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.
This commit is contained in:
Paul Gauthier 2023-06-20 16:27:28 -07:00
parent 03d2c73621
commit a858d06140

View file

@ -1,2 +1,4 @@
__all__ = ['EditBlockPrompts', 'WholeFilePrompts']
from .editblock import EditBlockPrompts
from .wholefile import WholeFilePrompts