bigraph-schema 0.0.57__tar.gz → 0.0.59__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 (35) hide show
  1. bigraph-schema-0.0.59/.github/workflows/notebook_to_html.yml +48 -0
  2. bigraph-schema-0.0.59/.github/workflows/pytest.yml +29 -0
  3. bigraph-schema-0.0.59/.gitignore +14 -0
  4. bigraph-schema-0.0.59/CLA.md +113 -0
  5. bigraph-schema-0.0.59/CODE_OF_CONDUCT.md +137 -0
  6. bigraph-schema-0.0.59/CONTRIBUTING.md +44 -0
  7. {bigraph-schema-0.0.57/bigraph_schema.egg-info → bigraph-schema-0.0.59}/PKG-INFO +1 -1
  8. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/parse.py +2 -2
  9. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/registry.py +46 -0
  10. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/tests.py +48 -0
  11. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/type_functions.py +3 -0
  12. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/type_system.py +50 -18
  13. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59/bigraph_schema.egg-info}/PKG-INFO +1 -1
  14. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema.egg-info/SOURCES.txt +15 -1
  15. bigraph-schema-0.0.59/notebooks/core.ipynb +1683 -0
  16. bigraph-schema-0.0.59/notebooks/demo.ipynb +1487 -0
  17. bigraph-schema-0.0.59/notebooks/images/place-link.png +0 -0
  18. bigraph-schema-0.0.59/notebooks/images/reaction-after.png +0 -0
  19. bigraph-schema-0.0.59/notebooks/images/reaction-before.png +0 -0
  20. bigraph-schema-0.0.59/notebooks/images/redex-reactum.png +0 -0
  21. bigraph-schema-0.0.59/pytest.ini +4 -0
  22. bigraph-schema-0.0.59/release.sh +43 -0
  23. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/setup.py +1 -1
  24. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/AUTHORS.md +0 -0
  25. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/LICENSE +0 -0
  26. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/README.md +0 -0
  27. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/__init__.py +0 -0
  28. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/edge.py +0 -0
  29. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/protocols.py +0 -0
  30. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/units.py +0 -0
  31. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema/utilities.py +0 -0
  32. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema.egg-info/dependency_links.txt +0 -0
  33. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema.egg-info/requires.txt +0 -0
  34. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/bigraph_schema.egg-info/top_level.txt +0 -0
  35. {bigraph-schema-0.0.57 → bigraph-schema-0.0.59}/setup.cfg +0 -0
