Skip to content

Commit

Permalink
try to fix linting 1
Browse files Browse the repository at this point in the history
  • Loading branch information
griembauer committed Nov 28, 2024
1 parent 3868e44 commit 6fa040d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/grass_gis_helpers/open_geodata_germany/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

17 changes: 9 additions & 8 deletions src/grass_gis_helpers/open_geodata_germany/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
import fileinput
from multiprocessing.pool import ThreadPool
import os
import requests
import zipfile_deflate64
from zipfile import ZipFile

import grass.script as grass
import requests
import zipfile_deflate64



def check_download_dir(download_dir):
Expand Down Expand Up @@ -114,10 +115,10 @@ def extract_compressed_files(file_names, download_dir):
extracted_files = []
for file_name in file_names:
file = os.path.join(download_dir, file_name)
with ZipFile(file, "r") as zipObj:
zip_content = zipObj.namelist()
with ZipFile(file, "r") as zipobj:
zip_content = zipobj.namelist()
# Extract all the contents of zip file in current directory
zipObj.extractall(download_dir)
zipobj.extractall(download_dir)
extracted_files.extend(zip_content)
return extracted_files

Expand All @@ -137,10 +138,10 @@ def extract_compressed_files_deflate64(file_names, download_dir):
extracted_files = []
for file_name in file_names:
file = os.path.join(download_dir, file_name)
with zipfile_deflate64.ZipFile(file, "r") as zipObj:
zip_content = zipObj.namelist()
with zipfile_deflate64.ZipFile(file, "r") as zipobj:
zip_content = zipobj.namelist()
# Extract all the contents of zip file in current directory
zipObj.extractall(download_dir)
zipobj.extractall(download_dir)
extracted_files.extend(zip_content)
return extracted_files

Expand Down
6 changes: 3 additions & 3 deletions src/grass_gis_helpers/open_geodata_germany/federal_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def import_administrative_boundaries(output, aoi=None, level="KRS"):
grass.run_command("g.region", vector=aoi, quiet=True)

# url of administrative boundaries
URL = (
url = (
"https://daten.gdz.bkg.bund.de/produkte/vg/vg5000_0101/"
"aktuell/vg5000_01-01.utm32s.shape.ebenen.zip"
)
Expand All @@ -98,7 +98,7 @@ def import_administrative_boundaries(output, aoi=None, level="KRS"):
)
try:
# check if URL is reachable
response = requests.get(URL)
response = requests.get(url)
if not response.status_code == 200:
grass.fatal(
(
Expand All @@ -108,7 +108,7 @@ def import_administrative_boundaries(output, aoi=None, level="KRS"):
)

# download and import administrative boundaries
vsi_url = f"/vsizip/vsicurl/{URL}/{filename}"
vsi_url = f"/vsizip/vsicurl/{url}/{filename}"
grass.run_command(
"v.import",
input=vsi_url,
Expand Down

0 comments on commit 6fa040d

Please sign in to comment.