KOSASIH / Galactic-Chain

Re-definition found for builtin function PYL-W0622
Anti-pattern
Major
4 months ago4 months old
26            return self.encode_point(result)
27        elif operation == "hash":
28            message = params["message"]
29            hash = hashlib.sha256(message.encode()).digest()30            return hash.hex()
31        else:
32            raise ValueError("Invalid operation")
Redefining built-in 'hash'
 8        # Store data in IPFS
 9        pass
10
11    def retrieve_data(self, hash):12        # Retrieve data from IPFS
13        pass
Redefining built-in 'hash'
14
15    def test_calculate_hash(self):
16        block = {"index": 1, "timestamp": 1643723400, "data": "", "previous_hash": "0", "hash": ""}
17        hash = self.blockchain.calculate_hash(block)18        self.assertIsNotNone(hash)
19        self.assertEqual(len(hash), 64)
20