bpo-30152: Reduce the number of imports for argparse. (#1269)

This commit is contained in:
Serhiy Storchaka 2017-09-26 00:55:55 +03:00 committed by GitHub
parent f1502d097c
commit 81108375d9
8 changed files with 59 additions and 49 deletions

View file

@ -172,9 +172,6 @@ class DynamicClassAttribute:
return result
import functools as _functools
import collections.abc as _collections_abc
class _GeneratorWrapper:
# TODO: Implement this in C.
def __init__(self, gen):
@ -247,7 +244,10 @@ def coroutine(func):
# return generator-like objects (for instance generators
# compiled with Cython).
@_functools.wraps(func)
# Delay functools and _collections_abc import for speeding up types import.
import functools
import _collections_abc
@functools.wraps(func)
def wrapped(*args, **kwargs):
coro = func(*args, **kwargs)
if (coro.__class__ is CoroutineType or