J08nY / pyecsca

Consider decorating method with @staticmethod PYL-R0201
Performance
Major
3 months ago3 years old
Method doesn't use the class instance and could be converted into a static method
137    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}.")
Method doesn't use the class instance and could be converted into a static method
 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
Method doesn't use the class instance and could be converted into a static method
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):
Method doesn't use the class instance and could be converted into a static method
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):
Method doesn't use the class instance and could be converted into a static method
 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