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

Python util.report函数代码示例

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

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



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

示例1: exploit

def  exploit(request):
    if not request.url.params:
        return
    for param  in request.url.params:  # only  get
        for poc in SQL_POCS:
            injectable = False
            req_tmp = request.copy()
            req_tmp.__class__ = GetRequest
            req_tmp.setParam(param, req_tmp.getParam(param) + poc)
            for (dbms, regex) in ((dbms, regex) for dbms in SQLI_ERROR_SINGS for regex in SQLI_ERROR_SINGS[dbms]):
                if    re.search(regex, req_tmp.fetch(), re.I):
                    # print "%s" % req_tmp
                    util.report({"type":"sqli", "content":util.json_encode({"sqli_type":"%s Error Based" % dbms, "param":param, "detail":"%s" % req_tmp})})
                    return  
        for prefix, suffix in itertools.product(SQL_PREFIXES, SQL_SUFFIXES):
            poc1 = "%s AND 1=1 %s" % (prefix, suffix)
            poc2 = "%s AND 1=2 %s" % (prefix, suffix)
            req_tmp1 = request.copy()
            req_tmp1.__class__ = GetRequest
            req_tmp1.setParam(param, req_tmp1.getParam(param) + poc1)
            req_tmp2 = request.copy()
            req_tmp2.__class__ = GetRequest
            req_tmp2.setParam(param, req_tmp2.getParam(param) + poc2)
            if (len(req_tmp1.fetch()) != len(req_tmp2.fetch())):
            	util.report({"type":"sqli", "content":util.json_encode({"sqli_type":"UNION query", "param":param, "detail":"%s" % req_tmp})})
                # print "UNION SQLI:param %s %s"  % (param,req_tmp2)
                return
开发者ID:Cnlouds,项目名称:playweb,代码行数:27,代码来源:sqli.py


示例2: update_k2_version

def update_k2_version(svn_revision):
	"""
	将文件版本信息和产品版本信息写入k2_version.h,后续构建会将此信息编入pe文件版本信息内
	:param svn_revision:
	:return:
	"""
	def write_k2_version(k2_version_file, version_info):
		with open(k2_version_file, "w") as f:
			f.write(version_info)

	version_info = "#ifndef K2_VERSION_H_\n"
	version_info += "#define K2_VERSION_H_\n"

	file_version=get_file_version(svn_revision)
	str_file_version = file_version.replace(",", ".")
	str_product_version = util.get_new_version()
	util.report("New Version Is:%s" % str_product_version)
	product_version = str_product_version.replace(".", ",")

	version_info += '#define FILE_VERSION  {file_version}\n'.format(file_version=file_version)
	version_info += '#define STR_FILE_VERSION  "{str_file_version}"\n'.format(str_file_version=str_file_version)
	version_info += '#define PRODUCT_VERSION  {product_version}\n'.format(product_version=product_version)
	version_info += '#define STR_PRODUCT_VERSION  "{str_product_version}"\n'.format(str_product_version=str_product_version)

	version_info += '#define COMPANY_NAME  "{company_name}"\n'.format(company_name="S2 Games")
	version_info += '#define LEGAL_COPY_RIGTE  "{legal_copy_write}"\n'.format(
		legal_copy_write="Copyright (C) 2013 S2 Games")
	version_info += '#define PRODUCT_NAME  "{product_name}"\n'.format(product_name="Strife")
	version_info += "#endif  //! #ifndef K2_VERSION_H_\n"

	k2_version_file = os.path.join(config.SRC_DIR, "k2", "k2_version.h")
	write_k2_version(k2_version_file, version_info)
开发者ID:510908220,项目名称:build-related-scripts,代码行数:32,代码来源:genversion.py


示例3: giving_up

def giving_up(removed_releases,fileid):
	if not removed_releases:
		util.report("No possible releases left")
		return
	util.report("Possible releases:")
	for releaseid in removed_releases:
		# If this release only has one track that we found,
		# and we have other possible releases, ignore this one.
		#
		# TODO: Actually, we should just display the top 2
		#  releases, by number of tracks found on it.
		if len(removed_releases[releaseid])<2 \
			and len(removed_releases)>1:
				continue
		release = lookups.get_release_by_releaseid(releaseid)
		util.report("%s - %s (%s.html)" % (
			release.artist.name,
			release.title,
			releaseid))
		for trackind in range(len(release.tracks)):
			if (trackind+1) in removed_releases[releaseid]:
				continue
			util.report(" #%02d %s.html %s" % (
				trackind+1,
				release.tracks[trackind].id,
				release.tracks[trackind].title))
		util.report(" %s" % (
			util.output_list(removed_releases[releaseid].keys())
			))
