From 0b74796d949c595ba3e2e72c041e2acbc7419c6a Mon Sep 17 00:00:00 2001 From: vladmandic Date: Wed, 25 Mar 2026 09:34:59 +0100 Subject: [PATCH] basic ty config Signed-off-by: vladmandic --- installer.py | 6 +++--- launch.py | 2 +- pipelines/model_google.py | 5 ++--- pyproject.toml | 17 +++++++++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/installer.py b/installer.py index ac8802c34..4221abb6f 100644 --- a/installer.py +++ b/installer.py @@ -152,7 +152,7 @@ def package_spec(package): # check if package is installed -def installed(package, friendly: str = None, quiet = False): # pylint: disable=redefined-outer-name +def installed(package, friendly: str | None = None, quiet = False): # pylint: disable=redefined-outer-name t_start = time.time() ok = True try: @@ -276,7 +276,7 @@ def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True): # install package using pip if not already installed -def install(package, friendly: str = None, ignore: bool = False, reinstall: bool = False, no_deps: bool = False, quiet: bool = False, force: bool = False, no_build_isolation: bool = False): +def install(package, friendly: str | None = None, ignore: bool = False, reinstall: bool = False, no_deps: bool = False, quiet: bool = False, force: bool = False, no_build_isolation: bool = False): t_start = time.time() res = '' force = force or args.reinstall @@ -293,7 +293,7 @@ def install(package, friendly: str = None, ignore: bool = False, reinstall: bool # execute git command -def git(arg: str, folder: str = None, ignore: bool = False, optional: bool = False): # pylint: disable=unused-argument +def git(arg: str, folder: str | None= None, ignore: bool = False, optional: bool = False): # pylint: disable=unused-argument t_start = time.time() if args.skip_git: return '' diff --git a/launch.py b/launch.py index 14e11274e..2629a96cb 100755 --- a/launch.py +++ b/launch.py @@ -117,7 +117,7 @@ def is_installed(pkg): # compatibility function @lru_cache -def repo_dir(name): # compatibility function +def repo_dir(name: str): # compatibility function return os.path.join(script_path, dir_repos, name) diff --git a/pipelines/model_google.py b/pipelines/model_google.py index a48024dea..04d2951cb 100644 --- a/pipelines/model_google.py +++ b/pipelines/model_google.py @@ -32,9 +32,8 @@ def google_requirements(): # reload('pydantic', '2.11.7') -def get_size_buckets(width: int, height: int) -> str: +def get_size_buckets(width: int, height: int) -> tuple[str, str]: aspect_ratio = width / height - closest_aspect_ratio = min(aspect_ratios_buckets.items(), key=lambda x: abs(x[1] - aspect_ratio))[0] pixel_count = width * height closest_size = min(image_size_buckets.items(), key=lambda x: abs(x[1] - pixel_count))[0] closest_aspect_ratio = min(aspect_ratios_buckets.items(), key=lambda x: abs(x[1] - aspect_ratio))[0] @@ -104,7 +103,7 @@ class GoogleNanoBananaPipeline(): # Debug logging args_log = args.copy() - if args_log.get('api_key'): + if args_log.get('api_key', ''): args_log['api_key'] = '...' + args_log['api_key'][-4:] log.debug(f'Cloud: model="{self.model}" args={args_log}') return args diff --git a/pyproject.toml b/pyproject.toml index b339015a1..85bd5e03b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -413,9 +413,14 @@ exclude = [ ] [tool.ty.rules] -invalid-method-overrides = "ignore" -invalid-argument-types = "ignore" -unresolved-imports = "ignore" -unresolved-attributes = "ignore" -invalid-assignments = "ignore" -unsupported-operators = "ignore" +invalid-method-override = "ignore" +invalid-argument-type = "ignore" +unresolved-import = "ignore" +unresolved-attribute = "ignore" +invalid-assignment = "ignore" +unsupported-operator = "ignore" +no-matching-overload = "ignore" +unsupported-base = "ignore" +possibly-missing-attribute = "ignore" +invalid-parameter-default = "ignore" +call-non-callable = "ignore"