How to use the keyring.util.properties.ClassProperty function in keyring

To help you get started, we’ve selected a few keyring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / Gnome.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(cls):
        if 'GnomeKeyring' not in globals():
            raise RuntimeError("GnomeKeyring module required")
        result = GnomeKeyring.get_default_keyring_sync()[0]
        if result != GnomeKeyring.Result.OK:
            raise RuntimeError(result.value_name)
        return 1
github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / Google.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(cls):
        if not cls._has_gdata():
            raise RuntimeError("Requires gdata")
        if not keyczar.has_keyczar():
            raise RuntimeError("Requires keyczar")
        return 3
github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / multi.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(cls):
        return 0
github andrey-yantsen / plexiglas / plexiglas / mobile_sync.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(cls):
        return 100
github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / kwallet.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(cls):
        with ExceptionRaisedContext() as exc:
            KWallet.__name__
        if exc:
            raise RuntimeError("KDE libraries not available")
        if "DISPLAY" not in os.environ:
            raise RuntimeError("cannot connect to X server")
        # Infer if KDE environment is active based on environment vars.
        # TODO: Does PyKDE provide a better indicator?
        kde_session_keys = (
            'KDE_SESSION_ID', # most environments
            'KDE_FULL_SESSION', # openSUSE
        )
        if not set(os.environ).intersection(kde_session_keys):
            return 0
github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / file.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(self):
        "Applicable for all platforms, but not recommended."
        try:
            __import__('Crypto.Cipher.AES')
            __import__('Crypto.Protocol.KDF')
            __import__('Crypto.Random')
        except ImportError:
            raise RuntimeError("PyCrypto required")
        if not json:
            raise RuntimeError("JSON implementation such as simplejson "
                "required.")
        return .6
github andrey-yantsen / plexiglas / plexiglas / plugin.py View on Github external
    @properties.ClassProperty
    @classmethod
    def name(cls):
        return '%s.%s' % (cls.__module__, cls.__name__)
github nficano / alexa-find-my-iphone / src / site-packages / keyrings / alt / Windows.py View on Github external
    @properties.ClassProperty
    @classmethod
    def priority(self):
        """
        Preferred on Windows when pywin32 isn't installed
        """
        if platform.system() != 'Windows':
            raise RuntimeError("Requires Windows")
        if not has_wincrypto():
            raise RuntimeError("Requires ctypes")
        return 2
github andrey-yantsen / plexiglas / plexiglas / simple_sync.py View on Github external
    @ClassProperty
    @classmethod
    def priority(cls):
        return 10
github andrey-yantsen / plexiglas / plexiglas / plugin.py View on Github external
    @properties.ClassProperty
    @classmethod
    def viable(cls):
        with ExceptionRaisedContext() as exc:
            cls.priority
        return not bool(exc)