Fix style errors

This commit is contained in:
Foo 2015-05-17 20:42:21 +03:00
parent 34026ee3ea
commit c02516a443
2 changed files with 13 additions and 16 deletions

View File

@ -9,7 +9,6 @@ from threading import Lock, Timer
from argparse import ArgumentParser from argparse import ArgumentParser
from powerline import Powerline from powerline import Powerline
from powerline.lib.monotonic import monotonic
from powerline.lib.encoding import get_unicode_writer from powerline.lib.encoding import get_unicode_writer
@ -29,12 +28,12 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
powerline = BarPowerline() powerline = BarPowerline()
lock = Lock() lock = Lock()
modes = ["default"] modes = ['default']
write = get_unicode_writer(encoding='utf-8') write = get_unicode_writer(encoding='utf-8')
def render(reschedule=False): def render(reschedule=False):
if reschedule: if reschedule:
Timer(0.5, render, kwargs={"reschedule": True}).start() Timer(0.5, render, kwargs={'reschedule': True}).start()
global lock global lock
with lock: with lock:

View File

@ -1,10 +1,7 @@
# vim:fileencoding=utf-8:noet # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function) from __future__ import (unicode_literals, division, absolute_import, print_function)
from threading import Thread
from powerline.theme import requires_segment_info from powerline.theme import requires_segment_info
from powerline.segments import Segment, with_docstring
conn = None conn = None
@ -30,27 +27,28 @@ def workspaces(pl, only_show=None, strip=0):
'''Return list of used workspaces '''Return list of used workspaces
:param list only_show: :param list only_show:
Specifies which workspaces to show. Specifies which workspaces to show. Valid entries are ``"visible"``,
Valid entries are "visible", "urgent" and "focused". ``"urgent"`` and ``"focused"``. If omitted or ``null`` all workspaces
If omitted or ``null`` all workspaces are shown. are shown.
:param int strip: :param int strip:
Specifies how many characters from the front of each workspace name should Specifies how many characters from the front of each workspace name
be stripped (e.g. to remove workspace numbers). Defaults to zero. should be stripped (e.g. to remove workspace numbers). Defaults to zero.
Highlight groups used: ``workspace``, ``w_visible``, ``w_focused``, ``w_urgent`` Highlight groups used: ``workspace`` or ``w_visible``, ``workspace`` or ``w_focused``, ``workspace`` or ``w_urgent``.
''' '''
global conn global conn
if not conn: conn = i3ipc.Connection() if not conn:
conn = i3ipc.Connection()
return [{ return [{
'contents': w['name'][min(len(w['name']),strip):], 'contents': w['name'][min(len(w['name']), strip):],
'highlight_groups': calcgrp(w) 'highlight_groups': calcgrp(w)
} for w in conn.get_workspaces() if not only_show or any(w[typ] for typ in only_show)] } for w in conn.get_workspaces() if not only_show or any((w[typ] for typ in only_show))]
@requires_segment_info @requires_segment_info
def mode(pl, segment_info, names={"default": None}): def mode(pl, segment_info, names={'default': None}):
'''Returns current i3 mode '''Returns current i3 mode
:param dict names: :param dict names: