bluesky / suitcase-tiff

http://nsls-ii.github.io/suitcase
Other
2 stars 5 forks source link

ENH/REF: Allow Serializer as context. #15

Closed danielballan closed 5 years ago

danielballan commented 5 years ago

Is there a good reason not to do this? It introduces one more programming concept that a Serializer author would need to use, but all they have to do is copy/paste the __enter__ and __exit__ blocks as is, which doesn't seem too bad.

On the plus side, it makes it easy to clean up correctly, and it matches the semantics of open and *Manager.open, which can be used as contexts.

If merged I will open similar PRs into the other suitcases, the documented example in suitcase-core's docs, and the cookiecutter.

licode commented 5 years ago

LGTM. 👍 on using those two functions.

awalter-bnl commented 5 years ago

I think this is a good idea, to avoid having to copy/paste can we just add these to the suitcase-cookiecutter so they are automatically included?

danielballan commented 5 years ago

can we just add these to the suitcase-cookiecutter so they are automatically included?

Yep:

If merged I will open similar PRs into the other suitcases, the documented example in suitcase-core's docs, and the cookiecutter.

Of course that won't affect the existing suitcases, so we'll still need to do PRs into those.

danielballan commented 5 years ago

Thanks!