Finish plugin API and add basic login system

This commit is contained in:
Tulir Asokan 2018-10-31 02:03:27 +02:00
parent d7f072aeff
commit 14fd0d6ac9
16 changed files with 160 additions and 62 deletions

View file

@ -59,10 +59,12 @@ class PluginLoader(ABC):
pass
async def stop_instances(self) -> None:
await asyncio.gather([instance.stop() for instance in self.references if instance.running])
await asyncio.gather(*[instance.stop() for instance
in self.references if instance.running])
async def start_instances(self) -> None:
await asyncio.gather([instance.start() for instance in self.references if instance.enabled])
await asyncio.gather(*[instance.start() for instance
in self.references if instance.enabled])
@abstractmethod
async def load(self) -> Type[PluginClass]:

View file

@ -207,8 +207,10 @@ class ZippedPluginLoader(PluginLoader):
self.log.debug(f"Loaded and imported plugin {self.id} from {self.path}")
return plugin
async def reload(self) -> Type[PluginClass]:
async def reload(self, new_path: Optional[str] = None) -> Type[PluginClass]:
await self.unload()
if new_path is not None:
self.path = new_path
return await self.load(reset_cache=True)
async def unload(self) -> None: