diff --git a/.github/workflows/pymoose.yml b/.github/workflows/pymoose.yml index fd29bb9bf2..937e2bffe8 100644 --- a/.github/workflows/pymoose.yml +++ b/.github/workflows/pymoose.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8] + python-version: [3.7, 3.8, 3.9, '3.10'] steps: - uses: actions/checkout@v2 diff --git a/python/moose/utils.py b/python/moose/utils.py index f5d4fad362..37c99bf4d7 100644 --- a/python/moose/utils.py +++ b/python/moose/utils.py @@ -6,9 +6,7 @@ from __future__ import absolute_import import types -import parser import token -import symbol import math from datetime import datetime from collections import defaultdict @@ -225,49 +223,6 @@ def apply_to_tree(moose_wildcard, python_filter=None, value=None): ) -def tweak_field(moose_wildcard, field, assignment_string): - """Tweak a specified field of all objects that match the - moose_wildcard using assignment string. All identifiers in - assignment string must be fields of the target object. - - Example: - - tweak_field('/mycell/##[Class=Compartment]', 'Rm', '1.5 / (3.1416 * diameter * length') - - will assign Rm to every compartment in mycell such that the - specific membrane resistance is 1.5 Ohm-m2. - """ - if not isinstance(moose_wildcard, str): - raise TypeError("moose_wildcard must be a string.") - id_list = moose.getWildcardList(moose_wildcard, True) - expression = parser.expr(assignment_string) - expr_list = expression.tolist() - # This is a hack: I just tried out some possible syntax trees and - # hand coded the replacement such that any identifier is replaced - # by moose_obj.identifier - def replace_fields_with_value(x): - if len(x) > 1: - if ( - x[0] == symbol.power - and x[1][0] == symbol.atom - and x[1][1][0] == token.NAME - ): - field = x[1][1][1] - x[1] = [symbol.atom, [token.NAME, "moose_obj"]] - x.append([symbol.trailer, [token.DOT, "."], [token.NAME, field]]) - for item in x: - if isinstance(item, list): - replace_fields_with_value(item) - return x - - tmp = replace_fields_with_value(expr_list) - new_expr = parser.sequence2st(tmp) - code = new_expr.compile() - for moose_id in id_list: - moose_obj = eval("moose.%s(moose_id)" % (moose.Neutral(moose_id).className)) - value = eval(code) - moose.setField(moose_id, field, str(value)) - # 2012-01-11 19:20:39 (+0530) Subha: checked for compatibility with dh_branch def printtree(root, vchar="|", hchar="__", vcount=1, depth=0, prefix="", is_last=False): diff --git a/setup.py b/setup.py index e4c9babd85..a51bb62875 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ numCores_ = multiprocessing.cpu_count() -version_ = '3.3.0.dev%s' % stamp +version_ = '4.0.0.dev%s' % stamp # importlib is available only for python3. Since we build wheels, prefer .so # extension. This way a wheel built by any python3.x will work with any python3.