This repository was archived by the owner on Jul 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathtypes.py
More file actions
88 lines (62 loc) · 2.11 KB
/
types.py
File metadata and controls
88 lines (62 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import pathlib
import typing as t
from dataclasses import dataclass
import click
from codecov_cli.helpers.ci_adapters.base import CIAdapterBase
from codecov_cli.helpers.versioning_systems import VersioningSystemInterface
class ContextObject(t.TypedDict):
ci_adapter: t.Optional[CIAdapterBase]
versioning_system: t.Optional[VersioningSystemInterface]
codecov_yaml: t.Optional[dict]
enterprise_url: t.Optional[str]
class CommandContext(click.Context):
obj: ContextObject
class UploadCollectionResultFile(object):
def __init__(self, path: pathlib.Path):
self.path = path
def get_filename(self) -> str:
return self.path.as_posix()
def get_content(self) -> bytes:
with open(self.path, "rb") as f:
return f.read()
def __repr__(self) -> str:
return str(self.path)
def __eq__(self, other):
if not isinstance(other, UploadCollectionResultFile):
return False
return self.path == other.path
def __hash__(self) -> int:
return hash(str(self.path))
@dataclass
class UploadCollectionResultFileFixer(object):
__slots__ = ["path", "fixed_lines_without_reason", "fixed_lines_with_reason", "eof"]
path: pathlib.Path
fixed_lines_without_reason: t.Set[int]
fixed_lines_with_reason: t.Optional[t.Set[t.Tuple[int, str]]]
eof: t.Optional[int]
@dataclass
class UploadCollectionResult(object):
__slots__ = ["network", "files", "file_fixes"]
network: t.List[str]
files: t.List[UploadCollectionResultFile]
file_fixes: t.List[UploadCollectionResultFileFixer]
class PreparationPluginInterface(object):
def run_preparation(self) -> None:
pass
@dataclass
class RequestResultWarning(object):
__slots__ = ("message",)
message: str
@dataclass
class RequestError(object):
__slots__ = ("code", "params", "description")
code: str
params: t.Dict
description: str
@dataclass
class RequestResult(object):
__slots__ = ("error", "warnings", "status_code", "text")
error: t.Optional[RequestError]
warnings: t.List[RequestResultWarning]
status_code: int
text: str