-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gradual typing #1217
Open
akaihola
wants to merge
11
commits into
Aider-AI:main
Choose a base branch
from
akaihola:gradual-typing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Gradual typing #1217
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4286a96
chore: configure Mypy
akaihola 7d610f3
fix: __all__ must contain strings, not objects
akaihola 3ec2ca5
fix: `| None` type for attrs overridden as None
akaihola eda23be
fix: avoid reassignment to different type
akaihola 628c04e
fix: namedtuple syntax Mypy is happy with
akaihola 10aefde
chore: add requirements for running mypy
akaihola 77438bb
chore: add GitHub workflow to run Mypy
akaihola 1be1d6d
fix: work around typing of conditional imports
akaihola c1339cb
fix: correct description type in ExInfo
akaihola 00eaf61
fix: correct return type for check_for_urls()
akaihola 94c963c
fix: use CoderPrompts base class as type for AskCoder.gpt_prompts
akaihola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
name: Linting | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- 'aider/website/**' | ||
- README.md | ||
- HISTORY.md | ||
branches: | ||
- main | ||
pull_request: | ||
paths-ignore: | ||
- 'aider/website/**' | ||
- README.md | ||
branches: | ||
- main | ||
|
||
jobs: | ||
mypy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install '.[browser,dev,playwright,mypy]' | ||
|
||
- name: Run Mypy | ||
uses: wearerequired/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
mypy: true | ||
mypy_args: "." | ||
continue_on_error: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from .ask_prompts import AskPrompts | ||
from .base_coder import Coder | ||
from .base_prompts import CoderPrompts | ||
|
||
|
||
class AskCoder(Coder): | ||
"""Ask questions about code without making any changes.""" | ||
|
||
edit_format = "ask" | ||
gpt_prompts = AskPrompts() | ||
gpt_prompts: CoderPrompts = AskPrompts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
class ExInfo: | ||
name: str | ||
retry: bool | ||
description: str | ||
description: str | None | ||
|
||
|
||
EXCEPTIONS = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ def _load_litellm(self): | |
|
||
litellm = LazyLiteLLM() | ||
|
||
__all__ = [litellm] | ||
__all__ = ["litellm"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[mypy] | ||
exclude = (?x)( | ||
^\.git/ | ||
| ^benchmark/$ | ||
| ^build/$ | ||
| ^dist/$ | ||
| ^scripts/$ | ||
) | ||
allow_untyped_globals = True | ||
check_untyped_defs = False | ||
|
||
[mypy-configargparse] | ||
ignore_missing_imports = True | ||
|
||
[mypy-diff_match_patch] | ||
ignore_missing_imports = True | ||
|
||
[mypy-diskcache] | ||
ignore_missing_imports = True | ||
|
||
[mypy-grep_ast.*] | ||
ignore_missing_imports = True | ||
|
||
[mypy-imgcat] | ||
ignore_missing_imports = True | ||
|
||
[mypy-llama_index.*] | ||
ignore_missing_imports = True | ||
|
||
[mypy-mixpanel] | ||
ignore_missing_imports = True | ||
|
||
[mypy-pydub] | ||
ignore_missing_imports = True | ||
|
||
[mypy-pypandoc] | ||
ignore_missing_imports = True | ||
|
||
[mypy-pyperclip] | ||
ignore_missing_imports = True | ||
|
||
[mypy-soundfile] | ||
ignore_missing_imports = True | ||
|
||
[mypy-sounddevice] | ||
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-c ../requirements.txt | ||
|
||
mypy | ||
types-Pygments | ||
types-PyYAML | ||
types-beautifulsoup4 | ||
types-jsonschema | ||
types-networkx | ||
types-pexpect | ||
types-psutil | ||
types-requests | ||
types-tqdm | ||
types-tree-sitter-languages |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type union syntax
X | Y
is only available in Python 3.10, but Aider still supports Python 3.9.Instead, this should be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 1 of this file, I've added
which makes sure
X | Y
is supported on Python 3.9.