diff --git a/README.rst b/README.rst index 03adb38..ceed55b 100644 --- a/README.rst +++ b/README.rst @@ -102,10 +102,10 @@ Usage Example entries = sorted(path.iterdir(), key=lambda x: (not x.is_dir(), x.name.lower())) for index, entry in enumerate(entries): - connector = "├── " if index < len(entries) - 1 else "└── " + connector = "|-- " if index < len(entries) - 1 else "'-- " print(f"{prefix}{connector}{entry.name}") if entry.is_dir(): - extension = "│ " if index < len(entries) - 1 else " " + extension = "| " if index < len(entries) - 1 else " " print_directory_tree(entry, prefix + extension) diff --git a/adafruit_pathlib.py b/adafruit_pathlib.py index 98edb1e..c23096f 100644 --- a/adafruit_pathlib.py +++ b/adafruit_pathlib.py @@ -350,7 +350,7 @@ def iterdir(self): OSError: If self.is_dir() is False. """ if not self.is_dir(): - raise OSError(errno.ENOTDIR, f"Not a directory: {self._path}") + raise OSError(f"Not a directory: {self._path}") for name in os.listdir(self._path): yield Path(self._path, name) diff --git a/docs/_static/custom.css b/docs/_static/custom.css new file mode 100644 index 0000000..d60cf4b --- /dev/null +++ b/docs/_static/custom.css @@ -0,0 +1,8 @@ +/* SPDX-FileCopyrightText: 2025 Sam Blenny + * SPDX-License-Identifier: MIT + */ + +/* Monkey patch the rtd theme to prevent horizontal stacking of short items + * see https://github.com/readthedocs/sphinx_rtd_theme/issues/1301 + */ +.py.property{display: block !important;} diff --git a/docs/conf.py b/docs/conf.py index 6d44518..8d16225 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -116,6 +116,9 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] +# Include extra css to work around rtd theme glitches +html_css_files = ["custom.css"] + # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. diff --git a/examples/pathlib_simpletest.py b/examples/pathlib_simpletest.py index e46110a..c59df91 100644 --- a/examples/pathlib_simpletest.py +++ b/examples/pathlib_simpletest.py @@ -12,10 +12,10 @@ def print_directory_tree(path: adafruit_pathlib.Path, prefix: str = ""): entries = sorted(path.iterdir(), key=lambda x: (not x.is_dir(), x.name.lower())) for index, entry in enumerate(entries): - connector = "├── " if index < len(entries) - 1 else "└── " + connector = "|-- " if index < len(entries) - 1 else "'-- " print(f"{prefix}{connector}{entry.name}") if entry.is_dir(): - extension = "│ " if index < len(entries) - 1 else " " + extension = "| " if index < len(entries) - 1 else " " print_directory_tree(entry, prefix + extension) diff --git a/ruff.toml b/ruff.toml index a6ed64f..38b523c 100644 --- a/ruff.toml +++ b/ruff.toml @@ -17,7 +17,6 @@ extend-select = [ "PLC2401", # non-ascii-name "PLC2801", # unnecessary-dunder-call "PLC3002", # unnecessary-direct-lambda-call - "E999", # syntax-error "PLE0101", # return-in-init "F706", # return-outside-function "F704", # yield-outside-function