Function for non-mutuals

main
Bob Mottram 2020-09-25 10:20:58 +00:00
parent e70158ed51
commit bdb5fa5804
1 changed files with 17 additions and 2 deletions

View File

@ -112,8 +112,7 @@ def isFollowingActor(baseDir: str,
def getMutualsOfPerson(baseDir: str,
nickname: str, domain: str,
followFile='following.txt') -> []:
nickname: str, domain: str) -> []:
"""Returns the mutuals of a person
i.e. accounts which they follow and which also follow back
"""
@ -128,6 +127,22 @@ def getMutualsOfPerson(baseDir: str,
return mutuals
def getNonMutualsOfPerson(baseDir: str,
nickname: str, domain: str) -> []:
"""Returns the followers who are not mutuals of a person
i.e. accounts which follow you but you don't follow them
"""
followers = \
getFollowersOfPerson(baseDir, nickname, domain, 'followers')
following = \
getFollowersOfPerson(baseDir, nickname, domain, 'following')
nonMutuals = []
for handle in following:
if handle not in followers:
nonMutuals.append(handle)
return nonMutuals
def getFollowersOfPerson(baseDir: str,
nickname: str, domain: str,
followFile='following.txt') -> []: