Skip to content

Commit

Permalink
remove redundant calls to resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
elfkuzco committed Apr 22, 2024
1 parent 800eb95 commit 3a8250c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/gutenberg2zim/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def is_safe(fname):
# move all extracted files to proper locations
for zipped_file in zipped_files:
# skip folders
if not Path(zipped_file).resolve().is_file():
if not Path(zipped_file).is_file():
continue

src = (Path(tmpd) / zipped_file).resolve()
src = Path(tmpd) / zipped_file
if src.exists():
fname = Path(zipped_file).name

Expand Down
8 changes: 3 additions & 5 deletions src/gutenberg2zim/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,10 @@ def f(x):
for zim_lang in zims:
if do_zim:
logger.info("BUILDING ZIM dynamically")
if one_lang_one_zim_folder:
output_folder = Path(one_lang_one_zim_folder).resolve()
else:
output_folder = Path(".").resolve()
build_zimfile(
output_folder=output_folder,
output_folder=Path(one_lang_one_zim_folder).resolve()
if one_lang_one_zim_folder
else Path(".").resolve(),
download_cache=dl_cache,
concurrency=concurrency,
languages=zim_lang,
Expand Down
2 changes: 1 addition & 1 deletion src/gutenberg2zim/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def save_bs_output(soup, fpath, encoding=UTF8):


def tmpl_path() -> Path:
return (Path(gutenberg2zim.__file__).parent / "templates").resolve()
return Path(gutenberg2zim.__file__).parent / "templates"


def get_list_of_all_languages():
Expand Down
2 changes: 1 addition & 1 deletion src/gutenberg2zim/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def get_formatted_number(num: str | None) -> str | None:
nums = [f"{i:0=5d}" for i in range(21000, 40000)]
for num in nums:
print(num) # noqa: T201
curd = Path(__file__).resolve().parent
curd = Path(__file__).parent
rdf = curd.parent / "rdf-files" / num / f"pg{num}.rdf"
if rdf.is_file():
data = ""
Expand Down
2 changes: 1 addition & 1 deletion src/gutenberg2zim/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,5 @@ def setup_urls(force, books):


if __name__ == "__main__":
book = Book.get(id=84)
book = Book.get(id=9)
print(get_urls(book)) # noqa: T201

0 comments on commit 3a8250c

Please sign in to comment.