<commit_before># -*- coding: utf-8 -*-
"""Camlipy command line tool.

Usage:
  camlipy put [-] [<file>...] [--permanode]
  camlipy get <blob_ref> [--contents] [--output=<destination>]
  camlipy config <server_url> [<username> <password>]
  camlipy -h | --help
  camlipy --version

Options:
  -h --help      Show this screen.
  --version      Show version.
  --permanode    Create a permanode.
  --contents     Output the blob to stdin.
"""
import sys
import os
import logging

import simplejson as json
from docopt import docopt

from camlipy import __version__, Camlistore

DEFAULT_SERVER = 'http://localhost:3179'
CAMLISTORE_CLIENT_CONFIG = os.path.expanduser('~/.config/camlistore/client-config.json')
CAMLIPY_CONFIG = os.path.expanduser('~/.config/camlipy/config.json')


def load_conf(path):
    return json.loads(open(CAMLISTORE_CLIENT_CONFIG, 'rb').read())

camlikwargs = {}
server = DEFAULT_SERVER
for path in [CAMLISTORE_CLIENT_CONFIG, CAMLIPY_CONFIG]:
    if os.path.isfile(CAMLISTORE_CLIENT_CONFIG):
        conf = load_conf(CAMLISTORE_CLIENT_CONFIG)
        server = conf['server']
        if conf.get('username'):
            camlikwargs.update({'auth': (conf['username'], conf['password'])})

c = Camlistore(server, **camlikwargs)

log = logging.getLogger(__name__)


class CamlipyFilter(logging.Filter):
    def filter(self, rec):
        if rec.name.startswith('camlipy') or rec.name == '__main__':
            return True
        else:
            return rec.levelno >= logging.WARNING
<commit_msg>Bugfix command line tool.<commit_after># -*- coding: utf-8 -*-
"""Camlipy command line tool.

Usage:
  camlipy put [-] [<file>...] [--permanode]
  camlipy get <blob_ref> [--contents] [--output=<destination>]
  camlipy config <server_url> [<username> <password>]
  camlipy -h | --help
  camlipy --version

Options:
  -h --help      Show this screen.
  --version      Show version.
  --permanode    Create a permanode.
  --contents     Output the blob to stdin.
"""
import sys
import os
import logging

import simplejson as json
from docopt import docopt

from camlipy import __version__, Camlistore

DEFAULT_SERVER = 'http://localhost:3179'
CAMLISTORE_CLIENT_CONFIG = os.path.expanduser('~/.config/camlistore/client-config.json')
CAMLIPY_CONFIG = os.path.expanduser('~/.config/camlipy/config.json')


def load_conf(path):
    return json.loads(open(path, 'rb').read())

camlikwargs = {}
server = DEFAULT_SERVER
for path in [CAMLISTORE_CLIENT_CONFIG, CAMLIPY_CONFIG]:
    if os.path.isfile(path):
        conf = load_conf(path)
        server = conf['server']
        if conf.get('username'):
            camlikwargs.update({'auth': (conf['username'], conf['password'])})

c = Camlistore(server, **camlikwargs)

log = logging.getLogger(__name__)


class CamlipyFilter(logging.Filter):
    def filter(self, rec):
        if rec.name.startswith('camlipy') or rec.name == '__main__':
            return True
        else:
            return rec.levelno >= logging.WARNING

{'fraction_non_alphanumeric': 0.13782696177062373, 'fraction_numerical': 0.00335345405767941, 'mean_word_length': 3.4588938714499253, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '6908573', 'n_tokens_mistral': 1015, 'n_tokens_neox': 975, 'n_words': 235}