11import datetime
22import urllib .parse
33from typing import Callable , Dict , Generic , List , Optional , Type , TypeVar
4- from google . protobuf . timestamp_pb2 import Timestamp
4+
55from google .protobuf .duration_pb2 import Duration
6+ from google .protobuf .timestamp_pb2 import Timestamp
7+
68from databricks .sdk .common .types .fieldmask import FieldMask
79
810
@@ -56,6 +58,7 @@ def _timestamp(d: Dict[str, any], field: str) -> Optional[Timestamp]:
5658 ts .FromJsonString (d [field ])
5759 return ts
5860
61+
5962def _repeated_timestamp (d : Dict [str , any ], field : str ) -> Optional [List [Timestamp ]]:
6063 if field not in d or not d [field ]:
6164 return None
@@ -66,13 +69,15 @@ def _repeated_timestamp(d: Dict[str, any], field: str) -> Optional[List[Timestam
6669 result .append (ts )
6770 return result
6871
72+
6973def _duration (d : Dict [str , any ], field : str ) -> Optional [Duration ]:
7074 if field not in d or not d [field ]:
7175 return None
7276 dur = Duration ()
7377 dur .FromJsonString (d [field ])
7478 return dur
7579
80+
7681def _repeated_duration (d : Dict [str , any ], field : str ) -> Optional [List [Duration ]]:
7782 if field not in d or not d [field ]:
7883 return None
@@ -83,13 +88,15 @@ def _repeated_duration(d: Dict[str, any], field: str) -> Optional[List[Duration]
8388 result .append (dur )
8489 return result
8590
91+
8692def _fieldmask (d : Dict [str , any ], field : str ) -> Optional [FieldMask ]:
8793 if field not in d or not d [field ]:
8894 return None
8995 fm = FieldMask ()
9096 fm .FromJsonString (d [field ])
9197 return fm
9298
99+
93100def _repeated_fieldmask (d : Dict [str , any ], field : str ) -> Optional [List [FieldMask ]]:
94101 if field not in d or not d [field ]:
95102 return None
@@ -101,7 +108,6 @@ def _repeated_fieldmask(d: Dict[str, any], field: str) -> Optional[List[FieldMas
101108 return result
102109
103110
104-
105111ReturnType = TypeVar ("ReturnType" )
106112
107113
0 commit comments