API Reference¶
A start on a more complete, method-by-method reference:
-
class
quoter.Quoter(*args, **kwargs)¶ A quote style. Instantiate it with the style information. Call it with a value to quote the value.
-
__call__(*args, **kwargs)¶ Quote the value, according to the current options.
-
__init__(*args, **kwargs)¶ Create a quoting style.
-
but(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
clone(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
options= Options(suffix=None, sep='', encoding=None, padding=0, prefix=None, pair=Transient, margin=0)¶
-
set(*args, **kwargs)¶ Change the receiver’s settings to those defined in the kwargs. An update-like function. This uplevels calls that would look like
Class.options.set(...)to the simplerClass.set(...). Works on either class or instance receivers. Requires that one uses the instance variableoptionsto store persistent configuration data.
-
settings(**kwargs)¶ Open a context manager for a with statement. Temporarily change settings for the duration of the with.
-
-
class
quoter.LambdaQuoter(*args, **kwargs)¶ A Quoter that uses code to decide what quotes to use, based on the value.
-
__call__(value, **kwargs)¶ Quote the value, based on the instance’s function.
-
__init__(*args, **kwargs)¶ Create a quoting style.
-
but(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
clone(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
options= Options(suffix=Prohibited, sep='', encoding=None, padding=0, prefix=Prohibited, func=None, pair=Prohibited, margin=0)¶
-
set(*args, **kwargs)¶ Change the receiver’s settings to those defined in the kwargs. An update-like function. This uplevels calls that would look like
Class.options.set(...)to the simplerClass.set(...). Works on either class or instance receivers. Requires that one uses the instance variableoptionsto store persistent configuration data.
-
settings(**kwargs)¶ Open a context manager for a with statement. Temporarily change settings for the duration of the with.
-
-
class
quoter.XMLQuoter(*args, **kwargs)¶ A more sophisticated quoter for XML elements that manages tags, namespaces, and the idea that some elements may not have contents.
-
__call__(*args, **kwargs)¶ Quote a value in X/HTML style, with optional attributes.
-
__init__(*args, **kwargs)¶ Create an XMLQuoter
-
but(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
clone(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
options= Options(atts={}, suffix=Prohibited, sep='', void=False, encoding=None, attquote=Quoter(suffix="'", sep='', encoding=None, padding=0, prefix="'", pair=Transient, margin=0), padding=0, prefix=Prohibited, tag=None, pair=Transient, ns=None, margin=0)¶
-
set(*args, **kwargs)¶ Change the receiver’s settings to those defined in the kwargs. An update-like function. This uplevels calls that would look like
Class.options.set(...)to the simplerClass.set(...). Works on either class or instance receivers. Requires that one uses the instance variableoptionsto store persistent configuration data.
-
settings(**kwargs)¶ Open a context manager for a with statement. Temporarily change settings for the duration of the with.
-
-
class
quoter.HTMLQuoter(*args, **kwargs)¶ A more sophisticated quoter that supports attributes and void elements for HTML.
-
__call__(*args, **kwargs)¶ Quote a value in X/HTML style, with optional attributes.
-
__init__(*args, **kwargs)¶
-
but(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
clone(**kwargs)¶ Create a new instance whose options are chained to this instance’s options (and thence to self.__class__.options). kwargs become the cloned instance’s overlay options.
-
options= Options(atts={}, suffix=Prohibited, sep='', void=False, encoding=None, attquote=Quoter(suffix="'", sep='', encoding=None, padding=0, prefix="'", pair=Transient, margin=0), padding=0, prefix=Prohibited, tag=None, pair=Transient, ns=Prohibited, margin=0)¶
-
set(*args, **kwargs)¶ Change the receiver’s settings to those defined in the kwargs. An update-like function. This uplevels calls that would look like
Class.options.set(...)to the simplerClass.set(...). Works on either class or instance receivers. Requires that one uses the instance variableoptionsto store persistent configuration data.
-
settings(**kwargs)¶ Open a context manager for a with statement. Temporarily change settings for the duration of the with.
-
-
quoter.quoteDefault ``StyleSet`` for ``Quoter`` objects¶ Container for named styles.
-
quoter.lambdaqDefault ``StyleSet`` for ``LambdaQuoter`` objects¶ Container for named styles.
-
quoter.xmlDefault ``StyleSet`` for ``XMLQuoter`` objects¶ Container for named styles.
-
quoter.htmlDefault ``StyleSet`` for ``HTMLQuoter`` objects¶ Container for named styles.
-
quoter.mdDefault ``StyleSet`` for ``Markdown`` objects¶ Container for named styles.