Fix flake8 failures
This commit is contained in:
parent
1f521da134
commit
f195b7e4d2
@ -134,7 +134,7 @@ class WebEngineElement(webelem.AbstractWebElement):
|
|||||||
self._js_call('set_value', value)
|
self._js_call('set_value', value)
|
||||||
|
|
||||||
def caret_position(self):
|
def caret_position(self):
|
||||||
"""Get the text caret position for the current element"""
|
"""Get the text caret position for the current element."""
|
||||||
return self._js_dict.get('caret_position', 0)
|
return self._js_dict.get('caret_position', 0)
|
||||||
|
|
||||||
def insert_text(self, text):
|
def insert_text(self, text):
|
||||||
|
@ -127,7 +127,7 @@ class WebKitElement(webelem.AbstractWebElement):
|
|||||||
self._elem.evaluateJavaScript("this.value='{}'".format(value))
|
self._elem.evaluateJavaScript("this.value='{}'".format(value))
|
||||||
|
|
||||||
def caret_position(self):
|
def caret_position(self):
|
||||||
"""Get the text caret position for the current element"""
|
"""Get the text caret position for the current element."""
|
||||||
self._check_vanished()
|
self._check_vanished()
|
||||||
pos = self._elem.evaluateJavaScript('this.selectionStart')
|
pos = self._elem.evaluateJavaScript('this.selectionStart')
|
||||||
assert isinstance(pos, (int, float, type(None)))
|
assert isinstance(pos, (int, float, type(None)))
|
||||||
|
@ -150,7 +150,7 @@ class ExternalEditor(QObject):
|
|||||||
self._proc.start(executable, args)
|
self._proc.start(executable, args)
|
||||||
|
|
||||||
def _calc_line_and_column(self, text, caret_position):
|
def _calc_line_and_column(self, text, caret_position):
|
||||||
"""Calculate line and column numbers given a text and caret position
|
r"""Calculate line and column numbers given a text and caret position.
|
||||||
|
|
||||||
Both line and column are 1-based indexes, because that's what most
|
Both line and column are 1-based indexes, because that's what most
|
||||||
editors use as line and column starting index. By "most" we mean at
|
editors use as line and column starting index. By "most" we mean at
|
||||||
|
@ -190,5 +190,5 @@ def test_modify(qtbot, editor, initial_text, edited_text):
|
|||||||
('a\nbb\nccc', 8, (3, 4)),
|
('a\nbb\nccc', 8, (3, 4)),
|
||||||
])
|
])
|
||||||
def test_calculation(editor, text, caret_position, result):
|
def test_calculation(editor, text, caret_position, result):
|
||||||
"""Test calculation for line and column given text and caret_position"""
|
"""Test calculation for line and column given text and caret_position."""
|
||||||
assert editor._calc_line_and_column(text, caret_position) == result
|
assert editor._calc_line_and_column(text, caret_position) == result
|
||||||
|
Loading…
Reference in New Issue
Block a user