Module Expr Str ImportFrom alias ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases body Expr Str Pass decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad NameLoad IfExp AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If AttributeLoad NameLoad attr body Assign NameStore BinOpBitAnd AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr Call NameLoad BoolOpOr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Return Call NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults kwarg body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad vararg kwarg body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body AugAssignAdd AttributeStore NameLoad attr TupleLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list
N/A N/A  Mixer types.  copy deepcopy BigInteger N/A N/A N/A  Type for big integers.  N/A N/A EmailString N/A N/A N/A  Type for emails.  N/A N/A HostnameString N/A N/A N/A  Type for hostnames.  N/A N/A IP4String N/A N/A N/A  Type for IPv4 addresses.  N/A N/A IP6String N/A N/A N/A  Type for IPv6 addresses.  N/A N/A IPString N/A N/A N/A  Type for IPv4 and IPv6 addresses.  N/A N/A NullOrBoolean N/A N/A N/A  Type for None or boolean values.  N/A N/A PositiveDecimal N/A N/A N/A  Type for positive decimals.  N/A N/A PositiveInteger N/A N/A N/A  Type for positive integers.  N/A N/A PositiveSmallInteger N/A N/A N/A  Type for positive small integers.  N/A N/A SmallInteger N/A N/A N/A  Type for small integers.  N/A N/A Text N/A N/A N/A  Type for texts.  N/A N/A URL N/A N/A N/A  Type for URLs.  N/A N/A UUID N/A N/A N/A  Type for UUIDs.  N/A N/A Mix N/A object N/A N/A  Virtual link on the mixed object.

    ::

        mixer = Mixer()

        # here `mixer.MIX` points on a generated `User` instance
        user = mixer.blend(User, username=mixer.MIX.first_name)

        # here `mixer.MIX` points on a generated `Message.author` instance
        message = mixer.blend(Message, author__name=mixer.MIX.login)

        # Mixer mix can get a function
        message = mixer.blend(Message, title=mixer.MIX.author(
            lambda author: 'Author: %s' % author.name
        ))

     __init__ N/A N/A self value parent N/A None None N/A N/A N/A self __value value N/A N/A self __parent parent N/A N/A self __func None N/A __getattr__ N/A N/A self value N/A N/A N/A N/A Mix value N/A N/A self __value self None N/A __call__ N/A N/A self func N/A N/A N/A N/A self __func func N/A self N/A __and__ N/A N/A self values N/A N/A N/A N/A self __parent N/A N/A values N/A N/A self __parent values N/A N/A isinstance values dict N/A N/A value N/A values N/A N/A self __value N/A N/A N/A isinstance values _Deffered N/A N/A value N/A getattr N/A values value N/A self __value N/A N/A value N/A getattr values N/A self __value N/A N/A self __func N/A N/A N/A N/A self __func value N/A value N/A __str__ N/A N/A self N/A N/A N/A N/A %s/%s N/A N/A self __value N/A str N/A N/A self __parent N/A __repr__ N/A N/A self N/A N/A N/A N/A <Mix %s> N/A str self N/A N/A ServiceValue N/A object N/A N/A  Abstract class for mixer values.  __init__ N/A N/A self scheme N/A None choices params N/A N/A N/A self scheme scheme N/A N/A self choices choices N/A N/A self params params N/A __call__ N/A N/A cls N/A args kwargs N/A N/A N/A cls args kwargs N/A classmethod gen_value N/A N/A self type_mixer name field N/A N/A N/A  Abstract method for value generation.  N/A NotImplementedError N/A N/A Field N/A ServiceValue N/A N/A  Set field values.

    By default the mixer generates random or fake a field values by types
    of them. But you can set some values by manual.

    ::

        # Generate a User model
        mixer.blend(User)

        # Generate with some values
        mixer.blend(User, name='John Connor')

    .. note:: Value may be a callable or instance of generator.

    ::

        # Value may be callable
        client = mixer.blend(Client, username=lambda:'callable_value')
        assert client.username == 'callable_value'

        # Value may be a generator
        clients = mixer.cycle(4).blend(
            Client, username=(name for name in ('Piter', 'John')))


    .. seealso:: :class:`mixer.main.Fake`, :class:`mixer.main.Random`,
                 :class:`mixer.main.Select`,
                 :meth:`mixer.main.Mixer.sequence`

     __init__ N/A N/A self scheme name N/A params N/A N/A N/A self name name N/A N/A N/A N/A super Field self __init__ scheme params N/A __deepcopy__ N/A N/A self memo N/A N/A N/A N/A Field N/A self scheme N/A self name N/A deepcopy N/A self params N/A gen_value N/A N/A self type_mixer name field N/A N/A N/A  Call :meth:`TypeMixer.gen_field`.

        :return value: A generated value

         N/A N/A N/A type_mixer gen_field field N/A N/A Fake N/A ServiceValue N/A N/A  Force a `fake` value.

    If you initialized a :class:`~mixer.main.Mixer` with `fake=False` you can
    force a `fake` value for field with this attribute (mixer.FAKE).

    ::

         mixer = Mixer(fake=False)
         user = mixer.blend(User)
         print user.name  # Some like: Fdjw4das

         user = mixer.blend(User, name=mixer.FAKE)
         print user.name  # Some like: Bob Marley

    You can setup a field type for generation of fake value: ::

         user = mixer.blend(User, score=mixer.FAKE(str))
         print user.score  # Some like: Bob Marley

    .. note:: This is also usefull on ORM model generation for filling a fields
              with default values (or null).

    ::

        from mixer.backend.django import mixer

        user = mixer.blend('auth.User', first_name=mixer.FAKE)
        print user.first_name  # Some like: John

     gen_value N/A N/A self type_mixer name fake N/A N/A N/A  Call :meth:`TypeMixer.gen_fake`.

        :return value: A generated value

         N/A N/A N/A type_mixer gen_fake name fake N/A N/A Random N/A ServiceValue N/A N/A  Force a `random` value.

    If you initialized a :class:`~mixer.main.Mixer` by default mixer try to
    fill fields with `fake` data. You can user `mixer.RANDOM` for prevent this
    behaviour for a custom fields.

    ::

         mixer = Mixer()
         user = mixer.blend(User)
         print user.name  # Some like: Bob Marley

         user = mixer.blend(User, name=mixer.RANDOM)
         print user.name  # Some like: Fdjw4das

    You can setup a field type for generation of fake value: ::

         user = mixer.blend(User, score=mixer.RANDOM(str))
         print user.score  # Some like: Fdjw4das

    Or you can get random value from choices: ::

        user = mixer.blend(User, name=mixer.RANDOM('john', 'mike'))
         print user.name  # mike or john

    .. note:: This is also usefull on ORM model generation for randomize fields
              with default values (or null).

    ::

        from mixer.backend.django import mixer

        mixer.blend('auth.User', first_name=mixer.RANDOM)
        print user.first_name  # Some like: Fdjw4das

     __init__ N/A N/A self scheme N/A None choices params N/A N/A N/A N/A N/A super Random self __init__ scheme choices params N/A N/A scheme None N/A N/A N/A self choices N/A scheme N/A gen_value N/A N/A self type_mixer name random N/A N/A N/A  Call :meth:`TypeMixer.gen_random`.

        :return value: A generated value

         N/A N/A N/A type_mixer gen_random name random N/A N/A Select N/A Random N/A N/A  Select values from database.

    When you generate some ORM models you can set value for related fields
    from database (select by random).

    Example for Django (select user from exists): ::

        from mixer.backend.django import mixer

        mixer.generate(Role, user=mixer.SELECT)


    You can setup a Django or SQLAlchemy filters with `mixer.SELECT`: ::

        from mixer.backend.django import mixer

        mixer.generate(Role, user=mixer.SELECT(
            username='test'
        ))

     gen_value N/A N/A self type_mixer name field N/A N/A N/A  Call :meth:`TypeMixer.gen_random`.

        :return value: A generated value

         N/A N/A N/A type_mixer gen_select name field N/A N/A _Deffered N/A object N/A N/A  A type which will be generated later.  __init__ N/A N/A self value scheme N/A None N/A N/A N/A self value value N/A N/A self scheme scheme N/A N/A