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


Python LOGGER.info方法代码示例

本文整理汇总了Python中config.LOGGER.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.info方法的具体用法?Python LOGGER.info怎么用?Python LOGGER.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config.LOGGER的用法示例。


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

示例1: get_itunes_track_data

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
    def get_itunes_track_data(self, track_path, itunes_keys):
        # TODO: iTunes uses HTML encoding for some things (ampersands) and URL encoding for the rest
        with open('/Users/carmstrong/Music/iTunes/iTunes Music Library.xml', 'rb') as itunes_xml:
            tree = etree.parse(itunes_xml)

        itunes_track_path = 'file://' + urllib.quote(track_path.encode('utf-8'), safe="/(),'")
        location_node = tree.xpath('//string[text()="{}"]'.format(itunes_track_path))

        if not location_node:
            LOGGER.info('{} not found in iTunes XML file.'.format(itunes_track_path))
            return

        results = {}
        for itunes_key in itunes_keys:
            try:
                itunes_value = location_node[0].xpath("../key[text()='{}']".format(itunes_key))[0].getnext().text
                try:
                    itunes_value = int(itunes_value)
                except (ValueError, TypeError):
                    continue
                results.update({itunes_key: itunes_value})

            except IndexError:
                continue

        return results
开发者ID:chrismv48,项目名称:music-master,代码行数:28,代码来源:library.py

示例2: handleTraceback

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def handleTraceback(object):
    context = object.context
    entry_url = object.entry_url

    if entry_url is None:
        return

    LOGGER.info("handle traceback [%s]" % entry_url)
    try:
        cleanup_lock.acquire()
        # we don't want to produce any errors here, thus, we'll be nice and die
        # silently if an error occurs here
        try:
            transaction.begin()
            # get our logbook view to use the api
            logbook = context.unrestrictedTraverse('@@logbook')
            # get the generated error url from Products.SiteErrorLog
            err_id = urllib.splitvalue(entry_url)[1]
            # save error
            logbook.save_error(err_id, context=aq_parent(context))
            transaction.get().note('collective.logbook traceback [%s]' %
                    entry_url)
            transaction.commit()
        finally:
            cleanup_lock.release()
    # only warning
    except Exception, e:
        LOGGER.warning("An error occured while handling the traceback")
        LOGGER.warning("%s" % e)
        LOGGER.exception(e)
开发者ID:miohtama,项目名称:collective.logbook-1,代码行数:32,代码来源:events.py

示例3: feature_decomposition

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def feature_decomposition(transformer, train_features, test_features):
    LOGGER.info("Beginning Dimensionality reduction using truncated SVD (%d features)" % transformer.n_components)
    train_dfeatures = transformer.fit_transform(train_features)
    #LOGGER.debug(["%6f " % transformer.explained_variance_ratio_[i] for i in range(5)])
    LOGGER.debug("%0.4f%% of total variance in %d features\n" % (
        100 * transformer.explained_variance_ratio_.sum(), transformer.n_components))
    return train_dfeatures, transformer.transform(test_features)
开发者ID:seanjh,项目名称:NaiveBayes-MAHW3,代码行数:9,代码来源:problem5.py

示例4: main

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def main():
    # get zip codes
    zip_codes = [row.zip_code for row in session.query(ZipCode).all()]

    # # add leading 0's to zip codes due to excel's stupidness
    # zip_codes_df['zip_code'] = zip_codes_df['zip_code'].astype(str)
    # zip_codes_df['zip_code'] = zip_codes_df['zip_code'].apply(lambda x: '0' * (5 - len(x)) + x)

    current_month = datetime.date.today().month
    current_rows = session.query(Indeed).filter(extract('month', Indeed.date_created) == current_month).all()
    current_rows = [row.as_dict() for row in current_rows]
    existing_zip_codes = [row['zip_code'] for row in current_rows]
    remaining_zip_codes = [zip_code for zip_code in zip_codes if zip_code not in existing_zip_codes]

    LOGGER.info('Found {} rows for current month: {}. Extracting {} remaining zip codes'.format(len(current_rows),
                                                                                                current_month,
                                                                                                len(
                                                                                                    remaining_zip_codes)))

    for i, zip_code in enumerate(remaining_zip_codes):
        job_count = get_num_job_postings(zip_code)
        row = Indeed(zip_code=zip_code, job_count=job_count, date_created=datetime.date.today())
        session.merge(row)
        session.commit()

        LOGGER.info("Extracting zip code {} ({} of {})".format(zip_code, i, len(remaining_zip_codes)))
    session.close()
