class_docstr: Create a zmq Context
  
  A zmq Context creates sockets via its ``ctx.socket`` method.
  
  .. versionchanged:: 24
  
      When using a Context as a context manager (``with zmq.Context()``),
      or deleting a context without closing it first,
      ``ctx.destroy()`` is called,
      closing any leftover sockets,
      instead of `ctx.term()` which requires sockets to be closed first.
  
      This prevents hangs caused by `ctx.term()` if sockets are left open,
      but means that unclean destruction of contexts
      (with sockets left open) is not safe
      if sockets are managed in other threads.
  
  .. versionadded:: 25
  
      Contexts can now be shadowed by passing another Context.
      This helps in creating an async copy of a sync context or vice versa::
  
          ctx = zmq.Context(async_ctx)
  
      Which previously had to be::
  
          ctx = zmq.Context.shadow(async_ctx.underlying)
class_docstr_tok: ["Create","a","zmq","Context","A","zmq","Context","creates","sockets","via","its","``","ctx.socket","``","method",".","..","versionchanged",":",":","24","When","using","a","Context","as","a","context","manager","(","``","with","zmq.Context","(",")","``",")",",","or","deleting","a","context","without","closing","it","first",",","``","ctx.destroy","(",")","``","is","called",",","closing","any","leftover","sockets",",","instead","of","`","ctx.term","(",")","`","which","requires","sockets","to","be","closed","first",".","This","prevents","hangs","caused","by","`","ctx.term","(",")","`","if","sockets","are","left","open",",","but","means","that","unclean","destruction","of","contexts","(","with","sockets","left","open",")","is","not","safe","if","sockets","are","managed","in","other","threads",".","..","versionadded",":",":","25","Contexts","can","now","be","shadowed","by","passing","another","Context",".","This","helps","in","creating","an","async","copy","of","a","sync","context","or","vice","versa",":",":","ctx","=","zmq.Context","(","async_ctx",")","Which","previously","had","to","be",":",":","ctx","=","zmq.Context.shadow","(","async_ctx.underlying",")"]
docstr: Close or terminate the context.
  
  Context termination is performed in the following steps:
  
  - Any blocking operations currently in progress on sockets open within context shall
    raise :class:`zmq.ContextTerminated`.
    With the exception of socket.close(), any further operations on sockets open within this context
    shall raise :class:`zmq.ContextTerminated`.
  - After interrupting all blocking calls, term shall block until the following conditions are satisfied:
      - All sockets open within context have been closed.
      - For each socket within context, all messages sent on the socket have either been
        physically transferred to a network peer,
        or the socket's linger period set with the zmq.LINGER socket option has expired.
  
  For further details regarding socket linger behaviour refer to libzmq documentation for ZMQ_LINGER.
  
  This can be called to close the context by hand. If this is not called,
  the context will automatically be closed when it is garbage collected,
  in which case you may see a ResourceWarning about the unclosed context.
docstr_tok: ["Close","or","terminate","the","context",".","Context","termination","is","performed","in","the","following","steps",":","-","Any","blocking","operations","currently","in","progress","on","sockets","open","within","context","shall","raise",":","class",":","`","zmq.ContextTerminated","`",".","With","the","exception","of","socket.close","(",")",",","any","further","operations","on","sockets","open","within","this","context","shall","raise",":","class",":","`","zmq.ContextTerminated","`",".","-","After","interrupting","all","blocking","calls",",","term","shall","block","until","the","following","conditions","are","satisfied",":","-","All","sockets","open","within","context","have","been","closed",".","-","For","each","socket","within","context",",","all","messages","sent","on","the","socket","have","either","been","physically","transferred","to","a","network","peer",",","or","the","socket","'s","linger","period","set","with","the","zmq.LINGER","socket","option","has","expired",".","For","further","details","regarding","socket","linger","behaviour","refer","to","libzmq","documentation","for","ZMQ_LINGER",".","This","can","be","called","to","close","the","context","by","hand",".","If","this","is","not","called",",","the","context","will","automatically","be","closed","when","it","is","garbage","collected",",","in","which","case","you","may","see","a","ResourceWarning","about","the","unclosed","context","."]
code: def term(self) -> None:
      """Close or terminate the context.
  
      Context termination is performed in the following steps:
  
      - Any blocking operations currently in progress on sockets open within context shall
        raise :class:`zmq.ContextTerminated`.
        With the exception of socket.close(), any further operations on sockets open within this context
        shall raise :class:`zmq.ContextTerminated`.
      - After interrupting all blocking calls, term shall block until the following conditions are satisfied:
          - All sockets open within context have been closed.
          - For each socket within context, all messages sent on the socket have either been
            physically transferred to a network peer,
            or the socket's linger period set with the zmq.LINGER socket option has expired.
  
      For further details regarding socket linger behaviour refer to libzmq documentation for ZMQ_LINGER.
  
      This can be called to close the context by hand. If this is not called,
      the context will automatically be closed when it is garbage collected,
      in which case you may see a ResourceWarning about the unclosed context.
      """
      super().term()
  
imports: import atexit
  import os
  from threading import Lock
  from typing import Any, Callable, Dict, Generic, List, Optional, Type, TypeVar, Union, overload
  from warnings import warn
  from weakref import WeakSet
  from zmq.backend import Context
  from zmq.constants import ContextOption, Errno, SocketOption
  from zmq.error import ZMQError
  from zmq.utils.interop import cast_int_addr
  from .attrsettr import AttributeSetter, OptValT
  from .socket import Socket
label_desc: Use image node_id 13 for calling the Context obj's underlying member method code with example usage: obj.term() without return types