# Path: edisgo/io/pypsa_io.py
# def to_pypsa(grid_object, timesteps, **kwargs):
#     def _set_slack(grid):
# def set_seed(edisgo_obj, pypsa_network):
# def _get_grid_component_dict(grid_object):
# def _append_lv_components(
#     comp,
#     comps,
#     lv_components,
#     lv_grid_name,
#     aggregate_loads=None,
#     aggregate_generators=None,
#     aggregate_storages=None,
# ):
# def _get_timeseries_with_aggregated_elements(
#     edisgo_obj, timesteps, element_types, elements, aggr_dict
# ):
# def _buses_voltage_set_point(edisgo_obj, buses, slack_bus, timesteps):
# def _check_integrity_of_pypsa(pypsa_network):
# def process_pfa_results(edisgo, pypsa, timesteps):


import pandas as pd
import logging
from pyomo.environ import (
    ConcreteModel,
    Set,
    Param,
    Objective,
    Constraint,
    minimize,
    Var,
)
from pyomo.opt import SolverFactory
from edisgo.io import pypsa_io
                    selected_generators = generators.loc[
                        (generators.type == col)
                    ]

                # check if curtailment exceeds feed-in
                feedin_selected_generators = feedin.loc[
                    :, selected_generators.gen_repr.values
                ]
                self._precheck(
                    curtailment_timeseries.loc[:, col],
                    feedin_selected_generators,
                    col,
                )

                # do curtailment
                if not feedin_selected_generators.empty:
                    curtailment_method(
                        feedin_selected_generators,
                        selected_generators,
                        curtailment_timeseries.loc[:, col],
                        edisgo,
                        col,
                        **kwargs
                    )

        # check if curtailment exceeds feed-in
        self._postcheck(edisgo.topology, feedin)

        # update generator time series in pypsa topology
        if edisgo.topology.pypsa is not None:

# Path: edisgo/io/pypsa_io.py
# def to_pypsa(grid_object, timesteps, **kwargs):
#     def _set_slack(grid):
# def set_seed(edisgo_obj, pypsa_network):
# def _get_grid_component_dict(grid_object):
# def _append_lv_components(
#     comp,
#     comps,
#     lv_components,
#     lv_grid_name,
#     aggregate_loads=None,
#     aggregate_generators=None,
#     aggregate_storages=None,
# ):
# def _get_timeseries_with_aggregated_elements(
#     edisgo_obj, timesteps, element_types, elements, aggr_dict
# ):
# def _buses_voltage_set_point(edisgo_obj, buses, slack_bus, timesteps):
# def _check_integrity_of_pypsa(pypsa_network):
# def process_pfa_results(edisgo, pypsa, timesteps):


# Path: edisgo/flex_opt/curtailment.py
import pandas as pd
import logging
from pyomo.environ import (
    ConcreteModel,
    Set,
    Param,
    Objective,
    Constraint,
    minimize,
    Var,
)
from pyomo.opt import SolverFactory
from edisgo.io import pypsa_io

                    selected_generators = generators.loc[
                        (generators.type == col)
                    ]

                # check if curtailment exceeds feed-in
                feedin_selected_generators = feedin.loc[
                    :, selected_generators.gen_repr.values
                ]
                self._precheck(
                    curtailment_timeseries.loc[:, col],
                    feedin_selected_generators,
                    col,
                )

                # do curtailment
                if not feedin_selected_generators.empty:
                    curtailment_method(
                        feedin_selected_generators,
                        selected_generators,
                        curtailment_timeseries.loc[:, col],
                        edisgo,
                        col,
                        **kwargs
                    )

        # check if curtailment exceeds feed-in
        self._postcheck(edisgo.topology, feedin)

        # update generator time series in pypsa topology
        if edisgo.topology.pypsa is not None:

            pypsa_io.update_pypsa_generator_timeseries(edisgo.topology)