mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 16:19:13 +02:00
Update a few type ignore comments (#8767)
Some are no longer needed and other's comments are out of date.
For the changes to the acme nonce errors, `Exception` doesn't take kwargs. The error message about this our own classes isn't super helpful:
```
In [2]: BadNonce('nonce', 'error', foo='bar')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-54555658ef99> in <module>
----> 1 BadNonce('nonce', 'error', foo='bar')
TypeError: __init__() got an unexpected keyword argument 'foo'
```
but if you try this on `Exception` which these classes inherit from, you get:
```
In [4]: Exception(foo='bar')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-028b924f74c5> in <module>
----> 1 Exception(foo='bar')
TypeError: Exception() takes no keyword arguments
```
See https://github.com/python/typeshed/pull/2348 for more info.
* remove outdated ignores
* update locking ignore comment
* don't accept kwargs
This commit is contained in:
@@ -205,10 +205,9 @@ class _WindowsLockMechanism(_BaseLockMechanism):
|
||||
# Under Windows, filesystem.open will raise directly an EACCES error
|
||||
# if the lock file is already locked.
|
||||
fd = filesystem.open(self._path, open_mode, 0o600)
|
||||
# The need for this "type: ignore" was fixed in
|
||||
# https://github.com/python/typeshed/pull/3607 and included in
|
||||
# newer versions of mypy so it can be removed when mypy is
|
||||
# upgraded.
|
||||
# This "type: ignore" is currently needed because msvcrt methods
|
||||
# are only defined on Windows. See
|
||||
# https://github.com/python/typeshed/blob/16ae4c61201cd8b96b8b22cdfb2ab9e89ba5bcf2/stdlib/msvcrt.pyi.
|
||||
msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) # type: ignore
|
||||
except (IOError, OSError) as err:
|
||||
if fd:
|
||||
@@ -224,10 +223,9 @@ class _WindowsLockMechanism(_BaseLockMechanism):
|
||||
def release(self):
|
||||
"""Release the lock."""
|
||||
try:
|
||||
# The need for this "type: ignore" was fixed in
|
||||
# https://github.com/python/typeshed/pull/3607 and included in
|
||||
# newer versions of mypy so it can be removed when mypy is
|
||||
# upgraded.
|
||||
# This "type: ignore" is currently needed because msvcrt methods
|
||||
# are only defined on Windows. See
|
||||
# https://github.com/python/typeshed/blob/16ae4c61201cd8b96b8b22cdfb2ab9e89ba5bcf2/stdlib/msvcrt.pyi.
|
||||
msvcrt.locking(self._fd, msvcrt.LK_UNLCK, 1) # type: ignore
|
||||
os.close(self._fd)
|
||||
|
||||
|
||||
@@ -301,8 +301,7 @@ def verify_signed_payload(public_key, signature, payload, signature_hash_algorit
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
if isinstance(public_key, RSAPublicKey):
|
||||
# https://github.com/python/typeshed/blob/master/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi
|
||||
verifier = public_key.verifier( # type: ignore
|
||||
verifier = public_key.verifier(
|
||||
signature, PKCS1v15(), signature_hash_algorithm
|
||||
)
|
||||
verifier.update(payload)
|
||||
|
||||
Reference in New Issue
Block a user