AdvancedHTMLParser.SpecialAttributes
index
/home/media/projects/AdvancedHTMLParser/AdvancedHTMLParser/SpecialAttributes.py

# Copyright (c) 2015 Tim Savannah under LGPLv3. 
# See LICENSE (https://gnu.org/licenses/lgpl-3.0.txt) for more information.
#
# These are various helpers for "special" attributes

 
Classes
       
builtins.dict(builtins.object)
SpecialAttributesDict
builtins.object
StyleAttribute

 
class SpecialAttributesDict(builtins.dict)
    SpecialAttributesDict - A dictionary that supports the various special members, to allow javascript like syntax
 
 
Method resolution order:
SpecialAttributesDict
builtins.dict
builtins.object

Methods defined here:
__getitem__(self, key)
__init__(self, tag)
# A dict that supports returning special members
__setitem__(self, key, value)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.dict:
__contains__(self, key, /)
True if D has a key k, else False.
__delitem__(self, key, /)
Delete self[key].
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__gt__(self, value, /)
Return self>value.
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
__repr__(self, /)
Return repr(self).
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(iterable, value=None, /) from builtins.type
Returns a new dict with keys from iterable and values equal to value.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
items(...)
D.items() -> a set-like object providing a view on D's items
keys(...)
D.keys() -> a set-like object providing a view on D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]
values(...)
D.values() -> an object providing a view on D's values

Data and other attributes inherited from builtins.dict:
__hash__ = None

 
class StyleAttribute(builtins.object)
    StyleAttribute - Represents the "style" field on a tag.
 
  Methods defined here:
__getattribute__(self, name)
__init__(self, styleValue)
__repr__(self)
__setattr__(self, name, val)
__str__(self)
getStyle(self, styleName)
getStyle - Gets the value of a style paramater, part of the "style" attribute
 
@param styleName - The name of the style
 
@return - String of the value of the style. '' is no value.
getStyleDict(self)
setStyle(self, styleName, styleValue)
setStyle - Sets a style param. Example: "display", "block"
 
    If you need to set many styles on an element, use setStyles instead. 
    It takes a dictionary of attribute, value pairs and applies it all in one go (faster)
 
    To remove a style, set its value to empty string.
    When all styles are removed, the "style" attribute will be nullified.
 
@param styleName - The name of the style element
@param styleValue - The value of which to assign the style element
 
@return - String of current value of "style" after change is made.
setStyles(self, styleUpdatesDict)
setStyles - Sets one or more style params. 
    This all happens in one shot, so it is much much faster than calling setStyle for every value.
 
    To remove a style, set its value to empty string.
    When all styles are removed, the "style" attribute will be nullified.
 
@param styleUpdatesDict - Dictionary of attribute : value styles.
 
@return - String of current value of "style" after change is made.

Static methods defined here:
styleToDict(styleStr)
getStyleDict - Gets a dictionary of style attribute/value pairs.
 
@return - OrderedDict of "style" attribute.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
RESERVED_ATTRIBUTES = ('_styleValue', '_styleDict', '_asStr')