Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print("Reader stopping...")
self.running = False
if self.file is not None:
self.file.close()
if type(source) != int:
source.close()
if self.hid is not None:
if type(self.hid) != int:
self.hid.close()
if system_platform != "Windows":
try:
hidapi.hid_close(source)
except Exception:
pass
try:
hidapi.hid_exit()
except Exception:
pass
print("Reader stopped...")
self.stopped = True
return
print("Reader stopping...")
self.running = False
if self.file is not None:
self.file.close()
if type(source) != int and type(source) != list:
source.close()
if self.hid is not None:
if type(self.hid) != int:
self.hid.close()
if system_platform != "Windows":
try:
hidapi.hid_close(source)
except Exception:
pass
try:
hidapi.hid_exit()
except Exception:
pass
print("Reader stopped...")
self.stopped = True
return