diff --git a/art.py b/art.py index 5570decd9..2884b950b 100644 --- a/art.py +++ b/art.py @@ -67,7 +67,7 @@ def get_art_site_url(actor_json: {}) -> str: get_attachment_property_value(property_value) if not prop_value_name: continue - art_text = remove_html(property_value[prop_value_name]) + art_text: str = remove_html(property_value[prop_value_name]) if not string_contains(art_text, art_sites): continue if not resembles_url(art_text): @@ -87,16 +87,18 @@ def set_art_site_url(actor_json: {}, art_site_url: str) -> None: actor_json['attachment']: list[dict] = [] # remove any existing value - property_found = None + property_found: dict = None for property_value in actor_json['attachment']: 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'): @@ -113,11 +115,13 @@ def set_art_site_url(actor_json: {}, art_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'):