Contents
Converters for boolean and HTML
Converts a string to a boolean
This converts the values “true”, “t”, “yes”, “y”, “on”, and “1” into true, and “false”, “f”, “no”, “n”, “off” and “0” into false. Non-string values are left alone. Other strings are errors.
Converts filenames to file: URLs and back again
‘imports’ a string – converts a string to a Python object, importing any necessary modules and evaluating the expression. Everything before the : in an import expression is the module path; everything after is an expression to be evaluated in the namespace of that module.
Alternately, if no : is present, then import the modules and get the attributes as necessary. Arbitrary expressions are not allowed in that case.
Import a module, or import an object from a module.
A module name like foo.bar:baz() can be used, where foo.bar is the module, and baz() is an expression evaluated in the context of that module. Note this is not safe on arbitrary strings because of the eval.
Import a module, or import an object from a module.
A name like foo.bar.baz can be a module foo.bar.baz or a module foo.bar with an object baz in it, or a module foo with an object bar with an attribute baz.
Implements NestedDict
A simple implementation of URI templates. Note: this is incomplete!
This only implements simple {var} substitution, not any of the other operations in the URI template (unfinished) spec.
Does URI template substitution
This only substitutes simple {var}, none of the fancier substitution techniques.