开发者ID:craigbox,项目名称:albumidentify,代码行数:29,代码来源:albumidentify.py


示例4: run

def run():
  # Setup the gantry arguments
  parser = argparse.ArgumentParser(description='gantry continuous deployment system')
  parser.add_argument('config_file', help = 'The configuration file')
  parser.add_argument('action', help = 'The action to perform', choices = ACTIONS.keys())
  parser.add_argument('component_name', help = 'The name of the component to manage')
  parser.add_argument('-m', dest='monitor', action='store_true', help = 'If specified and the action is "start" or "update", gantry will remain running to monitor components, auto restarting them as necessary')
  
  args = parser.parse_args()
  component_name = args.component_name
  action = args.action
  should_monitor = args.monitor
  config_file = args.config_file
  
  # Load the config.
  config = loadConfig(config_file)
  if not config:
    return
  
  # Create the manager.
  manager = RuntimeManager(config)
  
  # Find the component
  component = manager.getComponent(component_name)
  if not component:
    raise Exception('Unknown component: ' + component_name)

  # Run the action with the component and config.
  result = ACTIONS[action](component)
  if result and should_monitor:
    report('Starting monitoring of component: ' + component_name)
    monitor(component)
开发者ID:philipz,项目名称:gantryd,代码行数:32,代码来源:gantry.py


示例5: update

  def update(self):
    """ Updates a running instance of the component. Returns True on success and False
        otherwise.
    """
    self.logger.debug('Updating component %s', self.getName())
    client = getDockerClient()

    # Get the list of currently running container(s).
    existing_containers = self.getAllContainers(client)
    existing_primary = self.getPrimaryContainer()

    # Start the new instance.
    container = self.start()
    if not container:
      return False

    # Mark all the existing containers as draining.
    for existing in existing_containers:
      setContainerStatus(existing, 'draining')

    # Update the port proxy to redirect the external ports to the new
    # container.
    report('Redirecting traffic to new container', component=self)
    self.manager.adjustForUpdatingComponent(self, container)

    # Signal the existing primary container to terminate
    if existing_primary is not None:
      self.manager.terminateContainer(existing_primary, self)

    return True
开发者ID:zendesk,项目名称:gantryd,代码行数:30,代码来源:component.py


示例6: set_environment

    def set_environment(self, env=None, vs_tools=None, arch=None):
        self.report_build_step('set-environment')
        try:
            new_env = {
                'TERM': 'dumb',
            }
            if os.name == 'nt':
                if vs_tools is None:
                    vs_tools = os.path.expandvars('%VS140COMNTOOLS%')
                if arch is None:
                    arch = os.environ['PROCESSOR_ARCHITECTURE'].lower()
                else:
                    arch = arch.lower()
                vcvars_path = pjoin(
                    vs_tools, '..', '..', 'VC', 'vcvarsall.bat')
                cmd = util.shquote_cmd([vcvars_path, arch]) + ' && set'
                output = subprocess.check_output(cmd, shell=True)
                for line in output.splitlines():
                    var, val = line.split('=', 1)
                    new_env[var] = val

            if env is not None:
                new_env.epdate(env)

            for (var, val) in new_env.items():
                os.environ[var] = val

            for var in sorted(os.environ.keys()):
                util.report('%s=%s' % (var, os.environ[var]))
        except:
            self.report_step_exception()
            raise
开发者ID:efcs,项目名称:zorg,代码行数:32,代码来源:annotated_builder.py


示例7: run_many

