Skip to content

Commit

Permalink
Fix pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pfayolle committed Nov 13, 2023
1 parent 937b13c commit 4f21abb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def str_to_bool(string):
return False


def bytes_to_list_str(byte_data):
def bytes_to_list_str(byte_data) -> str:
"""Converts an iterable containing bytes to a string representation, using a list format"""
size = len(byte_data)
if BYTE_DATA_MAX_LEN:
byte_data = byte_data[0:BYTE_DATA_MAX_LEN]
Expand All @@ -57,7 +58,11 @@ def bytes_to_list_str(byte_data):
res += "]"
return res

def bytes_to_hexdump_str(byte_data):
def bytes_to_hexdump_str(byte_data) -> str:
"""
Converts an iterable containing bytes to a string representation
using a hexadecimal dump format
"""
offset = 0
size = len(byte_data)
if BYTE_DATA_MAX_LEN != 0 and BYTE_DATA_MAX_LEN < size:
Expand Down Expand Up @@ -154,6 +159,7 @@ def get_common_info_str(metric):
res = res + "\n\tproperties: None"
return res


def get_metric_str(metric) -> str:
"""Return a string describing metric if it is known to Device"""
value_str: str = get_typed_value_str(metric.datatype, metric)
Expand All @@ -163,7 +169,7 @@ def get_metric_str(metric) -> str:

@cmd2.with_default_category('Enki')
class SPShell(cmd2.Cmd):
# pylint: disable=too-many-instance-attributes, too-many-public-methods
# pylint: disable=too-many-instance-attributes, too-many-public-methods, global-statement
"""Enki Shell Interface"""

def __init__(self, mqtt_if: MQTTInterface):
Expand All @@ -178,7 +184,8 @@ def __init__(self, mqtt_if: MQTTInterface):
)
self.byte_data_max_len = BYTE_DATA_MAX_LEN
self.add_settable(
cmd2.Settable("byte_data_max_len", int, "Maximum number of bytes to display for byte data",
cmd2.Settable("byte_data_max_len", int,
"Maximum number of bytes to display for byte data",
self, onchange_cb=self._on_change_byte_data_max_len)
)

Expand Down

0 comments on commit 4f21abb

Please sign in to comment.