Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
681d7a7e
Commit
681d7a7e
authored
Aug 02, 2019
by
Stephan Seitz
Browse files
Forward {find,match,subs,replace} of Assignment to AssignmentCollection
parent
b8203fb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/simp/assignment_collection.py
View file @
681d7a7e
...
...
@@ -362,6 +362,29 @@ class AssignmentCollection:
self
.
sub_expressions
=
[
Assignment
(
k
,
v
)
for
k
,
v
in
sub_expressions_dict
.
items
()]
def
find
(
self
,
*
args
,
**
kwargs
):
return
set
.
union
(
*
[
a
.
find
(
*
args
,
**
kwargs
)
for
a
in
self
.
all_assignments
])
def
match
(
self
,
*
args
,
**
kwargs
):
rtn
=
{}
for
a
in
self
.
all_assignments
:
partial_result
=
a
.
match
(
*
args
,
**
kwargs
)
if
partial_result
:
rtn
.
update
(
partial_result
)
return
rtn
def
subs
(
self
,
*
args
,
**
kwargs
):
return
AssignmentCollection
(
main_assignments
=
[
a
.
subs
(
*
args
,
**
kwargs
)
for
a
in
self
.
main_assignments
],
subexpressions
=
[
a
.
subs
(
*
args
,
**
kwargs
)
for
a
in
self
.
subexpressions
]
)
def
replace
(
self
,
*
args
,
**
kwargs
):
return
AssignmentCollection
(
main_assignments
=
[
a
.
replace
(
*
args
,
**
kwargs
)
for
a
in
self
.
main_assignments
],
subexpressions
=
[
a
.
replace
(
*
args
,
**
kwargs
)
for
a
in
self
.
subexpressions
]
)
class
SymbolGen
:
"""Default symbol generator producing number symbols ζ_0, ζ_1, ..."""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment