Snake case

merge-requests/22/merge
Bob Mottram 2021-12-25 19:42:14 +00:00
parent cbbe8812bd
commit 464084e507
3 changed files with 15 additions and 15 deletions

View File

@ -18439,7 +18439,7 @@ def runDaemon(content_license_url: str,
show_publish_as_icon: bool, show_publish_as_icon: bool,
max_followers: int, max_followers: int,
max_news_posts: int, max_news_posts: int,
maxMirroredArticles: int, max_mirrored_articles: int,
maxNewswireFeedSizeKb: int, maxNewswireFeedSizeKb: int,
max_newswire_postsPerSource: int, max_newswire_postsPerSource: int,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
@ -18647,7 +18647,7 @@ def runDaemon(content_license_url: str,
httpd.showPublishedDateOnly = showPublishedDateOnly httpd.showPublishedDateOnly = showPublishedDateOnly
# maximum number of news articles to mirror # maximum number of news articles to mirror
httpd.maxMirroredArticles = maxMirroredArticles httpd.max_mirrored_articles = max_mirrored_articles
# maximum number of posts in the news timeline/outbox # maximum number of posts in the news timeline/outbox
httpd.max_news_posts = max_news_posts httpd.max_news_posts = max_news_posts

View File

@ -204,8 +204,8 @@ parser.add_argument('--max_feed_item_size_kb',
default=2048, default=2048,
help='Maximum size of an individual rss/atom ' + help='Maximum size of an individual rss/atom ' +
'feed item in K') 'feed item in K')
parser.add_argument('--maxMirroredArticles', parser.add_argument('--max_mirrored_articles',
dest='maxMirroredArticles', type=int, dest='max_mirrored_articles', type=int,
default=100, default=100,
help='Maximum number of news articles to mirror.' + help='Maximum number of news articles to mirror.' +
' Set to zero for indefinite mirroring.') ' Set to zero for indefinite mirroring.')
@ -3043,10 +3043,10 @@ maxNewswireFeedSizeKb = \
if maxNewswireFeedSizeKb: if maxNewswireFeedSizeKb:
args.maxNewswireFeedSizeKb = int(maxNewswireFeedSizeKb) args.maxNewswireFeedSizeKb = int(maxNewswireFeedSizeKb)
maxMirroredArticles = \ max_mirrored_articles = \
getConfigParam(base_dir, 'maxMirroredArticles') getConfigParam(base_dir, 'max_mirrored_articles')
if maxMirroredArticles is not None: if max_mirrored_articles is not None:
args.maxMirroredArticles = int(maxMirroredArticles) args.max_mirrored_articles = int(max_mirrored_articles)
max_news_posts = \ max_news_posts = \
getConfigParam(base_dir, 'max_news_posts') getConfigParam(base_dir, 'max_news_posts')
@ -3234,7 +3234,7 @@ if __name__ == "__main__":
args.show_publish_as_icon, args.show_publish_as_icon,
args.max_followers, args.max_followers,
args.max_news_posts, args.max_news_posts,
args.maxMirroredArticles, args.max_mirrored_articles,
args.maxNewswireFeedSizeKb, args.maxNewswireFeedSizeKb,
args.max_newswire_postsPerSource, args.max_newswire_postsPerSource,
args.dateonly, args.dateonly,

View File

@ -440,7 +440,7 @@ def _newswireHashtagProcessing(session, base_dir: str, postJsonObject: {},
def _createNewsMirror(base_dir: str, domain: str, def _createNewsMirror(base_dir: str, domain: str,
postIdNumber: str, url: str, postIdNumber: str, url: str,
maxMirroredArticles: int) -> bool: max_mirrored_articles: int) -> bool:
"""Creates a local mirror of a news article """Creates a local mirror of a news article
""" """
if '|' in url or '>' in url: if '|' in url or '>' in url:
@ -457,7 +457,7 @@ def _createNewsMirror(base_dir: str, domain: str,
mirrorIndexFilename = base_dir + '/accounts/newsmirror.txt' mirrorIndexFilename = base_dir + '/accounts/newsmirror.txt'
if maxMirroredArticles > 0 and noOfDirs > maxMirroredArticles: if max_mirrored_articles > 0 and noOfDirs > max_mirrored_articles:
if not os.path.isfile(mirrorIndexFilename): if not os.path.isfile(mirrorIndexFilename):
# no index for mirrors found # no index for mirrors found
return True return True
@ -465,7 +465,7 @@ def _createNewsMirror(base_dir: str, domain: str,
with open(mirrorIndexFilename, 'r') as indexFile: with open(mirrorIndexFilename, 'r') as indexFile:
# remove the oldest directories # remove the oldest directories
ctr = 0 ctr = 0
while noOfDirs > maxMirroredArticles: while noOfDirs > max_mirrored_articles:
ctr += 1 ctr += 1
if ctr > 5000: if ctr > 5000:
# escape valve # escape valve
@ -542,7 +542,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
personCache: {}, personCache: {},
federationList: [], federationList: [],
sendThreads: [], postLog: [], sendThreads: [], postLog: [],
maxMirroredArticles: int, max_mirrored_articles: int,
allow_local_network_access: bool, allow_local_network_access: bool,
systemLanguage: str, systemLanguage: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -645,7 +645,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
if mirrored: if mirrored:
if not _createNewsMirror(base_dir, domain, statusNumber, if not _createNewsMirror(base_dir, domain, statusNumber,
url, maxMirroredArticles): url, max_mirrored_articles):
continue continue
idStr = \ idStr = \
@ -833,7 +833,7 @@ def runNewswireDaemon(base_dir: str, httpd,
httpd.federationList, httpd.federationList,
httpd.sendThreads, httpd.sendThreads,
httpd.postLog, httpd.postLog,
httpd.maxMirroredArticles, httpd.max_mirrored_articles,
httpd.allow_local_network_access, httpd.allow_local_network_access,
httpd.systemLanguage, httpd.systemLanguage,
httpd.low_bandwidth, httpd.low_bandwidth,