Skip to content

Commit

Permalink
Fixed linting issues, #45
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoHuebner authored and pmayd committed Sep 4, 2022
1 parent cfce15b commit 5bee232
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
32 changes: 29 additions & 3 deletions nb/download_tablefile.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,15 +36,41 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 5,
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cache dir does not exist! Please make sure init_config() was run properly. Path: C:\\Users\\MDick\\.pygenesis\\data\n"
]
}
],
"source": [
"data = get_data(name=\"61111-0002\", method=\"tablefile\", table_area=all)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from pygenesis.cache import clean_cache"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"clean_cache(\"61111-0002\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
Expand Down
10 changes: 5 additions & 5 deletions src/pygenesis/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def wrapper_func(**kwargs):
cache_dir,
)

# TODO: Is "name" generally in all subsequent methods (e.g. beyond get_data - or is only data meaningful to cache)?
# TODO: Is "name" generally in all subsequent methods
# (e.g. beyond get_data - or is only data meaningful to cache)?
name = kwargs["name"]
data_dir = cache_dir / name
if data_dir.exists():
Expand Down Expand Up @@ -73,11 +74,10 @@ def clean_cache(file: Optional[str] = None) -> None:
cache_dir,
)

# remove specified file (directory) from the data cache or clear complete cache (remove childs, preserve base)
# remove specified file (directory) from the data cache
# or clear complete cache (remove childs, preserve base)
file_paths = (
[cache_dir / file]
if file is not None
else [child for child in cache_dir.iterdir()]
[cache_dir / file] if file is not None else list(cache_dir.iterdir())
)

for file_path in file_paths:
Expand Down

0 comments on commit 5bee232

Please sign in to comment.