Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit e1350a5

Browse files
committed
MAINT: replace initialized variable to None
1 parent bd37edc commit e1350a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pystan/stanfit4model.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ cdef class StanFit4Model:
484484

485485
# public methods
486486

487-
def plot(self, pars=None, dtypes={}):
487+
def plot(self, pars=None, dtypes=None):
488488
"""Visualize samples from posterior distributions
489489
490490
Parameters
@@ -508,7 +508,7 @@ cdef class StanFit4Model:
508508
pars = pystan.misc._remove_empty_pars(pars, self.sim['pars_oi'], self.sim['dims_oi'])
509509
return pystan.plots.traceplot(self, pars, dtypes)
510510

511-
def traceplot(self, pars=None, dtypes={}):
511+
def traceplot(self, pars=None, dtypes=None):
512512
"""Visualize samples from posterior distributions
513513
514514
Parameters
@@ -524,7 +524,7 @@ cdef class StanFit4Model:
524524
# FIXME: for now plot and traceplot do the same thing
525525
return self.plot(pars, dtypes=dtypes)
526526

527-
def extract(self, pars=None, permuted=True, inc_warmup=False, dtypes={}):
527+
def extract(self, pars=None, permuted=True, inc_warmup=False, dtypes=None):
528528
"""Extract samples in different forms for different parameters.
529529
530530
Parameters
@@ -558,12 +558,16 @@ cdef class StanFit4Model:
558558
self._verify_has_samples()
559559
if inc_warmup is True and permuted is True:
560560
logging.warn("`inc_warmup` ignored when `permuted` is True.")
561+
if dtypes is None and permuted is False:
562+
logging.warn("`dtypes` ignored when `permuted` is False.")
561563

562564
if pars is None:
563565
pars = self.sim['pars_oi']
564566
elif isinstance(pars, string_types):
565567
pars = [pars]
566568
pars = pystan.misc._remove_empty_pars(pars, self.sim['pars_oi'], self.sim['dims_oi'])
569+
if dtypes is None:
570+
dtypes = {}
567571

568572
allpars = self.sim['pars_oi'] + self.sim['fnames_oi']
569573
pystan.misc._check_pars(allpars, pars)

0 commit comments

Comments
 (0)