This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4022746 Add type annotations to setup.py (#16658)
4022746 is described below
commit 402274641168f412f44c545c34f3e7edf5cf1476
Author: Ali Muhammad <[email protected]>
AuthorDate: Fri Jun 25 22:25:52 2021 +0500
Add type annotations to setup.py (#16658)
---
setup.py | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/setup.py b/setup.py
index e42c092..d9236fa 100644
--- a/setup.py
+++ b/setup.py
@@ -62,14 +62,14 @@ class CleanCommand(Command):
description = "Tidy up the project root"
user_options: List[str] = []
- def initialize_options(self):
+ def initialize_options(self) -> None:
"""Set default values for options."""
- def finalize_options(self):
+ def finalize_options(self) -> None:
"""Set final values for options."""
@staticmethod
- def rm_all_files(files: List[str]):
+ def rm_all_files(files: List[str]) -> None:
"""Remove all files from the list"""
for file in files:
try:
@@ -77,7 +77,7 @@ class CleanCommand(Command):
except Exception as e: # noqa pylint: disable=broad-except
logger.warning("Error when removing %s: %s", file, e)
- def run(self):
+ def run(self) -> None:
"""Remove temporary files and directories."""
os.chdir(my_dir)
self.rm_all_files(glob.glob('./build/*'))
@@ -98,13 +98,13 @@ class CompileAssets(Command):
description = "Compile and build the frontend assets"
user_options: List[str] = []
- def initialize_options(self):
+ def initialize_options(self) -> None:
"""Set default values for options."""
- def finalize_options(self):
+ def finalize_options(self) -> None:
"""Set final values for options."""
- def run(self): # noqa
+ def run(self) -> None: # noqa
"""Run a command to compile and build assets."""
subprocess.check_call('./airflow/www/compile_assets.sh')
@@ -118,13 +118,13 @@ class ListExtras(Command):
description = "List available extras"
user_options: List[str] = []
- def initialize_options(self):
+ def initialize_options(self) -> None:
"""Set default values for options."""
- def finalize_options(self):
+ def finalize_options(self) -> None:
"""Set final values for options."""
- def run(self): # noqa
+ def run(self) -> None: # noqa
"""List extras."""
print("\n".join(wrap(", ".join(EXTRAS_REQUIREMENTS.keys()), 100)))
@@ -165,7 +165,7 @@ def git_version(version_: str) -> str:
return 'no_git_version'
-def write_version(filename: str = os.path.join(*[my_dir, "airflow",
"git_version"])):
+def write_version(filename: str = os.path.join(*[my_dir, "airflow",
"git_version"])) -> None:
"""
Write the Semver version + git hash to file, e.g.
".dev0+2f635dc265e78db6708f59f68e8009abb92c1e65".
@@ -765,7 +765,7 @@ PACKAGES_EXCLUDED_FOR_ALL.extend(
)
-def is_package_excluded(package: str, exclusion_list: List[str]):
+def is_package_excluded(package: str, exclusion_list: List[str]) -> bool:
"""
Checks if package should be excluded.
@@ -822,7 +822,7 @@ PREINSTALLED_PROVIDERS = [
]
-def get_provider_package_from_package_id(package_id: str):
+def get_provider_package_from_package_id(package_id: str) -> str:
"""
Builds the name of provider package out of the package id provided/
@@ -833,7 +833,7 @@ def get_provider_package_from_package_id(package_id: str):
return f"apache-airflow-providers-{package_suffix}"
-def get_excluded_providers():
+def get_excluded_providers() -> List[str]:
"""
Returns packages excluded for the current python version.
@@ -844,7 +844,7 @@ def get_excluded_providers():
return ['apache.hive'] if PY39 else []
-def get_all_provider_packages():
+def get_all_provider_packages() -> str:
"""Returns all provider packages configured in setup.py"""
excluded_providers = get_excluded_providers()
return " ".join(
@@ -863,7 +863,7 @@ class AirflowDistribution(Distribution):
"""
- def parse_config_files(self, *args, **kwargs): # pylint:
disable=signature-differs
+ def parse_config_files(self, *args, **kwargs) -> None: # pylint:
disable=signature-differs
"""
Ensure that when we have been asked to install providers from sources
that we don't *also* try to install those providers from PyPI.
@@ -959,7 +959,7 @@ def add_all_provider_packages() -> None:
class Develop(develop_orig):
"""Forces removal of providers in editable mode."""
- def run(self):
+ def run(self) -> None:
self.announce('Installing in editable mode. Uninstalling provider
packages!', level=log.INFO)
# We need to run "python3 -m pip" because it might be that older PIP
binary is in the path
# And it results with an error when running pip directly (cannot
import pip module)
@@ -983,7 +983,7 @@ class Develop(develop_orig):
class Install(install_orig):
"""Forces installation of providers from sources in editable mode."""
- def run(self):
+ def run(self) -> None:
self.announce('Standard installation. Providers are installed from
packages', level=log.INFO)
super().run()