mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2025-05-18 10:21:54 +02:00
csv_metadata_quality: Move scoped imports to global
According to PEP8 we should avoid scoped imports unless you have a good reason. Here there are two cases where we do (issn and isbn), but I will move the others to the global scope.
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
import requests_cache
|
||||
from pycountry import languages
|
||||
|
||||
|
||||
def issn(field):
|
||||
@ -85,7 +90,6 @@ def date(field, field_name):
|
||||
|
||||
Prints the date if invalid.
|
||||
"""
|
||||
from datetime import datetime
|
||||
|
||||
if pd.isna(field):
|
||||
print(f"Missing date ({field_name}).")
|
||||
@ -170,8 +174,6 @@ def language(field):
|
||||
Prints the value if it is invalid.
|
||||
"""
|
||||
|
||||
from pycountry import languages
|
||||
|
||||
# Skip fields with missing values
|
||||
if pd.isna(field):
|
||||
return
|
||||
@ -213,10 +215,6 @@ def agrovoc(field, field_name):
|
||||
Prints a warning if the value is invalid.
|
||||
"""
|
||||
|
||||
from datetime import timedelta
|
||||
import requests
|
||||
import requests_cache
|
||||
|
||||
# Skip fields with missing values
|
||||
if pd.isna(field):
|
||||
return
|
||||
|
Reference in New Issue
Block a user