1
0
forked from VimPlug/jedi

more variables private in the same file

This commit is contained in:
David Halter
2013-05-03 20:45:50 +04:30
parent 150b7fc1d5
commit 5d472e99ac
2 changed files with 12 additions and 13 deletions

View File

@@ -532,7 +532,6 @@ class RelatedName(BaseDefinition):
"""TODO: document this""" """TODO: document this"""
def __init__(self, name_part, scope): def __init__(self, name_part, scope):
super(RelatedName, self).__init__(scope, name_part.start_pos) super(RelatedName, self).__init__(scope, name_part.start_pos)
self.name_part = name_part
self.text = unicode(name_part) self.text = unicode(name_part)
self.end_pos = name_part.end_pos self.end_pos = name_part.end_pos
@@ -555,19 +554,19 @@ class CallDef(object):
return the `isinstance` function. without `(` it would return nothing. return the `isinstance` function. without `(` it would return nothing.
""" """
def __init__(self, executable, index, call): def __init__(self, executable, index, call):
self.executable = executable self._executable = executable
self.index = index self.index = index
self.call = call self._call = call
@property @property
def params(self): def params(self):
if self.executable.isinstance(er.Function): if self._executable.isinstance(er.Function):
if isinstance(self.executable, er.InstanceElement): if isinstance(self._executable, er.InstanceElement):
return self.executable.params[1:] return self._executable.params[1:]
return self.executable.params return self._executable.params
else: else:
try: try:
sub = self.executable.get_subscope_by_name('__init__') sub = self._executable.get_subscope_by_name('__init__')
return sub.params[1:] # ignore self return sub.params[1:] # ignore self
except KeyError: except KeyError:
return [] return []
@@ -576,7 +575,7 @@ class CallDef(object):
def bracket_start(self): def bracket_start(self):
""" The indent of the bracket that is responsible for the last function """ The indent of the bracket that is responsible for the last function
call. """ call. """
c = self.call c = self._call
while c.next is not None: while c.next is not None:
c = c.next c = c.next
return c.name.end_pos return c.name.end_pos
@@ -584,12 +583,12 @@ class CallDef(object):
@property @property
def call_name(self): def call_name(self):
""" The name (e.g. 'isinstance') as a string. """ """ The name (e.g. 'isinstance') as a string. """
return unicode(self.executable.name) return unicode(self._executable.name)
@property @property
def module(self): def module(self):
return self.executable.get_parent_until() return self._executable.get_parent_until()
def __repr__(self): def __repr__(self):
return '<%s: %s index %s>' % (type(self).__name__, self.executable, return '<%s: %s index %s>' % (type(self).__name__, self._executable,
self.index) self.index)

View File

@@ -92,7 +92,7 @@ def _rename(names, replace_str):
nr, indent = name.start_pos nr, indent = name.start_pos
line = new_lines[nr - 1] line = new_lines[nr - 1]
new_lines[nr - 1] = line[:indent] + replace_str + \ new_lines[nr - 1] = line[:indent] + replace_str + \
line[indent + len(name.name_part):] line[indent + len(name.text):]
process(current_path, old_lines, new_lines) process(current_path, old_lines, new_lines)
return dct return dct