ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/pyudev/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/pyudev/device.pyc

�
��3Yc@`sfdZddlmZmZmZmZddlZddlmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZddd	d
ddd
dgZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZde
e	fd��YZd�Zdefd��YZdS( u�
    pyudev.device
    =============

    Device class implementation of :mod:`pyudev`.

    .. moduleauthor::  Sebastian Wiesner  <lunaryorn@googlemail.com>
i(tprint_functiontdivisiontunicode_literalstabsolute_importN(tMappingt	ContainertIterable(t	timedelta(tensure_byte_stringtensure_unicode_stringtudev_list_iteratetstring_to_booltget_device_typeuDeviceu
AttributesuTagsuDeviceNotFoundErroruDeviceNotFoundAtPathErroruDeviceNotFoundByNameErroruDeviceNotFoundByNumberErroru DeviceNotFoundInEnvironmentErrortDeviceNotFoundErrorcB`seZdZRS(u�
    An error indicating that no :class:`Device` was found.

    .. versionchanged:: 0.5
       Renamed from ``NoSuchDeviceError`` to its current name.
    (t__name__t
__module__t__doc__(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR
.stDeviceNotFoundAtPathErrorcB`s/eZdZd�Zed��Zd�ZRS(uh
    A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was
    found at a given path.
    cC`stj||�dS(N(R
t__init__(tselftsys_path((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR=scC`s|jdS(u<
        The path that caused this error as string.
        i(targs(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR@scC`sdj|j�S(NuNo device at {0!r}(tformatR(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__str__Gs(RRRRtpropertyRR(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR7s	tDeviceNotFoundByNameErrorcB`s>eZdZd�Zed��Zed��Zd�ZRS(uj
    A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was
    found with a given name.
    cC`stj|||�dS(N(R
R(Rt	subsystemtsys_name((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRQscC`s|jdS(uA
        The subsystem that caused this error as string.
        i(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRTscC`s|jdS(u@
        The sys name that caused this error as string.
        i(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRcC`s
dj|�S(Nu+No device {0.sys_name!r} in {0.subsystem!r}(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRbs(RRRRRRRR(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRKs
	tDeviceNotFoundByNumberErrorcB`s>eZdZd�Zed��Zed��Zd�ZRS(us
    A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` was found
    for a given device number.
    cC`stj|||�dS(N(R
R(Rttypetnumber((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRlscC`s|jdS(uj
        The device type causing this error as string.  Either ``'char'`` or
        ``'block'``.
        i(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pytdevice_typeoscC`s|jdS(uB
        The device number causing this error as integer.
        i(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt
device_numberwscC`s
dj|�S(Nu7No {0.device_type} device with number {0.device_number}(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR~s(RRRRRRR R(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRfs
	t DeviceNotFoundInEnvironmentErrorcB`seZdZd�ZRS(u�
    A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` could
    be constructed from the process environment.
    cC`sdS(NuNo device found in environment((R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR�s(RRRR(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR!�stDevicecB`s�eZdZed��Zed��Zed��Zed��Zed��Zed��Z	d�Z
d�Zd	�Ze
d
��Ze
d��Zd(d�Zd
�Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d��Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d&�Z+d'�Z,RS()u�
    A single device with attached attributes and properties.

    This class subclasses the ``Mapping`` ABC, providing a read-only
    dictionary mapping property names to the corresponding values.
    Therefore all well-known dicitionary methods and operators
    (e.g. ``.keys()``, ``.items()``, ``in``) are available to access device
    properties.

    Aside of the properties, a device also has a set of udev-specific
    attributes like the path inside ``sysfs``.

    :class:`Device` objects compare equal and unequal to other devices and
    to strings (based on :attr:`device_path`).  However, there is no
    ordering on :class:`Device` objects, and the corresponding operators
    ``>``, ``<``, ``<=`` and ``>=`` raise :exc:`~exceptions.TypeError`.

    .. warning::

       Do **never** use object identity (``is`` operator) to compare
       :class:`Device` objects.  :mod:`pyudev` may create multiple
       :class:`Device` objects for the same device.  Instead simply compare
       devices by value using ``==`` or ``!=``.

    :class:`Device` objects are hashable and can therefore be used as keys
    in dictionaries and sets.

    They can also be given directly as ``udev_device *`` to functions wrapped
    through :mod:`ctypes`.
    cC`sI|j|j�s9tjj|j|jtj��}n|j||�S(u�
        Create a device from a device ``path``.  The ``path`` may or may not
        start with the ``sysfs`` mount point:

        >>> context = pyudev.Context()
        >>> Device.from_path(context, '/devices/platform')
        Device(u'/sys/devices/platform')
        >>> Device.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.4
        (t
startswithRtostpathtjointlstriptsept
from_sys_path(tclstcontextR%((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt	from_path�s'cC`s=|jj|t|��}|s0t|��n|||�S(u`
        Create a new device from a given ``sys_path``:

        >>> context = pyudev.Context()
        >>> Device.from_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``.

        .. versionchanged:: 0.4
           Raise :exc:`NoSuchDeviceError` instead of returning ``None``, if
           no device was found for ``sys_path``
        .. versionchanged:: 0.5
           Raise :exc:`DeviceNotFoundAtPathError` instead of
           :exc:`NoSuchDeviceError`
        (t_libudevtudev_device_new_from_syspathRR(R*R+Rtdevice((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR)�s
	cC`sI|jj|t|�t|��}|s<t||��n|||�S(u
        Create a new device from a given ``subsystem`` and a given
        ``sys_name``:

        >>> context = pyudev.Context()
        >>> sda = pyudev.Device.from_name(context, 'block', 'sda')
        >>> sda
        Device(u'/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda')
        >>> sda == pyudev.Device.from_path(context, '/block/sda')

        ``context`` is the :class:`Context` in which to search the device.
        ``subsystem`` and ``sys_name`` are byte or unicode strings, which
        denote the subsystem and the name of the device to create.

        Return a :class:`Device` object for the device.  Raise
        :exc:`DeviceNotFoundByNameError`, if no device was found with the given
        name.

        .. versionadded:: 0.5
        (R-t&udev_device_new_from_subsystem_sysnameRR(R*R+RRR/((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt	from_name�s	cC`sk|dkr$tdj|���n|jj|t|d�|�}|s^t||��n|||�S(u�
        Create a new device from a device ``number`` with the given device
        ``type``:

        >>> import os
        >>> ctx = Context()
        >>> major, minor = 8, 0
        >>> device = Device.from_device_number(context, 'block',
        ...     os.makedev(major, minor))
        >>> device
        Device(u'/sys/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0/block/sda')
        >>> os.major(device.device_number), os.minor(device.device_number)
        (8, 0)

        Use :func:`os.makedev` to construct a device number from a major and a
        minor device number, as shown in the example above.

        .. note::

           Device numbers are not unique across different device types.
           Passing a correct number with a wrong type may silently yield a
           wrong device object, so make sure to pass the correct device type.

        ``context`` is the :class:`Context`, in which to search the device.
        ``type`` is either ``'char'`` or ``'block'``, according to whether the
        device is a character or block device.  ``number`` is the device number
        as integer.

        Return a :class:`Device` object for the device with the given device
        ``number``.  Raise :exc:`DeviceNotFoundByNumberError`, if no device was
        found with the given device type and number.  Raise
        :exc:`~exceptions.ValueError`, if ``type`` is any other string than
        ``'char'`` or ``'block'``.

        .. versionadded:: 0.11
        ucharublocku6Invalid type: {0!r}. Must be one of "char" or "block".i(ucharublock(t
ValueErrorRR-tudev_device_new_from_devnumRR(R*R+RRR/((s1/usr/lib/python2.7/site-packages/pyudev/device.pytfrom_device_numbers&		cC`s1t|�}tj|�j}|j|||�S(u
        Create a new device from the given device file:

        >>> context = Context()
        >>> device = Device.from_device_file(context, '/dev/sda')
        >>> device
        Device(u'/sys/devices/pci0000:00/0000:00:0d.0/host2/target2:0:0/2:0:0:0/block/sda')
        >>> device.device_node
        u'/dev/sda'

        .. warning::

           Though the example seems to suggest that ``device.device_node ==
           filename`` holds with ``device = Device.from_device_file(context,
           filename)``, this is only true in a majority of cases.  There *can*
           be devices, for which this relation is actually false!  Thus, do
           *not* expect :attr:`~Device.device_node` to be equal to the given
           ``filename`` for the returned :class:`Device`.  Especially, use
           :attr:`~Device.device_node` if you need the device file of a
           :class:`Device` created with this method afterwards.

        ``context`` is the :class:`Context` in which to search the device.
        ``filename`` is a string containing the path of a device file.

        Return a :class:`Device` representing the given device file.  Raise
        :exc:`~exceptions.ValueError` if ``filename`` is no device file at all.
        Raise :exc:`~exceptions.EnvironmentError` if ``filename`` does not
        exist or if its metadata was inaccessible.

        .. versionadded:: 0.15
        (RR$tstattst_rdevR4(R*R+tfilenameRR ((s1/usr/lib/python2.7/site-packages/pyudev/device.pytfrom_device_file/s!cC`s1|jj|�}|s$t��n|||�S(u�
        Create a new device from the process environment (as in
        :data:`os.environ`).

        This only works reliable, if the current process is called from an
        udev rule, and is usually used for tools executed from ``IMPORT=``
        rules.  Use this method to create device objects in Python scripts
        called from udev rules.

        ``context`` is the library :class:`Context`.

        Return a :class:`Device` object constructed from the environment.
        Raise :exc:`DeviceNotFoundInEnvironmentError`, if no device could be
        created from the environment.

        .. udevversion:: 152

        .. versionadded:: 0.6
        (R-t udev_device_new_from_environmentR!(R*R+R/((s1/usr/lib/python2.7/site-packages/pyudev/device.pytfrom_environmentUscC`s"||_||_|j|_dS(N(R+t_as_parameter_R-(RR+t_device((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRos		cC`s|jj|�dS(N(R-tudev_device_unref(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__del__tscC`s
dj|�S(NuDevice({0.sys_path!r})(R(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__repr__wscC`s8|jj|�}|sdSt|j|jj|��S(u_
        The parent :class:`Device` or ``None``, if there is no parent
        device.
        N(R-tudev_device_get_parenttNoneR"R+tudev_device_ref(Rtparent((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRCzscc`s;x4|jj�j|�D]}||kr|VqqWdS(u�
        Yield all direct children of this device.

        .. note::

           As the underlying library does not provide any means to directly
           query the children of a device, this property performs a linear
           search through all devices.

        Return an iterable yielding a :class:`Device` object for each direct
        child of this device.

        .. udevversion:: 172

        .. versionchanged:: 0.13
           Requires udev version 172 now.
        N(R+tlist_devicestmatch_parent(RR/((s1/usr/lib/python2.7/site-packages/pyudev/device.pytchildren�scC`set|�}|dk	r't|�}n|jj|||�}|sIdSt|j|jj|��S(u�
        Find the parent device with the given ``subsystem`` and
        ``device_type``.

        ``subsystem`` is a byte or unicode string containing the name of the
        subsystem, in which to search for the parent.  ``device_type`` is a
        byte or unicode string holding the expected device type of the parent.
        It can be ``None`` (the default), which means, that no specific device
        type is expected.

        Return a parent :class:`Device` within the given ``subsystem`` and – if
        ``device_type`` is not ``None`` – with the given ``device_type``, or
        ``None``, if this device has no parent device matching these
        constraints.

        .. versionadded:: 0.9
        N(RRAR-t-udev_device_get_parent_with_subsystem_devtypeR"R+RB(RRRRC((s1/usr/lib/python2.7/site-packages/pyudev/device.pytfind_parent�s	cc`s(|j}x|r#|V|j}qWdS(u
        Traverse all parent devices of this device from bottom to top.

        Return an iterable yielding all parent devices as :class:`Device`
        objects, *not* including the current device.  The last yielded
        :class:`Device` is the top of the device hierarchy.
        N(RC(RRC((s1/usr/lib/python2.7/site-packages/pyudev/device.pyttraverse�s		cC`st|jj|��S(uz
        Absolute path of this device in ``sysfs`` including the ``sysfs``
        mount point as unicode string.
        (R	R-tudev_device_get_syspath(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR�scC`st|jj|��S(u
        Kernel device path as unicode string.  This path uniquely identifies
        a single device.

        Unlike :attr:`sys_path`, this path does not contain the ``sysfs``
        mount point.  However, the path is absolute and starts with a slash
        ``'/'``.
        (R	R-tudev_device_get_devpath(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pytdevice_path�s
cC`st|jj|��S(uQ
        Name of the subsystem this device is part of as unicode string.
        (R	R-tudev_device_get_subsystem(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR�scC`st|jj|��S(uF
        Device file name inside ``sysfs`` as unicode string.
        (R	R-tudev_device_get_sysname(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR�scC`s,|jj|�}|dk	r(t|�SdS(uO
        The trailing number of the :attr:`sys_name` as unicode string, or
        ``None``, if the device has no trailing number in its name.

        .. note::

           The number is returned as unicode string to preserve the exact
           format of the number, especially any leading zeros:

           >>> device = pyudev.Device.from_path(ctx, '/sys/devices/LNXSYSTM:00')
           >>> device.sys_number
           u'00'

           To work with numbers, explicitly convert them to ints:

           >>> int(device.sys_number)
           0

        .. versionadded:: 0.11
        N(R-tudev_device_get_sysnumRAR	(RR((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt
sys_number�scC`s,|jj|�}|dk	r(t|�SdS(u�
        Device type as unicode string, or ``None``, if the device type is
        unknown.

        >>> context = Context()
        >>> for device in context.list_devices(subsystem='net'):
        ...     '{0} - {1}'.format(device.sys_name, device.device_type or 'ethernet')
        ...
        u'eth0 - ethernet'
        u'wlan0 - wlan'
        u'lo - ethernet'
        u'vboxnet0 - ethernet'

        .. versionadded:: 0.10
        N(R-tudev_device_get_devtypeRAR	(RR((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRscC`s&|jj|�}|r"t|�SdS(u�
        The driver name as unicode string, or ``None``, if there is no
        driver for this device.

        .. versionadded:: 0.5
        N(R-tudev_device_get_driverR	(Rtdriver((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRSscC`s&|jj|�}|r"t|�SdS(u�
        Absolute path to the device node of this device as unicode string or
        ``None``, if this device doesn't have a device node.  The path
        includes the device directory (see :attr:`Context.device_path`).

        This path always points to the actual device node associated with
        this device, and never to any symbolic links to this device node.
        See :attr:`device_links` to get a list of symbolic links to this
        device node.

        .. warning::

           For devices created with :meth:`from_device_file()`, the value of
           this property is not necessary equal to the ``filename`` given to
           :meth:`from_device_file()`.
        N(R-tudev_device_get_devnodeR	(Rtnode((s1/usr/lib/python2.7/site-packages/pyudev/device.pytdevice_node(scC`s|jj|�S(u�
        The device number of the associated device as integer, or ``0``, if no
        device number is associated.

        Use :func:`os.major` and :func:`os.minor` to decompose the device
        number into its major and minor number:

        >>> context = Context()
        >>> sda = Device.from_name(context, 'block', 'sda')
        >>> sda.device_number
        2048L
        >>> (os.major(sda.device_number), os.minor(sda.device_number))
        (8, 0)

        For devices with an associated :attr:`device_node`, this is the same as
        the ``st_rdev`` field of the stat result of the :attr:`device_node`:

        >>> os.stat(sda.device_node).st_rdev
        2048

        .. versionadded:: 0.11
        (R-tudev_device_get_devnum(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR >scC`st|jj|��S(ui
        ``True``, if the device is initialized, ``False`` otherwise.

        A device is initialized, if udev has already handled this device and
        has set up device node permissions and context, or renamed a network
        device.

        Consequently, this property is only implemented for devices with a
        device node or for network devices.  On all other devices this property
        is always ``True``.

        It is *not* recommended, that you use uninitialized devices.

        .. seealso:: :attr:`time_since_initialized`

        .. udevversion:: 165

        .. versionadded:: 0.8
        (tboolR-tudev_device_get_is_initialized(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pytis_initializedXscC`s|jj|�}td|�S(u�
        The time elapsed since initialization as :class:`~datetime.timedelta`.

        This property is only implemented on devices, which need to store
        properties in the udev database.  On all other devices this property is
        simply zero :class:`~datetime.timedelta`.

        .. seealso:: :attr:`is_initialized`

        .. udevversion:: 165

        .. versionadded:: 0.8
        tmicroseconds(R-t&udev_device_get_usec_since_initializedR(RR[((s1/usr/lib/python2.7/site-packages/pyudev/device.pyttime_since_initializedos		cc`sD|jj|�}x+t|j|�D]\}}t|�Vq%WdS(u�
        An iterator, which yields the absolute paths (including the device
        directory, see :attr:`Context.device_path`) of all symbolic links
        pointing to the :attr:`device_node` of this device.  The paths are
        unicode strings.

        UDev can create symlinks to the original device node (see
        :attr:`device_node`) inside the device directory.  This is often
        used to assign a constant, fixed device node to devices like
        removeable media, which technically do not have a constant device
        node, or to map a single device into multiple device hierarchies.
        The property provides access to all such symbolic links, which were
        created by UDev for this device.
        N(R-t#udev_device_get_devlinks_list_entryR
R	(Rtdevlinkstnamet_((s1/usr/lib/python2.7/site-packages/pyudev/device.pytdevice_links�scC`s
t|�S(uT
        The system attributes of this device as read-only
        :class:`Attributes` mapping.

        System attributes are basically normal files inside the the device
        directory.  These files contain all sorts of information about the
        device, which may not be reflected by properties.  These attributes
        are commonly used for matching in udev rules, and can be printed
        using ``udevadm info --attribute-walk``.

        The values of these attributes are not always proper strings, and
        can contain arbitrary bytes.

        .. versionadded:: 0.5
        (t
Attributes(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt
attributes�scC`s
t|�S(u
        A :class:`Tags` object representing the tags attached to this device.

        The :class:`Tags` object supports a test for a single tag as well as
        iteration over all tags:

        >>> 'systemd' in device.tags
        True
        >>> list(device.tags)
        [u'systemd', u'seat']

        Tags are arbitrary classifiers that can be attached to devices by udev
        scripts and daemons.  For instance, systemd_ uses tags for multi-seat_
        support.

        .. _systemd: http://freedesktop.org/wiki/Software/systemd
        .. _multi-seat: http://www.freedesktop.org/wiki/Software/systemd/multiseat

        .. udevversion:: 154

        .. versionadded:: 0.6

        .. versionchanged:: 0.13
           Return a :class:`Tags` object now.
        (tTags(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyttags�scc`sD|jj|�}x+t|j|�D]\}}t|�Vq%WdS(u�
        Iterate over the names of all properties defined for this device.

        Return a generator yielding the names of all properties of this
        device as unicode strings.
        N(R-t%udev_device_get_properties_list_entryR
R	(Rt
propertiesR`Ra((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__iter__�scC`s2|jj|�}td�t|j|�D��S(uU
        Return the amount of properties defined for this device as integer.
        cs`s|]}dVqdS(iN((t.0Ra((s1/usr/lib/python2.7/site-packages/pyudev/device.pys	<genexpr>�s(R-RgtsumR
(RRh((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__len__�scC`s@|jj|t|��}|dkr6t|��nt|�S(uA
        Get the given ``property`` from this device.

        ``property`` is a unicode or byte string containing the name of the
        property.

        Return the property value as unicode string, or raise a
        :exc:`~exceptions.KeyError`, if the given property is not defined
        for this device.
        N(R-tudev_device_get_property_valueRRAtKeyErrorR	(RRtvalue((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__getitem__�s
	cC`st||�S(u�
        Get the given ``property`` from this device as integer.

        ``property`` is a unicode or byte string containing the name of the
        property.

        Return the property value as integer. Raise a
        :exc:`~exceptions.KeyError`, if the given property is not defined
        for this device, or a :exc:`~exceptions.ValueError`, if the property
        value cannot be converted to an integer.
        (tint(RR((s1/usr/lib/python2.7/site-packages/pyudev/device.pytasint�scC`st||�S(u�
        Get the given ``property`` from this device as boolean.

        A boolean property has either a value of ``'1'`` or of ``'0'``,
        where ``'1'`` stands for ``True``, and ``'0'`` for ``False``.  Any
        other value causes a :exc:`~exceptions.ValueError` to be raised.

        ``property`` is a unicode or byte string containing the name of the
        property.

        Return ``True``, if the property value is ``'1'`` and ``False``, if
        the property value is ``'0'``.  Any other value raises a
        :exc:`~exceptions.ValueError`.  Raise a :exc:`~exceptions.KeyError`,
        if the given property is not defined for this device.
        (R(RR((s1/usr/lib/python2.7/site-packages/pyudev/device.pytasbool�scC`s
t|j�S(N(thashRL(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__hash__
scC`s0t|t�r|j|jkS|j|kSdS(N(t
isinstanceR"RL(Rtother((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__eq__scC`s0t|t�r|j|jkS|j|kSdS(N(RvR"RL(RRw((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__ne__scC`std��dS(NuDevice not orderable(t	TypeError(RRw((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__gt__scC`std��dS(NuDevice not orderable(Rz(RRw((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__lt__scC`std��dS(NuDevice not orderable(Rz(RRw((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__le__"scC`std��dS(NuDevice not orderable(Rz(RRw((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__ge__%sN(-RRRtclassmethodR,R)R1R4R8R:RR>R?RRCRFRARHRIRRLRRRPRRSRVR RZR]RbRdRfRiRlRpRrRsRuRxRyR{R|R}R~(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR"�sP/&			
	
	
											RecB`sAeZdZd�Zd�Zed��Zd�Zd�ZRS(uk
    A iterable over :class:`Device` tags.

    Subclasses the ``Container`` and the ``Iterable`` ABC.
    cC`s
||_dS(N(R/(RR/((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR0sc`sRt|jd�r4t|jj|jt����St�fd�|D��SdS(Nuudev_device_has_tagc3`s|]}|�kVqdS(N((Rjtt(ttag(s1/usr/lib/python2.7/site-packages/pyudev/device.pys	<genexpr>8s(thasattrR-RXtudev_device_has_tagR/Rtany(RR�((R�s1/usr/lib/python2.7/site-packages/pyudev/device.pyt_has_tag3scC`s
|jjS(N(R/R-(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR-:scC`s
|j|�S(u�
        Check for existence of ``tag``.

        ``tag`` is a tag as unicode string.

        Return ``True``, if ``tag`` is attached to the device, ``False``
        otherwise.
        (R�(RR�((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt__contains__>s	cc`sG|jj|j�}x+t|j|�D]\}}t|�Vq(WdS(uS
        Iterate over all tags.

        Yield each tag as unicode string.
        N(R-tudev_device_get_tags_list_entryR/R
R	(RRfR�Ra((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRiIs(	RRRRR�RR-R�Ri(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRe)s			cC`s>tjj|�}|jd�p<|dkp<tjj|�S(uy
    Check, if ``filepath`` points to a valid udev attribute filename.

    Implementation is stolen from udev source code, ``print_all_attributes``
    in ``udev/udevadm-info.c``.  It excludes hidden files (starting with a
    dot), the special files ``dev`` and ``uevent`` and links.

    Return ``True``, if ``filepath`` refers to an attribute, ``False``
    otherwise.
    u.udevuuevent(udevuuevent(R$R%tbasenameR#tislink(tfilepathR7((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt_is_attribute_fileTsRccB`s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
u�
    A mapping which holds udev attributes for :class:`Device` objects.

    This class subclasses the ``Mapping`` ABC, providing a read-only
    dictionary mapping attribute names to the corresponding values.
    Therefore all well-known dicitionary methods and operators
    (e.g. ``.keys()``, ``.items()``, ``in``) are available to access device
    attributes.

    .. versionadded:: 0.5
    cC`s||_|j|_dS(N(R/R-(RR/((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRrs	cc`s�t|jd�rX|jj|j�}x}t|j|�D]\}}t|�Vq:WnO|jj}x@tj|�D]/}tj	j
||�}t|�rt|VqtqtWdS(Nu"udev_device_get_sysattr_list_entry(R�R-t"udev_device_get_sysattr_list_entryR/R
R	RR$tlistdirR%R&R�(Rtattrst	attributeRaRR7R�((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt_get_attributesvs	cC`std�|j�D��S(u:
        Return the amount of attributes defined.
        cs`s|]}dVqdS(iN((RjRa((s1/usr/lib/python2.7/site-packages/pyudev/device.pys	<genexpr>�s(RkR�(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRl�scC`s
|j�S(ul
        Iterate over all attributes defined.

        Yield each attribute name as unicode string.
        (R�(R((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRi�scC`s(|jj|jt|��}|dk	S(N(R-tudev_device_get_sysattr_valueR/RRA(RR�Ro((s1/usr/lib/python2.7/site-packages/pyudev/device.pyR��s	cC`s=|jj|jt|��}|dkr9t|��n|S(uO
        Get the given system ``attribute`` for the device.

        ``attribute`` is a unicode or byte string containing the name of the
        system attribute.

        Return the attribute value as byte string, or raise a
        :exc:`~exceptions.KeyError`, if the given attribute is not defined
        for this device.
        N(R-R�R/RRARn(RR�Ro((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRp�s
	cC`st||�S(u]
        Get the given ``atribute`` for the device as unicode string.

        Depending on the content of the attribute, this may or may not work.
        Be prepared to catch :exc:`~exceptions.UnicodeDecodeError`.

        ``attribute`` is a unicode or byte string containing the name of the
        attribute.

        Return the attribute value as byte string.  Raise a
        :exc:`~exceptions.KeyError`, if the given attribute is not defined
        for this device, or :exc:`~exceptions.UnicodeDecodeError`, if the
        content of the attribute cannot be decoded into a unicode string.
        (R	(RR�((s1/usr/lib/python2.7/site-packages/pyudev/device.pytasstring�scC`st|j|��S(u�
        Get the given ``attribute`` as integer.

        ``attribute`` is a unicode or byte string containing the name of the
        attribute.

        Return the attribute value as integer. Raise a
        :exc:`~exceptions.KeyError`, if the given attribute is not defined
        for this device, or a :exc:`~exceptions.ValueError`, if the
        attribute value cannot be converted to an integer.
        (RqR�(RR�((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRr�scC`st|j|��S(u�
        Get the given ``attribute`` from this device as boolean.

        A boolean attribute has either a value of ``'1'`` or of ``'0'``,
        where ``'1'`` stands for ``True``, and ``'0'`` for ``False``.  Any
        other value causes a :exc:`~exceptions.ValueError` to be raised.

        ``attribute`` is a unicode or byte string containing the name of the
        attribute.

        Return ``True``, if the attribute value is ``'1'`` and ``False``, if
        the attribute value is ``'0'``.  Any other value raises a
        :exc:`~exceptions.ValueError`.  Raise a :exc:`~exceptions.KeyError`,
        if the given attribute is not defined for this device.
        (RR�(RR�((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRs�s(RRRRR�RlRiR�RpR�RrRs(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyRces		
						(Rt
__future__RRRRR$tcollectionsRRRtdatetimeRtpyudev._utilRR	R
RRt__all__tLookupErrorR
RRRR!R"ReR�Rc(((s1/usr/lib/python2.7/site-packages/pyudev/device.pyt<module>s("(			
���+	

Zerion Mini Shell 1.0