403Webshell
Server IP : 172.24.0.40  /  Your IP : 216.73.216.10
Web Server : Apache
System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64
User : apache ( 48)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.6/site-packages/rhsmlib/facts/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.6/site-packages/rhsmlib/facts/__pycache__/cpuinfo.cpython-36.pyc
3

a�e�:�@s~ddlmZmZmZddlZddlZddlZddlZejde	�Z
Gdd�de�ZGdd�de�Z
Gdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZGd(d)�d)e�ZGd*d+�d+e�Z Gd,d-�d-e�Z!Gd.d/�d/e�Z"Gd0d1�d1e�Z#dS)2�)�print_function�division�absolute_importNz	rhsm-app.c@seZdZdZdZdZdS)�DefaultCpuFieldsa|Maps generic cpuinfo fields to the corresponding field from ProcessorModel.

    For, a cpu MODEL (a number or string that the cpu vendor assigns to that model of
    cpu, '45' for an intel Xeon for example)
    is in the 'model' field in /proc/cpuinfo, and the
    'model' in the sluggified field in X86_64ProcessorModel. For aarch64,
    the field 'cpu_part' is it's MODEL.
    �
model_name�modelN)�__name__�
__module__�__qualname__�__doc__�
MODEL_NAME�MODEL�rr�/usr/lib64/python3.6/cpuinfo.pyrpsrc@seZdZdZdZdS)�X86_64FieldsrrN)rr	r
rr
rrrrr}src@seZdZdZdZdS)�
Aarch64FieldsZcpu_partrN)rr	r
r
rrrrrr�src@seZdZdZdZdS)�Ppc64Fieldsr�machineN)rr	r
r
rrrrrr�src@sFeZdZeZddd�Zedd��Zedd��Zedd	��Z	d
d�Z
dS)
�CpuinfoModelNcCs(||_g|_g|_i|_d|_d|_dS)N)�cpuinfo_data�
processors�other�common�_model_name�_model)�selfrrrr�__init__�szCpuinfoModel.__init__cCs
t|j�S)N)�lenr)rrrr�count�szCpuinfoModel.countcCs(|jr|jS|jsdS|jj|jjd�S)N)rr�get�fields_classr)rrrrr�s
zCpuinfoModel.model_namecCs(|jr|jS|jsdS|jj|jjd�S)N)rrrr r
)rrrrr�s
zCpuinfoModel.modelcCs�g}|jd|j�|jd|j�|jd�x.t|jj��D]}|jd||j|f�q>W|jd�x$|jD]\}}|jd||f�qpW|jd�dj|�S)NzProcessor count: %szmodel_name: %s�z%s: %s�
)�appendrr�sortedr�keysr�join)r�lines�k�vrrr�__str__�s


zCpuinfoModel.__str__)N)rr	r
rr r�propertyrrrr*rrrrr�s


rc@seZdZdZdS)�Aarch64ProcessorModelzPThe info corresponding to the info about each aarch64 processor entry in cpuinfoN)rr	r
rrrrrr,�sr,c@seZdZdZdS)�X86_64ProcessorModelzOThe info corresponding to the info about each X86_64 processor entry in cpuinfoN)rr	r
rrrrrr-�sr-c@seZdZdZedd��ZdS)�Ppc64ProcessorModelzNThe info corresponding to the info about each ppc64 processor entry in cpuinfocCs"|�}|jtdd�|D���|S)NcSsg|]}t|��qSr)�fact_sluggify_item)�.0�itemrrr�
<listcomp>�sz3Ppc64ProcessorModel.from_stanza.<locals>.<listcomp>)�update�dict)�cls�stanza�cpu_datarrr�from_stanza�szPpc64ProcessorModel.from_stanzaN)rr	r
r�classmethodr8rrrrr.�sr.c@seZdZdZeZdS)�X86_64CpuinfoModelz�The model for all the cpuinfo data for all processors on the machine.

    ie, all the data in /proc/cpuinfo field as opposed to X86_64ProcessModel which
    is the info for 1 processor.N)rr	r
