xsdata.formats.dataclass.filters module¶
-
class
xsdata.formats.dataclass.filters.
Filters
(class_aliases=<factory>, field_aliases=<factory>, package_aliases=<factory>, module_aliases=<factory>, class_case=<function pascal_case>, field_case=<function snake_case>, package_case=<function snake_case>, module_case=<function snake_case>, class_safe_prefix='type', field_safe_prefix='value', package_safe_prefix='pkg', module_safe_prefix='mod', docstring_style=<DocstringStyle.RST: 'reStructuredText'>, max_line_length=79)[source]¶ Bases:
object
- Parameters
class_aliases (
Dict
) –field_aliases (
Dict
) –package_aliases (
Dict
) –module_aliases (
Dict
) –class_case (
Callable
) –field_case (
Callable
) –package_case (
Callable
) –module_case (
Callable
) –class_safe_prefix (
str
) –field_safe_prefix (
str
) –package_safe_prefix (
str
) –module_safe_prefix (
str
) –docstring_style (
DocstringStyle
) –max_line_length (
int
) –
-
class_aliases
: Dict¶
-
field_aliases
: Dict¶
-
package_aliases
: Dict¶
-
module_aliases
: Dict¶
-
docstring_style
: xsdata.models.config.DocstringStyle = 'reStructuredText'¶
-
cache
: Dict¶
-
class_name
(name)[source]¶ Convert the given string to a class name according to the selected conventions or use an existing alias.
-
field_name
(name)[source]¶ Convert the given string to a field name according to the selected conventions or use an existing alias.
-
module_name
(name)[source]¶ Convert the given string to a module name according to the selected conventions or use an existing alias.
-
package_name
(name)[source]¶ Convert the given string to a package name according to the selected conventions or use an existing alias.
-
field_metadata
(attr, parent_namespace, parents)[source]¶ Return a metadata dictionary for the given attribute.
-
field_choices
(attr, parent_namespace, parents)[source]¶ Return a list of metadata dictionaries for the choices of the given attribute.
Return None if attribute has no choices.
-
format_string
(data, indent, key='', pad=0)[source]¶ Return a pretty string representation of a string.
If the total length of the input string plus indent plus the key length and the additional pad is more than the max line length, wrap the text into multiple lines, avoiding breaking long words
-
text_wrap
(string, offset=0)[source]¶ Wrap text in respect to the max line length and the given offset.
-
field_default_value
(attr, ns_map=None)[source]¶ Generate the field default value/factory for the given attribute.
-
choice_type
(choice, parents)[source]¶ Generate type hints for the given choice.
Choices support a subset of features from normal attributes. First of all we don’t have a proper type hint but a type metadata key. That’s why we always need to wrap as Type[xxx]. The second big difference is that our choice belongs to a compound field that might be a list, that’s why list restriction is also ignored.
- Parameters
choice (
AttrChoice
) –
- Return type
-
classmethod
default_imports
(output)[source]¶ Generate the default imports for the given package output.
-
classmethod
from_config
(config)[source]¶ - Parameters
config (
GeneratorConfig
) –- Return type