From a3c0a69076273d8db54ec5931f79b966a048228c Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 18 Feb 2016 22:34:46 +0000 Subject: [PATCH] Coding style. Linting. --- termstr.py | 4 ++-- tools.py | 9 +++++---- tools_test.py | 5 +++-- vigil | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/termstr.py b/termstr.py index 5ac70f4..6f83d19 100644 --- a/termstr.py +++ b/termstr.py @@ -215,8 +215,8 @@ class TermStr(collections.UserString): def transform_style(self, transform_func): new_style = tuple(_join_lists([transform_func(style)] * len(str_) - for style, str_, position - in self._partition_style())) + for style, str_, position + in self._partition_style())) return self.__class__(self.data, new_style) def bold(self): diff --git a/tools.py b/tools.py index 27cf767..1d4cea1 100644 --- a/tools.py +++ b/tools.py @@ -128,6 +128,7 @@ def _syntax_highlight(text, lexer, style): if hex_rgb.startswith("#"): hex_rgb = hex_rgb[1:] return tuple(eval("0x"+hex_rgb[index:index+2]) for index in [0, 2, 4]) + def _char_style_for_token_type(token_type, default_bg_color): token_style = style.style_for_token(token_type) fg_color = (None if token_style["color"] is None @@ -138,10 +139,10 @@ def _syntax_highlight(text, lexer, style): token_style["italic"], token_style["underline"]) default_bg_color = _parse_rgb(style.background_color) - text = fill3.join("", - [termstr.TermStr(text, _char_style_for_token_type(token_type, - default_bg_color)) - for token_type, text in pygments.lex(text, lexer)]) + text = fill3.join( + "", [termstr.TermStr(text, _char_style_for_token_type( + token_type, default_bg_color)) + for token_type, text in pygments.lex(text, lexer)]) return fill3.Text(text, pad_char=termstr.TermStr(" ").bg_color( default_bg_color)) diff --git a/tools_test.py b/tools_test.py index 7b12875..1d1d9f7 100755 --- a/tools_test.py +++ b/tools_test.py @@ -111,8 +111,9 @@ class ToolsTestCase(unittest.TestCase): [("hi3.cpython-34.pyc", tools.Status.normal)]) def test_perl_syntax(self): - self._test_tool(tools.perl_syntax, [("perl.pl", tools.Status.ok), - ("perl6.pl", tools.Status.problem)]) + self._test_tool(tools.perl_syntax, + [("perl.pl", tools.Status.ok), + ("perl6.pl", tools.Status.problem)]) def test_perldoc(self): self._test_tool(tools.perldoc, diff --git a/vigil b/vigil index eede4b5..6f75ab1 100755 --- a/vigil +++ b/vigil @@ -54,7 +54,6 @@ Keys: import asyncio import collections import contextlib -import enum import functools import gzip import multiprocessing @@ -879,7 +878,7 @@ def _is_path_excluded(path): def _add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change, - exclude_filter): + exclude_filter): watch_manager = pyinotify.WatchManager() event_mask = (pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_ATTRIB |