def run_many(tests):
    global NWORKERS, pool
    start = time.time()
    total = 0
    failed = {}

    tests = list(tests)
    NWORKERS = min(len(tests), NWORKERS)
    pool = Pool(NWORKERS)
    util.BUFFER_OUTPUT = NWORKERS > 1

    def run_one(name, cmd, **kwargs):
        result = util.run(cmd, **kwargs)
        if result:
            # the tests containing AssertionError might have failed because
            # we spawned more workers than CPUs
            # we therefore will retry them sequentially
            failed[name] = [cmd, kwargs, 'AssertionError' in (result.output or '')]

    if NWORKERS > 1:
        gevent.spawn(info)

    try:
        try:
            for name, cmd, options in tests:
                total += 1
                spawn(run_one, name, cmd, **options).name = ' '.join(cmd)
            gevent.run()
        except KeyboardInterrupt:
            try:
                if pool:
                    util.log('Waiting for currently running to finish...')
                    pool.join()
            except KeyboardInterrupt:
                util.report(total, failed, exit=False, took=time.time() - start)
                util.log('(partial results)\n')
                raise
    except:
        pool.kill()  # this needed to kill the processes
        raise

    toretry = [key for (key, (cmd, kwargs, can_retry)) in failed.items() if can_retry]
    failed_then_succeeded = []

    if NWORKERS > 1 and toretry:
        util.log('\nWill re-try %s failed tests without concurrency:\n- %s\n', len(toretry), '\n- '.join(toretry))
        for name, (cmd, kwargs, _ignore) in failed.items():
            if not util.run(cmd, buffer_output=False, **kwargs):
                failed.pop(name)
                failed_then_succeeded.append(name)

    util.report(total, failed, took=time.time() - start)

    if failed_then_succeeded:
        util.log('\n%s tests failed during concurrent run but succeeded when ran sequentially:', len(failed_then_succeeded))
        util.log('- ' + '\n- '.join(failed_then_succeeded))
    assert not pool, pool

    os.system('rm -f */@test*_tmp')
开发者ID:NorthIsUp,项目名称:gevent,代码行数:59,代码来源:testrunner.py


示例8: sign_setup

def sign_setup():
	util.report("Begin Signature Setup.....")
	setup_name = "Strife-{version}-setup.exe".format(version=util.get_new_version())
	unsign_names = [setup_name]
	sign_remote_dir = util.get_new_version() + '_setup_final'
	sign_src_dir = config.PACKAGE_OUT
	waitsign.Sign(sign_src_dir, sign_remote_dir, unsign_names)
	util.report("End Signature Setup.....")
开发者ID:510908220,项目名称:build-related-scripts,代码行数:8,代码来源:sign.py


示例9: update_on_image

def update_on_image(component):
  running_image = component.getPrimaryContainerImageId()
  latest_image = component.getImageId()

  if running_image != latest_image:
    report('Newer Image found for component ' + component.getName())
    return ACTIONS['update'](component)
  return True
开发者ID:jmccarty3,项目名称:gantryd,代码行数:8,代码来源:gantry.py


示例10: setMatsubara

 def setMatsubara(self):
     assert self.partitionFunction != None and self.lehmannNominators != None and self.lehmannDenominators != None, 'Partition Function and Lehmann terms have to be set in advance.'
     report('Calculating one-particle Green\'s function(Matsubara)...', self.verbose)
     t0 = time()
     if self.species == 'fermionic':
         self.matsubaraData.update(lehmannSumDynamic(self.lehmannNominators, self.lehmannDenominators, self.partitionFunction, self.matsubaraMesh, self.zeroFrequencyTerms, 0, [+1, +1]))
     if self.species == 'bosonic':
         self.matsubaraData.update(lehmannSumDynamic(self.lehmannNominators, self.lehmannDenominators, self.partitionFunction, self.matsubaraMesh, self.zeroFrequencyTerms, 0, [+1, -1]))
     report('took '+str(time()-t0)[:4]+' seconds', self.verbose)
开发者ID:MHarland,项目名称:EasyED,代码行数:9,代码来源:observables.py


示例11: setRetarded

 def setRetarded(self, imaginaryOffset):
     assert self.partitionFunction != None and self.lehmannNominators != None and self.lehmannDenominators != None, 'Partition Function and Lehmann terms have to be set in advance.'
     report('Calculating one-particle Green\'s function(retarded)...', self.verbose)
     t0 = time()
     if self.species == 'fermionic':
         self.retardedData.update(lehmannSumDynamic(self.lehmannNominators, self.lehmannDenominators, self.partitionFunction, self.mesh, self.zeroFrequencyTerms, imaginaryOffset, [+1, +1]))
     elif self.species == 'bosonic':
         self.retardedData.update(lehmannSumDynamic(self.lehmannNominators, self.lehmannDenominators, self.partitionFunction, self.mesh, self.zeroFrequencyTerms, imaginaryOffset, [+1, -1]))
     report('took '+str(time()-t0)[:4]+' seconds', self.verbose)
