From b8571e9e1f54b9c80b9723a90d1f70c1c896f44e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 26 Nov 2021 11:35:46 -0500 Subject: [PATCH] Revert "Fix some alerts founded the LGTM system (#11966)" (#12295) This reverts commit 22255ab2297747145ebd2bd444a4a3d8f588f373. --- scripts/build/builders/mbed.py | 4 ++++ scripts/tools/memory/memdf/df.py | 3 +-- scripts/tools/memory/report_summary.py | 2 ++ src/controller/python/chip-repl.py | 8 ++++++++ src/controller/python/chip/ChipDeviceCtrl.py | 4 ++-- src/controller/python/chip/ChipReplStartup.py | 3 ++- src/controller/python/chip/clusters/Attribute.py | 4 ++-- src/controller/python/chip/clusters/Command.py | 2 +- src/controller/python/chip/interaction_model/__init__.py | 2 +- 9 files changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 5ba45d136eb174..d0198ca0c032e1 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -12,8 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging import os +import platform +import glob import shlex +import pathlib from enum import Enum, auto from .builder import Builder diff --git a/scripts/tools/memory/memdf/df.py b/scripts/tools/memory/memdf/df.py index 7345f41e0163a6..a91e44c669d94b 100644 --- a/scripts/tools/memory/memdf/df.py +++ b/scripts/tools/memory/memdf/df.py @@ -32,8 +32,7 @@ def __init__(self, *args, **kwargs): self[c] = pd.Series() types = {c: self.dtype[c] for c in self.columns if c in self.dtype} typed_columns = list(types.keys()) - self[typed_columns] = self.astype(types, copy=False)[ - typed_columns] # lgtm [py/hash-unhashable-value] + self[typed_columns] = self.astype(types, copy=False)[typed_columns] self.attrs['name'] = self.name diff --git a/scripts/tools/memory/report_summary.py b/scripts/tools/memory/report_summary.py index 5a3d0cd4ded8d0..3b21f6a88bb8ea 100755 --- a/scripts/tools/memory/report_summary.py +++ b/scripts/tools/memory/report_summary.py @@ -28,6 +28,8 @@ import sys +import numpy # type: ignore + import memdf.collect import memdf.report import memdf.select diff --git a/src/controller/python/chip-repl.py b/src/controller/python/chip-repl.py index 49adafca317bb8..0f6798137e4d06 100755 --- a/src/controller/python/chip-repl.py +++ b/src/controller/python/chip-repl.py @@ -18,7 +18,15 @@ # import IPython +import chip +import chip.logging +import coloredlogs +import logging from traitlets.config import Config +from rich import print +from rich import pretty +from rich import inspect +import builtins import argparse import sys diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index e093442043bcc1..4ca3aa94bbd0da 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -346,11 +346,11 @@ def DeviceAvailableCallback(device, err): # The callback might have been received synchronously (during self._ChipStack.Call()). # Check if the device is already set before waiting for the callback. - if returnDevice.value is None: + if returnDevice.value == None: with deviceAvailableCV: deviceAvailableCV.wait() - if returnDevice.value is None: + if returnDevice.value == None: raise self._ChipStack.ErrorToException(CHIP_ERROR_INTERNAL) return returnDevice diff --git a/src/controller/python/chip/ChipReplStartup.py b/src/controller/python/chip/ChipReplStartup.py index 8d032b9b356bdc..865042e34315be 100644 --- a/src/controller/python/chip/ChipReplStartup.py +++ b/src/controller/python/chip/ChipReplStartup.py @@ -8,6 +8,7 @@ import chip.clusters as Clusters import coloredlogs import chip.logging +import argparse import builtins @@ -40,7 +41,7 @@ def ReplInit(): def matterhelp(classOrObj=None): - if (classOrObj is None): + if (classOrObj == None): inspect(builtins.devCtrl, methods=True, help=True, private=False) else: inspect(classOrObj, methods=True, help=True, private=False) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index fd39b3ca987cc4..d8f3cebe68bc0c 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -18,8 +18,8 @@ from asyncio.futures import Future import ctypes from dataclasses import dataclass -from typing import Union, List, Any -from ctypes import CFUNCTYPE, c_char_p, c_size_t, c_uint32, c_uint16, py_object +from typing import Type, Union, List, Any +from ctypes import CFUNCTYPE, c_char_p, c_size_t, c_void_p, c_uint32, c_uint16, py_object from .ClusterObjects import ClusterAttributeDescriptor import chip.exceptions diff --git a/src/controller/python/chip/clusters/Command.py b/src/controller/python/chip/clusters/Command.py index e097184297b518..179c4ed9959da1 100644 --- a/src/controller/python/chip/clusters/Command.py +++ b/src/controller/python/chip/clusters/Command.py @@ -74,7 +74,7 @@ def _handleResponse(self, path: CommandPath, status: Status, response: bytes): self._future.set_result(None) else: # If a type hasn't been assigned, let's auto-deduce it. - if (self._expect_type is None): + if (self._expect_type == None): self._expect_type = FindCommandClusterObject(False, path) if self._expect_type: diff --git a/src/controller/python/chip/interaction_model/__init__.py b/src/controller/python/chip/interaction_model/__init__.py index 2b4bef9145a0e8..0ef2d861c18fc8 100644 --- a/src/controller/python/chip/interaction_model/__init__.py +++ b/src/controller/python/chip/interaction_model/__init__.py @@ -26,7 +26,7 @@ from chip.exceptions import ChipStackException -__all__ = ["Status", "InteractionModelError"] +__all__ = ["IMDelegate", "Status", "InteractionModelError"] class Status(enum.IntEnum):