xsdata.utils.classes module

class xsdata.utils.classes.ClassUtils[source]

Bases: object

INCLUDES_NONE = 0
INCLUDES_SOME = 1
INCLUDES_ALL = 2
classmethod compare_attributes(source, target)[source]
Parameters
Return type

int

classmethod sanitize_attributes(target)[source]
Parameters

target (Class) –

classmethod sanitize_attribute(attr)[source]
Parameters

attr (Attr) –

classmethod sanitize_restrictions(restrictions)[source]
Parameters

restrictions (Restrictions) –

classmethod sanitize_attribute_sequence(attrs, index)[source]

Reset the attribute at the given index if it has no siblings with the sequential restriction.

Parameters
classmethod sanitize_attribute_name(attrs, index)[source]

Check if the attribute at the given index has a duplicate name and prepend if exists the attribute namespace.

Parameters
classmethod merge_duplicate_attributes(target)[source]

Flatten duplicate attributes.

Remove duplicate fields in case of attributes or enumerations otherwise convert fields to lists.

Parameters

target (Class) –

classmethod copy_attributes(source, target, extension)[source]
Parameters
classmethod clone_attribute(attr, restrictions, prefix=None)[source]
Parameters
Return type

Attr

classmethod merge_attribute_type(source, target, attr, attr_type)[source]
Parameters
classmethod copy_inner_classes(source, target)[source]

Copy inner classes from source to target class.

Check for duplicates by name and skip if it already exists.

Parameters
classmethod merge_redefined_classes(classes)[source]

Merge original and redefined classes.

Parameters

classes (List[Class]) –

classmethod update_abstract_classes(classes)[source]

Update classes with the same qualified name to set implied abstract flags.

If a non abstract xs:element exists in the list mark the rest xs:complexType(s) as abstract.

Parameters

classes (List[Class]) –

classmethod create_mixed_attribute(target)[source]
Parameters

target (Class) –

classmethod create_default_attribute(item, extension)[source]
Parameters
classmethod create_reference_attribute(source, qname)[source]
Parameters
  • source (Class) –

  • qname (QName) –

Return type

Attr

classmethod find_attribute(attrs, attr)[source]
Parameters
Return type

int

classmethod reset_attribute_type(attr_type)[source]
Parameters

attr_type (AttrType) –