• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python debug.log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vistrails.core.debug.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: initialize

def initialize(*args, **keywords):
    if "CLTools" == identifiers.name:
        # this is the original package 
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except:
                debug.critical("""Could not create CLTools directory. Make
 sure '%s' does not exist and parent directory is writable""" % location)
                sys.exit(1)
    else:
        # this is a standalone package so modules are placed in this directory
        location = os.path.dirname(__file__)
    

    reg = vistrails.core.modules.module_registry.get_module_registry()
    reg.add_module(CLTools, abstract=True)
    for path in os.listdir(location):
        if path.endswith(SUFFIX):
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc:
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:30,代码来源:init.py


示例2: register_operations

def register_operations(reg, pkg, namespace, exclude=set()):
    modules = set()

    for name in dir(pkg):
        if name in exclude:
            continue

        op = getattr(pkg, name)
        if isinstance(op, types.ModuleType) or name.startswith('_'):
            continue
        if not callable(op):
            continue
        if op.__doc__ is None:
            debug.log("Object has no __doc__: %r" % op)
            continue

        args = guess_args(op, op.__doc__, op_name=name)

        input_ports = [(arg, type_)
                       for arg, descr, type_ in args]
        reg.add_module(type(name, (AutoOperation,),
                            {'args': args, 'op': (op,),
                             '_input_ports': input_ports,
                             '__doc__': op.__doc__}),
                       namespace=namespace)
        modules.add(name)

    return modules
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:28,代码来源:init.py


示例3: guess_args

def guess_args(obj, doc, op_name=None):
    args = []
    for line in read_args(doc):
        if not ':' in line:
            debug.log("Malformated argument in doc: %r" % obj)
            continue
        arg, descr = line.split(':', 1)
        descr = descr.strip()

        if arg == 'shape':
            type_ = '(basic:List)'
        elif (op_name is not None and
                (op_name == 'assign' or op_name.startswith('assign_')) and
                arg == 'ref'):
            type_ = Variable
        elif (_re_arg_bool.search(descr) is not None):
            type_ = '(basic:Boolean)'
        elif (_re_arg_int.search(descr) is not None):
            type_ = '(basic:Integer)'
        elif descr.lower().startswith("A list "):
            type_ = '(basic:List)'
        elif arg == 'dtype' or arg == 'name':
            type_ = '(basic:String)'
        else:
            type_ = TFOperation
        args.append((arg, descr, type_))
    if not args:
        debug.log("Didn't find 'Args:' in doc; skipping: %r" %
                  obj)
    return args
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:30,代码来源:init.py


示例4: install_default_startupxml_if_needed

 def install_default_startupxml_if_needed():
     fname = os.path.join(self.temp_configuration.dotVistrails,
                          'startup.xml')
     root_dir = system.vistrails_root_directory()
     origin = os.path.join(root_dir, 'core','resources',
                           'default_vistrails_startup_xml')
     def skip():
         if os.path.isfile(fname):
             try:
                 d = self.startup_dom()
                 v = str(d.getElementsByTagName('startup')[0].attributes['version'].value)
                 return LooseVersion('0.1') <= LooseVersion(v)
             except Exception:
                 return False
         else:
             return False
     if skip():
         return
     try:
         shutil.copyfile(origin, fname)
         debug.log('Succeeded!')
     except Exception, e:
         debug.critical("""Failed to copy default configuration
         file to %s. This could be an indication of a
         permissions problem. Please make sure '%s' is writable."""
                        % (fname,
                           self.temp_configuration.dotVistrails), e)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:27,代码来源:startup.py


示例5: reload_scripts

def reload_scripts():
    remove_all_scripts()
    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except:
                debug.critical("""Could not create CLTools directory. Make
 sure '%s' does not exist and parent directory is writable""" % location)
                sys.exit(1)
    else:
        # this is a standalone package so modules are placed in this directory
        location = os.path.dirname(__file__)
    
    for path in os.listdir(location):
        if path.endswith(SUFFIX):
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc:
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())

    from vistrails.core.interpreter.cached import CachedInterpreter
    CachedInterpreter.clear_package(identifiers.identifier)

    from vistrails.gui.vistrails_window import _app
    _app.invalidate_pipelines()
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:34,代码来源:init.py


