# Path: diffprivlib/mechanisms/base.py
# class DPMechanism(DPMachine, abc.ABC):
#     r"""Abstract base class for all mechanisms.  Instantiated from :class:`.DPMachine`.
# 
#     Parameters
#     ----------
#     epsilon : float
#         Privacy parameter :math:`\epsilon` for the mechanism.  Must be in [0, ∞].
# 
#     delta : float
#         Privacy parameter :math:`\delta` for the mechanism.  Must be in [0, 1].  Cannot be simultaneously zero with
#         ``epsilon``.
# 
#     """
#     def __init__(self, *, epsilon, delta):
#         self.epsilon, self.delta = self._check_epsilon_delta(epsilon, delta)
# 
#         self._rng = secrets.SystemRandom()
# 
#     def __repr__(self):
#         attrs = inspect.getfullargspec(self.__class__).kwonlyargs
#         attr_output = []
# 
#         for attr in attrs:
#             attr_output.append(attr + "=" + repr(self.__getattribute__(attr)))
# 
#         return str(self.__module__) + "." + str(self.__class__.__name__) + "(" + ", ".join(attr_output) + ")"
# 
#     @abc.abstractmethod
#     def randomise(self, value):
#         """Randomise `value` with the mechanism.
# 
#         Parameters
#         ----------
#         value : int or float or str or method
#             The value to be randomised.
# 
#         Returns
#         -------
#         int or float or str or method
#             The randomised value, same type as `value`.
# 
#         """
# 
#     def bias(self, value):
#         """Returns the bias of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the bias of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The bias of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         raise NotImplementedError
# 
#     def variance(self, value):
#         """Returns the variance of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the variance of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The variance of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         raise NotImplementedError
# 
#     def mse(self, value):
#         """Returns the mean squared error (MSE) of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the MSE of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The MSE of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         return self.variance(value) + (self.bias(value)) ** 2
# 
#     @classmethod
#     def _check_epsilon_delta(cls, epsilon, delta):
#         if not isinstance(epsilon, Real) or not isinstance(delta, Real):
#             raise TypeError("Epsilon and delta must be numeric")
# 
#         if epsilon < 0:
#             raise ValueError("Epsilon must be non-negative")
# 
#         if not 0 <= delta <= 1:
#             raise ValueError("Delta must be in [0, 1]")
# 
#         if epsilon + delta == 0:
#             raise ValueError("Epsilon and Delta cannot both be zero")
# 
#         return float(epsilon), float(delta)
# 
#     def _check_all(self, value):
#         del value
#         self._check_epsilon_delta(self.epsilon, self.delta)
# 
#         return True
# 
# Path: diffprivlib/utils.py
# def copy_docstring(source):
#     """Decorator function to copy a docstring from a `source` function to a `target` function.
# 
#     The docstring is only copied if a docstring is present in `source`, and if none is present in `target`.  Takes
#     inspiration from similar in `matplotlib`.
# 
#     Parameters
#     ----------
#     source : method
#         Source function from which to copy the docstring.  If ``source.__doc__`` is empty, do nothing.
# 
#     Returns
#     -------
#     target : method
#         Target function with new docstring.
# 
#     """
#     def copy_func(target):
#         if source.__doc__ and not target.__doc__:
#             target.__doc__ = source.__doc__
#         return target
#     return copy_func


from numbers import Real
from diffprivlib.mechanisms.base import DPMechanism
from diffprivlib.utils import copy_docstring
import numpy as np
        if int(vector_dim) < 1:
            raise ValueError("d must be strictly positive")

        return int(vector_dim)

    @classmethod
    def _check_sensitivity(cls, function_sensitivity, data_sensitivity):
        if not isinstance(function_sensitivity, Real) or not isinstance(data_sensitivity, Real):
            raise TypeError("Sensitivities must be numeric")

        if function_sensitivity < 0 or data_sensitivity < 0:
            raise ValueError("Sensitivities must be non-negative")

        return function_sensitivity, data_sensitivity

    def _check_all(self, value):
        super()._check_all(value)
        self._check_alpha(self.alpha)
        self._check_sensitivity(self.function_sensitivity, self.data_sensitivity)
        self._check_dimension(self.dimension)

        if not callable(value):
            raise TypeError("Value to be randomised must be a function")

        return True

    @copy_docstring(DPMechanism.bias)
    def bias(self, value):
        raise NotImplementedError


