eaiovnaovbqoebvqoeavibavo 3 `‰Í] ã@sBddlmZmZdd„Zdd„Zdd„ZGdd „d eƒZeƒZd S) é)ÚGLibÚGiocs‡‡‡fdd„}|S)z;Register and map decorated exception class to a DBus error.cstj|ˆˆˆƒ|S)N)Úerror_registrationÚregister_error)Úcls)ÚcodeÚdomainÚname©ú/usr/lib/python3.6/error.pyÚ decoratedsz!register_error..decoratedr )r rrr r )rrr r rsrcs‡fdd„}|S)z.Map decorated exception class to a DBus error.cstj|ˆƒ|S)N)rÚ map_error)r)Ú error_namer r r s zmap_error..decoratedr )rr r )rr r s r cCstj|ƒ|S)z9Map decorated exception class to all unknown DBus errors.)rÚmap_by_default)rr r r rs rc@s`eZdZdZdZeƒZeƒZdd„Zdd„Z dd„Z d d „Z d d „Z d d„Z dd„Zdd„ZdS)ÚErrorRegistrationz,Class for mapping exceptions to DBus errors.NcCs ||_dS)z%Set the exception class as a default.N)Ú_default)ÚselfÚ exception_clsr r r r#sz ErrorRegistration.map_by_defaultcCs||j|<||j|<dS)z'Map the exception class to a DBus name.N)Ú_mapÚ _reversed_map)rrr r r r r 's zErrorRegistration.map_errorcCs|j||ƒtjj|||ƒS)z4Map and register the exception class to a DBus name.)r rÚ DBusErrorr)rrr rrr r r r,s z ErrorRegistration.register_errorcCs |j|jkS)zIs the exception registered?)Ú __class__r)rÚobjr r r Úis_registered_exception1sz)ErrorRegistration.is_registered_exceptioncCs|jj|jƒS)z#Get the DBus name of the exception.)rÚgetr)rrr r r Ú get_dbus_name5szErrorRegistration.get_dbus_namecCs|jj||jƒS)z0Get the exception class mapped to the DBus name.)rrr)rr r r r Úget_exception_class9sz%ErrorRegistration.get_exception_classcCs*djd|ƒ}|j|ƒr&|t|ƒd…S|S)z'Transform the message of the exception.z{}:{}: z GDBus.ErrorN)ÚformatÚ startswithÚlen)rr ÚmessageÚprefixr r r Útransform_message=s  z#ErrorRegistration.transform_messagecCsnt|tjƒs|Stjj|ƒs |Stjj|ƒ}|j|ƒ}|s>|S|j||j ƒ}||ƒ}||_ |j |_ |j |_|S)z,Transform the remote error to the exception.)Ú isinstancerÚErrorrrZis_remote_errorZget_remote_errorrr"r Z dbus_namerZ dbus_domainrZ dbus_code)rÚer rr Z exceptionr r r Útransform_exceptionFs    z%ErrorRegistration.transform_exception)Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚdictrrrr rrrrr"r&r r r r rs rN) Z gi.repositoryrrrr rÚobjectrrr r r r Ús   E