Reduce indents

main2
Bob Mottram 2019-10-18 19:57:34 +01:00
parent 124832ec56
commit 4ea799f264
15 changed files with 38 additions and 38 deletions

View File

@ -118,7 +118,7 @@ def undoAnnounceCollectionEntry(postFilename: str,actor: str,debug: bool) -> Non
while tries<5: while tries<5:
try: try:
with open(postFilename, 'w') as fp: with open(postFilename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -187,7 +187,7 @@ def updateAnnounceCollection(postFilename: str,actor: str,debug: bool) -> None:
while tries<5: while tries<5:
try: try:
with open(postFilename, 'w') as fp: with open(postFilename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -259,7 +259,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(newAnnounce, fp, indent=4, sort_keys=False) commentjson.dump(newAnnounce, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -44,7 +44,7 @@ def setAvailability(baseDir: str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -30,7 +30,7 @@ def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: {
while tries<5: while tries<5:
try: try:
with open(cacheFilename, 'w') as fp: with open(cacheFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False) commentjson.dump(personJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -164,7 +164,7 @@ def capabilitiesAccept(baseDir: str,httpPrefix: str, \
while tries<5: while tries<5:
try: try:
with open(ocapFilename, 'w') as fp: with open(ocapFilename, 'w') as fp:
commentjson.dump(ocapAccept, fp, indent=4, sort_keys=False) commentjson.dump(ocapAccept, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -185,7 +185,7 @@ def capabilitiesGrantedSave(baseDir :str,nickname :str,domain :str,ocap: {}) ->
while tries<5: while tries<5:
try: try:
with open(ocapFilename, 'w') as fp: with open(ocapFilename, 'w') as fp:
commentjson.dump(ocap, fp, indent=4, sort_keys=False) commentjson.dump(ocap, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -264,7 +264,7 @@ def capabilitiesUpdate(baseDir: str,httpPrefix: str, \
while tries<5: while tries<5:
try: try:
with open(ocapFilename, 'w') as fp: with open(ocapFilename, 'w') as fp:
commentjson.dump(ocapJson, fp, indent=4, sort_keys=False) commentjson.dump(ocapJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -311,7 +311,7 @@ def capabilitiesReceiveUpdate(baseDir :str, \
while tries<5: while tries<5:
try: try:
with open(ocapFilename, 'w') as fp: with open(ocapFilename, 'w') as fp:
commentjson.dump(ocapJson, fp, indent=4, sort_keys=False) commentjson.dump(ocapJson, fp, indent=2, sort_keys=False)
return True return True
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -23,7 +23,7 @@ def createConfig(baseDir: str) -> None:
while tries<5: while tries<5:
try: try:
with open(configFilename, 'w') as fp: with open(configFilename, 'w') as fp:
commentjson.dump(configJson, fp, indent=4, sort_keys=False) commentjson.dump(configJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -50,7 +50,7 @@ def setConfigParam(baseDir: str, variableName: str, variableValue) -> None:
while tries<5: while tries<5:
try: try:
with open(configFilename, 'w') as fp: with open(configFilename, 'w') as fp:
commentjson.dump(configJson, fp, indent=4, sort_keys=False) commentjson.dump(configJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -3587,7 +3587,7 @@ class PubServer(BaseHTTPRequestHandler):
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -3600,7 +3600,7 @@ class PubServer(BaseHTTPRequestHandler):
while tries<5: while tries<5:
try: try:
with open(actorCacheFilename, 'w') as fp: with open(actorCacheFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -416,7 +416,7 @@ def storeFollowRequest(baseDir: str, \
while tries<5: while tries<5:
try: try:
with open(followActivityfilename, 'w') as fp: with open(followActivityfilename, 'w') as fp:
commentjson.dump(followJson, fp, indent=4, sort_keys=False) commentjson.dump(followJson, fp, indent=2, sort_keys=False)
return True return True
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -293,7 +293,7 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(newQueueItem, fp, indent=4, sort_keys=False) commentjson.dump(newQueueItem, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -720,7 +720,7 @@ def personReceiveUpdate(baseDir: str, \
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False) commentjson.dump(personJson, fp, indent=2, sort_keys=False)
print('actor updated for '+personJson['id']) print('actor updated for '+personJson['id'])
break break
except Exception as e: except Exception as e:
@ -1605,7 +1605,7 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
while tries<5: while tries<5:
try: try:
with open(destinationFilename, 'w+') as fp: with open(destinationFilename, 'w+') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -1991,7 +1991,7 @@ def runInboxQueue(projectVersion: str, \
while tries<5: while tries<5:
try: try:
with open(sharedInboxPostFilename, 'w') as fp: with open(sharedInboxPostFilename, 'w') as fp:
commentjson.dump(queueJson['post'],fp,indent=4, \ commentjson.dump(queueJson['post'],fp,indent=2, \
sort_keys=False) sort_keys=False)
break break
except Exception as e: except Exception as e:

View File

@ -76,7 +76,7 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug:
while tries<5: while tries<5:
try: try:
with open(postFilename, 'w') as fp: with open(postFilename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -168,7 +168,7 @@ def updateLikesCollection(postFilename: str,objectUrl: str, actor: str,debug: bo
while tries<5: while tries<5:
try: try:
with open(postFilename, 'w') as fp: with open(postFilename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -110,7 +110,7 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(personFilename, 'w') as fp: with open(personFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False) commentjson.dump(personJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -154,7 +154,7 @@ def setOrganizationScheme(baseDir: str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -283,7 +283,7 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(newPerson, fp, indent=4, sort_keys=False) commentjson.dump(newPerson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -300,7 +300,7 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
while tries<5: while tries<5:
try: try:
with open(cacheFilename, 'w') as fp: with open(cacheFilename, 'w') as fp:
commentjson.dump(newPerson, fp, indent=4, sort_keys=False) commentjson.dump(newPerson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -597,7 +597,7 @@ def setDisplayNickname(baseDir: str,nickname: str, domain: str, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False) commentjson.dump(personJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -635,7 +635,7 @@ def setBio(baseDir: str,nickname: str, domain: str, bio: str) -> bool:
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False) commentjson.dump(personJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -429,7 +429,7 @@ def savePostToBox(baseDir: str,httpPrefix: str,postId: str, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -2234,7 +2234,7 @@ def getPublicPostsOfPerson(baseDir: str,nickname: str,domain: str, \
personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,displayName= \ personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,displayName= \
getPersonBox(baseDir,session,wfRequest,personCache, \ getPersonBox(baseDir,session,wfRequest,personCache, \
projectVersion,httpPrefix,nickname,domain,'outbox') projectVersion,httpPrefix,nickname,domain,'outbox')
wfResult = json.dumps(wfRequest, indent=4, sort_keys=False) wfResult = json.dumps(wfRequest, indent=2, sort_keys=False)
maxMentions=10 maxMentions=10
maxEmoji=10 maxEmoji=10
@ -2460,7 +2460,7 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str,nickname: str,domain:
while tries<5: while tries<5:
try: try:
with open(announceFilename, 'w') as fp: with open(announceFilename, 'w') as fp:
commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
return postJsonObject return postJsonObject
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -49,7 +49,7 @@ def clearModeratorStatus(baseDir: str) -> None:
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -143,7 +143,7 @@ def setRole(baseDir: str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -54,7 +54,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(sharesFilename, 'w') as fp: with open(sharesFilename, 'w') as fp:
commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) commentjson.dump(sharesJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -165,7 +165,7 @@ def addShare(baseDir: str, \
while tries<5: while tries<5:
try: try:
with open(sharesFilename, 'w') as fp: with open(sharesFilename, 'w') as fp:
commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) commentjson.dump(sharesJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -224,7 +224,7 @@ def expireSharesForAccount(baseDir: str,nickname: str,domain: str) -> None:
while tries<5: while tries<5:
try: try:
with open(sharesFilename, 'w') as fp: with open(sharesFilename, 'w') as fp:
commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) commentjson.dump(sharesJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print('WARN: commentjson exception expireSharesForAccount 2 - '+str(e)) print('WARN: commentjson exception expireSharesForAccount 2 - '+str(e))

View File

@ -51,7 +51,7 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -82,7 +82,7 @@ def setSkills(baseDir: str,nickname: str,domain: str,skills: {}) -> None:
while tries<5: while tries<5:
try: try:
with open(actorFilename, 'w') as fp: with open(actorFilename, 'w') as fp:
commentjson.dump(actorJson, fp, indent=4, sort_keys=False) commentjson.dump(actorJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -96,7 +96,7 @@ def storeWebfingerEndpoint(nickname: str,domain: str,port: int,baseDir: str, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(wfJson, fp, indent=4, sort_keys=False) commentjson.dump(wfJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)
@ -109,7 +109,7 @@ def storeWebfingerEndpoint(nickname: str,domain: str,port: int,baseDir: str, \
while tries<5: while tries<5:
try: try:
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
commentjson.dump(wfJson, fp, indent=4, sort_keys=False) commentjson.dump(wfJson, fp, indent=2, sort_keys=False)
break break
except Exception as e: except Exception as e:
print(e) print(e)