Skip to content

mutate_helper

django_spire.contrib.seeding.field.seed.helper.mutate_helper

MutateFieldSeedHelper

Bases: FieldSeedHelper

Source code in django_spire/contrib/seeding/field/seed/helper/helper.py
def __init__(self, locale: str | list[str] = 'en_CA') -> None:
    self.locale = locale

Severity = MutateSeverity class-attribute instance-attribute

corrupt staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/mutate_helper.py
@staticmethod
def corrupt(
    field_seed: BaseFieldSeed,
    corrupt_chance: float = 0.5,
    severity: MutateSeverity = MutateSeverity.MILD,
) -> CorruptMutateFieldSeed:
    return CorruptMutateFieldSeed(
        field_seed=field_seed, corrupt_chance=corrupt_chance, severity=severity
    )

exclude staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/mutate_helper.py
@staticmethod
def exclude(field_seed: BaseFieldSeed, exclude_chance: float = 0.5) -> ExcludeMutateFieldSeed:
    return ExcludeMutateFieldSeed(
        field_seed=field_seed, exclude_chance=exclude_chance
    )

nullable staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/mutate_helper.py
@staticmethod
def nullable(field_seed: BaseFieldSeed, nullify_chance: float = 0.5) -> NullableMutateFieldSeed:
    return NullableMutateFieldSeed(field_seed=field_seed, nullify_chance=nullify_chance)

type staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/mutate_helper.py
@staticmethod
def type(
    field_seed: BaseFieldSeed, target_type: type, change_chance: float = 0.5
) -> TypeCoercionMutateFieldSeed:
    return TypeCoercionMutateFieldSeed(
        field_seed=field_seed, target_type=target_type, change_chance=change_chance
    )

value staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/mutate_helper.py
@staticmethod
def value(
    field_seed: BaseFieldSeed, transform: Callable, change_chance: float = 0.5
) -> TransformMutateFieldSeed:
    return TransformMutateFieldSeed(
        field_seed=field_seed, transform=transform, change_chance=change_chance
    )