From bc93462c29392084c735bc8b3e7ff0636ce81690 Mon Sep 17 00:00:00 2001 From: Abigail Gold <5366828+classabbyamp@users.noreply.github.com> Date: Mon, 30 Mar 2020 22:54:33 +0000 Subject: [PATCH] convert all OrderedDicts to dictionaries (#214) Fixes #184 Co-authored-by: 0x5c --- CHANGELOG.md | 2 + exts/base.py | 3 +- exts/qrz.py | 40 +++++++++---------- resources/callsign_info.py | 79 +++++++++++++++++++------------------- 4 files changed, 60 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4c0bf5..c44dce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added - `?standards` command to display [xkcd 927](https://xkcd.com/927/). +### Changed +- Python>=3.7 now required. ## [2.2.3] - 2020-03-29 diff --git a/exts/base.py b/exts/base.py index cddf934..c32ed9b 100644 --- a/exts/base.py +++ b/exts/base.py @@ -10,7 +10,6 @@ the GNU General Public License, version 2. import random import re -from collections import OrderedDict from typing import Union import discord @@ -189,7 +188,7 @@ class BaseCog(commands.Cog): def parse_changelog(): - changelog = OrderedDict() + changelog = {} ver = "" heading = "" diff --git a/exts/qrz.py b/exts/qrz.py index 2df0395..b322d20 100644 --- a/exts/qrz.py +++ b/exts/qrz.py @@ -8,7 +8,6 @@ the GNU General Public License, version 2. """ -from collections import OrderedDict from io import BytesIO import aiohttp @@ -159,27 +158,24 @@ def qrz_process_info(data: dict): else: lotw = "Unknown" - return OrderedDict([("Name", name), - ("Country", data.get("country", None)), - ("Address", address), - ("Grid Square", data.get("grid", None)), - ("County", data.get("county", None)), - ("CQ Zone", data.get("cqzone", None)), - ("ITU Zone", data.get("ituzone", None)), - ("IOTA Designator", data.get("iota", None)), - ("Expires", data.get("expdate", None)), - ("Aliases", data.get("aliases", None)), - ("Previous Callsign", data.get("p_call", None)), - ("License Class", data.get("class", None)), - ("Trustee", data.get("trustee", None)), - ("eQSL?", eqsl), - ("Paper QSL?", mqsl), - ("LotW?", lotw), - ("QSL Info", data.get("qslmgr", None)), - ("CQ Zone", data.get("cqzone", None)), - ("ITU Zone", data.get("ituzone", None)), - ("IOTA Designator", data.get("iota", None)), - ("Born", data.get("born", None))]) + return {"Name": name, + "Country": data.get("country", None), + "Address": address, + "Grid Square": data.get("grid", None), + "County": data.get("county", None), + "CQ Zone": data.get("cqzone", None), + "ITU Zone": data.get("ituzone", None), + "IOTA Designator": data.get("iota", None), + "Expires": data.get("expdate", None), + "Aliases": data.get("aliases", None), + "Previous Callsign": data.get("p_call", None), + "License Class": data.get("class", None), + "Trustee": data.get("trustee", None), + "eQSL?": eqsl, + "Paper QSL?": mqsl, + "LotW?": lotw, + "QSL Info": data.get("qslmgr", None), + "Born": data.get("born", None)} def setup(bot): diff --git a/resources/callsign_info.py b/resources/callsign_info.py index 3526abf..fe23e1c 100644 --- a/resources/callsign_info.py +++ b/resources/callsign_info.py @@ -8,49 +8,48 @@ the GNU General Public License, version 2. """ -from collections import OrderedDict - - us_calls_title = "Valid US Vanity Callsigns" us_calls_desc = ("#x# is the number of letters in the prefix and suffix of a callsign. " "E.g., WY4RC would be a 2x2 callsign, with prefix WY and suffix RC.") -us_calls = OrderedDict([("**Group A** (Extra Only)", ("**Any:** K, N, W (1x2)\n" - " AA-AL, KA-KZ, NA-NZ, WA-WZ (2x1)\n" - " AA-AL (2x2)\n" - "*Except*\n" - "**Alaska:** AL, KL, NL, WL (2x1)\n" - "**Caribbean:** KP, NP, WP (2x1)\n" - "**Pacific:** AH, KH, NH, WH (2x1)")), - ("**Group B** (Advanced and Extra Only)", ("**Any:** KA-KZ, NA-NZ, WA-WZ (2x2)\n" - "*Except*\n" - "**Alaska:** AL (2x2)\n" - "**Caribbean:** KP (2x2)\n" - "**Pacific:** AH (2x2)")), - ("**Group C** (Technician, General, Advanced, Extra Only)", ("**Any Region:** K, N, W (1x3)\n" - "*Except*\n" - "**Alaska:** KL, NL, WL (2x2)\n" - "**Caribbean:** NP, WP (2x2)\n" - "**Pacific:** KH, NH, WH (2x2)")), - ("**Group D** (Any License Class)", ("**Any Region:** KA-KZ, WA-WZ (2x3)\n" - "*Except*\n" - "**Alaska:** KL, WL (2x3)\n" - "**Caribbean:** KP, WP (2x3)\n" - "**Pacific:** KH, WH (2x3)")), - ("**Unavailable**", ("- KA2AA-KA9ZZ: US Army in Japan\n" - "- KC4AAA-KC4AAF: NSF in Antartica\n" - "- KC4USA-KC4USZ: US Navy in Antartica\n" - "- KG4AA-KG4ZZ: US Navy in Guantanamo Bay\n" - "- KL9KAA-KL9KHZ: US military in Korea\n" - "- KC6AA-KC6ZZ: Former US (Eastern and Western Caroline Islands), " - "now Federated States of Micronesia (V6) and Republic of Palau (T8)\n" - "- KX6AA-KX6ZZ: Former US (Marshall Islands), " - "now Republic of the Marshall Islands (V73)\n" - "- Any suffix SOS or QRA-QUZ\n" - "- Any 2x3 with X as the first suffix letter\n" - "- Any 2x3 with AF, KF, NF, or WF prefix and suffix EMA: FEMA\n" - "- Any 2x3 with AA-AL, NA-NZ, WC, WK, WM, WR, or WT prefix: \"Group X\"\n" - "- Any 2x1, 2x2, or 2x3 with KP, NP, WP prefix and 0, 6, 7, 8, 9 number\n" - "- Any 1x1 callsign: Special Event"))]) +us_calls = { + "**Group A** (Extra Only)": ("**Any:** K, N, W (1x2)\n" + " AA-AL, KA-KZ, NA-NZ, WA-WZ (2x1)\n" + " AA-AL (2x2)\n" + "*Except*\n" + "**Alaska:** AL, KL, NL, WL (2x1)\n" + "**Caribbean:** KP, NP, WP (2x1)\n" + "**Pacific:** AH, KH, NH, WH (2x1)"), + "**Group B** (Advanced and Extra Only)": ("**Any:** KA-KZ, NA-NZ, WA-WZ (2x2)\n" + "*Except*\n" + "**Alaska:** AL (2x2)\n" + "**Caribbean:** KP (2x2)\n" + "**Pacific:** AH (2x2)"), + "**Group C** (Technician, General, Advanced, Extra Only)": ("**Any Region:** K, N, W (1x3)\n" + "*Except*\n" + "**Alaska:** KL, NL, WL (2x2)\n" + "**Caribbean:** NP, WP (2x2)\n" + "**Pacific:** KH, NH, WH (2x2)"), + "**Group D** (Any License Class)": ("**Any Region:** KA-KZ, WA-WZ (2x3)\n" + "*Except*\n" + "**Alaska:** KL, WL (2x3)\n" + "**Caribbean:** KP, WP (2x3)\n" + "**Pacific:** KH, WH (2x3)"), + "**Unavailable**": ("- KA2AA-KA9ZZ: US Army in Japan\n" + "- KC4AAA-KC4AAF: NSF in Antartica\n" + "- KC4USA-KC4USZ: US Navy in Antartica\n" + "- KG4AA-KG4ZZ: US Navy in Guantanamo Bay\n" + "- KL9KAA-KL9KHZ: US military in Korea\n" + "- KC6AA-KC6ZZ: Former US (Eastern and Western Caroline Islands), " + "now Federated States of Micronesia (V6) and Republic of Palau (T8)\n" + "- KX6AA-KX6ZZ: Former US (Marshall Islands), " + "now Republic of the Marshall Islands (V73)\n" + "- Any suffix SOS or QRA-QUZ\n" + "- Any 2x3 with X as the first suffix letter\n" + "- Any 2x3 with AF, KF, NF, or WF prefix and suffix EMA: FEMA\n" + "- Any 2x3 with AA-AL, NA-NZ, WC, WK, WM, WR, or WT prefix: \"Group X\"\n" + "- Any 2x1, 2x2, or 2x3 with KP, NP, WP prefix and 0, 6, 7, 8, 9 number\n" + "- Any 1x1 callsign: Special Event") + } # format: country: (title, description, text) options = {"us": (us_calls_title, us_calls_desc, us_calls)}