Exemplo n.º 1
0
 def _is_length_tuple(expr):
     if expr is None:
         return True
     if mathtools.all_are_nonnegative_integer_equivalent_numbers(expr):
         if isinstance(expr, tuple):
             return True
     return False
 def __init__(
     self,
     counts=(1,),
     only_if_preceded_by_nonsilence=None,
     only_if_preceded_by_silence=None,
     ):
     if not counts:
         counts = (0,),
     if not isinstance(counts, collections.Sequence):
         counts = (counts,)
     assert len(counts)
     assert mathtools.all_are_nonnegative_integer_equivalent_numbers(
         counts)
     self._counts = abjad.CyclicTuple(counts)
     if only_if_preceded_by_nonsilence is not None:
         only_if_preceded_by_nonsilence = bool(
             only_if_preceded_by_nonsilence)
     if only_if_preceded_by_silence is not None:
         only_if_preceded_by_silence = bool(
             only_if_preceded_by_silence)
     assert not (
         only_if_preceded_by_silence and only_if_preceded_by_nonsilence
         )
     self._only_if_preceded_by_silence = only_if_preceded_by_silence
     self._only_if_preceded_by_nonsilence = only_if_preceded_by_nonsilence
Exemplo n.º 3
0
 def _is_length_tuple(expr):
     if expr is None:
         return True
     if mathtools.all_are_nonnegative_integer_equivalent_numbers(expr):
         if isinstance(expr, (tuple, list)):
             return True
     return False
Exemplo n.º 4
0
 def __init__(
     self,
     beam_specifier=None,
     duration_spelling_specifier=None,
     division_masks=None,
     extra_counts_per_division=None,
     incise_specifier=None,
     logical_tie_masks=None,
     split_divisions_by_counts=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     helper_functions=None,
     ):
     from abjad.tools import rhythmmakertools
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         division_masks=division_masks,
         logical_tie_masks=logical_tie_masks,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
         )
     prototype = (rhythmmakertools.InciseSpecifier, type(None))
     assert isinstance(incise_specifier, prototype)
     self._incise_specifier = incise_specifier
     if extra_counts_per_division is not None:
         extra_counts_per_division = tuple(extra_counts_per_division)
     if split_divisions_by_counts is not None:
         split_divisions_by_counts = tuple(split_divisions_by_counts)
     assert extra_counts_per_division is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         extra_counts_per_division), extra_counts_per_division
     assert split_divisions_by_counts is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         split_divisions_by_counts), split_divisions_by_counts
     self._extra_counts_per_division = extra_counts_per_division
     self._split_divisions_by_counts = split_divisions_by_counts
     if helper_functions is not None:
         assert isinstance(helper_functions, dict)
         for name in helper_functions:
             function = helper_functions.get(name)
             assert callable(function)
     self._helper_functions = helper_functions
Exemplo n.º 5
0
 def __init__(
     self,
     incise_specifier=None,
     split_divisions_by_counts=None,
     extra_counts_per_division=None,
     beam_specifier=None,
     duration_spelling_specifier=None,
     output_masks=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     helper_functions=None,
 ):
     from abjad.tools import rhythmmakertools
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         output_masks=output_masks,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
     )
     prototype = (rhythmmakertools.InciseSpecifier, type(None))
     assert isinstance(incise_specifier, prototype)
     self._incise_specifier = incise_specifier
     extra_counts_per_division = \
         self._to_tuple(extra_counts_per_division)
     split_divisions_by_counts = \
         self._to_tuple(split_divisions_by_counts)
     assert extra_counts_per_division is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         extra_counts_per_division), extra_counts_per_division
     assert split_divisions_by_counts is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         split_divisions_by_counts), split_divisions_by_counts
     self._extra_counts_per_division = extra_counts_per_division
     self._split_divisions_by_counts = split_divisions_by_counts
     if helper_functions is not None:
         assert isinstance(helper_functions, dict)
         for name in helper_functions:
             function = helper_functions.get(name)
             assert callable(function)
     self._helper_functions = helper_functions