Snake case

merge-requests/30/head
Bob Mottram 2021-12-28 17:33:54 +00:00
parent 34e533f289
commit f75a321f9e
9 changed files with 109 additions and 109 deletions

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getBriarAddress(actor_json: {}) -> str:
def get_briar_address(actor_json: {}) -> str:
"""Returns briar address for the given actor
"""
if not actor_json.get('attachment'):
@ -43,7 +43,7 @@ def getBriarAddress(actor_json: {}) -> str:
return ''
def setBriarAddress(actor_json: {}, briarAddress: str) -> None:
def set_briar_address(actor_json: {}, briarAddress: str) -> None:
"""Sets an briar address for the given actor
"""
notBriarAddress = False

View File

@ -10,7 +10,7 @@ __module_group__ = "Profile Metadata"
import re
def getCwtchAddress(actor_json: {}) -> str:
def get_cwtch_address(actor_json: {}) -> str:
"""Returns cwtch address for the given actor
"""
if not actor_json.get('attachment'):
@ -41,7 +41,7 @@ def getCwtchAddress(actor_json: {}) -> str:
return ''
def setCwtchAddress(actor_json: {}, cwtchAddress: str) -> None:
def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
"""Sets an cwtch address for the given actor
"""
notCwtchAddress = False

124
daemon.py
View File

