pyproject.toml: Enforce import annotations style
Add new ruff rules and fix their fallout:
future-annotations = true
select = [
"TC", # type-checking import placement rules
"FA", # future annotations rules
]
This comprises:
- Streamline imports and exports in cmds.xxx.Cmd
- Import base class as "Base"
- Export types Cmd and Parent via __all__
- Move all types imported only for annotation below TYPE_CHECKING
- Use "from __future__ import annotations" all over the place
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
7a65a7b5e1
commit
5d1ba6e15a
77 changed files with 382 additions and 196 deletions
|
|
@ -4,7 +4,6 @@ import json
|
|||
import os
|
||||
import sys
|
||||
|
||||
from argparse import Namespace
|
||||
from enum import Enum, auto
|
||||
from typing import TYPE_CHECKING, Iterable, TypeVar, cast
|
||||
|
||||
|
|
@ -13,6 +12,7 @@ from .log import DEBUG, ERR, log
|
|||
from .Uri import Uri
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from argparse import Namespace
|
||||
from .ExecContext import ExecContext
|
||||
from .FileContext import FileContext
|
||||
from .ProcFilter import ProcFilter, ProcPipeline
|
||||
|
|
@ -93,7 +93,7 @@ async def run_curl_into(
|
|||
raise TypeError(
|
||||
f'Expected {expected_type.__name__}, got {type(ret).__name__} from Curl'
|
||||
)
|
||||
return cast(T, ret)
|
||||
return cast('T', ret)
|
||||
|
||||
async def run_askpass(
|
||||
askpass_env: list[str],
|
||||
|
|
|
|||
Loading…
Reference in a new issue