bigraph-schema 0.0.50__tar.gz → 0.0.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bigraph-schema might be problematic. Click here for more details.

Files changed (21) hide show
  1. {bigraph-schema-0.0.50/bigraph_schema.egg-info → bigraph-schema-0.0.51}/PKG-INFO +1 -1
  2. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/type_functions.py +2 -1
  3. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/type_system.py +40 -5
  4. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51/bigraph_schema.egg-info}/PKG-INFO +1 -1
  5. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/setup.py +1 -1
  6. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/AUTHORS.md +0 -0
  7. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/LICENSE +0 -0
  8. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/README.md +0 -0
  9. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/__init__.py +0 -0
  10. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/edge.py +0 -0
  11. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/parse.py +0 -0
  12. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/protocols.py +0 -0
  13. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/registry.py +0 -0
  14. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/type_system_tests.py +0 -0
  15. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/units.py +0 -0
  16. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema/utilities.py +0 -0
  17. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema.egg-info/SOURCES.txt +0 -0
  18. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema.egg-info/dependency_links.txt +0 -0
  19. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema.egg-info/requires.txt +0 -0
  20. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/bigraph_schema.egg-info/top_level.txt +0 -0
  21. {bigraph-schema-0.0.50 → bigraph-schema-0.0.51}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.50
3
+ Version: 0.0.51
4
4
  Summary: A serializable type schema for compositional systems biology
5
5
  Home-page: https://github.com/vivarium-collective/bigraph-schema
6
6
  Author: Eran Agmon, Ryan Spangler
@@ -2517,7 +2517,8 @@ registry_types = {
2517
2517
  'quote': {
2518
2518
  '_type': 'quote',
2519
2519
  '_generate': generate_quote,
2520
- '_sort': sort_quote},
2520
+ '_sort': sort_quote,
2521
+ '_description': 'protect a schema from generation, ie in the config for a nested composite which has type information we only want to evaluate inside of the composite'},
2521
2522
 
2522
2523
  'tuple': {
2523
2524
  '_type': 'tuple',
@@ -603,20 +603,34 @@ class TypeSystem(Registry):
603
603
  return validation
604
604
 
605
605
 
606
- def representation(self, schema, level=None):
606
+ def representation(self, schema, path=None, parents=None):
607
607
  '''
608
608
  produce a string representation of the schema
609
609
  * intended to be the inverse of parse_expression()
610
610
  '''
611
611
 
612
612
 
613
+ path = path or []
614
+ parents = parents or []
615
+ schema_id = id(schema)
616
+
617
+ if schema_id in parents:
618
+ index = parents.index(schema_id)
619
+ reference = path[:index]
620
+ output = '/'.join(reference)
621
+
622
+ return f'/{output}'
623
+
613
624
  if isinstance(schema, str):
614
625
  return schema
615
626
 
616
627
  elif isinstance(schema, tuple):
617
628
  inner = [
618
- self.representation(element)
619
- for element in schema]
629
+ self.representation(
630
+ element,
631
+ path + [index],
632
+ parents + [schema_id])
633
+ for index, element in enumerate(schema)]
620
634
 
621
635
  pipes = '|'.join(inner)
622
636
  return f'({pipes})'
@@ -632,7 +646,9 @@ class TypeSystem(Registry):
632
646
  schema_key = f'_{parameter_key}'
633
647
  if schema_key in schema:
634
648
  parameter = self.representation(
635
- schema[schema_key])
649
+ schema[schema_key],
650
+ path + [schema_key],
651
+ parents + [schema_id])
636
652
  inner.append(parameter)
637
653
  else:
638
654
  inner.append('()')
@@ -650,7 +666,9 @@ class TypeSystem(Registry):
650
666
  inner = {}
651
667
  for key in non_schema_keys(schema):
652
668
  subschema = self.representation(
653
- schema[key])
669
+ schema[key],
670
+ path + [key],
671
+ parents + [schema_id])
654
672
 
655
673
  inner[key] = subschema
656
674
 
@@ -1987,6 +2005,23 @@ class TypeSystem(Registry):
1987
2005
  return top_schema, top_state
1988
2006
 
1989
2007
 
2008
+ def wire_schema(self, schema, wires, path=None):
2009
+ outcome = {}
2010
+ path = path or []
2011
+
2012
+ if isinstance(wires, dict):
2013
+ for key, subwires in wires.items():
2014
+ outcome[key] = self.wire_schema(
2015
+ schema,
2016
+ wires[key],
2017
+ path + [key])
2018
+
2019
+ else:
2020
+ _, outcome = self.slice('schema', schema, wires)
2021
+
2022
+ return outcome
2023
+
2024
+
1990
2025
  def hydrate(self, schema, state):
1991
2026
  hydrated = self.deserialize(schema, state)
1992
2027
  return self.fill(schema, hydrated)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.50
3
+ Version: 0.0.51
4
4
  Summary: A serializable type schema for compositional systems biology
5
5
  Home-page: https://github.com/vivarium-collective/bigraph-schema
6
6
  Author: Eran Agmon, Ryan Spangler
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
 
4
- VERSION = '0.0.50'
4
+ VERSION = '0.0.51'
5
5
 
6
6
 
7
7
  with open("README.md", "r") as readme:
File without changes