gnomish_army_knife.database package#
Submodules#
gnomish_army_knife.database.combat_log module#
A module implementing a combat-log state data structure.
- class gnomish_army_knife.database.combat_log.CombatLogState(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None, schemas: SchemaMap = None, dest_attr: str = 'data', verify: bool = True)[source]#
Bases:
GakDictCodec,BasicDictCodec,LoggerMixinThe top-level configuration object for the package.
- property files: dict[str, Any]#
Get combat log file data.
- init(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]]) None[source]#
Initialize this instance.
- process_event(key: str, event: CombatLogEvent) None[source]#
Process a combat-log event.
gnomish_army_knife.database.event module#
A module implementing interfaces for combat log events.
- class gnomish_army_knife.database.event.CombatLogEvent(timestamp: datetime, name: str, data: list[str], line: str)[source]#
Bases:
NamedTupleA simple container for combat log events.
- data: list[str]#
Alias for field number 2
- static from_json(data: dict[str, Any]) CombatLogEvent[source]#
Create an event from JSON message data.
- static from_line(line: str) CombatLogEvent[source]#
Create an event from a string line.
- line: str#
Alias for field number 3
- static log_handler(logger: Logger | LoggerAdapter[Any]) Callable[[CombatLogEvent], None][source]#
Create a simple event handler.
- name: str#
Alias for field number 1
- timestamp: datetime#
Alias for field number 0
gnomish_army_knife.database.meta module#
A module implementing an arena-match metadata interface.
- class gnomish_army_knife.database.meta.ArenaMatchMetadata[source]#
Bases:
LoggerMixinA class implementing an arena-match metadata interface.
- file_path(base: Path, suffix: str = '.txt') Path | None[source]#
Get a file path this match could be written to. This path should be unique for any match that occurs on live servers.
- handle(event: CombatLogEvent) bool[source]#
Attempt to glean new metadata from this event. Returns whether or not the end of a match has been captured.
- property summary: str#
A summary string for this match.
gnomish_army_knife.database.queue module#
A module implementing a simple queue-handler event interface.
- class gnomish_army_knife.database.queue.CombatLogQueueHandler[source]#
Bases:
objectA simple mixin class for handling combat log events via per-event handlers and queue handlers.
- handle(event: CombatLogEvent) None[source]#
Handle a combat-log event.
- register(queue: Queue[CombatLogEvent]) int[source]#
Register a queue.
- registered(queue: Queue[CombatLogEvent]) Iterator[None][source]#
Register a queue as a managed context.
gnomish_army_knife.database.writer module#
A module implementing an arena-match file-writing interface.
- class gnomish_army_knife.database.writer.ArenaMatchWriter(root: Path | str | None)[source]#
Bases:
LoggerMixinA class capable of writing individual arena match events to disk.
- async handle(event: CombatLogEvent) bool[source]#
Returns true if the arena-match-writer consumed the event.
Module contents#
A module implementing a database interface for the package.
- class gnomish_army_knife.database.ArenaMatchDb(stack: ExitStack, root: Path)[source]#
Bases:
LoggerMixinA class implementing a top-level program database interface.
- property combat_log_state_path: Path#
Get the path to the combat-log state data.
- create_writer() ArenaMatchWriter[source]#
Create an arena-match writer interface.
- ext = 'json'#
- property matchdb_path: Path#
The path to the matchdb directory.