Skip to content

Commit f85e912

Browse files
committed
Adjust to new pylint release.
1 parent 0f8a09e commit f85e912

File tree

8 files changed

+31
-23
lines changed

8 files changed

+31
-23
lines changed

plugins/module_utils/_acme/backend_cryptography.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
CRYPTOGRAPHY_MINIMAL_VERSION = "1.5"
5959

60-
CRYPTOGRAPHY_ERROR = None
60+
CRYPTOGRAPHY_ERROR: None | str
6161
try:
6262
import cryptography
6363
import cryptography.hazmat.backends
@@ -71,14 +71,15 @@
7171
import cryptography.x509
7272
import cryptography.x509.oid
7373
except ImportError:
74-
HAS_CURRENT_CRYPTOGRAPHY = False
75-
CRYPTOGRAPHY_VERSION = None
76-
CRYPTOGRAPHY_ERROR = traceback.format_exc()
74+
HAS_CURRENT_CRYPTOGRAPHY = False # pylint: disable=invalid-name
75+
CRYPTOGRAPHY_VERSION = None # pylint: disable=invalid-name
76+
CRYPTOGRAPHY_ERROR = traceback.format_exc() # pylint: disable=invalid-name
7777
else:
78-
CRYPTOGRAPHY_VERSION = cryptography.__version__
78+
CRYPTOGRAPHY_VERSION = cryptography.__version__ # pylint: disable=invalid-name
7979
HAS_CURRENT_CRYPTOGRAPHY = LooseVersion(CRYPTOGRAPHY_VERSION) >= LooseVersion(
8080
CRYPTOGRAPHY_MINIMAL_VERSION
8181
)
82+
CRYPTOGRAPHY_ERROR = None # pylint: disable=invalid-name
8283

8384
if t.TYPE_CHECKING:
8485
import datetime # pragma: no cover

plugins/module_utils/_crypto/cryptography_crl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# TODO: once cryptography has a _utc variant of InvalidityDate.invalidity_date, set this
4141
# to True and adjust get_invalidity_date() accordingly.
4242
# (https://github.com/pyca/cryptography/issues/10818)
43-
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = False
43+
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = False # pylint: disable=invalid-name
4444
if HAS_CRYPTOGRAPHY:
4545
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = _LooseVersion(
4646
cryptography.__version__

plugins/module_utils/_crypto/cryptography_support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
PrivateKeyTypesWOEdwards = None # pylint: disable=invalid-name
135135

136136

137-
CRYPTOGRAPHY_TIMEZONE = False
138-
_CRYPTOGRAPHY_36_0_OR_NEWER = False
137+
CRYPTOGRAPHY_TIMEZONE = False # pylint: disable=invalid-name
138+
_CRYPTOGRAPHY_36_0_OR_NEWER = False # pylint: disable=invalid-name
139139
if _HAS_CRYPTOGRAPHY:
140140
CRYPTOGRAPHY_TIMEZONE = LooseVersion(cryptography.__version__) >= LooseVersion(
141141
"42.0.0"

plugins/module_utils/_cryptography_dep.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,21 @@
3838
] # pragma: no cover
3939

4040

41-
_CRYPTOGRAPHY_IMP_ERR: str | None = None
42-
_CRYPTOGRAPHY_FILE: str | None = None
41+
_CRYPTOGRAPHY_IMP_ERR: str | None = None # pylint: disable=invalid-name
42+
_CRYPTOGRAPHY_FILE: str | None = None # pylint: disable=invalid-name
4343
try:
4444
import cryptography
4545
from cryptography import x509 # noqa: F401, pylint: disable=unused-import
4646

47-
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
48-
_CRYPTOGRAPHY_FILE = cryptography.__file__
4947
except ImportError:
50-
_CRYPTOGRAPHY_IMP_ERR = traceback.format_exc()
48+
_CRYPTOGRAPHY_IMP_ERR = traceback.format_exc() # pylint: disable=invalid-name
5149
CRYPTOGRAPHY_FOUND = False
52-
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
50+
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
5351
else:
5452
CRYPTOGRAPHY_FOUND = True
53+
# pylint: disable-next=invalid-name
54+
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
55+
_CRYPTOGRAPHY_FILE = cryptography.__file__ # pylint: disable=invalid-name
5556

5657

5758
# Corresponds to the community.crypto.cryptography_dep.minimum doc fragment

plugins/modules/crypto_info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@
174174
UnsupportedAlgorithm = Exception # type: ignore
175175
CryptographyInternalError = Exception # type: ignore
176176
HAS_CRYPTOGRAPHY = False
177-
CRYPTOGRAPHY_VERSION = None
178-
CRYPTOGRAPHY_IMP_ERR = traceback.format_exc()
177+
CRYPTOGRAPHY_VERSION = None # pylint: disable=invalid-name
178+
CRYPTOGRAPHY_IMP_ERR = traceback.format_exc() # pylint: disable=invalid-name
179179
else:
180180
HAS_CRYPTOGRAPHY = True
181-
CRYPTOGRAPHY_VERSION = cryptography.__version__
182-
CRYPTOGRAPHY_IMP_ERR = None
181+
CRYPTOGRAPHY_VERSION = cryptography.__version__ # pylint: disable=invalid-name
182+
CRYPTOGRAPHY_IMP_ERR = None # pylint: disable=invalid-name
183183

184184

185185
CURVES = (

plugins/modules/openssl_pkcs12.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
except ImportError:
319319
pass
320320

321-
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = None
321+
CRYPTOGRAPHY_COMPATIBILITY2022_ERR: str | None
322322
try:
323323
import cryptography.x509
324324
from cryptography.hazmat.primitives import hashes
@@ -329,9 +329,11 @@
329329
PBES.PBESv1SHA1And3KeyTripleDESCBC
330330
).hmac_hash(hashes.SHA1())
331331
except Exception:
332+
# pylint: disable-next=invalid-name
332333
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = traceback.format_exc()
333334
CRYPTOGRAPHY_HAS_COMPATIBILITY2022 = False
334335
else:
336+
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = None # pylint: disable=invalid-name
335337
CRYPTOGRAPHY_HAS_COMPATIBILITY2022 = True
336338

337339
if t.TYPE_CHECKING:

plugins/modules/openssl_signature.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@
117117
import cryptography.hazmat.primitives.asymmetric.padding
118118
import cryptography.hazmat.primitives.hashes
119119

120-
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
121120
except ImportError:
122-
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
121+
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
122+
else:
123+
# pylint: disable-next=invalid-name
124+
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
123125

124126
from ansible.module_utils.basic import AnsibleModule
125127

plugins/modules/openssl_signature_info.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@
106106
import cryptography.hazmat.primitives.asymmetric.padding
107107
import cryptography.hazmat.primitives.hashes
108108

109-
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
110109
except ImportError:
111-
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
110+
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
111+
else:
112+
# pylint: disable-next=invalid-name
113+
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
112114

113115
from ansible.module_utils.basic import AnsibleModule
114116

0 commit comments

Comments
 (0)