MCPcopy
hub / github.com/pandas-dev/pandas / in_interactive_session

Function in_interactive_session

pandas/io/formats/console.py:55–77  ·  view source on GitHub ↗

Check if we're running in an interactive shell. Returns ------- bool True if running under python/ipython interactive shell.

()

Source from the content-addressed store, hash-verified

53
54
55def in_interactive_session() -> bool:
56 """
57 Check if we're running in an interactive shell.
58
59 Returns
60 -------
61 bool
62 True if running under python/ipython interactive shell.
63 """
64 from pandas import get_option
65
66 def check_main() -> bool:
67 try:
68 import __main__ as main
69 except ModuleNotFoundError:
70 return get_option("mode.sim_interactive")
71 return not hasattr(main, "__file__") or get_option("mode.sim_interactive")
72
73 try:
74 # error: Name '__IPYTHON__' is not defined
75 return __IPYTHON__ or check_main() # type: ignore[name-defined]
76 except NameError:
77 return check_main()
78
79
80def in_ipython_frontend() -> bool:

Callers 1

get_console_sizeFunction · 0.85

Calls 1

check_mainFunction · 0.85

Tested by

no test coverage detected