Skip to content

Commit 01bda16

Browse files
PEP8
1 parent 2418acf commit 01bda16

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

bpython/inspection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
_name = LazyReCompile(r'[a-zA-Z_]\w*$')
4343

44-
ArgSpec = namedtuple('ArgSpec', ['args', 'varargs', 'varkwargs', 'defaults',
44+
ArgSpec = namedtuple('ArgSpec', ['args', 'varargs', 'varkwargs', 'defaults',
4545
'kwonly', 'kwonly_defaults', 'annotations'])
4646

4747
FuncProps = namedtuple('FuncProps', ['func', 'argspec', 'is_bound_method'])
@@ -229,11 +229,11 @@ def getfuncprops(func, f):
229229
func_name = None
230230

231231
try:
232-
is_bound_method = ((inspect.ismethod(f) and f.__self__ is not None)
233-
or (func_name == '__init__' and not
234-
func.endswith('.__init__'))
235-
or (func_name == '__new__' and not
236-
func.endswith('.__new__')))
232+
is_bound_method = ((inspect.ismethod(f) and f.__self__ is not None) or
233+
(func_name == '__init__' and not
234+
func.endswith('.__init__')) or
235+
(func_name == '__new__' and not
236+
func.endswith('.__new__')))
237237
except:
238238
# if f is a method from a xmlrpclib.Server instance, func_name ==
239239
# '__init__' throws xmlrpclib.Fault (see #202)

bpython/line.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ def current_object(cursor_offset, line):
9292
s += m.group(1)
9393
if not s:
9494
return None
95-
return LinePart(start, start+len(s), s)
95+
return LinePart(start, start + len(s), s)
9696

9797

9898
current_object_attribute_re = LazyReCompile(r'([\w_][\w0-9_]*)[.]?')
9999

100100

101101
def current_object_attribute(cursor_offset, line):
102102
"""If in attribute completion, the attribute being completed"""
103-
#TODO replace with more general current_expression_attribute
103+
# TODO replace with more general current_expression_attribute
104104
match = current_word(cursor_offset, line)
105105
if match is None:
106106
return None
@@ -216,12 +216,13 @@ def current_dotted_attribute(cursor_offset, line):
216216
return LinePart(start, end, word)
217217

218218

219-
current_expression_attribute_re = LazyReCompile(r'[.]\s*((?:[\w_][\w0-9_]*)|(?:))')
219+
current_expression_attribute_re = LazyReCompile(
220+
r'[.]\s*((?:[\w_][\w0-9_]*)|(?:))')
220221

221222

222223
def current_expression_attribute(cursor_offset, line):
223224
"""If after a dot, the attribute being completed"""
224-
#TODO replace with more general current_expression_attribute
225+
# TODO replace with more general current_expression_attribute
225226
matches = current_expression_attribute_re.finditer(line)
226227
for m in matches:
227228
if (m.start(1) <= cursor_offset and m.end(1) >= cursor_offset):

bpython/paste.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def paste(self, s):
103103
raise PasteFailed(_('No output from helper program.'))
104104
else:
105105
parsed_url = urlparse(paste_url)
106-
if (not parsed_url.scheme
107-
or any(unicodedata.category(c) == 'Cc'
108-
for c in paste_url)):
106+
if (not parsed_url.scheme or
107+
any(unicodedata.category(c) == 'Cc'
108+
for c in paste_url)):
109109
raise PasteFailed(_('Failed to recognize the helper '
110110
'program\'s output as an URL.'))
111111

bpython/repl.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,16 @@ def get_args(self):
539539
class_f = None
540540

541541
if (hasattr(f, '__init__') and
542-
f.__init__ is not object.__init__):
543-
class_f = f.__init__
542+
f.__init__ is not object.__init__):
543+
class_f = f.__init__
544544
if ((not class_f or
545-
not inspection.getfuncprops(func, class_f)) and
546-
hasattr(f, '__new__') and
547-
f.__new__ is not object.__new__ and
548-
f.__new__.__class__ is not object.__new__.__class__): # py3
549-
class_f = f.__new__
545+
not inspection.getfuncprops(func, class_f)) and
546+
hasattr(f, '__new__') and
547+
f.__new__ is not object.__new__ and
548+
# py3
549+
f.__new__.__class__ is not object.__new__.__class__):
550+
551+
class_f = f.__new__
550552

551553
if class_f:
552554
f = class_f
@@ -683,7 +685,8 @@ def next_indentation(self):
683685
indentation = next_indentation(self.buffer[-1],
684686
self.config.tab_length)
685687
if indentation and self.config.dedent_after > 0:
686-
line_is_empty = lambda line: not line.strip()
688+
def line_is_empty(line):
689+
return not line.strip()
687690
empty_lines = takewhile(line_is_empty, reversed(self.buffer))
688691
if sum(1 for _ in empty_lines) >= self.config.dedent_after:
689692
indentation -= 1

0 commit comments

Comments
 (0)