KOSASIH / Galactic-Chain

Consider decorating method with @staticmethod PYL-R0201
Performance
Major
4 months ago4 months old
Method doesn't use the class instance and could be converted into a static method
37        y = int(y, 16)
38        return self.curve.point(x, y)
39
40    def encode_point(self, point):41        x = format(point.x, "x")
42        y = format(point.y, "x")
43        return f"{x},{y}"
Method doesn't use the class instance and could be converted into a static method
46        return {"transaction": transaction.to_dict()}
47
48class EllipticCurveAPI(Resource):
49    def post(self):50        # Perform elliptic curve operation
51        operation = request.json["operation"]
52        params = request.json["params"]
Method doesn't use the class instance and could be converted into a static method
40        transaction = ai_contract_engine.create_transaction(sender, recipient, amount)
41        return {"transaction": transaction.to_dict()}
42
43    def get(self, transaction_id):44        # Get transaction details
45        transaction = ai_contract_engine.get_transaction(transaction_id)
46        return {"transaction": transaction.to_dict()}
Method doesn't use the class instance and could be converted into a static method
32        return {"contract": contract.to_dict()}
33
34class TransactionAPI(Resource):
35    def post(self):36        # Create new transaction
37        sender = request.json["sender"]
38        recipient = request.json["recipient"]
Method doesn't use the class instance and could be converted into a static method
26        ai_contract_engine.deploy_contract(contract_code, contract_name)
27        return {"message": f"Contract {contract_name} deployed successfully"}
28
29    def get(self, contract_name):30        # Get contract details
31        contract = ai_contract_engine.get_contract(contract_name)
32        return {"contract": contract.to_dict()}