diff --git a/software/authbox/api.py b/software/authbox/api.py index 4fb7d2e..1f72b9b 100755 --- a/software/authbox/api.py +++ b/software/authbox/api.py @@ -24,6 +24,7 @@ from __future__ import print_function +import queue import sys import threading import traceback @@ -31,8 +32,6 @@ from gpiozero import DigitalInputDevice -from authbox.compat import queue - # The line above simplifies imports for other modules that are already importing from api. # TODO give each object a logger and use that instead of prints diff --git a/software/authbox/badgereader_wiegand_gpio.py b/software/authbox/badgereader_wiegand_gpio.py index 9dc9c32..716247f 100755 --- a/software/authbox/badgereader_wiegand_gpio.py +++ b/software/authbox/badgereader_wiegand_gpio.py @@ -17,8 +17,9 @@ from __future__ import division, print_function +import queue + from authbox.api import BaseWiegandPinThread -from authbox.compat import queue DEFAULT_QUEUE_SIZE = 100 # more than enough for a scan DEFAULT_TIMEOUT_IN_MS = 15 diff --git a/software/authbox/compat.py b/software/authbox/compat.py deleted file mode 100644 index 895c925..0000000 --- a/software/authbox/compat.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2019 Tim Hatch All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS-IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Ease Python 3 transition by handling all the python2 differences in one place. -""" - -try: - import Queue as queue -except ImportError: - import queue # noqa: F401 - -try: - import ConfigParser as configparser -except ImportError: - import configparser # noqa: F401 diff --git a/software/authbox/config.py b/software/authbox/config.py index 628ab43..9501e3c 100644 --- a/software/authbox/config.py +++ b/software/authbox/config.py @@ -15,11 +15,10 @@ """Config API for Authbox. """ +import configparser import os.path import re -from authbox.compat import configparser - # TODO: This is very simplistic, supporting no escapes or indirect lookups TEMPLATE_RE = re.compile(r"{((?!\d)\w+)}") TIME_RE = re.compile(r"([\d.]+)([smhd])") diff --git a/software/authbox/gpio_button.py b/software/authbox/gpio_button.py index b0f03ea..1352e82 100755 --- a/software/authbox/gpio_button.py +++ b/software/authbox/gpio_button.py @@ -15,12 +15,12 @@ """Abstraction for blinky buttons. """ +import queue import time import gpiozero from authbox.api import BasePinThread -from authbox.compat import queue class Button(BasePinThread): diff --git a/software/authbox/gpio_buzzer.py b/software/authbox/gpio_buzzer.py index 5e42dc4..21c30f3 100644 --- a/software/authbox/gpio_buzzer.py +++ b/software/authbox/gpio_buzzer.py @@ -16,12 +16,12 @@ """ from __future__ import print_function +import queue import time import gpiozero from authbox.api import BasePinThread -from authbox.compat import queue OFF = 0 ON = 1 diff --git a/software/authbox/tests/test_badgereader_hid_keystroking.py b/software/authbox/tests/test_badgereader_hid_keystroking.py index e704291..0d2dc3e 100755 --- a/software/authbox/tests/test_badgereader_hid_keystroking.py +++ b/software/authbox/tests/test_badgereader_hid_keystroking.py @@ -14,10 +14,10 @@ """Tests for authbox.badgereader_hid_keystroking""" +import queue import unittest import authbox.badgereader_hid_keystroking -from authbox.compat import queue class BadgereaderTest(unittest.TestCase): diff --git a/software/authbox/tests/test_badgereader_wiegand_gpio.py b/software/authbox/tests/test_badgereader_wiegand_gpio.py index 1525d6d..341383f 100755 --- a/software/authbox/tests/test_badgereader_wiegand_gpio.py +++ b/software/authbox/tests/test_badgereader_wiegand_gpio.py @@ -14,12 +14,12 @@ """Tests for authbox.badgereader_wiegand_gpio""" +import queue import threading import time import unittest import authbox.badgereader_wiegand_gpio -from authbox.compat import queue from . import setup_mock_pin_factory # noqa: F401 diff --git a/software/authbox/tests/test_gpio_button.py b/software/authbox/tests/test_gpio_button.py index 117c332..2737cda 100755 --- a/software/authbox/tests/test_gpio_button.py +++ b/software/authbox/tests/test_gpio_button.py @@ -14,12 +14,12 @@ """Tests for authbox.gpio_button""" +import queue import unittest from functools import partial import authbox.gpio_button from authbox import fake_gpio_for_testing -from authbox.compat import queue from . import setup_mock_pin_factory # noqa: F401 diff --git a/software/authbox/tests/test_gpio_buzzer.py b/software/authbox/tests/test_gpio_buzzer.py index 08d5d92..05bcdcb 100755 --- a/software/authbox/tests/test_gpio_buzzer.py +++ b/software/authbox/tests/test_gpio_buzzer.py @@ -14,11 +14,11 @@ """Tests for authbox.gpio_buzzer""" +import queue import unittest import authbox.gpio_buzzer from authbox import fake_gpio_for_testing -from authbox.compat import queue from . import setup_mock_pin_factory # noqa: F401 diff --git a/software/authbox/tests/test_gpio_relay.py b/software/authbox/tests/test_gpio_relay.py index 3a6c750..6476591 100755 --- a/software/authbox/tests/test_gpio_relay.py +++ b/software/authbox/tests/test_gpio_relay.py @@ -14,11 +14,11 @@ """Tests for authbox.gpio_relay""" +import queue import unittest import authbox.gpio_relay from authbox import fake_gpio_for_testing -from authbox.compat import queue from . import setup_mock_pin_factory # noqa: F401 diff --git a/software/authbox/tests/test_timer.py b/software/authbox/tests/test_timer.py index 47a5a28..081cd67 100755 --- a/software/authbox/tests/test_timer.py +++ b/software/authbox/tests/test_timer.py @@ -14,10 +14,10 @@ """Tests for authbox.timer""" +import queue import unittest import authbox.timer -from authbox.compat import queue from . import setup_mock_pin_factory # noqa: F401 diff --git a/software/authbox/timer.py b/software/authbox/timer.py index 03e310f..3cbf4a2 100644 --- a/software/authbox/timer.py +++ b/software/authbox/timer.py @@ -17,11 +17,11 @@ from __future__ import print_function +import queue import threading import time from authbox.api import BaseDerivedThread -from authbox.compat import queue class Timer(BaseDerivedThread):