Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pruned dependencies #404

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading