From c63e319bb9fe0475f844ad226a031a2a41501e1e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 25 Dec 2021 18:49:19 +0000 Subject: [PATCH] Snake case --- daemon.py | 8 ++++---- epicyon.py | 26 +++++++++++++------------- newsdaemon.py | 4 ++-- newswire.py | 6 +++--- tests.py | 16 ++++++++-------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/daemon.py b/daemon.py index 66ab5ceb3..dec16f0d5 100644 --- a/daemon.py +++ b/daemon.py @@ -18415,7 +18415,7 @@ def runDaemon(content_license_url: str, verify_all_signatures: bool, send_threads_timeout_mins: int, dormant_months: int, - maxNewswirePosts: int, + max_newswire_posts: int, allowLocalNetworkAccess: bool, maxFeedItemSizeKb: int, publishButtonAtTop: bool, @@ -18427,7 +18427,7 @@ def runDaemon(content_license_url: str, maxNewsPosts: int, maxMirroredArticles: int, maxNewswireFeedSizeKb: int, - maxNewswirePostsPerSource: int, + max_newswire_postsPerSource: int, showPublishedDateOnly: bool, votingTimeMins: int, positiveVoting: bool, @@ -18576,7 +18576,7 @@ def runDaemon(content_license_url: str, httpd.newswire = {} # maximum number of posts to appear in the newswire on the right column - httpd.maxNewswirePosts = maxNewswirePosts + httpd.max_newswire_posts = max_newswire_posts # whether to require that all incoming posts have valid jsonld signatures httpd.verify_all_signatures = verify_all_signatures @@ -18627,7 +18627,7 @@ def runDaemon(content_license_url: str, # this is the maximum number of posts to show for each. # This avoids one or two sources from dominating the news, # and also prevents big feeds from slowing down page load times - httpd.maxNewswirePostsPerSource = maxNewswirePostsPerSource + httpd.max_newswire_postsPerSource = max_newswire_postsPerSource # Show only the date at the bottom of posts, and not the time httpd.showPublishedDateOnly = showPublishedDateOnly diff --git a/epicyon.py b/epicyon.py index bf81be3f3..1deb60958 100644 --- a/epicyon.py +++ b/epicyon.py @@ -173,7 +173,7 @@ parser.add_argument('-p', '--port', dest='port', type=int, default=None, help='Port number to run on') parser.add_argument('--postsPerSource', - dest='maxNewswirePostsPerSource', type=int, + dest='max_newswire_postsPerSource', type=int, default=4, help='Maximum newswire posts per feed or account') parser.add_argument('--dormant_months', @@ -191,8 +191,8 @@ parser.add_argument('--send_threads_timeout_mins', default=30, help='How many minutes before a thread to send out ' + 'posts expires') -parser.add_argument('--maxNewswirePosts', - dest='maxNewswirePosts', type=int, +parser.add_argument('--max_newswire_posts', + dest='max_newswire_posts', type=int, default=20, help='Maximum newswire posts in the right column') parser.add_argument('--maxFeedSize', @@ -3026,16 +3026,16 @@ if dateonly: args.dateonly = dateonly # set the maximum number of newswire posts per account or rss feed -maxNewswirePostsPerSource = \ - getConfigParam(base_dir, 'maxNewswirePostsPerSource') -if maxNewswirePostsPerSource: - args.maxNewswirePostsPerSource = int(maxNewswirePostsPerSource) +max_newswire_postsPerSource = \ + getConfigParam(base_dir, 'max_newswire_postsPerSource') +if max_newswire_postsPerSource: + args.max_newswire_postsPerSource = int(max_newswire_postsPerSource) # set the maximum number of newswire posts appearing in the right column -maxNewswirePosts = \ - getConfigParam(base_dir, 'maxNewswirePosts') -if maxNewswirePosts: - args.maxNewswirePosts = int(maxNewswirePosts) +max_newswire_posts = \ + getConfigParam(base_dir, 'max_newswire_posts') +if max_newswire_posts: + args.max_newswire_posts = int(max_newswire_posts) # set the maximum size of a newswire rss/atom feed in Kilobytes maxNewswireFeedSizeKb = \ @@ -3224,7 +3224,7 @@ if __name__ == "__main__": args.verify_all_signatures, args.send_threads_timeout_mins, args.dormant_months, - args.maxNewswirePosts, + args.max_newswire_posts, args.allowLocalNetworkAccess, args.maxFeedItemSizeKb, args.publishButtonAtTop, @@ -3236,7 +3236,7 @@ if __name__ == "__main__": args.maxNewsPosts, args.maxMirroredArticles, args.maxNewswireFeedSizeKb, - args.maxNewswirePostsPerSource, + args.max_newswire_postsPerSource, args.dateonly, args.votingtime, args.positivevoting, diff --git a/newsdaemon.py b/newsdaemon.py index 3d50cf247..386e1f75f 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -796,11 +796,11 @@ def runNewswireDaemon(base_dir: str, httpd, print('Updating newswire feeds') newNewswire = \ getDictFromNewswire(httpd.session, base_dir, domain, - httpd.maxNewswirePostsPerSource, + httpd.max_newswire_postsPerSource, httpd.maxNewswireFeedSizeKb, httpd.maxTags, httpd.maxFeedItemSizeKb, - httpd.maxNewswirePosts, + httpd.max_newswire_posts, httpd.maxCategoriesFeedItemSizeKb, httpd.systemLanguage, httpd.debug) diff --git a/newswire.py b/newswire.py index aa5b214e1..ca2dc8801 100644 --- a/newswire.py +++ b/newswire.py @@ -1136,7 +1136,7 @@ def _addBlogsToNewswire(base_dir: str, domain: str, newswire: {}, def getDictFromNewswire(session, base_dir: str, domain: str, maxPostsPerSource: int, maxFeedSizeKb: int, maxTags: int, maxFeedItemSizeKb: int, - maxNewswirePosts: int, + max_newswire_posts: int, maxCategoriesFeedItemSizeKb: int, systemLanguage: str, debug: bool) -> {}: """Gets rss feeds as a dictionary from newswire file @@ -1194,12 +1194,12 @@ def getDictFromNewswire(session, base_dir: str, domain: str, # are there too many posts? If so then remove the oldest ones noOfPosts = len(sortedResult.items()) - if noOfPosts > maxNewswirePosts: + if noOfPosts > max_newswire_posts: ctr = 0 removals = [] for dateStr, item in sortedResult.items(): ctr += 1 - if ctr > maxNewswirePosts: + if ctr > max_newswire_posts: removals.append(dateStr) for r in removals: sortedResult.pop(r) diff --git a/tests.py b/tests.py index 14c01de58..57ea94b36 100644 --- a/tests.py +++ b/tests.py @@ -780,7 +780,7 @@ def createServerAlice(path: str, domain: str, port: int, onionDomain = None i2pDomain = None allowLocalNetworkAccess = True - maxNewswirePosts = 20 + max_newswire_posts = 20 dormant_months = 3 send_threads_timeout_mins = 30 maxFollowers = 10 @@ -807,7 +807,7 @@ def createServerAlice(path: str, domain: str, port: int, broch_mode, verify_all_signatures, send_threads_timeout_mins, - dormant_months, maxNewswirePosts, + dormant_months, max_newswire_posts, allowLocalNetworkAccess, 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, @@ -922,7 +922,7 @@ def createServerBob(path: str, domain: str, port: int, onionDomain = None i2pDomain = None allowLocalNetworkAccess = True - maxNewswirePosts = 20 + max_newswire_posts = 20 dormant_months = 3 send_threads_timeout_mins = 30 maxFollowers = 10 @@ -949,7 +949,7 @@ def createServerBob(path: str, domain: str, port: int, broch_mode, verify_all_signatures, send_threads_timeout_mins, - dormant_months, maxNewswirePosts, + dormant_months, max_newswire_posts, allowLocalNetworkAccess, 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, 0, @@ -991,7 +991,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [], onionDomain = None i2pDomain = None allowLocalNetworkAccess = True - maxNewswirePosts = 20 + max_newswire_posts = 20 dormant_months = 3 send_threads_timeout_mins = 30 maxFollowers = 10 @@ -1019,7 +1019,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [], broch_mode, verify_all_signatures, send_threads_timeout_mins, - dormant_months, maxNewswirePosts, + dormant_months, max_newswire_posts, allowLocalNetworkAccess, 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, 0, @@ -1063,7 +1063,7 @@ def createServerGroup(path: str, domain: str, port: int, onionDomain = None i2pDomain = None allowLocalNetworkAccess = True - maxNewswirePosts = 20 + max_newswire_posts = 20 dormant_months = 3 send_threads_timeout_mins = 30 maxFollowers = 10 @@ -1091,7 +1091,7 @@ def createServerGroup(path: str, domain: str, port: int, broch_mode, verify_all_signatures, send_threads_timeout_mins, - dormant_months, maxNewswirePosts, + dormant_months, max_newswire_posts, allowLocalNetworkAccess, 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False,