Skip to content

Commit 0deb291

Browse files
author
Dilawar Singh
committed
Incremental change. Dynamic attributes.
1 parent 7f2539c commit 0deb291

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

python/moose/moose.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ def __init__(self, path, ndata=1):
3737
def __repr__(self):
3838
return self.__repr__()
3939

40+
def __setattr__(self, attr, val):
41+
self.setField(attr, val)
42+
43+
def __getattr__(self, attr):
44+
return super(__Neutral__, self).getField(attr)
45+
4046

4147
for p in _cmoose.wildcardFind('/##[TYPE=Cinfo]'):
4248
# create a class.
@@ -75,8 +81,6 @@ def wildcardFind(pattern):
7581
return paths
7682

7783
def delete(a):
78-
if hasattr(a, 'cobj'):
79-
return moose._cmoose.delete(a.cobj)
8084
return moose._cmoose.delete(a)
8185

8286
def element(pathOrObject):

tests/pybind11/test_shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def makereac2():
210210
pools[6] = tot1 = moose.BufPool(kin.path+"/tot1")
211211

212212
sum = moose.Function(tot1.path + "/func")
213-
# sum.expr = "x0+x1"
214-
sum.setField("expr", "x0+x1")
213+
sum.expr = "x0+x1"
214+
# sum.setField("expr", "x0+x1")
215215

216216
e1Pool = moose.Pool(kin.path + "/e1Pool")
217217
e2Pool = moose.Pool(kin.path + "/e2Pool")

0 commit comments

Comments
 (0)