Team Ai
Apppublic

kernel-memory-dump/HuggingFaceAgentsCourse_SmolAgent1

sourceHugging Faceupdated 2y agoView on Hugging Face
6likes
tech_priest_review.cpython-312.pyc38 linesDownload Raw Back to __pycache__
1�

2յ�gd���ddlmZddlZddlmZededeeeffd��Zedeeefdedefd	��Zededefd3��Z	y)�)�toolN)�Dict�code�returnc���ttjd|��ttjd|��ttjd|tj��ttjd|tj��ttjd|tj��d�}t|j
��dz}||d�S)	z�Analyzes code to determine its legacy score based on various patterns4    Args:5        code: The source code to analyze6    Returns:7        Dictionary containing legacy metrics8    z	TODO[:\(]z9FIXME[:\(]zdeprecated|obsoletez+legacy|old|maintain|backward.?compatibilityz^\s*//.*\{|\}|if|for|while)�todos�fixmes�10deprecated�legacy_markers�commented_code�11)�metrics�total_score)�len�re�findall�I�M�sum�values)r�legacy_patterns�legacy_scores   �`/media/seb/KEK/Hugging_face_space/HuggingFaceAgentsCourse_SmolAgent1/tools/tech_priest_review.py�analyze_code_legacyrs����R�Z�Z��d�3�4��b�j�j���5�6��"�*�*�%;�T�2�4�4�H�I���J�J�E�t�R�T�T�R�12��b�j�j�)F��b�d�d�S�T��O���-�-�/�0�2�5�L�&�|�D�D��analysis�code_snippetc��|d}gd�}|dkDr|jgd��g}|d}|ddkDr|jd|d�d	��|d13dkDr|jd�|ddkDr|jd
�|ddkDr|jd�dddj|ddD�cgc]}d|����	c}�ddj|D�cgc]}d|����	c}�d|dkDrdnd�d|�d�dg}dj|�Scc}wcc}w)z�Generates a Tech-Priest themed code review response14    Args:15        analysis: Dictionary containing code analysis metrics16        code_snippet: The original code being reviewed17    Returns:18        A Tech-Priest themed review response19    r)zBy the grace of the Omnissiahz!The Machine Spirit's wisdom flowszSacred patterns emergez$Binary benediction be upon this codezThe Mechanicus approves�2)z2Ancient wisdom courses through these blessed linesz(The rust of ages brings divine knowledgez1These sacred TODOs are prayers to the Machine Godz,Venerable patterns of the First Ones persistrrrz*intones in binary* z, sacred TODO markers await divine resolutionr20z?The ancient runes of deprecation mark paths of ancestral wisdomrz9Blessed legacy patterns weave through the sacred circuitsrz8Commented scriptures preserve the wisdom of the ancientsz$++ Begin Mechanicus Code Analysis ++z"*mechanical incense burners swing*�21N�z+ z22Technical Observations:z* z23Omnissiah's Verdict: zMOST SACRED�24ACCEPTABLEz (Legacy Score: �)z++ End Transmission ++)�extend�append�join)	rr�score�ritual_phrases�code_observationsr�phrase�obs�response_partss	         r�generate_tech_priest_responser-sc��
�]�#�E��N�
�r�z����
�	25����y�!�G��w��!��� � �"�7�7�#3�"4�4`�a�	26��|��q� �� � �M�	27��� �1�$�� � �G�	28��� �1�$�� � �F�	29�	/�,��	�	�~�b�q�/A�B�V�R��x�=�B�C�#��	�	�):�;�#�R��u�:�;�<�30!�5�2�:�-�<�!P�P`�af�`g�gh�i� ��N��9�9�^�$�$��C��;s�(C?�31Dc�4�t|�}t||�}|S)z�Performs a complete Tech-Priest themed code review32    Args:33        code: The source code to review34    Returns:35        A complete Tech-Priest themed review response36    )rr-)rr�responses   r�tech_priest_reviewr0ds��#�4�(�H�,�X�t�<�H��Or)37�38smolagentsrr�typingr�str�intrr-r0�rr�<module>r6s����	���E�c�E�d�3��8�n�E��E�,�A%�D��c��N�A%�#�A%�RU�A%��A%�H�	�S�	�S�	��	r