mirror of
https://github.com/certbot/certbot.git
synced 2026-07-31 18:45:40 +02:00
Prepare certbot module for mypy check untyped defs (#6005)
* Prepare certbot module for mypy check untyped defs * Fix #5952 * Bump mypy to version 0.600 and fix associated bugs * Fix pylint bugs after introducing mypy * Implement Brad's suggestions * Reenabling pylint and adding nginx mypy back
This commit is contained in:
committed by
Brad Warren
parent
250c0d6691
commit
36dfd06503
+10
-7
@@ -6,6 +6,7 @@ import os
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from acme.magic_typing import Set, List # pylint: disable=unused-import, no-name-in-module
|
||||
from certbot import errors
|
||||
from certbot import util
|
||||
|
||||
@@ -76,7 +77,8 @@ def pre_hook(config):
|
||||
if cmd:
|
||||
_run_pre_hook_if_necessary(cmd)
|
||||
|
||||
pre_hook.already = set() # type: ignore
|
||||
|
||||
executed_pre_hooks = set() # type: Set[str]
|
||||
|
||||
|
||||
def _run_pre_hook_if_necessary(command):
|
||||
@@ -88,12 +90,12 @@ def _run_pre_hook_if_necessary(command):
|
||||
:param str command: pre-hook to be run
|
||||
|
||||
"""
|
||||
if command in pre_hook.already:
|
||||
if command in executed_pre_hooks:
|
||||
logger.info("Pre-hook command already run, skipping: %s", command)
|
||||
else:
|
||||
logger.info("Running pre-hook command: %s", command)
|
||||
_run_hook(command)
|
||||
pre_hook.already.add(command)
|
||||
executed_pre_hooks.add(command)
|
||||
|
||||
|
||||
def post_hook(config):
|
||||
@@ -127,7 +129,8 @@ def post_hook(config):
|
||||
logger.info("Running post-hook command: %s", cmd)
|
||||
_run_hook(cmd)
|
||||
|
||||
post_hook.eventually = [] # type: ignore
|
||||
|
||||
post_hooks = [] # type: List[str]
|
||||
|
||||
|
||||
def _run_eventually(command):
|
||||
@@ -139,13 +142,13 @@ def _run_eventually(command):
|
||||
:param str command: post-hook to register to be run
|
||||
|
||||
"""
|
||||
if command not in post_hook.eventually:
|
||||
post_hook.eventually.append(command)
|
||||
if command not in post_hooks:
|
||||
post_hooks.append(command)
|
||||
|
||||
|
||||
def run_saved_post_hooks():
|
||||
"""Run any post hooks that were saved up in the course of the 'renew' verb"""
|
||||
for cmd in post_hook.eventually:
|
||||
for cmd in post_hooks:
|
||||
logger.info("Running post-hook command: %s", cmd)
|
||||
_run_hook(cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user