MCPcopy Index your code
hub / github.com/apache/dubbo-python2 / _encode_single_value

Method _encode_single_value

dubbo/codec/encoder.py:383–411  ·  view source on GitHub ↗

根据hessian协议对单个变量进行编码 :param value: :return:

(self, value)

Source from the content-addressed store, hash-verified

381 return result
382
383 def _encode_single_value(self, value):
384 """
385 根据hessian协议对单个变量进行编码
386 :param value:
387 :return:
388 """
389 # 布尔类型
390 if isinstance(value, bool):
391 return self._encode_bool(value)
392 # 整型(包括长整型)
393 elif isinstance(value, int):
394 return self._encode_int(value)
395 # 浮点类型
396 elif isinstance(value, float):
397 return self._encode_float(value)
398 # 字符串类型
399 elif isinstance(value, (str, unicode)):
400 return self._encode_str(value)
401 # 对象类型
402 elif isinstance(value, Object):
403 return self._encode_object(value)
404 # 列表(list)类型,不可以使用tuple替代
405 elif isinstance(value, list):
406 return self._encode_list(value)
407 # null
408 elif value is None:
409 return [ord('N')]
410 else:
411 raise HessianTypeError('Unknown argument type: {}'.format(value))
412
413
414def get_request_body_length(body):

Callers 3

_encode_request_bodyMethod · 0.95
_encode_objectMethod · 0.95
_encode_listMethod · 0.95

Calls 8

_encode_boolMethod · 0.95
_encode_intMethod · 0.95
_encode_floatMethod · 0.95
_encode_strMethod · 0.95
_encode_objectMethod · 0.95
_encode_listMethod · 0.95
HessianTypeErrorClass · 0.90
formatMethod · 0.80

Tested by

no test coverage detected