xsdata.codegen.handlers.attribute_type module

class xsdata.codegen.handlers.attribute_type.AttributeTypeHandler(container, dependencies=<factory>)[source]

Bases: xsdata.codegen.mixins.HandlerInterface

Minimize class attributes complexity by filtering and flattening types.

Parameters
container: ContainerInterface
dependencies: Dict
process(target)[source]

Process the given class attributes and their types.

Ensure all types are unique.

Parameters

target (Class) –

process_type(target, attr, attr_type)[source]

Process attribute type, split process for xml schema and user defined types.

Ignore forward references to inner classes.

Parameters
classmethod process_native_type(attr, attr_type)[source]

Reset attribute type if the attribute has a pattern restriction as they are not yet supported.

Parameters
find_dependency(target, attr_type)[source]

Find dependency for the given attribute.

Avoid conflicts by search in order:
  1. Non element/complexType

  2. Non abstract

  3. anything

Parameters
Return type

Optional[Class]

process_dependency_type(target, attr, attr_type)[source]

Process user defined attribute types, split process between complex and simple types.

Reset absent attribute types with a warning.

Complex Type: xs:Element and xs:ComplexType Simple stype: the rest

Parameters
classmethod process_simple_dependency(source, target, attr, attr_type)[source]

Replace the given attribute type with the types of the single field source class.

Ignore enumerations and gracefully handle dump types with no attributes.

Raises

AnalyzerValueError if the source class has more than one attributes

Parameters
process_complex_dependency(source, target, attr_type)[source]

Update circular reference flag.

Parameters
is_circular_dependency(source, target, seen)[source]

Check if any source dependencies recursively match the target class.

Parameters
Return type

bool

cached_dependencies(source)[source]

Returns from cache the source class dependencies as a collection of qualified names.

Parameters

source (Class) –

Return type

Tuple[QName]

classmethod reset_attribute_type(attr_type)[source]

Reset the attribute type to native string.

Parameters

attr_type (AttrType) –