当前位置: 首页>>代码示例>>Python>>正文


Python log.info函数代码示例

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


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

示例1: check_returncode

def check_returncode(self,recv,args):
    print 'verify code value,expect:%s,actual:%s'%(int(args.get('ExpectResult')),int(recv[1].get('CODE')))
    log.info('验证code的值,期望值:%s,实际值:%s'%(int(args.get('ExpectResult')),int(recv[1].get('CODE'))))
    print 'The Interface return is: '
    print recv
    print "The data I want to see is: %s" %(recv[1].get('sporderid'))
    self.assertEqual(int(args.get('ExpectResult')),int(recv[1].get('CODE')))
开发者ID:hqzxsc,项目名称:interface_xls,代码行数:7,代码来源:ice_case.py

示例2: get_http_ftp

def get_http_ftp(what,url,target,overwrite):
    from urllib2 import Request, urlopen, URLError, HTTPError, ProxyHandler, build_opener, install_opener
    import shutil

    if os.path.exists(target):
        if overwrite:
            log.info('Removing pre-existing file %s'%target)
            shutil.rmtree(target)
        else:
            log.info('Pre-existing file found, not re-getting %s'%target)
            return target

    proxy = os.getenv(what+'_proxy')
    if proxy : 
        proxy_support = ProxyHandler({what:proxy})
        opener = build_opener(proxy_support)
        install_opener(opener)

    #print 'openning',url

    try:
        res = urlopen(url)
    except HTTPError, e:
        print e.__class__, e 
        raise IOError,'Failed to get '+url
开发者ID:brettviren,项目名称:garpi,代码行数:25,代码来源:get.py

示例3: _searchTrailerAddict

 def _searchTrailerAddict(self, searchTitle, searchYear):
     """ Search TrailerAddict for a Trailer URL """
     # Search TrailerAddict for the Movie
     log.info("  Searching TrailerAddict for: '%s' (yr: %s)" % (searchTitle, searchYear))
     searchResults = traileraddict.search(searchTitle)
     if (not searchResults):
         log.fine("  TrailerAddict has no search results for: '%s' (yr: %s)" % (searchTitle, searchYear))
         return None
     # Select the correct TrailerAddict Movie
     firstTitle = searchResults[0]['title']
     firstYear = searchResults[0]['year']
     if (firstTitle.lower() == searchTitle.lower()) and (int(firstYear) == searchYear):
         log.fine("  First result is exact match: %s (%s)" % (searchTitle, searchYear))
         searchSelection = searchResults[0]
     else:
         log.fine("  No exact TrailerAddict match found, prompting user")
         choiceStr = lambda r: "%s (%s) - %s" % (r['title'], r['year'], r['url'])
         searchSelection = util.promptUser(searchResults, choiceStr)
     if (not searchSelection):
         log.fine("  TrailerAddict has no entry for: '%s' (yr: %s)" % (searchTitle, searchYear))
         return None
     # Search for the correct Video (Traileraddict has many per movie)
     trailerUrls = traileraddict.getTrailerUrls(searchSelection['url'])
     trailerUrl = traileraddict.getMainTrailer(trailerUrls)
     if (not trailerUrl):
         log.info("  Main trailer not found, prompting user")
         choiceStr = lambda t: t
         trailerUrl = util.promptUser(trailerUrls, choiceStr)
     return trailerUrl
开发者ID:kochbeck,项目名称:videocleaner,代码行数:29,代码来源:movie.py

