From 142aed3838e7a1ee812c0e21f3eedb48770e168c Mon Sep 17 00:00:00 2001 From: Cerek Hillen Date: Wed, 26 Aug 2020 02:29:34 -0400 Subject: [PATCH] type annotation for Timestamp and Duration (#4471) --- .../protobuf/internal/well_known_types.pyi | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/third_party/2and3/google/protobuf/internal/well_known_types.pyi b/third_party/2and3/google/protobuf/internal/well_known_types.pyi index 65dee08ba..cf23f1e28 100644 --- a/third_party/2and3/google/protobuf/internal/well_known_types.pyi +++ b/third_party/2and3/google/protobuf/internal/well_known_types.pyi @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timedelta from typing import Any, Optional class Error(Exception): ... @@ -16,36 +16,36 @@ class Any_: class Timestamp: def ToJsonString(self) -> str: ... - seconds: Any = ... - nanos: Any = ... - def FromJsonString(self, value: Any) -> None: ... + seconds: int = ... + nanos: int = ... + def FromJsonString(self, value: str) -> None: ... def GetCurrentTime(self) -> None: ... - def ToNanoseconds(self): ... - def ToMicroseconds(self): ... - def ToMilliseconds(self): ... - def ToSeconds(self): ... - def FromNanoseconds(self, nanos: Any) -> None: ... - def FromMicroseconds(self, micros: Any) -> None: ... - def FromMilliseconds(self, millis: Any) -> None: ... - def FromSeconds(self, seconds: Any) -> None: ... + def ToNanoseconds(self) -> int: ... + def ToMicroseconds(self) -> int: ... + def ToMilliseconds(self) -> int: ... + def ToSeconds(self) -> int: ... + def FromNanoseconds(self, nanos: int) -> None: ... + def FromMicroseconds(self, micros: int) -> None: ... + def FromMilliseconds(self, millis: int) -> None: ... + def FromSeconds(self, seconds: int) -> None: ... def ToDatetime(self) -> datetime: ... def FromDatetime(self, dt: datetime) -> None: ... class Duration: def ToJsonString(self) -> str: ... - seconds: Any = ... - nanos: Any = ... + seconds: int = ... + nanos: int = ... def FromJsonString(self, value: Any) -> None: ... - def ToNanoseconds(self): ... - def ToMicroseconds(self): ... - def ToMilliseconds(self): ... - def ToSeconds(self): ... - def FromNanoseconds(self, nanos: Any) -> None: ... - def FromMicroseconds(self, micros: Any) -> None: ... - def FromMilliseconds(self, millis: Any) -> None: ... - def FromSeconds(self, seconds: Any) -> None: ... - def ToTimedelta(self): ... - def FromTimedelta(self, td: Any) -> None: ... + def ToNanoseconds(self) -> int: ... + def ToMicroseconds(self) -> int: ... + def ToMilliseconds(self) -> int: ... + def ToSeconds(self) -> int: ... + def FromNanoseconds(self, nanos: int) -> None: ... + def FromMicroseconds(self, micros: int) -> None: ... + def FromMilliseconds(self, millis: int) -> None: ... + def FromSeconds(self, seconds: int) -> None: ... + def ToTimedelta(self) -> timedelta: ... + def FromTimedelta(self, td: timedelta) -> None: ... class FieldMask: def ToJsonString(self) -> str: ...