pylint: Enable and fix singleton-comparison warnings

This commit is contained in:
Kamil Śliwak 2021-12-21 15:25:14 +01:00
parent 784ae91b41
commit 5b10ff1216
5 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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')