Skip to content

Commit 169279b

Browse files
committed
Update the config help and add "newline='\n'" when writing a CSV output
The correct attribute name should be `column_renamings` instead of just the `renamings`. Signed-off-by: Chin Yeung Li <[email protected]>
1 parent d9e59e2 commit 169279b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/attributecode/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def transform_data(rows, transformer):
108108
109109
For instance with this configuration the columns "Directory/Location" will be
110110
renamed to "about_resource" and "foo" to "bar":
111-
renamings:
111+
column_renamings:
112112
'Directory/Location' : about_resource
113113
foo : bar
114114
@@ -270,7 +270,7 @@ def write_csv(location, data, column_names): # NOQA
270270
Write a CSV file at `location` the `data` list of ordered dicts using the
271271
`column_names`.
272272
"""
273-
with io.open(location, 'w', encoding='utf-8') as csvfile:
273+
with io.open(location, 'w', encoding='utf-8', newline='\n') as csvfile:
274274
writer = csv.DictWriter(csvfile, fieldnames=column_names)
275275
writer.writeheader()
276276
writer.writerows(data)

tests/testdata/test_cmd/help/about_transform_config_help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ is used to rename CSV columns.
1111

1212
For instance with this configuration the columns "Directory/Location" will be
1313
renamed to "about_resource" and "foo" to "bar":
14-
renamings:
14+
column_renamings:
1515
'Directory/Location' : about_resource
1616
foo : bar
1717

0 commit comments

Comments
 (0)