Rename Ipython to IPython (two capital letters in place of one)

This commit is contained in:
ZyX 2014-08-19 19:44:07 +04:00
parent 50160e9889
commit b93f8d9b7b
6 changed files with 28 additions and 28 deletions

View File

@ -1,11 +1,11 @@
# vim:fileencoding=utf-8:noet
from powerline.ipython import IpythonPowerline, RewriteResult
from powerline.ipython import IPythonPowerline, RewriteResult
from IPython.core.prompts import PromptManager
from IPython.core.hooks import TryNext
class IpythonInfo(object):
class IPythonInfo(object):
def __init__(self, shell):
self._shell = shell
@ -18,7 +18,7 @@ class PowerlinePromptManager(PromptManager):
def __init__(self, prompt_powerline, non_prompt_powerline, shell):
prompt_powerline.setup('prompt_powerline', self)
non_prompt_powerline.setup('non_prompt_powerline', self)
self.powerline_segment_info = IpythonInfo(shell)
self.powerline_segment_info = IPythonInfo(shell)
self.shell = shell
def render(self, name, color=True, *args, **kwargs):
@ -42,13 +42,13 @@ class PowerlinePromptManager(PromptManager):
return ret
class ConfigurableIpythonPowerline(IpythonPowerline):
class ConfigurableIPythonPowerline(IPythonPowerline):
def init(self, ip, is_prompt, old_widths):
config = ip.config.Powerline
self.config_overrides = config.get('config_overrides')
self.theme_overrides = config.get('theme_overrides', {})
self.paths = config.get('paths')
super(ConfigurableIpythonPowerline, self).init(is_prompt, old_widths)
super(ConfigurableIPythonPowerline, self).init(is_prompt, old_widths)
old_prompt_manager = None
@ -59,8 +59,8 @@ def load_ipython_extension(ip):
old_prompt_manager = ip.prompt_manager
old_widths = {}
prompt_powerline = ConfigurableIpythonPowerline(ip, True, old_widths)
non_prompt_powerline = ConfigurableIpythonPowerline(ip, False, old_widths)
prompt_powerline = ConfigurableIPythonPowerline(ip, True, old_widths)
non_prompt_powerline = ConfigurableIPythonPowerline(ip, False, old_widths)
ip.prompt_manager = PowerlinePromptManager(
prompt_powerline=prompt_powerline,

View File

@ -1,5 +1,5 @@
# vim:fileencoding=utf-8:noet
from powerline.ipython import IpythonPowerline, RewriteResult
from powerline.ipython import IPythonPowerline, RewriteResult
from powerline.lib.unicode import string
from IPython.Prompts import BasePrompt
from IPython.ipapi import get as get_ipython
@ -8,7 +8,7 @@ from IPython.ipapi import TryNext
import re
class IpythonInfo(object):
class IPythonInfo(object):
def __init__(self, cache):
self._cache = cache
@ -22,7 +22,7 @@ class PowerlinePrompt(BasePrompt):
powerline.setup('powerline', self)
other_powerline.setup('other_powerline', self)
self.powerline_last_in = powerline_last_in
self.powerline_segment_info = IpythonInfo(old_prompt.cache)
self.powerline_segment_info = IPythonInfo(old_prompt.cache)
self.cache = old_prompt.cache
if hasattr(old_prompt, 'sep'):
self.sep = old_prompt.sep
@ -85,20 +85,20 @@ class PowerlinePrompt2(PowerlinePromptOut):
powerline_prompt_type = 'in2'
class ConfigurableIpythonPowerline(IpythonPowerline):
class ConfigurableIPythonPowerline(IPythonPowerline):
def init(self, is_prompt, old_widths, config_overrides=None, theme_overrides={}, paths=None):
self.config_overrides = config_overrides
self.theme_overrides = theme_overrides
self.paths = paths
super(ConfigurableIpythonPowerline, self).init(is_prompt, old_widths)
super(ConfigurableIPythonPowerline, self).init(is_prompt, old_widths)
def setup(**kwargs):
ip = get_ipython()
old_widths = {}
prompt_powerline = ConfigurableIpythonPowerline(True, old_widths, **kwargs)
non_prompt_powerline = ConfigurableIpythonPowerline(False, old_widths, **kwargs)
prompt_powerline = ConfigurableIPythonPowerline(True, old_widths, **kwargs)
non_prompt_powerline = ConfigurableIPythonPowerline(False, old_widths, **kwargs)
def late_startup_hook():
last_in = {'nrspaces': 0}

View File

@ -22,9 +22,9 @@ class RewriteResult(object):
return RewriteResult(self.prompt + s)
class IpythonPowerline(Powerline):
class IPythonPowerline(Powerline):
def init(self, is_prompt, old_widths):
super(IpythonPowerline, self).init(
super(IPythonPowerline, self).init(
'ipython',
renderer_module=('.prompt' if is_prompt else None),
use_daemon_threads=True
@ -32,26 +32,26 @@ class IpythonPowerline(Powerline):
self.old_widths = old_widths
def create_renderer(self, *args, **kwargs):
super(IpythonPowerline, self).create_renderer(*args, **kwargs)
super(IPythonPowerline, self).create_renderer(*args, **kwargs)
self.renderer.old_widths = self.old_widths
def get_config_paths(self):
if self.paths:
return self.paths
else:
return super(IpythonPowerline, self).get_config_paths()
return super(IPythonPowerline, self).get_config_paths()
def get_local_themes(self, local_themes):
return dict(((type, {'config': self.load_theme_config(name)}) for type, name in local_themes.items()))
def load_main_config(self):
r = super(IpythonPowerline, self).load_main_config()
r = super(IPythonPowerline, self).load_main_config()
if self.config_overrides:
mergedicts(r, self.config_overrides)
return r
def load_theme_config(self, name):
r = super(IpythonPowerline, self).load_theme_config(name)
r = super(IPythonPowerline, self).load_theme_config(name)
if name in self.theme_overrides:
mergedicts(r, self.theme_overrides[name])
return r

View File

@ -4,7 +4,7 @@ from powerline.renderers.shell import ShellRenderer
from powerline.theme import Theme
class IpythonRenderer(ShellRenderer):
class IPythonRenderer(ShellRenderer):
'''Powerline ipython segment renderer.'''
def get_segment_info(self, segment_info, mode):
r = self.segment_info.copy()
@ -33,8 +33,8 @@ class IpythonRenderer(ShellRenderer):
match['theme'].shutdown()
def render(self, *args, **kwargs):
# XXX super(ShellRenderer), *not* super(IpythonRenderer)
# XXX super(ShellRenderer), *not* super(IPythonRenderer)
return super(ShellRenderer, self).render(*args, **kwargs)
renderer = IpythonRenderer
renderer = IPythonRenderer

View File

@ -1,12 +1,12 @@
# vim:fileencoding=utf-8:noet
from powerline.renderers.ipython import IpythonRenderer
from powerline.renderers.ipython import IPythonRenderer
class IpythonPromptRenderer(IpythonRenderer):
class IPythonPromptRenderer(IPythonRenderer):
'''Powerline ipython prompt renderer'''
escape_hl_start = '\x01'
escape_hl_end = '\x02'
renderer = IpythonPromptRenderer
renderer = IPythonPromptRenderer

View File

@ -109,9 +109,9 @@ class TestConfig(TestCase):
powerline.render(segment_info={'args': args})
def test_ipython(self):
from powerline.ipython import IpythonPowerline
from powerline.ipython import IPythonPowerline
class IpyPowerline(IpythonPowerline):
class IpyPowerline(IPythonPowerline):
paths = None
config_overrides = None
theme_overrides = {}