~kf5jwc/sms-printer

ref: 88d91e19f2499a3933341a270f81e30ebc048ac3 sms-printer/sms_printer/sms/schemas/types.py -rw-r--r-- 482 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
from typing import List


class sms(object):
    sender: str
    text: str

    def __init__(self, sender: str, text: str) -> None:
        self.sender = sender
        self.text = text


class sms_base(object):
    schema: str
    messages: List[sms]

    def __init__(self, sms_input):
        pass

    def __iter__(self):
        return self

    def __next__(self) -> sms:
        if not bool(self.messages):
            raise StopIteration
        return self.messages.pop(0)