a 8g+^[@sdZddlmZddlmZddlmZddlmZddlZddlmZeej Gdd d e Z eej Gd d d e Z Gd d d e Z Gddde ZGddde ZGddde ZGddde ZGddde ZGddde ZGddde ZdS)z pyudev.device._errors ===================== Errors raised by Device methods. .. moduleauthor:: Sebastian Wiesner )absolute_import)division)print_function)unicode_literalsN) add_metaclassc@seZdZdZdS) DeviceErrorzP Any error raised when messing around w/ or trying to discover devices. N__name__ __module__ __qualname____doc__r r 2/usr/lib/python3.9/site-packages/pyudev/_errors.pyr$src@seZdZdZdS)DeviceNotFoundErrorz An exception indicating that no :class:`Device` was found. .. versionchanged:: 0.5 Rename from ``NoSuchDeviceError`` to its current name. Nrr r r rr+src@s,eZdZdZddZeddZddZdS) DeviceNotFoundAtPathErrorzh A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found at a given path. cCst||dSNr__init__)selfsys_pathr r rr;sz"DeviceNotFoundAtPathError.__init__cCs |jdS)z< The path that caused this error as string. rargsrr r rr>sz"DeviceNotFoundAtPathError.sys_pathcCs d|jS)NzNo device at {0!r})formatrrr r r__str__Esz!DeviceNotFoundAtPathError.__str__N)r r r r rpropertyrrr r r rr5s  rc@seZdZdZdS)DeviceNotFoundByFileErrorzp A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found from the given filename. Nrr r r rrIsrc@seZdZdZdS)#DeviceNotFoundByInterfaceIndexErrorzw A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found from the given interface index. Nrr r r rrPsrc@seZdZdZdS)!DeviceNotFoundByKernelDeviceErrorz A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found from the given kernel device string. The format of the kernel device string is defined in the systemd.journal-fields man pages. Nrr r r rrWsrc@s8eZdZdZddZeddZeddZdd Zd S) DeviceNotFoundByNameErrorzj A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found with a given name. cCst|||dSrr)r subsystemsys_namer r rrgsz"DeviceNotFoundByNameError.__init__cCs |jdS)zA The subsystem that caused this error as string. rrrr r rr jsz#DeviceNotFoundByNameError.subsystemcCs |jdS)z@ The sys name that caused this error as string. rrr r rr!qsz"DeviceNotFoundByNameError.sys_namecCs d|S)Nz+No device {0.sys_name!r} in {0.subsystem!r}rrr r rrxsz!DeviceNotFoundByNameError.__str__N) r r r r rrr r!rr r r rras  rc@s8eZdZdZddZeddZeddZdd Zd S) DeviceNotFoundByNumberErrorzs A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` was found for a given device number. cCst|||dSrr)rtypZnumberr r rrsz$DeviceNotFoundByNumberError.__init__cCs |jdS)zj The device type causing this error as string. Either ``'char'`` or ``'block'``. rrrr r r device_typesz'DeviceNotFoundByNumberError.device_typecCs |jdS)zB The device number causing this error as integer. r"rrr r r device_numbersz)DeviceNotFoundByNumberError.device_numbercCs d|S)Nz7No {0.device_type} device with number {0.device_number}r#rr r rrsz#DeviceNotFoundByNumberError.__str__N) r r r r rrr&r'rr r r rr$|s  r$c@seZdZdZddZdS) DeviceNotFoundInEnvironmentErrorz A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` could be constructed from the process environment. cCsdS)NzNo device found in environmentr rr r rrsz(DeviceNotFoundInEnvironmentError.__str__N)r r r r rr r r rr(sr(c@s&eZdZdZdZdddZddZdS) DeviceValueErrorz Raised when a parameter has an unacceptable value. May also be raised when the parameter has an unacceptable type. z+value '%s' for parameter %s is unacceptableNcCs||_||_||_dS)z Initializer. :param object value: the value :param str param: the parameter :param str msg: an explanatory message N)_value_param_msg)rvalueZparammsgr r rrszDeviceValueError.__init__cCs6|jr$|jd}||j|j|jfS|j|j|jfS)Nz: %s)r,_FMT_STRr*r+)rZfmt_strr r rrs zDeviceValueError.__str__)N)r r r r r/rrr r r rr)s r))r Z __future__rrrrabcZsixrABCMeta Exceptionrrrrrrrr$r(r)r r r rs$