diff --git a/acceptreject.py b/acceptreject.py index 9ce38ca9f..5bbba45ec 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -38,7 +38,7 @@ def _createAcceptReject(baseDir: str, federationList: [], newAccept = { "@context": "https://www.w3.org/ns/activitystreams", 'type': acceptType, - 'actor': httpPrefix+'://' + domain + '/users/' + nickname, + 'actor': httpPrefix + '://' + domain + '/users/' + nickname, 'to': [toUrl], 'cc': [], 'object': objectJson @@ -120,9 +120,9 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {}, print('DEBUG: unrecognized actor ' + thisActor) return else: - if not '/' + acceptedDomain+'/users/' + nickname in thisActor: + if not '/' + acceptedDomain + '/users/' + nickname in thisActor: if debug: - print('Expected: /' + acceptedDomain+'/users/' + nickname) + print('Expected: /' + acceptedDomain + '/users/' + nickname) print('Actual: ' + thisActor) print('DEBUG: unrecognized actor ' + thisActor) return @@ -134,7 +134,7 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {}, return followedDomainFull = followedDomain if port: - followedDomainFull = followedDomain+':' + str(port) + followedDomainFull = followedDomain + ':' + str(port) followedNickname = getNicknameFromActor(followedActor) if not followedNickname: print('DEBUG: no nickname found within Follow activity object ' + @@ -168,7 +168,7 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {}, else: if debug: print('DEBUG: Unable to create follow - ' + - nickname + '@' + acceptedDomain+' -> ' + + nickname + '@' + acceptedDomain + ' -> ' + followedNickname + '@' + followedDomain) diff --git a/announce.py b/announce.py index 97c9d4fb1..0f41fb0f1 100644 --- a/announce.py +++ b/announce.py @@ -198,9 +198,10 @@ def sendAnnounceViaServer(baseDir: str, session, statusNumber, published = getStatusNumber() newAnnounceId = httpPrefix + '://' + fromDomainFull + '/users/' + \ fromNickname + '/statuses/' + statusNumber + actorStr = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname newAnnounceJson = { "@context": "https://www.w3.org/ns/activitystreams", - 'actor': httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname, + 'actor': actorStr, 'atomUri': newAnnounceId, 'cc': [ccUrl], 'id': newAnnounceId + '/activity', diff --git a/auth.py b/auth.py index a73d4c3f3..42cf25fa2 100644 --- a/auth.py +++ b/auth.py @@ -134,7 +134,7 @@ def authorizeBasic(baseDir: str, path: str, authHeader: str, providedPassword = plain.split(':')[1] passfile = open(passwordFile, "r") for line in passfile: - if line.startswith(nickname+':'): + if line.startswith(nickname + ':'): storedPassword = \ line.split(':')[1].replace('\n', '').replace('\r', '') success = _verifyPassword(storedPassword, providedPassword) diff --git a/availability.py b/availability.py index 9df2173bd..3cedea24a 100644 --- a/availability.py +++ b/availability.py @@ -95,8 +95,8 @@ def sendAvailabilityViaServer(baseDir: str, session, newAvailabilityJson = { 'type': 'Availability', - 'actor': httpPrefix+'://'+domainFull+'/users/'+nickname, - 'object': '"'+status+'"', + 'actor': httpPrefix + '://' + domainFull + '/users/' + nickname, + 'object': '"' + status + '"', 'to': [toUrl], 'cc': [ccUrl] } diff --git a/bookmarks.py b/bookmarks.py index 9eece3f02..a2b595d91 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -243,7 +243,7 @@ def bookmark(recentPostsCache: {}, newBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Bookmark', - 'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname, + 'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname, 'object': objectUrl } if ccList: @@ -302,10 +302,10 @@ def undoBookmark(recentPostsCache: {}, newUndoBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Undo', - 'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname, + 'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname, 'object': { 'type': 'Bookmark', - 'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname, + 'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname, 'object': objectUrl } } diff --git a/cache.py b/cache.py index bf9e5a351..96608524e 100644 --- a/cache.py +++ b/cache.py @@ -20,7 +20,7 @@ def _removePersonFromCache(baseDir: str, personUrl: str, """Removes an actor from the cache """ cacheFilename = baseDir + '/cache/actors/' + \ - personUrl.replace('/', '#')+'.json' + personUrl.replace('/', '#') + '.json' if os.path.isfile(cacheFilename): try: os.remove(cacheFilename) @@ -70,7 +70,7 @@ def storePersonInCache(baseDir: str, personUrl: str, return if os.path.isdir(baseDir + '/cache/actors'): cacheFilename = baseDir + '/cache/actors/' + \ - personUrl.replace('/', '#')+'.json' + personUrl.replace('/', '#') + '.json' if not os.path.isfile(cacheFilename): saveJson(personJson, cacheFilename) @@ -84,7 +84,7 @@ def getPersonFromCache(baseDir: str, personUrl: str, personCache: {}, if not personCache.get(personUrl): # does the person exist as a cached file? cacheFilename = baseDir + '/cache/actors/' + \ - personUrl.replace('/', '#')+'.json' + personUrl.replace('/', '#') + '.json' actorFilename = getFileCaseInsensitive(cacheFilename) if actorFilename: personJson = loadJson(actorFilename) diff --git a/content.py b/content.py index 22ba06f0b..79d8b4dd0 100644 --- a/content.py +++ b/content.py @@ -306,7 +306,7 @@ def _addMusicTag(content: str, tag: str) -> str: musicSites = ('soundcloud.com', 'bandcamp.com') musicSiteFound = False for site in musicSites: - if site+'/' in content: + if site + '/' in content: musicSiteFound = True break if not musicSiteFound: @@ -458,7 +458,7 @@ def _addEmoji(baseDir: str, wordStr: str, 'type': 'Image', 'url': emojiUrl }, - 'name': ':'+emoji+':', + 'name': ':' + emoji + ':', "updated": fileLastModified(emojiFilename), "id": emojiUrl.replace('.png', ''), 'type': 'Emoji' @@ -820,7 +820,7 @@ def addHtmlTags(baseDir: str, httpPrefix: str, continue elif ':' in wordStr: wordStr2 = wordStr.split(':')[1] -# print('TAG: emoji located - '+wordStr) +# print('TAG: emoji located - ' + wordStr) if not emojiDict: # emoji.json is generated so that it can be customized and # the changes will be retained even if default_emoji.json @@ -830,7 +830,7 @@ def addHtmlTags(baseDir: str, httpPrefix: str, baseDir + '/emoji/emoji.json') emojiDict = loadJson(baseDir + '/emoji/emoji.json') -# print('TAG: looking up emoji for :'+wordStr2+':') +# print('TAG: looking up emoji for :' + wordStr2 + ':') _addEmoji(baseDir, ':' + wordStr2 + ':', httpPrefix, originalDomain, replaceEmoji, hashtags, emojiDict) diff --git a/epicyon.py b/epicyon.py index a36e4af93..34baebdff 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1092,7 +1092,7 @@ if args.message: toDomain = 'public' toPort = port - # ccUrl=httpPrefix+'://'+domain+'/users/'+nickname+'/followers' + # ccUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/followers' ccUrl = None sendMessage = args.message followersOnly = args.followersonly diff --git a/inbox.py b/inbox.py index 4fdc8ce04..a87a15f53 100644 --- a/inbox.py +++ b/inbox.py @@ -506,7 +506,7 @@ def _inboxPostRecipientsAdd(baseDir: str, httpPrefix: str, toList: [], if domainMatch in recipient: # get the handle for the local account nickname = recipient.split(domainMatch)[1] - handle = nickname+'@'+domain + handle = nickname + '@' + domain if os.path.isdir(baseDir + '/accounts/' + handle): recipientsDict[handle] = None else: diff --git a/person.py b/person.py index 401a4c00b..44468e4de 100644 --- a/person.py +++ b/person.py @@ -131,7 +131,7 @@ def setProfileImage(baseDir: str, httpPrefix: str, nickname: str, domain: str, personJson[iconFilenameBase]['mediaType'] = mediaType personJson[iconFilenameBase]['url'] = \ httpPrefix + '://' + fullDomain + '/users/' + \ - nickname + '/'+iconFilename + nickname + '/' + iconFilename saveJson(personJson, personFilename) cmd = \ diff --git a/posts.py b/posts.py index a5b562d4b..0788f4a60 100644 --- a/posts.py +++ b/posts.py @@ -1060,7 +1060,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int, httpPrefix + '://' + domain + '/users/' + nickname + \ '/statuses/' + statusNumber + '/replies' newPostUrl = \ - httpPrefix + '://' + domain + '/@' + nickname + '/'+statusNumber + httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber newPostAttributedTo = \ httpPrefix + '://' + domain + '/users/' + nickname newPost = { @@ -1120,7 +1120,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int, httpPrefix + '://' + domain + '/users/' + nickname + \ '/statuses/' + statusNumber + '/replies' newPostUrl = \ - httpPrefix + '://' + domain + '/@' + nickname+'/' + statusNumber + httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber newPost = { "@context": postContext, 'id': newPostId, @@ -2896,7 +2896,7 @@ def createModeration(baseDir: str, nickname: str, domain: str, port: int, pageNumber = 1 pageStr = '?page=' + str(pageNumber) - boxUrl = httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname + boxUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/' + boxname boxHeader = { '@context': 'https://www.w3.org/ns/activitystreams', 'first': boxUrl + '?page=true', @@ -3849,8 +3849,8 @@ def populateRepliesJson(baseDir: str, nickname: str, domain: str, searchFilename = \ baseDir + \ '/accounts/' + nickname + '@' + \ - domain+'/' + \ - boxname+'/' + \ + domain + '/' + \ + boxname + '/' + \ messageId2.replace('/', '#') + '.json' if os.path.isfile(searchFilename): if authorized or \ @@ -3877,7 +3877,7 @@ def populateRepliesJson(baseDir: str, nickname: str, domain: str, searchFilename = \ baseDir + \ '/accounts/inbox@' + \ - domain+'/inbox/' + \ + domain + '/inbox/' + \ messageId2.replace('/', '#') + '.json' if os.path.isfile(searchFilename): if authorized or \ diff --git a/tests.py b/tests.py index 58ca52853..b5e8c9b01 100644 --- a/tests.py +++ b/tests.py @@ -2045,7 +2045,7 @@ def _testAddEmoji(): tags.append(tag) content = contentModified contentModified = replaceEmojiFromTags(content, tags, 'content') - # print('contentModified: '+contentModified) + # print('contentModified: ' + contentModified) assert contentModified == '
Emoji 🍋 🍓 🍌
' os.chdir(baseDirOriginal) @@ -2124,7 +2124,7 @@ def _testRecentPostsCache(): htmlStr = '' for i in range(5): postJsonObject = { - "id": "https://somesite.whatever/users/someuser/statuses/"+str(i) + "id": "https://somesite.whatever/users/someuser/statuses/" + str(i) } updateRecentPostsCache(recentPostsCache, maxRecentPosts, postJsonObject, htmlStr) diff --git a/utils.py b/utils.py index 311d0e70f..47a1b392f 100644 --- a/utils.py +++ b/utils.py @@ -1563,10 +1563,10 @@ def getCachedPostFilename(baseDir: str, nickname: str, domain: str, """ cachedPostDir = getCachedPostDirectory(baseDir, nickname, domain) if not os.path.isdir(cachedPostDir): - # print('ERROR: invalid html cache directory '+cachedPostDir) + # print('ERROR: invalid html cache directory ' + cachedPostDir) return None if '@' not in cachedPostDir: - # print('ERROR: invalid html cache directory '+cachedPostDir) + # print('ERROR: invalid html cache directory ' + cachedPostDir) return None cachedPostId = removeIdEnding(postJsonObject['id']) cachedPostFilename = cachedPostDir + '/' + cachedPostId.replace('/', '#') @@ -1866,7 +1866,7 @@ def undoLikesCollectionEntry(recentPostsCache: {}, if not postJsonObject.get('object'): if debug: pprint(postJsonObject) - print('DEBUG: post '+objectUrl+' has no object') + print('DEBUG: post ' + objectUrl + ' has no object') return if not isinstance(postJsonObject['object'], dict): return diff --git a/webapp_headerbuttons.py b/webapp_headerbuttons.py index 61c239c1c..825dcc302 100644 --- a/webapp_headerbuttons.py +++ b/webapp_headerbuttons.py @@ -116,7 +116,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '' if not featuresHeader: diff --git a/webapp_profile.py b/webapp_profile.py index 5a08d2659..d73a0601f 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -534,7 +534,7 @@ def htmlProfile(rssIconAtTop: bool, if xmppAddress: donateSection += \ '' + translate['XMPP'] + ': '+xmppAddress + '
\n' + xmppAddress + '">' + xmppAddress + '\n' if matrixAddress: donateSection += \ '' + translate['Matrix'] + ': ' + matrixAddress + '
\n' @@ -1675,7 +1675,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, translate['Matrix'] + '