Accept suggestions from new toolchain · rec/tdir@3bf788a

@@ -97,6 +97,7 @@ def test_something_else(self):

97979898

ORIGINAL_PATH = Path().absolute()

9999

"""

100+100101

from __future__ import annotations

101102102103

import dataclasses as dc

@@ -128,7 +129,7 @@ def tdir(

128129

save: bool = False,

129130

use_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

"""

165166

td: _Tdir

166167167-

@dek.dek(methods=methods) # type: ignore[misc]

168+

@dek.dek(methods=methods)

168169

def call(func: t.Callable[..., None], *args: t.Any, **kwargs: t.Any) -> None:

169170

with td:

170171

func(*args, **kwargs)

@@ -183,7 +184,7 @@ def call(func: t.Callable[..., None], *args: t.Any, **kwargs: t.Any) -> None:

183184

@dc.dataclass

184185

class _Tdir:

185186

args: t.Sequence[Arg]

186-

call: t.Callable[..., '_Tdir']

187+

call: t.Callable[..., _Tdir]

187188

chdir: bool

188189

clear: bool

189190

kwargs: t.Dict[str, Arg]

@@ -273,7 +274,7 @@ def fill(_root: t.Union[str, Path], *args: Arg, **kwargs: Arg) -> None:

273274

elif isinstance(a, Path):

274275

a = {a.name: a}

275276

elif 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)}')

277278

fill(_root, **a)

278279279280

for k, v in kwargs.items():

@@ -303,4 +304,4 @@ def fill(_root: t.Union[str, Path], *args: Arg, **kwargs: Arg) -> None:

303304

fill(rk, *v)

304305305306

else:

306-

raise TypeError('Do not understand type %s=%s' % (k, v))

307+

raise TypeError(f'Do not understand type {k}={v}')