rrr rrrrr:�sr:c@seZdZeZdS)�Ppc64CpuinfoModelN)rr	r
rr rrrrr;�sr;c@seZdZeZdS)�Aarch64CpuinfoModelN)rr	r
rr rrrrr<�sr<cCs|j�j�jdd�jdd�S)z�Encodes an arbitrary string to something that can be used as a fact name.

    ie, 'model_name' instead of 'Model name'
    whitespace -> _
    lowercase
    utf8
    escape quotes

    In theory, any utf8 would work
    � �_�.)�lower�strip�replace)�keyrrr�
fact_sluggify�srDcCst|d�}||dfS)Nr�)rD)Z
item_tupleZnewkeyrrrr/�sr/ccs(x"|j�D]}||�}|r
|Vq
WdS)N)�
splitlines)Z
file_contents�
line_splitter�line�partsrrr�split_key_value_generatorsrJcCs*|jdd�}|dr&dd�|D�}|SdS)N�:rErcSsg|]}|j��qSr)rA)r0�partrrrr2sz!line_splitter.<locals>.<listcomp>)�split)rHrIrrrrG	s
rGcCsx|D]}|j|�qW|S)N)�add)Zfields_accumZfields�fieldrrr�accumulate_fieldss
rPcsjtjt��xD|D]<�x6�fdd�|D�D] \}}|dkr:q(�|j|�q(WqWt�fdd��D��}|S)Ncsg|]}�|j��f�qSr)r)r0�	processor)rOrrr2 sz/find_shared_key_value_pairs.<locals>.<listcomp>cs,g|]$}t�|�dkr|�|j�f�qS)rE)r�pop)r0�x)�smashedrrr2&s)�collections�defaultdict�setrNr4)�
all_fieldsrr(r)Zcommon_cpu_infor)rOrTr�find_shared_key_value_pairss

rYccsTd}x@|D]8\}}||kr0|r$|V||fg}q
|r
|j||f�q
W|rP|VdS)a
Split the iterable kv_list into chunks by field.

    For a list with repeating stanzas in it, this will
    return a generate that will return each chunk.

    For something like /proc/cpuinfo, called with
    field 'processor', each stanza is a different cpu.
    N)r#)�kv_listrOZcurrent_stanzarC�valuerrr�split_kv_list_by_field*s	
r\c@seZdZedd��ZdS)�BaseCpuInfocCs|�}|j|�|S)z�Return a BaseCpuInfo subclass based on proc_cpuinfo_string.

        proc_cpuinfo_string is the string resulting from reading
        the entire contents of /proc/cpuinfo.)�_parse)r5�proc_cpuinfo_string�cpu_inforrr�from_proc_cpuinfo_stringZs
z$BaseCpuInfo.from_proc_cpuinfo_stringN)rr	r
r9rarrrrr]Ysr]c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Aarch64CpuInfocCst�|_dS)N)r<r`)rrrrrgszAarch64CpuInfo.__init__csXt|t�}�fdd�|D�}dd�|D�}�j|��j_�j|��j_�j|��j_dS)Nc3s|]}�j|�VqdS)N)� _capital_processor_to_model_name)r0r1)rrr�	<genexpr>osz(Aarch64CpuInfo._parse.<locals>.<genexpr>cSsg|]}t|��qSr)r/)r0r1rrrr2rsz)Aarch64CpuInfo._parse.<locals>.<listcomp>)	rJrG�gather_cpu_info_modelr`r�gather_processor_listr�gather_cpu_info_otherr)rrZraw_kv_iter�kv_iterZslugged_kv_listr)rrr^js

zAarch64CpuInfo._parsecCs|ddkrd|d<|S)z�Use the uppercase Processor field value as the model name.

        For aarch64, the 'Processor' field is the closest to model name,
        so we sub it in now.rZ	Processorrr)rr1rrrrc{sz/Aarch64CpuInfo._capital_processor_to_model_namecCs@g}x6|D].\}}|dkrq
