Update to Pylint 1.9.4 and corrections

This commit is contained in:
Adrien Ferrand
2019-04-09 09:22:19 +02:00
parent 4515a52d3f
commit 04152c21b5
64 changed files with 193 additions and 216 deletions
+16 -7
View File
@@ -176,7 +176,6 @@ def _handle_subset_cert_request(config, domains, cert):
raise errors.Error(USER_CANCELLED)
# pylint: disable=inconsistent-return-statements
def _handle_identical_cert_request(config, lineage):
"""Figure out what to do if a lineage has the same names as a previously obtained one
@@ -224,7 +223,8 @@ def _handle_identical_cert_request(config, lineage):
return "reinstall", lineage
elif response[1] == 1:
return "renew", lineage
assert False, "This is imporssible"
raise AssertionError('This is impossible')
def _find_lineage_for_domains(config, domains):
"""Determine whether there are duplicated names and how to handle
@@ -501,6 +501,7 @@ def _determine_account(config):
raise errors.Error(
"Registration cannot proceed without accepting "
"Terms of Service.")
return None
account_storage = account.AccountFileStorage(config)
acme = None
@@ -679,7 +680,7 @@ def register(config, unused_plugins):
account_storage = account.AccountFileStorage(config)
accounts = account_storage.find_all()
if len(accounts) > 0:
if accounts:
# TODO: add a flag to register a duplicate account (this will
# also require extending _determine_account's behavior
# or else extracting the registration code from there)
@@ -688,7 +689,7 @@ def register(config, unused_plugins):
"unsupported.")
# _determine_account will register an account
_determine_account(config)
return
return None
def update_account(config, unused_plugins):
@@ -711,7 +712,7 @@ def update_account(config, unused_plugins):
reporter_util = zope.component.getUtility(interfaces.IReporter)
add_msg = lambda m: reporter_util.add_message(m, reporter_util.MEDIUM_PRIORITY)
if len(accounts) == 0:
if not accounts:
return "Could not find an existing account to update."
if config.email is None:
if config.register_unsafely_without_email:
@@ -762,6 +763,7 @@ def _install_cert(config, le_client, domains, lineage=None):
path_provider.cert_path, path_provider.chain_path, path_provider.fullchain_path)
le_client.enhance_config(domains, path_provider.chain_path)
def install(config, plugins):
"""Install a previously obtained cert in a server.
@@ -813,13 +815,14 @@ def install(config, plugins):
raise errors.ConfigurationError("Path to certificate or key was not defined. "
"If your certificate is managed by Certbot, please use --cert-name "
"to define which certificate you would like to install.")
return None
if enhancements.are_requested(config):
# In the case where we don't have certname, we have errored out already
lineage = cert_manager.lineage_for_certname(config, config.certname)
enhancements.enable(lineage, domains, installer, config)
return None
def _populate_from_certname(config):
"""Helper function for install to populate missing config values from lineage
defined by --cert-name."""
@@ -882,6 +885,7 @@ def plugins_cmd(config, plugins):
logger.debug("Prepared plugins: %s", available)
notify(str(available))
def enhance(config, plugins):
"""Add security enhancements to existing configuration
@@ -938,6 +942,8 @@ def enhance(config, plugins):
if enhancements.are_requested(config):
enhancements.enable(lineage, domains, installer, config)
return None
def rollback(config, plugins):
"""Rollback server configuration changes made during install.
@@ -1041,7 +1047,8 @@ def certificates(config, unused_plugins):
"""
cert_manager.certificates(config)
def revoke(config, unused_plugins): # TODO: coop with renewal config
# TODO: coop with renewal config
def revoke(config, unused_plugins):
"""Revoke a previously obtained certificate.
:param config: Configuration object
@@ -1334,6 +1341,8 @@ def main(cli_args=None):
:raises errors.Error: error if plugin command is not supported
"""
if not cli_args:
cli_args = sys.argv[1:]
log.pre_arg_parse_setup()