feluelle commented on a change in pull request #5786:  [AIRFLOW-5170] Fix 
encoding pragmas, consistent licences for python files and related pylint fixes
URL: https://github.com/apache/airflow/pull/5786#discussion_r314895950
 
 

 ##########
 File path: airflow/contrib/hooks/qubole_hook.py
 ##########
 @@ -229,28 +236,29 @@ def get_extra_links(self, operator, dttm):
         return url
 
     def create_cmd_args(self, context):
+        """Creates command arguments"""
         args = []
         cmd_type = self.kwargs['command_type']
         inplace_args = None
         tags = {self.dag_id, self.task_id, context['run_id']}
         positional_args_list = flatten_list(POSITIONAL_ARGS.values())
 
-        for k, v in self.kwargs.items():
-            if k in COMMAND_ARGS[cmd_type]:
-                if k in HYPHEN_ARGS:
-                    args.append("--{0}={1}".format(k.replace('_', '-'), v))
-                elif k in positional_args_list:
-                    inplace_args = v
-                elif k == 'tags':
-                    if isinstance(v, str):
-                        tags.add(v)
-                    elif isinstance(v, (list, tuple)):
-                        for val in v:
+        for key, value in self.kwargs.items():  # pylint: 
disable=too-many-nested-blocks
+            if key in COMMAND_ARGS[cmd_type]:
+                if key in HYPHEN_ARGS:
+                    args.append("--{0}={1}".format(key.replace('_', '-'), 
value))
+                elif key in positional_args_list:
+                    inplace_args = value
+                elif key == 'tags':
+                    if isinstance(value, str):
+                        tags.add(value)
+                    elif isinstance(value, (list, tuple)):
+                        for val in value:
 
 Review comment:
   Then you have one less nested-block. I think there is still one too much so 
maybe if you want to get rid of the `# pylint: disable=too-many-nested-blocks` 
what about:
   ```python
   def _add_tags(tags)
       if isinstance(value, str):
           tags.add(value)
       elif isinstance(value, (list, tuple)):
           tags.extend(value)
       return tags
   ```
   Or do you think that such a function doesn't quite fit there?

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