Esempio n. 1
0
 def _get_format_specification(self):
     items = []
     if self.item_class.__name__.startswith('Named'):
         items = [str(x) for x in self]
     elif hasattr(self.item_class, 'pitch_number'):
         items = [x.pitch_number for x in self]
     elif hasattr(self.item_class, 'pitch_class_number'):
         items = [x.pitch_class_number for x in self]
     elif self.item_class.__name__.startswith('Numbered'):
         items = [
             mathtools.integer_equivalent_number_to_integer(float(x.number))
             for x in self
         ]
     elif hasattr(self.item_class, '__abs__'):
         items = [abs(x) for x in self]
     else:
         message = 'invalid item class: {!r}.'
         message = message.format(self.item_class)
         raise ValueError(message)
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_kwargs_names=['name'],
         repr_args_values=[items],
         storage_format_args_values=[tuple(self._collection)],
     )
Esempio n. 2
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_args_values=[self.address] + list(self.contents),
     )
Esempio n. 3
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         self,
         repr_args_values=[],
         repr_is_indented=False,
         repr_kwargs_names=[],
     )
Esempio n. 4
0
 def _get_format_specification(self):
     values = [self.symbol]
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
     )
Esempio n. 5
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     slot_contribution_names = (
         'absolute_before',
         'absolute_after',
         'before',
         'after',
         'opening',
         'closing',
         'right',
     )
     grob_contribution_names = (
         'context_settings',
         'grob_overrides',
         'grob_reverts',
     )
     names = [
         x for x in slot_contribution_names
         if getattr(self, x).has_contributions
     ]
     names.extend(x for x in grob_contribution_names if getattr(self, x))
     return systemtools.FormatSpecification(
         client=self,
         storage_format_kwargs_names=names,
     )
Esempio n. 6
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         repr_args_values=[self.target_duration, self._contents_summary],
         storage_format_args_values=[self.target_duration, self[:]],
         storage_format_kwargs_names=[],
     )
Esempio n. 7
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=True,
         storage_format_args_values=[self.kernel],
         storage_format_kwargs_names=[],
     )
Esempio n. 8
0
 def _get_format_specification(self):
     storage_format_text = repr_text = self._representation or None
     return systemtools.FormatSpecification(
         client=self,
         repr_text=repr_text,
         storage_format_text=storage_format_text,
     )
Esempio n. 9
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_args_values=(self.command,) + self.args,
         storage_format_kwargs_names=[],
         )
Esempio n. 10
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=[self.numbers],
         storage_format_is_indented=False,
         storage_format_kwargs_names=[],
         )
Esempio n. 11
0
 def _get_format_specification(self):
     agent = systemtools.StorageFormatAgent(self)
     names = agent.signature_names
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=True,
         template_names=names,
     )
Esempio n. 12
0
 def _get_format_specification(self):
     values = [self.name] + list(self.arguments or ())
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_is_indented=False,
         storage_format_kwargs_names=[],
     )
Esempio n. 13
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     return systemtools.FormatSpecification(
         repr_is_bracketed=True,
         storage_format_is_bracketed=True,
         storage_format_is_indented=False,
         storage_format_args_values=[self.actual_name],
         storage_format_kwargs_names=[])
Esempio n. 14
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     return systemtools.FormatSpecification(
         client=self,
         repr_is_bracketed=True,
         storage_format_is_bracketed=True,
         storage_format_kwargs_names=['buffer_id'],
     )
Esempio n. 15
0
 def _get_format_specification(self):
     values = [self.figured_bass_string]
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_is_indented=False,
         storage_format_args_values=values,
     )
Esempio n. 16
0
 def _get_format_specification(self):
     values = []
     summary = self._contents_summary
     if summary:
         values.append(summary)
     return systemtools.FormatSpecification(client=self,
                                            repr_args_values=values,
                                            storage_format_kwargs_names=[])
Esempio n. 17
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=[
             self._value.numerator,
             self._value.denominator,
         ],
         storage_format_kwargs_names=[],
     )
Esempio n. 18
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_args_values=[
             self._tempo_indication,
             self._proportional_notation_duration,
         ],
     )
Esempio n. 19
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     agent = systemtools.StorageFormatManager(self)
     names = agent.signature_names
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=True,
         template_names=names,
         )
Esempio n. 20
0
 def _get_format_specification(self):
     values = []
     if self.sequence:
         values.append(self.sequence)
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
     )
Esempio n. 21
0
 def _get_format_specification(self):
     repr_items = self._get_sorted_repr_items()
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_args_values=[repr_items],
         storage_format_args_values=[repr_items],
         storage_format_kwargs_names=[],
     )
Esempio n. 22
0
 def _get_format_specification(self):
     values = self._value
     if datastructuretools.String.is_string(self._value):
         values = [self._value]
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
     )
Esempio n. 23
0
 def _get_format_specification(self):
     values = [self.name]
     if self.direction is not None:
         values.append(self.direction)
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_is_indented=False,
     )
Esempio n. 24
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     agent = systemtools.StorageFormatAgent(self)
     names = agent.signature_keyword_names
     names.extend(sorted(self._kwargs))
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=True,
         storage_format_kwargs_names=names,
     )
Esempio n. 25
0
 def _get_format_specification(self):
     values = [self.number]
     if self.accidental.is_adjusted:
         values = [self.accidental.name, self.number]
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_is_indented=False,
         storage_format_args_values=values,
     )
Esempio n. 26
0
 def _get_format_specification(self):
     summary = self._compact_representation
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_args_values=[summary],
         storage_format_args_values=[format(self, 'lilypond')],
         storage_format_is_indented=False,
         storage_format_kwargs_names=[],
     )
Esempio n. 27
0
 def _get_format_specification(self):
     values = []
     if self.q_event:
         values.append(self.q_event)
     if self.offset:
         values.append(self.offset)
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=values,
     )
Esempio n. 28
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         storage_format_args_values=self.items or (),
         storage_format_kwargs_names=[
             'beatspan',
             'search_tree',
             'tempo',
             ],
         )
Esempio n. 29
0
 def _get_format_specification(self):
     return systemtools.FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_is_indented=False,
         storage_format_args_values=[
             str(self.key_signature.tonic),
             self.key_signature.mode.mode_name,
             ],
         )
Esempio n. 30
0
 def _get_format_specification(self):
     from abjad.tools import systemtools
     agent = systemtools.StorageFormatAgent(self)
     names = list(agent.signature_keyword_names)
     for name in names[:]:
         if not getattr(self, name):
             names.remove(name)
     return systemtools.FormatSpecification(
         client=self,
         storage_format_kwargs_names=names,
         )