@ -31,24 +31,24 @@ from metadata import meta_data_node_info
from metadata import metadata_custom_emoji
from enigma import get_enigma_pub_key
from enigma import set_enigma_pub_key
from pgp import getEmailAddress
from pgp import setEmailAddress
from pgp import getPGPpubKey
from pgp import getPGPfingerprint
from pgp import setPGPpubKey
from pgp import setPGPfingerprint
from xmpp import getXmppAddress
from xmpp import setXmppAddress
from ssb import getSSBAddress
from ssb import setSSBAddress
from tox import getToxAddress
from tox import setToxAddress
from briar import getBriarAddress
from briar import setBriarAddress
from jami import getJamiAddress
from jami import setJamiAddress
from cwtch import getCwtchAddress
from cwtch import setCwtchAddress
from pgp import get_email_address
from pgp import set_email_address
from pgp import get_pgp_pub_key
from pgp import get_pgp_fingerprint
from pgp import set_pgp_pub_key
from pgp import set_pgp_fingerprint
from xmpp import get_xmpp_address
from xmpp import set_xmpp_address
from ssb import get_ssb_address
from ssb import set_ssb_address
from tox import get_tox_address
from tox import set_tox_address
from briar import get_briar_address
from briar import set_briar_address
from jami import get_jami_address
from jami import set_jami_address
from cwtch import get_cwtch_address
from cwtch import set_cwtch_address
from matrix import getMatrixAddress
from matrix import setMatrixAddress
from donate import getDonationUrl
@ -5264,26 +5264,26 @@ class PubServer(BaseHTTPRequestHandler):
'instanceDescription', '')
# change email address
currentEmailAddress = getEmailAddress(actor_json)
currentEmailAddress = get_email_address(actor_json)
if fields.get('email'):
if fields['email'] != currentEmailAddress:
setEmailAddress(actor_json, fields['email'])
set_email_address(actor_json, fields['email'])
actorChanged = True
else:
if currentEmailAddress:
setEmailAddress(actor_json, '')
set_email_address(actor_json, '')
actorChanged = True
# change xmpp address
currentXmppAddress = getXmppAddress(actor_json)
currentXmppAddress = get_xmpp_address(actor_json)
if fields.get('xmppAddress'):
if fields['xmppAddress'] != currentXmppAddress:
setXmppAddress(actor_json,
fields['xmppAddress'])
set_xmpp_address(actor_json,
fields['xmppAddress'])
actorChanged = True
else:
if currentXmppAddress:
setXmppAddress(actor_json, '')
set_xmpp_address(actor_json, '')
actorChanged = True
# change matrix address
@ -5299,15 +5299,15 @@ class PubServer(BaseHTTPRequestHandler):
actorChanged = True
# change SSB address
currentSSBAddress = getSSBAddress(actor_json)
currentSSBAddress = get_ssb_address(actor_json)
if fields.get('ssbAddress'):
if fields['ssbAddress'] != currentSSBAddress:
setSSBAddress(actor_json,
fields['ssbAddress'])
set_ssb_address(actor_json,
fields['ssbAddress'])
actorChanged = True
else:
if currentSSBAddress:
setSSBAddress(actor_json, '')
set_ssb_address(actor_json, '')
actorChanged = True
# change blog address
@ -5335,51 +5335,51 @@ class PubServer(BaseHTTPRequestHandler):
actorChanged = True
# change tox address
currentToxAddress = getToxAddress(actor_json)
currentToxAddress = get_tox_address(actor_json)
if fields.get('toxAddress'):
if fields['toxAddress'] != currentToxAddress:
setToxAddress(actor_json,
fields['toxAddress'])
set_tox_address(actor_json,
fields['toxAddress'])
actorChanged = True
else:
if currentToxAddress:
setToxAddress(actor_json, '')
set_tox_address(actor_json, '')
actorChanged = True
# change briar address
currentBriarAddress = getBriarAddress(actor_json)
currentBriarAddress = get_briar_address(actor_json)
if fields.get('briarAddress'):
if fields['briarAddress'] != currentBriarAddress:
setBriarAddress(actor_json,
fields['briarAddress'])
set_briar_address(actor_json,
fields['briarAddress'])
actorChanged = True
else:
if currentBriarAddress:
setBriarAddress(actor_json, '')
set_briar_address(actor_json, '')
actorChanged = True
# change jami address
currentJamiAddress = getJamiAddress(actor_json)
currentJamiAddress = get_jami_address(actor_json)
if fields.get('jamiAddress'):
if fields['jamiAddress'] != currentJamiAddress:
setJamiAddress(actor_json,
fields['jamiAddress'])
set_jami_address(actor_json,
fields['jamiAddress'])
actorChanged = True
else:
if currentJamiAddress:
setJamiAddress(actor_json, '')
set_jami_address(actor_json, '')
actorChanged = True
# change cwtch address
currentCwtchAddress = getCwtchAddress(actor_json)
currentCwtchAddress = get_cwtch_address(actor_json)
if fields.get('cwtchAddress'):
if fields['cwtchAddress'] != currentCwtchAddress:
setCwtchAddress(actor_json,
fields['cwtchAddress'])
set_cwtch_address(actor_json,
fields['cwtchAddress'])
actorChanged = True
else:
if currentCwtchAddress:
setCwtchAddress(actor_json, '')
set_cwtch_address(actor_json, '')
actorChanged = True
# change Enigma public key
@ -5395,27 +5395,27 @@ class PubServer(BaseHTTPRequestHandler):
actorChanged = True
# change PGP public key
currentPGPpubKey = getPGPpubKey(actor_json)
currentPGPpubKey = get_pgp_pub_key(actor_json)
if fields.get('pgp'):
if fields['pgp'] != currentPGPpubKey:
setPGPpubKey(actor_json,
fields['pgp'])
set_pgp_pub_key(actor_json,
fields['pgp'])
actorChanged = True
else:
if currentPGPpubKey:
setPGPpubKey(actor_json, '')
set_pgp_pub_key(actor_json, '')
actorChanged = True
# change PGP fingerprint
currentPGPfingerprint = getPGPfingerprint(actor_json)
currentPGPfingerprint = get_pgp_fingerprint(actor_json)
if fields.get('openpgp'):
if fields['openpgp'] != currentPGPfingerprint:
setPGPfingerprint(actor_json,
fields['openpgp'])
set_pgp_fingerprint(actor_json,
fields['openpgp'])
actorChanged = True
else:
if currentPGPfingerprint:
setPGPfingerprint(actor_json, '')
set_pgp_fingerprint(actor_json, '')
actorChanged = True
# change donation link
@ -7113,18 +7113,18 @@ class PubServer(BaseHTTPRequestHandler):
lockedAccount = get_locked_account(actor_json)
donateUrl = getDonationUrl(actor_json)
websiteUrl = getWebsite(actor_json, self.server.translate)
xmppAddress = getXmppAddress(actor_json)
xmppAddress = get_xmpp_address(actor_json)
matrixAddress = getMatrixAddress(actor_json)
ssbAddress = getSSBAddress(actor_json)
ssbAddress = get_ssb_address(actor_json)
blogAddress = getBlogAddress(actor_json)
toxAddress = getToxAddress(actor_json)
briarAddress = getBriarAddress(actor_json)
jamiAddress = getJamiAddress(actor_json)
cwtchAddress = getCwtchAddress(actor_json)
emailAddress = getEmailAddress(actor_json)
toxAddress = get_tox_address(actor_json)
briarAddress = get_briar_address(actor_json)
jamiAddress = get_jami_address(actor_json)
cwtchAddress = get_cwtch_address(actor_json)
emailAddress = get_email_address(actor_json)
EnigmaPubKey = get_enigma_pub_key(actor_json)
PGPpubKey = getPGPpubKey(actor_json)
PGPfingerprint = getPGPfingerprint(actor_json)
PGPpubKey = get_pgp_pub_key(actor_json)
PGPfingerprint = get_pgp_fingerprint(actor_json)
if actor_json.get('alsoKnownAs'):
alsoKnownAs = actor_json['alsoKnownAs']

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getJamiAddress(actor_json: {}) -> str:
def get_jami_address(actor_json: {}) -> str:
"""Returns jami address for the given actor
"""
if not actor_json.get('attachment'):
@ -39,7 +39,7 @@ def getJamiAddress(actor_json: {}) -> str:
return ''
def setJamiAddress(actor_json: {}, jamiAddress: str) -> None:
def set_jami_address(actor_json: {}, jamiAddress: str) -> None:
"""Sets an jami address for the given actor
"""
notJamiAddress = False

