Commits

Anonymous committed ac2feb6

Renamed jaraco.excel to jaraco.office

Comments (0)

Files changed (7)

jaraco/excel/__init__.py

-#

jaraco/excel/excel.py

-
-def sheet_as_dict(worksheet):
-	"""
-	Take an xsrd worksheet and convert it to a dict, using the first
-	row as a header (to create keys for the subsequent rows).
-	"""
-	keys = worksheet.row_values(0)
-	value_range = range(1, worksheet.nrows)
-	to_dict = lambda values: dict(zip(keys, values))
-	return [
-		to_dict(worksheet.row_values(n))
-		for n in value_range
-		]

jaraco/excel/grep.py

-from win32com.client import Dispatch
-from itertools import takewhile
-import re
-
-app = Dispatch('Excel.Application')
-#wb = app.Workbooks.Open(filename)
-
-default_pattern = 'Total'
-
-def CleanRow(row):
-	return filter(None, row.Value[0])
-
-def HasPattern(row, pattern = default_pattern):
-	strings = map(unicode, CleanRow(row))
-	pattern = re.compile(pattern, re.I)
-	return bool(filter(pattern.search, strings))
-
-def NotHasPattern(row, pattern = default_pattern):
-	return not HasPattern(row, pattern)
-
-def IsNotBlank(row):
-	return bool(CleanRow(row))
-
-def IsBlank(row):
-	return not IsNotBlank(row)
-
-def DeleteUnmatchedRows():
-	"""
-	Delete rows that don't match the pattern; you'll have to run this
-	multiple times if you want to get consecutive matches
-	"""
-	# excel doesn't support iteration
-	#valueRows = takewhile(IsNotBlank, app.Rows)
-	#map(DeleteRow, filter(NotHasPattern, valueRows))
-	for row in GetPopulatedRows():
-		if NotHasPattern(row):
-			print 'deleting row', CleanRow(row)
-			row.Delete()
-
-def GetPopulatedRows():
-	for row in app.Rows:
-		if IsBlank(row): break
-		yield row
-
-def FixBlankWPNCD(row):
-	if row.Cells(1,1).Value is None:
-		app.Cells(row.Row, row.Column).Value = app.Cells(row.Row-1, row.Column).Value

jaraco/office/__init__.py

+#

jaraco/office/excel.py

+
+def sheet_as_dict(worksheet):
+	"""
+	Take an xsrd worksheet and convert it to a dict, using the first
+	row as a header (to create keys for the subsequent rows).
+	"""
+	keys = worksheet.row_values(0)
+	value_range = range(1, worksheet.nrows)
+	to_dict = lambda values: dict(zip(keys, values))
+	return [
+		to_dict(worksheet.row_values(n))
+		for n in value_range
+		]

jaraco/office/grep.py

+from win32com.client import Dispatch
+from itertools import takewhile
+import re
+
+app = Dispatch('Excel.Application')
+#wb = app.Workbooks.Open(filename)
+
+default_pattern = 'Total'
+
+def CleanRow(row):
+	return filter(None, row.Value[0])
+
+def HasPattern(row, pattern = default_pattern):
+	strings = map(unicode, CleanRow(row))
+	pattern = re.compile(pattern, re.I)
+	return bool(filter(pattern.search, strings))
+
+def NotHasPattern(row, pattern = default_pattern):
+	return not HasPattern(row, pattern)
+
+def IsNotBlank(row):
+	return bool(CleanRow(row))
+
+def IsBlank(row):
+	return not IsNotBlank(row)
+
+def DeleteUnmatchedRows():
+	"""
+	Delete rows that don't match the pattern; you'll have to run this
+	multiple times if you want to get consecutive matches
+	"""
+	# excel doesn't support iteration
+	#valueRows = takewhile(IsNotBlank, app.Rows)
+	#map(DeleteRow, filter(NotHasPattern, valueRows))
+	for row in GetPopulatedRows():
+		if NotHasPattern(row):
+			print 'deleting row', CleanRow(row)
+			row.Delete()
+
+def GetPopulatedRows():
+	for row in app.Rows:
+		if IsBlank(row): break
+		yield row
+
+def FixBlankWPNCD(row):
+	if row.Cells(1,1).Value is None:
+		app.Cells(row.Row, row.Column).Value = app.Cells(row.Row-1, row.Column).Value
 version = '1.0'
 
 setup(
-	name='jaraco.excel',
+	name='jaraco.office',
 	version=version,
-	description="Utility library for working with MS Excel documents",
-	keywords='excel',
+	description="Utility library for working with MS Office documents",
+	keywords='excel office word'.split(),
 	author='Jason R. Coombs',
 	author_email='jaraco@jaraco.com',
-	url='http://pypi.python.org/pypi/jaraco.excel',
+	url='http://pypi.python.org/pypi/jaraco.office',
 	license='MIT',
 	packages=find_packages(),
 	namespace_packages = ['jaraco'],