diff --git a/briar.py b/briar.py index b58bc91b1..b644e4158 100644 --- a/briar.py +++ b/briar.py @@ -115,7 +115,7 @@ def set_briar_address(actor_json: {}, briar_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/cwtch.py b/cwtch.py index c07494625..3a8e57d06 100644 --- a/cwtch.py +++ b/cwtch.py @@ -103,7 +103,7 @@ def set_cwtch_address(actor_json: {}, cwtch_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/discord.py b/discord.py index f368d9580..7e7a107a5 100644 --- a/discord.py +++ b/discord.py @@ -62,7 +62,7 @@ def set_discord(actor_json: {}, discord: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'].lower() diff --git a/enigma.py b/enigma.py index 9fd94ba71..7d8ff5690 100644 --- a/enigma.py +++ b/enigma.py @@ -86,7 +86,7 @@ def set_enigma_pub_key(actor_json: {}, enigma_pub_key: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/languages.py b/languages.py index 2fe1832f2..434576429 100644 --- a/languages.py +++ b/languages.py @@ -83,11 +83,13 @@ def set_actor_languages(actor_json: {}, languages_str: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/music.py b/music.py index 17ed9deae..b972fe006 100644 --- a/music.py +++ b/music.py @@ -68,11 +68,13 @@ def set_music_site_url(actor_json: {}, music_site_url: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'].lower() + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() elif property_value.get('schema:name'): - name_value = property_value['schema:name'].lower() + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() if not name_value: continue if not property_value.get('type'): @@ -89,11 +91,13 @@ def set_music_site_url(actor_json: {}, music_site_url: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/outbox.py b/outbox.py index 7aa7f8593..56d14e062 100644 --- a/outbox.py +++ b/outbox.py @@ -197,11 +197,13 @@ def _person_receive_update_outbox(base_dir: str, http_prefix: str, updatable_attachments = ('PGP', 'OpenPGP', 'Email') for new_property_value in updated_actor_json['attachment']: - name_value = None + name_value: str = None if new_property_value.get('name'): - name_value = new_property_value['name'] + if isinstance(new_property_value['name'], str): + name_value = new_property_value['name'] elif new_property_value.get('schema:name'): - name_value = new_property_value['schema:name'] + if isinstance(new_property_value['schema:name'], str): + name_value = new_property_value['schema:name'] if not name_value: continue if name_value not in updatable_attachments: diff --git a/peertube.py b/peertube.py index 69798b08b..c8b500c23 100644 --- a/peertube.py +++ b/peertube.py @@ -79,7 +79,7 @@ def set_peertube(actor_json: {}, peertube: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'].lower() diff --git a/pgp.py b/pgp.py index 6de3a8664..e36d49ef8 100644 --- a/pgp.py +++ b/pgp.py @@ -178,7 +178,7 @@ def get_pgp_fingerprint(actor_json: {}) -> str: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] @@ -225,7 +225,7 @@ def set_email_address(actor_json: {}, email_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] @@ -374,7 +374,7 @@ def set_pgp_pub_key(actor_json: {}, pgp_pub_key: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/pixelfed.py b/pixelfed.py index 02fc48923..4b8bbd724 100644 --- a/pixelfed.py +++ b/pixelfed.py @@ -102,7 +102,7 @@ def set_pixelfed(actor_json: {}, pixelfed: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'].lower() @@ -125,7 +125,7 @@ def set_pixelfed(actor_json: {}, pixelfed: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/pronouns.py b/pronouns.py index 760dc81ae..e2b3ef4d7 100644 --- a/pronouns.py +++ b/pronouns.py @@ -85,7 +85,7 @@ def set_pronouns(actor_json: {}, pronouns: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): if isinstance(property_value['name'], str): name_value = property_value['name'] diff --git a/ssb.py b/ssb.py index f20aa285c..f1a3382d4 100644 --- a/ssb.py +++ b/ssb.py @@ -84,11 +84,13 @@ def set_ssb_address(actor_json: {}, ssb_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): @@ -106,11 +108,13 @@ def set_ssb_address(actor_json: {}, ssb_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/tox.py b/tox.py index 80de27728..1f6827d1a 100644 --- a/tox.py +++ b/tox.py @@ -23,11 +23,13 @@ def get_tox_address(actor_json: {}) -> str: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not name_value.lower().startswith('tox'): @@ -88,11 +90,13 @@ def set_tox_address(actor_json: {}, tox_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): @@ -110,11 +114,13 @@ def set_tox_address(actor_json: {}, tox_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/utils.py b/utils.py index 33e22d358..684e9fafd 100644 --- a/utils.py +++ b/utils.py @@ -181,11 +181,13 @@ def get_actor_languages_list(actor_json: {}) -> []: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not name_value.lower().startswith('languages'): @@ -1389,9 +1391,11 @@ def get_gender_from_bio(base_dir: str, actor: str, person_cache: {}, continue name_value = None if tag.get('name'): - name_value = tag['name'] + if isinstance(tag['name'], str): + name_value = tag['name'] if tag.get('schema:name'): - name_value = tag['schema:name'] + if isinstance(tag['schema:name'], str): + name_value = tag['schema:name'] if not name_value: continue prop_value_name, _ = get_attachment_property_value(tag) @@ -2868,14 +2872,16 @@ def get_actor_property_url(actor_json: {}, property_name: str) -> str: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if not isinstance(property_value, dict): print("WARN: Actor attachment is not dict: " + str(property_value)) continue if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue name_value_lower = name_value.lower() diff --git a/webapp_utils.py b/webapp_utils.py index 66fc1825d..8af0b4b6a 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -311,11 +311,13 @@ def _set_actor_property_url(actor_json: {}, if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): @@ -346,11 +348,13 @@ def _set_actor_property_url(actor_json: {}, if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/webfinger.py b/webfinger.py index 6bf77af93..7d4000772 100644 --- a/webfinger.py +++ b/webfinger.py @@ -550,11 +550,13 @@ def _webfinger_update_from_profile(wf_json: {}, actor_json: {}) -> bool: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue property_name = name_value.lower() diff --git a/xmpp.py b/xmpp.py index d7ff7073f..2195c53a5 100644 --- a/xmpp.py +++ b/xmpp.py @@ -23,11 +23,13 @@ def get_xmpp_address(actor_json: {}) -> str: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'].lower() + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() elif property_value.get('schema:name'): - name_value = property_value['schema:name'].lower() + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() if not name_value: continue if not (name_value.startswith('xmpp') or @@ -82,11 +84,13 @@ def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): @@ -113,11 +117,13 @@ def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'): diff --git a/youtube.py b/youtube.py index 0df1b28b1..a3699c6e6 100644 --- a/youtube.py +++ b/youtube.py @@ -26,11 +26,13 @@ def get_youtube(actor_json: {}) -> str: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'].lower() + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() elif property_value.get('schema:name'): - name_value = property_value['schema:name'].lower() + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() if not name_value: continue if not string_contains(name_value, youtube_fieldnames): @@ -78,11 +80,13 @@ def set_youtube(actor_json: {}, youtube: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'].lower() + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() elif property_value.get('schema:name'): - name_value = property_value['schema:name'].lower() + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() if not name_value: continue if not property_value.get('type'): @@ -99,11 +103,13 @@ def set_youtube(actor_json: {}, youtube: str) -> None: if not isinstance(property_value, dict): print("WARN: actor attachment is not dict: " + str(property_value)) continue - name_value = None + name_value: str = None if property_value.get('name'): - name_value = property_value['name'] + if isinstance(property_value['name'], str): + name_value = property_value['name'] elif property_value.get('schema:name'): - name_value = property_value['schema:name'] + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] if not name_value: continue if not property_value.get('type'):