@@ -0,0 +1,48 @@
1
+ name: Convert Jupyter Notebook to HTML
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - 'notebooks/demo.ipynb'
7
+ - 'notebooks/core.ipynb'
8
+
9
+ jobs:
10
+ convert:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out repository
14
+ uses: actions/checkout@main
15
+ with:
16
+ ref: main
17
+ fetch-depth: 0 # Fetch all history to have access to the gh-pages branch
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@main
21
+ with:
22
+ python-version: 3.x
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install nbconvert
28
+
29
+ - name: Convert Jupyter Notebook to HTML
30
+ run: |
31
+ jupyter nbconvert --to html notebooks/demo.ipynb
32
+ jupyter nbconvert --to html notebooks/core.ipynb
33
+
34
+ - name: Commit and push HTML to gh-pages branch
35
+ run: |
36
+ git config --local user.email "eagmon@github.com"
37
+ git config --local user.name "GitHub Action"
38
+ git fetch origin
39
+ mv notebooks/demo.html /tmp/demo.html
40
+ mv notebooks/core.html /tmp/core.html
41
+ git checkout gh-pages || git checkout -b gh-pages
42
+ git pull origin gh-pages
43
+ mv /tmp/demo.html notebooks/demo.html
44
+ mv /tmp/core.html notebooks/core.html
45
+ git add notebooks/demo.html
46
+ git add notebooks/core.html
47
+ git diff-index --quiet HEAD || git commit -m "Update HTML files"
48
+ git push origin gh-pages || true
@@ -0,0 +1,29 @@
1
+ name: Run Pytest
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Check out repository
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v2
17
+ with:
18
+ python-version: 3.x
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install pytest pytest-cov
24
+ pip install -e .
25
+
26
+ - name: Run pytest
27
+ run: |
28
+ pip install pytest
29
+ pytest --cov=bigraph_schema --cov-report=term
@@ -0,0 +1,14 @@
1
+ *.out
2
+ out/
3
+ .idea/
4
+ *-checkpoint.ipynb
5
+ __pycache__
6
+ .DS_Store
7
+ .DS_Store?
8
+ ._*
9
+ .python-version
10
+ .pytest_cache
11
+ lib/
12
+ *.ipynb_checkpoints/
13
+ dist/
14
+ bigraph_schema.egg-info/
@@ -0,0 +1,113 @@
1
+ # Individual Contributor License Agreement
2
+
3
+ Thank you for your interest in Vivarium Core. To clarify the
4
+ intellectual property license granted with Contributions from any person
5
+ or entity, each Contribution must indicate each Contributor's agreement
6
+ with the license terms below. This agreement is for your protection as a
7
+ Contributor as well as the protection of the Vivarium Core authors
8
+ (Authors) and Vivarium Core's users. It does not change your rights to
9
+ use your own Contributions for any other purpose.
10
+
11
+ You accept and agree to the following terms and conditions for Your
12
+ Contributions (present and future) that you submit to the Authors.
13
+ Except for the license granted herein to the Authors and recipients of
14
+ software distributed by the Authors, You reserve all right, title, and
15
+ interest in and to Your Contributions.
16
+
17
+ 1. Definitions
18
+
19
+ "You" (or "Your") shall mean the copyright owner or legal entity
20
+ authorized by the copyright owner that is making this Agreement with
21
+ the Authors. For legal entities, the entity making a Contribution and
22
+ all other entities that control, are controlled by, or are under
23
+ common control with that entity are considered to be a single
24
+ Contributor. For the purposes of this definition, "control" means (i)
25
+ the power, direct or indirect, to cause the direction or management
26
+ of such entity, whether by contract or otherwise, or (ii) ownership
27
+ of fifty percent (50%) or more of the outstanding shares, or (iii)
28
+ beneficial ownership of such entity.
29
+
30
+ "Contribution" shall mean any original work of authorship, including
31
+ any modifications or additions to an existing work, that is
32
+ intentionally submitted by You to the Authors for inclusion in, or
33
+ documentation of, any of the products owned or managed by the Authors
34
+ (the "Work"). For the purposes of this definition, "submitted" means
35
+ any form of electronic, verbal, or written communication sent to the
36
+ Authors or their representatives, including but not limited to
37
+ communication on electronic mailing lists, source code control
38
+ systems, and issue tracking systems that are managed by, or on behalf
39
+ of, the Authors for the purpose of discussing and improving the Work,
40
+ but excluding communication that is conspicuously marked or otherwise
41
+ designated in writing by You as "Not a Contribution."
42
+
43
+ 2. Grant of Copyright License. Subject to the terms and conditions of
44
+ this Agreement, You hereby grant to the Authors and to recipients
45
+ of software distributed by the Authors a perpetual, worldwide,
46
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license
47
+ to reproduce, prepare derivative works of, publicly display, publicly
48
+ perform, sublicense, and distribute Your Contributions and such
49
+ derivative works.
50
+
51
+ 3. Grant of Patent License. Subject to the terms and conditions of this
52
+ Agreement, You hereby grant to the Authors and to recipients of
53
+ software distributed by the Authors a perpetual, worldwide,
54
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated
55
+ in this section) patent license to make, have made, use, offer to
56
+ sell, sell, import, and otherwise transfer the Work, where such
57
+ license applies only to those patent claims licensable by You that
58
+ are necessarily infringed by Your Contribution(s) alone or by
59
+ combination of Your Contribution(s) with the Work to which such
60
+ Contribution(s) was submitted. If any entity institutes patent
61
+ litigation against You or any other entity (including a cross-claim
62
+ or counterclaim in a lawsuit) alleging that your Contribution, or the
63
+ Work to which you have contributed, constitutes direct or
64
+ contributory patent infringement, then any patent licenses granted to
65
+ that entity under this Agreement for that Contribution or Work shall
66
+ terminate as of the date such litigation is filed.
67
+
68
+ 4. You represent that you are legally entitled to grant the above
69
+ license. If your employer(s) has rights to intellectual property that
70
+ you create that includes your Contributions, you represent that you
71
+ have received permission to make Contributions on behalf of that
72
+ employer, that your employer has waived such rights for your
73
+ Contributions to the Authors, or that your employer has executed a
74
+ separate Corporate CLA with the Authors.
75
+
76
+ 5. You represent that each of Your Contributions is Your original
77
+ creation (see section 7 for submissions on behalf of others). You
78
+ represent that Your Contribution submissions include complete details
79
+ of any third-party license or other restriction (including, but not
80
+ limited to, related patents and trademarks) of which you are
81
+ personally aware and which are associated with any part of Your
82
+ Contributions.
83
+
84
+ 6. You are not expected to provide support for Your Contributions,
85
+ except to the extent You desire to provide support. You may provide
86
+ support for free, for a fee, or not at all. Unless required by
87
+ applicable law or agreed to in writing, You provide Your
88
+ Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
89
+ OF ANY KIND, either express or implied, including, without
90
+ limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT,
91
+ MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
92
+
93
+ 7. Should You wish to submit work that is not Your original creation,
94
+ You may submit it to the Authors separately from any Contribution,
95
+ identifying the complete details of its source and of any license or
96
+ other restriction (including, but not limited to, related patents,
97
+ trademarks, and license agreements) of which you are personally
98
+ aware, and conspicuously marking the work as "Submitted on behalf of
99
+ a third-party: [named here]".
100
+
101
+ 8. You agree to notify the Authors of any facts or circumstances of
102
+ which you become aware that would make these representations
103
+ inaccurate in any respect.
104
+
105
+ -----------------------------------------------------------------------
106
+
107
+ End of Contributor License Agreement
108
+
109
+ -----------------------------------------------------------------------
110
+
111
+ The text of this agreement was adapted from the Apache Software
112
+ Foundation's [Individual Contributor License
113
+ Agreement](https://apache.org/licenses/icla.pdf).
@@ -0,0 +1,137 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in
6
+ our community a harassment-free experience for everyone, regardless of
7
+ age, body size, visible or invisible disability, ethnicity, sex
8
+ characteristics, gender identity and expression, level of experience,
9
+ education, socio-economic status, nationality, personal appearance,
10
+ race, caste, color, religion, or sexual identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open,
13
+ welcoming, diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our
24
+ mistakes, and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political
33
+ attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our
43
+ standards of acceptable behavior and will take appropriate and fair
44
+ corrective action in response to any behavior that they deem
45
+ inappropriate, threatening, offensive, or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or
48
+ reject comments, commits, code, wiki edits, issues, and other
49
+ contributions that are not aligned to this Code of Conduct, and will
50
+ communicate reasons for moderation decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also
55
+ applies when an individual is officially representing the community in
56
+ public spaces. Examples of representing our community include using an
57
+ official e-mail address, posting via an official social media account,
58
+ or acting as an appointed representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may
63
+ be reported to the Authors at the email addresses in
64
+ [`AUTHORS.md`](AUTHORS.md). All complaints will be reviewed and
65
+ investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security
68
+ of the reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in
73
+ determining the consequences for any action they deem in violation of
74
+ this Code of Conduct:
75
+
76
+ ### 1. Correction
77
+
78
+ **Community Impact**: Use of inappropriate language or other behavior
79
+ deemed unprofessional or unwelcome in the community.
80
+
81
+ **Consequence**: A private, written warning from community leaders,
82
+ providing clarity around the nature of the violation and an explanation
83
+ of why the behavior was inappropriate. A public apology may be
84
+ requested.
85
+
86
+ ### 2. Warning
87
+
88
+ **Community Impact**: A violation through a single incident or series of
89
+ actions.
90
+
91
+ **Consequence**: A warning with consequences for continued behavior. No
92
+ interaction with the people involved, including unsolicited interaction
93
+ with those enforcing the Code of Conduct, for a specified period of
94
+ time. This includes avoiding interactions in community spaces as well as
95
+ external channels like social media. Violating these terms may lead to a
96
+ temporary or permanent ban.
97
+
98
+ ### 3. Temporary Ban
99
+
100
+ **Community Impact**: A serious violation of community standards,
101
+ including sustained inappropriate behavior.
102
+
103
+ **Consequence**: A temporary ban from any sort of interaction or public
104
+ communication with the community for a specified period of time. No
105
+ public or private interaction with the people involved, including
106
+ unsolicited interaction with those enforcing the Code of Conduct, is
107
+ allowed during this period. Violating these terms may lead to a
108
+ permanent ban.
109
+
110
+ ### 4. Permanent Ban
111
+
112
+ **Community Impact**: Demonstrating a pattern of violation of community
113
+ standards, including sustained inappropriate behavior, harassment of an
114
+ individual, or aggression toward or disparagement of classes of
115
+ individuals.
116
+
117
+ **Consequence**: A permanent ban from any sort of public interaction
118
+ within the community.
119
+
120
+ ## Attribution
121
+
122
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
123
+ version 2.1, available at
124
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
125
+
126
+ Community Impact Guidelines were inspired by
127
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
128
+
129
+ For answers to common questions about this code of conduct, see the FAQ at
130
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
131
+ [https://www.contributor-covenant.org/translations][translations].
132
+
133
+ [homepage]: https://www.contributor-covenant.org
134
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
135
+ [Mozilla CoC]: https://github.com/mozilla/diversity
136
+ [FAQ]: https://www.contributor-covenant.org/faq
137
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,44 @@
1
+ # Contributing to Bigraph-Schema
2
+
3
+ ## Making a Contribution
4
+
5
+ Thank you for your interest in contributing to Vivarium Core! Here's how
6
+ you can get started:
7
+
8
+ 1. Review the [Contributor License Agreement](CLA.md) (CLA). Whenever
9
+ you submit a contribution to Vivarium Core, you are agreeing to the
10
+ CLA, which grants us rights to use your contribution. You don't need
11
+ to do anything special to "sign" the CLA. Instead, opening a pull
12
+ request indicates your agreement to the CLA.
13
+ 2. [Optional] If you want to make a contribution that isn't covered by
14
+ an existing issue, go ahead an open a new one!
15
+ 3. Once you have found or created an issue that describes the
16
+ contribution you want to make, wait to get feedback from the project
17
+ maintainers.
18
+ 4. If the project maintainers agree that your proposal makes sense, you
19
+ can fork the repository, make your changes, and open a pull request.
20
+ If you haven't done this before, check out [GitHub's guide to open
21
+ source
22
+ contributions](https://docs.github.com/en/get-started/quickstart/contributing-to-projects).
23
+ 5. Wait to get feedback from the project maintainers and then address
24
+ any review comments they leave. Once your pull request is approved,
25
+ the project maintainers will merge it.
26
+
27
+ ## Contacting Us
28
+
29
+ * To request features or report bugs, please open an
30
+ [issue](https://github.com/vivarium-collective/bigraph-schema/issues).
31
+ * To ask questions or request help, please open a [discussion
32
+ thread](https://github.com/vivarium-collective/bigraph-schema/discussions).
33
+ * To contact the maintainers privately, for example to report a
34
+ violation of our [code of conduct](CODE_OF_CONDUCT.md) or to notify us
35
+ of a security issue, you can use the contact information in the
36
+ [`AUTHORS.md` file](AUTHORS.md).
37
+
38
+ ## Code of Conduct
39
+
40
+ We expect kindness and respect in all interactions with the Vivarium
41
+ Collective community. Harassing or insulting behavior is not welcome and will
42
+ result in enforcement actions. Please review our [code of
43
+ conduct](CODE_OF_CONDUCT.md), which describes our expectations and
44
+ enforcement actions in more detail.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.57
3
+ Version: 0.0.59
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
@@ -37,7 +37,7 @@ parameter_grammar = Grammar(
37
37
  nest = symbol colon tree
38
38
  type_name = symbol parameter_list?
39
39
  parameter_list = square_left expression (comma expression)* square_right
40
- symbol = ~r"[\w\d-_/*&^%$#@!`+ ]+"
40
+ symbol = ~r"[\\w\\d-_/*&^%$#@!`+ ]+"
41
41
  dot = "."
42
42
  colon = ":"
43
43
  bar = "|"
@@ -49,7 +49,7 @@ parameter_grammar = Grammar(
49
49
  tilde = "~"
50
50
  not_newline = ~r"[^\\n\\r]"*
51
51
  newline = ~"[\\n\\r]+"
52
- ws = ~"\s*"
52
+ ws = ~r"\\s*"
53
53
  nothing = ""
54
54
  """)
55
55
 
@@ -151,6 +151,52 @@ def set_path(tree, path, value, top=None, cursor=None):
151
151
  return tree
152
152
 
153
153
 
154
+ def set_star_path(tree, path, value, top=None, cursor=()):
155
+ if tree is None:
156
+ tree = {}
157
+ if top is None:
158
+ top = tree
159
+ if path is None or len(path) == 0:
160
+ return tree
161
+ else:
162
+ if isinstance(path, str):
163
+ path = (path,)
164
+
165
+ head = path[0]
166
+ tail = path[1:]
167
+
168
+ if head == '..':
169
+ if len(cursor) == 0:
170
+ raise Exception(
171
+ f'trying to travel above the top of the tree: {path}')
172
+ else:
173
+ return set_star_path(
174
+ top,
175
+ cursor[:-1],
176
+ value)
177
+ elif head == '*':
178
+ for key in value:
179
+ tree[key] = set_star_path(
180
+ {},
181
+ tail,
182
+ value[key],
183
+ cursor=(key,))
184
+ return top
185
+ else:
186
+ if len(tail) == 0:
187
+ tree[head] = value
188
+ return top
189
+ else:
190
+ if head not in tree:
191
+ tree[head] = {}
192
+ return set_star_path(
193
+ tree[head],
194
+ tail,
195
+ value,
196
+ top=top,
197
+ cursor=tuple(cursor) + (head,))
198
+
199
+
154
200
  def transform_path(tree, path, transform):
155
201
  """
156
202
  Given a tree, a path, and a transform (function), mutate the tree by replacing the subtree at the path by whatever
@@ -1861,6 +1861,7 @@ def test_star_path(core):
1861
1861
  'green': 9999.4,
1862
1862
  'yellow': 11,
1863
1863
  'blue': 'umbrella'}}}
1864
+
1864
1865
  # TODO: can you do everything the * is doing here with _path instead?
1865
1866
  nested_path = ['aaa', '*', 'green']
1866
1867
 
@@ -1873,6 +1874,51 @@ def test_star_path(core):
1873
1874
  assert state['ccc'] == 9999.4
1874
1875
 
1875
1876
 
1877
+ def test_star_view_project(core):
1878
+ schema = {
1879
+ 'edges': 'map[edge[view:map[float],project:map[string]]]',
1880
+ 'stores': 'map[map[green:float|yellow:integer|blue:string]]'}
1881
+
1882
+ state = {
1883
+ 'edges': {
1884
+ 'edge': {
1885
+ 'inputs': {
1886
+ 'view': ['..', 'stores', 'aaa', '*', 'green']},
1887
+ 'outputs': {
1888
+ 'project': ['..', 'stores', 'aaa', '*', 'blue']}}},
1889
+ 'stores': {
1890
+ 'aaa': {
1891
+ 'bbb': {
1892
+ 'green': 1.1,
1893
+ 'yellow': 55,
1894
+ 'blue': 'what'},
1895
+ 'ccc': {
1896
+ 'green': 9999.4,
1897
+ 'yellow': 11,
1898
+ 'blue': 'umbrella'}}}}
1899
+
1900
+ edge_path = ['edges', 'edge']
1901
+
1902
+ view = core.view_edge(
1903
+ schema,
1904
+ state,
1905
+ edge_path)
1906
+
1907
+ internal = {
1908
+ 'project': {
1909
+ 'bbb': 'everything',
1910
+ 'ccc': 'inside out'}}
1911
+
1912
+ project = core.project_edge(
1913
+ schema,
1914
+ state,
1915
+ edge_path,
1916
+ internal)
1917
+
1918
+ assert view['view']['bbb'] == state['stores']['aaa']['bbb']['green']
1919
+ assert project['stores']['aaa']['ccc']['blue'] == internal['project']['ccc']
1920
+
1921
+
1876
1922
  def test_set_slice(core):
1877
1923
  float_schema, float_state = core.set_slice(
1878
1924
  'map[float]',
@@ -2483,5 +2529,7 @@ if __name__ == '__main__':
2483
2529
  test_remove_omitted(core)
2484
2530
  test_union_key_error(core)
2485
2531
  test_tree_equivalence(core)
2532
+ test_star_view_project(core)
2533
+
2486
2534
  # test_slice_edge(core)
2487
2535
  # test_complex_wiring(core)
@@ -292,6 +292,9 @@ def apply_list(schema, current, update, top_schema, top_state, path, core):
292
292
  raise Exception(f'trying to apply an update to an existing list, but the update is not a list or of element type:\n update: {update}\n element type: {pf(element_type)}')
293
293
 
294
294
  def apply_map(schema, current, update, top_schema, top_state, path, core=None):
295
+ if update is None:
296
+ return current
297
+
295
298
  if not isinstance(current, dict):
296
299
  raise Exception(f'trying to apply an update to a value that is not a map:\n value: {current}\n update: {update}')
297
300
  if not isinstance(update, dict):
@@ -14,7 +14,7 @@ from pprint import pformat as pf
14
14
  from bigraph_schema import Registry, non_schema_keys, is_schema_key, deep_merge, type_parameter_key
15
15
  from bigraph_schema.parse import parse_expression
16
16
  from bigraph_schema.utilities import union_keys
17
- from bigraph_schema.registry import remove_omitted, set_path, transform_path
17
+ from bigraph_schema.registry import remove_omitted, set_path, transform_path, set_star_path
18
18
 
19
19
  from bigraph_schema.type_functions import (
20
20
  registry_types, base_types, unit_types, register_base_reactions, is_empty, apply_schema, set_apply)
@@ -1366,23 +1366,55 @@ class TypeSystem(Registry):
1366
1366
  state,
1367
1367
  head)
1368
1368
 
1369
- try:
1370
- result_schema, result_state = self.set_slice(
1371
- down_schema,
1372
- down_state,
1373
- tail,
1374
- target_schema,
1375
- target_state,
1376
- defer=defer)
1377
- except Exception as e:
1378
- raise Exception(f'failed to set_slice at path {path}\n{str(e)}')
1369
+ if head == '*':
1370
+ result_schema, result_state = down_schema, down_state
1371
+ for key in down_state:
1372
+ if key in target_state:
1373
+ subtarget_schema, subtarget_state = self.slice(
1374
+ target_schema,
1375
+ target_state,
1376
+ key)
1377
+
1378
+ try:
1379
+ result_schema, result_state = self.set_slice(
1380
+ result_schema,
1381
+ result_state,
1382
+ tail,
1383
+ subtarget_schema,
1384
+ subtarget_state,
1385
+ defer=defer)
1386
+
1387
+ except Exception as e:
1388
+ raise Exception(
1389
+ f'failed to set_slice at path {path}\n{str(e)}')
1379
1390
 
1380
- return self.bind(
1381
- schema,
1382
- state,
1383
- head,
1384
- result_schema,
1385
- result_state)
1391
+ schema, state = self.bind(
1392
+ schema,
1393
+ state,
1394
+ key,
1395
+ result_schema,
1396
+ result_state)
1397
+
1398
+ return schema, state
1399
+
1400
+ else:
1401
+ try:
1402
+ result_schema, result_state = self.set_slice(
1403
+ down_schema,
1404
+ down_state,
1405
+ tail,
1406
+ target_schema,
1407
+ target_state,
1408
+ defer=defer)
1409
+ except Exception as e:
1410
+ raise Exception(f'failed to set_slice at path {path}\n{str(e)}')
1411
+
1412
+ return self.bind(
1413
+ schema,
1414
+ state,
1415
+ head,
1416
+ result_schema,
1417
+ result_state)
1386
1418
 
1387
1419
 
1388
1420
  def serialize(self, schema, state):
@@ -1634,7 +1666,7 @@ class TypeSystem(Registry):
1634
1666
 
1635
1667
  if isinstance(wires, (list, tuple)):
1636
1668
  destination = resolve_path(list(path) + list(wires))
1637
- result = set_path(
1669
+ result = set_star_path(
1638
1670
  result,
1639
1671
  destination,
1640
1672
  states)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.57
3
+ Version: 0.0.59
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,15 @@
1
+ .gitignore
1
2
  AUTHORS.md
3
+ CLA.md
4
+ CODE_OF_CONDUCT.md
5
+ CONTRIBUTING.md
2
6
  LICENSE
3
7
  README.md
8
+ pytest.ini
9
+ release.sh
4
10
  setup.py
11
+ .github/workflows/notebook_to_html.yml
12
+ .github/workflows/pytest.yml
5
13
  bigraph_schema/__init__.py
6
14
  bigraph_schema/edge.py
7
15
  bigraph_schema/parse.py
@@ -16,4 +24,10 @@ bigraph_schema.egg-info/PKG-INFO
16
24
  bigraph_schema.egg-info/SOURCES.txt
17
25
  bigraph_schema.egg-info/dependency_links.txt
18
26
  bigraph_schema.egg-info/requires.txt
19
- bigraph_schema.egg-info/top_level.txt
27
+ bigraph_schema.egg-info/top_level.txt
28
+ notebooks/core.ipynb
29
+ notebooks/demo.ipynb
30
+ notebooks/images/place-link.png
31
+ notebooks/images/reaction-after.png
32
+ notebooks/images/reaction-before.png
33
+ notebooks/images/redex-reactum.png