9
9
10
10
import sqlalchemy as sa
11
11
from bson import SON
12
- from pymongo import CursorType , helpers
12
+ from pymongo import CursorType , helpers_shared
13
13
from pymongo .client_session import ClientSession
14
14
from pymongo .collation import validate_collation_or_none
15
15
from pymongo .collection import Collection
16
16
from pymongo .common import validate_is_document_type , validate_is_mapping
17
- from pymongo .cursor import _QUERY_OPTIONS , Cursor , _Hint , _Sort
17
+ from pymongo .cursor import Cursor
18
+ from pymongo .cursor_shared import _QUERY_OPTIONS , _Hint , _Sort
18
19
from pymongo .errors import InvalidOperation
19
20
from pymongo .message import _GetMore , _Query
20
21
from pymongo .read_preferences import _ServerMode
@@ -119,7 +120,7 @@ def __init__(
119
120
allow_disk_use = validate_boolean ("allow_disk_use" , allow_disk_use )
120
121
121
122
if projection is not None :
122
- projection = helpers ._fields_list_to_dict (projection , "projection" )
123
+ projection = helpers_shared ._fields_list_to_dict (projection , "projection" )
123
124
124
125
if let is not None :
125
126
validate_is_document_type ("let" , let )
@@ -131,7 +132,7 @@ def __init__(
131
132
self .__skip = skip
132
133
self .__limit = limit
133
134
self .__batch_size = batch_size
134
- self .__ordering = sort and helpers ._index_document (sort ) or None
135
+ self .__ordering = sort and helpers_shared ._index_document (sort ) or None
135
136
self .__max_scan = max_scan
136
137
self .__explain = False
137
138
self .__comment = comment
@@ -287,8 +288,8 @@ def _refresh(self) -> int:
287
288
288
289
def sort (self , key_or_list : _Hint , direction : Optional [Union [int , str ]] = None ) -> Cursor [_DocumentType ]:
289
290
""" """
290
- keys = helpers ._index_list (key_or_list , direction )
291
- self .__ordering = helpers ._index_document (keys )
291
+ keys = helpers_shared ._index_list (key_or_list , direction )
292
+ self .__ordering = helpers_shared ._index_document (keys )
292
293
return self
293
294
294
295
def __send_message (self , operation : Union [_Query , _GetMore ]) -> None :
@@ -385,6 +386,6 @@ def __set_hint(self, index: Optional[_Hint]) -> None:
385
386
if isinstance (index , str ):
386
387
self .__hint = index
387
388
else :
388
- self .__hint = SON (helpers ._index_document (index ))
389
+ self .__hint = SON (helpers_shared ._index_document (index ))
389
390
390
391
return AmendedCursor
0 commit comments