xinbinhuang commented on a change in pull request #19019:
URL: https://github.com/apache/airflow/pull/19019#discussion_r730177898



##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -130,15 +130,6 @@ def build_job(self, jenkins_server: Jenkins, params: 
ParamType = "") -> Optional
         :return: Dict containing the response body (key body)
             and the headers coming along (headers)
         """
-        # Since params can be either JSON string, dictionary, or list,
-        # check type and pass to build_job_url
-        if params and isinstance(params, str):
-            params = ast.literal_eval(params)

Review comment:
       Removing this will cause a small backward incompatibility if users 
either use a `str` to represent either `dict` or `list`. So I'm happy to leave 
it as it's
   
   i.e. 
   ```python
   import ast
   import json
   
   
   abc = ast.literal_eval(json.dumps({"a":1}))
   
   assert isinstance(ast.literal_eval(json.dumps({"param":1})), dict)
   assert isinstance(ast.literal_eval(json.dumps([("param", "1")])), list)
   ```

##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -130,15 +130,6 @@ def build_job(self, jenkins_server: Jenkins, params: 
ParamType = "") -> Optional
         :return: Dict containing the response body (key body)
             and the headers coming along (headers)
         """
-        # Since params can be either JSON string, dictionary, or list,
-        # check type and pass to build_job_url
-        if params and isinstance(params, str):
-            params = ast.literal_eval(params)

Review comment:
       Removing this will cause a small backward incompatibility if a user 
somehow either use a `str` to represent either `dict` or `list`. So I'm happy 
to leave it as it's
   
   i.e. 
   ```python
   import ast
   import json
   
   
   abc = ast.literal_eval(json.dumps({"a":1}))
   
   assert isinstance(ast.literal_eval(json.dumps({"param":1})), dict)
   assert isinstance(ast.literal_eval(json.dumps([("param", "1")])), list)
   ```

##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -130,15 +130,6 @@ def build_job(self, jenkins_server: Jenkins, params: 
ParamType = "") -> Optional
         :return: Dict containing the response body (key body)
             and the headers coming along (headers)
         """
-        # Since params can be either JSON string, dictionary, or list,
-        # check type and pass to build_job_url
-        if params and isinstance(params, str):
-            params = ast.literal_eval(params)

Review comment:
       Removing this will cause a small backward incompatibility if a user 
somehow either use a `str` to represent either `dict` or `list`. So I'm happy 
to leave it as it's. Let me know if you want me keep it.
   
   i.e. 
   ```python
   import ast
   import json
   
   
   abc = ast.literal_eval(json.dumps({"a":1}))
   
   assert isinstance(ast.literal_eval(json.dumps({"param":1})), dict)
   assert isinstance(ast.literal_eval(json.dumps([("param", "1")])), list)
   ```

##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -130,15 +130,6 @@ def build_job(self, jenkins_server: Jenkins, params: 
ParamType = "") -> Optional
         :return: Dict containing the response body (key body)
             and the headers coming along (headers)
         """
-        # Since params can be either JSON string, dictionary, or list,
-        # check type and pass to build_job_url
-        if params and isinstance(params, str):
-            params = ast.literal_eval(params)

Review comment:
       Removing this will cause a small backward incompatibility if a user 
somehow use a `str` to represent either `dict` or `list`. So I'm happy to leave 
it as it's. Let me know if you want me keep it.
   
   i.e. 
   ```python
   import ast
   import json
   
   
   abc = ast.literal_eval(json.dumps({"a":1}))
   
   assert isinstance(ast.literal_eval(json.dumps({"param":1})), dict)
   assert isinstance(ast.literal_eval(json.dumps([("param", "1")])), list)
   ```

##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -130,15 +130,6 @@ def build_job(self, jenkins_server: Jenkins, params: 
ParamType = "") -> Optional
         :return: Dict containing the response body (key body)
             and the headers coming along (headers)
         """
-        # Since params can be either JSON string, dictionary, or list,
-        # check type and pass to build_job_url
-        if params and isinstance(params, str):
-            params = ast.literal_eval(params)

Review comment:
       Removing this will cause a small backward incompatibility if a user 
somehow use a `str` to represent either `dict` or `list`. So I'm happy to leave 
it as it's. Let me know if you want me keep it.
   
   i.e. 
   ```python
   import ast
   import json
   
   
   assert isinstance(ast.literal_eval(json.dumps({"param":1})), dict)
   assert isinstance(ast.literal_eval(json.dumps([("param", "1")])), list)
   ```




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

To unsubscribe, e-mail: [email protected]

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


Reply via email to