Example #1
0
 def _get_format_specification(self):
     return FormatSpecification(
         self,
         repr_is_indented=False,
         storage_format_args_values=[self.name],
         storage_format_is_indented=False,
     )
Example #2
0
 def _get_format_specification(self):
     values = [self.symbol]
     return FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
         )
Example #3
0
 def _get_format_specification(self):
     return FormatSpecification(
         client=self,
         storage_format_args_values=[self.numerator, self.denominator],
         storage_format_is_indented=False,
         storage_format_kwargs_names=[],
     )
Example #4
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 FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_kwargs_names=['name'],
         repr_args_values=[items],
         storage_format_args_values=[tuple(self._collection)],
     )
Example #5
0
 def _get_format_specification(self):
     values = [self.value]
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_is_indented=False,
         storage_format_args_values=values,
         )
Example #6
0
 def _get_format_specification(self):
     return FormatSpecification(
         self,
         coerce_for_equality=True,
         repr_is_indented=False,
         storage_format_args_values=[self.range_string],
         storage_format_is_indented=False,
     )
Example #7
0
 def _get_format_specification(self):
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_args_values=[self.name],
         storage_format_is_indented=False,
         storage_format_kwargs_names=['arrow'],
     )
Example #8
0
 def _get_format_specification(self):
     return FormatSpecification(
         client=self,
         coerce_for_equality=True,
         repr_is_indented=False,
         storage_format_is_indented=False,
         storage_format_args_values=[self.number],
     )
Example #9
0
 def _get_format_specification(self):
     values = [self.name]
     if self.direction is not None:
         values.append(self.direction)
     return FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_is_indented=False,
     )
Example #10
0
 def _get_format_specification(self):
     repr_items = self._get_sorted_repr_items()
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_args_values=[repr_items],
         storage_format_args_values=[repr_items],
         storage_format_kwargs_names=[],
     )
Example #11
0
 def _get_format_specification(self):
     return FormatSpecification(
         self,
         coerce_for_equality=True,
         repr_is_indented=False,
         storage_format_args_values=[self.name],
         storage_format_is_indented=False,
         storage_format_kwargs_names=['arrow'],
         )
Example #12
0
 def _get_format_specification(self):
     values = [self.name]
     return FormatSpecification(
         client=self,
         coerce_for_equality=True,
         storage_format_is_indented=False,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
         )
Example #13
0
 def _get_format_specification(self):
     values = self._value
     if String.is_string(self._value):
         values = [self._value]
     return FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_kwargs_names=[],
         )
Example #14
0
 def _get_format_specification(self):
     names = []
     if not self.format_slot == 'opening':
         names.append('format_slot')
     return FormatSpecification(
         client=self,
         storage_format_args_values=[self.argument],
         storage_format_kwargs_names=names,
         storage_format_is_indented=False,
     )
Example #15
0
 def _get_format_specification(self):
     values = []
     summary = self._get_contents_summary()
     if summary:
         values.append(summary)
     return FormatSpecification(
         client=self,
         repr_args_values=values,
         storage_format_kwargs_names=[],
     )
Example #16
0
 def _get_format_specification(self):
     summary = self._get_compact_representation()
     return 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=[],
     )
Example #17
0
 def _get_format_specification(self):
     names = []
     values = [(self.numerator, self.denominator)]
     if self._get_displacement():
         names = ["displacement"]
     return FormatSpecification(
         client=self,
         storage_format_args_values=values,
         storage_format_is_indented=False,
         storage_format_kwargs_names=names,
     )
Example #18
0
 def _get_format_specification(self):
     storage_format_is_indented = False
     if self.partial is not None or self.hide is not None:
         storage_format_is_indented = True
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         storage_format_args_values=[self.pair],
         storage_format_kwargs_names=["partial", "hide"],
         storage_format_is_indented=storage_format_is_indented,
     )
Example #19
0
 def _get_format_specification(self):
     manager = StorageFormatManager(self)
     names = list(manager.signature_keyword_names)
     if "items" in names:
         names.remove("items")
     return FormatSpecification(
         self,
         repr_is_indented=False,
         storage_format_args_values=[self._collection],
         storage_format_kwargs_names=names,
     )
Example #20
0
 def _get_format_specification(self):
     agent = StorageFormatManager(self)
     names = list(agent.signature_keyword_names)
     if self._get_compact_summary() == '':
         values = []
     else:
         values = [self._get_compact_summary()]
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_args_values=values,
         storage_format_kwargs_names=names,
         )
Example #21
0
 def _get_format_specification(self):
     keywords = ["command", "direction", "hide", "leak"]
     if self._ordinal is not None:
         keywords.append("ordinal")
     keywords.append("name_is_textual")
     if self._sforzando is not None:
         keywords.append("sforzando")
     return FormatSpecification(
         self,
         repr_is_indented=False,
         storage_format_args_values=[self.name],
         storage_format_is_indented=False,
         storage_format_kwargs_names=keywords,
     )
