<commit_before>import docopt
import logging
import yaml

from os.path import isfile

from rabix import __version__ as version
from rabix.common.errors import RabixError
from rabix.common.ref_resolver import Loader
from rabix.common.util import set_log_level
from rabix.tools.build import run_steps


log = logging.getLogger(__name__)


USAGE = """
Usage:
  rabix build [-v...] [--config=<cfg_path>]
  rabix checksum [--method=(md5|sha1)] <jsonptr>
  rabix -h | --help
  rabix --version

Commands:
  build                     Execute steps for app building, wrapping and
                            deployment.
  checksum                  Calculate and print the checksum of json document
                            (or fragment) pointed by <jsonptr>

Options:
  -c --config=<cfg_path>    Specify path to config file [default: .rabix.yml]
  -h --help                 Display this message.
  -m --method (md5|sha1)    Checksum type [default: sha1]
  --version                 Print version to standard output and quit.
  -v --verbose              Verbosity. More Vs more output.
"""


def checksum(jsonptr, method='sha1'):
    loader = Loader()
    obj = loader.load(jsonptr)
    print(method + '$' + loader.checksum(obj, method))<commit_msg>fixing usage string for rabix-tools<commit_after>import docopt
import logging
import yaml

from os.path import isfile

from rabix import __version__ as version
from rabix.common.errors import RabixError
from rabix.common.ref_resolver import Loader
from rabix.common.util import set_log_level
from rabix.tools.build import run_steps


log = logging.getLogger(__name__)


USAGE = """
Usage:
  rabix-tools build [-v...] [--config=<cfg_path>]
  rabix-tools checksum [--method=(md5|sha1)] <jsonptr>
  rabix-tools -h | --help
  rabix-tools --version

Commands:
  build                     Execute steps for app building, wrapping and
                            deployment.
  checksum                  Calculate and print the checksum of json document
                            (or fragment) pointed by <jsonptr>

Options:
  -c --config=<cfg_path>    Specify path to config file [default: .rabix.yml]
  -h --help                 Display this message.
  -m --method (md5|sha1)    Checksum type [default: sha1]
  --version                 Print version to standard output and quit.
  -v --verbose              Verbosity. More Vs more output.
"""


def checksum(jsonptr, method='sha1'):
    loader = Loader()
    obj = loader.load(jsonptr)
    print(method + '$' + loader.checksum(obj, method))
{'fraction_non_alphanumeric': 0.09533227848101265, 'fraction_numerical': 0.004746835443037975, 'mean_word_length': 2.436141304347826, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2836673', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 243}