Skip to content

Commit d0250c8

Browse files
committed
Adopt Luciano's simplified modelcontext().
1 parent 15ed144 commit d0250c8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pymc3/model.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,15 @@ def __call__(cls, *args, **kwargs):
277277
return instance
278278

279279

280-
281280
def modelcontext(model: Optional['Model']) -> Optional['Model']:
282-
"""return the given model or try to find it in the context if there was
283-
none supplied.
281+
"""
282+
Return the given model or, if none was supplied, try to find one in
283+
the context stack.
284284
"""
285285
if model is None:
286-
found = Model.get_context(error_if_none=False) # type: Optional['Model']
287-
if found is None:
286+
model = Model.get_context(error_if_none=False)
287+
if model is None:
288288
raise ValueError("No model on context stack.")
289-
return found
290289
return model
291290

292291

0 commit comments

Comments
 (0)