1
0
forked from VimPlug/jedi

don't need to generate 'pass' anymore if a class is empty in get_code

This commit is contained in:
Dave Halter
2014-03-04 17:27:26 +01:00
parent f54344fd9e
commit 8bd8ba1df8

View File

@@ -321,13 +321,6 @@ class Scope(Simple, IsScope, DocstringMixin):
return [n for n in self.get_set_vars() return [n for n in self.get_set_vars()
if isinstance(n, Import) or (len(n) == 1)] if isinstance(n, Import) or (len(n) == 1)]
def is_empty(self):
"""
:return: True if there are no subscopes, imports and statements.
:rtype: bool
"""
return not (self.imports or self.subscopes or self.statements or self.returns)
@Python3Method @Python3Method
def get_statement_for_position(self, pos, include_imports=False): def get_statement_for_position(self, pos, include_imports=False):
checks = self.statements + self.asserts checks = self.statements + self.asserts
@@ -484,10 +477,6 @@ class Class(Scope):
string += '(%s)' % sup string += '(%s)' % sup
string += ':\n' string += ':\n'
string += super(Class, self).get_code(True, indention) string += super(Class, self).get_code(True, indention)
if self.is_empty():
if self._doc_token is not None:
string += indention
string += "pass\n"
return string return string
@property @property
@@ -539,10 +528,6 @@ class Function(Scope):
params = ', '.join([stmt.get_code(False) for stmt in self.params]) params = ', '.join([stmt.get_code(False) for stmt in self.params])
string += "def %s(%s):\n" % (self.name, params) string += "def %s(%s):\n" % (self.name, params)
string += super(Function, self).get_code(True, indention) string += super(Function, self).get_code(True, indention)
if self.is_empty():
if self._doc_token is not None:
string += indention
string += 'pass\n'
return string return string
def get_set_vars(self): def get_set_vars(self):