Skip to content

Commit edbafaa

Browse files
authored
Remove unreachable lines of sampling code (#4261)
* remove unreachable code * clarify docs, invert guard * clarify that steps is a sequence * 📝 update docstring
1 parent 584e791 commit edbafaa

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pymc3/sampling.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -112,31 +112,31 @@ def instantiate_steppers(_model, steps, selected_steps, step_kwargs=None):
112112
----------
113113
model : Model object
114114
A fully-specified model object; legacy argument -- ignored
115-
steps : step function or vector of step functions
116-
One or more step functions that have been assigned to some subset of
117-
the model's parameters. Defaults to None (no assigned variables).
118-
selected_steps : dictionary of step methods and variables
119-
The step methods and the variables that have were assigned to them.
115+
steps : list
116+
A list of zero or more step function instances that have been assigned to some subset of
117+
the model's parameters.
118+
selected_steps : dict
119+
A dictionary that maps a step method class to a list of zero or more model variables.
120120
step_kwargs : dict
121121
Parameters for the samplers. Keys are the lower case names of
122-
the step method, values a dict of arguments.
122+
the step method, values a dict of arguments. Defaults to None.
123123
124124
Returns
125125
-------
126-
methods : list
127-
List of step methods associated with the model's variables.
126+
methods : list or step
127+
List of step methods associated with the model's variables, or step method
128+
if there is only one.
128129
"""
129130
if step_kwargs is None:
130131
step_kwargs = {}
131132

132133
used_keys = set()
133134
for step_class, vars in selected_steps.items():
134-
if len(vars) == 0:
135-
continue
136-
args = step_kwargs.get(step_class.name, {})
137-
used_keys.add(step_class.name)
138-
step = step_class(vars=vars, **args)
139-
steps.append(step)
135+
if vars:
136+
args = step_kwargs.get(step_class.name, {})
137+
used_keys.add(step_class.name)
138+
step = step_class(vars=vars, **args)
139+
steps.append(step)
140140

141141
unused_args = set(step_kwargs).difference(used_keys)
142142
if unused_args:

0 commit comments

Comments
 (0)