Skip to content

Commit 7c1194d

Browse files
authored
Merge pull request #167 from kbase/develop
Develop -> Master (1.3.3 release)
2 parents 80e330c + f0777a4 commit 7c1194d

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 1.3.3
2+
- Fixed a bug in the csv/tsv bulk specification parser that would include an empty entry for
3+
each empty line in the file.
4+
15
### Version 1.3.2
26
- Add `write_bulk_specification` endpoint for writing bulk specifications
37
- Add `import_filetypes` endpoint for getting datatype -> filetype -> extension mappings

staging_service/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
3636
routes = web.RouteTableDef()
37-
VERSION = "1.3.2"
37+
VERSION = "1.3.3"
3838

3939
_DATATYPE_MAPPINGS = None
4040

staging_service/import_specifications/individual_parsers.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,17 @@ def _parse_xsv(path: Path, sep: str) -> ParseResults:
165165
_csv_next(rdr, 3, columns, spcsrc, "Missing 3rd header line")
166166
results = []
167167
for i, row in enumerate(rdr, start=4):
168-
if row and len(row) != columns: # skip empty rows
169-
# could collect errors (first 10?) and throw an exception with a list
170-
# lets wait and see if that's really needed
171-
raise _ParseException(Error(
172-
ErrorType.INCORRECT_COLUMN_COUNT,
173-
f"Incorrect number of items in line {i}, "
174-
+ f"expected {columns}, got {len(row)}",
175-
spcsrc))
176-
results.append(frozendict(
177-
{param_ids[j]: _normalize_xsv(row[j]) for j in range(len(row))}))
168+
if row: # skip empty rows
169+
if len(row) != columns:
170+
# could collect errors (first 10?) and throw an exception with a list
171+
# lets wait and see if that's really needed
172+
raise _ParseException(Error(
173+
ErrorType.INCORRECT_COLUMN_COUNT,
174+
f"Incorrect number of items in line {i}, "
175+
+ f"expected {columns}, got {len(row)}",
176+
spcsrc))
177+
results.append(frozendict(
178+
{param_ids[j]: _normalize_xsv(row[j]) for j in range(len(row))}))
178179
if not results:
179180
raise _ParseException(Error(
180181
ErrorType.PARSE_FAIL, "No non-header data in file", spcsrc))

tests/import_specifications/test_individual_parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _xsv_parse_success_with_numeric_headers(
103103
))
104104

105105

106-
def _xsv_parse_success_with_internal_and_trailing_empty_lines(temp_dir: Path):
106+
def test_xsv_parse_success_with_internal_and_trailing_empty_lines(temp_dir: Path):
107107
"""
108108
Test that leaving one or more empty lines in a csv/tsv file does not cause the
109109
parse to fail. This is easy to do accidentally and so will annoy users.
@@ -135,7 +135,7 @@ def _xsv_parse_success_with_internal_and_trailing_empty_lines(
135135
assert res == ParseResults(frozendict(
136136
{"other_type": ParseResult(SpecificationSource(input_),
137137
tuple([
138-
frozendict({"spec1": "val3", "spec4": "val2", "spec3": 1, "spec4": 8.9}),
138+
frozendict({"spec1": "val3", "spec2": "val4", "spec3": 1, "spec4": 8.9}),
139139
frozendict({"spec1": "val1", "spec2": "val2", "spec3": 7, "spec4": 3.2}),
140140
])
141141
)}

0 commit comments

Comments
 (0)