Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/acme
diff options
context:
space:
mode:
authordokazaki <dokazaki@users.noreply.github.com>2017-03-19 05:10:10 +0300
committerBrad Warren <bmw@users.noreply.github.com>2017-03-19 05:10:10 +0300
commit8011fb2879659008528e8b6ba5c04ac3de1e63a0 (patch)
tree3c701c7ec9ac00adff96e01e4086d85a999c4e0b /acme
parent679887f6913072ce3280bdf5862d5dabc5c039f8 (diff)
Add mypy (#4386)
* Initial configuration of mypy in box, correction of base mypy errors. * Move mypy install to toe * Add pylint comments for typing imports. * Remove typing module for Python 2.6 compatibility.
Diffstat (limited to 'acme')
-rw-r--r--acme/acme/challenges.py6
-rw-r--r--acme/acme/client.py2
-rw-r--r--acme/acme/crypto_util.py2
-rw-r--r--acme/acme/crypto_util_test.py2
-rw-r--r--acme/acme/jose/jwa.py10
-rw-r--r--acme/acme/jose/jwk.py8
-rw-r--r--acme/acme/jose/jws.py8
-rw-r--r--acme/acme/jose/util.py4
-rw-r--r--acme/acme/messages.py8
-rw-r--r--acme/acme/standalone.py4
-rw-r--r--acme/acme/standalone_test.py2
11 files changed, 28 insertions, 28 deletions
diff --git a/acme/acme/challenges.py b/acme/acme/challenges.py
index ac4e3d60a..14641af10 100644
--- a/acme/acme/challenges.py
+++ b/acme/acme/challenges.py
@@ -5,7 +5,7 @@ import hashlib
import logging
import socket
-from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives import hashes # type: ignore
import OpenSSL
import requests
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
class Challenge(jose.TypedJSONObjectWithFields):
# _fields_to_partial_json | pylint: disable=abstract-method
"""ACME challenge."""
- TYPES = {}
+ TYPES = {} # type: dict
@classmethod
def from_json(cls, jobj):
@@ -37,7 +37,7 @@ class Challenge(jose.TypedJSONObjectWithFields):
class ChallengeResponse(jose.TypedJSONObjectWithFields):
# _fields_to_partial_json | pylint: disable=abstract-method
"""ACME challenge response."""
- TYPES = {}
+ TYPES = {} # type: dict
resource_type = 'challenge'
resource = fields.Resource(resource_type)
diff --git a/acme/acme/client.py b/acme/acme/client.py
index d6166960d..40291e115 100644
--- a/acme/acme/client.py
+++ b/acme/acme/client.py
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
# https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
if sys.version_info < (2, 7, 9): # pragma: no cover
try:
- requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
+ requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3() # type: ignore
except AttributeError:
import urllib3.contrib.pyopenssl # pylint: disable=import-error
urllib3.contrib.pyopenssl.inject_into_urllib3()
diff --git a/acme/acme/crypto_util.py b/acme/acme/crypto_util.py
index 266f2c0c7..6a33b3e52 100644
--- a/acme/acme/crypto_util.py
+++ b/acme/acme/crypto_util.py
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
# https://www.openssl.org/docs/ssl/SSLv23_method.html). _serve_sni
# should be changed to use "set_options" to disable SSLv2 and SSLv3,
# in case it's used for things other than probing/serving!
-_DEFAULT_TLSSNI01_SSL_METHOD = OpenSSL.SSL.SSLv23_METHOD
+_DEFAULT_TLSSNI01_SSL_METHOD = OpenSSL.SSL.SSLv23_METHOD # type: ignore
class SSLSocket(object): # pylint: disable=too-few-public-methods
diff --git a/acme/acme/crypto_util_test.py b/acme/acme/crypto_util_test.py
index ebb4010a6..9cf1f7deb 100644
--- a/acme/acme/crypto_util_test.py
+++ b/acme/acme/crypto_util_test.py
@@ -6,7 +6,7 @@ import time
import unittest
import six
-from six.moves import socketserver # pylint: disable=import-error
+from six.moves import socketserver #type: ignore # pylint: disable=import-error
import OpenSSL
diff --git a/acme/acme/jose/jwa.py b/acme/acme/jose/jwa.py
index 1853e0107..9b682ecab 100644
--- a/acme/acme/jose/jwa.py
+++ b/acme/acme/jose/jwa.py
@@ -9,9 +9,9 @@ import logging
import cryptography.exceptions
from cryptography.hazmat.backends import default_backend
-from cryptography.hazmat.primitives import hashes
-from cryptography.hazmat.primitives import hmac
-from cryptography.hazmat.primitives.asymmetric import padding
+from cryptography.hazmat.primitives import hashes # type: ignore
+from cryptography.hazmat.primitives import hmac # type: ignore
+from cryptography.hazmat.primitives.asymmetric import padding # type: ignore
from acme.jose import errors
from acme.jose import interfaces
@@ -28,9 +28,9 @@ class JWA(interfaces.JSONDeSerializable): # pylint: disable=abstract-method
"""JSON Web Algorithm."""
-class JWASignature(JWA, collections.Hashable):
+class JWASignature(JWA, collections.Hashable): # type: ignore
"""JSON Web Signature Algorithm."""
- SIGNATURES = {}
+ SIGNATURES = {} # type: dict
def __init__(self, name):
self.name = name
diff --git a/acme/acme/jose/jwk.py b/acme/acme/jose/jwk.py
index 5b6965c4d..54423f670 100644
--- a/acme/acme/jose/jwk.py
+++ b/acme/acme/jose/jwk.py
@@ -6,9 +6,9 @@ import logging
import cryptography.exceptions
from cryptography.hazmat.backends import default_backend
-from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives import hashes # type: ignore
from cryptography.hazmat.primitives import serialization
-from cryptography.hazmat.primitives.asymmetric import ec
+from cryptography.hazmat.primitives.asymmetric import ec # type: ignore
from cryptography.hazmat.primitives.asymmetric import rsa
import six
@@ -25,8 +25,8 @@ class JWK(json_util.TypedJSONObjectWithFields):
# pylint: disable=too-few-public-methods
"""JSON Web Key."""
type_field_name = 'kty'
- TYPES = {}
- cryptography_key_types = ()
+ TYPES = {} # type: dict
+ cryptography_key_types = () # type: tuple
"""Subclasses should override."""
required = NotImplemented
diff --git a/acme/acme/jose/jws.py b/acme/acme/jose/jws.py
index 9c14cf729..8fa8d7670 100644
--- a/acme/acme/jose/jws.py
+++ b/acme/acme/jose/jws.py
@@ -121,12 +121,12 @@ class Header(json_util.JSONObjectWithFields):
# x5c does NOT use JOSE Base64 (4.1.6)
- @x5c.encoder
+ @x5c.encoder # type: ignore
def x5c(value): # pylint: disable=missing-docstring,no-self-argument
return [base64.b64encode(OpenSSL.crypto.dump_certificate(
OpenSSL.crypto.FILETYPE_ASN1, cert.wrapped)) for cert in value]
- @x5c.decoder
+ @x5c.decoder # type: ignore
def x5c(value): # pylint: disable=missing-docstring,no-self-argument
try:
return tuple(util.ComparableX509(OpenSSL.crypto.load_certificate(
@@ -157,12 +157,12 @@ class Signature(json_util.JSONObjectWithFields):
'signature', decoder=json_util.decode_b64jose,
encoder=json_util.encode_b64jose)
- @protected.encoder
+ @protected.encoder # type: ignore
def protected(value): # pylint: disable=missing-docstring,no-self-argument
# wrong type guess (Signature, not bytes) | pylint: disable=no-member
return json_util.encode_b64jose(value.encode('utf-8'))
- @protected.decoder
+ @protected.decoder # type: ignore
def protected(value): # pylint: disable=missing-docstring,no-self-argument
return json_util.decode_b64jose(value).decode('utf-8')
diff --git a/acme/acme/jose/util.py b/acme/acme/jose/util.py
index 6be9a6602..26b7e0c5a 100644
--- a/acme/acme/jose/util.py
+++ b/acme/acme/jose/util.py
@@ -134,7 +134,7 @@ class ComparableRSAKey(ComparableKey): # pylint: disable=too-few-public-methods
return hash((self.__class__, pub.n, pub.e))
-class ImmutableMap(collections.Mapping, collections.Hashable):
+class ImmutableMap(collections.Mapping, collections.Hashable): # type: ignore
# pylint: disable=too-few-public-methods
"""Immutable key to value mapping with attribute access."""
@@ -180,7 +180,7 @@ class ImmutableMap(collections.Mapping, collections.Hashable):
for key, value in six.iteritems(self)))
-class frozendict(collections.Mapping, collections.Hashable):
+class frozendict(collections.Mapping, collections.Hashable): # type: ignore
# pylint: disable=invalid-name,too-few-public-methods
"""Frozen dictionary."""
__slots__ = ('_items', '_keys')
diff --git a/acme/acme/messages.py b/acme/acme/messages.py
index f7670dd72..4070290ad 100644
--- a/acme/acme/messages.py
+++ b/acme/acme/messages.py
@@ -98,7 +98,7 @@ class Error(jose.JSONObjectWithFields, errors.Error):
if part is not None)
-class _Constant(jose.JSONDeSerializable, collections.Hashable):
+class _Constant(jose.JSONDeSerializable, collections.Hashable): # type: ignore
"""ACME constant."""
__slots__ = ('name',)
POSSIBLE_NAMES = NotImplemented
@@ -132,7 +132,7 @@ class _Constant(jose.JSONDeSerializable, collections.Hashable):
class Status(_Constant):
"""ACME "status" field."""
- POSSIBLE_NAMES = {}
+ POSSIBLE_NAMES = {} # type: dict
STATUS_UNKNOWN = Status('unknown')
STATUS_PENDING = Status('pending')
STATUS_PROCESSING = Status('processing')
@@ -143,7 +143,7 @@ STATUS_REVOKED = Status('revoked')
class IdentifierType(_Constant):
"""ACME identifier type."""
- POSSIBLE_NAMES = {}
+ POSSIBLE_NAMES = {} # type: dict
IDENTIFIER_FQDN = IdentifierType('dns') # IdentifierDNS in Boulder
@@ -161,7 +161,7 @@ class Identifier(jose.JSONObjectWithFields):
class Directory(jose.JSONDeSerializable):
"""Directory."""
- _REGISTERED_TYPES = {}
+ _REGISTERED_TYPES = {} # type: dict
class Meta(jose.JSONObjectWithFields):
"""Directory Meta."""
diff --git a/acme/acme/standalone.py b/acme/acme/standalone.py
index 02cc2daf5..087240c15 100644
--- a/acme/acme/standalone.py
+++ b/acme/acme/standalone.py
@@ -6,9 +6,9 @@ import logging
import os
import sys
-from six.moves import BaseHTTPServer # pylint: disable=import-error
+from six.moves import BaseHTTPServer # type: ignore # pylint: disable=import-error
from six.moves import http_client # pylint: disable=import-error
-from six.moves import socketserver # pylint: disable=import-error
+from six.moves import socketserver # type: ignore # pylint: disable=import-error
import OpenSSL
diff --git a/acme/acme/standalone_test.py b/acme/acme/standalone_test.py
index 58469d470..613258c97 100644
--- a/acme/acme/standalone_test.py
+++ b/acme/acme/standalone_test.py
@@ -7,7 +7,7 @@ import time
import unittest
from six.moves import http_client # pylint: disable=import-error
-from six.moves import socketserver # pylint: disable=import-error
+from six.moves import socketserver # type: ignore # pylint: disable=import-error
import requests