Commit c694662
authored
Fix printing long strings in %whos magic command. (ipython#14938)
In trying to improve printing for dataframe and series objects, in pull
request ipython#14926, i inadvertently messed up printing of long
strings...sorry!
This change fixes that issue.
```python
## Does not mess up long strings
In [1]: sunday_qry = """
...: with
...: df as (select unnest(generate_series(date '1900-01-01',date '2100-12-31',interval 1 day)) as dt)
...: select * from df where extract(dayofweek from dt)=0;
...: """
...:
In [2]: df = pd.DataFrame({"a": range(10), "b": range(10,20),"c":list(string.ascii_letters[:10])})
In [3]: %whos
Variable Type Data/Info
-----------------------------------
df DataFrame Shape: (10, 3)
sunday_qry str \nwith\n df as (select<...>t(dayofweek from dt)=0;\n
In [4]:
"""
```
Compare this to what it currently does.
```python
## inadvertently messed up in ipython#14926
In [1]: sunday_qry = """
...: with
...: df as (select unnest(generate_series(date '1900-01-01',date '2100-12-31',interval 1 day)) as dt)
...: select * from df where extract(dayofweek from dt)=0;
...: """
...:
In [2]: df = pd.DataFrame({"a": range(10), "b": range(10,20),"c":list(string.ascii_letters[:10])})
In [3]: %whos
Variable Type Data/Info
----------------------------------------
df DataFrame Shape: (10, 3)
sunday_qry str
with
df as (select unnest(generate_series(date '1900-01-01',date '2100-12-31',interval 1 day)) as dt)
select * from df where extract(dayofweek from dt)=0;
In [4]:
```2 files changed
+36
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
474 | 474 | | |
475 | | - | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
735 | 769 | | |
736 | 770 | | |
737 | 771 | | |
| |||
0 commit comments