Message242255
according to inspect.py line 675 - this is only a best effort.
is this intended?
inspect.py @ 672
if isclass(object):
name = object.__name__
pat = re.compile(r'^(\s*)class\s*' + name + r'\b')
# make some effort to find the best matching class definition:
# use the one with the least indentation, which is the one
# that's most probably not inside a function definition.
candidates = []
for i in range(len(lines)):
match = pat.match(lines[i])
if match:
# if it's at toplevel, it's already the best one
if lines[i][0] == 'c':
return lines, i
# else add whitespace to candidate list
candidates.append((match.group(1), i))
if candidates:
# this will sort by whitespace, and by line number,
# less whitespace first
candidates.sort()
return lines, candidates[0][1]
else:
raise OSError('could not find class definition') |
|
Date |
User |
Action |
Args |
2015-04-29 23:08:49 | siming85 | set | recipients:
+ siming85 |
2015-04-29 23:08:48 | siming85 | set | messageid: <1430348928.98.0.0978970784211.issue24078@psf.upfronthosting.co.za> |
2015-04-29 23:08:48 | siming85 | link | issue24078 messages |
2015-04-29 23:08:48 | siming85 | create | |
|