Skip to content

Module treefrog.organize

None

None

View Source
from pathlib import Path

from typing import Sequence

from slippi.game import Game

from ..parse import Parser

from ..parse.parsers import matchup, month, stage, year

Ordering = Sequence[Parser]

default_ordering = (year, month, matchup, stage)

def build_parent(game: Game, ordering: Ordering = default_ordering) -> Path:

    parent = Path()

    for parser in ordering:

        parent /= str(parser(game))

    return parent

Variables

1
Ordering
1
default_ordering

Functions

build_parent

1
2
3
4
def build_parent(
    game: slippi.game.Game,
    ordering: Sequence[Callable[[slippi.game.Game], str]] = (<function year at 0x7f8f942ecdc0>, <function month at 0x7f8f942ece50>, <function matchup at 0x7f8f942b4dc0>, <function stage at 0x7f8f942ecca0>)
) -> pathlib.Path
View Source
def build_parent(game: Game, ordering: Ordering = default_ordering) -> Path:

    parent = Path()

    for parser in ordering:

        parent /= str(parser(game))

    return parent