Ë
    Fêñi¥  ã                  óˆ   — d dl mZ d dlZd dlZd dlZd dlZd dlmZ  G d„ d«      Ze	dk(  r e
ej                  «       «       yy)é    )ÚannotationsN)ÚPathc                  ó<   — e Zd ZdZedd„«       Zedd„«       Zdd„Zy)ÚCPUInfoað  Provide cross-platform CPU brand and model information.

    Query platform-specific sources to retrieve a human-readable CPU descriptor and normalize it for consistent
    presentation across macOS, Linux, and Windows. If platform-specific probing fails, generic platform identifiers are
    used to ensure a stable string is always returned.

    Methods:
        name: Return the normalized CPU name using platform-specific sources with robust fallbacks.
        _clean: Normalize and prettify common vendor brand strings and frequency patterns.
        __str__: Return the normalized CPU name for string contexts.

    Examples:
        >>> CPUInfo.name()
        'Apple M4 Pro'
        >>> str(CPUInfo())
        'Intel Core i7-9750H 2.60GHz'
    c                 ó‚  — 	 t         j                  dk(  rJt        j                  g d¢dd¬«      j                  j                  «       } | �r"t        j                  | «      S t         j                  j                  d«      rot        d«      }|j                  «       rÓ|j                  d¬«      j                  «       D ]0  }d	|v sŒt        j                  |j                  d
d«      d   «      c S  nt         j                  j                  d«      r`	 ddl}|j                  |j                   d«      5 }|j#                  |d«      \  }}|rt        j                  |«      cddd«       S 	 ddd«       t        j&                  «       xs5 t)        t        j*                  «       dd«      xs t        j,                  «       } t        j                  | xs d«      S # 1 sw Y   ŒmxY w# t$        $ r Y Œ{w xY w# t$        $ rJ t        j&                  «       xs t        j,                  «       xs d} t        j                  | xs d«      cY S w xY w)zDReturn a normalized CPU model string from platform-specific sources.Údarwin)Úsysctlz-nzmachdep.cpu.brand_stringT)Úcapture_outputÚtextÚlinuxz/proc/cpuinfoÚignore)Úerrorsz
model nameú:é   Úwinr   Nz.HARDWARE\DESCRIPTION\System\CentralProcessor\0ÚProcessorNameStringÚ	processorÚ zUnknown CPU)ÚsysÚplatformÚ
subprocessÚrunÚstdoutÚstripr   Ú_cleanÚ
startswithr   ÚexistsÚ	read_textÚ
splitlinesÚsplitÚwinregÚOpenKeyÚHKEY_LOCAL_MACHINEÚQueryValueExÚ	Exceptionr   ÚgetattrÚunameÚmachine)ÚsÚpÚlineÚwrÚkÚvalÚ_s          úW/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/ultralytics/utils/cpu.pyÚnamezCPUInfo.name   s×  € ð 	6Ü�|‰|˜xÒ'ä—N‘NÚ@ÐQUÐ\`ôç‘&Ÿ™›ð ò Ü"Ÿ>™>¨!Ó,Ð,Ü—‘×(Ñ(¨Ô1ä˜Ó)�Ø—8‘8”:Ø !§¡°8 Ó <× GÑ GÓ Iò I˜Ø'¨4Ò/Ü#*§>¡>°$·*±*¸SÀ!Ó2DÀQÑ2GÓ#HÒHñIô —‘×(Ñ(¨Ô/ð	Û'àŸ™ B×$9Ñ$9Ð;lÓmð 7ÐqrØ!#§¡°Ð4IÓ!J™˜˜QÙÜ#*§>¡>°#Ó#6÷7ñ 7à÷7ô ×"Ñ"Ó$Òh¬´·±Ó0@À+ÈrÓ(RÒhÔV^×VfÑVfÓVhˆAÜ—>‘> !Ò"4 }Ó5Ð5÷7ð 7ûô !ò áðûô ò 	6ä×"Ñ"Ó$Ò@¬×(8Ñ(8Ó(:Ò@¸bˆAÜ—>‘> !Ò"4 }Ó5Ò5ð	6úsi   ‚AG+ ÁA!G+ Ã)G+ Ã+!G+ Ä G Ä-,GÅ	G Å$G Å,A#G+ ÇGÇG Ç	G(Ç%G+ Ç'G(Ç(G+ Ç+AH>È=H>c                ó   — t        j                  dd| j                  «       «      } | j                  dd«      j                  dd«      j                  dd«      j                  dd«      j                  «       } t        j                  d| t         j
                  «      x}r%|j                  d	«      › d|j                  d
«      › �S t        j                  d| t         j
                  «      x}r%|j                  d	«      › d|j                  d
«      › �S | S )z3Normalize and prettify a raw CPU descriptor string.z\s+ú z(TM)r   z(tm)z(R)z(r)z%(Intel.*?i\d[\w-]*) CPU @ ([\d.]+GHz)r   é   z((AMD.*?Ryzen.*?[\w-]*) CPU @ ([\d.]+GHz))ÚreÚsubr   ÚreplaceÚsearchÚIÚgroup)r)   Úms     r0   r   zCPUInfo._cleanD   sß   € ô �F‰F�6˜3 §¡£	Ó*ˆØ�I‰I�f˜bÓ!×)Ñ)¨&°"Ó5×=Ñ=¸eÀRÓH×PÑPÐQVÐXZÓ[×aÑaÓcˆÜ—	‘	ÐBÀAÄrÇtÁtÓLÐLˆ1ÐLØ—g‘g˜a“j�\  1§7¡7¨1£: ,Ð/Ð/Ü—	‘	ÐEÀqÌ"Ï$É$ÓOÐOˆ1ÐOØ—g‘g˜a“j�\  1§7¡7¨1£: ,Ð/Ð/Øˆó    c                ó"   — | j                  «       S )zReturn the normalized CPU name.)r1   )Úselfs    r0   Ú__str__zCPUInfo.__str__O   s   € à�y‰y‹{Ðr<   N)ÚreturnÚstr)r)   rA   r@   rA   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr1   r   r?   © r<   r0   r   r      s5   „ ñð$ ò"6ó ð"6ðH òó ðôr<   r   Ú__main__)Ú
__future__r   r   r5   r   r   Úpathlibr   r   rB   Úprintr1   rG   r<   r0   ú<module>rL      sC   ðõ #ã Û 	Û Û 
Ý ÷Eñ EðP ˆzÒÙ	ˆ'�,‰,‹.Õð r<   