Skip to content
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

Treat display as a builtin in IPython #8707

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Treat display as a builtin in IPython #8707

merged 2 commits into from
Nov 16, 2023

Conversation

charliermarsh
Copy link
Member

Summary

display is a special-cased builtin in IPython. This PR adds it to the builtin namespace when analyzing IPython notebooks.

Closes #8702.

@@ -54,7 +55,7 @@ pub(crate) struct TestedNotebook {
}

#[cfg(not(fuzzing))]
pub(crate) fn test_notebook_path(
pub(crate) fn assert_notebook_path(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this to avoid some confusion.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 15, 2023
Copy link
Contributor

github-actions bot commented Nov 15, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

crates/ruff_python_stdlib/src/builtins.rs Outdated Show resolved Hide resolved
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
@charliermarsh charliermarsh enabled auto-merge (squash) November 16, 2023 01:54
@charliermarsh charliermarsh merged commit 4ac78d5 into main Nov 16, 2023
16 checks passed
@charliermarsh charliermarsh deleted the charlie/display branch November 16, 2023 01:58
konstin added a commit that referenced this pull request Nov 16, 2023
I checked for ipython-specific builtins on python 3.11 using
```python
import json
from subprocess import check_output

builtins_python = json.loads(check_output(["python3", "-c" "import json; print(json.dumps(dir(__builtins__)))"]))
builtins_ipython = json.loads(check_output(["ipython3", "-c" "import json; print(json.dumps(dir(__builtins__)))"]))
print(sorted(set(builtins_ipython) - set(builtins_python)))
```
and updated the relevant constant and match. The list changes from

`display`

to

`__IPYTHON__`, `display`, `get_ipython`.

Followup to #8707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

F821 false positive for IPython display()
2 participants