<commit_before>#!/usr/bin/env python3
from lib import activate_venv
from lib.veevutils import banner
from painter import paint

import sys, os, glob, stat, subprocess

def parseUtils():
	def isExecutable(f):
		return (os.stat(f)[stat.ST_MODE] & stat.S_IXUSR) > 0
	scripts = [util for util in glob.glob(os.path.join(UTILS_DIR, "*.py")) if isExecutable(util)]
	names = [os.path.splitext(os.path.basename(script))[0] for script in scripts]

	return names


def indented(message):
	print("     " + message)

def usage():
	def pad(name):
		return ' ' * (10 - len(name))

	print("SYNPOSIS")
	for command in COMMANDS:
		indented(PROGNAME + ' ' + command + ' ' + COMMANDS[command]['usage'])

	print("\nDESCRIPTION")
	indented("The combined cli utility for Velveeva")
	indented("The following options are available\n\n")

	for command in COMMANDS:
		indented(command + pad(command) + COMMANDS[command]['help'])



def util_help():
	print("UTILS")
	indented("(For more information use: velveeva util util_name --help)")

	for util in parseUtils():
		indented(PROGNAME + " util " + util)

def exec_util(args):
	if not args:
		print(banner())
		util_help()
		return 1

	util = args[0]
	util_args = args[1:]

	utils = parseUtils()

	if util is None:
		print(banner())
		util_help()
	elif util in utils:
		script = os.path.join(UTILS_DIR,util+".py")
		sys.exit(subprocess.call([script] + util_args, shell=True))

	else:
		print(util + ' is not a recognized Velveeva util command')
		logo()
		util_help()


def dispatch(command_name, args):
	if COMMANDS.get(command_name, None) is not None:
		cmd = COMMANDS[command_name]['command']
		if cmd is None:
			return
		elif callable(cmd):<commit_msg>use string for call arguments<commit_after>#!/usr/bin/env python3
from lib import activate_venv
from lib.veevutils import banner
from painter import paint

import sys, os, glob, stat, subprocess

def parseUtils():
	def isExecutable(f):
		return (os.stat(f)[stat.ST_MODE] & stat.S_IXUSR) > 0
	scripts = [util for util in glob.glob(os.path.join(UTILS_DIR, "*.py")) if isExecutable(util)]
	names = [os.path.splitext(os.path.basename(script))[0] for script in scripts]

	return names


def indented(message):
	print("     " + message)

def usage():
	def pad(name):
		return ' ' * (10 - len(name))

	print("SYNPOSIS")
	for command in COMMANDS:
		indented(PROGNAME + ' ' + command + ' ' + COMMANDS[command]['usage'])

	print("\nDESCRIPTION")
	indented("The combined cli utility for Velveeva")
	indented("The following options are available\n\n")

	for command in COMMANDS:
		indented(command + pad(command) + COMMANDS[command]['help'])



def util_help():
	print("UTILS")
	indented("(For more information use: velveeva util util_name --help)")

	for util in parseUtils():
		indented(PROGNAME + " util " + util)

def exec_util(args):
	if not args:
		print(banner())
		util_help()
		return 1

	util = args[0]
	util_args = args[1:]
	utils = parseUtils()

	if util is None:
		print(banner())
		util_help()
	elif util in utils:
		script = os.path.join(UTILS_DIR,util+".py")
		call = [script] + util_args
		sys.exit(subprocess.call(' '.join(call), shell=True))

	else:
		print(util + ' is not a recognized Velveeva util command')
		logo()
		util_help()


def dispatch(command_name, args):
	if COMMANDS.get(command_name, None) is not None:
		cmd = COMMANDS[command_name]['command']
		if cmd is None:
			return
		elif callable(cmd):
{'fraction_non_alphanumeric': 0.14012363850456286, 'fraction_numerical': 0.0047100382690609364, 'mean_word_length': 4.489499192245558, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7328090', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1195, 'n_words': 326}