From 83084f72ffc292eda16c2d20ffa8b67f846e5875 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 2 May 2024 14:35:58 -0700 Subject: [PATCH] Remove future library dependency --- chirp/bitwise.py | 2 - chirp/chirp_common.py | 2 - chirp/drivers/anytone778uv.py | 132 ++++++++++++++++------------------ chirp/drivers/btech.py | 2 - chirp/drivers/ft817.py | 1 - chirp/drivers/ga510.py | 8 --- chirp/drivers/icf.py | 2 - chirp/drivers/id51.py | 1 - chirp/drivers/id51plus.py | 1 - chirp/drivers/th350.py | 2 - chirp/drivers/tk8102.py | 1 - chirp/drivers/tk8180.py | 93 +++++++++++------------- chirp/drivers/uv5r.py | 2 - chirp/drivers/yaesu_clone.py | 1 - chirp/memmap.py | 2 - test-requirements.txt | 1 - tox.ini | 1 - 17 files changed, 105 insertions(+), 149 deletions(-) diff --git a/chirp/bitwise.py b/chirp/bitwise.py index 4cdbfad2..4e1188c0 100644 --- a/chirp/bitwise.py +++ b/chirp/bitwise.py @@ -64,8 +64,6 @@ import logging import re import warnings -from builtins import bytes - from chirp import bitwise_grammar LOG = logging.getLogger(__name__) diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py index e8261cfe..ca9b8bc2 100644 --- a/chirp/chirp_common.py +++ b/chirp/chirp_common.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes - import base64 import json import inspect diff --git a/chirp/drivers/anytone778uv.py b/chirp/drivers/anytone778uv.py index d06f645a..fb8476c0 100644 --- a/chirp/drivers/anytone778uv.py +++ b/chirp/drivers/anytone778uv.py @@ -51,18 +51,6 @@ import logging LOG = logging.getLogger(__name__) -# Gross hack to handle missing future module on un-updatable -# platforms like MacOS. Just avoid registering these radio -# classes for now. -try: - from builtins import bytes - has_future = True -except ImportError: - has_future = False - LOG.debug('python-future package is not ' - 'available; %s requires it' % __name__) - - # Here is where we define the memory map for the radio. Since # We often just know small bits of it, we can use #seekto to skip # around as needed. @@ -1730,46 +1718,49 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, # Original non-VOX models -if has_future: - @directory.register - class AnyTone778UV(AnyTone778UVBase): - VENDOR = "AnyTone" - MODEL = "778UV" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'AT778UV': ['V100', 'V200']} +@directory.register +class AnyTone778UV(AnyTone778UVBase): + VENDOR = "AnyTone" + MODEL = "778UV" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'AT778UV': ['V100', 'V200']} - @directory.register - class RetevisRT95(AnyTone778UVBase): - VENDOR = "Retevis" - MODEL = "RT95" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'RT95': ['V100']} - @directory.register - class CRTMicronUV(AnyTone778UVBase): - VENDOR = "CRT" - MODEL = "Micron UV" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'MICRON': ['V100']} +@directory.register +class RetevisRT95(AnyTone778UVBase): + VENDOR = "Retevis" + MODEL = "RT95" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'RT95': ['V100']} - @directory.register - class MidlandDBR2500(AnyTone778UVBase): - VENDOR = "Midland" - MODEL = "DBR2500" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'DBR2500': ['V100']} - @directory.register - class YedroYCM04vus(AnyTone778UVBase): - VENDOR = "Yedro" - MODEL = "YC-M04VUS" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'YCM04UV': ['V100']} +@directory.register +class CRTMicronUV(AnyTone778UVBase): + VENDOR = "CRT" + MODEL = "Micron UV" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'MICRON': ['V100']} + + +@directory.register +class MidlandDBR2500(AnyTone778UVBase): + VENDOR = "Midland" + MODEL = "DBR2500" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'DBR2500': ['V100']} + + +@directory.register +class YedroYCM04vus(AnyTone778UVBase): + VENDOR = "Yedro" + MODEL = "YC-M04VUS" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'YCM04UV': ['V100']} class AnyTone778UVvoxBase(AnyTone778UVBase): @@ -1779,27 +1770,28 @@ class AnyTone778UVvoxBase(AnyTone778UVBase): # New VOX models -if has_future: - @directory.register - class AnyTone778UVvox(AnyTone778UVvoxBase): - VENDOR = "AnyTone" - MODEL = "778UV VOX" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'778UV-P': ['V100']} +@directory.register +class AnyTone778UVvox(AnyTone778UVvoxBase): + VENDOR = "AnyTone" + MODEL = "778UV VOX" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'778UV-P': ['V100']} - @directory.register - class RetevisRT95vox(AnyTone778UVvoxBase): - VENDOR = "Retevis" - MODEL = "RT95 VOX" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'RT95-P': ['V100']} - @directory.register - class CRTMicronUVvox(AnyTone778UVvoxBase): - VENDOR = "CRT" - MODEL = "Micron UV V2" - # Allowed radio types is a dict keyed by model of a list of version - # strings - ALLOWED_RADIO_TYPES = {'MICRONP': ['V100']} +@directory.register +class RetevisRT95vox(AnyTone778UVvoxBase): + VENDOR = "Retevis" + MODEL = "RT95 VOX" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'RT95-P': ['V100']} + + +@directory.register +class CRTMicronUVvox(AnyTone778UVvoxBase): + VENDOR = "CRT" + MODEL = "Micron UV V2" + # Allowed radio types is a dict keyed by model of a list of version + # strings + ALLOWED_RADIO_TYPES = {'MICRONP': ['V100']} diff --git a/chirp/drivers/btech.py b/chirp/drivers/btech.py index 50d11b06..d2bfa560 100644 --- a/chirp/drivers/btech.py +++ b/chirp/drivers/btech.py @@ -15,8 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes - import struct import logging diff --git a/chirp/drivers/ft817.py b/chirp/drivers/ft817.py index 36ca8589..7a020016 100644 --- a/chirp/drivers/ft817.py +++ b/chirp/drivers/ft817.py @@ -16,7 +16,6 @@ """FT817 - FT817ND - FT817ND/US management module""" -from builtins import bytes from chirp.drivers import yaesu_clone from chirp import chirp_common, util, memmap, errors, directory, bitwise from chirp.settings import RadioSetting, RadioSettingGroup, \ diff --git a/chirp/drivers/ga510.py b/chirp/drivers/ga510.py index 58d9b050..c84d24cd 100644 --- a/chirp/drivers/ga510.py +++ b/chirp/drivers/ga510.py @@ -29,14 +29,6 @@ from chirp.settings import RadioSettingValueInteger, RadioSettingValueString LOG = logging.getLogger(__name__) -try: - from builtins import bytes - has_future = True -except ImportError: - has_future = False - LOG.debug('python-future package is not available; ' - '%s requires it' % __name__) - # GA510 and SHX8800 also have DTCS code 645 DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) diff --git a/chirp/drivers/icf.py b/chirp/drivers/icf.py index 5f43d1e8..c948276b 100644 --- a/chirp/drivers/icf.py +++ b/chirp/drivers/icf.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes - import binascii import hashlib import os diff --git a/chirp/drivers/id51.py b/chirp/drivers/id51.py index 402b1dce..a5da570f 100644 --- a/chirp/drivers/id51.py +++ b/chirp/drivers/id51.py @@ -12,7 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes import logging diff --git a/chirp/drivers/id51plus.py b/chirp/drivers/id51plus.py index 4aa751c8..9e231024 100644 --- a/chirp/drivers/id51plus.py +++ b/chirp/drivers/id51plus.py @@ -12,7 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes import logging diff --git a/chirp/drivers/th350.py b/chirp/drivers/th350.py index a728d2f1..22c37033 100644 --- a/chirp/drivers/th350.py +++ b/chirp/drivers/th350.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from __future__ import division - import struct import logging from math import floor diff --git a/chirp/drivers/tk8102.py b/chirp/drivers/tk8102.py index 888f015c..53d5c0a9 100644 --- a/chirp/drivers/tk8102.py +++ b/chirp/drivers/tk8102.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes import logging import struct diff --git a/chirp/drivers/tk8180.py b/chirp/drivers/tk8180.py index a3f7965d..88b1f8a7 100644 --- a/chirp/drivers/tk8180.py +++ b/chirp/drivers/tk8180.py @@ -27,18 +27,6 @@ from chirp.settings import RadioSettings, RadioSettingSubGroup LOG = logging.getLogger(__name__) -# Gross hack to handle missing future module on un-updatable -# platforms like MacOS. Just avoid registering these radio -# classes for now. -try: - from builtins import bytes - has_future = True -except ImportError: - has_future = False - LOG.debug('python-future package is not ' - 'available; %s requires it' % __name__) - - HEADER_FORMAT = """ #seekto 0x0100; struct { @@ -1225,47 +1213,52 @@ class KenwoodTKx180RadioZone(KenwoodTKx180Radio): return [] -if has_future: - @directory.register - class KenwoodTK7180Radio(KenwoodTKx180Radio): - MODEL = 'TK-7180' - VALID_BANDS = [(136000000, 174000000)] - _model = b'M7180\x04' +@directory.register +class KenwoodTK7180Radio(KenwoodTKx180Radio): + MODEL = 'TK-7180' + VALID_BANDS = [(136000000, 174000000)] + _model = b'M7180\x04' - @directory.register - class KenwoodTK8180Radio(KenwoodTKx180Radio): - MODEL = 'TK-8180' - VALID_BANDS = [(400000000, 520000000)] - _model = b'M8180\x06' - @directory.register - class KenwoodTK2180Radio(KenwoodTKx180Radio): - MODEL = 'TK-2180' - VALID_BANDS = [(136000000, 174000000)] - _model = b'P2180\x04' +@directory.register +class KenwoodTK8180Radio(KenwoodTKx180Radio): + MODEL = 'TK-8180' + VALID_BANDS = [(400000000, 520000000)] + _model = b'M8180\x06' - # K1,K3 are technically 450-470 (K3 == keypad) - @directory.register - class KenwoodTK3180K1Radio(KenwoodTKx180Radio): - MODEL = 'TK-3180K' - VALID_BANDS = [(400000000, 520000000)] - _model = b'P3180\x06' - # K2,K4 are technically 400-470 (K4 == keypad) - @directory.register - class KenwoodTK3180K2Radio(KenwoodTKx180Radio): - MODEL = 'TK-3180K2' - VALID_BANDS = [(400000000, 520000000)] - _model = b'P3180\x07' +@directory.register +class KenwoodTK2180Radio(KenwoodTKx180Radio): + MODEL = 'TK-2180' + VALID_BANDS = [(136000000, 174000000)] + _model = b'P2180\x04' - @directory.register - class KenwoodTK8180E(KenwoodTKx180Radio): - MODEL = 'TK-8180E' - VALID_BANDS = [(400000000, 520000000)] - _model = b'M8189\'' - @directory.register - class KenwoodTK7180ERadio(KenwoodTKx180Radio): - MODEL = 'TK-7180E' - VALID_BANDS = [(136000000, 174000000)] - _model = b'M7189$' +# K1,K3 are technically 450-470 (K3 == keypad) +@directory.register +class KenwoodTK3180K1Radio(KenwoodTKx180Radio): + MODEL = 'TK-3180K' + VALID_BANDS = [(400000000, 520000000)] + _model = b'P3180\x06' + + +# K2,K4 are technically 400-470 (K4 == keypad) +@directory.register +class KenwoodTK3180K2Radio(KenwoodTKx180Radio): + MODEL = 'TK-3180K2' + VALID_BANDS = [(400000000, 520000000)] + _model = b'P3180\x07' + + +@directory.register +class KenwoodTK8180E(KenwoodTKx180Radio): + MODEL = 'TK-8180E' + VALID_BANDS = [(400000000, 520000000)] + _model = b'M8189\'' + + +@directory.register +class KenwoodTK7180ERadio(KenwoodTKx180Radio): + MODEL = 'TK-7180E' + VALID_BANDS = [(136000000, 174000000)] + _model = b'M7189$' diff --git a/chirp/drivers/uv5r.py b/chirp/drivers/uv5r.py index 993ccb4b..94325c71 100644 --- a/chirp/drivers/uv5r.py +++ b/chirp/drivers/uv5r.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes - import struct import time import logging diff --git a/chirp/drivers/yaesu_clone.py b/chirp/drivers/yaesu_clone.py index a5e76439..39e41763 100644 --- a/chirp/drivers/yaesu_clone.py +++ b/chirp/drivers/yaesu_clone.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes import time import logging diff --git a/chirp/memmap.py b/chirp/memmap.py index b392ac67..bc36071c 100644 --- a/chirp/memmap.py +++ b/chirp/memmap.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from builtins import bytes - from chirp import util diff --git a/test-requirements.txt b/test-requirements.txt index b0f855f2..07deee04 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,6 @@ pytest-html six pep8 pyserial -future requests pyyaml pywin32; platform_system=="Windows" diff --git a/tox.ini b/tox.ini index 6bcb5e1d..cd40c7eb 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,6 @@ passenv = PIP_INDEX_URL PIP_TRUSTED_HOST allowlist_externals = bash -deps = future [testenv:style] sitepackages = False