Avoid default argument values to improve static analysis

merge-requests/26/head
Bob Mottram 2021-09-27 13:09:25 +01:00
parent 3a01b88d66
commit 7491a75574
7 changed files with 34 additions and 26 deletions

View File

@ -6968,6 +6968,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
self.postToNickname, domain)
showRepeats = not isDM(announceJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -6990,7 +6991,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(announceJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -7422,6 +7423,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
self.postToNickname, domain)
showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -7445,7 +7447,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(likedPostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -7565,6 +7567,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
self.postToNickname, domain)
showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -7587,7 +7590,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(likedPostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -7697,6 +7700,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -7719,7 +7723,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(bookmarkPostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -7830,6 +7834,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -7852,7 +7857,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(bookmarkPostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -8031,6 +8036,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
nickname, domain)
showRepeats = not isDM(mutePostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -8053,7 +8059,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(mutePostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)
@ -8129,8 +8135,8 @@ class PubServer(BaseHTTPRequestHandler):
print('Unmuted post cache: ' + str(cachedPostFilename))
showIndividualPostIcons = True
manuallyApproveFollowers = \
followerApprovalActive(baseDir,
nickname, domain)
followerApprovalActive(baseDir, nickname, domain)
showRepeats = not isDM(mutePostJson)
individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache,
self.server.maxRecentPosts,
@ -8153,7 +8159,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName,
self.server.systemLanguage,
self.server.maxLikeCount,
not isDM(mutePostJson),
showRepeats,
showIndividualPostIcons,
manuallyApproveFollowers,
False, True, False)

View File

@ -204,7 +204,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess,
themeName, systemLanguage, maxLikeCount,
notDM, True, True, False, True)
notDM, True, True, False, True, False)
def validInbox(baseDir: str, nickname: str, domain: str) -> bool:

View File

@ -79,7 +79,7 @@ def htmlConfirmDelete(cssCache: {},
showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess,
themeName, systemLanguage, maxLikeCount,
False, False, False, False, False)
False, False, False, False, False, False)
deletePostStr += '<center>'
deletePostStr += \
' <p class="followText">' + \

View File

@ -80,7 +80,8 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
allowLocalNetworkAccess,
themeName, systemLanguage,
maxLikeCount,
False, False, False, True, False)
False, False, False,
True, False, False)
if postStr:
profileStr += postStr + separatorStr
ctr += 1

View File

@ -1196,12 +1196,12 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
maxLikeCount: int,
showRepeats: bool = True,
showIcons: bool = False,
manuallyApprovesFollowers: bool = False,
showPublicOnly: bool = False,
storeToCache: bool = True,
useCacheOnly: bool = False) -> str:
showRepeats: bool,
showIcons: bool,
manuallyApprovesFollowers: bool,
showPublicOnly: bool,
storeToCache: bool,
useCacheOnly: bool) -> str:
""" Shows a single post as html
"""
if not postJsonObject:
@ -1870,7 +1870,7 @@ def htmlIndividualPost(cssCache: {},
peertubeInstances,
allowLocalNetworkAccess, themeName,
systemLanguage, maxLikeCount,
False, authorized, False, False, False)
False, authorized, False, False, False, False)
messageId = removeIdEnding(postJsonObject['id'])
# show the previous posts
@ -1902,7 +1902,7 @@ def htmlIndividualPost(cssCache: {},
themeName, systemLanguage,
maxLikeCount,
False, authorized,
False, False, False) + postStr
False, False, False, False) + postStr
# show the following posts
postFilename = locatePost(baseDir, nickname, domain, messageId)
@ -1936,7 +1936,7 @@ def htmlIndividualPost(cssCache: {},
themeName, systemLanguage,
maxLikeCount,
False, authorized,
False, False, False)
False, False, False, False)
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
@ -1983,7 +1983,7 @@ def htmlPostReplies(cssCache: {},
allowLocalNetworkAccess,
themeName, systemLanguage,
maxLikeCount,
False, False, False, False, False)
False, False, False, False, False, False)
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):

View File

@ -306,7 +306,7 @@ def htmlProfileAfterSearch(cssCache: {},
peertubeInstances,
allowLocalNetworkAccess,
themeName, systemLanguage, maxLikeCount,
False, False, False, False, False)
False, False, False, False, False, False)
i += 1
if i >= 8:
break
@ -1007,7 +1007,8 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
allowLocalNetworkAccess,
themeName, systemLanguage,
maxLikeCount,
False, False, False, True, False)
False, False, False,
True, False, False)
if postStr:
profileStr += postStr + separatorStr
ctr += 1

View File

@ -663,7 +663,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
themeName, systemLanguage, maxLikeCount,
showIndividualPostIcons,
showIndividualPostIcons,
False, False, False)
False, False, False, False)
if postStr:
historySearchForm += separatorStr + postStr
index += 1
@ -844,7 +844,7 @@ def htmlHashtagSearch(cssCache: {},
showRepeats, showIcons,
manuallyApprovesFollowers,
showPublicOnly,
storeToCache)
storeToCache, False)
if postStr:
hashtagSearchForm += separatorStr + postStr
index += 1