File: //proc/self/root/lib/python3.6/site-packages/usb/__pycache__/_objfinalizer.cpython-36.opt-1.pyc
3
�~�V� � @ s^ d dl Z dgZG dd� de�Ze jdkrJd dlZdd� ZG dd� de�ZnG d d� de�ZdS )
� N�AutoFinalizedObjectc s@ e Zd ZdZdd� Z� fdd�Zdd� Zdd � Zd
d� Z� Z S )�_AutoFinalizedObjectBasez[
Base class for objects that get automatically
finalized on delete or at exit.
c C s dS )z�Actually finalizes the object (frees allocated resources etc.).
Returns: None
Derived classes should implement this.
N� )�selfr r �#/usr/lib/python3.6/_objfinalizer.py�_finalize_object* s z)_AutoFinalizedObjectBase._finalize_objectc s t t| �j| �}d|_|S )z�Creates a new object instance and adds the private finalizer
attributes to it.
Returns: new object instance
Arguments:
* *args, **kwargs -- ignored
F)�superr �__new__�_finalize_called)�cls�args�kwargs�instance)� __class__r r r 3 s z _AutoFinalizedObjectBase.__new__c C s | j sd| _ | j� dS )z\Helper method that finalizes the object if not already done.
Returns: None
TN)r
r )r r r r �_do_finalize_object@ s z,_AutoFinalizedObjectBase._do_finalize_objectc C s t d��dS )zIFinalizes the object if not already done.
Returns: None
z6finalize() must be implemented by AutoFinalizedObject.N)�NotImplementedError)r r r r �finalizeI s z!_AutoFinalizedObjectBase.finalizec C s | j � d S )N)r )r r r r �__del__S s z _AutoFinalizedObjectBase.__del__)
�__name__�
__module__�__qualname__�__doc__r r r r r �
__classcell__r r )r r r $ s
r i c C s | � }|dk r|j � dS )a) Helper function for weakref.finalize() that dereferences a weakref
to an object and calls its _do_finalize_object() method if the object
is still alive. Does nothing otherwise.
Returns: None (implicit)
Arguments:
* obj_ref -- weakref to an object
N)r )Zobj_ref�objr r r �_do_finalize_object_ref[ s
r c s$ e Zd Z� fdd�Zdd� Z� ZS )r c s2 t t| �j| f|�|�}tj|ttj|��|_|S )a& Creates a new object instance and adds the private finalizer
attributes to it.
Returns: new object instance
Arguments:
* *args, **kwargs -- passed to the parent instance creator
(which ignores them)
)r r r �weakrefr r �ref�
_finalizer)r r r
r )r r r r m s
zAutoFinalizedObject.__new__c C s | j � dS )z)Finalizes the object if not already done.N)r )r r r r r � s zAutoFinalizedObject.finalize)r r r r r r r r )r r r k s !c @ s e Zd Zdd� ZdS )r c C s | j � dS )z)Finalizes the object if not already done.N)r )r r r r r � s zAutoFinalizedObject.finalizeN)r r r r r r r r r � s )�sys�__all__�objectr �
hexversionr r r r r r r �<module> s 3
,