mongomock/__init__.py

mongomock · mongomock/__init__.py · python · ISC
database

__init__.py from mongomock/mongomock

# Source: https://github.com/mongomock/mongomock | License: ISC | Copyright 2024, Monogomock Contributors
# Provided via justclaw.it.com; keep this notice with the code.
import os


try:
    from pymongo.errors import PyMongoError
except ImportError:

    class PyMongoError(Exception):
        pass


try:
    from pymongo.errors import OperationFailure
except ImportError:

    class OperationFailure(PyMongoError):
        def __init__(self, message, code=None, details=None):
            super().__init__()
            self._message = message
            self._code = code
            self._details = details

        code = property(lambda self: self._code)
        details = property(lambda self: self._details)

        def __str__(self):
            return self._message


try:
    from pymon

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key