开发者ID:chrismv48,项目名称:ugly-duckling,代码行数:29,代码来源:indeed_extract.py

示例5: handle

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def handle(fd, address):
    global data_queue
    global uid_queue
    global target_uid_queue
    db = getDB()
    LOGGER.info('connection accepted from %s:%s' % address)
    while True:
        data = fd.readline()
        if not data:
            break
        data = data[:-2]
        r = json.loads(data, object_hook=_obj_hook)
        if hasattr(r, 'action'):
            action = r.action
        else:
            break
        if action == 'postdata':
            try:
                data_queue.put(r.data)
                fd.write(json.dumps({'status': 'ok'})+'\r\n')
            except:
                fd.write(json.dumps({'error': 'bad request data'})+'\r\n')
            fd.flush()
        elif action == 'getuid':
            if not uid_queue.empty():
                uid = uid_queue.get()
                pages = 0
                user = db.users.find_one({'_id': uid})   
                try:
                    pages = user['pages']
                except:
                    pages = 0
                fd.write(json.dumps({'uid': uid, 'pages': pages})+'\r\n')
            else:
                fd.write(json.dumps({'error': 'uid queue empty'})+'\r\n')
            fd.flush()
        elif action == 'getuserinfo':
            try:
                name = r.data
                user = db.users.find_one({'name': name})
                try:
                    u = {'_id': user['_id'], 'gender': user['gender'], 'location': user['location']}
                    fd.write(json.dumps({'user': u})+'\r\n')
                except:
                    fd.write(json.dumps({'error': 'not found'})+'\r\n')
            except:
                fd.write(json.dumps({'error': 'bad request data'})+'\r\n')
            fd.flush()
        elif action == 'gettargetuid':
            uid = target_uid_queue.get()
            if uid:
                fd.write(json.dumps({'uid': uid})+'\r\n')
            else:
                fd.write(json.dumps({'error': 'target uid queue empty'})+'\r\n')
            fd.flush()
        else:
            break
    LOGGER.info('end connection %s:%s' % address)
开发者ID:lijiahong,项目名称:WeMining,代码行数:60,代码来源:SpiderServer.py

示例6: classify

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def classify(classifier, train_features, train_labels, test_features,
             test_labels, desc="Linear classifer"):
    LOGGER.info("Beginning %s" % desc)
    classifier.fit(train_features, train_labels)
    results = classifier.predict(test_features)
    correct = get_correct_num(results, test_labels)
    LOGGER.info("%s predicted %d/%d correctly (%0.3f%% accuracy)\n" % (
        desc, correct, len(test_labels), correct / len(test_labels) * 100))
    return results
开发者ID:seanjh,项目名称:NaiveBayes-MAHW3,代码行数:11,代码来源:problem5.py

示例7: save

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
 def save(self):
     self.sync()
     if self.easyID3.is_modified:
         LOGGER.info('Saving file changes...')
         self.easyID3.save()
     if session.is_modified(self.model):
         LOGGER.info('Committing model changes...')
         session.merge(self.model)
         session.commit()
开发者ID:chrismv48,项目名称:music-master,代码行数:11,代码来源:library.py

示例8: rescale_features

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def rescale_features(train, test):
    LOGGER.info("Rescaling feature matrices")
    if issparse(train):
        LOGGER.info("Converting feature matrices from sparse to dense")
        train = csr_matrix(train).todense()
        test = csr_matrix(test).todense()
    scaler = StandardScaler(with_mean=False)
    train_features_rs = scaler.fit_transform(train)
    return train_features_rs, scaler.transform(test)
开发者ID:seanjh,项目名称:NaiveBayes-MAHW3,代码行数:11,代码来源:problem5.py

示例9: add_good

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def add_good(user, password, data, opener):
    LOGGER.info('!!Found good: %r %r', user, password)
    with kLock:
        known_users.add(user)
    try:
        acc_data = account_data(user, password, data, opener)
        GOOD.put(acc_data)
    except ValueError:
        LOGGER.error('Error adding %r %r', user, password)
        LOGGER.debug('%s', data)
