dom¶
DOMDict¶
-
class
wysdom.dom.DOMDict(value: Optional[Mapping[str, Any]] = None, json_dom_info: Optional[DOMInfo] = None, item_type: Optional[Schema] = None)¶ Bases:
wysdom.dom.DOMObject.DOMObject,typing.GenericAn object with dynamic properties (corresponding to a Python dict).
Parameters:
DOMElement¶
-
class
wysdom.dom.DOMElement(value: Optional[Any] = None, json_dom_info: Optional[wysdom.dom.DOMElement.DOMInfo] = None, **kwargs)¶ Bases:
abc.ABCAbstract base class for any DOM element.
Parameters: - value – A data structure containing the data to populate this element.
- json_dom_info – A
DOMInfonamed tuple containing information about this object’s position in the DOM. - kwargs – Keyword arguments.
-
to_builtin() → Any¶ Returns the contents of this DOM object as a Python builtin. Return type varies depending on the specific object type.
DOMInfo¶
-
class
wysdom.dom.DOMInfo¶ Bases:
tupleNamed tuple containing information about a DOM element’s position within the DOM.
Parameters: - element – The
DOMElementthat this DOMInfo tuple provides information for. - document – The owning document for a
DOMElement, if it exists. - parent – The parent element of a
DOMElement, if it exists. - element_key – The key of a particular
DOMElementin its parent element, if it can be referred to by a key (i.e. if it its parent element is a Mapping).
Create new instance of DOMInfo(element, document, parent, element_key)
-
document¶ Alias for field number 1
-
element¶ Alias for field number 0
-
element_key¶ Alias for field number 3
-
parent¶ Alias for field number 2
- element – The
DOMList¶
-
class
wysdom.dom.DOMList(value: Iterable[T_co], json_dom_info: Optional[wysdom.dom.DOMElement.DOMInfo] = None, item_type: Optional[wysdom.base_schema.Schema.Schema] = None)¶ Bases:
wysdom.dom.DOMElement.DOMElement,collections.abc.MutableSequence,typing.GenericAn array element (corresponding to a Python list).
Parameters: -
insert(index: int, item: Any) → None¶ S.insert(index, value) – insert value before index
-
to_builtin() → List[Any]¶ Returns the contents of this DOM object as a Python builtin.
Returns: A Python list containing this object’s data
-
DOMObject¶
-
class
wysdom.dom.DOMObject(value: Mapping[str, Any] = None, json_dom_info: DOMInfo = None)¶ Bases:
wysdom.dom.DOMElement.DOMElement,collections.abc.MutableMappingAn object with named properties.
Parameters: - value – A dict (or any
collections.abc.Mapping) containing the data to populate this object’s properties. - json_dom_info – A
DOMInfonamed tuple containing information about this object’s position in the DOM.
-
to_builtin() → Dict[str, Any]¶ Returns the contents of this DOM object as a Python builtin.
Returns: A Python dict containing this object’s data
- value – A dict (or any
DOMProperties¶
-
class
wysdom.dom.DOMProperties(properties: Dict[str, wysdom.base_schema.Schema.Schema] = None, required: Set[str] = None, additional_properties: Union[bool, wysdom.base_schema.Schema.Schema] = False)¶ Bases:
objectA container for property information for a
DOMObject.Parameters: - properties – A dictionary of
Schemaobjects defining the expected names and types of aDOMObject’s properties. - required – A set of the property names that are required for an instance to be valid.
- additional_properties – Defines whether a
DOMObjectpermits additional dynamically-named properties. Can be True or False, or can be set to a specificSchemato restrict the permitted types of any additional properties.
-
additional_properties= False¶
-
properties= None¶
-
required= None¶
- properties – A dictionary of
functions¶
-
wysdom.dom.functions.document(element: wysdom.dom.DOMElement.DOMElement) → Optional[wysdom.dom.DOMElement.DOMElement]¶ Retrieve the owning document for a
DOMElement, if it exists.Parameters: element – A DOM element Returns: The owning document for that DOM element, or None if none exists
-
wysdom.dom.functions.dom(element: wysdom.dom.DOMElement.DOMElement) → wysdom.dom.DOMElement.DOMInfo¶ Retrieve a
DOMInfoobject for aDOMElementcontaining information about that element’s position in the DOM.Parameters: element – A DOM element Returns: The DOMInfoobject for that DOM element
-
wysdom.dom.functions.key(element: wysdom.dom.DOMElement.DOMElement) → Optional[str]¶ Retrieve the key of a particular
DOMElementin its parent element, if it can be referred to by a key (i.e. if it its parent element is acollections.abc.Mapping).Parameters: element – A DOM element Returns: The key of that DOM element in its parent, or None if it has no key
-
wysdom.dom.functions.parent(element: wysdom.dom.DOMElement.DOMElement) → Optional[wysdom.dom.DOMElement.DOMElement]¶ Retrieve the parent element of a
DOMElement, if it exists.Parameters: element – A DOM element Returns: The parent element of that DOM element, or None of none exists
-
wysdom.dom.functions.schema(element: wysdom.dom.DOMElement.DOMElement) → wysdom.base_schema.Schema.Schema¶ Retrieve the
Schemaobject for a particularDOMElement.Parameters: element – A DOM element Returns: The Schemaobject associated with that DOM element