Example #1
0
def import_modules_by_entry_point(_packages=None):
    """Import plugins by entry-point 'rally_plugins'."""
    loaded_packages = _packages or find_packages_by_entry_point()

    for package in loaded_packages:
        if "plugins_path" in package:
            em = pkg_resources.get_entry_map(package["name"])
            ep = em["rally_plugins"]["path"]
            try:
                m = ep.load()
                if hasattr(m, "__path__"):
                    path = pkgutil.extend_path(m.__path__, m.__name__)
                else:
                    path = [m.__file__]
                prefix = m.__name__ + "."
                for loader, name, _is_pkg in pkgutil.walk_packages(
                        path, prefix=prefix):
                    sys.modules[name] = importlib.import_module(name)
            except Exception as e:
                msg = ("\t Failed to load plugins from module '%(module)s' "
                       "(package: '%(package)s')" %
                       {"module": ep.module_name,
                        "package": "%s %s" % (package["name"],
                                              package["version"])})
                if logging.is_debug():
                    LOG.exception(msg)
                else:
                    LOG.warning(msg + (": %s" % six.text_type(e)))
    return loaded_packages
Example #2
0
def component_loader(__path__, __name__):
    """
    Loads classes from subdirectories of a given module.
    """
    __path__ = pkgutil.extend_path(__path__, __name__)

    for importer, module_name, ispkg in pkgutil.walk_packages(path=__path__, prefix=__name__+'.'):
        importlib.import_module(module_name)
Example #3
0
def __splpy_addDirToPath(dir):
    if os.path.isdir(dir):
        if dir not in sys.path:
            sys.path.insert(0, dir)
            # In case a streamsx module (e.g. streamsx.bm) 
            # is included in the additional code
            if os.path.isdir(os.path.join(dir, 'streamsx')):
                streamsx.__path__ = extend_path(streamsx.__path__, streamsx.__name__)
  def __enter__(self):
    # pkg_resources comes with setuptools.
    try:
      import pkg_resources
      nsdict = copy.deepcopy(pkg_resources._namespace_packages)
      declare_namespace = pkg_resources.declare_namespace
      pkg_resources.declare_namespace = self._declare_namespace
    except ImportError:
      nsdict = None
      declare_namespace = None

    # Save the global importer state.
    self.state = {
      'nsdict': nsdict,
      'declare_namespace': declare_namespace,
      'nspaths': {},
      'path': sys.path[:],
      'meta_path': sys.meta_path[:],
      'disables': {},
      'pkgutil.extend_path': pkgutil.extend_path,
    }

    # Update the systems meta path and apply function mocks.
    sys.path[:] = self.path
    sys.meta_path[:] = self.meta_path + sys.meta_path
    pkgutil.extend_path = extend_path

    # If this function is called not the first time, we need to
    # restore the modules that have been imported with it and
    # temporarily disable the ones that would be shadowed.
    for key, mod in items(self.modules):
      try: self.state['disables'][key] = sys.modules.pop(key)
      except KeyError: pass
      sys.modules[key] = mod

    # Evaluate imports from the .pth files, if any.
    for fn, lineno, stmt in self.pth_imports:
      exec_pth_import(fn, lineno, stmt)

    # Add the original path to sys.path.
    sys.path += self.state['path']

    # Update the __path__ of all namespace modules.
    for key, mod in items(sys.modules):
      if mod is None:
        # Relative imports could have lead to None-entries in
        # sys.modules. Get rid of them so they can be re-evaluated.
        prefix = key.rpartition('.')[0]
        if hasattr(sys.modules.get(prefix), '__path__'):
          del sys.modules[key]
      elif hasattr(mod, '__path__'):
        self.state['nspaths'][key] = copy.copy(mod.__path__)
        mod.__path__ = pkgutil.extend_path(mod.__path__, mod.__name__)

    self.in_context = True
    if self.do_autodisable:
      self.autodisable()
    return self
  def _declare_namespace(self, package_name):
    '''
    Mock for #pkg_resources.declare_namespace() which calls
    #pkgutil.extend_path() afterwards as the original implementation doesn't
    seem to properly find all available namespace paths.
    '''

    self.state['declare_namespace'](package_name)
    mod = sys.modules[package_name]
    mod.__path__ = pkgutil.extend_path(mod.__path__, package_name)
