Skip to content

Commit

Permalink
fix default column_specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajul committed Jan 28, 2018
1 parent 437d82a commit 9aebc17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pyradox/filetype/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pyradox.format
import re

class Dialect:
Expand Down Expand Up @@ -92,7 +93,7 @@ def guess_is_numeric(s):

def default_column_specs(key, row):
column_specs = [('id', None)]
for k, v in row:
for k, v in row.items():
column_specs.append((k, '%%(%s)s' % k))
return column_specs

Expand Down Expand Up @@ -149,7 +150,7 @@ def apply_format_spec(key, row, format_spec):
except ZeroDivisionError:
return ''
elif format_spec is None:
return human_string(key, True)
return pyradox.format.human_string(key, True)
else:
try:
return format_spec % row
Expand Down
3 changes: 2 additions & 1 deletion tests/csv_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _initpath
import pyradox.filetype.csv
import pyradox.filetype.table

spec = (
('Name', '%(name)s'),
Expand All @@ -8,5 +9,5 @@
)

for filename, tree in pyradox.filetype.csv.parse_dir('C:/Program Files (x86)/Steam/steamapps/common/Hearts of Iron 2 Complete Pack/Doomsday/db/tech/teams'):
print(filename, tree)
print(pyradox.filetype.table.make_table(tree, 'wiki'))

0 comments on commit 9aebc17

Please sign in to comment.