add @classproperty, change set_repo to not require the parent
This commit is contained in:
parent
5f4acfddee
commit
66453cb29b
3 changed files with 30 additions and 4 deletions
|
@ -16,11 +16,14 @@ After that, you can set config attributes:
|
|||
import my.config as config
|
||||
|
||||
|
||||
def set_repo(name: str, repo):
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
def set_repo(name: str, repo: Union[Path, str]) -> None:
|
||||
from .core.init import assign_module
|
||||
from . common import import_from
|
||||
|
||||
module = import_from(repo, name)
|
||||
r = Path(repo)
|
||||
module = import_from(r.parent, name)
|
||||
assign_module('my.config.repos', name, module)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue