@staticmethod
PYL-R0201137 def assumptions_str(self):
138 return [unparse(assumption)[1:-2] for assumption in self.assumptions]
139
140 def __validate_params(self, field, params):141 for key, value in params.items():
142 if not isinstance(value, Mod) or value.n != field:
143 raise ValueError(f"Wrong param input {key} = {value}.")
23 self.graph = graph
24 self.operator = None
25
26 def verify_chain(self, nodes: List[CodeOpNode]): 27 for i, node in enumerate(nodes[:-1]):
28 if node.outgoing_nodes != [nodes[i + 1]]:
29 raise BadFliparoo
112 else:
113 return None
114
115 def __to_op(116 self, op: Optional[Union[ast_operator, ast_unaryop]], left: Any, right: Any
117 ) -> OpType:
118 if isinstance(op, Mult):
104 self.constants = frozenset(constants)
105 self.compiled = compile(self.code, "", mode="exec")
106
107 def __to_name(self, node):108 if isinstance(node, Name):
109 return node.id
110 elif isinstance(node, Constant):
64 else:
65 self.__read_curve_file(self.__class__, file_path)
66
67 def __read_curve_file(self, cls, file_path: Traversable): 68 def format_eq(line, mode="exec"):
69 return parse(line.replace("^", "**"), mode=mode)
70
The method doesn't use its bound instance. Decorate this method with @staticmethod
decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.