github
6 of 17 new or added lines in 2 files covered. (35.29%)
23030 existing lines in 605 files now uncovered.31643 of 60422 relevant lines covered (52.37%)
1.05 hits per line
| 1 |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
|
|
| 2 |
# Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
| 3 |
|
|
|
UNCOV
4
|
from __future__ import annotations |
× |
| 5 |
|
|
|
UNCOV
6
|
import tokenize |
× |
|
UNCOV
7
|
from dataclasses import dataclass |
× |
|
UNCOV
8
|
from io import BytesIO |
× |
| 9 |
|
|
|
UNCOV
10
|
from pants.engine.internals.parser import ParseError |
× |
| 11 |
|
|
| 12 |
|
|
|
UNCOV
13
|
@dataclass(frozen=True) |
× |
|
UNCOV
14
|
class FixBUILDFileRequest: |
× |
|
UNCOV
15
|
path: str
|
× |
|
UNCOV
16
|
content: bytes
|
× |
| 17 |
|
|
|
UNCOV
18
|
@property
|
× |
|
UNCOV
19
|
def lines(self) -> list[str]: |
× |
|
UNCOV
20
|
return self.content.decode("utf-8").splitlines(keepends=True) |
× |
| 21 |
|
|
|
UNCOV
22
|
def tokenize(self) -> list[tokenize.TokenInfo]: |
× |
|
UNCOV
23
|
try:
|
× |
|
UNCOV
24
|
return list(tokenize.tokenize(BytesIO(self.content).readline)) |
× |
| 25 |
except tokenize.TokenError as e: |
× |
| 26 |
raise ParseError(f"Failed to parse {self.path}: {e}") |
× |
| 27 |
|
|
| 28 |
|
|
|
UNCOV
29
|
@dataclass(frozen=True) |
× |
|
UNCOV
30
|
class FixedBUILDFile: |
× |
|
UNCOV
31
|
path: str
|
× |
|
UNCOV
32
|
content: bytes
|
× |