Fix various minor formatting issues

Closes #242.
This commit is contained in:
Kim Silkebækken 2013-02-20 13:47:54 +01:00
parent ee51b8b76c
commit 282cb43eef
9 changed files with 65 additions and 61 deletions

View File

@ -5,8 +5,8 @@ ATTR_BOLD = 1
ATTR_ITALIC = 2 ATTR_ITALIC = 2
ATTR_UNDERLINE = 4 ATTR_UNDERLINE = 4
class Colorscheme(object):
class Colorscheme(object):
def __init__(self, colorscheme): def __init__(self, colorscheme):
'''Initialize a colorscheme.''' '''Initialize a colorscheme.'''
self.colors = {} self.colors = {}

View File

@ -3,6 +3,10 @@ import os
from powerline.lib.memoize import memoize from powerline.lib.memoize import memoize
vcs_props = (('git', '.git', os.path.exists),
('mercurial', '.hg', os.path.isdir))
def generate_directories(path): def generate_directories(path):
yield path yield path
while True: while True:
@ -13,9 +17,6 @@ def generate_directories(path):
yield path yield path
vcs_props = (('git', '.git', os.path.exists),
('mercurial', '.hg', os.path.isdir))
@memoize(100) @memoize(100)
def guess(path): def guess(path):
for directory in generate_directories(path): for directory in generate_directories(path):

View File

@ -42,7 +42,7 @@ class Renderer(object):
theme.segment_info.update(segment_info) theme.segment_info.update(segment_info)
# Handle excluded/included segments for the current mode # Handle excluded/included segments for the current mode
segments = [segment for segment in segments\ segments = [segment for segment in segments
if mode not in segment['exclude_modes'] or (segment['include_modes'] and segment in segment['include_modes'])] if mode not in segment['exclude_modes'] or (segment['include_modes'] and segment in segment['include_modes'])]
segments = [segment for segment in self._render_segments(mode, theme, segments)] segments = [segment for segment in self._render_segments(mode, theme, segments)]

View File

@ -6,7 +6,7 @@ import os
try: try:
import vim import vim
except ImportError: except ImportError:
vim = {} vim = {} # NOQA
from powerline.bindings.vim import vim_get_func, getbufvar from powerline.bindings.vim import vim_get_func, getbufvar
from powerline.theme import requires_segment_info from powerline.theme import requires_segment_info
@ -51,13 +51,14 @@ mode_translations = {
eventcaches = defaultdict(lambda: []) eventcaches = defaultdict(lambda: [])
bufeventcaches = defaultdict(lambda: []) bufeventcaches = defaultdict(lambda: [])
def purgeonevents_reg(events, eventcaches=bufeventcaches): def purgeonevents_reg(events, eventcaches=bufeventcaches):
def cache_reg_func(cache): def cache_reg_func(cache):
for event in events: for event in events:
if event not in eventcaches: if event not in eventcaches:
vim.eval('PowerlineRegisterCachePurgerEvent("' + event + '")') vim.eval('PowerlineRegisterCachePurgerEvent("' + event + '")')
eventcaches[event].append(cache) eventcaches[event].append(cache)
return cache_reg_func return cache_reg_func
purgeall_on_shell = purgeonevents_reg(('ShellCmdPost', 'ShellFilterPost', 'FocusGained'), eventcaches=eventcaches) purgeall_on_shell = purgeonevents_reg(('ShellCmdPost', 'ShellFilterPost', 'FocusGained'), eventcaches=eventcaches)

View File

@ -5,8 +5,9 @@ from copy import copy
from .segment import Segment from .segment import Segment
try: try:
unicode() unicode() # NOQA
except NameError: except NameError:
unicode = str unicode = str

View File

@ -11,7 +11,8 @@ try:
except IOError: except IOError:
README = '' README = ''
setup(name='Powerline', setup(
name='Powerline',
version='beta', version='beta',
description='The ultimate statusline/prompt utility.', description='The ultimate statusline/prompt utility.',
long_description=README, long_description=README,