Example #6
0
def _add_to_sys_path(dir_):
    if _TRACE.isEnabledFor(logging.DEBUG):
        _TRACE.debug('Potential addition to sys.path: %s EXISTS %s', dir_, str(os.path.isdir(dir_)))
    if os.path.isdir(dir_) and dir_ not in sys.path and os.listdir(dir_):
        _TRACE.debug('Inserting as first entry to sys.path: %s', dir_)
        sys.path.insert(0, dir_)
        pkg_resources.working_set.add_entry(dir_)
        # In case a streamsx module (e.g. streamsx.bm) 
        # is included in the additional code
        if os.path.isdir(os.path.join(dir_, 'streamsx')):
            streamsx.__path__ = extend_path(streamsx.__path__, streamsx.__name__)
        return True
    return False
def _import_encodings():
    import os
    import imp
    import encodings
    import pkgutil
    import sys
    del sys.path[:2]
    import encodings.aliases

    encodings.__path__ = pkgutil.extend_path(
            encodings.__path__,
            encodings.__name__)
    #imp.reload(encodings)

    import encodings.mac_roman
    encodings.aliases.__file__ = os.path.join(
            os.path.dirname(encodings.mac_roman.__file__),
            'aliases.py' + encodings.mac_roman.__file__[:-1])

    imp.reload(encodings.aliases)
    imp.reload(encodings)
Example #8
0
def import_modules_by_entry_point():
    """Import plugins by entry-point 'rally_plugins'."""
    for ep in pkg_resources.iter_entry_points("rally_plugins"):
        if ep.name == "path":
            try:
                m = ep.load()
                if hasattr(m, "__path__"):
                    path = pkgutil.extend_path(m.__path__, m.__name__)
                else:
                    path = [m.__file__]
                prefix = m.__name__ + "."
                for loader, name, _is_pkg in pkgutil.walk_packages(
                        path, prefix=prefix):
                    sys.modules[name] = importlib.import_module(name)
            except Exception as e:
                msg = ("\t Failed to load plugins from module '%(module)s' "
                       "(package: '%(package)s')" %
                       {"module": ep.module_name,
                        "package": "%s %s" % (ep.dist.project_name,
                                              ep.dist.version)})
                if logging.is_debug():
                    LOG.exception(msg)
                else:
                    LOG.warning(msg + (": %s" % six.text_type(e)))
Example #9
0
def extendPath(path, name):
    """Extend path, this method is based on pkgutil.extend_path and will
    allow aid on supporting inheriting resource paths.
    
    Example usage:
    from BWUtil import extendPath
    __path__ = extendPath(__path__, __name__)
    """
    from pkgutil import extend_path
    path = extend_path(path, name)
    if not isinstance(path, list):
        return path
    pname = os.path.join(*name.split('.'))
    init_py = '__init__' + os.extsep + 'py'
    path = path[:]
    for dir in sys.path:
        if not isinstance(dir, basestring) or not ResMgr.isDir(dir):
            continue
        subdir = os.path.join(dir, pname)
        initfile = os.path.join(subdir, init_py)
        if subdir not in path and ResMgr.isFile(initfile):
            path.append(subdir)

    return path
Example #10
0
# -*- coding: utf-8 -*-
# Namespaced packages, see http://www.python.org/dev/peps/pep-0420/

try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:  # pragma: no cover
    from pkgutil import extend_path  # pragma: no cover
    __path__ = extend_path(__path__, __name__)  # pragma: no cover
Example #11
0
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://www.herculesstichting.be/in_English)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/VSC-tools
#
# VSC-tools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# VSC-tools 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with VSC-tools. If not, see <http://www.gnu.org/licenses/>.
##
"""
initialize vsc.mympirun package.
the vsc.mympirun namespace is used in different folders allong the system
so explicitly declare this is also the vsc namespace

@author: Jens Timmerman (Ghent University)
@author: Stijn De Weirdt (Ghent University)
"""
from pkgutil import extend_path

