# Path: mtr/sync/lib/helpers.py
# def cell_value(row, cols, processor=None):
# def column_name(index):
# def column_index(value):
# def model_fields(model, settings=None):
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
# def make_model_class(settings):
# def _process_fk_attribute(model, attribute):
# def _process_mtm_attribute(model, attribute):
# def process_attribute(model, attribute):
# 
# Path: mtr/sync/settings.py
# 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,
#     }
# })


from django.utils.six.moves import filterfalse
from django.utils.translation import activate
from django.http import QueryDict
from django.contrib.admin.views.main import IGNORED_PARAMS
from mtr.utils.manager import BaseManager
from .helpers import make_model_class, process_attribute, \
    model_fields, cell_value, model_settings
from ..settings import SETTINGS
    def converter_choices(self):
        """Returns all registered converters"""

        for name, converter in self.all('converter').items():
            yield(name, getattr(converter, 'label', converter.__name__))

    def make_processor(self, settings, from_extension=False):
        """Create new processor instance if exists"""

        processor = None

        if from_extension:
            extension = settings.buffer_file.path.split('.')[-1]
            for pr in self.all('processors').values():
                if pr.file_format.strip('.') == extension:
                    processor = pr
                    settings.processor = processor.__name__
                    break

        processor = self.get('processor', settings.processor)

        return processor(settings, self)

    def export_data(self, settings, data=None):
        """Export data to file if no data passed,
        create queryset it from settings"""

        if settings.language:
            activate(settings.language)


# Path: mtr/sync/lib/helpers.py
# def cell_value(row, cols, processor=None):
# def column_name(index):
# def column_index(value):
# def model_fields(model, settings=None):
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
# def make_model_class(settings):
# def _process_fk_attribute(model, attribute):
# def _process_mtm_attribute(model, attribute):
# def process_attribute(model, attribute):
# 
# Path: mtr/sync/settings.py
# 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/lib/manager.py
from django.utils.six.moves import filterfalse
from django.utils.translation import activate
from django.http import QueryDict
from django.contrib.admin.views.main import IGNORED_PARAMS
from mtr.utils.manager import BaseManager
from .helpers import make_model_class, process_attribute, \
    model_fields, cell_value, model_settings
from ..settings import SETTINGS

    def converter_choices(self):
        """Returns all registered converters"""

        for name, converter in self.all('converter').items():
            yield(name, getattr(converter, 'label', converter.__name__))

    def make_processor(self, settings, from_extension=False):
        """Create new processor instance if exists"""

        processor = None

        if from_extension:
            extension = settings.buffer_file.path.split('.')[-1]
            for pr in self.all('processors').values():
                if pr.file_format.strip('.') == extension:
                    processor = pr
                    settings.processor = processor.__name__
                    break

        processor = self.get('processor', settings.processor)

        return processor(settings, self)

    def export_data(self, settings, data=None):
        """Export data to file if no data passed,
        create queryset it from settings"""

        if settings.language:
            activate(settings.language)


        processor = self.make_processor(settings)