Question: Marshall the given parameter object.

public void marshall(FailedWorkspaceChangeRequest failedWorkspaceChangeRequest, ProtocolMarshaller protocolMarshaller) {

        if (failedWorkspaceChangeRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(failedWorkspaceChangeRequest.getWorkspaceId(), WORKSPACEID_BINDING);
            protocolMarshaller.marshall(failedWorkspaceChangeRequest.getErrorCode(), ERRORCODE_BINDING);
            protocolMarshaller.marshall(failedWorkspaceChangeRequest.getErrorMessage(), ERRORMESSAGE_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options)
    {
        $this->_prepareParamsData($data);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: Called by Ruote::Dashboard#add_service

def add_service(key, *args)

      raise ArgumentError.new(
        '#add_service: at least two arguments please'
      ) if args.empty?

      key = key.to_s
      path, klass, opts = args

      key = "s_#{key}" unless SERVICE_PREFIX.match(key)

      aa = [ self, opts ].compact

      service = if klass

        require(path)

        @services[key] = Ruote.constantize(klass).new(*aa)

      elsif path.is_a?(Class)

        @services[key] = path.new(*aa)

      else

        @services[key] = path
      end

      (class << self; self; end).class_eval(
        %{ def #{key[2..-1]}; @services['#{key}']; end })
          #
          # This 'two-liner' will add an instance method to Context for this
          # service.
          #
          # If the service key is 's_dishwasher', then the service will be
          # available via Context#dishwasher.
          #
          # I.e. dishwasher = engine.context.dishwasher

      service
    end

def default_action_block
      proc do
        begin
          record = if resource.singular
                    parent_model = resource.parent.model.find(parent_resource_id)
                    parent_model.send resource.name
                  else
                    record = model.find(params[:id])
                  end

          record.update(instance_eval(&@strong_params))
          body record.reload
        rescue ActionController::ParameterMissing => error
          body error.message
          status :bad_request
        end
      end
    end

Instruction: Given a code description, retrieve the corresponding code.


Question:
Read a new object from the given input protocol and return the object.

        :type iprot: thryft.protocol._input_protocol._InputProtocol
        :rtype: pastpy.gen.database.impl.dbf.objects_dbf_record.ObjectsDbfRecord

def read(cls, iprot):
        '''

        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'accessno':
                try:
                    init_kwds['accessno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'accessory':
                try:
                    init_kwds['accessory'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'acqvalue':
                try:
                    init_kwds['acqvalue'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'age':
                try:
                    init_kwds['age'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'appnotes':
                try:
                    init_kwds['appnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'appraisor':
                try:
                    init_kwds['appraisor'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'assemzone':
                try:
                    init_kwds['assemzone'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'bagno':
                try:
                    init_kwds['bagno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'boxno':
                try:
                    init_kwds['boxno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'caption':
                try:
                    init_kwds['caption'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'cat':
                try:
                    init_kwds['cat'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'catby':
                try:
                    init_kwds['catby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'catdate':
                try:
                    init_kwds['catdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'cattype':
                try:
                    init_kwds['cattype'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'chemcomp':
                try:
                    init_kwds['chemcomp'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'circum':
                try:
                    init_kwds['circum'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'circumft':
                try:
                    init_kwds['circumft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'circumin':
                try:
                    init_kwds['circumin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'classes':
                try:
                    init_kwds['classes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'colldate':
                try:
                    init_kwds['colldate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'collection':
                try:
                    init_kwds['collection'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'collector':
                try:
                    init_kwds['collector'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'conddate':
                try:
                    init_kwds['conddate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'condexam':
                try:
                    init_kwds['condexam'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'condition':
                try:
                    init_kwds['condition'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'condnotes':
                try:
                    init_kwds['condnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'count':
                try:
                    init_kwds['count'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'creator':
                try:
                    init_kwds['creator'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'creator2':
                try:
                    init_kwds['creator2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'creator3':
                try:
                    init_kwds['creator3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'credit':
                try:
                    init_kwds['credit'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'crystal':
                try:
                    init_kwds['crystal'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'culture':
                try:
                    init_kwds['culture'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'curvalmax':
                try:
                    init_kwds['curvalmax'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'curvalue':
                try:
                    init_kwds['curvalue'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'dataset':
                try:
                    init_kwds['dataset'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'date':
                try:
                    init_kwds['date'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'datingmeth':
                try:
                    init_kwds['datingmeth'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'datum':
                try:
                    init_kwds['datum'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'depth':
                try:
                    init_kwds['depth'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'depthft':
                try:
                    init_kwds['depthft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'depthin':
                try:
                    init_kwds['depthin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'descrip':
                try:
                    init_kwds['descrip'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'diameter':
                try:
                    init_kwds['diameter'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'diameterft':
                try:
                    init_kwds['diameterft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'diameterin':
                try:
                    init_kwds['diameterin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'dimnotes':
                try:
                    init_kwds['dimnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'dimtype':
                try:
                    init_kwds['dimtype'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'dispvalue':
                try:
                    init_kwds['dispvalue'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'earlydate':
                try:
                    init_kwds['earlydate'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'elements':
                try:
                    init_kwds['elements'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'epoch':
                try:
                    init_kwds['epoch'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'era':
                try:
                    init_kwds['era'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'event':
                try:
                    init_kwds['event'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'ew':
                try:
                    init_kwds['ew'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'excavadate':
                try:
                    init_kwds['excavadate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'excavateby':
                try:
                    init_kwds['excavateby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhibitid':
                try:
                    init_kwds['exhibitid'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhibitno':
                try:
                    init_kwds['exhibitno'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhlabel1':
                try:
                    init_kwds['exhlabel1'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhlabel2':
                try:
                    init_kwds['exhlabel2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhlabel3':
                try:
                    init_kwds['exhlabel3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhlabel4':
                try:
                    init_kwds['exhlabel4'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'exhstart':
                try:
                    init_kwds['exhstart'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'family':
                try:
                    init_kwds['family'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'feature':
                try:
                    init_kwds['feature'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'flagdate':
                try:
                    init_kwds['flagdate'] = iprot.read_date_time()
                except (TypeError,):
                    pass
            elif ifield_name == 'flagnotes':
                try:
                    init_kwds['flagnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'flagreason':
                try:
                    init_kwds['flagreason'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'formation':
                try:
                    init_kwds['formation'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'fossils':
                try:
                    init_kwds['fossils'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'found':
                try:
                    init_kwds['found'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'fracture':
                try:
                    init_kwds['fracture'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'frame':
                try:
                    init_kwds['frame'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'framesize':
                try:
                    init_kwds['framesize'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'genus':
                try:
                    init_kwds['genus'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'gparent':
                try:
                    init_kwds['gparent'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'grainsize':
                try:
                    init_kwds['grainsize'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'habitat':
                try:
                    init_kwds['habitat'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'hardness':
                try:
                    init_kwds['hardness'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'height':
                try:
                    init_kwds['height'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'heightft':
                try:
                    init_kwds['heightft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'heightin':
                try:
                    init_kwds['heightin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'homeloc':
                try:
                    init_kwds['homeloc'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'idby':
                try:
                    init_kwds['idby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'iddate':
                try:
                    init_kwds['iddate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'imagefile':
                try:
                    init_kwds['imagefile'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'imageno':
                try:
                    init_kwds['imageno'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'imagesize':
                try:
                    init_kwds['imagesize'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscomp':
                try:
                    init_kwds['inscomp'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrlang':
                try:
                    init_kwds['inscrlang'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrpos':
                try:
                    init_kwds['inscrpos'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrtech':
                try:
                    init_kwds['inscrtech'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrtext':
                try:
                    init_kwds['inscrtext'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrtrans':
                try:
                    init_kwds['inscrtrans'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inscrtype':
                try:
                    init_kwds['inscrtype'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'insdate':
                try:
                    init_kwds['insdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'insphone':
                try:
                    init_kwds['insphone'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'inspremium':
                try:
                    init_kwds['inspremium'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'insrep':
                try:
                    init_kwds['insrep'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'insvalue':
                try:
                    init_kwds['insvalue'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'invnby':
                try:
                    init_kwds['invnby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'invndate':
                try:
                    init_kwds['invndate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'kingdom':
                try:
                    init_kwds['kingdom'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'latdeg':
                try:
                    init_kwds['latdeg'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'latedate':
                try:
                    init_kwds['latedate'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'legal':
                try:
                    init_kwds['legal'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'length':
                try:
                    init_kwds['length'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'lengthft':
                try:
                    init_kwds['lengthft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'lengthin':
                try:
                    init_kwds['lengthin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'level':
                try:
                    init_kwds['level'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'lithofacie':
                try:
                    init_kwds['lithofacie'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'loancond':
                try:
                    init_kwds['loancond'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'loandue':
                try:
                    init_kwds['loandue'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'loanid':
                try:
                    init_kwds['loanid'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'loaninno':
                try:
                    init_kwds['loaninno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'loanno':
                try:
                    init_kwds['loanno'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'loanrenew':
                try:
                    init_kwds['loanrenew'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'locfield1':
                try:
                    init_kwds['locfield1'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'locfield2':
                try:
                    init_kwds['locfield2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'locfield3':
                try:
                    init_kwds['locfield3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'locfield4':
                try:
                    init_kwds['locfield4'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'locfield5':
                try:
                    init_kwds['locfield5'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'locfield6':
                try:
                    init_kwds['locfield6'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'longdeg':
                try:
                    init_kwds['longdeg'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'luster':
                try:
                    init_kwds['luster'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'made':
                try:
                    init_kwds['made'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'maintcycle':
                try:
                    init_kwds['maintcycle'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'maintdate':
                try:
                    init_kwds['maintdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'maintnote':
                try:
                    init_kwds['maintnote'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'material':
                try:
                    init_kwds['material'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'medium':
                try:
                    init_kwds['medium'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'member':
                try:
                    init_kwds['member'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'mmark':
                try:
                    init_kwds['mmark'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'nhclass':
                try:
                    init_kwds['nhclass'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'nhorder':
                try:
                    init_kwds['nhorder'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'notes':
                try:
                    init_kwds['notes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'ns':
                try:
                    init_kwds['ns'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'objectid':
                try:
                    init_kwds['objectid'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'objname':
                try:
                    init_kwds['objname'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'objname2':
                try:
                    init_kwds['objname2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'objname3':
                try:
                    init_kwds['objname3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'objnames':
                try:
                    init_kwds['objnames'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'occurrence':
                try:
                    init_kwds['occurrence'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'oldno':
                try:
                    init_kwds['oldno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'origin':
                try:
                    init_kwds['origin'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'othername':
                try:
                    init_kwds['othername'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'otherno':
                try:
                    init_kwds['otherno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'outdate':
                try:
                    init_kwds['outdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'owned':
                try:
                    init_kwds['owned'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'parent':
                try:
                    init_kwds['parent'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'people':
                try:
                    init_kwds['people'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'period':
                try:
                    init_kwds['period'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'phylum':
                try:
                    init_kwds['phylum'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'policyno':
                try:
                    init_kwds['policyno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'ppid':
                try:
                    init_kwds['ppid'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'preparator':
                try:
                    init_kwds['preparator'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'prepdate':
                try:
                    init_kwds['prepdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'preserve':
                try:
                    init_kwds['preserve'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'pressure':
                try:
                    init_kwds['pressure'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'provenance':
                try:
                    init_kwds['provenance'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'pubnotes':
                try:
                    init_kwds['pubnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'qrurl':
                try:
                    init_kwds['qrurl'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'recas':
                try:
                    init_kwds['recas'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'recdate':
                try:
                    init_kwds['recdate'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'recfrom':
                try:
                    init_kwds['recfrom'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'relation':
                try:
                    init_kwds['relation'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'relnotes':
                try:
                    init_kwds['relnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'renewuntil':
                try:
                    init_kwds['renewuntil'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'repatby':
                try:
                    init_kwds['repatby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'repatclaim':
                try:
                    init_kwds['repatclaim'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'repatdate':
                try:
                    init_kwds['repatdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'repatdisp':
                try:
                    init_kwds['repatdisp'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'repathand':
                try:
                    init_kwds['repathand'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'repatnotes':
                try:
                    init_kwds['repatnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'repatnotic':
                try:
                    init_kwds['repatnotic'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'repattype':
                try:
                    init_kwds['repattype'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'rockclass':
                try:
                    init_kwds['rockclass'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'rockcolor':
                try:
                    init_kwds['rockcolor'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'rockorigin':
                try:
                    init_kwds['rockorigin'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'rocktype':
                try:
                    init_kwds['rocktype'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'role':
                try:
                    init_kwds['role'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'role2':
                try:
                    init_kwds['role2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'role3':
                try:
                    init_kwds['role3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'school':
                try:
                    init_kwds['school'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'sex':
                try:
                    init_kwds['sex'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'sgflag':
                try:
                    init_kwds['sgflag'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'signedname':
                try:
                    init_kwds['signedname'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'signloc':
                try:
                    init_kwds['signloc'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'site':
                try:
                    init_kwds['site'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'siteno':
                try:
                    init_kwds['siteno'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'specgrav':
                try:
                    init_kwds['specgrav'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'species':
                try:
                    init_kwds['species'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'sprocess':
                try:
                    init_kwds['sprocess'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'stage':
                try:
                    init_kwds['stage'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'status':
                try:
                    init_kwds['status'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'statusby':
                try:
                    init_kwds['statusby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'statusdate':
                try:
                    init_kwds['statusdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'sterms':
                try:
                    init_kwds['sterms'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'stratum':
                try:
                    init_kwds['stratum'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'streak':
                try:
                    init_kwds['streak'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'subfamily':
                try:
                    init_kwds['subfamily'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'subjects':
                try:
                    init_kwds['subjects'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'subspecies':
                try:
                    init_kwds['subspecies'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'technique':
                try:
                    init_kwds['technique'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempauthor':
                try:
                    init_kwds['tempauthor'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempby':
                try:
                    init_kwds['tempby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempdate':
                try:
                    init_kwds['tempdate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'temperatur':
                try:
                    init_kwds['temperatur'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'temploc':
                try:
                    init_kwds['temploc'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempnotes':
                try:
                    init_kwds['tempnotes'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempreason':
                try:
                    init_kwds['tempreason'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tempuntil':
                try:
                    init_kwds['tempuntil'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'texture':
                try:
                    init_kwds['texture'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'title':
                try:
                    init_kwds['title'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield1':
                try:
                    init_kwds['tlocfield1'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield2':
                try:
                    init_kwds['tlocfield2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield3':
                try:
                    init_kwds['tlocfield3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield4':
                try:
                    init_kwds['tlocfield4'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield5':
                try:
                    init_kwds['tlocfield5'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'tlocfield6':
                try:
                    init_kwds['tlocfield6'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf1':
                try:
                    init_kwds['udf1'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf10':
                try:
                    init_kwds['udf10'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf11':
                try:
                    init_kwds['udf11'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf12':
                try:
                    init_kwds['udf12'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf13':
                try:
                    init_kwds['udf13'] = iprot.read_i32()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf14':
                try:
                    init_kwds['udf14'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'udf15':
                try:
                    init_kwds['udf15'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'udf16':
                try:
                    init_kwds['udf16'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'udf17':
                try:
                    init_kwds['udf17'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'udf18':
                try:
                    init_kwds['udf18'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'udf19':
                try:
                    init_kwds['udf19'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'udf2':
                try:
                    init_kwds['udf2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf20':
                try:
                    init_kwds['udf20'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'udf21':
                try:
                    init_kwds['udf21'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf22':
                try:
                    init_kwds['udf22'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf3':
                try:
                    init_kwds['udf3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf4':
                try:
                    init_kwds['udf4'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf5':
                try:
                    init_kwds['udf5'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf6':
                try:
                    init_kwds['udf6'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf7':
                try:
                    init_kwds['udf7'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf8':
                try:
                    init_kwds['udf8'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'udf9':
                try:
                    init_kwds['udf9'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'unit':
                try:
                    init_kwds['unit'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'updated':
                try:
                    init_kwds['updated'] = iprot.read_date_time()
                except (TypeError,):
                    pass
            elif ifield_name == 'updatedby':
                try:
                    init_kwds['updatedby'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'used':
                try:
                    init_kwds['used'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'valuedate':
                try:
                    init_kwds['valuedate'] = iprot.read_date()
                except (TypeError,):
                    pass
            elif ifield_name == 'varieties':
                try:
                    init_kwds['varieties'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'vexhtml':
                try:
                    init_kwds['vexhtml'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'vexlabel1':
                try:
                    init_kwds['vexlabel1'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'vexlabel2':
                try:
                    init_kwds['vexlabel2'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'vexlabel3':
                try:
                    init_kwds['vexlabel3'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'vexlabel4':
                try:
                    init_kwds['vexlabel4'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'webinclude':
                try:
                    init_kwds['webinclude'] = iprot.read_bool()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'weight':
                try:
                    init_kwds['weight'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'weightin':
                try:
                    init_kwds['weightin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'weightlb':
                try:
                    init_kwds['weightlb'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'width':
                try:
                    init_kwds['width'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'widthft':
                try:
                    init_kwds['widthft'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'widthin':
                try:
                    init_kwds['widthin'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'xcord':
                try:
                    init_kwds['xcord'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'ycord':
                try:
                    init_kwds['ycord'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'zcord':
                try:
                    init_kwds['zcord'] = iprot.read_decimal()
                except (decimal.InvalidOperation, TypeError,):
                    pass
            elif ifield_name == 'zsorter':
                try:
                    init_kwds['zsorter'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            elif ifield_name == 'zsorterx':
                try:
                    init_kwds['zsorterx'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)

def stsci(hdulist):
    """"""

    instrument = hdulist[0].header.get('INSTRUME', '')

    # Update extension header keywords
    if instrument in ("WFPC2", "FOC"):
        rootname = hdulist[0].header.get('ROOTNAME', '')
        filetype = hdulist[0].header.get('FILETYPE', '')
        for i in range(1, len(hdulist)):
            # Add name and extver attributes to match PyFITS data structure
            hdulist[i].name = filetype
            hdulist[i]._extver = i
            # Add extension keywords for this chip to extension
            hdulist[i].header['EXPNAME'] = (rootname, "9 character exposure identifier")
            hdulist[i].header['EXTVER']= (i, "extension version number")
            hdulist[i].header['EXTNAME'] = (filetype, "extension name")
            hdulist[i].header['INHERIT'] = (True, "inherit the primary header")
            hdulist[i].header['ROOTNAME'] = (rootname, "rootname of the observation set")

Instruction: Given a code description, retrieve the corresponding code.


Question: Handles an append response.

protected void handleAppendResponse(MemberState member, AppendRequest request, AppendResponse response) {
    if (response.status() == Response.Status.OK) {
      handleAppendResponseOk(member, request, response);
    } else {
      handleAppendResponseError(member, request, response);
    }
  }

def parse_on_condition(self, node):

        try:
            test = node.lattrib['test']
        except:
            self.raise_error('<OnCondition> must specify a test.')

        event_handler = OnCondition(test)

        self.current_regime.add_event_handler(event_handler)

        self.current_event_handler = event_handler
        self.process_nested_tags(node)
        self.current_event_handler = None

Instruction: Given a code description, retrieve the corresponding code.


Question:
Parse a line.

@param string $line The line.
@return User Returns a user.
@throws IntegerArgumentException Throws an integer argument exception.

public function parseLine($line) {

        $data = explode(";", $line);
        $i    = -1;

        $model = new User();
        $model->setUserNumber(IntegerHelper::parseString($data[++$i]));
        $model->setCustomerNumber(IntegerHelper::parseString($data[++$i]));
        $model->setTitle($this->decodeString($data[++$i]));
        $model->setSurname($this->decodeString($data[++$i]));
        $model->setFirstname($this->decodeString($data[++$i]));
        $model->setDateBirth($this->decodeDate($data[++$i]));
        $model->setParkingSpace($this->decodeString($data[++$i]));
        $model->setRemarks($this->decodeString($data[++$i]));
        $model->setDatetimeLastModification($this->decodeDateTime($data[++$i]));
        $model->setDeletedRecord(BooleanHelper::parseString($data[++$i]));
        $model->setIdentificationNumber($this->decodeString($data[++$i]));
        $model->setCheckLicensePlate(BooleanHelper::parseString($data[++$i]));
        $model->setPassageLicensePlatePermitted(BooleanHelper::parseString($data[++$i]));
        $model->setExcessTimesCreditCard(BooleanHelper::parseString($data[++$i]));
        $model->setCreditCardNumber($this->decodeString($data[++$i]));
        $model->setExpiryDate($this->decodeDate($data[++$i]));
        $model->setRemarks2($this->decodeString($data[++$i]));
        $model->setRemarks3($this->decodeString($data[++$i]));
        $model->setDivision($this->decodeString($data[++$i]));
        $model->setEmail($this->decodeString($data[++$i]));
        $model->setGroupCounting(BooleanHelper::parseString($data[++$i]));
        $model->setETicketTypeP(IntegerHelper::parseString($data[++$i]));
        $model->setETicketEmailTelephone($this->decodeString($data[++$i]));
        $model->setETicketAuthentication(IntegerHelper::parseString($data[++$i]));
        $model->setETicketServiceTyp(IntegerHelper::parseString($data[++$i]));
        $model->setETicketServiceArt(IntegerHelper::parseString($data[++$i]));

        return $model;
    }

public static void main( String [] args )
    {
        if ( args.length > 0 ) {
            String filename = args[0];

            String [] bshArgs;
            if ( args.length > 1 ) {
                bshArgs = new String [ args.length -1 ];
                System.arraycopy( args, 1, bshArgs, 0, args.length-1 );
            } else
                bshArgs = new String [0];

            try {
                Interpreter interpreter = new Interpreter();
                interpreter.setu( "bsh.args", bshArgs );
                Object result =
                    interpreter.source( filename, interpreter.globalNameSpace );
                if ( result instanceof Class )
                    try {
                        invokeMain( (Class<?>)result, bshArgs );
                    } catch ( Exception e )
                    {
                        Object o = e;
                        if ( e instanceof InvocationTargetException )
                            o = e.getCause();
                        System.err.println(
                            "Class: "+result+" main method threw exception:"+o);
                    }
            } catch ( FileNotFoundException e ) {
                System.err.println("File not found: "+e);
            } catch ( TargetError e ) {
                System.err.println("Script threw exception: "+e);
                if ( e.inNativeCode() )
                    e.printStackTrace( DEBUG.get(), System.err );
            } catch ( EvalError e ) {
                System.err.println("Evaluation Error: "+e);
            } catch ( IOException e ) {
                System.err.println("I/O Error: "+e);
            }
        } else {
            @SuppressWarnings("resource")
            Interpreter interpreter =
            new Interpreter(new CommandLineReader(
                new FileReader(System.in)),
                System.out, System.err, true );
            interpreter.run();
        }
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
{@inheritdoc}

@return null|void

public function init()
    {
        // Duplicated init protection
        if ($this->_blInit) {
            return;
        }
        $this->_blInit = true;

        $this->_loadVarsFromFile();
        $this->_setDefaults();
        $this->storedVarTypes = $this->getStoredVarTypes();

        try {
            $sShopID = $this->getShopId();
            $blConfigLoaded = $this->_loadVarsFromDb($sShopID);

            // loading shop config
            if (empty($sShopID) || !$blConfigLoaded) {
                throw oxNew(ConnectionException::class, "Unable to load shop config values from database");
            }

            // loading theme config options
            $this->_loadVarsFromDb(
                $sShopID, null, Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme')
            );

            $this->_aConfigParamsParentTheme = $this->_aConfigParams;

            // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
            if ($this->getConfigParam('sCustomTheme')) {
                $this->_loadVarsFromDb(
                    $sShopID, null, Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme')
                );
            }

            // loading modules config
            $this->_loadVarsFromDb($sShopID, null, Config::OXMODULE_MODULE_PREFIX);

            $aOnlyMainShopVars = array('blMallUsers', 'aSerials', 'IMD', 'IMA', 'IMS');
            $this->_loadVarsFromDb($this->getBaseShopId(), $aOnlyMainShopVars);
        } catch (ConnectionException $oEx) {
            $oEx->debugOut();
            Registry::getUtils()->showMessageAndExit($oEx->getString());
        }
    }

def readNullModelFile(nfile):
    "

    params0_file = nfile+'.p0'
    nll0_file = nfile+'.nll0'
    assert os.path.exists(params0_file), '%s is missing.'%params0_file
    assert os.path.exists(nll0_file), '%s is missing.'%nll0_file
    params = SP.loadtxt(params0_file)
    NLL0 = SP.array([float(SP.loadtxt(nll0_file))])

    if params.ndim==1:
        rv = {'params0_g':SP.array([params[0]]),'params0_n':SP.array([params[1]]),'NLL0':NLL0}
    else:
        rv = {'params0_g':params[0],'params0_n':params[1],'NLL0':NLL0}

    return rv

Instruction: Given a code description, retrieve the corresponding code.


Question: Run pre_commands

def _parse_command_spec(self, spec, precmds):
        '''

        '''
        if 'pre_command' in spec:
            precmd_alias = spec['pre_command']
            try:
                precmd = precmds[precmd_alias]

                if self._blacklist_check(precmd):
                    raise RuntimeError("Command Blacklist: " + precmd)

                args = self._run_pre_command(precmd)
                logger.debug('Pre-command results: %s', args)

                expanded_specs = []
                for arg in args:
                    _spec = copy.copy(spec)
                    _spec['command'] = _spec['command'] + ' ' + arg
                    expanded_specs.append(_spec)
                return expanded_specs
            except LookupError:
                logger.debug('Pre-command %s not found. Skipping %s...',
                             precmd_alias, spec['command'])
                return []
        else:
            return [spec]

protected function registerCommands()
    {
        $this->application->addCommands([
            new BuildCommand($this->viewFactory, $this->filesystem),
            new PostCommand($this->viewFactory, $this->filesystem)
        ]);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Returns total used swap space

@see System::_swapDevices
@see DiskDevice::getUsed()

@return Integer

public function getSwapUsed()
    {
        if (count($this->_swapDevices) > 0) {
            $used = 0;
            foreach ($this->_swapDevices as $dev) {
                $used += $dev->getUsed();
            }

            return $used;
        } else {
            return null;
        }
    }

func (sw *SyslogHandler) dial() error {
	if sw.syslogProtocol == "" || sw.syslogProtocol == "unix" {
		logTypes := []string{"unixgram", "unix"}
		var logPaths []string
		if sw.syslogAddr != "" {
			logPaths = []string{sw.syslogAddr}
		} else {
			logPaths = []string{"/dev/log", "/var/run/syslog", "/var/run/log"}
		}
		for _, network := range logTypes {
			for _, path := range logPaths {
				conn, err := net.Dial(network, path)
				if err != nil {
					continue
				}
				sw.syslogConnection = conn
				return nil
			}
		}
		return fmt.Errorf("Could not find listening syslog daemon")
	}

	connection, err := net.Dial(sw.syslogProtocol, sw.syslogAddr)
	if err != nil {
		return err
	}
	sw.syslogConnection = connection
	return nil
}

Instruction: Given a code description, retrieve the corresponding code.


Question: Invalidates the cached resource index

public function invalidateResourceIndex(FilterInterface $filter = null)
    {
        $this->cache->deleteItem($this->getResourceIndexKey($filter));
    }

protected function addPatchResourceUpdate($name, $base, $controller)
    {
        $uri = $this->getResourceUri($name) .'/{' .$base .'}';

        $this->router->patch($uri, $controller.'@update');
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: Derived visitor method: generate code for a statement.

public void genStat(JCTree tree, Env<GenContext> env) {
        if (code.isAlive()) {
            code.statBegin(tree.pos);
            genDef(tree, env);
        } else if (env.info.isSwitch && tree.hasTag(VARDEF)) {
            // variables whose declarations are in a switch
            // can be used even if the decl is unreachable.
            code.newLocal(((JCVariableDecl) tree).sym);
        }
    }

def changed(self):

        if not self.parents:
            return []
        return ChangedFileNodesGenerator([n for n in
                                self._get_paths_for_status('modified')], self)

Instruction: Given a code description, retrieve the corresponding code.


Question: // Remove any data that should not be version controlled

func filterObject(object saveObject) {
	delete(object.Metadata.Annotations, "deployment.kubernetes.io/revision")
	delete(object.Metadata.Annotations, "kubectl.kubernetes.io/last-applied-configuration")
	delete(object.Metadata.Annotations, "kubernetes.io/change-cause")
	deleteNested(object.Spec, "template", "metadata", "creationTimestamp")
	deleteEmptyMapValues(object.Spec)
}

def save_excursion
      old_point = new_mark
      old_mark = @mark&.dup
      old_column = @goal_column
      begin
        yield
      ensure
        point_to_mark(old_point)
        old_point.delete
        if old_mark
          @mark.location = old_mark.location
          old_mark.delete
        end
        @goal_column = old_column
      end
    end

Instruction: Given a code description, retrieve the corresponding code.


Question:
Caches the cp attachment file entries in the entity cache if it is enabled.

@param cpAttachmentFileEntries the cp attachment file entries

@Override
	public void cacheResult(List<CPAttachmentFileEntry> cpAttachmentFileEntries) {
		for (CPAttachmentFileEntry cpAttachmentFileEntry : cpAttachmentFileEntries) {
			if (entityCache.getResult(
						CPAttachmentFileEntryModelImpl.ENTITY_CACHE_ENABLED,
						CPAttachmentFileEntryImpl.class,
						cpAttachmentFileEntry.getPrimaryKey()) == null) {
				cacheResult(cpAttachmentFileEntry);
			}
			else {
				cpAttachmentFileEntry.resetOriginalValues();
			}
		}
	}

InputStream downloadStream(String fileName) throws SnowflakeSQLException
  {
    if (stageInfo.getStageType() == StageInfo.StageType.LOCAL_FS)
    {
      logger.error("downloadStream function doesn't support local file system");

      throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
                                      ErrorCode.INTERNAL_ERROR.getMessageCode(),
                                      "downloadStream function only supported in remote stages");
    }

    remoteLocation remoteLocation =
        extractLocationAndPath(stageInfo.getLocation());

    String stageFilePath = fileName;

    if (!remoteLocation.path.isEmpty())
    {
      stageFilePath = SnowflakeUtil.concatFilePathNames(remoteLocation.path,
                                                        fileName, "/");
    }

    RemoteStoreFileEncryptionMaterial encMat = srcFileToEncMat.get(fileName);

    return storageFactory.createClient(stageInfo, parallel, encMat)
        .downloadToStream(connection, command, parallel, remoteLocation.location,
                          stageFilePath, stageInfo.getRegion());
  }

Instruction: Given a code description, retrieve the corresponding code.


Question: Calculate the stability classification for this case.

def compute_stability_classification(self, predicted_data, record, dataframe_record):
        ''''''
        stability_classification, stability_classication_x_cutoff, stability_classication_y_cutoff = None, self.stability_classication_x_cutoff, self.stability_classication_y_cutoff
        if record['DDG'] != None:
            stability_classification = fraction_correct([record['DDG']], [predicted_data[self.ddg_analysis_type]], x_cutoff = stability_classication_x_cutoff, y_cutoff = stability_classication_y_cutoff)
            stability_classification = int(stability_classification)
            assert(stability_classification == 0 or stability_classification == 1)
        dataframe_record['StabilityClassification'] = stability_classification

public static void addAlgorithm(StructureAlignment alg) {
		//ensure uniqueness
		try {
			getAlgorithm(alg.getAlgorithmName());
			// algorithm was found. Do nothing.
		} catch(StructureException e) {
			// no algorithm found, so it's new
			algorithms.add(alg);
		}
	}

Instruction: Given a code description, retrieve the corresponding code.


Question:
Visits a {@code ModuleElement} by calling {@code
defaultAction}.

@param e the element to visit
@param p a visitor-specified parameter
@return  the result of {@code defaultAction}

@Override
    public R visitModule(ModuleElement e, P p) {
        return defaultAction(e, p);
    }

public function set_model( $model )
    {
        // Check that the required arguments are provided.
        foreach( $this->required_arguments() as $key )
        {
            if ( !isset($model[$key]) )
            {
                throw new \RuntimeException('The required argument "'.$key.'" was not provided for '.get_called_class());
            }
        }

        // Assign the name of the component as the id if no id was specified
        if( !isset($model['id']) && isset($model['name']) )
        {
            $model['id'] = $model['name'];
        }

        // A name must be specified when a component has a visibility condition
        if( isset($model['show']) && !isset($model['name']) )
        {
            throw new \RuntimeException('Components with a visibility condition (a "show" argument) must have a name');
        }

        $this->model = array_merge( $this->default_model(), $model );
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: // SetTaskToken sets the TaskToken field's value.

func (s *SendTaskHeartbeatInput) SetTaskToken(v string) *SendTaskHeartbeatInput {
	s.TaskToken = &v
	return s
}

func BuildJWT(subject string, ttl time.Duration, privateKey []byte) (token string, err error) {
	claims := jwt.StandardClaims{
		Issuer:    subject,
		Subject:   subject,
		IssuedAt:  time.Now().Add(-20 * time.Second).Unix(),
		NotBefore: time.Now().Add(-20 * time.Second).Unix(),
	}
	if ttl > 0 {
		claims.ExpiresAt = time.Now().Add(ttl).Unix()
	}
	tokenBuilder := jwt.NewWithClaims(jwt.SigningMethodES256, claims)
	var key *ecdsa.PrivateKey
	key, err = jwt.ParseECPrivateKeyFromPEM(privateKey)
	if err != nil {
		return
	}
	token, err = tokenBuilder.SignedString(key)
	if err != nil {
		return
	}
	return
}

Instruction: Given a code description, retrieve the corresponding code.


Question:
Traverse a node when leaving.
@param  \PhpParser\Node $node Traversing node
@return \PhpParser\Node\Name Updated node

public function leaveNode(Node $node)
    {
        if ($node instanceof Stmt\Class_
            || $node instanceof Stmt\Interface_
            || $node instanceof Stmt\Trait_
        ) {
            if (empty($this->suffix) && !empty($this->namespaceNode)) {
                $node->name = $this->append(new Name($node->name), $this->namespaceNode);
            }
            else {
                $node->name = $node->name . $this->suffix;
            }
        } elseif ($node instanceof Name) {
            if (!$this->cancelNext) {
                return $this->appendSuffix($node);
            }
            $this->cancelNext = false;
        } elseif ($node instanceof Stmt\Use_) {
            $this->isImport = false;
        } elseif ($node instanceof Stmt\GroupUse) {
            $this->groupImport = false;
        }
    }

public function setName($name)
    {
        $this->name = $name;
        if ($this->node) {
            $this->node->name = $name;
        }
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: Marshall the given parameter object.

public void marshall(Hit hit, ProtocolMarshaller protocolMarshaller) {

        if (hit == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(hit.getId(), ID_BINDING);
            protocolMarshaller.marshall(hit.getFields(), FIELDS_BINDING);
            protocolMarshaller.marshall(hit.getExprs(), EXPRS_BINDING);
            protocolMarshaller.marshall(hit.getHighlights(), HIGHLIGHTS_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options)
    {
        $this->_prepareParamsData($data);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Implements \Iterator::rewind().

Resets the counter, timeout, and limit.

public function rewind()
    {
        $this->_count = 0;

        $timeout = $this->_agent->getTimeout();
        if ($timeout != CollectionAgentAbstract::NO_LIMIT) {
            $this->_expiry = $timeout + time();
        } else {
            // Pay homage to the Unix time apocalypse.
            // @see http://en.wikipedia.org/wiki/Year_2038_problem
            $this->_expiry = 2147483647;
        }
    }

public void set(int i) {
		int offset = i - this.sizeinwords * WORDSIZE;
		if (offset + WORDSIZE < 0) {
			throw new IllegalArgumentException("unsupported write back");
		} else if ((offset + WORDSIZE >= 0) && (offset < 0)) {
			final int before = this.buffer.get(this.buffer.size() - 1);
			this.buffer.set(this.buffer.size() - 1, before
					| (1 << (offset + WORDSIZE)));
			// if(before != buffer.get(buffer.size()-1)) ++ cardinality;
		} else {
			final int numberofemptywords = offset / WORDSIZE;
			offset -= numberofemptywords * WORDSIZE;
			fastadd(1 << offset, this.sizeinwords + numberofemptywords);
			// ++cardinality;
		}

	}

Instruction: Given a code description, retrieve the corresponding code.


Question:
Get an item.
@param string $key
@return array|bool|mixed

public function get($key)
    {
        $key = trim($key, '.');
        if ($this->has($key)) {
            $array =& $this->_items;
            if (strpos($key, '.') !== false) {
                foreach (explode('.', $key) as $v)
                    $array =& $array[$v];
                return $array;
            } else {
                return $this->_items[$key];
            }
        }
        return false;
    }

public static function server($mKeys = null, $bXssClean = false)
    {
        $aArray = isset($_SERVER) ? $_SERVER : [];
        return static::getItemsFromArray($mKeys, $bXssClean, $aArray);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Updates list for the superclass.

@param list	the list to update
@param superclass	the superclass
@param classes	the names to add

protected void updateClasses(HashMap<String,List<Class>> list, String superclass, List<Class> classes) {
    if (!list.containsKey(superclass)) {
      list.put(superclass, classes);
    }
    else {
      for (Class cls : classes) {
        if (!list.get(superclass).contains(cls))
          list.get(superclass).add(cls);
      }
    }
  }

def add_batch_parser(subparsers, parent_parser):

    parser = subparsers.add_parser(
        'batch',
        help='Displays information about batches and submit new batches',
        description='Provides subcommands to display Batch information and '
        'submit Batches to the validator via the REST API.')

    grand_parsers = parser.add_subparsers(title='subcommands',
                                          dest='subcommand')
    grand_parsers.required = True
    add_batch_list_parser(grand_parsers, parent_parser)
    add_batch_show_parser(grand_parsers, parent_parser)
    add_batch_status_parser(grand_parsers, parent_parser)
    add_batch_submit_parser(grand_parsers, parent_parser)

Instruction: Given a code description, retrieve the corresponding code.


Question: Return/yield tuples or lists corresponding to each row to be inserted.

def rows(self):

        with self.input().open('r') as fobj:
            for line in fobj:
                yield line.strip('\n').split('\t')

def put(self, _name, **values):

        try:
            sql = self.sqles[_name]
            data = sql['data']
            if sql['positional']:
                d = [values[k] for k, v in sql['fields'].items()]
            else:
                d = {v:values[k] for k, v in sql['fields'].items()}
            data.append(d)
            if self.size and len(data) >= self.size:
                do_(sql['raw_sql'], args=data)
                sql['data'] = []
        except:
            if self.transcation:
                Rollback(self.engine)
            raise

Instruction: Given a code description, retrieve the corresponding code.


Question:
Does the mode allow for course update?

@return bool

public function can_update() {
        return in_array($this->mode,
                array(
                    tool_uploadcourse_processor::MODE_UPDATE_ONLY,
                    tool_uploadcourse_processor::MODE_CREATE_OR_UPDATE)
                ) && $this->updatemode != tool_uploadcourse_processor::UPDATE_NOTHING;
    }

protected function modelExists()
    {
        $model = $this->option('model');

        if (empty($model)) {
            return true;
        }

        return class_exists($model) && is_subclass_of($model, Model::class);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Resolves the {@link BeanConfiguration} class instances. Default implementation uses ServiceLoader pattern.

@return The bean definition classes

protected @Nonnull Iterable<BeanConfiguration> resolveBeanConfigurations() {
        final SoftServiceLoader<BeanConfiguration> definitions = SoftServiceLoader.load(BeanConfiguration.class, classLoader);
        List<BeanConfiguration> list = new ArrayList<>(20);
        for (ServiceDefinition<BeanConfiguration> definition : definitions) {
            if (definition.isPresent()) {
                list.add(definition.load());
            }
        }
        return list;
    }

public static ResultMap getResultMap(Configuration configuration,Class<?> entityClass) {
        List<ResultMapping> resultMappings = new ArrayList<ResultMapping>();

        Set<ColumnMapper> entityClassColumns = EntityHelper.getEntityMapper(entityClass).getColumnsMapper();
        for (ColumnMapper entityColumn : entityClassColumns) {
            ResultMapping.Builder builder = new ResultMapping.Builder(configuration, entityColumn.getProperty(), entityColumn.getColumn(), entityColumn.getJavaType());
            if (entityColumn.getJdbcType() != null) {
                builder.jdbcType(entityColumn.getJdbcType());
            }

            List<ResultFlag> flags = new ArrayList<ResultFlag>();
            if (entityColumn.isId()) {
                flags.add(ResultFlag.ID);
            }
            builder.flags(flags);
            builder.lazy(false);
            resultMappings.add(builder.build());
        }
        ResultMap.Builder builder = new ResultMap.Builder(configuration, "BaseResultMap", entityClass, resultMappings, true);
        return builder.build();
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: UTF-16BE => ISO-8859-1

public static function iconv_fallback_utf16be_iso88591($string) {
		if (substr($string, 0, 2) == "\xFE\xFF") {
			// strip BOM
			$string = substr($string, 2);
		}
		$newcharstring = '';
		for ($i = 0; $i < strlen($string); $i += 2) {
			$charval = self::BigEndian2Int(substr($string, $i, 2));
			$newcharstring .= (($charval < 256) ? chr($charval) : '?');
		}
		return $newcharstring;
	}

String getLiteralPrefix() {

        switch (type) {

            case Types.SQL_BINARY :
            case Types.SQL_BLOB :
            case Types.SQL_CHAR :
            case Types.SQL_NCHAR :
            case Types.SQL_CLOB :
            case Types.SQL_VARBINARY :
            case Types.SQL_VARCHAR :
            case Types.SQL_NVARCHAR :
                return "'";

            case Types.SQL_DATALINK :
                return "'";    // hypothetically: "{url '";

            case Types.SQL_DATE :
                return "'";    // or JDBC escape: "{d '";

            case Types.OTHER :
                return "'";    // hypothetically: "{o '"; or new "pkg.cls"(...)

            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIME :
                return "'";    // or JDBC escape: "{t '";

            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP :
                return "'";    // or JDBC escape: "{ts '";

            case Types.SQL_XML :
                return "'";    // hypothetically: "{xml '";

            default :
                return null;
        }
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
// Sub performs an element-wise subtraction of two matrices, this is
// equivalent to iterating over every element of m1 and subtracting the corresponding value of m2.

public function override($post_type, $post){
        if( $this->is_valid_post_type($post_type) ){
            foreach( $this->fields as $name => $vars ){
                switch( $name ){
                    case 'excerpt':
                        remove_meta_box('postexcerpt', $post_type, 'normal');
                        break;
                    case 'post_format':
                        remove_meta_box('formatdiv', $post_type, 'side');
                        break;
                    default:
                        if( false !== array_search(Taxonomy::class, class_uses($vars['class'])) ){
                            if( taxonomy_exists($name) ){
                                if( is_taxonomy_hierarchical($name) ){
                                    $box_id = $name.'div';
                                }else{
                                    $box_id = 'tagsdiv-'.$name;
                                }
                                remove_meta_box($box_id, $post_type, 'side');
                            }
                        }else{
                            // Do nothing
                        }
                        break;
                }
            }
        }
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: get the last dom in object(for insertion operation)

function(item){
    var children = item.children;

    if(typeof item.last === "function") return item.last();
    if(typeof item.nodeType === "number") return item;

    if(children && children.length) return combine.last(children[children.length - 1]);
    if(item.group) return combine.last(item.group);

  }

def add_video(self, shape_id):
        """"""
        video_xml = (
            '<p:video %s>\n'
            '  <p:cMediaNode vol="80000">\n'
            '    <p:cTn id="%d" fill="hold" display="0">\n'
            '      <p:stCondLst>\n'
            '        <p:cond delay="indefinite"/>\n'
            '      </p:stCondLst>\n'
            '    </p:cTn>\n'
            '    <p:tgtEl>\n'
            '      <p:spTgt spid="%d"/>\n'
            '    </p:tgtEl>\n'
            '  </p:cMediaNode>\n'
            '</p:video>\n' % (nsdecls('p'), self._next_cTn_id, shape_id)
        )
        video = parse_xml(video_xml)
        self.append(video)

Instruction: Given a code description, retrieve the corresponding code.


Question:
Initialize this component. <br>
This is basically called by DI setting file.

@PostConstruct
    public synchronized void initialize() {
        final FwCoreDirection direction = assistCoreDirection();
        final TimeResourceProvider provider = direction.assistTimeResourceProvider();
        businessTimeHandler = provider.provideBusinessTimeHandler(this);
        if (businessTimeHandler == null) {
            String msg = "The provider returned null business-time handler: " + provider;
            throw new FwRequiredAssistNotFoundException(msg);
        }
        if (direction.isDevelopmentHere()) {
            developmentProvider = provider;
        } else {
            currentIgnoreTransaction = provider.isCurrentIgnoreTransaction();
            adjustTimeMillis = provider.provideAdjustTimeMillis();
            adjustAbsoluteMode = provider.isAdjustAbsoluteMode();
        }
        realCurrentTimeProvider = provider.provideRealCurrentTimeProvider(); // null allowed
        showBootLogging();
    }

@Override
    public String getCustomSetString() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "getCustomSetString");

        String ret = PmiRegistry.getInstrumentationLevelString60();

        if (tc.isEntryEnabled())
            Tr.exit(tc, "getCustomSetString");

        return ret;
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Allow an extension to prepend the extension configurations.

@param ContainerBuilder $container

public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (isset($bundles['AsseticBundle'])) {

            $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
            $loader->load('services.yml');

            $scripts = $container->getParameter('p2_ratchet.assetic.assets_js');
            $assetPath = __DIR__ . '/../Resources/assets';

            $inputs = array_map(function($value) use ($assetPath) {
                return $assetPath . '/' . $value;
            }, $scripts);

            $container->prependExtensionConfig(
                'assetic',
                array(
                    'assets' => array(
                        'p2_ratchet_js' => array(
                            'inputs' => $inputs
                        )
                    )
                )
            );
        }
    }

public function execute(TransactionData $transactionData, $argument = null)
    {
        foreach ($this->expectationBackup->listExpectations() as $expectation) {
            $this->expectationStorage->addExpectation($expectation);
        }
        $this->logger->debug('Pre-defined expectations are restored, scenarios and requests history are cleared.');

        $transactionData->setResponse(
            $transactionData->getResponse()->withStatus(200)
        );
    }

Instruction: Given a code description, retrieve the corresponding code.


Question: Build the base query dictionary

def _build_query(self):

        if isinstance(self._query_string, QueryString):
            self._query_dsl = self._query_string
        elif isinstance(self._query_string, string_types):
            self._query_dsl = QueryString(self._query_string)
        else:
            self._query_dsl = MatchAll()

private function prepareQuery(DocumentManager $dm)
    {
        $qb = $dm->createQueryBuilder($this->className);

        $qb->attr('hash')->equals($this->hash);
        $qb->attr('range')->equals($this->range);

        return $qb;
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
See {@link #initialize(URI, Configuration, boolean)} for details; calls with third arg
defaulting to 'true' for initializing the superclass.

@param path URI of a file/directory within this file system.
@param config Hadoop configuration.

@Override
  public void initialize(URI path, Configuration config) throws IOException {
    initialize(path, config, /* initSuperclass= */ true);
  }

def get_config_from_env(cls):

        core_path = os.path.join(os.environ['HADOOP_HOME'], 'conf', 'core-site.xml')
        core_configs = cls.read_core_config(core_path)

        hdfs_path = os.path.join(os.environ['HADOOP_HOME'], 'conf', 'hdfs-site.xml')
        hdfs_configs = cls.read_hdfs_config(hdfs_path)

        if (not core_configs) and (not hdfs_configs):
            raise Exception("No config found in %s nor in %s" % (core_path, hdfs_path))

        configs = {
            'use_trash': hdfs_configs.get('use_trash', core_configs.get('use_trash', False)),
            'use_sasl': core_configs.get('use_sasl', False),
            'hdfs_namenode_principal': hdfs_configs.get('hdfs_namenode_principal', None),
            'namenodes': hdfs_configs.get('namenodes', []) or core_configs.get('namenodes', [])
        }

        return configs

Instruction: Given a code description, retrieve the corresponding code.


Question:
Insert Action

The data to be inserted into the database.

@param array $values

@return int

public function insert(array $values)
    {
        $n_inserted = 0;

        $resets = [];

        foreach ($values as $key => $value) {
            if (is_array($value)) {
                $n_inserted += $this->insertOne($value);
            } else {
                $resets[$key] = $value;
            }

            unset($values[$key]);
        }

        if (!empty($resets)) {
            $n_inserted += $this->insertOne($resets);
        }

        return $n_inserted;
    }

function setActionParameter( $parameterName, $parameterValue, $view = '' )
    {
        if ( $view == '' )
            $view = self::currentView();
        $this->ViewActionParameters[$view][$parameterName] = $parameterValue;
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Find an item by the Primary Key ID. This does not use the search() functionality
@param integer $id
@return ActiveRecord

public function getById($id)
    {
        $database = DatabaseLayer::getInstance();
        $select = $database->select($this->getTableName(), $this->getTableAlias());
        $select->fields($this->getTableAlias());
        $select->condition($this->getIDField(), $id);
        $results = $select->execute(get_called_class());
        $result = end($results);
        return $result;
    }

public function whereSearch($filters)
    {
        $data = $this->request->get();

        foreach ($filters as $k => $v) {
            preg_match('#^(\w+)(.*)$#', is_string($k) ? $k : $v, $match);
            $field = $match[1];

            if (is_int($k)) {
                if (!isset($data[$field])) {
                    continue;
                }
                $value = $data[$field];
                if (is_string($value)) {
                    $value = trim($value);
                    if ($value === '') {
                        continue;
                    }
                }
                $this->where($v, $value);
            } else {
                $this->where($k, $v);
            }
        }

        return $this;
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Calculate a sha1 has of either a single file or a list
of files based on the data set by load_data.

@return string

public function get_sha1() {

        if ($this->plugin && $this->editor) {
            $plugin = $this->get_submission_plugin();
            $options = portfolio_format_text_options();
            $options->context = context_module::instance($this->cmid);

            $text = format_text($plugin->get_editor_text($this->editor, $this->sid),
                                $plugin->get_editor_format($this->editor, $this->sid),
                                $options);
            $textsha1 = sha1($text);
            $filesha1 = '';
            try {
                $filesha1 = $this->get_sha1_file();
            } catch (portfolio_caller_exception $e) {
                // No files.
            }
            return sha1($textsha1 . $filesha1);
        }
        return $this->get_sha1_file();
    }

public function assertStringEqualsFile($expectedFile, $canonicalize = false, $ignoreCase = false) {
        $this->callAssertMethod(__FUNCTION__, [
            'expected' => $expectedFile,
            'additionalParams' => [
                $canonicalize,
                $ignoreCase,
            ],
        ]);
    }

Instruction: Given a code description, retrieve the corresponding code.


Question:
Login Form
@return Form

public function createComponentLoginForm() : Form
    {
        $form = new Form;

        $form->addText('email')
            ->setRequired('E-mail je povinný.')
            ->addRule(Form::EMAIL, 'E-mail není ve správném formátu.');

        $form->addPassword('password')
            ->setRequired('Heslo je povinné.');

        $form->addSubmit('login');

        $form->onValidate[] = function (Form $form) { $this->validate($form); };
        $form->onSuccess[] = function (Form $form) { $this->success($form); };

        return $form;
    }

def resend_welcome_message(self, user, base_url):

        user.require_email_confirmation()
        self.save(user)
        self.send_welcome_message(user, base_url)

Instruction: Given a code description, retrieve the corresponding code.


Question: Returns modules configuration for this entity based on current user permissions.

@GetMapping("/modules")
  @ResponseBody
  public ModulesConfigResponse getModules(@RequestParam("entity") String entityTypeId) {
    EntityType entityType = dataService.getEntityType(entityTypeId);
    List<Module> modules = dataExplorerService.getModules(entityType);

    ModulesConfigResponse modulesConfigResponse = new ModulesConfigResponse();
    modules.forEach(
        module -> {
          String id;
          String label;
          String icon;

          switch (module) {
            case DATA:
              id = MOD_DATA;
              label = "Data";
              icon = "grid-icon.png";
              break;
            case AGGREGATION:
              id = "aggregates";
              label =
                  messageSource.getMessage(
                      "dataexplorer_aggregates_title", new Object[] {}, getLocale());
              icon = "aggregate-icon.png";
              break;
            case REPORT:
              id = MOD_ENTITIESREPORT;
              label = dataExplorerSettings.getEntityReport(entityTypeId);
              icon = "report-icon.png";
              break;
            default:
              throw new UnexpectedEnumException(module);
          }

          modulesConfigResponse.add(new ModuleConfig(id, label, icon));
        }

public function view($id = null)
    {
        $cmsPermission = $this->CmsPermission->get($id, [
            'contain' => ['CmsTerm', 'CmsContent']
        ]);
        $this->set('cmsPermission', $cmsPermission);
        $this->set('_serialize', ['cmsPermission']);
    }

Instruction: Given a code description, retrieve the corresponding code.