Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af9d424

Browse files
committed
reformat all of core
1 parent d3083dd commit af9d424

8 files changed

Lines changed: 176 additions & 176 deletions

File tree

IPython/core/debugger.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ def do_where(self, arg):
798798

799799
def break_anywhere(self, frame):
800800
"""
801-
802801
_stop_in_decorator_internals is overly restrictive, as we may still want
803802
to trace function calls, so we need to also update break_anywhere so
804803
that is we don't `stop_here`, because of debugger skip, we may still
@@ -820,8 +819,6 @@ def _is_in_decorator_internal_and_should_skip(self, frame):
820819
"""
821820
Utility to tell us whether we are in a decorator internal and should stop.
822821
823-
824-
825822
"""
826823

827824
# if we are disabled don't skip

IPython/core/display.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,15 +826,19 @@ def __init__(
826826
data : unicode, str or bytes
827827
The raw image data or a URL or filename to load the data from.
828828
This always results in embedded image data.
829+
829830
url : unicode
830831
A URL to download the data from. If you specify `url=`,
831832
the image data will not be embedded unless you also specify `embed=True`.
833+
832834
filename : unicode
833835
Path to a local file to load the data from.
834836
Images from a file are always embedded.
837+
835838
format : unicode
836839
The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given
837840
for format will be inferred from the filename extension.
841+
838842
embed : bool
839843
Should the image data be embedded using a data URI (True) or be
840844
loaded using an <img> tag. Set this to True if you want the image
@@ -844,21 +848,27 @@ def __init__(
844848
default value is `False`.
845849
846850
Note that QtConsole is not able to display images if `embed` is set to `False`
851+
847852
width : int
848853
Width in pixels to which to constrain the image in html
854+
849855
height : int
850856
Height in pixels to which to constrain the image in html
857+
851858
retina : bool
852859
Automatically set the width and height to half of the measured
853860
width and height.
854861
This only works for embedded images because it reads the width/height
855862
from image data.
856863
For non-embedded images, you can just set the desired display width
857864
and height directly.
865+
858866
unconfined : bool
859867
Set unconfined=True to disable max-width confinement of the image.
868+
860869
metadata : dict
861870
Specify extra metadata to attach to the image.
871+
862872
alt : unicode
863873
Alternative text for the image, for use by screen readers.
864874
@@ -1067,12 +1077,15 @@ def __init__(self, data=None, url=None, filename=None, embed=False,
10671077
data : unicode, str or bytes
10681078
The raw video data or a URL or filename to load the data from.
10691079
Raw data will require passing ``embed=True``.
1080+
10701081
url : unicode
10711082
A URL for the video. If you specify ``url=``,
10721083
the image data will not be embedded.
1084+
10731085
filename : unicode
10741086
Path to a local file containing the video.
10751087
Will be interpreted as a local URL unless ``embed=True``.
1088+
10761089
embed : bool
10771090
Should the video be embedded using a data URI (True) or be
10781091
loaded using a <video> tag (False).
@@ -1083,15 +1096,19 @@ def __init__(self, data=None, url=None, filename=None, embed=False,
10831096
Local files can be displayed with URLs without embedding the content, via::
10841097
10851098
Video('./video.mp4')
1099+
10861100
mimetype : unicode
10871101
Specify the mimetype for embedded videos.
10881102
Default will be guessed from file extension, if available.
1103+
10891104
width : int
10901105
Width in pixels to which to constrain the video in HTML.
10911106
If not supplied, defaults to the width of the video.
1107+
10921108
height : int
10931109
Height in pixels to which to constrain the video in html.
10941110
If not supplied, defaults to the height of the video.
1111+
10951112
html_attributes : str
10961113
Attributes for the HTML ``<video>`` block.
10971114
Default: ``"controls"`` to get video controls.
@@ -1221,7 +1238,6 @@ def set_matplotlib_close(close=True):
12211238
12221239
use `matplotlib_inline.backend_inline.set_matplotlib_close()`
12231240
1224-
12251241
Set whether the inline backend closes all figures automatically or not.
12261242
12271243
By default, the inline backend used in the IPython Notebook will close all

IPython/core/formatters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ def for_type(self, typ, func=None):
433433
----------
434434
typ : type or '__module__.__name__' string for a type
435435
The class of the object that will be formatted using `func`.
436+
436437
func : callable
437438
A callable for computing the format data.
438439
`func` will be called with the object to be formatted,
@@ -474,8 +475,10 @@ def for_type_by_name(self, type_module, type_name, func=None):
474475
type_module : str
475476
The full dotted name of the module the type is defined in, like
476477
``numpy``.
478+
477479
type_name : str
478480
The name of the type (the class name), like ``dtype``
481+
479482
func : callable
480483
A callable for computing the format data.
481484
`func` will be called with the object to be formatted,

IPython/core/history.py

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ def __init__(self, profile="default", hist_file="", **traits):
195195
Parameters
196196
----------
197197
profile : str
198-
The name of the profile from which to open history.
198+
The name of the profile from which to open history.
199199
hist_file : str
200-
Path to an SQLite history database stored by IPython. If specified,
201-
hist_file overrides profile.
200+
Path to an SQLite history database stored by IPython. If specified,
201+
hist_file overrides profile.
202202
config : :class:`~traitlets.config.loader.Config`
203-
Config object. hist_file can also be set through this.
203+
Config object. hist_file can also be set through this.
204204
"""
205205
# We need a pointer back to the shell for various tasks.
206206
super(HistoryAccessor, self).__init__(**traits)
@@ -227,7 +227,7 @@ def _get_hist_file_name(self, profile='default'):
227227
Parameters
228228
----------
229229
profile : str
230-
The name of a profile which has a history file.
230+
The name of a profile which has a history file.
231231
"""
232232
return Path(locate_profile(profile)) / "history.sqlite"
233233

@@ -271,13 +271,13 @@ def _run_sql(self, sql, params, raw=True, output=False, latest=False):
271271
Parameters
272272
----------
273273
sql : str
274-
Any filtering expressions to go after SELECT ... FROM ...
274+
Any filtering expressions to go after SELECT ... FROM ...
275275
params : tuple
276-
Parameters passed to the SQL query (to replace "?")
276+
Parameters passed to the SQL query (to replace "?")
277277
raw, output : bool
278-
See :meth:`get_range`
278+
See :meth:`get_range`
279279
latest : bool
280-
Select rows with max (session, line)
280+
Select rows with max (session, line)
281281
282282
Returns
283283
-------
@@ -305,23 +305,21 @@ def get_session_info(self, session):
305305
306306
Parameters
307307
----------
308-
309308
session : int
310309
Session number to retrieve.
311310
312311
Returns
313312
-------
314-
315313
session_id : int
316-
Session ID number
314+
Session ID number
317315
start : datetime
318-
Timestamp for the start of the session.
316+
Timestamp for the start of the session.
319317
end : datetime
320-
Timestamp for the end of the session, or None if IPython crashed.
318+
Timestamp for the end of the session, or None if IPython crashed.
321319
num_cmds : int
322-
Number of commands run, or None if IPython crashed.
320+
Number of commands run, or None if IPython crashed.
323321
remark : unicode
324-
A manually set description.
322+
A manually set description.
325323
"""
326324
query = "SELECT * from sessions where session == ?"
327325
return self.db.execute(query, (session,)).fetchone()
@@ -343,13 +341,13 @@ def get_tail(self, n=10, raw=True, output=False, include_latest=False):
343341
Parameters
344342
----------
345343
n : int
346-
The number of lines to get
344+
The number of lines to get
347345
raw, output : bool
348-
See :meth:`get_range`
346+
See :meth:`get_range`
349347
include_latest : bool
350-
If False (default), n+1 lines are fetched, and the latest one
351-
is discarded. This is intended to be used where the function
352-
is called by a user command, which it should not return.
348+
If False (default), n+1 lines are fetched, and the latest one
349+
is discarded. This is intended to be used where the function
350+
is called by a user command, which it should not return.
353351
354352
Returns
355353
-------
@@ -373,16 +371,16 @@ def search(self, pattern="*", raw=True, search_raw=True,
373371
Parameters
374372
----------
375373
pattern : str
376-
The wildcarded pattern to match when searching
374+
The wildcarded pattern to match when searching
377375
search_raw : bool
378-
If True, search the raw input, otherwise, the parsed input
376+
If True, search the raw input, otherwise, the parsed input
379377
raw, output : bool
380-
See :meth:`get_range`
378+
See :meth:`get_range`
381379
n : None or int
382-
If an integer is given, it defines the limit of
383-
returned entries.
380+
If an integer is given, it defines the limit of
381+
returned entries.
384382
unique : bool
385-
When it is true, return only unique entries.
383+
When it is true, return only unique entries.
386384
387385
Returns
388386
-------
@@ -430,9 +428,9 @@ def get_range(self, session, start=1, stop=None, raw=True,output=False):
430428
Returns
431429
-------
432430
entries
433-
An iterator over the desired lines. Each line is a 3-tuple, either
434-
(session, line, input) if output is False, or
435-
(session, line, (input, output)) if output is True.
431+
An iterator over the desired lines. Each line is a 3-tuple, either
432+
(session, line, input) if output is False, or
433+
(session, line, (input, output)) if output is True.
436434
"""
437435
if stop:
438436
lineclause = "line >= ? AND line < ?"
@@ -451,13 +449,13 @@ def get_range_by_str(self, rangestr, raw=True, output=False):
451449
Parameters
452450
----------
453451
rangestr : str
454-
A string specifying ranges, e.g. "5 ~2/1-4". If empty string is used,
455-
this will return everything from current session's history.
452+
A string specifying ranges, e.g. "5 ~2/1-4". If empty string is used,
453+
this will return everything from current session's history.
456454
457-
See the documentation of :func:`%history` for the full details.
455+
See the documentation of :func:`%history` for the full details.
458456
459457
raw, output : bool
460-
As :meth:`get_range`
458+
As :meth:`get_range`
461459
462460
Returns
463461
-------
@@ -605,24 +603,22 @@ def get_session_info(self, session=0):
605603
606604
Parameters
607605
----------
608-
609606
session : int
610607
Session number to retrieve. The current session is 0, and negative
611608
numbers count back from current session, so -1 is the previous session.
612609
613610
Returns
614611
-------
615-
616612
session_id : int
617-
Session ID number
613+
Session ID number
618614
start : datetime
619-
Timestamp for the start of the session.
615+
Timestamp for the start of the session.
620616
end : datetime
621-
Timestamp for the end of the session, or None if IPython crashed.
617+
Timestamp for the end of the session, or None if IPython crashed.
622618
num_cmds : int
623-
Number of commands run, or None if IPython crashed.
619+
Number of commands run, or None if IPython crashed.
624620
remark : unicode
625-
A manually set description.
621+
A manually set description.
626622
"""
627623
if session <= 0:
628624
session += self.session_number
@@ -673,9 +669,9 @@ def get_range(self, session=0, start=1, stop=None, raw=True,output=False):
673669
Returns
674670
-------
675671
entries
676-
An iterator over the desired lines. Each line is a 3-tuple, either
677-
(session, line, input) if output is False, or
678-
(session, line, (input, output)) if output is True.
672+
An iterator over the desired lines. Each line is a 3-tuple, either
673+
(session, line, input) if output is False, or
674+
(session, line, (input, output)) if output is True.
679675
"""
680676
if session <= 0:
681677
session += self.session_number
@@ -694,14 +690,12 @@ def store_inputs(self, line_num, source, source_raw=None):
694690
Parameters
695691
----------
696692
line_num : int
697-
The prompt number of this input.
698-
693+
The prompt number of this input.
699694
source : str
700-
Python input.
701-
695+
Python input.
702696
source_raw : str, optional
703-
If given, this is the raw input without any IPython transformations
704-
applied to it. If not given, ``source`` is used.
697+
If given, this is the raw input without any IPython transformations
698+
applied to it. If not given, ``source`` is used.
705699
"""
706700
if source_raw is None:
707701
source_raw = source
@@ -745,7 +739,7 @@ def store_output(self, line_num):
745739
Parameters
746740
----------
747741
line_num : int
748-
The line number from which to save outputs
742+
The line number from which to save outputs
749743
"""
750744
if (not self.db_log_output) or (line_num not in self.output_hist_reprs):
751745
return

0 commit comments

Comments
 (0)