diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29e11e4..5220f16 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,6 @@ repos: exclude: ^src/ - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.1.0 hooks: - id: flake8 diff --git a/environment.yml b/environment.yml index a97ff9b..5b3f866 100644 --- a/environment.yml +++ b/environment.yml @@ -5,6 +5,7 @@ dependencies: - geopandas - pyworms - ckanapi +- httpx - plotly - async - requests diff --git a/pyobistools/taxa.py b/pyobistools/taxa.py index 6feaceb..62c33e3 100644 --- a/pyobistools/taxa.py +++ b/pyobistools/taxa.py @@ -11,6 +11,9 @@ from pyobistools.utils import removesuffix +from pyobistools.validation import check_scientificname_and_ids as check_names + + STANDARD_SPECIES_COLUMNS = { 'taxon_id': np.nan, 'url': '', @@ -94,6 +97,20 @@ def add_suffix(name: str) -> t.List[str]: return [name.strip() + s for s in suffixes] +def match_taxa(names, ask=True, itis_usage=False): + """ + Wrap the existing functionality in validation in the expected name for this function as per R's iobis/obistools. + + @param names List of scientific names to check against + @param ask Do we ask the user to resolve multi-match or ambiguous names? + @param itis_usage Pass through the ITIS check setting for the client function to handle + + @return structure with appended lsids where WoRMS (or ITIS can resolve them) + """ + + return check_names.check_scientificname_and_ids(names, value='names', itis_usage=itis_usage) + + def search_worms(names: t.List[str], kwargs: t.Dict[str, t.Any] = {}) -> pd.DataFrame: """