mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
cleaning
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
import types
|
||||
if sys.hexversion >= 0x03000000:
|
||||
import io
|
||||
else:
|
||||
import types
|
||||
import inspect
|
||||
|
||||
import debug
|
||||
@@ -31,7 +32,7 @@ class CachedModule(object):
|
||||
if not self.path or timestamp == os.path.getmtime(self.path):
|
||||
self._parser = parser
|
||||
else:
|
||||
raise KeyError
|
||||
raise KeyError()
|
||||
except KeyError:
|
||||
self._load_module()
|
||||
return self._parser
|
||||
@@ -243,7 +244,8 @@ class Parser(CachedModule):
|
||||
# class members (functions) properties?
|
||||
for name, func in members.items():
|
||||
# recursion problem in properties TODO remove
|
||||
if name in ['fget', 'fset', 'fdel']: continue
|
||||
if name in ['fget', 'fset', 'fdel']:
|
||||
continue
|
||||
ret = 'pass'
|
||||
code += '@property\ndef %s(self):\n' % (name)
|
||||
code += parsing.indent_block(get_doc(func) + '%s\n\n' % ret)
|
||||
|
||||
@@ -896,7 +896,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
||||
except DecoratorNotFound:
|
||||
continue
|
||||
res_new.append(r)
|
||||
debug.dbg(a+'sfn remove, new: %s, old: %s' % (res_new, result))
|
||||
debug.dbg('sfn remove, new: %s, old: %s' % (res_new, result))
|
||||
return res_new
|
||||
|
||||
def filter_name(scope_generator):
|
||||
@@ -961,7 +961,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
||||
# if there are results, ignore the other scopes
|
||||
if result:
|
||||
break
|
||||
debug.dbg(a+'sfn filter "%s" in %s: %s' % (name_str, scope, result))
|
||||
debug.dbg('sfn filter "%s" in %s: %s' % (name_str, scope, result))
|
||||
return result
|
||||
|
||||
def descriptor_check(result):
|
||||
@@ -979,7 +979,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
||||
res_new.append(r)
|
||||
return res_new
|
||||
|
||||
import random; a = str(random.randint(0,99))
|
||||
if search_global:
|
||||
scope_generator = get_names_for_scope(scope, position=position)
|
||||
else:
|
||||
@@ -1200,5 +1199,3 @@ def follow_path(path, scope, position=None):
|
||||
result = imports.strip_imports(get_scopes_for_name(scope, current,
|
||||
position=position))
|
||||
return follow_paths(path, result, position=position)
|
||||
|
||||
|
||||
|
||||
@@ -985,7 +985,6 @@ class PyFuzzyParser(object):
|
||||
else:
|
||||
self.user_stmt = simple
|
||||
|
||||
|
||||
def _parsedotname(self, pre_used_token=None):
|
||||
"""
|
||||
The dot name parser parses a name, variable or function and returns
|
||||
@@ -1484,8 +1483,8 @@ class PyFuzzyParser(object):
|
||||
# (This is a rather unlikely error message, for normal code,
|
||||
# tokenize seems to be pretty tolerant)
|
||||
self._line_of_tokenize_restart = self.start_pos[0] + 1
|
||||
self._tokenize_start_pos = (0,0)
|
||||
self._tokenize_end_pos = (0,0)
|
||||
self._tokenize_start_pos = (0, 0)
|
||||
self._tokenize_end_pos = (0, 0)
|
||||
debug.warning('indentation error on line %s, ignoring it' %
|
||||
(self.start_pos[0]))
|
||||
self.gen = tokenize.generate_tokens(buf.readline)
|
||||
|
||||
@@ -27,6 +27,9 @@ def run_completion_test(correct, source, line_nr, line, path):
|
||||
# difference for testing)
|
||||
try:
|
||||
completions = functions.complete(source, line_nr, len(line), path)
|
||||
#import cProfile as profile
|
||||
#profile.run('functions.complete("""%s""", %i, %i, "%s")'
|
||||
# % (source, line_nr, len(line), path))
|
||||
except Exception:
|
||||
print('test @%s: %s' % (line_nr - 1, line))
|
||||
print(traceback.format_exc())
|
||||
|
||||
Reference in New Issue
Block a user