From ad6d36762e0df41ad02f30cf3671dfb01b0fc383 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Thu, 12 Feb 2026 20:02:05 -0500 Subject: [PATCH] Fix minor lint issues --- art.py | 2 +- audio.py | 4 ---- collision.py | 1 - formats/in_ans.py | 4 +--- playscii.py | 20 +++++++------------- ui_art_dialog.py | 4 +--- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/art.py b/art.py index a51055e..0e3b70d 100644 --- a/art.py +++ b/art.py @@ -1236,7 +1236,7 @@ class ArtFromDisk(Art): self.valid = True def log_init(self): - self.app.log(f"Loaded {filename} from disk:") + self.app.log(f"Loaded {self.filename} from disk:") self.app.log(f" character set: {self.charset.name}") self.app.log(f" palette: {self.palette.name}") self.app.log(f" width/height: {self.width} x {self.height}") diff --git a/audio.py b/audio.py index 6d128a4..9873098 100644 --- a/audio.py +++ b/audio.py @@ -130,10 +130,6 @@ class AudioLord: def is_music_playing(self): return bool(sdlmixer.Mix_PlayingMusic()) - def resume_music(self): - if self.current_music: - sdlmixer.Mix_ResumeMusic() - def stop_all_music(self): sdlmixer.Mix_HaltMusic() self.current_music = None diff --git a/collision.py b/collision.py index 8d065f7..8d8abce 100644 --- a/collision.py +++ b/collision.py @@ -652,6 +652,5 @@ def circle_box_penetration( pdist = circle_radius - d if d == 0: return - 1, 0, -pdist, -pdist # TODO: calculate other axis of intersection for area? return -closest_x / d, -closest_y / d, -pdist, -pdist diff --git a/formats/in_ans.py b/formats/in_ans.py index 6fb55bc..ef633a3 100644 --- a/formats/in_ans.py +++ b/formats/in_ans.py @@ -184,6 +184,4 @@ Assumes 80 columns, DOS character set and EGA palette. # resize to last line touched self.resize(WIDTH, max_y) # rare cases where no lines covered - if self.art.height == 0: - return False - return True + return self.art.height != 0 diff --git a/playscii.py b/playscii.py index d131b7c..e43dbc5 100755 --- a/playscii.py +++ b/playscii.py @@ -1,13 +1,8 @@ #!/usr/bin/env python3 import os.path -import sys - -if sys.version_info.major < 3: - print("Python 3 is required to run Playscii.", file=sys.stderr) - sys.exit(1) - import platform +import sys if platform.system() == "Windows" or platform.system() == "Darwin": import os @@ -21,6 +16,7 @@ if platform.system() == "Darwin" and hasattr(sys, "frozen"): os.chdir(os.path.abspath(os.path.dirname(sys.executable))) # app imports +import contextlib import ctypes import hashlib import importlib @@ -47,10 +43,10 @@ if version.parse(Image.__version__) > version.parse("10.0.0"): Image.ANTIALIAS = Image.LANCZOS # cache whether pdoc is available for help menu item pdoc_available = False -try: +with contextlib.suppress(Exception): + import pdoc # noqa: F401, E402 + pdoc_available = True -except Exception: - pass # submodules - set here so cfg file can modify them all easily from art import ( @@ -305,7 +301,7 @@ class Application: self.log("GLSL support not detected, " + self.compat_fail_message) self.should_quit = True return - glsl_ver = glsl_ver.decode("utf-8") if glsl_ver != None else None + glsl_ver = glsl_ver.decode("utf-8") if glsl_ver is not None else None self.log(f" GLSL detected: {glsl_ver}" or "[unknown]") # verify that we got at least a 2.1 context majorv, minorv = ctypes.c_int(0), ctypes.c_int(0) @@ -1204,10 +1200,8 @@ def get_paths(): new_dir = os.path.abspath(documents_dir + subdir) # os.path.exists can fail in Windows b/c case insensitivity, # so just try and fail :[ - try: + with contextlib.suppress(Exception): os.mkdir(new_dir) - except Exception: - pass return config_dir, documents_dir, cache_dir diff --git a/ui_art_dialog.py b/ui_art_dialog.py index ac48cc2..c3c6621 100644 --- a/ui_art_dialog.py +++ b/ui_art_dialog.py @@ -479,9 +479,7 @@ class AddFrameDialog(UIDialog): index = int(index) except Exception: return False - if index < 1 or index > self.ui.active_art.frames + 1: - return False - return True + return not (index < 1 or index > self.ui.active_art.frames + 1) def is_valid_frame_delay(self, delay): try: