Show More
@@ -7,6 +7,9 b' python:' | |||||
7 | - 3.4 |
|
7 | - 3.4 | |
8 | - 3.3 |
|
8 | - 3.3 | |
9 | sudo: false |
|
9 | sudo: false | |
|
10 | env: | |||
|
11 | global: | |||
|
12 | - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH | |||
10 | group: edge |
|
13 | group: edge | |
11 | before_install: |
|
14 | before_install: | |
12 | - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi' |
|
15 | - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi' | |
@@ -14,8 +17,15 b' install:' | |||||
14 | - pip install setuptools pip --upgrade |
|
17 | - pip install setuptools pip --upgrade | |
15 | - pip install -e file://$PWD#egg=ipython[test] --upgrade |
|
18 | - pip install -e file://$PWD#egg=ipython[test] --upgrade | |
16 | - pip install codecov --upgrade |
|
19 | - pip install codecov --upgrade | |
|
20 | - sudo apt-get install graphviz | |||
17 | script: |
|
21 | script: | |
18 | - cd /tmp && iptest --coverage xml && cd - |
|
22 | - cd /tmp && iptest --coverage xml && cd - | |
|
23 | # On the latest Python only, make sure that the docs build. | |||
|
24 | - | | |||
|
25 | if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then | |||
|
26 | pip install -r docs/requirements.txt | |||
|
27 | make -C docs/ html SPHINXOPTS="-W" | |||
|
28 | fi | |||
19 | after_success: |
|
29 | after_success: | |
20 | - cp /tmp/ipy_coverage.xml ./ |
|
30 | - cp /tmp/ipy_coverage.xml ./ | |
21 | - cp /tmp/.coverage ./ |
|
31 | - cp /tmp/.coverage ./ |
@@ -360,7 +360,7 b' class Completion:' | |||||
360 | need user facing information. |
|
360 | need user facing information. | |
361 |
|
361 | |||
362 | - Which range should be replaced replaced by what. |
|
362 | - Which range should be replaced replaced by what. | |
363 |
- Some metadata (like completion type), or meta information |
|
363 | - Some metadata (like completion type), or meta information to displayed to | |
364 | the use user. |
|
364 | the use user. | |
365 |
|
365 | |||
366 | For debugging purpose we can also store the origin of the completion (``jedi``, |
|
366 | For debugging purpose we can also store the origin of the completion (``jedi``, | |
@@ -1873,7 +1873,7 b' class IPCompleter(Completer):' | |||||
1873 | start_offset = before.rfind(matched_text) |
|
1873 | start_offset = before.rfind(matched_text) | |
1874 |
|
1874 | |||
1875 | # TODO: |
|
1875 | # TODO: | |
1876 | # Supress this, right now just for debug. |
|
1876 | # Suppress this, right now just for debug. | |
1877 | if jedi_matches and matches and self.debug: |
|
1877 | if jedi_matches and matches and self.debug: | |
1878 | yield Completion(start=start_offset, end=offset, text='--jedi/ipython--', |
|
1878 | yield Completion(start=start_offset, end=offset, text='--jedi/ipython--', | |
1879 | _origin='debug', type='none', signature='') |
|
1879 | _origin='debug', type='none', signature='') |
@@ -32,6 +32,7 b' import inspect' | |||||
32 | import linecache |
|
32 | import linecache | |
33 | import sys |
|
33 | import sys | |
34 | import warnings |
|
34 | import warnings | |
|
35 | import re | |||
35 |
|
36 | |||
36 | from IPython import get_ipython |
|
37 | from IPython import get_ipython | |
37 | from IPython.utils import PyColorize |
|
38 | from IPython.utils import PyColorize | |
@@ -175,6 +176,13 b' class Tracer(object):' | |||||
175 | self.debugger.set_trace(sys._getframe().f_back) |
|
176 | self.debugger.set_trace(sys._getframe().f_back) | |
176 |
|
177 | |||
177 |
|
178 | |||
|
179 | RGX_EXTRA_INDENT = re.compile('(?<=\n)\s+') | |||
|
180 | ||||
|
181 | ||||
|
182 | def strip_indentation(multiline_string): | |||
|
183 | return RGX_EXTRA_INDENT.sub('', multiline_string) | |||
|
184 | ||||
|
185 | ||||
178 | def decorate_fn_with_doc(new_fn, old_fn, additional_text=""): |
|
186 | def decorate_fn_with_doc(new_fn, old_fn, additional_text=""): | |
179 | """Make new_fn have old_fn's doc string. This is particularly useful |
|
187 | """Make new_fn have old_fn's doc string. This is particularly useful | |
180 | for the ``do_...`` commands that hook into the help system. |
|
188 | for the ``do_...`` commands that hook into the help system. | |
@@ -183,7 +191,7 b' def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):' | |||||
183 | def wrapper(*args, **kw): |
|
191 | def wrapper(*args, **kw): | |
184 | return new_fn(*args, **kw) |
|
192 | return new_fn(*args, **kw) | |
185 | if old_fn.__doc__: |
|
193 | if old_fn.__doc__: | |
186 | wrapper.__doc__ = old_fn.__doc__ + additional_text |
|
194 | wrapper.__doc__ = strip_indentation(old_fn.__doc__) + additional_text | |
187 | return wrapper |
|
195 | return wrapper | |
188 |
|
196 | |||
189 |
|
197 |
@@ -252,8 +252,9 b' def display(*objs, include=None, exclude=None, metadata=None, transient=None, di' | |||||
252 | display in IPython by following the above approach. But in practice, you |
|
252 | display in IPython by following the above approach. But in practice, you | |
253 | often need to work with existing classes that you can't easily modify. |
|
253 | often need to work with existing classes that you can't easily modify. | |
254 |
|
254 | |||
255 |
You can refer to the documentation on |
|
255 | You can refer to the documentation on integrating with the display system in | |
256 |
register custom formatters for already existing types |
|
256 | order to register custom formatters for already existing types | |
|
257 | (:ref:`integrating_rich_display`). | |||
257 |
|
258 | |||
258 | .. versionadded:: 5.4 display available without import |
|
259 | .. versionadded:: 5.4 display available without import | |
259 | .. versionadded:: 6.1 display available without import |
|
260 | .. versionadded:: 6.1 display available without import |
@@ -224,7 +224,7 b' def catch_format_error(method, self, *args, **kwargs):' | |||||
224 | r = method(self, *args, **kwargs) |
|
224 | r = method(self, *args, **kwargs) | |
225 | except NotImplementedError: |
|
225 | except NotImplementedError: | |
226 | # don't warn on NotImplementedErrors |
|
226 | # don't warn on NotImplementedErrors | |
227 | return None |
|
227 | return self._check_return(None, args[0]) | |
228 | except Exception: |
|
228 | except Exception: | |
229 | exc_info = sys.exc_info() |
|
229 | exc_info = sys.exc_info() | |
230 | ip = get_ipython() |
|
230 | ip = get_ipython() | |
@@ -232,7 +232,7 b' def catch_format_error(method, self, *args, **kwargs):' | |||||
232 | ip.showtraceback(exc_info) |
|
232 | ip.showtraceback(exc_info) | |
233 | else: |
|
233 | else: | |
234 | traceback.print_exception(*exc_info) |
|
234 | traceback.print_exception(*exc_info) | |
235 | return None |
|
235 | return self._check_return(None, args[0]) | |
236 | return self._check_return(r, args[0]) |
|
236 | return self._check_return(r, args[0]) | |
237 |
|
237 | |||
238 |
|
238 |
@@ -101,7 +101,7 b' def fix_error_editor(self,filename,linenum,column,msg):' | |||||
101 | `fix_error_editor` is deprecated as of IPython 6.0 and will be removed |
|
101 | `fix_error_editor` is deprecated as of IPython 6.0 and will be removed | |
102 | in future versions. It appears to be used only for automatically fixing syntax |
|
102 | in future versions. It appears to be used only for automatically fixing syntax | |
103 | error that has been broken for a few years and has thus been removed. If you |
|
103 | error that has been broken for a few years and has thus been removed. If you | |
104 | happend to use this function and still need it please make your voice heard on |
|
104 | happened to use this function and still need it please make your voice heard on | |
105 | the mailing list ipython-dev@python.org , or on the GitHub Issue tracker: |
|
105 | the mailing list ipython-dev@python.org , or on the GitHub Issue tracker: | |
106 | https://github.com/ipython/ipython/issues/9649 """, UserWarning) |
|
106 | https://github.com/ipython/ipython/issues/9649 """, UserWarning) | |
107 |
|
107 |
@@ -290,10 +290,13 b' class InputSplitter(object):' | |||||
290 | isp.push(line) |
|
290 | isp.push(line) | |
291 | print 'Input source was:\n', isp.source_reset(), |
|
291 | print 'Input source was:\n', isp.source_reset(), | |
292 | """ |
|
292 | """ | |
293 | # Number of spaces of indentation computed from input that has been pushed |
|
293 | # A cache for storing the current indentation | |
294 | # so far. This is the attributes callers should query to get the current |
|
294 | # The first value stores the most recently processed source input | |
295 | # indentation level, in order to provide auto-indent facilities. |
|
295 | # The second value is the number of spaces for the current indentation | |
296 | indent_spaces = 0 |
|
296 | # If self.source matches the first value, the second value is a valid | |
|
297 | # current indentation. Otherwise, the cache is invalid and the indentation | |||
|
298 | # must be recalculated. | |||
|
299 | _indent_spaces_cache = None, None | |||
297 | # String, indicating the default input encoding. It is computed by default |
|
300 | # String, indicating the default input encoding. It is computed by default | |
298 | # at initialization time via get_input_encoding(), but it can be reset by a |
|
301 | # at initialization time via get_input_encoding(), but it can be reset by a | |
299 | # client with specific knowledge of the encoding. |
|
302 | # client with specific knowledge of the encoding. | |
@@ -313,8 +316,6 b' class InputSplitter(object):' | |||||
313 | _buffer = None |
|
316 | _buffer = None | |
314 | # Command compiler |
|
317 | # Command compiler | |
315 | _compile = None |
|
318 | _compile = None | |
316 | # Mark when input has changed indentation all the way back to flush-left |
|
|||
317 | _full_dedent = False |
|
|||
318 | # Boolean indicating whether the current block is complete |
|
319 | # Boolean indicating whether the current block is complete | |
319 | _is_complete = None |
|
320 | _is_complete = None | |
320 | # Boolean indicating whether the current block has an unrecoverable syntax error |
|
321 | # Boolean indicating whether the current block has an unrecoverable syntax error | |
@@ -329,13 +330,11 b' class InputSplitter(object):' | |||||
329 |
|
330 | |||
330 | def reset(self): |
|
331 | def reset(self): | |
331 | """Reset the input buffer and associated state.""" |
|
332 | """Reset the input buffer and associated state.""" | |
332 | self.indent_spaces = 0 |
|
|||
333 | self._buffer[:] = [] |
|
333 | self._buffer[:] = [] | |
334 | self.source = '' |
|
334 | self.source = '' | |
335 | self.code = None |
|
335 | self.code = None | |
336 | self._is_complete = False |
|
336 | self._is_complete = False | |
337 | self._is_invalid = False |
|
337 | self._is_invalid = False | |
338 | self._full_dedent = False |
|
|||
339 |
|
338 | |||
340 | def source_reset(self): |
|
339 | def source_reset(self): | |
341 | """Return the input source and perform a full reset. |
|
340 | """Return the input source and perform a full reset. | |
@@ -374,7 +373,7 b' class InputSplitter(object):' | |||||
374 | if self._is_invalid: |
|
373 | if self._is_invalid: | |
375 | return 'invalid', None |
|
374 | return 'invalid', None | |
376 | elif self.push_accepts_more(): |
|
375 | elif self.push_accepts_more(): | |
377 | return 'incomplete', self.indent_spaces |
|
376 | return 'incomplete', self.get_indent_spaces() | |
378 | else: |
|
377 | else: | |
379 | return 'complete', None |
|
378 | return 'complete', None | |
380 | finally: |
|
379 | finally: | |
@@ -415,7 +414,6 b' class InputSplitter(object):' | |||||
415 | if source.endswith('\\\n'): |
|
414 | if source.endswith('\\\n'): | |
416 | return False |
|
415 | return False | |
417 |
|
416 | |||
418 | self._update_indent() |
|
|||
419 | try: |
|
417 | try: | |
420 | with warnings.catch_warnings(): |
|
418 | with warnings.catch_warnings(): | |
421 | warnings.simplefilter('error', SyntaxWarning) |
|
419 | warnings.simplefilter('error', SyntaxWarning) | |
@@ -473,7 +471,7 b' class InputSplitter(object):' | |||||
473 | # If there's just a single line or AST node, and we're flush left, as is |
|
471 | # If there's just a single line or AST node, and we're flush left, as is | |
474 | # the case after a simple statement such as 'a=1', we want to execute it |
|
472 | # the case after a simple statement such as 'a=1', we want to execute it | |
475 | # straight away. |
|
473 | # straight away. | |
476 | if self.indent_spaces==0: |
|
474 | if self.get_indent_spaces() == 0: | |
477 | if len(self.source.splitlines()) <= 1: |
|
475 | if len(self.source.splitlines()) <= 1: | |
478 | return False |
|
476 | return False | |
479 |
|
477 | |||
@@ -491,10 +489,20 b' class InputSplitter(object):' | |||||
491 | # General fallback - accept more code |
|
489 | # General fallback - accept more code | |
492 | return True |
|
490 | return True | |
493 |
|
491 | |||
494 |
def |
|
492 | def get_indent_spaces(self): | |
|
493 | sourcefor, n = self._indent_spaces_cache | |||
|
494 | if sourcefor == self.source: | |||
|
495 | return n | |||
|
496 | ||||
495 | # self.source always has a trailing newline |
|
497 | # self.source always has a trailing newline | |
496 |
|
|
498 | n = find_next_indent(self.source[:-1]) | |
497 | self._full_dedent = (self.indent_spaces == 0) |
|
499 | self._indent_spaces_cache = (self.source, n) | |
|
500 | return n | |||
|
501 | ||||
|
502 | # Backwards compatibility. I think all code that used .indent_spaces was | |||
|
503 | # inside IPython, but we can leave this here until IPython 7 in case any | |||
|
504 | # other modules are using it. -TK, November 2017 | |||
|
505 | indent_spaces = property(get_indent_spaces) | |||
498 |
|
506 | |||
499 | def _store(self, lines, buffer=None, store='source'): |
|
507 | def _store(self, lines, buffer=None, store='source'): | |
500 | """Store one or more lines of input. |
|
508 | """Store one or more lines of input. | |
@@ -698,41 +706,55 b' class IPythonInputSplitter(InputSplitter):' | |||||
698 | # flush the buffer. |
|
706 | # flush the buffer. | |
699 | self._store(lines, self._buffer_raw, 'source_raw') |
|
707 | self._store(lines, self._buffer_raw, 'source_raw') | |
700 |
|
708 | |||
|
709 | transformed_lines_list = [] | |||
701 | for line in lines_list: |
|
710 | for line in lines_list: | |
702 |
|
|
711 | transformed = self._transform_line(line) | |
|
712 | if transformed is not None: | |||
|
713 | transformed_lines_list.append(transformed) | |||
703 |
|
714 | |||
704 | return out |
|
715 | if transformed_lines_list: | |
705 |
|
716 | transformed_lines = '\n'.join(transformed_lines_list) | ||
706 | def push_line(self, line): |
|
717 | return super(IPythonInputSplitter, self).push(transformed_lines) | |
707 | buf = self._buffer |
|
718 | else: | |
|
719 | # Got nothing back from transformers - they must be waiting for | |||
|
720 | # more input. | |||
|
721 | return False | |||
|
722 | ||||
|
723 | def _transform_line(self, line): | |||
|
724 | """Push a line of input code through the various transformers. | |||
|
725 | ||||
|
726 | Returns any output from the transformers, or None if a transformer | |||
|
727 | is accumulating lines. | |||
708 |
|
|
728 | ||
|
729 | Sets self.transformer_accumulating as a side effect. | |||
|
730 | """ | |||
709 | def _accumulating(dbg): |
|
731 | def _accumulating(dbg): | |
710 | #print(dbg) |
|
732 | #print(dbg) | |
711 | self.transformer_accumulating = True |
|
733 | self.transformer_accumulating = True | |
712 |
return |
|
734 | return None | |
713 |
|
735 | |||
714 | for transformer in self.physical_line_transforms: |
|
736 | for transformer in self.physical_line_transforms: | |
715 | line = transformer.push(line) |
|
737 | line = transformer.push(line) | |
716 | if line is None: |
|
738 | if line is None: | |
717 | return _accumulating(transformer) |
|
739 | return _accumulating(transformer) | |
718 |
|
740 | |||
719 | if not self.within_python_line: |
|
741 | if not self.within_python_line: | |
720 | line = self.assemble_logical_lines.push(line) |
|
742 | line = self.assemble_logical_lines.push(line) | |
721 | if line is None: |
|
743 | if line is None: | |
722 |
return _accumulating('acc logical line') |
|
744 | return _accumulating('acc logical line') | |
723 |
|
745 | |||
724 | for transformer in self.logical_line_transforms: |
|
746 | for transformer in self.logical_line_transforms: | |
725 | line = transformer.push(line) |
|
747 | line = transformer.push(line) | |
726 | if line is None: |
|
748 | if line is None: | |
727 | return _accumulating(transformer) |
|
749 | return _accumulating(transformer) | |
728 |
|
750 | |||
729 | line = self.assemble_python_lines.push(line) |
|
751 | line = self.assemble_python_lines.push(line) | |
730 | if line is None: |
|
752 | if line is None: | |
731 | self.within_python_line = True |
|
753 | self.within_python_line = True | |
732 | return _accumulating('acc python line') |
|
754 | return _accumulating('acc python line') | |
733 | else: |
|
755 | else: | |
734 | self.within_python_line = False |
|
756 | self.within_python_line = False | |
735 |
|
757 | |||
736 | for transformer in self.python_line_transforms: |
|
758 | for transformer in self.python_line_transforms: | |
737 | line = transformer.push(line) |
|
759 | line = transformer.push(line) | |
738 | if line is None: |
|
760 | if line is None: | |
@@ -740,4 +762,5 b' class IPythonInputSplitter(InputSplitter):' | |||||
740 |
|
762 | |||
741 | #print("transformers clear") #debug |
|
763 | #print("transformers clear") #debug | |
742 | self.transformer_accumulating = False |
|
764 | self.transformer_accumulating = False | |
743 | return super(IPythonInputSplitter, self).push(line) |
|
765 | return line | |
|
766 |
@@ -193,8 +193,8 b' class ExecutionInfo(object):' | |||||
193 | name = self.__class__.__qualname__ |
|
193 | name = self.__class__.__qualname__ | |
194 | raw_cell = ((self.raw_cell[:50] + '..') |
|
194 | raw_cell = ((self.raw_cell[:50] + '..') | |
195 | if len(self.raw_cell) > 50 else self.raw_cell) |
|
195 | if len(self.raw_cell) > 50 else self.raw_cell) | |
196 |
return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s |
|
196 | return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s>' %\ | |
197 |
(name, id(self), raw_cell, store_history, silent, |
|
197 | (name, id(self), raw_cell, self.store_history, self.silent, self.shell_futures) | |
198 |
|
198 | |||
199 |
|
199 | |||
200 | class ExecutionResult(object): |
|
200 | class ExecutionResult(object): | |
@@ -1899,7 +1899,7 b' class InteractiveShell(SingletonConfigurable):' | |||||
1899 | # Not the format we expect; leave it alone |
|
1899 | # Not the format we expect; leave it alone | |
1900 | pass |
|
1900 | pass | |
1901 |
|
1901 | |||
1902 | # If the error occured when executing compiled code, we should provide full stacktrace. |
|
1902 | # If the error occurred when executing compiled code, we should provide full stacktrace. | |
1903 | elist = traceback.extract_tb(last_traceback) if running_compiled_code else [] |
|
1903 | elist = traceback.extract_tb(last_traceback) if running_compiled_code else [] | |
1904 | stb = self.SyntaxTB.structured_traceback(etype, value, elist) |
|
1904 | stb = self.SyntaxTB.structured_traceback(etype, value, elist) | |
1905 | self._showtraceback(etype, value, stb) |
|
1905 | self._showtraceback(etype, value, stb) | |
@@ -1940,7 +1940,7 b' class InteractiveShell(SingletonConfigurable):' | |||||
1940 |
|
1940 | |||
1941 | def _indent_current_str(self): |
|
1941 | def _indent_current_str(self): | |
1942 | """return the current level of indentation as a string""" |
|
1942 | """return the current level of indentation as a string""" | |
1943 | return self.input_splitter.indent_spaces * ' ' |
|
1943 | return self.input_splitter.get_indent_spaces() * ' ' | |
1944 |
|
1944 | |||
1945 | #------------------------------------------------------------------------- |
|
1945 | #------------------------------------------------------------------------- | |
1946 | # Things related to text completion |
|
1946 | # Things related to text completion |
@@ -406,7 +406,7 b' Currently the magic system has the following functions:""",' | |||||
406 | The Python package manager (pip) can only be used from outside of IPython. |
|
406 | The Python package manager (pip) can only be used from outside of IPython. | |
407 | Please reissue the `pip` command in a separate terminal or command prompt. |
|
407 | Please reissue the `pip` command in a separate terminal or command prompt. | |
408 |
|
408 | |||
409 |
See the Python documentation for more information |
|
409 | See the Python documentation for more information on how to install packages: | |
410 |
|
410 | |||
411 | https://docs.python.org/3/installing/'''.format(args=args))) |
|
411 | https://docs.python.org/3/installing/'''.format(args=args))) | |
412 |
|
412 |
@@ -369,14 +369,14 b' class CodeMagics(Magics):' | |||||
369 |
|
369 | |||
370 | l = len(contents) |
|
370 | l = len(contents) | |
371 |
|
371 | |||
372 | # 200 000 is ~ 2500 full 80 caracter lines |
|
372 | # 200 000 is ~ 2500 full 80 character lines | |
373 | # so in average, more than 5000 lines |
|
373 | # so in average, more than 5000 lines | |
374 | if l > 200000 and 'y' not in opts: |
|
374 | if l > 200000 and 'y' not in opts: | |
375 | try: |
|
375 | try: | |
376 | ans = self.shell.ask_yes_no(("The text you're trying to load seems pretty big"\ |
|
376 | ans = self.shell.ask_yes_no(("The text you're trying to load seems pretty big"\ | |
377 | " (%d characters). Continue (y/[N]) ?" % l), default='n' ) |
|
377 | " (%d characters). Continue (y/[N]) ?" % l), default='n' ) | |
378 | except StdinNotImplementedError: |
|
378 | except StdinNotImplementedError: | |
379 | #asume yes if raw input not implemented |
|
379 | #assume yes if raw input not implemented | |
380 | ans = True |
|
380 | ans = True | |
381 |
|
381 | |||
382 | if ans is False : |
|
382 | if ans is False : |
@@ -591,9 +591,9 b' class Inspector(Colorable):' | |||||
591 | Name of the variable pointing to `obj`. |
|
591 | Name of the variable pointing to `obj`. | |
592 | formatter: callable |
|
592 | formatter: callable | |
593 | info: |
|
593 | info: | |
594 |
already computed information |
|
594 | already computed information | |
595 | detail_level: integer |
|
595 | detail_level: integer | |
596 |
Granularity of detail level, if set to 1, give more information |
|
596 | Granularity of detail level, if set to 1, give more information. | |
597 | """ |
|
597 | """ | |
598 |
|
598 | |||
599 | info = self._info(obj, oname=oname, info=info, detail_level=detail_level) |
|
599 | info = self._info(obj, oname=oname, info=info, detail_level=detail_level) | |
@@ -679,7 +679,7 b' class Inspector(Colorable):' | |||||
679 |
|
679 | |||
680 | The formatter is a callable that takes a string as an input |
|
680 | The formatter is a callable that takes a string as an input | |
681 | and returns either a formatted string or a mime type bundle |
|
681 | and returns either a formatted string or a mime type bundle | |
682 |
in the form of a diction |
|
682 | in the form of a dictionary. | |
683 |
|
683 | |||
684 | Although the support of custom formatter returning a string |
|
684 | Although the support of custom formatter returning a string | |
685 | instead of a mime type bundle is deprecated. |
|
685 | instead of a mime type bundle is deprecated. |
@@ -43,7 +43,7 b" re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')" | |||||
43 | # particular, all binary operators should be excluded, so that if foo is |
|
43 | # particular, all binary operators should be excluded, so that if foo is | |
44 | # callable, foo OP bar doesn't become foo(OP bar), which is invalid. The |
|
44 | # callable, foo OP bar doesn't become foo(OP bar), which is invalid. The | |
45 | # characters '!=()' don't need to be checked for, as the checkPythonChars |
|
45 | # characters '!=()' don't need to be checked for, as the checkPythonChars | |
46 |
# routine explicit |
|
46 | # routine explicitly does so, to catch direct calls and rebindings of | |
47 | # existing names. |
|
47 | # existing names. | |
48 |
|
48 | |||
49 | # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise |
|
49 | # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise |
@@ -939,6 +939,34 b' def test_object_key_completion():' | |||||
939 | nt.assert_in('qwick', matches) |
|
939 | nt.assert_in('qwick', matches) | |
940 |
|
940 | |||
941 |
|
941 | |||
|
942 | class NamedInstanceMetaclass(type): | |||
|
943 | def __getitem__(cls, item): | |||
|
944 | return cls.get_instance(item) | |||
|
945 | ||||
|
946 | class NamedInstanceClass(object, metaclass=NamedInstanceMetaclass): | |||
|
947 | def __init__(self, name): | |||
|
948 | if not hasattr(self.__class__, 'instances'): | |||
|
949 | self.__class__.instances = {} | |||
|
950 | self.__class__.instances[name] = self | |||
|
951 | ||||
|
952 | @classmethod | |||
|
953 | def _ipython_key_completions_(cls): | |||
|
954 | return cls.instances.keys() | |||
|
955 | ||||
|
956 | @classmethod | |||
|
957 | def get_instance(cls, name): | |||
|
958 | return cls.instances[name] | |||
|
959 | ||||
|
960 | def test_class_key_completion(): | |||
|
961 | ip = get_ipython() | |||
|
962 | NamedInstanceClass('qwerty') | |||
|
963 | NamedInstanceClass('qwick') | |||
|
964 | ip.user_ns['named_instance_class'] = NamedInstanceClass | |||
|
965 | ||||
|
966 | _, matches = ip.Completer.complete(line_buffer="named_instance_class['qw") | |||
|
967 | nt.assert_in('qwerty', matches) | |||
|
968 | nt.assert_in('qwick', matches) | |||
|
969 | ||||
942 | def test_tryimport(): |
|
970 | def test_tryimport(): | |
943 | """ |
|
971 | """ | |
944 | Test that try-import don't crash on trailing dot, and import modules before |
|
972 | Test that try-import don't crash on trailing dot, and import modules before |
@@ -56,7 +56,7 b' def test_underscore_no_overrite_builtins():' | |||||
56 |
|
56 | |||
57 | def test_interactivehooks_ast_modes(): |
|
57 | def test_interactivehooks_ast_modes(): | |
58 | """ |
|
58 | """ | |
59 | Test that ast nodes can be triggerd with different modes |
|
59 | Test that ast nodes can be triggered with different modes | |
60 | """ |
|
60 | """ | |
61 | saved_mode = ip.ast_node_interactivity |
|
61 | saved_mode = ip.ast_node_interactivity | |
62 | ip.ast_node_interactivity = 'last_expr_or_assign' |
|
62 | ip.ast_node_interactivity = 'last_expr_or_assign' | |
@@ -83,7 +83,7 b' def test_interactivehooks_ast_modes():' | |||||
83 |
|
83 | |||
84 | def test_interactivehooks_ast_modes_semi_supress(): |
|
84 | def test_interactivehooks_ast_modes_semi_supress(): | |
85 | """ |
|
85 | """ | |
86 | Test that ast nodes can be triggerd with different modes and supressed |
|
86 | Test that ast nodes can be triggered with different modes and suppressed | |
87 | by semicolon |
|
87 | by semicolon | |
88 | """ |
|
88 | """ | |
89 | saved_mode = ip.ast_node_interactivity |
|
89 | saved_mode = ip.ast_node_interactivity |
@@ -521,3 +521,13 b' def test_repr_mime_meta():' | |||||
521 | 'height': 10, |
|
521 | 'height': 10, | |
522 | } |
|
522 | } | |
523 | }) |
|
523 | }) | |
|
524 | ||||
|
525 | def test_repr_mime_failure(): | |||
|
526 | class BadReprMime(object): | |||
|
527 | def _repr_mimebundle_(self, include=None, exclude=None): | |||
|
528 | raise RuntimeError | |||
|
529 | ||||
|
530 | f = get_ipython().display_formatter | |||
|
531 | obj = BadReprMime() | |||
|
532 | d, md = f.format(obj) | |||
|
533 | nt.assert_in('text/plain', d) |
@@ -37,7 +37,7 b' def mini_interactive_loop(input_func):' | |||||
37 | # input indefinitely, until some exit/quit command was issued. Here we |
|
37 | # input indefinitely, until some exit/quit command was issued. Here we | |
38 | # only illustrate the basic inner loop. |
|
38 | # only illustrate the basic inner loop. | |
39 | while isp.push_accepts_more(): |
|
39 | while isp.push_accepts_more(): | |
40 | indent = ' '*isp.indent_spaces |
|
40 | indent = ' '*isp.get_indent_spaces() | |
41 | prompt = '>>> ' + indent |
|
41 | prompt = '>>> ' + indent | |
42 | line = indent + input_func(prompt) |
|
42 | line = indent + input_func(prompt) | |
43 | isp.push(line) |
|
43 | isp.push(line) | |
@@ -132,7 +132,7 b' class InputSplitterTestCase(unittest.TestCase):' | |||||
132 | isp.push('x=1') |
|
132 | isp.push('x=1') | |
133 | isp.reset() |
|
133 | isp.reset() | |
134 | self.assertEqual(isp._buffer, []) |
|
134 | self.assertEqual(isp._buffer, []) | |
135 | self.assertEqual(isp.indent_spaces, 0) |
|
135 | self.assertEqual(isp.get_indent_spaces(), 0) | |
136 | self.assertEqual(isp.source, '') |
|
136 | self.assertEqual(isp.source, '') | |
137 | self.assertEqual(isp.code, None) |
|
137 | self.assertEqual(isp.code, None) | |
138 | self.assertEqual(isp._is_complete, False) |
|
138 | self.assertEqual(isp._is_complete, False) | |
@@ -149,21 +149,21 b' class InputSplitterTestCase(unittest.TestCase):' | |||||
149 | def test_indent(self): |
|
149 | def test_indent(self): | |
150 | isp = self.isp # shorthand |
|
150 | isp = self.isp # shorthand | |
151 | isp.push('x=1') |
|
151 | isp.push('x=1') | |
152 | self.assertEqual(isp.indent_spaces, 0) |
|
152 | self.assertEqual(isp.get_indent_spaces(), 0) | |
153 | isp.push('if 1:\n x=1') |
|
153 | isp.push('if 1:\n x=1') | |
154 | self.assertEqual(isp.indent_spaces, 4) |
|
154 | self.assertEqual(isp.get_indent_spaces(), 4) | |
155 | isp.push('y=2\n') |
|
155 | isp.push('y=2\n') | |
156 | self.assertEqual(isp.indent_spaces, 0) |
|
156 | self.assertEqual(isp.get_indent_spaces(), 0) | |
157 |
|
157 | |||
158 | def test_indent2(self): |
|
158 | def test_indent2(self): | |
159 | isp = self.isp |
|
159 | isp = self.isp | |
160 | isp.push('if 1:') |
|
160 | isp.push('if 1:') | |
161 | self.assertEqual(isp.indent_spaces, 4) |
|
161 | self.assertEqual(isp.get_indent_spaces(), 4) | |
162 | isp.push(' x=1') |
|
162 | isp.push(' x=1') | |
163 | self.assertEqual(isp.indent_spaces, 4) |
|
163 | self.assertEqual(isp.get_indent_spaces(), 4) | |
164 | # Blank lines shouldn't change the indent level |
|
164 | # Blank lines shouldn't change the indent level | |
165 | isp.push(' '*2) |
|
165 | isp.push(' '*2) | |
166 | self.assertEqual(isp.indent_spaces, 4) |
|
166 | self.assertEqual(isp.get_indent_spaces(), 4) | |
167 |
|
167 | |||
168 | def test_indent3(self): |
|
168 | def test_indent3(self): | |
169 | isp = self.isp |
|
169 | isp = self.isp | |
@@ -171,75 +171,75 b' class InputSplitterTestCase(unittest.TestCase):' | |||||
171 | # shouldn't get confused. |
|
171 | # shouldn't get confused. | |
172 | isp.push("if 1:") |
|
172 | isp.push("if 1:") | |
173 | isp.push(" x = (1+\n 2)") |
|
173 | isp.push(" x = (1+\n 2)") | |
174 | self.assertEqual(isp.indent_spaces, 4) |
|
174 | self.assertEqual(isp.get_indent_spaces(), 4) | |
175 |
|
175 | |||
176 | def test_indent4(self): |
|
176 | def test_indent4(self): | |
177 | isp = self.isp |
|
177 | isp = self.isp | |
178 | # whitespace after ':' should not screw up indent level |
|
178 | # whitespace after ':' should not screw up indent level | |
179 | isp.push('if 1: \n x=1') |
|
179 | isp.push('if 1: \n x=1') | |
180 | self.assertEqual(isp.indent_spaces, 4) |
|
180 | self.assertEqual(isp.get_indent_spaces(), 4) | |
181 | isp.push('y=2\n') |
|
181 | isp.push('y=2\n') | |
182 | self.assertEqual(isp.indent_spaces, 0) |
|
182 | self.assertEqual(isp.get_indent_spaces(), 0) | |
183 | isp.push('if 1:\t\n x=1') |
|
183 | isp.push('if 1:\t\n x=1') | |
184 | self.assertEqual(isp.indent_spaces, 4) |
|
184 | self.assertEqual(isp.get_indent_spaces(), 4) | |
185 | isp.push('y=2\n') |
|
185 | isp.push('y=2\n') | |
186 | self.assertEqual(isp.indent_spaces, 0) |
|
186 | self.assertEqual(isp.get_indent_spaces(), 0) | |
187 |
|
187 | |||
188 | def test_dedent_pass(self): |
|
188 | def test_dedent_pass(self): | |
189 | isp = self.isp # shorthand |
|
189 | isp = self.isp # shorthand | |
190 | # should NOT cause dedent |
|
190 | # should NOT cause dedent | |
191 | isp.push('if 1:\n passes = 5') |
|
191 | isp.push('if 1:\n passes = 5') | |
192 | self.assertEqual(isp.indent_spaces, 4) |
|
192 | self.assertEqual(isp.get_indent_spaces(), 4) | |
193 | isp.push('if 1:\n pass') |
|
193 | isp.push('if 1:\n pass') | |
194 | self.assertEqual(isp.indent_spaces, 0) |
|
194 | self.assertEqual(isp.get_indent_spaces(), 0) | |
195 | isp.push('if 1:\n pass ') |
|
195 | isp.push('if 1:\n pass ') | |
196 | self.assertEqual(isp.indent_spaces, 0) |
|
196 | self.assertEqual(isp.get_indent_spaces(), 0) | |
197 |
|
197 | |||
198 | def test_dedent_break(self): |
|
198 | def test_dedent_break(self): | |
199 | isp = self.isp # shorthand |
|
199 | isp = self.isp # shorthand | |
200 | # should NOT cause dedent |
|
200 | # should NOT cause dedent | |
201 | isp.push('while 1:\n breaks = 5') |
|
201 | isp.push('while 1:\n breaks = 5') | |
202 | self.assertEqual(isp.indent_spaces, 4) |
|
202 | self.assertEqual(isp.get_indent_spaces(), 4) | |
203 | isp.push('while 1:\n break') |
|
203 | isp.push('while 1:\n break') | |
204 | self.assertEqual(isp.indent_spaces, 0) |
|
204 | self.assertEqual(isp.get_indent_spaces(), 0) | |
205 | isp.push('while 1:\n break ') |
|
205 | isp.push('while 1:\n break ') | |
206 | self.assertEqual(isp.indent_spaces, 0) |
|
206 | self.assertEqual(isp.get_indent_spaces(), 0) | |
207 |
|
207 | |||
208 | def test_dedent_continue(self): |
|
208 | def test_dedent_continue(self): | |
209 | isp = self.isp # shorthand |
|
209 | isp = self.isp # shorthand | |
210 | # should NOT cause dedent |
|
210 | # should NOT cause dedent | |
211 | isp.push('while 1:\n continues = 5') |
|
211 | isp.push('while 1:\n continues = 5') | |
212 | self.assertEqual(isp.indent_spaces, 4) |
|
212 | self.assertEqual(isp.get_indent_spaces(), 4) | |
213 | isp.push('while 1:\n continue') |
|
213 | isp.push('while 1:\n continue') | |
214 | self.assertEqual(isp.indent_spaces, 0) |
|
214 | self.assertEqual(isp.get_indent_spaces(), 0) | |
215 | isp.push('while 1:\n continue ') |
|
215 | isp.push('while 1:\n continue ') | |
216 | self.assertEqual(isp.indent_spaces, 0) |
|
216 | self.assertEqual(isp.get_indent_spaces(), 0) | |
217 |
|
217 | |||
218 | def test_dedent_raise(self): |
|
218 | def test_dedent_raise(self): | |
219 | isp = self.isp # shorthand |
|
219 | isp = self.isp # shorthand | |
220 | # should NOT cause dedent |
|
220 | # should NOT cause dedent | |
221 | isp.push('if 1:\n raised = 4') |
|
221 | isp.push('if 1:\n raised = 4') | |
222 | self.assertEqual(isp.indent_spaces, 4) |
|
222 | self.assertEqual(isp.get_indent_spaces(), 4) | |
223 | isp.push('if 1:\n raise TypeError()') |
|
223 | isp.push('if 1:\n raise TypeError()') | |
224 | self.assertEqual(isp.indent_spaces, 0) |
|
224 | self.assertEqual(isp.get_indent_spaces(), 0) | |
225 | isp.push('if 1:\n raise') |
|
225 | isp.push('if 1:\n raise') | |
226 | self.assertEqual(isp.indent_spaces, 0) |
|
226 | self.assertEqual(isp.get_indent_spaces(), 0) | |
227 | isp.push('if 1:\n raise ') |
|
227 | isp.push('if 1:\n raise ') | |
228 | self.assertEqual(isp.indent_spaces, 0) |
|
228 | self.assertEqual(isp.get_indent_spaces(), 0) | |
229 |
|
229 | |||
230 | def test_dedent_return(self): |
|
230 | def test_dedent_return(self): | |
231 | isp = self.isp # shorthand |
|
231 | isp = self.isp # shorthand | |
232 | # should NOT cause dedent |
|
232 | # should NOT cause dedent | |
233 | isp.push('if 1:\n returning = 4') |
|
233 | isp.push('if 1:\n returning = 4') | |
234 | self.assertEqual(isp.indent_spaces, 4) |
|
234 | self.assertEqual(isp.get_indent_spaces(), 4) | |
235 | isp.push('if 1:\n return 5 + 493') |
|
235 | isp.push('if 1:\n return 5 + 493') | |
236 | self.assertEqual(isp.indent_spaces, 0) |
|
236 | self.assertEqual(isp.get_indent_spaces(), 0) | |
237 | isp.push('if 1:\n return') |
|
237 | isp.push('if 1:\n return') | |
238 | self.assertEqual(isp.indent_spaces, 0) |
|
238 | self.assertEqual(isp.get_indent_spaces(), 0) | |
239 | isp.push('if 1:\n return ') |
|
239 | isp.push('if 1:\n return ') | |
240 | self.assertEqual(isp.indent_spaces, 0) |
|
240 | self.assertEqual(isp.get_indent_spaces(), 0) | |
241 | isp.push('if 1:\n return(0)') |
|
241 | isp.push('if 1:\n return(0)') | |
242 | self.assertEqual(isp.indent_spaces, 0) |
|
242 | self.assertEqual(isp.get_indent_spaces(), 0) | |
243 |
|
243 | |||
244 | def test_push(self): |
|
244 | def test_push(self): | |
245 | isp = self.isp |
|
245 | isp = self.isp | |
@@ -508,7 +508,7 b" if __name__ == '__main__':" | |||||
508 | while True: |
|
508 | while True: | |
509 | prompt = start_prompt |
|
509 | prompt = start_prompt | |
510 | while isp.push_accepts_more(): |
|
510 | while isp.push_accepts_more(): | |
511 | indent = ' '*isp.indent_spaces |
|
511 | indent = ' '*isp.get_indent_spaces() | |
512 | if autoindent: |
|
512 | if autoindent: | |
513 | line = indent + input(prompt+indent) |
|
513 | line = indent + input(prompt+indent) | |
514 | else: |
|
514 | else: |
@@ -106,7 +106,7 b' def test_magic_error_status():' | |||||
106 | def test_config(): |
|
106 | def test_config(): | |
107 | """ test that config magic does not raise |
|
107 | """ test that config magic does not raise | |
108 | can happen if Configurable init is moved too early into |
|
108 | can happen if Configurable init is moved too early into | |
109 | Magics.__init__ as then a Config object will be registerd as a |
|
109 | Magics.__init__ as then a Config object will be registered as a | |
110 | magic. |
|
110 | magic. | |
111 | """ |
|
111 | """ | |
112 | ## should not raise. |
|
112 | ## should not raise. | |
@@ -587,7 +587,7 b' def test_timeit_special_syntax():' | |||||
587 |
|
587 | |||
588 | def test_timeit_return(): |
|
588 | def test_timeit_return(): | |
589 | """ |
|
589 | """ | |
590 | test wether timeit -o return object |
|
590 | test whether timeit -o return object | |
591 | """ |
|
591 | """ | |
592 |
|
592 | |||
593 | res = _ip.run_line_magic('timeit','-n10 -r10 -o 1') |
|
593 | res = _ip.run_line_magic('timeit','-n10 -r10 -o 1') |
@@ -298,7 +298,7 b' System commands:' | |||||
298 | !cp a.txt b/ : System command escape, calls os.system() |
|
298 | !cp a.txt b/ : System command escape, calls os.system() | |
299 | cp a.txt b/ : after %rehashx, most system commands work without ! |
|
299 | cp a.txt b/ : after %rehashx, most system commands work without ! | |
300 | cp ${f}.txt $bar : Variable expansion in magics and system commands |
|
300 | cp ${f}.txt $bar : Variable expansion in magics and system commands | |
301 | files = !ls /usr : Capture sytem command output |
|
301 | files = !ls /usr : Capture system command output | |
302 | files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc' |
|
302 | files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc' | |
303 |
|
303 | |||
304 | History: |
|
304 | History: |
@@ -184,7 +184,7 b' class ModuleReloader(object):' | |||||
184 | if not hasattr(module, '__file__') or module.__file__ is None: |
|
184 | if not hasattr(module, '__file__') or module.__file__ is None: | |
185 | return None, None |
|
185 | return None, None | |
186 |
|
186 | |||
187 | if getattr(module, '__name__', None) in ['__mp_main__', '__main__']: |
|
187 | if getattr(module, '__name__', None) in [None, '__mp_main__', '__main__']: | |
188 | # we cannot reload(__main__) or reload(__mp_main__) |
|
188 | # we cannot reload(__main__) or reload(__mp_main__) | |
189 | return None, None |
|
189 | return None, None | |
190 |
|
190 |
@@ -273,7 +273,7 b' def deep_reload_hook(m):' | |||||
273 | """Replacement for reload().""" |
|
273 | """Replacement for reload().""" | |
274 | # Hardcode this one as it would raise a NotImplemeentedError from the |
|
274 | # Hardcode this one as it would raise a NotImplemeentedError from the | |
275 | # bowels of Python and screw up the import machinery after. |
|
275 | # bowels of Python and screw up the import machinery after. | |
276 | # unlike other imports the `exclude` list aleady in place is not enough. |
|
276 | # unlike other imports the `exclude` list already in place is not enough. | |
277 |
|
277 | |||
278 | if m is types: |
|
278 | if m is types: | |
279 | return m |
|
279 | return m |
@@ -231,7 +231,7 b' class Demo(object):' | |||||
231 | value. |
|
231 | value. | |
232 |
|
232 | |||
233 | - format_rst(False): a bool to enable comments and doc strings |
|
233 | - format_rst(False): a bool to enable comments and doc strings | |
234 | formating with pygments rst lexer |
|
234 | formatting with pygments rst lexer | |
235 |
|
235 | |||
236 | - formatter('terminal'): a string of pygments formatter name to be |
|
236 | - formatter('terminal'): a string of pygments formatter name to be | |
237 | used. Useful values for terminals: terminal, terminal256, |
|
237 | used. Useful values for terminals: terminal, terminal256, |
@@ -508,7 +508,7 b' class FileLinks(FileLink):' | |||||
508 | # Working on a platform where the path separator is "\", so |
|
508 | # Working on a platform where the path separator is "\", so | |
509 | # must convert these to "/" for generating a URI |
|
509 | # must convert these to "/" for generating a URI | |
510 | def fp_cleaner(fp): |
|
510 | def fp_cleaner(fp): | |
511 | # Replace all occurences of backslash ("\") with a forward |
|
511 | # Replace all occurrences of backslash ("\") with a forward | |
512 | # slash ("/") - this is necessary on windows when a path is |
|
512 | # slash ("/") - this is necessary on windows when a path is | |
513 | # provided as input, but we must link to a URI |
|
513 | # provided as input, but we must link to a URI | |
514 | return fp.replace('\\','/') |
|
514 | return fp.replace('\\','/') |
@@ -96,7 +96,7 b" def idle(exe=u'idle'):" | |||||
96 | import idlelib |
|
96 | import idlelib | |
97 | p = os.path.dirname(idlelib.__filename__) |
|
97 | p = os.path.dirname(idlelib.__filename__) | |
98 | # i'm not sure if this actually works. Is this idle.py script |
|
98 | # i'm not sure if this actually works. Is this idle.py script | |
99 |
# guar |
|
99 | # guaranteed to be executable? | |
100 | exe = os.path.join(p, 'idle.py') |
|
100 | exe = os.path.join(p, 'idle.py') | |
101 | install_editor(exe + u' {filename}') |
|
101 | install_editor(exe + u' {filename}') | |
102 |
|
102 |
@@ -29,6 +29,6 b' def _main_quit(*args, **kwargs):' | |||||
29 |
|
29 | |||
30 |
|
30 | |||
31 | def inputhook_gtk3(): |
|
31 | def inputhook_gtk3(): | |
32 | GLib.io_add_watch(sys.stdin, GLib.IO_IN, _main_quit) |
|
32 | GLib.io_add_watch(sys.stdin, GLib.PRIORITY_DEFAULT, GLib.IO_IN, _main_quit) | |
33 | Gtk.main() |
|
33 | Gtk.main() | |
34 | return 0 |
|
34 | return 0 |
@@ -287,14 +287,6 b' class EmbeddedSphinxShell(object):' | |||||
287 | IP = InteractiveShell.instance(config=config, profile_dir=profile) |
|
287 | IP = InteractiveShell.instance(config=config, profile_dir=profile) | |
288 | atexit.register(self.cleanup) |
|
288 | atexit.register(self.cleanup) | |
289 |
|
289 | |||
290 | sys.stdout = self.cout |
|
|||
291 | sys.stderr = self.cout |
|
|||
292 |
|
||||
293 | # For debugging, so we can see normal output, use this: |
|
|||
294 | #from IPython.utils.io import Tee |
|
|||
295 | #sys.stdout = Tee(self.cout, channel='stdout') # dbg |
|
|||
296 | #sys.stderr = Tee(self.cout, channel='stderr') # dbg |
|
|||
297 |
|
||||
298 | # Store a few parts of IPython we'll need. |
|
290 | # Store a few parts of IPython we'll need. | |
299 | self.IP = IP |
|
291 | self.IP = IP | |
300 | self.user_ns = self.IP.user_ns |
|
292 | self.user_ns = self.IP.user_ns |
@@ -8,5 +8,5 b' def _main_quit(*args, **kwargs):' | |||||
8 | return False |
|
8 | return False | |
9 |
|
9 | |||
10 | def inputhook(context): |
|
10 | def inputhook(context): | |
11 | GLib.io_add_watch(context.fileno(), GLib.IO_IN, _main_quit) |
|
11 | GLib.io_add_watch(context.fileno(), GLib.PRIORITY_DEFAULT, GLib.IO_IN, _main_quit) | |
12 | Gtk.main() |
|
12 | Gtk.main() |
@@ -34,7 +34,7 b' Wrapper around the eventloop that gives some time to the Tkinter GUI to process' | |||||
34 | events when it's loaded and while we are waiting for input at the REPL. This |
|
34 | events when it's loaded and while we are waiting for input at the REPL. This | |
35 | way we don't block the UI of for instance ``turtle`` and other Tk libraries. |
|
35 | way we don't block the UI of for instance ``turtle`` and other Tk libraries. | |
36 |
|
36 | |||
37 |
(Normally Tkinter register |
|
37 | (Normally Tkinter registers it's callbacks in ``PyOS_InputHook`` to integrate | |
38 | in readline. ``prompt-toolkit`` doesn't understand that input hook, but this |
|
38 | in readline. ``prompt-toolkit`` doesn't understand that input hook, but this | |
39 | will fix it for Tk.) |
|
39 | will fix it for Tk.) | |
40 | """ |
|
40 | """ |
@@ -55,7 +55,7 b' class IPython2PythonConverter(object):' | |||||
55 | """Convert IPython 'syntax' to valid Python. |
|
55 | """Convert IPython 'syntax' to valid Python. | |
56 |
|
56 | |||
57 | Eventually this code may grow to be the full IPython syntax conversion |
|
57 | Eventually this code may grow to be the full IPython syntax conversion | |
58 |
implementation, but for now it only does prompt conver |
|
58 | implementation, but for now it only does prompt conversion.""" | |
59 |
|
59 | |||
60 | def __init__(self): |
|
60 | def __init__(self): | |
61 | self.rps1 = re.compile(r'In\ \[\d+\]: ') |
|
61 | self.rps1 = re.compile(r'In\ \[\d+\]: ') |
@@ -87,7 +87,7 b' def parse_test_output(txt):' | |||||
87 | txt : str |
|
87 | txt : str | |
88 | Text output of a test run, assumed to contain a line of one of the |
|
88 | Text output of a test run, assumed to contain a line of one of the | |
89 | following forms:: |
|
89 | following forms:: | |
90 |
|
90 | |||
91 | 'FAILED (errors=1)' |
|
91 | 'FAILED (errors=1)' | |
92 | 'FAILED (failures=1)' |
|
92 | 'FAILED (failures=1)' | |
93 | 'FAILED (errors=1, failures=1)' |
|
93 | 'FAILED (errors=1, failures=1)' | |
@@ -186,7 +186,7 b' def ipexec(fname, options=None, commands=()):' | |||||
186 |
|
186 | |||
187 | Returns |
|
187 | Returns | |
188 | ------- |
|
188 | ------- | |
189 | (stdout, stderr) of ipython subprocess. |
|
189 | ``(stdout, stderr)`` of ipython subprocess. | |
190 | """ |
|
190 | """ | |
191 | if options is None: options = [] |
|
191 | if options is None: options = [] | |
192 |
|
192 | |||
@@ -333,13 +333,13 b' notprinted_msg = """Did not find {0!r} in printed output (on {1}):' | |||||
333 |
|
333 | |||
334 | class AssertPrints(object): |
|
334 | class AssertPrints(object): | |
335 | """Context manager for testing that code prints certain text. |
|
335 | """Context manager for testing that code prints certain text. | |
336 |
|
336 | |||
337 | Examples |
|
337 | Examples | |
338 | -------- |
|
338 | -------- | |
339 | >>> with AssertPrints("abc", suppress=False): |
|
339 | >>> with AssertPrints("abc", suppress=False): | |
340 | ... print("abcd") |
|
340 | ... print("abcd") | |
341 | ... print("def") |
|
341 | ... print("def") | |
342 |
... |
|
342 | ... | |
343 | abcd |
|
343 | abcd | |
344 | def |
|
344 | def | |
345 | """ |
|
345 | """ | |
@@ -349,13 +349,13 b' class AssertPrints(object):' | |||||
349 | self.s = [self.s] |
|
349 | self.s = [self.s] | |
350 | self.channel = channel |
|
350 | self.channel = channel | |
351 | self.suppress = suppress |
|
351 | self.suppress = suppress | |
352 |
|
352 | |||
353 | def __enter__(self): |
|
353 | def __enter__(self): | |
354 | self.orig_stream = getattr(sys, self.channel) |
|
354 | self.orig_stream = getattr(sys, self.channel) | |
355 | self.buffer = MyStringIO() |
|
355 | self.buffer = MyStringIO() | |
356 | self.tee = Tee(self.buffer, channel=self.channel) |
|
356 | self.tee = Tee(self.buffer, channel=self.channel) | |
357 | setattr(sys, self.channel, self.buffer if self.suppress else self.tee) |
|
357 | setattr(sys, self.channel, self.buffer if self.suppress else self.tee) | |
358 |
|
358 | |||
359 | def __exit__(self, etype, value, traceback): |
|
359 | def __exit__(self, etype, value, traceback): | |
360 | try: |
|
360 | try: | |
361 | if value is not None: |
|
361 | if value is not None: | |
@@ -381,7 +381,7 b' printed_msg = """Found {0!r} in printed output (on {1}):' | |||||
381 |
|
381 | |||
382 | class AssertNotPrints(AssertPrints): |
|
382 | class AssertNotPrints(AssertPrints): | |
383 | """Context manager for checking that certain output *isn't* produced. |
|
383 | """Context manager for checking that certain output *isn't* produced. | |
384 |
|
384 | |||
385 | Counterpart of AssertPrints""" |
|
385 | Counterpart of AssertPrints""" | |
386 | def __exit__(self, etype, value, traceback): |
|
386 | def __exit__(self, etype, value, traceback): | |
387 | try: |
|
387 | try: |
@@ -166,7 +166,7 b' try:' | |||||
166 | """Split a command line's arguments in a shell-like manner. |
|
166 | """Split a command line's arguments in a shell-like manner. | |
167 |
|
167 | |||
168 | This is a special version for windows that use a ctypes call to CommandLineToArgvW |
|
168 | This is a special version for windows that use a ctypes call to CommandLineToArgvW | |
169 | to do the argv splitting. The posix paramter is ignored. |
|
169 | to do the argv splitting. The posix parameter is ignored. | |
170 |
|
170 | |||
171 | If strict=False, process_common.arg_split(...strict=False) is used instead. |
|
171 | If strict=False, process_common.arg_split(...strict=False) is used instead. | |
172 | """ |
|
172 | """ |
@@ -6,6 +6,7 b'' | |||||
6 | # Distributed under the terms of the Modified BSD License. |
|
6 | # Distributed under the terms of the Modified BSD License. | |
7 |
|
7 | |||
8 | import inspect |
|
8 | import inspect | |
|
9 | import types | |||
9 |
|
10 | |||
10 |
|
11 | |||
11 | def safe_hasattr(obj, attr): |
|
12 | def safe_hasattr(obj, attr): | |
@@ -53,16 +54,13 b' def dir2(obj):' | |||||
53 | def get_real_method(obj, name): |
|
54 | def get_real_method(obj, name): | |
54 | """Like getattr, but with a few extra sanity checks: |
|
55 | """Like getattr, but with a few extra sanity checks: | |
55 |
|
56 | |||
56 | - If obj is a class, ignore its methods |
|
57 | - If obj is a class, ignore everything except class methods | |
57 | - Check if obj is a proxy that claims to have all attributes |
|
58 | - Check if obj is a proxy that claims to have all attributes | |
58 | - Catch attribute access failing with any exception |
|
59 | - Catch attribute access failing with any exception | |
59 | - Check that the attribute is a callable object |
|
60 | - Check that the attribute is a callable object | |
60 |
|
61 | |||
61 | Returns the method or None. |
|
62 | Returns the method or None. | |
62 | """ |
|
63 | """ | |
63 | if inspect.isclass(obj): |
|
|||
64 | return None |
|
|||
65 |
|
||||
66 | try: |
|
64 | try: | |
67 | canary = getattr(obj, '_ipython_canary_method_should_not_exist_', None) |
|
65 | canary = getattr(obj, '_ipython_canary_method_should_not_exist_', None) | |
68 | except Exception: |
|
66 | except Exception: | |
@@ -77,6 +75,9 b' def get_real_method(obj, name):' | |||||
77 | except Exception: |
|
75 | except Exception: | |
78 | return None |
|
76 | return None | |
79 |
|
77 | |||
|
78 | if inspect.isclass(obj) and not isinstance(m, types.MethodType): | |||
|
79 | return None | |||
|
80 | ||||
80 | if callable(m): |
|
81 | if callable(m): | |
81 | return m |
|
82 | return m | |
82 |
|
83 |
@@ -115,7 +115,7 b' def filefind(filename, path_dirs=None):' | |||||
115 | """Find a file by looking through a sequence of paths. |
|
115 | """Find a file by looking through a sequence of paths. | |
116 |
|
116 | |||
117 | This iterates through a sequence of paths looking for a file and returns |
|
117 | This iterates through a sequence of paths looking for a file and returns | |
118 | the full, absolute path of the first occurence of the file. If no set of |
|
118 | the full, absolute path of the first occurrence of the file. If no set of | |
119 | path dirs is given, the filename is tested as is, after running through |
|
119 | path dirs is given, the filename is tested as is, after running through | |
120 | :func:`expandvars` and :func:`expanduser`. Thus a simple call:: |
|
120 | :func:`expandvars` and :func:`expanduser`. Thus a simple call:: | |
121 |
|
121 |
@@ -192,7 +192,7 b' def test_get_xdg_dir_0():' | |||||
192 |
|
192 | |||
193 | @with_environment |
|
193 | @with_environment | |
194 | def test_get_xdg_dir_1(): |
|
194 | def test_get_xdg_dir_1(): | |
195 |
"""test_get_xdg_dir_1, check nonexist |
|
195 | """test_get_xdg_dir_1, check nonexistent xdg_dir""" | |
196 | reload(path) |
|
196 | reload(path) | |
197 | path.get_home_dir = lambda : HOME_TEST_DIR |
|
197 | path.get_home_dir = lambda : HOME_TEST_DIR | |
198 | os.name = "posix" |
|
198 | os.name = "posix" |
@@ -667,7 +667,7 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :' | |||||
667 | separator_size : int (default=2) |
|
667 | separator_size : int (default=2) | |
668 | How much caracters will be used as a separation between each columns. |
|
668 | How much caracters will be used as a separation between each columns. | |
669 | displaywidth : int (default=80) |
|
669 | displaywidth : int (default=80) | |
670 | The width of the area onto wich the columns should enter |
|
670 | The width of the area onto which the columns should enter | |
671 |
|
671 | |||
672 | Returns |
|
672 | Returns | |
673 | ------- |
|
673 | ------- | |
@@ -675,7 +675,7 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :' | |||||
675 | strings_matrix |
|
675 | strings_matrix | |
676 |
|
676 | |||
677 | nested list of string, the outer most list contains as many list as |
|
677 | nested list of string, the outer most list contains as many list as | |
678 | rows, the innermost lists have each as many element as colums. If the |
|
678 | rows, the innermost lists have each as many element as columns. If the | |
679 | total number of elements in `items` does not equal the product of |
|
679 | total number of elements in `items` does not equal the product of | |
680 | rows*columns, the last element of some lists are filled with `None`. |
|
680 | rows*columns, the last element of some lists are filled with `None`. | |
681 |
|
681 |
@@ -13,6 +13,7 b' Patches:' | |||||
13 | - u and rb literals are allowed under Python 3.3 and above. |
|
13 | - u and rb literals are allowed under Python 3.3 and above. | |
14 |
|
14 | |||
15 | ------------------------------------------------------------------------------ |
|
15 | ------------------------------------------------------------------------------ | |
|
16 | ||||
16 | Tokenization help for Python programs. |
|
17 | Tokenization help for Python programs. | |
17 |
|
18 | |||
18 | tokenize(readline) is a generator that breaks a stream of bytes into |
|
19 | tokenize(readline) is a generator that breaks a stream of bytes into |
@@ -3,6 +3,7 b' IPython Documentation' | |||||
3 |
|
3 | |||
4 | This directory contains the majority of the documentation for IPython. |
|
4 | This directory contains the majority of the documentation for IPython. | |
5 |
|
5 | |||
|
6 | ||||
6 | Deploy docs |
|
7 | Deploy docs | |
7 | ----------- |
|
8 | ----------- | |
8 |
|
9 | |||
@@ -12,13 +13,24 b' Pull requests.' | |||||
12 |
|
13 | |||
13 | Requirements |
|
14 | Requirements | |
14 | ------------ |
|
15 | ------------ | |
15 | The following tools are needed to build the documentation: |
|
16 | ||
|
17 | The documentation must be built using Python 3. | |||
|
18 | ||||
|
19 | In additions to :ref:`devinstall`, | |||
|
20 | the following tools are needed to build the documentation: | |||
16 |
|
21 | |||
17 | - sphinx |
|
22 | - sphinx | |
|
23 | - sphinx_rtd_theme | |||
|
24 | - docrepr | |||
18 |
|
25 | |||
19 | On Debian-based systems, you should be able to run:: |
|
26 | In a conda environment, or a Python 3 ``venv``, you should be able to run:: | |
20 |
|
27 | |||
21 | sudo apt-get install python-sphinx |
|
28 | cd ipython | |
|
29 | pip install -U -r docs/requirements.txt | |||
|
30 | ||||
|
31 | ||||
|
32 | Build Commands | |||
|
33 | -------------- | |||
22 |
|
34 | |||
23 | The documentation gets built using ``make``, and comes in several flavors. |
|
35 | The documentation gets built using ``make``, and comes in several flavors. | |
24 |
|
36 | |||
@@ -35,5 +47,18 b' API documentation. This build target skips that.' | |||||
35 |
|
47 | |||
36 | You can run ``make help`` to see information on all possible make targets. |
|
48 | You can run ``make help`` to see information on all possible make targets. | |
37 |
|
49 | |||
|
50 | To save time, | |||
|
51 | the make targets above only proceess the files that have been changed since the | |||
|
52 | previous docs build. | |||
|
53 | To remove the previous docs build you can use ``make clean``. | |||
|
54 | You can also combine ``clean`` with other `make` commands; | |||
|
55 | for example, | |||
|
56 | ``make clean html`` will do a complete rebuild of the docs or `make clean pdf` will do a complete build of the pdf. | |||
|
57 | ||||
38 |
|
58 | |||
|
59 | Continuous Integration | |||
|
60 | ---------------------- | |||
39 |
|
61 | |||
|
62 | Documentation builds are included in the Travis-CI continuous integration process, | |||
|
63 | so you can see the results of the docs build for any pull request at | |||
|
64 | https://travis-ci.org/ipython/ipython/pull_requests. |
@@ -1,3 +1,6 b'' | |||||
1 | -e . |
|
1 | -e . | |
2 | ipykernel |
|
2 | ipykernel | |
3 | setuptools>=18.5 |
|
3 | setuptools>=18.5 | |
|
4 | sphinx | |||
|
5 | sphinx-rtd-theme | |||
|
6 | docrepr |
@@ -57,6 +57,7 b' extensions = [' | |||||
57 | 'sphinx.ext.doctest', |
|
57 | 'sphinx.ext.doctest', | |
58 | 'sphinx.ext.inheritance_diagram', |
|
58 | 'sphinx.ext.inheritance_diagram', | |
59 | 'sphinx.ext.intersphinx', |
|
59 | 'sphinx.ext.intersphinx', | |
|
60 | 'sphinx.ext.graphviz', | |||
60 | 'IPython.sphinxext.ipython_console_highlighting', |
|
61 | 'IPython.sphinxext.ipython_console_highlighting', | |
61 | 'IPython.sphinxext.ipython_directive', |
|
62 | 'IPython.sphinxext.ipython_directive', | |
62 | 'sphinx.ext.napoleon', # to preprocess docstrings |
|
63 | 'sphinx.ext.napoleon', # to preprocess docstrings |
@@ -19,6 +19,8 b' returns a list of objects which are possible keys in a subscript expression' | |||||
19 | .. versionadded:: 5.0 |
|
19 | .. versionadded:: 5.0 | |
20 | Custom key completions |
|
20 | Custom key completions | |
21 |
|
21 | |||
|
22 | .. _integrating_rich_display: | |||
|
23 | ||||
22 | Rich display |
|
24 | Rich display | |
23 | ============ |
|
25 | ============ | |
24 |
|
26 | |||
@@ -28,8 +30,8 b' these are surrounded by single, not double underscores.' | |||||
28 |
|
30 | |||
29 | Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg`` |
|
31 | Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg`` | |
30 | representations. The notebook can also display ``html``, ``javascript``, |
|
32 | representations. The notebook can also display ``html``, ``javascript``, | |
31 |
and ``latex``. If the methods don't exist, or return ``None``, it |
|
33 | ``markdown`` and ``latex``. If the methods don't exist, or return ``None``, it | |
32 | back to a standard ``repr()``. |
|
34 | falls back to a standard ``repr()``. | |
33 |
|
35 | |||
34 | For example:: |
|
36 | For example:: | |
35 |
|
37 | |||
@@ -40,6 +42,38 b' For example::' | |||||
40 | def _repr_html_(self): |
|
42 | def _repr_html_(self): | |
41 | return "<h1>" + self.text + "</h1>" |
|
43 | return "<h1>" + self.text + "</h1>" | |
42 |
|
44 | |||
|
45 | There are also two more powerful display methods: | |||
|
46 | ||||
|
47 | .. class:: MyObject | |||
|
48 | ||||
|
49 | .. method:: _repr_mimebundle_(include=None, exclude=None) | |||
|
50 | ||||
|
51 | Should return a dictionary of multiple formats, keyed by mimetype, or a tuple | |||
|
52 | of two dictionaries: *data, metadata*. If this returns something, other | |||
|
53 | ``_repr_*_`` methods are ignored. The method should take keyword arguments | |||
|
54 | ``include`` and ``exclude``, though it is not required to respect them. | |||
|
55 | ||||
|
56 | .. method:: _ipython_display_() | |||
|
57 | ||||
|
58 | Displays the object as a side effect; the return value is ignored. If this | |||
|
59 | is defined, all other display methods are ignored. | |||
|
60 | ||||
|
61 | Formatters for third-party types | |||
|
62 | -------------------------------- | |||
|
63 | ||||
|
64 | The user can also register formatters for types without modifying the class:: | |||
|
65 | ||||
|
66 | from bar import Foo | |||
|
67 | ||||
|
68 | def foo_html(obj): | |||
|
69 | return '<marquee>Foo object %s</marquee>' % obj.name | |||
|
70 | ||||
|
71 | html_formatter = get_ipython().display_formatter.formatters['text/html'] | |||
|
72 | html_formatter.for_type(Foo, foo_html) | |||
|
73 | ||||
|
74 | # Or register a type without importing it - this does the same as above: | |||
|
75 | html_formatter.for_type_by_name('bar.Foo', foo_html) | |||
|
76 | ||||
43 | Custom exception tracebacks |
|
77 | Custom exception tracebacks | |
44 | =========================== |
|
78 | =========================== | |
45 |
|
79 |
@@ -53,7 +53,7 b' environments, you will need to specify unique names for the kernelspecs.' | |||||
53 |
|
53 | |||
54 | Make sure you have ipykernel installed in your environement. If you are using |
|
54 | Make sure you have ipykernel installed in your environement. If you are using | |
55 | ``pip`` to install ``ipykernel`` in a conda env, make sure ``pip`` is |
|
55 | ``pip`` to install ``ipykernel`` in a conda env, make sure ``pip`` is | |
56 |
installed: |
|
56 | installed: | |
57 |
|
57 | |||
58 | .. sourcecode:: bash |
|
58 | .. sourcecode:: bash | |
59 |
|
59 | |||
@@ -86,7 +86,7 b' Using virtualenv or conda envs, you can make your IPython kernel in one env avai' | |||||
86 |
|
86 | |||
87 | /path/to/kernel/env/bin/python -m ipykernel install --prefix=/path/to/jupyter/env --name 'python-my-env' |
|
87 | /path/to/kernel/env/bin/python -m ipykernel install --prefix=/path/to/jupyter/env --name 'python-my-env' | |
88 |
|
88 | |||
89 | Note that this command will create a new configuration for the kernel in one of the prefered location (see ``jupyter --paths`` command for more details): |
|
89 | Note that this command will create a new configuration for the kernel in one of the preferred location (see ``jupyter --paths`` command for more details): | |
90 |
|
90 | |||
91 | * system-wide (e.g. /usr/local/share), |
|
91 | * system-wide (e.g. /usr/local/share), | |
92 | * in Jupyter's env (sys.prefix/share), |
|
92 | * in Jupyter's env (sys.prefix/share), |
@@ -239,8 +239,8 b' To run any command at the system shell, simply prefix it with ``!``, e.g.::' | |||||
239 |
|
239 | |||
240 | You can capture the output into a Python list, e.g.: ``files = !ls``. To pass |
|
240 | You can capture the output into a Python list, e.g.: ``files = !ls``. To pass | |
241 | the values of Python variables or expressions to system commands, prefix them |
|
241 | the values of Python variables or expressions to system commands, prefix them | |
242 |
with $: ``!grep -rF $pattern ipython/*``. See :ref:`our |
|
242 | with $: ``!grep -rF $pattern ipython/*`` or wrap in `{braces}`. See :ref:`our | |
243 | <system_shell_access>` for more details. |
|
243 | shell section <system_shell_access>` for more details. | |
244 |
|
244 | |||
245 | Define your own system aliases |
|
245 | Define your own system aliases | |
246 | ------------------------------ |
|
246 | ------------------------------ |
@@ -34,7 +34,7 b' Pull requests (226):' | |||||
34 | * `574 <https://github.com/ipython/ipython/issues/574>`_: Getcwdu |
|
34 | * `574 <https://github.com/ipython/ipython/issues/574>`_: Getcwdu | |
35 | * `565 <https://github.com/ipython/ipython/issues/565>`_: don't move old config files, keep nagging the user |
|
35 | * `565 <https://github.com/ipython/ipython/issues/565>`_: don't move old config files, keep nagging the user | |
36 | * `575 <https://github.com/ipython/ipython/issues/575>`_: Added more docstrings to IPython.zmq.session. |
|
36 | * `575 <https://github.com/ipython/ipython/issues/575>`_: Added more docstrings to IPython.zmq.session. | |
37 | * `567 <https://github.com/ipython/ipython/issues/567>`_: fix trailing whitespace from reseting indentation |
|
37 | * `567 <https://github.com/ipython/ipython/issues/567>`_: fix trailing whitespace from resetting indentation | |
38 | * `564 <https://github.com/ipython/ipython/issues/564>`_: Command line args in docs |
|
38 | * `564 <https://github.com/ipython/ipython/issues/564>`_: Command line args in docs | |
39 | * `560 <https://github.com/ipython/ipython/issues/560>`_: reorder qt support in kernel |
|
39 | * `560 <https://github.com/ipython/ipython/issues/560>`_: reorder qt support in kernel | |
40 | * `561 <https://github.com/ipython/ipython/issues/561>`_: command-line suggestions |
|
40 | * `561 <https://github.com/ipython/ipython/issues/561>`_: command-line suggestions | |
@@ -445,7 +445,7 b' Regular issues (285):' | |||||
445 | * `46 <https://github.com/ipython/ipython/issues/46>`_: Input to %timeit is not preparsed |
|
445 | * `46 <https://github.com/ipython/ipython/issues/46>`_: Input to %timeit is not preparsed | |
446 | * `285 <https://github.com/ipython/ipython/issues/285>`_: ipcluster local -n 4 fails |
|
446 | * `285 <https://github.com/ipython/ipython/issues/285>`_: ipcluster local -n 4 fails | |
447 | * `205 <https://github.com/ipython/ipython/issues/205>`_: In the Qt console, Tab should insert 4 spaces when not completing |
|
447 | * `205 <https://github.com/ipython/ipython/issues/205>`_: In the Qt console, Tab should insert 4 spaces when not completing | |
448 | * `145 <https://github.com/ipython/ipython/issues/145>`_: Bug on MSW sytems: idle can not be set as default IPython editor. Fix Suggested. |
|
448 | * `145 <https://github.com/ipython/ipython/issues/145>`_: Bug on MSW systems: idle can not be set as default IPython editor. Fix Suggested. | |
449 | * `77 <https://github.com/ipython/ipython/issues/77>`_: ipython oops in cygwin |
|
449 | * `77 <https://github.com/ipython/ipython/issues/77>`_: ipython oops in cygwin | |
450 | * `121 <https://github.com/ipython/ipython/issues/121>`_: If plot windows are closed via window controls, no more plotting is possible. |
|
450 | * `121 <https://github.com/ipython/ipython/issues/121>`_: If plot windows are closed via window controls, no more plotting is possible. | |
451 | * `111 <https://github.com/ipython/ipython/issues/111>`_: Iterator version of TaskClient.map() that returns results as they become available |
|
451 | * `111 <https://github.com/ipython/ipython/issues/111>`_: Iterator version of TaskClient.map() that returns results as they become available | |
@@ -494,7 +494,7 b' Regular issues (285):' | |||||
494 | * `161 <https://github.com/ipython/ipython/issues/161>`_: make ipythonqt exit without dialog when exit() is called |
|
494 | * `161 <https://github.com/ipython/ipython/issues/161>`_: make ipythonqt exit without dialog when exit() is called | |
495 | * `263 <https://github.com/ipython/ipython/issues/263>`_: [ipython + numpy] Some test errors |
|
495 | * `263 <https://github.com/ipython/ipython/issues/263>`_: [ipython + numpy] Some test errors | |
496 | * `256 <https://github.com/ipython/ipython/issues/256>`_: reset docstring ipython 0.10 |
|
496 | * `256 <https://github.com/ipython/ipython/issues/256>`_: reset docstring ipython 0.10 | |
497 |
* `258 <https://github.com/ipython/ipython/issues/258>`_: allow caching to avoid matplotlib object refer |
|
497 | * `258 <https://github.com/ipython/ipython/issues/258>`_: allow caching to avoid matplotlib object references | |
498 | * `248 <https://github.com/ipython/ipython/issues/248>`_: Can't open and read files after upgrade from 0.10 to 0.10.0 |
|
498 | * `248 <https://github.com/ipython/ipython/issues/248>`_: Can't open and read files after upgrade from 0.10 to 0.10.0 | |
499 | * `247 <https://github.com/ipython/ipython/issues/247>`_: ipython + Stackless |
|
499 | * `247 <https://github.com/ipython/ipython/issues/247>`_: ipython + Stackless | |
500 | * `245 <https://github.com/ipython/ipython/issues/245>`_: Magic save and macro missing newlines, line ranges don't match prompt numbers. |
|
500 | * `245 <https://github.com/ipython/ipython/issues/245>`_: Magic save and macro missing newlines, line ranges don't match prompt numbers. |
@@ -284,7 +284,7 b' Pull requests (257):' | |||||
284 | * `798 <https://github.com/ipython/ipython/issues/798>`_: pexpect & Python 3 |
|
284 | * `798 <https://github.com/ipython/ipython/issues/798>`_: pexpect & Python 3 | |
285 | * `804 <https://github.com/ipython/ipython/issues/804>`_: Magic 'range' crash if greater than len(input_hist) |
|
285 | * `804 <https://github.com/ipython/ipython/issues/804>`_: Magic 'range' crash if greater than len(input_hist) | |
286 | * `821 <https://github.com/ipython/ipython/issues/821>`_: update tornado dependency to 2.1 |
|
286 | * `821 <https://github.com/ipython/ipython/issues/821>`_: update tornado dependency to 2.1 | |
287 | * `807 <https://github.com/ipython/ipython/issues/807>`_: Faciliate ssh tunnel sharing by announcing ports |
|
287 | * `807 <https://github.com/ipython/ipython/issues/807>`_: Facilitate ssh tunnel sharing by announcing ports | |
288 | * `795 <https://github.com/ipython/ipython/issues/795>`_: Add cluster-id for multiple cluster instances per profile |
|
288 | * `795 <https://github.com/ipython/ipython/issues/795>`_: Add cluster-id for multiple cluster instances per profile | |
289 | * `742 <https://github.com/ipython/ipython/issues/742>`_: Glut |
|
289 | * `742 <https://github.com/ipython/ipython/issues/742>`_: Glut | |
290 | * `668 <https://github.com/ipython/ipython/issues/668>`_: Greedy completer |
|
290 | * `668 <https://github.com/ipython/ipython/issues/668>`_: Greedy completer |
@@ -581,7 +581,7 b' Pull Requests (793):' | |||||
581 | * :ghpull:`3575`: tweak `run -d` message to 'continue execution' |
|
581 | * :ghpull:`3575`: tweak `run -d` message to 'continue execution' | |
582 | * :ghpull:`3569`: add PYTHONSTARTUP to startup files |
|
582 | * :ghpull:`3569`: add PYTHONSTARTUP to startup files | |
583 | * :ghpull:`3567`: Trigger a single event on js app initilized |
|
583 | * :ghpull:`3567`: Trigger a single event on js app initilized | |
584 |
* :ghpull:`3565`: style.min.css shou |
|
584 | * :ghpull:`3565`: style.min.css should always exist... | |
585 | * :ghpull:`3531`: allow markdown in heading cells |
|
585 | * :ghpull:`3531`: allow markdown in heading cells | |
586 | * :ghpull:`3577`: Simplify codemirror ipython-mode |
|
586 | * :ghpull:`3577`: Simplify codemirror ipython-mode | |
587 | * :ghpull:`3495`: Simplified regexp, and suggestions for clearer regexps. |
|
587 | * :ghpull:`3495`: Simplified regexp, and suggestions for clearer regexps. | |
@@ -666,7 +666,7 b' Pull Requests (793):' | |||||
666 | * :ghpull:`3373`: make cookie_secret configurable |
|
666 | * :ghpull:`3373`: make cookie_secret configurable | |
667 | * :ghpull:`3307`: switch default ws_url logic to js side |
|
667 | * :ghpull:`3307`: switch default ws_url logic to js side | |
668 | * :ghpull:`3392`: Restore anchor link on h2-h6 |
|
668 | * :ghpull:`3392`: Restore anchor link on h2-h6 | |
669 | * :ghpull:`3369`: Use different treshold for (auto)scroll in output |
|
669 | * :ghpull:`3369`: Use different threshold for (auto)scroll in output | |
670 | * :ghpull:`3370`: normalize unicode notebook filenames |
|
670 | * :ghpull:`3370`: normalize unicode notebook filenames | |
671 | * :ghpull:`3372`: base default cookie name on request host+port |
|
671 | * :ghpull:`3372`: base default cookie name on request host+port | |
672 | * :ghpull:`3378`: disable CodeMirror drag/drop on Safari |
|
672 | * :ghpull:`3378`: disable CodeMirror drag/drop on Safari | |
@@ -848,7 +848,7 b' Pull Requests (793):' | |||||
848 | * :ghpull:`2941`: fix baseUrl |
|
848 | * :ghpull:`2941`: fix baseUrl | |
849 | * :ghpull:`2903`: Specify toggle value on cell line number |
|
849 | * :ghpull:`2903`: Specify toggle value on cell line number | |
850 | * :ghpull:`2911`: display order in output area configurable |
|
850 | * :ghpull:`2911`: display order in output area configurable | |
851 | * :ghpull:`2897`: Dont rely on BaseProjectUrl data in body tag |
|
851 | * :ghpull:`2897`: Don't rely on BaseProjectUrl data in body tag | |
852 | * :ghpull:`2894`: Cm configurable |
|
852 | * :ghpull:`2894`: Cm configurable | |
853 | * :ghpull:`2927`: next release will be 1.0 |
|
853 | * :ghpull:`2927`: next release will be 1.0 | |
854 | * :ghpull:`2932`: Simplify using notebook static files from external code |
|
854 | * :ghpull:`2932`: Simplify using notebook static files from external code | |
@@ -1476,7 +1476,7 b' Issues (691):' | |||||
1476 | * :ghissue:`3374`: ipython qtconsole does not display the prompt on OSX |
|
1476 | * :ghissue:`3374`: ipython qtconsole does not display the prompt on OSX | |
1477 | * :ghissue:`3380`: simple call to kernel |
|
1477 | * :ghissue:`3380`: simple call to kernel | |
1478 | * :ghissue:`3379`: TaskRecord key 'started' not set |
|
1478 | * :ghissue:`3379`: TaskRecord key 'started' not set | |
1479 | * :ghissue:`3241`: notebook conection time out |
|
1479 | * :ghissue:`3241`: notebook connection time out | |
1480 | * :ghissue:`3334`: magic interpreter interpretes non magic commands? |
|
1480 | * :ghissue:`3334`: magic interpreter interpretes non magic commands? | |
1481 | * :ghissue:`3326`: python3.3: Type error when launching SGE cluster in IPython notebook |
|
1481 | * :ghissue:`3326`: python3.3: Type error when launching SGE cluster in IPython notebook | |
1482 | * :ghissue:`3349`: pip3 doesn't run 2to3? |
|
1482 | * :ghissue:`3349`: pip3 doesn't run 2to3? | |
@@ -1802,7 +1802,7 b' Issues (691):' | |||||
1802 | * :ghissue:`2351`: Multiple Notebook Apps: cookies not port specific, clash with each other |
|
1802 | * :ghissue:`2351`: Multiple Notebook Apps: cookies not port specific, clash with each other | |
1803 | * :ghissue:`2350`: running unittest from qtconsole prints output to terminal |
|
1803 | * :ghissue:`2350`: running unittest from qtconsole prints output to terminal | |
1804 | * :ghissue:`2303`: remote tracebacks broken since 952d0d6 (PR #2223) |
|
1804 | * :ghissue:`2303`: remote tracebacks broken since 952d0d6 (PR #2223) | |
1805 |
* :ghissue:`2330`: qtconsole does not high |
|
1805 | * :ghissue:`2330`: qtconsole does not highlight tab-completion suggestion with custom stylesheet | |
1806 | * :ghissue:`2325`: Parsing Tex formula fails in Notebook |
|
1806 | * :ghissue:`2325`: Parsing Tex formula fails in Notebook | |
1807 | * :ghissue:`2324`: Parsing Tex formula fails |
|
1807 | * :ghissue:`2324`: Parsing Tex formula fails | |
1808 | * :ghissue:`1474`: Add argument to `run -n` for custom namespace |
|
1808 | * :ghissue:`1474`: Add argument to `run -n` for custom namespace |
@@ -1422,7 +1422,7 b' Issues (434):' | |||||
1422 | * :ghissue:`3402`: Feature Request: Save As (latex, html,..etc) as a menu option in Notebook rather than explicit need to invoke nbconvert |
|
1422 | * :ghissue:`3402`: Feature Request: Save As (latex, html,..etc) as a menu option in Notebook rather than explicit need to invoke nbconvert | |
1423 | * :ghissue:`3224`: Revisit layout of notebook area |
|
1423 | * :ghissue:`3224`: Revisit layout of notebook area | |
1424 | * :ghissue:`2746`: rerunning a cell with long output (exception) scrolls to much (html notebook) |
|
1424 | * :ghissue:`2746`: rerunning a cell with long output (exception) scrolls to much (html notebook) | |
1425 | * :ghissue:`2667`: can't save opened notebook if accidently delete the notebook in the dashboard |
|
1425 | * :ghissue:`2667`: can't save opened notebook if accidentally delete the notebook in the dashboard | |
1426 | * :ghissue:`3026`: Reporting errors from _repr_<type>_ methods |
|
1426 | * :ghissue:`3026`: Reporting errors from _repr_<type>_ methods | |
1427 | * :ghissue:`1844`: Notebook does not exist and permalinks |
|
1427 | * :ghissue:`1844`: Notebook does not exist and permalinks | |
1428 | * :ghissue:`2450`: [closed PR] Prevent jumping of window to input when output is clicked. |
|
1428 | * :ghissue:`2450`: [closed PR] Prevent jumping of window to input when output is clicked. |
@@ -34,7 +34,7 b' Highlights of this release:' | |||||
34 | (such as a linux text console without X11). |
|
34 | (such as a linux text console without X11). | |
35 |
|
35 | |||
36 | For this release we merged 24 commits, contributed by the following people |
|
36 | For this release we merged 24 commits, contributed by the following people | |
37 |
(please let us know if we om |
|
37 | (please let us know if we omitted your name and we'll gladly fix this in the | |
38 | notes for the future): |
|
38 | notes for the future): | |
39 |
|
39 | |||
40 | * Fernando Perez |
|
40 | * Fernando Perez |
@@ -190,7 +190,7 b' Smaller Changes' | |||||
190 | (`#6990 <https://github.com/ipython/ipython/pull/6990>`__). |
|
190 | (`#6990 <https://github.com/ipython/ipython/pull/6990>`__). | |
191 | - A warning was added that shows on widget import because it's expected |
|
191 | - A warning was added that shows on widget import because it's expected | |
192 | that the API will change again by IPython 4.0. This warning can be |
|
192 | that the API will change again by IPython 4.0. This warning can be | |
193 | supressed (`#7107 <https://github.com/ipython/ipython/pull/7107>`__, |
|
193 | suppressed (`#7107 <https://github.com/ipython/ipython/pull/7107>`__, | |
194 | `#7200 <https://github.com/ipython/ipython/pull/7200>`__, |
|
194 | `#7200 <https://github.com/ipython/ipython/pull/7200>`__, | |
195 | `#7201 <https://github.com/ipython/ipython/pull/7201>`__, |
|
195 | `#7201 <https://github.com/ipython/ipython/pull/7201>`__, | |
196 | `#7204 <https://github.com/ipython/ipython/pull/7204>`__). |
|
196 | `#7204 <https://github.com/ipython/ipython/pull/7204>`__). |
@@ -87,7 +87,7 b' Define ``_repr_mimebundle_``' | |||||
87 | Object can now define `_repr_mimebundle_` in place of multiple `_repr_*_` |
|
87 | Object can now define `_repr_mimebundle_` in place of multiple `_repr_*_` | |
88 | methods and return a full mimebundle. This greatly simplify many implementation |
|
88 | methods and return a full mimebundle. This greatly simplify many implementation | |
89 | and allow to publish custom mimetypes (like geojson, plotly, dataframes....). |
|
89 | and allow to publish custom mimetypes (like geojson, plotly, dataframes....). | |
90 |
See the ``Cutom Display Logic`` example notebook for more information |
|
90 | See the ``Custom Display Logic`` example notebook for more information. | |
91 |
|
91 | |||
92 | Execution Heuristics |
|
92 | Execution Heuristics | |
93 | -------------------- |
|
93 | -------------------- |
@@ -739,7 +739,7 b'' | |||||
739 | " \n", |
|
739 | " \n", | |
740 | " def _repr_mimebundle_(self, include, exclude, **kwargs):\n", |
|
740 | " def _repr_mimebundle_(self, include, exclude, **kwargs):\n", | |
741 | " \"\"\"\n", |
|
741 | " \"\"\"\n", | |
742 |
" repr_mimebundle shou |
|
742 | " repr_mimebundle should accept include, exclude and **kwargs\n", | |
743 | " \"\"\"\n", |
|
743 | " \"\"\"\n", | |
744 | " if self._png_data is None:\n", |
|
744 | " if self._png_data is None:\n", | |
745 | " self._png_data = self._figure_data('png')\n", |
|
745 | " self._png_data = self._figure_data('png')\n", | |
@@ -777,7 +777,7 b'' | |||||
777 | } |
|
777 | } | |
778 | ], |
|
778 | ], | |
779 | "source": [ |
|
779 | "source": [ | |
780 |
"# that is def |
|
780 | "# that is definitively wrong as it should show the PNG. \n", | |
781 | "display(Gaussian())" |
|
781 | "display(Gaussian())" | |
782 | ] |
|
782 | ] | |
783 | }, |
|
783 | }, |
@@ -2602,7 +2602,7 b'' | |||||
2602 | " // Register the callback with on_msg.\n", |
|
2602 | " // Register the callback with on_msg.\n", | |
2603 | " comm.on_msg(function(msg) {\n", |
|
2603 | " comm.on_msg(function(msg) {\n", | |
2604 | " //console.log('receiving', msg['content']['data'], msg);\n", |
|
2604 | " //console.log('receiving', msg['content']['data'], msg);\n", | |
2605 | " // Pass the mpl event to the overriden (by mpl) onmessage function.\n", |
|
2605 | " // Pass the mpl event to the overridden (by mpl) onmessage function.\n", | |
2606 | " ws.onmessage(msg['content']['data'])\n", |
|
2606 | " ws.onmessage(msg['content']['data'])\n", | |
2607 | " });\n", |
|
2607 | " });\n", | |
2608 | " return ws;\n", |
|
2608 | " return ws;\n", |
@@ -660,7 +660,7 b'' | |||||
660 | "cell_type": "markdown", |
|
660 | "cell_type": "markdown", | |
661 | "metadata": {}, |
|
661 | "metadata": {}, | |
662 | "source": [ |
|
662 | "source": [ | |
663 | "Here is the embedded version. Note that this image was pulled from the webcam when this code cell was originally run and stored in the Notebook. Unless we rerun this cell, this is not todays image." |
|
663 | "Here is the embedded version. Note that this image was pulled from the webcam when this code cell was originally run and stored in the Notebook. Unless we rerun this cell, this is not today's image." | |
664 | ] |
|
664 | ] | |
665 | }, |
|
665 | }, | |
666 | { |
|
666 | { |
@@ -3,7 +3,7 b'' | |||||
3 | # This script autogenerates `IPython.core.latex_symbols.py`, which contains a |
|
3 | # This script autogenerates `IPython.core.latex_symbols.py`, which contains a | |
4 | # single dict , named `latex_symbols`. The keys in this dict are latex symbols, |
|
4 | # single dict , named `latex_symbols`. The keys in this dict are latex symbols, | |
5 | # such as `\\alpha` and the values in the dict are the unicode equivalents for |
|
5 | # such as `\\alpha` and the values in the dict are the unicode equivalents for | |
6 | # those. Most importantly, only unicode symbols that are valid identifers in |
|
6 | # those. Most importantly, only unicode symbols that are valid identifiers in | |
7 | # Python 3 are included. |
|
7 | # Python 3 are included. | |
8 |
|
8 | |||
9 | # |
|
9 | # |
@@ -23,7 +23,7 b' def merge_branch(repo, branch ):' | |||||
23 |
|
23 | |||
24 | If something does not goes smoothly, merge is aborted |
|
24 | If something does not goes smoothly, merge is aborted | |
25 |
|
25 | |||
26 |
Returns True if merge sucessfu |
|
26 | Returns True if merge successful, False otherwise | |
27 | """ |
|
27 | """ | |
28 | # Delete the branch first |
|
28 | # Delete the branch first | |
29 | try : |
|
29 | try : |
General Comments 0
You need to be logged in to leave comments.
Login now