|j|�}||d<|j|�q
W|S)NrQ)rer#)rrZZprocessor_listr(r)Zcpu_info_modelrrrrf�s
z$Aarch64CpuInfo.gather_processor_listcCs0g}x&|D]\}}|dkr
|j||g�q
W|S)N�hardware)r#)rrZZ
other_listr(r)rrrrg�s
z$Aarch64CpuInfo.gather_cpu_info_othercCs6t�}x*|D]"\}}|dks|dkr&q|||<qW|S)NrQri)r,)rrZr7r(r)rrrre�sz$Aarch64CpuInfo.gather_cpu_info_modelN)	rr	r
rr^rcrfrgrerrrrrbfs	rbc@s$eZdZdd�Zdd�Zdd�ZdS)�
X86_64CpuInfocCst�|_dS)N)r:r`)rrrrr�szX86_64CpuInfo.__init__cCspt|t�}g}t�}x8t|d�D]*}|j|�}|j|�t|t|j���}q Wt	||�|j
_||j
_||j
_
dS)NrQ)rJrGrWr\�"processor_stanza_to_processor_datar#rP�listr%rYr`rrr)rrrhrrX�processor_stanza�	proc_dictrrrr^�s


zX86_64CpuInfo._parsecCs"t�}|jtdd�|D���|S)z<Take a list of k,v tuples, sluggify name, and add to a dict.cSsg|]}t|��qSr)r/)r0r1rrrr2�szDX86_64CpuInfo.processor_stanza_to_processor_data.<locals>.<listcomp>)r-r3r4)rr6r7rrrrk�sz0X86_64CpuInfo.processor_stanza_to_processor_dataN)rr	r
rr^rkrrrrrj�srjc@s$eZdZdd�Zdd�Zdd�ZdS)�Ppc64CpuInfocCst�|_dS)N)r;r`)rrrrr�szPpc64CpuInfo.__init__cCsft|t�}tj|j|�}x*t|d�D]}tj|�}|jj	j
|�q$Wtdd�|D��|j_||j_
dS)NrQcSsg|]}t|��qSr)r/)r0r1rrrr2�sz'Ppc64CpuInfo._parse.<locals>.<listcomp>)rJrG�	itertools�	takewhile�_not_timebase_keyr\r.r8r`rr#r4rr)rrrhZprocessor_iterrmrnrrrr^�s

zPpc64CpuInfo._parsecCs|ddkS)NrZtimebaser)rr1rrrrr�szPpc64CpuInfo._not_timebase_keyN)rr	r
rr^rrrrrrro�s
roc@s:eZdZeeeed�ZdZeddd��Z	ed	dd��Z
dS)
�SystemCpuInfoFactory)Zx86_64Zaarch64Zppc64Zppc64lez
/proc/cpuinfoNcCs,|tjkrt�|j|�}|j|}|j|�S)N)rs�uname_to_cpuinfo�NotImplementedError�open_proc_cpuinfora)r5Z
uname_machine�prefixr_Z
arch_classrrr�from_uname_machine�s



z'SystemCpuInfoFactory.from_uname_machinec	CsH|j}|r"tjj||jdd��}d}t|d��}|j�}WdQRX|S)NrEr!�r)�proc_cpuinfo_path�os�pathr&�open�read)r5rwrzZproc_cpuinfo_bufZproc_cpuinfo_frrrrv�sz&SystemCpuInfoFactory.open_proc_cpuinfo)N)N)rr	r
rjrbrortrzr9rxrvrrrrrs�s
rs)$Z
__future__rrrrUrpZloggingr{Z	getLoggerr�log�objectrrrrrr4r,r-r.r:r;r<rDr/rJrGrPrYr\r]rbrjrorsrrrr�<module>s8P
>	
/
<

Youez - 2016 - github.com/yon3zu
LinuXploit