3
]ð](  ã               @   s4   d Z ddlZddlZddlmZ G dd„ deƒZdS )aî  DEPRECATED - A manager to handle when cursors are killed after they are
closed.

New cursor managers should be defined as subclasses of CursorManager and can be
installed on a client by calling
:meth:`~pymongo.mongo_client.MongoClient.set_cursor_manager`.

.. versionchanged:: 3.3
   Deprecated, for real this time.

.. versionchanged:: 3.0
   Undeprecated. :meth:`~pymongo.cursor_manager.CursorManager.close` now
   requires an `address` argument. The ``BatchCursorManager`` class is removed.
é    N)Úinteger_typesc               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚCursorManagerz+DEPRECATED - The cursor manager base class.c             C   s    t jdtdd� tj|ƒ| _dS )z[Instantiate the manager.

        :Parameters:
          - `client`: a MongoClient
        zCursor managers are deprecated.é   )Ú
stacklevelN)ÚwarningsÚwarnÚDeprecationWarningÚweakrefÚrefÚ_CursorManager__client)ÚselfÚclient© r   ú9/tmp/pip-build-20mum3z4/pymongo/pymongo/cursor_manager.pyÚ__init__&   s
    zCursorManager.__init__c             C   s(   t |tƒstdƒ‚| jƒ j|g|ƒ dS )a2  Kill a cursor.

        Raises TypeError if cursor_id is not an instance of (int, long).

        :Parameters:
          - `cursor_id`: cursor id to close
          - `address`: the cursor's server's (host, port) pair

        .. versionchanged:: 3.0
           Now requires an `address` argument.
        zcursor_id must be an integerN)Ú
isinstancer   Ú	TypeErrorr   Zkill_cursors)r   Z	cursor_idÚaddressr   r   r   Úclose2   s    
zCursorManager.closeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   #   s   r   )r   r   r	   Zbson.py3compatr   Úobjectr   r   r   r   r   Ú<module>   s   