diff --git a/docs/source/history.rst b/docs/source/history.rst index 77d8b95056..5a37abe5c6 100644 --- a/docs/source/history.rst +++ b/docs/source/history.rst @@ -99,6 +99,8 @@ Fix ``sock.accept()`` for IPv6 sockets (https://github.com/python-trio/trio/issu deprecate most of the task and nursery APIs +make our exports visible to PyCharm (314) + Renames from https://github.com/python-trio/trio/issues/157 Note that pypy needs 5.9+ to support deprecations properly diff --git a/trio/_core/__init__.py b/trio/_core/__init__.py index e7bca0de86..b058d108e1 100644 --- a/trio/_core/__init__.py +++ b/trio/_core/__init__.py @@ -44,7 +44,6 @@ async def wait_socket_readable(sock): raise TypeError("need a socket") await wait_readable(sock) - async def wait_socket_writable(sock): if type(sock) != _stdlib_socket.socket: raise TypeError("need a socket") diff --git a/trio/hazmat.py b/trio/hazmat.py index 444e26f70a..f57b8ee30c 100644 --- a/trio/hazmat.py +++ b/trio/hazmat.py @@ -1,14 +1,46 @@ # These are all re-exported from trio._core. See comments in trio/__init__.py -# for details. +# for details. To make static analysis easier, this lists all possible +# symbols, and then we prune some below if they aren't available on this +# system. __all__ = [ - "Result", "Value", "Error", "cancel_shielded_checkpoint", "Abort", - "wait_task_rescheduled", "enable_ki_protection", "disable_ki_protection", - "currently_ki_protected", "Task", "checkpoint", "current_task", - "checkpoint_if_cancelled", "spawn_system_task", "reschedule", - "current_call_soon_thread_and_signal_safe", "wait_writable", - "wait_readable", "ParkingLot", "UnboundedQueue", "RunLocal", - "wait_socket_readable", "wait_socket_writable" + "Result", + "Value", + "Error", + "cancel_shielded_checkpoint", + "Abort", + "wait_task_rescheduled", + "enable_ki_protection", + "disable_ki_protection", + "currently_ki_protected", + "Task", + "checkpoint", + "current_task", + "checkpoint_if_cancelled", + "spawn_system_task", + "reschedule", + "current_call_soon_thread_and_signal_safe", + "wait_writable", + "wait_readable", + "ParkingLot", + "UnboundedQueue", + "RunLocal", + "wait_socket_readable", + "wait_socket_writable", + # kqueue symbols + "current_kqueue", + "monitor_kevent", + "wait_kevent", + # windows symbols + "current_iocp", + "register_with_iocp", + "wait_overlapped", + "monitor_completion_key", ] from . import _core -globals().update({sym: getattr(_core, sym) for sym in __all__}) +# Some hazmat symbols are platform specific +for _sym in list(__all__): + if hasattr(_core, _sym): + globals()[_sym] = getattr(_core, _sym) + else: + __all__.remove(_sym)