Skip to content

Commit

Permalink
Cleanup pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
uzlonewolf committed May 26, 2024
1 parent 2360fa3 commit c1f6e07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tinytuya/BulbDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def _hexvalue_to_rgb(hexvalue, bulb="A"):
r = int(hexvalue[0:2], 16)
g = int(hexvalue[2:4], 16)
b = int(hexvalue[4:6], 16)
if bulb == "B":
elif bulb == "B":
# hexvalue is in hsv
h = float(int(hexvalue[0:4], 16) / 360.0)
s = float(int(hexvalue[4:8], 16) / 1000.0)
Expand All @@ -191,6 +191,9 @@ def _hexvalue_to_rgb(hexvalue, bulb="A"):
r = int(rgb[0] * 255)
g = int(rgb[1] * 255)
b = int(rgb[2] * 255)
else:
# should we raise an error instead?
r = g = b = 0

return (r, g, b)

Expand Down
3 changes: 2 additions & 1 deletion tinytuya/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
pass

for clib in ('pyca/cryptography', 'PyCryptodomex', 'PyCrypto', 'pyaes'):
Crypto = AES = CRYPTOLIB = None
Crypto = Crypto_modes = AES = CRYPTOLIB = None
try:
if clib == 'pyca/cryptography': # https://cryptography.io/en/latest/
from cryptography import __version__ as Crypto_version
Expand Down Expand Up @@ -524,6 +524,7 @@ def unpack_message(data, hmac_key=None, header=None, no_retcode=False):
retcode = 0 if not retcode_len else struct.unpack(MESSAGE_RETCODE_FMT, data[header_len:header_len+retcode_len])[0]
payload = data[header_len+retcode_len:msg_len]
crc, suffix = struct.unpack(end_fmt, payload[-end_len:])
crc_good = False
payload = payload[:-end_len]

if header.prefix == PREFIX_55AA_VALUE:
Expand Down

0 comments on commit c1f6e07

Please sign in to comment.