# Path: src/moviesapp/vk.py
# def get_vk_avatar(url):
#     if url in settings.VK_NO_AVATAR:
#         return None
#     return url


from django.conf import settings
from .vk import get_vk_avatar



def load_user_data(backend, user, **kwargs):  # pylint: disable=unused-argument
    if user.loaded_initial_data:
        return None

    if backend.name in settings.VK_BACKENDS:
        # We don't need the username and email because they are already loaded.
        FIELDS = (
            "first_name",
            "last_name",
            "photo_100",
            "photo_200",
        )
        vk = user.get_vk()
        data = vk.get_data(FIELDS)
        avatar_small = get_vk_avatar(data["photo_100"])
        if avatar_small:
            user.avatar_small = avatar_small

# Path: src/moviesapp/vk.py
# def get_vk_avatar(url):
#     if url in settings.VK_NO_AVATAR:
#         return None
#     return url


# Path: src/moviesapp/social.py
from django.conf import settings
from .vk import get_vk_avatar




def load_user_data(backend, user, **kwargs):  # pylint: disable=unused-argument
    if user.loaded_initial_data:
        return None

    if backend.name in settings.VK_BACKENDS:
        # We don't need the username and email because they are already loaded.
        FIELDS = (
            "first_name",
            "last_name",
            "photo_100",
            "photo_200",
        )
        vk = user.get_vk()
        data = vk.get_data(FIELDS)
        avatar_small = get_vk_avatar(data["photo_100"])
        if avatar_small:
            user.avatar_small = avatar_small

        avatar_big = get_vk_avatar(data["photo_200"])