Example #22
0
 def _get_format_specification(self):
     keywords = ['command', 'direction', 'hide', 'leak']
     if self._ordinal is not None:
         keywords.append('ordinal')
     keywords.append('name_is_textual')
     if self._sforzando is not None:
         keywords.append('sforzando')
     return FormatSpecification(
         self,
         repr_is_indented=False,
         storage_format_args_values=[self.name],
         storage_format_is_indented=False,
         storage_format_kwargs_names=keywords,
     )
Example #23
0
 def _get_format_specification(self):
     agent = StorageFormatManager(self)
     names = list(agent.signature_keyword_names)
     if 'client' in names:
         names.remove('client')
     if 'items' in names:
         names.remove('items')
     if 'keep_sorted' in names:
         names.remove('keep_sorted')
     return FormatSpecification(
         self,
         repr_is_indented=False,
         storage_format_args_values=[self._collection],
         storage_format_kwargs_names=names,
     )
Example #24
0
 def _get_format_specification(self):
     arguments = [repr(str(self))]
     if self.tweaks:
         arguments.extend(self.tweaks._get_attribute_pairs())
     arguments = ", ".join([str(_) for _ in arguments])
     repr_text = f"{type(self).__name__}({arguments})"
     manager = StorageFormatManager(self)
     names = list(manager.signature_keyword_names)
     if "client" in names:
         names.remove("client")
     if "tweaks" in names:
         names.remove("tweaks")
     return FormatSpecification(
         self, repr_text=repr_text, storage_format_kwargs_names=names
     )
Example #25
0
 def _get_format_specification(self):
     if self.item_class.__name__.startswith("Named"):
         repr_items = {str(k): v for k, v in self.items()}
     else:
         repr_items = {
             mathtools.integer_equivalent_number_to_integer(float(
                 k.number)): v
             for k, v in self.items()
         }
     return FormatSpecification(
         client=self,
         repr_is_indented=False,
         repr_args_values=[repr_items],
         storage_format_args_values=[self._collection],
     )
Example #26
0
 def _get_format_specification(self):
     repr_args_values = [self.section]
     if self.token is not None:
         repr_args_values.append(self.token)
     repr_is_indented = False
     repr_kwargs_names = []
     return FormatSpecification(
         self,
         repr_args_values=repr_args_values,
         repr_is_indented=repr_is_indented,
         repr_kwargs_names=repr_kwargs_names,
         storage_format_args_values=repr_args_values,
         storage_format_is_indented=repr_is_indented,
         storage_format_kwargs_names=repr_kwargs_names,
     )
Example #27
0
 def _get_format_specification(self):
     arguments = [repr(str(self))]
     arguments.extend(self.tweaks._get_attribute_pairs())
     arguments = ', '.join([str(x) for x in arguments])
     repr_text = f'{type(self).__name__}({arguments})'
     agent = StorageFormatManager(self)
     names = list(agent.signature_keyword_names)
     if 'client' in names:
         names.remove('client')
     if 'tweaks' in names:
         names.remove('tweaks')
     return FormatSpecification(
         self,
         repr_text=repr_text,
         storage_format_kwargs_names=names,
         )
Example #28
0
    def _get_format_specification(self):
        from abjad.system.FormatSpecification import FormatSpecification

        is_indented = False
        names = []
        values = [self.numerator, self.denominator]
        if self._get_grace_displacement():
            is_indented = True
            names = ["grace_displacement"]
            values = [(self.numerator, self.denominator)]
        return FormatSpecification(
            client=self,
            repr_is_indented=is_indented,
            storage_format_args_values=values,
            storage_format_is_indented=is_indented,
            storage_format_kwargs_names=names,
        )
Example #29
0
 def _get_format_specification(self):
     repr_text = None
     repr_args_values = []
     repr_kwargs_names = self._get_repr_kwargs_names()
     storage_format_args_values = []
     if self:
         repr_args_values.append(self._get_contents_summary())
         lilypond_format = ' '.join(format(x, 'lilypond') for x in self)
         lilypond_format = lilypond_format.replace('\n', ' ')
         lilypond_format = lilypond_format.replace('\t', ' ')
         lilypond_format = lilypond_format.replace('  ', ' ')
         storage_format_args_values.append(lilypond_format)
         if not self[:].are_leaves():
             repr_text = self._get_abbreviated_string_format()
     return FormatSpecification(
         client=self,
         repr_args_values=repr_args_values,
         repr_kwargs_names=repr_kwargs_names,
         repr_text=repr_text,
         storage_format_args_values=storage_format_args_values,
         )
Example #30
0
 def _get_format_specification(self):
     return FormatSpecification(client=self)