Improve __all__ definitions for threading and _dummy_threading modules (#7135)

This commit is contained in:
Alex Waygood
2022-02-05 16:07:02 +00:00
committed by GitHub
parent bdef0a70a6
commit 348c38a0dd
7 changed files with 181 additions and 63 deletions

View File

@@ -6,7 +6,25 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
__all__: list[str]
__all__ = [
"activeCount",
"active_count",
"Condition",
"currentThread",
"current_thread",
"enumerate",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Timer",
"setprofile",
"settrace",
"local",
"stack_size",
]
def active_count() -> int: ...
def activeCount() -> int: ...

View File

@@ -6,7 +6,25 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
__all__: list[str]
__all__ = [
"activeCount",
"active_count",
"Condition",
"currentThread",
"current_thread",
"enumerate",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Timer",
"setprofile",
"settrace",
"local",
"stack_size",
]
def active_count() -> int: ...
def activeCount() -> int: ...

View File

@@ -8,7 +8,56 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
_T = TypeVar("_T")
__all__: list[str]
if sys.version_info >= (3, 8):
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
"excepthook",
"ExceptHookArgs",
]
else:
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
]
def active_count() -> int: ...
def current_thread() -> Thread: ...
@@ -16,10 +65,6 @@ def currentThread() -> Thread: ...
def get_ident() -> int: ...
def enumerate() -> list[Thread]: ...
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
def settrace(func: _TF) -> None: ...
def setprofile(func: _PF | None) -> None: ...
def stack_size(size: int = ...) -> int: ...

View File

@@ -8,7 +8,86 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
_T = TypeVar("_T")
__all__: list[str]
if sys.version_info >= (3, 10):
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
"excepthook",
"ExceptHookArgs",
"gettrace",
"getprofile",
"get_native_id",
]
elif sys.version_info >= (3, 8):
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
"excepthook",
"ExceptHookArgs",
"get_native_id",
]
else:
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
]
def active_count() -> int: ...
def activeCount() -> int: ... # deprecated alias for active_count()

View File

@@ -26,6 +26,10 @@ distutils.cygwinccompiler.RE_VERSION
distutils.dist.command_re
distutils.fancy_getopt.longopt_re
distutils.fancy_getopt.neg_alias_re
dummy_threading.Condition.acquire
dummy_threading.Condition.release
dummy_threading.Event.isSet
dummy_threading.local.__new__
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
hmac.HMAC.__init__
@@ -125,26 +129,8 @@ distutils.command.bdist_wininst
distutils.command.bdist_wininst.bdist_wininst
distutils.sysconfig.expand_makefile_vars
distutils.sysconfig.get_python_version
dummy_threading.Barrier
dummy_threading.BoundedSemaphore
dummy_threading.BrokenBarrierError
dummy_threading.Condition
dummy_threading.Event
dummy_threading.Lock
dummy_threading.RLock
dummy_threading.Semaphore
dummy_threading.TIMEOUT_MAX
dummy_threading.Thread
dummy_threading.ThreadError
dummy_threading.Timer
dummy_threading.active_count
dummy_threading.current_thread
dummy_threading.enumerate
dummy_threading.get_ident
dummy_threading.local
dummy_threading.main_thread
dummy_threading.setprofile
dummy_threading.settrace
dummy_threading.stack_size
html.parser.HTMLParser.unescape
platform.popen

View File

@@ -25,6 +25,10 @@ collections.UserString.maketrans
contextvars.Context.__init__ # Default C __init__ signature is wrong
contextvars.ContextVar.get
dataclasses.field
dummy_threading.Condition.acquire
dummy_threading.Condition.release
dummy_threading.Event.isSet
dummy_threading.local.__new__
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
hmac.HMAC.__init__
@@ -102,26 +106,8 @@ distutils.cygwinccompiler.RE_VERSION
distutils.dist.command_re
distutils.fancy_getopt.longopt_re
distutils.fancy_getopt.neg_alias_re
dummy_threading.Barrier
dummy_threading.BoundedSemaphore
dummy_threading.BrokenBarrierError
dummy_threading.Condition
dummy_threading.Event
dummy_threading.Lock
dummy_threading.RLock
dummy_threading.Semaphore
dummy_threading.TIMEOUT_MAX
dummy_threading.Thread
dummy_threading.ThreadError
dummy_threading.Timer
dummy_threading.active_count
dummy_threading.current_thread
dummy_threading.enumerate
dummy_threading.get_ident
dummy_threading.local
dummy_threading.main_thread
dummy_threading.setprofile
dummy_threading.settrace
dummy_threading.stack_size
html.parser.HTMLParser.unescape
platform.popen

View File

@@ -29,6 +29,11 @@ collections.KeysView.__reversed__
collections.ValuesView.__reversed__
contextvars.Context.__init__ # Default C __init__ signature is wrong
dataclasses.field
dummy_threading.Condition.acquire
dummy_threading.Condition.release
dummy_threading.Event.isSet
dummy_threading.Thread.native_id
dummy_threading.local.__new__
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
@@ -115,28 +120,9 @@ distutils.cygwinccompiler.RE_VERSION
distutils.dist.command_re
distutils.fancy_getopt.longopt_re
distutils.fancy_getopt.neg_alias_re
dummy_threading.Barrier
dummy_threading.BoundedSemaphore
dummy_threading.BrokenBarrierError
dummy_threading.Condition
dummy_threading.Event
dummy_threading.ExceptHookArgs
dummy_threading.Lock
dummy_threading.RLock
dummy_threading.Semaphore
dummy_threading.TIMEOUT_MAX
dummy_threading.Thread
dummy_threading.ThreadError
dummy_threading.Timer
dummy_threading.active_count
dummy_threading.current_thread
dummy_threading.enumerate
dummy_threading.excepthook
dummy_threading.get_ident
dummy_threading.local
dummy_threading.main_thread
dummy_threading.setprofile
dummy_threading.settrace
dummy_threading.stack_size
html.parser.HTMLParser.unescape
multiprocessing.managers.SharedMemoryServer.create