mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-14 00:53:25 +00:00
24 lines
636 B
Python
24 lines
636 B
Python
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) |