Skip to content

Commit 1433534

Browse files
committed
Use _private imports
1 parent 6fb5bcb commit 1433534

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

Lib/contextlib.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""Utilities for with-statement contexts. See PEP 343."""
2-
from inspect import isasyncgenfunction, iscoroutinefunction, \
3-
isgeneratorfunction
42

53
import abc
64
import os
75
import sys
86
import _collections_abc
97
from collections import deque
108
from functools import wraps
9+
from inspect import isasyncgenfunction as _isasyncgenfunction
10+
from inspect import iscoroutinefunction as _iscoroutinefunction
11+
from inspect import isgeneratorfunction as _isgeneratorfunction
1112
from types import GenericAlias
1213

1314
__all__ = ["asynccontextmanager", "contextmanager", "closing", "nullcontext",
@@ -101,11 +102,11 @@ async def asyncgen_inner(*args, **kwds):
101102
yield value
102103

103104
wrapper = wraps(func)
104-
if isasyncgenfunction(func):
105+
if _isasyncgenfunction(func):
105106
return wrapper(asyncgen_inner)
106-
elif iscoroutinefunction(func):
107+
elif _iscoroutinefunction(func):
107108
return wrapper(async_inner)
108-
elif isgeneratorfunction(func):
109+
elif _isgeneratorfunction(func):
109110
return wrapper(gen_inner)
110111
else:
111112
return wrapper(inner)
@@ -143,11 +144,11 @@ async def asyncgen_inner(*args, **kwds):
143144
yield value
144145

145146
wrapper = wraps(func)
146-
if isasyncgenfunction(func):
147+
if _isasyncgenfunction(func):
147148
return wrapper(asyncgen_inner)
148-
elif iscoroutinefunction(func):
149+
elif _iscoroutinefunction(func):
149150
return wrapper(async_inner)
150-
elif isgeneratorfunction(func):
151+
elif _isgeneratorfunction(func):
151152
return wrapper(gen_inner)
152153
else:
153154
return wrapper(inner)

0 commit comments

Comments
 (0)