set <INSTRUCTION> instr_key to instr_value

        :param instr_key: str, label key
        :param instr_value: str or None, new label/env value or None to remove
11065
def _modify_instruction_label_env(self, instruction, instr_key, instr_value):
        
        if instruction == 'LABEL':
            instructions = self.labels
        elif instruction == 'ENV':
            instructions = self.envs
        else:
            raise ValueError("Unknown instruction '%s'" % instruction)

        if instr_key not in instructions:
            raise KeyError('%s not in %ss' % (instr_key, instruction))

        # extract target instructions from the final stage only
        candidates = []
        for insn in self.structure:
            if insn['instruction'] == 'FROM':
                candidates = []
            if insn['instruction'] == instruction:
                candidates.append(insn)

        # Find where in the file to put the changes
        content = startline = endline = None
        for candidate in candidates:
            words = list(WordSplitter(candidate['value']).split(dequote=False))

            # LABEL/ENV syntax is one of two types:
            if '=' not in words[0]:  # LABEL/ENV name value
                # Remove quotes from key name and see if it's the one
                # we're looking for.
                if WordSplitter(words[0]).dequote() == instr_key:
                    if instr_value is None:
                        # Delete this line altogether
                        content = None
                    else:
                        # Adjust label/env value
                        words[1:] = [quote(instr_value)]

                        # Now reconstruct the line
                        content = " ".join([instruction] + words) + '\n'

                    startline = candidate['startline']
                    endline = candidate['endline']
                    break
            else:  # LABEL/ENV "name"="value"
                for index, token in enumerate(words):
                    key, _ = token.split("=", 1)
                    if WordSplitter(key).dequote() == instr_key:
                        if instr_value is None:
                            # Delete this label
                            del words[index]
                        else:
                            # Adjust label/env value
                            words[index] = "{0}={1}".format(key,
                                                            quote(instr_value))

                        if len(words) == 0:
                            # We removed the last label/env, delete the whole line
                            content = None
                        else:
                            # Now reconstruct the line
                            content = " ".join([instruction] + words) + '\n'

                        startline = candidate['startline']
                        endline = candidate['endline']
                        break

        # We know the label/env we're looking for is there
        assert startline and endline

        # Re-write the Dockerfile
        lines = self.lines
        del lines[startline:endline + 1]
        if content:
            lines.insert(startline, content)
        self.lines = lines
706527
def execute(self, asm_instr):
        
        # Update the instruction pointer.
        self.ir_emulator.registers[self.ip] = asm_instr.address + asm_instr.size

        # Process syscall.
        if self.arch_info.instr_is_syscall(asm_instr):
            raise Syscall()

        # Process instruction and return next address instruction to execute.
        return self.__execute(asm_instr)
1097920
def encode_instruction(self, pc, instr):
        
        data = instr.split()
        operation = data[0]

        try:
            mips_op_info = MIPS.operations[operation]
        except KeyError, e:
            raise RuntimeError('Unknown operation: {}'.format(operation))

        # Grab the parsing info from the assembler operations table
        # Generate the initial operand map using the specified tokenizer
        parse_info = self.operations[operation]
        encoding_map = parse_info.tokenizer(parse_info.tokens, ''.join(data[1:]))

        # Get the binary equivalents of the operands and MIPS operation information
        self.resolve_operands(encoding_map, operation, pc)

        # Pull MIPS operation info into encoding map
        self.resolve_operation_info(encoding_map, mips_op_info)

        instruction = self.mips.generate_instruction(mips_op_info.format)
        return instruction.encode(encoding_map)
