Exemplo n.º 1
0
 def _get_format_specification(self):
     values = self._value
     if stringtools.is_string(self._value):
         values = [self._value]
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
         )
Exemplo n.º 2
0
 def _storage_format_specification(self):
     from abjad.tools import systemtools
     if stringtools.is_string(self._value):
         positional_argument_values = (self._value,)
     else:
         positional_argument_values = self._value
     return systemtools.StorageFormatSpecification(
         self,
         positional_argument_values=positional_argument_values,
         )
Exemplo n.º 3
0
 def _storage_format_specification(self):
     from abjad.tools import systemtools
     if stringtools.is_string(self._value):
         positional_argument_values = (self._value, )
     else:
         positional_argument_values = self._value
     return systemtools.StorageFormatSpecification(
         self,
         positional_argument_values=positional_argument_values,
     )
Exemplo n.º 4
0
 def __init__(self, *args):
     from abjad.tools import pitchtools
     if args and \
         isinstance(args[0], collections.Iterable) and \
         not stringtools.is_string(args[0]) and \
         len(args) == 1:
         args = args[0]
     if len(args) == 1:
         if isinstance(args[0], (int, float)):
             arg = mathtools.integer_equivalent_number_to_integer(
                 float(args[0]))
             self._initialize_by_pitch_number(arg)
         elif isinstance(args[0], type(self)):
             self._initialize_by_named_pitch(*args)
         elif isinstance(args[0], pitchtools.NumberedPitch):
             self._initialize_by_pitch_number(
                 args[0].pitch_number)
         elif isinstance(args[0], pitchtools.PitchClass):
             self._initialize_by_named_pitch_class_and_octave_number(
                 pitchtools.NamedPitchClass(args[0]), 4)
         elif hasattr(args[0], 'named_pitch'):
             self._initialize_by_named_pitch(args[0].named_pitch)
         elif self.is_pitch_class_octave_number_string(args[0]):
             self._initialize_by_pitch_class_octave_number_string(*args)
         elif isinstance(args[0], str):
             self._initialize_by_pitch_name(*args)
         else:
             message = 'can not initialize {} from {!r}.'
             message = message.format(type(self).__name__, args)
             raise ValueError(message)
     elif len(args) == 2:
         if isinstance(args[0], str):
             self._initialize_by_pitch_class_name_and_octave_number(*args)
         elif isinstance(args[0], pitchtools.NamedPitchClass):
             self._initialize_by_named_pitch_class_and_octave_number(*args)
         elif isinstance(args[0], (int, float)):
             if isinstance(args[1], str):
                 self._initialize_by_pitch_number_and_diatonic_pitch_class_name(
                     *args)
             elif isinstance(args[1], pitchtools.NamedPitchClass):
                 self._initialize_by_pitch_number_and_named_pitch_class(*args)
             else:
                 raise TypeError
         else:
             message = 'can not initialize {}: {!r}.'
             message = message.format(type(self).__name__, args)
             raise ValueError(message)
     elif len(args) == 0:
         self._initialize_by_pitch_class_name_and_octave_number('c', 4)
     else:
         message = 'can not initialize {}: {!r}.'
         message = message.format(type(self).__name__, args)
         raise ValueError(message)
Exemplo n.º 5
0
 def __init__(
     self,
     context_name=None,
     optional_id=None,
     optional_context_mod=None,
     music=None,
 ):
     from abjad.tools import lilypondparsertools
     context_name = context_name or ''
     music = music or lilypondparsertools.SequentialMusic()
     assert stringtools.is_string(context_name)
     assert isinstance(music, Music)
     self.context_name = context_name
     self.optional_id = optional_id
     self.optional_context_mod = optional_context_mod
     self.music = music
Exemplo n.º 6
0
 def _storage_format_specification(self):
     from abjad.tools import systemtools
     if stringtools.is_string(self._value):
         positional_argument_values = (self._value, )
     else:
         positional_argument_values = self._value
     keyword_argument_names = []
     if self.force_quotes:
         keyword_argument_names.append('force_quotes')
     if self.quoting:
         keyword_argument_names.append('quoting')
     return systemtools.StorageFormatSpecification(
         self,
         keyword_argument_names=keyword_argument_names,
         positional_argument_values=positional_argument_values,
     )
Exemplo n.º 7
0
 def _storage_format_specification(self):
     from abjad.tools import systemtools
     if stringtools.is_string(self._value):
         positional_argument_values = (self._value,)
     else:
         positional_argument_values = self._value
     keyword_argument_names = []
     if self.force_quotes:
         keyword_argument_names.append('force_quotes')
     if self.quoting:
         keyword_argument_names.append('quoting')
     return systemtools.StorageFormatSpecification(
         self,
         keyword_argument_names=keyword_argument_names,
         positional_argument_values=positional_argument_values,
         )
Exemplo n.º 8
0
 def __init__(
     self,
     context_name=None,
     optional_id=None,
     optional_context_mod=None,
     music=None,
     ):
     from abjad.tools import lilypondparsertools
     context_name = context_name or ''
     music = music or lilypondparsertools.SequentialMusic()
     assert stringtools.is_string(context_name)
     assert isinstance(music, Music)
     self.context_name = context_name
     self.optional_id = optional_id
     self.optional_context_mod = optional_context_mod
     self.music = music
Exemplo n.º 9
0
 def _get_format_specification(self):
     if stringtools.is_string(self._value):
         values = [self._value]
     elif isinstance(self._value, collections.Iterable):
         values = self._value
     else:
         values = [self._value]
     names = []
     if self.force_quotes:
         names.append('force_quotes')
     if self.quoting:
         names.append('quoting')
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=names,
     )
Exemplo n.º 10
0
 def text(self, arg):
     assert stringtools.is_string(arg)
     arg = arg.strip()
     self._text = arg