From 4ea799f264bbeb50ab504704e08cfcf6901750d9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 18 Oct 2019 19:57:34 +0100 Subject: [PATCH] Reduce indents --- announce.py | 6 +++--- availability.py | 2 +- cache.py | 2 +- capabilities.py | 8 ++++---- config.py | 4 ++-- daemon.py | 4 ++-- follow.py | 2 +- inbox.py | 8 ++++---- like.py | 4 ++-- person.py | 12 ++++++------ posts.py | 6 +++--- roles.py | 4 ++-- shares.py | 6 +++--- skills.py | 4 ++-- webfinger.py | 4 ++-- 15 files changed, 38 insertions(+), 38 deletions(-) diff --git a/announce.py b/announce.py index 01442b16..79452769 100644 --- a/announce.py +++ b/announce.py @@ -118,7 +118,7 @@ def undoAnnounceCollectionEntry(postFilename: str,actor: str,debug: bool) -> Non while tries<5: try: 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 except Exception as e: print(e) @@ -187,7 +187,7 @@ def updateAnnounceCollection(postFilename: str,actor: str,debug: bool) -> None: while tries<5: try: 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 except Exception as e: print(e) @@ -259,7 +259,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \ while tries<5: try: 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 except Exception as e: print(e) diff --git a/availability.py b/availability.py index 68dee85a..46eef175 100644 --- a/availability.py +++ b/availability.py @@ -44,7 +44,7 @@ def setAvailability(baseDir: str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) diff --git a/cache.py b/cache.py index d09046b5..5694fe4e 100644 --- a/cache.py +++ b/cache.py @@ -30,7 +30,7 @@ def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: { while tries<5: try: 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 except Exception as e: print(e) diff --git a/capabilities.py b/capabilities.py index 0e460a15..03f2340f 100644 --- a/capabilities.py +++ b/capabilities.py @@ -164,7 +164,7 @@ def capabilitiesAccept(baseDir: str,httpPrefix: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -185,7 +185,7 @@ def capabilitiesGrantedSave(baseDir :str,nickname :str,domain :str,ocap: {}) -> while tries<5: try: 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 except Exception as e: print(e) @@ -264,7 +264,7 @@ def capabilitiesUpdate(baseDir: str,httpPrefix: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -311,7 +311,7 @@ def capabilitiesReceiveUpdate(baseDir :str, \ while tries<5: try: 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 except Exception as e: print(e) diff --git a/config.py b/config.py index bd5a1f02..413f2d4a 100644 --- a/config.py +++ b/config.py @@ -23,7 +23,7 @@ def createConfig(baseDir: str) -> None: while tries<5: try: 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 except Exception as e: print(e) @@ -50,7 +50,7 @@ def setConfigParam(baseDir: str, variableName: str, variableValue) -> None: while tries<5: try: 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 except Exception as e: print(e) diff --git a/daemon.py b/daemon.py index 9a0aa967..4484c108 100644 --- a/daemon.py +++ b/daemon.py @@ -3587,7 +3587,7 @@ class PubServer(BaseHTTPRequestHandler): while tries<5: try: 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 except Exception as e: print(e) @@ -3600,7 +3600,7 @@ class PubServer(BaseHTTPRequestHandler): while tries<5: try: 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 except Exception as e: print(e) diff --git a/follow.py b/follow.py index 90c434b0..31a3c115 100644 --- a/follow.py +++ b/follow.py @@ -416,7 +416,7 @@ def storeFollowRequest(baseDir: str, \ while tries<5: try: 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 except Exception as e: print(e) diff --git a/inbox.py b/inbox.py index 70695e9c..5420153a 100644 --- a/inbox.py +++ b/inbox.py @@ -293,7 +293,7 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -720,7 +720,7 @@ def personReceiveUpdate(baseDir: str, \ while tries<5: try: 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']) break except Exception as e: @@ -1605,7 +1605,7 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ while tries<5: try: 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 except Exception as e: print(e) @@ -1991,7 +1991,7 @@ def runInboxQueue(projectVersion: str, \ while tries<5: try: with open(sharedInboxPostFilename, 'w') as fp: - commentjson.dump(queueJson['post'],fp,indent=4, \ + commentjson.dump(queueJson['post'],fp,indent=2, \ sort_keys=False) break except Exception as e: diff --git a/like.py b/like.py index ceaafda3..4afda6f4 100644 --- a/like.py +++ b/like.py @@ -76,7 +76,7 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug: while tries<5: try: 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 except Exception as e: print(e) @@ -168,7 +168,7 @@ def updateLikesCollection(postFilename: str,objectUrl: str, actor: str,debug: bo while tries<5: try: 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 except Exception as e: print(e) diff --git a/person.py b/person.py index 89f135a8..c2a7ad1d 100644 --- a/person.py +++ b/person.py @@ -110,7 +110,7 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -154,7 +154,7 @@ def setOrganizationScheme(baseDir: str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -283,7 +283,7 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \ while tries<5: try: 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 except Exception as e: print(e) @@ -300,7 +300,7 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \ while tries<5: try: 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 except Exception as e: print(e) @@ -597,7 +597,7 @@ def setDisplayNickname(baseDir: str,nickname: str, domain: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -635,7 +635,7 @@ def setBio(baseDir: str,nickname: str, domain: str, bio: str) -> bool: while tries<5: try: 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 except Exception as e: print(e) diff --git a/posts.py b/posts.py index 580c693e..9fc5f4f8 100644 --- a/posts.py +++ b/posts.py @@ -429,7 +429,7 @@ def savePostToBox(baseDir: str,httpPrefix: str,postId: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -2234,7 +2234,7 @@ def getPublicPostsOfPerson(baseDir: str,nickname: str,domain: str, \ personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,displayName= \ getPersonBox(baseDir,session,wfRequest,personCache, \ 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 maxEmoji=10 @@ -2460,7 +2460,7 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str,nickname: str,domain: while tries<5: try: 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 except Exception as e: print(e) diff --git a/roles.py b/roles.py index 68f59aec..448b80e9 100644 --- a/roles.py +++ b/roles.py @@ -49,7 +49,7 @@ def clearModeratorStatus(baseDir: str) -> None: while tries<5: try: 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 except Exception as e: print(e) @@ -143,7 +143,7 @@ def setRole(baseDir: str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) diff --git a/shares.py b/shares.py index 11a970cf..718511b2 100644 --- a/shares.py +++ b/shares.py @@ -54,7 +54,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -165,7 +165,7 @@ def addShare(baseDir: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -224,7 +224,7 @@ def expireSharesForAccount(baseDir: str,nickname: str,domain: str) -> None: while tries<5: try: 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 except Exception as e: print('WARN: commentjson exception expireSharesForAccount 2 - '+str(e)) diff --git a/skills.py b/skills.py index aac9cf44..a9bef6e1 100644 --- a/skills.py +++ b/skills.py @@ -51,7 +51,7 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -82,7 +82,7 @@ def setSkills(baseDir: str,nickname: str,domain: str,skills: {}) -> None: while tries<5: try: 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 except Exception as e: print(e) diff --git a/webfinger.py b/webfinger.py index a8743a08..28af3f99 100644 --- a/webfinger.py +++ b/webfinger.py @@ -96,7 +96,7 @@ def storeWebfingerEndpoint(nickname: str,domain: str,port: int,baseDir: str, \ while tries<5: try: 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 except Exception as e: print(e) @@ -109,7 +109,7 @@ def storeWebfingerEndpoint(nickname: str,domain: str,port: int,baseDir: str, \ while tries<5: try: 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 except Exception as e: print(e)