开发者ID:MHarland,项目名称:EasyED,代码行数:9,代码来源:observables.py


示例12: make_installer

def make_installer(version):
    set_nis_info(config.NSI_SCRIPT, version)
    cmd = '{nsi_tool} /X"SetCompressor  /FINAL lzma" {nsi_script}'.format(
        nsi_tool=config.NSI_TOOL, nsi_script=config.NSI_SCRIPT
    )

    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    while p.poll() == None:
        util.report(p.stdout.readline())
开发者ID:510908220,项目名称:build-related-scripts,代码行数:9,代码来源:installer.py


示例13: run_many

def run_many(tests, expected=None, failfast=False):
    global NWORKERS, pool
    start = time()
    total = 0
    failed = {}

    NWORKERS = min(len(tests), NWORKERS)
    pool = Pool(NWORKERS)
    util.BUFFER_OUTPUT = NWORKERS > 1

    def run_one(cmd, **kwargs):
        result = util.run(cmd, **kwargs)
        if result:
            if failfast:
                sys.exit(1)
            # the tests containing AssertionError might have failed because
            # we spawned more workers than CPUs
            # we therefore will retry them sequentially
            failed[result.name] = [cmd, kwargs, 'AssertionError' in (result.output or '')]

    try:
        try:
            for cmd, options in tests:
                total += 1
                spawn(run_one, cmd, **(options or {}))
            gevent.wait()
        except KeyboardInterrupt:
            try:
                if pool:
                    util.log('Waiting for currently running to finish...')
                    pool.join()
            except KeyboardInterrupt:
                util.report(total, failed, exit=False, took=time() - start, expected=expected)
                util.log('(partial results)\n')
                raise
    except:
        traceback.print_exc()
        pool.kill()  # this needed to kill the processes
        raise

    toretry = [key for (key, (cmd, kwargs, can_retry)) in failed.items() if can_retry]
    failed_then_succeeded = []

    if NWORKERS > 1 and toretry:
        util.log('\nWill retry %s failed tests without concurrency:\n- %s\n', len(toretry), '\n- '.join(toretry))
        for name, (cmd, kwargs, _ignore) in failed.items():
            if not util.run(cmd, buffer_output=False, **kwargs):
                failed.pop(name)
                failed_then_succeeded.append(name)

    if failed_then_succeeded:
        util.log('\n%s tests failed during concurrent run but succeeded when ran sequentially:', len(failed_then_succeeded))
        util.log('- ' + '\n- '.join(failed_then_succeeded))

    util.log('gevent version %s from %s', gevent.__version__, gevent.__file__)
    util.report(total, failed, took=time() - start, expected=expected)
    assert not pool, pool
开发者ID:mahmoudimus,项目名称:gevent,代码行数:57,代码来源:testrunner.py


示例14: fillingFunction

 def fillingFunction(muTrial):
     self.hamiltonian.matrix = self.hamiltonian.matrix - muTrial * nMatrix
     self.calcEigensystem()
     self.calcPartitionFunction()
     self.calcOccupation()
     fillingTrial = self.getTotalOccupation()
     self.hamiltonian.matrix = self.hamiltonian.matrix + muTrial * nMatrix
     report('Filling(mu='+str(muTrial)+') = '+str(fillingTrial), self.verbose)
     self.filling = fillingTrial
     return fillingTrial - filling
开发者ID:MHarland,项目名称:EasyED,代码行数:10,代码来源:ensembles.py


示例15: killComponents

  def killComponents(self, componentNames):
    """ Tells all the given components on all systems to die. """
    self.initialize(componentNames)

    report('Marking components as killed', project = self.project_name)
    for component in self.components:
      report('Marking component as killed', project = self.project_name, component = component,
        level = ReportLevels.EXTRA)
      state = ComponentState(self.project_name, component, self.etcd_client)
      state.setStatus(KILLED_STATUS)
开发者ID:philipz,项目名称:gantryd,代码行数:10,代码来源:client.py


示例16: commit_resource

