1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2025-05-08 06:06:00 +02:00

Don't unnecessarily rewrite DataFrames for checks

By using df[column] = df[column].apply(check...) we were re-writing
the DataFrame every time we returned from a check. We don't actuall
y need to return a value at all, as the point of checks is to print
a warning to the screen. In Python a "return" statement without a v
ariable returns None.

I haven't measured the impact of this, but I assume it will mean we
are faster and use less memory.
This commit is contained in:
2021-03-16 16:04:19 +02:00
parent 9a5e3fd6ef
commit 330a7b7b9c
4 changed files with 32 additions and 32 deletions

View File

@ -23,7 +23,7 @@ def test_check_valid_issn():
result = check.issn(value)
assert result == value
assert result == None
def test_check_invalid_isbn(capsys):
@ -44,7 +44,7 @@ def test_check_valid_isbn():
result = check.isbn(value)
assert result == value
assert result == None
def test_check_missing_date(capsys):
@ -100,7 +100,7 @@ def test_check_valid_date():
result = check.date(value, field_name)
assert result == value
assert result == None
def test_check_suspicious_characters(capsys):
@ -126,7 +126,7 @@ def test_check_valid_iso639_1_language():
result = check.language(value)
assert result == value
assert result == None
def test_check_valid_iso639_3_language():
@ -136,7 +136,7 @@ def test_check_valid_iso639_3_language():
result = check.language(value)
assert result == value
assert result == None
def test_check_invalid_iso639_1_language(capsys):
@ -199,7 +199,7 @@ def test_check_valid_agrovoc():
result = check.agrovoc(value, field_name)
assert result == value
assert result == None
def test_check_uncommon_filename_extension(capsys):
@ -223,7 +223,7 @@ def test_check_common_filename_extension():
result = check.filename_extension(value)
assert result == value
assert result == None
def test_check_incorrect_iso_639_1_language(capsys):
@ -276,7 +276,7 @@ def test_check_correct_iso_639_1_language():
result = experimental.correct_language(series)
assert result == language
assert result == None
def test_check_correct_iso_639_3_language():
@ -291,7 +291,7 @@ def test_check_correct_iso_639_3_language():
result = experimental.correct_language(series)
assert result == language
assert result == None
def test_check_valid_spdx_license_identifier():
@ -301,7 +301,7 @@ def test_check_valid_spdx_license_identifier():
result = check.spdx_license_identifier(license)
assert result == license
assert result == None
def test_check_invalid_spdx_license_identifier(capsys):