Skip to content

Commit

Permalink
Add flag for turning off wikidata mapping caching
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Apr 3, 2024
1 parent ea8f0cb commit eecd947
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pyobo/xrefdb/sources/wikidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ def get_wikidata_df(prefix: str, wikidata_property: str) -> pd.DataFrame:
return df


def iter_wikidata_mappings(wikidata_property: str) -> Iterable[Tuple[str, str]]:
def iter_wikidata_mappings(
wikidata_property: str, *, cache: bool = True
) -> Iterable[Tuple[str, str]]:
"""Iterate over Wikidata xrefs."""
path = WIKIDATA_MAPPING_DIRECTORY.join(name=f"{wikidata_property}.json")
if path.exists():
if path.exists() and cache:
with path.open() as file:
rows = json.load(file)
else:
Expand Down

0 comments on commit eecd947

Please sign in to comment.