File: devpi_client.py

package info (click to toggle)
python-keyring 25.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 552 kB
  • sloc: python: 1,923; sh: 17; makefile: 17
file content (29 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import functools

import pluggy
from jaraco.context import suppress

import keyring.errors

hookimpl = pluggy.HookimplMarker("devpiclient")


def restore_signature(func):
    # workaround for pytest-dev/pluggy#358
    @functools.wraps(func)
    def wrapper(url, username):
        return func(url, username)

    return wrapper


@hookimpl()
@restore_signature
@suppress(keyring.errors.KeyringError)
def devpiclient_get_password(url, username):
    """
    >>> pluggy._hooks.varnames(devpiclient_get_password)
    (('url', 'username'), ())
    >>>
    """
    return keyring.get_password(url, username)