Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pickle: Hide "numpy" module unless --with-intrinsic-mods is used #1895

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

Merged
merged 2 commits into from
Jun 12, 2023
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
9 changes: 6 additions & 3 deletions src/lpython/pickle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ class ASRPickleVisitor :
s.append(")");
}
void visit_Module(const ASR::Module_t &x) {
// hide intrinsic modules and numpy module by default
if (!show_intrinsic_modules &&
(x.m_intrinsic || startswith(x.m_name, "lfortran_intrinsic_"))) {
(x.m_intrinsic || startswith(x.m_name, "numpy"))) {
s.append("(");
if (use_colors) {
s.append(color(style::bold));
s.append(color(fg::magenta));
}
s.append("IntrinsicModule");
s.append(x.m_intrinsic ? "IntrinsicModule" : "Module");
if (use_colors) {
s.append(color(fg::reset));
s.append(color(style::reset));
Expand Down Expand Up @@ -202,7 +203,9 @@ class ASRJsonVisitor :
}

void visit_Module(const ASR::Module_t &x) {
if (x.m_intrinsic && !show_intrinsic_modules) { // do not show intrinsic modules by default
// hide intrinsic modules and numpy module by default
if (!show_intrinsic_modules &&
(x.m_intrinsic || startswith(x.m_name, "numpy"))) {
s.append("{");
inc_indent(); s.append("\n" + indtd);
s.append("\"node\": \"Module\"");
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-array_01_decl-39cf894.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_01_decl-39cf894.stdout",
"stdout_hash": "7c629e68e8259cdad76c7c5f6fbda500fb11ee53cd85ef36738ad550",
"stdout_hash": "a31f210cef724c6bdf84f10ab9f177708e754b8b32ccbe62f0695d5e",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-array_01_decl-39cf894.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-array_02_decl-e8f6874.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_02_decl-e8f6874.stdout",
"stdout_hash": "0248f1a76d6fc9ab351cf53c9dd835d5dbc644423e1d150bc10d6a9a",
"stdout_hash": "fd32bda3bbfa7674acd3e6af34142333625aa7f9d7803cacf448fc24",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-array_02_decl-e8f6874.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_02-bc1a7ea.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-bindc_02-bc1a7ea.stdout",
"stdout_hash": "a84c81209f918df8b469a9249361ac3b7237cf0967e8dc0800279ff9",
"stdout_hash": "96064ed45528b0957f33def62b58e5af77b4010fef69f95124fcc5df",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-bindc_02-bc1a7ea.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-elemental_01-b58df26.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-elemental_01-b58df26.stdout",
"stdout_hash": "5b6cf6a1bc74628962f642ae611e4cc270e870d66c9d9b496d13067e",
"stdout_hash": "2b7a263e3b7c122e03cf3847e1db4cf3d8f46e7bb32b421bd1814450",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-elemental_01-b58df26.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-generics_array_01-682b1b2.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-generics_array_01-682b1b2.stdout",
"stdout_hash": "91946cc87dd5befb12b930f7fd0baca8f6aec64c2dab92317d02345b",
"stdout_hash": "6021ce034db2021fd5698d84ee65b4bf1f7d38d79f71b9734d221893",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-generics_array_01-682b1b2.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-generics_array_02-22c8dc1.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-generics_array_02-22c8dc1.stdout",
"stdout_hash": "b439e834f721ece945c0cfb3af082dd2f0912a659e3f223abb37ca91",
"stdout_hash": "e52b1e442e6b912417d34740a34fa5d98b7dd277405d82100d731ab3",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-generics_array_02-22c8dc1.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-generics_array_03-fb3706c.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-generics_array_03-fb3706c.stdout",
"stdout_hash": "eb54235545cd083346a7c0bfd51f8ffbe4d17fa12b590eb804e73d65",
"stdout_hash": "f51c607cb57f06e94b025b01f94b256c6a188561021c0f95d43d9b9e",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
5,997 changes: 1 addition & 5,996 deletions tests/reference/asr-generics_array_03-fb3706c.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-structs_05-fa98307.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-structs_05-fa98307.stdout",
"stdout_hash": "e08112bd49af04ab18f89edc3f077eef5e70a7ca058097fb8cac2c9e",
"stdout_hash": "96b25c8659ccec04056485ee95f069c83a25d9806019c9199cb00303",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
Loading