From c3cea33fb0b0ca73e119cc1a53f31d34ffd1dc14 2012-05-11 21:36:24 From: Matthias BUSSONNIER Date: 2012-05-11 21:36:24 Subject: [PATCH] fix english, typo, remove code that was a test also remove unused import from openpy --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index b2adbba..e444b9b 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2750,7 +2750,7 @@ class InteractiveShell(SingletonConfigurable, Magic): A string specifying code to retrieve. This will be tried respectively as: ranges of input history (see %history for syntax), url, - correspnding .py file,filename, or an expression evaluating to a + correspnding .py file, filename, or an expression evaluating to a string or Macro in the user namespace. raw : bool @@ -2772,8 +2772,8 @@ class InteractiveShell(SingletonConfigurable, Magic): utarget = unquote_filename(target) if utarget.startswith(('http://', 'https://')): return openpy.read_py_url(utarget, skip_encoding_cookie=True) - except: - raise ValueError(("'%s': no such URL, or URL innaccessible.") % utarget) + except UnicodeDecodeError: + raise ValueError(("'%s' seem to be unredable.") % utarget) try : pyfile = get_py_filename(target) diff --git a/IPython/core/magic.py b/IPython/core/magic.py index fd13c92..1c06dd5 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -2265,8 +2265,8 @@ Currently the magic system has the following functions:\n""" def magic_loadpy(self, arg_s): """Alias of `%load` - `%loadpy` has gain some flexibility and drop the requirement of `.py` - extension. So it has been rename simply into %load. You can look at + `%loadpy` has gained some flexibility and droped the requirement of a `.py` + extension. So it has been renamed simply into %load. You can look at `%load`'s docstring for more info. """ self.magic_load(arg_s) @@ -2281,11 +2281,11 @@ Currently the magic system has the following functions:\n""" Options: -------- - -y : Don't ask confirmation for loading source above 200 000 caracters. + -y : Don't ask confirmation for loading source above 200 000 characters. This magic command can either take a local filename, a URL, an history range (see %history) or a macro as argument, it will prompt for - confirmation before loading source with more than 200 000 caracters, unless + confirmation before loading source with more than 200 000 characters, unless -y flag is passed or if the frontend does not support raw_input:: %load myscript.py @@ -2303,7 +2303,7 @@ Currently the magic system has the following functions:\n""" # so in average, more than 5000 lines if l > 200000 and 'y' not in opts: try: - ans = self.shell.ask_yes_no(("The text you'r trying to load seem pretty big"\ + ans = self.shell.ask_yes_no(("The text you're trying to load seems pretty big"\ " (%d characters). Continue (y/[N]) ?" % l), default='n' ) except StdinNotImplementedError: #asume yes if raw input not implemented diff --git a/IPython/utils/openpy.py b/IPython/utils/openpy.py index 1c1f8af..9dd6b22 100644 --- a/IPython/utils/openpy.py +++ b/IPython/utils/openpy.py @@ -6,7 +6,6 @@ Much of the code is taken from the tokenize module in Python 3.2. """ from __future__ import absolute_import -import __builtin__ import io from io import TextIOWrapper import re