From f015da39b003911694e979b333b33d50d5d5ea04 Mon Sep 17 00:00:00 2001 From: Mayank Patibandla <34776435+mayankpatibandla@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:51:03 -0400 Subject: [PATCH] Fixed some errors --- .pylintrc | 5 ++--- pros/common/utils.py | 2 +- pros/conductor/project/ProjectTransaction.py | 1 - pros/conductor/project/__init__.py | 2 +- pros/ga/analytics.py | 2 +- pros/serial/devices/vex/crc.py | 2 +- pros/serial/devices/vex/v5_device.py | 5 ++--- pros/serial/ports/__init__.py | 2 +- 8 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.pylintrc b/.pylintrc index 16e8f317..5a21d69f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,10 +1,9 @@ [MASTER] max-line-length = 120 - -disable = C0114, C0115, C0116, R0903, C0415, R1705, R0913, W1203, R1729, E1120, E1123, C0209, R1710, W0621, C0121, +disable = C0114, C0115, C0116, R0903, C0415, R1705, R0913, W1203, R1729, E1120, E1123, C0209, R1710, W0621, C0121, W0614, W0401, W1202, C0117, W0718, R0205, R0402, R0914, R1725, R1735, C0411, W0237, W0702, W0223, W0613, W0108, R0912, R0911, W0511, E1136, R0902, W0611, C0412, C0103, C0301, R1732, R0915, W1514, R1718, W1510, E0602, W1309, C0325, E1101, R1714, R0916, W0719, R1734, E1133, W1201, W0107, W3101, W0640, C0201, W1113, W0246, W0622, W0221, E1111, R1720, W0221, R1723, E0102, W0201, E0203, E0401, W0602, W0212, W0707, R0904, - W0101, C0302, E0110, W0603, R1701, W0106, R1721 + W0101, C0302, E0110, W0603, R1701, W0106, R1721, W0601, diff --git a/pros/common/utils.py b/pros/common/utils.py index 294da89f..d74d9a2d 100644 --- a/pros/common/utils.py +++ b/pros/common/utils.py @@ -35,7 +35,7 @@ def get_version(): module = pros.cli.main.__name__ for dist in pkg_resources.working_set: scripts = dist.get_entry_map().get('console_scripts') or {} - for script_name, entry_point in iter(scripts.items()): + for _, entry_point in iter(scripts.items()): if entry_point.module_name == module: ver = dist.version if ver is not None: diff --git a/pros/conductor/project/ProjectTransaction.py b/pros/conductor/project/ProjectTransaction.py index 14034d42..edae1330 100644 --- a/pros/conductor/project/ProjectTransaction.py +++ b/pros/conductor/project/ProjectTransaction.py @@ -36,7 +36,6 @@ def execute(self, conductor: c.Conductor, project: c.Project): raise e else: ui.logger(__name__).warning(str(e)) - return None def describe(self, conductor: c.Conductor, project: c.Project): action = project.get_template_actions(conductor.resolve_template(self.template)) diff --git a/pros/conductor/project/__init__.py b/pros/conductor/project/__init__.py index 486610ca..a0777595 100644 --- a/pros/conductor/project/__init__.py +++ b/pros/conductor/project/__init__.py @@ -411,7 +411,7 @@ def find_project(path: str, recurse_times: int = 10): if os.path.isfile(path): path = os.path.dirname(path) if os.path.isdir(path): - for n in range(recurse_times): + for _ in range(recurse_times): if path is not None and os.path.isdir(path): files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f.lower() == 'project.pros'] diff --git a/pros/ga/analytics.py b/pros/ga/analytics.py index 7a9c76af..247e6b31 100644 --- a/pros/ga/analytics.py +++ b/pros/ga/analytics.py @@ -62,7 +62,7 @@ def send(self,action): timeout=5.0) self.pendingRequests.append(future) - except Exception as e: + except Exception: from pros.cli.common import logger logger(__name__).warning("Unable to send analytics. Do you have a stable internet connection?", extra={'sentry': False}) diff --git a/pros/serial/devices/vex/crc.py b/pros/serial/devices/vex/crc.py index f53bee5d..2e4270d7 100644 --- a/pros/serial/devices/vex/crc.py +++ b/pros/serial/devices/vex/crc.py @@ -9,7 +9,7 @@ def __init__(self, size: int, polynomial: int): for i in range(256): crc_accumulator = i << (self._size - 8) - for j in range(8): + for _ in range(8): if crc_accumulator & (1 << (self._size - 1)): crc_accumulator = (crc_accumulator << 1) ^ self._polynomial else: diff --git a/pros/serial/devices/vex/v5_device.py b/pros/serial/devices/vex/v5_device.py index a19d0777..124897e0 100644 --- a/pros/serial/devices/vex/v5_device.py +++ b/pros/serial/devices/vex/v5_device.py @@ -268,7 +268,6 @@ def upload_project(self, project: Project, **kwargs): def generate_ini_file(self, remote_name: str = None, slot: int = 0, ini: ConfigParser = None, **kwargs): project_ini = ConfigParser() - from semantic_version import Spec default_icon = 'USER902x.bmp' if Spec('>=1.0.0-22').match(self.status['cpu0_version']) else 'USER999x.bmp' project_ini['project'] = { 'version': str(kwargs.get('ide_version') or get_version()), @@ -612,7 +611,7 @@ def read_ini(self, remote_name: str) -> Optional[ConfigParser]: rx_io.seek(0, 0) config.read_string(rx_io.read().decode('ascii')) return config - except VEXCommError as e: + except VEXCommError: return None @retries @@ -918,7 +917,7 @@ def kv_write(self, kv: str, payload: Union[Iterable, bytes, bytearray, str]): payload = payload.encode(encoding='ascii') tx_fmt =f'<{len(encoded_kv)}s{len(payload)}s' tx_payload = struct.pack(tx_fmt, encoded_kv, payload) - ret = self._txrx_ext_packet(0x2f, tx_payload, 1, check_length=False, check_ack=True) + self._txrx_ext_packet(0x2f, tx_payload, 1, check_length=False, check_ack=True) logger(__name__).debug('Completed ext 0x2f command') return payload diff --git a/pros/serial/ports/__init__.py b/pros/serial/ports/__init__.py index be344a79..4850b2b9 100644 --- a/pros/serial/ports/__init__.py +++ b/pros/serial/ports/__init__.py @@ -1,7 +1,7 @@ from functools import lru_cache from pros.common import logger -from serial.tools import list_ports as list_ports +from serial.tools import list_ports from .base_port import BasePort, PortConnectionException, PortException from .direct_port import DirectPort