<commit_before>#!/usr/bin/python

import os
import sys

if not len(sys.argv)>1:
	raise Exception, 'Usage: gen_graph.sh module1 module2 module3'

modules = sys.argv[1:]
done = []

print 'digraph G {'
while len(modules):
	f = modules.pop(0)
	done.append(f)
	if os.path.isfile(os.path.join(f,"__terp__.py")):
		info=eval(file(os.path.join(f,"__terp__.py")).read())
		if info.get('installable', True):
			for name in info['depends']:
				if name not in done+modules:
					modules.append(name)
				print '\t%s -> %s;' % (f, name)
print '}'<commit_msg>the generator of the dependency graph of modules can now process all modules of the current directory<commit_after>#!/usr/bin/python

import os
import sys
import glob

if len(sys.argv) == 2 and (sys.argv[1] in ['-h', '--help']):
    print >>sys.stderr, 'Usage: module_graph.py [module1 module2 module3]\n\tWhen no module is specified, all modules in current directory are used'
    sys.exit(1)

modules = sys.argv[1:]
if not len(modules):
    modules = map(os.path.dirname, glob.glob(os.path.join('*', '__terp__.py')))

done = []

print 'digraph G {'
while len(modules):
	f = modules.pop(0)
	done.append(f)
	if os.path.isfile(os.path.join(f,"__terp__.py")):
		info=eval(file(os.path.join(f,"__terp__.py")).read())
		if info.get('installable', True):
			for name in info['depends']:
				if name not in done+modules:
					modules.append(name)
				print '\t%s -> %s;' % (f, name)
print '}'
{'fraction_non_alphanumeric': 0.17458100558659218, 'fraction_numerical': 0.009776536312849162, 'mean_word_length': 4.136200716845878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '486018', 'n_tokens_mistral': 565, 'n_tokens_neox': 531, 'n_words': 138}