<commit_before># -*- coding: utf-8 -*-

import logging
from api import Api

def do(config):

    api = Api(config['api'])
    ok, status, data = api.post('/Profile/getOwnProfile')
    text = config['format'] % data['user_info']
    params = dict(content=text.encode('UTF-8'), qualifier=':')
    ok, status, data = api.post('/Timeline/plurkAdd', params)
    if not ok:
        logging.error('status: %s' % status)
        logging.error(data)

if __name__ == '__main__':
    import sys
    if 2 <> len(sys.argv):
        sys.stderr.write('usage: %s config.yml\n' % sys.argv[0])
        sys.exit(1)

    from config import load
    do(load(sys.argv[1]))<commit_msg>replaced dumb works with util.abort<commit_after># -*- coding: utf-8 -*-

from api import Api
from util import abort
import logging

def do(config):

    api = Api(config['api'])
    ok, status, data = api.post('/Profile/getOwnProfile')
    text = config['format'] % data['user_info']
    params = dict(content=text.encode('UTF-8'), qualifier=':')
    ok, status, data = api.post('/Timeline/plurkAdd', params)
    if not ok:
        logging.error('status: %s' % status)
        logging.error(data)

if __name__ == '__main__':
    import sys
    if 2 <> len(sys.argv):
        abort('usage: %s config.yml\n' % sys.argv[0])

    from config import load
    do(load(sys.argv[1]))
{'fraction_non_alphanumeric': 0.16890881913303438, 'fraction_numerical': 0.008221225710014948, 'mean_word_length': 3.107361963190184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3166701', 'n_tokens_mistral': 460, 'n_tokens_neox': 454, 'n_words': 112}