~kf5jwc/sms-printer

ref: 6a2e6e2b7591ba972574af4054db55dbf969bba0 sms-printer/sms_printer/sms/schemas/__init__.py -rw-r--r-- 799 bytes View raw
6a2e6e2b — Kyle Jones Code linters are great. 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
This module provides the filtering and parsing. They currently only
provide a list of messages with the sender number and message text.

Each module has a `SCHEMA` and a `Parser(Parser_Base)`

The `SCHEMA` is matched against incoming messages to determine the
correct parser to use for a message.

Adding more is simple enough. Define a new parser and its schema in
its own module next to the others, and add it to `SCHEMAS` here.

I use `genson` to generate schemas based on an example message.
"""


from typing import Dict, Type

from . import types

from . import bandwidth_v1
from . import bandwidth_v2


SCHEMAS: Dict[str, Type[types.Parser_Base]] = {}

SCHEMAS[bandwidth_v1.SCHEMA] = bandwidth_v1.Parser
SCHEMAS[bandwidth_v2.SCHEMA] = bandwidth_v2.Parser


__all__ = ["SCHEMAS", "types"]