<commit_before>#!/usr/bin/python

from __future__ import print_function

import os
import sys
import subprocess
import re
import importlib


def roger_version(root_dir):
    with open(os.path.join(root_dir, "VERSION")) as f:
        version = f.read().strip()
    print(version)


def print_help_opt(opt, desc):
    print("  {} {}".format(opt.ljust(13), desc))


def roger_help(root, commands):
    print("usage: roger [-h] [-v] command [arg...]\n")
    print("a command line interface to work with roger mesos.")
    print("\npositional arguments:")
    print_help_opt("command", "command to run.")
    print_help_opt("arg", "arguments to pass to the command.")
    print("\noptional arguments:")
    print_help_opt("-h, --help", "show this help message and exit.")
    print_help_opt("-v, --version", "show version information and exit.")<commit_msg>Try finding version first from installation if possible.<commit_after>#!/usr/bin/python

from __future__ import print_function

import os
import sys
import subprocess
import re
import importlib
from pkg_resources import get_distribution

def roger_version(root_dir):
    version = "Unknown!"
    try:
        version = get_distribution('roger_mesos_tools').version
    except Exception:
        fname = os.path.join(root_dir, "VERSION")
        if(os.path.isfile(fname)):
            with open(os.path.join(root_dir, "VERSION")) as f:
                version = f.read().strip()
    finally:
        print(version)

def print_help_opt(opt, desc):
    print("  {} {}".format(opt.ljust(13), desc))


def roger_help(root, commands):
    print("usage: roger [-h] [-v] command [arg...]\n")
    print("a command line interface to work with roger mesos.")
    print("\npositional arguments:")
    print_help_opt("command", "command to run.")
    print_help_opt("arg", "arguments to pass to the command.")
    print("\noptional arguments:")
    print_help_opt("-h, --help", "show this help message and exit.")
    print_help_opt("-v, --version", "show version information and exit.")
{'fraction_non_alphanumeric': 0.13968410661401776, 'fraction_numerical': 0.0019743336623889436, 'mean_word_length': 3.724941724941725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4644516', 'n_tokens_mistral': 630, 'n_tokens_neox': 618, 'n_words': 180}