diff --git a/briar.py b/briar.py index e29bf8686..d54a40d08 100644 --- a/briar.py +++ b/briar.py @@ -13,33 +13,33 @@ def getBriarAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('briar'): + if not property_value['name'].lower().startswith('briar'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() - if len(propertyValue['value']) < 50: + property_value['value'] = property_value['value'].strip() + if len(property_value['value']) < 50: continue - if not propertyValue['value'].startswith('briar://'): + if not property_value['value'].startswith('briar://'): continue - if propertyValue['value'].lower() != propertyValue['value']: + if property_value['value'].lower() != property_value['value']: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - if '.' in propertyValue['value']: + if '.' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -70,30 +70,30 @@ def setBriarAddress(actor_json: {}, briarAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('briar'): + if not property_value['name'].lower().startswith('briar'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notBriarAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('briar'): + if not property_value['name'].lower().startswith('briar'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = briarAddress + property_value['value'] = briarAddress return newBriarAddress = { diff --git a/cwtch.py b/cwtch.py index 2e617c9b2..1a79d2cbb 100644 --- a/cwtch.py +++ b/cwtch.py @@ -15,29 +15,29 @@ def getCwtchAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('cwtch'): + if not property_value['name'].lower().startswith('cwtch'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() - if len(propertyValue['value']) < 2: + property_value['value'] = property_value['value'].strip() + if len(property_value['value']) < 2: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - if '.' in propertyValue['value']: + if '.' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -58,30 +58,30 @@ def setCwtchAddress(actor_json: {}, cwtchAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('cwtch'): + if not property_value['name'].lower().startswith('cwtch'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notCwtchAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('cwtch'): + if not property_value['name'].lower().startswith('cwtch'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = cwtchAddress + property_value['value'] = cwtchAddress return newCwtchAddress = { diff --git a/donate.py b/donate.py index ef34561ad..cef6ee0d4 100644 --- a/donate.py +++ b/donate.py @@ -24,20 +24,20 @@ def getDonationUrl(actor_json: {}) -> str: if not actor_json.get('attachment'): return '' donationType = _getDonationTypes() - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if propertyValue['name'].lower() not in donationType: + if property_value['name'].lower() not in donationType: continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if ' str: return '' matchStrings = _getWebsiteStrings() matchStrings.append(translate['Website'].lower()) - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if propertyValue['name'].lower() not in matchStrings: + if property_value['name'].lower() not in matchStrings: continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - return propertyValue['value'] + return property_value['value'] return '' @@ -91,14 +91,14 @@ def setDonationUrl(actor_json: {}, donateUrl: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower() != donateName: + if not property_value['name'].lower() != donateName: continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) @@ -110,16 +110,16 @@ def setDonationUrl(actor_json: {}, donateUrl: str) -> None: '" rel="me nofollow noopener noreferrer" target="_blank">' + \ donateUrl + '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if propertyValue['name'].lower() != donateName: + if property_value['name'].lower() != donateName: continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = donateValue + property_value['value'] = donateValue return newDonate = { @@ -152,14 +152,14 @@ def setWebsite(actor_json: {}, websiteUrl: str, translate: {}) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if propertyValue['name'].lower() not in matchStrings: + if property_value['name'].lower() not in matchStrings: continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) diff --git a/enigma.py b/enigma.py index 3634b2e45..8767d9f4f 100644 --- a/enigma.py +++ b/enigma.py @@ -13,18 +13,18 @@ def getEnigmaPubKey(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('enigma'): + if not property_value['name'].lower().startswith('enigma'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - return propertyValue['value'] + return property_value['value'] return '' @@ -40,30 +40,30 @@ def setEnigmaPubKey(actor_json: {}, enigmaPubKey: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('enigma'): + if not property_value['name'].lower().startswith('enigma'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: - actor_json['attachment'].remove(propertyValue) + actor_json['attachment'].remove(property_value) if removeKey: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('enigma'): + if not property_value['name'].lower().startswith('enigma'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = enigmaPubKey + property_value['value'] = enigmaPubKey return newenigmaPubKey = { diff --git a/jami.py b/jami.py index 0bcb4a7eb..ed0f23414 100644 --- a/jami.py +++ b/jami.py @@ -13,29 +13,29 @@ def getJamiAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('jami'): + if not property_value['name'].lower().startswith('jami'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() - if len(propertyValue['value']) < 2: + property_value['value'] = property_value['value'].strip() + if len(property_value['value']) < 2: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - if '.' in propertyValue['value']: + if '.' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -62,30 +62,30 @@ def setJamiAddress(actor_json: {}, jamiAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('jami'): + if not property_value['name'].lower().startswith('jami'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notJamiAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('jami'): + if not property_value['name'].lower().startswith('jami'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = jamiAddress + property_value['value'] = jamiAddress return newJamiAddress = { diff --git a/languages.py b/languages.py index 7f73f17fe..2d4fbd12b 100644 --- a/languages.py +++ b/languages.py @@ -67,14 +67,14 @@ def setActorLanguages(base_dir: str, actor_json: {}, # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('languages'): + if not property_value['name'].lower().startswith('languages'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) diff --git a/matrix.py b/matrix.py index c829aebbe..d161f8b5e 100644 --- a/matrix.py +++ b/matrix.py @@ -13,26 +13,26 @@ def getMatrixAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('matrix'): + if not property_value['name'].lower().startswith('matrix'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if '@' not in propertyValue['value']: + if '@' not in property_value['value']: continue - if not propertyValue['value'].startswith('@'): + if not property_value['value'].startswith('@'): continue - if ':' not in propertyValue['value']: + if ':' not in property_value['value']: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -44,14 +44,14 @@ def setMatrixAddress(actor_json: {}, matrixAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('matrix'): + if not property_value['name'].lower().startswith('matrix'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) @@ -69,16 +69,16 @@ def setMatrixAddress(actor_json: {}, matrixAddress: str) -> None: if ':' not in matrixAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('matrix'): + if not property_value['name'].lower().startswith('matrix'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = matrixAddress + property_value['value'] = matrixAddress return newMatrixAddress = { diff --git a/pgp.py b/pgp.py index b77e3bc69..3188145f2 100644 --- a/pgp.py +++ b/pgp.py @@ -28,22 +28,22 @@ def getEmailAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('email'): + if not property_value['name'].lower().startswith('email'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if '@' not in propertyValue['value']: + if '@' not in property_value['value']: continue - if '.' not in propertyValue['value']: + if '.' not in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -52,20 +52,20 @@ def getPGPpubKey(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('pgp'): + if not property_value['name'].lower().startswith('pgp'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if not containsPGPPublicKey(propertyValue['value']): + if not containsPGPPublicKey(property_value['value']): continue - return propertyValue['value'] + return property_value['value'] return '' @@ -74,20 +74,20 @@ def getPGPfingerprint(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('openpgp'): + if not property_value['name'].lower().startswith('openpgp'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if len(propertyValue['value']) < 10: + if len(property_value['value']) < 10: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -109,30 +109,30 @@ def setEmailAddress(actor_json: {}, emailAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('email'): + if not property_value['name'].lower().startswith('email'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notEmailAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('email'): + if not property_value['name'].lower().startswith('email'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = emailAddress + property_value['value'] = emailAddress return newEmailAddress = { @@ -160,30 +160,30 @@ def setPGPpubKey(actor_json: {}, PGPpubKey: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('pgp'): + if not property_value['name'].lower().startswith('pgp'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: - actor_json['attachment'].remove(propertyValue) + actor_json['attachment'].remove(property_value) if removeKey: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('pgp'): + if not property_value['name'].lower().startswith('pgp'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = PGPpubKey + property_value['value'] = PGPpubKey return newPGPpubKey = { @@ -209,30 +209,30 @@ def setPGPfingerprint(actor_json: {}, fingerprint: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('openpgp'): + if not property_value['name'].lower().startswith('openpgp'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: - actor_json['attachment'].remove(propertyValue) + actor_json['attachment'].remove(property_value) if removeFingerprint: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('openpgp'): + if not property_value['name'].lower().startswith('openpgp'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = fingerprint.strip() + property_value['value'] = fingerprint.strip() return newPGPfingerprint = { diff --git a/ssb.py b/ssb.py index 5d75bf892..a106bdef0 100644 --- a/ssb.py +++ b/ssb.py @@ -13,29 +13,29 @@ def getSSBAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('ssb'): + if not property_value['name'].lower().startswith('ssb'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() - if not propertyValue['value'].startswith('@'): + property_value['value'] = property_value['value'].strip() + if not property_value['value'].startswith('@'): continue - if '=.' not in propertyValue['value']: + if '=.' not in property_value['value']: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -61,30 +61,30 @@ def setSSBAddress(actor_json: {}, ssbAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('ssb'): + if not property_value['name'].lower().startswith('ssb'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notSSBAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('ssb'): + if not property_value['name'].lower().startswith('ssb'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = ssbAddress + property_value['value'] = ssbAddress return newSSBAddress = { diff --git a/tests.py b/tests.py index 0c4e25fe0..3b8dbc0a4 100644 --- a/tests.py +++ b/tests.py @@ -5160,10 +5160,10 @@ def testUpdateActor(base_dir: str): print("actor_json['attachment'] has no contents") assert len(actor_json['attachment']) > 0 propertyFound = False - for propertyValue in actor_json['attachment']: - if propertyValue['name'] == 'PGP': + for property_value in actor_json['attachment']: + if property_value['name'] == 'PGP': print('PGP property set within attachment') - assert pubKey in propertyValue['value'] + assert pubKey in property_value['value'] propertyFound = True assert propertyFound diff --git a/tox.py b/tox.py index 7dde82938..2c12c39bc 100644 --- a/tox.py +++ b/tox.py @@ -13,31 +13,31 @@ def getToxAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('tox'): + if not property_value['name'].lower().startswith('tox'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() - if len(propertyValue['value']) != 76: + property_value['value'] = property_value['value'].strip() + if len(property_value['value']) != 76: continue - if propertyValue['value'].upper() != propertyValue['value']: + if property_value['value'].upper() != property_value['value']: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - if '.' in propertyValue['value']: + if '.' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -66,30 +66,30 @@ def setToxAddress(actor_json: {}, toxAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('tox'): + if not property_value['name'].lower().startswith('tox'): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notToxAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith('tox'): + if not property_value['name'].lower().startswith('tox'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = toxAddress + property_value['value'] = toxAddress return newToxAddress = { diff --git a/utils.py b/utils.py index 5ce51afc4..47c0b8d9b 100644 --- a/utils.py +++ b/utils.py @@ -39,23 +39,23 @@ def get_actor_languages_list(actor_json: {}) -> []: """ if not actor_json.get('attachment'): return [] - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith('languages'): + if not property_value['name'].lower().startswith('languages'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if isinstance(propertyValue['value'], list): - langList = propertyValue['value'] + if isinstance(property_value['value'], list): + langList = property_value['value'] langList.sort() return langList - elif isinstance(propertyValue['value'], str): - langStr = propertyValue['value'] + elif isinstance(property_value['value'], str): + langStr = property_value['value'] langListTemp = [] if ',' in langStr: langListTemp = langStr.split(',') @@ -2874,33 +2874,33 @@ def getActorPropertyUrl(actor_json: {}, propertyName: str) -> str: if not actor_json.get('attachment'): return '' propertyName = propertyName.lower() - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue['name'].lower().startswith(propertyName): + if not property_value['name'].lower().startswith(propertyName): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = propertyValue['value'].strip() + property_value['value'] = property_value['value'].strip() prefixes = getProtocolPrefixes() prefixFound = False for prefix in prefixes: - if propertyValue['value'].startswith(prefix): + if property_value['value'].startswith(prefix): prefixFound = True break if not prefixFound: continue - if '.' not in propertyValue['value']: + if '.' not in property_value['value']: continue - if ' ' in propertyValue['value']: + if ' ' in property_value['value']: continue - if ',' in propertyValue['value']: + if ',' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' diff --git a/webapp_utils.py b/webapp_utils.py index c48149837..c30996b8f 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -180,14 +180,14 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith(propertyNameLower): + if not property_value['name'].lower().startswith(propertyNameLower): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) @@ -207,16 +207,16 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None: if ',' in url: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue['name'].lower().startswith(propertyNameLower): + if not property_value['name'].lower().startswith(propertyNameLower): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = url + property_value['value'] = url return newAddress = { diff --git a/webfinger.py b/webfinger.py index 852269e63..253284e5d 100644 --- a/webfinger.py +++ b/webfinger.py @@ -361,10 +361,10 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool: for name, alias in webfingerPropertyName.items(): aliasesNotFound.append(alias) - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - propertyName = propertyValue['name'].lower() + propertyName = property_value['name'].lower() found = False for name, alias in webfingerPropertyName.items(): if name == propertyName: @@ -374,14 +374,14 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool: break if not found: continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - newValue = propertyValue['value'].strip() + newValue = property_value['value'].strip() if '://' in newValue: newValue = newValue.split('://')[1] diff --git a/xmpp.py b/xmpp.py index e960de24f..fce587ca7 100644 --- a/xmpp.py +++ b/xmpp.py @@ -13,24 +13,24 @@ def getXmppAddress(actor_json: {}) -> str: """ if not actor_json.get('attachment'): return '' - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - nameLower = propertyValue['name'].lower() + nameLower = property_value['name'].lower() if not (nameLower.startswith('xmpp') or nameLower.startswith('jabber')): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not propertyValue.get('value'): + if not property_value.get('value'): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - if '@' not in propertyValue['value']: + if '@' not in property_value['value']: continue - if '"' in propertyValue['value']: + if '"' in property_value['value']: continue - return propertyValue['value'] + return property_value['value'] return '' @@ -52,33 +52,33 @@ def setXmppAddress(actor_json: {}, xmppAddress: str) -> None: # remove any existing value propertyFound = None - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - if not (propertyValue['name'].lower().startswith('xmpp') or - propertyValue['name'].lower().startswith('jabber')): + if not (property_value['name'].lower().startswith('xmpp') or + property_value['name'].lower().startswith('jabber')): continue - propertyFound = propertyValue + propertyFound = property_value break if propertyFound: actor_json['attachment'].remove(propertyFound) if notXmppAddress: return - for propertyValue in actor_json['attachment']: - if not propertyValue.get('name'): + for property_value in actor_json['attachment']: + if not property_value.get('name'): continue - if not propertyValue.get('type'): + if not property_value.get('type'): continue - nameLower = propertyValue['name'].lower() + nameLower = property_value['name'].lower() if not (nameLower.startswith('xmpp') or nameLower.startswith('jabber')): continue - if propertyValue['type'] != 'PropertyValue': + if property_value['type'] != 'PropertyValue': continue - propertyValue['value'] = xmppAddress + property_value['value'] = xmppAddress return newXmppAddress = {