# we're not the only ones in this namespace
__path__ = extend_path(__path__, __name__)  #@reservedassignment
Example #12
0
    relies on GitPython (see http://gitorious.org/git-python)
    """
    try:
        import git
    except ImportError:
        return UNKNOWN
    try:
        path = os.path.dirname(__file__)
        gitrepo = git.Git(path)
        return gitrepo.rev_list("HEAD").splitlines()[0]
    except git.GitCommandError:
        return UNKNOWN


git_rev = get_git_revision()
if git_rev == UNKNOWN:
    VERBOSE_VERSION = VERSION
else:
    VERBOSE_VERSION = LooseVersion("%s-r%s" % (VERSION, git_rev))

# extend path so python finds our easyblocks in the subdirectories where they are located
subdirs = [chr(l) for l in range(ord('a'), ord('z') + 1)] + ['0']
for subdir in subdirs:
    __path__ = extend_path(__path__, '%s.%s' % (__name__, subdir))

del subdir, subdirs, l, git_rev

# let python know this is not the only place to look for easyblocks, so we can have multiple
# easybuild/easyblocks paths in the Python search path, next to the official easyblocks distribution
pkg_resources.declare_namespace(__name__)
Example #13
0
    relies on GitPython (see http://gitorious.org/git-python)
    """
    try:
        import git
    except ImportError:
        return UNKNOWN
    try:
        path = os.path.dirname(__file__)
        gitrepo = git.Git(path)
        return gitrepo.rev_list("HEAD").splitlines()[0]
    except git.GitCommandError:
        return UNKNOWN


git_rev = get_git_revision()
if git_rev == UNKNOWN:
    VERBOSE_VERSION = VERSION
else:
    VERBOSE_VERSION = LooseVersion("%s-r%s" % (VERSION, git_rev))

# extend path so python finds our easyblocks in the subdirectories where they are located
subdirs = [chr(l) for l in range(ord('a'), ord('z') + 1)] + ['0']
for subdir in subdirs:
    __path__ = extend_path(__path__, '%s.%s' % (__name__, subdir))

del subdir, subdirs, l, git_rev

# let python know this is not the only place to look for easyblocks, so we can have multiple
# easybuild/easyblocks paths in the Python search path, next to the official easyblocks distribution
pkg_resources.declare_namespace(__name__)
Example #14
0
from pkgutil import extend_path
__path__ = extend_path(__path__, 'neurokernel')
Example #15
0
from pkgutil import extend_path
__path__ = extend_path(__path__, 'fabctx')
Example #16
0
# this is a namespace package
try:
    import pkg_resources
    pkg_resources.declare_namespace(__name__)
except ImportError:
    import pkgutil
    __path__ = pkgutil.extend_path(__path__, __name__) # @ReservedAssignment

VERSION = '2.1'
FULL_VERSION = '2.1.6'
Example #17
0
from pkgutil import extend_path  # pragma: nocover
__path__ = extend_path(__path__, __name__)  # pragma: nocover
Example #18
0
from pydantic import BaseModel

from nonebot.utils import DataclassEncoder

if TYPE_CHECKING:
    from nonebot.config import Config
    from nonebot.drivers import Driver, WebSocket

try:
    import pkg_resources
    pkg_resources.declare_namespace(__name__)
    del pkg_resources
except ImportError:
    import pkgutil
    __path__: Iterable[str] = pkgutil.extend_path(__path__, __name__)
    del pkgutil
except Exception:
    pass


class Bot(abc.ABC):
    """
    Bot 基类。用于处理上报消息,并提供 API 调用接口。
    """

    driver: "Driver"
    """Driver 对象"""
    config: "Config"
    """Config 配置对象"""
Example #19
0
# maky "pyxb" subpackages available
from pkgutil import extend_path
__path__ = extend_path(__path__, "pyxb")
Example #20
0
__author__ = "Jérôme Kieffer"
__contact__ = "*****@*****.**"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "15/12/2014"


import unittest
import os
import numpy
import logging, time
import sys
import fabio
if __name__ == '__main__':
    import pkgutil, os
    __path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
pyFAI = sys.modules["pyFAI"]

if logger.getEffectiveLevel() <= logging.INFO:
    import pylab

class TestPolarization(unittest.TestCase):
    shape = (13, 13)
    Y, X = numpy.ogrid[-6:7, -6:7]
    rotY = numpy.radians(30.0 * Y)
    rotX = numpy.radians(30.0 * X)
    tth = numpy.sqrt(rotY ** 2 + rotX ** 2)
    chi = numpy.arctan2(rotY, rotX)
#    print numpy.degrees(tth[6])
Example #21
0
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

# !!! DO NOT MODIFY !!! (pkgutil-style namespace package)

from pkgutil import extend_path

from pkg_resources import get_distribution, DistributionNotFound

__path__ = extend_path(__path__, __name__)  # type: ignore

try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    __version__ = "0.0.0-unknown"
Example #22
0
# Map from listeners proto, with holes where filter config fragments should go, and
# a list of filter config fragment protos, to a final listeners.pb with the
# config fragments converted to the opaque Struct representation.

import sys

# Some evil hack to deal with the fact that Bazel puts both google/api and
# google/protobuf roots in the sys.path, and Python gets confused, e.g. it
# thinks that there is no api package if it encounters the google/protobuf root
# in sys.path first.
from pkgutil import extend_path
import google

google.__path__ = extend_path(google.__path__, google.__name__)

from google.protobuf import json_format
from google.protobuf import struct_pb2
from google.protobuf import text_format

from envoy.api.v2 import lds_pb2
from envoy.config.filter.network.http_connection_manager.v2 import http_connection_manager_pb2


# Convert an arbitrary proto object to its Struct proto representation.
def proto_to_struct(proto):
    json_rep = json_format.MessageToJson(proto)
    parsed_msg = struct_pb2.Struct()
    json_format.Parse(json_rep, parsed_msg)
    return parsed_msg

Example #23
0
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)  # @ReservedAssignment
Example #24
0
 def ExtendPath(self):
     self.path = pkgutil.extend_path(self.path, self.name)
     if self.parent is not None:
         self.parent.ExtendPath()
