Cleanup: suppress various pylint warnings
This commit is contained in:
@@ -112,7 +112,7 @@ def main() -> int:
|
||||
try:
|
||||
with open(output_cc_file, "r", encoding="utf-8") as fh:
|
||||
old_generated_code = fh.read()
|
||||
except:
|
||||
except Exception:
|
||||
old_generated_code = ""
|
||||
new_generated_code = "\n".join(include_lines + decl_lines + [""] + func_lines)
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ def seek(r, txt, recurs):
|
||||
print(txt + ' -> ' + str(r))
|
||||
return
|
||||
|
||||
if type_r == str:
|
||||
if type_r is str:
|
||||
if PRINT_DATA:
|
||||
print(txt + ' -> "' + str(r) + '"')
|
||||
return
|
||||
|
||||
@@ -10,11 +10,6 @@ __all__ = (
|
||||
|
||||
import os
|
||||
|
||||
from collections.abc import (
|
||||
Callable,
|
||||
Iterator,
|
||||
)
|
||||
|
||||
PATHS: tuple[str, ...] = (
|
||||
"build_files",
|
||||
"doc",
|
||||
|
||||
@@ -57,6 +57,7 @@ class _GetchWindows:
|
||||
|
||||
def __init__(self):
|
||||
import msvcrt
|
||||
del msvcrt
|
||||
|
||||
def __call__(self):
|
||||
import msvcrt
|
||||
|
||||
@@ -78,10 +78,9 @@ class _GetchUnix:
|
||||
|
||||
def __init__(self):
|
||||
import tty
|
||||
import sys
|
||||
del tty
|
||||
|
||||
def __call__(self):
|
||||
import sys
|
||||
import tty
|
||||
import termios
|
||||
fd = sys.stdin.fileno()
|
||||
@@ -98,6 +97,7 @@ class _GetchWindows:
|
||||
|
||||
def __init__(self):
|
||||
import msvcrt
|
||||
del msvcrt
|
||||
|
||||
def __call__(self):
|
||||
import msvcrt
|
||||
|
||||
@@ -171,7 +171,7 @@ def cmake_advanced_info() -> (
|
||||
# Enable to check on nicer XML.
|
||||
use_pretty_xml = False
|
||||
if use_pretty_xml:
|
||||
with open(".cproject_pretty", 'w') as fh:
|
||||
with open(".cproject_pretty", 'w', encoding="utf-8") as fh:
|
||||
fh.write(tree.toprettyxml(indent=" ", newl=""))
|
||||
|
||||
ELEMENT_NODE = tree.ELEMENT_NODE
|
||||
|
||||
@@ -104,23 +104,22 @@ def convert_tabs_to_spaces(files: Sequence[str]) -> None:
|
||||
print("TabExpand", f)
|
||||
with open(f, 'r', encoding="utf-8") as fh:
|
||||
data = fh.read()
|
||||
if False:
|
||||
# Simple 4 space
|
||||
data = data.expandtabs(4)
|
||||
else:
|
||||
# Complex 2 space
|
||||
# because some comments have tabs for alignment.
|
||||
def handle(l: str) -> str:
|
||||
ls = l.lstrip("\t")
|
||||
d = len(l) - len(ls)
|
||||
if d != 0:
|
||||
return (" " * d) + ls.expandtabs(4)
|
||||
else:
|
||||
return l.expandtabs(4)
|
||||
# Simple 4 space (but we're using 2 spaces).
|
||||
# `data = data.expandtabs(4)`
|
||||
|
||||
lines = data.splitlines(keepends=True)
|
||||
lines = [handle(l) for l in lines]
|
||||
data = "".join(lines)
|
||||
# Complex 2 space
|
||||
# because some comments have tabs for alignment.
|
||||
def handle(l: str) -> str:
|
||||
ls = l.lstrip("\t")
|
||||
d = len(l) - len(ls)
|
||||
if d != 0:
|
||||
return (" " * d) + ls.expandtabs(4)
|
||||
else:
|
||||
return l.expandtabs(4)
|
||||
|
||||
lines = data.splitlines(keepends=True)
|
||||
lines = [handle(l) for l in lines]
|
||||
data = "".join(lines)
|
||||
with open(f, 'w', encoding="utf-8") as fh:
|
||||
fh.write(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user