Add stubs for submodules of six.moves (#2108)

To support "from six.moves.cPickle import loads", we must add a stub for
six.moves.cPickle as if it were a real submodule, even though it isn't
implemented as such. This fixes python/mypy#1550.

We don't apply this approach to six.moves.builtins on Python 2, because
it seems to confuse mypy.

We also add stubs for aliases in six.moves whose underlying modules have
been added to typeshed.

For Python 2:
    - six.moves.SimpleHTTPServer (alias for SimpleHTTPServer)

For Python 3:
    - six.moves.tkinter_dialog (alias for tkinter.dialog)
    - six.moves.tkinter_filedialog (alias for tkinter.filedialog)
    - six.moves.tkinter_commondialog (alias for tkinter.commondialog)
    - six.moves.tkinter_tkfiledialog (alias for tkinter.filedialog)
This commit is contained in:
Daniel Li
2018-05-12 12:02:44 -04:00
committed by Jelle Zijlstra
parent 86f9472bc9
commit 56a31be7a7
51 changed files with 100 additions and 51 deletions

View File

@@ -0,0 +1 @@
from BaseHTTPServer import *

View File

@@ -0,0 +1 @@
from SimpleHTTPServer import *

View File

@@ -22,27 +22,27 @@ from __builtin__ import xrange as xrange
from itertools import izip as zip
from itertools import izip_longest as zip_longest
import __builtin__ as builtins
import ConfigParser as configparser
from . import configparser
# import copy_reg as copyreg
# import gdbm as dbm_gnu
import dummy_thread as _dummy_thread
import cookielib as http_cookiejar
import Cookie as http_cookies
import htmlentitydefs as html_entities
import HTMLParser as html_parser
import httplib as http_client
from . import _dummy_thread
from . import http_cookiejar
from . import http_cookies
from . import html_entities
from . import html_parser
from . import http_client
# import email.MIMEMultipart as email_mime_multipart
# import email.MIMENonMultipart as email_mime_nonmultipart
import email.MIMEText as email_mime_text
from . import email_mime_text
# import email.MIMEBase as email_mime_base
import BaseHTTPServer as BaseHTTPServer
from . import BaseHTTPServer
# import CGIHTTPServer as CGIHTTPServer
# import SimpleHTTPServer as SimpleHTTPServer
import cPickle as cPickle
import Queue as queue
import repr as reprlib
import SocketServer as socketserver
import thread as _thread
from . import SimpleHTTPServer
from . import cPickle
from . import queue
from . import reprlib
from . import socketserver
from . import _thread
# import Tkinter as tkinter
# import Dialog as tkinter_dialog
# import FileDialog as tkinter_filedialog
@@ -58,9 +58,9 @@ import thread as _thread
# import tkFont as tkinter_font
# import tkMessageBox as tkinter_messagebox
# import tkSimpleDialog as tkinter_tksimpledialog
import six.moves.urllib.parse as urllib_parse
import six.moves.urllib.error as urllib_error
import six.moves.urllib as urllib
import robotparser as urllib_robotparser
import xmlrpclib as xmlrpc_client
from . import urllib_parse
from . import urllib_error
from . import urllib
from . import urllib_robotparser
from . import xmlrpc_client
# import SimpleXMLRPCServer as xmlrpc_server

View File

@@ -0,0 +1 @@
from dummy_thread import *

1
third_party/2/six/moves/_thread.pyi vendored Normal file
View File

@@ -0,0 +1 @@
from thread import *

1
third_party/2/six/moves/cPickle.pyi vendored Normal file
View File

@@ -0,0 +1 @@
from cPickle import *

View File

@@ -0,0 +1 @@
from ConfigParser import *

View File

@@ -0,0 +1 @@
from email.MIMEText import *

View File

@@ -0,0 +1 @@
from htmlentitydefs import *

View File

@@ -0,0 +1 @@
from HTMLParser import *

View File

@@ -0,0 +1 @@
from httplib import *

View File

@@ -0,0 +1 @@
from cookielib import *

View File

@@ -0,0 +1 @@
from Cookie import *

1
third_party/2/six/moves/queue.pyi vendored Normal file
View File

@@ -0,0 +1 @@
from Queue import *

1
third_party/2/six/moves/reprlib.pyi vendored Normal file
View File

@@ -0,0 +1 @@
from repr import *

View File

@@ -0,0 +1 @@
from SocketServer import *

View File

@@ -0,0 +1 @@
from .urllib.error import *

View File

@@ -0,0 +1 @@
from .urllib.parse import *

View File

@@ -0,0 +1 @@
from robotparser import *

View File

@@ -0,0 +1 @@
from xmlrpclib import *