Return the number of leading spaces in line. Args: line: A string to check. Returns: An integer count of leading spaces, possibly zero.
(line)
| 2244 | |
| 2245 | |
| 2246 | def GetIndentLevel(line): |
| 2247 | """Return the number of leading spaces in line. |
| 2248 | |
| 2249 | Args: |
| 2250 | line: A string to check. |
| 2251 | |
| 2252 | Returns: |
| 2253 | An integer count of leading spaces, possibly zero. |
| 2254 | """ |
| 2255 | indent = Match(r'^( *)\S', line) |
| 2256 | if indent: |
| 2257 | return len(indent.group(1)) |
| 2258 | else: |
| 2259 | return 0 |
| 2260 | |
| 2261 | def PathSplitToList(path): |
| 2262 | """Returns the path split into a list by the separator. |
no test coverage detected