class line_counts

A collection of line count statistics.

line_counts Details

class cs.line_counts

A collection of line count statistics.

__init__(_blank, _comment, _code, _mixed)

Constructor.

Parameters:
  • _blank (int) – The number of blank lines.
  • _comment (int) – The number of lines that contain comments only.
  • _code (int) – The number of lines that contain code only.
  • _mixed (int) – The number of mized lines: lines that contain a combination of code and comments.
Raises:

OverflowError

>>> line_counts(2, 0, 2, 0)
<cs.line_counts blank: 2, comment: 0, code: 2, mixed: 0>
__repr__()

Get a representation of a line_counts object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> v0 = line_counts(2, 0, 2, 0)
>>> repr(v0)
'<cs.line_counts blank: 2, comment: 0, code: 2, mixed: 0>'
__str__()

Get a simple string representation of a line_counts object.

Return type:str
Returns:The string representation.
>>> v0 = line_counts(2, 0, 2, 0)
>>> str(v0)
'blank: 2, comment: 0, code: 2, mixed: 0'
get_blank()

Get the number of blank lines.

Return type:int
Returns:The number of lines that are blank.
>>> v0 = line_counts(2, 0, 2, 0)
>>> v0.get_blank()
2
get_code()

Get the number of code-only lines from a line_counts object.

Return type:int
Returns:The number of lines that contain code only.
>>> v0 = line_counts(2, 0, 2, 0)
>>> v0.get_code()
2
get_comment()

Get the number of comment-only lines from a line_counts object.

Return type:int
Returns:The number of lines that contain comments only.
>>> v0 = line_counts(2, 0, 2, 0)
>>> v0.get_comment()
0
get_mixed()

Get the number of mixed lines from a line_counts object.

Return type:int
Returns:The number of lines that contain a combination of code and comments.
>>> v0 = line_counts(2, 0, 2, 0)
>>> v0.get_mixed()
0