Internal clone helper.
(self, deepcopy: bool = True, base: Optional[Cursor] = None)
| 259 | return self._clone(True) |
| 260 | |
| 261 | def _clone(self, deepcopy: bool = True, base: Optional[Cursor] = None) -> Cursor: # type: ignore[type-arg] |
| 262 | """Internal clone helper.""" |
| 263 | if not base: |
| 264 | if self._session and not self._session._implicit: |
| 265 | base = self._clone_base(self._session) |
| 266 | else: |
| 267 | base = self._clone_base(None) |
| 268 | |
| 269 | values_to_clone = ( |
| 270 | "spec", |
| 271 | "projection", |
| 272 | "skip", |
| 273 | "limit", |
| 274 | "max_time_ms", |
| 275 | "max_await_time_ms", |
| 276 | "comment", |
| 277 | "max", |
| 278 | "min", |
| 279 | "ordering", |
| 280 | "explain", |
| 281 | "hint", |
| 282 | "batch_size", |
| 283 | "max_scan", |
| 284 | "query_flags", |
| 285 | "collation", |
| 286 | "empty", |
| 287 | "show_record_id", |
| 288 | "return_key", |
| 289 | "allow_disk_use", |
| 290 | "snapshot", |
| 291 | "exhaust", |
| 292 | "has_filter", |
| 293 | "cursor_type", |
| 294 | ) |
| 295 | data = { |
| 296 | k: v for k, v in self.__dict__.items() if k.startswith("_") and k[1:] in values_to_clone |
| 297 | } |
| 298 | if deepcopy: |
| 299 | data = self._deepcopy(data) |
| 300 | base.__dict__.update(data) |
| 301 | return base |
| 302 | |
| 303 | def _clone_base(self, session: Optional[ClientSession]) -> Cursor: # type: ignore[type-arg] |
| 304 | """Creates an empty Cursor object for information to be copied into.""" |
no test coverage detected