search for: boolify

Displaying 3 results from an estimated 3 matches for "boolify".

2020 Aug 06
4
[PATCH nbdkit] plugins: python: Add imageio plugin example
...params["transfer_url"] = value + elif key == "connections": + params["connections"] = int(value) + elif key == "ca_file": + params["ca_file"] = value + elif key == "secure": + params["secure"] = boolify(key, value) + else: + raise RuntimeError("unknown parameter: {!r}".format(key)) + + +def boolify(key, value): + v = value.lower() + if v in ("yes", "true", "1"): + return True + if v in ("no", "false", 0): +...
2020 Aug 06
0
Re: [PATCH nbdkit] plugins: python: Add imageio plugin example
..."] = value > + elif key == "connections": > + params["connections"] = int(value) > + elif key == "ca_file": > + params["ca_file"] = value > + elif key == "secure": > + params["secure"] = boolify(key, value) > + else: > + raise RuntimeError("unknown parameter: {!r}".format(key)) > + > + > +def boolify(key, value): > + v = value.lower() > + if v in ("yes", "true", "1"): > + return True > + if v in (&...
2020 Aug 08
0
Re: [PATCH nbdkit] plugins: python: Add imageio plugin example
...l-quoted (in the unlikely case that someone has an 'nbd:' subdirectory that could interfere with shell globbing). > +# > +# Downloading image is not efficient with this version, since we don't report > +# extents yet. I'll push the obvious typo fixes. > + > +def boolify(key, value): > + v = value.lower() > + if v in ("yes", "true", "1"): > + return True > + if v in ("no", "false", 0): > + return False > + raise RuntimeError("Invalid boolean value for {}: {!r}".f...