Snake case

merge-requests/30/head
Bob Mottram 2021-12-27 13:58:17 +00:00
parent e58e1435d5
commit b399bdc5ee
3 changed files with 14 additions and 14 deletions

View File

@ -14,7 +14,7 @@ from utils import has_object_stringType
from utils import remove_domain_port from utils import remove_domain_port
from utils import has_users_path from utils import has_users_path
from utils import get_full_domain from utils import get_full_domain
from utils import getFollowersList from utils import get_followers_list
from utils import validNickname from utils import validNickname
from utils import domainPermitted from utils import domainPermitted
from utils import getDomainFromActor from utils import getDomainFromActor
@ -197,9 +197,9 @@ def getMutualsOfPerson(base_dir: str,
i.e. accounts which they follow and which also follow back i.e. accounts which they follow and which also follow back
""" """
followers = \ followers = \
getFollowersList(base_dir, nickname, domain, 'followers.txt') get_followers_list(base_dir, nickname, domain, 'followers.txt')
following = \ following = \
getFollowersList(base_dir, nickname, domain, 'following.txt') get_followers_list(base_dir, nickname, domain, 'following.txt')
mutuals = [] mutuals = []
for handle in following: for handle in following:
if handle in followers: if handle in followers:

View File

@ -49,7 +49,7 @@ from utils import isPublicPost
from utils import has_users_path from utils import has_users_path
from utils import valid_post_date from utils import valid_post_date
from utils import get_full_domain from utils import get_full_domain
from utils import getFollowersList from utils import get_followers_list
from utils import isEvil from utils import isEvil
from utils import getStatusNumber from utils import getStatusNumber
from utils import createPersonDir from utils import createPersonDir
@ -4348,9 +4348,9 @@ def _getNonMutualsOfPerson(base_dir: str,
i.e. accounts which follow you but you don't follow them i.e. accounts which follow you but you don't follow them
""" """
followers = \ followers = \
getFollowersList(base_dir, nickname, domain, 'followers.txt') get_followers_list(base_dir, nickname, domain, 'followers.txt')
following = \ following = \
getFollowersList(base_dir, nickname, domain, 'following.txt') get_followers_list(base_dir, nickname, domain, 'following.txt')
nonMutuals = [] nonMutuals = []
for handle in followers: for handle in followers:
if handle not in following: if handle not in following:

View File

@ -548,12 +548,12 @@ def isSuspended(base_dir: str, nickname: str) -> bool:
return False return False
def getFollowersList(base_dir: str, def get_followers_list(base_dir: str,
nickname: str, domain: str, nickname: str, domain: str,
followFile='following.txt') -> []: follow_file='following.txt') -> []:
"""Returns a list of followers for the given account """Returns a list of followers for the given account
""" """
filename = acct_dir(base_dir, nickname, domain) + '/' + followFile filename = acct_dir(base_dir, nickname, domain) + '/' + follow_file
if not os.path.isfile(filename): if not os.path.isfile(filename):
return [] return []
@ -587,10 +587,10 @@ def get_followers_of_person(base_dir: str,
if not os.path.isfile(filename): if not os.path.isfile(filename):
continue continue
with open(filename, 'r') as followingfile: with open(filename, 'r') as followingfile:
for followingHandle in followingfile: for following_handle in followingfile:
followingHandle2 = followingHandle.replace('\n', '') following_handle2 = following_handle.replace('\n', '')
followingHandle2 = followingHandle2.replace('\r', '') following_handle2 = following_handle2.replace('\r', '')
if followingHandle2 == handle: if following_handle2 == handle:
if account not in followers: if account not in followers:
followers.append(account) followers.append(account)
break break