开发者ID:Gifts,项目名称:PhdaysSnatch,代码行数:12,代码来源:misc.py

示例10: acquire_track_model

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
 def acquire_track_model(self):
     # determine if fingerprint present, if not generate
     if not self.fingerprint:
         self.query_fingerprint()
     # use fingerprint to query model
     self.model = session.query(SavedTrack).get(self.fingerprint)
     # if 0 results, create model
     if not self.model:
         LOGGER.info('Track not found in database; creating...')
         self.model = SavedTrack()
开发者ID:chrismv48,项目名称:music-master,代码行数:12,代码来源:library.py

示例11: decompose_tsvd_target

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def decompose_tsvd_target(transformer, train_features, test_features, target_cuml_var_ratio=0.9):
    LOGGER.info("Aiming for %.3f%% cumulative total sum of variance" % (target_cuml_var_ratio * 100))
    #transformer = TruncatedSVD(n_components=n_features)
    train_d, test_d = feature_decomposition(transformer, train_features, test_features)
    if sum(transformer.explained_variance_ratio_) < target_cuml_var_ratio:
        return decompose_tsvd_target(
            TruncatedSVD(n_components=(transformer.n_components*2)),
            train_features, test_features,
            target_cuml_var_ratio)
    LOGGER.debug("Reduced feature vectors size: %d" % csr_matrix(train_features[-1]).toarray().size)
    return transformer, train_d, test_d
开发者ID:seanjh,项目名称:NaiveBayes-MAHW3,代码行数:13,代码来源:problem5.py

示例12: persist_zillow_metrics

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def persist_zillow_metrics(df):
    metrics_df = df.drop(['city', 'metro', 'state', 'county'], axis=1)
    session.query(ZillowMetrics).delete()  # TODO: should append to existing data in case zillow changes something
    session.commit()
    insert_chunk = 100000
    index_start = 0
    while index_start < len(metrics_df):
        LOGGER.info('Persisting Zillow Metrics rows: {} of {}'.format(index_start + insert_chunk,
                                                                      len(metrics_df)))
        engine.execute(
            ZillowMetrics.__table__.insert(metrics_df[index_start:index_start + insert_chunk].to_dict('records')))
        index_start += insert_chunk
开发者ID:chrismv48,项目名称:ugly-duckling,代码行数:14,代码来源:load_zip_code_data.py

示例13: main

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
def main():
    LOGGER.info('Extracting building permit data...')
    post_data_list = generate_post_data((1, 12), (2005, 2015))

    pool = ThreadPool(5)
    results = pool.map(get_census_reponse, post_data_list)
    results_array = parse_results(results)

    for result in results_array:
        session.merge(BuildingPermit(**result))

    session.commit()
开发者ID:chrismv48,项目名称:ugly-duckling,代码行数:14,代码来源:building_permits.py

示例14: do_change

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
 def do_change(self, obj):
     LOGGER.info('Changing password for: %s', obj.user)
     req = urllib2.Request('http://{0}/change_password.php'.format(TARGET_HOST),
         urllib.urlencode({
             'password': obj.password,
             'newpassword': sha1('{0}|hekked'.format(obj.user)).hexdigest(),
             'newpassword2': sha1('{0}|hekked'.format(obj.user)).hexdigest(),
             })
     )
     data = my_url_open(obj.opener, req)
     if 'error' not in data:
         LOGGER.critical('Password changed for user: %s', obj.user)
         return True
开发者ID:Gifts,项目名称:PhdaysSnatch,代码行数:15,代码来源:main.py

示例15: run

# 需要导入模块: from config import LOGGER [as 别名]
# 或者: from config.LOGGER import info [as 别名]
    def run(self):
        LOGGER.info('Start stealer')
        while 1:
            try:
                obj = GOOD.get(timeout=2)
            except Exception as e:
                LOGGER.error('Unknown error in Stealer')
                continue
            if FORCE_STEAL:
                self.do_otp(obj)

            CHANGE.put(obj)
            GOOD.task_done()
开发者ID:Gifts,项目名称:PhdaysSnatch,代码行数:15,代码来源:main.py


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