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

python variables pane: don't hide _ if it was changed by the user #6297

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023-2024 Posit Software, PBC. All rights reserved.
# Copyright (C) 2023-2025 Posit Software, PBC. All rights reserved.
# Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
#

Expand Down Expand Up @@ -75,7 +75,7 @@ def _prepare_shell(shell: PositronShell) -> None:
# manually add them to user_ns_hidden to replicate running in Positron.
shell.user_ns_hidden.update(
{
k: None
k: ""
Copy link
Contributor Author

@austin3dickey austin3dickey Feb 20, 2025

Choose a reason for hiding this comment

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

This is closer to what actually happens outside of tests (and fixes a test for me)

for k in [
"__name__",
"__doc__",
Expand Down Expand Up @@ -134,6 +134,8 @@ def shell(kernel) -> Iterable[PositronShell]:
new_user_ns_keys = set(shell.user_ns.keys()) - user_ns_keys
for key in new_user_ns_keys:
del shell.user_ns[key]
if "_" in shell.user_ns:
del shell.user_ns["_"]


@pytest.fixture
Expand Down
Loading
Loading