Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for text-based analysis.

Functions§

count_non_comment_matches
Count non-comment occurrences of a pattern in source content
count_non_import_matches
Count non-comment, non-import occurrences of a pattern in source content
find_line_of_str
Find the line number of a string literal in source content (skipping comments)
find_line_of_str_non_import
Find the line number of a string literal, skipping comments and import statements
get_position_from_content
Get (line, column) from a byte offset in source content.
truncate
Truncate a string to a maximum length, appending “…” if truncated.