mixins
xsdata.codegen.mixins
ContainerInterface
Bases: ABC
A class list wrapper with an easy access api.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config | GeneratorConfig | The generator configuration instance | required |
Source code in xsdata/codegen/mixins.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
__init__(config)
Initialize the container.
Source code in xsdata/codegen/mixins.py
19 20 21 22 |
|
__iter__()
abstractmethod
Yield an iterator for the class map values.
Source code in xsdata/codegen/mixins.py
24 25 26 |
|
process()
abstractmethod
Run the processor and filter steps.
Source code in xsdata/codegen/mixins.py
28 29 30 |
|
find(qname, condition=return_true)
abstractmethod
Find class that matches the given qualified name and condition callable.
Classes are allowed to have the same qualified name, e.g. xsd:Element extending xsd:ComplexType with the same name, you can provide and additional callback to filter the classes like the tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qname | str | The qualified name of the class | required |
condition | Callable | A user callable to filter further | return_true |
Returns:
Type | Description |
---|---|
Optional[Class] | A class instance or None if no match found. |
Source code in xsdata/codegen/mixins.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
find_inner(source, qname)
abstractmethod
Search by qualified name for a specific inner class or fail.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source | Class | The source class to search for the inner class | required |
qname | str | The qualified name of the inner class to look up | required |
Returns:
Type | Description |
---|---|
Class | The inner class instance |
Raises:
Type | Description |
---|---|
CodeGenerationError | If the inner class is not found. |
Source code in xsdata/codegen/mixins.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
first(qname)
abstractmethod
Return the first class that matches the qualified name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qname | str | The qualified name of the class | required |
Returns:
Type | Description |
---|---|
Class | The first matching class |
Raises:
Type | Description |
---|---|
KeyError | If no class matches the qualified name |
Source code in xsdata/codegen/mixins.py
63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
add(item)
abstractmethod
Add class instance to the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | Class | The class instance to add | required |
Source code in xsdata/codegen/mixins.py
77 78 79 80 81 82 83 |
|
remove(*items)
abstractmethod
Safely remove classes from the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items | Class | The classes to remove | () |
Source code in xsdata/codegen/mixins.py
85 86 87 88 89 90 91 |
|
extend(items)
abstractmethod
Add a list of classes to the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items | list[Class] | The list of class instances to add | required |
Source code in xsdata/codegen/mixins.py
93 94 95 96 97 98 99 |
|
reset(item, qname)
abstractmethod
Update the given class qualified name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | Class | The target class instance to update | required |
qname | str | The new qualified name of the class | required |
Source code in xsdata/codegen/mixins.py
101 102 103 104 105 106 107 108 |
|
set(items)
abstractmethod
Set the list of classes to the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items | list[Class] | The list of classes | required |
Source code in xsdata/codegen/mixins.py
110 111 112 113 114 115 116 |
|
HandlerInterface
Bases: ABC
Class handler interface.
Source code in xsdata/codegen/mixins.py
119 120 121 122 123 124 125 126 127 128 129 130 |
|
process(target)
abstractmethod
Process the given target class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
Source code in xsdata/codegen/mixins.py
124 125 126 127 128 129 130 |
|
RelativeHandlerInterface
Bases: HandlerInterface
, ABC
An interface for codegen handlers with class container access.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container | ContainerInterface | The container instance | required |
Source code in xsdata/codegen/mixins.py
133 134 135 136 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 170 171 172 173 174 175 176 |
|
__init__(container)
Initialize the class.
Source code in xsdata/codegen/mixins.py
142 143 144 |
|
base_attrs(target)
Return a list of all parent attrs recursively.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class | required |
Returns:
Type | Description |
---|---|
list[Attr] | A list of attr instances. |
Source code in xsdata/codegen/mixins.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
process(target)
abstractmethod
Process entrypoint for a class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
Source code in xsdata/codegen/mixins.py
170 171 172 173 174 175 176 |
|
ContainerHandlerInterface
Bases: ABC
A codegen interface for processing the whole class container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container | ContainerInterface | The class container instance | required |
Source code in xsdata/codegen/mixins.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
__init__(container)
Initialize the class.
Source code in xsdata/codegen/mixins.py
188 189 190 |
|
run()
abstractmethod
Run the process for the whole container.
Source code in xsdata/codegen/mixins.py
192 193 194 |
|