cpython/Lib
Ivan Levkivskyi 4c23aff065
bpo-29262: Add get_origin() and get_args() introspection helpers to typing (GH-13685)
This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.

As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.

The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
2019-05-31 00:10:07 +01:00
..
asyncio bpo-36999: Add asyncio.Task.get_coro() (GH-13680) 2019-05-30 08:30:09 -07:00
collections bpo-36953: Delay removal of ABCs from collections. (GH-13409) 2019-05-30 14:45:48 -07:00
concurrent bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618) 2019-05-28 21:02:52 +09:00
ctypes
curses
dbm
distutils bpo-21536: On Cygwin, C extensions must be linked with libpython (GH-13549) 2019-05-24 17:33:47 +02:00
email
encodings
ensurepip
html
http
idlelib bpo-37039: IDLE - zoomheight fixes (GH-13576) 2019-05-27 19:16:46 -04:00
importlib Don't crash if there exists an EGG-INFO directory on sys.path (#13667) 2019-05-29 17:13:11 -07:00
json
lib2to3 bpo-5028: Fix up rest of documentation for tokenize documenting line (GH-13686) 2019-05-30 15:06:32 -07:00
logging
msilib
multiprocessing bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603) 2019-05-28 16:02:50 +02:00
pydoc_data Regenerate topics file (GH-13642) 2019-05-29 22:59:00 +01:00
site-packages
sqlite3
test bpo-29262: Add get_origin() and get_args() introspection helpers to typing (GH-13685) 2019-05-31 00:10:07 +01:00
tkinter
turtledemo
unittest bpo-32972: Async test case (GH-13386) 2019-05-29 02:33:59 -07:00
urllib bpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481) 2019-05-27 09:43:45 -04:00
venv
wsgiref bpo-8138: Initialize wsgiref's SimpleServer as single-threaded (GH-12977) 2019-05-24 20:24:42 +03:00
xml
xmlrpc
__future__.py
__phello__.foo.py
_bootlocale.py
_collections_abc.py
_compat_pickle.py
_compression.py
_dummy_thread.py
_markupbase.py
_osx_support.py
_py_abc.py
_pydecimal.py
_pyio.py bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601) 2019-05-28 01:44:21 +02:00
_sitebuiltins.py
_strptime.py
_threading_local.py
_weakrefset.py
abc.py
aifc.py
antigravity.py
argparse.py
ast.py
asynchat.py
asyncore.py
base64.py
bdb.py
binhex.py
bisect.py
bz2.py
calendar.py
cgi.py
cgitb.py
chunk.py
cmd.py
code.py
codecs.py
codeop.py
colorsys.py
compileall.py
configparser.py
contextlib.py
contextvars.py
copy.py
copyreg.py
cProfile.py
crypt.py
csv.py
dataclasses.py
datetime.py
decimal.py
difflib.py
dis.py
doctest.py
dummy_threading.py
enum.py
filecmp.py
fileinput.py
fnmatch.py
formatter.py
fractions.py
ftplib.py
functools.py bpo-36772 Allow lru_cache to be used as decorator without making a function call (GH-13048) 2019-05-26 11:27:35 -07:00
genericpath.py
getopt.py
getpass.py
gettext.py
glob.py
gzip.py
hashlib.py
heapq.py
hmac.py
imaplib.py
imghdr.py
imp.py
inspect.py
io.py bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00
ipaddress.py
keyword.py
linecache.py
locale.py
lzma.py
mailbox.py
mailcap.py
mimetypes.py
modulefinder.py bpo-37032: Add CodeType.replace() method (GH-13542) 2019-05-24 23:57:23 +02:00
netrc.py
nntplib.py
ntpath.py
nturl2path.py
numbers.py
opcode.py
operator.py
optparse.py
os.py
pathlib.py
pdb.py bpo-36969: Make PDB args command display positional only arguments (GH-13459) 2019-05-24 21:44:31 +01:00
pickle.py bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
pickletools.py bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
pipes.py
pkgutil.py
platform.py
plistlib.py
poplib.py
posixpath.py
pprint.py
profile.py
pstats.py
pty.py
py_compile.py bpo-22640: Add silent mode to py_compile.compile() (GH-12976) 2019-05-28 19:29:04 +03:00
pyclbr.py
pydoc.py bpo-36045: builtins.help() now prefixes async for async functions (GH-12010) 2019-05-24 04:38:01 -07:00
queue.py
quopri.py
random.py
re.py
reprlib.py
rlcompleter.py
runpy.py
sched.py
secrets.py
selectors.py
shelve.py
shlex.py bpo-22454: Add shlex.join() (the opposite of shlex.split()) (GH-7605) 2019-05-29 09:06:11 +01:00
shutil.py bpo-36610: shutil.copyfile(): use sendfile() on Linux only (GH-13675) 2019-05-30 14:05:41 +08:00
signal.py
site.py
smtpd.py
smtplib.py
sndhdr.py
socket.py
socketserver.py
sre_compile.py
sre_constants.py
sre_parse.py
ssl.py
stat.py
statistics.py
string.py
stringprep.py
struct.py
subprocess.py bpo-31961: Fix support of path-like executables in subprocess. (GH-5914) 2019-05-28 22:49:35 +03:00
sunau.py
symbol.py
symtable.py
sysconfig.py
tabnanny.py
tarfile.py
telnetlib.py
tempfile.py
textwrap.py
this.py
threading.py bpo-1230540: Add threading.excepthook() (GH-13515) 2019-05-28 00:39:52 +02:00
timeit.py
token.py
tokenize.py bpo-5028: Fix up rest of documentation for tokenize documenting line (GH-13686) 2019-05-30 15:06:32 -07:00
trace.py
traceback.py
tracemalloc.py
tty.py
turtle.py
types.py bpo-37032: Add CodeType.replace() method (GH-13542) 2019-05-24 23:57:23 +02:00
typing.py bpo-29262: Add get_origin() and get_args() introspection helpers to typing (GH-13685) 2019-05-31 00:10:07 +01:00
uu.py
uuid.py
warnings.py
wave.py
weakref.py
webbrowser.py
xdrlib.py
zipapp.py
zipfile.py bpo-22102: Fixes zip files with disks set to 0 (GH-5985) 2019-05-28 19:15:11 -04:00
zipimport.py bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00