0x1949 Team - FAZEMRX - MANAGER
Edit File: quirkapplier.cpython-310.pyc
o ��f� � @ sf d dl m Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZ d dl Z G dd� d�Zdd� ZdS )� )�globNc @ sh e Zd Zddd�Zdd� Zdd� Zdd � Zd d� Zdd d�Zdd� Z dd� Z dd� Zdd� Zdd� Z dS )�QuirkChecker�/usr/share/jockey/quirksc C s. || _ || _g | _| �� | �� | _d| _d S )Nz/usr/share/X11/xorg.conf.d)�_handler�quirks_path�_quirks�get_quirks_from_path�get_system_info�_system_info�_xorg_conf_d_path)�self�handler�path� r �5/usr/lib/python3/dist-packages/Quirks/quirkapplier.py�__init__! s zQuirkChecker.__init__c C s| g | _ tj�| j�r3ttj�| jd��D ]}tj�|�r/t� d| � | � |�}| j |7 _ q| j S t� d| j � | j S )�5check all the files in a directory looking for quirks�*z Parsing %sz%s does not exist)r �osr �isdirr r �join�isfile�logging�debug�get_quirks_from_file)r �f�quirksr r r r ) s ��z!QuirkChecker.get_quirks_from_pathc C s t j�|�}|�� S )r )�Quirks�quirkreader� ReadQuirk� get_quirks)r � quirk_filer r r r 7 s z!QuirkChecker.get_quirks_from_filec C s t j�� }|�� S )zGet system info for the quirk)r � quirkinfo� QuirkInfo�get_dmi_info)r � quirk_infor r r r = s zQuirkChecker.get_system_infoc C s� d}|j �� D ]2}|j | D ]*}| j�|�r8| j�|�|kr8t|j | �dkr8t�d| j�|�|f � dS qqt�d� |S )zSee if tags match system infoT� zFailure to match %s with %sF�Success)� match_tags�keysr �get�lenr r )r �quirk�result�tag�valr r r �matches_tagsB s ��� zQuirkChecker.matches_tagsTc C s� | j D ]?}| j�� dd� |jD �v rBt�d|j � | �|�r=|r/t�d|j � | � |� qt�d|j � | � |� qt�d� qdS )z)Process quirks and do something with themc S s g | ]}|� � �� �qS r )�lower�strip)�.0�xr r r � <listcomp>R s z.QuirkChecker._check_quirks.<locals>.<listcomp>zProcessing quirk %szApplying quirk %szUnapplying quirk %szQuirk doesn't matchN)r r r1 r r r �idr0 �info�_apply_quirk�_unapply_quirk)r �enabler, r r r � _check_quirksO s ��zQuirkChecker._check_quirksc C � | � d� dS )zEnable all quirks for a handlerTN�r; �r r r r � enable_quirks_ � zQuirkChecker.enable_quirksc C r<