Fix locally disable pylint messages

This commit is contained in:
Jakub Warmuz 2015-01-25 10:23:21 +00:00
parent 9478d14817
commit 3734710f1c
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
10 changed files with 39 additions and 37 deletions

View file

@ -342,9 +342,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
return vhs
# pylint: disable=anomalous-backslash-in-string
def is_name_vhost(self, target_addr):
"""Returns if vhost is a name based vhost
r"""Returns if vhost is a name based vhost
NameVirtualHost was deprecated in Apache 2.4 as all VirtualHosts are
now NameVirtualHosts. If version is earlier than 2.4, check if addr
@ -962,10 +961,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
###########################################################################
# Challenges Section
###########################################################################
# pylint: disable=no-self-use, unused-argument
def get_chall_pref(self, domain):
def get_chall_pref(self, unused_domain): # pylint: disable=no-self-use
"""Return list of challenge preferences."""
return ["dvsni"]
def perform(self, chall_list):

View file

@ -43,8 +43,7 @@ class Addr(object):
return self.__class__((self.tup[0], port))
# pylint: disable=too-few-public-methods
class VirtualHost(object):
class VirtualHost(object): # pylint: disable=too-few-public-methods
"""Represents an Apache Virtualhost.
:ivar str filep: file path of VH
@ -58,7 +57,8 @@ class VirtualHost(object):
"""
def __init__(self, filep, path, addrs, ssl, enabled, names=None): # pylint: disable=too-many-arguments
def __init__(self, filep, path, addrs, ssl, enabled, names=None):
# pylint: disable=too-many-arguments
"""Initialize a VH."""
self.filep = filep
self.path = path

View file

@ -324,9 +324,9 @@ class AugeasConfigurator(object):
return True, ""
# pylint: disable=no-self-use, anomalous-backslash-in-string
def register_file_creation(self, temporary, *files):
"""Register the creation of all files during letsencrypt execution.
# pylint: disable=no-self-use
r"""Register the creation of all files during letsencrypt execution.
Call this method before writing to the file to make sure that the
file will be cleaned up if the program exits unexpectedly.
@ -375,8 +375,7 @@ class AugeasConfigurator(object):
# Need to reload configuration after these changes take effect
self.aug.load()
# pylint: disable=no-self-use
def _remove_contained_files(self, file_list):
def _remove_contained_files(self, file_list): # pylint: disable=no-self-use
"""Erase all files contained within file_list.
:param str file_list: file containing list of file paths to be deleted
@ -408,8 +407,8 @@ class AugeasConfigurator(object):
return True
# pylint: disable=no-self-use
def _finalize_checkpoint(self, cp_dir, title):
# pylint: disable=no-self-use
"""Move IN_PROGRESS checkpoint to timestamped checkpoint.
Adds title to cp_dir CHANGES_SINCE

View file

@ -132,8 +132,8 @@ class Client(object):
return self.network.send_and_receive_expected(
acme.certificate_request(csr_der, self.authkey.pem), "certificate")
# pylint: disable=no-self-use
def save_certificate(self, certificate_dict, cert_path, chain_path):
# pylint: disable=no-self-use
"""Saves the certificate received from the ACME server.
:param dict certificate_dict: certificate message from server

View file

@ -25,8 +25,7 @@ class ClientAuthenticator(object):
"""
self.rec_token = recovery_token.RecoveryToken(server)
# pylint: disable=unused-argument,no-self-use
def get_chall_pref(self, domain):
def get_chall_pref(self, unused_domain): # pylint: disable=no-self-use
"""Return list of challenge preferences."""
return ["recoveryToken"]

View file

