from future import standard_library standard_library.install_aliases() from builtins import range from builtins import * from past.utils import old_div from builtins import object STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build') IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') from clonedigger.logilab.common.deprecation import moved get_cycles = moved('logilab.common.graph', 'get_cycles') cached = moved('logilab.common.decorators', 'cached') ProgressBar = moved('logilab.common.shellutils', 'ProgressBar') Execute = moved('logilab.common.shellutils', 'Execute') acquire_lock = moved('logilab.common.shellutils', 'acquire_lock') release_lock = moved('logilab.common.shellutils', 'release_lock') deprecated_function = moved('logilab.common.deprecation', 'deprecated_function') class_renamed = moved('logilab.common.deprecation', 'class_renamed') def intersection(list1, list2): """return the intersection of list1 and list2""" warn('this function is deprecated, use a set instead', DeprecationWarning, stacklevel=2) intersect_dict, result = {}, [] for item in list1: intersect_dict[item] = 1
database='', user='', password='', port='', quiet=False, drivers=PREFERED_DRIVERS, pywrap=False): """return a db connexion according to given arguments""" module, modname = _import_driver_module(driver, drivers, ['connect']) try: adapter = ADAPTER_DIRECTORY.get_adapter(driver, modname) except NoAdapterFound, err: if not quiet: msg = 'No Adapter found for %s, using default one' % err.objname print >> sys.stderr, msg adapted_module = DBAPIAdapter(module, pywrap) else: adapted_module = adapter(module, pywrap) if host and not port: try: host, port = host.split(':', 1) except ValueError: pass if port: port = int(port) return adapted_module.connect(host, database, user, password, port=port) from clonedigger.logilab.common.deprecation import moved get_adv_func_helper = moved('logilab.common.adbh', 'get_adv_func_helper')
from __future__ import print_function from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import range from builtins import * from past.utils import old_div from builtins import object STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build') IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') from clonedigger.logilab.common.deprecation import moved get_cycles = moved('logilab.common.graph', 'get_cycles') cached = moved('logilab.common.decorators', 'cached') ProgressBar = moved('logilab.common.shellutils', 'ProgressBar') Execute = moved('logilab.common.shellutils', 'Execute') acquire_lock = moved('logilab.common.shellutils', 'acquire_lock') release_lock = moved('logilab.common.shellutils', 'release_lock') deprecated_function = moved('logilab.common.deprecation', 'deprecated_function') class_renamed = moved('logilab.common.deprecation', 'class_renamed') def intersection(list1, list2): """return the intersection of list1 and list2""" warn('this function is deprecated, use a set instead', DeprecationWarning, stacklevel=2)
from clonedigger.logilab.common.adbh import get_adv_func_helper mod.adv_func_helper = get_adv_func_helper(driver) return mod def get_connection(driver='postgres', host='', database='', user='', password='', port='', quiet=False, drivers=PREFERED_DRIVERS, pywrap=False): """return a db connexion according to given arguments""" module, modname = _import_driver_module(driver, drivers, ['connect']) try: adapter = ADAPTER_DIRECTORY.get_adapter(driver, modname) except NoAdapterFound as err: if not quiet: msg = 'No Adapter found for %s, using default one' % err.objname print(msg, file=sys.stderr) adapted_module = DBAPIAdapter(module, pywrap) else: adapted_module = adapter(module, pywrap) if host and not port: try: host, port = host.split(':', 1) except ValueError: pass if port: port = int(port) return adapted_module.connect(host, database, user, password, port=port) from clonedigger.logilab.common.deprecation import moved get_adv_func_helper = moved('logilab.common.adbh', 'get_adv_func_helper')