1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

PEP8: Use isinstance(name, unicode)

This commit is contained in:
Will Oller
2014-11-30 15:52:34 -08:00
parent 8885f608a2
commit 3184dba80c

View File

@@ -70,8 +70,7 @@ def challenge_request(name):
:rtype: dict
"""
if type(name) is not unicode:
if not isinstance(name, unicode):
raise TypeError("Parameter 'name' must be unicode")
if not name:
@@ -97,28 +96,28 @@ def authorization_request(req_id, name, server_nonce, responses, key):
:rtype: dict
"""
if type(req_id) is not str:
if not isinstance(req_id, str):
raise TypeError("Parameter 'req_id' must be of type str")
if not req_id:
raise ValueError("Parameter 'req_id' must not be empty")
if type(name) is not unicode:
if not isinstance(name, unicode):
raise TypeError("Parameter 'name' must be of type unicode")
if not name:
raise ValueError("Parameter 'name' must not be empty")
if type(server_nonce) is not str:
if not isinstance(server_nonce, str):
raise TypeError("Parameter 'server_nonce' must be of type str")
if not server_nonce:
raise ValueError("Parameter 'server_nonce' must not be empty")
if type(responses) is not list:
if not isinstance(responses, list):
raise TypeError("Parameter 'responses' must be of type list")
if type(key) is not str:
if not isinstance(key, str):
raise TypeError("Parameter 'key' must be of type str")
if not key:
@@ -145,13 +144,13 @@ def certificate_request(csr_der, key):
:rtype: dict
"""
if type(csr_der) is not str:
if not isinstance(csr_der, str):
raise TypeError("Parameter 'csr_der' must be of type str")
if not csr_der:
raise ValueError("Parameter 'csr_der' must not be empty")
if type(key) is not str:
if not isinstance(key, str):
raise TypeError("Parameter 'key' must be of type str")
if not key:
@@ -176,13 +175,13 @@ def revocation_request(key_file, cert_der):
:rtype: dict
"""
if type(key_file) is not str:
if not isinstance(key_file, str):
raise TypeError("Parameter 'key_file' must be of type str")
if not key_file:
raise ValueError("Parameter 'key_file' must not be empty")
if type(cert_der) is not str:
if not isinstance(cert_der, str):
raise TypeError("Parameter 'cert_der' must be of type str")
if not cert_der:
@@ -204,7 +203,7 @@ def status_request(token):
:rtype: dict
"""
if type(token) is not str:
if not isinstance(token, str):
raise TypeError("Parameter 'token' must be of type str")
if not token: