Skip to content

Commit

Permalink
Rename normalize_tags_columns_attr and update description (#139)
Browse files Browse the repository at this point in the history
This PR renames `normalize_tags_columns_attr` `normalize_tags_columns`
and updates its description, since no normalisation is done in this
function.

---------

Co-authored-by: Siddharth Krishna <[email protected]>
  • Loading branch information
olejandro and siddharth-krishna authored Nov 29, 2023
1 parent fb5a150 commit 26c03bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion times_reader/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def convert_xl_to_times(
return {}

transform_list = [
transforms.normalize_tags_columns_attrs,
transforms.normalize_tags_columns,
transforms.remove_fill_tables,
transforms.remove_empty_tables,
lambda config, tables: [transforms.remove_comment_rows(t) for t in tables],
Expand Down
7 changes: 2 additions & 5 deletions times_reader/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,21 +480,18 @@ def discard(table):
return [table for table in tables if not discard(table)]


def normalize_tags_columns_attrs(
def normalize_tags_columns(
config: datatypes.Config,
tables: List[datatypes.EmbeddedXlTable],
) -> List[datatypes.EmbeddedXlTable]:
"""
Normalize (uppercase) tags, (lowercase) column names, and (uppercase) values in
attribute columns.
Normalize (uppercase) tags and (lowercase) column names.
:param tables: List of tables in EmbeddedXlTable format.
:return: List of tables in EmbeddedXlTable format with normalzed values.
"""

# TODO Normalize column names and attribute values in mapping.txt when reading it
# TODO Check all string literals left in file
def normalize(table: datatypes.EmbeddedXlTable) -> datatypes.EmbeddedXlTable:
# Only uppercase upto ':', the rest can be non-uppercase values like regions
parts = table.tag.split(":")
Expand Down

0 comments on commit 26c03bf

Please sign in to comment.