<commit_before>#!/usr/bin/env python

from PLC.API import PLCAPI
from DocBook import DocBook

def api_methods():
    api = PLCAPI(None)
    methods = api.all_methods
    return [api.callable(method) for method in methods]

DocBook(api_methods ()).Process()<commit_msg>minor cleanup to be more verbose when there are errors; most of the time when we have these errors its because the environment we are building in is missing some required python module<commit_after>#!/usr/bin/env python

from PLC.API import PLCAPI
from PLC.Faults import PLCInvalidAPIMethod
from DocBook import DocBook
import sys

api = PLCAPI(None)
methods = api.all_methods
good_apis = []
bad_apis = []
for method in methods:
    try:
        good_api = api.callable(method)
        good_apis.append(good_api)
    except PLCInvalidAPIMethod, e:
        bad_apis.append((method,e))

DocBook(good_apis).Process()

if len(bad_apis):
    sys.stderr.write("UNEXPECTED: There are %d non-callable methods:\n")
    for bad_api,e in bad_apis:
        sys.stderr.write("\t%s:%s\n" % (bad_api,e))
    sys.exit(-1)
{'fraction_non_alphanumeric': 0.10074626865671642, 'fraction_numerical': 0.0009328358208955224, 'mean_word_length': 4.037558685446009, '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': '6496111', 'n_tokens_mistral': 354, 'n_tokens_neox': 343, 'n_words': 105}