Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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: 10 additions & 9 deletions 19 progressbar/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ def get_terminal_size(): # pragma: no cover
Returns:
width, height: Two integers containing width and height
'''

try:
# Default to 79 characters for IPython notebooks
ipython = globals().get('get_ipython')()
from ipykernel import zmqshell
if isinstance(ipython, zmqshell.ZMQInteractiveShell):
return 79, 24
except Exception: # pragma: no cover
pass

try:
# This works for Python 3, but not Pypy3. Probably the best method if
# it's supported so let's always try
Expand Down Expand Up @@ -136,15 +146,6 @@ def get_terminal_size(): # pragma: no cover
except Exception: # pragma: no cover
pass

try:
# Default to 79 characters for IPython notebooks
ipython = globals().get('get_ipython')()
from ipykernel import zmqshell
if isinstance(ipython, zmqshell.ZMQInteractiveShell):
return 79, 24
except Exception: # pragma: no cover
pass

try:
w, h = _get_terminal_size_linux()
if w and h:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.