forked from VimPlug/jedi
fixed TODO the docstring clean isn't good, because of string prefixes
This commit is contained in:
+12
-4
@@ -89,11 +89,19 @@ class Scope(object):
|
|||||||
self.statements.append(stmt)
|
self.statements.append(stmt)
|
||||||
return stmt
|
return stmt
|
||||||
|
|
||||||
def add_docstr(self, str):
|
def add_docstr(self, string):
|
||||||
""" Clean up a docstring """
|
""" Clean up a docstring """
|
||||||
# TODO the docstring clean isn't good, because things like
|
|
||||||
# r""" test """ are not being handled
|
# scan for string prefixes like r, u, etc.
|
||||||
d = str.replace('\n', ' ')
|
index1 = string.find("'")
|
||||||
|
index2 = string.find('"')
|
||||||
|
index = index1 if index1 < index2 and index1 > -1 else index2
|
||||||
|
prefix = string[:index]
|
||||||
|
d = string[index:]
|
||||||
|
print 'docstr', d, prefix
|
||||||
|
|
||||||
|
# now clean docstr
|
||||||
|
d = d.replace('\n', ' ')
|
||||||
d = d.replace('\t', ' ')
|
d = d.replace('\t', ' ')
|
||||||
while d.find(' ') > -1:
|
while d.find(' ') > -1:
|
||||||
d = d.replace(' ', ' ')
|
d = d.replace(' ', ' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user