mirror of
https://github.com/certbot/certbot.git
synced 2026-08-04 00:22:38 +02:00
pylint: locally disable missing-docstring
This commit is contained in:
@@ -14,7 +14,7 @@ HEIGHT = 20
|
|||||||
class CommonDisplayMixin(object): # pylint: disable=too-few-public-methods
|
class CommonDisplayMixin(object): # pylint: disable=too-few-public-methods
|
||||||
"""Mixin with methods common to classes implementing IDisplay."""
|
"""Mixin with methods common to classes implementing IDisplay."""
|
||||||
|
|
||||||
def redirect_by_default(self):
|
def redirect_by_default(self): # pylint: disable=missing-docstring
|
||||||
choices = [
|
choices = [
|
||||||
("Easy", "Allow both HTTP and HTTPS access to these sites"),
|
("Easy", "Allow both HTTP and HTTPS access to these sites"),
|
||||||
("Secure", "Make all requests redirect to secure HTTPS access")]
|
("Secure", "Make all requests redirect to secure HTTPS access")]
|
||||||
@@ -41,10 +41,10 @@ class NcursesDisplay(CommonDisplayMixin):
|
|||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
|
|
||||||
def generic_notification(self, message):
|
def generic_notification(self, message): # pylint: disable=missing-docstring
|
||||||
self.dialog.msgbox(message, width=self.width)
|
self.dialog.msgbox(message, width=self.width)
|
||||||
|
|
||||||
def generic_menu(self, message, choices, unused_input_text=""):
|
def generic_menu(self, message, choices, unused_input_text=""): # pylint: disable=missing-docstring
|
||||||
# Can accept either tuples or just the actual choices
|
# Can accept either tuples or just the actual choices
|
||||||
if choices and isinstance(choices[0], tuple):
|
if choices and isinstance(choices[0], tuple):
|
||||||
code, selection = self.dialog.menu(
|
code, selection = self.dialog.menu(
|
||||||
@@ -57,27 +57,27 @@ class NcursesDisplay(CommonDisplayMixin):
|
|||||||
|
|
||||||
return code(int(tag) - 1)
|
return code(int(tag) - 1)
|
||||||
|
|
||||||
def generic_input(self, message):
|
def generic_input(self, message): # pylint: disable=missing-docstring
|
||||||
return self.dialog.inputbox(message)
|
return self.dialog.inputbox(message)
|
||||||
|
|
||||||
def generic_yesno(self, message, yes_label="Yes", no_label="No"):
|
def generic_yesno(self, message, yes_label="Yes", no_label="No"): # pylint: disable=missing-docstring
|
||||||
return self.dialog.DIALOG_OK == self.dialog.yesno(
|
return self.dialog.DIALOG_OK == self.dialog.yesno(
|
||||||
message, self.height, self.width,
|
message, self.height, self.width,
|
||||||
yes_label=yes_label, no_label=no_label)
|
yes_label=yes_label, no_label=no_label)
|
||||||
|
|
||||||
def filter_names(self, names):
|
def filter_names(self, names): # pylint: disable=missing-docstring
|
||||||
choices = [(n, "", 0) for n in names]
|
choices = [(n, "", 0) for n in names]
|
||||||
code, names = self.dialog.checklist(
|
code, names = self.dialog.checklist(
|
||||||
"Which names would you like to activate HTTPS for?",
|
"Which names would you like to activate HTTPS for?",
|
||||||
choices=choices)
|
choices=choices)
|
||||||
return code, [str(s) for s in names]
|
return code, [str(s) for s in names]
|
||||||
|
|
||||||
def success_installation(self, domains):
|
def success_installation(self, domains): # pylint: disable=missing-docstring
|
||||||
self.dialog.msgbox(
|
self.dialog.msgbox(
|
||||||
"\nCongratulations! You have successfully enabled "
|
"\nCongratulations! You have successfully enabled "
|
||||||
+ gen_https_names(domains) + "!", width=self.width)
|
+ gen_https_names(domains) + "!", width=self.width)
|
||||||
|
|
||||||
def display_certs(self, certs):
|
def display_certs(self, certs): # pylint: disable=missing-docstring
|
||||||
list_choices = [
|
list_choices = [
|
||||||
(str(i+1), "%s | %s | %s" %
|
(str(i+1), "%s | %s | %s" %
|
||||||
(str(c["cn"].ljust(self.width - 39)),
|
(str(c["cn"].ljust(self.width - 39)),
|
||||||
@@ -94,7 +94,7 @@ class NcursesDisplay(CommonDisplayMixin):
|
|||||||
tag = -1
|
tag = -1
|
||||||
return code, (int(tag) - 1)
|
return code, (int(tag) - 1)
|
||||||
|
|
||||||
def confirm_revocation(self, cert):
|
def confirm_revocation(self, cert): # pylint: disable=missing-docstring
|
||||||
text = ("Are you sure you would like to revoke the following "
|
text = ("Are you sure you would like to revoke the following "
|
||||||
"certificate:\n")
|
"certificate:\n")
|
||||||
text += cert_info_frame(cert)
|
text += cert_info_frame(cert)
|
||||||
@@ -102,7 +102,7 @@ class NcursesDisplay(CommonDisplayMixin):
|
|||||||
return self.dialog.DIALOG_OK == self.dialog.yesno(
|
return self.dialog.DIALOG_OK == self.dialog.yesno(
|
||||||
text, width=self.width, height=self.height)
|
text, width=self.width, height=self.height)
|
||||||
|
|
||||||
def more_info_cert(self, cert):
|
def more_info_cert(self, cert): # pylint: disable=missing-docstring
|
||||||
text = "Certificate Information:\n"
|
text = "Certificate Information:\n"
|
||||||
text += cert_info_frame(cert)
|
text += cert_info_frame(cert)
|
||||||
print text
|
print text
|
||||||
@@ -118,13 +118,13 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
super(FileDisplay, self).__init__()
|
super(FileDisplay, self).__init__()
|
||||||
self.outfile = outfile
|
self.outfile = outfile
|
||||||
|
|
||||||
def generic_notification(self, message):
|
def generic_notification(self, message): # pylint: disable=missing-docstring
|
||||||
side_frame = '-' * 79
|
side_frame = '-' * 79
|
||||||
msg = textwrap.fill(message, 80)
|
msg = textwrap.fill(message, 80)
|
||||||
self.outfile.write("\n%s\n%s\n%s\n" % (side_frame, msg, side_frame))
|
self.outfile.write("\n%s\n%s\n%s\n" % (side_frame, msg, side_frame))
|
||||||
raw_input("Press Enter to Continue")
|
raw_input("Press Enter to Continue")
|
||||||
|
|
||||||
def generic_menu(self, message, choices, input_text=""):
|
def generic_menu(self, message, choices, input_text=""): # pylint: disable=missing-docstring
|
||||||
# Can take either tuples or single items in choices list
|
# Can take either tuples or single items in choices list
|
||||||
if choices and isinstance(choices[0], tuple):
|
if choices and isinstance(choices[0], tuple):
|
||||||
choices = ["%s - %s" % (c[0], c[1]) for c in choices]
|
choices = ["%s - %s" % (c[0], c[1]) for c in choices]
|
||||||
@@ -144,7 +144,7 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
|
|
||||||
return code, (selection - 1)
|
return code, (selection - 1)
|
||||||
|
|
||||||
def generic_input(self, message): # pylint: disable=no-self-use
|
def generic_input(self, message): # pylint: disable=no-self-use,missing-docstring
|
||||||
ans = raw_input("%s (Enter c to cancel)\n" % message)
|
ans = raw_input("%s (Enter c to cancel)\n" % message)
|
||||||
|
|
||||||
if ans.startswith('c') or ans.startswith('C'):
|
if ans.startswith('c') or ans.startswith('C'):
|
||||||
@@ -152,12 +152,12 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
else:
|
else:
|
||||||
return OK, ans
|
return OK, ans
|
||||||
|
|
||||||
def generic_yesno(self, message, unused_yes_label="", unused_no_label=""):
|
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))
|
self.outfile.write("\n%s\n" % textwrap.fill(message, 80))
|
||||||
ans = raw_input("y/n: ")
|
ans = raw_input("y/n: ")
|
||||||
return ans.startswith('y') or ans.startswith('Y')
|
return ans.startswith('y') or ans.startswith('Y')
|
||||||
|
|
||||||
def filter_names(self, names):
|
def filter_names(self, names): # pylint: disable=missing-docstring
|
||||||
code, tag = self.generic_menu(
|
code, tag = self.generic_menu(
|
||||||
"Choose the names would you like to upgrade to HTTPS?",
|
"Choose the names would you like to upgrade to HTTPS?",
|
||||||
names, "Select the number of the name: ")
|
names, "Select the number of the name: ")
|
||||||
@@ -165,7 +165,7 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
# Make sure to return a list...
|
# Make sure to return a list...
|
||||||
return code, [names[tag]]
|
return code, [names[tag]]
|
||||||
|
|
||||||
def display_certs(self, certs):
|
def display_certs(self, certs): # pylint: disable=missing-docstring
|
||||||
menu_choices = [(str(i+1), str(c["cn"]) + " - " + c["pub_key"] +
|
menu_choices = [(str(i+1), str(c["cn"]) + " - " + c["pub_key"] +
|
||||||
" - " + str(c["not_before"])[:-6])
|
" - " + str(c["not_before"])[:-6])
|
||||||
for i, c in enumerate(certs)]
|
for i, c in enumerate(certs)]
|
||||||
@@ -202,13 +202,13 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
|
|
||||||
return code, selection
|
return code, selection
|
||||||
|
|
||||||
def success_installation(self, domains):
|
def success_installation(self, domains): # pylint: disable=missing-docstring
|
||||||
side_frame = '*' * 79
|
side_frame = '*' * 79
|
||||||
msg = textwrap.fill("Congratulations! You have successfully "
|
msg = textwrap.fill("Congratulations! You have successfully "
|
||||||
"enabled %s!" % gen_https_names(domains))
|
"enabled %s!" % gen_https_names(domains))
|
||||||
self.outfile.write("%s\n%s\n%s\n" % (side_frame, msg, side_frame))
|
self.outfile.write("%s\n%s\n%s\n" % (side_frame, msg, side_frame))
|
||||||
|
|
||||||
def confirm_revocation(self, cert):
|
def confirm_revocation(self, cert): # pylint: disable=missing-docstring
|
||||||
self.outfile.write("Are you sure you would like to revoke "
|
self.outfile.write("Are you sure you would like to revoke "
|
||||||
"the following certificate:\n")
|
"the following certificate:\n")
|
||||||
self.outfile.write(cert_info_frame(cert))
|
self.outfile.write(cert_info_frame(cert))
|
||||||
@@ -216,7 +216,7 @@ class FileDisplay(CommonDisplayMixin):
|
|||||||
ans = raw_input("y/n")
|
ans = raw_input("y/n")
|
||||||
return ans.startswith('y') or ans.startswith('Y')
|
return ans.startswith('y') or ans.startswith('Y')
|
||||||
|
|
||||||
def more_info_cert(self, cert):
|
def more_info_cert(self, cert): # pylint: disable=missing-docstring
|
||||||
self.outfile.write("\nCertificate Information:\n")
|
self.outfile.write("\nCertificate Information:\n")
|
||||||
self.outfile.write(cert_info_frame(cert))
|
self.outfile.write(cert_info_frame(cert))
|
||||||
|
|
||||||
@@ -225,14 +225,14 @@ CANCEL = "cancel"
|
|||||||
HELP = "help"
|
HELP = "help"
|
||||||
|
|
||||||
|
|
||||||
def cert_info_frame(cert):
|
def cert_info_frame(cert): # pylint: disable=missing-docstring
|
||||||
text = "-" * (WIDTH - 4) + "\n"
|
text = "-" * (WIDTH - 4) + "\n"
|
||||||
text += cert_info_string(cert)
|
text += cert_info_string(cert)
|
||||||
text += "-" * (WIDTH - 4)
|
text += "-" * (WIDTH - 4)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
def cert_info_string(cert):
|
def cert_info_string(cert): # pylint: disable=missing-docstring
|
||||||
text = "Subject: %s\n" % cert["subject"]
|
text = "Subject: %s\n" % cert["subject"]
|
||||||
text += "SAN: %s\n" % cert["san"]
|
text += "SAN: %s\n" % cert["san"]
|
||||||
text += "Issuer: %s\n" % cert["issuer"]
|
text += "Issuer: %s\n" % cert["issuer"]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class InteractiveChallenge(object):
|
|||||||
super(InteractiveChallenge, self).__init__()
|
super(InteractiveChallenge, self).__init__()
|
||||||
self.string = string
|
self.string = string
|
||||||
|
|
||||||
def perform(self, quiet=True):
|
def perform(self, quiet=True): # pylint: disable=missing-docstring
|
||||||
if quiet:
|
if quiet:
|
||||||
dialog.Dialog().msgbox(
|
dialog.Dialog().msgbox(
|
||||||
self.get_display_string(), width=self.BOX_SIZE)
|
self.get_display_string(), width=self.BOX_SIZE)
|
||||||
@@ -34,7 +34,7 @@ class InteractiveChallenge(object):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_display_string(self):
|
def get_display_string(self): # pylint: disable=missing-docstring
|
||||||
return (textwrap.fill(self.string, width=self.BOX_SIZE) +
|
return (textwrap.fill(self.string, width=self.BOX_SIZE) +
|
||||||
"\n\nPlease Press Enter to Continue")
|
"\n\nPlease Press Enter to Continue")
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class RecoveryContact(object):
|
|||||||
self.contact = contact
|
self.contact = contact
|
||||||
self.poll_delay = poll_delay
|
self.poll_delay = poll_delay
|
||||||
|
|
||||||
def perform(self, quiet=True):
|
def perform(self, quiet=True): # pylint: disable=missing-docstring
|
||||||
d = dialog.Dialog() # pylint: disable=invalid-name
|
d = dialog.Dialog() # pylint: disable=invalid-name
|
||||||
if quiet:
|
if quiet:
|
||||||
if self.success_url:
|
if self.success_url:
|
||||||
@@ -50,7 +50,7 @@ class RecoveryContact(object):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def cleanup(self): # pylint: disable=no-self-use
|
def cleanup(self): # pylint: disable=no-self-use,missing-docstring
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_display_string(self):
|
def get_display_string(self):
|
||||||
@@ -109,7 +109,7 @@ class RecoveryContact(object):
|
|||||||
|
|
||||||
return ans.startswith('y') or ans.startswith('Y')
|
return ans.startswith('y') or ans.startswith('Y')
|
||||||
|
|
||||||
def generate_response(self):
|
def generate_response(self): # pylint: disable=missing-docstring
|
||||||
if not self.token:
|
if not self.token:
|
||||||
return {"type": "recoveryContact"}
|
return {"type": "recoveryContact"}
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -410,12 +410,12 @@ class PathSatisfiedTest(unittest.TestCase):
|
|||||||
self.assertFalse(self.handler._path_satisfied(dom[i]))
|
self.assertFalse(self.handler._path_satisfied(dom[i]))
|
||||||
|
|
||||||
|
|
||||||
def gen_auth_resp(chall_list):
|
def gen_auth_resp(chall_list): # pylint: disable=missing-docstring
|
||||||
return ["%s%s" % (type(chall).__name__, chall.domain)
|
return ["%s%s" % (type(chall).__name__, chall.domain)
|
||||||
for chall in chall_list]
|
for chall in chall_list]
|
||||||
|
|
||||||
|
|
||||||
def gen_path(str_list, challenges):
|
def gen_path(str_list, challenges): # pylint: disable=missing-docstring
|
||||||
path = []
|
path = []
|
||||||
for i, chall in enumerate(challenges):
|
for i, chall in enumerate(challenges):
|
||||||
for str_chall in str_list:
|
for str_chall in str_list:
|
||||||
|
|||||||
Reference in New Issue
Block a user