<commit_before>#!/usr/bin/python 

import imp
import os
import inspect
import logging

class YAS3FSPlugin (object):
	@staticmethod
	def load_from_file(yas3fs, filepath, expected_class = None):
		class_inst = None

		try:
			mod_name,file_ext = os.path.splitext(os.path.split(filepath)[-1])
			if file_ext.lower() == '.py':
				py_mod = imp.load_source(mod_name, filepath)

			elif file_ext.lower() == '.pyc':
				py_mod = imp.load_compiled(mod_name, filepath)
			else:
				raise

			if not py_mod:
				raise

			for klass in inspect.getmembers(py_mod,inspect.isclass):
				if not issubclass(klass[1], YAS3FSPlugin):
					continue

				if expected_class == None or expected_class == klass[0]:
					class_inst = klass[1](yas3fs)
					break
		except Exception as e:
			raise Exception("cannot load plugin file " + filepath + " " + e)

		if not class_inst:
			raise Exception("cannot load plugin class " + expected_class + " " + e)


		return class_inst<commit_msg>Remove reference to inaccessible exception<commit_after>#!/usr/bin/python 

import imp
import os
import inspect
import logging

class YAS3FSPlugin (object):
	@staticmethod
	def load_from_file(yas3fs, filepath, expected_class = None):
		class_inst = None

		try:
			mod_name,file_ext = os.path.splitext(os.path.split(filepath)[-1])
			if file_ext.lower() == '.py':
				py_mod = imp.load_source(mod_name, filepath)

			elif file_ext.lower() == '.pyc':
				py_mod = imp.load_compiled(mod_name, filepath)
			else:
				raise

			if not py_mod:
				raise

			for klass in inspect.getmembers(py_mod,inspect.isclass):
				if not issubclass(klass[1], YAS3FSPlugin):
					continue

				if expected_class == None or expected_class == klass[0]:
					class_inst = klass[1](yas3fs)
					break
		except Exception as e:
			raise Exception("cannot load plugin file " + filepath + " " + e)

		if not class_inst:
			raise Exception("cannot load plugin class " + expected_class)

		return class_inst
{'fraction_non_alphanumeric': 0.10824742268041238, 'fraction_numerical': 0.008247422680412371, 'mean_word_length': 3.745721271393643, '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': '1644254', 'n_tokens_mistral': 783, 'n_tokens_neox': 662, 'n_words': 166}