File tree Expand file tree Collapse file tree 3 files changed +23
-19
lines changed
Expand file tree Collapse file tree 3 files changed +23
-19
lines changed Original file line number Diff line number Diff line change 1616 DEFAULT_RULESDIR ,
1717 INVALID_CONFIG_RC ,
1818)
19- from ansiblelint .file_utils import expand_path_vars , guess_project_dir , normpath
19+ from ansiblelint .file_utils import (
20+ abspath ,
21+ expand_path_vars ,
22+ guess_project_dir ,
23+ normpath ,
24+ )
2025
2126_logger = logging .getLogger (__name__ )
2227_PATH_VARS = [
2530]
2631
2732
28- def abspath (path : str , base_dir : str ) -> str :
29- """Make relative path absolute relative to given directory.
30-
31- Args:
32- path (str): the path to make absolute
33- base_dir (str): the directory from which make \
34- relative paths absolute
35- """
36- if not os .path .isabs (path ):
37- # Don't use abspath as it assumes path is relative to cwd.
38- # We want it relative to base_dir.
39- path = os .path .join (base_dir , path )
40-
41- return os .path .normpath (path )
42-
43-
4433def expand_to_normalized_paths (
4534 config : Dict [str , Any ], base_dir : Optional [str ] = None
4635) -> None :
Original file line number Diff line number Diff line change 2828_logger = logging .getLogger (__package__ )
2929
3030
31+ def abspath (path : str , base_dir : str ) -> str :
32+ """Make relative path absolute relative to given directory.
33+
34+ Args:
35+ path (str): the path to make absolute
36+ base_dir (str): the directory from which make \
37+ relative paths absolute
38+ """
39+ if not os .path .isabs (path ):
40+ # Don't use abspath as it assumes path is relative to cwd.
41+ # We want it relative to base_dir.
42+ path = os .path .join (base_dir , path )
43+
44+ return os .path .normpath (path )
45+
46+
3147def normpath (path : Union [str , BasePathLike ]) -> str :
3248 """
3349 Normalize a path in order to provide a more consistent output.
Original file line number Diff line number Diff line change 2323import pytest
2424
2525from ansiblelint import formatters
26- from ansiblelint .cli import abspath
27- from ansiblelint .file_utils import Lintable
26+ from ansiblelint .file_utils import Lintable , abspath
2827from ansiblelint .rules import RulesCollection
2928from ansiblelint .runner import Runner
3029
You can’t perform that action at this time.
0 commit comments