
    rh	                        d dl mZ d dlZd dlZd dlZd dlmZ d	dZd
dZed        Z	eej                  fd       Zd Zy)    )annotationsN)contextmanagerc                    | j                   j                  }||t        j                   j                  k(  r| j                   j                  S |dz   | j                   j                  z   S )a  
    Gives a full name (package_name.class_name) for a class / object in Python. Will
    be used to load the correct classes from JSON files

    Args:
        o: The object for which to get the full name.

    Returns:
        str: The full name of the object.

    Example:
        >>> from sentence_transformers.losses import MultipleNegativesRankingLoss
        >>> from sentence_transformers import SentenceTransformer
        >>> from sentence_transformers.util import fullname
        >>> model = SentenceTransformer('all-MiniLM-L6-v2')
        >>> loss = MultipleNegativesRankingLoss(model)
        >>> fullname(loss)
        'sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss'
    .)	__class__
__module__str__name__)omodules     r/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/sentence_transformers/util/misc.pyfullnamer   	   sR    * [[##F~3==#;#;;{{###|akk2222    c                8   	 | j                  dd      \  }}	 t        j                  |       }	 t        ||      S # t        $ r |  d}t        |      w xY w# t
        $ r t        j                  |      }Y Jw xY w# t        $ r d| d| d}t        |      w xY w)a:  
    Import a dotted module path and return the attribute/class designated by the
    last name in the path. Raise ImportError if the import failed.

    Args:
        dotted_path (str): The dotted module path.

    Returns:
        Any: The attribute/class designated by the last name in the path.

    Raises:
        ImportError: If the import failed.

    Example:
        >>> import_from_string('sentence_transformers.losses.MultipleNegativesRankingLoss')
        <class 'sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss'>
    r      z  doesn't look like a module pathzModule "z" does not define a "z" attribute/class)rsplit
ValueErrorImportError	importlibimport_module	ExceptiongetattrAttributeError)dotted_pathmodule_path
class_namemsgr   s        r   import_from_stringr   %   s    $"-"4"4S!"<Z
6((5vz**  =>#  6((56
  %::,FWX#s%   : A A; AA87A8;Bc               #  |   K   ddl m} m}m}  |       }	 |r |         d |r |        yy# |r |        w w xY ww)zN
    A context manager that will disable caching in the datasets library.
    r   )disable_cachingenable_cachingis_caching_enabledN)datasetsr    r!   r"   )r    r!   r"   is_originally_enableds       r   disable_datasets_cachingr%   I   sF     
 ML.0   !  !s   <- <9<c              #     K   t         j                  j                  j                  }t        j                  |        	 d t        j                  |       y# t        j                  |       w xY ww)z
    A context manager that will prevent any logging messages
    triggered during the body from being processed.

    Args:
        highest_level: the maximum logging level allowed.
    N)loggingrootmanagerdisable)highest_levelprevious_levels     r   disable_loggingr-   [   sI      \\))11NOOM"(''s   :A1A A1A..A1c                d   t        | dd      5 }t        j                  |      }t        |      }d d d        t	              dkD  rS|d   j                  |       t        | ddd      5 }t        j                  |      }|j                  |       d d d        yy# 1 sw Y   kxY w# 1 sw Y   yxY w)	N zutf-8)newlineencodingr   wTF)opencsvreaderlistlenextendwriter	writerows)csv_pathadditional_datafr6   rowsr:   s         r   append_to_last_rowr@   m   s    	hW	5 AF| 4y1}R( (Cg> 	#!ZZ]FT"	#  	# s   !B)'B&B#&B/)returnr	   )r   r	   rA   type)
__future__r   r5   r   r'   
contextlibr   r   r   r%   CRITICALr-   r@    r   r   <module>rG      sU    " 
   %38!H  " ")"2"2 ( ("r   