27 UNSPECIFIED_ERROR = 1 |
27 UNSPECIFIED_ERROR = 1 |
28 BAD_TRANSFORM_DATA = 2 |
28 BAD_TRANSFORM_DATA = 2 |
29 NOT_IMAGE = 3 |
29 NOT_IMAGE = 3 |
30 BAD_IMAGE_DATA = 4 |
30 BAD_IMAGE_DATA = 4 |
31 IMAGE_TOO_LARGE = 5 |
31 IMAGE_TOO_LARGE = 5 |
|
32 INVALID_BLOB_KEY = 6 |
32 |
33 |
33 _ErrorCode_NAMES = { |
34 _ErrorCode_NAMES = { |
34 1: "UNSPECIFIED_ERROR", |
35 1: "UNSPECIFIED_ERROR", |
35 2: "BAD_TRANSFORM_DATA", |
36 2: "BAD_TRANSFORM_DATA", |
36 3: "NOT_IMAGE", |
37 3: "NOT_IMAGE", |
37 4: "BAD_IMAGE_DATA", |
38 4: "BAD_IMAGE_DATA", |
38 5: "IMAGE_TOO_LARGE", |
39 5: "IMAGE_TOO_LARGE", |
|
40 6: "INVALID_BLOB_KEY", |
39 } |
41 } |
40 |
42 |
41 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "") |
43 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "") |
42 ErrorCode_Name = classmethod(ErrorCode_Name) |
44 ErrorCode_Name = classmethod(ErrorCode_Name) |
43 |
45 |
520 _STYLE = """""" |
522 _STYLE = """""" |
521 _STYLE_CONTENT_TYPE = """""" |
523 _STYLE_CONTENT_TYPE = """""" |
522 class ImageData(ProtocolBuffer.ProtocolMessage): |
524 class ImageData(ProtocolBuffer.ProtocolMessage): |
523 has_content_ = 0 |
525 has_content_ = 0 |
524 content_ = "" |
526 content_ = "" |
|
527 has_blob_key_ = 0 |
|
528 blob_key_ = "" |
525 |
529 |
526 def __init__(self, contents=None): |
530 def __init__(self, contents=None): |
527 if contents is not None: self.MergeFromString(contents) |
531 if contents is not None: self.MergeFromString(contents) |
528 |
532 |
529 def content(self): return self.content_ |
533 def content(self): return self.content_ |
537 self.has_content_ = 0 |
541 self.has_content_ = 0 |
538 self.content_ = "" |
542 self.content_ = "" |
539 |
543 |
540 def has_content(self): return self.has_content_ |
544 def has_content(self): return self.has_content_ |
541 |
545 |
|
546 def blob_key(self): return self.blob_key_ |
|
547 |
|
548 def set_blob_key(self, x): |
|
549 self.has_blob_key_ = 1 |
|
550 self.blob_key_ = x |
|
551 |
|
552 def clear_blob_key(self): |
|
553 if self.has_blob_key_: |
|
554 self.has_blob_key_ = 0 |
|
555 self.blob_key_ = "" |
|
556 |
|
557 def has_blob_key(self): return self.has_blob_key_ |
|
558 |
542 |
559 |
543 def MergeFrom(self, x): |
560 def MergeFrom(self, x): |
544 assert x is not self |
561 assert x is not self |
545 if (x.has_content()): self.set_content(x.content()) |
562 if (x.has_content()): self.set_content(x.content()) |
|
563 if (x.has_blob_key()): self.set_blob_key(x.blob_key()) |
546 |
564 |
547 def Equals(self, x): |
565 def Equals(self, x): |
548 if x is self: return 1 |
566 if x is self: return 1 |
549 if self.has_content_ != x.has_content_: return 0 |
567 if self.has_content_ != x.has_content_: return 0 |
550 if self.has_content_ and self.content_ != x.content_: return 0 |
568 if self.has_content_ and self.content_ != x.content_: return 0 |
|
569 if self.has_blob_key_ != x.has_blob_key_: return 0 |
|
570 if self.has_blob_key_ and self.blob_key_ != x.blob_key_: return 0 |
551 return 1 |
571 return 1 |
552 |
572 |
553 def IsInitialized(self, debug_strs=None): |
573 def IsInitialized(self, debug_strs=None): |
554 initialized = 1 |
574 initialized = 1 |
555 if (not self.has_content_): |
575 if (not self.has_content_): |
559 return initialized |
579 return initialized |
560 |
580 |
561 def ByteSize(self): |
581 def ByteSize(self): |
562 n = 0 |
582 n = 0 |
563 n += self.lengthString(len(self.content_)) |
583 n += self.lengthString(len(self.content_)) |
|
584 if (self.has_blob_key_): n += 1 + self.lengthString(len(self.blob_key_)) |
564 return n + 1 |
585 return n + 1 |
565 |
586 |
566 def Clear(self): |
587 def Clear(self): |
567 self.clear_content() |
588 self.clear_content() |
|
589 self.clear_blob_key() |
568 |
590 |
569 def OutputUnchecked(self, out): |
591 def OutputUnchecked(self, out): |
570 out.putVarInt32(10) |
592 out.putVarInt32(10) |
571 out.putPrefixedString(self.content_) |
593 out.putPrefixedString(self.content_) |
|
594 if (self.has_blob_key_): |
|
595 out.putVarInt32(18) |
|
596 out.putPrefixedString(self.blob_key_) |
572 |
597 |
573 def TryMerge(self, d): |
598 def TryMerge(self, d): |
574 while d.avail() > 0: |
599 while d.avail() > 0: |
575 tt = d.getVarInt32() |
600 tt = d.getVarInt32() |
576 if tt == 10: |
601 if tt == 10: |
577 self.set_content(d.getPrefixedString()) |
602 self.set_content(d.getPrefixedString()) |
578 continue |
603 continue |
|
604 if tt == 18: |
|
605 self.set_blob_key(d.getPrefixedString()) |
|
606 continue |
579 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
607 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
580 d.skipData(tt) |
608 d.skipData(tt) |
581 |
609 |
582 |
610 |
583 def __str__(self, prefix="", printElemNumber=0): |
611 def __str__(self, prefix="", printElemNumber=0): |
584 res="" |
612 res="" |
585 if self.has_content_: res+=prefix+("content: %s\n" % self.DebugFormatString(self.content_)) |
613 if self.has_content_: res+=prefix+("content: %s\n" % self.DebugFormatString(self.content_)) |
|
614 if self.has_blob_key_: res+=prefix+("blob_key: %s\n" % self.DebugFormatString(self.blob_key_)) |
586 return res |
615 return res |
587 |
616 |
588 |
617 |
589 def _BuildTagLookupTable(sparse, maxtag, default=None): |
618 def _BuildTagLookupTable(sparse, maxtag, default=None): |
590 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
619 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
591 |
620 |
592 kcontent = 1 |
621 kcontent = 1 |
|
622 kblob_key = 2 |
593 |
623 |
594 _TEXT = _BuildTagLookupTable({ |
624 _TEXT = _BuildTagLookupTable({ |
595 0: "ErrorCode", |
625 0: "ErrorCode", |
596 1: "content", |
626 1: "content", |
597 }, 1) |
627 2: "blob_key", |
|
628 }, 2) |
598 |
629 |
599 _TYPES = _BuildTagLookupTable({ |
630 _TYPES = _BuildTagLookupTable({ |
600 0: ProtocolBuffer.Encoder.NUMERIC, |
631 0: ProtocolBuffer.Encoder.NUMERIC, |
601 1: ProtocolBuffer.Encoder.STRING, |
632 1: ProtocolBuffer.Encoder.STRING, |
602 }, 1, ProtocolBuffer.Encoder.MAX_TYPE) |
633 2: ProtocolBuffer.Encoder.STRING, |
|
634 }, 2, ProtocolBuffer.Encoder.MAX_TYPE) |
603 |
635 |
604 _STYLE = """""" |
636 _STYLE = """""" |
605 _STYLE_CONTENT_TYPE = """""" |
637 _STYLE_CONTENT_TYPE = """""" |
606 class OutputSettings(ProtocolBuffer.ProtocolMessage): |
638 class OutputSettings(ProtocolBuffer.ProtocolMessage): |
607 |
639 |