Package bitten :: Package util :: Module loc

Module loc

Support for counting the lines of code in Python programs.
Functions
 
count(source)
Parse the given file-like object as Python source code.
Variables
  BLANK = 0
  CODE = 1
  COMMENT = 2
  DOC = 3
Function Details

count(source)

 

Parse the given file-like object as Python source code.

For every line in the code, this function yields a (lineno, type, line) tuple, where lineno is the line number (starting at 0), type is one of BLANK, CODE, COMMENT or DOC, and line is the actual content of the line.

Parameters:
  • source - a file-like object containing Python code