Updated stub for 2.7 httplib; new stubs for 2.7 mimetools, rfc822.

This commit is contained in:
Guido van Rossum
2015-11-23 10:29:38 -08:00
parent 7b75dec702
commit a0deb69be9
3 changed files with 232 additions and 1 deletions

View File

@@ -1,3 +1,124 @@
# Stubs for httplib (incomplete)
# Stubs for httplib (Python 2)
#
# Generated by stubgen and manually massaged a bit.
# Needs lots more work!
from typing import Any, Dict
import mimetools
responses = ... # type: Dict[int, str]
class HTTPMessage(mimetools.Message):
def addheader(self, key: str, value: str) -> None: ...
def addcontinue(self, key: str, more: str) -> None: ...
dict = ... # type: Dict[str, str]
unixfrom = ... # type: str
headers = ... # type: Any
status = ... # type: str
seekable = ... # type: bool
def readheaders(self) -> None: ...
class HTTPResponse:
fp = ... # type: Any
debuglevel = ... # type: Any
strict = ... # type: Any
msg = ... # type: Any
version = ... # type: Any
status = ... # type: Any
reason = ... # type: Any
chunked = ... # type: Any
chunk_left = ... # type: Any
length = ... # type: Any
will_close = ... # type: Any
def __init__(self, sock, debuglevel=0, strict=0, method=None, buffering=False) -> None: ...
def begin(self): ...
def close(self): ...
def isclosed(self): ...
def read(self, amt=None): ...
def fileno(self): ...
def getheader(self, name, default=None): ...
def getheaders(self): ...
class HTTPConnection:
response_class = ... # type: Any
default_port = ... # type: Any
auto_open = ... # type: Any
debuglevel = ... # type: Any
strict = ... # type: Any
timeout = ... # type: Any
source_address = ... # type: Any
sock = ... # type: Any
def __init__(self, host, port=None, strict=None, timeout=..., source_address=None) -> None: ...
def set_tunnel(self, host, port=None, headers=None): ...
def set_debuglevel(self, level): ...
def connect(self): ...
def close(self): ...
def send(self, data): ...
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): ...
def putheader(self, header, *values): ...
def endheaders(self, message_body=None): ...
def request(self, method, url, body=None, headers=...): ...
def getresponse(self, buffering=False): ...
class HTTP:
debuglevel = ... # type: Any
def __init__(self, host='', port=None, strict=None) -> None: ...
def connect(self, host=None, port=None): ...
def getfile(self): ...
file = ... # type: Any
headers = ... # type: Any
def getreply(self, buffering=False): ...
def close(self): ...
class HTTPSConnection(HTTPConnection):
default_port = ... # type: Any
key_file = ... # type: Any
cert_file = ... # type: Any
def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=..., source_address=None, context=None) -> None: ...
sock = ... # type: Any
def connect(self): ...
class HTTPS(HTTP):
key_file = ... # type: Any
cert_file = ... # type: Any
def __init__(self, host='', port=None, key_file=None, cert_file=None, strict=None, context=None) -> None: ...
class HTTPException(Exception): ...
class NotConnected(HTTPException): ...
class InvalidURL(HTTPException): ...
class UnknownProtocol(HTTPException):
args = ... # type: Any
version = ... # type: Any
def __init__(self, version) -> None: ...
class UnknownTransferEncoding(HTTPException): ...
class UnimplementedFileMode(HTTPException): ...
class IncompleteRead(HTTPException):
args = ... # type: Any
partial = ... # type: Any
expected = ... # type: Any
def __init__(self, partial, expected=None) -> None: ...
class ImproperConnectionState(HTTPException): ...
class CannotSendRequest(ImproperConnectionState): ...
class CannotSendHeader(ImproperConnectionState): ...
class ResponseNotReady(ImproperConnectionState): ...
class BadStatusLine(HTTPException):
args = ... # type: Any
line = ... # type: Any
def __init__(self, line) -> None: ...
class LineTooLong(HTTPException):
def __init__(self, line_type) -> None: ...
error = ... # type: Any
class LineAndFileWrapper:
def __init__(self, line, file) -> None: ...
def __getattr__(self, attr): ...
def read(self, amt=None): ...
def readline(self): ...
def readlines(self, size=None): ...

31
stdlib/2.7/mimetools.pyi Normal file
View File

@@ -0,0 +1,31 @@
# Stubs for mimetools (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
import rfc822
class Message(rfc822.Message):
encodingheader = ... # type: Any
typeheader = ... # type: Any
def __init__(self, fp, seekable=1): ...
plisttext = ... # type: Any
type = ... # type: Any
maintype = ... # type: Any
subtype = ... # type: Any
def parsetype(self): ...
plist = ... # type: Any
def parseplist(self): ...
def getplist(self): ...
def getparam(self, name): ...
def getparamnames(self): ...
def getencoding(self): ...
def gettype(self): ...
def getmaintype(self): ...
def getsubtype(self): ...
def choose_boundary(): ...
def decode(input, output, encoding): ...
def encode(input, output, encoding): ...
def copyliteral(input, output): ...
def copybinary(input, output): ...

79
stdlib/2.7/rfc822.pyi Normal file
View File

@@ -0,0 +1,79 @@
# Stubs for rfc822 (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Message:
fp = ... # type: Any
seekable = ... # type: Any
startofheaders = ... # type: Any
startofbody = ... # type: Any
def __init__(self, fp, seekable=1): ...
def rewindbody(self): ...
dict = ... # type: Any
unixfrom = ... # type: Any
headers = ... # type: Any
status = ... # type: Any
def readheaders(self): ...
def isheader(self, line): ...
def islast(self, line): ...
def iscomment(self, line): ...
def getallmatchingheaders(self, name): ...
def getfirstmatchingheader(self, name): ...
def getrawheader(self, name): ...
def getheader(self, name, default=None): ...
get = ... # type: Any
def getheaders(self, name): ...
def getaddr(self, name): ...
def getaddrlist(self, name): ...
def getdate(self, name): ...
def getdate_tz(self, name): ...
def __len__(self): ...
def __getitem__(self, name): ...
def __setitem__(self, name, value): ...
def __delitem__(self, name): ...
def setdefault(self, name, default=''): ...
def has_key(self, name): ...
def __contains__(self, name): ...
def __iter__(self): ...
def keys(self): ...
def values(self): ...
def items(self): ...
class AddrlistClass:
specials = ... # type: Any
pos = ... # type: Any
LWS = ... # type: Any
CR = ... # type: Any
atomends = ... # type: Any
phraseends = ... # type: Any
field = ... # type: Any
commentlist = ... # type: Any
def __init__(self, field): ...
def gotonext(self): ...
def getaddrlist(self): ...
def getaddress(self): ...
def getrouteaddr(self): ...
def getaddrspec(self): ...
def getdomain(self): ...
def getdelimited(self, beginchar, endchars, allowcomments=1): ...
def getquote(self): ...
def getcomment(self): ...
def getdomainliteral(self): ...
def getatom(self, atomends=None): ...
def getphraselist(self): ...
class AddressList(AddrlistClass):
addresslist = ... # type: Any
def __init__(self, field): ...
def __len__(self): ...
def __add__(self, other): ...
def __iadd__(self, other): ...
def __sub__(self, other): ...
def __isub__(self, other): ...
def __getitem__(self, index): ...
def parsedate_tz(data): ...
def parsedate(data): ...
def mktime_tz(data): ...