Skip to content

Commit 44f4ac3

Browse files
committed
More fixes
1 parent 5626dc2 commit 44f4ac3

File tree

7 files changed

+26
-15
lines changed

7 files changed

+26
-15
lines changed

src/rez/package_filter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,12 @@ def parse_rule(cls, txt):
369369
Returns:
370370
Rule:
371371
"""
372-
types = {"glob": GlobRule,
373-
"regex": RegexRule,
374-
"range": RangeRule,
375-
"before": TimestampRule,
376-
"after": TimestampRule}
372+
types: dict[str, type[Rule]] = {
373+
"glob": GlobRule,
374+
"regex": RegexRule,
375+
"range": RangeRule,
376+
"before": TimestampRule,
377+
"after": TimestampRule}
377378

378379
# parse form 'x(y)' into x, y
379380
label, txt = Rule._parse_label(txt)
@@ -440,7 +441,7 @@ def cost(self):
440441
return 10
441442

442443
@classmethod
443-
def _parse(cls, txt):
444+
def _parse(cls, txt: str):
444445
_, txt = Rule._parse_label(txt)
445446
return cls(txt)
446447

src/rez/package_maker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from rez.version import Version
2121
from contextlib import contextmanager
2222
import os
23+
from typing import Iterable
2324

2425

2526
# this schema will automatically harden request strings like 'python-*'; see
@@ -200,19 +201,20 @@ def make_package(name, path, make_base=None, make_root=None, skip_existing=True,
200201
#
201202

202203
package = maker.get_package()
203-
src_variants: list[Variant] = []
204204

205205
# skip those variants that already exist
206206
if skip_existing:
207+
variants: list[Variant] = []
207208
for variant in package.iter_variants():
208209
variant_ = variant.install(path, dry_run=True)
209210
if variant_ is None:
210-
src_variants.append(variant)
211+
variants.append(variant)
211212
else:
212213
maker.skipped_variants.append(variant_)
213214
if warn_on_skip:
214215
print_warning("Skipping installation: Package variant already "
215216
"exists: %s" % variant_.uri)
217+
src_variants: Iterable[Variant] = variants
216218
else:
217219
src_variants = package.iter_variants()
218220

src/rez/resolved_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ def read_from_buffer(cls, buf, identifier_str=None):
734734
except Exception as e:
735735
cls._load_error(e, identifier_str)
736736

737-
def get_resolve_diff(self, other):
737+
def get_resolve_diff(self, other: ResolvedContext):
738738
"""Get the difference between the resolve in this context and another.
739739
740740
The difference is described from the point of view of the current context

src/rez/rex.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from contextlib import contextmanager
1414
from string import Formatter
1515
from collections.abc import MutableMapping
16+
from typing import Iterable
1617

1718
from rez.system import system
1819
from rez.config import config
@@ -178,7 +179,7 @@ class ActionManager(object):
178179
triggers the callbacks of the `ActionInterpreter`.
179180
"""
180181
def __init__(self, interpreter: ActionInterpreter, parent_environ: dict[str, str] | None = None,
181-
parent_variables=None, formatter=None, verbose=False, env_sep_map=None):
182+
parent_variables: Iterable[str] | None = None, formatter=None, verbose=False, env_sep_map=None):
182183
'''
183184
interpreter: string or `ActionInterpreter`
184185
the interpreter to use when executing rex actions

src/rez/shells.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_shell_types() -> list[str]:
3636
return list(plugin_manager.get_plugins('shell'))
3737

3838

39-
def get_shell_class(shell=None) -> type[Shell]:
39+
def get_shell_class(shell: str | None = None) -> type[Shell]:
4040
"""Get the plugin class associated with the given or current shell.
4141
4242
Returns:
@@ -47,9 +47,9 @@ def get_shell_class(shell=None) -> type[Shell]:
4747
if not shell:
4848
from rez.system import system
4949
shell = system.shell
50-
50+
assert shell is not None
5151
from rez.plugin_managers import plugin_manager
52-
return plugin_manager.get_plugin_class("shell", shell, type=Shell)
52+
return plugin_manager.get_plugin_class("shell", shell, Shell)
5353

5454

5555
def create_shell(shell: str | None = None, **kwargs) -> Shell:
@@ -335,7 +335,7 @@ class UnixShell(Shell):
335335
command_arg = '-c'
336336
stdin_arg = '-s'
337337
last_command_status = '$?'
338-
syspaths = None
338+
syspaths: list[str] = None
339339

340340
#
341341
# startup rules

src/rez/suite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class Context(TypedDict):
3939
hidden_tools: set[str]
4040
priority: int
4141
prefix_char: str | None
42+
loaded: bool
43+
prefix: str
44+
suffix: str
45+
4246
else:
4347
Tool = dict
4448
Context = dict

src/rezplugins/release_hook/amqp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
"""
66
Publishes a message to the broker.
77
"""
8+
from __future__ import annotations
9+
810
from rez.release_hook import ReleaseHook
911
from rez.utils.logging_ import print_error, print_debug
1012
from rez.utils.amqp import publish_message
1113
from rez.config import config
14+
from typing import Any
1215

1316

1417
class AmqpReleaseHook(ReleaseHook):
@@ -55,7 +58,7 @@ def post_release(self, user, install_path, variants, **kwargs):
5558
package = self.package
5659

5760
# build the message dict
58-
data = {}
61+
data: dict[str, Any] = {}
5962
data["package"] = dict(
6063
name=package.name,
6164
version=str(package.version),

0 commit comments

Comments
 (0)