4242 _grid_out_property ,
4343)
4444from pymongo import ASCENDING , DESCENDING , WriteConcern , _csot
45+ from pymongo .common import validate_string
4546from pymongo .errors import (
4647 BulkWriteError ,
4748 ConfigurationError ,
5051 InvalidOperation ,
5152 OperationFailure ,
5253)
54+ from pymongo .helpers_shared import _check_write_command_response
55+ from pymongo .read_preferences import ReadPreference , _ServerMode
5356from pymongo .synchronous .client_session import ClientSession
5457from pymongo .synchronous .collection import Collection
55- from pymongo .synchronous .common import validate_string
5658from pymongo .synchronous .cursor import Cursor
5759from pymongo .synchronous .database import Database
58- from pymongo .synchronous .helpers import _check_write_command_response , next
59- from pymongo .synchronous .read_preferences import ReadPreference , _ServerMode
60+ from pymongo .synchronous .helpers import next
6061
6162_IS_SYNC = True
6263
@@ -234,7 +235,10 @@ def get_version(
234235 raise NoFile ("no version %d for filename %r" % (version , filename )) from None
235236
236237 def get_last_version (
237- self , filename : Optional [str ] = None , session : Optional [ClientSession ] = None , ** kwargs : Any
238+ self ,
239+ filename : Optional [str ] = None ,
240+ session : Optional [ClientSession ] = None ,
241+ ** kwargs : Any ,
238242 ) -> GridOut :
239243 """Get the most recent version of a file in GridFS by ``"filename"``
240244 or metadata fields.
@@ -497,7 +501,7 @@ def __init__(
497501 .. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
498502 """
499503 if not isinstance (db , Database ):
500- raise TypeError ("database must be an instance of AsyncDatabase " )
504+ raise TypeError ("database must be an instance of Database " )
501505
502506 db = _clear_entity_type_registry (db )
503507
@@ -1028,7 +1032,7 @@ def __init__(
10281032 provided by :class:`~gridfs.GridFS`.
10291033
10301034 Raises :class:`TypeError` if `root_collection` is not an
1031- instance of :class:`~pymongo.collection.AsyncCollection `.
1035+ instance of :class:`~pymongo.collection.Collection `.
10321036
10331037 Any of the file level options specified in the `GridFS Spec
10341038 <http://dochub.mongodb.org/core/gridfsspec>`_ may be passed as
@@ -1069,10 +1073,10 @@ def __init__(
10691073
10701074 .. versionchanged:: 3.0
10711075 `root_collection` must use an acknowledged
1072- :attr:`~pymongo.collection.AsyncCollection .write_concern`
1076+ :attr:`~pymongo.collection.Collection .write_concern`
10731077 """
10741078 if not isinstance (root_collection , Collection ):
1075- raise TypeError ("root_collection must be an instance of AsyncCollection " )
1079+ raise TypeError ("root_collection must be an instance of Collection " )
10761080
10771081 if not root_collection .write_concern .acknowledged :
10781082 raise ConfigurationError ("root_collection must use acknowledged write_concern" )
@@ -1401,7 +1405,7 @@ def __init__(
14011405 Either `file_id` or `file_document` must be specified,
14021406 `file_document` will be given priority if present. Raises
14031407 :class:`TypeError` if `root_collection` is not an instance of
1404- :class:`~pymongo.collection.AsyncCollection `.
1408+ :class:`~pymongo.collection.Collection `.
14051409
14061410 :param root_collection: root collection to read from
14071411 :param file_id: value of ``"_id"`` for the file to read
@@ -1424,7 +1428,7 @@ def __init__(
14241428 from the server. Metadata is fetched when first needed.
14251429 """
14261430 if not isinstance (root_collection , Collection ):
1427- raise TypeError ("root_collection must be an instance of AsyncCollection " )
1431+ raise TypeError ("root_collection must be an instance of Collection " )
14281432 _disallow_transactions (session )
14291433
14301434 root_collection = _clear_entity_type_registry (root_collection )
@@ -1482,7 +1486,7 @@ def __getattr__(self, name: str) -> Any:
14821486 self .open () # type: ignore[unused-coroutine]
14831487 elif not self ._file :
14841488 raise InvalidOperation (
1485- "You must call AsyncGridOut .open() before accessing the %s property" % name
1489+ "You must call GridOut .open() before accessing the %s property" % name
14861490 )
14871491 if name in self ._file :
14881492 return self ._file [name ]
@@ -1677,13 +1681,13 @@ def writable(self) -> bool:
16771681 return False
16781682
16791683 def __enter__ (self ) -> GridOut :
1680- """Makes it possible to use :class:`AsyncGridOut ` files
1684+ """Makes it possible to use :class:`GridOut ` files
16811685 with the async context manager protocol.
16821686 """
16831687 return self
16841688
16851689 def __exit__ (self , exc_type : Any , exc_val : Any , exc_tb : Any ) -> Any :
1686- """Makes it possible to use :class:`AsyncGridOut ` files
1690+ """Makes it possible to use :class:`GridOut ` files
16871691 with the async context manager protocol.
16881692 """
16891693 self .close ()
0 commit comments