kopia lustrzana https://github.com/glidernet/ogn-python
Rename module ogn.exceptions to ogn.parser.exceptions
rodzic
756ac0e337
commit
2012310ad2
|
@ -1,7 +1,7 @@
|
|||
from datetime import datetime
|
||||
|
||||
from .model import Beacon, AircraftBeacon, ReceiverBeacon
|
||||
from ogn.exceptions import AprsParseError
|
||||
from ogn.parser.exceptions import AprsParseError
|
||||
|
||||
|
||||
def parse_aprs(packet, reference_date=None):
|
||||
|
|
|
@ -4,7 +4,7 @@ from time import time
|
|||
|
||||
from ogn.gateway import settings
|
||||
from ogn.aprs_parser import parse_aprs
|
||||
from ogn.exceptions import AprsParseError, OgnParseError, AmbigousTimeError
|
||||
from ogn.parser.exceptions import AprsParseError, OgnParseError, AmbigousTimeError
|
||||
|
||||
|
||||
def create_aprs_login(user_name, pass_code, app_name, app_version, aprs_filter=None):
|
||||
|
|
|
@ -4,7 +4,7 @@ from sqlalchemy import Column, String, Integer, Float, Boolean, SmallInteger
|
|||
|
||||
from ogn.parser.utils import fpm2ms
|
||||
from .beacon import Beacon
|
||||
from ogn.exceptions import OgnParseError
|
||||
from ogn.parser.exceptions import OgnParseError
|
||||
|
||||
|
||||
class AircraftBeacon(Beacon):
|
||||
|
|
|
@ -5,7 +5,7 @@ from sqlalchemy import Column, String, Integer, Float, DateTime
|
|||
from sqlalchemy.ext.declarative import AbstractConcreteBase
|
||||
|
||||
from ogn.parser.utils import createTimestamp, dmsToDeg, kts2kmh, feet2m
|
||||
from ogn.exceptions import AprsParseError
|
||||
from ogn.parser.exceptions import AprsParseError
|
||||
from .base import Base
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import re
|
|||
from sqlalchemy import Column, Float, String
|
||||
|
||||
from .beacon import Beacon
|
||||
from ogn.exceptions import OgnParseError
|
||||
from ogn.parser.exceptions import OgnParseError
|
||||
|
||||
|
||||
class ReceiverBeacon(Beacon):
|
||||
|
|
|
@ -9,17 +9,16 @@ class AprsParseError(Exception):
|
|||
def __init__(self, aprs_string):
|
||||
self.aprs_string = aprs_string
|
||||
|
||||
self.message = "This is not a valid APRS string: {}".format(aprs_string)
|
||||
self.message = "This is not a valid APRS packet: {}".format(aprs_string)
|
||||
super(AprsParseError, self).__init__(self.message)
|
||||
|
||||
|
||||
class OgnParseError(Exception):
|
||||
"""Parse error while parsing an aprs packet substring."""
|
||||
def __init__(self, substring, expected_type):
|
||||
self.substring = substring
|
||||
self.expected_type = expected_type
|
||||
"""Parse error while parsing an ogn message from aprs comment."""
|
||||
def __init__(self, aprs_comment):
|
||||
self.aprs_comment = aprs_comment
|
||||
|
||||
self.message = "For type {} this is not a valid token: {}".format(expected_type, substring)
|
||||
self.message = "This is not a valid OGN message: {}".format(aprs_comment)
|
||||
super(OgnParseError, self).__init__(self.message)
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ from datetime import datetime
|
|||
|
||||
from ogn.parser.utils import ms2fpm
|
||||
from ogn.model import Beacon, AircraftBeacon
|
||||
from ogn.exceptions import OgnParseError
|
||||
from ogn.parser.exceptions import OgnParseError
|
||||
|
||||
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
|
|
|
@ -4,7 +4,7 @@ from datetime import datetime
|
|||
|
||||
from ogn.parser.utils import dmsToDeg, kts2kmh, m2feet
|
||||
from ogn.model import Beacon
|
||||
from ogn.exceptions import AprsParseError
|
||||
from ogn.parser.exceptions import AprsParseError
|
||||
|
||||
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import unittest
|
||||
|
||||
from ogn.model import ReceiverBeacon
|
||||
from ogn.exceptions import OgnParseError
|
||||
from ogn.parser.exceptions import OgnParseError
|
||||
|
||||
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||
from time import sleep
|
||||
|
||||
from ogn.aprs_parser import parse_aprs
|
||||
from ogn.exceptions import AprsParseError, OgnParseError
|
||||
from ogn.parser.exceptions import AprsParseError, OgnParseError
|
||||
|
||||
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
|
|
Ładowanie…
Reference in New Issue