vacuum_inner_classes
xsdata.codegen.handlers.vacuum_inner_classes
VacuumInnerClasses
Bases: HandlerInterface
Cleanup nested classes.
Search and vacuum inner classes with no attributes or a single extension or rename inner classes that have the same name as the outer/parent class.
Cases
- Filter duplicate inner classes
- Removing identical overriding fields can sometimes leave a class bare with just an extension. For inner classes we can safely replace the forward reference with the inner extension reference.
- Empty nested complexContent with no restrictions or extensions, we can replace these references with xs:anySimpleType
Source code in xsdata/codegen/handlers/vacuum_inner_classes.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 |
|
process(target)
Process entrypoint for classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
Source code in xsdata/codegen/handlers/vacuum_inner_classes.py
27 28 29 30 31 32 33 34 35 36 37 38 |
|
remove_inner(target, inner)
classmethod
Remove inner class and update the target class attrs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
inner | Class | The nested class instance | required |
Source code in xsdata/codegen/handlers/vacuum_inner_classes.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
rename_inner(target, inner)
classmethod
Rename the inner class and update the target class attrs.
The inner class will get the Inner suffix
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
inner | Class | The nested class instance | required |
Source code in xsdata/codegen/handlers/vacuum_inner_classes.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
find_attr_types(target, qname)
classmethod
Find attr and choice types by the qualified name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
qname | str | The qualified name | required |
Source code in xsdata/codegen/handlers/vacuum_inner_classes.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|