Enable Ruff PLW (Pylint Warning) (#13749)

This commit is contained in:
Avasam
2025-04-01 09:12:15 -04:00
committed by GitHub
parent df1206f3cb
commit eafa274f1b
14 changed files with 43 additions and 37 deletions
+3 -1
View File
@@ -35,7 +35,9 @@ def run_protoc(
) -> str:
"""TODO: Describe parameters and return."""
protoc_version = (
subprocess.run([sys.executable, "-m", "grpc_tools.protoc", "--version"], capture_output=True).stdout.decode().strip()
subprocess.run([sys.executable, "-m", "grpc_tools.protoc", "--version"], capture_output=True, check=False)
.stdout.decode()
.strip()
)
print()
print(protoc_version)
+1 -1
View File
@@ -90,7 +90,7 @@ and {protoc_version} on \
print("Updated protobuf/METADATA.toml")
# Run pre-commit to cleanup the stubs
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")))
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False)
if __name__ == "__main__":
+1 -1
View File
@@ -69,7 +69,7 @@ and {protoc_version} on \
print("Updated s2clientprotocol/METADATA.toml")
# Run pre-commit to cleanup the stubs
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")))
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False)
if __name__ == "__main__":
+3 -3
View File
@@ -72,7 +72,7 @@ def post_creation() -> None:
for path in STUBS_FOLDER.rglob("*_pb2.pyi"):
print(f"Fixing imports in '{path}'")
with open(path) as file:
with open(path, encoding="utf-8") as file:
filedata = file.read()
# Replace the target string
@@ -80,7 +80,7 @@ def post_creation() -> None:
filedata = re.sub(XLA_IMPORT_PATTERN, "\\1tensorflow.compiler.xla.", filedata)
# Write the file out again
with open(path, "w") as file:
with open(path, "w", encoding="utf-8") as file:
file.write(filedata)
print()
@@ -137,7 +137,7 @@ and {protoc_version} on `tensorflow=={PACKAGE_VERSION}`.""",
print("Updated tensorflow/METADATA.toml")
# Run pre-commit to cleanup the stubs
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")))
subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False)
if __name__ == "__main__":