turbaszek commented on a change in pull request #9947:
URL: https://github.com/apache/airflow/pull/9947#discussion_r463482925



##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -19,19 +19,22 @@
 import json
 import socket
 import time
+from typing import Any, Mapping, Optional, Type, Union
 from urllib.error import HTTPError, URLError
 
 import jenkins
-from jenkins import JenkinsException
+from jenkins import Jenkins, JenkinsException
 from requests import Request
 
 from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.providers.jenkins.hooks.jenkins import JenkinsHook
 from airflow.utils.decorators import apply_defaults
 
+JReqType = Mapping[str, Union[str, Mapping[str, str]]]
 
-def jenkins_request_with_headers(jenkins_server, req):
+
+def jenkins_request_with_headers(jenkins_server: Type[Jenkins], req: Request) 
-> JReqType:

Review comment:
       If the result is always in type of `{'body': ..., 'headers': ...}` I 
would suggest introducing named tuple. This should solve a lot of problems and 
will add some useful stuff like accessing using attributes.
   ```python
   class JenkingRequest(NamedTuple):
       body: str
       headers: Dict[str, str]
   ```




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