Avoid default argument values to improve static analysis

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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