MCPcopy Create free account
hub / github.com/ActiveState/code / doRegularFile

Function doRegularFile

recipes/Python/577546_linecountpy/recipe-577546.py:151–158  ·  view source on GitHub ↗
(file, cmtStr)

Source from the content-addressed store, hash-verified

149
150
151def doRegularFile(file, cmtStr):
152 count = 0
153 f = open(file, 'r')
154 for line in f:
155 line = line.strip()
156 if len(line) > 0 and not line.startswith(cmtStr):
157 count += 1
158 return count
159
160
161def doShFile(file):

Callers 2

doShFileFunction · 0.85
doMFileFunction · 0.85

Calls 3

startswithMethod · 0.80
openFunction · 0.50
stripMethod · 0.45

Tested by

no test coverage detected