From 50dbc3559560323ac698932d06702cec078c7ae0 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Thu, 17 Sep 2026 11:28:36 -0700 Subject: [PATCH] Ruff --- docs/source/conf.py | 1 - pyproject.toml | 3 +++ src/wavinfo/__init__.py | 2 +- src/wavinfo/__main__.py | 16 ++++++++++------ src/wavinfo/wave_dbmd_reader.py | 6 ------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c0fdb6b..72e8486 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # diff --git a/pyproject.toml b/pyproject.toml index 3de1026..c7d9909 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,9 +65,12 @@ indent-width = 4 [tool.ruff.lint] fixable = ['ALL'] ignore = [ + 'FA100', #Add `from __future__ import annotations` to simplify `typing.Optional` 'UP022', # Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` 'SIM115', # Use a context manager for opening files 'UP031', #Use format specifiers instead of percent format + 'C408', # Unnecessary `dict()` call (rewrite as a literal) + 'C417' # Unnecessary `map()` usage (rewrite using a generator expression) ] # [tool.pylint] diff --git a/src/wavinfo/__init__.py b/src/wavinfo/__init__.py index 82e9cb0..fd0ffcc 100644 --- a/src/wavinfo/__init__.py +++ b/src/wavinfo/__init__.py @@ -2,7 +2,7 @@ Probe WAVE Files for iXML, Broadcast-WAVE and other metadata. """ -__all__ = ["WavInfoReader", "WavInfoEOFError"] +__all__ = ["WavInfoEOFError", "WavInfoReader"] from .riff_parser import WavInfoEOFError from .wave_reader import WavInfoReader diff --git a/src/wavinfo/__main__.py b/src/wavinfo/__main__.py index 9d1ddf7..43001a4 100644 --- a/src/wavinfo/__main__.py +++ b/src/wavinfo/__main__.py @@ -31,7 +31,11 @@ class MetaBrowser(Cmd): prompt = "(wavinfo) " metadata: Union[List, Dict] - path: List[str] = [] + path: List[str] + + def preloop(self) -> None: + self.path = [] + return super().preloop() @property def cwd(self): @@ -91,7 +95,7 @@ class MetaBrowser(Cmd): else: print(f"Index {argv[0]} does not exist") elif isinstance(self.cwd, dict): - if argv[0] in self.cwd.keys(): + if argv[0] in self.cwd: self.path = self.path + [argv[0]] else: print(f'Key "{argv[0]}" does not exist') @@ -177,12 +181,14 @@ def main(): else: ret_dict = { "filename": arg, - "run_date": datetime.datetime.now().isoformat(), + "run_date": datetime.datetime.now( + tz=datetime.timezone.utc + ).isoformat(), "application": f"wavinfo {version}", "scopes": {}, } for scope, name, value in this_file.walk(): - if scope not in ret_dict["scopes"].keys(): + if scope not in ret_dict["scopes"]: ret_dict["scopes"][scope] = {} ret_dict["scopes"][scope][name] = value @@ -198,8 +204,6 @@ def main(): file=sys.stderr, ) continue - except Exception as e: - raise e if len(interactive_dict) > 0: cli = MetaBrowser() diff --git a/src/wavinfo/wave_dbmd_reader.py b/src/wavinfo/wave_dbmd_reader.py index e471f3a..a25563f 100644 --- a/src/wavinfo/wave_dbmd_reader.py +++ b/src/wavinfo/wave_dbmd_reader.py @@ -178,22 +178,16 @@ class DolbyDigitalPlusMetadata: Per ATSC/A52 § 5.4.2.12, this is not in use and always 0xFF. """ - pass - class MixLevel(int): """ § 4.3.6.2 """ - pass - class DialnormLevel(int): """ § 4.3.4.4 """ - pass - class RoomType(Enum): """ `roomtyp` 4.3.6.3