#
# LSST Data Management System
#
# Copyright 2008-2017  AURA/LSST.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program.  If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#

import pkgutil, lsstimport
__path__ = pkgutil.extend_path(__path__, __name__)


Example #26
0
# Copyright (C) 2016 Chintalagiri Shashank
#
# This file is part of tendril.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
The Connectors Utils Package (:mod:`tendril.utils.connectors`)
==============================================================

.. toctree::

    tendril.utils.connectors.prefab

"""

from pkgutil import extend_path

__path__ = extend_path(__path__, 'tendril.utils.connectors')
Example #27
0
# generated from catkin/cmake/template/__init__.py.in
# keep symbol table as clean as possible by deleting all unnecessary symbols

from os import path as os_path
from sys import path as sys_path

from pkgutil import extend_path

__extended_path = "/home/rip-acer-vn7-591g-1/catkin_ws/src/rosserial/rosserial_arduino/src".split(
    ";")
for p in reversed(__extended_path):
    sys_path.insert(0, p)
    del p
del sys_path

__path__ = extend_path(__path__, __name__)
del extend_path

__execfiles = []
for p in __extended_path:
    src_init_file = os_path.join(p, __name__ + '.py')
    if os_path.isfile(src_init_file):
        __execfiles.append(src_init_file)
    else:
        src_init_file = os_path.join(p, __name__, '__init__.py')
        if os_path.isfile(src_init_file):
            __execfiles.append(src_init_file)
    del src_init_file
    del p
del os_path
del __extended_path
Example #28
0
# -*- coding: utf-8 -*-
#
# Copyright 2013, Qunar OPSDEV
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
# Author: jaypei <*****@*****.**>
#

try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)  # flake8: noqa
Example #29
0
from pkgutil import extend_path
__path__ = extend_path([], "pylet.%s" % __name__)
Example #30
0
from __future__ import absolute_import

import os
import warnings
warnings.warn('The scikits.cuda namespace package is deprecated and will be '
              'removed in the future; please import the skcuda package '
              'instead.', DeprecationWarning, stacklevel=2)

# This import must precede the invocation of extend_path() to work with Python
# 3:
import skcuda

from pkgutil import extend_path
__path__ = extend_path(__path__, 'skcuda')

from .info import __doc__
from .version import __version__

# Needed to ensure correct header location even when modules are import as
# scikits.cuda.something:
install_headers = skcuda.__file__.replace(os.path.basename(skcuda.__file__), '') + 'include'
Example #31
0
# this is a namespace package
try:
    import pkg_resources
    pkg_resources.declare_namespace(__name__)
except ImportError:
    import pkgutil
    __path__ = pkgutil.extend_path(__path__, __name__)  # @ReservedAssignment

VERSION = '2.1'
FULL_VERSION = '2.1.6'
Example #32
0
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)  # type: ignore
Example #33
0
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

""" OpenERP core library."""


#----------------------------------------------------------
# odoo must be a namespace package for odoo.addons to become one too
# https://packaging.python.org/guides/packaging-namespace-packages/
#----------------------------------------------------------
import pkgutil
import os.path
__path__ = [
    os.path.abspath(path)
    for path in pkgutil.extend_path(__path__, __name__)
]

import sys
assert sys.version_info > (3, 6), "Outdated python version detected, Odoo requires Python >= 3.6 to run."

#----------------------------------------------------------
# Running mode flags (gevent, prefork)
#----------------------------------------------------------
# Is the server running with gevent.
evented = False
if len(sys.argv) > 1 and sys.argv[1] == 'gevent':
    sys.argv.remove('gevent')
    import gevent.monkey
    import psycopg2
    from gevent.socket import wait_read, wait_write
    gevent.monkey.patch_all()
import os, re, StringIO
import ConfigParser, pkgutil

import sonata.plugins

def find_plugin_dirs():
	return [os.path.expanduser('~/.sonata/plugins'),
		'/usr/local/lib/sonata/plugins']

# add dirs from sys.path:
sonata.plugins.__path__ = pkgutil.extend_path(sonata.plugins.__path__, 
					      sonata.plugins.__name__)
# add dirs specific to sonata:
sonata.plugins.__path__ = find_plugin_dirs() + sonata.plugins.__path__


class Plugin(object):
	def __init__(self, path, name, info, load):
		self.path = path
		self.name = name
		self._info = info
		self._load = load
		# obligatory plugin info:
		format_value = info.get('plugin', 'plugin_format')
		self.plugin_format = tuple(map(int, format_value.split(',')))
		self.longname = info.get('plugin', 'name')
		versionvalue = info.get('plugin', 'version')
		self.version = tuple(map(int, versionvalue.split(',')))
		self.version_string = '.'.join(map(str, self.version))
		self._capabilities =  dict(info.items('capabilities'))
Example #35
0
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Test for numpy images.
"""
__author__ = "Jérôme Kieffer"
__date__ = "16/06/2016"
import os
import sys
import unittest
if __name__ == '__main__':
    import pkgutil
    __path__ = pkgutil.extend_path([os.path.dirname(__file__)], "fabio.test")
