typing
xsdata.formats.dataclass.typing
Result
Bases: NamedTuple
Analyze Result Object.
Source code in xsdata/formats/dataclass/typing.py
66 67 68 69 70 71 |
|
evaluate(tp, globalns, localns=None)
Analyze/Validate the typing annotation.
Source code in xsdata/formats/dataclass/typing.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
analyze_token_args(origin, args)
Analyze token arguments.
Ensure it only has one argument, filter out ellipsis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
origin | Any | The annotation origin | required |
args | tuple[Any, ...] | The annotation arguments | required |
Returns:
Type | Description |
---|---|
tuple[Any] | A tuple that contains only one arg |
Raises:
Type | Description |
---|---|
TypeError | If the origin is not list or tuple, and it has more than one argument |
Source code in xsdata/formats/dataclass/typing.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
analyze_optional_origin(origin, args, types)
Analyze optional type annotations.
Remove the NoneType, adjust and return the origin, args and types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
origin | Any | The annotation origin | required |
args | tuple[Any, ...] | The annotation arguments | required |
types | tuple[Any, ...] | The annotation types | required |
Returns:
Type | Description |
---|---|
tuple[Any, ...] | The old or new origin args and types. |
Source code in xsdata/formats/dataclass/typing.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
filter_none_type(args)
Filter out none types from args.
Source code in xsdata/formats/dataclass/typing.py
122 123 124 |
|
filter_ellipsis(args)
Filter out ellipsis from args.
Source code in xsdata/formats/dataclass/typing.py
127 128 129 |
|
evaluate_text(annotation, tokens=False)
Run exactly the same validations with attribute.
Source code in xsdata/formats/dataclass/typing.py
132 133 134 |
|
evaluate_attribute(annotation, tokens=False)
Validate annotations for a xml attribute.
Source code in xsdata/formats/dataclass/typing.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
evaluate_attributes(annotation, **_)
Validate annotations for xml wildcard attributes.
Source code in xsdata/formats/dataclass/typing.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
evaluate_element(annotation, tokens=False)
Validate annotations for a xml element.
Source code in xsdata/formats/dataclass/typing.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
evaluate_elements(annotation, **_)
Validate annotations for a xml compound field.
Source code in xsdata/formats/dataclass/typing.py
239 240 241 242 243 244 245 246 247 248 249 250 |
|
evaluate_wildcard(annotation, **_)
Validate annotations for a xml wildcard.
Source code in xsdata/formats/dataclass/typing.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|