move common package to root level

This commit is contained in:
Junzi Sun 2020-05-03 23:27:17 +02:00
parent fe9e033a64
commit 5286355bf6
8 changed files with 12 additions and 16 deletions

View File

@ -8,7 +8,7 @@ ext:
python setup.py build_ext --inplace
test:
python -m pytest
python -m pytest tests
clean:
find pyModeS/decoder -type f -name '*.c' -delete

View File

@ -2,11 +2,11 @@ import os
import warnings
try:
from .decoder import c_common as common
from .decoder.c_common import *
from . import c_common as common
from .c_common import *
except:
from .decoder import common
from .decoder.common import *
from . import common
from .common import *
from .decoder import tell
from .decoder import adsb
@ -15,6 +15,9 @@ from .decoder import bds
from .extra import aero
from .extra import tcpclient
from .encoder import encode_adsb
warnings.simplefilter("once", DeprecationWarning)
dirpath = os.path.dirname(os.path.realpath(__file__))

View File

@ -41,10 +41,8 @@ def crc(msg, encode=False):
# the CRC generator
G = [int("11111111", 2), int("11111010", 2), int("00000100", 2), int("10000000", 2)]
if encode and isinstance(msg, str):
if encode:
msg = msg[:-6] + "000000"
elif encode:
msg = msg[:-6] + b"000000"
msgbin = hex2bin(msg)
msgbin_split = wrap(msgbin, 8)

View File

@ -21,12 +21,7 @@ Common functions for Mode-S decoding
import numpy as np
from pyModeS.extra import aero
try:
from pyModeS.decoder import c_common as common
except:
from pyModeS.decoder import common
from pyModeS import common
from pyModeS.decoder.bds import (
bds05,

View File

@ -19,7 +19,7 @@ from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
extensions = [Extension("pyModeS.decoder.c_common", ["pyModeS/decoder/c_common.pyx"])]
extensions = [Extension("pyModeS.c_common", ["pyModeS/c_common.pyx"])]
# To use a consistent encoding

View File

@ -1,4 +1,4 @@
from pyModeS.decoder import common
from pyModeS import common
def test_conversions():