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

class MyDemoConsoleApp(ramona.console_app):
	pass

if __name__ == '__main__':
	app = MyDemoConsoleApp(configuration='./demo.conf')
	app.run()
 

 #TODO: clean -> find . -name "*.pyc" -or -name "*.pyo" | xargs rm
 <commit_msg>Adding demo for @tool methods<commit_after>#!/usr/bin/env python
import os, fnmatch
import ramona

class MyDemoConsoleApp(ramona.console_app):

	@ramona.tool
	def clean(self):
		'Clean project directory from intermediate files (*.pyc)'
		for root, dirnames, filenames in os.walk('.'):
			for filename in fnmatch.filter(filenames, '*.pyc'):
				filename = os.path.join(root, filename)
				if not os.path.isfile(filename): continue
				os.unlink(filename)

	@ramona.tool
	def unittests(self):
		'Seek for all unit tests and execute them'
		import unittest
		tl = unittest.TestLoader()
		ts = tl.discover('.', '*.py')

		tr = unittest.runner.TextTestRunner(verbosity=2)
		return tr.run(ts)


if __name__ == '__main__':
	app = MyDemoConsoleApp(configuration='./demo.conf')
	app.run()
 
{'fraction_non_alphanumeric': 0.14366729678638943, 'fraction_numerical': 0.000945179584120983, 'mean_word_length': 4.268656716417911, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2685908', 'n_tokens_mistral': 406, 'n_tokens_neox': 372, 'n_words': 93}