# Path: mtr/sync/settings.py
# def get_buffer_file_path(instance, filename, absolute=False):
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })
# 
# Path: mtr/sync/translation.py

# 
# Path: mtr/sync/lib/helpers.py
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
#     """Return iterator of fields names by given model in settings"""
# 
#     model = model or make_model_class(settings)
#     include_related = True and settings.include_related
# 
#     for name, field in model_fields(model, settings).items():
#         label = name
#         child_attrs = None
#         m_prefix = None
# 
#         if level > 1:
#             continue
# 
#         if isinstance(field, models.ForeignKey):
#             if not include_related:
#                 continue
#             m_prefix = '{}|_fk_|'
#         elif isinstance(field, models.ManyToManyField):
#             if not include_related:
#                 continue
#             m_prefix = '{}|_m_|'
#         elif isinstance(field, property):
#             field = field.fget
# 
#         label = getattr(
#             field, 'short_description', getattr(
#                 field, 'verbose_name', getattr(
#                     field, '__name__', repr(field))))
# 
#         if m_prefix:
#             child_attrs = []
#             child_attrs = model_attributes(
#                 settings, m_prefix.format(name),
#                 model=field.rel.to, parent=model, level=level + 1)
#         if prefix:
#             name = ''.join((prefix, name))
# 
#         if child_attrs:
#             for name, label in child_attrs:
#                 yield (name, smart_text('{} | {}').format(
#                     field.rel.to._meta.verbose_name, label).capitalize())
#         else:
#             yield (name, label.capitalize())
# 
# Path: mtr/sync/lib/signals.py

# 
# Path: mtr/sync/lib/exceptions.py
# class ErrorChoicesMixin(object):
#     IMPORT_DATA = 0
#     UNDEFINED = 1
# 
#     STEP_CHOICES = (
#         (IMPORT_DATA, _('import data')),
#         (UNDEFINED, _('unexpected error'))
#     )


from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings as django_settings
from .settings import SETTINGS, strip_media_root
from .translation import gettext_lazy as _
from .lib.helpers import model_attributes
from .lib.signals import export_started, export_completed, \
    import_started, import_completed, error_raised
from .lib.exceptions import ErrorChoicesMixin
from mtr.utils.models.mixins import PositionRelatedMixin, \
    TimeStampedMixin
        from .lib.manager import manager
        from .lib.manager import manager
        from .lib.manager import manager
            from .tasks import export_data, import_data
            from .tasks import export_data, import_data
    start_row = models.PositiveIntegerField(
        _('start row'), null=True, blank=True,
        help_text=_("Reading or writing start index (including itself)"))

    end_row = models.PositiveIntegerField(
        _('end row'), null=True, blank=True,
        help_text=_("Reading or writing end index (including itself)"))

    model = models.CharField(
        _('model'), max_length=255, blank=True,
        help_text=_("Choose database model if action need it"))

    show_in_quick_menu = models.BooleanField(
        _('show in quick menu list'), default=False)

    processor = models.CharField(
        _('format'), max_length=255,
        default=SETTINGS['default_processor'],
        help_text=_("Choose file type"))
    worksheet = models.CharField(
        _('worksheet page'), max_length=255, blank=True,
        help_text=_("Page name of sheet book"))
    include_header = models.BooleanField(
        _('include header'), default=True,
        help_text=_(
            "Check it if you need to write field names in"
            " export or skip it in import"))

    filename = models.CharField(
        _('custom filename'), max_length=255, blank=True,

# Path: mtr/sync/settings.py
# def get_buffer_file_path(instance, filename, absolute=False):
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })
# 
# Path: mtr/sync/translation.py

# 
# Path: mtr/sync/lib/helpers.py
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
#     """Return iterator of fields names by given model in settings"""
# 
#     model = model or make_model_class(settings)
#     include_related = True and settings.include_related
# 
#     for name, field in model_fields(model, settings).items():
#         label = name
#         child_attrs = None
#         m_prefix = None
# 
#         if level > 1:
#             continue
# 
#         if isinstance(field, models.ForeignKey):
#             if not include_related:
#                 continue
#             m_prefix = '{}|_fk_|'
#         elif isinstance(field, models.ManyToManyField):
#             if not include_related:
#                 continue
#             m_prefix = '{}|_m_|'
#         elif isinstance(field, property):
#             field = field.fget
# 
#         label = getattr(
#             field, 'short_description', getattr(
#                 field, 'verbose_name', getattr(
#                     field, '__name__', repr(field))))
# 
#         if m_prefix:
#             child_attrs = []
#             child_attrs = model_attributes(
#                 settings, m_prefix.format(name),
#                 model=field.rel.to, parent=model, level=level + 1)
#         if prefix:
#             name = ''.join((prefix, name))
# 
#         if child_attrs:
#             for name, label in child_attrs:
#                 yield (name, smart_text('{} | {}').format(
#                     field.rel.to._meta.verbose_name, label).capitalize())
#         else:
#             yield (name, label.capitalize())
# 
# Path: mtr/sync/lib/signals.py

# 
# Path: mtr/sync/lib/exceptions.py
# class ErrorChoicesMixin(object):
#     IMPORT_DATA = 0
#     UNDEFINED = 1
# 
#     STEP_CHOICES = (
#         (IMPORT_DATA, _('import data')),
#         (UNDEFINED, _('unexpected error'))
#     )


# Path: mtr/sync/models.py
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings as django_settings
from .settings import SETTINGS, strip_media_root
from .translation import gettext_lazy as _
from .lib.helpers import model_attributes
from .lib.signals import export_started, export_completed, \
    import_started, import_completed, error_raised
from .lib.exceptions import ErrorChoicesMixin
from mtr.utils.models.mixins import PositionRelatedMixin, \
    TimeStampedMixin
        from .lib.manager import manager
        from .lib.manager import manager
        from .lib.manager import manager
            from .tasks import export_data, import_data
            from .tasks import export_data, import_data

    start_row = models.PositiveIntegerField(
        _('start row'), null=True, blank=True,
        help_text=_("Reading or writing start index (including itself)"))

    end_row = models.PositiveIntegerField(
        _('end row'), null=True, blank=True,
        help_text=_("Reading or writing end index (including itself)"))

    model = models.CharField(
        _('model'), max_length=255, blank=True,
        help_text=_("Choose database model if action need it"))

    show_in_quick_menu = models.BooleanField(
        _('show in quick menu list'), default=False)

    processor = models.CharField(
        _('format'), max_length=255,
        default=SETTINGS['default_processor'],
        help_text=_("Choose file type"))
    worksheet = models.CharField(
        _('worksheet page'), max_length=255, blank=True,
        help_text=_("Page name of sheet book"))
    include_header = models.BooleanField(
        _('include header'), default=True,
        help_text=_(
            "Check it if you need to write field names in"
            " export or skip it in import"))

    filename = models.CharField(
        _('custom filename'), max_length=255, blank=True,

        help_text=_("Custom filename for export"))