import json
from typing import List

from config.config import SkillConfig
from skill import SkillRank


def load_json(file_location: str) -> List:
    with open(file_location) as file:
        return json.load(file)


def skills_are_desired(
    config: SkillConfig,
    skill_ranks: List[SkillRank]
) -> bool:
    configured_skill_ranks = filter(
        lambda skill_rank: (
            skill_rank.skill_name in config.skill_mappings.keys()
        ),
        skill_ranks
    )
    desired_skills = list(
        filter(
            lambda skill_weight: skill_weight > 0,
            map(
                lambda configured_skill_rank: config.skill_mappings[
                    configured_skill_rank.skill_name
                ].weight,
                configured_skill_ranks
            )
        )
    )

    return len(desired_skills) > 0

import json
from typing import List

from config.config import SkillConfig
from skill import SkillRank


def load_json(file_location: str) -> List:
    with open(file_location) as file:
        return json.load(file)


def skills_are_desired(
    config: SkillConfig,
    skill_ranks: List[SkillRank]
) -> bool:
    configured_skill_ranks = filter(
        lambda skill_rank: (
            skill_rank.skill_name in config.skill_mappings.keys()
        ),
        skill_ranks
    )
    desired_skills = list(
        filter(
            lambda skill_weight: skill_weight > 0,
            map(
                lambda configured_skill_rank: config.skill_mappings[
                    configured_skill_rank.skill_name
                ].weight,
                configured_skill_ranks
            )
        )
    )

    return len(desired_skills) > 0
