From 591f6dc008173d3b920adf8a831dcd4363138518 Mon Sep 17 00:00:00 2001 From: Ryan Spangler Date: Fri, 20 Dec 2024 15:23:18 -0800 Subject: [PATCH] adding methods to Edge --- bigraph_schema/edge.py | 25 ++++++++++++++++++++++++- bigraph_schema/type_system.py | 8 ++++---- setup.py | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/bigraph_schema/edge.py b/bigraph_schema/edge.py index daa9d2b..16b32a5 100644 --- a/bigraph_schema/edge.py +++ b/bigraph_schema/edge.py @@ -7,10 +7,33 @@ """ class Edge: - def __init__(self): + config_schema = {} + + + def __init__(self, config=None, core=None): + if core is None: + raise Exception('must provide a core') + + self.core = core + + if config is None: + config = {} + + self.config = self.core.fill( + self.config_schema, + config) + + self.initialize(self.config) + + + def initialize(self): pass + def initial_state(self): + return {} + + def inputs(self): return {} diff --git a/bigraph_schema/type_system.py b/bigraph_schema/type_system.py index e379d1c..5ff0c95 100644 --- a/bigraph_schema/type_system.py +++ b/bigraph_schema/type_system.py @@ -120,14 +120,14 @@ def __init__(self): register_base_reactions(self) - def register_types(core, type_library): + def register_types(self, type_library): for type_key, type_data in type_library.items(): - if not core.exists(type_key): - core.register( + if not self.exists(type_key): + self.register( type_key, type_data) - return core + return self def lookup(self, type_key, attribute): diff --git a/setup.py b/setup.py index 70ef680..9cfee27 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -VERSION = '0.0.47' +VERSION = '0.0.48' with open("README.md", "r") as readme: