Example #1
0
    def __init__(self, path: str, name: Optional[str] = None, **kwargs: Any):
        self._children: List[Type[ProjectModule]] = []
        self.path: Path = Path(path).absolute()
        self.data_path: Path = self.path / '.micropy'
        self.info_path: Path = self.path / 'micropy.json'
        self.cache_path: Path = self.data_path / '.cache'
        self._context = Config(source_format=DictConfigSource)

        self.name: str = name or self.path.name
        self._config: Config = Config(self.info_path,
                                      default={'name': self.name},
                                      should_sync=lambda *a: self.exists)
        self.log: ServiceLog = Log.add_logger(self.name, show_title=False)
Example #2
0
 def __init__(self, path: str, name: Optional[str] = None, **kwargs: Any):
     self._children: List[Type[ProjectModule]] = []
     self.path: Path = Path(path).absolute()
     self.data_path: Path = self.path / ".micropy"
     self.info_path: Path = self.path / "micropy.json"
     self.cache_path: Path = self.data_path / ".cache"
     self._cache = Config(self.cache_path)
     self._context = Config(source_format=DictConfigSource, default={"datadir": self.data_path})
     self.name: str = name or self.path.name
     default_config = {
         "name": self.name,
     }
     self._config: Config = Config(self.info_path, default=default_config)
     self.log: ServiceLog = Log.add_logger(self.name, show_title=False)
Example #3
0
    def config(self, value: dict) -> Config:
        """Sets active config.

        Args:
            value (dict): Value to set.

        Returns:
            Config: Current config

        """
        self._config = Config(self.info_path, default=value)
        return self._config