File tree Expand file tree Collapse file tree 3 files changed +12
-22
lines changed
Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change 77
88import yaml
99
10- if t .TYPE_CHECKING :
11- from typing import Literal , TypeAlias
12-
13- FormatLiteral = Literal ["json" , "yaml" ]
14-
15- RawConfigData : TypeAlias = dict [t .Any , t .Any ]
10+ FormatLiteral = t .Literal ["json" , "yaml" ]
11+ RawConfigData : t .TypeAlias = dict [t .Any , t .Any ]
1612
1713
1814class ConfigReader :
Original file line number Diff line number Diff line change 77import logging
88import os
99import pathlib
10+ from collections .abc import Callable
1011import typing as t
1112
1213from libvcs .sync .git import GitRemote
1617from . import exc
1718from ._internal .config_reader import ConfigReader , DuplicateAwareConfigReader
1819from .util import get_config_dir , update_dict
20+ from .types import ConfigDict , RawConfigDict
1921
2022log = logging .getLogger (__name__ )
2123
22- if t .TYPE_CHECKING :
23- from collections .abc import Callable
24- from typing import TypeGuard
25-
26- from .types import ConfigDict , RawConfigDict
27-
2824
2925def expand_dir (
3026 dir_ : pathlib .Path ,
@@ -34,14 +30,15 @@ def expand_dir(
3430
3531 Parameters
3632 ----------
37- _dir : pathlib.Path
33+ dir_ : pathlib.Path
34+ Directory path to expand
3835 cwd : pathlib.Path, optional
39- current working dir (for deciphering relative _dir paths), defaults to
40- :py:meth:`os.getcwd()`
36+ Current working dir (used to resolve relative paths). Defaults to
37+ :py:meth:`pathlib.Path.cwd`.
4138
4239 Returns
4340 -------
44- pathlib.Path :
41+ pathlib.Path
4542 Absolute directory path
4643 """
4744 dir_ = pathlib .Path (os .path .expandvars (str (dir_ ))).expanduser ()
@@ -136,7 +133,7 @@ def extract_repos(
136133 ** url ,
137134 )
138135
139- def is_valid_config_dict (val : t .Any ) -> TypeGuard [ConfigDict ]:
136+ def is_valid_config_dict (val : t .Any ) -> t . TypeGuard [ConfigDict ]:
140137 assert isinstance (val , dict )
141138 return True
142139
Original file line number Diff line number Diff line change 55import pathlib
66import typing as t
77
8- if t .TYPE_CHECKING :
9- from typing import TypeGuard
8+ from vcspull .types import RawConfigDict
109
11- from vcspull .types import RawConfigDict
1210
13-
14- def is_valid_config (config : dict [str , t .Any ]) -> TypeGuard [RawConfigDict ]:
11+ def is_valid_config (config : dict [str , t .Any ]) -> t .TypeGuard [RawConfigDict ]:
1512 """Return true and upcast if vcspull configuration file is valid."""
1613 if not isinstance (config , dict ):
1714 return False
You can’t perform that action at this time.
0 commit comments