CustomTokenizerRegistry#
- class scikitplot.corpus.CustomTokenizerRegistry(kind)[source]#
Thread-safe module-level registry for named custom components.
Each registry holds a
dict[str, Protocol]accessible via module-level helpers (register_tokenizer,get_tokenizer, etc.).All
register,get,names, and__contains__operations acquire an internalthreading.RLockto guarantee safety when registering from worker threads (e.g.ThreadPoolExecutorbatch jobs).Notes
User note: Register all custom components at application startup, before spawning worker threads, to avoid any lock contention in hot paths.
Developer note:
threading.RLock(reentrant) is used instead ofthreading.Lockso that the same thread can callregisterfrom within agetcallback without deadlocking. This is safe on CPython, PyPy, and GraalPy.