Commits

Jason R. Coombs  committed 02cae6f

Converted merchant model to a proper module rather than simple script

  • Participants
  • Parent commits d5cc96f

Comments (0)

Files changed (1)

File jaraco/financial/merchant.py

 import collections
 
 from bs4 import BeautifulSoup
-import path
 
-def run():
-	doc = path.path('//drake/users/jaraco/Downloads/'
-		'TLReport_PortfolioFinancialNetProfitMultiMonth_CPL-001.xls').expanduser()
-	with open(doc) as f:
+def load_report(source):
+	"""
+	Load a report as downloaded from Translink
+	"""
+	with open(source) as f:
 		data = f.read()
 	data = '<html>'+data+'</html>'
 	soup = BeautifulSoup(data)
 	assert len(tables) == 1
 	table = tables[0]
 	agents = map(Agent.from_row, table)
-	map(print, agents)
 
 	return agents
 
 	rows = [collections.OrderedDict(zip(header, data(row)))
 		for row in rows]
 	return rows
-
-if __name__ == '__main__':
-	run()