16
pgp.py
View File

@ -23,7 +23,7 @@ from auth import createBasicAuthHeader
from session import postJson
def getEmailAddress(actor_json: {}) -> str:
def get_email_address(actor_json: {}) -> str:
"""Returns the email address for the given actor
"""
if not actor_json.get('attachment'):
@ -47,7 +47,7 @@ def getEmailAddress(actor_json: {}) -> str:
return ''
def getPGPpubKey(actor_json: {}) -> str:
def get_pgp_pub_key(actor_json: {}) -> str:
"""Returns PGP public key for the given actor
"""
if not actor_json.get('attachment'):
@ -69,7 +69,7 @@ def getPGPpubKey(actor_json: {}) -> str:
return ''
def getPGPfingerprint(actor_json: {}) -> str:
def get_pgp_fingerprint(actor_json: {}) -> str:
"""Returns PGP fingerprint for the given actor
"""
if not actor_json.get('attachment'):
@ -91,7 +91,7 @@ def getPGPfingerprint(actor_json: {}) -> str:
return ''
def setEmailAddress(actor_json: {}, emailAddress: str) -> None:
def set_email_address(actor_json: {}, emailAddress: str) -> None:
"""Sets the email address for the given actor
"""
notEmailAddress = False
@ -143,7 +143,7 @@ def setEmailAddress(actor_json: {}, emailAddress: str) -> None:
actor_json['attachment'].append(newEmailAddress)
def setPGPpubKey(actor_json: {}, PGPpubKey: str) -> None:
def set_pgp_pub_key(actor_json: {}, PGPpubKey: str) -> None:
"""Sets a PGP public key for the given actor
"""
removeKey = False
@ -194,7 +194,7 @@ def setPGPpubKey(actor_json: {}, PGPpubKey: str) -> None:
actor_json['attachment'].append(newPGPpubKey)
def setPGPfingerprint(actor_json: {}, fingerprint: str) -> None:
def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
"""Sets a PGP fingerprint for the given actor
"""
removeFingerprint = False
@ -532,14 +532,14 @@ def pgpPublicKeyUpload(base_dir: str, session,
# set the pgp details
if PGPpubKeyId:
setPGPfingerprint(actor_json, PGPpubKeyId)
set_pgp_fingerprint(actor_json, PGPpubKeyId)
else:
if debug:
print('No PGP key Id. Continuing anyway.')
if debug:
print('Setting PGP key within ' + actor)
setPGPpubKey(actor_json, PGPpubKey)
set_pgp_pub_key(actor_json, PGPpubKey)
# create an actor update
statusNumber, published = get_status_number()

4
ssb.py
View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getSSBAddress(actor_json: {}) -> str:
def get_ssb_address(actor_json: {}) -> str:
"""Returns ssb address for the given actor
"""
if not actor_json.get('attachment'):
@ -39,7 +39,7 @@ def getSSBAddress(actor_json: {}) -> str:
return ''
def setSSBAddress(actor_json: {}, ssbAddress: str) -> None:
def set_ssb_address(actor_json: {}, ssbAddress: str) -> None:
"""Sets an ssb address for the given actor
"""
notSSBAddress = False

4
tox.py
View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getToxAddress(actor_json: {}) -> str:
def get_tox_address(actor_json: {}) -> str:
"""Returns tox address for the given actor
"""
if not actor_json.get('attachment'):
@ -41,7 +41,7 @@ def getToxAddress(actor_json: {}) -> str:
return ''
def setToxAddress(actor_json: {}, toxAddress: str) -> None:
def set_tox_address(actor_json: {}, toxAddress: str) -> None:
"""Sets an tox address for the given actor
"""
notToxAddress = False

View File

@ -41,17 +41,17 @@ from posts import parseUserFeed
from posts import isCreateInsideAnnounce
from donate import getDonationUrl
from donate import getWebsite
from xmpp import getXmppAddress
from xmpp import get_xmpp_address
from matrix import getMatrixAddress
from ssb import getSSBAddress
from pgp import getEmailAddress
from pgp import getPGPfingerprint
from pgp import getPGPpubKey
from ssb import get_ssb_address
from pgp import get_email_address
from pgp import get_pgp_fingerprint
from pgp import get_pgp_pub_key
from enigma import get_enigma_pub_key
from tox import getToxAddress
from briar import getBriarAddress
from jami import getJamiAddress
from cwtch import getCwtchAddress
from tox import get_tox_address
from briar import get_briar_address
from jami import get_jami_address
from cwtch import get_cwtch_address
from filters import isFiltered
from follow import isFollowerOfPerson
from follow import getFollowerDomains
@ -636,16 +636,16 @@ def htmlProfile(signing_priv_key_pem: str,
websiteUrl = getWebsite(profile_json, translate)
blogAddress = getBlogAddress(profile_json)
EnigmaPubKey = get_enigma_pub_key(profile_json)
PGPpubKey = getPGPpubKey(profile_json)
PGPfingerprint = getPGPfingerprint(profile_json)
emailAddress = getEmailAddress(profile_json)
xmppAddress = getXmppAddress(profile_json)
PGPpubKey = get_pgp_pub_key(profile_json)
PGPfingerprint = get_pgp_fingerprint(profile_json)
emailAddress = get_email_address(profile_json)
xmppAddress = get_xmpp_address(profile_json)
matrixAddress = getMatrixAddress(profile_json)
ssbAddress = getSSBAddress(profile_json)
toxAddress = getToxAddress(profile_json)
briarAddress = getBriarAddress(profile_json)
jamiAddress = getJamiAddress(profile_json)
cwtchAddress = getCwtchAddress(profile_json)
ssbAddress = get_ssb_address(profile_json)
toxAddress = get_tox_address(profile_json)
briarAddress = get_briar_address(profile_json)
jamiAddress = get_jami_address(profile_json)
cwtchAddress = get_cwtch_address(profile_json)
if donateUrl or websiteUrl or xmppAddress or matrixAddress or \
ssbAddress or toxAddress or briarAddress or \
jamiAddress or cwtchAddress or PGPpubKey or EnigmaPubKey or \
@ -2132,18 +2132,18 @@ def htmlEditProfile(css_cache: {}, translate: {}, base_dir: str, path: str,
movedTo = actor_json['movedTo']
donateUrl = getDonationUrl(actor_json)
websiteUrl = getWebsite(actor_json, translate)
xmppAddress = getXmppAddress(actor_json)
xmppAddress = get_xmpp_address(actor_json)
matrixAddress = getMatrixAddress(actor_json)
ssbAddress = getSSBAddress(actor_json)
ssbAddress = get_ssb_address(actor_json)
blogAddress = getBlogAddress(actor_json)
toxAddress = getToxAddress(actor_json)
briarAddress = getBriarAddress(actor_json)
jamiAddress = getJamiAddress(actor_json)
cwtchAddress = getCwtchAddress(actor_json)
emailAddress = getEmailAddress(actor_json)
toxAddress = get_tox_address(actor_json)
briarAddress = get_briar_address(actor_json)
jamiAddress = get_jami_address(actor_json)
cwtchAddress = get_cwtch_address(actor_json)
emailAddress = get_email_address(actor_json)
EnigmaPubKey = get_enigma_pub_key(actor_json)
PGPpubKey = getPGPpubKey(actor_json)
PGPfingerprint = getPGPfingerprint(actor_json)
PGPpubKey = get_pgp_pub_key(actor_json)
PGPfingerprint = get_pgp_fingerprint(actor_json)
if actor_json.get('name'):
if not isFiltered(base_dir, nickname, domain, actor_json['name']):
displayNickname = actor_json['name']

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getXmppAddress(actor_json: {}) -> str:
def get_xmpp_address(actor_json: {}) -> str:
"""Returns xmpp address for the given actor
"""
if not actor_json.get('attachment'):
@ -34,7 +34,7 @@ def getXmppAddress(actor_json: {}) -> str:
return ''
def setXmppAddress(actor_json: {}, xmppAddress: str) -> None:
def set_xmpp_address(actor_json: {}, xmppAddress: str) -> None:
"""Sets an xmpp address for the given actor
"""
notXmppAddress = False