text: #
  # Autogenerated by Thrift
  #
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  #  @generated
  #
  
  from __future__ import absolute_import
  import six
  from thrift.util.Recursive import fix_spec
  from thrift.Thrift import *
  from thrift.protocol.TProtocol import TProtocolException
  
  
  from .ttypes import *
  from thrift.Thrift import TProcessor
  import pprint
  import warnings
  from thrift import Thrift
  from thrift.transport import TTransport
  from thrift.protocol import TBinaryProtocol
  from thrift.protocol import TCompactProtocol
  from thrift.protocol import THeaderProtocol
  fastproto = None
  if not '__pypy__' in sys.builtin_module_names:
    try:
      from thrift.protocol import fastproto
    except ImportError:
      pass
  
  all_structs = []
  UTF8STRINGS = bool(0) or sys.version_info.major >= 3
  
  from thrift.util.Decorators import (
    future_process_main,
    future_process_method,
    process_main as thrift_process_main,
    process_method as thrift_process_method,
    should_run_on_thread,
    write_results_after_future,
    write_results_exception_callback,
    write_results_success_callback,
  )
  
  class Iface:
    def init(self, int1=None):
      """
      Parameters:
       - int1
      """
      pass
  
  
  class ContextIface:
    def init(self, handler_ctx, int1=None):
      """
      Parameters:
       - int1
      """
      pass
  
  
  # HELPER FUNCTIONS AND STRUCTURES
  
  class init_args:
    """
    Attributes:
     - int1
    """
  
    thrift_spec = None
    thrift_field_annotations = None
    thrift_struct_annotations = None
    __init__ = None
    @staticmethod
    def isUnion():
      return False
  
    def read(self, iprot):
      if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None:
        fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)
        return
      if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None:
        fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.I64:
            self.int1 = iprot.readI64()
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
        oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
        return
      if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
        oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
        return
      oprot.writeStructBegin('init_args')
      if self.int1 != None:
        oprot.writeFieldBegin('int1', TType.I64, 1)
        oprot.writeI64(self.int1)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def __repr__(self):
      L = []
      padding = ' ' * 4
      if self.int1 is not None:
        value = pprint.pformat(self.int1, indent=0)
        value = padding.join(value.splitlines(True))
        L.append('    int1=%s' % (value))
      return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '')
  
    def __eq__(self, other):
      if not isinstance(other, self.__class__):
        return False
  
      return self.__dict__ == other.__dict__ 
  
    def __ne__(self, other):
      return not (self == other)
  
    # Override the __hash__ function for Python3 - t10434117
    if not six.PY2:
      __hash__ = object.__hash__
  
  all_structs.append(init_args)
  init_args.thrift_spec = (
    None, # 0
    (1, TType.I64, 'int1', None, None, 2, ), # 1
  )
  
  init_args.thrift_struct_annotations = {
  }
  init_args.thrift_field_annotations = {
  }
  
  def init_args__init__(self, int1=None,):
    self.int1 = int1
  
  init_args.__init__ = init_args__init__
  
  def init_args__setstate__(self, state):
    state.setdefault('int1', None)
    self.__dict__ = state
  
  init_args.__getstate__ = lambda self: self.__dict__.copy()
  init_args.__setstate__ = init_args__setstate__
  
  class init_result:
    """
    Attributes:
     - success
    """
  
    thrift_spec = None
    thrift_field_annotations = None
    thrift_struct_annotations = None
    __init__ = None
    @staticmethod
    def isUnion():
      return False
  
    def read(self, iprot):
      if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None:
        fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)
        return
      if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None:
        fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 0:
          if ftype == TType.I64:
            self.success = iprot.readI64()
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
        oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
        return
      if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
        oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
        return
      oprot.writeStructBegin('init_result')
      if self.success != None:
        oprot.writeFieldBegin('success', TType.I64, 0)
        oprot.writeI64(self.success)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def __repr__(self):
      L = []
      padding = ' ' * 4
      if self.success is not None:
        value = pprint.pformat(self.success, indent=0)
        value = padding.join(value.splitlines(True))
        L.append('    success=%s' % (value))
      return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '')
  
    def __eq__(self, other):
      if not isinstance(other, self.__class__):
        return False
  
      return self.__dict__ == other.__dict__ 
  
    def __ne__(self, other):
      return not (self == other)
  
    # Override the __hash__ function for Python3 - t10434117
    if not six.PY2:
      __hash__ = object.__hash__
  
  all_structs.append(init_result)
  init_result.thrift_spec = (
    (0, TType.I64, 'success', None, None, 2, ), # 0
  )
  
  init_result.thrift_struct_annotations = {
  }
  init_result.thrift_field_annotations = {
  }
  
  def init_result__init__(self, success=None,):
    self.success = success
  
  init_result.__init__ = init_result__init__
  
  def init_result__setstate__(self, state):
    state.setdefault('success', None)
    self.__dict__ = state
  
  init_result.__getstate__ = lambda self: self.__dict__.copy()
  init_result.__setstate__ = init_result__setstate__
  
  class Client(Iface):
    def __enter__(self):
      return self
  
    def __exit__(self, type, value, tb):
      self._iprot.trans.close()
      if self._iprot is not self._oprot:
        self._oprot.trans.close()
  
    def __init__(self, iprot, oprot=None):
      self._iprot = self._oprot = iprot
      if oprot != None:
        self._oprot = oprot
      self._seqid = 0
  
    def init(self, int1=None):
      """
      Parameters:
       - int1
      """
      self.send_init(int1)
      return self.recv_init()
  
    def send_init(self, int1=None):
      self._oprot.writeMessageBegin('init', TMessageType.CALL, self._seqid)
      args = init_args()
      args.int1 = int1
      args.write(self._oprot)
      self._oprot.writeMessageEnd()
      self._oprot.trans.flush()
  
    def recv_init(self, ):
      (fname, mtype, rseqid) = self._iprot.readMessageBegin()
      if mtype == TMessageType.EXCEPTION:
        x = TApplicationException()
        x.read(self._iprot)
        self._iprot.readMessageEnd()
        raise x
      result = init_result()
      result.read(self._iprot)
      self._iprot.readMessageEnd()
      if result.success != None:
        return result.success
      raise TApplicationException(TApplicationException.MISSING_RESULT, "init failed: unknown result");
  
  
  class Processor(Iface, TProcessor):
    _onewayMethods = ()
  
    def __init__(self, handler):
      TProcessor.__init__(self)
      self._handler = handler
      self._processMap = {}
      self._priorityMap = {}
      self._processMap["init"] = Processor.process_init
      self._priorityMap["init"] = TPriority.NORMAL
  
    def onewayMethods(self):
      l = []
      l.extend(Processor._onewayMethods)
      return tuple(l)
  
    @thrift_process_main()
    def process(self,): pass
  
    @thrift_process_method(init_args, oneway=False)
    def process_init(self, args, handler_ctx):
      result = init_result()
      try:
        result.success = self._handler.init(args.int1)
      except:
        ex = sys.exc_info()[1]
        self._event_handler.handlerError(handler_ctx, 'init', ex)
        result = Thrift.TApplicationException(message=repr(ex))
      return result
  
  Iface._processor_type = Processor
  
  class ContextProcessor(ContextIface, TProcessor):
    _onewayMethods = ()
  
    def __init__(self, handler):
      TProcessor.__init__(self)
      self._handler = handler
      self._processMap = {}
      self._priorityMap = {}
      self._processMap["init"] = ContextProcessor.process_init
      self._priorityMap["init"] = TPriority.NORMAL
  
    def onewayMethods(self):
      l = []
      l.extend(ContextProcessor._onewayMethods)
      return tuple(l)
  
    @thrift_process_main()
    def process(self,): pass
  
    @thrift_process_method(init_args, oneway=False)
    def process_init(self, args, handler_ctx):
      result = init_result()
      try:
        result.success = self._handler.init(handler_ctx, args.int1)
      except:
        ex = sys.exc_info()[1]
        self._event_handler.handlerError(handler_ctx, 'init', ex)
        result = Thrift.TApplicationException(message=repr(ex))
      return result
  
  ContextIface._processor_type = ContextProcessor
  
  fix_spec(all_structs)
  del all_structs
  
  