Skip to content

Commit

Permalink
Small fixes / change revert following review
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Jul 25, 2023
1 parent 319d9f9 commit 7a082af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def initialize(self, version, build_data):
return
Path(self.root).joinpath("src/kolibri2zim/templates/assets")
subprocess.run(
str(Path(self.root).joinpath("get_js_deps.sh")), # : S603
str(Path(self.root).joinpath("get_js_deps.sh")),
check=True,
)
return super().initialize(version, build_data)
Expand All @@ -38,7 +38,8 @@ def deps_already_installed(self) -> bool:
for dep in JS_DEPS:
if (
not Path(self.root)
.joinpath(f"src/kolibri2zim/templates/assets/{dep}")
.joinpath("src/kolibri2zim/templates/assets")
.joinpath(dep)
.exists()
):
return False
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ select = [
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow use of datetime with tz and date.today
"DTZ005", "DTZ011",
# Remove flake8-errmsg since we consider they bloat the code and provide limited value
"EM",
# Allow boolean positional values in function calls, like `dict.get(... True)`
Expand Down
11 changes: 5 additions & 6 deletions src/kolibri2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ def run(self):
LongDescription=self.long_description,
Creator=self.author,
Publisher=self.publisher,
Date=datetime.datetime.now(datetime.UTC),
Date=datetime.date.today(),
Illustration_48x48_at_1=self.favicon_48_fpath.read_bytes(),
)
self.creator.start()
Expand Down Expand Up @@ -871,9 +871,8 @@ def run(self):
f"FAILURE not_done={len(result.not_done)} done={len(result.done)}"
)
for future in result.done:
future_exception = future.exception()
if future_exception:
raise future_exception
if future.exception():
raise future.exception() # pyright:ignore
except KeyboardInterrupt:
self.creator.can_finish = False
logger.error("KeyboardInterrupt, exiting.")
Expand Down Expand Up @@ -929,12 +928,12 @@ def sanitize_inputs(self):
channel_meta = self.db.get_channel_metadata(self.channel_id)

# input & metadata sanitation
period = datetime.datetime.now(datetime.UTC).strftime("%Y-%m")
period = datetime.datetime.now().strftime("%Y-%m")
if self.fname:
# make sure we were given a filename and not a path
fname_path = Path(str(self.fname).format(period=period))
if Path(fname_path.name) != fname_path:
raise ValueError(f"filename is not a filename: {fname_path}")
raise ValueError(f"filename is not a filename: {self.fname}")
self.clean_fname = str(fname_path)
else:
self.clean_fname = f"{self.name}_{period}.zim"
Expand Down

0 comments on commit 7a082af

Please sign in to comment.