From ecdd14353ad078efc8db800d4d56a43c719eeb98 Mon Sep 17 00:00:00 2001 From: Serhii Tereshchenko Date: Sat, 14 Oct 2023 11:25:16 +0300 Subject: [PATCH] feat: Support correct return type for Factory() call (pyright-only) --- factory/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/base.py b/factory/base.py index 796f3d65..84c151fe 100644 --- a/factory/base.py +++ b/factory/base.py @@ -415,7 +415,7 @@ class BaseFactory(Generic[T]): UnknownStrategy = errors.UnknownStrategy UnsupportedStrategy = errors.UnsupportedStrategy - def __new__(cls, *args, **kwargs): + def __new__(cls, *args, **kwargs) -> T: """Would be called if trying to instantiate the class.""" raise errors.FactoryError('You cannot instantiate BaseFactory')