turbaszek commented on a change in pull request #9947:
URL: https://github.com/apache/airflow/pull/9947#discussion_r463480138
##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -160,7 +163,7 @@ def poll_job_in_queue(self, location, jenkins_server):
location_answer = jenkins_request_with_headers(
jenkins_server, Request(method='POST', url=location))
if location_answer is not None:
- json_response = json.loads(location_answer['body'])
+ json_response = json.loads(location_answer['body']) # type:
ignore
Review comment:
Type of `location_answer` is `Union[str, Mapping[str, str]]` and this is
visible in L54:
```
return {'body': response_body.decode('utf-8'), 'headers': response_headers}
```
What I would try is:
```suggestion
body_str: str = location_answer['body']
json_response = json.loads(body_str)
```
The error comes from mypy assuming that the type under `body` key may be
`Mapping` and that's is indeed and error as `json.loads` accepts only `str,
bytes, bytearray`
##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -160,7 +163,7 @@ def poll_job_in_queue(self, location, jenkins_server):
location_answer = jenkins_request_with_headers(
jenkins_server, Request(method='POST', url=location))
if location_answer is not None:
- json_response = json.loads(location_answer['body'])
+ json_response = json.loads(location_answer['body']) # type:
ignore
Review comment:
Type of `location_answer` is `Union[str, Mapping[str, str]]` and this is
visible in L54:
```
return {'body': response_body.decode('utf-8'), 'headers': response_headers}
```
What I would try is:
```suggestion
body_str: str = location_answer['body']
json_response = json.loads(body_str)
```
The error comes from mypy assuming that the type under `body` key may be
`Mapping` and that is indeed an error as `json.loads` accepts only `str, bytes,
bytearray`
----------------------------------------------------------------
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]