Include any 'extra_kwargs' that have been included for this field,
        possibly removing any incompatible existing keyword arguments.
19241
def include_extra_kwargs(self, kwargs, extra_kwargs):
        
        if extra_kwargs.get('read_only', False):
            for attr in [
                'required', 'default', 'allow_blank', 'allow_null',
                'min_length', 'max_length', 'min_value', 'max_value',
                'validators', 'queryset'
            ]:
                kwargs.pop(attr, None)

        if extra_kwargs.get('default') and kwargs.get('required') is False:
            kwargs.pop('required')

        if extra_kwargs.get('read_only', kwargs.get('read_only', False)):
            extra_kwargs.pop('required', None)  # Read only fields should always omit the 'required' argument.

        kwargs.update(extra_kwargs)

        return kwargs
597155
def extra_create_kwargs(self):
        
        user = self.get_agnocomplete_context()
        if user:
            _, domain = user.email.split('@')
            return {
                'domain': domain
            }
        return {}
1113193
def add_params(self, **kw):
        
        for k, v in kw.items():
            if k not in self.params:
                raise ValidationError(
                    '"%s" is not a valid parameter for %s'
                    % (k, self.__class__.__name__))
            self.params[k].validate(v)

        self._orig_kwargs.update(kw)
        self.kwargs = self._orig_kwargs.copy()
382421
def _attach_params(self, params, **kwargs):
        
        lst = params.to_list() if isinstance(params, ParameterSet) else params
        for param in lst:
            param._bundle = self

            for k, v in kwargs.items():
                # Here we'll set the attributes (_context, _qualifier, etc)
                if getattr(param, '_{}'.format(k)) is None:
                    setattr(param, '_{}'.format(k), v)
            self._params.append(param)

        self._check_copy_for()

        return
555207
def add_aliases(self_or_cls, **kwargs):
        
        self_or_cls.aliases.update({v:k for k,v in kwargs.items()})
610543
def add_args_kwargs(func):
    

    @wraps(func)
    def wrapper(*args, **kwargs):

        props = argspec(func)

        # if 'args' not in props:
        if isinstance(props[1], type(None)):

            args = args[:len(props[0])]

        if ((not isinstance(props[2], type(None))) or
                (not isinstance(props[3], type(None)))):

            return func(*args, **kwargs)

        else:

            return func(*args)

    return wrapper
541483
def full_clean(self, *args, **kwargs):
        
        super().full_clean(*args, **kwargs)
        for field in self.errors:
            if field != NON_FIELD_ERRORS:
                self.apply_widget_invalid_options(field)
847861
def get_uniqueness_extra_kwargs(self, field_names, declared_fields, extra_kwargs):
        
        model = getattr(self.Meta, 'model')
        model_fields = self._get_model_fields(
            field_names, declared_fields, extra_kwargs
        )

        # Determine if we need any additional `HiddenField` or extra keyword
        # arguments to deal with `unique_for` dates that are required to
        # be in the input data in order to validate it.
        unique_constraint_names = set()

        for model_field in model_fields.values():
            # Include each of the `unique_for_*` field names.
            unique_constraint_names |= {model_field.unique_for_date, model_field.unique_for_month,
                                        model_field.unique_for_year}

        unique_constraint_names -= {None}

        # Include each of the `unique_together` field names,
        # so long as all the field names are included on the serializer.
        for parent_class in [model] + list(model._meta.parents.keys()):
            for unique_together_list in parent_class._meta.unique_together:
                if set(field_names).issuperset(set(unique_together_list)):
                    unique_constraint_names |= set(unique_together_list)

        # Now we have all the field names that have uniqueness constraints
        # applied, we can add the extra 'required=...' or 'default=...'
        # arguments that are appropriate to these fields, or add a `HiddenField` for it.
        hidden_fields = {}
        uniqueness_extra_kwargs = {}

        for unique_constraint_name in unique_constraint_names:
            # Get the model field that is referred too.
            unique_constraint_field = model._meta.get_field(unique_constraint_name)

            if getattr(unique_constraint_field, 'auto_now_add', None):
                default = CreateOnlyDefault(timezone.now)
            elif getattr(unique_constraint_field, 'auto_now', None):
                default = timezone.now
            elif unique_constraint_field.has_default():
                default = unique_constraint_field.default
            else:
                default = empty

            if unique_constraint_name in model_fields:
                # The corresponding field is present in the serializer
                if default is empty:
                    uniqueness_extra_kwargs[unique_constraint_name] = {'required': True}
                else:
                    uniqueness_extra_kwargs[unique_constraint_name] = {'default': default}
            elif default is not empty:
                # The corresponding field is not present in the,
                # serializer. We have a default to use for it, so
                # add in a hidden field that populates it.
                hidden_fields[unique_constraint_name] = HiddenField(default=default)

        # Update `extra_kwargs` with any new options.
        for key, value in uniqueness_extra_kwargs.items():
            if key in extra_kwargs:
                extra_kwargs[key].update(value)
            else:
                extra_kwargs[key] = value

        return extra_kwargs, hidden_fields
486581
def p_kw_args_update(self, p):
        """"""
        p[0] = p[1]
        for key in p[3]:
            if key in p[1]:
                msg = "Keyword argument '%s' defined more than once." % key
                self.errors.append((msg, p.lineno(2), self.path))
        p[0].update(p[3])
528326
def extra(self):
        
        return dict([(key, val) for key, val in
                     self._dict.items() if key not in self.c_param])
500690
def update_kwargs(self, kwargs, count, offset):
        
        kwargs.update({self.count_key: count, self.offset_key: offset})
        return kwargs
162836
def kwargs(self):
        """"""
        # Subclasses must override this property if and only if they define
        # keyword-only arguments in their __init__ method
        if hasattr(self, '_has_kwargs') and self._has_kwargs:
            raise NotImplementedError(
                "Class %s does not provide a kwargs property"
                % str(self.__class__.__name__))
        return {}
792586
def _preprocess_kwargs(self, initial_kwargs):
        
        kwargs = initial_kwargs.copy()
        generic_key_related_kwargs = self._get_generic_key_related_kwargs(initial_kwargs)
        for key, value in generic_key_related_kwargs.items():
            # delete old kwarg that was related to generic key
            del kwargs[key]
            try:
                suffix = key.split('__')[1]
            except IndexError:
                suffix = None
            # add new kwargs that related to object_id and content_type fields
            new_kwargs = self._get_filter_object_id_and_content_type_filter_kwargs(value, suffix)
            kwargs.update(new_kwargs)

        return kwargs
1110662
def add_embed_field(self, **kwargs):
        
        self.fields.append({
            'name': kwargs.get('name'),
            'value': kwargs.get('value'),
            'inline': kwargs.get('inline', True)
        })
166289
def __fix_args(kwargs):
    
    kwargs.setdefault('fixed_strings', kwargs.get('F'))
    kwargs.setdefault('basic_regexp', kwargs.get('G'))
    kwargs.setdefault('extended_regexp', kwargs.get('E'))
    kwargs.setdefault('ignore_case', kwargs.get('i'))
    kwargs.setdefault('invert', kwargs.get('v'))
    kwargs.setdefault('words', kwargs.get('w'))
    kwargs.setdefault('line', kwargs.get('x'))
    kwargs.setdefault('count', kwargs.get('c'))
    kwargs.setdefault('max_count', kwargs.get('m'))
    kwargs.setdefault('after_context', kwargs.get('A'))
    kwargs.setdefault('before_context', kwargs.get('B'))
    kwargs.setdefault('quiet', kwargs.get('q'))
    kwargs.setdefault('byte_offset', kwargs.get('b'))
    kwargs.setdefault('only_matching', kwargs.get('o'))
    kwargs.setdefault('line_number', kwargs.get('n'))
    kwargs.setdefault('regex_flags', kwargs.get('r'))
    kwargs.setdefault('keep_eol', kwargs.get('k'))
    kwargs.setdefault('trim', kwargs.get('t'))
725353
def add_argument(self, *args, **kwargs):
        

        if len(args) == 1 and isinstance(args[0], self.argument_class):
            self.args.append(args[0])
        else:
            self.args.append(self.argument_class(*args, **kwargs))

        # Do not know what other argument classes are out there
        if self.trim and self.argument_class is Argument:
            # enable trim for appended element
            self.args[-1].trim = kwargs.get('trim', self.trim)

        return self
537759
def include(_name_or_func, *args,
            _module=None, _default='includeme', **kwargs):
    
    if callable(_name_or_func):
        resolved = _name_or_func
    else:
        resolved = resolve_str(_name_or_func, _module, _default)

    resolved(*args, **kwargs)