示例4: _getImdbUrlFromSearch

 def _getImdbUrlFromSearch(self, foreign=False):
     """ Search IMDB for the specified title. """
     # Search IMDB for potential matches
     title = self.curTitle
     year = self.curYear or "NA"
     log.info("  Searching IMDB for: '%s' (yr: %s)" % (title, year))
     results = imdbpy.search_movie(title, IMDB_MAX_RESULTS)
     # Check first 5 Results Title and year matches exactly
     selection = None
     for result in results[0:5]:
         if (self._weakMatch(result['title'], title)) and (int(result['year']) == year):
             log.fine("  Result match: %s (%s)" % (result['title'], result['year']))
             selection = result
             break
     # Ask User to Select Correct Result
     if (not selection):
         log.fine("  No exact IMDB match found, prompting user")
         if (not foreign): choiceStr = lambda r: "%s (%s) - %s" % (r['title'], r['year'], self.getUrl(r.movieID))
         else: choiceStr = lambda r: "%s (%s-%s): %s" % (r['title'], self._getCountry(r), r['year'], self._getAka(r))
         selection = util.promptUser(results, choiceStr)
     # If still no selection, return none
     if (not selection):
         log.fine("  IMDB has no entry for: %s (%s)" % (title, year))
         return None
     return self.getUrl(selection.movieID)
开发者ID:kochbeck,项目名称:videocleaner,代码行数:25,代码来源:movie.py

示例5: run

