Return the number of leading spaces in line. Args: line: A string to check. Returns: An integer count of leading spaces, possibly zero.
(line)
| 2259 | |
| 2260 | |
| 2261 | def GetIndentLevel(line): |
| 2262 | """Return the number of leading spaces in line. |
| 2263 | |
| 2264 | Args: |
| 2265 | line: A string to check. |
| 2266 | |
| 2267 | Returns: |
| 2268 | An integer count of leading spaces, possibly zero. |
| 2269 | """ |
| 2270 | indent = Match(r'^( *)\S', line) |
| 2271 | if indent: |
| 2272 | return len(indent.group(1)) |
| 2273 | else: |
| 2274 | return 0 |
| 2275 | |
| 2276 | def PathSplitToList(path): |
| 2277 | """Returns the path split into a list by the separator. |
no test coverage detected