Remove default arguments

main
Bob Mottram 2024-02-19 15:38:08 +00:00
parent 9ed6eaa75d
commit 58a1a0b629
11 changed files with 29 additions and 25 deletions

View File

@ -200,7 +200,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
peertube_instances: [],
system_language: str,
person_cache: {},
blog_separator: str = '<hr>') -> str:
blog_separator: str) -> str:
"""Returns the content for a single blog post
"""
linked_author = False
@ -501,7 +501,7 @@ def html_blog_post(session, authorized: bool,
domain_full, post_json_object,
None, False,
peertube_instances, system_language,
person_cache)
person_cache, '<hr>')
# show rss links
blog_str += '<p class="rssfeed">'
@ -592,7 +592,8 @@ def html_blog_page(authorized: bool, session,
base_dir, http_prefix, translate,
nickname, domain, domain_full, item,
None, True, peertube_instances,
system_language, person_cache)
system_language, person_cache,
'<hr>')
if len(timeline_json['orderedItems']) >= no_of_items:
blog_str += navigate_str

View File

@ -4019,7 +4019,8 @@ class PubServer(BaseHTTPRequestHandler):
unfollow_account(self.server.base_dir, self.post_to_nickname,
self.server.domain,
following_nickname, following_domain_full,
self.server.debug, group_account)
self.server.debug, group_account,
'following.txt')
self._post_to_outbox_thread(unfollow_json,
curr_session, proxy_type)

View File

@ -3721,7 +3721,7 @@ def _command_options() -> None:
languages_understood, translate, buy_url, chat_url,
auto_cw_cache)
domain_full = domain + ':' + str(port)
clear_follows(base_dir, nickname, domain)
clear_follows(base_dir, nickname, domain, 'following.txt')
follow_person(base_dir, nickname, domain, 'maxboardroom', domain_full,
federation_list, False, False)
follow_person(base_dir, nickname, domain, 'ultrapancake', domain_full,

View File

@ -310,7 +310,7 @@ def is_follower_of_person(base_dir: str, nickname: str, domain: str,
def unfollow_account(base_dir: str, nickname: str, domain: str,
follow_nickname: str, follow_domain: str,
debug: bool, group_account: bool,
follow_file: str = 'following.txt') -> bool:
follow_file: str) -> bool:
"""Removes a person to the follow list
"""
domain = remove_domain_port(domain)
@ -387,7 +387,7 @@ def unfollower_of_account(base_dir: str, nickname: str, domain: str,
def clear_follows(base_dir: str, nickname: str, domain: str,
follow_file: str = 'following.txt') -> None:
follow_file: str) -> None:
"""Removes all follows
"""
if not os.path.isdir(base_dir + '/accounts'):
@ -1506,7 +1506,7 @@ def outbox_undo_follow(base_dir: str, message_json: {}, debug: bool) -> None:
has_group_type(base_dir, message_json['object']['object'], None)
if unfollow_account(base_dir, nickname_follower, domain_follower_full,
nickname_following, domain_following_full,
debug, group_account):
debug, group_account, 'following.txt'):
if debug:
print('DEBUG: ' + nickname_follower + ' unfollowed ' +
nickname_following + '@' + domain_following_full)

View File

@ -375,7 +375,9 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str,
location_str = get_location_from_post(post_json_object)
if location_str:
if resembles_url(location_str):
zoom, latitude, longitude = geocoords_from_map_link(location_str)
zoom, latitude, longitude = \
geocoords_from_map_link(location_str,
'openstreetmap.org')
if latitude and longitude and zoom and \
location_str not in map_links:
map_links.append(location_str)

View File

@ -145,7 +145,7 @@ def understood_post_language(base_dir: str, nickname: str,
return False
def libretranslate_languages(url: str, api_key: str = None) -> []:
def libretranslate_languages(url: str, api_key: str) -> []:
"""Returns a list of supported languages
"""
if not url:

View File

@ -322,9 +322,7 @@ def _geocoords_from_wego_link(url: str) -> (int, float, float):
def geocoords_from_map_link(url: str,
osm_domain: str = 'openstreetmap.org') -> (int,
float,
float):
osm_domain: str) -> (int, float, float):
"""Returns geocoordinates from a map link url
"""
if osm_domain in url:

