diff --git a/README.md b/README.md index a8d65d30a..85b176b58 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,11 @@ style](#coding-style)**. The following tools are there to help you: ## Documentation -In order to generate the sphinx documentation, run the following commands. +The official documentation is available at +https://letsencrypt.readthedocs.org. + +In order to generate the Sphinx documentation, run the following +commands. ``` ./venv/bin/python setup.py docs @@ -80,7 +84,7 @@ cd docs make clean html SPHINXBUILD=../venv/bin/sphinx-build ``` -This should generate documentation in the /lets-encrypt-preview/docs/_build/html +This should generate documentation in the `docs/_build/html` directory. ### Coding style diff --git a/letsencrypt/client/apache/configurator.py b/letsencrypt/client/apache/configurator.py index 88dcb33d1..bb3ea3eba 100644 --- a/letsencrypt/client/apache/configurator.py +++ b/letsencrypt/client/apache/configurator.py @@ -338,9 +338,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 @@ -958,10 +957,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): diff --git a/letsencrypt/client/apache/obj.py b/letsencrypt/client/apache/obj.py index 647724a48..905e3f192 100644 --- a/letsencrypt/client/apache/obj.py +++ b/letsencrypt/client/apache/obj.py @@ -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 diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index f26ed4a5c..4455e76c3 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -144,8 +144,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 diff --git a/letsencrypt/client/client_authenticator.py b/letsencrypt/client/client_authenticator.py index 1847d3760..699e5e598 100644 --- a/letsencrypt/client/client_authenticator.py +++ b/letsencrypt/client/client_authenticator.py @@ -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"] diff --git a/letsencrypt/client/display.py b/letsencrypt/client/display.py index 3374ae9c6..213de34d1 100644 --- a/letsencrypt/client/display.py +++ b/letsencrypt/client/display.py @@ -42,10 +42,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( @@ -61,7 +63,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) @@ -73,7 +76,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) @@ -127,13 +131,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] @@ -153,7 +159,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'): @@ -161,7 +168,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') @@ -211,7 +219,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)) diff --git a/letsencrypt/client/revoker.py b/letsencrypt/client/revoker.py index 18af3d5ec..28cdf1bf1 100644 --- a/letsencrypt/client/revoker.py +++ b/letsencrypt/client/revoker.py @@ -118,8 +118,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 diff --git a/letsencrypt/client/tests/apache/parser_test.py b/letsencrypt/client/tests/apache/parser_test.py index df0046ff5..453952a19 100644 --- a/letsencrypt/client/tests/apache/parser_test.py +++ b/letsencrypt/client/tests/apache/parser_test.py @@ -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( diff --git a/letsencrypt/client/tests/auth_handler_test.py b/letsencrypt/client/tests/auth_handler_test.py index c5e97dace..b80c3c61d 100644 --- a/letsencrypt/client/tests/auth_handler_test.py +++ b/letsencrypt/client/tests/auth_handler_test.py @@ -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) diff --git a/letsencrypt/client/tests/challenge_util_test.py b/letsencrypt/client/tests/challenge_util_test.py index e0b99122f..759ee34ce 100644 --- a/letsencrypt/client/tests/challenge_util_test.py +++ b/letsencrypt/client/tests/challenge_util_test.py @@ -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):