pint.utils.open_or_use

pint.utils.open_or_use(f, mode='r')[source]

Open a filename or use an open file.

Specifically, if f is a string, try to use it as an argument to open. Otherwise just yield it. In particular anything that is not a subclass of str will be passed through untouched.