80627
def setInstrumentParameters(self, instrpars):
        
        pri_header = self._image[0].header
        usingDefaultGain = False
        usingDefaultReadnoise = False

        if self._isNotValid (instrpars['gain'], instrpars['gnkeyword']):
            instrpars['gnkeyword'] = None
        if self._isNotValid (instrpars['rdnoise'], instrpars['rnkeyword']):
            instrpars['rnkeyword'] = None
        if self._isNotValid (instrpars['exptime'], instrpars['expkeyword']):
            instrpars['expkeyword'] = 'EXPTIME'

        for chip in self.returnAllChips(extname=self.scienceExt):
            #pri_header=chip.header #stis stores stuff in the science data header

            chip.cte_dir=0

            chip._exptime = self.getInstrParameter(
                instrpars['exptime'], chip.header, instrpars['expkeyword']
            )

            if chip._exptime is None:
                print('ERROR: invalid instrument task parameter')
                raise ValueError

            if instrpars['rnkeyword'] is not None:
                chip._rdnoise   = self.getInstrParameter(
                    instrpars['rdnoise'], pri_header, instrpars['rnkeyword']
                )
            else:
                chip._rdnoise = None
                usingDefaultReadnoise = True

            if instrpars['gnkeyword'] is not None:
                chip._gain = self.getInstrParameter(
                    instrpars['gain'], pri_header, instrpars['gnkeyword']
                )
            else:
                chip._gain = None
                usingDefaultGain = True

            if chip._exptime is None:
                print('ERROR: invalid instrument task parameter')
                raise ValueError

            # We need to determine if the user has used the default readnoise/gain value
            # since if not, they will need to supply a gain/readnoise value as well

            if usingDefaultReadnoise:
                chip._rdnoise= self._setMAMADefaultReadnoise()

            if usingDefaultGain:
                chip._gain = self._setMAMADefaultGain()

            self._assignSignature(chip._chip) #this is used in the static mask
            chip._effGain=chip._gain

        # Convert the science data to electrons if specified by the user.
        self.doUnitConversions()
384380
def assign_value(self, comp_def, value, src_ref):
        
        super().assign_value(comp_def, value, src_ref)
        if "rclr" in comp_def.properties:
            del comp_def.properties["rclr"]
        if "rset" in comp_def.properties:
            del comp_def.properties["rset"]
432603
def setInstrumentParameters(self,instrpars):
        
        pri_header = self._image[0].header

        if self._isNotValid (instrpars['gain'], instrpars['gnkeyword']):
            instrpars['gnkeyword'] = None
        if self._isNotValid (instrpars['rdnoise'], instrpars['rnkeyword']):
            instrpars['rnkeyword'] = None
        if self._isNotValid (instrpars['exptime'], instrpars['expkeyword']):
            instrpars['expkeyword'] = 'EXPTIME'

        # We need to treat Read Noise and Gain as a special case since it is
        # not populated in the SBC primary header for the MAMA
        for chip in self.returnAllChips(extname=self.scienceExt):
            chip._gain      = 1.0 #self.getInstrParameter("", pri_header,
                                  #                  instrpars['gnkeyword'])
            chip._rdnoise   = 0.0 #self.getInstrParameter("", pri_header,
                                  #                   instrpars['rnkeyword'])
            chip._exptime   = self.getInstrParameter(instrpars['exptime'], pri_header,
                                                     instrpars['expkeyword'])
            if chip._exptime is None:
                print('ERROR: invalid instrument task parameter')
                raise ValueError

        # We need to determine if the user has used the default readnoise/gain value
        # since if not, they will need to supply a gain/readnoise value as well
        usingDefaultGain = instrpars['gnkeyword'] is None
        usingDefaultReadnoise = instrpars['rnkeyword'] is None

        # Set the default readnoise or gain values based upon the amount of user input given.

        # Case 1: User supplied no gain or readnoise information
        if usingDefaultReadnoise and usingDefaultGain:
            # Set the default gain and readnoise values
            self._setSBCchippars()
        # Case 2: The user has supplied a value for gain
        elif usingDefaultReadnoise and not usingDefaultGain:
            # Set the default readnoise value
            self._setDefaultSBCReadnoise()
        # Case 3: The user has supplied a value for readnoise
        elif not usingDefaultReadnoise and usingDefaultGain:
            # Set the default gain value
            self._setDefaultSBCGain()
        else:
            # In this case, the user has specified both a gain and readnoise values.  Just use them as is.
            pass
1342882
def deep_set_symbol_key(hash, key, value)
      if value.kind_of? Hash
        hash[key.to_sym] = value.inject({}) { |inner_hash, (inner_key, inner_value)| deep_set_symbol_key(inner_hash, inner_key, inner_value) }
      else
        hash[key.to_sym] = value
      end
      hash
    end