from .utilstest import UtilsTest
import numpy
logger = UtilsTest.get_logger(__file__)
fabio = sys.modules["fabio"]
from fabio.numpyimage import NumpyImage
from fabio.openimage import openimage


class TestNumpy(unittest.TestCase):
    """basic test"""

    def setUp(self):
        """Generate files"""

        self.ary = numpy.random.randint(0, 6500, size=99).reshape(11, 9).astype("uint16")
Example #36
0
from pkgutil import extend_path

# Extend path so python finds our easyblocks in the subdirectories where they are located
subdirs = [chr(l) for l in range(ord('a'), ord('z') + 1)] + ['0']
for subdir in subdirs:
    __path__ = extend_path(__path__, '%s.%s' % (__name__, subdir))

# And let python know this is not the only place to look for them, so we can have multiple
# easybuild/easyblock paths in your python search path, next to the official easyblocks distribution
__path__ = extend_path(__path__, __name__)  # @ReservedAssignment

del subdir, subdirs, l
Example #37
0
from __future__ import absolute_import
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

Example #38
0
from time import time as _time
from sys import stdout as _stdout
from os.path import split as _split
from pkgutil import extend_path
__path__ = extend_path(__path__, "ome")
del extend_path
import settings
import logging

def timing(function):
    def wrapper(*args, **kwargs):
        arg_str = str(args)
        if arg_str[-2] == ",": # trailing comma
            arg_str = arg_str[:-2] + ")"
        logging.debug("starting %s" % function.func_name)
        _stdout.flush()
        l = len(function.func_name)
        start = _time()
        res = function(*args, **kwargs)
        logging.debug("%s complete (%.2f sec)"% (function.func_name, _time() - start))
        return res
    wrapper.func_doc = function.func_doc
    return wrapper

def notiming(function):
    return function


Example #39
0
def ex_path():
    __path__ = os.path.abspath()
    pkgutil.extend_path(__path__, __name__)
Example #40
0
# Load preprocessing unit
from pkgutil import extend_path
__path__ = extend_path(__path__, "../preprocessing/")
Example #41
0
from pkgutil import extend_path

