
    -h                    |    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 erd dl
mZ d dlmZmZ  G d d	          Zd
S )    )annotations)defaultdict)Path)TYPE_CHECKING)Kind)GriffeLoader)AliasObjectc                  *    e Zd ZdZddZdd	ZddZdS )Statsz$Load statistics for a Griffe loader.loaderr   returnNonec                   || _         	 t          t          dddddddd          }|j        j                                        }t          j        dt          j        dt          j	        dt          j
        di| _        	 t          |          | _        	 || _        	 t          d |j                                        D                       | _        	 d| _        	 d| _        	 d| _        	 |D ]}|                     |           dS )zoInitialiwe the stats object.

        Parameters:
            loader: The loader to compute stats for.
        r   ) .py.pyiz.pycz.pyoz.pydz.soc              3  4   K   | ]}t          |          V  d S )N)len).0liness     J/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/_griffe/stats.py	<genexpr>z!Stats.__init__.<locals>.<genexpr>:   s(      RRURRRRRR    N)r   r   intmodules_collectionmembersvaluesr   MODULECLASSFUNCTION	ATTRIBUTEby_kindr   packagesmodules_by_extensionsumlines_collectionr   time_spent_visitingtime_spent_inspectingtime_spent_serializing
_itercount)selfr   r%   top_modulesmodules        r   __init__zStats.__init__   s!    .*  
  
 /7>>@@ KJM1NA	
 	)K((!$8!-RR1H1O1O1Q1QRRRRR
$#$ *%&",&'#-! 	$ 	$FOOF####	$ 	$r   rootObject | Aliasc                h   |j         rd S | j        |j        xx         dz  cc<   |j        rVt	          |j        t                    r | j        |j        j        xx         dz  cc<   n|j        | j        dxx         dz  cc<   |j	        
                                D ]}|                     |           d S )N   r   )is_aliasr#   kind	is_module
isinstancefilepathr   r%   suffixr   r   r+   )r,   r0   members      r   r+   zStats._itercountI   s    = 	FTY1$> 	3$-.. 3)$-*>???1D????&)"---2---l))++ 	$ 	$FOOF####	$ 	$r   strc                   g }| j         }| j        t          j                 }| j        t          j                 }| j        t          j                 }| j        t          j                 }t          ||||f          }|                    d           |                    d           |                    d           |                    d|            |                    d|            |                    d|            |                    d|            |                    d| d	| d
           | j	        }|d         }	|d         }
|d         }||	z
  |
z
  |z
  }|                    d           |                    d| j
                    |                    d           |                    d           |                    d|	            |                    d|            |                    d|
            |                    d|            |                    d           t          |                                          D ]"\  }}|r|                    d| d|            #| j        dz  }| j        dz  }||z   }||z  dz  }||z  dz  }| j        j        }|rdn|
}	 ||z  }n# t"          $ r d}Y nw xY w|	|z   |r|
ndz   }	 ||z  }n# t"          $ r d}Y nw xY w|                    d           |                    d| d| d|dd|dd	           |                    d | d| d|dd|dd	           | j        dz  }||z  }|                    d!| d|dd"           d#                    |          S )$zQFormat the statistics as text.

        Returns:
            Text stats.
        
Statisticsz---------------------zNumber of loaded objectsz  Modules: z  Classes: z  Functions: z  Attributes: z	  Total: z across z	 packagesr   r   r   zTotal number of lines: Modulesz  Builtin: z  Compiled: z  Regular: z	  Stubs: z  Per extension:z    z: i  d   r   zTime spent visiting modules (z): zms, z.02fzms/module (z%)zTime spent inspecting modules (zTime spent serializing: z	ms/module
)r$   r#   r   r   r    r!   r"   r&   appendr%   r   sorteditemsr(   r)   r   force_inspectionZeroDivisionErrorr*   join)r,   r   r$   modulesclasses	functions
attributesobjectsper_extbuiltinregularstubscompiledextnumber
visit_timeinspect_time
total_timevisit_percentinspect_percentrD   visited_modulesvisit_time_per_moduleinspected_modulesinspect_time_per_moduleserialize_timeserialize_time_per_modules                              r   as_textzStats.as_textU   s    =,t{+,tz*L/	\$.1
wJ?@@\""",---/000,7,,---,7,,---0Y001112j22333EEE(EEEFFF+"+%.W$w.6R;tz;;<<<RY,7,,---.H..///,7,,---((()))'(((!'--//22 	5 	5KC 53C33633444-4
1D8,.
"Z/#5&3c9;7/<!!W	&$.$@!!  	& 	& 	&$%!!!	& $h.=M2T''STU	(&25F&F##  	( 	( 	(&'###	( 	R]O ] ]] ]4\] ]FS\] ] ]	
 	
 	
 	c.? c cc c!8bc cJYbc c c	
 	
 	

 4t;$2W$<!mmmD]mmmmnnnyys$   /J5 5KKK K)(K)N)r   r   r   r   )r0   r1   r   r   )r   r;   )__name__
__module____qualname____doc__r/   r+   r^    r   r   r   r      s]        ..3$ 3$ 3$ 3$j
$ 
$ 
$ 
$H  H  H  H  H  H r   r   N)
__future__r   collectionsr   pathlibr   typingr   _griffe.enumerationsr   _griffe.loaderr   _griffe.modelsr	   r
   r   rc   r   r   <module>rk      s    # " " " " " # # # # # #                   % % % % % % -++++++,,,,,,,,L  L  L  L  L  L  L  L  L  L r   