From e37d1d64ead66b614746df94f93fb3f7cf0df412 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sun, 10 Jul 2022 15:03:13 +0100 Subject: [PATCH 1/2] DS: PY-W0069 --- tests/test_main.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tests/test_main.py diff --git a/tests/test_main.py b/tests/test_main.py deleted file mode 100644 index ebbdd22..0000000 --- a/tests/test_main.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python3 - -"""MODULE: Provides test cases for app/main.py.""" - -# from app.ip import is_ip_address - - -# def test_is_ip_address_true() -> None: -# test_query = "1.2.3.4" -# assert is_ip_address(test_query) - - -# def test_is_ip_address_false_ip() -> None: -# test_query = "256.315.16.23" -# assert not is_ip_address(test_query) - - -# def test_is_ip_address_false_fqdn() -> None: -# test_query = "google.com" -# assert not is_ip_address(test_query) -- 2.47.2 From 5fbcb5e89bfd022a7ea1ec77ebb7788db4c60b98 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sun, 10 Jul 2022 15:03:30 +0100 Subject: [PATCH 2/2] DS: FLK-E501 --- app/main.py | 8 ++++---- app/query_normalisation.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 6223415..150ce2e 100644 --- a/app/main.py +++ b/app/main.py @@ -44,13 +44,13 @@ def main(): as_number = get_autonomous_system_number(ip_info.get("as")) # Assemble list for table generation + country = ip_info.get("country") + region = ip_info.get("regionName") + city = ip_info.get("city") table_data = [ ["IP Address", ip_info.get("query")], ["Organization", ip_info.get("org")], - [ - "Location", - f"{ip_info.get('country')}/{ip_info.get('regionName')}/{ip_info.get('city')}", - ], + ["Location", f"{country}/{region}/{city}"], ["Timezone", ip_info.get("timezone")], ["Internet Service Provider", ip_info.get("isp")], ["Autonomous System", as_number], diff --git a/app/query_normalisation.py b/app/query_normalisation.py index 5bf32fd..3aa06b2 100644 --- a/app/query_normalisation.py +++ b/app/query_normalisation.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 -"""MODULE: Provides functions that ensure an IP address is available to query the APIs for.""" +"""MODULE: Provides functions that ensure an IP address is +available to query the APIs for.""" import socket import ipaddress -- 2.47.2