codekingpro/portable-devtools
114k
1import contextlib2import functools3 4import pluggy5 6import keyring.errors7 8 9hookimpl = pluggy.HookimplMarker("devpiclient")10 11 12# https://github.com/jaraco/jaraco.context/blob/c3a9b739/jaraco/context.py#L20513suppress = type('suppress', (contextlib.suppress, contextlib.ContextDecorator), {})14 15 16def restore_signature(func):17 # workaround for pytest-dev/pluggy#35818 @functools.wraps(func)19 def wrapper(url, username):20 return func(url, username)21 22 return wrapper23 24 25@hookimpl()26@restore_signature27@suppress(keyring.errors.KeyringError)28def devpiclient_get_password(url, username):29 """30 >>> pluggy._hooks.varnames(devpiclient_get_password)31 (('url', 'username'), ())32 >>>33 """34 return keyring.get_password(url, username)35 