MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / GetPreviousNonBlankLine

Function GetPreviousNonBlankLine

rtpose_wrapper/scripts/cpp_lint.py:3046–3066  ·  view source on GitHub ↗

Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. linenum: The number of the line to check. Returns: A tuple with two elements. The first element is the contents of the last non-blank line befor

(clean_lines, linenum)

Source from the content-addressed store, hash-verified

3044
3045
3046def GetPreviousNonBlankLine(clean_lines, linenum):
3047 """Return the most recent non-blank line and its line number.
3048
3049 Args:
3050 clean_lines: A CleansedLines instance containing the file contents.
3051 linenum: The number of the line to check.
3052
3053 Returns:
3054 A tuple with two elements. The first element is the contents of the last
3055 non-blank line before the current line, or the empty string if this is the
3056 first non-blank line. The second is the line number of that line, or -1
3057 if this is the first non-blank line.
3058 """
3059
3060 prevlinenum = linenum - 1
3061 while prevlinenum >= 0:
3062 prevline = clean_lines.elided[prevlinenum]
3063 if not IsBlankLine(prevline): # if not a blank line...
3064 return (prevline, prevlinenum)
3065 prevlinenum -= 1
3066 return ('', -1)
3067
3068
3069def CheckBraces(filename, clean_lines, linenum, error):

Callers 2

CheckBracesFunction · 0.85
CheckStyleFunction · 0.85

Calls 1

IsBlankLineFunction · 0.85

Tested by

no test coverage detected