basic ty config

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-03-25 09:34:59 +01:00
parent b90558430e
commit 0b74796d94
4 changed files with 17 additions and 13 deletions

View File

@@ -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 ''

View File

@@ -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)

View File

@@ -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

View File

@@ -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"