Returns : for location of regex match. path: filename. text: Contents of . re_match: A re.Match. offset: Added to line number of start of . Default offset=2 is because callers usually grep for leading n
(path, text, re_match, offset=+2)
| 18 | |
| 19 | |
| 20 | def _file_line(path, text, re_match, offset=+2): |
| 21 | ''' |
| 22 | Returns <file>:<line> for location of regex match. |
| 23 | |
| 24 | path: |
| 25 | filename. |
| 26 | text: |
| 27 | Contents of <filename>. |
| 28 | re_match: |
| 29 | A re.Match. |
| 30 | offset: |
| 31 | Added to line number of start of <re_match>. Default offset=2 is |
| 32 | because callers usually grep for leading newline, and line numbers are |
| 33 | generally 1-based. |
| 34 | ''' |
| 35 | text_before = text[:re_match.start()] |
| 36 | line = text_before.count('\n') + offset |
| 37 | return f'{path}:{line}' |
| 38 | |
| 39 | |
| 40 | def test_release_versions(): |
no outgoing calls
no test coverage detected
searching dependent graphs…