MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / __split_formula_and_value

Method __split_formula_and_value

python/pymesh/wires/Parameters.py:140–156  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

138 self.raw_parameters.set_thickness_type(thickness_type)
139
140 def __split_formula_and_value(self, data):
141 formula_matcher = re.compile("{(.*)}")
142 if isinstance(data, (str, unicode)):
143 try:
144 value = float(data)
145 formula = ""
146 except ValueError:
147 value = 0.0
148 result = formula_matcher.match(data)
149 assert(result is not None)
150 formula = result.group(1)
151 elif isinstance(data, (float, int)):
152 value = float(data)
153 formula = ""
154 else:
155 raise TypeError("Cannot split formula and value: {}".format(data))
156 return str(formula), value
157
158 def __load_json(self, json_file):
159 with open(json_file, 'r') as fin:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected