Build the keyword arguments required to instantiate the form.
557779
def get_form_kwargs(self):
        

        kwargs = {}
        for key in six.iterkeys(self.form_classes):
            if self.request.method in ('POST', 'PUT'):
                kwargs[key] = {
                    'data': self.request.POST,
                    'files': self.request.FILES,
                }
            else:
                kwargs[key] = {}
        return kwargs
1329898
def add_form(self, **kwargs):
        """"""
        vocabularies = kwargs.get('vocabularies', None)
        qualifier = kwargs.get('qualifier', None)
        content = kwargs.get('content', None)
        parent_tag = kwargs.get('parent_tag', None)
        superuser = kwargs.get('superuser', False)
        # Element has both the qualifier and content.
        if qualifier is not None and content is not None:
            # Create the form attribute.
            self.form = UNTL_FORM_DISPATCH[self.tag](
                vocabularies=vocabularies,
                qualifier_value=qualifier,
                input_value=content,
                untl_object=self,
                superuser=superuser,
            )
        # Element just has a qualifier.
        elif qualifier is not None:
            # Create the form attribute.
            self.form = UNTL_FORM_DISPATCH[self.tag](
                vocabularies=vocabularies,
                qualifier_value=qualifier,
                untl_object=self,
                superuser=superuser,
            )
        # Element just has content.
        elif content is not None:
            # If the element is a child element,
            # create the form attribute.
            if parent_tag is None:
                self.form = UNTL_FORM_DISPATCH[self.tag](
                    vocabularies=vocabularies,
                    input_value=content,
                    untl_object=self,
                    superuser=superuser,
                )
            else:
                # Create the form attribute.
                self.form = UNTL_FORM_DISPATCH[self.tag](
                    vocabularies=vocabularies,
                    input_value=content,
                    untl_object=self,
                    parent_tag=parent_tag,
                    superuser=superuser,
                )
        # Element has children and no qualifiers or content
        # or is blank (not originally in the UNTL record).
        else:
            # Element is a child element.
            if parent_tag is None:
                # Create the form attribute.
                self.form = UNTL_FORM_DISPATCH[self.tag](
                    vocabularies=vocabularies,
                    untl_object=self,
                    superuser=superuser,
                )
            else:
                # Create the form attribute.
                self.form = UNTL_FORM_DISPATCH[self.tag](
                    vocabularies=vocabularies,
                    untl_object=self,
                    parent_tag=parent_tag,
                    superuser=superuser,
                )
654170
protected function buildForm()
    {
        $this->form = Yii::createObject(array_merge([
            'scenario' => $this->scenario,
            'parent_id' => $this->parent_id,
            'parentTariff' => $this->parentTariff,
            'tariff' => $this->tariff,
        ], $this->getFormOptions()));
    }
372526
def get_form_kwargs(self, **kwargs):
        '''  '''
        kwargs = super(ClassRegistrationView, self).get_form_kwargs(**kwargs)
        kwargs['user'] = self.request.user if hasattr(self.request,'user') else None

        listing = self.get_listing()

        kwargs.update({
            'openEvents': listing['openEvents'],
            'closedEvents': listing['closedEvents'],
        })
        return kwargs
31018
public function buildForm()
    {

        $this
            ->add('range', 'datepicker',
                [
                    'label'      => trans('expendable::form.date'),
                    'validation' => 'required',
                    'range'      => true
                ])
            ->add('type', 'choice', [
                'choices'    => StaticLabel::typeExport(),
                'validation' => 'required',
                'label'      => trans('expendable::form.type')
            ])
            ->addDefaultActions();
    }
564663
def build_args(args)
      args.each do |arg|
        arg.each do |key, value|
          case key.to_s
          when 'query_params'
            @query_params = value
          when 'request_headers'
            update_headers(value)
          when 'request_body'
            @request_body = value
          end
        end
      end
    end
1158384
def get_form_kwargs(self, **kwargs):
        '''  '''
        kwargs = super(PrivateLessonStudentInfoView, self).get_form_kwargs(**kwargs)
        kwargs['request'] = self.request
        kwargs['payAtDoor'] = self.payAtDoor
        return kwargs
