Ejemplo n.º 1
0
 def from_json_str(cls, json_str: str, primitive_cls: Type[Time],
                   context: _primitive_wrappers.Context) -> 'TimeWrapper':
     """See PrimitiveWrapper.from_json_str."""
     _primitive_wrappers.validate_primitive_json_representation(
         primitive_cls.DESCRIPTOR, json_str)
     time = _parse(json_str, primitive_cls)
     return cls(time, context)
Ejemplo n.º 2
0
 def from_json_str(cls, json_str: str, primitive_cls: Type[message.Message],
                   context: _primitive_wrappers.Context) -> 'DateWrapper':
   """See _primitive_wrappers.PrimitiveWrapper.from_json_str."""
   _primitive_wrappers.validate_primitive_json_representation(
       primitive_cls.DESCRIPTOR, json_str)
   date = _parse(
       json_str, primitive_cls, default_timezone=context.default_timezone)
   return cls(date, context)
Ejemplo n.º 3
0
 def from_json_str(
         cls, json_str: str, primitive_cls: Type[Decimal],
         context: _primitive_wrappers.Context) -> 'DecimalWrapper':
     """See _primitive_wrappers.PrimitiveWrapper.from_json_str."""
     _primitive_wrappers.validate_primitive_json_representation(
         primitive_cls.DESCRIPTOR, json_str)
     decimal_ = _parse(json_str, primitive_cls)
     return cls(decimal_, context)
Ejemplo n.º 4
0
 def from_json_str(
         cls, json_str: str, primitive_cls: Type[Instant],
         context: _primitive_wrappers.Context) -> 'InstantWrapper':
     """See PrimitiveWrapper.from_json_str."""
     _primitive_wrappers.validate_primitive_json_representation(
         primitive_cls.DESCRIPTOR, json_str)
     instant = _parse(json_str, primitive_cls)
     return cls(instant, context)
Ejemplo n.º 5
0
 def from_json_str(
     cls, json_str: str, primitive_cls: Type[Base64Binary],
     context: _primitive_wrappers.Context) -> 'Base64BinaryWrapper':
   """See _primitive_wrappers.PrimitiveWrapper.from_json_str."""
   _primitive_wrappers.validate_primitive_json_representation(
       primitive_cls.DESCRIPTOR, json_str)
   base64_binary = _parse(
       json_str,
       primitive_cls,
       separator_stride_cls=context.separator_stride_cls)
   return cls(base64_binary, context)