~kf5jwc/sms-printer

ref: 88d91e19f2499a3933341a270f81e30ebc048ac3 sms-printer/sms_printer/sms/schemas/__init__.py -rw-r--r-- 778 bytes View raw
88d91e19 — Kyle Jones Refactor for adding JSON schema based parsing 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(sms_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: Dict[str, Type[types.sms_base]] = {}

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


__all__ = ['SCHEMAS', 'types']