From eeacf511dc79f000d6c43113a4ba03d26b4a5201 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Tue, 7 May 2024 23:50:18 -0400 Subject: [PATCH 1/2] Add try-catch to pop --- site_list.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site_list.py b/site_list.py index b66010dc..10c8845f 100644 --- a/site_list.py +++ b/site_list.py @@ -9,7 +9,10 @@ with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_file: # Removes schema-specific keywords for proper processing social_networks: dict = dict(data) -social_networks.pop('$schema') +try: + social_networks.pop('$schema') +except: + pass # Sort the social networks in alphanumeric order social_networks: list = sorted(social_networks.items()) From 87c5b4d8f311c8cb09c3cbeac1a56796328c21e4 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Wed, 8 May 2024 00:08:45 -0400 Subject: [PATCH 2/2] Swap try-catch for better .pop --- sherlock/sites.py | 5 +---- site_list.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sherlock/sites.py b/sherlock/sites.py index ba6c930a..619dc4ee 100644 --- a/sherlock/sites.py +++ b/sherlock/sites.py @@ -153,10 +153,7 @@ class SitesInformation: f"data file '{data_file_path}'." ) - try: - site_data.pop('$schema') - except: - pass + site_data.pop('$schema', None) self.sites = {} diff --git a/site_list.py b/site_list.py index 10c8845f..1f0f05fd 100644 --- a/site_list.py +++ b/site_list.py @@ -9,10 +9,7 @@ with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_file: # Removes schema-specific keywords for proper processing social_networks: dict = dict(data) -try: - social_networks.pop('$schema') -except: - pass +social_networks.pop('$schema', None) # Sort the social networks in alphanumeric order social_networks: list = sorted(social_networks.items())