|
22 | 22 | from __future__importunicode_literals |
23 | 23 |
|
24 | 24 | importhttp.client |
| 25 | +fromtypingimportDict |
| 26 | +fromtypingimportUnion |
25 | 27 |
|
26 | 28 | try: |
27 | 29 | importgrpc |
28 | | - |
29 | 30 | exceptImportError:# pragma: NO COVER |
30 | 31 | grpc=None |
31 | 32 |
|
32 | 33 | # Lookup tables for mapping exceptions from HTTP and gRPC transports. |
33 | 34 | # Populated by _GoogleAPICallErrorMeta |
34 | | -_HTTP_CODE_TO_EXCEPTION= {} |
35 | | -_GRPC_CODE_TO_EXCEPTION= {} |
| 35 | +_HTTP_CODE_TO_EXCEPTION:Dict[int,Exception]= {} |
| 36 | +_GRPC_CODE_TO_EXCEPTION:Dict[int,Exception]= {} |
36 | 37 |
|
37 | 38 | # Additional lookup table to map integer status codes to grpc status code |
38 | 39 | # grpc does not currently support initializing enums from ints |
@@ -100,7 +101,7 @@ class GoogleAPICallError(GoogleAPIError, metaclass=_GoogleAPICallErrorMeta): |
100 | 101 | gRPC call metadata. |
101 | 102 | """ |
102 | 103 |
|
103 | | -code=None |
| 104 | +code:Union[int,None]=None |
104 | 105 | """Optional[int]: The HTTP status code associated with this error. |
105 | 106 |
|
106 | 107 | This may be ``None`` if the exception does not have a direct mapping |
|