# Path: diffprivlib/mechanisms/base.py
# class DPMechanism(DPMachine, abc.ABC):
#     r"""Abstract base class for all mechanisms.  Instantiated from :class:`.DPMachine`.
# 
#     Parameters
#     ----------
#     epsilon : float
#         Privacy parameter :math:`\epsilon` for the mechanism.  Must be in [0, ∞].
# 
#     delta : float
#         Privacy parameter :math:`\delta` for the mechanism.  Must be in [0, 1].  Cannot be simultaneously zero with
#         ``epsilon``.
# 
#     """
#     def __init__(self, *, epsilon, delta):
#         self.epsilon, self.delta = self._check_epsilon_delta(epsilon, delta)
# 
#         self._rng = secrets.SystemRandom()
# 
#     def __repr__(self):
#         attrs = inspect.getfullargspec(self.__class__).kwonlyargs
#         attr_output = []
# 
#         for attr in attrs:
#             attr_output.append(attr + "=" + repr(self.__getattribute__(attr)))
# 
#         return str(self.__module__) + "." + str(self.__class__.__name__) + "(" + ", ".join(attr_output) + ")"
# 
#     @abc.abstractmethod
#     def randomise(self, value):
#         """Randomise `value` with the mechanism.
# 
#         Parameters
#         ----------
#         value : int or float or str or method
#             The value to be randomised.
# 
#         Returns
#         -------
#         int or float or str or method
#             The randomised value, same type as `value`.
# 
#         """
# 
#     def bias(self, value):
#         """Returns the bias of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the bias of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The bias of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         raise NotImplementedError
# 
#     def variance(self, value):
#         """Returns the variance of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the variance of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The variance of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         raise NotImplementedError
# 
#     def mse(self, value):
#         """Returns the mean squared error (MSE) of the mechanism at a given `value`.
# 
#         Parameters
#         ----------
#         value : int or float
#             The value at which the MSE of the mechanism is sought.
# 
#         Returns
#         -------
#         bias : float or None
#             The MSE of the mechanism at `value` if defined, `None` otherwise.
# 
#         """
#         return self.variance(value) + (self.bias(value)) ** 2
# 
#     @classmethod
#     def _check_epsilon_delta(cls, epsilon, delta):
#         if not isinstance(epsilon, Real) or not isinstance(delta, Real):
#             raise TypeError("Epsilon and delta must be numeric")
# 
#         if epsilon < 0:
#             raise ValueError("Epsilon must be non-negative")
# 
#         if not 0 <= delta <= 1:
#             raise ValueError("Delta must be in [0, 1]")
# 
#         if epsilon + delta == 0:
#             raise ValueError("Epsilon and Delta cannot both be zero")
# 
#         return float(epsilon), float(delta)
# 
#     def _check_all(self, value):
#         del value
#         self._check_epsilon_delta(self.epsilon, self.delta)
# 
#         return True
# 
# Path: diffprivlib/utils.py
# def copy_docstring(source):
#     """Decorator function to copy a docstring from a `source` function to a `target` function.
# 
#     The docstring is only copied if a docstring is present in `source`, and if none is present in `target`.  Takes
#     inspiration from similar in `matplotlib`.
# 
#     Parameters
#     ----------
#     source : method
#         Source function from which to copy the docstring.  If ``source.__doc__`` is empty, do nothing.
# 
#     Returns
#     -------
#     target : method
#         Target function with new docstring.
# 
#     """
#     def copy_func(target):
#         if source.__doc__ and not target.__doc__:
#             target.__doc__ = source.__doc__
#         return target
#     return copy_func


# Path: diffprivlib/mechanisms/vector.py
from numbers import Real
from diffprivlib.mechanisms.base import DPMechanism
from diffprivlib.utils import copy_docstring
import numpy as np

        if int(vector_dim) < 1:
            raise ValueError("d must be strictly positive")

        return int(vector_dim)

    @classmethod
    def _check_sensitivity(cls, function_sensitivity, data_sensitivity):
        if not isinstance(function_sensitivity, Real) or not isinstance(data_sensitivity, Real):
            raise TypeError("Sensitivities must be numeric")

        if function_sensitivity < 0 or data_sensitivity < 0:
            raise ValueError("Sensitivities must be non-negative")

        return function_sensitivity, data_sensitivity

    def _check_all(self, value):
        super()._check_all(value)
        self._check_alpha(self.alpha)
        self._check_sensitivity(self.function_sensitivity, self.data_sensitivity)
        self._check_dimension(self.dimension)

        if not callable(value):
            raise TypeError("Value to be randomised must be a function")

        return True

    @copy_docstring(DPMechanism.bias)
    def bias(self, value):
        raise NotImplementedError


    @copy_docstring(DPMechanism.variance)