Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/factory-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ from .declarations import SelfAttribute as SelfAttribute
from .declarations import Sequence as Sequence
from .declarations import SubFactory as SubFactory
from .declarations import Trait as Trait
from .declarations import Transformer as Transformer
from .enums import BUILD_STRATEGY as BUILD_STRATEGY
from .enums import CREATE_STRATEGY as CREATE_STRATEGY
from .enums import STUB_STRATEGY as STUB_STRATEGY
Expand Down
5 changes: 4 additions & 1 deletion src/factory-stubs/declarations.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ class LazyAttribute(BaseDeclaration[T, V]):
def function(__obj: builder.Resolver[T]) -> V: ...
def __init__(self, function: Callable[[builder.Resolver[T]], V]) -> None: ...

class _UNSPECIFIED: ...
class Transformer(BaseDeclaration[T, V]):
default: Any
transform: Callable[[Any], V]
def __init__(self, default: T, transform: Callable[[Any], V]) -> None: ...

def deepgetattr(obj: Any, name: str, default: _UNSPECIFIED | Any = ...) -> Any: ...

Expand Down
5 changes: 5 additions & 0 deletions src/factory-stubs/django.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class DjangoModelFactory(base.Factory[TModel]):
class Meta:
abstract: bool

class Password(declarations.Transformer[Any, str]):
def __init__(
self, password: str, transform: Callable[[str], str] = ..., **kwargs: Any
) -> None: ...

class FileField(declarations.BaseDeclaration[Any, File]):
DEFAULT_FILENAME: str

Expand Down