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

CLN: Remove io/formats/terminal.py #25916

Merged
merged 1 commit into from
Mar 29, 2019
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
19 changes: 17 additions & 2 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

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

I would expect flake8 to complain about this (F821 I think). Any idea why it doesn’t?

Low priority: could make the docstring follow the standard format

Copy link
Member Author

Choose a reason for hiding this comment

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

I would expect flake8 to complain about this (F821 I think)

Uncertain. I don't think it's because of the try-except block wrapping it?

Low priority: could make the docstring follow the standard format

Agreed on priority. Can always do after.

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,
Expand Down
22 changes: 0 additions & 22 deletions pandas/io/formats/terminal.py

This file was deleted.