@ -41,10 +41,12 @@ class NcursesDisplay(CommonDisplayMixin):
self.width = width
self.height = height
def generic_notification(self, message): # pylint: disable=missing-docstring
def generic_notification(self, message):
# pylint: disable=missing-docstring
self.dialog.msgbox(message, width=self.width)
def generic_menu(self, message, choices, unused_input_text=""): # pylint: disable=missing-docstring
def generic_menu(self, message, choices, unused_input_text=""):
# pylint: disable=missing-docstring
# Can accept either tuples or just the actual choices
if choices and isinstance(choices[0], tuple):
code, selection = self.dialog.menu(
@ -60,7 +62,8 @@ class NcursesDisplay(CommonDisplayMixin):
def generic_input(self, message): # pylint: disable=missing-docstring
return self.dialog.inputbox(message)
def generic_yesno(self, message, yes_label="Yes", no_label="No"): # pylint: disable=missing-docstring
def generic_yesno(self, message, yes_label="Yes", no_label="No"):
# pylint: disable=missing-docstring
return self.dialog.DIALOG_OK == self.dialog.yesno(
message, self.height, self.width,
yes_label=yes_label, no_label=no_label)
@ -72,7 +75,8 @@ class NcursesDisplay(CommonDisplayMixin):
choices=choices)
return code, [str(s) for s in names]
def success_installation(self, domains): # pylint: disable=missing-docstring
def success_installation(self, domains):
# pylint: disable=missing-docstring
self.dialog.msgbox(
"\nCongratulations! You have successfully enabled "
+ gen_https_names(domains) + "!", width=self.width)
@ -118,13 +122,15 @@ class FileDisplay(CommonDisplayMixin):
super(FileDisplay, self).__init__()
self.outfile = outfile
def generic_notification(self, message): # pylint: disable=missing-docstring
def generic_notification(self, message):
# pylint: disable=missing-docstring
side_frame = '-' * 79
msg = textwrap.fill(message, 80)
self.outfile.write("\n%s\n%s\n%s\n" % (side_frame, msg, side_frame))
raw_input("Press Enter to Continue")
def generic_menu(self, message, choices, input_text=""): # pylint: disable=missing-docstring
def generic_menu(self, message, choices, input_text=""):
# pylint: disable=missing-docstring
# Can take either tuples or single items in choices list
if choices and isinstance(choices[0], tuple):
choices = ["%s - %s" % (c[0], c[1]) for c in choices]
@ -144,7 +150,8 @@ class FileDisplay(CommonDisplayMixin):
return code, (selection - 1)
def generic_input(self, message): # pylint: disable=no-self-use,missing-docstring
def generic_input(self, message):
# pylint: disable=no-self-use,missing-docstring
ans = raw_input("%s (Enter c to cancel)\n" % message)
if ans.startswith('c') or ans.startswith('C'):
@ -152,7 +159,8 @@ class FileDisplay(CommonDisplayMixin):
else:
return OK, ans
def generic_yesno(self, message, unused_yes_label="", unused_no_label=""): # pylint: disable=missing-docstring
def generic_yesno(self, message, unused_yes_label="", unused_no_label=""):
# pylint: disable=missing-docstring
self.outfile.write("\n%s\n" % textwrap.fill(message, 80))
ans = raw_input("y/n: ")
return ans.startswith('y') or ans.startswith('Y')
@ -202,7 +210,8 @@ class FileDisplay(CommonDisplayMixin):
return code, selection
def success_installation(self, domains): # pylint: disable=missing-docstring
def success_installation(self, domains):
# pylint: disable=missing-docstring
side_frame = '*' * 79
msg = textwrap.fill("Congratulations! You have successfully "
"enabled %s!" % gen_https_names(domains))

View file

@ -112,8 +112,7 @@ class Revoker(object):
else:
exit(0)
# pylint: disable=no-self-use
def remove_cert_key(self, cert):
def remove_cert_key(self, cert): # pylint: disable=no-self-use
"""Remove certificate and key.
:param dict cert: Cert dict used throughout revocation

View file

@ -42,8 +42,7 @@ class ApacheParserTest(util.ApacheTest):
file_path = os.path.join(
self.config_path, "sites-available", "letsencrypt.conf")
# pylint: disable=protected-access
self.parser._parse_file(file_path)
self.parser._parse_file(file_path) # pylint: disable=protected-access
# search for the httpd incl
matches = self.parser.aug.match(

View file

@ -17,7 +17,6 @@ TRANSLATE = {
}
# pylint: disable=protected-access
class SatisfyChallengesTest(unittest.TestCase):
"""verify_identities test."""
@ -42,7 +41,7 @@ class SatisfyChallengesTest(unittest.TestCase):
msg = acme_util.get_chall_msg(dom, "nonce0", challenge)
self.handler.add_chall_msg(dom, msg, "dummy_key")
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), 1)
@ -61,7 +60,7 @@ class SatisfyChallengesTest(unittest.TestCase):
acme_util.get_chall_msg(str(i), "nonce%d" % i, challenge),
"dummy_key")
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5)
self.assertEqual(len(self.handler.dv_c), 5)
@ -90,7 +89,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["simpleHttps"], challenges)
mock_chall_path.return_value = path
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), len(challenges))
@ -120,7 +119,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["simpleHttps", "recoveryToken"], challenges)
mock_chall_path.return_value = path
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), len(challenges))
@ -151,7 +150,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["dvsni", "recoveryContact"], challenges)
mock_chall_path.return_value = path
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5)
for i in range(5):
@ -200,7 +199,7 @@ class SatisfyChallengesTest(unittest.TestCase):
mock_chall_path.side_effect = paths
self.handler._satisfy_challenges()
self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5)
self.assertEqual(len(self.handler.dv_c), 5)

View file

@ -12,8 +12,9 @@ from letsencrypt.client import client
from letsencrypt.client import CONFIG
from letsencrypt.client import le_util
# pylint: disable=too-few-public-methods
class DvsniGenCertTest(unittest.TestCase):
# pylint: disable=too-few-public-methods
"""Tests for letsencrypt.client.challenge_util.dvsni_gen_cert."""
def test_standard(self):