potiuk commented on a change in pull request #6596: [AIRFLOW-6004] Untangle 
Executors class to avoid cyclic imports
URL: https://github.com/apache/airflow/pull/6596#discussion_r351286109
 
 

 ##########
 File path: airflow/plugins_manager.py
 ##########
 @@ -187,26 +197,29 @@ def make_module(name, objects):
 macros_modules = []
 
 # Plugin components to integrate directly
-admin_views = []  # type: List[Any]
-flask_blueprints = []  # type: List[Any]
-menu_links = []  # type: List[Any]
-flask_appbuilder_views = []  # type: List[Any]
-flask_appbuilder_menu_links = []  # type: List[Any]
-stat_name_handler = None  # type: Any
-global_operator_extra_links = []  # type: List[BaseOperatorLink]
-operator_extra_links = []  # type: List[BaseOperatorLink]
+admin_views: List[Any] = []
+flask_blueprints: List[Any] = []
+menu_links: List[Any] = []
+flask_appbuilder_views: List[Any] = []
+flask_appbuilder_menu_links: List[Any] = []
+stat_name_handler: Any = None
+global_operator_extra_links: List[Any] = []
+operator_extra_links: List[Any] = []
 
 stat_name_handlers = []
 for p in plugins:
+    if not p.name:
+        raise AirflowPluginException("Plugin name is missing.")
+    plugin_name: str = p.name
 
 Review comment:
   Because that's the only one mypy complained about when I added types. Name - 
it turns - can be None (it's optional). Others are always Lists (at most they 
are empty ones). So this is just a case when you specify Plugin and forget to 
add name to it. More like an assertion. 
   
   BTW. Maybe in the future we should use real assertions in such cases ? I did 
not want to introduce it yet, but assertions might be another step-up for the 
quality of the code.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to