From bd5e15f83b73ed2406f373c013b13932c5d4ecff Mon Sep 17 00:00:00 2001 From: Arkadiusz Baczek Date: Thu, 20 Nov 2025 15:50:50 +0100 Subject: [PATCH 1/2] fix: Modify truediv and rtruediv implementation for python <3.12 Signed-off-by: Baczek, Arkadiusz --- mfd_connect/pathlib/path.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mfd_connect/pathlib/path.py b/mfd_connect/pathlib/path.py index 29557e6..bdd6a5f 100644 --- a/mfd_connect/pathlib/path.py +++ b/mfd_connect/pathlib/path.py @@ -148,6 +148,22 @@ def with_name(self, name: str) -> "CustomPath": if not name or f.sep in name or (f.altsep and f.altsep in name) or name == ".": raise ValueError("Invalid name %r" % (name)) return self._from_parsed_parts_py3_12(self.drive, self.root, self._tail[:-1] + [name]) + else: + def __truediv__(self, key): + try: + child = super().__truediv__(key) + child._owner = self._owner + return child + except TypeError: + return NotImplemented + + def __rtruediv__(self, key): + try: + child = super().__rtruediv__(key) + child._owner = self._owner + return child + except TypeError: + return NotImplemented @property def parent(self) -> "CustomPath": # pragma: no cover From ed358759e494b452dcb448659ea7b93acc30ded1 Mon Sep 17 00:00:00 2001 From: "Baczek, Arkadiusz" Date: Tue, 25 Nov 2025 09:46:08 +0100 Subject: [PATCH 2/2] fix: Change the read_text implementation of CustomPosixPath to avoid hanging due to large output Signed-off-by: Baczek, Arkadiusz --- mfd_connect/pathlib/path.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mfd_connect/pathlib/path.py b/mfd_connect/pathlib/path.py index bdd6a5f..f1989aa 100644 --- a/mfd_connect/pathlib/path.py +++ b/mfd_connect/pathlib/path.py @@ -400,7 +400,8 @@ def samefile(self, other_path: CustomPath) -> bool: # noqa:D102 ) def read_text(self, encoding: Optional[str] = None, errors: Optional["Iterable"] = None) -> str: # noqa:D102 - return self._owner.execute_command(f"cat {self}", expected_return_codes=None).stdout + proc = self._owner.start_process(f"cat {self}") + return "".join(chunk for chunk in proc.get_stdout_iter()) def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: # noqa:D102 if not exist_ok and self.is_file():