future first: switch the order of some if statements (#5206)

Since we're adding this to our contribution guidelines in
https://github.com/python/typeshed/pull/5205
This commit is contained in:
Shantanu
2021-04-11 06:44:18 -07:00
committed by GitHub
parent b308c1f964
commit fa9d5a5e9f
36 changed files with 147 additions and 146 deletions
+5 -5
View File
@@ -32,14 +32,14 @@ from .datastructures import (
WWWAuthenticate,
)
if sys.version_info < (3,):
_Str = TypeVar("_Str", str, unicode)
_ToBytes = Union[bytes, bytearray, buffer, unicode]
_ETagData = Union[str, unicode, bytearray, buffer, memoryview]
else:
if sys.version_info >= (3, 0):
_Str = str
_ToBytes = Union[bytes, bytearray, memoryview, str]
_ETagData = Union[bytes, bytearray, memoryview]
else:
_Str = TypeVar("_Str", str, unicode)
_ToBytes = Union[bytes, bytearray, buffer, unicode]
_ETagData = Union[str, unicode, bytearray, buffer, memoryview]
_T = TypeVar("_T")
_U = TypeVar("_U")
+3 -3
View File
@@ -45,10 +45,10 @@ class GuardedIterator(object):
chunks: List[int]
def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: List[int]) -> None: ...
def __iter__(self) -> GuardedIterator: ...
if sys.version_info < (3,):
def next(self) -> str: ...
else:
if sys.version_info >= (3, 0):
def __next__(self) -> str: ...
else:
def next(self) -> str: ...
def close(self) -> None: ...
class LintMiddleware(object):
+7 -7
View File
@@ -1,21 +1,21 @@
import sys
from typing import Any, Optional
if sys.version_info < (3,):
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
else:
if sys.version_info >= (3, 0):
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
else:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
if sys.platform == "win32":
class ForkingMixIn(object): ...
else:
if sys.version_info < (3,):
from SocketServer import ForkingMixIn as ForkingMixIn
else:
if sys.version_info >= (3, 0):
from socketserver import ForkingMixIn as ForkingMixIn
else:
from SocketServer import ForkingMixIn as ForkingMixIn
class _SslDummy:
def __getattr__(self, name): ...
+4 -4
View File
@@ -3,12 +3,12 @@ from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
if sys.version_info < (3,):
from cookielib import CookieJar
from urllib2 import Request as U2Request
else:
if sys.version_info >= (3, 0):
from http.cookiejar import CookieJar
from urllib.request import Request as U2Request
else:
from cookielib import CookieJar
from urllib2 import Request as U2Request
def stream_encode_multipart(
values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., charset: Text = ...