(contents: str, enum_name: str)
| 61 | |
| 62 | |
| 63 | def extract_enum_body(contents: str, enum_name: str) -> str: |
| 64 | res = re.search(f"pub enum {enum_name} " + r"\{(.+?)\n\}", contents, re.DOTALL) |
| 65 | if not res: |
| 66 | raise ValueError(f"Could not find {enum_name} enum") |
| 67 | |
| 68 | return "\n".join( |
| 69 | line.split("//")[0].strip() # Remove any comment. i.e. "foo // some comment" |
| 70 | for line in res.group(1).splitlines() |
| 71 | if not line.strip().startswith("//") # Ignore comment lines |
| 72 | ) |
| 73 | |
| 74 | |
| 75 | def build_deopts(contents: str) -> dict[str, list[str]]: |
no test coverage detected