def run (args):
    if len(args) < 2:
        print 'MM:00 EXEC: ERROR usage: exec cmd cmd ...'
        print 'Commands are:'
        for c in sorted(commands):
            print '  ' + c + ': ' + commands[c].get('cmd', '<CMD>')
        return
    
    for i in range(1, len(args)):
        cmdname = args[i]
        try:
            c = commands[cmdname]['cmd']
        except:
            log.error('MM:00 ERROR: EXEC FAILED unknown or poorly specified cmd: ' + cmdname)
            continue
        log.info('MM:00 EXEC: ' + cmdname + ' cmd = ' + c)
        ca = c.split()
        try:
            p = subprocess.Popen(ca, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = p.communicate()
        except Exception, e:
            out = ''
            err = 'Command Failed: ' + repr(e)
        r = out + err
        log.debug('MM:00 EXEC: ' + cmdname + ' output = \n' + r.strip())
开发者ID:frankzhao,项目名称:iSDX,代码行数:25,代码来源:tmgr.py

示例6: apple_privacy

def apple_privacy():
    session.permanent = True # TODO
    log.info("apple_privacy is called")
    content = 'ok'
    resp = make_response(content, 200)
    resp.headers['Content-type'] = 'application/json; charset=utf-8'
    return resp
开发者ID:DennyZhang,项目名称:xiaozibao,代码行数:7,代码来源:server.py

示例7: _renameSubtitles

 def _renameSubtitles(self):
     """ Rename the Subtitle files. """
     includeCount = len(self.curFileNames) >= 2
     if (self.subtitles):
         for i in range(len(self.subtitles)):
             subPath = self.subtitles[i]
             newFilePrefix = self.newFileNames[i][0:-4]
             # Make sure the subtitle directory exists
             newSubDirPath = "%s/subtitles" % (self.dirPath)
             if (not os.path.exists(newSubDirPath)):
                 log.info("  >> Creating Dir: %s" % newSubDirPath)
                 os.mkdir(newSubDirPath, 0755)
             # Rename SRT Files
             if (subPath.lower().endswith('.srt')):
                 curSrtPath = "%s/%s" % (self.dirPath, subPath)
                 newSrtPath = "%s/%s.srt" % (newSubDirPath, newFilePrefix)
                 self._rename(curSrtPath, newSrtPath)
             # Rename IDX, SUB Files
             elif (subPath.lower().endswith('.idx')):
                 curIdxPath = "%s/%s" % (self.dirPath, subPath)
                 curSubPath = "%s.sub" % (curIdxPath[0:-4])
                 newIdxPath = "%s/%s.idx" % (newSubDirPath, newFilePrefix)
                 newSubPath = "%s/%s.sub" % (newSubDirPath, newFilePrefix)
                 self._rename(curIdxPath, newIdxPath)
                 self._rename(curSubPath, newSubPath)
开发者ID:kochbeck,项目名称:videocleaner,代码行数:25,代码来源:video.py

示例8: delay

def delay (args):
    if len(args) == 1:
        try:
            log.info('MM:00 DELAY ' + args[0])
            time.sleep(float(args[0]))
        except Exception, e:
            log.error('MM:00 ERROR: DELAY: exception: ' + repr(e))
开发者ID:h2020-endeavour,项目名称:iSDX,代码行数:7,代码来源:tmgr.py

示例9: list_topic

def list_topic(topic, start_num, count, voteup, votedown, sort_method):
    global db
    conn = db.connect()

    sql_clause = "select postid, category, title, filename from posts "

    where_clause = "where category ='%s'" % (topic)
    extra_where_clause = ""
    if voteup != -1:
        extra_where_clause = "%s and voteup = %d" % (extra_where_clause, voteup)
    if votedown != -1:
        extra_where_clause = "%s and votedown = %d" % (extra_where_clause, votedown)
    where_clause = "%s%s" % (where_clause, extra_where_clause)

    orderby_clause = " "
    if sort_method == config.SORT_METHOD_LATEST:
        orderby_clause = "order by voteup asc, votedown asc"

    if sort_method == config.SORT_METHOD_HOTEST:
        orderby_clause = "order by voteup desc, votedown desc"

    sql = "%s %s %s limit %d offset %d;" % (sql_clause, where_clause, orderby_clause, count, start_num)
    log.info(sql)
    cursor = conn.execute(sql)
    out = cursor.fetchall()
    conn.close()
    user_posts = POST.lists_to_posts(out)
    return user_posts
开发者ID:DennyZhang,项目名称:xiaozibao,代码行数:28,代码来源:data.py

示例10: download

    def download(self):
        '''Download missing or update pre-existing project files.  As
        a side effect the program will be in the projects directory
        that contains the downloaded project'''
        log.info(self.name +' download')
        import fs, ConfigParser
        projdir = fs.projects()
        fs.goto(projdir, True)
        from get import get

        try:
            tag = self.tag()
        except ConfigParser.NoOptionError:
            tag = None

        #print 'url="%s" name="%s" tag="%s"'%(self.url(), self.name, tag)
        get(self.url(), self.name, True, tag=tag)
        tarfile = os.path.basename(self.url())
        if '.tgz' in tarfile or '.tar' in tarfile:
            untar(tarfile)
            dot = tarfile.find('.')
            dirname = tarfile[:dot]
            import shutil
            shutil.move(dirname, self.name)
            pass        

        fs.goback
        return
开发者ID:brettviren,项目名称:garpi,代码行数:28,代码来源:projects.py

示例11: _filter_methods

 def _filter_methods(self, cls, methods):
     log.info('All Tests for {} {}'.format(cls, methods))
     if not self.name_filter:
         return methods
     filtered = [method for method in methods if self.name_filter.lower() in method.lower()]
     log.info('Filtered Tests for {}'.format(cls, filtered))
     return filtered
开发者ID:facebook,项目名称:FBSimulatorControl,代码行数:7,代码来源:tests.py

示例12: _download_git_submodules

    def _download_git_submodules(self):
        'If gaudi is served from a git repo with a submodule per pacakge'
        url = self.url()
        if url[4] == '+': url = url[4:]
        log.info(self.name +' download')

        # Get super project
        self._git_clone(url,True)

        # Get release package
        self._git_checkout(self.tag(),self.rel_pkg())
        
        self.init_project(['lcgcmt'])

        # Get versions
        import cmt
        pkg_dir = os.path.join(self.proj_dir()+'/'+self.rel_pkg())
        uses = cmt.get_uses(pkg_dir,self.env(pkg_dir))
        for use in uses:
            #print 'use:',use.name,use.project,use.directory,use.version
            if use.project == 'gaudi' and use.directory == '':
                if '*' in use.version:
                    log.info('Skipping %s %s'%(use.name,use.version))
                    continue
                self._git_checkout(use.version,use.name)
                pass
            continue
        return
开发者ID:brettviren,项目名称:garpi,代码行数:28,代码来源:gaudi.py

示例13: write_excel

def write_excel(joblist, filename):
    """
    write Excel with Workbook
    :param joblist:
    :param filename:
    :return:
    """
    mkdirs_if_not_exists(EXCEL_DIR)
    wb = Workbook()
    ws = wb.active
    ws.title = u"职位信息"
    ws.cell(row=1, column=1).value = u'职位编码'
    ws.cell(row=1, column=2).value = u'职位名称'
    ws.cell(row=1, column=3).value = u'所在城市'
    ws.cell(row=1, column=4).value = u'发布日期'
    ws.cell(row=1, column=5).value = u'薪资待遇'
    ws.cell(row=1, column=6).value = u'公司编码'
    ws.cell(row=1, column=7).value = u'公司名称'
    ws.cell(row=1, column=8).value = u'公司全称'

    rownum = 2
    for each_job in joblist:
        ws.cell(row=rownum, column=1).value = each_job.positionId
        ws.cell(row=rownum, column=2).value = each_job.positionName
        ws.cell(row=rownum, column=3).value = each_job.city
        ws.cell(row=rownum, column=4).value = each_job.createTime
        ws.cell(row=rownum, column=5).value = each_job.salary
        ws.cell(row=rownum, column=6).value = each_job.companyId
        ws.cell(row=rownum, column=7).value = each_job.companyName
        ws.cell(row=rownum, column=8).value = each_job.companyFullName
        rownum += 1
    wb.save(EXCEL_DIR + filename + '.xlsx')
    logging.info('Excel生成成功!')
开发者ID:EclipseXuLu,项目名称:LagouJob,代码行数:33,代码来源:excel_helper.py

示例14: check_return

def check_return(self,r_status,r_data,args):
    if r_status==200:
        if args['ExpectResult']:
            try:
                eresult=json.loads(args['ExpectResult'])
            except Exception, e:
                print e
                print u'请检查excel的ExpectResult列数据格式是不是dict'
            if type(eresult)==dict:
                for key,value in eresult.items():
                    if r_data.has_key(key):
                        if type(eresult[key])==dict:
                            for key1,value1 in eresult[key].items():
                                if r_data[key].has_key(key1):
                                    print u'  验证%s的值,期望值:%s,实际值:%s'%(key1,value1,r_data[key][key1])
                                    log.info(u'  验证%s的值,期望值:%s,实际值:%s'%(key1,value1,r_data[key][key1]))
                                    self.assertEqual(value1,r_data[key][key1])
                                else:
                                    print '返回的接口数据无此%s'%key1
                        else:
                            print u'验证%s的值,期望值:%s,实际值:%s'%(key,value,r_data[key])
                            log.info(u'验证%s的值,期望值:%s,实际值:%s'%(key,value,r_data[key]))
                            self.assertEqual(value,r_data[key])
                    else:
                        print '返回的接口数据无此%s'%key
        else:
            print u'请检查excel的ExpectResult列是否准备了待验证的数据'
开发者ID:hqzxsc,项目名称:interface_xls,代码行数:27,代码来源:ews_case.py

示例15: testRecordsVideo

 def testRecordsVideo(self):
     if self.metal.is_supported() is False:
         log.info('Metal not supported, skipping testRecordsVideo')
         return
     (simulator, _) = self.testLaunchesSystemApplication()
     arguments = [
         simulator.get_udid(), 'record', 'start',
         '--', 'listen',
         '--', 'record', 'stop',
         '--', 'shutdown',
     ]
     # Launch the process, terminate and confirm teardown is successful
     with self.fbsimctl.launch(arguments) as process:
         process.wait_for_event('listen', 'started')
         process.terminate()
         process.wait_for_event('listen', 'ended')
         process.wait_for_event('shutdown', 'ended')
     # Get the diagnostics
     diagnose_events = self.assertExtractAndKeyDiagnostics(
         self.assertEventsFromRun(
             [simulator.get_udid(), 'diagnose'],
             'diagnostic',
             'discrete',
         ),
     )
     # Confirm the video exists
     video_path = diagnose_events['video']['location']
     self.assertTrue(
         os.path.exists(video_path),
         'Video at path {} should exist'.format(video_path),
     )
开发者ID:robbertvanginkel,项目名称:FBSimulatorControl,代码行数:31,代码来源:tests.py


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