Skip to content

Commit b748f91

Browse files
authored
lint: Enforce "line break before operator" (#365)
Converse of #361: Ignore W503 and enforce W504. This matches the style of Nvim core and is just better :)
1 parent 95e6995 commit b748f91

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

pynvim/api/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def __repr__(self):
3939

4040
def __eq__(self, other):
4141
"""Return True if `self` and `other` are the same object."""
42-
return (hasattr(other, 'code_data') and
43-
other.code_data == self.code_data)
42+
return (hasattr(other, 'code_data')
43+
and other.code_data == self.code_data)
4444

4545
def __hash__(self):
4646
"""Return hash based on remote object id."""

pynvim/api/nvim.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def request(self, name, *args, **kwargs):
166166
present and True, a asynchronous notification is sent instead. This
167167
will never block, and the return value or error is ignored.
168168
"""
169-
if (self._session._loop_thread is not None and
170-
threading.current_thread() != self._session._loop_thread):
169+
if (self._session._loop_thread is not None
170+
and threading.current_thread() != self._session._loop_thread):
171171

172172
msg = ("Request from non-main thread.\n"
173173
"Requests from different threads should be wrapped "
@@ -403,8 +403,8 @@ def err_write(self, msg, **kwargs):
403403
return self.request('nvim_err_write', msg, **kwargs)
404404

405405
def _thread_invalid(self):
406-
return (self._session._loop_thread is not None and
407-
threading.current_thread() != self._session._loop_thread)
406+
return (self._session._loop_thread is not None
407+
and threading.current_thread() != self._session._loop_thread)
408408

409409
def quit(self, quit_command='qa!'):
410410
"""Send a quit command to Nvim.

pynvim/msgpack_rpc/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ def _on_request(self, name, args, response):
193193
def handler():
194194
try:
195195
rv = self._request_cb(name, args)
196-
debug('greenlet %s finished executing, ' +
197-
'sending %s as response', gr, rv)
196+
debug('greenlet %s finished executing, '
197+
+ 'sending %s as response', gr, rv)
198198
response.send(rv)
199199
except ErrorResponse as err:
200200
warn("error response from request '%s %s': %s", name,

pynvim/plugin/host.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ def predicate(o):
202202
# register in the rpc handler dict
203203
if sync:
204204
if method in self._request_handlers:
205-
raise Exception(('Request handler for "{}" is ' +
206-
'already registered').format(method))
205+
raise Exception(('Request handler for "{}" is '
206+
+ 'already registered').format(method))
207207
self._request_handlers[method] = fn_wrapped
208208
else:
209209
if method in self._notification_handlers:
210-
raise Exception(('Notification handler for "{}" is ' +
211-
'already registered').format(method))
210+
raise Exception(('Notification handler for "{}" is '
211+
+ 'already registered').format(method))
212212
self._notification_handlers[method] = fn_wrapped
213213
if hasattr(fn, '_nvim_rpc_spec'):
214214
specs.append(fn._nvim_rpc_spec)

pynvim/plugin/script_host.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def python_do_range(self, start, stop, code):
143143
elif isinstance(result, basestring):
144144
newlines.append(result)
145145
else:
146-
exception = TypeError('pydo should return a string ' +
147-
'or None, found %s instead'
146+
exception = TypeError('pydo should return a string '
147+
+ 'or None, found %s instead'
148148
% result.__class__.__name__)
149149
break
150150
linenr += 1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
ignore = D211,E731,D401,W504
2+
ignore = D211,E731,D401,W503
33

44
[tool:pytest]
55
testpaths = test

0 commit comments

Comments
 (0)