From a49a254d238ad1c3f985e0d62724a47623a8a3a1 Mon Sep 17 00:00:00 2001 From: Joshix Date: Sat, 15 Jun 2024 18:00:00 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20remove=20type=20ignore=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- an_website/host_info/host_info.py | 4 ++-- an_website/version/version.py | 22 ++++++---------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/an_website/host_info/host_info.py b/an_website/host_info/host_info.py index a34375a5f..7f663e8a2 100644 --- a/an_website/host_info/host_info.py +++ b/an_website/host_info/host_info.py @@ -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] diff --git a/an_website/version/version.py b/an_website/version/version.py index cb58d8b07..c7cb7b040 100644 --- a/an_website/version/version.py +++ b/an_website/version/version.py @@ -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