Stats
This section contains the reference for the implementation of tokei's CodeStats
and Report
structs.
CodeStats ¶
A class representing stats about a single blob of code. tokei reference.
Examples¶
>>> from pytokei import CodeStats
>>> CodeStats()
CodeStats(blanks: 0, code: 0, comments: 0, lines: 0)
blobs
property
¶
Language blobs that were contained inside this blob, represented in the equivalent python objects. tokei reference
blobs_plain
property
¶
Equivalent method to blobs
but in builtin python objects.
plain ¶
Returns the content of the blob as a dict, blanks, code, comments and lines.
summarise ¶
Creates a new CodeStats
from an existing one with all of the child blobs merged.
Report ¶
A struct representing the statistics of a file.
It can be constructed easily:
Examples¶
But it isn't expected to be used like this, just get it from a parsed directory.
plain ¶
Representation of the object in builtin python objects, where the key corresponds
to the filename that generated it, and the value is the result of CodeStats.plain
method.