##// END OF EJS Templates
Merge pull request #12893 from Carreau/doc-reformat...
Carol Willing -
r26455:e0d15ef6 merge
parent child Browse files
Show More
@@ -49,18 +49,16 b' def process_handler(cmd, callback, stderr=subprocess.PIPE):'
49 Parameters
49 Parameters
50 ----------
50 ----------
51 cmd : str or list
51 cmd : str or list
52 A command to be executed by the system, using :class:`subprocess.Popen`.
52 A command to be executed by the system, using :class:`subprocess.Popen`.
53 If a string is passed, it will be run in the system shell. If a list is
53 If a string is passed, it will be run in the system shell. If a list is
54 passed, it will be used directly as arguments.
54 passed, it will be used directly as arguments.
55
56 callback : callable
55 callback : callable
57 A one-argument function that will be called with the Popen object.
56 A one-argument function that will be called with the Popen object.
58
59 stderr : file descriptor number, optional
57 stderr : file descriptor number, optional
60 By default this is set to ``subprocess.PIPE``, but you can also pass the
58 By default this is set to ``subprocess.PIPE``, but you can also pass the
61 value ``subprocess.STDOUT`` to force the subprocess' stderr to go into
59 value ``subprocess.STDOUT`` to force the subprocess' stderr to go into
62 the same file descriptor as its stdout. This is useful to read stdout
60 the same file descriptor as its stdout. This is useful to read stdout
63 and stderr combined in the order they are generated.
61 and stderr combined in the order they are generated.
64
62
65 Returns
63 Returns
66 -------
64 -------
@@ -117,12 +115,12 b' def getoutput(cmd):'
117 Parameters
115 Parameters
118 ----------
116 ----------
119 cmd : str or list
117 cmd : str or list
120 A command to be executed in the system shell.
118 A command to be executed in the system shell.
121
119
122 Returns
120 Returns
123 -------
121 -------
124 output : str
122 output : str
125 A string containing the combination of stdout and stderr from the
123 A string containing the combination of stdout and stderr from the
126 subprocess, in whatever order the subprocess originally wrote to its
124 subprocess, in whatever order the subprocess originally wrote to its
127 file descriptors (so the order of the information in this string is the
125 file descriptors (so the order of the information in this string is the
128 correct order as would be seen if running the command in a terminal).
126 correct order as would be seen if running the command in a terminal).
@@ -141,7 +139,7 b' def getoutputerror(cmd):'
141 Parameters
139 Parameters
142 ----------
140 ----------
143 cmd : str or list
141 cmd : str or list
144 A command to be executed in the system shell.
142 A command to be executed in the system shell.
145
143
146 Returns
144 Returns
147 -------
145 -------
@@ -159,7 +157,7 b' def get_output_error_code(cmd):'
159 Parameters
157 Parameters
160 ----------
158 ----------
161 cmd : str or list
159 cmd : str or list
162 A command to be executed in the system shell.
160 A command to be executed in the system shell.
163
161
164 Returns
162 Returns
165 -------
163 -------
@@ -82,12 +82,12 b' class ProcessHandler(object):'
82 Parameters
82 Parameters
83 ----------
83 ----------
84 cmd : str
84 cmd : str
85 A command to be executed in the system shell.
85 A command to be executed in the system shell.
86
86
87 Returns
87 Returns
88 -------
88 -------
89 output : str
89 output : str
90 A string containing the combination of stdout and stderr from the
90 A string containing the combination of stdout and stderr from the
91 subprocess, in whatever order the subprocess originally wrote to its
91 subprocess, in whatever order the subprocess originally wrote to its
92 file descriptors (so the order of the information in this string is the
92 file descriptors (so the order of the information in this string is the
93 correct order as would be seen if running the command in a terminal).
93 correct order as would be seen if running the command in a terminal).
@@ -103,12 +103,12 b' class ProcessHandler(object):'
103 Parameters
103 Parameters
104 ----------
104 ----------
105 cmd : str
105 cmd : str
106 A command to be executed in the system shell.
106 A command to be executed in the system shell.
107
107
108 Returns
108 Returns
109 -------
109 -------
110 output : str
110 output : str
111 A string containing the combination of stdout and stderr from the
111 A string containing the combination of stdout and stderr from the
112 subprocess, in whatever order the subprocess originally wrote to its
112 subprocess, in whatever order the subprocess originally wrote to its
113 file descriptors (so the order of the information in this string is the
113 file descriptors (so the order of the information in this string is the
114 correct order as would be seen if running the command in a terminal).
114 correct order as would be seen if running the command in a terminal).
@@ -124,7 +124,7 b' class ProcessHandler(object):'
124 Parameters
124 Parameters
125 ----------
125 ----------
126 cmd : str
126 cmd : str
127 A command to be executed in the system shell.
127 A command to be executed in the system shell.
128
128
129 Returns
129 Returns
130 -------
130 -------
@@ -128,7 +128,7 b' def system(cmd):'
128 Parameters
128 Parameters
129 ----------
129 ----------
130 cmd : str or list
130 cmd : str or list
131 A command to be executed in the system shell.
131 A command to be executed in the system shell.
132
132
133 Returns
133 Returns
134 -------
134 -------
@@ -152,7 +152,7 b' def getoutput(cmd):'
152 Parameters
152 Parameters
153 ----------
153 ----------
154 cmd : str or list
154 cmd : str or list
155 A command to be executed in the system shell.
155 A command to be executed in the system shell.
156
156
157 Returns
157 Returns
158 -------
158 -------
@@ -181,7 +181,7 b' try:'
181
181
182 This is a special version for windows that use a ctypes call to CommandLineToArgvW
182 This is a special version for windows that use a ctypes call to CommandLineToArgvW
183 to do the argv splitting. The posix parameter is ignored.
183 to do the argv splitting. The posix parameter is ignored.
184
184
185 If strict=False, process_common.arg_split(...strict=False) is used instead.
185 If strict=False, process_common.arg_split(...strict=False) is used instead.
186 """
186 """
187 #CommandLineToArgvW returns path to executable if called with empty string.
187 #CommandLineToArgvW returns path to executable if called with empty string.
@@ -551,13 +551,13 b' def system(cmd):'
551 Parameters
551 Parameters
552 ----------
552 ----------
553 cmd : str
553 cmd : str
554 A command to be executed in the system shell.
554 A command to be executed in the system shell.
555
555
556 Returns
556 Returns
557 -------
557 -------
558 None : we explicitly do NOT return the subprocess status code, as this
558 None : we explicitly do NOT return the subprocess status code, as this
559 utility is meant to be used extensively in IPython, where any return value
559 utility is meant to be used extensively in IPython, where any return value
560 would trigger :func:`sys.displayhook` calls.
560 would trigger : func:`sys.displayhook` calls.
561 """
561 """
562 with AvoidUNCPath() as path:
562 with AvoidUNCPath() as path:
563 if path is not None:
563 if path is not None:
@@ -50,7 +50,7 b' def flag_calls(func):'
50
50
51 def undoc(func):
51 def undoc(func):
52 """Mark a function or class as undocumented.
52 """Mark a function or class as undocumented.
53
53
54 This is found by inspecting the AST, so for now it must be used directly
54 This is found by inspecting the AST, so for now it must be used directly
55 as @undoc, not as e.g. @decorators.undoc
55 as @undoc, not as e.g. @decorators.undoc
56 """
56 """
@@ -37,10 +37,10 b' def get_stream_enc(stream, default=None):'
37 # won't need to make changes all over IPython.
37 # won't need to make changes all over IPython.
38 def getdefaultencoding(prefer_stream=True):
38 def getdefaultencoding(prefer_stream=True):
39 """Return IPython's guess for the default encoding for bytes as text.
39 """Return IPython's guess for the default encoding for bytes as text.
40
40
41 If prefer_stream is True (default), asks for stdin.encoding first,
41 If prefer_stream is True (default), asks for stdin.encoding first,
42 to match the calling Terminal, but that is often None for subprocesses.
42 to match the calling Terminal, but that is often None for subprocesses.
43
43
44 Then fall back on locale.getpreferredencoding(),
44 Then fall back on locale.getpreferredencoding(),
45 which should be a sensible platform default (that respects LANG environment),
45 which should be a sensible platform default (that respects LANG environment),
46 and finally to sys.getdefaultencoding() which is the most conservative option,
46 and finally to sys.getdefaultencoding() which is the most conservative option,
@@ -28,12 +28,10 b' def extract_vars(*names,**kw):'
28 *names : str
28 *names : str
29 One or more variable names which will be extracted from the caller's
29 One or more variable names which will be extracted from the caller's
30 frame.
30 frame.
31
31 **kw : integer, optional
32 depth : integer, optional
33 How many frames in the stack to walk when looking for your variables.
32 How many frames in the stack to walk when looking for your variables.
34 The default is 0, which will use the frame where the call was made.
33 The default is 0, which will use the frame where the call was made.
35
34
36
37 Examples
35 Examples
38 --------
36 --------
39 ::
37 ::
@@ -22,7 +22,6 b' def complete_object(obj, prev_completions):'
22 The object to complete.
22 The object to complete.
23 prev_completions : list
23 prev_completions : list
24 List of attributes discovered so far.
24 List of attributes discovered so far.
25
26 This should return the list of attributes in obj. If you only wish to
25 This should return the list of attributes in obj. If you only wish to
27 add to the attributes already discovered normally, return
26 add to the attributes already discovered normally, return
28 own_attrs + prev_completions.
27 own_attrs + prev_completions.
@@ -16,12 +16,12 b' def import_item(name):'
16 Parameters
16 Parameters
17 ----------
17 ----------
18 name : string
18 name : string
19 The fully qualified name of the module/package being imported.
19 The fully qualified name of the module/package being imported.
20
20
21 Returns
21 Returns
22 -------
22 -------
23 mod : module object
23 mod : module object
24 The module that was imported.
24 The module that was imported.
25 """
25 """
26
26
27 parts = name.rsplit('.', 1)
27 parts = name.rsplit('.', 1)
@@ -113,11 +113,9 b' class Tee(object):'
113 Parameters
113 Parameters
114 ----------
114 ----------
115 file_or_name : filename or open filehandle (writable)
115 file_or_name : filename or open filehandle (writable)
116 File that will be duplicated
116 File that will be duplicated
117
118 mode : optional, valid mode for open().
117 mode : optional, valid mode for open().
119 If a filename was give, open with this mode.
118 If a filename was give, open with this mode.
120
121 channel : str, one of ['stdout', 'stderr']
119 channel : str, one of ['stdout', 'stderr']
122 """
120 """
123 if channel not in ['stdout', 'stderr']:
121 if channel not in ['stdout', 'stderr']:
@@ -195,15 +193,14 b" def temp_pyfile(src, ext='.py'):"
195 Parameters
193 Parameters
196 ----------
194 ----------
197 src : string or list of strings (no need for ending newlines if list)
195 src : string or list of strings (no need for ending newlines if list)
198 Source code to be written to the file.
196 Source code to be written to the file.
199
200 ext : optional, string
197 ext : optional, string
201 Extension for the generated file.
198 Extension for the generated file.
202
199
203 Returns
200 Returns
204 -------
201 -------
205 (filename, open filehandle)
202 (filename, open filehandle)
206 It is the caller's responsibility to close the open file and unlink it.
203 It is the caller's responsibility to close the open file and unlink it.
207 """
204 """
208 fname = tempfile.mkstemp(ext)[1]
205 fname = tempfile.mkstemp(ext)[1]
209 with open(Path(fname), "w") as f:
206 with open(Path(fname), "w") as f:
@@ -43,14 +43,13 b' class Struct(dict):'
43
43
44 Parameters
44 Parameters
45 ----------
45 ----------
46 args : dict, Struct
46 *args : dict, Struct
47 Initialize with one dict or Struct
47 Initialize with one dict or Struct
48 kw : dict
48 **kw : dict
49 Initialize with key, value pairs.
49 Initialize with key, value pairs.
50
50
51 Examples
51 Examples
52 --------
52 --------
53
54 >>> s = Struct(a=10,b=30)
53 >>> s = Struct(a=10,b=30)
55 >>> s.a
54 >>> s.a
56 10
55 10
@@ -68,7 +67,6 b' class Struct(dict):'
68
67
69 Examples
68 Examples
70 --------
69 --------
71
72 >>> s = Struct()
70 >>> s = Struct()
73 >>> s['a'] = 10
71 >>> s['a'] = 10
74 >>> s.allow_new_attr(False)
72 >>> s.allow_new_attr(False)
@@ -95,7 +93,6 b' class Struct(dict):'
95
93
96 Examples
94 Examples
97 --------
95 --------
98
99 >>> s = Struct()
96 >>> s = Struct()
100 >>> s.a = 10
97 >>> s.a = 10
101 >>> s.a
98 >>> s.a
@@ -130,7 +127,6 b' class Struct(dict):'
130
127
131 Examples
128 Examples
132 --------
129 --------
133
134 >>> s = Struct(a=10)
130 >>> s = Struct(a=10)
135 >>> s.a
131 >>> s.a
136 10
132 10
@@ -155,7 +151,6 b' class Struct(dict):'
155
151
156 Examples
152 Examples
157 --------
153 --------
158
159 >>> s = Struct(a=10,b=30)
154 >>> s = Struct(a=10,b=30)
160 >>> s2 = Struct(a=20,c=40)
155 >>> s2 = Struct(a=20,c=40)
161 >>> s += s2
156 >>> s += s2
@@ -170,7 +165,6 b' class Struct(dict):'
170
165
171 Examples
166 Examples
172 --------
167 --------
173
174 >>> s1 = Struct(a=10,b=30)
168 >>> s1 = Struct(a=10,b=30)
175 >>> s2 = Struct(a=20,c=40)
169 >>> s2 = Struct(a=20,c=40)
176 >>> s = s1 + s2
170 >>> s = s1 + s2
@@ -186,7 +180,6 b' class Struct(dict):'
186
180
187 Examples
181 Examples
188 --------
182 --------
189
190 >>> s1 = Struct(a=10,b=30)
183 >>> s1 = Struct(a=10,b=30)
191 >>> s2 = Struct(a=40)
184 >>> s2 = Struct(a=40)
192 >>> s = s1 - s2
185 >>> s = s1 - s2
@@ -202,7 +195,6 b' class Struct(dict):'
202
195
203 Examples
196 Examples
204 --------
197 --------
205
206 >>> s1 = Struct(a=10,b=30)
198 >>> s1 = Struct(a=10,b=30)
207 >>> s2 = Struct(a=40)
199 >>> s2 = Struct(a=40)
208 >>> s1 -= s2
200 >>> s1 -= s2
@@ -236,7 +228,6 b' class Struct(dict):'
236
228
237 Examples
229 Examples
238 --------
230 --------
239
240 >>> s = Struct(a=10,b=30)
231 >>> s = Struct(a=10,b=30)
241 >>> s2 = s.copy()
232 >>> s2 = s.copy()
242 >>> type(s2) is Struct
233 >>> type(s2) is Struct
@@ -251,7 +242,6 b' class Struct(dict):'
251
242
252 Examples
243 Examples
253 --------
244 --------
254
255 >>> s = Struct(a=10)
245 >>> s = Struct(a=10)
256 >>> s.hasattr('a')
246 >>> s.hasattr('a')
257 True
247 True
@@ -284,7 +274,7 b' class Struct(dict):'
284
274
285 Parameters
275 Parameters
286 ----------
276 ----------
287 __loc_data : dict, Struct
277 __loc_data__ : dict, Struct
288 The data to merge into self
278 The data to merge into self
289 __conflict_solve : dict
279 __conflict_solve : dict
290 The conflict policy dict. The keys are binary functions used to
280 The conflict policy dict. The keys are binary functions used to
@@ -292,12 +282,11 b' class Struct(dict):'
292 the keys the conflict resolution function applies to. Instead of
282 the keys the conflict resolution function applies to. Instead of
293 a list of strings a space separated string can be used, like
283 a list of strings a space separated string can be used, like
294 'a b c'.
284 'a b c'.
295 kw : dict
285 **kw : dict
296 Additional key, value pairs to merge in
286 Additional key, value pairs to merge in
297
287
298 Notes
288 Notes
299 -----
289 -----
300
301 The `__conflict_solve` dict is a dictionary of binary functions which will be used to
290 The `__conflict_solve` dict is a dictionary of binary functions which will be used to
302 solve key conflicts. Here is an example::
291 solve key conflicts. Here is an example::
303
292
@@ -338,7 +327,6 b' class Struct(dict):'
338
327
339 Examples
328 Examples
340 --------
329 --------
341
342 This show the default policy:
330 This show the default policy:
343
331
344 >>> s = Struct(a=10,b=30)
332 >>> s = Struct(a=10,b=30)
@@ -43,7 +43,7 b' def find_mod(module_name):'
43 """
43 """
44 Find module `module_name` on sys.path, and return the path to module `module_name`.
44 Find module `module_name` on sys.path, and return the path to module `module_name`.
45
45
46 - If `module_name` refers to a module directory, then return path to __init__ file.
46 - If `module_name` refers to a module directory, then return path to __init__ file.
47 - If `module_name` is a directory without an __init__file, return None.
47 - If `module_name` is a directory without an __init__file, return None.
48 - If module is missing or does not have a `.py` or `.pyw` extension, return None.
48 - If module is missing or does not have a `.py` or `.pyw` extension, return None.
49 - Note that we are not interested in running bytecode.
49 - Note that we are not interested in running bytecode.
@@ -52,7 +52,7 b' def find_mod(module_name):'
52 Parameters
52 Parameters
53 ----------
53 ----------
54 module_name : str
54 module_name : str
55
55
56 Returns
56 Returns
57 -------
57 -------
58 module_path : str
58 module_path : str
@@ -60,15 +60,15 b' def strip_encoding_cookie(filelike):'
60
60
61 def read_py_file(filename, skip_encoding_cookie=True):
61 def read_py_file(filename, skip_encoding_cookie=True):
62 """Read a Python file, using the encoding declared inside the file.
62 """Read a Python file, using the encoding declared inside the file.
63
63
64 Parameters
64 Parameters
65 ----------
65 ----------
66 filename : str
66 filename : str
67 The path to the file to read.
67 The path to the file to read.
68 skip_encoding_cookie : bool
68 skip_encoding_cookie : bool
69 If True (the default), and the encoding declaration is found in the first
69 If True (the default), and the encoding declaration is found in the first
70 two lines, that line will be excluded from the output.
70 two lines, that line will be excluded from the output.
71
71
72 Returns
72 Returns
73 -------
73 -------
74 A unicode string containing the contents of the file.
74 A unicode string containing the contents of the file.
@@ -82,18 +82,18 b' def read_py_file(filename, skip_encoding_cookie=True):'
82
82
83 def read_py_url(url, errors='replace', skip_encoding_cookie=True):
83 def read_py_url(url, errors='replace', skip_encoding_cookie=True):
84 """Read a Python file from a URL, using the encoding declared inside the file.
84 """Read a Python file from a URL, using the encoding declared inside the file.
85
85
86 Parameters
86 Parameters
87 ----------
87 ----------
88 url : str
88 url : str
89 The URL from which to fetch the file.
89 The URL from which to fetch the file.
90 errors : str
90 errors : str
91 How to handle decoding errors in the file. Options are the same as for
91 How to handle decoding errors in the file. Options are the same as for
92 bytes.decode(), but here 'replace' is the default.
92 bytes.decode(), but here 'replace' is the default.
93 skip_encoding_cookie : bool
93 skip_encoding_cookie : bool
94 If True (the default), and the encoding declaration is found in the first
94 If True (the default), and the encoding declaration is found in the first
95 two lines, that line will be excluded from the output.
95 two lines, that line will be excluded from the output.
96
96
97 Returns
97 Returns
98 -------
98 -------
99 A unicode string containing the contents of the file.
99 A unicode string containing the contents of the file.
@@ -109,7 +109,7 b' def get_py_filename(name, force_win32=None):'
109 raise IOError('File `%r` not found.' % name)
109 raise IOError('File `%r` not found.' % name)
110
110
111
111
112 def filefind(filename, path_dirs=None):
112 def filefind(filename: str, path_dirs=None) -> str:
113 """Find a file by looking through a sequence of paths.
113 """Find a file by looking through a sequence of paths.
114
114
115 This iterates through a sequence of paths looking for a file and returns
115 This iterates through a sequence of paths looking for a file and returns
@@ -139,7 +139,12 b' def filefind(filename, path_dirs=None):'
139
139
140 Returns
140 Returns
141 -------
141 -------
142 Raises :exc:`IOError` or returns absolute path to file.
142 path : str
143 returns absolute path to file.
144
145 Raises
146 ------
147 IOError
143 """
148 """
144
149
145 # If paths are quoted, abspath gets confused, strip them...
150 # If paths are quoted, abspath gets confused, strip them...
@@ -178,7 +183,6 b' def get_home_dir(require_writable=False) -> str:'
178
183
179 Parameters
184 Parameters
180 ----------
185 ----------
181
182 require_writable : bool [default: False]
186 require_writable : bool [default: False]
183 if True:
187 if True:
184 guarantees the return value is a writable directory, otherwise
188 guarantees the return value is a writable directory, otherwise
@@ -40,15 +40,15 b' def pkg_commit_hash(pkg_path):'
40 Parameters
40 Parameters
41 ----------
41 ----------
42 pkg_path : str
42 pkg_path : str
43 directory containing package
43 directory containing package
44 only used for getting commit from active repo
44 only used for getting commit from active repo
45
45
46 Returns
46 Returns
47 -------
47 -------
48 hash_from : str
48 hash_from : str
49 Where we got the hash from - description
49 Where we got the hash from - description
50 hash_str : str
50 hash_str : str
51 short form of hash
51 short form of hash
52 """
52 """
53 # Try and get commit from written commit text file
53 # Try and get commit from written commit text file
54 if _sysinfo.commit:
54 if _sysinfo.commit:
@@ -71,12 +71,12 b' def pkg_info(pkg_path):'
71 Parameters
71 Parameters
72 ----------
72 ----------
73 pkg_path : str
73 pkg_path : str
74 path containing __init__.py for package
74 path containing __init__.py for package
75
75
76 Returns
76 Returns
77 -------
77 -------
78 context : dict
78 context : dict
79 with named parameters of interest
79 with named parameters of interest
80 """
80 """
81 src, hsh = pkg_commit_hash(pkg_path)
81 src, hsh = pkg_commit_hash(pkg_path)
82 return dict(
82 return dict(
@@ -45,7 +45,7 b' def toggle_set_term_title(val):'
45
45
46 Parameters
46 Parameters
47 ----------
47 ----------
48 val : bool
48 val : bool
49 If True, set_term_title() actually writes to the terminal (using the
49 If True, set_term_title() actually writes to the terminal (using the
50 appropriate platform-specific module). If False, it is a no-op.
50 appropriate platform-specific module). If False, it is a no-op.
51 """
51 """
@@ -111,7 +111,7 b' def test_rich_output_metadata(method_mime):'
111
111
112 def test_rich_output_display():
112 def test_rich_output_display():
113 """test RichOutput.display
113 """test RichOutput.display
114
114
115 This is a bit circular, because we are actually using the capture code we are testing
115 This is a bit circular, because we are actually using the capture code we are testing
116 to test itself.
116 to test itself.
117 """
117 """
@@ -54,8 +54,8 b' def setup_module():'
54 def teardown_module():
54 def teardown_module():
55 """Teardown testenvironment for the module:
55 """Teardown testenvironment for the module:
56
56
57 - Remove tempdir
57 - Remove tempdir
58 - restore sys.path
58 - restore sys.path
59 """
59 """
60 # Note: we remove the parent test dir, which is the root of all test
60 # Note: we remove the parent test dir, which is the root of all test
61 # subdirs we may have created. Use shutil instead of os.removedirs, so
61 # subdirs we may have created. Use shutil instead of os.removedirs, so
@@ -56,7 +56,7 b' HOME_TEST_DIR = join(TMP_TEST_DIR, "home_test_dir")'
56 def setup_module():
56 def setup_module():
57 """Setup testenvironment for the module:
57 """Setup testenvironment for the module:
58
58
59 - Adds dummy home dir tree
59 - Adds dummy home dir tree
60 """
60 """
61 # Do not mask exceptions here. In particular, catching WindowsError is a
61 # Do not mask exceptions here. In particular, catching WindowsError is a
62 # problem because that exception is only defined on Windows...
62 # problem because that exception is only defined on Windows...
@@ -66,7 +66,7 b' def setup_module():'
66 def teardown_module():
66 def teardown_module():
67 """Teardown testenvironment for the module:
67 """Teardown testenvironment for the module:
68
68
69 - Remove dummy home dir tree
69 - Remove dummy home dir tree
70 """
70 """
71 # Note: we remove the parent test dir, which is the root of all test
71 # Note: we remove the parent test dir, which is the root of all test
72 # subdirs we may have created. Use shutil instead of os.removedirs, so
72 # subdirs we may have created. Use shutil instead of os.removedirs, so
@@ -12,6 +12,6 b' from IPython.utils import sysinfo'
12
12
13 def test_json_getsysinfo():
13 def test_json_getsysinfo():
14 """
14 """
15 test that it is easily jsonable and don't return bytes somewhere.
15 test that it is easily jsonable and don't return bytes somewhere.
16 """
16 """
17 json.dumps(sysinfo.get_sys_info())
17 json.dumps(sysinfo.get_sys_info())
@@ -252,7 +252,6 b' def indent(instr,nspaces=4, ntabs=0, flatten=False):'
252
252
253 Parameters
253 Parameters
254 ----------
254 ----------
255
256 instr : basestring
255 instr : basestring
257 The string to be indented.
256 The string to be indented.
258 nspaces : int (default: 4)
257 nspaces : int (default: 4)
@@ -266,7 +265,6 b' def indent(instr,nspaces=4, ntabs=0, flatten=False):'
266
265
267 Returns
266 Returns
268 -------
267 -------
269
270 str|unicode : string indented by ntabs and nspaces.
268 str|unicode : string indented by ntabs and nspaces.
271
269
272 """
270 """
@@ -390,7 +388,6 b' def wrap_paragraphs(text, ncols=80):'
390
388
391 Returns
389 Returns
392 -------
390 -------
393
394 list of complete paragraphs, wrapped to fill `ncols` columns.
391 list of complete paragraphs, wrapped to fill `ncols` columns.
395 """
392 """
396 paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE)
393 paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE)
@@ -410,7 +407,7 b' def wrap_paragraphs(text, ncols=80):'
410
407
411 def long_substr(data):
408 def long_substr(data):
412 """Return the longest common substring in a list of strings.
409 """Return the longest common substring in a list of strings.
413
410
414 Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python
411 Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python
415 """
412 """
416 substr = ''
413 substr = ''
@@ -474,7 +471,7 b' def strip_email_quotes(text):'
474 def strip_ansi(source):
471 def strip_ansi(source):
475 """
472 """
476 Remove ansi escape codes from text.
473 Remove ansi escape codes from text.
477
474
478 Parameters
475 Parameters
479 ----------
476 ----------
480 source : str
477 source : str
@@ -651,7 +648,6 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :'
651
648
652 Parameters
649 Parameters
653 ----------
650 ----------
654
655 items
651 items
656 list of strings to columize
652 list of strings to columize
657 row_first : (default False)
653 row_first : (default False)
@@ -666,14 +662,11 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :'
666
662
667 Returns
663 Returns
668 -------
664 -------
669
670 strings_matrix
665 strings_matrix
671
672 nested list of string, the outer most list contains as many list as
666 nested list of string, the outer most list contains as many list as
673 rows, the innermost lists have each as many element as columns. If the
667 rows, the innermost lists have each as many element as columns. If the
674 total number of elements in `items` does not equal the product of
668 total number of elements in `items` does not equal the product of
675 rows*columns, the last element of some lists are filled with `None`.
669 rows*columns, the last element of some lists are filled with `None`.
676
677 dict_info
670 dict_info
678 some info to make columnize easier:
671 some info to make columnize easier:
679
672
@@ -713,14 +706,11 b" def columnize(items, row_first=False, separator=' ', displaywidth=80, spread=Fa"
713 ----------
706 ----------
714 items : sequence of strings
707 items : sequence of strings
715 The strings to process.
708 The strings to process.
716
717 row_first : (default False)
709 row_first : (default False)
718 Whether to compute columns for a row-first matrix instead of
710 Whether to compute columns for a row-first matrix instead of
719 column-first (default).
711 column-first (default).
720
721 separator : str, optional [default is two spaces]
712 separator : str, optional [default is two spaces]
722 The string that separates columns.
713 The string that separates columns.
723
724 displaywidth : int, optional [default is 80]
714 displaywidth : int, optional [default is 80]
725 Width of the display in number of characters.
715 Width of the display in number of characters.
726
716
@@ -23,20 +23,18 b' def generate_tokens(readline):'
23
23
24 def line_at_cursor(cell, cursor_pos=0):
24 def line_at_cursor(cell, cursor_pos=0):
25 """Return the line in a cell at a given cursor position
25 """Return the line in a cell at a given cursor position
26
26
27 Used for calling line-based APIs that don't support multi-line input, yet.
27 Used for calling line-based APIs that don't support multi-line input, yet.
28
28
29 Parameters
29 Parameters
30 ----------
30 ----------
31
31 cell : str
32 cell: str
33 multiline block of text
32 multiline block of text
34 cursor_pos: integer
33 cursor_pos : integer
35 the cursor position
34 the cursor position
36
35
37 Returns
36 Returns
38 -------
37 -------
39
40 (line, offset): (string, integer)
38 (line, offset): (string, integer)
41 The line with the current cursor, and the character offset of the start of the line.
39 The line with the current cursor, and the character offset of the start of the line.
42 """
40 """
@@ -58,15 +56,14 b' def line_at_cursor(cell, cursor_pos=0):'
58
56
59 def token_at_cursor(cell, cursor_pos=0):
57 def token_at_cursor(cell, cursor_pos=0):
60 """Get the token at a given cursor
58 """Get the token at a given cursor
61
59
62 Used for introspection.
60 Used for introspection.
63
61
64 Function calls are prioritized, so the token for the callable will be returned
62 Function calls are prioritized, so the token for the callable will be returned
65 if the cursor is anywhere inside the call.
63 if the cursor is anywhere inside the call.
66
64
67 Parameters
65 Parameters
68 ----------
66 ----------
69
70 cell : unicode
67 cell : unicode
71 A block of Python code
68 A block of Python code
72 cursor_pos : int
69 cursor_pos : int
General Comments 0
You need to be logged in to leave comments. Login now