コード例 #1
0
ファイル: coder_impl.py プロジェクト: dhalperi/incubator-beam
  def get_estimated_size_and_observables(self, value, nested=False):
    if isinstance(value, observable.ObservableMixin):
      # FastPrimitivesCoderImpl can presumably encode the elements too.
      return 1, [(value, self)]

    out = ByteCountingOutputStream()
    self.encode_to_stream(value, out, nested)
    return out.get_count(), []
コード例 #2
0
 def get_estimated_size_and_observables(self, value, nested=False):
     if isinstance(value, observable.ObservableMixin):
         # FastPrimitivesCoderImpl can presumably encode the elements too.
         return 1, [(value, self)]
     else:
         out = ByteCountingOutputStream()
         self.encode_to_stream(value, out, nested)
         return out.get_count(), []
コード例 #3
0
ファイル: coder_impl.py プロジェクト: dhalperi/incubator-beam
 def estimate_size(self, value, nested=False):
   """Estimates the encoded size of the given value, in bytes."""
   out = ByteCountingOutputStream()
   self.encode_to_stream(value, out, nested)
   return out.get_count()
コード例 #4
0
 def estimate_size(self, value, nested=False):
     """Estimates the encoded size of the given value, in bytes."""
     out = ByteCountingOutputStream()
     self.encode_to_stream(value, out, nested)
     return out.get_count()