Coding style.
Linting.
This commit is contained in:
parent
cbba46d5c0
commit
a3c0a69076
4 changed files with 11 additions and 10 deletions
|
|
@ -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):
|
||||
|
|
|
|||
9
tools.py
9
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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
3
vigil
3
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 |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue