def test_docformat(): with suppress_warnings() as sup: sup.filter(category=DeprecationWarning) udd = doccer.unindent_dict(doc_dict) formatted = doccer.docformat(docstring, udd) assert_equal(formatted, filled_docstring) single_doc = 'Single line doc %(strtest1)s' formatted = doccer.docformat(single_doc, doc_dict) # Note - initial indent of format string does not # affect subsequent indent of inserted parameter assert_equal(formatted, """Single line doc Another test with some indent""")
def __init__(self, seed=None): """ Initialize a multivariate t-distributed random variable. Parameters ---------- seed : Random state. """ super(multivariate_t_gen, self).__init__(seed) self.__doc__ = doccer.docformat(self.__doc__, mvt_docdict_params) self._random_state = check_random_state(seed)
def __init__(self, seed=None): super(multivariate_normal_gen, self).__init__(seed) self.__doc__ = doccer.docformat(self.__doc__, mvn_docdict_params)
self.shape_info = _PSD(shape, allow_singular=allow_singular) def logpdf(self, x): x = self._dist._process_quantiles(x, self.dim) U = self.shape_info.U log_pdet = self.shape_info.log_pdet return self._dist._logpdf(x, self.loc, U, log_pdet, self.df, self.dim, self.shape_info.rank) def pdf(self, x): return np.exp(self.logpdf(x)) def rvs(self, size=1, random_state=None): return self._dist.rvs(loc=self.loc, shape=self.shape, df=self.df, size=size, random_state=random_state) multivariate_t = multivariate_t_gen() # Set frozen generator docstrings from corresponding docstrings in # matrix_normal_gen and fill in default strings in class docstrings for name in ['logpdf', 'pdf', 'rvs']: method = multivariate_t_gen.__dict__[name] method_frozen = multivariate_t_frozen.__dict__[name] method_frozen.__doc__ = doccer.docformat(method.__doc__, mvt_docdict_noparams) method.__doc__ = doccer.docformat(method.__doc__, mvt_docdict_params)