code: def models(
      model,  # type: Type[dm.Model]
      **field_strategies,  # type: Union[st.SearchStrategy[Any], DefaultValueType]
  ):
      # type: (...) -> st.SearchStrategy[Any]
      """Return a strategy for examples of ``model``.
  
      .. warning::
          Hypothesis creates saved models. This will run inside your testing
          transaction when using the test runner, but if you use the dev console
          this will leave debris in your database.
  
      ``model`` must be an subclass of :class:`~django:django.db.models.Model`.
      Strategies for fields may be passed as keyword arguments, for example
      ``is_staff=st.just(False)``.
  
      Hypothesis can often infer a strategy based the field type and validators
      - for best results, make sure your validators are derived from Django's
      and therefore have the known types and attributes.
      Passing a keyword argument skips inference for that field; pass a strategy
      or pass ``hypothesis.extra.django.models.default_value`` to skip
      inference for that field.
  
      Foreign keys are not automatically derived. If they're nullable they will
      default to always being null, otherwise you always have to specify them.
      For example, examples of a Shop type with a foreign key to Company could
      be generated with::
  
        shop_strategy = models(Shop, company=models(Company))
      """
      note_deprecation(
          "`hypothesis.extra.django.models.models` is deprecated; use `hypothesis.extra.django."
          "from_model` instead.",
          since="2019-01-10",
      )
      result = {}
      for k, v in field_strategies.items():
          if not isinstance(v, DefaultValueType):
              result[k] = v
      missed = []  # type: List[Text]
      for f in model._meta.concrete_fields:
          if not (
              f.name in field_strategies or isinstance(f, dm.AutoField)
          ):
              result[f.name] = from_field(f)
              if result[f.name].is_empty:
                  missed.append(f.name)
      if missed:
          raise InvalidArgument(
              "Missing arguments for mandatory field%s %s for model %s"
              % (
                  "s" if len(missed) > 1 else "",
                  ", ".join(missed),
                  model.__name__,
              )
          )
  
      for field in result:
          if model._meta.get_field(field).primary_key:
              # The primary key is generated as part of the strategy. We
              # want to find any existing row with this primary key and
              # overwrite its contents.
              kwargs = {field: result.pop(field)}
              kwargs["defaults"] = st.fixed_dictionaries(result)
              return _models_impl(
                  st.builds(model.objects.update_or_create, **kwargs)
              )
  
      # The primary key is not generated as part of the strategy, so we
      # just match against any row that has the same value for all
      # fields.
      return _models_impl(
          st.builds(model.objects.get_or_create, **result)
      )
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/extra/django/models.py
imports: from __future__ import absolute_import, division, print_function
  import django.db.models
  from django.db import IntegrityError
  import hypothesis.strategies._internal.core
  from hypothesis import reject
  from hypothesis._settings import note_deprecation
  from hypothesis.errors import InvalidArgument
  from hypothesis.extra.django import from_field, register_field_strategy
  from hypothesis.utils.conventions import DefaultValueType
label_desc: Use image node_id 2 for calling a global function with example usage: models(model) and returns: _models_impl, _models_impl