# Path: keyring/keyring/backend.py
# class KeyringBackend(object):
#     """The abstract base class of the keyring, every backend must implement
#     this interface.
#     """
# 
#     #@abc.abstractproperty
#     def priority(cls):
#         """
#         Each backend class must supply a priority, a number (float or integer)
#         indicating the priority of the backend relative to all other backends.
#         The priority need not be static -- it may (and should) vary based
#         attributes of the environment in which is runs (platform, available
#         packages, etc.).
# 
#         A higher number indicates a higher priority. The priority should raise
#         a RuntimeError with a message indicating the underlying cause if the
#         backend is not suitable for the current environment.
# 
#         As a rule of thumb, a priority between zero but less than one is
#         suitable, but a priority of one or greater is recommended.
#         """
# 
#     @properties.ClassProperty
#     @classmethod
#     def viable(cls):
#         with errors.ExceptionRaisedContext() as exc:
#             cls.priority
#         return not bool(exc)
# 
#     @abc.abstractmethod
#     def get_password(self, service, username):
#         """Get password of the username for the service
#         """
#         return None
# 
#     @abc.abstractmethod
#     def set_password(self, service, username, password):
#         """Set password for the username of the service
#         """
#         raise errors.PasswordSetError("reason")
# 
#     # for backward-compatibility, don't require a backend to implement
#     #  delete_password
#     #@abc.abstractmethod
#     def delete_password(self, service, username):
#         """Delete the password for the username of the service.
#         """
#         raise errors.PasswordDeleteError("reason")


import platform
import subprocess
import re
import binascii
from ..backend import KeyringBackend
from ..errors import PasswordSetError
from ..errors import PasswordDeleteError
from ..util import properties
from ..py27compat import unicode_str



class SecurityCommand(unicode_str):
    """
    A string suitable for passing as the 'command' parameter to the
    OS X 'security' command.
    """
    def __new__(cls, cmd, store='generic'):
        cmd = '%(cmd)s-%(store)s-password' % vars()
        return super(SecurityCommand, cls).__new__(cls, cmd)



# Path: keyring/keyring/backend.py
# class KeyringBackend(object):
#     """The abstract base class of the keyring, every backend must implement
#     this interface.
#     """
# 
#     #@abc.abstractproperty
#     def priority(cls):
#         """
#         Each backend class must supply a priority, a number (float or integer)
#         indicating the priority of the backend relative to all other backends.
#         The priority need not be static -- it may (and should) vary based
#         attributes of the environment in which is runs (platform, available
#         packages, etc.).
# 
#         A higher number indicates a higher priority. The priority should raise
#         a RuntimeError with a message indicating the underlying cause if the
#         backend is not suitable for the current environment.
# 
#         As a rule of thumb, a priority between zero but less than one is
#         suitable, but a priority of one or greater is recommended.
#         """
# 
#     @properties.ClassProperty
#     @classmethod
#     def viable(cls):
#         with errors.ExceptionRaisedContext() as exc:
#             cls.priority
#         return not bool(exc)
# 
#     @abc.abstractmethod
#     def get_password(self, service, username):
#         """Get password of the username for the service
#         """
#         return None
# 
#     @abc.abstractmethod
#     def set_password(self, service, username, password):
#         """Set password for the username of the service
#         """
#         raise errors.PasswordSetError("reason")
# 
#     # for backward-compatibility, don't require a backend to implement
#     #  delete_password
#     #@abc.abstractmethod
#     def delete_password(self, service, username):
#         """Delete the password for the username of the service.
#         """
#         raise errors.PasswordDeleteError("reason")


# Path: keyring/keyring/backends/OS_X.py
import platform
import subprocess
import re
import binascii
from ..backend import KeyringBackend
from ..errors import PasswordSetError
from ..errors import PasswordDeleteError
from ..util import properties
from ..py27compat import unicode_str




class SecurityCommand(unicode_str):
    """
    A string suitable for passing as the 'command' parameter to the
    OS X 'security' command.
    """
    def __new__(cls, cmd, store='generic'):
        cmd = '%(cmd)s-%(store)s-password' % vars()
        return super(SecurityCommand, cls).__new__(cls, cmd)



class Keyring(KeyringBackend):