Added some comments JFF

This commit is contained in:
Klaus-Uwe Mitterer 2017-01-27 22:02:53 +01:00
parent be97a12ef3
commit 0e580816d8
2 changed files with 17 additions and 0 deletions

View file

@ -5,6 +5,13 @@ import dbtools
import sqlite3, csv, sys
def makeDB(dbo=dbtools.dbHelper(), infile='tweets.csv'):
"""
Initializes the database.
:param dbo: Database object for the database to be initialized.
:param infile: Path of the CSV file to initalize the database with.
:return: Returns nothing.
"""
try:
infile = open(infile)
except IOError:

View file

@ -51,6 +51,8 @@ def getMessages(db=dbtools.dbHelper(), two=twitools.twObject()):
return mcount, savepoint or 0, db.getLatestMessage()
def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False):
""" Get handles of users we are following. :param db: Database object to be used. :param two: Twitter object to be used. :param firstrun: Must be set to True if the function is executed for the first time. Defaults to False. :return: Returns the number of gained and lost followings in a list (gained, lost). """
current = list(db.getFollowers())
new = list(twitools.getNamesByIDs(twitools.getFollowerIDs()))
gained = 0
@ -77,6 +79,14 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
return gained, lost
def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False):
"""
Get handles of users we are following.
:param db: Database object to be used.
:param two: Twitter object to be used.
:param firstrun: Must be set to True if the function is executed for the first time. Defaults to False.
:return: Returns the number of gained and lost followings in a list (gained, lost).
"""
current = list(db.getFollowing())
new = list(twitools.getNamesByIDs(twitools.getFollowingIDs()))
gained = 0