diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py index 01bab472b06d04..bfbdfa2c9ff878 100644 --- a/pandas/core/config_init.py +++ b/pandas/core/config_init.py @@ -14,8 +14,6 @@ is_bool, is_callable, is_instance_factory, is_int, is_one_of_factory, is_text) -from pandas.io.formats.terminal import is_terminal - # compute use_bottleneck_doc = """ @@ -287,6 +285,23 @@ def table_schema_cb(key): _enable_data_resource_formatter(cf.get_option(key)) +def is_terminal(): + """ + Detect if Python is running in a terminal. + + Returns True if Python is running in a terminal or False if not. + """ + try: + ip = get_ipython() + except NameError: # assume standard Python interpreter in a terminal + return True + else: + if hasattr(ip, 'kernel'): # IPython as a Jupyter kernel + return False + else: # IPython in a terminal + return True + + with cf.config_prefix('display'): cf.register_option('precision', 6, pc_precision_doc, validator=is_int) cf.register_option('float_format', None, float_format_doc, diff --git a/pandas/io/formats/terminal.py b/pandas/io/formats/terminal.py deleted file mode 100644 index ae9a380272efa5..00000000000000 --- a/pandas/io/formats/terminal.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -Terminal utilities. -""" - -__all__ = ['is_terminal'] - - -def is_terminal(): - """ - Detect if Python is running in a terminal. - - Returns True if Python is running in a terminal or False if not. - """ - try: - ip = get_ipython() - except NameError: # assume standard Python interpreter in a terminal - return True - else: - if hasattr(ip, 'kernel'): # IPython as a Jupyter kernel - return False - else: # IPython in a terminal - return True