Parse BSON codec options.
(options: Any)
| 487 | |
| 488 | |
| 489 | def _parse_codec_options(options: Any) -> CodecOptions[Any]: |
| 490 | """Parse BSON codec options.""" |
| 491 | kwargs = {} |
| 492 | for k in set(options) & { |
| 493 | "document_class", |
| 494 | "tz_aware", |
| 495 | "uuidrepresentation", |
| 496 | "unicode_decode_error_handler", |
| 497 | "tzinfo", |
| 498 | "type_registry", |
| 499 | "datetime_conversion", |
| 500 | }: |
| 501 | if k == "uuidrepresentation": |
| 502 | kwargs["uuid_representation"] = options[k] |
| 503 | else: |
| 504 | kwargs[k] = options[k] |
| 505 | return CodecOptions(**kwargs) |