potiuk commented on a change in pull request #13439:
URL: https://github.com/apache/airflow/pull/13439#discussion_r551508177



##########
File path: setup.py
##########
@@ -640,15 +672,21 @@ def find_requirements_for_alias(alias_to_look_for: 
Tuple[str, str]) -> List[str]
         raise Exception(f"The extra {new_extra} is missing for alias 
{deprecated_extra}")
 
 
-# Add extras for all deprecated aliases. Requirements for those deprecated 
aliases are the same
-# as the extras they are replaced with
-for alias, extra in EXTRAS_DEPRECATED_ALIASES.items():
-    requirements = EXTRAS_REQUIREMENTS.get(extra) if extra != '' else []
-    if requirements is None:
-        raise Exception(f"The extra {extra} is missing for deprecated alias 
{alias}")
-    # Note the requirements are not copies - those are the same lists as for 
the new extras. This is intended.
-    # Thanks to that if the original extras are later extended with providers, 
aliases are extended as well.
-    EXTRAS_REQUIREMENTS[alias] = requirements
+def add_extras_for_all_deprecated_aliases() -> None:
+    """
+    Add extras for all deprecated aliases. Requirements for those deprecated 
aliases are the same
+    as the extras they are replaced with.
+    The requirements are not copies - those are the same lists as for the new 
extras. This is intended.
+    Thanks to that if the original extras are later extended with providers, 
aliases are extended as well.
+    """
+    for alias, extra in EXTRAS_DEPRECATED_ALIASES.items():
+        requirements = EXTRAS_REQUIREMENTS.get(extra) if extra != '' else []
+        if requirements is None:
+            raise Exception(f"The extra {extra} is missing for deprecated 
alias {alias}")
+        EXTRAS_REQUIREMENTS[alias] = requirements
+
+
+add_extras_for_all_deprecated_aliases()

Review comment:
       I looked at it and yeah, we pretty much always want them called. The 
main reason I added the methods is to make them named/pydoced and also it makes 
it better to reuse some of the common variable names (extras for onw) because 
if they are in the "top" code, then they can easily hide other variable rather 
than be 'local' in functions. So less warnings from PyCharm for one.

##########
File path: setup.py
##########
@@ -640,15 +672,21 @@ def find_requirements_for_alias(alias_to_look_for: 
Tuple[str, str]) -> List[str]
         raise Exception(f"The extra {new_extra} is missing for alias 
{deprecated_extra}")
 
 
-# Add extras for all deprecated aliases. Requirements for those deprecated 
aliases are the same
-# as the extras they are replaced with
-for alias, extra in EXTRAS_DEPRECATED_ALIASES.items():
-    requirements = EXTRAS_REQUIREMENTS.get(extra) if extra != '' else []
-    if requirements is None:
-        raise Exception(f"The extra {extra} is missing for deprecated alias 
{alias}")
-    # Note the requirements are not copies - those are the same lists as for 
the new extras. This is intended.
-    # Thanks to that if the original extras are later extended with providers, 
aliases are extended as well.
-    EXTRAS_REQUIREMENTS[alias] = requirements
+def add_extras_for_all_deprecated_aliases() -> None:
+    """
+    Add extras for all deprecated aliases. Requirements for those deprecated 
aliases are the same
+    as the extras they are replaced with.
+    The requirements are not copies - those are the same lists as for the new 
extras. This is intended.
+    Thanks to that if the original extras are later extended with providers, 
aliases are extended as well.
+    """
+    for alias, extra in EXTRAS_DEPRECATED_ALIASES.items():
+        requirements = EXTRAS_REQUIREMENTS.get(extra) if extra != '' else []
+        if requirements is None:
+            raise Exception(f"The extra {extra} is missing for deprecated 
alias {alias}")
+        EXTRAS_REQUIREMENTS[alias] = requirements
+
+
+add_extras_for_all_deprecated_aliases()

Review comment:
       I looked at it and yeah, we pretty much always want them called. The 
main reason I added the methods is to make them named/pydoced and also it makes 
it better to reuse some of the common variable names (extras for one) because 
if they are in the "top" code, then they can easily hide other variable rather 
than be 'local' in functions. So less warnings from PyCharm for one.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to