Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
s-martin committed Apr 25, 2024
1 parent ff33bc1 commit ca906a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
getattr(function_calls, function_name)(function_args)
except:

Check failure on line 31 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.11)

E722 do not use bare 'except'

Check failure on line 31 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.10)

E722 do not use bare 'except'

Check failure on line 31 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.12)

E722 do not use bare 'except'

Check failure on line 31 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.9)

E722 do not use bare 'except'
logger.warning(
"Function " + function_name + " not found in function_calls.py (mapped from button: " + button_string + ")")
"Function " + function_name + " not found in function_calls.py (mapped from button: "
+ button_string + ")")
except KeyError:
logger.warning("Button " + button_string + " not mapped to any function.")
except:

Check failure on line 37 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.11)

E722 do not use bare 'except'

Check failure on line 37 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.10)

E722 do not use bare 'except'

Check failure on line 37 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.12)

E722 do not use bare 'except'

Check failure on line 37 in components/controls/buttons_usb_encoder/buttons_usb_encoder.py

View workflow job for this annotation

GitHub Actions / build (3.9)

E722 do not use bare 'except'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

button_map[button_string] = function_name
button_map[button_string + "_args"] = function_args
print("Button '" + button_string + "' is now mapped to '" + function_name_short + "' with argument '" + str(function_args) + "'")
print("Button '" + button_string + "' is now mapped to '" + function_name_short
+ "' with argument '" + str(function_args) + "'")
break
except KeyboardInterrupt:
continue
Expand Down
4 changes: 2 additions & 2 deletions components/gpio_control/function_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def functionCallBluetoothToggle(self, mode=None):
function_call("{command} -c=bluetoothtoggle -v={value}".format(command=self.playout_control, value=mode), shell=True)

def functionCallTriggerPlayCardId(self, cardid):
function_call("{command} --cardid={value}".format(command=self.rfid_trigger, value = cardid), shell=True)
function_call("{command} --cardid={value}".format(command=self.rfid_trigger, value=cardid), shell=True)

def functionCallTriggerPlayFolder(self, folder):
function_call("{command} --dir={value}".format(command=self.rfid_trigger, value = folder), shell=True)
function_call("{command} --dir={value}".format(command=self.rfid_trigger, value=folder), shell=True)

def getFunctionCall(self, functionName):
self.logger.error('Get FunctionCall: {} {}'.format(functionName, functionName in locals()))
Expand Down
12 changes: 3 additions & 9 deletions scripts/Reader.py.pcsc
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ class Reader:
try:
hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
if hresult != SCARD_S_SUCCESS:
raise error(
'Failed to establish context: ' + \
SCardGetErrorMessage(hresult))
raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult))

try:
hresult, readers = SCardListReaders(hcontext, [])
if hresult != SCARD_S_SUCCESS:
raise error(
'Failed to list readers: ' + \
SCardGetErrorMessage(hresult))
raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult))

readerstates = []
for i in range(len(readers)):
Expand All @@ -57,9 +53,7 @@ class Reader:
finally:
hresult = SCardReleaseContext(hcontext)
if hresult != SCARD_S_SUCCESS:
raise error(
'Failed to release context: ' + \
SCardGetErrorMessage(hresult))
raise error('Failed to release context: ' + SCardGetErrorMessage(hresult))

return (toHexString(response, PACK))

Expand Down

0 comments on commit ca906a6

Please sign in to comment.