
    i
                        d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
 ddlZddlmZ ddlmZ eee
e
geee	eeef      gdf   eg df   f   f   Zg fdeeef   dee   deeee   ef      fd	Zd
eeef   deeef   fdZdeeef   deeef   fdZ	 dde	ee      deegef   fdZej0                  ej2                  fddde
de
deeef   fdZy)z1
Configuration utilities copied from spacy.util.
    N)DictAnyTupleCallableIteratorListOptionalIO)Language)registrynodeparentreturnc              #      K   | j                         D ]6  \  }}g ||}t        |t              rt        ||      E d{    1||f 8 y7 w)z8Walk a dict and yield the path and values of the leaves.N)items
isinstancedict	walk_dict)r   r   keyvalue
key_parents        c/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/spacy_loggers/util.pyr   r      sX      jjl &
U#v^s^
eT" 
333u%%& 4s   <AAAvaluesc                     i }| j                         D ]`  \  }}|}|j                         j                  d      }t        |      D ],  \  }}|t	        |      dz
  k(  }|j                  ||r|ni       }. b |S )a  Convert dot notation to a dict. For example: {"token.pos": True,
    "token._.xyz": True} becomes {"token": {"pos": True, "_": {"xyz": True }}}.

    values (Dict[str, Any]): The key/value pairs to convert.
    RETURNS (Dict[str, dict]): The converted values.
    .   )r   lowersplit	enumeratelen
setdefault)	r   resultr   r   pathpartsiitemis_lasts	            r   dot_to_dictr(      s     Flln C
U		!!#& ' 	CGAt3u:>)G??4'rBD	CC M    objc                 j    t        |       D ci c]  \  }}dj                  |      | c}}S c c}}w )zConvert dot notation to a dict. For example: {"token": {"pos": True,
    "_": {"xyz": True }}} becomes {"token.pos": True, "token._.xyz": True}.

    values (Dict[str, dict]): The dict to convert.
    RETURNS (Dict[str, Any]): The key/value pairs.
    r   )r   join)r*   r   r   s      r   dict_to_dotr-   /   s-     4=S>BZS%CHHSM5 BBBs   /regexpsc                    	 g | ;| D ]6  }j                  t        j                  |t        j                               8 dt        dt        ffd}|S # t        j                  $ r}t        d d      |d }~ww xY w)N)flagszRegular expression `z/` couldn't be compiled for logger stats matcherstringr   c                 :    D ]  }|j                  |       s y y)NTF)search)r1   regexcompileds     r   is_matchz,matcher_for_regex_patterns.<locals>.is_matchF   s&     	E||F#	 r)   )appendrecompile	MULTILINEerror
ValueErrorstrbool)r.   r4   errr6   r5   s       @r   matcher_for_regex_patternsr@   9   s      G

5 EFG   O 88 "5')XY
	s   ?A A>)A99A>nlpr   stdoutstderrc                 b    t        j                  dd      } |d      } || ||      \  }}||fS )Nloggerszspacy.ConsoleLogger.v1F)progress_bar)r   get)rA   rB   rC   console_loggerconsoleconsole_log_stepconsole_finalizes          r   setup_default_console_loggerrL   O   s@     \\)-EFN%0G)0ff)E&&---r)   )N)__doc__systypingr   r   r   r   r   r   r	   r
   r8   spacyr   
spacy.utilr   r=   LoggerTr   r   r(   r-   r>   r@   rB   rC   rL    r)   r   <module>rT      sb    K K K 	   r2	(HT#s(^,-t3
4hr4x6H
HIK /1	&
sCx.	&"&s)	&eDIsN#$	&S#X 4T	? "CT#t)_ Cc3h C $(d3i seTk. #&**3::.	..68.
8X.r)   