def line_stats(example):
    """Calculates mean and max line length of file."""
    line_lengths = [len(line) for line in example["content"].splitlines()]
    return {"line_mean": np.mean(line_lengths), "line_max": max(line_lengths)}
Calculates mean and max line length of file.
dpkd/transformers/examples/research_projects/codeparrot/scripts/preprocessing.py