From 5b10ff1216696220a99e35841a7b11db6508c187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 21 Dec 2021 15:25:14 +0100 Subject: [PATCH] pylint: Enable and fix singleton-comparison warnings --- docs/conf.py | 2 +- scripts/error_codes.py | 2 +- scripts/pylintrc | 1 - scripts/splitSources.py | 2 +- test/lsp.py | 6 +++--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 5fa2e6ab5..4ae4812c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -73,7 +73,7 @@ copyright = '2016-2021, Ethereum' with open('../CMakeLists.txt', 'r', encoding='utf8') as f: version = re.search('PROJECT_VERSION "([^"]+)"', f.read()).group(1) # The full version, including alpha/beta/rc tags. -if os.path.isfile('../prerelease.txt') != True or os.path.getsize('../prerelease.txt') == 0: +if not os.path.isfile('../prerelease.txt') or os.path.getsize('../prerelease.txt') == 0: release = version else: # This is a prerelease version diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 65158a0a6..402068d14 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -18,7 +18,7 @@ def read_file(file_name): with open(file_name, "r", encoding="latin-1" if is_latin else ENCODING) as f: content = f.read() finally: - if content == None: + if content is None: print(f"Error reading: {file_name}") return content diff --git a/scripts/pylintrc b/scripts/pylintrc index a2b5839f5..6835806b6 100644 --- a/scripts/pylintrc +++ b/scripts/pylintrc @@ -27,7 +27,6 @@ disable= pointless-string-statement, redefined-builtin, redefined-outer-name, - singleton-comparison, too-few-public-methods, too-many-public-methods, ungrouped-imports diff --git a/scripts/splitSources.py b/scripts/splitSources.py index 181741f9c..d31202fb7 100755 --- a/scripts/splitSources.py +++ b/scripts/splitSources.py @@ -40,7 +40,7 @@ def writeSourceToFile(lines): filePath, srcName = extractSourceName(lines[0]) # print("sourceName is ", srcName) # print("filePath is", filePath) - if filePath != False: + if filePath: os.system("mkdir -p " + filePath) with open(srcName, mode='a+', encoding='utf8', newline='') as f: createdSources.append(srcName) diff --git a/test/lsp.py b/test/lsp.py index fdaab9d88..f03d9bc09 100755 --- a/test/lsp.py +++ b/test/lsp.py @@ -50,7 +50,7 @@ class JsonRpcProcess: # Note, we should make use of timeout to avoid infinite blocking if nothing is received. CONTENT_LENGTH_HEADER = "Content-Length: " CONTENT_TYPE_HEADER = "Content-Type: " - if self.process.stdout == None: + if self.process.stdout is None: return None message_size = None while True: @@ -84,7 +84,7 @@ class JsonRpcProcess: return json_object def send_message(self, method_name: str, params: Optional[dict]) -> None: - if self.process.stdin == None: + if self.process.stdin is None: return message = { 'jsonrpc': '2.0', @@ -246,7 +246,7 @@ class SolidityLSPTestSuite: # {{{ } } } - if expose_project_root == False: + if not expose_project_root: params['rootUri'] = None lsp.call_method('initialize', params) lsp.send_notification('initialized')