def commit_resource():
	old_dir = os.getcwd()
	resource_dir = os.path.abspath(os.path.join(config.ROOT_DIR, "StrifeServer"))
	os.chdir(resource_dir)
	print os.getcwd()
	cmd = '''svn commit -m "server resource"'''
	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
	while p.poll() == None:
		util.report(p.stdout.readline())
	os.chdir(old_dir)
开发者ID:510908220,项目名称:build-related-scripts,代码行数:10,代码来源:server_package.py


示例17: handleKilled

  def handleKilled(self, was_initial_check):
    """ Handles when the component has been marked to be killed. """
    self.monitor_event.clear()

    if was_initial_check:
      report('Component %s is marked as killed' % self.component.getName(),
             project=self.project_name, component=self.component)

    self.is_running = False
    self.component.stop(kill=True)
    return CHECK_SLEEP_TIME
开发者ID:JiangKevin,项目名称:gantryd,代码行数:11,代码来源:componentwatcher.py


示例18: setMu

 def setMu(self, mu):
     c = AnnihilationOperator(self.singleParticleBasis)
     nMatrix = nsum([c[orb].H.dot(c[orb]) for orb in self.orderedSingleParticleStates], axis = 0)
     self.hamiltonian.matrix = self.hamiltonian.matrix + self.mu * nMatrix
     self.mu = mu
     self.hamiltonian.matrix = self.hamiltonian.matrix - mu * nMatrix
     self.energyEigenvalues = None
     self.energyEigenstates = None
     self.partitionFunction = None
     self.occupation = dict()
     report('Chemical potential set to '+str(mu), self.verbose)
开发者ID:MHarland,项目名称:EasyED,代码行数:11,代码来源:ensembles.py


示例19: run

def run():
  #setup logging
  logging.basicConfig(level=logging.DEBUG)
  
  # Setup the gantry arguments
  parser = argparse.ArgumentParser(description='gantry continuous deployment system')
  parser.add_argument('config_file', help='The configuration file')
  parser.add_argument('action', help='The action to perform', choices=ACTIONS.keys())
  parser.add_argument('component_name', help='The name of the component to manage')
  parser.add_argument('-m', dest='monitor', action='store_true', help='If specified and the action is "start" or "update", gantry will remain running to monitor components, auto restarting them as necessary')
  parser.add_argument('--setconfig', dest='config_overrides', action='append', help='Configuration overrides for the component')

  args = parser.parse_args()
  component_name = args.component_name
  action = args.action
  should_monitor = args.monitor
  config_file = args.config_file
  config_overrides = args.config_overrides

  # Load the config.
  config = loadConfig(config_file)
  if not config:
    return

  # Create the manager.
  manager = RuntimeManager(config)

  # Find the component
  component = manager.getComponent(component_name)
  if not component:
    raise Exception('Unknown component: ' + component_name)
    
  # Apply the config overrides (if any).
  if config_overrides:
    component.applyConfigOverrides(config_overrides)

  # Run the action with the component and config.
  result = ACTIONS[action](component)
  if result and should_monitor:
    try:
      report('Starting monitoring of component: ' + component_name)
      monitor(component)
    except KeyboardInterrupt:
      report('Terminating monitoring of component: ' + component_name)

  def cleanup_monitor(signum, frame):
    manager.join()

  # Set the signal handler and a 5-second alarm
  signal.signal(signal.SIGINT, cleanup_monitor)

  # We may have to call cleanup manually if we weren't asked to monitor
  cleanup_monitor(None, None)
开发者ID:binhtnguyen,项目名称:gantryd,代码行数:53,代码来源:gantry.py


示例20: markUpdated

  def markUpdated(self, componentNames):
    """ Tells all the given components to update themselves. """
    self.initialize(componentNames)

    report('Updating the image IDs on components', project = self.project_name)
    for component in self.components:
      image_id = component.getImageId()
      state = ComponentState(self.project_name, component, self.etcd_client)

      report('Component ' + component.getName() + ' -> ' + image_id[0:12], project = self.project_name,
        component = component)
      state.setReadyStatus(image_id)      
开发者ID:philipz,项目名称:gantryd,代码行数:12,代码来源:client.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.report_error函数代码示例发布时间:2022-05-26
下一篇:
Python util.render_template函数代码示例发布时间: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