Skip to content

Commit

Permalink
Fix typing check - move assert before use of fp.tell() + shorten the …
Browse files Browse the repository at this point in the history
…message while at it
  • Loading branch information
yarikoptic committed Sep 12, 2024
1 parent 98faaaf commit 7cd4c99
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,10 @@ def __exit__(
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None:
assert self.fp is not None
if exc_type is not None or exc_val is not None or exc_tb is not None:
lgr.debug(

Check warning on line 872 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L872

Added line #L872 was not covered by tests
"%s - entered __exit__ with current position %d with exception: "
"%s, %s, %s",
"%s - entered __exit__ with position %d with exception: " "%s, %s, %s",
self.dirpath,
self.fp.tell(),
exc_type,
Expand All @@ -879,11 +879,10 @@ def __exit__(
)
else:
lgr.debug(
"%s - entered __exit__ with current position %d without any exception",
"%s - entered __exit__ with position %d without any exception",
self.dirpath,
self.fp.tell(),
)
assert self.fp is not None
self.fp.close()
try:
if exc_type is None:
Expand Down

0 comments on commit 7cd4c99

Please sign in to comment.