simplebench.type_proxies.lazy_type_proxy module🔗

Provides a generic deferred import mechanism for any type.

class simplebench.type_proxies.lazy_type_proxy.LazyTypeProxy[source]🔗

Bases: Generic[T]

A generic base class for creating lazy-loading type proxies.

Usage:

class MyProxy(LazyTypeProxy['RealType']):
    pass

register_lazy_proxy(MyProxy, 'RealType', 'path.to.module')
simplebench.type_proxies.lazy_type_proxy.register_lazy_proxy(
proxy_class: type,
real_type_name: str,
module_path: str,
) None[source]🔗

Register a lazy proxy class with its real type information.

The proxy class will use this information to perform runtime type checks without causing circular import issues.

Usage:

register_lazy_proxy(MyProxyClass, 'RealTypeName', 'path.to.module')
Parameters:
  • proxy_class (type) – The proxy class to register.

  • real_type_name (str) – The name of the real type being proxied.

  • module_path (str) – The module path where the real type can be imported from.