diff --git a/certbot-apache/certbot_apache/_internal/apacheparser.py b/certbot-apache/certbot_apache/_internal/apacheparser.py index 0aba0cb3c..8d2a79754 100644 --- a/certbot-apache/certbot_apache/_internal/apacheparser.py +++ b/certbot-apache/certbot_apache/_internal/apacheparser.py @@ -118,7 +118,8 @@ class ApacheBlockNode(ApacheDirectiveNode): # pylint: disable=unused-argument def add_child_directive(self, name: str, parameters: Optional[List[str]] = None, - position: int = None) -> ApacheDirectiveNode: # pragma: no cover + position: Optional[int] = None + ) -> ApacheDirectiveNode: # pragma: no cover """Adds a new DirectiveNode to the sequence of children""" new_dir = ApacheDirectiveNode(name=assertions.PASS, parameters=assertions.PASS, diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py index 0b54271be..41209deb4 100644 --- a/certbot-apache/certbot_apache/_internal/configurator.py +++ b/certbot-apache/certbot_apache/_internal/configurator.py @@ -812,7 +812,7 @@ class ApacheConfigurator(common.Configurator): return self._find_best_vhost(target, filtered_vhosts, filter_defaults) def _find_best_vhost( - self, target_name: str, vhosts: List[obj.VirtualHost] = None, + self, target_name: str, vhosts: Optional[List[obj.VirtualHost]] = None, filter_defaults: bool = True ) -> Optional[obj.VirtualHost]: """Finds the best vhost for a target_name. diff --git a/certbot-ci/certbot_integration_tests/certbot_tests/context.py b/certbot-ci/certbot_integration_tests/certbot_tests/context.py index 0dc732880..6b7407e50 100644 --- a/certbot-ci/certbot_integration_tests/certbot_tests/context.py +++ b/certbot-ci/certbot_integration_tests/certbot_tests/context.py @@ -17,8 +17,8 @@ class IntegrationTestsContext: self.request = request if hasattr(request.config, 'workerinput'): # Worker node - self.worker_id = request.config.workerinput['workerid'] # type: ignore[attr-defined] - acme_xdist = request.config.workerinput['acme_xdist'] # type: ignore[attr-defined] + self.worker_id = request.config.workerinput['workerid'] + acme_xdist = request.config.workerinput['acme_xdist'] else: # Primary node self.worker_id = 'primary' acme_xdist = request.config.acme_xdist # type: ignore[attr-defined] diff --git a/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py b/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py index dde41f367..4a383fe56 100644 --- a/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py +++ b/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py @@ -21,7 +21,7 @@ class IntegrationTestsContext(certbot_context.IntegrationTestsContext): self.request = request if hasattr(request.config, 'workerinput'): # Worker node - self._dns_xdist = request.config.workerinput['dns_xdist'] # type: ignore[attr-defined] + self._dns_xdist = request.config.workerinput['dns_xdist'] else: # Primary node self._dns_xdist = request.config.dns_xdist # type: ignore[attr-defined] diff --git a/certbot-nginx/certbot_nginx/_internal/configurator.py b/certbot-nginx/certbot_nginx/_internal/configurator.py index 39784110c..2786e5e8e 100644 --- a/certbot-nginx/certbot_nginx/_internal/configurator.py +++ b/certbot-nginx/certbot_nginx/_internal/configurator.py @@ -1112,7 +1112,7 @@ class NginxConfigurator(common.Configurator): ################################################### # Wrapper functions for Reverter class (Installer) ################################################### - def save(self, title: str = None, temporary: bool = False) -> None: + def save(self, title: Optional[str] = None, temporary: bool = False) -> None: """Saves all changes to the configuration files. :param str title: The title of the save. If a title is given, the diff --git a/certbot/certbot/_internal/account.py b/certbot/certbot/_internal/account.py index 8ebc71de3..eb2466f32 100644 --- a/certbot/certbot/_internal/account.py +++ b/certbot/certbot/_internal/account.py @@ -108,7 +108,7 @@ class Account: class AccountMemoryStorage(interfaces.AccountStorage): """In-memory account storage.""" - def __init__(self, initial_accounts: Dict[str, Account] = None) -> None: + def __init__(self, initial_accounts: Optional[Dict[str, Account]] = None) -> None: self.accounts = initial_accounts if initial_accounts is not None else {} def find_all(self) -> List[Account]: diff --git a/certbot/certbot/_internal/display/dummy_readline.py b/certbot/certbot/_internal/display/dummy_readline.py index 2b6e4c310..62152b050 100644 --- a/certbot/certbot/_internal/display/dummy_readline.py +++ b/certbot/certbot/_internal/display/dummy_readline.py @@ -11,6 +11,7 @@ def get_completer() -> Optional[Callable[[], str]]: def get_completer_delims() -> List[str]: """An empty implementation of readline.get_completer_delims.""" + return [] def parse_and_bind(unused_command: str) -> None: diff --git a/certbot/certbot/_internal/main.py b/certbot/certbot/_internal/main.py index 2ece86517..d72fa4d06 100644 --- a/certbot/certbot/_internal/main.py +++ b/certbot/certbot/_internal/main.py @@ -1683,7 +1683,7 @@ def make_displayer(config: configuration.NamespaceConfig devnull.close() -def main(cli_args: List[str] = None) -> Optional[Union[str, int]]: +def main(cli_args: Optional[List[str]] = None) -> Optional[Union[str, int]]: """Run Certbot. :param cli_args: command line to Certbot, defaults to ``sys.argv[1:]`` diff --git a/certbot/certbot/tests/util.py b/certbot/certbot/tests/util.py index 3509f360f..772fcd5a5 100644 --- a/certbot/certbot/tests/util.py +++ b/certbot/certbot/tests/util.py @@ -39,7 +39,7 @@ from certbot.plugins import common class DummyInstaller(common.Installer): """Dummy installer plugin for test purpose.""" def get_all_names(self) -> Iterable[str]: - pass + return [] def deploy_cert(self, domain: str, cert_path: str, key_path: str, chain_path: str, fullchain_path: str) -> None: @@ -50,7 +50,7 @@ class DummyInstaller(common.Installer): pass def supported_enhancements(self) -> List[str]: - pass + return [] def save(self, title: Optional[str] = None, temporary: bool = False) -> None: pass @@ -69,7 +69,7 @@ class DummyInstaller(common.Installer): pass def more_info(self) -> str: - pass + return "" def vector_path(*names: str) -> str: @@ -253,7 +253,7 @@ class FreezableMock: value of func is ignored. """ - def __init__(self, frozen: bool = False, func: Callable[..., Any] = None, + def __init__(self, frozen: bool = False, func: Optional[Callable[..., Any]] = None, return_value: Any = mock.sentinel.DEFAULT) -> None: self._frozen_set = set() if frozen else {'freeze', } self._func = func