xsdata.codegen.utils module

class xsdata.codegen.utils.ClassUtils[source]

Bases: object

classmethod copy_attributes(source, target, extension)[source]

Copy the attributes from the source class to the target class and remove the extension that links the two classes together.

The new attributes are prepended in the list unless if they are supposed to be last in a sequence.

Parameters
classmethod clone_attribute(attr, restrictions, prefix=None)[source]

Clone the given attribute and merge its restrictions with the given instance.

Prepend the given namespace prefix to the attribute name if available.

Parameters
Return type

Attr

classmethod copy_inner_classes(source, target)[source]

Copy safely inner classes from source to target class.

Checks:
  1. Inner is the target class, skip and mark as self reference

  2. Inner with same name exists, skip

Parameters
classmethod find_attribute(attrs, attr)[source]

Return the position of the given attribute in the list.

Parameters
Return type

int