1138277
def __execute_str(self, instr):
        
        op0_val = self.read_operand(instr.operands[0])

        self.write_operand(instr.operands[2], op0_val)

        return None
1241868
def attr(key, value=None):
    '''
    
    '''
    key = target(key)

    if key is False:
        return False
    elif os.path.isdir(key):
        return key
    elif value is not None:
        return write(key, value)
    else:
        return read(key)
1155528
def _imm_default_init(self, *args, **kwargs):
    '''
    
    '''
    for (k,v) in six.iteritems({k:v for dct in (args + (kwargs,)) for (k,v) in dct}):
        setattr(self, k, v)
773458
def __taint_store(self, instr):
        
        # Get memory address.
        op2_val = self.__emu.read_operand(instr.operands[2])

        # Get taint information.
        op0_size = instr.operands[0].size
        op0_taint = self.get_operand_taint(instr.operands[0])

        # Propagate taint.
        self.set_memory_taint(op2_val, op0_size // 8, op0_taint)
162793
def internal_set(symbol, value)
      if configurables.key?(symbol)
        configurables[symbol].set(configuration, value)
      elsif config_contexts.key?(symbol)
        config_contexts[symbol].restore(value.to_hash)
      else
        if config_strict_mode == :warn
          Chef::Log.warn("Setting unsupported config value #{symbol}.")
        elsif config_strict_mode
          raise UnknownConfigOptionError, "Cannot set unsupported config value #{symbol}."
        end
        configuration[symbol] = value
      end
    end
441376
def add_instruction(self, instr):
        
        if gl.has_errors:
            return

        __DEBUG__('%04Xh [%04Xh] ASM: %s' % (self.org, self.org - self.ORG, instr.asm))
        self.set_memory_slot()
        self.orgs[self.org] += (instr,)

        for byte in instr.bytes():
            self.__set_byte(byte, instr.lineno)
567460
def cmd(self, value):
        
        cmd = None
        for insndesc in self.structure:
            if insndesc['instruction'] == 'FROM':  # new stage, reset
                cmd = None
            elif insndesc['instruction'] == 'CMD':
                cmd = insndesc

        new_cmd = 'CMD ' + value
        if cmd:
            self.add_lines_at(cmd, new_cmd, replace=True)
        else:
            self.add_lines(new_cmd)
859356
def set_iscsi_initiator_info(self, initiator_iqn):
        
        if(self._is_boot_mode_uefi() is True):
            iscsi_uri = self._check_iscsi_rest_patch_allowed()
            initiator_info = {'iSCSIInitiatorName': initiator_iqn}
            status, headers, response = self._rest_patch(iscsi_uri,
                                                         None, initiator_info)
            if status >= 300:
                msg = self._get_extended_error(response)
                raise exception.IloError(msg)
        else:
            msg = 'iSCSI initiator cannot be set in the BIOS boot mode'
            raise exception.IloCommandNotSupportedError(msg)
459674
def set(self, key, value):
        ''''''
        if hasattr(value, 'labels'):
            if 'VARIABLE' in env.config['SOS_DEBUG'] or 'ALL' in env.config[
                    'SOS_DEBUG']:
                env.log_to_file(
                    'VARIABLE',
                    f"Set {key} to {short_repr(value)} with labels {short_repr(value.labels)}"
                )
        else:
            if 'VARIABLE' in env.config['SOS_DEBUG'] or 'ALL' in env.config[
                    'SOS_DEBUG']:
                env.log_to_file(
                    'VARIABLE',
                    f"Set {key} to {short_repr(value)} of type {value.__class__.__name__}"
                )
        self._dict[key] = value
550000
def _delete_instructions(self, instruction, value=None):
        
        if instruction == 'LABEL' and value:
            self._modify_instruction_label(value, None)
            return
        if instruction == 'ENV' and value:
            self._modify_instruction_env(value, None)
            return

        lines = self.lines
        deleted = False
        for insn in reversed(self.structure):
            if insn['instruction'] == instruction:
                if value and insn['value'] != value:
                    continue
                deleted = True
                del lines[insn['startline']:insn['endline'] + 1]
        if deleted:
            self.lines = lines