示例6: install_package

 def install_package(self, codepath):
     debug.log("package found!")
     # read manifest
     try:
         f = open(os.path.join(self._path, codepath, "MANIFEST"))
     except IOError, e:
         raise InvalidPackage("Package is missing manifest.")
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:7,代码来源:packagerepository.py


示例7: __init__

    def __init__(self, address):
        """ Process WSDL and add all Types and Methods
        """
        self.address = address
        self.signature = toSignature(self.address)
        self.wsdlHash = '-1'
        self.modules = []
        self.package = None
        debug.log("Installing Web Service from WSDL: %s"% address)

        options = dict(cachingpolicy=1, cache=package_cache)
        
        proxy_types = ['http']
        for t in proxy_types:
            key = 'proxy_%s'%t
            if configuration.check(key):
                proxy = getattr(configuration, key)
                debug.log("Using proxy: %s" % proxy)
                if len(proxy):
                    options['proxy'] = {t:proxy}
        try:
            self.service = suds.client.Client(address, **options)
            self.backUpCache()
        except Exception, e:
            self.service = None
            # We may be offline and the cache may have expired,
            # try to use backup
            if self.restoreFromBackup():
                try:
                    self.service = suds.client.Client(address, **options)
                except Exception, e:
                    self.service = None
                    debug.critical("Could not load WSDL: %s" % address,
                           str(e) + '\n' + str(traceback.format_exc()))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:34,代码来源:init.py


示例8: create_startupxml_if_needed

    def create_startupxml_if_needed(self):
        needs_create = True
        fname = self.get_startup_xml_fname()
        if os.path.isfile(fname):
            try:
                tree = ElementTree.parse(fname)
                startup_version = \
                    vistrails.db.services.io.get_version_for_xml(tree.getroot())
                version_list = version_string_to_list(startup_version)
                if version_list >= [0,1]:
                    needs_create = False
            except:
                debug.warning("Unable to read startup.xml file, "
                              "creating a new one")

        if needs_create:
            root_dir = system.vistrails_root_directory()
            origin = os.path.join(root_dir, 'core','resources',
                                  'default_vistrails_startup_xml')
            try:
                shutil.copyfile(origin, fname)
                debug.log('Succeeded!')
                self.first_run = True
            except:
                debug.critical("""Failed to copy default configuration
                file to %s. This could be an indication of a
                permissions problem. Please make sure '%s' is writable."""
                               % (fname, self._dot_vistrails))
                raise
开发者ID:alexmavr,项目名称:VisTrails,代码行数:29,代码来源:startup.py


示例9: reload_scripts

def reload_scripts(initial=False, name=None):
    reg = vistrails.core.modules.module_registry.get_module_registry()
    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        if name is None:
            remove_all_scripts()
        else:
            del cl_tools[name]
            reg.delete_module(identifiers.identifier, name)

    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location): # pragma: no cover # pragma: no branch
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except Exception, e:
                debug.critical("Could not create CLTools directory. Make "
                               "sure '%s' does not exist and parent directory "
                               "is writable" % location,
                               e)
                sys.exit(1)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:27,代码来源:init.py


示例10: get_connection

    def get_connection(self):
        if self._conn_id is not None \
                and DBLocator.connections.has_key(self._conn_id):
            connection = DBLocator.connections[self._conn_id]
            if io.ping_db_connection(connection):
                return connection
        else:
            if self._conn_id is None:
                if DBLocator.cache_connections.has_key(self._hash):
                    connection = DBLocator.cache_connections[self._hash]
                    if io.ping_db_connection(connection):
                        debug.log("Reusing cached connection")
                        return connection

                if len(DBLocator.connections.keys()) == 0:
                    self._conn_id = 1
                else:
                    self._conn_id = max(DBLocator.connections.keys()) + 1
        config = {'host': self._host,
                  'port': self._port,
                  'db': self._db,
                  'user': self._user,
                  'passwd': self._passwd}
        #print "config:", config
        connection = io.open_db_connection(config)
            
        DBLocator.connections[self._conn_id] = connection
        DBLocator.cache_connections[self._hash] = connection
        return connection
