# Path: social/utils.py
# def module_member(name):
#     mod, member = name.rsplit('.', 1)
#     module = import_module(mod)
#     return getattr(module, member)
# 
# def setting_name(*names):
#     names = [val.upper().replace('-', '_') for val in names if val]
#     return '_'.join((SETTING_PREFIX,) + tuple(names))


from functools import wraps
from flask import current_app, url_for, g, request, redirect
from social.utils import module_member, setting_name
from social.strategies.utils import get_strategy




DEFAULTS = {
    'STORAGE': 'social.apps.flask_app.models.FlaskStorage',
    'STRATEGY': 'social.strategies.flask_strategy.FlaskStrategy'
}


def get_helper(name, do_import=False):
    config = current_app.config.get(setting_name(name),
                                    DEFAULTS.get(name, None))

# Path: social/utils.py
# def module_member(name):
#     mod, member = name.rsplit('.', 1)
#     module = import_module(mod)
#     return getattr(module, member)
# 
# def setting_name(*names):
#     names = [val.upper().replace('-', '_') for val in names if val]
#     return '_'.join((SETTING_PREFIX,) + tuple(names))


# Path: social/apps/flask_app/utils.py
from functools import wraps
from flask import current_app, url_for, g, request, redirect
from social.utils import module_member, setting_name
from social.strategies.utils import get_strategy





DEFAULTS = {
    'STORAGE': 'social.apps.flask_app.models.FlaskStorage',
    'STRATEGY': 'social.strategies.flask_strategy.FlaskStrategy'
}


def get_helper(name, do_import=False):
    config = current_app.config.get(setting_name(name),
                                    DEFAULTS.get(name, None))

    return do_import and module_member(config) or config