feat: dotchain

This commit is contained in:
2024-08-01 11:33:09 +08:00
parent abb5195e55
commit bbf3fe2909
16 changed files with 1571 additions and 13 deletions

24
src/blackbox/sum.py Normal file
View File

@ -0,0 +1,24 @@
from .blackbox import Blackbox
from injector import singleton
@singleton
class Sum(Blackbox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __call__(self, *args, **kwargs):
return self.processing(*args, **kwargs)
def processing(self, *args, **kwargs):
total = 0
for arg in args[0]:
total += arg
return total
def valid(self, *args, **kwargs) -> bool:
return super().valid(*args, **kwargs)
async def fast_api_handler(self, request):
json = await request.json()
return self.processing(json)