| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,7 @@ | |||
| 41 | 41 | ||
| 42 | 42 | _name = LazyReCompile(r'[a-zA-Z_]\w*$') | |
| 43 | 43 | ||
| 44 | - ArgSpec = namedtuple('ArgSpec', ['args', 'varargs', 'varkwargs', 'defaults', | ||
| 44 | + ArgSpec = namedtuple('ArgSpec', ['args', 'varargs', 'varkwargs', 'defaults', | ||
| 45 | 45 | 'kwonly', 'kwonly_defaults', 'annotations']) | |
| 46 | 46 | ||
| 47 | 47 | FuncProps = namedtuple('FuncProps', ['func', 'argspec', 'is_bound_method']) | |
@@ -229,11 +229,11 @@ def getfuncprops(func, f): | |||
| 229 | 229 | func_name = None | |
| 230 | 230 | ||
| 231 | 231 | 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__'))) | ||
| 237 | 237 | except: | |
| 238 | 238 | # if f is a method from a xmlrpclib.Server instance, func_name == | |
| 239 | 239 | # '__init__' throws xmlrpclib.Fault (see #202) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,15 +92,15 @@ def current_object(cursor_offset, line): | |||
| 92 | 92 | s += m.group(1) | |
| 93 | 93 | if not s: | |
| 94 | 94 | return None | |
| 95 | - return LinePart(start, start+len(s), s) | ||
| 95 | + return LinePart(start, start + len(s), s) | ||
| 96 | 96 | ||
| 97 | 97 | ||
| 98 | 98 | current_object_attribute_re = LazyReCompile(r'([\w_][\w0-9_]*)[.]?') | |
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | 101 | def current_object_attribute(cursor_offset, line): | |
| 102 | 102 | """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 | ||
| 104 | 104 | match = current_word(cursor_offset, line) | |
| 105 | 105 | if match is None: | |
| 106 | 106 | return None | |
@@ -216,12 +216,13 @@ def current_dotted_attribute(cursor_offset, line): | |||
| 216 | 216 | return LinePart(start, end, word) | |
| 217 | 217 | ||
| 218 | 218 | ||
| 219 | - current_expression_attribute_re = LazyReCompile(r'[.]\s*((?:[\w_][\w0-9_]*)|(?:))') | ||
| 219 | + current_expression_attribute_re = LazyReCompile( | ||
| 220 | + r'[.]\s*((?:[\w_][\w0-9_]*)|(?:))') | ||
| 220 | 221 | ||
| 221 | 222 | ||
| 222 | 223 | def current_expression_attribute(cursor_offset, line): | |
| 223 | 224 | """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 | ||
| 225 | 226 | matches = current_expression_attribute_re.finditer(line) | |
| 226 | 227 | for m in matches: | |
| 227 | 228 | if (m.start(1) <= cursor_offset and m.end(1) >= cursor_offset): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,9 +103,9 @@ def paste(self, s): | |||
| 103 | 103 | raise PasteFailed(_('No output from helper program.')) | |
| 104 | 104 | else: | |
| 105 | 105 | 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)): | ||
| 109 | 109 | raise PasteFailed(_('Failed to recognize the helper ' | |
| 110 | 110 | 'program\'s output as an URL.')) | |
| 111 | 111 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -539,14 +539,16 @@ def get_args(self): | |||
| 539 | 539 | class_f = None | |
| 540 | 540 | ||
| 541 | 541 | 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__ | ||
| 544 | 544 | 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__ | ||
| 550 | 552 | ||
| 551 | 553 | if class_f: | |
| 552 | 554 | f = class_f | |
@@ -683,7 +685,8 @@ def next_indentation(self): | |||
| 683 | 685 | indentation = next_indentation(self.buffer[-1], | |
| 684 | 686 | self.config.tab_length) | |
| 685 | 687 | 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() | ||
| 687 | 690 | empty_lines = takewhile(line_is_empty, reversed(self.buffer)) | |
| 688 | 691 | if sum(1 for _ in empty_lines) >= self.config.dedent_after: | |
| 689 | 692 | indentation -= 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments