3 5ýVlã@sdZddlmZddlmZddlmZddlmZddlZddlmZeej ƒGdd „d e ƒƒZ eej ƒGd d „d e ƒƒZ Gd d „d e ƒZ Gdd„de ƒZGdd„de ƒZGdd„de ƒZGdd„de ƒZGdd„de ƒZGdd„de ƒZGdd„de ƒ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,eZdZdZdd„Zedd„ƒZdd„ZdS) ÚDeviceNotFoundAtPathErrorzh A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found at a given path. cCstj||ƒdS)N)rÚ__init__)ÚselfÚsys_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|jƒS)NzNo device at {0!r})Úformatr)rr r r Ú__str__Esz!DeviceNotFoundAtPathError.__str__N)rr r r rÚpropertyrrr 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@s8eZdZdZdd„Zedd„ƒZedd„ƒZdd „Zd S) ÚDeviceNotFoundByNameErrorzj A :exc:`DeviceNotFoundError` indicating that no :class:`Device` was found with a given name. cCstj|||ƒdS)N)rr)rÚ subsystemÚsys_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@s8eZdZdZdd„Zedd„ƒZedd„ƒZdd „Zd S) ÚDeviceNotFoundByNumberErrorzs A :exc:`DeviceNotFoundError` indicating, that no :class:`Device` was found for a given device number. cCstj|||ƒdS)N)rr)rÚtypZnumberr r r r€sz$DeviceNotFoundByNumberError.__init__cCs |jdS)zj The device type causing this error as string. Either ``'char'`` or ``'block'``. r)r)rr r r Ú device_typeƒsz'DeviceNotFoundByNumberError.device_typecCs |jdS)zB The device number causing this error as integer. r)r)rr r r Ú device_number‹sz)DeviceNotFoundByNumberError.device_numbercCs dj|ƒS)Nz7No {0.device_type} device with number {0.device_number})r)rr r r r’sz#DeviceNotFoundByNumberError.__str__N) rr r r rrr r!rr r r r rzs   rc@seZdZdZdd„ZdS)Ú 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 r�sz(DeviceNotFoundInEnvironmentError.__str__N)rr r r rr r r r r"—sr"c@s&eZdZdZdZddd„Zdd„ZdS) Ú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)rÚvalueZparamÚmsgr r r rªszDeviceValueError.__init__cCs:|jr$|jd}||j|j|jfS|j|j|jfSdS)Nz: %s)r&Ú_FMT_STRr$r%)rZfmt_strr r r r¶s zDeviceValueError.__str__)N)rr r r r)rrr r r r r#¡s r#)r Z __future__rrrrÚabcZsixrÚABCMetaÚ Exceptionrrrrrrrrr"r#r r r r Ús$