xsdata.codegen.utils module

class xsdata.codegen.utils.ClassUtils[source]

Bases: object

General reusable utils methods that didn’t fit anywhere else.

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

Copy the attributes and inner classes 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 copy_group_attributes(source, target, attr)[source]

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

Parameters
classmethod copy_extensions(source, target, extension)[source]

Copy the extensions from the source class to the target class and merge the restrictions from the extension that linked the two classes together.

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