View File

@ -648,7 +648,7 @@ def register_account(base_dir: str, http_prefix: str, domain: str, port: int,
def create_group(base_dir: str, nickname: str, domain: str, port: int,
http_prefix: str, save_to_file: bool,
password: str = None) -> (str, str, {}, {}):
password: str) -> (str, str, {}, {}):
"""Returns a group
"""
(private_key_pem, public_key_pem,

View File

@ -341,10 +341,9 @@ def get_person_box(signing_priv_key_pem: str, origin_domain: str,
base_dir: str, session, wf_request: {}, person_cache: {},
project_version: str, http_prefix: str,
nickname: str, domain: str,
box_name: str = 'inbox',
source_id: int = 0,
system_language: str = 'en') -> (str, str, str, str, str,
str, str, bool):
box_name: str, source_id: int,
system_language: str) -> (str, str, str, str, str,
str, str, bool):
debug = False
profile_str = 'https://www.w3.org/ns/activitystreams'
as_header = {
@ -1490,7 +1489,7 @@ def _create_post_place_and_time(event_date: str, end_date: str,
latitude = longitude = None
if '://' in location:
_, latitude, longitude = \
geocoords_from_map_link(location)
geocoords_from_map_link(location, 'openstreetmap.org')
if latitude and longitude:
tags.append({
"@context": "https://www.w3.org/ns/activitystreams",

View File

@ -2748,7 +2748,7 @@ def _test_followers_of_person(base_dir: str) -> None:
create_person(base_dir, 'sausagedog', domain, port,
http_prefix, True, False, password)
clear_follows(base_dir, nickname, domain)
clear_follows(base_dir, nickname, domain, 'following.txt')
follow_person(base_dir, nickname, domain, 'maxboardroom', domain,
federation_list, False, False)
follow_person(base_dir, 'drokk', domain, 'ultrapancake', domain,
@ -2903,7 +2903,7 @@ def _test_follows(base_dir: str) -> None:
create_person(base_dir, nickname, domain, port, http_prefix, True,
False, password)
clear_follows(base_dir, nickname, domain)
clear_follows(base_dir, nickname, domain, 'following.txt')
follow_person(base_dir, nickname, domain, 'badger', 'wild.com',
federation_list, False, False)
follow_person(base_dir, nickname, domain, 'squirrel', 'secret.com',
@ -2930,7 +2930,7 @@ def _test_follows(base_dir: str) -> None:
assert domain_found
unfollow_account(base_dir, nickname, domain, 'batman', 'mesh.com',
True, False)
True, False, 'following.txt')
domain_found = False
for following_domain in fp_foll:
@ -7898,7 +7898,8 @@ def _test_hashtag_maps():
map_links = get_map_links_from_post_content(content)
link = "www.google.com/maps/@52.217291,-3.0811865,20.04z"
assert link in map_links
zoom, latitude, longitude = geocoords_from_map_link(link)
zoom, latitude, longitude = \
geocoords_from_map_link(link, 'openstreetmap.org')
assert zoom == 20
assert latitude
assert int(latitude * 1000) == 52217
@ -7906,7 +7907,8 @@ def _test_hashtag_maps():
assert int(longitude * 1000) == -3081
link = "www.openstreetmap.org/#map=19/52.90860/-3.59917"
assert link in map_links
zoom, latitude, longitude = geocoords_from_map_link(link)
zoom, latitude, longitude = \
geocoords_from_map_link(link, 'openstreetmap.org')
assert zoom == 19
assert latitude
assert int(latitude * 1000) == 52908

View File

@ -2972,7 +2972,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
location_domain)
# remember the coordinates
map_zoom, map_latitude, map_longitude = \
geocoords_from_map_link(location_str)
geocoords_from_map_link(location_str,
'openstreetmap.org')
if map_zoom and map_latitude and map_longitude:
set_map_preferences_coords(base_dir, nickname, domain,
map_latitude, map_longitude,