开发者ID:hjanime,项目名称:VisTrails,代码行数:29,代码来源:locator.py


示例11: temp_autosave_changed

 def temp_autosave_changed(self, on):
     """ temp_autosave_changed(on: int) -> None
     
     """
     debug.log("thumbs_temp_auto_save_changed")
     value = bool(on)
     if self._autosave_cb.text() == "No (for this session only)":
         value = not bool(on)
     
     self._temp_configuration.thumbs.autoSave = value
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:configuration.py


示例12: temp_mouse_hover_changed

 def temp_mouse_hover_changed(self, on):
     """ temp_mouse_hover_changed(on: int) -> None
     
     """
     debug.log("thumbs_temp_mouse_hover_changed")
     value = bool(on)
     if self._mouse_hover_cb.text() == "No (for this session only)":
         value = not bool(on)
     
     self._temp_configuration.thumbs.mouseHover = value
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:configuration.py


示例13: temp_use_cache_changed

    def temp_use_cache_changed(self, on):
        """ temp_use_cache_changed(on: int) -> None

        """
        debug.log("temp_use_cache_changed")
        value = bool(on)
        if self._use_cache_cb.text() == "No (for this session only)":
            value = not bool(on)
        
        self._temp_configuration.useCache = value
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:configuration.py


示例14: temp_db_connect_changed

    def temp_db_connect_changed(self, on):
        """ temp_db_connect_changed(on: int) -> None

        """
        debug.log("temp_db_connect_changed")
        value = bool(on)
        if self._db_connect_cb.text() == "No (for this session only)":
            value = not bool(on)
        
        self._temp_configuration.dbDefault = value
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:configuration.py


示例15: initialize

def initialize(*args, **keywords):
    reg = vistrails.core.modules.module_registry.get_module_registry()
    basic = vistrails.core.modules.basic_modules

    reg.add_module(DownloadFile)
    reg.add_input_port(DownloadFile, "url", (basic.String, 'URL'))
    reg.add_input_port(DownloadFile, 'insecure',
                       (basic.Boolean, "Allow invalid SSL certificates"),
                       optional=True, defaults="['False']")
    reg.add_output_port(DownloadFile, "file",
                        (basic.File, 'local File object'))
    reg.add_output_port(DownloadFile, "local_filename",
                        (basic.String, 'local filename'), optional=True)

    reg.add_module(HTTPDirectory)
    reg.add_input_port(HTTPDirectory, 'url', (basic.String, "URL"))
    reg.add_input_port(HTTPDirectory, 'insecure',
                       (basic.Boolean, "Allow invalid SSL certificates"),
                       optional=True, defaults="['False']")
    reg.add_output_port(HTTPDirectory, 'directory',
                        (basic.Directory, "local Directory object"))
    reg.add_output_port(HTTPDirectory, 'local_path',
                        (basic.String, "local path"), optional=True)

    reg.add_module(RepoSync)
    reg.add_input_port(RepoSync, "file", (basic.File, 'File'))
    reg.add_input_port(RepoSync, "checksum",
                       (basic.String, 'Checksum'), optional=True)
    reg.add_output_port(RepoSync, "file", (basic.File,
                                           'Repository Synced File object'))
    reg.add_output_port(RepoSync, "checksum",
                        (basic.String, 'Checksum'), optional=True)

    reg.add_module(URLEncode)
    reg.add_input_port(URLEncode, "string", basic.String)
    reg.add_output_port(URLEncode, "encoded", basic.String)

    reg.add_module(URLDecode)
    reg.add_input_port(URLDecode, "encoded", basic.String)
    reg.add_output_port(URLDecode, "string", basic.String)

    global package_directory
    dotVistrails = current_dot_vistrails()
    package_directory = os.path.join(dotVistrails, "HTTP")

    if not os.path.isdir(package_directory):
        try:
            debug.log("Creating HTTP package directory: %s" % package_directory)
            os.mkdir(package_directory)
        except Exception, e:
            raise RuntimeError("Failed to create cache directory: %s" %
                               package_directory, e)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:52,代码来源:init.py


