Ejemplo n.º 1
0
    def tabulate_well_formedness_violations(self):
        r'''Tabulates well-formedness violations in client.

        ..  container:: example

            ::

                >>> staff = Staff("c'8 d'8 e'8 f'8")
                >>> staff[1].written_duration = Duration(1, 4)
                >>> beam = spannertools.Beam()
                >>> attach(beam, staff[:])

            ..  doctest::

                >>> print(format(staff))
                \new Staff {
                    c'8 [
                    d'4
                    e'8
                    f'8 ]
                }

            ::

                >>> result = inspect_(staff).tabulate_well_formedness_violations()

            ::

                >>> print(result)
                1 / 4 beamed quarter notes
                0 / 1 discontiguous spanners
                0 / 5 duplicate ids
                0 / 0 intermarked hairpins
                0 / 0 misdurated measures
                0 / 0 misfilled measures
                0 / 4 mispitched ties
                0 / 4 misrepresented flags
                0 / 5 missing parents
                0 / 0 nested measures
                0 / 1 overlapping beams
                0 / 0 overlapping glissandi
                0 / 0 overlapping octavation spanners
                0 / 0 short hairpins

            Beamed quarter notes are not well formed.

        Returns string.
        '''
        from abjad.tools import systemtools
        manager = systemtools.WellformednessManager(self._client)
        triples = manager()
        strings = []
        for violators, total, check_name in triples:
            violator_count = len(violators)
            string = '{} /\t{} {}'
            check_name = check_name.replace('check_', '')
            check_name = check_name.replace('_', ' ')
            string = string.format(violator_count, total, check_name)
            strings.append(string)
        return '\n'.join(strings)
Ejemplo n.º 2
0
    def is_well_formed(self):
        r'''Is true when client is well-formed.
        Otherwise false.

        Returns false.
        '''
        from abjad.tools import systemtools
        manager = systemtools.WellformednessManager()
        for violators, total, check_name in manager(self._client):
            if violators:
                return False
        return True
Ejemplo n.º 3
0
    def get_badly_formed_components(self):
        r'''Gets badly formed components in client.

        ..  container:: example

            ::

                >>> staff = Staff("c'8 d'8 e'8 f'8")
                >>> staff[1].written_duration = Duration(1, 4)
                >>> beam = spannertools.Beam()
                >>> attach(beam, staff[:])

            ..  doctest::

                >>> print(format(staff))
                \new Staff {
                    c'8 [
                    d'4
                    e'8
                    f'8 ]
                }

            ::

                >>> inspect_(staff).get_badly_formed_components()
                [Note("d'4")]

            (Beamed quarter notes are not well formed.)

        Returns list.
        '''
        from abjad.tools import systemtools
        manager = systemtools.WellformednessManager(self._client)
        violators = []
        for current_violators, total, check_name in manager():
            violators.extend(current_violators)
        return violators