有尊严地使用python,这里提供一些工具
项目描述
安装
pip install Remilia
快速开始
精简日志
from Remilia.LiteLog import LiteLog
Logger=LiteLog(__name__)
Logger.info("hello")
>>>[ INFO | __main__ | 14:58:50 ] hello
精简活动
from Remilia.LiteEvent import EventType,EventBus
EventBus=EventBus()
@EventBus.registEvent(EventType("hello"))
def hello():
print("hello")
@EventBus.registEventTrigger("hello",EventBus.PreEvent)
def beforehello(event:EventType):
print(f"before the {event.getOBJ().__code__.co_name} event")
#event.setCancel()
#print("I cancel the event")
@EventBus.registEventTrigger("hello",EventBus.AftEvent)
def beforehello(event:EventType):
print(f"after the {event.getOBJ().__code__.co_name} event")
hello()
>>>before the hello
>>>hello
>>>after the hello
轻线程
from Remilia import LiteThread
def hello():
return "hello"
TVManager=LiteThread.ThreadValueManager()
TestThread=LiteThread.LiteThread(target=hello)
TestThread.start()
print(TVManager.waitResult(TestThread))
>>>hello
LiteMixin
from Remilia import LiteMixin
class A:
def __init__(self) -> None:
self.hello()
def hello(self):
print("hello")
A()
class A_patch:
def hello(self):
print("byebye")
LiteMixin.MixInClass(A,A_patch)
A()
>>>hello
>>>byebye
精简版PGL
# main.py
# test
# - plugin1.py
# - plugin2.py
#main
from Remilia import LitePGL,LiteResource
PGLoader=LitePGL.PluginLoader()
LoadPoint1=LitePGL.PluginLoadPoint(PGLoader,"loadpoint1")
PGLoader.setInterface(globals())
PGLoader.initLoadPlugin(LiteResource.Path("test/plugin2.py"))
PGLoader.initLoadPlugin(LiteResource.Path("test/plugin1.py"))
LoadPoint1.run()
#test/plugin1.py
PluginLoader=self
p2Self=PluginLoader.requestPlugin("p2")
@PluginLoader.registPlugin(PluginLoader.getInterface["LoadPoint1"])
class plugin:
def __init__(self) -> None:
global PluginLoader,p2Self
print("I am p1")
p2Self.hello("hello")
def __reference__(self):
return {
"pluginid":"p1"
}
#test/plugin2.py
PluginLoader=self
@PluginLoader.registPlugin(PluginLoader.getInterface["LoadPoint1"])
class plugin2:
def __init__(self) -> None:
print("I am p2")
def hello(self,*args):
print(*args)
def __reference__(self):
return {
"pluginid":"p2"
}
>>>I am p2
>>>I am p1
>>>hello
这里还有一些其他的超级类/方法
在我们的 WIKI 中了解更多信息
https://github.com/IAXRetailer/Remilia/wiki
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
Remilia-2022.9.25.6.38.48.tar.gz
(12.1 kB
查看哈希)
内置分布
关
Remilia- 2022.9.25.6.38.48 -py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | ee42d8304dabac64305520971d2564eeb03dbe3b1576e1431ad56bfa388da461 |
|
| MD5 | 05f7ee8c7fea42b2afa833f1873fdceb |
|
| 布莱克2-256 | 40d09b1baf35d2cc838b53e53ab5711ea8ab351c762cab6bd7ed65fb5842ba89 |