thirdparty/google_appengine/google/appengine/api/images/images_service_pb.py
changeset 109 620f9b141567
child 149 f2e327a7c5de
equal deleted inserted replaced
108:261778de26ff 109:620f9b141567
       
     1 #!/usr/bin/env python
       
     2 #
       
     3 # Copyright 2007 Google Inc.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #     http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 #
       
    17 
       
    18 from google.net.proto import ProtocolBuffer
       
    19 import array
       
    20 import dummy_thread as thread
       
    21 
       
    22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
       
    23                    unusednames=printElemNumber,debug_strs no-special"""
       
    24 
       
    25 class ImagesServiceError(ProtocolBuffer.ProtocolMessage):
       
    26 
       
    27   UNSPECIFIED_ERROR =    1
       
    28   BAD_TRANSFORM_DATA =    2
       
    29   NOT_IMAGE    =    3
       
    30   BAD_IMAGE_DATA =    4
       
    31   IMAGE_TOO_LARGE =    5
       
    32 
       
    33   _ErrorCode_NAMES = {
       
    34     1: "UNSPECIFIED_ERROR",
       
    35     2: "BAD_TRANSFORM_DATA",
       
    36     3: "NOT_IMAGE",
       
    37     4: "BAD_IMAGE_DATA",
       
    38     5: "IMAGE_TOO_LARGE",
       
    39   }
       
    40 
       
    41   def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "")
       
    42   ErrorCode_Name = classmethod(ErrorCode_Name)
       
    43 
       
    44   def __init__(self, contents=None):
       
    45     pass
       
    46     if contents is not None: self.MergeFromString(contents)
       
    47 
       
    48 
       
    49   def MergeFrom(self, x):
       
    50     assert x is not self
       
    51 
       
    52   def Equals(self, x):
       
    53     if x is self: return 1
       
    54     return 1
       
    55 
       
    56   def __eq__(self, other):
       
    57     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
    58 
       
    59   def __ne__(self, other):
       
    60     return not (self == other)
       
    61 
       
    62   def IsInitialized(self, debug_strs=None):
       
    63     initialized = 1
       
    64     return initialized
       
    65 
       
    66   def ByteSize(self):
       
    67     n = 0
       
    68     return n + 0
       
    69 
       
    70   def Clear(self):
       
    71     pass
       
    72 
       
    73   def OutputUnchecked(self, out):
       
    74     pass
       
    75 
       
    76   def TryMerge(self, d):
       
    77     while d.avail() > 0:
       
    78       tt = d.getVarInt32()
       
    79       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
    80       d.skipData(tt)
       
    81 
       
    82 
       
    83   def __str__(self, prefix="", printElemNumber=0):
       
    84     res=""
       
    85     return res
       
    86 
       
    87 
       
    88   _TEXT = (
       
    89    "ErrorCode",
       
    90   )
       
    91 
       
    92   _TYPES = (
       
    93    ProtocolBuffer.Encoder.NUMERIC,
       
    94   )
       
    95 
       
    96   _STYLE = """"""
       
    97   _STYLE_CONTENT_TYPE = """"""
       
    98 class ImagesServiceTransform(ProtocolBuffer.ProtocolMessage):
       
    99 
       
   100   RESIZE       =    1
       
   101   ROTATE       =    2
       
   102   HORIZONTAL_FLIP =    3
       
   103   VERTICAL_FLIP =    4
       
   104   CROP         =    5
       
   105   IM_FEELING_LUCKY =    6
       
   106 
       
   107   _Type_NAMES = {
       
   108     1: "RESIZE",
       
   109     2: "ROTATE",
       
   110     3: "HORIZONTAL_FLIP",
       
   111     4: "VERTICAL_FLIP",
       
   112     5: "CROP",
       
   113     6: "IM_FEELING_LUCKY",
       
   114   }
       
   115 
       
   116   def Type_Name(cls, x): return cls._Type_NAMES.get(x, "")
       
   117   Type_Name = classmethod(Type_Name)
       
   118 
       
   119   def __init__(self, contents=None):
       
   120     pass
       
   121     if contents is not None: self.MergeFromString(contents)
       
   122 
       
   123 
       
   124   def MergeFrom(self, x):
       
   125     assert x is not self
       
   126 
       
   127   def Equals(self, x):
       
   128     if x is self: return 1
       
   129     return 1
       
   130 
       
   131   def __eq__(self, other):
       
   132     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   133 
       
   134   def __ne__(self, other):
       
   135     return not (self == other)
       
   136 
       
   137   def IsInitialized(self, debug_strs=None):
       
   138     initialized = 1
       
   139     return initialized
       
   140 
       
   141   def ByteSize(self):
       
   142     n = 0
       
   143     return n + 0
       
   144 
       
   145   def Clear(self):
       
   146     pass
       
   147 
       
   148   def OutputUnchecked(self, out):
       
   149     pass
       
   150 
       
   151   def TryMerge(self, d):
       
   152     while d.avail() > 0:
       
   153       tt = d.getVarInt32()
       
   154       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   155       d.skipData(tt)
       
   156 
       
   157 
       
   158   def __str__(self, prefix="", printElemNumber=0):
       
   159     res=""
       
   160     return res
       
   161 
       
   162 
       
   163   _TEXT = (
       
   164    "ErrorCode",
       
   165   )
       
   166 
       
   167   _TYPES = (
       
   168    ProtocolBuffer.Encoder.NUMERIC,
       
   169   )
       
   170 
       
   171   _STYLE = """"""
       
   172   _STYLE_CONTENT_TYPE = """"""
       
   173 class Transform(ProtocolBuffer.ProtocolMessage):
       
   174   def __init__(self, contents=None):
       
   175     self.width_ = 0
       
   176     self.height_ = 0
       
   177     self.rotate_ = 0
       
   178     self.horizontal_flip_ = 0
       
   179     self.vertical_flip_ = 0
       
   180     self.crop_left_x_ = 0.0
       
   181     self.crop_top_y_ = 0.0
       
   182     self.crop_right_x_ = 1.0
       
   183     self.crop_bottom_y_ = 1.0
       
   184     self.autolevels_ = 0
       
   185     self.has_width_ = 0
       
   186     self.has_height_ = 0
       
   187     self.has_rotate_ = 0
       
   188     self.has_horizontal_flip_ = 0
       
   189     self.has_vertical_flip_ = 0
       
   190     self.has_crop_left_x_ = 0
       
   191     self.has_crop_top_y_ = 0
       
   192     self.has_crop_right_x_ = 0
       
   193     self.has_crop_bottom_y_ = 0
       
   194     self.has_autolevels_ = 0
       
   195     if contents is not None: self.MergeFromString(contents)
       
   196 
       
   197   def width(self): return self.width_
       
   198 
       
   199   def set_width(self, x):
       
   200     self.has_width_ = 1
       
   201     self.width_ = x
       
   202 
       
   203   def clear_width(self):
       
   204     self.has_width_ = 0
       
   205     self.width_ = 0
       
   206 
       
   207   def has_width(self): return self.has_width_
       
   208 
       
   209   def height(self): return self.height_
       
   210 
       
   211   def set_height(self, x):
       
   212     self.has_height_ = 1
       
   213     self.height_ = x
       
   214 
       
   215   def clear_height(self):
       
   216     self.has_height_ = 0
       
   217     self.height_ = 0
       
   218 
       
   219   def has_height(self): return self.has_height_
       
   220 
       
   221   def rotate(self): return self.rotate_
       
   222 
       
   223   def set_rotate(self, x):
       
   224     self.has_rotate_ = 1
       
   225     self.rotate_ = x
       
   226 
       
   227   def clear_rotate(self):
       
   228     self.has_rotate_ = 0
       
   229     self.rotate_ = 0
       
   230 
       
   231   def has_rotate(self): return self.has_rotate_
       
   232 
       
   233   def horizontal_flip(self): return self.horizontal_flip_
       
   234 
       
   235   def set_horizontal_flip(self, x):
       
   236     self.has_horizontal_flip_ = 1
       
   237     self.horizontal_flip_ = x
       
   238 
       
   239   def clear_horizontal_flip(self):
       
   240     self.has_horizontal_flip_ = 0
       
   241     self.horizontal_flip_ = 0
       
   242 
       
   243   def has_horizontal_flip(self): return self.has_horizontal_flip_
       
   244 
       
   245   def vertical_flip(self): return self.vertical_flip_
       
   246 
       
   247   def set_vertical_flip(self, x):
       
   248     self.has_vertical_flip_ = 1
       
   249     self.vertical_flip_ = x
       
   250 
       
   251   def clear_vertical_flip(self):
       
   252     self.has_vertical_flip_ = 0
       
   253     self.vertical_flip_ = 0
       
   254 
       
   255   def has_vertical_flip(self): return self.has_vertical_flip_
       
   256 
       
   257   def crop_left_x(self): return self.crop_left_x_
       
   258 
       
   259   def set_crop_left_x(self, x):
       
   260     self.has_crop_left_x_ = 1
       
   261     self.crop_left_x_ = x
       
   262 
       
   263   def clear_crop_left_x(self):
       
   264     self.has_crop_left_x_ = 0
       
   265     self.crop_left_x_ = 0.0
       
   266 
       
   267   def has_crop_left_x(self): return self.has_crop_left_x_
       
   268 
       
   269   def crop_top_y(self): return self.crop_top_y_
       
   270 
       
   271   def set_crop_top_y(self, x):
       
   272     self.has_crop_top_y_ = 1
       
   273     self.crop_top_y_ = x
       
   274 
       
   275   def clear_crop_top_y(self):
       
   276     self.has_crop_top_y_ = 0
       
   277     self.crop_top_y_ = 0.0
       
   278 
       
   279   def has_crop_top_y(self): return self.has_crop_top_y_
       
   280 
       
   281   def crop_right_x(self): return self.crop_right_x_
       
   282 
       
   283   def set_crop_right_x(self, x):
       
   284     self.has_crop_right_x_ = 1
       
   285     self.crop_right_x_ = x
       
   286 
       
   287   def clear_crop_right_x(self):
       
   288     self.has_crop_right_x_ = 0
       
   289     self.crop_right_x_ = 1.0
       
   290 
       
   291   def has_crop_right_x(self): return self.has_crop_right_x_
       
   292 
       
   293   def crop_bottom_y(self): return self.crop_bottom_y_
       
   294 
       
   295   def set_crop_bottom_y(self, x):
       
   296     self.has_crop_bottom_y_ = 1
       
   297     self.crop_bottom_y_ = x
       
   298 
       
   299   def clear_crop_bottom_y(self):
       
   300     self.has_crop_bottom_y_ = 0
       
   301     self.crop_bottom_y_ = 1.0
       
   302 
       
   303   def has_crop_bottom_y(self): return self.has_crop_bottom_y_
       
   304 
       
   305   def autolevels(self): return self.autolevels_
       
   306 
       
   307   def set_autolevels(self, x):
       
   308     self.has_autolevels_ = 1
       
   309     self.autolevels_ = x
       
   310 
       
   311   def clear_autolevels(self):
       
   312     self.has_autolevels_ = 0
       
   313     self.autolevels_ = 0
       
   314 
       
   315   def has_autolevels(self): return self.has_autolevels_
       
   316 
       
   317 
       
   318   def MergeFrom(self, x):
       
   319     assert x is not self
       
   320     if (x.has_width()): self.set_width(x.width())
       
   321     if (x.has_height()): self.set_height(x.height())
       
   322     if (x.has_rotate()): self.set_rotate(x.rotate())
       
   323     if (x.has_horizontal_flip()): self.set_horizontal_flip(x.horizontal_flip())
       
   324     if (x.has_vertical_flip()): self.set_vertical_flip(x.vertical_flip())
       
   325     if (x.has_crop_left_x()): self.set_crop_left_x(x.crop_left_x())
       
   326     if (x.has_crop_top_y()): self.set_crop_top_y(x.crop_top_y())
       
   327     if (x.has_crop_right_x()): self.set_crop_right_x(x.crop_right_x())
       
   328     if (x.has_crop_bottom_y()): self.set_crop_bottom_y(x.crop_bottom_y())
       
   329     if (x.has_autolevels()): self.set_autolevels(x.autolevels())
       
   330 
       
   331   def Equals(self, x):
       
   332     if x is self: return 1
       
   333     if self.has_width_ != x.has_width_: return 0
       
   334     if self.has_width_ and self.width_ != x.width_: return 0
       
   335     if self.has_height_ != x.has_height_: return 0
       
   336     if self.has_height_ and self.height_ != x.height_: return 0
       
   337     if self.has_rotate_ != x.has_rotate_: return 0
       
   338     if self.has_rotate_ and self.rotate_ != x.rotate_: return 0
       
   339     if self.has_horizontal_flip_ != x.has_horizontal_flip_: return 0
       
   340     if self.has_horizontal_flip_ and self.horizontal_flip_ != x.horizontal_flip_: return 0
       
   341     if self.has_vertical_flip_ != x.has_vertical_flip_: return 0
       
   342     if self.has_vertical_flip_ and self.vertical_flip_ != x.vertical_flip_: return 0
       
   343     if self.has_crop_left_x_ != x.has_crop_left_x_: return 0
       
   344     if self.has_crop_left_x_ and self.crop_left_x_ != x.crop_left_x_: return 0
       
   345     if self.has_crop_top_y_ != x.has_crop_top_y_: return 0
       
   346     if self.has_crop_top_y_ and self.crop_top_y_ != x.crop_top_y_: return 0
       
   347     if self.has_crop_right_x_ != x.has_crop_right_x_: return 0
       
   348     if self.has_crop_right_x_ and self.crop_right_x_ != x.crop_right_x_: return 0
       
   349     if self.has_crop_bottom_y_ != x.has_crop_bottom_y_: return 0
       
   350     if self.has_crop_bottom_y_ and self.crop_bottom_y_ != x.crop_bottom_y_: return 0
       
   351     if self.has_autolevels_ != x.has_autolevels_: return 0
       
   352     if self.has_autolevels_ and self.autolevels_ != x.autolevels_: return 0
       
   353     return 1
       
   354 
       
   355   def __eq__(self, other):
       
   356     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   357 
       
   358   def __ne__(self, other):
       
   359     return not (self == other)
       
   360 
       
   361   def IsInitialized(self, debug_strs=None):
       
   362     initialized = 1
       
   363     return initialized
       
   364 
       
   365   def ByteSize(self):
       
   366     n = 0
       
   367     if (self.has_width_): n += 1 + self.lengthVarInt64(self.width_)
       
   368     if (self.has_height_): n += 1 + self.lengthVarInt64(self.height_)
       
   369     if (self.has_rotate_): n += 1 + self.lengthVarInt64(self.rotate_)
       
   370     if (self.has_horizontal_flip_): n += 2
       
   371     if (self.has_vertical_flip_): n += 2
       
   372     if (self.has_crop_left_x_): n += 5
       
   373     if (self.has_crop_top_y_): n += 5
       
   374     if (self.has_crop_right_x_): n += 5
       
   375     if (self.has_crop_bottom_y_): n += 5
       
   376     if (self.has_autolevels_): n += 2
       
   377     return n + 0
       
   378 
       
   379   def Clear(self):
       
   380     self.clear_width()
       
   381     self.clear_height()
       
   382     self.clear_rotate()
       
   383     self.clear_horizontal_flip()
       
   384     self.clear_vertical_flip()
       
   385     self.clear_crop_left_x()
       
   386     self.clear_crop_top_y()
       
   387     self.clear_crop_right_x()
       
   388     self.clear_crop_bottom_y()
       
   389     self.clear_autolevels()
       
   390 
       
   391   def OutputUnchecked(self, out):
       
   392     if (self.has_width_):
       
   393       out.putVarInt32(8)
       
   394       out.putVarInt32(self.width_)
       
   395     if (self.has_height_):
       
   396       out.putVarInt32(16)
       
   397       out.putVarInt32(self.height_)
       
   398     if (self.has_rotate_):
       
   399       out.putVarInt32(24)
       
   400       out.putVarInt32(self.rotate_)
       
   401     if (self.has_horizontal_flip_):
       
   402       out.putVarInt32(32)
       
   403       out.putBoolean(self.horizontal_flip_)
       
   404     if (self.has_vertical_flip_):
       
   405       out.putVarInt32(40)
       
   406       out.putBoolean(self.vertical_flip_)
       
   407     if (self.has_crop_left_x_):
       
   408       out.putVarInt32(53)
       
   409       out.putFloat(self.crop_left_x_)
       
   410     if (self.has_crop_top_y_):
       
   411       out.putVarInt32(61)
       
   412       out.putFloat(self.crop_top_y_)
       
   413     if (self.has_crop_right_x_):
       
   414       out.putVarInt32(69)
       
   415       out.putFloat(self.crop_right_x_)
       
   416     if (self.has_crop_bottom_y_):
       
   417       out.putVarInt32(77)
       
   418       out.putFloat(self.crop_bottom_y_)
       
   419     if (self.has_autolevels_):
       
   420       out.putVarInt32(80)
       
   421       out.putBoolean(self.autolevels_)
       
   422 
       
   423   def TryMerge(self, d):
       
   424     while d.avail() > 0:
       
   425       tt = d.getVarInt32()
       
   426       if tt == 8:
       
   427         self.set_width(d.getVarInt32())
       
   428         continue
       
   429       if tt == 16:
       
   430         self.set_height(d.getVarInt32())
       
   431         continue
       
   432       if tt == 24:
       
   433         self.set_rotate(d.getVarInt32())
       
   434         continue
       
   435       if tt == 32:
       
   436         self.set_horizontal_flip(d.getBoolean())
       
   437         continue
       
   438       if tt == 40:
       
   439         self.set_vertical_flip(d.getBoolean())
       
   440         continue
       
   441       if tt == 53:
       
   442         self.set_crop_left_x(d.getFloat())
       
   443         continue
       
   444       if tt == 61:
       
   445         self.set_crop_top_y(d.getFloat())
       
   446         continue
       
   447       if tt == 69:
       
   448         self.set_crop_right_x(d.getFloat())
       
   449         continue
       
   450       if tt == 77:
       
   451         self.set_crop_bottom_y(d.getFloat())
       
   452         continue
       
   453       if tt == 80:
       
   454         self.set_autolevels(d.getBoolean())
       
   455         continue
       
   456       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   457       d.skipData(tt)
       
   458 
       
   459 
       
   460   def __str__(self, prefix="", printElemNumber=0):
       
   461     res=""
       
   462     if self.has_width_: res+=prefix+("width: %s\n" % self.DebugFormatInt32(self.width_))
       
   463     if self.has_height_: res+=prefix+("height: %s\n" % self.DebugFormatInt32(self.height_))
       
   464     if self.has_rotate_: res+=prefix+("rotate: %s\n" % self.DebugFormatInt32(self.rotate_))
       
   465     if self.has_horizontal_flip_: res+=prefix+("horizontal_flip: %s\n" % self.DebugFormatBool(self.horizontal_flip_))
       
   466     if self.has_vertical_flip_: res+=prefix+("vertical_flip: %s\n" % self.DebugFormatBool(self.vertical_flip_))
       
   467     if self.has_crop_left_x_: res+=prefix+("crop_left_x: %s\n" % self.DebugFormatFloat(self.crop_left_x_))
       
   468     if self.has_crop_top_y_: res+=prefix+("crop_top_y: %s\n" % self.DebugFormatFloat(self.crop_top_y_))
       
   469     if self.has_crop_right_x_: res+=prefix+("crop_right_x: %s\n" % self.DebugFormatFloat(self.crop_right_x_))
       
   470     if self.has_crop_bottom_y_: res+=prefix+("crop_bottom_y: %s\n" % self.DebugFormatFloat(self.crop_bottom_y_))
       
   471     if self.has_autolevels_: res+=prefix+("autolevels: %s\n" % self.DebugFormatBool(self.autolevels_))
       
   472     return res
       
   473 
       
   474   kwidth = 1
       
   475   kheight = 2
       
   476   krotate = 3
       
   477   khorizontal_flip = 4
       
   478   kvertical_flip = 5
       
   479   kcrop_left_x = 6
       
   480   kcrop_top_y = 7
       
   481   kcrop_right_x = 8
       
   482   kcrop_bottom_y = 9
       
   483   kautolevels = 10
       
   484 
       
   485   _TEXT = (
       
   486    "ErrorCode",
       
   487    "width",
       
   488    "height",
       
   489    "rotate",
       
   490    "horizontal_flip",
       
   491    "vertical_flip",
       
   492    "crop_left_x",
       
   493    "crop_top_y",
       
   494    "crop_right_x",
       
   495    "crop_bottom_y",
       
   496    "autolevels",
       
   497   )
       
   498 
       
   499   _TYPES = (
       
   500    ProtocolBuffer.Encoder.NUMERIC,
       
   501    ProtocolBuffer.Encoder.NUMERIC,
       
   502 
       
   503    ProtocolBuffer.Encoder.NUMERIC,
       
   504 
       
   505    ProtocolBuffer.Encoder.NUMERIC,
       
   506 
       
   507    ProtocolBuffer.Encoder.NUMERIC,
       
   508 
       
   509    ProtocolBuffer.Encoder.NUMERIC,
       
   510 
       
   511    ProtocolBuffer.Encoder.FLOAT,
       
   512 
       
   513    ProtocolBuffer.Encoder.FLOAT,
       
   514 
       
   515    ProtocolBuffer.Encoder.FLOAT,
       
   516 
       
   517    ProtocolBuffer.Encoder.FLOAT,
       
   518 
       
   519    ProtocolBuffer.Encoder.NUMERIC,
       
   520 
       
   521   )
       
   522 
       
   523   _STYLE = """"""
       
   524   _STYLE_CONTENT_TYPE = """"""
       
   525 class ImageData(ProtocolBuffer.ProtocolMessage):
       
   526   def __init__(self, contents=None):
       
   527     self.content_ = ""
       
   528     self.has_content_ = 0
       
   529     if contents is not None: self.MergeFromString(contents)
       
   530 
       
   531   def content(self): return self.content_
       
   532 
       
   533   def set_content(self, x):
       
   534     self.has_content_ = 1
       
   535     self.content_ = x
       
   536 
       
   537   def clear_content(self):
       
   538     self.has_content_ = 0
       
   539     self.content_ = ""
       
   540 
       
   541   def has_content(self): return self.has_content_
       
   542 
       
   543 
       
   544   def MergeFrom(self, x):
       
   545     assert x is not self
       
   546     if (x.has_content()): self.set_content(x.content())
       
   547 
       
   548   def Equals(self, x):
       
   549     if x is self: return 1
       
   550     if self.has_content_ != x.has_content_: return 0
       
   551     if self.has_content_ and self.content_ != x.content_: return 0
       
   552     return 1
       
   553 
       
   554   def __eq__(self, other):
       
   555     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   556 
       
   557   def __ne__(self, other):
       
   558     return not (self == other)
       
   559 
       
   560   def IsInitialized(self, debug_strs=None):
       
   561     initialized = 1
       
   562     if (not self.has_content_):
       
   563       initialized = 0
       
   564       if debug_strs is not None:
       
   565         debug_strs.append('Required field: content not set.')
       
   566     return initialized
       
   567 
       
   568   def ByteSize(self):
       
   569     n = 0
       
   570     n += self.lengthString(len(self.content_))
       
   571     return n + 1
       
   572 
       
   573   def Clear(self):
       
   574     self.clear_content()
       
   575 
       
   576   def OutputUnchecked(self, out):
       
   577     out.putVarInt32(10)
       
   578     out.putPrefixedString(self.content_)
       
   579 
       
   580   def TryMerge(self, d):
       
   581     while d.avail() > 0:
       
   582       tt = d.getVarInt32()
       
   583       if tt == 10:
       
   584         self.set_content(d.getPrefixedString())
       
   585         continue
       
   586       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   587       d.skipData(tt)
       
   588 
       
   589 
       
   590   def __str__(self, prefix="", printElemNumber=0):
       
   591     res=""
       
   592     if self.has_content_: res+=prefix+("content: %s\n" % self.DebugFormatString(self.content_))
       
   593     return res
       
   594 
       
   595   kcontent = 1
       
   596 
       
   597   _TEXT = (
       
   598    "ErrorCode",
       
   599    "content",
       
   600   )
       
   601 
       
   602   _TYPES = (
       
   603    ProtocolBuffer.Encoder.NUMERIC,
       
   604    ProtocolBuffer.Encoder.STRING,
       
   605 
       
   606   )
       
   607 
       
   608   _STYLE = """"""
       
   609   _STYLE_CONTENT_TYPE = """"""
       
   610 class OutputSettings(ProtocolBuffer.ProtocolMessage):
       
   611 
       
   612   PNG          =    0
       
   613   JPEG         =    1
       
   614 
       
   615   _MIME_TYPE_NAMES = {
       
   616     0: "PNG",
       
   617     1: "JPEG",
       
   618   }
       
   619 
       
   620   def MIME_TYPE_Name(cls, x): return cls._MIME_TYPE_NAMES.get(x, "")
       
   621   MIME_TYPE_Name = classmethod(MIME_TYPE_Name)
       
   622 
       
   623   def __init__(self, contents=None):
       
   624     self.mime_type_ = 0
       
   625     self.has_mime_type_ = 0
       
   626     if contents is not None: self.MergeFromString(contents)
       
   627 
       
   628   def mime_type(self): return self.mime_type_
       
   629 
       
   630   def set_mime_type(self, x):
       
   631     self.has_mime_type_ = 1
       
   632     self.mime_type_ = x
       
   633 
       
   634   def clear_mime_type(self):
       
   635     self.has_mime_type_ = 0
       
   636     self.mime_type_ = 0
       
   637 
       
   638   def has_mime_type(self): return self.has_mime_type_
       
   639 
       
   640 
       
   641   def MergeFrom(self, x):
       
   642     assert x is not self
       
   643     if (x.has_mime_type()): self.set_mime_type(x.mime_type())
       
   644 
       
   645   def Equals(self, x):
       
   646     if x is self: return 1
       
   647     if self.has_mime_type_ != x.has_mime_type_: return 0
       
   648     if self.has_mime_type_ and self.mime_type_ != x.mime_type_: return 0
       
   649     return 1
       
   650 
       
   651   def __eq__(self, other):
       
   652     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   653 
       
   654   def __ne__(self, other):
       
   655     return not (self == other)
       
   656 
       
   657   def IsInitialized(self, debug_strs=None):
       
   658     initialized = 1
       
   659     return initialized
       
   660 
       
   661   def ByteSize(self):
       
   662     n = 0
       
   663     if (self.has_mime_type_): n += 1 + self.lengthVarInt64(self.mime_type_)
       
   664     return n + 0
       
   665 
       
   666   def Clear(self):
       
   667     self.clear_mime_type()
       
   668 
       
   669   def OutputUnchecked(self, out):
       
   670     if (self.has_mime_type_):
       
   671       out.putVarInt32(8)
       
   672       out.putVarInt32(self.mime_type_)
       
   673 
       
   674   def TryMerge(self, d):
       
   675     while d.avail() > 0:
       
   676       tt = d.getVarInt32()
       
   677       if tt == 8:
       
   678         self.set_mime_type(d.getVarInt32())
       
   679         continue
       
   680       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   681       d.skipData(tt)
       
   682 
       
   683 
       
   684   def __str__(self, prefix="", printElemNumber=0):
       
   685     res=""
       
   686     if self.has_mime_type_: res+=prefix+("mime_type: %s\n" % self.DebugFormatInt32(self.mime_type_))
       
   687     return res
       
   688 
       
   689   kmime_type = 1
       
   690 
       
   691   _TEXT = (
       
   692    "ErrorCode",
       
   693    "mime_type",
       
   694   )
       
   695 
       
   696   _TYPES = (
       
   697    ProtocolBuffer.Encoder.NUMERIC,
       
   698    ProtocolBuffer.Encoder.NUMERIC,
       
   699 
       
   700   )
       
   701 
       
   702   _STYLE = """"""
       
   703   _STYLE_CONTENT_TYPE = """"""
       
   704 class ImagesTransformRequest(ProtocolBuffer.ProtocolMessage):
       
   705   def __init__(self, contents=None):
       
   706     self.image_ = ImageData()
       
   707     self.transform_ = []
       
   708     self.output_ = OutputSettings()
       
   709     self.has_image_ = 0
       
   710     self.has_output_ = 0
       
   711     if contents is not None: self.MergeFromString(contents)
       
   712 
       
   713   def image(self): return self.image_
       
   714 
       
   715   def mutable_image(self): self.has_image_ = 1; return self.image_
       
   716 
       
   717   def clear_image(self):self.has_image_ = 0; self.image_.Clear()
       
   718 
       
   719   def has_image(self): return self.has_image_
       
   720 
       
   721   def transform_size(self): return len(self.transform_)
       
   722   def transform_list(self): return self.transform_
       
   723 
       
   724   def transform(self, i):
       
   725     return self.transform_[i]
       
   726 
       
   727   def mutable_transform(self, i):
       
   728     return self.transform_[i]
       
   729 
       
   730   def add_transform(self):
       
   731     x = Transform()
       
   732     self.transform_.append(x)
       
   733     return x
       
   734 
       
   735   def clear_transform(self):
       
   736     self.transform_ = []
       
   737   def output(self): return self.output_
       
   738 
       
   739   def mutable_output(self): self.has_output_ = 1; return self.output_
       
   740 
       
   741   def clear_output(self):self.has_output_ = 0; self.output_.Clear()
       
   742 
       
   743   def has_output(self): return self.has_output_
       
   744 
       
   745 
       
   746   def MergeFrom(self, x):
       
   747     assert x is not self
       
   748     if (x.has_image()): self.mutable_image().MergeFrom(x.image())
       
   749     for i in xrange(x.transform_size()): self.add_transform().CopyFrom(x.transform(i))
       
   750     if (x.has_output()): self.mutable_output().MergeFrom(x.output())
       
   751 
       
   752   def Equals(self, x):
       
   753     if x is self: return 1
       
   754     if self.has_image_ != x.has_image_: return 0
       
   755     if self.has_image_ and self.image_ != x.image_: return 0
       
   756     if len(self.transform_) != len(x.transform_): return 0
       
   757     for e1, e2 in zip(self.transform_, x.transform_):
       
   758       if e1 != e2: return 0
       
   759     if self.has_output_ != x.has_output_: return 0
       
   760     if self.has_output_ and self.output_ != x.output_: return 0
       
   761     return 1
       
   762 
       
   763   def __eq__(self, other):
       
   764     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   765 
       
   766   def __ne__(self, other):
       
   767     return not (self == other)
       
   768 
       
   769   def IsInitialized(self, debug_strs=None):
       
   770     initialized = 1
       
   771     if (not self.has_image_):
       
   772       initialized = 0
       
   773       if debug_strs is not None:
       
   774         debug_strs.append('Required field: image not set.')
       
   775     elif not self.image_.IsInitialized(debug_strs): initialized = 0
       
   776     for i in xrange(len(self.transform_)):
       
   777       if (not self.transform_[i].IsInitialized(debug_strs)): initialized=0
       
   778     if (not self.has_output_):
       
   779       initialized = 0
       
   780       if debug_strs is not None:
       
   781         debug_strs.append('Required field: output not set.')
       
   782     elif not self.output_.IsInitialized(debug_strs): initialized = 0
       
   783     return initialized
       
   784 
       
   785   def ByteSize(self):
       
   786     n = 0
       
   787     n += self.lengthString(self.image_.ByteSize())
       
   788     n += 1 * len(self.transform_)
       
   789     for i in xrange(len(self.transform_)): n += self.lengthString(self.transform_[i].ByteSize())
       
   790     n += self.lengthString(self.output_.ByteSize())
       
   791     return n + 2
       
   792 
       
   793   def Clear(self):
       
   794     self.clear_image()
       
   795     self.clear_transform()
       
   796     self.clear_output()
       
   797 
       
   798   def OutputUnchecked(self, out):
       
   799     out.putVarInt32(10)
       
   800     out.putVarInt32(self.image_.ByteSize())
       
   801     self.image_.OutputUnchecked(out)
       
   802     for i in xrange(len(self.transform_)):
       
   803       out.putVarInt32(18)
       
   804       out.putVarInt32(self.transform_[i].ByteSize())
       
   805       self.transform_[i].OutputUnchecked(out)
       
   806     out.putVarInt32(26)
       
   807     out.putVarInt32(self.output_.ByteSize())
       
   808     self.output_.OutputUnchecked(out)
       
   809 
       
   810   def TryMerge(self, d):
       
   811     while d.avail() > 0:
       
   812       tt = d.getVarInt32()
       
   813       if tt == 10:
       
   814         length = d.getVarInt32()
       
   815         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   816         d.skip(length)
       
   817         self.mutable_image().TryMerge(tmp)
       
   818         continue
       
   819       if tt == 18:
       
   820         length = d.getVarInt32()
       
   821         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   822         d.skip(length)
       
   823         self.add_transform().TryMerge(tmp)
       
   824         continue
       
   825       if tt == 26:
       
   826         length = d.getVarInt32()
       
   827         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   828         d.skip(length)
       
   829         self.mutable_output().TryMerge(tmp)
       
   830         continue
       
   831       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   832       d.skipData(tt)
       
   833 
       
   834 
       
   835   def __str__(self, prefix="", printElemNumber=0):
       
   836     res=""
       
   837     if self.has_image_:
       
   838       res+=prefix+"image <\n"
       
   839       res+=self.image_.__str__(prefix + "  ", printElemNumber)
       
   840       res+=prefix+">\n"
       
   841     cnt=0
       
   842     for e in self.transform_:
       
   843       elm=""
       
   844       if printElemNumber: elm="(%d)" % cnt
       
   845       res+=prefix+("transform%s <\n" % elm)
       
   846       res+=e.__str__(prefix + "  ", printElemNumber)
       
   847       res+=prefix+">\n"
       
   848       cnt+=1
       
   849     if self.has_output_:
       
   850       res+=prefix+"output <\n"
       
   851       res+=self.output_.__str__(prefix + "  ", printElemNumber)
       
   852       res+=prefix+">\n"
       
   853     return res
       
   854 
       
   855   kimage = 1
       
   856   ktransform = 2
       
   857   koutput = 3
       
   858 
       
   859   _TEXT = (
       
   860    "ErrorCode",
       
   861    "image",
       
   862    "transform",
       
   863    "output",
       
   864   )
       
   865 
       
   866   _TYPES = (
       
   867    ProtocolBuffer.Encoder.NUMERIC,
       
   868    ProtocolBuffer.Encoder.STRING,
       
   869 
       
   870    ProtocolBuffer.Encoder.STRING,
       
   871 
       
   872    ProtocolBuffer.Encoder.STRING,
       
   873 
       
   874   )
       
   875 
       
   876   _STYLE = """"""
       
   877   _STYLE_CONTENT_TYPE = """"""
       
   878 class ImagesTransformResponse(ProtocolBuffer.ProtocolMessage):
       
   879   def __init__(self, contents=None):
       
   880     self.image_ = ImageData()
       
   881     self.has_image_ = 0
       
   882     if contents is not None: self.MergeFromString(contents)
       
   883 
       
   884   def image(self): return self.image_
       
   885 
       
   886   def mutable_image(self): self.has_image_ = 1; return self.image_
       
   887 
       
   888   def clear_image(self):self.has_image_ = 0; self.image_.Clear()
       
   889 
       
   890   def has_image(self): return self.has_image_
       
   891 
       
   892 
       
   893   def MergeFrom(self, x):
       
   894     assert x is not self
       
   895     if (x.has_image()): self.mutable_image().MergeFrom(x.image())
       
   896 
       
   897   def Equals(self, x):
       
   898     if x is self: return 1
       
   899     if self.has_image_ != x.has_image_: return 0
       
   900     if self.has_image_ and self.image_ != x.image_: return 0
       
   901     return 1
       
   902 
       
   903   def __eq__(self, other):
       
   904     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   905 
       
   906   def __ne__(self, other):
       
   907     return not (self == other)
       
   908 
       
   909   def IsInitialized(self, debug_strs=None):
       
   910     initialized = 1
       
   911     if (not self.has_image_):
       
   912       initialized = 0
       
   913       if debug_strs is not None:
       
   914         debug_strs.append('Required field: image not set.')
       
   915     elif not self.image_.IsInitialized(debug_strs): initialized = 0
       
   916     return initialized
       
   917 
       
   918   def ByteSize(self):
       
   919     n = 0
       
   920     n += self.lengthString(self.image_.ByteSize())
       
   921     return n + 1
       
   922 
       
   923   def Clear(self):
       
   924     self.clear_image()
       
   925 
       
   926   def OutputUnchecked(self, out):
       
   927     out.putVarInt32(10)
       
   928     out.putVarInt32(self.image_.ByteSize())
       
   929     self.image_.OutputUnchecked(out)
       
   930 
       
   931   def TryMerge(self, d):
       
   932     while d.avail() > 0:
       
   933       tt = d.getVarInt32()
       
   934       if tt == 10:
       
   935         length = d.getVarInt32()
       
   936         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   937         d.skip(length)
       
   938         self.mutable_image().TryMerge(tmp)
       
   939         continue
       
   940       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   941       d.skipData(tt)
       
   942 
       
   943 
       
   944   def __str__(self, prefix="", printElemNumber=0):
       
   945     res=""
       
   946     if self.has_image_:
       
   947       res+=prefix+"image <\n"
       
   948       res+=self.image_.__str__(prefix + "  ", printElemNumber)
       
   949       res+=prefix+">\n"
       
   950     return res
       
   951 
       
   952   kimage = 1
       
   953 
       
   954   _TEXT = (
       
   955    "ErrorCode",
       
   956    "image",
       
   957   )
       
   958 
       
   959   _TYPES = (
       
   960    ProtocolBuffer.Encoder.NUMERIC,
       
   961    ProtocolBuffer.Encoder.STRING,
       
   962 
       
   963   )
       
   964 
       
   965   _STYLE = """"""
       
   966   _STYLE_CONTENT_TYPE = """"""
       
   967 
       
   968 __all__ = ['ImagesServiceError','ImagesServiceTransform','Transform','ImageData','OutputSettings','ImagesTransformRequest','ImagesTransformResponse']