Skip to content

Commit

Permalink
✨ remove type ignore comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed Jun 15, 2024
1 parent 284e0cf commit a49a254
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
4 changes: 2 additions & 2 deletions an_website/host_info/host_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ async def get(self, *, head: bool = False) -> None:
if head:
return

logo = self.SCREENFETCH_CACHE.value # type: ignore[attr-defined]
logo = self.SCREENFETCH_CACHE.value

if not logo:
logo = minify_ansi_art((await run(SCREENFETCH_PATH, "-L"))[1])
self.SCREENFETCH_CACHE.value = logo # type: ignore[attr-defined]
self.SCREENFETCH_CACHE.value = logo

screenfetch_bytes = (await run(SCREENFETCH_PATH, "-n", env=ENV))[1]

Expand Down
22 changes: 6 additions & 16 deletions an_website/version/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,21 @@ def hash_all_files() -> str:
def get_file_hashes() -> str:
"""Return the file hashes."""
with FILE_HASHES:
if FILE_HASHES.value: # type: ignore[attr-defined]
return cast(
str,
FILE_HASHES.value.decode("UTF-8"), # type: ignore[attr-defined]
)
if FILE_HASHES.value:
return FILE_HASHES.value.decode("UTF-8")
file_hashes = hash_all_files()
FILE_HASHES.value = file_hashes.encode("UTF-8") # type: ignore[attr-defined]
FILE_HASHES.value = file_hashes.encode("UTF-8")
return file_hashes


def get_hash_of_file_hashes() -> str:
"""Return a hash of the file hashes."""
with HASH_OF_FILE_HASHES:
if HASH_OF_FILE_HASHES.value: # type: ignore[attr-defined]
if HASH_OF_FILE_HASHES.value:
# .raw to fix bug with \x00 in hash
return cast(
str,
HASH_OF_FILE_HASHES.raw.decode( # type: ignore[attr-defined]
"UTF-16-BE"
),
)
return HASH_OF_FILE_HASHES.raw.decode("UTF-16-BE")
hash_of_file_hashes = hash_bytes(get_file_hashes().encode("UTF-8"))
HASH_OF_FILE_HASHES.raw = ( # type: ignore[attr-defined]
hash_of_file_hashes.encode("UTF-16-BE")
)
HASH_OF_FILE_HASHES.raw = hash_of_file_hashes.encode("UTF-16-BE")
return hash_of_file_hashes


Expand Down

0 comments on commit a49a254

Please sign in to comment.