Allow not using files from user_dir
This commit is contained in:
parent
de2cc58b0c
commit
44289e4c58
@ -17,13 +17,13 @@ class IResolver:
|
|||||||
This class contains all the logic to load custom classes
|
This class contains all the logic to load custom classes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def build_search_paths(self, config, current_path: Path, user_subdir: str,
|
def build_search_paths(self, config, current_path: Path, user_subdir: Optional[str] = None,
|
||||||
extra_dir: Optional[str] = None) -> List[Path]:
|
extra_dir: Optional[str] = None) -> List[Path]:
|
||||||
|
|
||||||
abs_paths = [
|
abs_paths: List[Path] = [current_path]
|
||||||
config['user_data_dir'].joinpath(user_subdir),
|
|
||||||
current_path,
|
if user_subdir:
|
||||||
]
|
abs_paths.insert(0, config['user_data_dir'].joinpath(user_subdir))
|
||||||
|
|
||||||
if extra_dir:
|
if extra_dir:
|
||||||
# Add extra directory to the top of the search paths
|
# Add extra directory to the top of the search paths
|
||||||
|
@ -40,7 +40,7 @@ class PairListResolver(IResolver):
|
|||||||
current_path = Path(__file__).parent.parent.joinpath('pairlist').resolve()
|
current_path = Path(__file__).parent.parent.joinpath('pairlist').resolve()
|
||||||
|
|
||||||
abs_paths = self.build_search_paths(config, current_path=current_path,
|
abs_paths = self.build_search_paths(config, current_path=current_path,
|
||||||
user_subdir='pairlist', extra_dir=None)
|
user_subdir=None, extra_dir=None)
|
||||||
|
|
||||||
pairlist = self._load_object(paths=abs_paths, object_type=IPairList,
|
pairlist = self._load_object(paths=abs_paths, object_type=IPairList,
|
||||||
object_name=pairlist_name, kwargs=kwargs)
|
object_name=pairlist_name, kwargs=kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user