Package lxml :: Package html :: Module diff :: Class token |
[hide private]
[frames] | no frames]

# Class token

source code

    object --+
             |
    basestring --+
                 |
           unicode --+
                     |
                    token

Known Subclasses:
  - href_token
  - , tag_token

Represents a diffable token, generally a word that is displayed to the user. Opening tags are attached to this token when they are adjacent (pre_tags) and closing tags that follow the word (post_tags). Some exceptions occur when there are empty tags adjacent to a word, so there may be close tags in pre_tags, or open tags in post_tags.

We also keep track of whether the word was originally followed by whitespace, even though we do not want to treat the word as equivalent to a similar word that does not have a trailing space.

Instance Methods | [hide private]
__repr__(self) repr(x) | source code
html(self) | source code
Inherited from `unicode`: `__add__`, `__contains__`, `__eq__`, `__format__`, `__ge__`, `__getattribute__`, `__getitem__`, `__getnewargs__`, `__getslice__`, `__gt__`, `__hash__`, `__le__`, `__len__`, `__lt__`, `__mod__`, `__mul__`, `__ne__`, `__rmod__`, `__rmul__`, `__sizeof__`, `__str__`, `capitalize`, `center`, `count`, `decode`, `encode`, `endswith`, `expandtabs`, `find`, `format`, `index`, `isalnum`, `isalpha`, `isdecimal`, `isdigit`, `islower`, `isnumeric`, `isspace`, `istitle`, `isupper`, `join`, `ljust`, `lower`, `lstrip`, `partition`, `replace`, `rfind`, `rindex`, `rjust`, `rpartition`, `rsplit`, `rstrip`, `split`, `splitlines`, `startswith`, `strip`, `swapcase`, `title`, `translate`, `upper`, `zfill` Inherited from `unicode` (private): `_formatter_field_name_split`, `_formatter_parser` Inherited from `object`: `__delattr__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__subclasshook__`

Static Methods | [hide private]
a new object with type S, a subtype of T |
__new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=`'````'`) | source code

Class Variables | [hide private]
| hide_when_equal = `False`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=`'````'`) Static Method | source code
Returns: a new object with type S, a subtype of T Overrides: object.__new__ (inherited documentation)

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)