golden hour
/lib/python2.7/site-packages/certbot/_internal
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.py
184 B
Del
OK
__init__.pyc
349 B
Del
OK
__init__.pyo
349 B
Del
OK
account.py
14.5 KB
Del
OK
account.pyc
14.89 KB
Del
OK
account.pyo
14.89 KB
Del
OK
auth_handler.py
18.38 KB
Del
OK
auth_handler.pyc
17.21 KB
Del
OK
auth_handler.pyo
17.1 KB
Del
OK
cert_manager.py
15.59 KB
Del
OK
cert_manager.pyc
16.42 KB
Del
OK
cert_manager.pyo
16.42 KB
Del
OK
cli
-
Del
OK
client.py
30.2 KB
Del
OK
client.pyc
26.95 KB
Del
OK
client.pyo
26.95 KB
Del
OK
configuration.py
5.75 KB
Del
OK
configuration.pyc
7.77 KB
Del
OK
configuration.pyo
7.77 KB
Del
OK
constants.py
6.37 KB
Del
OK
constants.pyc
5.02 KB
Del
OK
constants.pyo
5.02 KB
Del
OK
display
-
Del
OK
eff.py
4.56 KB
Del
OK
eff.pyc
5.2 KB
Del
OK
eff.pyo
5.2 KB
Del
OK
error_handler.py
7.05 KB
Del
OK
error_handler.pyc
6.59 KB
Del
OK
error_handler.pyo
6.59 KB
Del
OK
hooks.py
7.88 KB
Del
OK
hooks.pyc
9.28 KB
Del
OK
hooks.pyo
9.28 KB
Del
OK
lock.py
9.94 KB
Del
OK
lock.pyc
9.92 KB
Del
OK
lock.pyo
9.92 KB
Del
OK
log.py
13.43 KB
Del
OK
log.pyc
13.56 KB
Del
OK
log.pyo
13.45 KB
Del
OK
main.py
50.33 KB
Del
OK
main.pyc
43.83 KB
Del
OK
main.pyo
43.61 KB
Del
OK
plugins
-
Del
OK
renewal.py
22.29 KB
Del
OK
renewal.pyc
17.4 KB
Del
OK
renewal.pyo
17.4 KB
Del
OK
reporter.py
3.48 KB
Del
OK
reporter.pyc
3.75 KB
Del
OK
reporter.pyo
3.68 KB
Del
OK
snap_config.py
3.38 KB
Del
OK
snap_config.pyc
4.73 KB
Del
OK
snap_config.pyo
4.73 KB
Del
OK
storage.py
45.96 KB
Del
OK
storage.pyc
42.26 KB
Del
OK
storage.pyo
42.26 KB
Del
OK
updater.py
3.87 KB
Del
OK
updater.pyc
4.35 KB
Del
OK
updater.pyo
4.35 KB
Del
OK
Edit: reporter.py
"""Collects and displays information to the user.""" from __future__ import print_function import collections import logging import sys import textwrap from six.moves import queue # type: ignore import zope.interface from certbot import interfaces from certbot import util logger = logging.getLogger(__name__) @zope.interface.implementer(interfaces.IReporter) class Reporter(object): """Collects and displays information to the user. :ivar `queue.PriorityQueue` messages: Messages to be displayed to the user. """ HIGH_PRIORITY = 0 """High priority constant. See `add_message`.""" MEDIUM_PRIORITY = 1 """Medium priority constant. See `add_message`.""" LOW_PRIORITY = 2 """Low priority constant. See `add_message`.""" _msg_type = collections.namedtuple('ReporterMsg', 'priority text on_crash') def __init__(self, config): self.messages = queue.PriorityQueue() # type: queue.PriorityQueue[Reporter._msg_type] self.config = config def add_message(self, msg, priority, on_crash=True): """Adds msg to the list of messages to be printed. :param str msg: Message to be displayed to the user. :param int priority: One of `HIGH_PRIORITY`, `MEDIUM_PRIORITY`, or `LOW_PRIORITY`. :param bool on_crash: Whether or not the message should be printed if the program exits abnormally. """ assert self.HIGH_PRIORITY <= priority <= self.LOW_PRIORITY self.messages.put(self._msg_type(priority, msg, on_crash)) logger.debug("Reporting to user: %s", msg) def print_messages(self): """Prints messages to the user and clears the message queue. If there is an unhandled exception, only messages for which ``on_crash`` is ``True`` are printed. """ bold_on = False if not self.messages.empty(): no_exception = sys.exc_info()[0] is None bold_on = sys.stdout.isatty() if not self.config.quiet: if bold_on: print(util.ANSI_SGR_BOLD) print('IMPORTANT NOTES:') first_wrapper = textwrap.TextWrapper( initial_indent=' - ', subsequent_indent=(' ' * 3), break_long_words=False, break_on_hyphens=False) next_wrapper = textwrap.TextWrapper( initial_indent=first_wrapper.subsequent_indent, subsequent_indent=first_wrapper.subsequent_indent, break_long_words=False, break_on_hyphens=False) while not self.messages.empty(): msg = self.messages.get() if self.config.quiet: # In --quiet mode, we only print high priority messages that # are flagged for crash cases if not (msg.priority == self.HIGH_PRIORITY and msg.on_crash): continue if no_exception or msg.on_crash: if bold_on and msg.priority > self.HIGH_PRIORITY: if not self.config.quiet: sys.stdout.write(util.ANSI_SGR_RESET) bold_on = False lines = msg.text.splitlines() print(first_wrapper.fill(lines[0])) if len(lines) > 1: print("\n".join( next_wrapper.fill(line) for line in lines[1:])) if bold_on and not self.config.quiet: sys.stdout.write(util.ANSI_SGR_RESET)
Save