Code Duplication    Length = 14-14 lines in 2 locations

src/egon/data/datasets/electrical_neighbours.py 2 locations

@@ 1876-1889 (lines=14) @@
1873
        **year_start_end
1874
    )
1875
1876
    if not_retrieved:
1877
        logger.warning("Generation data from entsoe could not be retrieved.")
1878
        # check for generation backup from former runs
1879
        file_path = Path(
1880
            "./",
1881
            "data_bundle_egon_data",
1882
            "entsoe",
1883
            f"gen_entsoe_{scn_name}.csv",
1884
        ).resolve()
1885
        if os.path.isfile(file_path):
1886
            df_gen_sq, not_retrieved = fill_by_backup_data_from_former_runs(
1887
                df_gen_sq, file_path, not_retrieved
1888
            )
1889
        save_entsoe_data(df_gen_sq, file_path=file_path)
1890
1891
    targets = config.datasets()["electrical_neighbours"]["targets"]
1892
    # Delete existing data
@@ 1695-1708 (lines=14) @@
1692
        **year_start_end
1693
    )
1694
1695
    if not_retrieved:
1696
        logger.warning("Generation data from entsoe could not be retrieved.")
1697
        # check for generation backup from former runs
1698
        file_path = Path(
1699
            "./",
1700
            "data_bundle_egon_data",
1701
            "entsoe",
1702
            f"gen_entsoe_{scn_name}.csv",
1703
        ).resolve()
1704
        if os.path.isfile(file_path):
1705
            df_gen_sq, not_retrieved = fill_by_backup_data_from_former_runs(
1706
                df_gen_sq, file_path, not_retrieved
1707
            )
1708
        save_entsoe_data(df_gen_sq, file_path=file_path)
1709
1710
    sto_sq = df_gen_sq.loc[:, df_gen_sq.columns == "Hydro Pumped Storage"]
1711
    sto_sq.rename(columns={"Hydro Pumped Storage": "p_nom"}, inplace=True)