more relative imports
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 5f75f9e · Browse files · 2 files·+22 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+22 added−28 removed
- other:+22 added−28 removed
Provenance
- Commit
a1de45c- Tree
6a4033a- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
5f75f9e
2 files changed+22 added−28 removed
modified:src/click/_unicodefun.py+4 added-7 removed
2 unmodified lines3 import sys4 5 from ._compat import PY26 7-# If someone wants to vendor click, we want to ensure the8-# correct package is discovered. Ideally we could use a9-# relative import here but unfortunately Python does not10-# support that.11-click = sys.modules[__name__.rsplit(".", 1)[0]]7 13-8 def _find_unicode_literals_frame():9 import __future__10 11 if not hasattr(sys, "_getframe"): # not all Python implementations have it13 unmodified lines25 26 def _check_for_unicode_literals():27 if not __debug__:28 return29+30+ from . import disable_unicode_literals_warning31+35- if not PY2 or click.disable_unicode_literals_warning:32+ if not PY2 or disable_unicode_literals_warning:33 return34 bad_frame = _find_unicode_literals_frame()35 if bad_frame <= 0:36 return94 unmodified linesmodified:src/click/testing.py+18 added-21 removed
3 unmodified lines4 import shutil5 import sys6 import tempfile7 8+from . import formatting9+from . import termui10+from . import utils11 from ._compat import iteritems12 from ._compat import PY213 from ._compat import string_types14 12-# If someone wants to vendor click, we want to ensure the13-# correct package is discovered. Ideally we could use a14-# relative import here but unfortunately Python does not15-# support that.16-clickpkg = sys.modules[__name__.rsplit(".", 1)[0]]15 18-16 if PY2:17 from cStringIO import StringIO18 else:19 import io159 unmodified lines179 180 old_stdin = sys.stdin181 old_stdout = sys.stdout182 old_stderr = sys.stderr186- old_forced_width = clickpkg.formatting.FORCED_WIDTH187- clickpkg.formatting.FORCED_WIDTH = 80183+ old_forced_width = formatting.FORCED_WIDTH184+ formatting.FORCED_WIDTH = 80185 186 env = self.make_env(env)187 188 if PY2:44 unmodified lines233 if color is None:234 return not default_color235 return not color236 240- old_visible_prompt_func = clickpkg.termui.visible_prompt_func241- old_hidden_prompt_func = clickpkg.termui.hidden_prompt_func242- old__getchar_func = clickpkg.termui._getchar243- old_should_strip_ansi = clickpkg.utils.should_strip_ansi244- clickpkg.termui.visible_prompt_func = visible_input245- clickpkg.termui.hidden_prompt_func = hidden_input246- clickpkg.termui._getchar = _getchar247- clickpkg.utils.should_strip_ansi = should_strip_ansi237+ old_visible_prompt_func = termui.visible_prompt_func238+ old_hidden_prompt_func = termui.hidden_prompt_func239+ old__getchar_func = termui._getchar240+ old_should_strip_ansi = utils.should_strip_ansi241+ termui.visible_prompt_func = visible_input242+ termui.hidden_prompt_func = hidden_input243+ termui._getchar = _getchar244+ utils.should_strip_ansi = should_strip_ansi245 246 old_env = {}247 try:248 for key, value in iteritems(env):17 unmodified lines266 os.environ[key] = value267 sys.stdout = old_stdout268 sys.stderr = old_stderr269 sys.stdin = old_stdin273- clickpkg.termui.visible_prompt_func = old_visible_prompt_func274- clickpkg.termui.hidden_prompt_func = old_hidden_prompt_func275- clickpkg.termui._getchar = old__getchar_func276- clickpkg.utils.should_strip_ansi = old_should_strip_ansi277- clickpkg.formatting.FORCED_WIDTH = old_forced_width270+ termui.visible_prompt_func = old_visible_prompt_func271+ termui.hidden_prompt_func = old_hidden_prompt_func272+ termui._getchar = old__getchar_func273+ utils.should_strip_ansi = old_should_strip_ansi274+ formatting.FORCED_WIDTH = old_forced_width275 276 def invoke(277 self,278 cli,105 unmodified lines