AbjadConfiguration

class systemtools.AbjadConfiguration

Abjad configuration.

>>> abjad_configuration = systemtools.AbjadConfiguration()
>>> abjad_configuration['accidental_spelling']
'mixed'

AbjadConfiguration creates the $HOME/.abjad/ directory on instantiation.

AbjadConfiguration then attempts to read an abjad.cfg file in that directory and parse the file as a ConfigParser configuration.

AbjadConfiguration generates a default configuration if no file is found.

AbjadConfiguration validates the ConfigParser instance and replaces key-value pairs which fail validation with default values.

If the validated configuration differs from the original on disk, AbjadConfiguration writes the validated configuration back to disk.

The Abjad output directory is created the from abjad_output_directory key if it does not already exist.

AbjadConfiguration supports the mutable mapping interface and can be subscripted as a dictionary.

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.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_systemtools { graph [label=systemtools]; "abjad.tools.systemtools.AbjadConfiguration.AbjadConfiguration" [color=black, fontcolor=white, group=2, label=<<B>AbjadConfiguration</B>>, shape=box, style="filled, rounded"]; "abjad.tools.systemtools.Configuration.Configuration" [color=3, group=2, label=Configuration, shape=oval, style=bold]; "abjad.tools.systemtools.Configuration.Configuration" -> "abjad.tools.systemtools.AbjadConfiguration.AbjadConfiguration"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.systemtools.Configuration.Configuration"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

abjad_boilerplate_directory Gest Abjad boilerplate directory.
abjad_directory Gets Abjad directory.
abjad_experimental_directory Gets Abjad experimental directory.
abjad_output_directory Gets Abjad output directory.
abjad_root_directory Gets Abjad root directory.
configuration_directory_name Gets configuration directory name.
configuration_directory_path Gets configuration directory path.
configuration_file_name Gets configuration file name.
configuration_file_path Gets configuration file path.
get(\*args, \*\*kwargs) Get a key.
get_abjad_startup_string(class_) Gets Abjad startup string.
get_abjad_version_string() Gets Abjad version string.
get_lilypond_minimum_version_string(class_) Gets LilyPond minimum version string.
get_lilypond_version_string() Gets LilyPond version string.
get_python_version_string() Gets Python version string.
get_tab_width() Gets tab width.
get_text_editor() Gets text editor.
home_directory Gets home directory.
lilypond_log_file_path Gets LilyPond log file path.
list_package_dependency_versions() Lists package dependency versions.
set_default_accidental_spelling([spelling]) Sets default accidental spelling.
temp_directory Gets system temp directory.
__delitem__(i) Deletes item i from configuration.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__getitem__(i) Gets item i from configuration.
__hash__() Hashes Abjad object.
__iter__() Iterates configuration settings.
__len__() Gets the number of settings in configuration.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.
__setitem__(i, arg) Sets configuration item i to arg.

Read-only properties

AbjadConfiguration.abjad_boilerplate_directory

Gest Abjad boilerplate directory.

Return string.

AbjadConfiguration.abjad_directory

Gets Abjad directory.

Returns string.

AbjadConfiguration.abjad_experimental_directory

Gets Abjad experimental directory.

Returns string.

AbjadConfiguration.abjad_output_directory

Gets Abjad output directory.

Returns string.

AbjadConfiguration.abjad_root_directory

Gets Abjad root directory.

Returns string.

AbjadConfiguration.configuration_directory_name

Gets configuration directory name.

Returns string.

(Configuration).configuration_directory_path

Gets configuration directory path.

Defaults to $HOME/{configuration_directory_name}.

If $HOME is read-only or $HOME/{configuration_directory_name} is read-only, returns $TEMP/{configuration_directory_name}.

Also caches the initial result to reduce filesystem interaction.

Returns string.

AbjadConfiguration.configuration_file_name

Gets configuration file name.

Returns string.

(Configuration).configuration_file_path

Gets configuration file path.

Returns string.

(Configuration).home_directory

Gets home directory.

Returns string.

AbjadConfiguration.lilypond_log_file_path

Gets LilyPond log file path.

Returns string.

(Configuration).temp_directory

Gets system temp directory.

Returns string.

Methods

(Configuration).get(*args, **kwargs)

Get a key.

Class & static methods

classmethod AbjadConfiguration.get_abjad_startup_string(class_)

Gets Abjad startup string.

>>> abjad_configuration.get_abjad_startup_string()
'Abjad 2.19 (development)'

Returns string.

static AbjadConfiguration.get_abjad_version_string()

Gets Abjad version string.

>>> abjad_configuration.get_abjad_version_string()
'2.19'

Returns string.

classmethod AbjadConfiguration.get_lilypond_minimum_version_string(class_)

Gets LilyPond minimum version string.

>>> abjad_configuration.get_lilypond_minimum_version_string() 
'2.17.0'

Returns string.

static AbjadConfiguration.get_lilypond_version_string()

Gets LilyPond version string.

>>> abjad_configuration.get_lilypond_version_string() 
'2.19.1'

Returns string.

static AbjadConfiguration.get_python_version_string()

Gets Python version string.

>>> abjad_configuration.get_python_version_string() 
'2.7.5'

Returns string.

static AbjadConfiguration.get_tab_width()

Gets tab width.

>>> abjad_configuration.get_tab_width()
4

Used by code generation functions.

Returns nonnegative integer.

static AbjadConfiguration.get_text_editor()

Gets text editor.

>>> abjad_configuration.get_text_editor() 
'vim'

Returns string.

static AbjadConfiguration.list_package_dependency_versions()

Lists package dependency versions.

>>> abjad_configuration.list_package_dependency_versions() 
{'sphinx': '1.1.2', 'pytest': '2.1.2'}

Returns dictionary.

static AbjadConfiguration.set_default_accidental_spelling(spelling='mixed')

Sets default accidental spelling.

Sets default accidental spelling to sharps:

>>> abjad_configuration.set_default_accidental_spelling('sharps')
>>> [Note(13, (1, 4)), Note(15, (1, 4))]
[Note("cs''4"), Note("ds''4")]

Sets default accidental spelling to flats:

>>> abjad_configuration.set_default_accidental_spelling('flats')
>>> [Note(13, (1, 4)), Note(15, (1, 4))]
[Note("df''4"), Note("ef''4")]

Sets default accidental spelling to mixed:

>>> abjad_configuration.set_default_accidental_spelling()
>>> [Note(13, (1, 4)), Note(15, (1, 4))]
[Note("cs''4"), Note("ef''4")]

Defaults to 'mixed'.

Mixed test case must appear last here for doc tests to check correctly.

Returns none.

Special methods

(Configuration).__delitem__(i)

Deletes item i from configuration.

Returns none.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(Configuration).__getitem__(i)

Gets item i from configuration.

Returns none.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(Configuration).__iter__()

Iterates configuration settings.

Returns generator.

(Configuration).__len__()

Gets the number of settings in configuration.

Returns nonnegative integer.

(AbjadObject).__ne__(expr)

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

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(Configuration).__setitem__(i, arg)

Sets configuration item i to arg.

Returns none.