3 5Vl@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 /usr/lib/python3.6/_errors.pyr$src@seZdZdZdS)DeviceNotFoundErrorz An exception indicating that no :class:`Device` was found. .. versionchanged:: 0.5 Rename from ``NoSuchDeviceError`` to its current name. N)rr r r r r r r r+src@s,eZdZdZddZeddZddZdS) DeviceNotFoundAtPathErrorzh A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found at a given path. cCstj||dS)N)r__init__)selfsys_pathr r r r;sz"DeviceNotFoundAtPathError.__init__cCs |jdS)z< The path that caused this error as string. r)args)rr r r r>sz"DeviceNotFoundAtPathError.sys_pathcCs dj|jS)NzNo device at {0!r})formatr)rr r r __str__Esz!DeviceNotFoundAtPathError.__str__N)rr r r rpropertyrrr r r r r5s rc@seZdZdZdS)DeviceNotFoundByFileErrorzp A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found from the given filename. N)rr r r r r r r rIsrc@seZdZdZdS)#DeviceNotFoundByInterfaceIndexErrorzw A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found from the given interface index. N)rr r r r r r r rOsrc@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 pagees. N)rr r r r r r r rUsrc@s8eZdZdZddZeddZeddZdd Zd S) DeviceNotFoundByNameErrorzj A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found with a given name. cCstj|||dS)N)rr)r subsystemsys_namer r r resz"DeviceNotFoundByNameError.__init__cCs |jdS)zA The subsystem that caused this error as string. r)r)rr r r rhsz#DeviceNotFoundByNameError.subsystemcCs |jdS)z@ The sys name that caused this error as string. )r)rr r r rosz"DeviceNotFoundByNameError.sys_namecCs dj|S)Nz+No device {0.sys_name!r} in {0.subsystem!r})r)rr r r rvsz!DeviceNotFoundByNameError.__str__N) rr r r rrrrrr r r r r_s   rc@s8eZdZdZddZeddZeddZdd Zd S) DeviceNotFoundByNumberErrorzs A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` was found for a given device number. cCstj|||dS)N)rr)rtypZnumberr r r rsz$DeviceNotFoundByNumberError.__init__cCs |jdS)zj The device type causing this error as string. Either ``'char'`` or ``'block'``. r)r)rr r r device_typesz'DeviceNotFoundByNumberError.device_typecCs |jdS)zB The device number causing this error as integer. r)r)rr r r device_numbersz)DeviceNotFoundByNumberError.device_numbercCs dj|S)Nz7No {0.device_type} device with number {0.device_number})r)rr r r rsz#DeviceNotFoundByNumberError.__str__N) rr r r rrr r!rr r r r rzs   rc@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 r rsz(DeviceNotFoundInEnvironmentError.__str__N)rr r r rr r r r r"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 r rszDeviceValueError.__init__cCs:|jr$|jd}||j|j|jfS|j|j|jfSdS)Nz: %s)r&_FMT_STRr$r%)rZfmt_strr r r rs zDeviceValueError.__str__)N)rr r r r)rrr r r r r#s r#)r Z __future__rrrrabcZsixrABCMeta Exceptionrrrrrrrrr"r#r r r r s$