Skip to content

Commit

Permalink
Tell IPython to stop inspecting NodeCollection objects; suggested by …
Browse files Browse the repository at this point in the history
…Harold Gutch
  • Loading branch information
heplesser committed Mar 12, 2024
1 parent 8dd4b52 commit f68c60e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pynest/nest/lib/hl_api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ def __getattr__(self, attr):
if not self:
raise AttributeError("Cannot get attribute of empty NodeCollection")

# IPython looks up this method when doing pretty printing
# Without special casing this, this would go through SLI which is *slow*
if attr == "_ipython_canary_method_should_not_exist_":
raise KeyError(attr)

if attr == "spatial":
metadata = sli_func("GetMetadata", self._datum)
val = metadata if metadata else None
Expand Down

0 comments on commit f68c60e

Please sign in to comment.