Code Duplication    Length = 14-17 lines in 2 locations

src/egon/data/datasets/vg250/__init__.py 1 location

@@ 34-47 (lines=14) @@
31
)
32
33
34
def download_files():
35
    """Download VG250 (Verwaltungsgebiete) shape files."""
36
    data_config = egon.data.config.datasets()
37
    vg250_config = data_config["vg250"]["original_data"]
38
39
    download_directory = Path(".") / "vg250"
40
    # Create the folder, if it does not exists already
41
    if not os.path.exists(download_directory):
42
        os.mkdir(download_directory)
43
44
    target_file = download_directory / vg250_config["target"]["file"]
45
46
    if not os.path.isfile(target_file):
47
        urlretrieve(vg250_config["source"]["url"], target_file)
48
49
50
def to_postgres():

src/egon/data/datasets/zensus/__init__.py 1 location

@@ 49-65 (lines=17) @@
46
        )
47
48
49
def download_zensus_pop():
50
    """Download Zensus csv file on population per hectar grid cell."""
51
    data_config = egon.data.config.datasets()
52
    zensus_population_config = data_config["zensus_population"][
53
        "original_data"
54
    ]
55
    download_directory = Path(".") / "zensus_population"
56
    # Create the folder, if it does not exists already
57
    if not os.path.exists(download_directory):
58
        os.mkdir(download_directory)
59
60
    target_file = (
61
        download_directory / zensus_population_config["target"]["file"]
62
    )
63
64
    if not os.path.isfile(target_file):
65
        urlretrieve(zensus_population_config["source"]["url"], target_file)
66
67
68
def download_zensus_misc():