python类error()的实例源码

setup.py 文件源码 项目:exatomic 作者: exa-analytics 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self):
        if not self.has_npm():
            log.error("`npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo")
        else:
            env = os.environ.copy()
            env['PATH'] = npm_path
            log.info("Installing build dependencies with npm. This may take a while...")
            check_call(["npm", "install"], cwd=jsroot, stdout=sys.stdout, stderr=sys.stderr, **prckws)
            os.utime(node_modules, None)

        for t in self.targets:
            if not os.path.exists(t):
                msg = "Missing file: %s" % t
                if not self.has_npm():
                    msg += "\nnpm is required to build a development version of jupyter-" + name
                raise ValueError(msg)

        # update package data in case this created new files
        update_package_data(self.distribution)
setup.py 文件源码 项目:notebook-molecular-visualization 作者: Autodesk 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """decorator for building minified js/css prior to another command"""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:geonotebook 作者: OpenGeoscience 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """Decorator for building minified js/css prior to another command."""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:widget-cookiecutter 作者: jupyter-widgets 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """decorator for building minified js/css prior to another command"""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:widget-cookiecutter 作者: jupyter-widgets 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run(self):
        has_npm = self.has_npm()
        if not has_npm:
            log.error("`npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo")

        env = os.environ.copy()
        env['PATH'] = npm_path

        if self.should_run_npm_install():
            log.info("Installing build dependencies with npm.  This may take a while...")
            npmName = self.get_npm_name();
            check_call([npmName, 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr)
            os.utime(self.node_modules, None)

        for t in self.targets:
            if not os.path.exists(t):
                msg = 'Missing file: %s' % t
                if not has_npm:
                    msg += '\nnpm is required to build a development version of a widget extension'
                raise ValueError(msg)

        # update package data in case this created new files
        update_package_data(self.distribution)
setup.py 文件源码 项目:ipysankeywidget 作者: ricklupton 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """decorator for building minified js/css prior to another command"""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:ipysankeywidget 作者: ricklupton 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self):
        has_npm = self.has_npm()
        if not has_npm:
            log.error("`npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo")

        env = os.environ.copy()
        env['PATH'] = npm_path

        if self.should_run_npm_install():
            log.info("Installing build dependencies with npm.  This may take a while...")
            npm_name = self.get_npm_name()
            check_call([npm_name, 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr)
            os.utime(self.node_modules, None)

        for t in self.targets:
            if not os.path.exists(t):
                msg = 'Missing file: %s' % t
                if not has_npm:
                    msg += '\nnpm is required to build a development version of a widget extension'
                raise ValueError(msg)

        # update package data in case this created new files
        update_package_data(self.distribution)
setup.py 文件源码 项目:iprofiler 作者: j-towns 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """decorator for building minified js/css prior to another command"""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:iprofiler 作者: j-towns 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self):
        has_npm = self.has_npm()
        if not has_npm:
            log.error("`npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo")

        env = os.environ.copy()
        env['PATH'] = npm_path

        if self.should_run_npm_install():
            log.info("Installing build dependencies with npm.  This may take a while...")
            check_call(['npm', 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr)
            os.utime(self.node_modules, None)

        for t in self.targets:
            if not os.path.exists(t):
                msg = 'Missing file: %s' % t
                if not has_npm:
                    msg += '\nnpm is required to build a development version of widgetsnbextension'
                raise ValueError(msg)

        # update package data in case this created new files
        update_package_data(self.distribution)
setup.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_version(self):
            """extract version number from the b3.egg-info/PKG-INFO file"""
            log.info(">>> parse B3 version")
            pkginfo_file = os.path.join(self.build_exe, 'PKG-INFO')
            pkginfo_version = re.compile(
                r'^\s*Version:\s*(?P<version>(?P<numbers>\d+\.\d+(?:\.\d+)?)(?P<pre_release>(?:a|b|dev|d)\d*)?(?P<suffix>.*?))\s*$',
                re.MULTILINE)
            with open(pkginfo_file, 'r') as f:
                match = pkginfo_version.search(f.read())
                if not match:
                    log.error("could not find version from %s" % pkginfo_file)
                    sys.exit(1)

            current_b3_version_part1 = match.group("numbers")
            current_b3_version_part2 = ""
            if match.group("pre_release"):
                current_b3_version_part2 += match.group("pre_release")
            if match.group("suffix"):
                current_b3_version_part2 += match.group("suffix")

            return current_b3_version_part1, current_b3_version_part2
setup.py 文件源码 项目:jupyter_britecharts_widget_tutorial 作者: kazuar 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def js_prerelease(command, strict=False):
    """decorator for building minified js/css prior to another command"""
    class DecoratedCommand(command):
        def run(self):
            jsdeps = self.distribution.get_command_obj('jsdeps')
            if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
                # sdist, nothing to do
                command.run(self)
                return

            try:
                self.distribution.run_command('jsdeps')
            except Exception as e:
                missing = [t for t in jsdeps.targets if not os.path.exists(t)]
                if strict or missing:
                    log.warn('rebuilding js and css failed')
                    if missing:
                        log.error('missing files: %s' % missing)
                    raise e
                else:
                    log.warn('rebuilding js and css failed (not a problem)')
                    log.warn(str(e))
            command.run(self)
            update_package_data(self.distribution)
    return DecoratedCommand
setup.py 文件源码 项目:jupyter_britecharts_widget_tutorial 作者: kazuar 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        has_npm = self.has_npm()
        if not has_npm:
            log.error("`npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo")

        env = os.environ.copy()
        env['PATH'] = npm_path

        if self.should_run_npm_install():
            log.info("Installing build dependencies with npm.  This may take a while...")
            check_call(['npm', 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr)
            os.utime(self.node_modules, None)

        for t in self.targets:
            if not os.path.exists(t):
                msg = 'Missing file: %s' % t
                if not has_npm:
                    msg += '\nnpm is required to build a development version of widgetsnbextension'
                raise ValueError(msg)

        # update package data in case this created new files
        update_package_data(self.distribution)
lib2to3_ex.py 文件源码 项目:python- 作者: secondtonone1 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:my-first-blog 作者: AnkurBegining 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:swjtu-pyscraper 作者: Desgard 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:jira_worklog_scanner 作者: pgarneau 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:zanph 作者: zanph 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 67 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
util.py 文件源码 项目:devsecops-example-helloworld 作者: boozallen 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run_command_hooks(cmd_obj, hook_kind):
    """Run hooks registered for that command and phase.

    *cmd_obj* is a finalized command object; *hook_kind* is either
    'pre_hook' or 'post_hook'.
    """

    if hook_kind not in ('pre_hook', 'post_hook'):
        raise ValueError('invalid hook kind: %r' % hook_kind)

    hooks = getattr(cmd_obj, hook_kind, None)

    if hooks is None:
        return

    for hook in hooks.values():
        if isinstance(hook, str):
            try:
                hook_obj = resolve_name(hook)
            except ImportError:
                err = sys.exc_info()[1] # For py3k
                raise DistutilsModuleError('cannot find hook %s: %s' %
                                           (hook,err))
        else:
            hook_obj = hook

        if not hasattr(hook_obj, '__call__'):
            raise DistutilsOptionError('hook %r is not callable' % hook)

        log.info('running %s %s for command %s',
                 hook_kind, hook, cmd_obj.get_command_name())

        try :
            hook_obj(cmd_obj)
        except:
            e = sys.exc_info()[1]
            log.error('hook %s raised exception: %s\n' % (hook, e))
            log.error(traceback.format_exc())
            sys.exit(1)
lib2to3_ex.py 文件源码 项目:ascii-art-py 作者: blinglnav 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
ah_bootstrap.py 文件源码 项目:whoseline 作者: bmorris3 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def parse_config(cls):
        if not os.path.exists('setup.cfg'):
            return {}

        cfg = ConfigParser()

        try:
            cfg.read('setup.cfg')
        except Exception as e:
            if DEBUG:
                raise

            log.error(
                "Error reading setup.cfg: {0!r}\n{1} will not be "
                "automatically bootstrapped and package installation may fail."
                "\n{2}".format(e, PACKAGE_NAME, _err_help_msg))
            return {}

        if not cfg.has_section('ah_bootstrap'):
            return {}

        config = {}

        for option, type_ in CFG_OPTIONS:
            if not cfg.has_option('ah_bootstrap', option):
                continue

            if type_ is bool:
                value = cfg.getboolean('ah_bootstrap', option)
            else:
                value = cfg.get('ah_bootstrap', option)

            config[option] = value

        return config
ah_bootstrap.py 文件源码 项目:dust_extinction 作者: karllark 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def parse_config(cls):
        if not os.path.exists('setup.cfg'):
            return {}

        cfg = ConfigParser()

        try:
            cfg.read('setup.cfg')
        except Exception as e:
            if DEBUG:
                raise

            log.error(
                "Error reading setup.cfg: {0!r}\n{1} will not be "
                "automatically bootstrapped and package installation may fail."
                "\n{2}".format(e, PACKAGE_NAME, _err_help_msg))
            return {}

        if not cfg.has_section('ah_bootstrap'):
            return {}

        config = {}

        for option, type_ in CFG_OPTIONS:
            if not cfg.has_option('ah_bootstrap', option):
                continue

            if type_ is bool:
                value = cfg.getboolean('ah_bootstrap', option)
            else:
                value = cfg.get('ah_bootstrap', option)

            config[option] = value

        return config
lib2to3_ex.py 文件源码 项目:ivaochdoc 作者: ivaoch 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:aws-cfn-plex 作者: lordmuffin 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)
lib2to3_ex.py 文件源码 项目:RPoint 作者: george17-meet 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def log_error(self, msg, *args, **kw):
        log.error(msg, *args)


问题


面经


文章

微信
公众号

扫码关注公众号