Skip to content

Commit a3d33e8

Browse files
committed
Add more annotations
1 parent 93c62e3 commit a3d33e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+251
-105
lines changed

mypy-baseline.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ src/rez/util.py:0: error: Item "None" of "Loader | Any | None" has no attribute
4040
src/rez/utils/backcompat.py:0: error: Item "None" of "Match[str] | None" has no attribute "groupdict" [union-attr]
4141
src/rez/utils/backcompat.py:0: error: Item "None" of "Match[str] | None" has no attribute "groupdict" [union-attr]
4242
src/rez/utils/sourcecode.py:0: error: Item "None" of "FunctionType | MethodType | None" has no attribute "__name__" [union-attr]
43-
src/rez/utils/sourcecode.py:0: error: Incompatible types in assignment (expression has type "str | Any", variable has type "None") [assignment]
4443
src/rez/utils/sourcecode.py:0: error: Argument 1 to "getsourcelines" has incompatible type "FunctionType | MethodType | None"; expected Module | type[Any] | MethodType | FunctionType | TracebackType | FrameType | CodeType | Callable[..., Any] [arg-type]
4544
src/rez/utils/platform_.py:0: error: Module has no attribute "windll" [attr-defined]
4645
src/rez/utils/platform_.py:0: error: Module has no attribute "WinError" [attr-defined]
@@ -112,26 +111,37 @@ src/rez/packages.py:0: error: Argument 1 to "Variant" has incompatible type "Res
112111
src/rez/solver.py:0: error: Argument 1 to "set_context" of "PackageBaseResourceWrapper" has incompatible type "ResolvedContext | None"; expected "ResolvedContext" [arg-type]
113112
src/rez/package_order.py:0: error: Incompatible types in assignment (expression has type "Iterable[str] | None", variable has type "list[str]") [assignment]
114113
src/rez/package_order.py:0: error: Argument 1 to "sort_key" of "PackageOrder" has incompatible type "str | None"; expected "str" [arg-type]
114+
src/rez/package_maker.py:0: error: Item "None" of "Variant | None" has no attribute "base" [union-attr]
115+
src/rez/package_maker.py:0: error: Argument 1 has incompatible type "Variant | None"; expected "Variant" [arg-type]
116+
src/rez/package_maker.py:0: error: Item "None" of "Variant | None" has no attribute "root" [union-attr]
117+
src/rez/package_maker.py:0: error: Argument 1 has incompatible type "Variant | None"; expected "Variant" [arg-type]
115118
src/rez/package_filter.py:0: error: "type[property]" has no attribute "uncache" [attr-defined]
116119
src/rez/package_filter.py:0: error: Too many arguments for "RegexRuleBase" [call-arg]
117120
src/rez/resolver.py:0: error: Argument 1 to "get_variant_state_handle" of "PackageRepository" has incompatible type "Resource"; expected "PackageResource" [arg-type]
118121
src/rez/resolver.py:0: error: Argument 1 to "get_variant_state_handle" of "PackageRepository" has incompatible type "Resource"; expected "PackageResource" [arg-type]
122+
src/rez/resolver.py:0: error: Item "None" of "list[PackageVariant] | None" has no attribute "__iter__" (not iterable) [union-attr]
123+
src/rez/resolver.py:0: error: Item "None" of "list[Requirement] | None" has no attribute "__iter__" (not iterable) [union-attr]
119124
src/rez/package_cache.py:0: error: Module has no attribute "CREATE_NEW_PROCESS_GROUP" [attr-defined]
120125
src/rez/resolved_context.py:0: error: Incompatible return value type (got "_Wrapped[[VarArg(Any), KwArg(Any)], Any, [Any, VarArg(Any), KwArg(Any)], Any]", expected "CallableT") [return-value]
121126
src/rez/resolved_context.py:0: error: Argument "verbosity" to "Resolver" has incompatible type "int"; expected "bool" [arg-type]
122127
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
123-
src/rez/resolved_context.py:0: error: Argument 1 to "get_equivalent_variant" of "PackageRepository" has incompatible type "Resource | Any"; expected "VariantResource" [arg-type]
128+
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
129+
src/rez/resolved_context.py:0: error: Argument 1 to "get_equivalent_variant" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type]
124130
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
125131
src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "list[Requirement]", variable has type "list[PackageRequest]") [assignment]
126132
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
127133
src/rez/resolved_context.py:0: error: Argument 1 to "__iadd__" of "list" has incompatible type "list[str]"; expected "Iterable[PackageRequest]" [arg-type]
128134
src/rez/resolved_context.py:0: error: Item "None" of "ResolvedContext | None" has no attribute "set_load_path" [union-attr]
129135
src/rez/resolved_context.py:0: error: Incompatible return value type (got "ResolvedContext | None", expected "ResolvedContext") [return-value]
136+
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
137+
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
130138
src/rez/resolved_context.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[Any], Any] | None"; expected "None" [arg-type]
139+
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
131140
src/rez/resolved_context.py:0: error: Item "None" of "list[Requirement] | None" has no attribute "__iter__" (not iterable) [union-attr]
132141
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
133142
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
134143
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
144+
src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr]
135145
src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "list[PackageOrder]", variable has type "PackageOrderList") [assignment]
136146
src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "PackageOrderList") [assignment]
137147
src/rez/resolved_context.py:0: error: Argument 1 to "update" of "MutableMapping" has incompatible type "dict[str, Any] | None"; expected "SupportsKeysAndGetItem[str, Any]" [arg-type]
@@ -178,7 +188,6 @@ src/rezplugins/package_repository/filesystem.py:0: error: Return type "PackageRe
178188
src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 of "get_variant_state_handle" is incompatible with supertype "PackageRepository"; supertype defines the argument type as "PackageResource" [override]
179189
src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepositoryResource" has no attribute "state_handle" [attr-defined]
180190
src/rezplugins/package_repository/filesystem.py:0: error: "PackageFamilyResource" has no attribute "get_last_release_time" [attr-defined]
181-
src/rezplugins/package_repository/filesystem.py:0: error: Return type "Variant | None" of "get_variant_from_uri" incompatible with return type "VariantResource | None" in supertype "PackageRepository" [override]
182191
src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in assignment (expression has type "str", variable has type "int | None") [assignment]
183192
src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type]
184193
src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "remove_package" of "FileSystemPackageRepository" has incompatible type "str | None"; expected "str" [arg-type]
@@ -217,6 +226,7 @@ src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any |
217226
src/rezplugins/package_repository/filesystem.py:0: error: "VariantResource" has no attribute "variant_requires" [attr-defined]
218227
src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "Any | str | None"; expected "str" [arg-type]
219228
src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "_on_changed" of "FileSystemPackageRepository" has incompatible type "Any | str | None"; expected "str" [arg-type]
229+
src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "get_package" of "PackageRepository" has incompatible type "Any | str | None"; expected "str" [arg-type]
220230
src/rez/package_test.py:0: error: Item "None" of "ResolvedContext | None" has no attribute "get_resolved_package" [union-attr]
221231
src/rez/package_test.py:0: error: Item "None" of "Variant | Any | None" has no attribute "uri" [union-attr]
222232
src/rez/package_test.py:0: error: Item "None" of "Variant | Any | None" has no attribute "variant_requires" [union-attr]
@@ -293,11 +303,9 @@ src/rez/bind/_pymodule.py:0: error: Name "env" is not defined [name-defined]
293303
src/rez/bind/_pymodule.py:0: error: Name "env" is not defined [name-defined]
294304
src/rezplugins/build_process/local.py:0: error: Argument 1 to "join" of "str" has incompatible type "list[str | None]"; expected "Iterable[str]" [arg-type]
295305
src/rezplugins/build_process/local.py:0: error: Argument 1 to "pre_variant_install" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type]
296-
src/rezplugins/build_process/local.py:0: error: Unexpected TypedDict keys ("package_install_path", "variant_install_path") [misc]
297306
src/rezplugins/build_process/local.py:0: error: Argument 1 to "get_repository" of "PackageRepositoryManager" has incompatible type "str | None"; expected "str" [arg-type]
298307
src/rezplugins/build_process/local.py:0: error: Argument 1 to "on_variant_install_cancelled" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type]
299-
src/rezplugins/build_process/local.py:0: error: TypedDict "BuildResult" has no key "package_install_path" [typeddict-item]
300-
src/rezplugins/build_process/local.py:0: error: TypedDict "BuildResult" has no key "variant_install_path" [typeddict-item]
308+
src/rezplugins/build_process/local.py:0: error: Argument 1 to "on_variant_install_cancelled" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type]
301309
src/rez/cli/pip.py:0: error: "Config" has no attribute "debug_package_release" [attr-defined]
302310
src/rez/cli/release.py:0: error: Name "raw_input" is not defined [name-defined]
303311
src/rez/cli/selftest.py:0: error: Argument 1 to "getfile" has incompatible type "FrameType | None"; expected Module | type[Any] | MethodType | FunctionType | TracebackType | FrameType | CodeType | Callable[..., Any] [arg-type]

