Dataset Viewer
Auto-converted to Parquet Duplicate
query
stringlengths
101
233k
passage
stringlengths
17
140k
negative_1
stringlengths
18
140k
negative_2
stringlengths
18
140k
negative_3
stringlengths
18
140k
negative_4
stringlengths
18
140k
negative_5
stringlengths
18
140k
negative_6
stringlengths
17
140k
negative_7
stringlengths
18
140k
negative_8
stringlengths
18
140k
negative_9
stringlengths
18
140k
negative_10
stringlengths
18
140k
negative_11
stringlengths
18
140k
negative_12
stringlengths
18
140k
negative_13
stringlengths
18
140k
negative_14
stringlengths
18
140k
negative_15
stringlengths
18
140k
negative_16
stringlengths
17
140k
negative_17
stringlengths
18
140k
negative_18
stringlengths
18
140k
negative_19
stringlengths
18
140k
negative_20
stringlengths
18
140k
negative_21
stringlengths
18
140k
negative_22
stringlengths
18
140k
negative_23
stringlengths
18
140k
negative_24
stringlengths
18
140k
Instruct: Given the following code snippet, retrieve the most relevant code snippet. Query: func getStringValue(b []rune) (int, error) { if b[0] != '"' { return 0, NewParseError("strings must start with '\"'") } endQuote := false i := 1 for ; i < len(b) && !endQuote; i++ { if escaped := isEscaped(b[:i], b[i]); b[i] == '"' && !escaped { endQuote = true break } else if escaped { /*c, err := getEscapedByte(b[i]) if err !=
nil { return 0, err } b[i-1] = c b = append(b[:i], b[i+1:]...) i--*/ continue } } if !endQuote { return 0, NewParseError("missing '\"' in string value") } return i + 1, nil }
bytes. output := new(bytes.Buffer) output.Write(b[:firstEsc]) for _, c := range b[firstEsc:] { if isSafeChar(c) { output.WriteByte(c) } else { fmt.Fprintf(output, "%%%02X", c) } } return output.String() }
have to worry about safe JSON marshaling with json.Marshal, since '<' and '>" are reservedin XML. return string(b), nil }
errortext, err := strconv.Unquote(string(quoted)) if err != nil { return string(quoted) } return errortext }
err error) { s := unsafeBytesToString(b) return strconv.ParseInt(s, base, bitSize) }
b[i] >= '0' && b[i] <= '9' }
// If no escapes return raw conten if bytes.IndexByte(v, '\\') == -1 { return string(v), nil } return ParseString(v) }
{ scanner := bytes.NewBufferString(s) t := newParser(scanner, dest, true) return t.parse() }
{ if c == '&' { if entityQuote, n := parse.QuoteEntity(b[i:]); n > 0 { j += copy(t[j:], b[start:i]) if entityQuote != quote { t[j] = entityQuote j++ } else { j += copy(t[j:], escapedQuote) } start = i + n } } else if c == quote { j += copy(t[j:], b[start:i]) j += copy(t[j:], escapedQuote) start = i + 1 } } j += copy(t[j:], b[start:]) t[j] = quote return t[:j+1] }
return C.GoStringN((*C.char)(b.C_gss_buffer_t.value), C.int(b.C_gss_buffer_t.length)) }
(int, error) { return len(b), nil }
|| b[len(b)-1] != byte('"') { return errors.New("value is not a string") } return id.fillID(b[1 : len(b)-1]) }
`unfinished backslash escape sequence`, ) } escapeType := raw[i+1] switch escapeType { case '\\': // skip over the second slash i++ case 'n': b = '\n' i++ case '"': b = '"' i++ default: return "", Errorf( ast.Pos{ Column: tok.Pos.Column + utf8.RuneCount(raw[:i]), Line: tok.Pos.Line, }, `invalid backslash escape sequence`, ) } } buf = append(buf, b) } return string(buf), nil }
len(b.runes) + int(b.offset) }
if \z (for some byte z) is not a known escape sequence // then it appears as literal text in the string. buf.WriteString(quoted[:2]) quoted = quoted[2:] case '\n': // Ignore the escape and the line break. quoted = quoted[2:] case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '\'', '"': // One-char escape buf.WriteByte(unesc[quoted[1]]) quoted = quoted[2:] case '0', '1', '2', '3', '4', '5', '6', '7': // Octal escape, up to 3 digits. n := int(quoted[1] - '0') quoted = quoted[2:] for i := 1; i < 3; i++ { if len(quoted) == 0 || quoted[0] < '0' || '7' < quoted[0] { break } n = n*8 + int(quoted[0]-'0') quoted = quoted[1:] } if n >= 256 { // NOTE: Python silently discards the high bit, // so that '\541' == '\141' == 'a'. // Let's see if we can avoid doing that in BUILD files. err = fmt.Errorf(`invalid escape sequence \%03o`, n) return } buf.WriteByte(byte(n)) case 'x': // Hexadecimal escape, exactly 2 digits. if len(quoted) < 4 { err = fmt.Errorf(`truncated escape sequence %s`, quoted) return } n, err1 := strconv.ParseInt(quoted[2:4], 16, 0) if err1 != nil { err = fmt.Errorf(`invalid escape sequence %s`, quoted[:4]) return } buf.WriteByte(byte(n)) quoted = quoted[4:] } } s = buf.String() return }
error) { s := unsafeBytesToString(b) return strconv.ParseFloat(s, bitSize) }
//This is kind of a rough hack to replace the old []byte //detection with reflect.Uint8Type, it doesn't catch //zero-length byte slices case reflect.Slice: typ := v.Type() if typ.Elem().Kind() == reflect.Uint || typ.Elem().Kind() == reflect.Uint8 || typ.Elem().Kind() == reflect.Uint16 || typ.Elem().Kind() == reflect.Uint32 || typ.Elem().Kind() == reflect.Uint64 || typ.Elem().Kind() == reflect.Uintptr { if v.Len() > 0 { if v.Index(0).OverflowUint(257) { return string(v.Interface().([]byte)), nil } } } } return "", errors.New("Unsupported type") }
err error) { s := unsafeBytesToString(b) return strconv.ParseUint(s, base, bitSize) }
current string // move to the next string if it's present if r.i >= len(r.seq[r.si]) && r.si < len(r.seq)-1 { r.si++ r.i = 0 } return b, sep, true }
{ n *= 10 if b < '0' || b > '9' { return -1, errors.New("invalid response") } n += int(b - '0') } return n, nil }
switch { case b == '_': result.WriteByte('_') escapeLevel = 0 case b == '.': result.WriteByte(':') escapeLevel = 0 case b >= '0' && b <= '9': parsedByte = (b - 48) << 4 escapeLevel = 2 case b >= 'A' && b <= 'F': // A-F parsedByte = (b - 55) << 4 escapeLevel = 2 default: return errors.Errorf( "illegal escape sequence at byte %d (%c)", i, b, ) } case 2: switch { case b >= '0' && b <= '9': parsedByte += b - 48 case b >= 'A' && b <= 'F': // A-F parsedByte += b - 55 default: return errors.Errorf( "illegal escape sequence at byte %d (%c)", i, b, ) } result.WriteByte(parsedByte) escapeLevel = 0 default: panic("unexpected escape level") } } *tv = TagValue(result.String()) return nil }
start, end, err := splitRange(string(b)) if err != nil { return err } if start == "infinity" || start == "" { // do nothing } else { var startDate Date if startDate, err = Parse(start); err != nil { return err } term.Start = startDate } if end == "infinity" || end == "" { return nil } var endDate Date if endDate, err = Parse(end); err != nil { return err } // Remove a single day from the date (it is exclusive - we want inclusive) endDate = endDate.AddDays(-1) term.End = endDate return nil }
{ return bcode.Metadata().CodeKind + bcode.Content() }
l.consumeIdentToken() l.r.Restore() return l.r.Pos() == len(b) }
{ size := rd.ReadB() b := rd.ReadCesu8(int(size)) return b, int(size) }
Instruct: Retrieve the most relevant code snippet for the given code snippet. Query: func getBoolValue(b []rune) (int, error) { if len(b) < 4 { return 0, NewParseError("invalid boolean value") } n := 0 for _, lv := range literalValues { if len(lv) > len(b) { continue }
if isLitValue(lv, b) { n = len(lv) } } if n == 0 { return 0, NewParseError("invalid boolean value") } return n, nil }
"1"==true & "0"==false if b, err := strconv.ParseBool(s); err == nil { return interface{}(b) } } return interface{}(s) }
_, _, err := variableNV(ln) return err == nil }
panicIfNull(b) return b.Count() == b.length }
the same for both. sf.hasScript = b[0]&(1<<1) != 0 sf.change = b[0]&(1<<5) != 0 sf.unsynced = b[0]&(1<<6) != 0 sf.partialSync = b[0]&(1<<7) != 0 return int64(n), nil }
{ n *= 10 if b < '0' || b > '9' { return -1, errors.New("invalid response") } n += int(b - '0') } return n, nil }
l.consumeUnquotedURL() l.r.Restore() return l.r.Pos() == len(b) }
:= strconv.ParseBool(value) if err != nil { d.logFormatError("bool", err) return dv } return bvalue }
type assertion") } *b = v[0] == 1 return nil }
b[0]&0x80 > 0 && b[1] == 0 && b[2] == 0 && b[3] == 0 && b[4] == 0 }
true, FALSE, False, false if s != "t" && s != "T" && s != "f" && s != "F" { if b, err := strconv.ParseBool(s); err == nil { return interface{}(b) } } } return interface{}(s) }
Value{t: reflect.Bool, b: b} }
num; i++ { b.AppendBools(value) } }
if b != 0 && b != 1 { err = InvalidBool } return b == 1, err }
{ *b = false if strings.ToLower(attr.Value) == "true" { *b = true } return nil }
return (b1 << 4) | b2, b1 != 255 && b2 != 255 }
(val bool) { val, _ = tr.BoolErr(nn) return }
if err != nil { return 0, QROutOfRange } v, err := sqltypes.ToInt64(bv) if err != nil { return 0, QROutOfRange } return v, QROK }
if exists { otherValue, isType := nestedGenericValue.(bool) if !isType { return true, incorrectTypeForFlagError(name, "bool", nestedGenericValue) } return otherValue, nil } return true, nil }
fmt.Errorf("unsupported type BoolT for JSONSource") }
if len(b) > 0 && b[0] != ',' { return false } if n == 0 { return true } return ae[n-1] == ' ' }
if exists { otherValue, isType := nestedGenericValue.(bool) if !isType { return false, incorrectTypeForFlagError(name, "bool", nestedGenericValue) } return otherValue, nil } return false, nil }
if b < '0' || b > '9' { return -1, protocolError("illegal bytes in length") } n += int(b - '0') } return n, nil }
ok bool) { return b.buf.last() }
len(b.data) >= n }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func getNumericalValue(b []rune) (int, int, error) { if !isDigit(b[0]) { return 0, 0, NewParseError("invalid digit value") } i := 0 helper := numberHelper{} loop: for negativeIndex := 0; i < len(b); i++ { negativeIndex++ if !isDigit(b[i]) { switch b[i] { case '-': if helper.IsNegative() || negativeIndex != 1 { return 0, 0, NewParseError("parse error '-'") } n := getNegativeNumber(b[i:]) i += (n - 1) helper.Determine(b[i]) continue case '.': if err := helper.Determine(b[i]); err != nil { return 0, 0, err } case 'e', 'E': if err := helper.Determine(b[i]); err != nil {
return 0, 0, err } negativeIndex = 0 case 'b': if helper.numberFormat == hex { break } fallthrough case 'o', 'x': if i == 0 && b[i] != '0' { return 0, 0, NewParseError("incorrect base format, expected leading '0'") } if i != 1 { return 0, 0, NewParseError(fmt.Sprintf("incorrect base format found %s at %d index", string(b[i]), i)) } if err := helper.Determine(b[i]); err != nil { return 0, 0, err } default: if isWhitespace(b[i]) { break loop } if isNewline(b[i:]) { break loop } if !(helper.numberFormat == hex && isHexByte(b[i])) { if i+2 < len(b) && !isNewline(b[i:i+2]) { return 0, 0, NewParseError("invalid numerical character") } else if !isNewline([]rune{b[i]}) { return 0, 0, NewParseError("invalid numerical character") } break loop } } } } return helper.Base(), i, nil }
if !isDigit(b[i]) { return i } } return i }
count, n := binary.Uvarint(b) if n <= 0 { e.err = fmt.Errorf("booleanDecoder: invalid count") return } e.b = b[n:] e.i = -1 e.n = int(count) if min := len(e.b) * 8; min < e.n { // Shouldn't happen - TSM file was truncated/corrupted e.n = min } }
fmt.Sprintf("Couldn't lex number, junk after decimal point: %v", strconv.QuoteRuneToASCII(r)), l.prevLocation()) } case numAfterDigit: switch { case r == 'e' || r == 'E': state = numAfterE case r >= '0' && r <= '9': state = numAfterDigit default: break outerLoop } case numAfterE: switch { case r == '+' || r == '-': state = numAfterExpSign case r >= '0' && r <= '9': state = numAfterExpDigit default: return l.makeStaticErrorPoint( fmt.Sprintf("Couldn't lex number, junk after 'E': %v", strconv.QuoteRuneToASCII(r)), l.prevLocation()) } case numAfterExpSign: if r >= '0' && r <= '9' { state = numAfterExpDigit } else { return l.makeStaticErrorPoint( fmt.Sprintf("Couldn't lex number, junk after exponent sign: %v", strconv.QuoteRuneToASCII(r)), l.prevLocation()) } case numAfterExpDigit: if r >= '0' && r <= '9' { state = numAfterExpDigit } else { break outerLoop } } } l.backup() l.emitToken(tokenNumber) return nil }
/* boundary case: 9223372036854775808 */ if !d.negative && x == math.MinInt64 { return math.MaxInt64, ErrOverflow } if !d.negative { x = -x } for i := d.digitsFrac; i > 0; i -= digitsPerWord { if d.wordBuf[wordIdx] != 0 { return x, ErrTruncated } wordIdx++ } return x, nil }
error) { s := unsafeBytesToString(b) return strconv.ParseFloat(s, bitSize) }
nil { return -1, err } return ParseBytes(b) }
if len(denom) == 0 { // err = ErrFormatWrong // return // } } value = str[0:pos] // grab the elements of the suffix suffixStart := pos for i := pos; ; i++ { if i >= end { suffix = str[suffixStart:end] return } if !strings.ContainsAny(str[i:i+1], "eEinumkKMGTP") { pos = i break } } if pos < end { switch str[pos] { case '-', '+': pos++ } } Suffix: for i := pos; ; i++ { if i >= end { suffix = str[suffixStart:end] return } switch str[i] { case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': default: break Suffix } } // we encountered a non decimal in the Suffix loop, but the last character // was not a valid exponent err = ErrFormatWrong return }
n, b := GetNumBase(num) return strconv.ParseInt(n, b, 64) }
s[1] == 'X'): if len(s) < 3 { err = strconv.ErrSyntax goto Error } base = 16 s = s[2:] default: base = 10 } default: err = errors.New("invalid base " + strconv.Itoa(base)) goto Error } // Cutoff is the smallest number such that cutoff*base > maxInt64. // Use compile-time constants for common cases. switch base { case 10: cutoff = math.MaxInt64/10 + 1 case 16: cutoff = math.MaxInt64/16 + 1 default: cutoff = math.MaxInt64/int64(base) + 1 } maxVal = math.MaxInt64 for ; i < len(s); i++ { if n >= cutoff { // n*base overflows return parseLargeInt(float64(n), s[i:], base, sign) } v := digitVal(s[i]) if v >= base { break } n *= int64(base) n1 := n + int64(v) if n1 < n || n1 > maxVal { // n+v overflows return parseLargeInt(float64(n)+float64(v), s[i+1:], base, sign) } n = n1 } if i == 0 { err = strconv.ErrSyntax goto Error } if sign { n = -n } return intToValue(n), nil Error: return _NaN, err }
b[num] >= 'a' && b[num] <= 'z' || b[num] >= 'A' && b[num] <= 'Z' { i := num + 1 for i < len(b) && (b[i] >= 'a' && b[i] <= 'z' || b[i] >= 'A' && b[i] <= 'Z') { i++ } return num, i - num } return num, 0 }
int(b[1]) return decimalBinSize(precision, frac) + 2, nil }
err error) { s := unsafeBytesToString(b) return strconv.ParseInt(s, base, bitSize) }
unmarshalJSONEnum(b, pbexamplepb.NumericEnum_value) }
length := int(first) - positiveTagStart if len(b) < length { return nil, 0, errors.Trace(errDecodeInsufficient) } var v uint64 for _, c := range b[:length] { v = (v << 8) | uint64(c) } return b[length:], v, nil }
working and not just putting // the default in (which is `0`). valInt := -1 value := string(b) if value == `"never"` || value == `"null"` || value == "never" || value == "null" { valInt = 0 } else { valInt, err = strconv.Atoi(value) } *tf = TimeoutField(valInt) return }
if b[0] == '1' { value = HIGH } else { value = LOW } } return value, e }
'-') && afterE: afterE = false default: r.pos += i if !isTokenEnd(c) { r.errSyntax() } else { r.token.byteValue = r.Data[r.start:r.pos] } return } } r.pos = len(r.Data) r.token.byteValue = r.Data[r.start:] }
i = (uint32(b[2]) << 23) | (uint32(b[3]) << 15) | (uint32(b[4]) << 7) | (uint32(b[5]) >> 1) i >>= (29 - uint32(b[1])) return int(i) }
is bit 0, bigger - bit 1. // const HIGH_LOW_DUR_AVG = (24 + (70-24)/2) * time.Microsecond if pulseH.Duration > HIGH_DUR_MAX { return 0, fmt.Errorf("High edge value duration %v exceed "+ "maximum expected %v", pulseH.Duration, HIGH_DUR_MAX) } if pulseH.Duration > HIGH_LOW_DUR_AVG { //fmt.Printf("bit %d is high\n", 7-i) b = b | (1 << uint(7-i)) } } return byte(b), nil }
implement io.ByteReader, so we must allocate a // byte slice with a single byte, and read each byte into the slice. buf := make([]byte, 1) for { if _, err = ior.Read(buf); err != nil { return 0, err // NOTE: must send back unaltered error to detect io.EOF } b = buf[0] value |= uint64(b&intMask) << shift if b&intFlag == 0 { return (int64(value>>1) ^ -int64(value&1)), nil } shift += 7 } }
if b < '0' || b > '9' { return -1, protocolError("illegal bytes in length") } n += int(b - '0') } return n, nil }
base, until we hit zero // store remainder each time // Prepend as an additional character is the higher power for n.Cmp(zero) == 1 { n, rem = n.DivMod(n, bse, rem) b = append([]byte{e.encode[rem.Int64()]}, b...) } s := string(b) if e.padding > 0 { s = e.pad(s, e.padding) } return s }
rune is a letter then this is a duration token. if ch0, _ := s.r.read(); isLetter(ch0) || ch0 == 'µ' { _, _ = buf.WriteRune(ch0) for { ch1, _ := s.r.read() if !isLetter(ch1) && ch1 != 'µ' { s.r.unread() break } _, _ = buf.WriteRune(ch1) } // Continue reading digits and letters as part of this token. for { if ch0, _ := s.r.read(); isLetter(ch0) || ch0 == 'µ' || isDigit(ch0) { _, _ = buf.WriteRune(ch0) } else { s.r.unread() break } } return DURATIONVAL, pos, buf.String() } else { s.r.unread() return INTEGER, pos, buf.String() } } return NUMBER, pos, buf.String() }
err = errors.Trace(ErrBadNumber) break } r = r1 } if !hasNum { err = ErrTruncated } if !negative && r >= intCutOff { return math.MaxInt64, errors.Trace(ErrBadNumber) } if negative && r > intCutOff { return math.MinInt64, errors.Trace(ErrBadNumber) } if negative { r = -r } return int64(r), err }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func getNegativeNumber(b []rune) int { if b[0] != '-' { return 0 } i := 1 for ; i < len(b); i++ {
if !isDigit(b[i]) { return i } } return i }
{ switch s[i] { case '.': return 4 case ':': return 6 } } return 0 }
if b.w >= len(b.s) { return 0 } return (b.w - b.r) }
Input { return i.Neg() }) }
// Check that the last element has (lastElemBits) 1's lastElemBits := (bA.Bits+63)%64 + 1 lastElem := bA.Elems[len(bA.Elems)-1] return (lastElem+1)&((uint64(1)<<uint(lastElemBits))-1) == 0 }
21.8 ns/op // BenchmarkIntLenLog10Rand-4 30000000 44.5 ns/op // BenchmarkIntLenAsmRand-4 200000000 8.62 ns/op // BenchmarkIntLenCondRand-4 200000000 8.09 ns/op switch { case x < 10: return 1 case x < 100: return 2 case x < 1000: return 3 case x < 10000: return 4 case x < 100000: return 5 case x < 1000000: return 6 case x < 10000000: return 7 case x < 100000000: return 8 case x < 1000000000: return 9 case x < 10000000000: return 10 case x < 100000000000: return 11 case x < 1000000000000: return 12 case x < 10000000000000: return 13 case x < 100000000000000: return 14 case x < 1000000000000000: return 15 case x < 10000000000000000: return 16 case x < 100000000000000000: return 17 case x < 1000000000000000000: return 18 case x < 10000000000000000000: return 19 default: panic("unreachable") } }
size, err := readKind(b) if err != nil { return 0, err } b = b[tagsize+size:] } return i, nil }
negative count") } m := b.grow(n) return b.buf[m:] }
} str := string(b) *i = strToInt(str) return nil }
if b < '0' || b > '9' { return -1, protocolError("illegal bytes in length") } n += int(b - '0') } return n, nil }
} var x int64 for i := range b { x = (x << 8) + int64(b[i]&0xFF) } return x, nil }
hb, c := b.Containers.Last() lb := c.max() return hb<<16 | uint64(lb) }
int(b[1]) return decimalBinSize(precision, frac) + 2, nil }
key") } // skip the flag b = b[1:] return DecodeVarint(b) }
b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' }
is bit 0, bigger - bit 1. // const HIGH_LOW_DUR_AVG = (24 + (70-24)/2) * time.Microsecond if pulseH.Duration > HIGH_DUR_MAX { return 0, fmt.Errorf("High edge value duration %v exceed "+ "maximum expected %v", pulseH.Duration, HIGH_DUR_MAX) } if pulseH.Duration > HIGH_LOW_DUR_AVG { //fmt.Printf("bit %d is high\n", 7-i) b = b | (1 << uint(7-i)) } } return byte(b), nil }
count, n := binary.Uvarint(b) if n <= 0 { e.err = fmt.Errorf("booleanDecoder: invalid count") return } e.b = b[n:] e.i = -1 e.n = int(count) if min := len(e.b) * 8; min < e.n { // Shouldn't happen - TSM file was truncated/corrupted e.n = min } }
err error) { s := unsafeBytesToString(b) return strconv.ParseInt(s, base, bitSize) }
length := int(first) - positiveTagStart if len(b) < length { return nil, 0, errors.Trace(errDecodeInsufficient) } var v uint64 for _, c := range b[:length] { v = (v << 8) | uint64(c) } return b[length:], v, nil }
- 2*strings.Count(f, "%%") }
21 if len(b) <= 4 { goto bad } y = uint64(b[4]) x += y << 28 if y < 0x80 { return x, 5 } x -= 0x80 << 28 if len(b) <= 5 { goto bad } y = uint64(b[5]) x += y << 35 if y < 0x80 { return x, 6 } x -= 0x80 << 35 if len(b) <= 6 { goto bad } y = uint64(b[6]) x += y << 42 if y < 0x80 { return x, 7 } x -= 0x80 << 42 if len(b) <= 7 { goto bad } y = uint64(b[7]) x += y << 49 if y < 0x80 { return x, 8 } x -= 0x80 << 49 if len(b) <= 8 { goto bad } y = uint64(b[8]) x += y << 56 if y < 0x80 { return x, 9 } x -= 0x80 << 56 if len(b) <= 9 { goto bad } y = uint64(b[9]) x += y << 63 if y < 2 { return x, 10 } bad: return 0, 0 }
if s[i] == b { n++ } } return n }
of empty files. return b.contentPostings.endByte + b.namePostings.endByte }
'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' }
return Byte2Int(b.buf[b.readerIndex-4 : b.readerIndex]), nil }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func isEscaped(value []rune, b rune) bool { if len(value) == 0 { return false } switch b { case '\'': // single quote case '"': // quote case 'n': // newline case 't': // tab
case '\\': // backslash default: return false } return value[len(value)-1] == '\\' }
// \ (%x5C) is not a valid character unless it is followed by two HEX characters due to not // being a member of UTF1SUBSET. if i+2 > len(escapedString) { return "", NewError(ErrorFilterCompile, errors.New("ldap: missing characters for escape in filter")) } escByte, decodeErr := hexpac.DecodeString(escapedString[i+1 : i+3]) if decodeErr != nil { return "", NewError(ErrorFilterCompile, errors.New("ldap: invalid characters for escape in filter")) } buffer.WriteByte(escByte[0]) i += 2 // +1 from end of loop, so 3 total for \xx. } else { buffer.WriteRune(currentRune) } i += currentWidth } return buffer.String(), nil }
Codes { in = bytes.Replace(in, []byte{b}, esc, -1) } return in }
b.Output != "name" && b.Output != "compact" }
if len(b) > 0 && b[0] != ',' { return false } if n == 0 { return true } return ae[n-1] == ' ' }
bytes to \uFFFD (replacement char). return string(bytes.Runes(b)) }
{ i := int(b) if i > 127 || i < 0 { return false } } return true }
panicIfNull(b) return b.Count() == b.length }
case '\t': return true case '\r': return true case '\n': return true default: return false } }
Character values allowed in ETags. case c == 0x21 || c >= 0x23 && c <= 0x7E || c >= 0x80: case c == '"': return string(s[:i+1]), s[i+1:] default: break } } return "", "" }
eof, '.', ',', '[', ']', '$', '@', '{', '}': return true } return false }
func(r rune) bool { return a <= r && r <= b } }
the first character in a decomposition // is always non-zero if different from info.ccc and that we can return // false at this point. This is verified by maketables. return false }
switch { case b == '_': result.WriteByte('_') escapeLevel = 0 case b == '.': result.WriteByte(':') escapeLevel = 0 case b >= '0' && b <= '9': parsedByte = (b - 48) << 4 escapeLevel = 2 case b >= 'A' && b <= 'F': // A-F parsedByte = (b - 55) << 4 escapeLevel = 2 default: return errors.Errorf( "illegal escape sequence at byte %d (%c)", i, b, ) } case 2: switch { case b >= '0' && b <= '9': parsedByte += b - 48 case b >= 'A' && b <= 'F': // A-F parsedByte += b - 55 default: return errors.Errorf( "illegal escape sequence at byte %d (%c)", i, b, ) } result.WriteByte(parsedByte) escapeLevel = 0 default: panic("unexpected escape level") } } *tv = TagValue(result.String()) return nil }
1024 && utf8.ValidString(value) && !strings.Contains(value, `\`) { return nil } return &ErrInvalidFilterValue{value} }
must be legal in an XML 1.0 document. for _, r := range val { if !isLegalXmlCharacter(r) { return fmt.Errorf("Invalid codepoint for XML 1.0 document: %U", r) } } return nil }
b[i] >= '0' && b[i] <= '9' }
b[0]&0x80 > 0 && b[1] == 0 && b[2] == 0 && b[3] == 0 && b[4] == 0 }
for _, v := range value.optArgs { if implVarScan(v) { return true } } return false }
== -1 { return in } out := bytes.Replace(in, escapedSlash, regularSlash, -1) out = bytes.Replace(out, escapedTab, regularTab, -1) return out }
switch p.currentByte { case '"': return case '\n': p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String())) return case '\\': escaped = true default: p.currentToken.WriteByte(p.currentByte) } } }
err != nil { return nil, err } return EncodeEscape(b), nil }
nil { return nil, err } return EncodeEscape(b), nil }
== strings.TrimPrefix(b, "W/") }
StringBlock, VerbatimStringDouble, VerbatimStringSingle: return false } panic(fmt.Sprintf("Unknown string kind: %v", k)) }
Instruct: Given the code snippet, retrieve the most relevant code snippet. Query: func OpenFile(path string) (Sections, error) { f, err := os.Open(path) if err != nil { return
Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) } defer f.Close() return Parse(f) }
err != nil { return nil, err } defer f.Close() return Parse(f) }
err := f.open(); err != nil { return nil, err } return f, nil }
end of the file, and back to offset 0 fsize, err := f.Seek(0, os.SEEK_END) if err != nil { return nil, nil, err } if _, err := f.Seek(0, os.SEEK_SET); err != nil { return nil, nil, err } io, ch := NewProgressReader(f, fsize) return io, ch, nil }
} file, err := os.Open(f.AssetName) if err != nil { return nil, errors.Wrapf(err, "Error opening file asset: %s", f.AssetName) } f.reader = file return f, nil }
nil, err } defer f.Close() return ReadLinesFromReader(f) }
os.Open(f.FilePath) } return nil, roles.ErrPermissionDenied }
{ buf := new(bytes.Buffer) f.Files[path] = buf return inMemoryCloser{buf: buf}, nil }
return io.NewSectionReader(f.image, int64(f.ExtentLocationBE*sectorSize), int64(f.ExtentLengthBE)) }
0, err } defer f.Close() return ParseCSVGetRowsFromReader(f) }
err } defer f.Close() var config [][]string if err := json.NewDecoder(f).Decode(&config); err != nil { return nil, err } return config, nil }
nil, err } defer f.Close() return ImportReader(f) }
sec := f.sections[name] if sec == nil { return nil, fmt.Errorf("section '%s' does not exist", name) } return sec, nil }
FromMap(nil) } defer f.Close() return FromReader(f) }
panic(err) } defer f.Close() return ReadConllu(f) }
not open: %v", err) } defer f.Close() file, err := syntax.NewParser().Parse(f, path) if err != nil { return nil, fmt.Errorf("could not parse: %v", err) } return SourceNode(ctx, file) }
nil, err } defer f.Close() return parseMountStats(f) }
FakeFileInfo{File: f}, nil }
nil, err } defer f.Close() return ioutil.ReadAll(f) }
err := fi.sp.SourceFs.Open(fi.Filename()) return f, err }
{ data, _, err := f.read(ctx) if err != nil { return nil, err } resp.Flags |= fuse.OpenDirectIO return fs.DataHandle(data), nil }
nil { return nil, 0, err } return f, dokan.ExistingFile, nil }
err } defer f.Close() return ParseCSVToInstancesFromReader(f, hasHeaders) }
defer f.Close() out := Info{} if err = json.NewDecoder(f).Decode(&out); err != nil { return Info{}, err } return out, nil }
f, err := os.Open(path) if err != nil { return nil, err } defer f.Close() // read keyring return KeyRing(f) }
Instruct: Given the following code snippet, retrieve the most relevant code snippet. Query: func Parse(f io.Reader) (Sections, error) { tree, err := ParseAST(f) if err != nil { return Sections{}, err } v := NewDefaultVisitor()
if err = Walk(tree, v); err != nil { return Sections{}, err } return v.Sections, nil }
return reflectRecursive("", v, visitor) }
= append(tree.Visitors, env.Visitors...) err = tree.Parse() if err != nil { return nil, err } return tree, nil }
return v.marshalWriter(f, configType) }
tokens := buildTokenArray(tokenizer) scopes := findScopes(tokens) return walk(scopes) }
{ dv := deadVisitor{ f: f, } ast.Walk(dv, node) }
Parse(buf) if err != nil { panic(err) } return f }
the tree ast.Inspect(rootAstNode, treeCursor.insert) // Return the actual root return treeCursor.root.Children[0] }
{ evaluators := core.NewEvaluators(f) return generic.NewConfiguration(evaluators, DefaultIgnoredResources()) }
} var src nodes buf := bufio.NewReader(f) lineno := 1 for { line, err := buf.ReadString('\n') if err != nil { if err != io.EOF { return nil, file, err } if line == "" { // end was at or past EOF; that's okay break } } if lineno >= start { flat, cum := sumNodes(lineNodes[lineno]) src = append(src, &node{ info: nodeInfo{ name: strings.TrimRight(line, "\n"), lineno: lineno, }, flat: flat, cum: cum, }) } lineno++ if lineno > end { break } } return src, file, nil }
return v.FieldWithValue(nil, f, tag) }
} defer f.Close() vmxBytes, err := ioutil.ReadAll(f) if err != nil { return map[string]string{}, err } return ParseVMX(string(vmxBytes)), nil }
_, err := LoadConfig(ConfigSourceDescriptor{Fs: fs, Filename: "config.toml"}) return v, err }
{ Println("Checking file", name) ast.Walk(f, file) }
if v != nil { if err := f.t.UnmarshalBinary(v); err != nil { return err } } } return nil }
code _, err = Write(tree) if err != nil { panic(err) } return 1 }
{ if f.Present() { return *f.value } return v }
{ return reg.printAll(v, false) }
{ return reg.printAll(v, true) }
return v.extractItems(*v.Spaces, true) }
return Set(f.value, v, seps...) }
return reflectwalk.Walk(v, walker) }
return v.extractItems(*v.Spaces, false) }
err != nil { return nil, err } defer f.Close() return Parse(f) }
node.Accept(visitor) return visitor.output() }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func ParseBytes(b []byte) (Sections, error) { tree, err := ParseASTBytes(b) if err != nil { return Sections{}, err } v := NewDefaultVisitor()
if err = Walk(tree, v); err != nil { return Sections{}, err } return v.Sections, nil }
= append(tree.Visitors, env.Visitors...) err = tree.Parse() if err != nil { return nil, err } return tree, nil }
return reflectRecursive("", v, visitor) }
return v.extractItems(*v.Spaces, true) }
buf.Reset() if err := Write(buf, node); err != nil { return err } return json.Unmarshal(buf.Bytes(), v) }
return v.extractItems(*v.Spaces, false) }
b := bytes.NewBuffer(nil) err := xml.NewEncoder(b).Encode(v) return b.Bytes(), err }
var err error tree.Tree, err = parse.Parse(text) return tree, err }
newVisit(v).Visit(q.root, q.bound.Left(), q.bound.Right(), q.bound.Bottom(), q.bound.Top(), ) return v.pointers }
err := p.client.RoundTrip(ctx, "GET", "/projecttree", v, nil, &segments) return segments, err }
:= json.Marshal(v) result := map[string]interface{}{} _ = json.Unmarshal(b, &result) return result }
err := o.client.RoundTrip(ctx, "GET", "/orgtree", v, nil, &segments) return segments, err }
code _, err = Write(tree) if err != nil { panic(err) } return 1 }
{ return reg.printAll(v, false) }
{ return reg.printAll(v, true) }
ioutil.ReadFile(file) if err != nil { return err } return Unmarshal(b, v) }
{ return &stringTree{ container: newNodeContainer(justValue{v}, duplicates), } }
encoding.ReadFrom(bytes.NewBuffer(val), &v) return }
encoding.ReadFrom(bytes.NewBuffer(val), &v) return }
b.LoadOne(&v) return v, err }
m { return v, nil } return nil, fmt.Errorf("Unable to extract the raw value from:\n\n%s\n\n", string(b)) }
return reflectwalk.Walk(v, walker) }
if err := util.UnmarshalJSON(bs, &v); err != nil { return err } return unmarshalExpr(expr, v) }
return UnmarshalHTML(v, h.DOM, structMap) }
if err != nil { return nil, err } var bfp BootFileParam err = bfp.UnmarshalBinary(v) return bfp, err }
Instruct: Retrieve the most relevant code snippet for the following snippet Query: func (c SmokeTestCase) BuildInputShape(ref *ShapeRef) string { var b ShapeValueBuilder return fmt.Sprintf("&%s{\n%s\n}",
b.GoType(ref, true), b.BuildShape(ref, c.Input, false), ) }
"{\n" for _, v := range value { out += fmt.Sprintf("%s,\n", f.paramsStructAny(v, shape.MemberRef.Shape)) } out += "}" return out }
return fmt.Sprintf("0,%v,%v,0,%v,0,%v,%v,%v,%v,%v,%v,0,%v", b, a, a+c, 2*c, b, a+c, 2*b, a, 2*b, b) }
s.ShapeName, API: s.API, Shape: s} return ref.GoTags(root, required) }
:= paramFiller{prefixPackageName: prefixPackageName} return util.GoFmt(f.paramsStructAny(value, shape)) }
if v.IsValid() { return fmt.Sprintf("aws.Float64(%v)", v.Interface()) } case "timestamp": v := reflect.Indirect(reflect.ValueOf(value)) if v.IsValid() { return fmt.Sprintf("aws.Time(time.Unix(%d, 0))", int(v.Float())) } case "jsonvalue": v, err := json.Marshal(value) if err != nil { panic("failed to marshal JSONValue, " + err.Error()) } const tmpl = `func() aws.JSONValue { var m aws.JSONValue if err := json.Unmarshal([]byte(%q), &m); err != nil { panic("failed to unmarshal JSONValue, "+err.Error()) } return m }()` return fmt.Sprintf(tmpl, string(v)) default: panic("Unhandled type " + shape.Type) } return "" }
return fmt.Sprintf("%v,0,%v,0,%v,%v,%v,%v,%v,%v,%v,%v,0,%v,0,%v,%v,0", c, s-c, s, c, s, s-c, s-c, s, c, s, s-c, c, c) }
== "structure" { return "*" + shape.API.PackageName() + "." + shape.GoTypeElem() } return shape.GoType() }
GetDefinitionName: func(name string) (string, spec.Extensions) { buildDefinitions.Do(buildDefinitionsFunc) return namer.GetDefinitionName(name) }, GetDefinitions: func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { def := generatedopenapi.GetOpenAPIDefinitions(ref) def[fmt.Sprintf("%s/%s.%s", b.group, b.version, b.kind)] = common.OpenAPIDefinition{ Schema: *b.schema, } def[fmt.Sprintf("%s/%s.%s", b.group, b.version, b.listKind)] = common.OpenAPIDefinition{ Schema: *b.listSchema, } return def }, } }
fmt.Sprintf("%s: %s {\n", memName, b.GoType(ref, false)) ret += b.buildListElements(passRef, v) ret += "},\n" return ret }
Callback: func(args []interface{}) (interface{}, error) { format := args[0].(string) return fmt.Sprintf(format, args[1:]...), nil }, } }
params *%s.%s", o.API.PackageName(), o.InputRef.GoTypeElem()) } e := example{o, map[string]int{}} return "params := " + e.traverseAny(o.InputRef.Shape, false, false) }
(*terraform.ResourceConfig, error) { return schemaMap(p.Schema).Input(input, c) }
{ script, err := builder.Script() if err != nil { panic(err) } return script }
tests err := cqlCreateTableTemplate.Execute(&buf, e) if err != nil { panic(err) } return buf.String() }
t := ref.Shape.Type switch t { case "timestamp": return parseTimeString(ref, memName, fmt.Sprintf("%s", v)) case "blob": if (ref.Streaming || ref.Shape.Streaming) && isPayload { return fmt.Sprintf("%s: aws.ReadSeekCloser(strings.NewReader(%q)),\n", memName, v) } return fmt.Sprintf("%s: []byte(%q),\n", memName, v) default: return convertToCorrectType(memName, t, v) } default: panic(fmt.Errorf("Unsupported scalar type: %v", reflect.TypeOf(v))) } }
return fmt.Sprintf("%s\n VALUES %s;", b.query, strings.Join(b.sqlValues, ", \n ")) }
var w bytes.Buffer if err := s3managerUploadInputTmpl.Execute(&w, s); err != nil { panic(fmt.Sprintf("failed to execute %s template, %v", s3managerUploadInputTmpl.Name(), err)) } return a.importsGoCode() + w.String() }
shape.Shape, ctx *pathContext) (shape.Shape, *pathContext) { return shape.Unique{in}, ctx }, } }
prettify(reflect.ValueOf(i), 0, &buf) return buf.String() }
switch sv.Ref.Shape.Type { case "map", "list": err = validationGoCodeTmpls.ExecuteTemplate(w, "nestedMapList", sv) default: err = validationGoCodeTmpls.ExecuteTemplate(w, "nestedStruct", sv) } default: panic(fmt.Sprintf("ShapeValidation.GoCode, %s's type %d, unknown validation type", sv.Name, sv.Type)) } if err != nil { panic(fmt.Sprintf("ShapeValidation.GoCode failed, err: %v", err)) } return w.String() }
map[string]interface{}{ "Shape": shape, "Validations": vs, }) return buf.String() }
{ bs, err := bf.MarshalBinary() return datastore.MkPropertyNI(bs), err }
{ v.Kind = "reference" v.Err = fmt.Errorf("Reference type not expected") }
r.resolveReference(&shape.KeyRef) r.resolveReference(&shape.ValueRef) for _, m := range shape.MemberRefs { r.resolveReference(m) } }
Instruct: Retrieve the most relevant code snippet for the given snippet. Query: func (s *CodeHook) SetMessageVersion(v string) *CodeHook {
s.MessageVersion = &v return s }
string) *ContinueAsNewWorkflowExecutionDecisionAttributes { s.WorkflowTypeVersion = &v return s }
string) { m.ctrl.Call(m, "SetRuntimeVersion", arg0) }
*Variable { s.DatasetContentVersionValue = v return s }
{ s.CSSVersion = &v return s }
{ s.NextVersionIdMarker = &v return s }
string) *UpdateDocumentVersionInput { s.VersionStatus = &v return s }
string) *S3ContentLocationUpdate { s.ObjectVersionUpdate = &v return s }
string) *ServiceSoftwareOptions { s.NewVersion = &v return s }
s.UpdateVersion = &v return s }
Set up a service to return the git code version. ws := new(restful.WebService) ws.Path(path) ws.Doc("git code version from which this is built") ws.Route( ws.GET("/").To(func(_ *restful.Request, resp *restful.Response) { writeJSON(resp, versionInfo) }). Doc("get the code version"). Operation("getCodeVersion"). Produces(restful.MIME_JSON)) container.Add(ws) }
string) { m.ctrl.Call(m, "SetDriverVersion", arg0) }
s.IntentVersion = &v return s }
string) { ts.tu.Manifest.Version = version }
s.CurrentDeliveryStreamVersionId = &v return s }
s.AppVersionCode = &v return s }
s.ExecutedVersion = &v return s }
s.HTTPVersion = &v return s }
*ResourceIdentifier { s.PolicyVersionIdentifier = v return s }
s.ReportVersioning = &v return s }
{ s.CoreDefinitionVersionId = &v return s }
*ApplicationResourceLifecycleConfig { s.VersionLifecycleConfig = v return s }
s.EventVersion = &v return s }
flashVersion h.flashVersionSet = true return h }
s.SlotTypeVersion = &v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet. Query: func (s *FollowUpPrompt) SetPrompt(v *Prompt) *FollowUpPrompt
{ s.Prompt = v return s }
promotionAction h.promotionActionSet = true return h }
{ s.PENDING = &v return s }
if prompt != dbus.ObjectPath("/") { method = fmt.Sprint(ssPromptIface, "Prompt") call := s.Object(ssServiceName, prompt).Call(method, 0, "unlock") return call.Err } return nil }
{ s.S = &v return s }
{ s.Patch = v return s }
*Pose { s.Pitch = &v return s }
{ s.Interactive = &v return s }
{ s.Forward = &v return s }
*Proposal) *GetProposalOutput { s.Proposal = v return s }
*Activity { s.OriginalParent = v return s }
*ScheduleActionStartSettings { s.FollowModeScheduleActionStartSettings = v return s }
*Prediction) *PredictOutput { s.Prediction = v return s }
{ s.Commit = v return s }
*Update { s.Params = v return s }
*SuggestOutput { s.Suggest = v return s }
*PollForJobsInput { s.QueryParam = v return s }
{ s.Node = v return s }
*Pusher { p.expfmt = format return p }
*Recipes { s.Setup = v return s }
promotionName h.promotionNameSet = true return h }
{ s.ACTIVE = &v return s }
s.PromotionalMessagesPerSecond = &v return s }
{ s.StylePassthrough = &v return s }
{ s.Chain = &v return s }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (s *FulfillmentActivity) SetCodeHook(v
*CodeHook) *FulfillmentActivity { s.CodeHook = v return s }
*CodeContent) *ApplicationCodeConfiguration { s.CodeContent = v return s }
*Task { s.StopCode = &v return s }
func(db *gorm.DB) *gorm.DB { return db.Where("code = ?", code) } }
s.HttpCode = &v return s }
func(o *unmarshalOpts) { o.hooks = append(o.hooks, hookFunction) } }
*CodeContentUpdate) *ApplicationCodeConfigurationUpdate { s.CodeContentUpdate = v return s }
func(opts *Options) error { opts.codec = c return nil } }
couponCode h.couponCodeSet = true return h }
func(o *dialOptions) { o.codec = f } }
*ApplicationConfiguration { s.ApplicationCodeConfiguration = v return s }
{ s.BreakoutCode = &v return s }
{ s.SourceCode = v return s }
*ApplicationConfigurationUpdate { s.ApplicationCodeConfigurationUpdate = v return s }
*CodeContentDescription) *ApplicationCodeConfigurationDescription { s.CodeContentDescription = v return s }
*Run { s.ResultCode = &v return s }
{ s.ACTIVE = &v return s }
*codeAndHash) { c.Code = codeAndHash.code c.CodeHash = codeAndHash.hash c.CodeAddr = addr }
*ApplicationConfigurationDescription { s.ApplicationCodeConfigurationDescription = v return s }
s.ApplicationCodeUpdate = &v return s }
int) { w.code = code w.ResponseWriter.WriteHeader(code) }
s.EventCode = &v return s }
codeCommitEvent awsLambdaEvents.CodeCommitEvent) (interface{}, error) { return reactorFunc(ctx, codeCommitEvent) }
string) *WebhookDefinition { s.TargetAction = &v return s }
string) *CodeContentDescription { s.CodeMD5 = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet. Query: func (s *GetBotAliasesOutput) SetBotAliases(v []*BotAliasMetadata)
*GetBotAliasesOutput { s.BotAliases = v return s }
[]*string) *GetUtterancesViewInput { s.BotVersions = v return s }
} ret := m.ctrl.Call(m, "ListAliasesWithContext", varargs...) ret0, _ := ret[0].(*lambda.ListAliasesOutput) ret1, _ := ret[1].(error) return ret0, ret1 }
{ s.OwnerAlias = &v return s }
s.aliases = alias return s }
aliases") return f.Service.ListAliases(&lambda.ListAliasesInput{ FunctionName: &f.FunctionName, }) }
s.IsAlias = &v return s }
importdef{name: alias, alias: true} }
{ s.AliasTarget = v return s }
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAliasesRequest", reflect.TypeOf((*MockLambdaAPI)(nil).ListAliasesRequest), arg0) }
aliases, cache: make(map[string][]byte), } }
:= rawAliases.(type) { case []interface{}: for _, v := range concreteValue { aliases = append(aliases, expandEnv(v.(string))) } } } return aliases }
(*logical.Response, error) { return i.handleAliasListCommon(ctx, true) } }
(*logical.Response, error) { return i.handleAliasListCommon(ctx, false) } }
string) *IndicesRolloverService { s.alias = alias return s }
*RoleAliasDescription) *DescribeRoleAliasOutput { s.RoleAliasDescription = v return s }
err = c.Request("GET", "/_aliases", nil, &v) return }
*DescribePatchBaselinesOutput { s.BaselineIdentities = v return s }
*Target { s.BatchParameters = v return s }
{ s.Alphabet = &v return s }
string) *GetJSONWebKeyParams { o.SetSet(set) return o }
{ s.ConfigurationSetAttributeNames = v return s }
return autoConvert_core_HostAlias_To_v1_HostAlias(in, out, s) }
{ s.BinaryListValues = v return s }
= append(s.alias, alias...) return s }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *GetBotChannelAssociationsOutput) SetBotChannelAssociations(v
[]*BotChannelAssociation) *GetBotChannelAssociationsOutput { s.BotChannelAssociations = v return s }
[]*string) *StartAssociationsOnceInput { s.AssociationIds = v return s }
*ChannelMapping { s.OutputChannels = v return s }
*GetChannelsOutput { s.ChannelsResponse = v return s }
[]*string) *GetUtterancesViewInput { s.BotVersions = v return s }
[]*AssociationFilter) *ListAssociationsInput { s.AssociationFilterList = v return s }
[]*ChannelSummary) *ListChannelsOutput { s.ChannelSummaries = v return s }
{ s.ScheduleAssociationState = &v return s }
[]*ResolverRuleAssociation) *ListResolverRuleAssociationsOutput { s.ResolverRuleAssociations = v return s }
*ListAssociationVersionsOutput { s.AssociationVersions = v return s }
{ s.AssociationCount = &v return s }
*RemixSettings { s.ChannelMappings = v return s }
{ s.AssociatedEntity = &v return s }
[]*AssociationExecutionTarget) *DescribeAssociationExecutionTargetsOutput { s.AssociationExecutionTargets = v return s }
error) { c.onCDOTAUserMsg_BotChat = append(c.onCDOTAUserMsg_BotChat, fn) }
{ s.InputChannels = v return s }
*FailedCreateAssociation { s.Entry = v return s }
*TrainingSpecification { s.TrainingChannels = v return s }
[]*GatewayAssociationProposal) *DescribeDirectConnectGatewayAssociationProposalsOutput { s.DirectConnectGatewayAssociationProposals = v return s }
int64) *AudioChannelMapping { s.OutputChannel = &v return s }
*BaiduChannelRequest) *UpdateBaiduChannelInput { s.BaiduChannelRequest = v return s }
[]*InstanceAssociationStatusInfo) *DescribeInstanceAssociationsStatusOutput { s.InstanceAssociationStatusInfos = v return s }
{ n.setNotificationChannels(i, nc) }
[]*AssociationExecution) *DescribeAssociationExecutionsOutput { s.AssociationExecutions = v return s }
[]*S3Resource) *DisassociateS3ResourcesInput { s.AssociatedS3Resources = v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet. Query: func (s *GetBotInput) SetVersionOrAlias(v string) *GetBotInput {
s.VersionOrAlias = &v return s }
importdef{name: alias, alias: true} }
{ s.OwnerAlias = &v return s }
string) *ContinueAsNewWorkflowExecutionDecisionAttributes { s.WorkflowTypeVersion = &v return s }
string) *ServiceSoftwareOptions { s.NewVersion = &v return s }
{ return func(opts *options) { opts.statusReq.Version = version } }
{ return func(opts *options) { opts.contentReq.Version = version } }
{ s.AliasTarget = v return s }
map[string]*float64) *AliasRoutingConfiguration { s.AdditionalVersionWeights = v return s }
string) *S3ContentLocationUpdate { s.ObjectVersionUpdate = &v return s }
string) *UpdateDocumentVersionInput { s.VersionStatus = &v return s }
s.IsAlias = &v return s }
string) *SetSecurityTokenServicePreferencesInput { s.GlobalEndpointTokenVersion = &v return s }
string) { m.ctrl.Call(m, "UpdateClientVersion", v) }
string) { m.ctrl.Call(m, "SetRuntimeVersion", arg0) }
string) { m.ctrl.Call(m, "SetDriverVersion", arg0) }
string) *IndicesRolloverService { s.alias = alias return s }
string) *GetDeviceDefinitionVersionInput { s.DeviceDefinitionVersionId = &v return s }
int64) *LabelParameterVersionInput { s.ParameterVersion = &v return s }
*Variable { s.DatasetContentVersionValue = v return s }
string) { ts.tu.Manifest.Version = version }
*ResourceIdentifier { s.PolicyVersionIdentifier = v return s }
{ s.FaceModelVersions = v return s }
string) *MinimumEngineVersionPerAllowedValue { s.AllowedValue = &v return s }
string) *DocumentDefaultVersionDescription { s.DefaultVersionName = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet. Query: func (s *GetUtterancesViewInput) SetBotVersions(v
[]*string) *GetUtterancesViewInput { s.BotVersions = v return s }
[]*string) *BatchDeleteTableVersionInput { s.VersionIds = v return s }
[]*ClusterVersion) *DescribeClusterVersionsOutput { s.ClusterVersions = v return s }
[]*AgentVersion) *DescribeAgentVersionsOutput { s.AgentVersions = v return s }
[]*string) *ListElasticsearchVersionsOutput { s.ElasticsearchVersions = v return s }
*ListAssociationVersionsOutput { s.AssociationVersions = v return s }
[]*TableVersion) *GetTableVersionsOutput { s.TableVersions = v return s }
[]*string) *CompatibleVersionsMap { s.TargetVersions = v return s }
[]*PlansListMember) *ListBackupPlanVersionsOutput { s.BackupPlanVersionsList = v return s }
*SecretListEntry { s.SecretVersionsToStages = v return s }
s.IncludedObjectVersions = &v return s }
:= VersionSet{} for _, v := range apiVersions { vs[v] = struct{}{} } return vs }
*Build { s.SecondarySourceVersions = v return s }
*GetBotAliasesOutput { s.BotAliases = v return s }
[]*BotChannelAssociation) *GetBotChannelAssociationsOutput { s.BotChannelAssociations = v return s }
[]*DBEngineVersion) *DescribeDBEngineVersionsOutput { s.DBEngineVersions = v return s }
s.OptionGroupOptionVersions = v return s }
[]*CacheEngineVersion) *DescribeCacheEngineVersionsOutput { s.CacheEngineVersions = v return s }
[]*PlatformSummary) *ListPlatformVersionsOutput { s.PlatformSummaryList = v return s }
*DescribeSecretOutput { s.VersionIdsToStages = v return s }
{ for _, version := range versions { o.GroupVersionConfigs[version] = false } }
[]*TrafficPolicy) *ListTrafficPolicyVersionsOutput { s.TrafficPolicies = v return s }
Version_1_27, Version_1_28, Version_1_29, Version_1_30, Version_1_31, Version_1_32, } }
string) { g.initConfig() g.Config.Version = s }
sort.Sort(sort.Reverse(versions)) } }
Instruct: Retrieve the most relevant code snippet for the following snippet Query: func (s *Intent) SetIntentVersion(v string) *Intent {
s.IntentVersion = &v return s }
string) *ContinueAsNewWorkflowExecutionDecisionAttributes { s.WorkflowTypeVersion = &v return s }
s.SlotTypeVersion = &v return s }
{ return func(opts *options) { opts.statusReq.Version = version } }
*Variable { s.DatasetContentVersionValue = v return s }
*ResourceIdentifier { s.PolicyVersionIdentifier = v return s }
s.VersionOrAlias = &v return s }
s.ExecutedVersion = &v return s }
{ s.ModelVersion = &v return s }
{ s.CSSVersion = &v return s }
s.CurrentDeliveryStreamVersionId = &v return s }
= appendInt(v, version) return s.append(TypeProtocolVersion, v) }
string) *ServiceSoftwareOptions { s.NewVersion = &v return s }
s.ApiKeyVersion = &v return s }
s.BackupPlanVersion = &v return s }
{ s.NextVersionIdMarker = &v return s }
{ s.CoreDefinitionVersionId = &v return s }
compatible. Add a ".0" // suffix to remedy this. v.APIVersion = fmt.Sprintf("%s.0", v.APIVersion) return v, nil }
string) *UpdateDocumentVersionInput { s.VersionStatus = &v return s }
int64) *LabelParameterVersionInput { s.ParameterVersion = &v return s }
s.ReportedVersion = &v return s }
s.ToolsVersion = &v return s }
string) *S3ContentLocationUpdate { s.ObjectVersionUpdate = &v return s }
s.EventVersion = &v return s }
string) { m.ctrl.Call(m, "UpdateClientVersion", v) }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *Message) SetGroupNumber(v int64) *Message {
s.GroupNumber = &v return s }
s.CloneGroupId = &v return s }
int64) *ModifyReplicationGroupShardConfigurationInput { s.NodeGroupCount = &v return s }
s.NewGroupName = &v return s }
s.PropertyGroupId = &v return s }
string) *GroupOwnerSetting { s.GroupOwner = &v return s }
return autoConvert_user_Group_To_v1_Group(in, out, s) }
C.gtk_radio_menu_item_set_group(RADIO_MENU_ITEM(v), gslist(group)) }
int64) *DescribeAccountLimitsOutput { s.NumberOfAutoScalingGroups = &v return s }
s.GreenGrassGroupId = &v return s }
*ListGroupsOutput { s.GroupIdentifiers = v return s }
s.RowGroupLength = &v return s }
return autoConvert_v1_Group_To_user_Group(in, out, s) }
int64) *Scte35SegmentationDescriptor { s.SegmentNum = &v return s }
*Job { s.OutputGroupDetails = v return s }
*NodeGroup { s.NodeGroupMembers = v return s }
{ s.TrackNumber = &v return s }
= GroupName s.GroupId = GroupId s.GroupManagementType = GroupManagementType s.Created = Created return s }
{ s := new(GroupMembershipInfo) s.AccessType = AccessType s.Group = Group s.IsInherited = false return s }
*ECSTaskSet { s.TargetGroup = v return s }
s.OptionGroupArn = &v return s }
string) *GenerateTestReportArgs { a.Group = &group return a }
int64) *MetricFilterMatchRecord { s.EventNumber = &v return s }
{ s.NewDeploymentGroupName = &v return s }
*PropertyGroup { s.PropertyMap = v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet Query: func (s *PutBotInput) SetProcessBehavior(v string) *PutBotInput {
s.ProcessBehavior = &v return s }
*InputLambdaProcessor) *InputProcessingConfiguration { s.InputLambdaProcessor = v return s }
[]*ProcessType) *DescribeScalingProcessTypesOutput { s.Processes = v return s }
{ s.UpgradeProcessing = &v return s }
*Job { s.JobProcessDetails = v return s }
s.InitProcessEnabled = &v return s }
Cmder) error, ) { c.process = fn(c.process) }
{ g.initConfigProcess() g.Config.Process.Args = args }
s.Scte35Behavior = &v return s }
string) *GlobalConfiguration { s.InputEndAction = &v return s }
s.ScalingPolicyUpdateBehavior = &v return s }
string) *BulkProcessorService { s.name = name return s }
*InputUpdate { s.InputProcessingConfigurationUpdate = v return s }
var responseProcess Process response := cloudcontroller.Response{ DecodeJSONResponseInto: &responseProcess, } err = client.connection.Make(request, &response) return responseProcess, response.Warnings, err }
{ res := "" if msg.Text != nil { res2 := scf.f(bot, msg, *msg.Text) if res2 != nil { res = *res2 } } return &res }
{ m.currentMocks(t).ProcessMessageMock = impl }
if len(bot.ChainConditionals) > 0 { bot.ChainConditionals[len(bot.ChainConditionals)-1].SetLoop(true) } return bot }
bool) *UpdateSecurityProfileInput { s.DeleteBehaviors = &v return s }
s.ScalingBehavior = &v return s }
new(SetDownloadBehaviorArgs) args.Behavior = behavior return args }
*Residency { r.TaskLostBehavior = behavior return r }
string) { m.ctrl.Call(m, "SetResponseTypeHandled", arg0) }
*InputLambdaProcessorUpdate) *InputProcessingConfigurationUpdate { s.InputLambdaProcessorUpdate = v return s }
s.StreamManifestBehavior = &v return s }
_ chat1.ChatSetConvSettingsArg) error { return nil }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *Slot) SetSlotConstraint(v string) *Slot {
s.SlotConstraint = &v return s }
*AttributeValue { s.SL = v return s }
s.ConstraintDescription = &v return s }
{ s.SlotMigration = v return s }
*SizeConstraintSet { s.SizeConstraints = v return s }
{ s.S = &v return s }
*JSVal { v.ConstraintMap = cm return v }
*JSVal { v.Name = s return v }
*SizeConstraint) *SizeConstraintSetUpdate { s.SizeConstraint = v return s }
string) *ListAvailableManagementCidrRangesInput { s.ManagementCidrRangeConstraint = &v return s }
{ s.ActualValue = &v return s }
*GeoMatchSet { s.GeoMatchConstraints = v return s }
*Value { s.RealValue = &v return s }
*AccountSettings { s.MaxSlots = v return s }
constraint.SetVersion(version) return constraint }
*AttributeValue { s.L = v return s }
{ s.Classic = &v return s }
{ s.Node = v return s }
{ i := indexOfColumn(header, d) if i != -1 { d.constraints[i] = constraint } }
*AttributeValue { s.NS = v return s }
s.ModifiedSinceConstraint = &v return s }
{ s := Cap(v) g.items = append(g.items, s) return s }
string) *Scte35DeliveryRestrictions { s.DeviceRestrictions = &v return s }
*HttpRoute { s.Match = v return s }
Set(s string) { (*xsdt.String)(me).Set(s) }
Instruct: Retrieve the most relevant code snippet for the given code snippet. Query: func (s *Slot) SetSlotType(v string)
*Slot { s.SlotType = &v return s }
s.SplitType = &v return s }
{ s.DeviceType = &v return s }
s.SqlType = &v return s }
*AttributeValue { s.SL = v return s }
{ s.typ = typ return s }
{ s.S = &v return s }
{ s.PlatformType = &v return s }
{ s.UserType = &v return s }
{ s.SparseTrackType = &v return s }
s.StatementType = &v return s }
string) *ConfigurationOptionDescription { s.ValueType = &v return s }
s.SegmentType = &v return s }
s.TypeIdentifier = &v return s }
s.SelectorType = &v return s }
s.MatchType = &v return s }
string) *AutomationExecutionMetadata { s.AutomationType = &v return s }
{ s.BounceType = &v return s }
{ s.OutputLocationType = &v return s }
s.VTLDeviceType = &v return s }
s.ScanType = &v return s }
{ s.ResourceAwsEc2InstanceType = v return s }
s.SdkType = &v return s }
s.SlotConstraint = &v return s }
s.StartSelectorType = &v return s }
Instruct: Retrieve the most relevant code snippet for the following snippet. Query: func (s *Slot) SetSlotTypeVersion(v string) *Slot {
s.SlotTypeVersion = &v return s }
string) { g.initConfig() g.Config.Version = s }
string) *S3ContentLocationUpdate { s.ObjectVersionUpdate = &v return s }
s.UpdateVersion = &v return s }
string) *ServiceSoftwareOptions { s.NewVersion = &v return s }
{ s.ModelVersion = &v return s }
s.IntentVersion = &v return s }
s.VersionOrAlias = &v return s }
string) { d.version = v d.Set("Version", v) }
string) *UpdateDocumentVersionInput { s.VersionStatus = &v return s }
*ResourceIdentifier { s.PolicyVersionIdentifier = v return s }
*Variable { s.DatasetContentVersionValue = v return s }
{ s.CSSVersion = &v return s }
s.ExecutedVersion = &v return s }
s.ToolsVersion = &v return s }
{ s.ChangeSetType = &v return s }
{ s.S = &v return s }
s.ReportVersioning = &v return s }
string) *SetSecurityTokenServicePreferencesInput { s.GlobalEndpointTokenVersion = &v return s }
*AttributeValue { s.SL = v return s }
item.versionType = versionType return item }
{ s.NextVersionIdMarker = &v return s }
string) { m.ctrl.Call(m, "SetRuntimeVersion", arg0) }
s.ReportedVersion = &v return s }
string) *ConfigurationOptionDescription { s.ValueType = &v return s }
Instruct: Retrieve the most relevant code snippet for the following snippet Query: func (s *Slot) SetValueElicitationPrompt(v *Prompt) *Slot {
s.ValueElicitationPrompt = v return s }
{ s.Evaluation = &v return s }
{ s.ActualValue = &v return s }
promotionAction h.promotionActionSet = true return h }
{ s.S = &v return s }
{ s.SlotMigration = v return s }
*ElapseOK { o.Payload = payload return o }
*Slot { s.SlotType = &v return s }
*Action { s.Elasticsearch = v return s }
*Value { s.RealValue = &v return s }
if prompt != dbus.ObjectPath("/") { method = fmt.Sprint(ssPromptIface, "Prompt") call := s.Object(ssServiceName, prompt).Call(method, 0, "unlock") return call.Err } return nil }
*AttributeValue { s.L = v return s }
*Value { s.StructValue = v return s }
error { e.Value = value e.explicitlySet = true return nil }
*AttributeValue { s.SS = v return s }
*Proposal) *GetProposalOutput { s.Proposal = v return s }
promotionName h.promotionNameSet = true return h }
*Parameter { s.NodeTypeSpecificValues = v return s }
{ s.EvaluatedExpression = &v return s }
error) { return s.elb, nil }
*Field { s.RefValue = &v return s }
{ s.PENDING = &v return s }
s.DeviceOnlyRememberedOnUserPrompt = &v return s }
errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), ElapseHandler: ElapseHandlerFunc(func(params ElapseParams) middleware.Responder { return middleware.NotImplemented("operation Elapse has not yet been implemented") }), } }
promotionCreative h.promotionCreativeSet = true return h }
Instruct: Retrieve the most relevant code snippet for the following code snippet Query: func (s *UtteranceData) SetDistinctUsers(v int64) *UtteranceData {
s.DistinctUsers = &v return s }
{ s.UserType = &v return s }
s.distinct = v return s }
int64) *UserImportJobType { s.FailedUsers = &v return s }
{ s.UserList = v return s }
{ s.UserStorage = v return s }
*Http { s.UserAgent = &v return s }
{ s.UpdateCount = &v return s }
int) *CreateUsersWithArrayInputDefault { o._statusCode = code return o }
new(SetCustomQuotaArg) s.UsersAndQuotas = UsersAndQuotas return s }
int) *CreateUsersWithListInputDefault { o._statusCode = code return o }
{ s.UsageRecord = v return s }
new(CustomQuotaUsersArg) s.Users = Users return s }
error { ret := m.ctrl.Call(m, "SetUserTags", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 }
s.ImportedUsers = &v return s }
*AdminLinkProviderForUserInput { s.DestinationUser = v return s }
*SendUsersMessagesInput { s.SendUsersMessageRequest = v return s }
bool) *ConfigurationOptionDescription { s.UserDefined = &v return s }
uint64) { atomic.AddUint64(&s.count, v) }
[]*PolicyUser) *ListEntitiesForPolicyOutput { s.PolicyUsers = v return s }
int64) *InputParallelismUpdate { s.CountUpdate = &v return s }
int64) *DescribeCollectionOutput { s.FaceCount = &v return s }
{ if gs.count == 0 || gs.count > v { gs.count = v } }
int64) *GetObjectOutput { s.TagCount = &v return s }
func(c *connection) { c.user = user c.pConnection.SetUser(user) } }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *UtteranceData) SetFirstUtteredDate(v time.Time) *UtteranceData {
s.FirstUtteredDate = &v return s }
time.Time) *MultipartUpload { s.Initiated = &v return s }
time.Time) *AccessKeyLastUsed { s.LastUsedDate = &v return s }
time.Time) *InstanceInformation { s.RegistrationDate = &v return s }
time.Time) *RecipientDsnFields { s.LastAttemptDate = &v return s }
time.Time) *EventFeedbackType { s.FeedbackDate = &v return s }
time.Time) *BillingRecord { s.BillDate = &v return s }
time.Time) *ProvisionedThroughputDescription { s.LastIncreaseDateTime = &v return s }
time.Time) *InstanceAssociationStatusInfo { s.ExecutionDate = &v return s }
time.Time) *PendingMaintenanceAction { s.ForcedApplyDate = &v return s }
time.Time) *PendingMaintenanceAction { s.CurrentApplyDate = &v return s }
time.Time) *ObjectLockRetention { s.RetainUntilDate = &v return s }
time.Time) { m.ctrl.Call(m, "SetCreatedAt", arg0) }
time.Time) *ProvisionedThroughputDescription { s.LastDecreaseDateTime = &v return s }
time.Time) *TimestampRange { s.BeginDate = &v return s }
time.Time) *StartSupportDataExportInput { s.FromDate = &v return s }
{ s.OldestDate = &v return s }
{ s.DatetimeValue = &v return s }
time.Time) *InstanceInformation { s.LastPingDateTime = &v return s }
time.Time) *GetResourceConfigHistoryInput { s.EarlierTime = &v return s }
time.Time) *ReputationOptions { s.LastFreshStart = &v return s }
{ s.AutomatedUpdateDate = &v return s }
time.Time) *DescribeOrganizationOutput { s.CompletedDate = &v return s }
s.FirstEventTimestamp = &v return s }
time.Time) *QueryExecutionStatus { s.SubmissionDateTime = &v return s }
Instruct: Given the code snippet, retrieve the most relevant code snippet. Query: func (s *UtteranceData) SetLastUtteredDate(v time.Time) *UtteranceData {
s.LastUtteredDate = &v return s }
time.Time) *InstanceInformation { s.LastPingDateTime = &v return s }
time.Time) *InventoryDeletionStatusItem { s.LastStatusUpdateTime = &v return s }
{ s.ReplicationTaskLastAssessmentDate = &v return s }
time.Time) *CertificateAuthority { s.LastStateChangeAt = &v return s }
time.Time) *ConfigExportDeliveryInfo { s.LastAttemptTime = &v return s }
s.DeviceLastAuthenticatedDate = &v return s }
{ s.LastUsedTime = &v return s }
*Crawler { s.LastCrawl = v return s }
s.StageLastUpdatedDateTime = &v return s }
s.ThreatIntelIndicatorLastObservedAt = v return s }
{ s.LastRefreshDate = &v return s }
s.StateLastUpdatedDateTime = &v return s }
time.Time) *EnabledServicePrincipal { s.DateEnabled = &v return s }
{ s.LastAccessedTime = &v return s }
time.Time) *ObjectLockRetention { s.RetainUntilDate = &v return s }
time.Time) *ConfigurationRecorderStatus { s.LastStartTime = &v return s }
{ s.AutomatedUpdateDate = &v return s }
{ s.LastSuccessfulTime = &v return s }
s.LastInventoryDate = &v return s }
time.Time) *ReputationOptions { s.LastFreshStart = &v return s }
s.LastUpdateAssociationDate = &v return s }
time.Time) *EventFeedbackType { s.FeedbackDate = &v return s }
time.Time) *PendingMaintenanceAction { s.CurrentApplyDate = &v return s }
time.Time) *GetResourceConfigHistoryInput { s.LaterTime = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet. Query: func (s *UtteranceData) SetUtteranceString(v string) *UtteranceData {
s.UtteranceString = &v return s }
string) *RegexPatternSetUpdate { s.RegexPatternString = &v return s }
s.FirstUtteredDate = &v return s }
string) *Scte35SegmentationDescriptor { s.SegmentationUpid = &v return s }
{ s.Transcript = v return s }
string) *CreatePlatformEndpointInput { s.CustomUserData = &v return s }
*Http { s.UserAgent = &v return s }
{ s.bodyString = body return s }
*JSVal { v.Name = s return v }
string) *RtmpGroupSettings { s.CaptionData = &v return s }
string) *RegisterUserInput { s.SessionName = &v return s }
string) *ParameterStringFilter { s.Option = &v return s }
defer s.Unlock() s.string = v }
string) *ReservationAggregates { s.TotalActualUnits = &v return s }
string) *RepositoryTrigger { s.CustomData = &v return s }
string) error { return NotImplemented{} }
string) *CommandInvocation { s.TraceOutput = &v return s }
{ s.S = &v return s }
string) *AwsApiCallAction { s.CallerType = &v return s }
string) *PutEventsRequestEntry { s.Detail = &v return s }
string) *ReservationPurchaseRecommendationDetail { s.UpfrontCost = &v return s }
string) { r.SetReaderBody(strings.NewReader(s)) }
string) *FunctionConfiguration { s.Executable = &v return s }
string) *InputSwitchScheduleActionSettings { s.InputAttachmentNameReference = &v return s }
string) { g.initConfig() g.Config.Version = s }
Instruct: Retrieve the most relevant code snippet for the following code snippet Query: func (kp kmsKeyHandler) decryptHandler(env Envelope) (CipherDataDecrypter, error) { m := MaterialDescription{} err := m.decodeDescription([]byte(env.MatDesc)) if err != nil { return nil, err } cmkID, ok := m["kms_cmk_id"] if !ok {
return nil, awserr.New("MissingCMKIDError", "Material description is missing CMK ID", nil) } kp.CipherData.MaterialDescription = m kp.cmkID = cmkID kp.WrapAlgorithm = KMSWrap return &kp, nil }
error) { return s.kms, nil }
var masterKey [32]byte if _, err := hex.Decode(masterKey[:], []byte(hexKey)); err != nil { return "", nil, fmt.Errorf("Invalid KMS master key: %s not a 32 bytes long HEX value", hexKey) } return keyID, crypto.NewKMS(masterKey), nil }
var clientHalfData [32]byte if len(decryptedData) != len(clientHalfData) { return TLFCryptKeyClientHalf{}, errors.WithStack(libkb.DecryptionError{Cause: errors.New( "TLF crypt key client half has wrong data length")}) } copy(clientHalfData[:], decryptedData) return MakeTLFCryptKeyClientHalf(clientHalfData), nil }
somebody else return nil, err default: return nil, fmt.Errorf("unable to open envelope, decrypt failed: %v", err) } }
the shared // secret is rederived from what was decoded. err := circuit.ErrorEncrypter.Reextract( cm.cfg.ExtractErrorEncrypter, ) if err != nil { return nil, err } return circuit, nil }
} input := &kms.DecryptInput{ CiphertextBlob: []byte(ciphertextBlob), } output, err := k.Client.Decrypt(input) if err != nil { return "", err } return string(output.Plaintext), nil }
if err != nil { return err } e.CipherFunc = CipherFunction(b[0]) e.Key = b[1 : len(b)-2] expectedChecksum := uint16(b[len(b)-2])<<8 | uint16(b[len(b)-1]) checksum := checksumKeyMaterial(e.Key) if checksum != expectedChecksum { return errors.StructuralError("EncryptedKey checksum incorrect") } return nil }
// (key found in state db but value is empty). We do not // distinguish the case here if len(ciphertext) == 0 { return nil, errors.New("no ciphertext to decrypt") } return ent.Decrypt(ciphertext) }
blockPtr data.BlockPointer) ( tlfCryptKey kbfscrypto.TLFCryptKey, err error) { return km.getTLFCryptKeyUsingCurrentDevice(ctx, kmd, blockPtr.KeyGen, true) }
!success { return errors.New("Failed to decrypt keyring") } s, err := u.engine.guard.Secret(mek) if err != nil { return err } defer s.Destroy() unboxer := unboxerImpl{mek: s} return fn(&unboxer) }
kbfscrypto.TLFCryptKey{}, errors.New( "TLF crypt key not symmetrically encrypted") }
{ return kbfscrypto.MakeFakeCryptPrivateKeyOrBust( string(name) + " crypt key") }
requested crypt function is unavailable") }
reserved for encrypted data on disk. if bytes.HasPrefix(b, []byte("k8s:enc:")) { return []byte{}, false, fmt.Errorf("identity transformer tried to read encrypted data") } return b, false, nil }
error) { reader := cc.Cipher.Decrypt(src) return &CryptoReadCloser{Body: src, Decrypter: reader}, nil }
public) existing, ok := k.lookupEncKey(ckey) if ok { return existing.key, existing.ni, nil } defer func() { if err == nil { k.writeEncKey(ckey, encItem{ key: res, ni: ni, }) } }() return k.createNameInfoSource(ctx, membersType).EncryptionKey(ctx, tlfName, tlfID, membersType, public) }
} splitKey := strings.Split(string(ciphertext), ":") if len(splitKey) != 3 { return nil, errors.New("invalid ciphertext returned") } keyID := splitKey[1] s.currentKeyID.Store(keyID) ret := &physical.EncryptedBlobInfo{ Ciphertext: ciphertext, KeyInfo: &physical.SealKeyInfo{ KeyID: keyID, }, } return ret, nil }
string) { if _, ok := ckm[key]; ok { delete(ckm, key) } }
env.WrapAlg = req.HTTPResponse.Header.Get(strings.Join([]string{metaHeader, wrapAlgorithmHeader}, "-")) env.CEKAlg = req.HTTPResponse.Header.Get(strings.Join([]string{metaHeader, cekAlgorithmHeader}, "-")) env.TagLen = req.HTTPResponse.Header.Get(strings.Join([]string{metaHeader, tagLengthHeader}, "-")) env.UnencryptedMD5 = req.HTTPResponse.Header.Get(strings.Join([]string{metaHeader, unencryptedMD5Header}, "-")) env.UnencryptedContentLen = req.HTTPResponse.Header.Get(strings.Join([]string{metaHeader, unencryptedContentLengthHeader}, "-")) return env, nil }
{ switch resource := untyped.(type) { case *resources.AWSKMSKey: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSKMSKey not found", name) }
func(e RSA, privKey *rsa.PrivateKey, ciphertext []byte) ([]byte, error) { return rsa.DecryptPKCS1v15(RandReader, privKey, ciphertext) }, } }
psp ks.mx.Unlock() if addtocache { ks.symKeyDecryptCacheCursor++ ks.symKeyDecryptCache[ks.symKeyDecryptCacheCursor%cap(ks.symKeyDecryptCache)] = &keyid } }
error) { return NewEncrypterManager( buildMasterKey(db, transformedKey), db.Header.FileHeaders.EncryptionIV, ) }
errors.Wrap(err, "failed to create cipher from shared key") } cek, err := keyunwrap(block, enckey) if err != nil { return nil, errors.Wrap(err, "failed to unwrap data") } return cek, nil }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (kp *kmsKeyHandler) GenerateCipherData(keySize, ivSize int) (CipherData, error) { out, err := kp.kms.GenerateDataKey(&kms.GenerateDataKeyInput{ EncryptionContext: kp.CipherData.MaterialDescription, KeyId: kp.cmkID, KeySpec: aws.String("AES_256"), }) if err != nil { return CipherData{}, err } iv := generateBytes(ivSize) cd := CipherData{
Key: out.Plaintext, IV: iv, WrapAlgorithm: KMSWrap, MaterialDescription: kp.CipherData.MaterialDescription, EncryptedKey: out.CiphertextBlob, } return cd, nil }
return toBytes(decrypt(toUint32s(data, false), toUint32s(key, false)), true) }
(string, error) { return api.w.GenerateSymKey() }
// Then encrypt return aesCBCEncryptWithIV(IV, key, tmp) }
generateKeyMaterial(iv, d.ivTag, kex) generateKeyMaterial(key, d.keyTag, kex) generateKeyMaterial(macKey, d.macKeyTag, kex) return }
opts bccsp.DecrypterOpts) (plaintext []byte, err error) { return nil, nil }
// Then encrypt return aesCBCEncryptWithRand(prng, key, tmp) }
} pubEnc, privEnc, err := box.GenerateKey(rand.Reader) if err != nil { return nil, err } sealedEnc, nonceEnc, err := e.Seal(ctx, (*privEnc)[:]) if err != nil { return nil, err } kp.Encryption.Private = sealedEnc kp.Encryption.Public = *pubEnc kp.Encryption.PNonce = nonceEnc return kp, nil }
config.crypter.Generate(key, nil) }
(data []byte, err error) { return rsa.EncryptOAEP(client.Hash, client.Reader, pub, inData, nil) }
ciphertext []byte) ([]byte, error) { return ciphertext, nil }
crypto.PrivKey) { var zero zeroReader for i := 0; i < b.N; i++ { GenerateKey(zero) } }
make it more likely to fit into the // 32-character "random" seed. return kbfscrypto.MakeFakeTLFCryptKeyOrBust( string(name) + " " + string(keyGen) + " crypt key ") }
(tlfCryptKey kbfscrypto.TLFCryptKey, err error) { return km.getTLFCryptKeyUsingCurrentDevice(ctx, kmd, kmd.LatestKeyGeneration(), false) }
{ cek := make([]byte, len(d.Key)) copy(cek, d.Key) return cek, nil }
return nil, awserr.New("MissingCMKIDError", "Material description is missing CMK ID", nil) } kp.CipherData.MaterialDescription = m kp.cmkID = cmkID kp.WrapAlgorithm = KMSWrap return &kp, nil }
err error) { key, err := c.BCCSP.KeyGen(opts) return GetKey(key), err }
err = tspiError(C.Tspi_Data_Unbind(encdata, key.handle, &dataLen, &cData)) if err != nil { return nil, err } blob := C.GoBytes(unsafe.Pointer(cData), (C.int(dataLen))) C.Tspi_Context_FreeMemory(key.context, cData) return blob, nil }
error) { return api.w.NewKeyPair() }
err := io.ReadFull(hkdf, key) if n != len(key) || err != nil { return data24, err } total := copy(data24[:], key[:nonceSize]) if total != nonceSize { return data24, errors.New("Could not derive a nonce.") } return data24, nil }
[]byte, error) { mek, err := e.Unbox(ctx, encMec, mecNonce, privKP, encPubKey) if err != nil { return nil, nil, err } defer mek.Destroy() return e.Box(ctx, mek, privKP, targetPubKey) }
Then encrypt return aesCBCEncrypt(key, tmp) }
km.getTLFCryptKey(ctx, kmdWithKeys, kmdToDecrypt.LatestKeyGeneration(), getTLFCryptKeyAnyDevice|getTLFCryptKeyDoCache) }
[]byte) *ImportKeyMaterialInput { s.EncryptedKeyMaterial = v return s }
error) { return s.kms, nil }
Instruct: Given the code snippet, retrieve the most relevant code snippet Query: func (cc *aesGCMContentCipher) DecryptContents(src io.ReadCloser) (io.ReadCloser,
error) { reader := cc.Cipher.Decrypt(src) return &CryptoReadCloser{Body: src, Decrypter: reader}, nil }
c.aead, nonce: c.nonce, src: src, } }
err error) { err = KeyCannotDecryptError{} return }
io.ReadCloser) io.ReadCloser { return stream }
ciphertext []byte) ([]byte, error) { return ciphertext, nil }
by one and then the 'seen' byte is not used anymore. n, err := Decode(src, src) return src[:n], err }
data that is not (len=%v)", len(cipherText)) } dd, err := gcm.Open(dst, cipherText[1:1+s.nonceSize], cipherText[1+s.nonceSize:], nil) if err != nil { return nil, err } return dd, nil }
string) (io.ReadCloser, error) { return nil, ErrNotSupported }
{ w := &byteSliceWriter{dst} _, err := WriteGunzip(w, src) return w.b, err }
(io.ReadCloser, *probe.Error) { return f.get() }
return cc.Cipher.Encrypt(src), nil }
var expectedTag [16]byte gcmAesData(&g.productTable, data, &expectedTag) ret, out := sliceForAppend(dst, len(ciphertext)) if len(ciphertext) > 0 { gcmAesDec(&g.productTable, out, ciphertext, &counter, &expectedTag, g.ks) } gcmAesFinish(&g.productTable, &tagMask, &expectedTag, uint64(len(ciphertext)), uint64(len(data))) if subtle.ConstantTimeCompare(expectedTag[:12], tag) != 1 { for i := range out { out[i] = 0 } return nil, errOpen } return ret, nil }
in the header sk, err := x.decryptSessionKey(ctx, header) if err != nil { return err } var secretKey [32]byte copy(secretKey[:], sk) // read body num := 0 var buf []byte br := &byteReader{ciphertext} for { l, err := stdbin.ReadUvarint(br) if err != nil { if err == io.EOF { return nil } return err } buf = make([]byte, l) n, err := br.Read(buf) if err := x.decryptChunk(secretKey, num, buf[:n], plaintext); err != nil { return err } if err != nil { if err == io.EOF { return nil } return err } num++ } }
{ return secretbox.Open(out, box, nonce, sharedKey) }
src, padder: c.padder, } return reader }
ret0, _ := ret[0].(io.ReadCloser) ret1, _ := ret[1].(error) return ret0, ret1 }
the beginning of the ciphertext. if len(payload) < aes.BlockSize { return nil, errors.New("payload too short") } iv := payload[saltLength : saltLength+aes.BlockSize] payload = payload[saltLength+aes.BlockSize:] payloadDst := make([]byte, len(payload)) stream := cipher.NewCFBDecrypter(block, iv) // XORKeyStream can work in-place if the two arguments are the same. stream.XORKeyStream(payloadDst, payload) return payloadDst, nil }
:= DecryptReader(src, config) if err != nil { return 0, err } return io.CopyBuffer(dst, decReader, make([]byte, maxPayloadSize)) }
gcm, err := cipher.NewGCM(aesCipher) if err != nil { return nil, fmt.Errorf("failed to initialize GCM mode") } return gcm, nil }
&& config.MaxVersion == Version10 { return decryptReaderV10(src, &config) } if config.MinVersion == Version20 && config.MaxVersion == Version20 { return decryptReaderV20(src, &config) } return decryptReader(src, &config), nil }
} else if len(se.prefix) != c.blockSize()+2 { return nil, errors.InvalidArgumentError("can't try ciphers with different block lengths") } ocfbResync := OCFBResync if se.MDC { // MDC packets use a different form of OCFB mode. ocfbResync = OCFBNoResync } s := NewOCFBDecrypter(c.new(key), se.prefix, ocfbResync) if s == nil { return nil, errors.ErrKeyIncorrect } plaintext := cipher.StreamReader{S: s, R: se.contents} if se.MDC { // MDC packets have an embedded hash that we need to check. h := sha1.New() h.Write(se.prefix) return &seMDCReader{in: plaintext, h: h}, nil } // Otherwise, we just need to wrap plaintext so that it's a valid ReadCloser. return seReader{plaintext}, nil }
[]byte, recipients []string) ([]byte, error) { return content, nil }
(n int64, err error) { return io.Copy(dst, NewReader(src, buf)) }
Decrypt the message nonce := msg[versionSize : versionSize+nonceSize] ciphertext := msg[versionSize+nonceSize:] plain, err := gcm.Open(nil, nonce, ciphertext, data) if err != nil { return nil, err } // Success! return plain, nil }
source, ref, options) ret0, _ := ret[0].(io.ReadCloser) ret1, _ := ret[1].(error) return ret0, ret1 }
Instruct: Given the following code snippet, retrieve the most relevant code snippet. Query: func (s *DescribeUpdateInput) SetUpdateId(v string) *DescribeUpdateInput
{ s.UpdateId = &v return s }
{ p := &UpdatePodParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
*TriggerUpdate) *UpdateTriggerInput { s.TriggerUpdate = v return s }
{ p := &UpdateUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateClusterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateZoneParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateTemplateParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
*RemoveAttributesInput { s.UpdateAttributesRequest = v return s }
{ p := &UpdateProjectParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateInstanceGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ s.JobUpdate = v return s }
{ p := &UpdateNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
*ApplicationUpdate) *UpdateApplicationInput { s.ApplicationUpdate = v return s }
*S3DestinationUpdate) *UpdateDestinationInput { s.S3DestinationUpdate = v return s }
{ p := &UpdateVpnGatewayParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateStoragePoolParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateRoleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ s.UpdateAvailable = &v return s }
{ p := &UpdateRegionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateHostParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
string) *CreateSoftwareUpdateJobInput { s.SoftwareToUpdate = &v return s }
s.Id = Id s.Deadline = &UpdateFileRequestDeadline{Tagged: dropbox.Tagged{"no_update"}} return s }
*Update { u.TargetPath = path return u }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (s *ListUpdatesOutput) SetUpdateIds(v []*string) *ListUpdatesOutput
{ s.UpdateIds = v return s }
[]*string) *ListCollectionsOutput { s.CollectionIds = v return s }
*Container { s.GpuIds = v return s }
[]*string) *ListDetectorsOutput { s.DetectorIds = v return s }
[]*string) *ListThreatIntelSetsOutput { s.ThreatIntelSetIds = v return s }
{ p := &UpdateIpAddressParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
[]*string) *BatchGetTracesOutput { s.UnprocessedTraceIds = v return s }
*DescribePatchBaselinesOutput { s.BaselineIdentities = v return s }
{ s.Ec2InstanceIds = v return s }
*ListOTAUpdatesOutput { s.OtaUpdates = v return s }
{ s.LogicalResourceIds = v return s }
*ListDocumentsOutput { s.DocumentIdentifiers = v return s }
*BatchUpdateUserInput { s.UpdateUserRequestItems = v return s }
*BatchUpdatePhoneNumberInput { s.UpdatePhoneNumberRequestItems = v return s }
*Signer { s.KeyPairIds = v return s }
*UpdateTableInput { s.GlobalSecondaryIndexUpdates = v return s }
[]*string) *BatchDeleteTableVersionInput { s.VersionIds = v return s }
{ p := &UpdateClusterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ s.NodeIdsToReboot = v return s }
string) *UpdateProvisionedProductInput { s.UpdateToken = &v return s }
[]*Tag) *UpdateTagsForDomainInput { s.TagsToUpdate = v return s }
*BatchGetQueryExecutionOutput { s.UnprocessedQueryExecutionIds = v return s }
{ for i := range ids { ids[i] = o.NewV1() } }
[]*string) *NotifyWorkersInput { s.WorkerIds = v return s }
[]string) { m.ctrl.Call(m, "SetGPUIDs", arg0) }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (s *Logging) SetClusterLogging(v []*LogSetup)
*Logging { s.ClusterLogging = v return s }
*BucketLoggingStatus) *PutBucketLoggingInput { s.BucketLoggingStatus = v return s }
*PendingModifiedValues { s.PendingCloudwatchLogsExports = v return s }
{ s.ClusterInfoList = v return s }
string) *AudioNormalizationSettings { s.LoudnessLogging = &v return s }
{ s.ClusterStates = v return s }
*LogConfiguration) *ContainerDefinition { s.LogConfiguration = v return s }
{ s.StartLoggingTime = &v return s }
loggingCmd.AddCommand(revertLevelsCmd(cf)) loggingCmd.AddCommand(getLogSpecCmd(cf)) loggingCmd.AddCommand(setLogSpecCmd(cf)) return loggingCmd }
{ s.StopLoggingTime = &v return s }
*CloudWatchLoggingOption) *AddApplicationCloudWatchLoggingOptionInput { s.CloudWatchLoggingOption = v return s }
*ListClustersOutput { s.ClusterListEntries = v return s }
{ return func(r *Ringpop) error { return logging.SetLevels(levels) } }
logging.SetFactory(c, lc.NewLogger) }
[]*LogSubscription) *ListLogSubscriptionsOutput { s.LogSubscriptions = v return s }
{ s.ClusterArns = v return s }
*Cluster { s.ClusterNodes = v return s }
[]*ClusterVersion) *DescribeClusterVersionsOutput { s.ClusterVersions = v return s }
[]*string) *PendingCloudwatchLogsExports { s.LogTypesToEnable = v return s }
[]*string) *CloudwatchLogsExportConfiguration { s.EnableLogTypes = v return s }
[]*string) *DescribeDRTAccessOutput { s.LogBucketList = v return s }
s.CertificateTransparencyLoggingPreference = &v return s }
*Cluster { s.ClusterParameterGroups = v return s }
[]*LogGroup) *DescribeLogGroupsOutput { s.LogGroups = v return s }
s.LogsConfigOverride = v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *Update) SetParams(v []*UpdateParam)
*Update { s.Params = v return s }
*Toolchain { s.StackParameters = v return s }
*Parameter { s.NodeTypeSpecificValues = v return s }
*Target { s.RunCommandParameters = v return s }
&UpdateVolumeParams{} p.p = make(map[string]interface{}) return p }
*UpdateTaskParams { o.SetBody(body) return o }
{ s.JobParameters = v return s }
*Script { s.params = params return s }
*UpdateOneParams { o.SetContext(ctx) return o }
*StepExecution { s.OverriddenParameters = v return s }
*Target { s.EcsParameters = v return s }
string) *UpdateJSONWebKeyParams { o.SetSet(set) return o }
s.DeviceMethodParameters = &v return s }
*RemoveAttributesInput { s.UpdateAttributesRequest = v return s }
{ p := &UpdateDomainParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
*SelectQuery { s.params = params return s }
{ s.UpdateId = &v return s }
{ p := &UpdateRoleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ p := &UpdateUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
{ s.UpdateCount = &v return s }
{ p := &UpdatePodParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
setParamsUint(id, params, "id") }
{ p := &UpdateClusterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
*PetUpdateParams { o.SetBody(body) return o }
{ s.DeletedParameters = v return s }
Instruct: Retrieve the most relevant code snippet for the given snippet. Query: func IsReaderSeekable(r io.Reader) bool { switch v := r.(type) { case ReaderSeekerCloser: return v.IsSeeker() case *ReaderSeekerCloser:
return v.IsSeeker() case io.ReadSeeker: return true default: return false } }
func(c *RWI) { if r != nil { c.reader = r } } }
attribute? return (r.Create != nil || r.Read != nil) }
is := r.(*bufio.Reader); is { return r } return bufio.NewReader(r) }
(io.ReadCloser, *probe.Error) { return f.get() }
io.ReadSeeker) error { return decode(p, reader) }
// TODO: handle built-in 'sequable' things such as arrays, slices, strings return false }
(io.ReaderFrom, error) { value := reflect.New(valueType) return value.Interface().(io.ReaderFrom), nil }) }
{ return &randomReader{b: &bytes.Buffer{}, r: r} }
{ return gobool(C.g_variant_is_of_type(v.native(), t.native())) }
&readerErrWrapper{ reader: r, closer: closer, } }
{ return &reader{ r: r, bo: NativeEndian, } }
reflect.ValueOf(r.Data).Elem().IsValid() }
conn IOSession) (bool, interface{}, error) { return false, true, nil }
// Read starting position switch t := seekInfo.Start.Type.(type) { case *orderer.SeekPosition_Oldest: mock.Pos = 0 case *orderer.SeekPosition_Specified: mock.Pos = t.Specified.Number } return nil }
after Go 1.10 br.Reset(originalReader) if p, err := br.Peek(0); err == nil { return cap(p) } return 0 }
reflect.ValueOf(v).Kind() == reflect.Slice }
(*Reader, error) { xr := new(Reader) err := xr.Reset(rs) return xr, err }
io.Writer, r io.Reader) bool { return false } }
r.reader.(io.ReadCloser) if !ok { return nil } return closer.Close() }
string) (io.ReadCloser, error) { return nil, ErrNotSupported }
*CipherReader { return &CipherReader{r, mask, 0} }
"ForeignEmbeddedMethod") ret0, _ := ret[0].(*bufio.Reader) return ret0 }
{ m := &hashReader{ source: r, hash: h, } return m }
&readCloser{Reader: r, closer: c} }
Instruct: Given the following code snippet, retrieve the most relevant snippet Query: func (r ReaderSeekerCloser) Read(p []byte) (int, error) { switch t := r.r.(type) { case
io.Reader: return t.Read(p) } return 0, nil }
{ return &reader{ r: r, bo: NativeEndian, } }
n int n, r.err = io.ReadFull(r.rd, p) r.cnt += n }
{ return r.ReadNumBytes(len(r.data) - r.index) }
return ReadElements(r, &t.Code, &t.LastApplied, ) }
a io.Readers might not actually be seekable. switch v := s.(type) { case ReaderSeekerCloser: return v.GetLen() case *ReaderSeekerCloser: return v.GetLen() } return seekerLen(s) }
func(c *RWI) { if r != nil { c.reader = r } } }
(io.ReadCloser, *probe.Error) { return f.get() }
string) (io.ReadCloser, error) { return nil, ErrNotSupported }
return encoding.ReadFrom(r, &defaultPad8) }
error) { return NewReaderDict(r, nil) }
encoding.ReadFrom(r, &t.Table, &pad3{}, &t.Config) }
{ return b.ReadNFrom(0, r) }
{ r = &readBuf{} t = cn.recv1Buf(r) return t, r }
r.ReadCloser r.ReadCloser = nil return result }
{ return &randomReader{b: &bytes.Buffer{}, r: r} }
// stream // // TODO(mdlayher): use r.Data instead of allocating? b := make([]byte, int(r.SectorCount)*sectorSize) n, err := rs.Read(b) if err != nil { return nil, err } // Verify sector count if sectors := n / sectorSize; sectors != int(r.SectorCount) { return nil, errATAAbort } return &ATAArg{ CmdStatus: ATACmdStatusReadyStatus, Data: b, }, nil }
int64, err error) { b.bytes, m, err = b.readNFrom(n, r) return m, err }
int) (io.Reader, int, error) { return NewTailReaderWithDelimiter(ctx, r, reqLines, eol) }
(n int, err error) { return r.reader.ReadAt(buf, int64(addr-r.offset)) }
{ n, err = c.r.Read(p) ws.Cipher(p[:n], c.mask, c.pos) c.pos += n return }
error) { return p.pR.Read(buf) }
(int, error) { return fb.b.Read(p) }
if s, ok := rd.(io.Seeker); ok { r.rs = s } else { r.rs = nil } }
return decode(r, reader) }
Instruct: Given the following code snippet, retrieve the most relevant code snippet. Query: func (r ReaderSeekerCloser) IsSeeker() bool { _,
ok := r.r.(io.Seeker) return ok }
(io.ReadCloser, *probe.Error) { return f.get() }
if s, ok := rd.(io.Seeker); ok { r.rs = s } else { r.rs = nil } }
func(c *RWI) { if r != nil { c.reader = r } } }
// Read starting position switch t := seekInfo.Start.Type.(type) { case *orderer.SeekPosition_Oldest: mock.Pos = 0 case *orderer.SeekPosition_Specified: mock.Pos = t.Specified.Number } return nil }
conn IOSession) (bool, interface{}, error) { return false, true, nil }
reflect.ValueOf(r.Data).Elem().IsValid() }
return func(c *Client) error { c.seekType = seek return nil } }
error { return br.r.Seek(off) }
r.routeType == StructPtrRoute }
reflect.ValueOf(r.Params).Elem().IsValid() }
int) (int64, error) { r.hash = nil return r.rsc.Seek(offset, whence) }
is := r.(*bufio.Reader); is { return r } return bufio.NewReader(r) }
ok := r.URL.Query()["X-Amz-Credential"] return ok }
io.Writer, r io.Reader) bool { return false } }
// TODO: handle built-in 'sequable' things such as arrays, slices, strings return false }
bool) { return nil, false }
( bool, error) { return false, nil }
len(r.TransferEncoding) > 0 || r.ContentLength > 0 }
io.ReadSeeker) error { return decode(p, reader) }
(bool, error) { return false, nil }
{ c.once.Do(c.init) return c.isVersion }
(bool, error) { return true, nil }
{ return &randomReader{b: &bytes.Buffer{}, r: r} }
either via new or load functions. s.DataFP.Seek(0, os.SEEK_SET) return io.Reader(s.DataFP) }
Instruct: Given the code snippet, retrieve the most relevant code snippet Query: func SeekerLen(s io.Seeker) (int64, error) { // Determine if the seeker is actually seekable. ReaderSeekerCloser // hides the fact that
a io.Readers might not actually be seekable. switch v := s.(type) { case ReaderSeekerCloser: return v.GetLen() case *ReaderSeekerCloser: return v.GetLen() } return seekerLen(s) }
(int, error) { return len(b), nil }
return s.queues.Length(s.key()) }
either via new or load functions. s.DataFP.Seek(0, os.SEEK_SET) return io.Reader(s.DataFP) }
{ s.mu.RLock() n := s.n s.mu.RUnlock() return n }
return len(s.messages) - s.expiredCount }
s.RUnlock() return len(s.list) }
ok := r.r.(io.Seeker) return ok }
{ return bufferedReadSeeker{ r: bufio.NewReaderSize(readSeeker, size), s: readSeeker, } }
return s.Position >= s.maxBytes }
s.mu.RLock() defer s.mu.RUnlock() return len(s.m) }
return s.container.Len() }
return 0, false } return *s.Length, true }
0, err } n := s.Size() s.Free() return int64(n), nil }
s.RUnlock() return s.bitmap.GetCardinality() }
return 0 } return *s.Length }
s.RUnlock() return len(s.cache) }
{ size, ok := <-s.resizeChan if !ok { return nil } return &size }
t, c, err := s.readType() if err != nil { return t, 0, err } l, err := s.readLength(c) return t, l, err }
var bufSize int64 s.withParserLock(func() error { bufSize = s.c.parser.bufferedBytes() return nil }) return bufSize == 0 }
return int(s.C_gss_OID_set.count) }
is 24 bytes b += int(unsafe.Sizeof(s.bitmap)) + int(s.bitmap.GetSizeInBytes()) s.RUnlock() return b }
{ return int(s.state.baseline), s.state.addBits }
is 16 bytes long. We interpret it as two // uint64s and XOR them together. return int64(binary.BigEndian.Uint64(s[0:]) ^ binary.BigEndian.Uint64(s[8:])) }
len(s.index.cells) s.refresh() }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (r ReaderSeekerCloser) Close() error { switch t := r.r.(type) {
case io.Closer: return t.Close() } return nil }
r.reader.(io.ReadCloser) if !ok { return nil } return closer.Close() }
if t.firstFin == &t.outbound { return ResultClosedBySelf } return ResultClosedByPeer }
err := r.rc.Close() r.rc = nil return err }
close(r.closed) r.source.removeConn(r) return nil }
err2 := t.w.Close() if err1 != nil { return err1 } return err2 }
nothing default: close(t.closed) close(t.expectedRequests) close(t.receivedMessages) } return nil }
m.source.(io.Closer); ok { return r.Close() } return nil }
t.fh == nil { return nil } return t.fh.Close() }
r.closerRcv != nil { return r.closerRcv } return r.closer }
error { return t.tsv.Close(ctx) }
return rb.ReadCloser.Close() }
error { r.SetReadDeadline(t) return r.SetWriteDeadline(t) }
*File) error { _, err := t.file.Seek(0, os.SEEK_SET) return err } }
close(r.closing) return <-r.closed }
ok { r.Close() return nil } return ErrNotCloseable }
return ReadElements(r, &t.Code, &t.LastApplied, ) }
_, ct := range t.Children { ct.Close() } return nil }
we already have our result err := r.Close() if err != nil { // Return no error as we got the one result already. return nil } return nil }
// If the out writer supports io.Closer, Close it. if c, ok := t.out.(io.Closer); ok { c.Close() } return err }
If the terminal handler was closed (most likely due to the *SessionContext // closing) then the stream should be closed as well. t.terminalCancel() return nil }
if o.APIName != "GET Object" && o.APIName != "Image Process" && r.Body != nil { err = r.Body.Close() if err != nil { return err } r.Body = nil } return nil }
like lock read/write here // Maybe index r.rows = append(r.rows, t) return nil }
return nil } return r.r.Close() }
err = r.Body.Close() if err != nil { log.ErrorCtx(r.Context(), errors.Wrap(err, "error closing request body"), nil) } }
Instruct: Retrieve the most relevant code snippet for the given snippet Query: func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { pLen := len(p) expLen := pos + int64(pLen) b.m.Lock() defer b.m.Unlock() if int64(len(b.buf)) < expLen {
if int64(cap(b.buf)) < expLen { if b.GrowthCoeff < 1 { b.GrowthCoeff = 1 } newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) copy(newBuf, b.buf) b.buf = newBuf } b.buf = b.buf[:expLen] } copy(b.buf[pos:], p) return pLen, nil }
p.buffer = b[:len(b)&^(sizeOfSlotHeader-1)] }
b.Compact(false) space = b.WriteLen() if space > len(p) { n = copy(b.s[b.w:], p[:]) } else { n = copy(b.s[b.w:], p[:space]) } } if n == 0 { return 0, errors.New("No room left in buffer") } return n, nil }
= append(b.B, p...) return len(p), nil }
append(buf.bytes, b...) return len(b), nil }
error) { p := w.grow(len(b)) return copy(w.buf[p:], b), nil }
p.waitNoPendingWrites() return p.Storage().ReadAt(b, off-p.Info().Offset()) }
err := p.Writer.Write(buf) return n, NewTTransportExceptionFromError(err) }
r.t.info.Piece(pi) po := r.torrentOffset(pos) % r.t.info.PieceLength b1 := missinggo.LimitLen(b, ip.Length()-po, avail) n, err = r.t.readAt(b1, r.torrentOffset(pos)) if n != 0 { err = nil return } r.t.cl.lock() // TODO: Just reset pieces in the readahead window. This might help // prevent thrashing with small caches and file and piece priorities. log.Printf("error reading torrent %s piece %d offset %d, %d bytes: %v", r.t.infoHash.HexString(), pi, po, len(b1), err) if !r.t.updatePieceCompletion(pi) { log.Printf("piece %d completion unchanged", pi) } r.t.cl.unlock() } }
return rb.buf.Write(p) }
so we // don't spend all our time copying. copy(b.buf[:], b.buf[b.off:]) buf = b.buf[:m] } else { // not enough space anywhere buf = makeSlice(2*cap(b.buf) + n) copy(buf, b.buf[b.off:]) } b.buf = buf b.off = 0 } b.buf = b.buf[0 : b.off+m+n] return b.off + m }
if !r.isInitialized() || r.expectedChaceEnd(off) <= r.offset || r.cacheEnd() <= r.expectedChaceOffset(off) { n, err = r.readAtAndRenewCache(off) if n == 0 { return } return r.copySafe(b, off) } else if r.offset <= off && bufEnd <= r.cacheEnd() { return r.copySafe(b, off) } return }
{ w.Lock() n, err = w.Writer.Write(p) w.Unlock() return n, err }
[]byte) { copy(b.append(len(p)), p) }
if p.closed { return } atomic.AddUint32(&p.put, 1) pool := p.pool[p.poolNum(cap(b))] select { case pool <- b: default: } }
> MaxEIRPacketLength { return ErrNotFit } p.b = append(p.b, b...) return nil } }
if n != len(p) { err = io.ErrShortWrite return } } return len(p), nil }
len(data) keep := min(maxOutputLen-bufLen, dataLen) if keep > 0 { b.buf.Write(data[:keep]) } if keep < dataLen { b.truncated = true } return dataLen, nil }
Write to the buffer nn, err = c.buf.Write(p) // Signal to flush the buffer select { case c.flushCh <- struct{}{}: default: // flush is blocked } return nn, err }
> cap(b.buf) { b.buf = buf[:cap(buf)] } return nil }
return nil, err } if p.buf == nil && err == nil { // Return a non-nil slice on success. return []byte{}, nil } return p.buf, err }
defer f.bufLock.Unlock() return f.bufw.Write(p) }
b, err := p.readAndConsume() if err != nil { return nil, err } _, err = p.Output.Write(b) return b, err }
} if l.size+writeLen > l.max() { if err := l.rotate(); err != nil { return 0, err } } n, err = l.file.Write(p) l.size += int64(n) return n, err }
p.written += n if err != nil { panic(localError{err}) } }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (b *WriteAtBuffer) Bytes() []byte { b.m.Lock()
defer b.m.Unlock() return b.buf }
err := m.WriteTo(buffer) return buffer.Bytes(), err }
newPayload, _ := m.PopPayload() b.Writer.Write(newPayload) atomic.AddUint64(&b.MessageCount, 1) }
b = m.remaining[:n] m.remaining = m.remaining[n:] return }
return b.ReadBytes(b.GetMarkedRemind()) }
b.mtx.RLock() defer b.mtx.RUnlock() return b.value }
bytesCopy := make([]byte, length, length) copy(bytesCopy, b.bytes) return bytesCopy }
error) { if b.Full { err = b.Pack(m) } return }
{ return bp.pool.Get().(*bytes.Buffer) }
{ return z.buf[z.raw.start:z.raw.end] }
{ b := make([]byte, f.length()) _, err := f.read(b) return b, err }
defer b.mu.RUnlock() return b.read() }
b.mu.Unlock() return b.flush() }
return C.GoStringN((*C.char)(b.C_gss_buffer_t.value), C.int(b.C_gss_buffer_t.length)) }
ret := make([]LogEntry, len(*m.data)) copy(ret, *m.data) return ret }
b.mtx.RUnlock() return b.current }
return b.getBits(bucket*uint(b.bucketSize), uint(b.bucketSize)) }
error) { return s.buf.Bytes(), s.err }
} b.Packed, b.err = m.Pack() return b }
the underlying // byte slice is returned. if cap(b.Bytes()) > bp.a { b = bytes.NewBuffer(make([]byte, 0, bp.a)) } select { case bp.c <- b: default: // Discard the buffer if the pool is full. } }
AppendMeasureFiltered(b, m, nil) }
return appendArb(buf, m, true, false) }
s.mutex.RUnlock() return b }
if b.w >= len(b.s) { return 0 } return (b.w - b.r) }
b.lock.Lock() defer b.lock.Unlock() // Make further accesses error out. b.m = nil }
Instruct: Given the following code snippet, retrieve the most relevant snippet. Query: func (s *AutoScalingThresholds) SetCpuThreshold(v float64) *AutoScalingThresholds
{ s.CpuThreshold = &v return s }
*BehaviorCriteria { s.StatisticalThreshold = v return s }
*PodContainer { p.Resources.Cpus = cpu return p }
s.ThresholdValue = &v return s }
c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Emulation.setCPUThrottlingRate", Params: v}) }
string) *ApprovalThresholdPolicy { s.ThresholdComparator = &v return s }
if g.Config.Linux.Resources.CPU == nil { g.Config.Linux.Resources.CPU = &rspec.LinuxCPU{} } }
error) { c := int64(math.Ceil(float64(cpu.MilliValue()) / float64(divisor.MilliValue()))) return strconv.FormatInt(c, 10), nil }
Requests: v1.ResourceList{ v1.ResourceName(v1.ResourceCPU): resource.MustParse(cpu), }, } }
float64) *CPUUtilization { s.SoftIRQ = &v return s }
model.Threshold = val model.Unlock() }
if _err != nil { return } _selfArg, _err := convertHostCPURefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self) if _err != nil { return } _result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg) if _err != nil { return } _retval, _err = convertFloatToGo(_method + " -> ", _result.Value) return }
*Account { s.ThrottleSettings = v return s }
s.ThresholdType = &v return s }
s.SyncThreshold = &v return s }
*PIDController { c.setpoint = setpoint return c }
{ sc.mux.Lock() defer sc.mux.Unlock() sc.cache.SetDefaultCPUSet(cset) sc.storeState() }
new(SetCPUThrottlingRateArgs) args.Rate = rate return args }
g.Config.Linux.Resources.CPU.Quota = &quota }
s.CpsLimit = &v return s }
{ c.value = value return c }
atomic.StoreInt64((*int64)(&usageThreshold), int64(duration)) }
s.FailureThresholdPercentage = &v return s }
Threshold: threshold, ToKeep: minPointsToKeep, } }
{ return (percent / 100) * shelpers.TotalTicksAvailable() / float64(c.totalCpus) }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (s *AutoScalingThresholds) SetIgnoreMetricsTime(v
int64) *AutoScalingThresholds { s.IgnoreMetricsTime = &v return s }
*configOption) { o.metricsInterval = metricsInterval } }
{ s.MetricTimestamp = &v return s }
if _err != nil { return } _selfArg, _err := convertVMMetricsRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self) if _err != nil { return } _result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg) if _err != nil { return } _retval, _err = convertTimeToGo(_method + " -> ", _result.Value) return }
*Options { s.Mtime = &v return s }
time.Time) *GetResourceConfigHistoryInput { s.LaterTime = &v return s }
{ s.InstalledTime = &v return s }
time.Time) *RemediationExecutionStatus { s.InvocationTime = &v return s }
time.Time) *ReplicationInstance { s.FreeUntil = &v return s }
*Options { s.Atime = &v return s }
*Group { s.EnabledMetrics = v return s }
*Event { s.EventTime = &v return s }
string) *AddAttachmentsToSetOutput { s.ExpiryTime = &v return s }
int64) *TrustedAdvisorResourcesSummary { s.ResourcesIgnored = &v return s }
if _err != nil { return } _selfArg, _err := convertVBDMetricsRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self) if _err != nil { return } _result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg) if _err != nil { return } _retval, _err = convertTimeToGo(_method + " -> ", _result.Value) return }
if _err != nil { return } _selfArg, _err := convertPIFMetricsRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self) if _err != nil { return } _result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg) if _err != nil { return } _retval, _err = convertTimeToGo(_method + " -> ", _result.Value) return }
s.SegmentationTime = &v return s }
s.TaskTimeLimitInSeconds = &v return s }
*Timing { s.FinishTime = &v return s }
time.Time) *GetResourceConfigHistoryInput { s.EarlierTime = &v return s }
int64) *DeploymentReadyOption { s.WaitTimeInMinutes = &v return s }
time.Time) *DatasetContentSummary { s.ScheduleTime = &v return s }
s.DeregisterTime = &v return s }
*Options) { o.waitTime = value } }
float64) *DeviceMinutes { s.Metered = &v return s }
Instruct: Retrieve the most relevant code snippet for the given snippet. Query: func (s *AutoScalingThresholds) SetLoadThreshold(v float64) *AutoScalingThresholds
{ s.LoadThreshold = &v return s }
*ScalingInstruction { s.PredefinedLoadMetricSpecification = v return s }
s.ThresholdValue = &v return s }
{ s.TablesLoaded = &v return s }
s.LoadTimeout = &v return s }
s.LoadAverage = v return s }
{ s.TablesLoading = &v return s }
*AttributeValue { s.SL = v return s }
model.Threshold = val model.Unlock() }
string) *PredefinedLoadMetricSpecification { s.PredefinedLoadMetricType = &v return s }
s.FullLoadErrorPercentage = &v return s }
*AttributeValue { s.L = v return s }
s.ThresholdType = &v return s }
string) *ApprovalThresholdPolicy { s.ThresholdComparator = &v return s }
*Account { s.ThrottleSettings = v return s }
s.SyncThreshold = &v return s }
int64) *AutoScalingThresholds { s.IgnoreMetricsTime = &v return s }
s.FailureThresholdPercentage = &v return s }
{ s.AutoScalingEnabledUpdate = &v return s }
s.ThresholdsWaitTime = &v return s }
int64) *DescribeAccountLimitsOutput { s.NumberOfAutoScalingGroups = &v return s }
{ s.ActualValue = &v return s }
s.BreachThreshold = &v return s }
*LoadBalancer { s.ConfigurationOptions = v return s }
*ConnectionSettings) *LoadBalancerAttributes { s.ConnectionSettings = v return s }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *AutoScalingThresholds) SetMemoryThreshold(v float64) *AutoScalingThresholds
{ s.MemoryThreshold = &v return s }
s.ThresholdValue = &v return s }
g.Config.Windows.Resources.Memory.Limit = &limit }
val, ok := (*self)[ResourceMemory]; ok { return &val } return &resource.Quantity{} }
model.Threshold = val model.Unlock() }
mongo.MemoryProfile) { c.mongoMemoryProfile = v.String() }
*AttributeValue { s.M = v return s }
(string, error) { m := int64(math.Ceil(float64(memory.Value()) / float64(divisor.Value()))) return strconv.FormatInt(m, 10), nil }
{ return context.WithValue(contextOrBackground(parent), keyQueryMemoryLimit, value) }
*Account { s.ThrottleSettings = v return s }
g.Config.Linux.Resources.Memory.Limit = &limit }
int64) *AutoScalingThresholds { s.IgnoreMetricsTime = &v return s }
{ s.MINIMUM = &v return s }
uint64) { C.rocksdb_options_optimize_universal_style_compaction(opts.c, C.uint64_t(memtable_memory_budget)) }
s.ThresholdType = &v return s }
string) *ApprovalThresholdPolicy { s.ThresholdComparator = &v return s }
float64) *DeviceMinutes { s.Metered = &v return s }
atomic.StoreInt64((*int64)(&usageThreshold), int64(duration)) }
uint64(service.RAMThreshold) newThreshold := ctx.String("ramThreshold") suffix := newThreshold[len(newThreshold)-1:] if suffix != "%" { fmt.Fprintln(os.Stderr, fmt.Errorf("ramThreshold '%s' does not end with %%", newThreshold)) c.exit(1) return } percent := newThreshold[:len(newThreshold)-1] val, err := strconv.ParseUint(percent, 10, 64) if err != nil { fmt.Fprintln(os.Stderr, fmt.Errorf("ramThreshold '%s' must be an integer", newThreshold)) c.exit(1) return } if oldThreshold != val { service.RAMThreshold = uint(val) modified = true } } if modified { if service, err := c.driver.UpdateServiceObj(*service); err != nil { fmt.Fprintln(os.Stderr, err) } else if service == nil { fmt.Fprintln(os.Stderr, "received nil service") c.exit(1) return } else { fmt.Println(service.ID) } } else { fmt.Printf("Service already reflects desired configured - no changes made\n\n") return } }
if _err != nil { return } _selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self) if _err != nil { return } _valueArg, _err := convertFloatToXen(fmt.Sprintf("%s(%s)", _method, "value"), value) if _err != nil { return } _, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg) return }
eg // - 3.75GiB on AWS, Google // - 3.5GiB on Azure // - 4GiB on Rackspace etc var mem uint64 = 3.5 * 1024 cons.Mem = &mem } return cons }
Threshold: threshold, ToKeep: minPointsToKeep, } }
float64) *OrderableDBInstanceOption { s.MinIopsPerGib = &v return s }
s.SyncThreshold = &v return s }
s.BreachThreshold = &v return s }
Instruct: Retrieve the most relevant code snippet for the given snippet Query: func (s *AutoScalingThresholds) SetThresholdsWaitTime(v int64) *AutoScalingThresholds {
s.ThresholdsWaitTime = &v return s }
s.EstimatedWaitTime = &v return s }
int64) *BlueInstanceTerminationOption { s.TerminationWaitTimeInMinutes = &v return s }
int64) *SimpleScalingPolicyConfiguration { s.CoolDown = &v return s }
{ s.DeploymentWaitType = &v return s }
atomic.StoreInt64((*int64)(&usageThreshold), int64(duration)) }
{ s.LoadThreshold = &v return s }
*Account { s.ThrottleSettings = v return s }
return func(s *Selector) { s.wait = wait } }
s.InstanceTerminationWaitTimeStarted = &v return s }
c.RetryWaitTime = waitTime return c }
time.Duration) *WellKnownParams { o.SetTimeout(timeout) return o }
time.Duration) *GetJSONWebKeySetParams { o.SetTimeout(timeout) return o }
time.Duration) *UpdateJSONWebKeySetParams { o.SetTimeout(timeout) return o }
time.Duration) *CreateJSONWebKeySetParams { o.SetTimeout(timeout) return o }
{ s.IOWait = &v return s }
int64) *BackendConnectionErrors { s.TimeoutCount = &v return s }
time.Duration) { m.ctrl.Call(m, "SetTimeout", arg0) }
_ = time.ParseDuration(wait) }
time.Duration { if configuredValue == 0 { return defaultValue } return configuredValue }
{ return time.Duration(b.ring.ReassignmentWait) * time.Minute }
int64) *DescribeAccountLimitsOutput { s.NumberOfAutoScalingGroups = &v return s }
return func(o *SubscriptionOptions) error { o.AckWait = t return nil } }
= time.ParseDuration(wait) }
int64) *ShutdownEventConfiguration { s.ExecutionTimeout = &v return s }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (s *BlockDeviceMapping) SetEbs(v *EbsBlockDevice)
*BlockDeviceMapping { s.Ebs = v return s }
string) *M2tsSettings { s.Ebif = &v return s }
{ s.EcsTarget = v return s }
fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Iops)), "volume_size": fmt.Sprintf("%d", aws.Int64Value(v.Ebs.VolumeSize)), "snapshot_id": aws.StringValue(v.Ebs.SnapshotId), "volume_type": aws.StringValue(v.Ebs.VolumeType), } mapping["ebs"] = ebs } log.Printf("[DEBUG] aws_ami - adding block device mapping: %v", mapping) s.Add(mapping) } return s }
*Target { s.EcsParameters = v return s }
{ s.Essential = &v return s }
s.EbpPlacement = &v return s }
s.MinEbpInterval = &v return s }
*EC2TagSet { s.Ec2TagSetList = v return s }
s.ForceTsVideoEbpOrder = &v return s }
VolumeID: csiSource.VolumeHandle, FSType: csiSource.FSType, ReadOnly: csiSource.ReadOnly, } if partition, ok := csiSource.VolumeAttributes["partition"]; ok { partValue, err := strconv.Atoi(partition) if err != nil { return nil, fmt.Errorf("Failed to convert partition %v to integer: %v", partition, err) } ebsSource.Partition = int32(partValue) } pv.Spec.CSI = nil pv.Spec.AWSElasticBlockStore = ebsSource return pv, nil }
= append(o.nullFields, "EBSRootVolumeSize") } return o }
s.EbpAudioInterval = &v return s }
ok := conf["iops"].(int); ok && v != 0 { volumeSpec.Iops = aws.Int64(int64(v)) } if v, ok := conf["volumes_per_instance"].(int); ok && v != 0 { ebs.VolumesPerInstance = aws.Int64(int64(v)) } ebs.VolumeSpecification = volumeSpec ebsConfigs = append(ebsConfigs, ebs) } } result.EbsBlockDeviceConfigs = ebsConfigs return result }
{ s.ElbInfoList = v return s }
s.EbpLookaheadMs = &v return s }
{ s.Evaluation = &v return s }
{ s.S = &v return s }
{ if s.chooser.Demand().(BoolEqualer).B { s.attr.SetEqualer(e) } }
*Source { s.Etag = &v return s }
{ s.EfsFilesystemArn = &v return s }
*EC2Specification) *ServiceSpecification { s.EC2Specification = v return s }
*M2tsSettings { s.Scte35Esam = v return s }
*Communication { s.AttachmentSet = v return s }
{ s.SizeInGB = &v return s }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *ChefConfiguration) SetBerkshelfVersion(v string) *ChefConfiguration {
s.BerkshelfVersion = &v return s }
string) { ts.tu.Manifest.Version = version }
string) { m.ctrl.Call(m, "SetRuntimeVersion", arg0) }
{ s.CSSVersion = &v return s }
{ return func(opts *options) { opts.statusReq.Version = version } }
string) { m.ctrl.Call(m, "SetDriverVersion", arg0) }
*ApplicationResourceLifecycleConfig { s.VersionLifecycleConfig = v return s }
b.version = &version return b }
g.Config.Version = version }
{ s.BootstrapBrokerString = &v return s }
*Variable { s.DatasetContentVersionValue = v return s }
string) *ServiceSoftwareOptions { s.NewVersion = &v return s }
s.BackupPlanVersion = &v return s }
s.ZookeeperVersion = &v return s }
*BuildConfiguration) *CreateApplicationVersionInput { s.BuildConfiguration = v return s }
string) *ContinueAsNewWorkflowExecutionDecisionAttributes { s.WorkflowTypeVersion = &v return s }
{ return func(opts *options) { opts.rollbackReq.Version = ver } }
string) *S3ContentLocationUpdate { s.ObjectVersionUpdate = &v return s }
string) *UpdateDocumentVersionInput { s.VersionStatus = &v return s }
string) { m.ctrl.Call(m, "UpdateClientVersion", v) }
s.UpdateVersion = &v return s }
*Recipes { s.Configure = v return s }
*App { s.ProductionBranch = v return s }
*Recipes { s.Setup = v return s }
s.RelativeFileVersion = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant code snippet. Query: func (s *ChefConfiguration) SetManageBerkshelf(v bool) *ChefConfiguration {
s.ManageBerkshelf = &v return s }
*Recipes { s.Setup = v return s }
bool) *DeregisterTargetFromMaintenanceWindowInput { s.Safe = &v return s }
error { f.set = set return f.BoolFlag.ApplyWithError(set) }
error { f.set = set return f.BoolTFlag.ApplyWithError(set) }
s.IncludeManagementEvents = &v return s }
bool) *UpdateRelationalDatabaseInput { s.EnableBackupRetention = &v return s }
*Server { s.manager = manager return s }
values in line with API POST b.Prefs.SelfJoin = true b.Prefs.CardCovers = true return b }
bool) *DockerVolumeConfiguration { s.Autoprovision = &v return s }
bool) *ListQualificationTypesInput { s.MustBeRequestable = &v return s }
{ s.BootstrapBrokerString = &v return s }
true, Managed: true, SupportsSELinux: true, } }
bool) *UpdateDevEndpointInput { s.UpdateEtlLibraries = &v return s }
error) { g.SetManager(ManagerFunc(manager)) }
bool) *GlobalSecondaryIndexDescription { s.Backfilling = &v return s }
bool) *EnvironmentVariable { s.Secure = &v return s }
s.AwsManaged = &v return s }
stateBag.Put(constants.ArmManagedImageLocation, b.config.manageImageLocation) }
bool) *ModifyClusterMaintenanceInput { s.DeferMaintenance = &v return s }
{ s.MustBeOwnedByCaller = &v return s }
bool) *FunctionConfiguration { s.Pinned = &v return s }
Config: true, API: true, } }
*App { s.ProductionBranch = v return s }
*Recipes { s.Deploy = v return s }
Instruct: Given the code snippet, retrieve the most relevant code snippet Query: func (s *CloneStackInput) SetCloneAppIds(v
[]*string) *CloneStackInput { s.CloneAppIds = v return s }
*BatchDeleteClusterSnapshotsInput { s.Identifiers = v return s }
[]string) { m.ctrl.Call(m, "SetGPUIDs", arg0) }
[]*string) *ListCollectionsOutput { s.CollectionIds = v return s }
{ s.SourceIdsList = v return s }
*Container { s.GpuIds = v return s }
[]*string) *DescribeScalingActivitiesInput { s.ActivityIds = v return s }
[]*string) *BatchModifyClusterSnapshotsInput { s.SnapshotIdentifierList = v return s }
{ s.Pids = v return s }
{ s.UserIds = &v return s }
[]*string) *ModifyDocumentPermissionInput { s.AccountIdsToAdd = v return s }
{ s.ClusterArns = v return s }
*GetAppsOutput { s.ApplicationsResponse = v return s }
[]*string) *StartAssociationsOnceInput { s.AssociationIds = v return s }
[]*string) *DescribeClustersInput { s.ClusterNames = v return s }
[]*string) *DescribeCommandsInput { s.CommandIds = v return s }
{ for i := range ids { ids[i] = o.NewV1() } }
*Signer { s.KeyPairIds = v return s }
s.CloneGroupId = &v return s }
[]*ApplicationSource) *DescribeScalingPlansInput { s.ApplicationSources = v return s }
{ s.AWSAccountIds = v return s }
{ s.Ec2InstanceIds = v return s }
[]*string) *ListThreatIntelSetsOutput { s.ThreatIntelSetIds = v return s }
[]*string) *ListDetectorsOutput { s.DetectorIds = v return s }
[]*string) *GetAuthorizationTokenInput { s.RegistryIds = v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *CloneStackInput) SetClonePermissions(v bool) *CloneStackInput {
s.ClonePermissions = &v return s }
to Subscribe. // For meaning of Import/Export, see canImport and canExport. p := &Permissions{ Publish: perms.Import, Subscribe: perms.Export, } c.setPermissions(p) }
*Denied { s.ImplicitDeny = v return s }
*Denied { s.ExplicitDeny = v return s }
getCanModify: func() (common.AuthFunc, error) { return authorizer.AuthOwner, nil }, }, nil }
{ s.InboundPermissionAuthorizations = v return s }
bool) *DescribeClusterSnapshotsInput { s.ClusterExists = &v return s }
s.AllowSharedFolder = false s.AllowOwnershipTransfer = false return s }
{ p := &UpdateIsoPermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
s.AllowSharedFolder = false s.Autorename = false s.AllowOwnershipTransfer = false return s }
ValidateFunc: validation.IntAtLeast(10), }, "customize": { Type: schema.TypeList, Optional: true, MaxItems: 1, Description: "The customization spec for this clone. This allows the user to configure the virtual machine post-clone.", Elem: &schema.Resource{Schema: VirtualMachineCustomizeSchema()}, }, } }
bool) *GetClusterCredentialsInput { s.AutoCreate = &v return s }
{ s.MustBeOwnedByCaller = &v return s }
s.Autorename = false s.AllowOwnershipTransfer = false return s }
chronograf.Permissions { return t.PermissionsF(ctx) }
*TestInvokeAuthorizerOutput { s.Claims = v return s }
[]byte, ownerPass []byte) error { return p.setProtection(permissions, userPass, ownerPass) }
{ s.CloneUrlSsh = &v return s }
[]*SharedImagePermissions) *DescribeImagePermissionsOutput { s.SharedImagePermissionsList = v return s }
s *Spec) error { setProcess(s) s.Process.NoNewPrivileges = false return nil }
bool) *DeleteProjectInput { s.DeleteStack = &v return s }
bool) *PublicAccessBlockConfiguration { s.IgnorePublicAcls = &v return s }
{ s.Classic = &v return s }
core.Authorization) (err error) { return }
SharedFolderMemberPolicy s.SharedFolderJoinPolicy = SharedFolderJoinPolicy s.SharedLinkCreatePolicy = SharedLinkCreatePolicy return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet Query: func (s *CloneStackInput) SetSourceStackId(v string) *CloneStackInput {
s.SourceStackId = &v return s }
*StackInstance) *DescribeStackInstanceOutput { s.StackInstance = v return s }
*Toolchain { s.StackParameters = v return s }
string) *RestoreDBInstanceToPointInTimeInput { s.SourceDbiResourceId = &v return s }
{ s.source = source return s }
string) *NeighborConnectionDetail { s.SourceServerId = &v return s }
string) *AggregateResourceIdentifier { s.SourceAccountId = &v return s }
string) *AssociateProductWithPortfolioInput { s.SourcePortfolioId = &v return s }
*StackSet) *DescribeStackSetOutput { s.StackSet = v return s }
string) *UpdateProvisioningPreferences { s.StackSetOperationType = &v return s }
s.SourceSnapshotClusterIdentifier = &v return s }
[]*string) *CloneStackInput { s.CloneAppIds = v return s }
{ s.ChangeSource = &v return s }
error) { var stack Stack return &stack, c.Get(&stack, "/stacks/"+stackIdentity) }
Update: stackUpdate, Deploy: stackDeploy, Shutdown: stackShutdown, Delete: stackDelete, } }
s.SourceDBClusterSnapshotIdentifier = &v return s }
{ s.SourceCode = v return s }
*StackResourceDetail) *DescribeStackResourceOutput { s.StackResourceDetail = v return s }
string) *GetNodesIdentifierCatalogsSourceParams { o.Source = source return o }
s.OutputSourceId = &v return s }
*StackResourceDrift { s.PhysicalResourceIdContext = v return s }
*StackResourceDrift) *DetectStackResourceDriftOutput { s.StackResourceDrift = v return s }
{ s.SourceIdsList = v return s }
func(n *Nexter) { *(n.id) = s } }
s.Get(ctx, &stack, fmt.Sprintf("/stacks/%v", stackIdentity), nil, nil) }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (s *CloudWatchLogsLogStream) SetBatchCount(v
int64) *CloudWatchLogsLogStream { s.BatchCount = &v return s }
int64) *PutRecordBatchOutput { s.FailedPutCount = &v return s }
{ if gs.count == 0 || gs.count > v { gs.count = v } }
int64) *StreamDescriptionSummary { s.ConsumerCount = &v return s }
*ScribeCollector) { s.batchInterval = d } }
int64) *GetObjectOutput { s.TagCount = &v return s }
int) { tsv.qe.streamConns.SetCapacity(val) }
s.MaximumCount = &v return s }
{ s.ConnectionsCount = &v return s }
s.ThrottleCount = &v return s }
{ if v < 1 { v = 1 } b.ring.MaxPartitionCount = v }
{ s.ReplicaCount = &v return s }
s.MaxCount = &v return s }
int64) *ModifyReplicationGroupShardConfigurationInput { s.NodeGroupCount = &v return s }
int64) *StackSetOperationPreferences { s.MaxConcurrentCount = &v return s }
*StackSummary { s.InstancesCount = v return s }
*Pipe { p.batchSize = n return p }
int64) *UpdateShardCountOutput { s.CurrentShardCount = &v return s }
int64) *TerminologyProperties { s.TermCount = &v return s }
{ s.HostedZoneCount = &v return s }
*CountService { s.q = q return s }
int64) *DownloadDBLogFilePortionInput { s.NumberOfLines = &v return s }
int64) *BackendConnectionErrors { s.TimeoutCount = &v return s }
{ s.HealthCheckCount = &v return s }
{ s.KeyCount = &v return s }
Instruct: Retrieve the most relevant code snippet for the following snippet. Query: func (s *CloudWatchLogsLogStream) SetBufferDuration(v int64) *CloudWatchLogsLogStream
{ s.BufferDuration = &v return s }
int64) *CloudWatchLogsLogStream { s.BatchCount = &v return s }
int64) *SpotProvisioningSpecification { s.BlockDurationMinutes = &v return s }
int64) *GetRelationalDatabaseEventsInput { s.DurationInMinutes = &v return s }
s.ScheduledActionBufferTime = &v return s }
int64) *CreatePresignedNotebookInstanceUrlInput { s.SessionExpirationDurationInSeconds = &v return s }
{ return func(p *ProgressBar) { p.config.throttleDuration = duration } }
{ return func(s *Server) error { s.leaseDuration = d return nil } }
s.MinBufferTimeSeconds = &v return s }
*Service { s.DurationHistogram = v return s }
error { f.set = set return f.DurationFlag.ApplyWithError(set) }
{ return func(g *Group) { g.groupCheckDuration = duration } }
{ s.TimeoutDurationMinutes = &v return s }
time.Duration) *BulkProcessorService { s.flushInterval = interval return s }
{ return func(s *Server) error { s.metricInterval = dur return nil } }
int64) *TaskExecutionResultDetail { s.VerifyDuration = &v return s }
{ s.DeferMaintenanceDuration = &v return s }
{ s.DeleteStream = &v return s }
s.DurationInMs = &v return s }
{ return func(r *Rebalancer) error { r.backoffDuration = d return nil } }
s.PolicyDurationSeconds = &v return s }
error { C.i2c_updateDelay(l.lwHandle, C.uint(duration)) return l.error() }
int64) *DescribeUploadBufferOutput { s.UploadBufferUsedInBytes = &v return s }
int64) *TaskExecutionResultDetail { s.PrepareDuration = &v return s }
{ return func(m *Module) { m.csrfValidityDuration = t } }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (s *CloudWatchLogsLogStream) SetDatetimeFormat(v string) *CloudWatchLogsLogStream
{ s.DatetimeFormat = &v return s }
{ s.ExportDataFormat = v return s }
{ s.format = format return s }
time.Time) *ProvisionedThroughputDescription { s.LastIncreaseDateTime = &v return s }
time.Time) *KinesisStreamSourceDescription { s.DeliveryStartTimestamp = &v return s }
string) *ResourceDataSyncS3Destination { s.SyncFormat = &v return s }
time.Time) *InstanceInformation { s.LastPingDateTime = &v return s }
{ s.StartLoggingTime = &v return s }
time.Time) *ProvisionedThroughputDescription { s.LastDecreaseDateTime = &v return s }
l.TimeFormat = s l.mu.Unlock() return l }
string) *CloudWatchLoggingOptionUpdate { s.LogStreamARNUpdate = &v return s }
ret := FieldWithType(name, formcommon.DATETIME) return ret }
*PendingModifiedValues { s.PendingCloudwatchLogsExports = v return s }
string) *GetCredentialReportOutput { s.ReportFormat = &v return s }
{ s.StopLoggingTime = &v return s }
time.Time) *RecipientDsnFields { s.LastAttemptDate = &v return s }
{ s.ChangesetFormat = &v return s }
{ h.Set("Date", t.Format(dateLayout)) }
*IndexField { s.DateOptions = v return s }
time.Time) *QueryExecutionStatus { s.CompletionDateTime = &v return s }
time.Time) *EnabledServicePrincipal { s.DateEnabled = &v return s }
time.Time) *QueryExecutionStatus { s.SubmissionDateTime = &v return s }
{ s.LogStreamNames = v return s }
{ s.TemplateFormat = &v return s }
time.Time) *EventFeedbackType { s.FeedbackDate = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant code snippet Query: func (s *CloudWatchLogsLogStream) SetFileFingerprintLines(v
string) *CloudWatchLogsLogStream { s.FileFingerprintLines = &v return s }
NewFileLogger(f, INFO, ROTATE, maxLines, maxRotate, BUFSIZE) }
string) *DeleteFilesFileidentifierParams { o.Fileidentifier = fileidentifier return o }
func(options *Options) { options.FileHandler = handler } }
s.LogStream = &v return s }
int64) *CloudWatchLogsLogStream { s.BatchCount = &v return s }
{ o.Fileidentifier = fileidentifier return o }
C.rocksdb_restore_options_set_keep_log_files(ro.c, C.int(v)) }
{ s.FileLastWritten = &v return s }
string) *HlsGroupSettings { s.TsFileMode = &v return s }
string) *CloudWatchLoggingOptionUpdate { s.LogStreamARNUpdate = &v return s }
*FileGroupSettings) *OutputGroupSettings { s.FileGroupSettings = v return s }
*PendingModifiedValues { s.PendingCloudwatchLogsExports = v return s }
*FilterLogEventsOutput { s.SearchedLogStreams = v return s }
s.FileInput = &v return s }
*CreateCommitInput { s.SetFileModes = v return s }
{ s.ReportFileFormat = &v return s }
s.FilePosition = &v return s }
*Client) error { c.logf = f return nil } }
*File) error { t.ring = rbuf.NewFixedSizeRingBuf(i) return nil } }
{ // TODO mutex this s.logLines = append(s.logLines, fields...) }
int64) *DescribeTaskExecutionOutput { s.FilesTransferred = &v return s }
*FileSourceSettings) *CaptionSourceSettings { s.FileSourceSettings = v return s }
string) *ReplicationTaskAssessmentResult { s.AssessmentResultsFile = &v return s }
s.Line = &v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet. Query: func (s *CloudWatchLogsLogStream) SetInitialPosition(v string) *CloudWatchLogsLogStream
{ s.InitialPosition = &v return s }
{ s.LogStreamNames = v return s }
s.LogStream = &v return s }
int64) *CloudWatchLogsLogStream { s.BatchCount = &v return s }
{ m := GlobalPositionInt{} m.TIME_BOOT_MS = TIME_BOOT_MS m.LAT = LAT m.LON = LON m.ALT = ALT m.RELATIVE_ALT = RELATIVE_ALT m.VX = VX m.VY = VY m.VZ = VZ m.HDG = HDG return &m }
newFuncServerOption(func(o *serverOptions) { o.initialWindowSize = s }) }
s.ExclusiveStartStreamName = &v return s }
s.StartPosition = v return s }
time.Time) *MultipartUpload { s.Initiated = &v return s }
*Stream) *FileLocation { s.Stream = v return s }
newFuncDialOption(func(o *dialOptions) { o.copts.InitialWindowSize = s }) }
*PendingModifiedValues { s.PendingCloudwatchLogsExports = v return s }
{ s.DeleteStream = &v return s }
productImpressionPosition h.productImpressionPositionSet = true return h }
newFuncServerOption(func(o *serverOptions) { o.initialConnWindowSize = s }) }
{ s.InputStream = v return s }
time.Time) *KinesisStreamSourceDescription { s.DeliveryStartTimestamp = &v return s }
*StreamRecord { s.NewImage = v return s }
{ return func(options *ClientOptions) error { options.importLogWriter = loc return nil } }
string) *CloudWatchLogsLogStream { s.FileFingerprintLines = &v return s }
string) *ServerLaunchConfiguration { s.LogicalId = &v return s }
*StreamRecord { s.OldImage = v return s }
*Input { s.KinesisStreamsInput = v return s }
productPosition h.productPositionSet = true return h }
string) *LogConfiguration { s.LogDriver = &v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *CloudWatchLogsLogStream) SetMultiLineStartPattern(v
string) *CloudWatchLogsLogStream { s.MultiLineStartPattern = &v return s }
s.ExclusiveStartDeliveryStreamName = &v return s }
{ if !oneline { return v.addmodifier(MULTILINE) } return v.removemodifier(MULTILINE) }
}) } if multilinePatternKey != "" { multilinePattern, err := regexp.Compile(multilinePatternKey) if err != nil { return nil, errors.Wrapf(err, "awslogs could not parse multiline pattern key %q", multilinePatternKey) } return multilinePattern, nil } return nil, nil }
string) *ListResourceRecordSetsInput { s.StartRecordName = &v return s }
string) *InputStartingPositionConfiguration { s.InputStartingPosition = &v return s }
{ s.LogStreamNames = v return s }
string) *CloudWatchLoggingOptionUpdate { s.LogStreamARNUpdate = &v return s }
time.Time) *KinesisStreamSourceDescription { s.DeliveryStartTimestamp = &v return s }
string) *ListResourceRecordSetsInput { s.StartRecordType = &v return s }
*ScheduleAction { s.ScheduleActionStartSettings = v return s }
*TypedAttributeValueRange { s.StartValue = v return s }
string) *ListGeoLocationsInput { s.StartCountryCode = &v return s }
{ s.StartRecordIdentifier = &v return s }
s.LogStream = &v return s }
s.TooNewLogEventStartIndex = &v return s }
string) *StartReplicationTaskInput { s.StartReplicationTaskType = &v return s }
string) *FollowModeScheduleActionStartSettings { s.FollowPoint = &v return s }
*ScheduleActionStartSettings { s.FollowModeScheduleActionStartSettings = v return s }
time.Time) *MultipartUpload { s.Initiated = &v return s }
e.multiline = v return e }
s.StartPosition = v return s }
string) *RegexPatternSetUpdate { s.RegexPatternString = &v return s }
s.ExclusiveStartTableName = &v return s }
{ s.StartingPositionTimestamp = &v return s }
Instruct: Retrieve the most relevant code snippet for the following code snippet. Query: func (s *Command) SetAcknowledgedAt(v string) *Command {
s.AcknowledgedAt = &v return s }
{ s.ImportedAt = &v return s }
{ s.ModifiedAt = &v return s }
time.Time) *EventSubscription { s.SubscribedAt = &v return s }
time.Time) *CertificateAuthority { s.LastStateChangeAt = &v return s }
s.AcceptTime = &v return s }
time.Time) { m.ctrl.Call(m, "SetCreatedAt", arg0) }
{ s.SyncCreatedTime = &v return s }
{ s.AssociatedTimestamp = &v return s }
time.Time) *ReservationPlan { s.PurchasedAt = &v return s }
{ s.AutoAppliedAfterDate = &v return s }
time.Time) *QueryExecutionStatus { s.CompletionDateTime = &v return s }
{ s.LastAccessedTime = &v return s }
{ s.CloseTimestamp = &v return s }
{ s.FromTimeStamp = &v return s }
{ s.DatetimeValue = &v return s }
{ s.ActualValue = &v return s }
{ s.Commit = v return s }
*Crawler { s.LastCrawl = v return s }
time.Time) *AccessKeyLastUsed { s.LastUsedDate = &v return s }
*Event { s.EventTime = &v return s }
time.Time) *QueryExecutionStatus { s.SubmissionDateTime = &v return s }
string) *AddAttachmentsToSetOutput { s.ExpiryTime = &v return s }
time.Time) *InstanceInformation { s.LastPingDateTime = &v return s }
{ s.InvitationTimestamp = &v return s }
Instruct: Retrieve the most relevant code snippet for the following snippet. Query: func (s *DeleteInstanceInput) SetDeleteElasticIp(v bool) *DeleteInstanceInput {
s.DeleteElasticIp = &v return s }
(*ec2.ModifyInstanceAttributeOutput, error) { panic("Not implemented") }
[]*ElasticIp) *DescribeElasticIpsOutput { s.ElasticIps = v return s }
*DeleteIPAMIPParams { o.SetContext(ctx) return o }
string) *DeleteIPAMIPParams { o.SetIP(ip) return o }
bool) *DeleteApplicationVersionInput { s.DeleteSourceBundle = &v return s }
{ return &alitasks.EIP{Name: s(c.GetNameForEIP())} }
bool) *UpdateSecurityProfileInput { s.DeleteBehaviors = &v return s }
cloud provider DeleteInstance not implemented yet") return fmt.Errorf("vSphere cloud provider does not support deleting cloud instances at this time.") }
(*elb.DeleteLoadBalancerOutput, error) { panic("Not implemented") }
{ s.DeleteStream = &v return s }
cloud provider DeleteInstance not implemented yet") return fmt.Errorf("digital ocean cloud provider does not support deleting cloud instances at this time") }
bool) *DeleteFileSystemWindowsConfiguration { s.SkipFinalBackup = &v return s }
*Flow { s.EgressIp = &v return s }
cloud provider DeleteInstance not implemented yet") return fmt.Errorf("baremetal cloud provider does not support deleting cloud instances at this time") }
*DBInstanceAutomatedBackup) *DeleteDBInstanceAutomatedBackupOutput { s.DBInstanceAutomatedBackup = v return s }
{ p := &DeleteVlanIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
error) { serviceInstance := s.findOneInstance(instanceID) serviceInstance.SetActive(false) err := s.remove(&serviceInstance) return false, err }
{ p := &RemoveIpFromNicParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p }
string) { m.ctrl.Call(m, "Delete", arg0) }
{ p := &DeleteRemoteAccessVpnParams{} p.p = make(map[string]interface{}) p.p["publicipid"] = publicipid return p }
bool) *DeleteAccountAuditConfigurationInput { s.DeleteScheduledAudits = &v return s }
*http.Client) *DeleteIPAMIPParams { o.SetHTTPClient(client) return o }
*DeleteVMParams { o.SetContext(ctx) return o }
{ s.EC2InstanceIdsToTerminate = v return s }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *DeleteInstanceInput) SetDeleteVolumes(v
bool) *DeleteInstanceInput { s.DeleteVolumes = &v return s }
Delete: volumeDelete, Prune: volumePrune, Detail: volumeDetail, Raw: volumeRaw, } }
([]*ec2.Volume, error) { panic("Not implemented") }
(*csipb.DeleteVolumeResponse, error) { return nil, nil }
Type: master.Call_DESTROY_VOLUMES, DestroyVolumes: &master.Call_DestroyVolumes{ AgentID: a, Volumes: v, }, } }
bool) *DeleteProjectInput { s.DeleteStack = &v return s }
*DBInstanceAutomatedBackup) *DeleteDBInstanceAutomatedBackupOutput { s.DBInstanceAutomatedBackup = v return s }
c.WaitUntilVolumeDeletedWithContext(aws.BackgroundContext(), input) }
{ s.DeleteStream = &v return s }
(resp *ec2.VolumeAttachment, err error) { panic("Not implemented") }
[]*types.Volume { sort.Sort(ByVolumeID(volumes)) return volumes }
bool) *DeleteApplicationVersionInput { s.DeleteSourceBundle = &v return s }
[]*string) *UpdateDevEndpointInput { s.DeleteArguments = v return s }
{ s.MethodCall(s, "CreateVolumes", ctx, params) if s.CreateVolumesFunc != nil { return s.CreateVolumesFunc(ctx, params) } return nil, errors.NotImplementedf("CreateVolumes") }
!= nil { return s.DetachVolumesFunc(ctx, params) } return nil, errors.NotImplementedf("DetachVolumes") }
string) error { _, err := e.kvdb.Delete(e.volKey(volumeID)) return err }
*CreateCommitInput { s.DeleteFiles = v return s }
{ return c.c.Delete(fmt.Sprintf("/storage/volumes/%s", volumeID)) }
[]*VolumeInfo) *ListVolumesOutput { s.VolumeInfos = v return s }
*WriteRequest { s.DeleteRequest = v return s }
{ p := &ListVolumesParams{} p.p = make(map[string]interface{}) return p }
*ListObjectVersionsOutput { s.DeleteMarkers = v return s }
(*csipb.ListVolumesResponse, error) { return nil, nil }
bool) *DeleteAccountAuditConfigurationInput { s.DeleteScheduledAudits = &v return s }
s.SchemaDeleteOption = &v return s }
Instruct: Retrieve the most relevant code snippet for the following snippet. Query: func (s *DescribeAgentVersionsOutput) SetAgentVersions(v
[]*AgentVersion) *DescribeAgentVersionsOutput { s.AgentVersions = v return s }
[]*AgentInfo) *DescribeAgentsOutput { s.AgentsInfo = v return s }
*ListLayerVersionsOutput { s.LayerVersions = v return s }
[]*AgentPreview) *PreviewAgentsOutput { s.AgentPreviews = v return s }
[]*ClusterVersion) *DescribeClusterVersionsOutput { s.ClusterVersions = v return s }
{ s.FaceModelVersions = v return s }
[]*PolicyVersion) *ListPolicyVersionsOutput { s.PolicyVersions = v return s }
[]*AssessmentRunAgent) *ListAssessmentRunAgentsOutput { s.AssessmentRunAgents = v return s }
*SecretListEntry { s.SecretVersionsToStages = v return s }
*AgentInfo { s.AgentNetworkInfoList = v return s }
[]*string) *CompatibleVersionsMap { s.TargetVersions = v return s }
s.AgentArns = v return s }
s.ActiveAgents = &v return s }
s.UnknownAgents = &v return s }
[]*string) *GetUtterancesViewInput { s.BotVersions = v return s }
s.ShutdownAgents = &v return s }
[]*TableVersion) *GetTableVersionsOutput { s.TableVersions = v return s }
s.OptionGroupOptionVersions = v return s }
string) *CreateAgentInput { s.AgentName = &v return s }
[]*string) *ListElasticsearchVersionsOutput { s.ElasticsearchVersions = v return s }
s.AgentHealths = v return s }
s.HealthyAgents = &v return s }
*Build { s.SecondarySourceVersions = v return s }
[]*string) *BatchDeleteTableVersionInput { s.VersionIds = v return s }
[]*CacheEngineVersion) *DescribeCacheEngineVersionsOutput { s.CacheEngineVersions = v return s }
Instruct: Given the following code snippet, retrieve the most relevant snippet Query: func (s *DescribeCommandsInput) SetCommandIds(v
[]*string) *DescribeCommandsInput { s.CommandIds = v return s }
[]*string) *DescribeScalingActivitiesInput { s.ActivityIds = v return s }
[]*string) *DescribePipelinesInput { s.PipelineIds = v return s }
{ s.SystemIds = v return s }
return func(c *TestContainerConfig) { c.Config.Cmd = strslice.StrSlice(cmds) } }
[]*string) *ListCollectionsOutput { s.CollectionIds = v return s }
*RunCommandParameters { s.RunCommandTargets = v return s }
*Container { s.GpuIds = v return s }
[]*string) *DescribeVolumesInput { s.VolumeIds = v return s }
bambou.CurrentSession().FetchChildren(o, CommandIdentity, &list, info) return list, err }
[]*string) *DescribeStacksInput { s.StackIds = v return s }
[]*string) *DescribeCasesInput { s.CaseIdList = v return s }
[]*string) *ListThreatIntelSetsOutput { s.ThreatIntelSetIds = v return s }
func(n *Nexter) { *(n.id) = s } }
[]string) *MultiTermvectorService { s.ids = ids return s }
[]*string) *ListDetectorsOutput { s.DetectorIds = v return s }
[]*string) *DescribeDomainControllersInput { s.DomainControllerIds = v return s }
*CommandInvocation { s.CommandPlugins = v return s }
[]*string) *DescribeSnapshotsInput { s.SnapshotIds = v return s }
[]*string) *DescribeMatchmakingInput { s.TicketIds = v return s }
= append(s.commands, commands...) return s }
{ s.SourceIdsList = v return s }
[]*string) *DescribeServiceErrorsInput { s.ServiceErrorIds = v return s }
*BatchDeleteClusterSnapshotsInput { s.Identifiers = v return s }
{ s.Pids = v return s }
Instruct: Given the code snippet, retrieve the most relevant code snippet Query: func (s *DescribeEcsClustersInput) SetEcsClusterArns(v
[]*string) *DescribeEcsClustersInput { s.EcsClusterArns = v return s }
{ s.TaskArns = v return s }
*TraceSummary { s.ResourceARNs = v return s }
[]*string) *ListContainerInstancesOutput { s.ContainerInstanceArns = v return s }
[]*string) *ListLicenseConfigurationsInput { s.LicenseConfigurationArns = v return s }
[]*string) *DescribeResourceGroupsInput { s.ResourceGroupArns = v return s }
[]*string) *DescribeClustersInput { s.ClusterNames = v return s }
[]*string) *DescribeRulesInput { s.RuleArns = v return s }
s.DbClusterOrInstanceArn = &v return s }
[]*string) *DescribeTargetGroupsInput { s.TargetGroupArns = v return s }
*Target { s.EcsParameters = v return s }
[]*string) *DescribeUserProfilesInput { s.IamUserArns = v return s }
[]*string) *ListTaskDefinitionsOutput { s.TaskDefinitionArns = v return s }
s.EcsClusterName = &v return s }
[]*string) *GetResourceShareInvitationsInput { s.ResourceShareInvitationArns = v return s }
[]*string) *DescribeRdsDbInstancesInput { s.RdsDbInstanceArns = v return s }
s.EcsContainerInstanceArn = &v return s }
s.ApplicationArns = v return s }
s.SecurityGroupArns = v return s }
s.GlobalClusterArn = &v return s }
{ s.EfsFilesystemArn = &v return s }
*ListClustersOutput { s.ClusterListEntries = v return s }
s.AgentArns = v return s }
*EC2TagSet { s.Ec2TagSetList = v return s }
{ s.EcsTarget = v return s }
Instruct: Retrieve the most relevant code snippet for the given code snippet Query: func (s *DescribeEcsClustersOutput) SetEcsClusters(v
[]*EcsCluster) *DescribeEcsClustersOutput { s.EcsClusters = v return s }
[]*CacheCluster) *DescribeCacheClustersOutput { s.CacheClusters = v return s }
[]*string) *DescribeClustersInput { s.ClusterNames = v return s }
s.EcsClusterName = &v return s }
{ s.EcsTarget = v return s }
[]*GlobalCluster) *DescribeGlobalClustersOutput { s.GlobalClusters = v return s }
*EC2TagSet { s.Ec2TagSetList = v return s }
error) { return c.Fake. InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) }
[]*ClusterSubnetGroup) *DescribeClusterSubnetGroupsOutput { s.ClusterSubnetGroups = v return s }
*Cluster { s.ClusterParameterGroups = v return s }
*Cluster { s.ClusterNodes = v return s }
{ s.ClusterStates = v return s }
&ListClustersParams{} p.p = make(map[string]interface{}) return p }
*Cluster { s.Hsms = v return s }
{ s.ClusterArns = v return s }
make([]cluster.Cluster, 0, len(clusters)) for _, cls := range clusters { cs = append(cs, cls) } return cs }
[]*DBClusterParameterGroup) *DescribeDBClusterParameterGroupsOutput { s.DBClusterParameterGroups = v return s }
*Cluster { s.Ec2InstanceAttributes = v return s }
[]*ClusterVersion) *DescribeClusterVersionsOutput { s.ClusterVersions = v return s }
{ s.Ec2InstanceIds = v return s }
int64) *CreateReplicationGroupInput { s.NumCacheClusters = &v return s }
*GlobalCluster { s.GlobalClusterMembers = v return s }
{ s.ClusterInfoList = v return s }
_ := ret[0].(*ecs.CreateClusterOutput) ret1, _ := ret[1].(error) return ret0, ret1 }
*DBCluster { s.DBClusterMembers = v return s }
Instruct: Given the code snippet, retrieve the most relevant snippet. Query: func (s *DescribeElasticIpsInput) SetIps(v
[]*string) *DescribeElasticIpsInput { s.Ips = v return s }
i, v := range ips { new_private_ip := &ec2.PrivateIpAddressSpecification{ PrivateIpAddress: aws.String(v.(string)), } new_private_ip.Primary = aws.Bool(i == 0) dtos = append(dtos, new_private_ip) } return dtos }
[]*IpSet) *Accelerator { s.IpSets = v return s }
[]*StaticIp) *GetStaticIpsOutput { s.StaticIps = v return s }
{ s.IpSetIds = v return s }
if err := ips.tryUpdate(); err != nil { dcontext.GetLogger(context.Background()).WithError(err).Warn("failed to update AWS IP") } go ips.updater() return ips }
[]*DedicatedIp) *GetDedicatedIpsOutput { s.DedicatedIps = v return s }
*Nameserver { s.GlueIps = v return s }
*IPSetUpdate { s.IPSetDescriptor = v return s }
free IPs in VLAN 001:\ncrimson get-ips -vlan 001 -n 20", CommandRun: func() subcommands.CommandRun { cmd := &GetIPsCmd{} cmd.Initialize(params) cmd.Flags.Int64Var(&cmd.req.Vlan, "vlan", 0, "VLAN to get free IP addresses on.") cmd.Flags.Var(flag.Int32(&cmd.req.PageSize), "n", "The number of free IP addresses to get.") return cmd }, } }
{ s.IpRoutes = v return s }
c.call("SetIPs", r, new(string)) }
[]*string) *WorkspaceDirectory { s.IpGroupIds = v return s }
[]*string) *AwsEc2InstanceDetails { s.IpV4Addresses = v return s }
func(s *Server) error { s.ip = i return nil } return nil }
s.IngestIp = &v return s }
copy(ips, staticIPs) return &AgentServer{ staticIPs: ips, } }
s.ignoreIPs = ips return nil } }
[]*string) *DirectoryConnectSettings { s.CustomerDnsIps = v return s }
[]*string) *AssetAttributes { s.Ipv4Addresses = v return s }
if e.IPv6.IsSet() { ips = append(ips, e.IPv6.IP()) } return ips }
string) *NetworkBinding { s.BindIP = &v return s }
*Cluster { s.ElasticIpStatus = v return s }
[]*IpRouteInfo) *ListIpRoutesOutput { s.IpRoutesInfo = v return s }
string) *ChannelEgressEndpoint { s.SourceIp = &v return s }
Instruct: Retrieve the most relevant code snippet for the following code snippet Query: func (s *DescribeElasticIpsOutput) SetElasticIps(v
[]*ElasticIp) *DescribeElasticIpsOutput { s.ElasticIps = v return s }
*Nameserver { s.GlueIps = v return s }
[]*string) *RemoveIpRoutesInput { s.CidrIps = v return s }
[]*DedicatedIp) *GetDedicatedIpsOutput { s.DedicatedIps = v return s }
*ListIPSetsOutput { s.IPSets = v return s }
i, v := range ips { new_private_ip := &ec2.PrivateIpAddressSpecification{ PrivateIpAddress: aws.String(v.(string)), } new_private_ip.Primary = aws.Bool(i == 0) dtos = append(dtos, new_private_ip) } return dtos }
[]*IpSet) *Accelerator { s.IpSets = v return s }
{ s.IpSetIds = v return s }
if e.IPv6.IsSet() { ips = append(ips, e.IPv6.IP()) } return ips }
[]*ElasticLoadBalancer) *DescribeElasticLoadBalancersOutput { s.ElasticLoadBalancers = v return s }
*IPSet { s.IPSetDescriptors = v return s }
[]*string) *AwsEc2InstanceDetails { s.IpV4Addresses = v return s }
[]*string) *ListElasticsearchInstanceTypesOutput { s.ElasticsearchInstanceTypes = v return s }
{ s.IpRoutes = v return s }
*Flow { s.EgressIp = &v return s }
[]*string) *WorkspaceDirectory { s.IpGroupIds = v return s }
[]*string) *AssetAttributes { s.Ipv4Addresses = v return s }
if err := ips.tryUpdate(); err != nil { dcontext.GetLogger(context.Background()).WithError(err).Warn("failed to update AWS IP") } go ips.updater() return ips }
string) *ChannelEgressEndpoint { s.SourceIp = &v return s }
[]*string) *ListElasticsearchVersionsOutput { s.ElasticsearchVersions = v return s }
[]*string) *DirectoryConnectSettings { s.CustomerDnsIps = v return s }
{ s.ElbInfoList = v return s }
[]*string) *AwsEc2InstanceDetails { s.IpV6Addresses = v return s }
[]string for _, ing := range info.LoadBalancerStatus.Ingress { ips = append(ips, ing.IP) } return ips }
[]*string) *GetCheckerIpRangesOutput { s.CheckerIpRanges = v return s }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
11

Models trained or fine-tuned on codefuse-ai/F2LLM-v2

Collection including codefuse-ai/F2LLM-v2