# Path: moonlight/glyphs/glyph_types.py
# def is_notehead(glyph):
# def is_stemmed_notehead(glyph):
# def is_beamed_notehead(glyph):
# def is_dotted_notehead(glyph):
# def is_clef(glyph):
# def is_rest(glyph):
# 
# Path: moonlight/glyphs/note_dots.py
# COMPONENTS = components.ConnectedComponentsColumns
# class NoteDots(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _is_in_range(min_value, values, max_value):
# def _extract_dots(structure):
# 
# Path: moonlight/glyphs/repeated.py
# class FixRepeatedRests(object):
#   def apply(self, page):
# 
# Path: moonlight/staves/staff_processor.py
# class StaffProcessor(object):
#   def __init__(self, structure, staffline_extractor):
#   def apply(self, page):
# 
# Path: moonlight/structure/barlines.py
# class Barlines(object):
#   def __init__(self, structure, close_barline_threshold=None):
#   def apply(self, page):
#   def _assign_barlines(self, systems):
#           def get_span(barline):
#   def _get_blacklist_x(self, system):
# def assign_barlines_to_staves(barline_x, barline_y0, barline_y1,
#                               staff_detector):
# 
# Path: moonlight/structure/beam_processor.py
# COLUMNS = components.ConnectedComponentsColumns
# class BeamProcessor(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _get_overlapping_beams(stem, beams):
# def _maybe_duplicate_beams(beams, staffline_distance):
#   def _estimate_num_beams(beam):
# def _do_intervals_overlap(intervals_a, intervals_b):
#   def contained(points, intervals):
# 
# Path: moonlight/structure/section_barlines.py
# COLUMNS = components_module.ConnectedComponentsColumns
# class SectionBarlines(object):
# class MergeStandardAndBeginRepeatBars(object):
#   def __init__(self, structure):
#   def apply(self, page):
#   def _section_min_width(self):
#   def _section_max_width(self, staff_index):
#   def __init__(self, structure):
#   def apply(self, page):
# 
# Path: moonlight/structure/stems.py
# _MIN_STEM_HEIGHT_STAFFLINE_DISTANCE = 2.5
# _STEM_NOTEHEAD_HORIZONTAL_STAFFLINE_DISTANCE = 0.5
# _STEM_NOTEHEAD_DISTANCE_STAFFLINE_DISTANCE = 0.5
# class Stems(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _get_stem_candidates(staffline_distance, verticals):


from moonlight.glyphs import glyph_types
from moonlight.glyphs import note_dots
from moonlight.glyphs import repeated
from moonlight.staves import staff_processor
from moonlight.structure import barlines
from moonlight.structure import beam_processor
from moonlight.structure import section_barlines
from moonlight.structure import stems
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



def create_processors(structure, staffline_extractor=None):
  """Generator for the processors to be applied to the Page in order.

  Args:
    structure: The computed `Structure`.
    staffline_extractor: The staffline extractor to use for scaling glyph x
      coordinates. Optional.

  Yields:
    Callables which accept a single `Page` as an argument, and return it
      (either modifying in place or returning a modified copy).
  """
  yield staff_processor.StaffProcessor(structure, staffline_extractor)
  yield stems.Stems(structure)
  yield beam_processor.BeamProcessor(structure)
  yield note_dots.NoteDots(structure)

  yield CenteredRests()
  yield repeated.FixRepeatedRests()

  yield barlines.Barlines(structure)
  yield section_barlines.SectionBarlines(structure)

# Path: moonlight/glyphs/glyph_types.py
# def is_notehead(glyph):
# def is_stemmed_notehead(glyph):
# def is_beamed_notehead(glyph):
# def is_dotted_notehead(glyph):
# def is_clef(glyph):
# def is_rest(glyph):
# 
# Path: moonlight/glyphs/note_dots.py
# COMPONENTS = components.ConnectedComponentsColumns
# class NoteDots(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _is_in_range(min_value, values, max_value):
# def _extract_dots(structure):
# 
# Path: moonlight/glyphs/repeated.py
# class FixRepeatedRests(object):
#   def apply(self, page):
# 
# Path: moonlight/staves/staff_processor.py
# class StaffProcessor(object):
#   def __init__(self, structure, staffline_extractor):
#   def apply(self, page):
# 
# Path: moonlight/structure/barlines.py
# class Barlines(object):
#   def __init__(self, structure, close_barline_threshold=None):
#   def apply(self, page):
#   def _assign_barlines(self, systems):
#           def get_span(barline):
#   def _get_blacklist_x(self, system):
# def assign_barlines_to_staves(barline_x, barline_y0, barline_y1,
#                               staff_detector):
# 
# Path: moonlight/structure/beam_processor.py
# COLUMNS = components.ConnectedComponentsColumns
# class BeamProcessor(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _get_overlapping_beams(stem, beams):
# def _maybe_duplicate_beams(beams, staffline_distance):
#   def _estimate_num_beams(beam):
# def _do_intervals_overlap(intervals_a, intervals_b):
#   def contained(points, intervals):
# 
# Path: moonlight/structure/section_barlines.py
# COLUMNS = components_module.ConnectedComponentsColumns
# class SectionBarlines(object):
# class MergeStandardAndBeginRepeatBars(object):
#   def __init__(self, structure):
#   def apply(self, page):
#   def _section_min_width(self):
#   def _section_max_width(self, staff_index):
#   def __init__(self, structure):
#   def apply(self, page):
# 
# Path: moonlight/structure/stems.py
# _MIN_STEM_HEIGHT_STAFFLINE_DISTANCE = 2.5
# _STEM_NOTEHEAD_HORIZONTAL_STAFFLINE_DISTANCE = 0.5
# _STEM_NOTEHEAD_DISTANCE_STAFFLINE_DISTANCE = 0.5
# class Stems(object):
#   def __init__(self, structure):
#   def apply(self, page):
# def _get_stem_candidates(staffline_distance, verticals):


# Path: moonlight/page_processors.py
from moonlight.glyphs import glyph_types
from moonlight.glyphs import note_dots
from moonlight.glyphs import repeated
from moonlight.staves import staff_processor
from moonlight.structure import barlines
from moonlight.structure import beam_processor
from moonlight.structure import section_barlines
from moonlight.structure import stems

"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



def create_processors(structure, staffline_extractor=None):
  """Generator for the processors to be applied to the Page in order.

  Args:
    structure: The computed `Structure`.
    staffline_extractor: The staffline extractor to use for scaling glyph x
      coordinates. Optional.

  Yields:
    Callables which accept a single `Page` as an argument, and return it
      (either modifying in place or returning a modified copy).
  """
  yield staff_processor.StaffProcessor(structure, staffline_extractor)
  yield stems.Stems(structure)
  yield beam_processor.BeamProcessor(structure)
  yield note_dots.NoteDots(structure)

  yield CenteredRests()
  yield repeated.FixRepeatedRests()

  yield barlines.Barlines(structure)
  yield section_barlines.SectionBarlines(structure)

  yield section_barlines.MergeStandardAndBeginRepeatBars(structure)