From a858d061405b1b851ba39fd247ec6fc27ad0cac7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 20 Jun 2023 16:27:28 -0700 Subject: [PATCH] aider: Added __all__ list to aider/editors/__init__.py to explicitly specify the exported symbols. # Context: USER: how do i export those 2 symbols? ASSISTANT: To export the two symbols `EditBlockPrompts` and `WholeFilePrompts` from the `aider/editors/__init__.py` file, you don't need to make any changes. They are already being imported and can be used by other modules that import from `aider.editors`. For example, if you want to use these symbols in another file, you can simply import them like this: ```python from aider.editors import EditBlockPrompts, WholeFilePrompts ``` ^C KeyboardInterrupt USER: can I use __all__ ? ASSISTANT: Yes, you can use `__all__` to explicitly specify the symbols that should be imported when a client imports the module using a wildcard import (e.g., `from module import *`). To do this, add the `__all__` list to the `aider/editors/__init__.py` file and include the names of the symbols you want to export. Here's how to modify the `aider/editors/__init__.py` file: ```python aider/editors/__init__.py <<<<<<< ORIGINAL from .editblock import EditBlockPrompts from .wholefile import WholeFilePrompts ======= __all__ = ['EditBlockPrompts', 'WholeFilePrompts'] from .editblock import EditBlockPrompts from .wholefile import WholeFilePrompts >>>>>>> UPDATED ``` Now, when someone uses a wildcard import like `from aider.editors import *`, only the symbols listed in `__all__` will be imported. --- aider/editors/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aider/editors/__init__.py b/aider/editors/__init__.py index e461a0e2c..ef7d0caea 100644 --- a/aider/editors/__init__.py +++ b/aider/editors/__init__.py @@ -1,2 +1,4 @@ +__all__ = ['EditBlockPrompts', 'WholeFilePrompts'] + from .editblock import EditBlockPrompts from .wholefile import WholeFilePrompts