Accept suggestions from new toolchain · rec/tdir@3bf788a
@@ -97,6 +97,7 @@ def test_something_else(self):
97979898 ORIGINAL_PATH = Path().absolute()
9999"""
100+100101from __future__ import annotations
101102102103import dataclasses as dc
@@ -128,7 +129,7 @@ def tdir(
128129save: bool = False,
129130use_dir: str = '',
130131**kwargs: Arg,
131-) -> '_Tdir':
132+) -> _Tdir:
132133"""
133134 Set up a temporary directory, fill it with files, then tear it down at
134135 the end of an operation.
@@ -164,7 +165,7 @@ def tdir(
164165 """
165166td: _Tdir
166167167-@dek.dek(methods=methods) # type: ignore[misc]
168+@dek.dek(methods=methods)
168169def call(func: t.Callable[..., None], *args: t.Any, **kwargs: t.Any) -> None:
169170with td:
170171func(*args, **kwargs)
@@ -183,7 +184,7 @@ def call(func: t.Callable[..., None], *args: t.Any, **kwargs: t.Any) -> None:
183184@dc.dataclass
184185class _Tdir:
185186args: t.Sequence[Arg]
186-call: t.Callable[..., '_Tdir']
187+call: t.Callable[..., _Tdir]
187188chdir: bool
188189clear: bool
189190kwargs: t.Dict[str, Arg]
@@ -273,7 +274,7 @@ def fill(_root: t.Union[str, Path], *args: Arg, **kwargs: Arg) -> None:
273274elif isinstance(a, Path):
274275a = {a.name: a}
275276elif not isinstance(a, dict):
276-raise TypeError('Do not understand type %s of %s' % (a, type(a)))
277+raise TypeError(f'Do not understand type {a} of {type(a)}')
277278fill(_root, **a)
278279279280for k, v in kwargs.items():
@@ -303,4 +304,4 @@ def fill(_root: t.Union[str, Path], *args: Arg, **kwargs: Arg) -> None:
303304fill(rk, *v)
304305305306else:
306-raise TypeError('Do not understand type %s=%s' % (k, v))
307+raise TypeError(f'Do not understand type {k}={v}')