grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a Êic]"ã@s‚ddlmZmZddlmZgd¢Zdd„ZGdd„deƒZGdd „d ed �Z Gd d „d e ƒZ Gd d„de ƒZ Gdd„de ƒZ dS)é)ÚABCMetaÚabstractmethod©Ú get_dbus_name)Úget_error_decoratorÚ DBusErrorÚAbstractErrorRuleÚ ErrorRuleÚDefaultErrorRuleÚ ErrorMappercsd‡fdd„ }|S)a½Generate a decorator for DBus errors. Create a function for decorating Python exception classes. The decorator will add a new rule to the given error mapper that will map the class to the specified error name. Definition of the decorator: .. code-block:: python decorator(error_name, namespace=()) The decorator accepts a name of the DBus error and optionally a namespace of the DBus name. The namespace will be used as a prefix of the DBus name. Usage: .. code-block:: python # Create an error mapper. error_mapper = ErrorMapper() # Create a decorator for DBus errors and use it to map # the class ExampleError to the name my.example.Error. dbus_error = create_error_decorator(error_mapper) @dbus_error("my.example.Error") class ExampleError(DBusError): pass :param error_mapper: an error mapper :return: a decorator ©cs$tg|¢ˆ‘Rމ‡‡fdd„}|S)Ncsˆ t|ˆd�¡|S)N)Úexception_typeÚ error_name)Úadd_ruler )Úcls)Ú error_mapperrr ú0/usr/lib/python3.9/site-packages/dasbus/error.pyÚ decoratedIs þz9get_error_decorator..decorator..decoratedr)rÚ namespacer©r)rrÚ decoratorFsz&get_error_decorator..decorator)r r )rrr rrr#s# rc@seZdZdZdS)rzA default DBus error.N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r r r rrUsrc@sDeZdZdZgZedd„ƒZedd„ƒZedd„ƒZedd „ƒZ d S) rz=Abstract rule for mapping a Python exception to a DBus error.cCsdS)z’Is this rule matching the given exception type? :param exception_type: a type of the Python error :return: True or False Nr ©Úselfr r r rÚ match_type_szAbstractErrorRule.match_typecCsdS)z›Get a DBus name for the given exception type. :param exception_type: a type of the Python error :return: a name of the DBus error Nr rr r rÚget_namehszAbstractErrorRule.get_namecCsdS)zˆIs this rule matching the given DBus error? :param error_name: a name of the DBus error :return: True or False Nr ©rrr r rÚ match_nameqszAbstractErrorRule.match_namecCsdS)z—Get an exception type of the given DBus error. param error_name: a name of the DBus error :return: a type of the Python error Nr rr r rÚget_typezszAbstractErrorRule.get_typeN) rrrrÚ __slots__rrrr r!r r r rrZs   r)Ú metaclassc@s@eZdZdZddgZdd„Zdd„Zdd „Zd d „Zd d „Z dS)r z4Rule for mapping a Python exception to a DBus error.Ú_exception_typeÚ _error_namecCs||_||_dS)aVCreate a new error rule. The rule will return the Python type exception_type for the DBue error error_name. The rule will return the DBue name error_name for the Python type exception_type :param exception_type: a type of the Python error :param error_name: a name of the DBus error N)r$r%)rr rr r rÚ__init__Œs zErrorRule.__init__cCs |j|kS)ú/Is this rule matching the given exception type?©r$rr r rr›szErrorRule.match_typecCs|jS©z-Get a DBus name for the given exception type.©r%rr r rrŸszErrorRule.get_namecCs |j|kS)ú+Is this rule matching the given DBus error?r*rr r rr £szErrorRule.match_namecCs|jS©z.Get an exception type of the given DBus error.r(rr r rr!§szErrorRule.get_typeN© rrrrr"r&rrr r!r r r rr „sþr c@s@eZdZdZddgZdd„Zdd„Zdd „Zd d „Zd d „Z dS)r zs  2*((