Module treefrog.parse
None
None
View Source
from .parsers import day, hour, matchup, minute, month, second, stage, timestamp, year
from .utils import ParseError, Parser
__all__ = (
"matchup",
"stage",
"timestamp",
"year",
"month",
"day",
"hour",
"minute",
"second",
"Parser",
"ParseError",
)
Sub-modules
Variables
Functions
day
| def day(
game: 'Game'
) -> 'str'
|
View Source
def day(game: Game) -> str:
return str(game.metadata.date.day)
hour
| def hour(
game: 'Game'
) -> 'str'
|
View Source
def hour(game: Game) -> str:
return str(game.metadata.date.hour)
matchup
| def matchup(
game: 'Game'
) -> 'str'
|
View Source
def matchup(game: Game) -> str:
c1, c2 = tuple(characters(game))
return f"{character_name(c1)} vs {character_name(c2)}"
minute
| def minute(
game: 'Game'
) -> 'str'
|
View Source
def minute(game: Game) -> str:
return str(game.metadata.date.minute)
month
| def month(
game: 'Game'
) -> 'str'
|
View Source
def month(game: Game) -> str:
return calendar.month_name[game.metadata.date.month]
second
| def second(
game: 'Game'
) -> 'str'
|
View Source
def second(game: Game) -> str:
return str(game.metadata.date.second)
stage
| def stage(
game: 'Game'
) -> 'str'
|
View Source
def stage(game: Game) -> str:
return stage_name(game.start.stage)
timestamp
| def timestamp(
game: 'Game'
) -> 'str'
|
View Source
def timestamp(game: Game) -> str:
utc_dt = game.metadata.date
dt = utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None)
return f"{dt.year}{dt.month:02}{dt.day:02}T{dt.hour:02}{dt.minute:02}{dt.second:02}"
year
| def year(
game: 'Game'
) -> 'str'
|
View Source
def year(game: Game) -> str:
return str(game.metadata.date.year)
Classes
ParseError
| class ParseError(
message,
filename=None,
pos=None
)
|
View Source
class ParseError(IOError):
def __init__(self, message, filename = None, pos = None):
super().__init__(message)
self.filename = filename
self.pos = pos
def __str__(self):
return 'Parse error (%s %s): %s' % (
self.filename or '?',
'@0x%x' % self.pos if self.pos else '?',
super().__str__())
Ancestors (in MRO)
- builtins.OSError
- builtins.Exception
- builtins.BaseException
Class variables
Methods
with_traceback
| def with_traceback(
...
)
|
Exception.with_traceback(tb) --
set self.traceback to tb and return self.