示例16: __init__

    def __init__(self, address):
        """ Process WSDL and add all Types and Methods
        """
        self.address = address
        self.signature = toSignature(self.address)
        self.wsdlHash = '-1'
        self.modules = []
        self.package = None
        debug.log("Installing Web Service from WSDL: %s"% address)

        options = dict(cachingpolicy=1, cache=package_cache)
        
        proxy_types = ['http']
        for t in proxy_types:
            key = 'proxy_%s'%t
            if configuration.check(key):
                proxy = getattr(configuration, key)
                debug.log("Using proxy: %s" % proxy)
                if len(proxy):
                    options['proxy'] = {t:proxy}
        try:
            self.service = suds.client.Client(address, **options)
            self.backUpCache()
        except Exception:
            self.service = None
            # We may be offline and the cache may have expired,
            # try to use backup
            if self.restoreFromBackup():
                try:
                    self.service = suds.client.Client(address, **options)
                except Exception:
                    self.service = None
                    debug.critical("Could not load WSDL: %s" % address,
                                   traceback.format_exc())
            else:
                debug.critical("Could not load WSDL: %s" % address,
                               traceback.format_exc())
        if self.service:
            try:
                self.createPackage()
                self.setTypes()
                self.setMethods()
                self.createTypeClasses()
                self.createMethodClasses()
            except Exception:
                debug.critical("Could not create Web Service: %s" % address,
                               traceback.format_exc())
                self.service = None
        if self.wsdlHash == '-1':
            # create empty package so that it can be reloaded/deleted
            self.createFailedPackage()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:51,代码来源:init.py


示例17: addTag

 def addTag(self, version_name, version_number):
     """addTag(version_name, version_number) -> None
     Adds new tag to vistrail
       
     """
     if version_name == '':
         return None
     if self.has_tag(version_number):
         debug.log("Version is already tagged")
         raise VersionAlreadyTagged()
     if self.has_tag_str(version_name):
         debug.log("Tag already exists")
         raise TagExists()
     self.set_tag(version_number, version_name)
开发者ID:Nikea,项目名称:VisTrails,代码行数:14,代码来源:vistrail.py


示例18: create_default_directory

    def create_default_directory(self):
        if os.path.lexists(self.temp_configuration.dotVistrails):
            return

        debug.log('Will try to create default directory')
        try:
            os.mkdir(self.temp_configuration.dotVistrails)
            debug.log('Succeeded!')
        except:
            debug.critical("""Failed to create initialization directory.
                    This could be an indication of a permissions problem.
                    Make sure parent directory of '%s' is writable."""
                    % self.temp_configuration.dotVistrails)
            sys.exit(1)
开发者ID:cjh1,项目名称:VisTrails,代码行数:14,代码来源:startup.py


示例19: finalize

 def finalize(self):
     if not self._initialized:
         return
     debug.log("Finalizing %s" % self.name)
     try:
         callable_ = self._module.finalize
     except AttributeError:
         pass
     else:
         try:
             callable_()
         except Exception, e:
             debug.critical("Couldn't finalize %s: %s: %s" % (
                            self.name, type(e).__name__, ', '.join(e.args)))
开发者ID:tacaswell,项目名称:VisTrails,代码行数:14,代码来源:package.py


示例20: initialize

def initialize(*args, **keywords):
    """ initialize() -> None
    Package-entry to initialize the package

    """
    import vistrails.core.application
    if not vistrails.core.application.is_running_gui():
        raise RuntimeError, "GUI is not running. The Spreadsheet package requires the GUI"

    # initialize widgets
    debug.log('Loading Spreadsheet widgets...')
    global basicWidgets
    if basicWidgets==None:
        basicWidgets = addWidget('vistrails.packages.spreadsheet.basic_widgets')
    importWidgetModules(basicWidgets)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:15,代码来源:init.py



注:本文中的vistrails.core.debug.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python debug.unexpected_exception函数代码示例发布时间:2022-05-26
下一篇:
Python debug.format_exception函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap