Skip to content

Commit 023dcec

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Run mypy from tox"
2 parents e60b700 + 164e5d0 commit 023dcec

7 files changed

Lines changed: 17 additions & 35 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,14 @@ repos:
1515
files: .*\.(yaml|yml)$
1616
args: ['--unsafe']
1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.14.0
18+
rev: v0.15.1
1919
hooks:
2020
- id: ruff-check
2121
args: ['--fix', '--unsafe-fixes']
2222
- id: ruff-format
2323
- repo: https://opendev.org/openstack/hacking
24-
rev: 7.0.0
24+
rev: 8.0.0
2525
hooks:
2626
- id: hacking
2727
additional_dependencies: []
2828
exclude: '^(doc|releasenotes)/.*$'
29-
- repo: https://github.com/pre-commit/mirrors-mypy
30-
rev: v1.18.2
31-
hooks:
32-
- id: mypy
33-
additional_dependencies:
34-
- types-requests
35-
# keep this in-sync with '[tool.mypy] exclude' in 'pyproject.toml'
36-
exclude: |
37-
(?x)(
38-
doc/.*
39-
| examples/.*
40-
| hacking/.*
41-
| releasenotes/.*
42-
)

openstackclient/common/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def take_action(self, parsed_args):
6161
# TODO(bapalm): Fix this when cliff properly supports
6262
# handling the detection rather than using the hard-code below.
6363
if parsed_args.formatter == 'table':
64-
command_names = utils.format_list(command_names, "\n")
64+
command_names = utils.format_list(command_names, "\n") # type: ignore
6565

6666
commands.append((group, command_names))
6767

openstackclient/identity/v2_0/service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ def take_action(self, parsed_args):
160160
for service, service_endpoints in endpoints.items():
161161
if service_endpoints:
162162
info = {"type": service}
163-
info.update(service_endpoints[0])
163+
# FIXME(stephenfin): The return type for this in ksa is
164+
# wrong
165+
info.update(service_endpoints[0]) # type: ignore
164166
return zip(*sorted(info.items()))
165167

166168
msg = _(

openstackclient/volume/v2/volume_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def take_action(self, parsed_args):
466466
_EncryptionInfoColumn = functools.partial(
467467
EncryptionInfoColumn, encryption_data=encryption
468468
)
469-
formatters['id'] = _EncryptionInfoColumn
469+
formatters['id'] = _EncryptionInfoColumn # type: ignore
470470

471471
return (
472472
column_headers,

openstackclient/volume/v3/volume_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def take_action(self, parsed_args):
549549
_EncryptionInfoColumn = functools.partial(
550550
EncryptionInfoColumn, encryption_data=encryption
551551
)
552-
formatters['id'] = _EncryptionInfoColumn
552+
formatters['id'] = _EncryptionInfoColumn # type: ignore
553553

554554
return (
555555
column_headers,

pyproject.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -744,15 +744,7 @@ follow_imports = "normal"
744744
incremental = true
745745
check_untyped_defs = true
746746
warn_unused_ignores = true
747-
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
748-
exclude = '''
749-
(?x)(
750-
doc
751-
| examples
752-
| hacking
753-
| releasenotes
754-
)
755-
'''
747+
exclude = '(?x)(doc | examples | hacking | releasenotes)'
756748

757749
[[tool.mypy.overrides]]
758750
module = ["openstackclient.tests.unit.*"]

tox.ini

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,22 @@ commands =
2020
[testenv:pep8]
2121
description =
2222
Run style checks.
23-
skip_install = true
2423
deps =
2524
pre-commit
25+
{[testenv:mypy]deps}
2626
commands =
2727
pre-commit run --all-files --show-diff-on-failure
28+
{[testenv:mypy]commands}
2829

29-
[testenv:bandit]
30+
[testenv:mypy]
3031
description =
31-
Run bandit security checks.
32-
skip_install = true
32+
Run type checks.
3333
deps =
34-
pre-commit
34+
{[testenv]deps}
35+
mypy
36+
types-requests
3537
commands =
36-
pre-commit run --all-files --show-diff-on-failure bandit
38+
mypy --cache-dir="{envdir}/mypy_cache" {posargs:openstackclient}
3739

3840
[testenv:unit-tips]
3941
commands =

0 commit comments

Comments
 (0)