1
1
from __future__ import annotations
2
2
3
3
from pathlib import Path
4
- from typing import TYPE_CHECKING , Any , Iterator , TypeVar , cast
4
+ from typing import TYPE_CHECKING , Any , Iterator
5
5
6
6
from tox .config .types import Command , EnvList
7
7
11
11
12
12
if TYPE_CHECKING :
13
13
from tox .config .main import Config
14
- T = TypeVar ("T" )
15
14
16
15
17
16
class MemoryLoader (Loader [Any ]):
18
17
def __init__ (self , ** kwargs : Any ) -> None :
19
18
super ().__init__ (Section (prefix = "<memory>" , name = str (id (self ))), [])
20
19
self .raw : dict [str , Any ] = {** kwargs }
21
20
22
- def load_raw (self , key : Any , conf : Config | None , env_name : str | None ) -> T : # noqa: U100
23
- return cast ( T , self .raw [key ])
21
+ def load_raw (self , key : Any , conf : Config | None , env_name : str | None ) -> Any : # noqa: U100
22
+ return self .raw [key ]
24
23
25
24
def found_keys (self ) -> set [str ]:
26
25
return set (self .raw .keys ())
@@ -34,15 +33,15 @@ def to_str(value: Any) -> str:
34
33
return str (value )
35
34
36
35
@staticmethod
37
- def to_list (value : Any , of_type : type [Any ]) -> Iterator [T ]: # noqa: U100
36
+ def to_list (value : Any , of_type : type [Any ]) -> Iterator [Any ]: # noqa: U100
38
37
return iter (value )
39
38
40
39
@staticmethod
41
- def to_set (value : Any , of_type : type [Any ]) -> Iterator [T ]: # noqa: U100
40
+ def to_set (value : Any , of_type : type [Any ]) -> Iterator [Any ]: # noqa: U100
42
41
return iter (value )
43
42
44
43
@staticmethod
45
- def to_dict (value : Any , of_type : tuple [type [Any ], type [Any ]]) -> Iterator [tuple [T , T ]]: # noqa: U100
44
+ def to_dict (value : Any , of_type : tuple [type [Any ], type [Any ]]) -> Iterator [tuple [Any , Any ]]: # noqa: U100
46
45
return value .items () # type: ignore[no-any-return]
47
46
48
47
@staticmethod
0 commit comments