add @classproperty, change set_repo to not require the parent

This commit is contained in:
Dima Gerasimov 2020-05-09 20:03:35 +01:00
parent 5f4acfddee
commit 66453cb29b
3 changed files with 30 additions and 4 deletions

View file

@ -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)