Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jun 10, 2020
1 parent dcbebbf commit 562ab6a
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 70 deletions.
1 change: 1 addition & 0 deletions pytaxize/col/col.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
warnings.warn("Pandas library not installed, dataframes disabled")
pd = None


def children(name=None, id=None, format=None, start=None, checklist=None):
"""
Search Catalogue of Life for for direct children of a particular taxon.
Expand Down
1 change: 1 addition & 0 deletions pytaxize/gbif/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
warnings.warn("Pandas library not installed, dataframes disabled")
pd = None


def parse(name, as_dataframe=False):
"""
Parse taxon names using the GBIF name parser.
Expand Down
2 changes: 2 additions & 0 deletions pytaxize/gn/gnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from pytaxize.refactor import Refactor
import os


class NoResultException(Exception):
pass


def gnr_datasources():
"""
Get data sources for the Global Names Resolver.
Expand Down
11 changes: 10 additions & 1 deletion pytaxize/ids/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pytaxize.ncbi import ncbi
from ..gbif.gbif_utils import *


class NoResultException(Exception):
pass

Expand Down Expand Up @@ -63,14 +64,18 @@ def ncbi(self, verbose=True):
rank_taken = z["Rank"]
result = _make_id(id[0], fname, z["Rank"], "ncbi")
if len(id) > 1:
result = [ _make_id(w["TaxId"], w["ScientificName"], w["Rank"], "ncbi") for w in res[fname] ]
result = [
_make_id(w["TaxId"], w["ScientificName"], w["Rank"], "ncbi")
for w in res[fname]
]
out.append(result)
# out = _flatten(out)
if isinstance(out, dict):
out = [out]
if isinstance(out[0], list):
out = out[0]
return out

# def col(self, verbose=True):
# """
# Get Catalogue of Life taxonomic identifiers
Expand Down Expand Up @@ -134,6 +139,7 @@ def ncbi(self, verbose=True):

# return out


def _make_id(id, name, rank, type):
if id is None:
uri = None
Expand All @@ -146,6 +152,7 @@ def _make_id(id, name, rank, type):
"uri": uri,
}


def _converter(x):
if x.__class__.__name__ == "str":
return [x]
Expand All @@ -156,6 +163,7 @@ def _converter(x):
def _flatten(x):
return [item for sublist in x for item in sublist]


id_uris = {
"col": {
"species": "http://www.catalogueoflife.org/col/details/species/id/%s",
Expand All @@ -167,6 +175,7 @@ def _flatten(x):
},
}


def _make_id_uri(rank, which, x):
if rank is not None:
if rank.lower() == "species":
Expand Down
Loading

0 comments on commit 562ab6a

Please sign in to comment.