Twisted
Home FAQ Docs Download Timeline Roadmap View Tickets Search
class documentation

Better token wrapper for tokenize module.

Example usage: >>> from token import NAME >>> t = Token(NAME, 'foo', (1, 0), (1, 3), 'foo = 1') >>> t.kind 1 >>> t.value 'foo' >>> t.start (1, 0) >>> t.end (1, 3) >>> t.source 'foo = 1' >>> t == NAME True >>> t == 'foo' True >>> t == ['foo'] # Not matching kind+value, returns False False >>> t == None False >>> t.match(NAME, 'foo') True >>> repr(t) "<Token kind='NAME' value='foo'>" >>> t == 3.14 False

Method __eq__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method match Undocumented
Instance Variable end Undocumented
Instance Variable kind Undocumented
Instance Variable source Source line
Instance Variable start Undocumented
Instance Variable value Undocumented
def __eq__(self, other: Any) -> bool: (source)

Undocumented

def __init__(self, kind: int, value: str, start: tuple[int, int], end: tuple[int, int], source: str): (source)

Undocumented

def __repr__(self) -> str: (source)

Undocumented

def match(self, *conditions: Any) -> bool: (source)

Undocumented

Undocumented

Undocumented

Source line

Undocumented

Undocumented