Browse Source

licences, mypy

Daniel Busch 5 tháng trước cách đây
mục cha
commit
6fe3d3922d
2 tập tin đã thay đổi với 13 bổ sung11 xóa
  1. 2 0
      pyproject.toml
  2. 11 11
      src/faostat_data_primap/download.py

+ 2 - 0
pyproject.toml

@@ -194,6 +194,8 @@ authorized_licenses = [
     "LGPLv2+",
     "LGPLv2+",
     "GNU Lesser General Public License v2 (LGPLv2)",
     "GNU Lesser General Public License v2 (LGPLv2)",
     "GNU Lesser General Public License v2 or later (LGPLv2+)",
     "GNU Lesser General Public License v2 or later (LGPLv2+)",
+    'GNU General Public License v3 (GPLv3)',
+    'GNU Lesser General Public License v3 (LGPLv3)',
     "mit",
     "mit",
     "mit license",
     "mit license",
     "Mozilla Public License 2.0 (MPL 2.0)",
     "Mozilla Public License 2.0 (MPL 2.0)",

+ 11 - 11
src/faostat_data_primap/download.py

@@ -18,8 +18,8 @@ from faostat_data_primap.helper.definitions import domains, downloaded_data_path
 
 
 
 
 def find_previous_release_path(
 def find_previous_release_path(
-    current_release_path: pathlib.PosixPath,
-) -> pathlib.PosixPath | None:
+    current_release_path: pathlib.Path,
+) -> pathlib.Path | None:
     """
     """
     Find the most recent previous release directory within same domain
     Find the most recent previous release directory within same domain
 
 
@@ -29,12 +29,12 @@ def find_previous_release_path(
 
 
     Parameters
     Parameters
     ----------
     ----------
-    current_release_path : pathlib.PosixPath
+    current_release_path : pathlib.Path
         The path of the current release directory.
         The path of the current release directory.
 
 
     Returns
     Returns
     -------
     -------
-    pathlib.PosixPath or None
+    pathlib.Path or None
         Returns the path of the most recent previous release directory if one exists,
         Returns the path of the most recent previous release directory if one exists,
         otherwise returns None.
         otherwise returns None.
     """
     """
@@ -68,13 +68,13 @@ def find_previous_release_path(
     return domain_path / all_releases_datetime[index - 1].strftime("%Y-%m-%d")
     return domain_path / all_releases_datetime[index - 1].strftime("%Y-%m-%d")
 
 
 
 
-def calculate_checksum(file_path: pathlib.PosixPath) -> str:
+def calculate_checksum(file_path: pathlib.Path) -> str:
     """
     """
     Calculate the SHA-256 checksum of a file.
     Calculate the SHA-256 checksum of a file.
 
 
     Parameters
     Parameters
     ----------
     ----------
-    file_path : pathlib.PosixPath
+    file_path : pathlib.Path
         The path to the file for which the checksum is calculated.
         The path to the file for which the checksum is calculated.
 
 
     Returns
     Returns
@@ -89,7 +89,7 @@ def calculate_checksum(file_path: pathlib.PosixPath) -> str:
     return sha256.hexdigest()
     return sha256.hexdigest()
 
 
 
 
-def download_methodology(url_download: str, save_path: pathlib.PosixPath) -> None:
+def download_methodology(url_download: str, save_path: pathlib.Path) -> None:
     """
     """
     Download methodology file.
     Download methodology file.
 
 
@@ -107,7 +107,7 @@ def download_methodology(url_download: str, save_path: pathlib.PosixPath) -> Non
     ----------
     ----------
     url_download : str
     url_download : str
         The URL from which to download the file.
         The URL from which to download the file.
-    save_path : pathlib.PosixPath
+    save_path : pathlib.Path
         The path to the directory where the file should be saved.
         The path to the directory where the file should be saved.
     """
     """
     filename = url_download.split("/")[-1]
     filename = url_download.split("/")[-1]
@@ -223,7 +223,7 @@ def get_last_updated_date(soup: BeautifulSoup, url: str) -> str:
     return last_updated
     return last_updated
 
 
 
 
-def download_file(url_download: str, save_path: pathlib.PosixPath) -> bool:
+def download_file(url_download: str, save_path: pathlib.Path) -> bool:
     """
     """
     Download file.
     Download file.
 
 
@@ -253,7 +253,7 @@ def download_file(url_download: str, save_path: pathlib.PosixPath) -> bool:
     return False
     return False
 
 
 
 
-def unzip_file(local_filename: pathlib.PosixPath) -> list[str]:
+def unzip_file(local_filename: pathlib.Path) -> list[str]:
     """
     """
     Unzip files in same directory. Skip if files are already there
     Unzip files in same directory. Skip if files are already there
 
 
@@ -295,7 +295,7 @@ def unzip_file(local_filename: pathlib.PosixPath) -> list[str]:
 
 
 def download_all_domains(
 def download_all_domains(
     domains: dict[str, dict[str, str]] = domains,
     domains: dict[str, dict[str, str]] = domains,
-    downloaded_data_path: pathlib.PosixPath = downloaded_data_path,
+    downloaded_data_path: pathlib.Path = downloaded_data_path,
 ) -> list[str]:
 ) -> list[str]:
     """
     """
     Download and unpack all climate-related domains from the FAO stat website.
     Download and unpack all climate-related domains from the FAO stat website.