more abc
This commit is contained in:
parent
8fdf263e4b
commit
d07cbb2b10
@ -11,7 +11,7 @@ from owrx.config import Config
|
|||||||
from owrx.metrics import Metrics, CounterMetric, DirectMetric
|
from owrx.metrics import Metrics, CounterMetric, DirectMetric
|
||||||
from owrx.pskreporter import PskReporter
|
from owrx.pskreporter import PskReporter
|
||||||
from owrx.parser import Parser
|
from owrx.parser import Parser
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABC, ABCMeta, abstractmethod
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -333,13 +333,17 @@ class WsjtParser(Parser):
|
|||||||
metric.inc()
|
metric.inc()
|
||||||
|
|
||||||
|
|
||||||
class Decoder(object):
|
class Decoder(ABC):
|
||||||
def parse_timestamp(self, instring, dateformat):
|
def parse_timestamp(self, instring, dateformat):
|
||||||
ts = datetime.strptime(instring, dateformat)
|
ts = datetime.strptime(instring, dateformat)
|
||||||
return int(
|
return int(
|
||||||
datetime.combine(datetime.utcnow().date(), ts.time()).replace(tzinfo=timezone.utc).timestamp() * 1000
|
datetime.combine(datetime.utcnow().date(), ts.time()).replace(tzinfo=timezone.utc).timestamp() * 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def parse(self, msg, dial_freq):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Jt9Decoder(Decoder):
|
class Jt9Decoder(Decoder):
|
||||||
locator_pattern = re.compile("[A-Z0-9]+\\s([A-Z0-9]+)\\s([A-R]{2}[0-9]{2})$")
|
locator_pattern = re.compile("[A-Z0-9]+\\s([A-Z0-9]+)\\s([A-R]{2}[0-9]{2})$")
|
||||||
|
Loading…
Reference in New Issue
Block a user