924861
def build(self, **kwargs):
        
        build_args = dict(self.where_query)
        build_args.update(kwargs)
        record = self.model(**record_args(build_args))
        if self.join_args:
            # EXAMPLE:
            # Say we have a many-to-many relation like so:
            #   Post -> Tagging -> Tag
            # If we are adding a tag to a post, we need to create the tagging
            # in addition to the tag. To do this, we add a "related record" to
            # the tag which is the tagging. By building the previous record,
            # if it exists, we can recursively build a long object tree.
            # That is, when we do post.tags(), we get a query that looks like:
            # Query(Tag).joins("taggings").where(taggings={"post_id":post.id})
            # The call to "build" then creates a tag using kwargs and the where
            # constraint, and creates a tagging that looks like:
            # Tagging(post_id = post.id) and adds it to the tag's related
            # records. The tagging's tag_id is added once the tag is saved
            # which is the first time it gets an id
            # Join args will never have just one element
            next_to_build = getattr(self.record, self.join_args[-2]['table']).build()
            record._related_records.append(next_to_build)
        return record
25823
def use_args(
        self,
        argmap: ArgMap,
        req: typing.Optional[Request] = None,
        locations: typing.Iterable = None,
        as_kwargs: bool = False,
        validate: Validate = None,
        error_status_code: typing.Optional[int] = None,
        error_headers: typing.Union[typing.Mapping[str, str], None] = None,
    ) -> typing.Callable[..., typing.Callable]:
        
        locations = locations or self.locations
        request_obj = req
        # Optimization: If argmap is passed as a dictionary, we only need
        # to generate a Schema once
        if isinstance(argmap, Mapping):
            argmap = core.dict2schema(argmap, self.schema_class)()

        def decorator(func: typing.Callable) -> typing.Callable:
            req_ = request_obj

            if inspect.iscoroutinefunction(func):

                @functools.wraps(func)
                async def wrapper(*args, **kwargs):
                    req_obj = req_

                    if not req_obj:
                        req_obj = self.get_request_from_view_args(func, args, kwargs)
                    # NOTE: At this point, argmap may be a Schema, callable, or dict
                    parsed_args = await self.parse(
                        argmap,
                        req=req_obj,
                        locations=locations,
                        validate=validate,
                        error_status_code=error_status_code,
                        error_headers=error_headers,
                    )
                    if as_kwargs:
                        kwargs.update(parsed_args or {})
                        return await func(*args, **kwargs)
                    else:
                        # Add parsed_args after other positional arguments
                        new_args = args + (parsed_args,)
                        return await func(*new_args, **kwargs)

            else:

                @functools.wraps(func)  # type: ignore
                def wrapper(*args, **kwargs):
                    req_obj = req_

                    if not req_obj:
                        req_obj = self.get_request_from_view_args(func, args, kwargs)
                    # NOTE: At this point, argmap may be a Schema, callable, or dict
                    parsed_args = yield from self.parse(  # type: ignore
                        argmap,
                        req=req_obj,
                        locations=locations,
                        validate=validate,
                        error_status_code=error_status_code,
                        error_headers=error_headers,
                    )
                    if as_kwargs:
                        kwargs.update(parsed_args)
                        return func(*args, **kwargs)  # noqa: B901
                    else:
                        # Add parsed_args after other positional arguments
                        new_args = args + (parsed_args,)
                        return func(*new_args, **kwargs)

            return wrapper

        return decorator
425996
def _build_arguments(self):
        
        # TODO: add tests to confirm deployments
        self._parser.add_argument(
            '-t', '--tag',
            required=False,
            type=six.text_type,
            default=None,
            help='This tag will override image tag provided in the configuration file.'
        )

        self._parser.add_argument(
            '-e', '--env',
            required=False,
            type=six.text_type,
            action='append',
            default=None,
            help='environment variables to create in the container at run time.'
        )
634330
def build_args():
    """"""
    parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('recipe', type=str, help="The recipe file to load and run.")
    parser.add_argument('-d', '--define', action="append", default=[], help="Set a free variable in the recipe")
    parser.add_argument('-l', '--loop', default=None, help="Loop over a free variable")
    parser.add_argument('-i', '--info', action='store_true', help="Lists out all the steps of that recipe, doesn't run the recipe steps")
    parser.add_argument('-a', '--archive', help="Archive the passed yaml recipe and do not run it")
    parser.add_argument('-c', '--config', default=None, help="A YAML config file with variable definitions")

    return parser
