mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-14 19:30:21 +00:00
98 lines
3.6 KiB
Diff
98 lines
3.6 KiB
Diff
diff --git a/aider/help.py b/aider/help.py
|
|
index c76188d1..9fded648 100755
|
|
--- a/aider/help.py
|
|
+++ b/aider/help.py
|
|
@@ -6,7 +6,7 @@ import shutil
|
|
import warnings
|
|
from pathlib import Path
|
|
|
|
-import importlib_resources
|
|
+import importlib.resources
|
|
|
|
from aider import __version__, utils
|
|
from aider.dump import dump # noqa: F401
|
|
@@ -31,7 +31,7 @@ def install_help_extra(io):
|
|
|
|
|
|
def get_package_files():
|
|
- for path in importlib_resources.files("aider.website").iterdir():
|
|
+ for path in importlib.resources.files("aider.website").iterdir():
|
|
if path.is_file():
|
|
yield path
|
|
elif path.is_dir():
|
|
@@ -112,7 +112,7 @@ def get_index():
|
|
continue
|
|
|
|
doc = Document(
|
|
- text=importlib_resources.files("aider.website")
|
|
+ text=importlib.resources.files("aider.website")
|
|
.joinpath(fname)
|
|
.read_text(encoding="utf-8"),
|
|
metadata=dict(
|
|
diff --git a/aider/main.py b/aider/main.py
|
|
index afb3f836..7ade37af 100644
|
|
--- a/aider/main.py
|
|
+++ b/aider/main.py
|
|
@@ -13,7 +13,7 @@ try:
|
|
except ImportError:
|
|
git = None
|
|
|
|
-import importlib_resources
|
|
+import importlib.resources
|
|
import shtab
|
|
from dotenv import load_dotenv
|
|
from prompt_toolkit.enums import EditingMode
|
|
@@ -391,7 +391,7 @@ def register_litellm_models(git_root, model_metadata_fname, io, verbose=False):
|
|
model_metadata_files = []
|
|
|
|
# Add the resource file path
|
|
- resource_metadata = importlib_resources.files("aider.resources").joinpath("model-metadata.json")
|
|
+ resource_metadata = importlib.resources.files("aider.resources").joinpath("model-metadata.json")
|
|
model_metadata_files.append(str(resource_metadata))
|
|
|
|
model_metadata_files += generate_search_path_list(
|
|
diff --git a/aider/resources/__init__.py b/aider/resources/__init__.py
|
|
index f7ca4efb..cabf3c36 100644
|
|
--- a/aider/resources/__init__.py
|
|
+++ b/aider/resources/__init__.py
|
|
@@ -1,3 +1,3 @@
|
|
-# This ensures that importlib_resources.files("aider.resources")
|
|
+# This ensures that importlib.resources.files("aider.resources")
|
|
# doesn't raise ImportError, even if there are no other files in this
|
|
# dir.
|
|
diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py
|
|
index cc694a9f..82124b28 100755
|
|
--- a/benchmark/benchmark.py
|
|
+++ b/benchmark/benchmark.py
|
|
@@ -16,7 +16,7 @@ from types import SimpleNamespace
|
|
from typing import List, Optional
|
|
|
|
import git
|
|
-import importlib_resources
|
|
+import importlib.resources
|
|
import lox
|
|
import pandas as pd
|
|
import prompts
|
|
@@ -320,7 +320,7 @@ def main(
|
|
|
|
test_dnames = sorted(str(d.relative_to(original_dname)) for d in exercise_dirs)
|
|
|
|
- resource_metadata = importlib_resources.files("aider.resources").joinpath("model-metadata.json")
|
|
+ resource_metadata = importlib.resources.files("aider.resources").joinpath("model-metadata.json")
|
|
model_metadata_files_loaded = models.register_litellm_models([resource_metadata])
|
|
dump(model_metadata_files_loaded)
|
|
|
|
diff --git a/tests/basic/test_main.py b/tests/basic/test_main.py
|
|
index c8966a53..ec7a04a1 100644
|
|
--- a/tests/basic/test_main.py
|
|
+++ b/tests/basic/test_main.py
|
|
@@ -1303,7 +1303,7 @@ class TestMain(TestCase):
|
|
mock_files = MagicMock()
|
|
mock_files.joinpath.return_value = mock_resource_path
|
|
|
|
- with patch("aider.main.importlib_resources.files", return_value=mock_files):
|
|
+ with patch("aider.main.importlib.resources.files", return_value=mock_files):
|
|
# Capture stdout to check the output
|
|
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
|
main(
|