Code Duplication    Length = 33-33 lines in 2 locations

src/egon/data/datasets/pypsaeur/__init__.py 2 locations

@@ 1291-1323 (lines=33) @@
1288
        )
1289
1290
1291
def prepared_network():
1292
    if egon.data.config.settings()["egon-data"]["--run-pypsa-eur"]:
1293
        with open(
1294
            __path__[0] + "/datasets/pypsaeur/config.yaml", "r"
1295
        ) as stream:
1296
            data_config = yaml.safe_load(stream)
1297
1298
        target_file = (
1299
            Path(".")
1300
            / "run-pypsa-eur"
1301
            / "pypsa-eur"
1302
            / "results"
1303
            / data_config["run"]["name"]
1304
            / "prenetworks"
1305
            / f"elec_s_{data_config['scenario']['clusters'][0]}"
1306
            f"_l{data_config['scenario']['ll'][0]}"
1307
            f"_{data_config['scenario']['opts'][0]}"
1308
            f"_{data_config['scenario']['sector_opts'][0]}"
1309
            f"_{data_config['scenario']['planning_horizons'][0]}.nc"
1310
        )
1311
1312
    else:
1313
        target_file = (
1314
            Path(".")
1315
            / "data_bundle_powerd_data"
1316
            / "pypsa_eur"
1317
            / "2024-08-02-egondata-integration"
1318
            / "results"
1319
            / "postnetworks"
1320
            / "elec_s_37_lv1.5__Co2L0-1H-T-H-B-I-A-solar+p3_2050.nc"
1321
        )
1322
1323
    return pypsa.Network(target_file.absolute().as_posix())
1324
1325
1326
def overwrite_H2_pipeline_share():
@@ 283-315 (lines=33) @@
280
        print("Pypsa-eur is not executed due to the settings of egon-data")
281
282
283
def read_network():
284
    if config.settings()["egon-data"]["--run-pypsa-eur"]:
285
        with open(
286
            __path__[0] + "/datasets/pypsaeur/config.yaml", "r"
287
        ) as stream:
288
            data_config = yaml.safe_load(stream)
289
290
        target_file = (
291
            Path(".")
292
            / "run-pypsa-eur"
293
            / "pypsa-eur"
294
            / "results"
295
            / data_config["run"]["name"]
296
            / "postnetworks"
297
            / f"elec_s_{data_config['scenario']['clusters'][0]}"
298
            f"_l{data_config['scenario']['ll'][0]}"
299
            f"_{data_config['scenario']['opts'][0]}"
300
            f"_{data_config['scenario']['sector_opts'][0]}"
301
            f"_{data_config['scenario']['planning_horizons'][0]}.nc"
302
        )
303
304
    else:
305
        target_file = (
306
            Path(".")
307
            / "data_bundle_powerd_data"
308
            / "pypsa_eur"
309
            / "2024-08-02-egondata-integration"
310
            / "results"
311
            / "postnetworks"
312
            / "elec_s_37_lv1.5__Co2L0-1H-T-H-B-I-A-solar+p3_2050.nc"
313
        )
314
315
    return pypsa.Network(target_file)
316
317
318
def clean_database():