Parse a raw dictionary to create a resource.

        :type raw: Dict[str, Any]
7967
def _parse_raw(self, raw):
        
        self.raw = raw
        if not raw:
            raise NotImplementedError("We cannot instantiate empty resources: %s" % raw)
        dict2resource(raw, self, self._options, self._session)
1081806
def raw(self, from_, to, body):
        
        if isinstance(to, string_types):
            raise TypeError('"to" parameter must be enumerable')
        return self._session.post('{}/raw'.format(self._url), json={
            'from': from_,
            'to': to,
            'body': body,
        }).json()
274122
def _parse_resource(self, resource):
        

        link = 'jsonapi.org/format/#document-resource-objects'
        rid = isinstance(resource.get('id'), unicode)
        rtype = isinstance(resource.get('type'), unicode)

        if not rtype or (self.req.is_patching and not rid):
            self.fail('JSON API requires that every resource object MUST '
                      'contain a `type` top-level key. Additionally, when '
                      'modifying an existing resource object an `id` '
                      'top-level key is required. The values of both keys '
                      'MUST be strings. Your request did not comply with '
                      'one or more of these 3 rules', link)
        elif 'attributes' not in resource and 'relationships' not in resource:
            self.fail('Modifiying or creating resources require at minimum '
                      'an attributes object and/or relationship object.', link)
        elif rid and self.req.is_posting:
            abort(exceptions.ModificationDenied(**{
                'detail': 'Our API does not support client-generated ID\'s '
                          'when creating NEW resources. Instead, our API '
                          'will generate one for you & return it in the '
                          'response.',
                'links': 'jsonapi.org/format/#crud-creating-client-ids',
            }))
530412
def parse(self, content):
        
        raw = {}

        try:
            root = etree.fromstring(content)
        except SyntaxError as e:
            raise ValueError(*e.args)

        for child in root:
            raw[child.tag] = child.text

        formatted = self.format(raw)

        msg_type = formatted['type']
        msg_parser = getattr(self, 'parse_%s' % msg_type, None)
        if callable(msg_parser):
            parsed = msg_parser(raw)
        else:
            parsed = self.parse_invalid_type(raw)

        formatted.update(parsed)
        return formatted
1206389
def from_raw(self, raw: RawScalar) -> Optional[ScalarValue]:
        
        if isinstance(raw, str):
            return raw
361138
def parseURIRaw(str, raw):
    
    ret = libxml2mod.xmlParseURIRaw(str, raw)
    if ret is None:raise uriError('xmlParseURIRaw() failed')
    return URI(_obj=ret)
1259346
def raw_value(self) -> typing.Optional[object]:
        
        raw_value = self._from_environ()
        if raw_value is None:
            raw_value = self._from_config_file()
        if raw_value is None:
            raw_value = self._from_default()
        return raw_value
1214649
def format_raw_data(self, tpe, raw_data):
        
        
        if tpe == 'text':
            formatted_raw_data = self.parse_text_to_dict(raw_data)
        elif tpe == 'file':
            formatted_raw_data = self.parse_file_to_dict(raw_data)
        else:
            formatted_raw_data = {'ERROR':'unknown data type', 'data':[raw_data]}
        return formatted_raw_data
495072
def rm_raw(ctx, dataset, kwargs):
    ""

    kwargs = parse_kwargs(kwargs)
    data(dataset, **ctx.obj).rm_raw(**kwargs)
588727
def _parse_json(cls, resources, exactly_one=True):
        
        if not len(resources['features']):  # pragma: no cover
            return None
        if exactly_one:
            return cls.parse_resource(resources['features'][0])
        else:
            return [cls.parse_resource(resource) for resource
                    in resources['features']]
813625
def get_raw_values(self, pydict, recovery_name=True):
        
        new_dict = {"id": pydict["id"]}
        for field in self:
            raw_key = "%s_raw" % field.key
            if raw_key in pydict:
                if recovery_name:
                    new_dict[field.name] = pydict[raw_key]
                else:
                    new_dict[field.key] = pydict[raw_key]
        return new_dict
908170
def parse(self):
        
        (options, args) = self.parser.parse_args()
        self._set_attributes(args, options)
        return self._create_dictionary()
785963
def raw(self) -> str:
        
        doc = """Version: {0}
Type: Peer
Currency: {1}
PublicKey: {2}
Block: {3}
Endpoints:
""".format(self.version, self.currency, self.pubkey, self.blockUID)

        for _endpoint in self.endpoints:
            doc += "{0}\n".format(_endpoint.inline())

        return doc
211612
def parse(self, *args):
        

        if isinstance(self.dictionary, dict):
            return self.dictionary

        raise self.subparserException("Argument passed to Dictionary SubParser is not a dict: %s" % type(self.dictionary))
199129
def to_raw(self, value, context=None):
        """"""
        if value is None:
            return None
        res = {}
        value = value.copy()
        errors = []
        for field in list(set(value) & set(self._fields)):
            schema = self._fields.get(field)
            name = schema.get_attr('name', field)
            try:
                res[name] = \
                    schema.to_raw(value.pop(field), context=context)
            except exceptions.ValidationErrors as ex:
                self._update_errors_by_exception(errors, ex, name)

        self._raise_exception_when_errors(errors, value)
        res.update(value)
        return res
1009843
def _load_raw_data(self, resource_name):
        
        # Instantiating the resource again as a simple `Resource` ensures that
        # ``data`` will be returned as bytes.
        upcast_resource = datapackage.Resource(
            self.__resources[resource_name].descriptor,
            default_base_path=self.__base_path)
        return upcast_resource.data
562298
def _deserialize_default(cls, cls_target, obj_raw):
        

        if cls._is_deserialized(cls_target, obj_raw):
            return obj_raw
        elif type(obj_raw) == dict:
            return cls._deserialize_dict(cls_target, obj_raw)
        else:
            return cls_target(obj_raw)