@@ -70,7 +70,7 @@ def _disallow_transactions(session: Optional[AsyncClientSession]) -> None:
7070class AsyncGridFS :
7171 """An instance of GridFS on top of a single Database."""
7272
73- def __init__ (self , database : AsyncDatabase , collection : str = "fs" ):
73+ def __init__ (self , database : AsyncDatabase [ Any ] , collection : str = "fs" ):
7474 """Create a new instance of :class:`GridFS`.
7575
7676 Raises :class:`TypeError` if `database` is not an instance of
@@ -463,7 +463,7 @@ class AsyncGridFSBucket:
463463
464464 def __init__ (
465465 self ,
466- db : AsyncDatabase ,
466+ db : AsyncDatabase [ Any ] ,
467467 bucket_name : str = "fs" ,
468468 chunk_size_bytes : int = DEFAULT_CHUNK_SIZE ,
469469 write_concern : Optional [WriteConcern ] = None ,
@@ -513,11 +513,11 @@ def __init__(
513513
514514 self ._bucket_name = bucket_name
515515 self ._collection = db [bucket_name ]
516- self ._chunks : AsyncCollection = self ._collection .chunks .with_options (
516+ self ._chunks : AsyncCollection [ Any ] = self ._collection .chunks .with_options (
517517 write_concern = write_concern , read_preference = read_preference
518518 )
519519
520- self ._files : AsyncCollection = self ._collection .files .with_options (
520+ self ._files : AsyncCollection [ Any ] = self ._collection .files .with_options (
521521 write_concern = write_concern , read_preference = read_preference
522522 )
523523
@@ -1085,7 +1085,7 @@ class AsyncGridIn:
10851085
10861086 def __init__ (
10871087 self ,
1088- root_collection : AsyncCollection ,
1088+ root_collection : AsyncCollection [ Any ] ,
10891089 session : Optional [AsyncClientSession ] = None ,
10901090 ** kwargs : Any ,
10911091 ) -> None :
@@ -1141,7 +1141,7 @@ def __init__(
11411141 """
11421142 if not isinstance (root_collection , AsyncCollection ):
11431143 raise TypeError (
1144- f"root_collection must be an instance of AsyncCollection, not { type (root_collection )} "
1144+ f"root_collection must be an instance of AsyncCollection[Any] , not { type (root_collection )} "
11451145 )
11461146
11471147 if not root_collection .write_concern .acknowledged :
@@ -1172,7 +1172,7 @@ def __init__(
11721172 object .__setattr__ (self , "_buffered_docs_size" , 0 )
11731173
11741174 async def _create_index (
1175- self , collection : AsyncCollection , index_key : Any , unique : bool
1175+ self , collection : AsyncCollection [ Any ] , index_key : Any , unique : bool
11761176 ) -> None :
11771177 doc = await collection .find_one (projection = {"_id" : 1 }, session = self ._session )
11781178 if doc is None :
@@ -1456,7 +1456,7 @@ class AsyncGridOut(GRIDOUT_BASE_CLASS): # type: ignore
14561456
14571457 def __init__ (
14581458 self ,
1459- root_collection : AsyncCollection ,
1459+ root_collection : AsyncCollection [ Any ] ,
14601460 file_id : Optional [int ] = None ,
14611461 file_document : Optional [Any ] = None ,
14621462 session : Optional [AsyncClientSession ] = None ,
@@ -1494,7 +1494,7 @@ def __init__(
14941494 """
14951495 if not isinstance (root_collection , AsyncCollection ):
14961496 raise TypeError (
1497- f"root_collection must be an instance of AsyncCollection, not { type (root_collection )} "
1497+ f"root_collection must be an instance of AsyncCollection[Any] , not { type (root_collection )} "
14981498 )
14991499 _disallow_transactions (session )
15001500
@@ -1829,7 +1829,7 @@ class _AsyncGridOutChunkIterator:
18291829 def __init__ (
18301830 self ,
18311831 grid_out : AsyncGridOut ,
1832- chunks : AsyncCollection ,
1832+ chunks : AsyncCollection [ Any ] ,
18331833 session : Optional [AsyncClientSession ],
18341834 next_chunk : Any ,
18351835 ) -> None :
@@ -1842,7 +1842,7 @@ def __init__(
18421842 self ._num_chunks = math .ceil (float (self ._length ) / self ._chunk_size )
18431843 self ._cursor = None
18441844
1845- _cursor : Optional [AsyncCursor ]
1845+ _cursor : Optional [AsyncCursor [ Any ] ]
18461846
18471847 def expected_chunk_length (self , chunk_n : int ) -> int :
18481848 if chunk_n < self ._num_chunks - 1 :
@@ -1921,7 +1921,7 @@ async def close(self) -> None:
19211921
19221922class AsyncGridOutIterator :
19231923 def __init__ (
1924- self , grid_out : AsyncGridOut , chunks : AsyncCollection , session : AsyncClientSession
1924+ self , grid_out : AsyncGridOut , chunks : AsyncCollection [ Any ] , session : AsyncClientSession
19251925 ):
19261926 self ._chunk_iter = _AsyncGridOutChunkIterator (grid_out , chunks , session , 0 )
19271927
@@ -1935,14 +1935,14 @@ async def next(self) -> bytes:
19351935 __anext__ = next
19361936
19371937
1938- class AsyncGridOutCursor (AsyncCursor ):
1938+ class AsyncGridOutCursor (AsyncCursor ): # type: ignore[type-arg]
19391939 """A cursor / iterator for returning GridOut objects as the result
19401940 of an arbitrary query against the GridFS files collection.
19411941 """
19421942
19431943 def __init__ (
19441944 self ,
1945- collection : AsyncCollection ,
1945+ collection : AsyncCollection [ Any ] ,
19461946 filter : Optional [Mapping [str , Any ]] = None ,
19471947 skip : int = 0 ,
19481948 limit : int = 0 ,
0 commit comments