flake8 format

main
Bob Mottram 2020-04-04 12:40:47 +01:00
parent 05d2d3d983
commit a0930a61b8
1 changed files with 17 additions and 17 deletions

34
ssb.py
View File

@ -1,12 +1,11 @@
__filename__="ssb.py"
__author__="Bob Mottram"
__license__="AGPL3+"
__version__="1.1.0"
__maintainer__="Bob Mottram"
__email__="bob@freedombone.net"
__status__="Production"
__filename__ = "ssb.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.1.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
import json
def getSSBAddress(actorJson: {}) -> str:
"""Returns ssb address for the given actor
@ -22,9 +21,9 @@ def getSSBAddress(actorJson: {}) -> str:
continue
if not propertyValue.get('value'):
continue
if propertyValue['type']!='PropertyValue':
if propertyValue['type'] != 'PropertyValue':
continue
propertyValue['value']=propertyValue['value'].strip()
propertyValue['value'] = propertyValue['value'].strip()
if not propertyValue['value'].startswith('@'):
continue
if '=.' not in propertyValue['value']:
@ -38,14 +37,15 @@ def getSSBAddress(actorJson: {}) -> str:
return propertyValue['value']
return ''
def setSSBAddress(actorJson: {},ssbAddress: str) -> None:
def setSSBAddress(actorJson: {}, ssbAddress: str) -> None:
"""Sets an ssb address for the given actor
"""
if not actorJson.get('attachment'):
actorJson['attachment']=[]
actorJson['attachment'] = []
# remove any existing value
propertyFound=None
propertyFound = None
for propertyValue in actorJson['attachment']:
if not propertyValue.get('name'):
continue
@ -53,7 +53,7 @@ def setSSBAddress(actorJson: {},ssbAddress: str) -> None:
continue
if not propertyValue['name'].lower().startswith('ssb'):
continue
propertyFound=propertyValue
propertyFound = propertyValue
break
if propertyFound:
actorJson['attachment'].remove(propertyFound)
@ -76,12 +76,12 @@ def setSSBAddress(actorJson: {},ssbAddress: str) -> None:
continue
if not propertyValue['name'].lower().startswith('ssb'):
continue
if propertyValue['type']!='PropertyValue':
if propertyValue['type'] != 'PropertyValue':
continue
propertyValue['value']=ssbAddress
propertyValue['value'] = ssbAddress
return
newSSBAddress={
newSSBAddress = {
"name": "SSB",
"type": "PropertyValue",
"value": ssbAddress