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,Generic[wysdom.dom.DOMDict.T_co]An 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: Any)¶ 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.
-
abstract
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(element: Optional[DOMElement] = None, document: Optional[DOMElement] = None, parent: Optional[DOMElement] = None, element_key: Optional[str] = None)¶ 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)
-
property
document¶ Alias for field number 1
-
property
element¶ Alias for field number 0
-
property
element_key¶ Alias for field number 3
-
property
parent¶ Alias for field number 2
DOMList¶
-
class
wysdom.dom.DOMList(value: Iterable, 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,Generic[wysdom.dom.DOMList.T_co]An 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
DOMProperties¶
-
class
wysdom.dom.DOMProperties(properties: Optional[Dict[str, wysdom.base_schema.Schema.Schema]] = None, required: Optional[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: Union[bool, wysdom.base_schema.Schema.Schema] = False¶
-
properties: Dict[str, wysdom.base_schema.Schema.Schema] = None¶
-
required: Set[str] = None¶
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