SchemeColor

class schemetools.SchemeColor(*arguments, **keywords)

A Scheme color.

>>> schemetools.SchemeColor('ForestGreen')
SchemeColor('ForestGreen')

Scheme colors are immutable.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_schemetools { graph [label=schemetools]; "abjad.tools.schemetools.Scheme.Scheme" [color=3, group=2, label=Scheme, shape=box]; "abjad.tools.schemetools.SchemeColor.SchemeColor" [color=black, fontcolor=white, group=2, label=<<B>SchemeColor</B>>, shape=box, style="filled, rounded"]; "abjad.tools.schemetools.Scheme.Scheme" -> "abjad.tools.schemetools.SchemeColor.SchemeColor"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.schemetools.Scheme.Scheme"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

force_quotes Is true when quotes should be forced in output.
format_embedded_scheme_value(value[, ...]) Formats value as an embedded Scheme value.
format_scheme_value(value[, force_quotes, ...]) Formats value as Scheme would.
quoting Gets Scheme quoting string.
verbatim Is true when formatting should format value absolutely verbatim.
__copy__(*arguments) Copies Abjad value object.
__eq__(argument) Is true when all initialization values of Abjad value object equal the initialization values of argument.
__format__([format_specification]) Formats scheme.
__hash__() Hashes Abjad value object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.
__str__() String representation of scheme object.

Read-only properties

(Scheme).force_quotes

Is true when quotes should be forced in output. Otherwise false.

Returns true or false.

(Scheme).quoting

Gets Scheme quoting string.

Returns string.

(Scheme).verbatim

Is true when formatting should format value absolutely verbatim. Whitespace, quotes, and all other parts of value are left intact.

Defaults to false.

Set to true or false.

Returns true or false.

Class & static methods

(Scheme).format_embedded_scheme_value(value, force_quotes=False)

Formats value as an embedded Scheme value.

(Scheme).format_scheme_value(value, force_quotes=False, verbatim=False)

Formats value as Scheme would.

Example 1. Some basic values:

>>> schemetools.Scheme.format_scheme_value(1)
'1'
>>> schemetools.Scheme.format_scheme_value('foo')
'foo'
>>> schemetools.Scheme.format_scheme_value('bar baz')
'"bar baz"'
>>> schemetools.Scheme.format_scheme_value([1.5, True, False])
'(1.5 #t #f)'

Example 2. Strings without whitespace can be forcibly quoted via the force_quotes keyword:

>>> schemetools.Scheme.format_scheme_value(
...     'foo',
...     force_quotes=True,
...     )
'"foo"'

Example 3. Set verbatim to true to format value exactly (with only hash preprended):

>>> string = '(lambda (grob) (grob-interpret-markup grob'
>>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))'
>>> schemetools.Scheme.format_scheme_value(string, verbatim=True)
'(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'

Example 4. Hash symbols in strings will result in quoted output unless verbatim is True, in order to prevent LilyPond parsing errors:

>>> string = '#1-finger'
>>> schemetools.Scheme.format_scheme_value(string)
'"#1-finger"'
>>> schemetools.Scheme.format_scheme_value(string, verbatim=True)
'#1-finger'

Returns string.

Special methods

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(Scheme).__format__(format_specification='')

Formats scheme.

Set format_specification to ‘’‘, ‘lilypond’ or 'storage'. Interprets ‘’ equal to ‘lilypond’.

Example 1. Scheme LilyPond format:

>>> scheme = schemetools.Scheme('foo')
>>> format(scheme)
'#foo'

Example 2. Scheme storage format:

>>> print(format(scheme, 'storage'))
schemetools.Scheme(
    'foo'
    )

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(Scheme).__str__()

String representation of scheme object.

Returns string.