From 4030fdb5746d6e7ce8c99dd7b6d46667fedf7049 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 4 Jul 2024 15:07:49 -0300 Subject: [PATCH] Improved the `get_package_files()` function to handle the `MultiplexedPath` object and avoid the `AttributeError`. --- aider/help.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/aider/help.py b/aider/help.py index 7f1a7a1e3..c2b3ab6fd 100755 --- a/aider/help.py +++ b/aider/help.py @@ -15,10 +15,16 @@ warnings.simplefilter("ignore", category=FutureWarning) def get_package_files(): website_files = importlib_resources.files('website') - for path in website_files.rglob('*.md'): - if not any(part.startswith(('OLD', 'tmp')) or part in ('examples', '_posts') for part in path.parts): - dump(path) - yield str(path) + for path in importlib_resources.files('website').iterdir(): + if path.is_file() and path.name.endswith('.md'): + if not any(part.startswith(('OLD', 'tmp')) or part in ('examples', '_posts') for part in path.parts): + dump(path) + yield str(path) + elif path.is_dir(): + for subpath in path.rglob('*.md'): + if not any(part.startswith(('OLD', 'tmp')) or part in ('examples', '_posts') for part in subpath.parts): + dump(subpath) + yield str(subpath) def fname_to_url(filepath):