mixins
xsdata.formats.mixins
GeneratorResult
Bases: NamedTuple
Generator result transfer object.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
The target file path |
title |
str
|
The result title for misc usage |
source |
str
|
The source code/output to be written |
Source code in xsdata/formats/mixins.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
AbstractGenerator
Bases: ABC
Abstract code generator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
GeneratorConfig
|
The generator config instance |
required |
Source code in xsdata/formats/mixins.py
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 | |
__init__(config)
Initialize the generator.
Source code in xsdata/formats/mixins.py
38 39 40 | |
module_name(module)
Convert the given module name to match the generator conventions.
Source code in xsdata/formats/mixins.py
42 43 44 | |
package_name(package)
Convert the given module name to match the generator conventions.
Source code in xsdata/formats/mixins.py
46 47 48 | |
render(classes)
abstractmethod
Return an iterator of the generated results.
Source code in xsdata/formats/mixins.py
50 51 52 | |
group_by_package(classes)
classmethod
Group the given list of classes by the target package directory.
Source code in xsdata/formats/mixins.py
54 55 56 57 | |
group_by_module(classes)
classmethod
Group the given list of classes by the target module directory.
Source code in xsdata/formats/mixins.py
59 60 61 62 | |
render_header()
Generate a header for the writer to prepend on the output files.
Source code in xsdata/formats/mixins.py
64 65 66 67 68 69 70 71 72 73 74 75 | |
normalize_packages(classes)
Normalize the classes module and package names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
classes
|
list[Class]
|
A list of class instances |
required |
Raises:
| Type | Description |
|---|---|
CodeGenerationError
|
If the analyzer failed to designate a class to a package and module. |
Source code in xsdata/formats/mixins.py
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 | |