From 6bd65f14739ceb0ba95cf7c64ff8f211f6c51419 Mon Sep 17 00:00:00 2001 From: a_zap Date: Wed, 28 May 2025 17:29:08 +0200 Subject: [PATCH 1/2] Adjusted .pre-commit-config.yaml for Windows usage --- .pre-commit-config.yaml | 8 ++++++-- utils/generate_markdown_docs.py | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08a8e33e72..7d1fffd938 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,9 +56,13 @@ repos: (?x)^( .*cs.meta| .*.css| - .*.meta + .*.meta| + .*.asset| + .*.prefab| + .*.unity| + .*.json )$ - args: [--fix=lf] + args: [--fix=crlf] - id: trailing-whitespace name: trailing-whitespace-markdown diff --git a/utils/generate_markdown_docs.py b/utils/generate_markdown_docs.py index 7566b1bdc7..5ce432b3a2 100755 --- a/utils/generate_markdown_docs.py +++ b/utils/generate_markdown_docs.py @@ -6,7 +6,6 @@ import argparse import hashlib - # pydoc-markdown -I . -m module_name --render_toc > doc.md @@ -52,8 +51,8 @@ def remove_trailing_whitespace(filename): # compare source and destination and write only if changed if source_file != destination_file: num_changed += 1 - with open(filename, "wb") as f: - f.write(destination_file.encode()) + with open(filename, "w", newline="\r\n") as f: + f.write(destination_file) if __name__ == "__main__": @@ -84,7 +83,7 @@ def remove_trailing_whitespace(filename): for submodule in submodules: module_args.append("-m") module_args.append(f"{module_name}.{submodule}") - with open(output_file_name, "w") as output_file: + with open(output_file_name, "wb") as output_file: subprocess_args = [ "pydoc-markdown", "-I", From cd2b649017dcebd1722b01fd70c68f90c1ff612c Mon Sep 17 00:00:00 2001 From: a_zap Date: Wed, 28 May 2025 17:31:55 +0200 Subject: [PATCH 2/2] Fixed mypy issue --- ml-agents/mlagents/trainers/subprocess_env_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ml-agents/mlagents/trainers/subprocess_env_manager.py b/ml-agents/mlagents/trainers/subprocess_env_manager.py index 43d468f2bc..8f767e23d0 100644 --- a/ml-agents/mlagents/trainers/subprocess_env_manager.py +++ b/ml-agents/mlagents/trainers/subprocess_env_manager.py @@ -12,7 +12,7 @@ UnityCommunicatorStoppedException, ) from multiprocessing import Process, Pipe, Queue -from multiprocessing.connection import Connection +from multiprocessing.connection import Connection, PipeConnection from queue import Empty as EmptyQueueException from mlagents_envs.base_env import BaseEnv, BehaviorName, BehaviorSpec from mlagents_envs import logging_util @@ -77,7 +77,7 @@ class StepResponse(NamedTuple): class UnityEnvWorker: - def __init__(self, process: Process, worker_id: int, conn: Connection): + def __init__(self, process: Process, worker_id: int, conn: PipeConnection): self.process = process self.worker_id = worker_id self.conn = conn