from pathlib import Path
from typing import Pattern
from typing import List
import re


def scrape_file(path_code: Path, re_feature: Pattern[str]) -> List[str]:
    """Scrape a file using a compiled regular expression returning the list of results."""  # noqa: DAR101,DAR201
    # Note: Doesn't handle multiple lines. Would probably be better to use an AST if that complexity is needed
    code = path_code.read_text()
    features = []
    for match in re_feature.finditer(code, re.MULTILINE):
        features.append(match.group(1))
    return features