def __init__(self, model, independent_vars=None, params=None, **kwargs):
        """
        :param model: dict of ``callable``, where dependent variables are the
            keys. If instead of a dict a (sequence of) ``callable`` is provided,
            it will be turned into a dict automatically.
        :param independent_vars: The independent variables of the  model.
            (Deprecated, use ``connectivity_mapping`` instead.)
        :param params: The parameters of the model.
            (Deprecated, use ``connectivity_mapping`` instead.)
        :param connectivity_mapping: Mapping indicating the dependencies of
            every variable in the model. For example, a model_dict
            {y: a * x + b} has a connectivity_mapping {y: {x, a, b}}. Note that
            the values of this dict have to be sets.
        """
        connectivity_mapping = kwargs.pop('connectivity_mapping')
        if connectivity_mapping is None and \
                independent_vars is not None and params is not None:
            # Make model into a mapping if needed.
            if not isinstance(model, Mapping):
                try:
                    iter(model)
                except TypeError:
                    model = [model]  # make model iterable

                model = {Variable(): expr for expr in model}
            warnings.warn(DeprecationWarning(
                '`independent_vars` and `params` have been deprecated.'
                ' Use `connectivity_mapping` instead.'
            ))
            self.independent_vars = sorted(independent_vars, key=str)
            self.params = sorted(params, key=str)
            self.connectivity_mapping = {var: set(independent_vars + params)
                                         for var in model}
        elif connectivity_mapping:
            self.connectivity_mapping = connectivity_mapping
            if not isinstance(model, Mapping):
                raise TypeError('Please provide the model as a mapping, '
                                'corresponding to `connectivity_mapping`.')
        else:
            raise TypeError('Please provide `connectivity_mapping`.')
        super(BaseNumericalModel, self).__init__(model, **kwargs)
def __init__ ( self , model , independent_vars = None , params = None , ** kwargs ) : connectivity_mapping = kwargs . pop ( 'connectivity_mapping' ) if connectivity_mapping is None and independent_vars is not None and params is not None : if not isinstance ( model , Mapping ) : try : iter ( model ) except TypeError : model = [ model ] model = { Variable ( ) : expr for expr in model } warnings . warn ( DeprecationWarning ( '`independent_vars` and `params` have been deprecated.' ' Use `connectivity_mapping` instead.' ) ) self . independent_vars = sorted ( independent_vars , key = str ) self . params = sorted ( params , key = str ) self . connectivity_mapping = { var : set ( independent_vars + params ) for var in model } elif connectivity_mapping : self . connectivity_mapping = connectivity_mapping if not isinstance ( model , Mapping ) : raise TypeError ( 'Please provide the model as a mapping, ' 'corresponding to `connectivity_mapping`.' ) else : raise TypeError ( 'Please provide `connectivity_mapping`.' ) super ( BaseNumericalModel , self ) . __init__ ( model , ** kwargs )
:param model: dict of ``callable``, where dependent variables are the
            keys. If instead of a dict a (sequence of) ``callable`` is provided,
            it will be turned into a dict automatically.
        :param independent_vars: The independent variables of the  model.
            (Deprecated, use ``connectivity_mapping`` instead.)
        :param params: The parameters of the model.
            (Deprecated, use ``connectivity_mapping`` instead.)
        :param connectivity_mapping: Mapping indicating the dependencies of
            every variable in the model. For example, a model_dict
            {y: a * x + b} has a connectivity_mapping {y: {x, a, b}}. Note that
            the values of this dict have to be sets.