Home | History | Annotate | Download | only in python2.7

Lines Matching refs:lines

375         lines = string.split(string.expandtabs(doc), '\n')
379 # Find minimum indentation of any non-blank lines after first line.
381 for line in lines[1:]:
387 if lines:
388 lines[0] = lines[0].lstrip()
390 for i in range(1, len(lines)): lines[i] = lines[i][margin:]
391 # Remove any trailing or leading blank lines.
392 while lines and not lines[-1]:
393 lines.pop()
394 while lines and not lines[0]:
395 lines.pop(0)
396 return string.join(lines, '\n')
522 or code object. The source code is returned as a list of all the lines
534 lines = linecache.getlines(file, module.__dict__)
536 lines = linecache.getlines(file)
537 if not lines:
541 return lines, 0
550 for i in range(len(lines)):
551 match = pat.match(lines[i])
554 if lines[i][0] == 'c':
555 return lines, i
562 return lines, candidates[0][1]
580 if pat.match(lines[lnum]): break
582 return lines, lnum
586 """Get lines of comments immediately preceding an object's source code.
591 lines, lnum = findsource(object)
598 if lines and lines[0][:2] == '#!': start = 1
599 while start < len(lines) and string.strip(lines[start]) in ('', '#'):
601 if start < len(lines) and lines[start][:1] == '#':
604 while end < len(lines) and lines[end][:1] == '#':
605 comments.append(string.expandtabs(lines[end]))
611 indent = indentsize(lines[lnum])
613 if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \
614 indentsize(lines[end]) == indent:
615 comments = [string.lstrip(string.expandtabs(lines[end]))]
618 comment = string.lstrip(string.expandtabs(lines[end]))
619 while comment[:1] == '#' and indentsize(lines[end]) == indent:
623 comment = string.lstrip(string.expandtabs(lines[end]))
673 def getblock(lines):
674 """Extract the block of code at the top of the given list of lines."""
677 tokenize.tokenize(iter(lines).next, blockfinder.tokeneater)
680 return lines[:blockfinder.last]
683 """Return a list of source lines and starting line number for an object.
686 or code object. The source code is returned as a list of the lines
690 lines, lnum = findsource(object)
692 if ismodule(object): return lines, 0
693 else: return getblock(lines[lnum:]), lnum + 1
701 lines, lnum = getsourcelines(object)
702 return string.join(lines, '')
991 the current line, the function name, a list of lines of context from
993 The optional second argument specifies the number of lines of context
1007 lines, lnum = findsource(frame)
1009 lines = index = None
1012 start = max(0, min(start, len(lines) - context))
1013 lines = lines[start:start+context]
1016 lines = index = None
1018 return Traceback(filename, lineno, frame.f_code.co_name, lines, index)
1029 name, a list of lines of context, and index within the context."""
1040 name, a list of lines of context, and index within the context."""