-
Notifications
You must be signed in to change notification settings - Fork 113
Make as_fillable_container()
and as_fill_item()
not mutate their inputs
#862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@contextlib.contextmanager | ||
def private_seed_n(n: int = 0) -> Generator[None, None, None]: | ||
with private_seed(): | ||
random.seed(0) | ||
return func(*args, **kwargs) | ||
random.seed(n) | ||
yield |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this new context manager is to make it so the code inside the with private_seed_n():
statement is clearer -- it will have the same form as it would if were called without the with private_seed_n():
.
@schloerke On a related note, I was looking at the functions Is there any reason not to switch to those methods from htmltools? That would remove the need for those functions, and also make the code feel less weird. |
@wch I was looking into switching to the Edit: I opened an issue to track/explain this comment: #865 |
I've removed the |
|
This is a follow-up to #861 (comment). Also closes #577.
This PR makes it so that
as_fillable_container()
andas_fill_item()
do not modify their inputs.Fixes #865