from .dict_extension import *
from .enum_argparse import *
from .file import *
from .folder import *
from .list_extension import *
from .sftp import *

__path__ = extend_path(__path__, "functional")
__path__ = extend_path(__path__, "dl")

__version__ = "0.1.4"
Example #42
0
# Copyright 2014-2015 MathWorks, Inc.
"""
Array interface between Python and MATLAB.

This package defines classes and exceptions that create and manage
multidimensional arrays in Python that are passed between Python and MATLAB.
The arrays, while similar to Python sequences, have different behaviors.

Modules
-------
    * mlarray - type-specific multidimensional array classes for working
    with MATLAB
    * mlexceptions - exceptions raised manipulating mlarray objects
"""

import os
import sys
from pkgutil import extend_path
__path__ = extend_path(__path__, '__name__')

_package_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append(_package_folder)

from mlarray import double, single, uint8, int8, uint16, \
    int16, uint32, int32, uint64, int64, logical
from mlexceptions import ShapeError as ShapeError
from mlexceptions import SizeError as SizeError
Example #43
0
    relies on GitPython (see http://gitorious.org/git-python)
    """
    try:
        import git
    except ImportError:
        return UNKNOWN
    try:
        path = os.path.dirname(__file__)
        gitrepo = git.Git(path)
        return gitrepo.rev_list("HEAD").splitlines()[0]
    except git.GitCommandError:
        return UNKNOWN


git_rev = get_git_revision()
if git_rev == UNKNOWN:
    VERBOSE_VERSION = VERSION
else:
    VERBOSE_VERSION = LooseVersion("%s-r%s" % (VERSION, git_rev))

# extend path so python finds our easyblocks in the subdirectories where they are located
subdirs = [chr(l) for l in range(ord("a"), ord("z") + 1)] + ["0"]
for subdir in subdirs:
    __path__ = extend_path(__path__, "%s.%s" % (__name__, subdir))

del subdir, subdirs, l, git_rev

# let python know this is not the only place to look for easyblocks, so we can have multiple
# easybuild/easyblocks paths in the Python search path, next to the official easyblocks distribution
pkg_resources.declare_namespace(__name__)
Example #44
0
# -*- coding: utf-8 -*-
"""Tests for fastavro"""

from __future__ import absolute_import

from pkgutil import extend_path
__path__ = extend_path(__path__, 'fastavro')

import fastavro  # noqa
Example #45
0
 def ExtendPath(self):
     self.path = pkgutil.extend_path(self.path, self.name)
     if self.parent is not None:
         self.parent.ExtendPath()
Example #46
0
    or UNKNOWN is getting the git revision fails

    relies on GitPython (see http://gitorious.org/git-python)
    """
    try:
        import git
    except ImportError:
        return UNKNOWN
    try:
        path = os.path.dirname(__file__)
        gitrepo = git.Git(path)
        return gitrepo.rev_list("HEAD").splitlines()[0]
    except git.GitCommandError:
        return UNKNOWN


git_rev = get_git_revision()
if git_rev == UNKNOWN:
    VERBOSE_VERSION = VERSION
else:
    VERBOSE_VERSION = LooseVersion("%s-r%s" % (VERSION, get_git_revision()))

# Extend path so python finds our easyblocks in the subdirectories where they are located
subdirs = [chr(l) for l in range(ord('a'), ord('z') + 1)] + ['0']
__path__.extend([os.path.join(__path__[0], subdir) for subdir in subdirs])
# And let python know this is not the only place to look for them, so we can have multiple
# easybuild/easyblock paths in your python search path, next to the official easyblocks distribution
__path__ = extend_path(__path__, __name__)  # @ReservedAssignment

del subdir, subdirs, l, git_rev
Example #47
0
#!/usr/bin/env python
# encoding: utf-8

# Copyright (C) 2016 Chintalagiri Shashank
#
# This file is part of tendril.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
Docstring for __init__.py
"""

from pkgutil import extend_path
__path__ = extend_path(__path__, 'tendril.utils.connectors')
Example #48
0
"""
Galaxy root package -- this is a namespace package.
"""

from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
Example #49
0
# see https://docs.python.org/3/library/pkgutil.html
import sys
from pkgutil import extend_path

__path__ = extend_path(sys.path, __name__)