Skip to content

Commit e5fb6bf

Browse files
sobolevnadhtruong
andauthored
perf: micro-optimize BaseFactory._infer_model_type (#731)
Co-authored-by: Andrew Truong <[email protected]>
1 parent 36c68f5 commit e5fb6bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

polyfactory/factories/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class Foo(ModelFactory[MyModel]): # <<< MyModel
275275
"""
276276

277277
factory_bases: Iterable[type[BaseFactory[T]]] = (
278-
b for b in get_original_bases(cls) if get_origin(b) and issubclass(get_origin(b), BaseFactory)
278+
b for b in get_original_bases(cls) if (orig := get_origin(b)) and issubclass(orig, BaseFactory)
279279
)
280280
generic_args: Sequence[type[T]] = [
281281
arg for factory_base in factory_bases for arg in get_args(factory_base) if not is_type_var(arg)

0 commit comments

Comments
 (0)