mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-03-26 21:33:25 +00:00
Adjust to new pylint release.
This commit is contained in:
@@ -57,7 +57,7 @@ from ansible_collections.community.crypto.plugins.module_utils._version import (
|
||||
|
||||
CRYPTOGRAPHY_MINIMAL_VERSION = "1.5"
|
||||
|
||||
CRYPTOGRAPHY_ERROR = None
|
||||
CRYPTOGRAPHY_ERROR: None | str
|
||||
try:
|
||||
import cryptography
|
||||
import cryptography.hazmat.backends
|
||||
@@ -71,14 +71,15 @@ try:
|
||||
import cryptography.x509
|
||||
import cryptography.x509.oid
|
||||
except ImportError:
|
||||
HAS_CURRENT_CRYPTOGRAPHY = False
|
||||
CRYPTOGRAPHY_VERSION = None
|
||||
CRYPTOGRAPHY_ERROR = traceback.format_exc()
|
||||
HAS_CURRENT_CRYPTOGRAPHY = False # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_VERSION = None # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||
else:
|
||||
CRYPTOGRAPHY_VERSION = cryptography.__version__
|
||||
CRYPTOGRAPHY_VERSION = cryptography.__version__ # pylint: disable=invalid-name
|
||||
HAS_CURRENT_CRYPTOGRAPHY = LooseVersion(CRYPTOGRAPHY_VERSION) >= LooseVersion(
|
||||
CRYPTOGRAPHY_MINIMAL_VERSION
|
||||
)
|
||||
CRYPTOGRAPHY_ERROR = None # pylint: disable=invalid-name
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
@@ -40,7 +40,7 @@ if t.TYPE_CHECKING:
|
||||
# TODO: once cryptography has a _utc variant of InvalidityDate.invalidity_date, set this
|
||||
# to True and adjust get_invalidity_date() accordingly.
|
||||
# (https://github.com/pyca/cryptography/issues/10818)
|
||||
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = False
|
||||
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = False # pylint: disable=invalid-name
|
||||
if HAS_CRYPTOGRAPHY:
|
||||
CRYPTOGRAPHY_TIMEZONE_INVALIDITY_DATE = _LooseVersion(
|
||||
cryptography.__version__
|
||||
|
||||
@@ -134,8 +134,8 @@ else:
|
||||
PrivateKeyTypesWOEdwards = None # pylint: disable=invalid-name
|
||||
|
||||
|
||||
CRYPTOGRAPHY_TIMEZONE = False
|
||||
_CRYPTOGRAPHY_36_0_OR_NEWER = False
|
||||
CRYPTOGRAPHY_TIMEZONE = False # pylint: disable=invalid-name
|
||||
_CRYPTOGRAPHY_36_0_OR_NEWER = False # pylint: disable=invalid-name
|
||||
if _HAS_CRYPTOGRAPHY:
|
||||
CRYPTOGRAPHY_TIMEZONE = LooseVersion(cryptography.__version__) >= LooseVersion(
|
||||
"42.0.0"
|
||||
|
||||
@@ -38,20 +38,21 @@ if t.TYPE_CHECKING:
|
||||
] # pragma: no cover
|
||||
|
||||
|
||||
_CRYPTOGRAPHY_IMP_ERR: str | None = None
|
||||
_CRYPTOGRAPHY_FILE: str | None = None
|
||||
_CRYPTOGRAPHY_IMP_ERR: str | None = None # pylint: disable=invalid-name
|
||||
_CRYPTOGRAPHY_FILE: str | None = None # pylint: disable=invalid-name
|
||||
try:
|
||||
import cryptography
|
||||
from cryptography import x509 # noqa: F401, pylint: disable=unused-import
|
||||
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
_CRYPTOGRAPHY_FILE = cryptography.__file__
|
||||
except ImportError:
|
||||
_CRYPTOGRAPHY_IMP_ERR = traceback.format_exc()
|
||||
_CRYPTOGRAPHY_IMP_ERR = traceback.format_exc() # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_FOUND = False
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
|
||||
else:
|
||||
CRYPTOGRAPHY_FOUND = True
|
||||
# pylint: disable-next=invalid-name
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
_CRYPTOGRAPHY_FILE = cryptography.__file__ # pylint: disable=invalid-name
|
||||
|
||||
|
||||
# Corresponds to the community.crypto.cryptography_dep.minimum doc fragment
|
||||
|
||||
@@ -174,12 +174,12 @@ except ImportError:
|
||||
UnsupportedAlgorithm = Exception # type: ignore
|
||||
CryptographyInternalError = Exception # type: ignore
|
||||
HAS_CRYPTOGRAPHY = False
|
||||
CRYPTOGRAPHY_VERSION = None
|
||||
CRYPTOGRAPHY_IMP_ERR = traceback.format_exc()
|
||||
CRYPTOGRAPHY_VERSION = None # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_IMP_ERR = traceback.format_exc() # pylint: disable=invalid-name
|
||||
else:
|
||||
HAS_CRYPTOGRAPHY = True
|
||||
CRYPTOGRAPHY_VERSION = cryptography.__version__
|
||||
CRYPTOGRAPHY_IMP_ERR = None
|
||||
CRYPTOGRAPHY_VERSION = cryptography.__version__ # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_IMP_ERR = None # pylint: disable=invalid-name
|
||||
|
||||
|
||||
CURVES = (
|
||||
|
||||
@@ -318,7 +318,7 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = None
|
||||
CRYPTOGRAPHY_COMPATIBILITY2022_ERR: str | None
|
||||
try:
|
||||
import cryptography.x509
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
@@ -329,9 +329,11 @@ try:
|
||||
PBES.PBESv1SHA1And3KeyTripleDESCBC
|
||||
).hmac_hash(hashes.SHA1())
|
||||
except Exception:
|
||||
# pylint: disable-next=invalid-name
|
||||
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = traceback.format_exc()
|
||||
CRYPTOGRAPHY_HAS_COMPATIBILITY2022 = False
|
||||
else:
|
||||
CRYPTOGRAPHY_COMPATIBILITY2022_ERR = None # pylint: disable=invalid-name
|
||||
CRYPTOGRAPHY_HAS_COMPATIBILITY2022 = True
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
|
||||
@@ -117,9 +117,11 @@ try:
|
||||
import cryptography.hazmat.primitives.asymmetric.padding
|
||||
import cryptography.hazmat.primitives.hashes
|
||||
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
except ImportError:
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
|
||||
else:
|
||||
# pylint: disable-next=invalid-name
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
@@ -106,9 +106,11 @@ try:
|
||||
import cryptography.hazmat.primitives.asymmetric.padding
|
||||
import cryptography.hazmat.primitives.hashes
|
||||
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
except ImportError:
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0")
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion("0.0") # pylint: disable=invalid-name
|
||||
else:
|
||||
# pylint: disable-next=invalid-name
|
||||
CRYPTOGRAPHY_VERSION = LooseVersion(cryptography.__version__)
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
Reference in New Issue
Block a user