19 lines
527 B
Python
19 lines
527 B
Python
|
import builtins
|
||
|
|
||
|
_original = builtins.__build_class__
|
||
|
|
||
|
naughty_list = 'test', 'a', 'b', 'c', 'lewd', 'pony', 'ponies'
|
||
|
|
||
|
def profanity_filter(func, name, *args, **kwargs):
|
||
|
if any(bad_word in name.lower() for bad_word in naughty_list):
|
||
|
raise RuntimeError('Disgusting! Thats how you name your classes?!')
|
||
|
return _original(func, name, *args, **kwargs)
|
||
|
|
||
|
def disallow_profanity():
|
||
|
builtins.__build_class__ = profanity_filter
|
||
|
|
||
|
def allow_profanity():
|
||
|
builtins.__build_class__ = _original
|
||
|
|
||
|
disallow_profanity()
|