# Path: calliope/preprocess/util.py
# def get_all_carriers(config, direction="both"):
# def flatten_list(unflattened_list):
# def split_loc_techs_transmission(transmission_string):
# def get_systemwide_constraints(tech_config):
# def vincenty(coord1, coord2):
#     U1 = np.arctan((1 - f) * np.tan(np.radians(coord1[0])))
#     U2 = np.arctan((1 - f) * np.tan(np.radians(coord2[0])))
#     L = np.radians(coord2[1] - coord1[1])
#         C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha))
#     A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)))
#     B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)))
#     D = b * A * (sigma - deltaSigma)
# 
# Path: calliope/preprocess/checks.py
# DEFAULTS = AttrDict.from_yaml(
#     os.path.join(os.path.dirname(calliope.__file__), "config", "defaults.yaml")
# )
# POSSIBLE_COSTS = [i for i in DEFAULTS.techs.default_tech.costs.default_cost.keys()]
# def check_overrides(config_model, override):
# def check_initial(config_model):
# def _check_tech_final(
#     model_run, tech_id, tech_config, loc_id, model_warnings, errors, comments
# ):
# def check_final(model_run):
# def check_model_data(model_data):
# 
# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):


from itertools import product
from calliope.preprocess.util import constraint_exists, concat_iterable
from calliope.preprocess import checks
from calliope import exceptions
import numpy as np
            i
            for i in sets.techlists
            if f"energy_cap_{sense}"
            in model_run.model.get_key("group_share.{}".format(i), {}).keys()
        ]
        constraint_sets[
            f"techlists_carrier_group_share_carrier_prod_{sense}_constraint"
        ] = [
            i + "::" + carrier
            for i in sets.techlists
            if f"carrier_prod_{sense}"
            in model_run.model.get_key("group_share.{}".format(i), {}).keys()
            for carrier in sets.carriers
            if carrier
            in model_run.model.get_key(
                f"group_share.{i}.carrier_prod_{sense}", {}
            ).keys()
        ]

    # group.py
    group_constraints = {
        name: data
        for name, data in model_run["group_constraints"].items()
        if data.get("exists", True)
    }
    constraint_sets["group_constraints"] = set()
    for group_constraint_name, group_constraint in group_constraints.items():
        tech_groups = [
            [
                k

# Path: calliope/preprocess/util.py
# def get_all_carriers(config, direction="both"):
# def flatten_list(unflattened_list):
# def split_loc_techs_transmission(transmission_string):
# def get_systemwide_constraints(tech_config):
# def vincenty(coord1, coord2):
#     U1 = np.arctan((1 - f) * np.tan(np.radians(coord1[0])))
#     U2 = np.arctan((1 - f) * np.tan(np.radians(coord2[0])))
#     L = np.radians(coord2[1] - coord1[1])
#         C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha))
#     A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)))
#     B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)))
#     D = b * A * (sigma - deltaSigma)
# 
# Path: calliope/preprocess/checks.py
# DEFAULTS = AttrDict.from_yaml(
#     os.path.join(os.path.dirname(calliope.__file__), "config", "defaults.yaml")
# )
# POSSIBLE_COSTS = [i for i in DEFAULTS.techs.default_tech.costs.default_cost.keys()]
# def check_overrides(config_model, override):
# def check_initial(config_model):
# def _check_tech_final(
#     model_run, tech_id, tech_config, loc_id, model_warnings, errors, comments
# ):
# def check_final(model_run):
# def check_model_data(model_data):
# 
# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):


# Path: calliope/preprocess/constraint_sets.py
from itertools import product
from calliope.preprocess.util import constraint_exists, concat_iterable
from calliope.preprocess import checks
from calliope import exceptions
import numpy as np

            i
            for i in sets.techlists
            if f"energy_cap_{sense}"
            in model_run.model.get_key("group_share.{}".format(i), {}).keys()
        ]
        constraint_sets[
            f"techlists_carrier_group_share_carrier_prod_{sense}_constraint"
        ] = [
            i + "::" + carrier
            for i in sets.techlists
            if f"carrier_prod_{sense}"
            in model_run.model.get_key("group_share.{}".format(i), {}).keys()
            for carrier in sets.carriers
            if carrier
            in model_run.model.get_key(
                f"group_share.{i}.carrier_prod_{sense}", {}
            ).keys()
        ]

    # group.py
    group_constraints = {
        name: data
        for name, data in model_run["group_constraints"].items()
        if data.get("exists", True)
    }
    constraint_sets["group_constraints"] = set()
    for group_constraint_name, group_constraint in group_constraints.items():
        tech_groups = [
            [
                k

                for k, v in checks.DEFAULTS.tech_groups.items()