From 27ba7838e1e2e89777eb0ed06bf2c87881546784 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Mon, 26 Apr 2021 14:24:54 +1000 Subject: [PATCH] Do not import from unpackaged paths in typing (#1926) The tests path is not part of the shipped project, thus this type cannot be checked by users of this project. The correct type in place of the type imported from tests appears to be Optional[ Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass] ] --- github/Requester.pyi | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/github/Requester.pyi b/github/Requester.pyi index 53cc9a38..6070c4fd 100644 --- a/github/Requester.pyi +++ b/github/Requester.pyi @@ -5,7 +5,6 @@ from typing import Any, Callable, Dict, Iterator, Optional, Tuple, Union from requests.models import Response from github.GithubObject import GithubObject -from tests.Framework import ReplayingHttpsConnection # from urllib3.util.retry import Retry @@ -57,7 +56,9 @@ class Requester: def __authenticate( self, url: str, responseHeader: Dict[str, Any], parameters: Dict[str, Any], ) -> None: ... - def __customConnection(self, url: str,) -> Optional[ReplayingHttpsConnection]: ... + def __customConnection( + self, url: str, + ) -> Optional[Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]]: ... def __createConnection( self, ) -> Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]: ... @@ -120,7 +121,9 @@ class Requester: parameters: Dict[str, str] = ..., headers: Dict[str, str] = ..., input: Optional[str] = ..., - cnx: Optional[ReplayingHttpsConnection] = ..., + cnx: Optional[ + Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass] + ] = ..., ) -> Tuple[int, Dict[str, Any], str]: ... def requestBlobAndCheck( self, @@ -137,7 +140,9 @@ class Requester: parameters: Optional[Dict[str, Any]] = ..., headers: Optional[Dict[str, Any]] = ..., input: Optional[Any] = ..., - cnx: Optional[ReplayingHttpsConnection] = ..., + cnx: Optional[ + Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass] + ] = ..., ) -> Tuple[int, Dict[str, Any], str]: ... def requestJsonAndCheck( self, @@ -154,7 +159,9 @@ class Requester: parameters: Optional[Dict[str, Any]] = ..., headers: Optional[Dict[str, Any]] = ..., input: Optional[OrderedDict] = ..., - cnx: Optional[ReplayingHttpsConnection] = ..., + cnx: Optional[ + Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass] + ] = ..., ) -> Tuple[int, Dict[str, Any], str]: ... def requestMultipartAndCheck( self,