Skip to content

Commit f734c58

Browse files
JohnVillalovosnejch
authored andcommitted
chore: update to mypy 1.16.0 and resolve issues found
There was an error in the type-hints that was detected when updating to mypy 1.16.0 The error was: $ mypy gitlab/v4/cli.py:411: error: Argument 1 to "cls_to_gitlab_resource" has incompatible type "type[Any]"; expected "RESTObject" [arg-type] Found 1 error in 1 file (checked 246 source files)
1 parent 378a836 commit f734c58

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

gitlab/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def gitlab_resource_to_cls(
107107
return class_type
108108

109109

110-
def cls_to_gitlab_resource(cls: RESTObject) -> str:
110+
def cls_to_gitlab_resource(cls: type[RESTObject]) -> str:
111111
dasherized_uppercase = camel_upperlower_regex.sub(r"\1-\2", cls.__name__)
112112
dasherized_lowercase = camel_lowerupper_regex.sub(r"\1-\2", dasherized_uppercase)
113113
return dasherized_lowercase.lower()

gitlab/v4/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def extend_parser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
394394
subparsers.required = True
395395

396396
# populate argparse for all Gitlab Object
397-
classes = set()
397+
classes: set[type[gitlab.base.RESTObject]] = set()
398398
for cls in gitlab.v4.objects.__dict__.values():
399399
if not isinstance(cls, type):
400400
continue

requirements-lint.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ black==25.1.0
44
commitizen==4.8.2
55
flake8==7.2.0
66
isort==6.0.1
7-
mypy==1.15.0
7+
mypy==1.16.0
88
pylint==3.3.7
99
pytest==8.3.5
1010
responses==0.25.7

tests/unit/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def error(self, message):
161161
"Raise error instead of exiting on invalid arguments, to make testing easier"
162162
raise ValueError(message)
163163

164-
class Fake:
164+
class Fake(gitlab.base.RESTObject):
165165
_id_attr = None
166166

167167
class FakeManager(CreateMixin, UpdateMixin, gitlab.base.RESTManager):

0 commit comments

Comments
 (0)