Skip to content

Commit cd5a2b9

Browse files
committed
Add return type for Resource.__enter__
1 parent faf99f6 commit cd5a2b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

googleapiclient-stubs/discovery.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from email.generator import Generator as BytesGenerator
2-
from typing import Any, Dict, Optional, Union, overload
2+
from typing import Any, Dict, Optional, TypeVar, Union, overload
33

44
import google.auth.credentials # type: ignore
55
import httplib2 # type: ignore
@@ -333,6 +333,8 @@ from googleapiclient.discovery_cache.base import Cache
333333
from googleapiclient.http import HttpMock, HttpRequest
334334
from googleapiclient.model import Model
335335

336+
T = TypeVar("T")
337+
336338
class _BytesGenerator(BytesGenerator): ...
337339

338340
def fix_method_name(name: Any): ...
@@ -362,7 +364,7 @@ class Resource:
362364
rootDesc: Any,
363365
schema: Any,
364366
) -> None: ...
365-
def __enter__(self): ...
367+
def __enter__(self: T) -> T: ...
366368
def __exit__(self, exc_type: Any, exc: Any, exc_tb: Any) -> None: ...
367369
def close(self) -> None: ...
368370

0 commit comments

Comments
 (0)