Skip to content

Commit

Permalink
Fixes for latest Pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
avylove committed Feb 4, 2023
1 parent faf10af commit d933a37
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 63 deletions.
70 changes: 35 additions & 35 deletions blessed/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,40 +86,40 @@ class Terminal(object):
# Too many instance attributes (12/7)

#: Sugary names for commonly-used capabilities
_sugar = dict(
save='sc',
restore='rc',
clear_eol='el',
clear_bol='el1',
clear_eos='ed',
enter_fullscreen='smcup',
exit_fullscreen='rmcup',
move='cup',
move_yx='cup',
move_x='hpa',
move_y='vpa',
hide_cursor='civis',
normal_cursor='cnorm',
reset_colors='op',
normal='sgr0',
reverse='rev',
italic='sitm',
no_italic='ritm',
shadow='sshm',
no_shadow='rshm',
standout='smso',
no_standout='rmso',
subscript='ssubm',
no_subscript='rsubm',
superscript='ssupm',
no_superscript='rsupm',
underline='smul',
no_underline='rmul',
cursor_report='u6',
cursor_request='u7',
terminal_answerback='u8',
terminal_enquire='u9',
)
_sugar = {
'save': 'sc',
'restore': 'rc',
'clear_eol': 'el',
'clear_bol': 'el1',
'clear_eos': 'ed',
'enter_fullscreen': 'smcup',
'exit_fullscreen': 'rmcup',
'move': 'cup',
'move_yx': 'cup',
'move_x': 'hpa',
'move_y': 'vpa',
'hide_cursor': 'civis',
'normal_cursor': 'cnorm',
'reset_colors': 'op',
'normal': 'sgr0',
'reverse': 'rev',
'italic': 'sitm',
'no_italic': 'ritm',
'shadow': 'sshm',
'no_shadow': 'rshm',
'standout': 'smso',
'no_standout': 'rmso',
'subscript': 'ssubm',
'no_subscript': 'rsubm',
'superscript': 'ssupm',
'no_superscript': 'rsupm',
'underline': 'smul',
'no_underline': 'rmul',
'cursor_report': 'u6',
'cursor_request': 'u7',
'terminal_answerback': 'u8',
'terminal_enquire': 'u9',
}

def __init__(self, kind=None, stream=None, force_styling=False):
"""
Expand Down Expand Up @@ -534,7 +534,7 @@ def _query_response(self, query_str, response_re, timeout):

# Exclude response from subsequent input
if match:
data = (data[:match.start()] + data[match.end():])
data = data[:match.start()] + data[match.end():]

# re-buffer keyboard data, if any
self.ungetch(data)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def tigetstr(attr):
return ('seq-%s' % (attr,)).encode('latin1')
monkeypatch.setattr(curses, 'tigetstr', tigetstr)
term = mock.Mock()
term._sugar = dict(mnemonic='xyz')
term._sugar = {'mnemonic': 'xyz'}

# exercise
assert resolve_capability(term, 'mnemonic') == u'seq-xyz'
Expand Down
36 changes: 9 additions & 27 deletions tests/test_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,19 @@
from .conftest import TEST_QUICK

TEXTWRAP_KEYWORD_COMBINATIONS = [
dict(break_long_words=False,
drop_whitespace=False,
subsequent_indent=''),
dict(break_long_words=False,
drop_whitespace=True,
subsequent_indent=''),
dict(break_long_words=False,
drop_whitespace=False,
subsequent_indent=' '),
dict(break_long_words=False,
drop_whitespace=True,
subsequent_indent=' '),
dict(break_long_words=True,
drop_whitespace=False,
subsequent_indent=''),
dict(break_long_words=True,
drop_whitespace=True,
subsequent_indent=''),
dict(break_long_words=True,
drop_whitespace=False,
subsequent_indent=' '),
dict(break_long_words=True,
drop_whitespace=True,
subsequent_indent=' '),
{'break_long_words': False, 'drop_whitespace': False, 'subsequent_indent': ''},
{'break_long_words': False, 'drop_whitespace': True, 'subsequent_indent': ''},
{'break_long_words': False, 'drop_whitespace': False, 'subsequent_indent': ' '},
{'break_long_words': False, 'drop_whitespace': True, 'subsequent_indent': ' '},
{'break_long_words': True, 'drop_whitespace': False, 'subsequent_indent': ''},
{'break_long_words': True, 'drop_whitespace': True, 'subsequent_indent': ''},
{'break_long_words': True, 'drop_whitespace': False, 'subsequent_indent': ' '},
{'break_long_words': True, 'drop_whitespace': True, 'subsequent_indent': ' '},
]
if TEST_QUICK:
# test only one feature: everything on
TEXTWRAP_KEYWORD_COMBINATIONS = [
dict(break_long_words=True,
drop_whitespace=True,
subsequent_indent=' ')
{'break_long_words': True, 'drop_whitespace': True, 'subsequent_indent': ' '}
]


Expand Down

0 comments on commit d933a37

Please sign in to comment.