Skip to content

Commit

Permalink
Feat: add ability to access configuration file from processors/genera…
Browse files Browse the repository at this point in the history
…tors
  • Loading branch information
S1ro1 committed Apr 10, 2024
1 parent 7dae2ee commit 2531c97
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions bspump/jupyter/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from typing import Any, Callable, List


class AsabObjMocker:
def __init__(self):
self.Id = None
self.Loop = None
class DevPipeline(bspump.Pipeline):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class DevApp(bspump.BSPumpApplication):
Expand Down Expand Up @@ -316,12 +315,15 @@ def processor(app, pipeline):
global __bitswan_processors
global __bitswan_dev
global __bitswan_dev_runtime
global __bitswan_current_pipeline
if not __bitswan_dev:
__bitswan_processors.append(func)
else:
processor = func(__bitswan_dev_runtime.dev_app, AsabObjMocker())

callable_process = partial(processor.process, None)
pipeline = DevPipeline(
app=__bitswan_dev_runtime.dev_app, id=__bitswan_current_pipeline
)
processor = func(__bitswan_dev_runtime.dev_app, pipeline)
callable_process = partial(processor.process, processor)
__bitswan_dev_runtime.step(func.__name__, callable_process)


Expand All @@ -338,12 +340,15 @@ async def _fn():
global __bitswan_processors
global __bitswan_dev
global __bitswan_dev_runtime
global __bitswan_current_pipeline
if not __bitswan_dev:
# TODO: check this
__bitswan_processors.append(func)
else:
app, pipeline = __bitswan_dev_runtime.dev_app, AsabObjMocker()
generator = func(app, pipeline)
pipeline = DevPipeline(
__bitswan_dev_runtime.dev_app, __bitswan_current_pipeline
)
generator = func(__bitswan_dev_runtime.app, pipeline)

async def asfunc(inject, event):
async def super_inject(context, event, depth):
Expand Down

0 comments on commit 2531c97

Please sign in to comment.