Coverage for /builds/BuildGrid/buildgrid/buildgrid/server/types.py: 77.78%
18 statements
« prev ^ index » next coverage.py v7.4.1, created at 2024-10-04 17:48 +0000
« prev ^ index » next coverage.py v7.4.1, created at 2024-10-04 17:48 +0000
1# Copyright (C) 2021 Bloomberg LP
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# <http://www.apache.org/licenses/LICENSE-2.0>
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License' is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
16from typing import Any, Dict, Protocol, Tuple, Type, TypeVar, Union
18GrpcTrailingMetadata = Tuple[Tuple[str, Union[str, bytes]], ...]
19LogStreamConnectionConfig = Dict[str, Union[str, Dict[str, str]]]
22class OnServerStartCallback(Protocol):
23 def __call__(self) -> Any: ...
26class PortAssignedCallback(Protocol):
27 def __call__(self, port_map: Dict[Any, int]) -> Any: ...
30Cls = TypeVar("Cls")
33class MessageType(Protocol):
34 # Acts like a protobuf message. Add methods as needed.
36 @classmethod
37 def FromString(cls: Type[Cls], s: bytes) -> Cls:
38 pass
40 def SerializeToString(self: Any, *, deterministic: bool = ...) -> bytes:
41 pass
43 def ParseFromString(self, serialized: bytes) -> int:
44 pass
46 def Clear(self) -> None:
47 pass