schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes module¶
This module contains XSD types classes for xsdtypes package
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
is_datetime
(date_string, date_format='%Y-%m-%d')¶ Check if the string represents a valid datetime according to the specified formatting.
Parameters: - date_string – The string containing the datetime
- date_format – The reference formatting for datetime
Returns: True if the string is a valid datetime, False if not.
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDType
(name, python_type, validators=None, to_python=None, from_python=<class 'str'>)¶ Bases:
object
Base class for representing generic XSD types. Use this class for create XSD built-in types.
An instance contains a Python’s type transformation ana a list of validator functions.
Use Python’s types conversion:
Decoding from XML: python_type(value) Encoding to XML: str(value)-
is_list
()¶
-
validate
(value)¶ Validator for decoded values. :param value: The Python’s object that has to be validated
-
decode
(text)¶ Transform an XML text into a Python object. :param text: XML text
-
encode
(obj)¶ Transform a Python object into an XML string. :param obj: The Python object that has to be encoded in XML
-
basename
()¶ Get the name of the type without prefix or namespace URI.
-
get_rank
()¶ The rank of the XSDType-only instance (an XSD builtin type) is always 0.
-
get_lengths
(only_lists=True)¶
-
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDSimpleType
(base_type, elem, name=None, is_list=False, length=None, validators=None, enumeration=None)¶ Bases:
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType
A class for represent XSD schema simple type.
-
is_list
()¶
-
validate
(value)¶ Validator for decoded values. :param value: The Python’s object that has to be validated
-
decode
(text)¶ Transform an XML text into a Python object. :param text: XML text
-
encode
(obj)¶ Transform a Python object into an XML string. :param obj: The Python object that has to be encoded in XML
-
get_rank
()¶ Compute the pseudo-dimension of the XSDSimpleType, considering the dimension of the base type.
Returns: int
-
get_lengths
(only_lists=True)¶ Get the lengths defined for the XSD type.
Parameters: only_lists – Include lengths defined for other types. Returns: a list with defined lengths
-
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDComplexType
(base_type, elem, name=None, is_list=False, validators=None, enumeration=None, content_model=None, attributes=None)¶ Bases:
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDSimpleType
A class for represent XSD schema simple type.
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDElement
(name, path, xsd_type, attrib=None)¶ Bases:
object
Support structure to associate an element and its attributes with XSD simple types.
-
name
= None¶ The name is the element tag
-
path
= None¶ The XPath of this element
-
xsd_type
= None¶ XSD type of the element
-
attrib
= None¶ Attributes of element declaration (eg. minOccurs, default …)
-
basename
()¶ Get the name of the element without prefix or namespace URI.
-
get_type
()¶
-
is_optional
()¶
-
get_default
()¶
-
get_min_occurs
()¶
-
get_max_occurs
()¶
-
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDAttribute
(xsd_type, attrib=None)¶ Bases:
object
Support structure to associate an attribute with XSD simple types.
-
xsd_type
= None¶ XSD type of the attribute
-
attrib
= None¶ Attributes of attribute declaration (eg. use, default, …)
-
get_type
()¶
-
is_optional
()¶
-
get_default
()¶
-
-
class
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSDGroup
(name=None, group_type=None, attrib=None, *args, **kwargs)¶ Bases:
list
-
attrib
= None¶ Attributes of element declaration (eg. minOccurs, default …)
-
get_min_occurs
()¶
-
get_max_occurs
()¶
-
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_builtin_types_factory
(xsd_type_class=<class 'schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType'>, *args, **kwargs)¶ Build a dictionary for XSD builtin types mapping.
Parameters: - xsd_type_class – XSDType class for instances.
- args – List of tuples containing a single definition.
- kwargs – A dictionary with multiple built-in type declarations.
Returns: Dictionary that map a type name to a decoding type class instance
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSD_BUILTIN_TYPES
= {'QName': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cf28>, 'anyType': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123e5d4e0>, 'anyURI': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cf60>, 'boolean': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cf98>, 'byte': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5c940>, 'date': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cd30>, 'dateTime': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cd68>, 'decimal': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5c978>, 'double': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5c9b0>, 'duration': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cef0>, 'float': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ca58>, 'gDay': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cda0>, 'gMonth': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cdd8>, 'gMonthDay': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ce10>, 'gYear': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ce48>, 'gYearMonth': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ce80>, 'int': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ca90>, 'integer': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cac8>, 'long': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cb00>, 'negativeInteger': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cb38>, 'nonNegativeInteger': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cbe0>, 'nonPositiveInteger': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cba8>, 'positiveInteger': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cb70>, 'short': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cc18>, 'string': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5c908>, 'time': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ceb8>, 'unsignedByte': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cc50>, 'unsignedInt': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5cc88>, 'unsignedLong': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ccc0>, 'unsignedShort': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDType object at 0x7fd123c5ccf8>}¶ Dictionary for XSD built-in types mapping. The values are XSDType instances
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
XSI_ATTRIBUTES
= {'{http://www.w3.org/2001/XMLSchema-instance}noNamespaceSchemaLocation': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDAttribute object at 0x7fd123c71048>, '{http://www.w3.org/2001/XMLSchema-instance}schemaLocation': <schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.XSDAttribute object at 0x7fd123c5cfd0>}¶ XSI attributes for schema instances
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_simple_type_factory
(elem, **kwargs)¶ Factory function for XSD simple type declaration.
Parameters: elem – The ElementTree’s Element. It must be a simpleType declaration element. :param kwargs: Various lookup tables and parameters, dependant by the context where the function is called. :return: a couple with the type_name, that maybe an empty string, and the XSDSimpleType instance that represents the XSD declaration.
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_attribute_type_factory
(elem, **kwargs)¶ Factory function for XSD attribute declaration.
Parameters: elem – The ElementTree’s Element. It must be a attribute declaration element. :param kwargs: Various lookup tables and parameters, dependant by the context where the function is called. :return: a couple with the attribute name and the instance of XSDType associated with it.
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_complex_type_factory
(elem, **kwargs)¶ Factory function for XSD complex type declaration.
Parameters: elem – The ElementTree’s Element. It must be a complexType declaration element. :param kwargs: Various lookup tables and parameters, dependant by the context where the function is called. :return: a couple with the type_name, that maybe an empty string, and the XSDComplexType instance that represents the XSD declaration.
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_group_factory
(elem, **kwargs)¶
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_element_factory
(elem, xsd_element=None, **kwargs)¶ Factory function for XSD element declaration. The function walks through complexTypes to find declarations of descendant XSD elements.
Parameters: elem – The ElementTree’s Element. It must be an element declaration element. :param xsd_element: The complex type, if it’s already created. :param kwargs: Various lookup tables and parameters, dependant by the context where the function is called. An xsd_elements dictionary is needed as the destination of the XSD element declarations.
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
add_xsd_types_to_dict
(declarations, target_dict, factory_function, **kwargs)¶ Function to add XSD global types declarations. Unresolved references to other types in the list are retried until are completed.
Parameters: declarations – Sequence of XSD simpleType/complexType declarations. :param target_dict: Dictionary for type declarations. :param factory_function: Factory function to use. :param kwargs: Various arguments to pass to the factory function.
-
schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xsdtypes.
xsd_get_type
(type_name, xsd_types)¶ Lookup for a XSD type in XSD predefined built-in types map and in XML Schema types map.
Parameters: - type_name – XSD type name
- xsd_types – Map for XSD simple types
Returns: BaseXSDType/XSDSimpleType instance