MCPcopy Create free account
hub / github.com/FastLED/FastLED / strip_comments

Function strip_comments

ci/lint_cpp/check_namespace_includes.py:43–57  ·  view source on GitHub ↗

Strip C/C++ comments from content. Args: content (str): The content to strip comments from Returns: str: Content with comments removed

(content: str)

Source from the content-addressed store, hash-verified

41
42
43def strip_comments(content: str) -> str:
44 """
45 Strip C/C++ comments from content.
46
47 Args:
48 content (str): The content to strip comments from
49
50 Returns:
51 str: Content with comments removed
52 """
53 # Remove multi-line comments
54 content = re.sub(r"/\*.*?\*/", "", content, flags=re.DOTALL)
55 # Remove single-line comments
56 content = re.sub(r"//.*$", "", content, flags=re.MULTILINE)
57 return content
58
59
60def is_bracket_balanced(file_path: Path) -> bool:

Callers 2

is_bracket_balancedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected