-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] feat: ForFilter generator helper for builtins.filter
#19643
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
Open
BobTheBuidler
wants to merge
29
commits into
python:master
Choose a base branch
from
BobTheBuidler:for-filter
base: master
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
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b3f3eab
[mypyc] feat: ForFilter generator helper for builtins.filter
BobTheBuidler 67818c6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 74b7a6e
fix: add filter to ir fixtures
BobTheBuidler eeb09ab
fix: run tests
BobTheBuidler ddc13b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fc12cea
test with None
BobTheBuidler 5ce8148
Merge branch 'for-filter' of https://github.com/BobTheBuidler/mypy in…
BobTheBuidler 54ad04e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] eae9209
IR cases for testing C calls
BobTheBuidler 9941d54
feat: handle native calls and primitive ops
BobTheBuidler 71b27ef
Merge branch 'for-filter' of https://github.com/BobTheBuidler/mypy in…
BobTheBuidler 5237f0b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d68b833
Update run-loops.test
BobTheBuidler c9680dc
Update for_helpers.py
BobTheBuidler 5bf4b22
test primitive op
BobTheBuidler c39bb4a
feat: use speciailizers
BobTheBuidler 8e43b2e
Merge branch 'for-filter' of https://github.com/BobTheBuidler/mypy in…
BobTheBuidler 9dceb9a
Revert "Update for_helpers.py"
BobTheBuidler 7c8053f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8aff832
add to docs
BobTheBuidler 0d2c019
Merge branch 'for-filter' of https://github.com/BobTheBuidler/mypy in…
BobTheBuidler cec1a5d
Update for_helpers.py
BobTheBuidler 5170a10
Merge branch 'master' into for-filter
BobTheBuidler ba5a978
Merge branch 'master' into for-filter
BobTheBuidler 572793c
Update native_operations.rst
BobTheBuidler 55ed2d6
Merge branch 'master' into for-filter
BobTheBuidler dbbbb57
Update for_helpers.py
BobTheBuidler 0bc1d26
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7d56fa9
Update for_helpers.py
BobTheBuidler 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -571,3 +571,37 @@ print([x for x in native.Vector2(4, -5.2)]) | |
[out] | ||
Vector2(x=-2, y=3.1) | ||
\[4, -5.2] | ||
|
||
[case testRunForFilter] | ||
def f(a: list[int]) -> int: | ||
s = 0 | ||
for x in filter(lambda x: x % 2 == 0, a): | ||
s += x | ||
return s | ||
|
||
[file driver.py] | ||
from native import f | ||
print(f([1, 2, 3, 4, 5, 6])) | ||
print(f([1, 3, 5])) | ||
print(f([])) | ||
|
||
[out] | ||
12 | ||
0 | ||
0 | ||
|
||
[case testRunForFilterEdgeCases] | ||
def f(a: list[int]) -> int: | ||
s = 0 | ||
for x in filter(lambda x: x > 10, a): | ||
s += x | ||
return s | ||
|
||
[file driver.py] | ||
from native import f | ||
print(f([5, 15, 25])) | ||
print(f([])) | ||
|
||
[out] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please merge all the tests under a single |
||
40 | ||
0 |
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.
Uh oh!
There was an error while loading. Please reload this page.