fix: explicit optional types in `config.py` (#472)

* fix: make auther function optional in Config

* fix: make args optional in from_args

* chore: autoformatting
This commit is contained in:
Dmitrii O 2023-01-30 23:25:05 +01:00 committed by GitHub
parent ae3dcf2bbd
commit d716d0faf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -689,7 +689,7 @@ class RunConfig(_ConfigCommon):
log_req_frmt: str,
log_res_frmt: str,
log_err_frmt: str,
auther: t.Callable[[str, str], bool] = None,
auther: t.Optional[t.Callable[[str, str], bool]] = None,
**kwargs: t.Any,
) -> None:
"""Construct a RuntimeConfig."""
@ -828,7 +828,9 @@ class Config:
return default_config.with_updates(**overrides)
@classmethod
def from_args(cls, args: t.Sequence[str] = None) -> Configuration:
def from_args(
cls, args: t.Optional[t.Sequence[str]] = None
) -> Configuration:
"""Construct a Config from the passed args or sys.argv."""
# If pulling args from sys.argv (commandline arguments), argv[0] will
# be the program name, (i.e. pypi-server), so we don't need to