Skip to content

Commit

Permalink
Pruned dependencies (#404)
Browse files Browse the repository at this point in the history
Removed:
- [x] `bioregistry`
  • Loading branch information
hrshdhgd committed Aug 7, 2023
1 parent 8a98cf5 commit 52f2d54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 105 deletions.
93 changes: 1 addition & 92 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ importlib-metadata = ">=6.8.0"
pandas = ">=2.0.3"
pansql = ">=0.0.1"
sssom-schema = ">=0.14.0"
bioregistry = ">=0.9.87"
networkx = ">=3.1"
sparqlwrapper = ">=2.0.0"
validators = ">=0.20.0"
Expand Down
19 changes: 7 additions & 12 deletions src/sssom/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import os
import re
from pathlib import Path
from typing import List, Optional, TextIO, Union
from typing import Dict, List, Optional, TextIO, Union

import pandas as pd
from bioregistry import get_iri
from curies import Converter
from pansql import sqldf

from sssom.validators import validate
Expand Down Expand Up @@ -195,7 +195,7 @@ def get_list_of_predicate_iri(predicate_filter: tuple, prefix_map: dict) -> list
return list(set(iri_list))


def extract_iri(input, prefix_map) -> list:
def extract_iri(input: str, prefix_map: Dict[str, str]) -> List[str]:
"""
Recursively extracts a list of IRIs from a string or file.
Expand All @@ -207,19 +207,14 @@ def extract_iri(input, prefix_map) -> list:
if is_iri(input):
return [input]
elif is_curie(input):
p_iri = get_iri(input, prefix_map=prefix_map, use_bioregistry_io=False)
if not p_iri:
p_iri = get_iri(input)
converter = Converter.from_prefix_map(prefix_map)
p_iri = converter.expand(input)
if p_iri:
return [p_iri]
else:
logging.warning(
f"{input} is a curie but could not be resolved to an IRI, "
f"neither with the provided prefix map nor with bioregistry."
)

elif os.path.isfile(input):
pred_list = Path(input).read_text().splitlines()
iri_list = []
iri_list: List[str] = []
for p in pred_list:
p_iri = extract_iri(p, prefix_map)
if p_iri:
Expand Down

0 comments on commit 52f2d54

Please sign in to comment.