src/rez/bundle_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Copyright Contributors to the Rez Project
33

44

5+
from __future__ import annotations
6+
57
import os
68
import os.path
79
import stat

src/rez/cli/bind.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
'''
66
Create a Rez package for existing software.
77
'''
8+
from __future__ import annotations
9+
810
import argparse
911

1012

src/rez/cli/bundle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
'''
66
Bundle a context and its packages into a relocatable dir.
77
'''
8+
from __future__ import annotations
9+
810
import os
911
import os.path
1012
import sys

src/rez/cli/complete.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"""
66
Prints package completion strings.
77
"""
8+
from __future__ import annotations
9+
810
import argparse
911

1012

src/rez/cli/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
'''
66
Print current rez settings.
77
'''
8+
from __future__ import annotations
9+
810
import json
911

1012

src/rez/cli/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# Since features such as context tracking are related to context use only, we
1414
# disable them in this tool.
1515
#
16+
from __future__ import annotations
17+
1618
import os
1719
import json
1820
import sys

src/rez/cli/cp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'''
66
Copy a package from one repository to another.
77
'''
8+
from __future__ import annotations
89

910

1011
def setup_parser(parser, completions: bool = False) -> None:

src/rez/cli/depends.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
Perform a reverse package dependency lookup.
77
"""
8+
from __future__ import annotations
89

910

1011
def setup_parser(parser, completions: bool = False) -> None:

src/rez/cli/diff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
Compare the source code of two packages.
77
"""
8+
from __future__ import annotations
89

910

1011
def setup_parser(parser, completions: bool = False) -> None:

0 commit comments

Comments
 (0)