Wrap submitted data within an extra dict.
183977
def update_payload(self, fields=None):
        """"""
        org_payload = super(Organization, self).update_payload(fields)
        payload = {u'organization': org_payload}
        if 'redhat_repository_url' in org_payload:
            rh_repo_url = org_payload.pop('redhat_repository_url')
            payload['redhat_repository_url'] = rh_repo_url
        return payload
1183065
def _prepend_name(self, prefix, dict_):
        ''''''
        return dict(['.'.join([prefix, name]), msg]
                    for name, msg in dict_.iteritems())
709561
def _wrap_data(data: Union[str, bytes]):
        
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        return MsgType(data=data, frame_finished=True, message_finished=True)
516154
def __wrap_with_tuple(self) -> tuple:
        """"""
        l = list()
        length = len(self.data)
        while self.idx < length:
            l.append(self.__parse())
        return tuple(l)
167944
def submit(self):
        """"""
        self._newflg = False
        ret = list()
        for buf in self._buffer.values():
            buf = copy.deepcopy(buf)
            if self._fdpext:
                buf['fpout'] = f"{self._fproot}/{buf['label']}.{self._fdpext}"
            else:
                del buf['fpout']
            buf['index'] = tuple(buf['index'])
            ret.append(Info(buf))
        ret += self._stream
        return tuple(ret)
574333
def wrap(cls, value):
        ''' 

        '''
        if isinstance(value, dict):
            if isinstance(value, PropertyValueDict):
                return value
            else:
                return PropertyValueDict(value)
        else:
            return value
327298
def _add_post_data(self, request: Request):
        ''''''
        if self._item_session.url_record.post_data:
            data = wpull.string.to_bytes(self._item_session.url_record.post_data)
        else:
            data = wpull.string.to_bytes(
                self._processor.fetch_params.post_data
            )

        request.method = 'POST'
        request.fields['Content-Type'] = 'application/x-www-form-urlencoded'
        request.fields['Content-Length'] = str(len(data))

        _logger.debug('Posting with data {0}.', data)

        if not request.body:
            request.body = Body(io.BytesIO())

        with wpull.util.reset_file_offset(request.body):
            request.body.write(data)
1337420
def extra_context(self, request, context):
        """"""
        if settings.PAGE_EXTRA_CONTEXT:
            context.update(settings.PAGE_EXTRA_CONTEXT())
417900
def json_post(methodname, rtype, key):
    """"""
    return compose(
        reusable,
        map_return(registry(rtype), itemgetter(key)),
        basic_interaction,
        map_yield(partial(_json_as_post, methodname)),
        oneyield,
    )
634823
def wrap_options(self, data, renderer_context):
        ''''''
        request = renderer_context.get("request", None)
        method = request and getattr(request, 'method')
        if method != 'OPTIONS':
            raise WrapperNotApplicable("Request method must be OPTIONS")

        wrapper = self.dict_class()
        wrapper["meta"] = data
        return wrapper
731742
def _wrap_result(data, columns, index_col=None, coerce_float=True,
                 parse_dates=None):
    """"""

    frame = DataFrame.from_records(data, columns=columns,
                                   coerce_float=coerce_float)

    frame = _parse_date_columns(frame, parse_dates)

    if index_col is not None:
        frame.set_index(index_col, inplace=True)

    return frame
5212
def wrap_submit(submit_func):
    """"""

    def call(self, func, *args, **kwargs):
        wrapped_func = wrap_task_func(func)
        _tracer = execution_context.get_opencensus_tracer()
        propagator = binary_format.BinaryFormatPropagator()

        wrapped_kwargs = {}
        wrapped_kwargs["span_context_binary"] = propagator.to_header(
            _tracer.span_context
        )
        wrapped_kwargs["kwds"] = kwargs
        wrapped_kwargs["sampler"] = _tracer.sampler
        wrapped_kwargs["exporter"] = _tracer.exporter
        wrapped_kwargs["propagator"] = _tracer.propagator

        return submit_func(self, wrapped_func, *args, **wrapped_kwargs)

    return call
935874
def append(self, request, response):
        """"""
        request = self._before_record_request(request)
        if not request:
            return
        # Deepcopy is here because mutation of `response` will corrupt the
        # real response.
        response = copy.deepcopy(response)
        response = self._before_record_response(response)
        if response is None:
            return
        self.data.append((request, response))
        self.dirty = True
401611
def wrap(self, value):
        ''' 
        '''
        self.validate_wrap(value)
        ret = []
        for field, value in izip(self.types, value):
            ret.append(field.wrap(value))
        return ret
108222
def fetch_extra_data(resource):
    """"""
    person_id = resource.get('PersonID', [None])[0]
    identity_class = resource.get('IdentityClass', [None])[0]
    department = resource.get('Department', [None])[0]

    return dict(
        person_id=person_id,
        identity_class=identity_class,
        department=department
    )
1145315
def _wrap_result(name, data, sparse_index, fill_value, dtype=None):
    
    if name.startswith('__'):
        # e.g. __eq__ --> eq
        name = name[2:-2]

    if name in ('eq', 'ne', 'lt', 'gt', 'le', 'ge'):
        dtype = np.bool

    fill_value = lib.item_from_zerodim(fill_value)

    if is_bool_dtype(dtype):
        # fill_value may be np.bool_
        fill_value = bool(fill_value)
    return SparseArray(data,
                       sparse_index=sparse_index,
                       fill_value=fill_value,
                       dtype=dtype)
10421
def submit(self, value):
    """"""
    # Add a batch dimension if necessary.
    if value.shape.ndims == self._sum.shape.ndims:
      value = value[None, ...]
    return tf.group(
        self._sum.assign_add(tf.reduce_sum(value, 0)),
        self._count.assign_add(tf.shape(value)[0]))