Added some comments JFF
This commit is contained in:
parent
be97a12ef3
commit
0e580816d8
2 changed files with 17 additions and 0 deletions
7
csvdb.py
7
csvdb.py
|
@ -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:
|
||||
|
|
10
filler.py
10
filler.py
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue