KOSASIH / HealthGuard-Refugee-Initiative

Re-definition found for builtin function PYL-W0622
Anti-pattern
Major
5 months ago5 months old
Redefining built-in 'hash'
30def create_new_block(previous_block, data):
31    index = previous_block.index + 1
32    timestamp = datetime.datetime.now()
33    hash = calculate_hash(index, previous_block.previous_hash, timestamp, data)34    return Block(index, previous_block.previous_hash, timestamp, data, hash)
35
36
Redefining built-in 'hash'
 4
 5
 6class Block:
 7    def __init__(self, index, previous_hash, timestamp, data, hash): 8        self.index = index
 9        self.previous_hash = previous_hash
10        self.timestamp = timestamp
Redefining built-in 'hash'
 37    previous_block = get_previous_block(blockchain)
 38    index = previous_block.index + 1
 39    timestamp = int(time.time())
 40    hash = calculate_hash(index, previous_block.previous_hash, timestamp, data) 41    block = Block(index, previous_block.previous_hash, timestamp, data, hash)
 42    blockchain.append(block)
 43
Redefining built-in 'hash'
  6
  7
  8class Block:
  9    def __init__(self, index, previous_hash, timestamp, data, hash): 10        self.index = index
 11        self.previous_hash = previous_hash
 12        self.timestamp = timestamp