o a@s>dZddlmZddlmZddlmZGdddejZdS) zV Keyring Chainer - iterates over other viable backends to discover passwords in each. )backend) properties)failc@sXeZdZdZdZejeddZejeddZ ddZ d d Z d d Z d dZ dS)ChainerBackendzZ >>> ChainerBackend() TcCst|jdkr dStjjdS)z If there are backends to chain, high priority Otherwise very low priority since our operation when empty is the same as null. r )lenbackendsrKeyringpriority)clsr :/usr/lib/python3/dist-packages/keyring/backends/chainer.pyr szChainerBackend.prioritycCs&dd}t|t}t|tjddS)z5 Discover all keyrings for chaining. cSs(tjpt}t|t o||o|jdkS)N)r_limitbool isinstancerr )keyringlimitr r rallow&s  z&ChainerBackend.backends..allowT)keyreverse)filterrget_all_keyringsorted by_priority)r rallowedr r rr szChainerBackend.backendscC,|jD]}|||}|dur|SqdSN)r get_password)selfserviceusernamerpasswordr r rr1  zChainerBackend.get_passwordc Cs6|jD]}z ||||WStyYqwdSr)r set_passwordNotImplementedError)r r!r"r#rr r rr%7s  zChainerBackend.set_passwordc Cs4|jD]}z |||WStyYqwdSr)r delete_passwordr&)r r!r"rr r rr'>s  zChainerBackend.delete_passwordcCrr)r get_credential)r r!r"r credentialr r rr(Er$zChainerBackend.get_credentialN)__name__ __module__ __qualname____doc__viabler ClassProperty classmethodr r rr%r'r(r r r rr s   rN)r-rutilrrKeyringBackendrr r r rs