From a7a673880c54162835510c1952506d652633a224 Mon Sep 17 00:00:00 2001 From: Sjoerd Bouma Date: Tue, 25 Jun 2024 14:41:51 +0200 Subject: [PATCH 1/2] replace match with if/else to restore Python 3.6 compatibility --- pygdsm/__init__.py | 47 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/pygdsm/__init__.py b/pygdsm/__init__.py index 7b53832..717e4f0 100644 --- a/pygdsm/__init__.py +++ b/pygdsm/__init__.py @@ -35,17 +35,18 @@ def init_gsm(gsm_name: str='gsm08'): sky_model (various): Corresponding sky model """ gsm_name = gsm_name.lower().strip() - match gsm_name: - case 'gsm': # Shorthand for GSM08 - return GlobalSkyModel() - case 'gsm08': - return GlobalSkyModel() - case 'gsm16': - return GlobalSkyModel16() - case 'lfsm': - return LowFrequencySkyModel() - case 'haslam': - return HaslamSkyModel() + if gsm_name == 'gsm': # Shorthand for GSM08 + return GlobalSkyModel() + elif gsm_name == 'gsm08': + return GlobalSkyModel() + elif gsm_name == 'gsm16': + return GlobalSkyModel16() + elif gsm_name == 'lfsm': + return LowFrequencySkyModel() + elif gsm_name == 'haslam': + return HaslamSkyModel() + else: + raise ValueError(f'Invalid model specification "{gsm_name}"') def init_observer(gsm_name: str='gsm08'): @@ -68,14 +69,16 @@ def init_observer(gsm_name: str='gsm08'): observer (various): Corresponding sky model observer """ gsm_name = gsm_name.lower().strip() - match gsm_name: - case 'gsm': # Shorthand for GSM08 - return GSMObserver() - case 'gsm08': - return GSMObserver() - case 'gsm16': - return GSMObserver16() - case 'lfsm': - return LFSMObserver() - case 'haslam': - return HaslamObserver() \ No newline at end of file + + if gsm_name == 'gsm': # Shorthand for GSM08 + return GSMObserver() + elif gsm_name == 'gsm08': + return GSMObserver() + elif gsm_name == 'gsm16': + return GSMObserver16() + elif gsm_name == 'lfsm': + return LFSMObserver() + elif gsm_name == 'haslam': + return HaslamObserver() + else: + raise ValueError(f'Invalid model specification "{gsm_name}"') \ No newline at end of file From 98860ee569fa0d289935c63c568f944c78d18aaf Mon Sep 17 00:00:00 2001 From: Sjoerd Bouma Date: Tue, 25 Jun 2024 14:44:07 +0200 Subject: [PATCH 2/2] specify Python version requirement --- setup.cfg | 3 +++ setup.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/setup.cfg b/setup.cfg index 8b09a37..09c4c7c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,6 +7,9 @@ universal=1 [metadata] description_file=README.md +[options] +python_requires = >=3.6 + [aliases] test=pytest diff --git a/setup.py b/setup.py index 9a89064..dde423b 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,10 @@ # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', ],