Registry¶
pikit.registry ¶
A tiny name -> class registry with a decorator API.
Contributors add a new method by writing one file and decorating their
class; no edits to core code are required. Attacks and defenses each get
their own registry instance (see attacks/__init__.py and
defenses/__init__.py).
Registry ¶
Bases: Generic[T]
Maps a short string key to a class.
Examples¶
reg = Registry("attack") @reg.register("naive") ... class _Naive: # doctest: +SKIP ... ... reg.list() # doctest: +SKIP ['naive']