We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8032e7 commit ad88bb3Copy full SHA for ad88bb3
src/guidellm/utils/pydantic_utils.py
@@ -275,6 +275,17 @@ class DatabaseConfig(BaseConfig):
275
276
schema_discriminator: ClassVar[str] = "model_type"
277
278
+ def __new__(cls, *args, **kwargs): # noqa: ARG004
279
+ """
280
+ Prevent direct instantiation of base classes that use this mixin.
281
+
282
+ Only allows instantiation of concrete subclasses, not the base class.
283
284
+ base_type = cls.__pydantic_schema_base_type__()
285
+ if cls is base_type:
286
+ raise TypeError(f"only children of '{cls.__name__}' may be instantiated")
287
+ return super().__new__(cls)
288
289
@classmethod
290
def register_decorator(
291
cls, clazz: RegisterClassT, name: str | list[str] | None = None
0 commit comments