[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.144.110.15: ~ $
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

from __future__ import absolute_import

# support overrides in different directories than our gi module
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

import sys
import os
import importlib

# we can't have pygobject 2 loaded at the same time we load the internal _gobject
if 'gobject' in sys.modules:
    raise ImportError('When using gi.repository you must not import static '
                      'modules like "gobject". Please change all occurrences '
                      'of "import gobject" to "from gi.repository import GObject".')

from . import _gi
from ._gi import _gobject
from ._gi import _API
from ._gi import Repository
from ._gi import PyGIDeprecationWarning
from ._gi import PyGIWarning

_API = _API  # pyflakes
PyGIDeprecationWarning = PyGIDeprecationWarning
PyGIWarning = PyGIWarning

_versions = {}
_overridesdir = os.path.join(os.path.dirname(__file__), 'overrides')

version_info = _gobject.pygobject_version[:]
__version__ = "{0}.{1}.{2}".format(*version_info)


def check_version(version):
    if isinstance(version, str):
        version_list = tuple(map(int, version.split(".")))
    else:
        version_list = version

    if version_list > version_info:
        raise ValueError((
            "pygobject's version %s required, and available version "
            "%s is not recent enough") % (version, __version__)
        )


def require_version(namespace, version):
    """ Ensures the correct versions are loaded when importing `gi` modules.

    :param namespace: The name of module to require.
    :type namespace: str
    :param version: The version of module to require.
    :type version: str
    :raises ValueError: If module/version is already loaded, already required, or unavailable.

    :Example:

    .. code-block:: python

        import gi
        gi.require_version('Gtk', '3.0')

    """
    repository = Repository.get_default()

    if namespace in repository.get_loaded_namespaces():
        loaded_version = repository.get_version(namespace)
        if loaded_version != version:
            raise ValueError('Namespace %s is already loaded with version %s' %
                             (namespace, loaded_version))

    if namespace in _versions and _versions[namespace] != version:
        raise ValueError('Namespace %s already requires version %s' %
                         (namespace, _versions[namespace]))

    available_versions = repository.enumerate_versions(namespace)
    if not available_versions:
        raise ValueError('Namespace %s not available' % namespace)

    if version not in available_versions:
        raise ValueError('Namespace %s not available for version %s' %
                         (namespace, version))

    _versions[namespace] = version


def require_versions(requires):
    """ Utility function for consolidating multiple `gi.require_version()` calls.

    :param requires: The names and versions of modules to require.
    :type requires: dict

    :Example:

    .. code-block:: python

        import gi
        gi.require_versions({'Gtk': '3.0', 'GLib': '2.0', 'Gio': '2.0'})
    """
    for module_name, module_version in requires.items():
        require_version(module_name, module_version)


def get_required_version(namespace):
    return _versions.get(namespace, None)


def require_foreign(namespace, symbol=None):
    """Ensure the given foreign marshaling module is available and loaded.

    :param str namespace:
        Introspection namespace of the foreign module (e.g. "cairo")
    :param symbol:
        Optional symbol typename to ensure a converter exists.
    :type symbol: str or None
    :raises: ImportError

    :Example:

    .. code-block:: python

        import gi
        import cairo
        gi.require_foreign('cairo')

    """
    try:
        _gi.require_foreign(namespace, symbol)
    except Exception as e:
        raise ImportError(str(e))
    importlib.import_module('gi.repository', namespace)

Filemanager

Name Type Size Permission Actions
_gobject Folder 0755
overrides Folder 0755
repository Folder 0755
.__init__.pyo.40009 File 4.24 KB 0644
._constants.pyo.40009 File 1.28 KB 0644
._error.pyo.40009 File 1.76 KB 0644
._option.pyo.40009 File 12.46 KB 0644
._propertyhelper.pyo.40009 File 12.6 KB 0644
._signalhelper.pyo.40009 File 9.5 KB 0644
.docstring.pyo.40009 File 4.85 KB 0644
.importer.pyo.40009 File 3.93 KB 0644
.pygtkcompat.pyo.40009 File 754 B 0644
__init__.py File 4.72 KB 0644
__init__.pyc File 4.24 KB 0644
__init__.pyo File 4.24 KB 0644
_constants.py File 2.03 KB 0644
_constants.pyc File 1.28 KB 0644
_constants.pyo File 1.28 KB 0644
_error.py File 2.03 KB 0644
_error.pyc File 1.76 KB 0644
_error.pyo File 1.76 KB 0644
_gi.so File 323.71 KB 0755
_option.py File 12.94 KB 0644
_option.pyc File 12.46 KB 0644
_option.pyo File 12.46 KB 0644
_propertyhelper.py File 14.82 KB 0644
_propertyhelper.pyc File 12.6 KB 0644
_propertyhelper.pyo File 12.6 KB 0644
_signalhelper.py File 9.63 KB 0644
_signalhelper.pyc File 9.5 KB 0644
_signalhelper.pyo File 9.5 KB 0644
docstring.py File 6.53 KB 0644
docstring.pyc File 4.85 KB 0644
docstring.pyo File 4.85 KB 0644
importer.py File 5.16 KB 0644
importer.pyc File 3.93 KB 0644
importer.pyo File 3.93 KB 0644
module.py File 9.8 KB 0644
module.pyc File 6.7 KB 0644
module.pyo File 6.64 KB 0644
pygtkcompat.py File 766 B 0644
pygtkcompat.pyc File 754 B 0644
pygtkcompat.pyo File 754 B 0644
types.py File 13.48 KB 0644
types.pyc File 9.57 KB 0644
types.pyo File 9.52 KB 0644