Skip to content

Commit

Permalink
🧪 Temporarily suppress MyPy violations
Browse files Browse the repository at this point in the history
FIXME: address each ignored violation gradually
  • Loading branch information
webknjaz committed Sep 25, 2024
1 parent 5c86d2c commit ad71c67
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 32 deletions.
25 changes: 1 addition & 24 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,36 +606,13 @@ jobs:
- linkcheck-docs
- spellcheck-docs
environment-variables:
- >- # only affects pre-commit, set for all for simplicity:
SKIP=mypy
- ''
tox-run-posargs:
- ''
xfail:
- false
check-name:
- ''
include:
- runner-vm-os: ubuntu-latest
python-version: 3.11
toxenv: pre-commit
environment-variables: ''
tox-run-posargs: mypy-py313 --all-files
xfail: true
check-name: MyPy @ Python 3.13
- runner-vm-os: ubuntu-latest
python-version: 3.11
toxenv: pre-commit
environment-variables: ''
tox-run-posargs: mypy-py312 --all-files
xfail: true
check-name: MyPy @ Python 3.12
- runner-vm-os: ubuntu-latest
python-version: 3.11
toxenv: pre-commit
environment-variables: ''
tox-run-posargs: mypy-py311 --all-files
xfail: true
check-name: MyPy @ Python 3.11
fail-fast: false
uses: ./.github/workflows/reusable-tox.yml
with:
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/aim.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-call, no-untyped-def"

from urllib.parse import quote, urlencode, urljoin

import requests
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/aws_secretsmanager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-def"

import boto3
from botocore.exceptions import ClientError

Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/azure_kv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="import-untyped, no-untyped-def"

from azure.identity import ClientSecretCredential
from azure.keyvault.secrets import SecretClient
from msrestazure import azure_cloud
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/centrify_vault.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-call, no-untyped-def, type-var"

from urllib.parse import urljoin

import requests
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/conjur.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="arg-type, no-untyped-call, no-untyped-def"

import base64
import binascii
from urllib.parse import quote, urljoin
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/dsv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="attr-defined, import-untyped, no-untyped-def"

from base64 import b64decode

from delinea.secrets.vault import PasswordGrantAuthorizer, SecretsVault
Expand Down
29 changes: 21 additions & 8 deletions src/awx_plugins/credentials/hashivault.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="arg-type, no-untyped-call, no-untyped-def"

import copy
import os
import pathlib
Expand Down Expand Up @@ -175,7 +178,7 @@
}

hashi_kv_inputs = copy.deepcopy(base_inputs)
hashi_kv_inputs['fields'].append(
hashi_kv_inputs['fields'].append( # type: ignore[attr-defined] # FIXME
{
'id': 'api_version',
'label': _('API Version'),
Expand All @@ -188,7 +191,7 @@
},
)
hashi_kv_inputs['metadata'] = (
[
[ # type: ignore[operator] # FIXME
{
'id': 'secret_backend',
'label': _('Name of Secret Backend'),
Expand Down Expand Up @@ -218,11 +221,13 @@
},
]
)
hashi_kv_inputs['required'].extend(['api_version', 'secret_key'])
hashi_kv_inputs['required'].extend( # type: ignore[attr-defined] # FIXME
['api_version', 'secret_key'],
)

hashi_ssh_inputs = copy.deepcopy(base_inputs)
hashi_ssh_inputs['metadata'] = (
[
[ # type: ignore[operator] # FIXME
{
'id': 'public_key',
'label': _('Unsigned Public Key'),
Expand All @@ -249,7 +254,9 @@
},
]
)
hashi_ssh_inputs['required'].extend(['public_key', 'role'])
hashi_ssh_inputs['required'].extend( # type: ignore[attr-defined] # FIXME
['public_key', 'role'],
)


def handle_auth(**kwargs):
Expand Down Expand Up @@ -356,7 +363,9 @@ def kv_backend(**kwargs):

if api_version == 'v2':
if kwargs.get('secret_version'):
request_kwargs['params'] = {'version': kwargs['secret_version']}
request_kwargs['params'] = { # type: ignore[assignment] # FIXME
'version': kwargs['secret_version'],
}
if secret_backend:
path_segments = [secret_backend, 'data', secret_path]
else:
Expand Down Expand Up @@ -416,9 +425,13 @@ def ssh_backend(**kwargs):
'allow_redirects': False,
}

request_kwargs['json'] = {'public_key': kwargs['public_key']}
request_kwargs['json'] = { # type: ignore[assignment] # FIXME
'public_key': kwargs['public_key'],
}
if kwargs.get('valid_principals'):
request_kwargs['json']['valid_principals'] = kwargs['valid_principals']
request_kwargs['json'][
'valid_principals'
] = kwargs['valid_principals'] # type: ignore[index] # FIXME

sess = requests.Session()
sess.mount(url, requests.adapters.HTTPAdapter(max_retries=5))
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/injectors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-call, no-untyped-def"

import json
import os
import stat
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="assignment, no-untyped-def"

import os
import tempfile
from collections import namedtuple
Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/plugins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="assignment, misc, no-redef"

from __future__ import annotations


Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/credentials/tss.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-def, import-not-found, import-untyped"

from .plugin import CredentialPlugin, translate_function as _


Expand Down
3 changes: 3 additions & 0 deletions src/awx_plugins/inventory/plugins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="assignment, no-untyped-call, no-untyped-def, var-annotated"

import os.path
import stat
import tempfile
Expand Down
3 changes: 3 additions & 0 deletions tests/credential_plugins_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME: the following violations must be addressed gradually and unignored
# mypy: disable-error-code="no-untyped-call"

from unittest import mock

import pytest
Expand Down

0 comments on commit ad71c67

Please sign in to comment.