206388
def _preprocess_params(cls, kwargs):
        
        # kwargs.pop('csrf_token', None)
        for attr, val in kwargs.items():
            if cls.is_the_primary_key(attr) and cls._prevent_primary_key_initialization_:
                del kwargs[attr]
                continue
            if val == "":
                # Making an assumption that there is no good usecase
                # for setting an empty string. This will help prevent
                # cases where empty string is sent because of client
                # not clearing form fields to null
                kwargs[attr] = None
                continue
            if attr in class_mapper(cls).relationships and attr not in cls._no_overwrite_:
                rel = class_mapper(cls).relationships[attr]
                if rel.uselist:
                    if isinstance(val, list):
                        if all(isinstance(v, dict) for v in val):
                            rel_cls = cls.mapped_rel_class(attr)
                            kwargs[attr] = rel_cls.update_or_new_all(
                                list_of_kwargs=val, keys=[rel_cls.primary_key_name()])
                    elif isinstance(val, dict):
                        rel_cls = cls.mapped_rel_class(attr)
                        mapping_col = rel.collection_class().keyfunc.name
                        list_of_kwargs = [merge(v, {mapping_col: k}) for k, v in val.items()]
                        kwargs[attr] = {getattr(obj, mapping_col): obj for obj in rel_cls.update_or_new_all(
                            list_of_kwargs=list_of_kwargs, keys=[rel_cls.primary_key_name()])}
                elif isinstance(val, dict):
                    rel_cls = cls.mapped_rel_class(attr)
                    kwargs[attr] = rel_cls.update_or_new(
                        **merge(val, {'keys': [rel_cls.primary_key_name()]}))
        return kwargs
1920
def make_request(self, method, *args, **kwargs):
    """"""
    if args and not use_signature:
        raise NotImplementedError("Only keyword arguments allowed in Python2")

    new_kwargs = {kw: unwrap(value) for kw, value in kwargs.items()}

    if use_signature:
        new_args = tuple(unwrap(value) for value in args)
        bound_args = method.signature.bind(
            unwrap(self), *new_args, **new_kwargs).arguments

        # if we encounter any Enum arguments, replace them with their value
        def translate_enum(arg):
            return arg.value if isinstance(arg, Enum) else arg

        for k in bound_args:
            if isinstance(bound_args[k], str):
                continue
            if isinstance(bound_args[k], dict):
                continue

            try:
                x = [translate_enum(arg) for arg in bound_args[k]]
                bound_args[k] = x
            except TypeError:
                bound_args[k] = translate_enum(bound_args[k])

        # replace `self` with the correct keyword
        new_kwargs = {(kw if kw != 'self' else method.field_name): v
                      for kw, v in bound_args.items()}
        # args = tuple(x.value if isinstance(x, Enum) else x for x in args)

    else:
        new_kwargs[self.field_name] = unwrap(self)

    return method.request_type(**new_kwargs)
857463
def get_form(self, **kwargs):
        """"""
        if not hasattr(self, "form_class"):
            raise AttributeError(_("You must define a form_class"))
        return self.form_class(**kwargs)
615040
def init_form(self, form_data, widget_attrs=None, template=None):
        """"""
        form = self.form(data=form_data)
        form.template = template
        # Attach flow attribute to have access from flow forms (usually to call get_arg_or_attr())
        form.flow = self
        if widget_attrs is not None:
            set_form_widgets_attrs(form, widget_attrs)
        return form
1260612
def setup_parameters(self):
        """"""
        t = self.template
        parameters = self.get_parameter_definitions()

        if not parameters:
            logger.debug("No parameters defined.")
            return

        for name, attrs in parameters.items():
            p = build_parameter(name, attrs)
            t.add_parameter(p)
588396
def get_form_kwargs(self):
        
        kwargs = super(SmartFormMixin, self).get_form_kwargs()
        kwargs['initial'] = self.derive_initial()
        return kwargs