Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyudev/device/__pycache__/_device.cpython-39.pyc
Ðазад
a i�hO� � @ s d Z ddlmZmZmZmZ ddlZddlZddlZddl m Z ddlZddlm Z ddlmZmZmZmZmZmZmZ ddlmZmZmZmZmZ e�e�dd ejd kr�dnd �� G dd � d e�Z G dd� de j!�Z"G dd� de j!�Z#G dd� de�Z$G dd� de j%e j&�Z'dS )z� pyudev.device._device ===================== Device class implementation of :mod:`pyudev`. .. moduleauthor:: Sebastian Wiesner <lunaryorn@gmail.com> � )�absolute_import�division�print_function�unicode_literalsN)� timedelta)�collections_abc)�DeviceNotFoundAtPathError�DeviceNotFoundByFileError�#DeviceNotFoundByInterfaceIndexError�!DeviceNotFoundByKernelDeviceError�DeviceNotFoundByNameError�DeviceNotFoundByNumberError� DeviceNotFoundInEnvironmentError)�ensure_byte_string�ensure_unicode_string�get_device_type�string_to_bool�udev_list_iterater �collections)� r zcollections.abcc @ s| e Zd ZdZedd� �Zedd� �Zedd� �Zedd � �Zed d� �Z edd � �Z edd� �Zedd� �Zedd� �Z dS )�DeviceszT Class for constructing :class:`Device` objects from various kinds of data. c C s0 |� |j�s$tj�|j|�tj��}| �||�S )a� Create a device from a device ``path``. The ``path`` may or may not start with the ``sysfs`` mount point: >>> from pyudev import Context, Device >>> context = Context() >>> Devices.from_path(context, '/devices/platform') Device(u'/sys/devices/platform') >>> Devices.from_path(context, '/sys/devices/platform') Device(u'/sys/devices/platform') ``context`` is the :class:`Context` in which to search the device. ``path`` is a device path as unicode or byte string. Return a :class:`Device` object for the device. Raise :exc:`DeviceNotFoundAtPathError`, if no device was found for ``path``. .. versionadded:: 0.18 )� startswith�sys_path�os�path�join�lstrip�sep� from_sys_path)�cls�contextr � r! ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pyudev/device/_device.py� from_pathJ s zDevices.from_pathc C s( |j �|t|��}|st|��t||�S )a� Create a new device from a given ``sys_path``: >>> from pyudev import Context, Device >>> context = Context() >>> Devices.from_sys_path(context, '/sys/devices/platform') Device(u'/sys/devices/platform') ``context`` is the :class:`Context` in which to search the device. ``sys_path`` is a unicode or byte string containing the path of the device inside ``sysfs`` with the mount point included. Return a :class:`Device` object for the device. Raise :exc:`DeviceNotFoundAtPathError`, if no device was found for ``sys_path``. .. versionadded:: 0.18 )�_libudevZudev_device_new_from_syspathr r �Device)r r r �devicer! r! r"