o
    i                     @   s`   d Z ddlZddlZddlZeejZe Ze Z	e Z
defddZdefddZdS )zUtility functions for object identification and counting.

This module provides thread-safe utilities for generating unique identifiers
and maintaining per-class instance counts across the Pipecat framework.
    Nreturnc                   C   s0   t  ttW  d   S 1 sw   Y  dS )zGenerate a unique id for an object.

    Returns:
        A unique integer identifier that increments globally across all objects.
    N)_ID_LOCKnext_ID r   r   G/home/ubuntu/.local/lib/python3.10/site-packages/pipecat/utils/utils.pyobj_id   s   $r   c                 C   s8   t  tt| jj W  d   S 1 sw   Y  dS )zGenerate a unique count for an object based on its class.

    Args:
        obj: The object instance to count.

    Returns:
        A unique integer count that increments per class type.
    N)_COUNTS_LOCKr   _COUNTS	__class____name__)objr   r   r   	obj_count!   s   	$r   )__doc__collections	itertools	threadingdefaultdictcountr
   Lockr	   r   r   intr   r   r   r   r   r   <module>   s   
