Code Quality #2187

Merged
anand-skss merged 1 commits from code-quality into v0.6 2024-02-29 04:26:41 +01:00
3 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ def generate_hash(string):
try: try:
# make input case insensitive # make input case insensitive
string = str.lower(string) string = str.lower(string)
hash_object = hashlib.md5(str.encode(string)) # nosec B303 hash_object = hashlib.md5(str.encode(string)) # nosec B303, B324
print(hash_object.hexdigest()) print(hash_object.hexdigest())
# returned object is a hex string # returned object is a hex string
return hash_object.hexdigest() return hash_object.hexdigest()

View File

@ -521,8 +521,8 @@ class singleWorker(StoppableThread):
inventoryHash = calculateInventoryHash(payload) inventoryHash = calculateInventoryHash(payload)
Inventory()[inventoryHash] = ( Inventory()[inventoryHash] = (
objectType, streamNumber, buffer(payload), objectType, streamNumber, buffer(payload), # noqa: F821
embeddedTime, buffer(tag) embeddedTime, buffer(tag) # noqa: F821
) )
self.logger.info( self.logger.info(
'sending inv (within sendOnionPeerObj function) for object: %s', 'sending inv (within sendOnionPeerObj function) for object: %s',

View File

@ -413,7 +413,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
try: try:
self.object.checkObjectByType() self.object.checkObjectByType()
objectProcessorQueue.put(( objectProcessorQueue.put((
self.object.objectType, buffer(self.object.data))) self.object.objectType, buffer(self.object.data))) # noqa: F821
except BMObjectInvalidError: except BMObjectInvalidError:
BMProto.stopDownloadingObject(self.object.inventoryHash, True) BMProto.stopDownloadingObject(self.object.inventoryHash, True)
else: else:
@ -429,8 +429,8 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
Inventory()[self.object.inventoryHash] = ( Inventory()[self.object.inventoryHash] = (
self.object.objectType, self.object.streamNumber, self.object.objectType, self.object.streamNumber,
buffer(self.payload[objectOffset:]), self.object.expiresTime, buffer(self.payload[objectOffset:]), self.object.expiresTime, # noqa: F821
buffer(self.object.tag) buffer(self.object.tag) # noqa: F821
) )
self.handleReceivedObject( self.handleReceivedObject(
self.object.streamNumber, self.object.inventoryHash) self.object.streamNumber, self.object.inventoryHash)