Skip to content

Commit

Permalink
chg: remove unused function check_name_uniqueness
Browse files Browse the repository at this point in the history
- looks to have been unused since about 2012 so it's probably safe to go
  • Loading branch information
lindsay-stevens committed Oct 29, 2024
1 parent 5ac7dae commit 2fef486
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions pyxform/xls2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,31 +195,6 @@ def clean_text_values(sheet_name: str, data: list[dict], strip_whitespace: bool
return data


# This is currently unused because name uniqueness is checked in json2xform.
def check_name_uniqueness(dict_array):
"""
Make sure all names are unique
Raises and exception if a duplicate is found
"""
# This set is used to validate the uniqueness of names.
name_set = set()
row_number = 0 # TODO: There might be a bug with row numbers...
for row in dict_array:
row_number += 1
name = row.get(constants.NAME)
if name:
if name in name_set:
raise PyXFormError(
"Question name is not unique: "
+ str(name)
+ " Row: "
+ str(row_number)
)
else:
name_set.add(name)
return dict_array


def group_dictionaries_by_key(list_of_dicts, key, remove_key=True):
"""
Takes a list of dictionaries and returns a
Expand Down

0 comments on commit 2fef486

Please sign in to comment.