~kf5jwc/sms-printer

ref: 4a1d852f9a38f157710d4950364292dee33c144f sms-printer/sms_printer/sms/schemas/__init__.py -rw-r--r-- 799 bytes View raw
4a1d852f — Kyle Jones Refactor for environment configuration 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

import types

from . import bandwidth_v1
from . import bandwidth_v2


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

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


__all__ = ['SCHEMAS', 'types']