repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_flow_mapping_key | func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) {
return false
}
if !yaml_emitter_increase_indent(emitter, true, false) {
return false
}
emitter.flow_level++
}
... | go | func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) {
return false
}
if !yaml_emitter_increase_indent(emitter, true, false) {
return false
}
emitter.flow_level++
}
... | [
"func",
"yaml_emitter_emit_flow_mapping_key",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"first",
"bool",
")",
"bool",
"{",
"if",
"first",
"{",
"if",
"!",
"yaml_emitter_write_indicator",
"(",
"emitter",
",",
"[",
"]",
"byte",
... | // Expect a flow key node. | [
"Expect",
"a",
"flow",
"key",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L504-L555 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_flow_mapping_value | func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
if simple {
if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
return false
}
} else {
if emitter.canonical || emitter.column > emitter.best_width {
if !yaml_emitter_write... | go | func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
if simple {
if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
return false
}
} else {
if emitter.canonical || emitter.column > emitter.best_width {
if !yaml_emitter_write... | [
"func",
"yaml_emitter_emit_flow_mapping_value",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"simple",
"bool",
")",
"bool",
"{",
"if",
"simple",
"{",
"if",
"!",
"yaml_emitter_write_indicator",
"(",
"emitter",
",",
"[",
"]",
"byt... | // Expect a flow value node. | [
"Expect",
"a",
"flow",
"value",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L558-L575 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_block_sequence_item | func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) {
return false
}
}
if event.typ == yaml_SEQUENCE_END_EVENT {
emitter.indent = emitter.indents... | go | func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) {
return false
}
}
if event.typ == yaml_SEQUENCE_END_EVENT {
emitter.indent = emitter.indents... | [
"func",
"yaml_emitter_emit_block_sequence_item",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"first",
"bool",
")",
"bool",
"{",
"if",
"first",
"{",
"if",
"!",
"yaml_emitter_increase_indent",
"(",
"emitter",
",",
"false",
",",
"... | // Expect a block item node. | [
"Expect",
"a",
"block",
"item",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L578-L599 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_block_mapping_key | func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_increase_indent(emitter, false, false) {
return false
}
}
if event.typ == yaml_MAPPING_END_EVENT {
emitter.indent = emitter.indents[len(emitter.indents)-1]
emitter.indents ... | go | func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_increase_indent(emitter, false, false) {
return false
}
}
if event.typ == yaml_MAPPING_END_EVENT {
emitter.indent = emitter.indents[len(emitter.indents)-1]
emitter.indents ... | [
"func",
"yaml_emitter_emit_block_mapping_key",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"first",
"bool",
")",
"bool",
"{",
"if",
"first",
"{",
"if",
"!",
"yaml_emitter_increase_indent",
"(",
"emitter",
",",
"false",
",",
"fa... | // Expect a block key node. | [
"Expect",
"a",
"block",
"key",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L602-L627 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_block_mapping_value | func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
if simple {
if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
return false
}
} else {
if !yaml_emitter_write_indent(emitter) {
return false
}
if !yaml_emitter_write_... | go | func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
if simple {
if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
return false
}
} else {
if !yaml_emitter_write_indent(emitter) {
return false
}
if !yaml_emitter_write_... | [
"func",
"yaml_emitter_emit_block_mapping_value",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"simple",
"bool",
")",
"bool",
"{",
"if",
"simple",
"{",
"if",
"!",
"yaml_emitter_write_indicator",
"(",
"emitter",
",",
"[",
"]",
"by... | // Expect a block value node. | [
"Expect",
"a",
"block",
"value",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L630-L645 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_alias | func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
emitter.state = emitter.states[len(emitter.states)-1]
emitter.states = emitter.states[:len(emitter.states)-1]
return true
} | go | func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
emitter.state = emitter.states[len(emitter.states)-1]
emitter.states = emitter.states[:len(emitter.states)-1]
return true
} | [
"func",
"yaml_emitter_emit_alias",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"!",
"yaml_emitter_process_anchor",
"(",
"emitter",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"emitter",
".",
"state",
"=",... | // Expect ALIAS. | [
"Expect",
"ALIAS",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L673-L680 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_scalar | func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_select_scalar_style(emitter, event) {
return false
}
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if !yaml_emitter_increase_indent(emitter,... | go | func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_select_scalar_style(emitter, event) {
return false
}
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if !yaml_emitter_increase_indent(emitter,... | [
"func",
"yaml_emitter_emit_scalar",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"!",
"yaml_emitter_select_scalar_style",
"(",
"emitter",
",",
"event",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!"... | // Expect SCALAR. | [
"Expect",
"SCALAR",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L683-L704 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_sequence_start | func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE ||
y... | go | func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE ||
y... | [
"func",
"yaml_emitter_emit_sequence_start",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"!",
"yaml_emitter_process_anchor",
"(",
"emitter",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"yaml_emitt... | // Expect SEQUENCE-START. | [
"Expect",
"SEQUENCE",
"-",
"START",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L707-L721 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_mapping_start | func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE ||
yaml... | go | func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if !yaml_emitter_process_anchor(emitter) {
return false
}
if !yaml_emitter_process_tag(emitter) {
return false
}
if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE ||
yaml... | [
"func",
"yaml_emitter_emit_mapping_start",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"!",
"yaml_emitter_process_anchor",
"(",
"emitter",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"yaml_emitte... | // Expect MAPPING-START. | [
"Expect",
"MAPPING",
"-",
"START",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L724-L738 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_check_empty_sequence | func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool {
if len(emitter.events)-emitter.events_head < 2 {
return false
}
return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT &&
emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT
} | go | func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool {
if len(emitter.events)-emitter.events_head < 2 {
return false
}
return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT &&
emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT
} | [
"func",
"yaml_emitter_check_empty_sequence",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"len",
"(",
"emitter",
".",
"events",
")",
"-",
"emitter",
".",
"events_head",
"<",
"2",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"emitter",... | // Check if the next events represent an empty sequence. | [
"Check",
"if",
"the",
"next",
"events",
"represent",
"an",
"empty",
"sequence",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L746-L752 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_check_empty_mapping | func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool {
if len(emitter.events)-emitter.events_head < 2 {
return false
}
return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT &&
emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT
} | go | func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool {
if len(emitter.events)-emitter.events_head < 2 {
return false
}
return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT &&
emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT
} | [
"func",
"yaml_emitter_check_empty_mapping",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"len",
"(",
"emitter",
".",
"events",
")",
"-",
"emitter",
".",
"events_head",
"<",
"2",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"emitter",
... | // Check if the next events represent an empty mapping. | [
"Check",
"if",
"the",
"next",
"events",
"represent",
"an",
"empty",
"mapping",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L755-L761 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_check_simple_key | func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool {
length := 0
switch emitter.events[emitter.events_head].typ {
case yaml_ALIAS_EVENT:
length += len(emitter.anchor_data.anchor)
case yaml_SCALAR_EVENT:
if emitter.scalar_data.multiline {
return false
}
length += len(emitter.anchor_data.anch... | go | func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool {
length := 0
switch emitter.events[emitter.events_head].typ {
case yaml_ALIAS_EVENT:
length += len(emitter.anchor_data.anchor)
case yaml_SCALAR_EVENT:
if emitter.scalar_data.multiline {
return false
}
length += len(emitter.anchor_data.anch... | [
"func",
"yaml_emitter_check_simple_key",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"length",
":=",
"0",
"\n",
"switch",
"emitter",
".",
"events",
"[",
"emitter",
".",
"events_head",
"]",
".",
"typ",
"{",
"case",
"yaml_ALIAS_EVENT",
":",
"length"... | // Check if the next node can be expressed as a simple key. | [
"Check",
"if",
"the",
"next",
"node",
"can",
"be",
"expressed",
"as",
"a",
"simple",
"key",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L764-L795 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_select_scalar_style | func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {
no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0
if no_tag && !event.implicit && !event.quoted_implicit {
return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are spe... | go | func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {
no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0
if no_tag && !event.implicit && !event.quoted_implicit {
return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are spe... | [
"func",
"yaml_emitter_select_scalar_style",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"no_tag",
":=",
"len",
"(",
"emitter",
".",
"tag_data",
".",
"handle",
")",
"==",
"0",
"&&",
"len",
"(",
"emitter",
".",
... | // Determine an acceptable scalar style. | [
"Determine",
"an",
"acceptable",
"scalar",
"style",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L798-L844 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_process_anchor | func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool {
if emitter.anchor_data.anchor == nil {
return true
}
c := []byte{'&'}
if emitter.anchor_data.alias {
c[0] = '*'
}
if !yaml_emitter_write_indicator(emitter, c, true, false, false) {
return false
}
return yaml_emitter_write_anchor(emitter, emi... | go | func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool {
if emitter.anchor_data.anchor == nil {
return true
}
c := []byte{'&'}
if emitter.anchor_data.alias {
c[0] = '*'
}
if !yaml_emitter_write_indicator(emitter, c, true, false, false) {
return false
}
return yaml_emitter_write_anchor(emitter, emi... | [
"func",
"yaml_emitter_process_anchor",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"emitter",
".",
"anchor_data",
".",
"anchor",
"==",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"c",
":=",
"[",
"]",
"byte",
"{",
"'&'",
"}",
"\n",
... | // Write an achor. | [
"Write",
"an",
"achor",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L847-L859 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_process_tag | func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool {
if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 {
return true
}
if len(emitter.tag_data.handle) > 0 {
if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) {
return false
}
if len(emitter.tag_data.suffix)... | go | func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool {
if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 {
return true
}
if len(emitter.tag_data.handle) > 0 {
if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) {
return false
}
if len(emitter.tag_data.suffix)... | [
"func",
"yaml_emitter_process_tag",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"len",
"(",
"emitter",
".",
"tag_data",
".",
"handle",
")",
"==",
"0",
"&&",
"len",
"(",
"emitter",
".",
"tag_data",
".",
"suffix",
")",
"==",
"0",
"{",
... | // Write a tag. | [
"Write",
"a",
"tag",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L862-L888 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_process_scalar | func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool {
switch emitter.scalar_data.style {
case yaml_PLAIN_SCALAR_STYLE:
return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
case yaml_SINGLE_QUOTED_SCALAR_STYLE:
return yaml_emitter_write_single_quoted_... | go | func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool {
switch emitter.scalar_data.style {
case yaml_PLAIN_SCALAR_STYLE:
return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
case yaml_SINGLE_QUOTED_SCALAR_STYLE:
return yaml_emitter_write_single_quoted_... | [
"func",
"yaml_emitter_process_scalar",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"switch",
"emitter",
".",
"scalar_data",
".",
"style",
"{",
"case",
"yaml_PLAIN_SCALAR_STYLE",
":",
"return",
"yaml_emitter_write_plain_scalar",
"(",
"emitter",
",",
"emitt... | // Write a scalar. | [
"Write",
"a",
"scalar",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L891-L909 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_analyze_version_directive | func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool {
if version_directive.major != 1 || version_directive.minor != 1 {
return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive")
}
return true
} | go | func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool {
if version_directive.major != 1 || version_directive.minor != 1 {
return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive")
}
return true
} | [
"func",
"yaml_emitter_analyze_version_directive",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"version_directive",
"*",
"yaml_version_directive_t",
")",
"bool",
"{",
"if",
"version_directive",
".",
"major",
"!=",
"1",
"||",
"version_directive",
".",
"minor",
"!=",
"1"... | // Check if a %YAML directive is valid. | [
"Check",
"if",
"a",
"%YAML",
"directive",
"is",
"valid",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L912-L917 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_analyze_tag_directive | func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool {
handle := tag_directive.handle
prefix := tag_directive.prefix
if len(handle) == 0 {
return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty")
}
if handle[0] != '!' {
return yaml_emi... | go | func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool {
handle := tag_directive.handle
prefix := tag_directive.prefix
if len(handle) == 0 {
return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty")
}
if handle[0] != '!' {
return yaml_emi... | [
"func",
"yaml_emitter_analyze_tag_directive",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"tag_directive",
"*",
"yaml_tag_directive_t",
")",
"bool",
"{",
"handle",
":=",
"tag_directive",
".",
"handle",
"\n",
"prefix",
":=",
"tag_directive",
".",
"prefix",
"\n",
"if"... | // Check if a %TAG directive is valid. | [
"Check",
"if",
"a",
"%TAG",
"directive",
"is",
"valid",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L920-L941 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_analyze_anchor | func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool {
if len(anchor) == 0 {
problem := "anchor value must not be empty"
if alias {
problem = "alias value must not be empty"
}
return yaml_emitter_set_emitter_error(emitter, problem)
}
for i := 0; i < len(anchor); i += w... | go | func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool {
if len(anchor) == 0 {
problem := "anchor value must not be empty"
if alias {
problem = "alias value must not be empty"
}
return yaml_emitter_set_emitter_error(emitter, problem)
}
for i := 0; i < len(anchor); i += w... | [
"func",
"yaml_emitter_analyze_anchor",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"anchor",
"[",
"]",
"byte",
",",
"alias",
"bool",
")",
"bool",
"{",
"if",
"len",
"(",
"anchor",
")",
"==",
"0",
"{",
"problem",
":=",
"\"",
"\"",
"\n",
"if",
"alias",
"{... | // Check if an anchor is valid. | [
"Check",
"if",
"an",
"anchor",
"is",
"valid",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L944-L964 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_analyze_event | func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.anchor_data.anchor = nil
emitter.tag_data.handle = nil
emitter.tag_data.suffix = nil
emitter.scalar_data.value = nil
switch event.typ {
case yaml_ALIAS_EVENT:
if !yaml_emitter_analyze_anchor(emitter, event.anchor, tru... | go | func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.anchor_data.anchor = nil
emitter.tag_data.handle = nil
emitter.tag_data.suffix = nil
emitter.scalar_data.value = nil
switch event.typ {
case yaml_ALIAS_EVENT:
if !yaml_emitter_analyze_anchor(emitter, event.anchor, tru... | [
"func",
"yaml_emitter_analyze_event",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"emitter",
".",
"anchor_data",
".",
"anchor",
"=",
"nil",
"\n",
"emitter",
".",
"tag_data",
".",
"handle",
"=",
"nil",
"\n",
"em... | // Check if the event data is valid. | [
"Check",
"if",
"the",
"event",
"data",
"is",
"valid",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L1133-L1186 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_write_bom | func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool {
if !flush(emitter) {
return false
}
pos := emitter.buffer_pos
emitter.buffer[pos+0] = '\xEF'
emitter.buffer[pos+1] = '\xBB'
emitter.buffer[pos+2] = '\xBF'
emitter.buffer_pos += 3
return true
} | go | func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool {
if !flush(emitter) {
return false
}
pos := emitter.buffer_pos
emitter.buffer[pos+0] = '\xEF'
emitter.buffer[pos+1] = '\xBB'
emitter.buffer[pos+2] = '\xBF'
emitter.buffer_pos += 3
return true
} | [
"func",
"yaml_emitter_write_bom",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"!",
"flush",
"(",
"emitter",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"pos",
":=",
"emitter",
".",
"buffer_pos",
"\n",
"emitter",
".",
"buffer",
"[",
"... | // Write the BOM character. | [
"Write",
"the",
"BOM",
"character",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L1189-L1199 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go | evalIdentifier | func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) ([]reflect.Value, error) {
results := []reflect.Value{}
switch node.Name {
case "range":
j.stack = append(j.stack, j.cur)
j.beginRange += 1
results = input
case "end":
if j.endRange < j.inRange { //inside a loop, break the curren... | go | func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) ([]reflect.Value, error) {
results := []reflect.Value{}
switch node.Name {
case "range":
j.stack = append(j.stack, j.cur)
j.beginRange += 1
results = input
case "end":
if j.endRange < j.inRange { //inside a loop, break the curren... | [
"func",
"(",
"j",
"*",
"JSONPath",
")",
"evalIdentifier",
"(",
"input",
"[",
"]",
"reflect",
".",
"Value",
",",
"node",
"*",
"IdentifierNode",
")",
"(",
"[",
"]",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"results",
":=",
"[",
"]",
"reflect",
... | // evalIdentifier evaluates IdentifierNode | [
"evalIdentifier",
"evaluates",
"IdentifierNode"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go#L189-L211 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go | evalArray | func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.Value, error) {
result := []reflect.Value{}
for _, value := range input {
value, isNil := template.Indirect(value)
if isNil || (value.Kind() != reflect.Array && value.Kind() != reflect.Slice) {
return input, fmt.Errorf("%v is not ... | go | func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.Value, error) {
result := []reflect.Value{}
for _, value := range input {
value, isNil := template.Indirect(value)
if isNil || (value.Kind() != reflect.Array && value.Kind() != reflect.Slice) {
return input, fmt.Errorf("%v is not ... | [
"func",
"(",
"j",
"*",
"JSONPath",
")",
"evalArray",
"(",
"input",
"[",
"]",
"reflect",
".",
"Value",
",",
"node",
"*",
"ArrayNode",
")",
"(",
"[",
"]",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"reflect",
".",
"V... | // evalArray evaluates ArrayNode | [
"evalArray",
"evaluates",
"ArrayNode"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go#L214-L257 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go | evalField | func (j *JSONPath) evalField(input []reflect.Value, node *FieldNode) ([]reflect.Value, error) {
results := []reflect.Value{}
// If there's no input, there's no output
if len(input) == 0 {
return results, nil
}
for _, value := range input {
var result reflect.Value
value, isNil := template.Indirect(value)
i... | go | func (j *JSONPath) evalField(input []reflect.Value, node *FieldNode) ([]reflect.Value, error) {
results := []reflect.Value{}
// If there's no input, there's no output
if len(input) == 0 {
return results, nil
}
for _, value := range input {
var result reflect.Value
value, isNil := template.Indirect(value)
i... | [
"func",
"(",
"j",
"*",
"JSONPath",
")",
"evalField",
"(",
"input",
"[",
"]",
"reflect",
".",
"Value",
",",
"node",
"*",
"FieldNode",
")",
"(",
"[",
"]",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"results",
":=",
"[",
"]",
"reflect",
".",
"... | // evalField evaluates filed of struct or key of map. | [
"evalField",
"evaluates",
"filed",
"of",
"struct",
"or",
"key",
"of",
"map",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go#L306-L335 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go | NewStreamExecutor | func NewStreamExecutor(upgrader httpstream.UpgradeRoundTripper, fn func(http.RoundTripper) http.RoundTripper, method string, url *url.URL) (StreamExecutor, error) {
var rt http.RoundTripper = upgrader
if fn != nil {
rt = fn(rt)
}
return &streamExecutor{
upgrader: upgrader,
transport: rt,
method: method,... | go | func NewStreamExecutor(upgrader httpstream.UpgradeRoundTripper, fn func(http.RoundTripper) http.RoundTripper, method string, url *url.URL) (StreamExecutor, error) {
var rt http.RoundTripper = upgrader
if fn != nil {
rt = fn(rt)
}
return &streamExecutor{
upgrader: upgrader,
transport: rt,
method: method,... | [
"func",
"NewStreamExecutor",
"(",
"upgrader",
"httpstream",
".",
"UpgradeRoundTripper",
",",
"fn",
"func",
"(",
"http",
".",
"RoundTripper",
")",
"http",
".",
"RoundTripper",
",",
"method",
"string",
",",
"url",
"*",
"url",
".",
"URL",
")",
"(",
"StreamExecu... | // NewStreamExecutor upgrades the request so that it supports multiplexed bidirectional
// streams. This method takes a stream upgrader and an optional function that is invoked
// to wrap the round tripper. This method may be used by clients that are lower level than
// Kubernetes clients or need to provide their own u... | [
"NewStreamExecutor",
"upgrades",
"the",
"request",
"so",
"that",
"it",
"supports",
"multiplexed",
"bidirectional",
"streams",
".",
"This",
"method",
"takes",
"a",
"stream",
"upgrader",
"and",
"an",
"optional",
"function",
"that",
"is",
"invoked",
"to",
"wrap",
"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go#L86-L97 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go | Dial | func (e *streamExecutor) Dial(protocols ...string) (httpstream.Connection, string, error) {
rt := transport.DebugWrappers(e.transport)
// TODO the client probably shouldn't be created here, as it doesn't allow
// flexibility to allow callers to configure it.
client := &http.Client{Transport: rt}
req, err := http... | go | func (e *streamExecutor) Dial(protocols ...string) (httpstream.Connection, string, error) {
rt := transport.DebugWrappers(e.transport)
// TODO the client probably shouldn't be created here, as it doesn't allow
// flexibility to allow callers to configure it.
client := &http.Client{Transport: rt}
req, err := http... | [
"func",
"(",
"e",
"*",
"streamExecutor",
")",
"Dial",
"(",
"protocols",
"...",
"string",
")",
"(",
"httpstream",
".",
"Connection",
",",
"string",
",",
"error",
")",
"{",
"rt",
":=",
"transport",
".",
"DebugWrappers",
"(",
"e",
".",
"transport",
")",
"... | // Dial opens a connection to a remote server and attempts to negotiate a SPDY
// connection. Upon success, it returns the connection and the protocol
// selected by the server. | [
"Dial",
"opens",
"a",
"connection",
"to",
"a",
"remote",
"server",
"and",
"attempts",
"to",
"negotiate",
"a",
"SPDY",
"connection",
".",
"Upon",
"success",
"it",
"returns",
"the",
"connection",
"and",
"the",
"protocol",
"selected",
"by",
"the",
"server",
"."... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go#L102-L129 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | getSessionID | func (t *transport) getSessionID() []byte {
if t.sessionID == nil {
panic("session ID not set yet")
}
return t.sessionID
} | go | func (t *transport) getSessionID() []byte {
if t.sessionID == nil {
panic("session ID not set yet")
}
return t.sessionID
} | [
"func",
"(",
"t",
"*",
"transport",
")",
"getSessionID",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"t",
".",
"sessionID",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"t",
".",
"sessionID",
"\n",
"}"
] | // getSessionID returns the ID of the SSH connection. The return value
// should not be modified. | [
"getSessionID",
"returns",
"the",
"ID",
"of",
"the",
"SSH",
"connection",
".",
"The",
"return",
"value",
"should",
"not",
"be",
"modified",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L50-L55 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | prepareKeyChange | func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
if t.sessionID == nil {
t.sessionID = kexResult.H
}
kexResult.SessionID = t.sessionID
if ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult); err != nil {
return err
} else {
t.reader.pendingKeyChange <- ciph
}
... | go | func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
if t.sessionID == nil {
t.sessionID = kexResult.H
}
kexResult.SessionID = t.sessionID
if ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult); err != nil {
return err
} else {
t.reader.pendingKeyChange <- ciph
}
... | [
"func",
"(",
"t",
"*",
"transport",
")",
"prepareKeyChange",
"(",
"algs",
"*",
"algorithms",
",",
"kexResult",
"*",
"kexResult",
")",
"error",
"{",
"if",
"t",
".",
"sessionID",
"==",
"nil",
"{",
"t",
".",
"sessionID",
"=",
"kexResult",
".",
"H",
"\n",
... | // prepareKeyChange sets up key material for a keychange. The key changes in
// both directions are triggered by reading and writing a msgNewKey packet
// respectively. | [
"prepareKeyChange",
"sets",
"up",
"key",
"material",
"for",
"a",
"keychange",
".",
"The",
"key",
"changes",
"in",
"both",
"directions",
"are",
"triggered",
"by",
"reading",
"and",
"writing",
"a",
"msgNewKey",
"packet",
"respectively",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L83-L103 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | readPacket | func (t *transport) readPacket() ([]byte, error) {
return t.reader.readPacket(t.bufReader)
} | go | func (t *transport) readPacket() ([]byte, error) {
return t.reader.readPacket(t.bufReader)
} | [
"func",
"(",
"t",
"*",
"transport",
")",
"readPacket",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"t",
".",
"reader",
".",
"readPacket",
"(",
"t",
".",
"bufReader",
")",
"\n",
"}"
] | // Read and decrypt next packet. | [
"Read",
"and",
"decrypt",
"next",
"packet",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L106-L108 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | generateKeys | func generateKeys(d direction, algs directionAlgorithms, kex *kexResult) (iv, key, macKey []byte) {
cipherMode := cipherModes[algs.Cipher]
macMode := macModes[algs.MAC]
iv = make([]byte, cipherMode.ivSize)
key = make([]byte, cipherMode.keySize)
macKey = make([]byte, macMode.keySize)
generateKeyMaterial(iv, d.iv... | go | func generateKeys(d direction, algs directionAlgorithms, kex *kexResult) (iv, key, macKey []byte) {
cipherMode := cipherModes[algs.Cipher]
macMode := macModes[algs.MAC]
iv = make([]byte, cipherMode.ivSize)
key = make([]byte, cipherMode.keySize)
macKey = make([]byte, macMode.keySize)
generateKeyMaterial(iv, d.iv... | [
"func",
"generateKeys",
"(",
"d",
"direction",
",",
"algs",
"directionAlgorithms",
",",
"kex",
"*",
"kexResult",
")",
"(",
"iv",
",",
"key",
",",
"macKey",
"[",
"]",
"byte",
")",
"{",
"cipherMode",
":=",
"cipherModes",
"[",
"algs",
".",
"Cipher",
"]",
... | // generateKeys generates key material for IV, MAC and encryption. | [
"generateKeys",
"generates",
"key",
"material",
"for",
"IV",
"MAC",
"and",
"encryption",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L198-L210 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | generateKeyMaterial | func generateKeyMaterial(out, tag []byte, r *kexResult) {
var digestsSoFar []byte
h := r.Hash.New()
for len(out) > 0 {
h.Reset()
h.Write(r.K)
h.Write(r.H)
if len(digestsSoFar) == 0 {
h.Write(tag)
h.Write(r.SessionID)
} else {
h.Write(digestsSoFar)
}
digest := h.Sum(nil)
n := copy(out, dig... | go | func generateKeyMaterial(out, tag []byte, r *kexResult) {
var digestsSoFar []byte
h := r.Hash.New()
for len(out) > 0 {
h.Reset()
h.Write(r.K)
h.Write(r.H)
if len(digestsSoFar) == 0 {
h.Write(tag)
h.Write(r.SessionID)
} else {
h.Write(digestsSoFar)
}
digest := h.Sum(nil)
n := copy(out, dig... | [
"func",
"generateKeyMaterial",
"(",
"out",
",",
"tag",
"[",
"]",
"byte",
",",
"r",
"*",
"kexResult",
")",
"{",
"var",
"digestsSoFar",
"[",
"]",
"byte",
"\n\n",
"h",
":=",
"r",
".",
"Hash",
".",
"New",
"(",
")",
"\n",
"for",
"len",
"(",
"out",
")"... | // generateKeyMaterial fills out with key material generated from tag, K, H
// and sessionId, as specified in RFC 4253, section 7.2. | [
"generateKeyMaterial",
"fills",
"out",
"with",
"key",
"material",
"generated",
"from",
"tag",
"K",
"H",
"and",
"sessionId",
"as",
"specified",
"in",
"RFC",
"4253",
"section",
"7",
".",
"2",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L242-L265 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | exchangeVersions | func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
// Contrary to the RFC, we do not ignore lines that don't
// start with "SSH-2.0-" to make the library usable with
// nonconforming servers.
for _, c := range versionLine {
// The spec disallows non US-ASCII chars, and
// spe... | go | func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
// Contrary to the RFC, we do not ignore lines that don't
// start with "SSH-2.0-" to make the library usable with
// nonconforming servers.
for _, c := range versionLine {
// The spec disallows non US-ASCII chars, and
// spe... | [
"func",
"exchangeVersions",
"(",
"rw",
"io",
".",
"ReadWriter",
",",
"versionLine",
"[",
"]",
"byte",
")",
"(",
"them",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"// Contrary to the RFC, we do not ignore lines that don't",
"// start with \"SSH-2.0-\" to make th... | // Sends and receives a version line. The versionLine string should
// be US ASCII, start with "SSH-2.0-", and should not include a
// newline. exchangeVersions returns the other side's version line. | [
"Sends",
"and",
"receives",
"a",
"version",
"line",
".",
"The",
"versionLine",
"string",
"should",
"be",
"US",
"ASCII",
"start",
"with",
"SSH",
"-",
"2",
".",
"0",
"-",
"and",
"should",
"not",
"include",
"a",
"newline",
".",
"exchangeVersions",
"returns",
... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L272-L289 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go | readVersion | func readVersion(r io.Reader) ([]byte, error) {
versionString := make([]byte, 0, 64)
var ok bool
var buf [1]byte
for len(versionString) < maxVersionStringBytes {
_, err := io.ReadFull(r, buf[:])
if err != nil {
return nil, err
}
// The RFC says that the version should be terminated with \r\n
// but se... | go | func readVersion(r io.Reader) ([]byte, error) {
versionString := make([]byte, 0, 64)
var ok bool
var buf [1]byte
for len(versionString) < maxVersionStringBytes {
_, err := io.ReadFull(r, buf[:])
if err != nil {
return nil, err
}
// The RFC says that the version should be terminated with \r\n
// but se... | [
"func",
"readVersion",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"versionString",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"64",
")",
"\n",
"var",
"ok",
"bool",
"\n",
"var",
"buf",
"[",
"1",
... | // Read version string as specified by RFC 4253, section 4.2. | [
"Read",
"version",
"string",
"as",
"specified",
"by",
"RFC",
"4253",
"section",
"4",
".",
"2",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/transport.go#L297-L332 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/google/appengine.go | AppEngineTokenSource | func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
if appengineTokenFunc == nil {
panic("google: AppEngineTokenSource can only be used on App Engine.")
}
scopes := append([]string{}, scope...)
sort.Strings(scopes)
return &appEngineTokenSource{
ctx: ctx,
scopes: scopes,
... | go | func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
if appengineTokenFunc == nil {
panic("google: AppEngineTokenSource can only be used on App Engine.")
}
scopes := append([]string{}, scope...)
sort.Strings(scopes)
return &appEngineTokenSource{
ctx: ctx,
scopes: scopes,
... | [
"func",
"AppEngineTokenSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"scope",
"...",
"string",
")",
"oauth2",
".",
"TokenSource",
"{",
"if",
"appengineTokenFunc",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"scopes",
":=",
"a... | // AppEngineTokenSource returns a token source that fetches tokens
// issued to the current App Engine application's service account.
// If you are implementing a 3-legged OAuth 2.0 flow on App Engine
// that involves user accounts, see oauth2.Config instead.
//
// The provided context must have come from appengine.New... | [
"AppEngineTokenSource",
"returns",
"a",
"token",
"source",
"that",
"fetches",
"tokens",
"issued",
"to",
"the",
"current",
"App",
"Engine",
"application",
"s",
"service",
"account",
".",
"If",
"you",
"are",
"implementing",
"a",
"3",
"-",
"legged",
"OAuth",
"2",... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/google/appengine.go#L26-L37 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go | GetSysctl | func GetSysctl(sysctl string) (int, error) {
data, err := ioutil.ReadFile(path.Join(sysctlBase, sysctl))
if err != nil {
return -1, err
}
val, err := strconv.Atoi(strings.Trim(string(data), " \n"))
if err != nil {
return -1, err
}
return val, nil
} | go | func GetSysctl(sysctl string) (int, error) {
data, err := ioutil.ReadFile(path.Join(sysctlBase, sysctl))
if err != nil {
return -1, err
}
val, err := strconv.Atoi(strings.Trim(string(data), " \n"))
if err != nil {
return -1, err
}
return val, nil
} | [
"func",
"GetSysctl",
"(",
"sysctl",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
".",
"Join",
"(",
"sysctlBase",
",",
"sysctl",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // GetSysctl returns the value for the specified sysctl setting | [
"GetSysctl",
"returns",
"the",
"value",
"for",
"the",
"specified",
"sysctl",
"setting"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go#L41-L51 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go | SetSysctl | func SetSysctl(sysctl string, newVal int) error {
return ioutil.WriteFile(path.Join(sysctlBase, sysctl), []byte(strconv.Itoa(newVal)), 0640)
} | go | func SetSysctl(sysctl string, newVal int) error {
return ioutil.WriteFile(path.Join(sysctlBase, sysctl), []byte(strconv.Itoa(newVal)), 0640)
} | [
"func",
"SetSysctl",
"(",
"sysctl",
"string",
",",
"newVal",
"int",
")",
"error",
"{",
"return",
"ioutil",
".",
"WriteFile",
"(",
"path",
".",
"Join",
"(",
"sysctlBase",
",",
"sysctl",
")",
",",
"[",
"]",
"byte",
"(",
"strconv",
".",
"Itoa",
"(",
"ne... | // SetSysctl modifies the specified sysctl flag to the new value | [
"SetSysctl",
"modifies",
"the",
"specified",
"sysctl",
"flag",
"to",
"the",
"new",
"value"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go#L54-L56 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go | MustParse | func MustParse(str string) Quantity {
q, err := ParseQuantity(str)
if err != nil {
panic(fmt.Errorf("cannot parse '%v': %v", str, err))
}
return *q
} | go | func MustParse(str string) Quantity {
q, err := ParseQuantity(str)
if err != nil {
panic(fmt.Errorf("cannot parse '%v': %v", str, err))
}
return *q
} | [
"func",
"MustParse",
"(",
"str",
"string",
")",
"Quantity",
"{",
"q",
",",
"err",
":=",
"ParseQuantity",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"str",
",",
"err",
")",
")",
... | // MustParse turns the given string into a quantity or panics; for tests
// or others cases where you know the string is valid. | [
"MustParse",
"turns",
"the",
"given",
"string",
"into",
"a",
"quantity",
"or",
"panics",
";",
"for",
"tests",
"or",
"others",
"cases",
"where",
"you",
"know",
"the",
"string",
"is",
"valid",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go#L112-L118 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go | String | func (q *Quantity) String() string {
number, suffix := q.Canonicalize()
return number + string(suffix)
} | go | func (q *Quantity) String() string {
number, suffix := q.Canonicalize()
return number + string(suffix)
} | [
"func",
"(",
"q",
"*",
"Quantity",
")",
"String",
"(",
")",
"string",
"{",
"number",
",",
"suffix",
":=",
"q",
".",
"Canonicalize",
"(",
")",
"\n",
"return",
"number",
"+",
"string",
"(",
"suffix",
")",
"\n",
"}"
] | // String formats the Quantity as a string. | [
"String",
"formats",
"the",
"Quantity",
"as",
"a",
"string",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go#L304-L307 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go | Set | func (q *Quantity) Set(value int64) {
if q.Amount == nil {
q.Amount = &inf.Dec{}
}
q.Amount.SetUnscaled(value)
q.Amount.SetScale(0)
} | go | func (q *Quantity) Set(value int64) {
if q.Amount == nil {
q.Amount = &inf.Dec{}
}
q.Amount.SetUnscaled(value)
q.Amount.SetScale(0)
} | [
"func",
"(",
"q",
"*",
"Quantity",
")",
"Set",
"(",
"value",
"int64",
")",
"{",
"if",
"q",
".",
"Amount",
"==",
"nil",
"{",
"q",
".",
"Amount",
"=",
"&",
"inf",
".",
"Dec",
"{",
"}",
"\n",
"}",
"\n",
"q",
".",
"Amount",
".",
"SetUnscaled",
"(... | // Set sets q's value to be value. | [
"Set",
"sets",
"q",
"s",
"value",
"to",
"be",
"value",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/resource/quantity.go#L411-L417 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | parsePubKey | func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
switch algo {
case KeyAlgoRSA:
return parseRSA(in)
case KeyAlgoDSA:
return parseDSA(in)
case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
return parseECDSA(in)
case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,... | go | func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
switch algo {
case KeyAlgoRSA:
return parseRSA(in)
case KeyAlgoDSA:
return parseDSA(in)
case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
return parseECDSA(in)
case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,... | [
"func",
"parsePubKey",
"(",
"in",
"[",
"]",
"byte",
",",
"algo",
"string",
")",
"(",
"pubKey",
"PublicKey",
",",
"rest",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"switch",
"algo",
"{",
"case",
"KeyAlgoRSA",
":",
"return",
"parseRSA",
"(",
"in... | // parsePubKey parses a public key of the given algorithm.
// Use ParsePublicKey for keys with prepended algorithm. | [
"parsePubKey",
"parses",
"a",
"public",
"key",
"of",
"the",
"given",
"algorithm",
".",
"Use",
"ParsePublicKey",
"for",
"keys",
"with",
"prepended",
"algorithm",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L36-L52 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | MarshalAuthorizedKey | func MarshalAuthorizedKey(key PublicKey) []byte {
b := &bytes.Buffer{}
b.WriteString(key.Type())
b.WriteByte(' ')
e := base64.NewEncoder(base64.StdEncoding, b)
e.Write(key.Marshal())
e.Close()
b.WriteByte('\n')
return b.Bytes()
} | go | func MarshalAuthorizedKey(key PublicKey) []byte {
b := &bytes.Buffer{}
b.WriteString(key.Type())
b.WriteByte(' ')
e := base64.NewEncoder(base64.StdEncoding, b)
e.Write(key.Marshal())
e.Close()
b.WriteByte('\n')
return b.Bytes()
} | [
"func",
"MarshalAuthorizedKey",
"(",
"key",
"PublicKey",
")",
"[",
"]",
"byte",
"{",
"b",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"b",
".",
"WriteString",
"(",
"key",
".",
"Type",
"(",
")",
")",
"\n",
"b",
".",
"WriteByte",
"(",
"' '",
... | // MarshalAuthorizedKey serializes key for inclusion in an OpenSSH
// authorized_keys file. The return value ends with newline. | [
"MarshalAuthorizedKey",
"serializes",
"key",
"for",
"inclusion",
"in",
"an",
"OpenSSH",
"authorized_keys",
"file",
".",
"The",
"return",
"value",
"ends",
"with",
"newline",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L180-L189 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | parseRSA | func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
var w struct {
E *big.Int
N *big.Int
Rest []byte `ssh:"rest"`
}
if err := Unmarshal(in, &w); err != nil {
return nil, nil, err
}
if w.E.BitLen() > 24 {
return nil, nil, errors.New("ssh: exponent too large")
}
e := w.E.Int64()
if... | go | func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
var w struct {
E *big.Int
N *big.Int
Rest []byte `ssh:"rest"`
}
if err := Unmarshal(in, &w); err != nil {
return nil, nil, err
}
if w.E.BitLen() > 24 {
return nil, nil, errors.New("ssh: exponent too large")
}
e := w.E.Int64()
if... | [
"func",
"parseRSA",
"(",
"in",
"[",
"]",
"byte",
")",
"(",
"out",
"PublicKey",
",",
"rest",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"var",
"w",
"struct",
"{",
"E",
"*",
"big",
".",
"Int",
"\n",
"N",
"*",
"big",
".",
"Int",
"\n",
"Res... | // parseRSA parses an RSA key according to RFC 4253, section 6.6. | [
"parseRSA",
"parses",
"an",
"RSA",
"key",
"according",
"to",
"RFC",
"4253",
"section",
"6",
".",
"6",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L222-L244 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | parseDSA | func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
var w struct {
P, Q, G, Y *big.Int
Rest []byte `ssh:"rest"`
}
if err := Unmarshal(in, &w); err != nil {
return nil, nil, err
}
key := &dsaPublicKey{
Parameters: dsa.Parameters{
P: w.P,
Q: w.Q,
G: w.G,
},
Y: w.Y,
}
retu... | go | func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
var w struct {
P, Q, G, Y *big.Int
Rest []byte `ssh:"rest"`
}
if err := Unmarshal(in, &w); err != nil {
return nil, nil, err
}
key := &dsaPublicKey{
Parameters: dsa.Parameters{
P: w.P,
Q: w.Q,
G: w.G,
},
Y: w.Y,
}
retu... | [
"func",
"parseDSA",
"(",
"in",
"[",
"]",
"byte",
")",
"(",
"out",
"PublicKey",
",",
"rest",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"var",
"w",
"struct",
"{",
"P",
",",
"Q",
",",
"G",
",",
"Y",
"*",
"big",
".",
"Int",
"\n",
"Rest",
... | // parseDSA parses an DSA key according to RFC 4253, section 6.6. | [
"parseDSA",
"parses",
"an",
"DSA",
"key",
"according",
"to",
"RFC",
"4253",
"section",
"6",
".",
"6",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L299-L317 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | ecHash | func ecHash(curve elliptic.Curve) crypto.Hash {
bitSize := curve.Params().BitSize
switch {
case bitSize <= 256:
return crypto.SHA256
case bitSize <= 384:
return crypto.SHA384
}
return crypto.SHA512
} | go | func ecHash(curve elliptic.Curve) crypto.Hash {
bitSize := curve.Params().BitSize
switch {
case bitSize <= 256:
return crypto.SHA256
case bitSize <= 384:
return crypto.SHA384
}
return crypto.SHA512
} | [
"func",
"ecHash",
"(",
"curve",
"elliptic",
".",
"Curve",
")",
"crypto",
".",
"Hash",
"{",
"bitSize",
":=",
"curve",
".",
"Params",
"(",
")",
".",
"BitSize",
"\n",
"switch",
"{",
"case",
"bitSize",
"<=",
"256",
":",
"return",
"crypto",
".",
"SHA256",
... | // ecHash returns the hash to match the given elliptic curve, see RFC
// 5656, section 6.2.1 | [
"ecHash",
"returns",
"the",
"hash",
"to",
"match",
"the",
"given",
"elliptic",
"curve",
"see",
"RFC",
"5656",
"section",
"6",
".",
"2",
".",
"1"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L412-L421 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | NewSignerFromKey | func NewSignerFromKey(k interface{}) (Signer, error) {
var sshKey Signer
switch t := k.(type) {
case *rsa.PrivateKey:
sshKey = &rsaPrivateKey{t}
case *dsa.PrivateKey:
sshKey = &dsaPrivateKey{t}
case *ecdsa.PrivateKey:
if !supportedEllipticCurve(t.Curve) {
return nil, errors.New("ssh: only P256, P384 and P... | go | func NewSignerFromKey(k interface{}) (Signer, error) {
var sshKey Signer
switch t := k.(type) {
case *rsa.PrivateKey:
sshKey = &rsaPrivateKey{t}
case *dsa.PrivateKey:
sshKey = &dsaPrivateKey{t}
case *ecdsa.PrivateKey:
if !supportedEllipticCurve(t.Curve) {
return nil, errors.New("ssh: only P256, P384 and P... | [
"func",
"NewSignerFromKey",
"(",
"k",
"interface",
"{",
"}",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"var",
"sshKey",
"Signer",
"\n",
"switch",
"t",
":=",
"k",
".",
"(",
"type",
")",
"{",
"case",
"*",
"rsa",
".",
"PrivateKey",
":",
"sshKey",
"=... | // NewSignerFromKey takes a pointer to rsa, dsa or ecdsa PrivateKey
// returns a corresponding Signer instance. EC keys should use P256,
// P384 or P521. | [
"NewSignerFromKey",
"takes",
"a",
"pointer",
"to",
"rsa",
"dsa",
"or",
"ecdsa",
"PrivateKey",
"returns",
"a",
"corresponding",
"Signer",
"instance",
".",
"EC",
"keys",
"should",
"use",
"P256",
"P384",
"or",
"P521",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L528-L545 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | NewPublicKey | func NewPublicKey(k interface{}) (PublicKey, error) {
var sshKey PublicKey
switch t := k.(type) {
case *rsa.PublicKey:
sshKey = (*rsaPublicKey)(t)
case *ecdsa.PublicKey:
if !supportedEllipticCurve(t.Curve) {
return nil, errors.New("ssh: only P256, P384 and P521 EC keys are supported.")
}
sshKey = (*ecdsa... | go | func NewPublicKey(k interface{}) (PublicKey, error) {
var sshKey PublicKey
switch t := k.(type) {
case *rsa.PublicKey:
sshKey = (*rsaPublicKey)(t)
case *ecdsa.PublicKey:
if !supportedEllipticCurve(t.Curve) {
return nil, errors.New("ssh: only P256, P384 and P521 EC keys are supported.")
}
sshKey = (*ecdsa... | [
"func",
"NewPublicKey",
"(",
"k",
"interface",
"{",
"}",
")",
"(",
"PublicKey",
",",
"error",
")",
"{",
"var",
"sshKey",
"PublicKey",
"\n",
"switch",
"t",
":=",
"k",
".",
"(",
"type",
")",
"{",
"case",
"*",
"rsa",
".",
"PublicKey",
":",
"sshKey",
"... | // NewPublicKey takes a pointer to rsa, dsa or ecdsa PublicKey
// and returns a corresponding ssh PublicKey instance. EC keys should use P256, P384 or P521. | [
"NewPublicKey",
"takes",
"a",
"pointer",
"to",
"rsa",
"dsa",
"or",
"ecdsa",
"PublicKey",
"and",
"returns",
"a",
"corresponding",
"ssh",
"PublicKey",
"instance",
".",
"EC",
"keys",
"should",
"use",
"P256",
"P384",
"or",
"P521",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L549-L565 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | ParsePrivateKey | func ParsePrivateKey(pemBytes []byte) (Signer, error) {
key, err := ParseRawPrivateKey(pemBytes)
if err != nil {
return nil, err
}
return NewSignerFromKey(key)
} | go | func ParsePrivateKey(pemBytes []byte) (Signer, error) {
key, err := ParseRawPrivateKey(pemBytes)
if err != nil {
return nil, err
}
return NewSignerFromKey(key)
} | [
"func",
"ParsePrivateKey",
"(",
"pemBytes",
"[",
"]",
"byte",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"key",
",",
"err",
":=",
"ParseRawPrivateKey",
"(",
"pemBytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}"... | // ParsePrivateKey returns a Signer from a PEM encoded private key. It supports
// the same keys as ParseRawPrivateKey. | [
"ParsePrivateKey",
"returns",
"a",
"Signer",
"from",
"a",
"PEM",
"encoded",
"private",
"key",
".",
"It",
"supports",
"the",
"same",
"keys",
"as",
"ParseRawPrivateKey",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L569-L576 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go | ParseDSAPrivateKey | func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
var k struct {
Version int
P *big.Int
Q *big.Int
G *big.Int
Priv *big.Int
Pub *big.Int
}
rest, err := asn1.Unmarshal(der, &k)
if err != nil {
return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
... | go | func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
var k struct {
Version int
P *big.Int
Q *big.Int
G *big.Int
Priv *big.Int
Pub *big.Int
}
rest, err := asn1.Unmarshal(der, &k)
if err != nil {
return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
... | [
"func",
"ParseDSAPrivateKey",
"(",
"der",
"[",
"]",
"byte",
")",
"(",
"*",
"dsa",
".",
"PrivateKey",
",",
"error",
")",
"{",
"var",
"k",
"struct",
"{",
"Version",
"int",
"\n",
"P",
"*",
"big",
".",
"Int",
"\n",
"Q",
"*",
"big",
".",
"Int",
"\n",
... | // ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as
// specified by the OpenSSL DSA man page. | [
"ParseDSAPrivateKey",
"returns",
"a",
"DSA",
"private",
"key",
"from",
"its",
"ASN",
".",
"1",
"DER",
"encoding",
"as",
"specified",
"by",
"the",
"OpenSSL",
"DSA",
"man",
"page",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/keys.go#L600-L628 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go | NewProxyServer | func NewProxyServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *client.Config) (*ProxyServer, error) {
host := cfg.Host
if !strings.HasSuffix(host, "/") {
host = host + "/"
}
target, err := url.Parse(host)
if err != nil {
return nil, err
}
proxy := newProxy(target)... | go | func NewProxyServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *client.Config) (*ProxyServer, error) {
host := cfg.Host
if !strings.HasSuffix(host, "/") {
host = host + "/"
}
target, err := url.Parse(host)
if err != nil {
return nil, err
}
proxy := newProxy(target)... | [
"func",
"NewProxyServer",
"(",
"filebase",
"string",
",",
"apiProxyPrefix",
"string",
",",
"staticPrefix",
"string",
",",
"filter",
"*",
"FilterServer",
",",
"cfg",
"*",
"client",
".",
"Config",
")",
"(",
"*",
"ProxyServer",
",",
"error",
")",
"{",
"host",
... | // NewProxyServer creates and installs a new ProxyServer.
// It automatically registers the created ProxyServer to http.DefaultServeMux.
// 'filter', if non-nil, protects requests to the api only. | [
"NewProxyServer",
"creates",
"and",
"installs",
"a",
"new",
"ProxyServer",
".",
"It",
"automatically",
"registers",
"the",
"created",
"ProxyServer",
"to",
"http",
".",
"DefaultServeMux",
".",
"filter",
"if",
"non",
"-",
"nil",
"protects",
"requests",
"to",
"the"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go#L149-L179 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go | ListenUnix | func (s *ProxyServer) ListenUnix(path string) (net.Listener, error) {
// Remove any socket, stale or not, but fall through for other files
fi, err := os.Stat(path)
if err == nil && (fi.Mode()&os.ModeSocket) != 0 {
os.Remove(path)
}
// Default to only user accessible socket, caller can open up later if desired
o... | go | func (s *ProxyServer) ListenUnix(path string) (net.Listener, error) {
// Remove any socket, stale or not, but fall through for other files
fi, err := os.Stat(path)
if err == nil && (fi.Mode()&os.ModeSocket) != 0 {
os.Remove(path)
}
// Default to only user accessible socket, caller can open up later if desired
o... | [
"func",
"(",
"s",
"*",
"ProxyServer",
")",
"ListenUnix",
"(",
"path",
"string",
")",
"(",
"net",
".",
"Listener",
",",
"error",
")",
"{",
"// Remove any socket, stale or not, but fall through for other files",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"p... | // ListenUnix does net.Listen for a unix socket | [
"ListenUnix",
"does",
"net",
".",
"Listen",
"for",
"a",
"unix",
"socket"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go#L187-L198 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go | ServeOnListener | func (s *ProxyServer) ServeOnListener(l net.Listener) error {
server := http.Server{
Handler: s.handler,
}
return server.Serve(l)
} | go | func (s *ProxyServer) ServeOnListener(l net.Listener) error {
server := http.Server{
Handler: s.handler,
}
return server.Serve(l)
} | [
"func",
"(",
"s",
"*",
"ProxyServer",
")",
"ServeOnListener",
"(",
"l",
"net",
".",
"Listener",
")",
"error",
"{",
"server",
":=",
"http",
".",
"Server",
"{",
"Handler",
":",
"s",
".",
"handler",
",",
"}",
"\n",
"return",
"server",
".",
"Serve",
"(",... | // Serve starts the server using given listener, loops forever. | [
"Serve",
"starts",
"the",
"server",
"using",
"given",
"listener",
"loops",
"forever",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/proxy_server.go#L201-L206 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/template.go | ExecuteTemplate | func ExecuteTemplate(w io.Writer, templateText string, data interface{}) error {
t := template.New("top")
t.Funcs(template.FuncMap{
"trim": strings.TrimSpace,
"wrap": wrap,
})
template.Must(t.Parse(templateText))
return t.Execute(w, data)
} | go | func ExecuteTemplate(w io.Writer, templateText string, data interface{}) error {
t := template.New("top")
t.Funcs(template.FuncMap{
"trim": strings.TrimSpace,
"wrap": wrap,
})
template.Must(t.Parse(templateText))
return t.Execute(w, data)
} | [
"func",
"ExecuteTemplate",
"(",
"w",
"io",
".",
"Writer",
",",
"templateText",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"error",
"{",
"t",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"t",
".",
"Funcs",
"(",
"template",
".",
... | // ExecuteTemplate executes templateText with data and output written to w. | [
"ExecuteTemplate",
"executes",
"templateText",
"with",
"data",
"and",
"output",
"written",
"to",
"w",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/template.go#L34-L42 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go | NewScheme | func NewScheme() *Scheme {
s := &Scheme{
gvkToType: map[unversioned.GroupVersionKind]reflect.Type{},
typeToGVK: map[reflect.Type][]unversioned.GroupVersionKind{},
converter: NewConverter(),
cloner: NewCloner(),
// TODO remove this hard coded list. As step one, hardcode it here so this pull doesn't become... | go | func NewScheme() *Scheme {
s := &Scheme{
gvkToType: map[unversioned.GroupVersionKind]reflect.Type{},
typeToGVK: map[reflect.Type][]unversioned.GroupVersionKind{},
converter: NewConverter(),
cloner: NewCloner(),
// TODO remove this hard coded list. As step one, hardcode it here so this pull doesn't become... | [
"func",
"NewScheme",
"(",
")",
"*",
"Scheme",
"{",
"s",
":=",
"&",
"Scheme",
"{",
"gvkToType",
":",
"map",
"[",
"unversioned",
".",
"GroupVersionKind",
"]",
"reflect",
".",
"Type",
"{",
"}",
",",
"typeToGVK",
":",
"map",
"[",
"reflect",
".",
"Type",
... | // NewScheme manufactures a new scheme. | [
"NewScheme",
"manufactures",
"a",
"new",
"scheme",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go#L61-L78 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go | AddGeneratedConversionFuncs | func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) error {
for _, f := range conversionFuncs {
if err := s.converter.RegisterGeneratedConversionFunc(f); err != nil {
return err
}
}
return nil
} | go | func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) error {
for _, f := range conversionFuncs {
if err := s.converter.RegisterGeneratedConversionFunc(f); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"AddGeneratedConversionFuncs",
"(",
"conversionFuncs",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"conversionFuncs",
"{",
"if",
"err",
":=",
"s",
".",
"converter",
".",
"Reg... | // Similar to AddConversionFuncs, but registers conversion functions that were
// automatically generated. | [
"Similar",
"to",
"AddConversionFuncs",
"but",
"registers",
"conversion",
"functions",
"that",
"were",
"automatically",
"generated",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go#L215-L222 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go | AddDeepCopyFuncs | func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterDeepCopyFunc(f); err != nil {
return err
}
}
return nil
} | go | func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterDeepCopyFunc(f); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"AddDeepCopyFuncs",
"(",
"deepCopyFuncs",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"deepCopyFuncs",
"{",
"if",
"err",
":=",
"s",
".",
"cloner",
".",
"RegisterDeepCopyFunc"... | // AddDeepCopyFuncs adds functions to the list of deep copy functions.
// Note that to copy sub-objects, you can use the conversion.Cloner object that
// will be passed to your deep-copy function. | [
"AddDeepCopyFuncs",
"adds",
"functions",
"to",
"the",
"list",
"of",
"deep",
"copy",
"functions",
".",
"Note",
"that",
"to",
"copy",
"sub",
"-",
"objects",
"you",
"can",
"use",
"the",
"conversion",
".",
"Cloner",
"object",
"that",
"will",
"be",
"passed",
"t... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go#L227-L234 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go | AddGeneratedDeepCopyFuncs | func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterGeneratedDeepCopyFunc(f); err != nil {
return err
}
}
return nil
} | go | func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterGeneratedDeepCopyFunc(f); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"AddGeneratedDeepCopyFuncs",
"(",
"deepCopyFuncs",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"deepCopyFuncs",
"{",
"if",
"err",
":=",
"s",
".",
"cloner",
".",
"RegisterGene... | // Similar to AddDeepCopyFuncs, but registers deep copy functions that were
// automatically generated. | [
"Similar",
"to",
"AddDeepCopyFuncs",
"but",
"registers",
"deep",
"copy",
"functions",
"that",
"were",
"automatically",
"generated",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go#L238-L245 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go | AddStructFieldConversion | func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName string, destFieldType interface{}, destFieldName string) error {
return s.converter.SetStructFieldCopy(srcFieldType, srcFieldName, destFieldType, destFieldName)
} | go | func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName string, destFieldType interface{}, destFieldName string) error {
return s.converter.SetStructFieldCopy(srcFieldType, srcFieldName, destFieldType, destFieldName)
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"AddStructFieldConversion",
"(",
"srcFieldType",
"interface",
"{",
"}",
",",
"srcFieldName",
"string",
",",
"destFieldType",
"interface",
"{",
"}",
",",
"destFieldName",
"string",
")",
"error",
"{",
"return",
"s",
".",
"... | // AddStructFieldConversion allows you to specify a mechanical copy for a moved
// or renamed struct field without writing an entire conversion function. See
// the comment in Converter.SetStructFieldCopy for parameter details.
// Call as many times as needed, even on the same fields. | [
"AddStructFieldConversion",
"allows",
"you",
"to",
"specify",
"a",
"mechanical",
"copy",
"for",
"a",
"moved",
"or",
"renamed",
"struct",
"field",
"without",
"writing",
"an",
"entire",
"conversion",
"function",
".",
"See",
"the",
"comment",
"in",
"Converter",
"."... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/scheme.go#L251-L253 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/proxy/transport.go | rewriteResponse | func (t *Transport) rewriteResponse(req *http.Request, resp *http.Response) (*http.Response, error) {
origBody := resp.Body
defer origBody.Close()
newContent := &bytes.Buffer{}
var reader io.Reader = origBody
var writer io.Writer = newContent
encoding := resp.Header.Get("Content-Encoding")
switch encoding {
ca... | go | func (t *Transport) rewriteResponse(req *http.Request, resp *http.Response) (*http.Response, error) {
origBody := resp.Body
defer origBody.Close()
newContent := &bytes.Buffer{}
var reader io.Reader = origBody
var writer io.Writer = newContent
encoding := resp.Header.Get("Content-Encoding")
switch encoding {
ca... | [
"func",
"(",
"t",
"*",
"Transport",
")",
"rewriteResponse",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"resp",
"*",
"http",
".",
"Response",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"origBody",
":=",
"resp",
".",
"Body",
"... | // rewriteResponse modifies an HTML response by updating absolute links referring
// to the original host to instead refer to the proxy transport. | [
"rewriteResponse",
"modifies",
"an",
"HTML",
"response",
"by",
"updating",
"absolute",
"links",
"referring",
"to",
"the",
"original",
"host",
"to",
"instead",
"refer",
"to",
"the",
"proxy",
"transport",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/proxy/transport.go#L198-L241 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | String | func (k *Key) String() string {
s := string(k.Format) + " " + base64.StdEncoding.EncodeToString(k.Blob)
if k.Comment != "" {
s += " " + k.Comment
}
return s
} | go | func (k *Key) String() string {
s := string(k.Format) + " " + base64.StdEncoding.EncodeToString(k.Blob)
if k.Comment != "" {
s += " " + k.Comment
}
return s
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"String",
"(",
")",
"string",
"{",
"s",
":=",
"string",
"(",
"k",
".",
"Format",
")",
"+",
"\"",
"\"",
"+",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"k",
".",
"Blob",
")",
"\n\n",
"if",
"k",
"... | // String returns the storage form of an agent key with the format, base64
// encoded serialized key, and the comment if it is not empty. | [
"String",
"returns",
"the",
"storage",
"form",
"of",
"an",
"agent",
"key",
"with",
"the",
"format",
"base64",
"encoded",
"serialized",
"key",
"and",
"the",
"comment",
"if",
"it",
"is",
"not",
"empty",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L148-L156 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | Verify | func (k *Key) Verify(data []byte, sig *ssh.Signature) error {
return errors.New("agent: agent key does not know how to verify")
} | go | func (k *Key) Verify(data []byte, sig *ssh.Signature) error {
return errors.New("agent: agent key does not know how to verify")
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Verify",
"(",
"data",
"[",
"]",
"byte",
",",
"sig",
"*",
"ssh",
".",
"Signature",
")",
"error",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // Verify satisfies the ssh.PublicKey interface, but is not
// implemented for agent keys. | [
"Verify",
"satisfies",
"the",
"ssh",
".",
"PublicKey",
"interface",
"but",
"is",
"not",
"implemented",
"for",
"agent",
"keys",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L170-L172 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | call | func (c *client) call(req []byte) (reply interface{}, err error) {
c.mu.Lock()
defer c.mu.Unlock()
msg := make([]byte, 4+len(req))
binary.BigEndian.PutUint32(msg, uint32(len(req)))
copy(msg[4:], req)
if _, err = c.conn.Write(msg); err != nil {
return nil, clientErr(err)
}
var respSizeBuf [4]byte
if _, err ... | go | func (c *client) call(req []byte) (reply interface{}, err error) {
c.mu.Lock()
defer c.mu.Unlock()
msg := make([]byte, 4+len(req))
binary.BigEndian.PutUint32(msg, uint32(len(req)))
copy(msg[4:], req)
if _, err = c.conn.Write(msg); err != nil {
return nil, clientErr(err)
}
var respSizeBuf [4]byte
if _, err ... | [
"func",
"(",
"c",
"*",
"client",
")",
"call",
"(",
"req",
"[",
"]",
"byte",
")",
"(",
"reply",
"interface",
"{",
"}",
",",
"err",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
"... | // call sends an RPC to the agent. On success, the reply is
// unmarshaled into reply and replyType is set to the first byte of
// the reply, which contains the type of the message. | [
"call",
"sends",
"an",
"RPC",
"to",
"the",
"agent",
".",
"On",
"success",
"the",
"reply",
"is",
"unmarshaled",
"into",
"reply",
"and",
"replyType",
"is",
"set",
"to",
"the",
"first",
"byte",
"of",
"the",
"reply",
"which",
"contains",
"the",
"type",
"of",... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L219-L248 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | unmarshal | func unmarshal(packet []byte) (interface{}, error) {
if len(packet) < 1 {
return nil, errors.New("agent: empty packet")
}
var msg interface{}
switch packet[0] {
case agentFailure:
return new(failureAgentMsg), nil
case agentSuccess:
return new(successAgentMsg), nil
case agentIdentitiesAnswer:
msg = new(id... | go | func unmarshal(packet []byte) (interface{}, error) {
if len(packet) < 1 {
return nil, errors.New("agent: empty packet")
}
var msg interface{}
switch packet[0] {
case agentFailure:
return new(failureAgentMsg), nil
case agentSuccess:
return new(successAgentMsg), nil
case agentIdentitiesAnswer:
msg = new(id... | [
"func",
"unmarshal",
"(",
"packet",
"[",
"]",
"byte",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"len",
"(",
"packet",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
... | // unmarshal parses an agent message in packet, returning the parsed
// form and the message type of packet. | [
"unmarshal",
"parses",
"an",
"agent",
"message",
"in",
"packet",
"returning",
"the",
"parsed",
"form",
"and",
"the",
"message",
"type",
"of",
"packet",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L347-L368 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | insertKey | func (c *client) insertKey(s interface{}, comment string) error {
var req []byte
switch k := s.(type) {
case *rsa.PrivateKey:
if len(k.Primes) != 2 {
return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
}
k.Precompute()
req = ssh.Marshal(rsaKeyMsg{
Type: ssh.KeyAlgoRSA,
... | go | func (c *client) insertKey(s interface{}, comment string) error {
var req []byte
switch k := s.(type) {
case *rsa.PrivateKey:
if len(k.Primes) != 2 {
return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
}
k.Precompute()
req = ssh.Marshal(rsaKeyMsg{
Type: ssh.KeyAlgoRSA,
... | [
"func",
"(",
"c",
"*",
"client",
")",
"insertKey",
"(",
"s",
"interface",
"{",
"}",
",",
"comment",
"string",
")",
"error",
"{",
"var",
"req",
"[",
"]",
"byte",
"\n",
"switch",
"k",
":=",
"s",
".",
"(",
"type",
")",
"{",
"case",
"*",
"rsa",
"."... | // Insert adds a private key to the agent. | [
"Insert",
"adds",
"a",
"private",
"key",
"to",
"the",
"agent",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L400-L448 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go | Signers | func (c *client) Signers() ([]ssh.Signer, error) {
keys, err := c.List()
if err != nil {
return nil, err
}
var result []ssh.Signer
for _, k := range keys {
result = append(result, &agentKeyringSigner{c, k})
}
return result, nil
} | go | func (c *client) Signers() ([]ssh.Signer, error) {
keys, err := c.List()
if err != nil {
return nil, err
}
var result []ssh.Signer
for _, k := range keys {
result = append(result, &agentKeyringSigner{c, k})
}
return result, nil
} | [
"func",
"(",
"c",
"*",
"client",
")",
"Signers",
"(",
")",
"(",
"[",
"]",
"ssh",
".",
"Signer",
",",
"error",
")",
"{",
"keys",
",",
"err",
":=",
"c",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // Signers provides a callback for client authentication. | [
"Signers",
"provides",
"a",
"callback",
"for",
"client",
"authentication",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/client.go#L538-L549 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go | yaml_parser_set_reader_error | func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool {
parser.error = yaml_READER_ERROR
parser.problem = problem
parser.problem_offset = offset
parser.problem_value = value
return false
} | go | func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool {
parser.error = yaml_READER_ERROR
parser.problem = problem
parser.problem_offset = offset
parser.problem_value = value
return false
} | [
"func",
"yaml_parser_set_reader_error",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"problem",
"string",
",",
"offset",
"int",
",",
"value",
"int",
")",
"bool",
"{",
"parser",
".",
"error",
"=",
"yaml_READER_ERROR",
"\n",
"parser",
".",
"problem",
"=",
"problem"... | // Set the reader error and return 0. | [
"Set",
"the",
"reader",
"error",
"and",
"return",
"0",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go#L8-L14 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go | yaml_parser_determine_encoding | func yaml_parser_determine_encoding(parser *yaml_parser_t) bool {
// Ensure that we had enough bytes in the raw buffer.
for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 {
if !yaml_parser_update_raw_buffer(parser) {
return false
}
}
// Determine the encoding.
buf := parser.raw_buffer
pos... | go | func yaml_parser_determine_encoding(parser *yaml_parser_t) bool {
// Ensure that we had enough bytes in the raw buffer.
for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 {
if !yaml_parser_update_raw_buffer(parser) {
return false
}
}
// Determine the encoding.
buf := parser.raw_buffer
pos... | [
"func",
"yaml_parser_determine_encoding",
"(",
"parser",
"*",
"yaml_parser_t",
")",
"bool",
"{",
"// Ensure that we had enough bytes in the raw buffer.",
"for",
"!",
"parser",
".",
"eof",
"&&",
"len",
"(",
"parser",
".",
"raw_buffer",
")",
"-",
"parser",
".",
"raw_b... | // Determine the input stream encoding by checking the BOM symbol. If no BOM is
// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. | [
"Determine",
"the",
"input",
"stream",
"encoding",
"by",
"checking",
"the",
"BOM",
"symbol",
".",
"If",
"no",
"BOM",
"is",
"found",
"the",
"UTF",
"-",
"8",
"encoding",
"is",
"assumed",
".",
"Return",
"1",
"on",
"success",
"0",
"on",
"failure",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go#L25-L53 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go | yaml_parser_update_raw_buffer | func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool {
size_read := 0
// Return if the raw buffer is full.
if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) {
return true
}
// Return on EOF.
if parser.eof {
return true
}
// Move the remaining bytes in the raw buf... | go | func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool {
size_read := 0
// Return if the raw buffer is full.
if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) {
return true
}
// Return on EOF.
if parser.eof {
return true
}
// Move the remaining bytes in the raw buf... | [
"func",
"yaml_parser_update_raw_buffer",
"(",
"parser",
"*",
"yaml_parser_t",
")",
"bool",
"{",
"size_read",
":=",
"0",
"\n\n",
"// Return if the raw buffer is full.",
"if",
"parser",
".",
"raw_buffer_pos",
"==",
"0",
"&&",
"len",
"(",
"parser",
".",
"raw_buffer",
... | // Update the raw buffer. | [
"Update",
"the",
"raw",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/readerc.go#L56-L85 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_parser_initialize | func yaml_parser_initialize(parser *yaml_parser_t) bool {
*parser = yaml_parser_t{
raw_buffer: make([]byte, 0, input_raw_buffer_size),
buffer: make([]byte, 0, input_buffer_size),
}
return true
} | go | func yaml_parser_initialize(parser *yaml_parser_t) bool {
*parser = yaml_parser_t{
raw_buffer: make([]byte, 0, input_raw_buffer_size),
buffer: make([]byte, 0, input_buffer_size),
}
return true
} | [
"func",
"yaml_parser_initialize",
"(",
"parser",
"*",
"yaml_parser_t",
")",
"bool",
"{",
"*",
"parser",
"=",
"yaml_parser_t",
"{",
"raw_buffer",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"input_raw_buffer_size",
")",
",",
"buffer",
":",
"make",
"(... | // Create a new parser object. | [
"Create",
"a",
"new",
"parser",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L28-L34 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_string_read_handler | func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
if parser.input_pos == len(parser.input) {
return 0, io.EOF
}
n = copy(buffer, parser.input[parser.input_pos:])
parser.input_pos += n
return n, nil
} | go | func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
if parser.input_pos == len(parser.input) {
return 0, io.EOF
}
n = copy(buffer, parser.input[parser.input_pos:])
parser.input_pos += n
return n, nil
} | [
"func",
"yaml_string_read_handler",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"buffer",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"parser",
".",
"input_pos",
"==",
"len",
"(",
"parser",
".",
"input",
")",
"{",
"return... | // String read handler. | [
"String",
"read",
"handler",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L42-L49 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_file_read_handler | func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
return parser.input_file.Read(buffer)
} | go | func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
return parser.input_file.Read(buffer)
} | [
"func",
"yaml_file_read_handler",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"buffer",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"parser",
".",
"input_file",
".",
"Read",
"(",
"buffer",
")",
"\n",
"}"
] | // File read handler. | [
"File",
"read",
"handler",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L52-L54 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_parser_set_input_string | func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) {
if parser.read_handler != nil {
panic("must set the input source only once")
}
parser.read_handler = yaml_string_read_handler
parser.input = input
parser.input_pos = 0
} | go | func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) {
if parser.read_handler != nil {
panic("must set the input source only once")
}
parser.read_handler = yaml_string_read_handler
parser.input = input
parser.input_pos = 0
} | [
"func",
"yaml_parser_set_input_string",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"input",
"[",
"]",
"byte",
")",
"{",
"if",
"parser",
".",
"read_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"parser",
".",
"read_handler",
"... | // Set a string input. | [
"Set",
"a",
"string",
"input",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L57-L64 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_parser_set_input_file | func yaml_parser_set_input_file(parser *yaml_parser_t, file *os.File) {
if parser.read_handler != nil {
panic("must set the input source only once")
}
parser.read_handler = yaml_file_read_handler
parser.input_file = file
} | go | func yaml_parser_set_input_file(parser *yaml_parser_t, file *os.File) {
if parser.read_handler != nil {
panic("must set the input source only once")
}
parser.read_handler = yaml_file_read_handler
parser.input_file = file
} | [
"func",
"yaml_parser_set_input_file",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"file",
"*",
"os",
".",
"File",
")",
"{",
"if",
"parser",
".",
"read_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"parser",
".",
"read_handler"... | // Set a file input. | [
"Set",
"a",
"file",
"input",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L67-L73 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_parser_set_encoding | func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) {
if parser.encoding != yaml_ANY_ENCODING {
panic("must set the encoding only once")
}
parser.encoding = encoding
} | go | func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) {
if parser.encoding != yaml_ANY_ENCODING {
panic("must set the encoding only once")
}
parser.encoding = encoding
} | [
"func",
"yaml_parser_set_encoding",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"encoding",
"yaml_encoding_t",
")",
"{",
"if",
"parser",
".",
"encoding",
"!=",
"yaml_ANY_ENCODING",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"parser",
".",
"encoding",
... | // Set the source encoding. | [
"Set",
"the",
"source",
"encoding",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L76-L81 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_string_write_handler | func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
*emitter.output_buffer = append(*emitter.output_buffer, buffer...)
return nil
} | go | func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
*emitter.output_buffer = append(*emitter.output_buffer, buffer...)
return nil
} | [
"func",
"yaml_string_write_handler",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"buffer",
"[",
"]",
"byte",
")",
"error",
"{",
"*",
"emitter",
".",
"output_buffer",
"=",
"append",
"(",
"*",
"emitter",
".",
"output_buffer",
",",
"buffer",
"...",
")",
"\n",
... | // String write handler. | [
"String",
"write",
"handler",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L100-L103 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_file_write_handler | func yaml_file_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
_, err := emitter.output_file.Write(buffer)
return err
} | go | func yaml_file_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
_, err := emitter.output_file.Write(buffer)
return err
} | [
"func",
"yaml_file_write_handler",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"buffer",
"[",
"]",
"byte",
")",
"error",
"{",
"_",
",",
"err",
":=",
"emitter",
".",
"output_file",
".",
"Write",
"(",
"buffer",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // File write handler. | [
"File",
"write",
"handler",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L106-L109 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_emitter_set_output_string | func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) {
if emitter.write_handler != nil {
panic("must set the output target only once")
}
emitter.write_handler = yaml_string_write_handler
emitter.output_buffer = output_buffer
} | go | func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) {
if emitter.write_handler != nil {
panic("must set the output target only once")
}
emitter.write_handler = yaml_string_write_handler
emitter.output_buffer = output_buffer
} | [
"func",
"yaml_emitter_set_output_string",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"output_buffer",
"*",
"[",
"]",
"byte",
")",
"{",
"if",
"emitter",
".",
"write_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"emitter",
".",... | // Set a string output. | [
"Set",
"a",
"string",
"output",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L112-L118 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_emitter_set_output_file | func yaml_emitter_set_output_file(emitter *yaml_emitter_t, file io.Writer) {
if emitter.write_handler != nil {
panic("must set the output target only once")
}
emitter.write_handler = yaml_file_write_handler
emitter.output_file = file
} | go | func yaml_emitter_set_output_file(emitter *yaml_emitter_t, file io.Writer) {
if emitter.write_handler != nil {
panic("must set the output target only once")
}
emitter.write_handler = yaml_file_write_handler
emitter.output_file = file
} | [
"func",
"yaml_emitter_set_output_file",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"file",
"io",
".",
"Writer",
")",
"{",
"if",
"emitter",
".",
"write_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"emitter",
".",
"write_handl... | // Set a file output. | [
"Set",
"a",
"file",
"output",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L121-L127 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_emitter_set_encoding | func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) {
if emitter.encoding != yaml_ANY_ENCODING {
panic("must set the output encoding only once")
}
emitter.encoding = encoding
} | go | func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) {
if emitter.encoding != yaml_ANY_ENCODING {
panic("must set the output encoding only once")
}
emitter.encoding = encoding
} | [
"func",
"yaml_emitter_set_encoding",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"encoding",
"yaml_encoding_t",
")",
"{",
"if",
"emitter",
".",
"encoding",
"!=",
"yaml_ANY_ENCODING",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"emitter",
".",
"encodin... | // Set the output encoding. | [
"Set",
"the",
"output",
"encoding",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L130-L135 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_emitter_set_width | func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
if width < 0 {
width = -1
}
emitter.best_width = width
} | go | func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
if width < 0 {
width = -1
}
emitter.best_width = width
} | [
"func",
"yaml_emitter_set_width",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"width",
"int",
")",
"{",
"if",
"width",
"<",
"0",
"{",
"width",
"=",
"-",
"1",
"\n",
"}",
"\n",
"emitter",
".",
"best_width",
"=",
"width",
"\n",
"}"
] | // Set the preferred line width. | [
"Set",
"the",
"preferred",
"line",
"width",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L151-L156 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_document_start_event_initialize | func yaml_document_start_event_initialize(event *yaml_event_t, version_directive *yaml_version_directive_t,
tag_directives []yaml_tag_directive_t, implicit bool) bool {
*event = yaml_event_t{
typ: yaml_DOCUMENT_START_EVENT,
version_directive: version_directive,
tag_directives: tag_directives,
... | go | func yaml_document_start_event_initialize(event *yaml_event_t, version_directive *yaml_version_directive_t,
tag_directives []yaml_tag_directive_t, implicit bool) bool {
*event = yaml_event_t{
typ: yaml_DOCUMENT_START_EVENT,
version_directive: version_directive,
tag_directives: tag_directives,
... | [
"func",
"yaml_document_start_event_initialize",
"(",
"event",
"*",
"yaml_event_t",
",",
"version_directive",
"*",
"yaml_version_directive_t",
",",
"tag_directives",
"[",
"]",
"yaml_tag_directive_t",
",",
"implicit",
"bool",
")",
"bool",
"{",
"*",
"event",
"=",
"yaml_e... | // Create DOCUMENT-START. | [
"Create",
"DOCUMENT",
"-",
"START",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L272-L281 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_document_end_event_initialize | func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) bool {
*event = yaml_event_t{
typ: yaml_DOCUMENT_END_EVENT,
implicit: implicit,
}
return true
} | go | func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) bool {
*event = yaml_event_t{
typ: yaml_DOCUMENT_END_EVENT,
implicit: implicit,
}
return true
} | [
"func",
"yaml_document_end_event_initialize",
"(",
"event",
"*",
"yaml_event_t",
",",
"implicit",
"bool",
")",
"bool",
"{",
"*",
"event",
"=",
"yaml_event_t",
"{",
"typ",
":",
"yaml_DOCUMENT_END_EVENT",
",",
"implicit",
":",
"implicit",
",",
"}",
"\n",
"return",... | // Create DOCUMENT-END. | [
"Create",
"DOCUMENT",
"-",
"END",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L284-L290 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go | yaml_sequence_start_event_initialize | func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool {
*event = yaml_event_t{
typ: yaml_SEQUENCE_START_EVENT,
anchor: anchor,
tag: tag,
implicit: implicit,
style: yaml_style_t(style),
}
return true
} | go | func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool {
*event = yaml_event_t{
typ: yaml_SEQUENCE_START_EVENT,
anchor: anchor,
tag: tag,
implicit: implicit,
style: yaml_style_t(style),
}
return true
} | [
"func",
"yaml_sequence_start_event_initialize",
"(",
"event",
"*",
"yaml_event_t",
",",
"anchor",
",",
"tag",
"[",
"]",
"byte",
",",
"implicit",
"bool",
",",
"style",
"yaml_sequence_style_t",
")",
"bool",
"{",
"*",
"event",
"=",
"yaml_event_t",
"{",
"typ",
":"... | // Create SEQUENCE-START. | [
"Create",
"SEQUENCE",
"-",
"START",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/apic.go#L331-L340 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/resource_container_linux.go | RunInResourceContainer | func RunInResourceContainer(containerName string) error {
manager := fs.Manager{
Cgroups: &configs.Cgroup{
Name: containerName,
AllowAllDevices: true,
},
}
return manager.Apply(os.Getpid())
} | go | func RunInResourceContainer(containerName string) error {
manager := fs.Manager{
Cgroups: &configs.Cgroup{
Name: containerName,
AllowAllDevices: true,
},
}
return manager.Apply(os.Getpid())
} | [
"func",
"RunInResourceContainer",
"(",
"containerName",
"string",
")",
"error",
"{",
"manager",
":=",
"fs",
".",
"Manager",
"{",
"Cgroups",
":",
"&",
"configs",
".",
"Cgroup",
"{",
"Name",
":",
"containerName",
",",
"AllowAllDevices",
":",
"true",
",",
"}",
... | // Creates resource-only containerName if it does not already exist and moves
// the current process to it.
//
// containerName must be an absolute container name. | [
"Creates",
"resource",
"-",
"only",
"containerName",
"if",
"it",
"does",
"not",
"already",
"exist",
"and",
"moves",
"the",
"current",
"process",
"to",
"it",
".",
"containerName",
"must",
"be",
"an",
"absolute",
"container",
"name",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/resource_container_linux.go#L33-L42 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/history.go | History | func (h *DeploymentHistoryViewer) History(namespace, name string) (HistoryInfo, error) {
historyInfo := HistoryInfo{
RevisionToTemplate: make(map[int64]*api.PodTemplateSpec),
}
deployment, err := h.c.Extensions().Deployments(namespace).Get(name)
if err != nil {
return historyInfo, fmt.Errorf("failed to retrieve... | go | func (h *DeploymentHistoryViewer) History(namespace, name string) (HistoryInfo, error) {
historyInfo := HistoryInfo{
RevisionToTemplate: make(map[int64]*api.PodTemplateSpec),
}
deployment, err := h.c.Extensions().Deployments(namespace).Get(name)
if err != nil {
return historyInfo, fmt.Errorf("failed to retrieve... | [
"func",
"(",
"h",
"*",
"DeploymentHistoryViewer",
")",
"History",
"(",
"namespace",
",",
"name",
"string",
")",
"(",
"HistoryInfo",
",",
"error",
")",
"{",
"historyInfo",
":=",
"HistoryInfo",
"{",
"RevisionToTemplate",
":",
"make",
"(",
"map",
"[",
"int64",
... | // History returns a revision-to-replicaset map as the revision history of a deployment | [
"History",
"returns",
"a",
"revision",
"-",
"to",
"-",
"replicaset",
"map",
"as",
"the",
"revision",
"history",
"of",
"a",
"deployment"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/history.go#L62-L92 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/history.go | PrintRolloutHistory | func PrintRolloutHistory(historyInfo HistoryInfo, resource, name string) (string, error) {
if len(historyInfo.RevisionToTemplate) == 0 {
return fmt.Sprintf("No rollout history found in %s %q", resource, name), nil
}
// Sort the revisionToChangeCause map by revision
var revisions []string
for k := range historyIn... | go | func PrintRolloutHistory(historyInfo HistoryInfo, resource, name string) (string, error) {
if len(historyInfo.RevisionToTemplate) == 0 {
return fmt.Sprintf("No rollout history found in %s %q", resource, name), nil
}
// Sort the revisionToChangeCause map by revision
var revisions []string
for k := range historyIn... | [
"func",
"PrintRolloutHistory",
"(",
"historyInfo",
"HistoryInfo",
",",
"resource",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"len",
"(",
"historyInfo",
".",
"RevisionToTemplate",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Sp... | // PrintRolloutHistory prints a formatted table of the input revision history of the deployment | [
"PrintRolloutHistory",
"prints",
"a",
"formatted",
"table",
"of",
"the",
"input",
"revision",
"history",
"of",
"the",
"deployment"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/history.go#L95-L125 | train |
kubernetes-retired/contrib | node-perf-dash/parser.go | Parse | func Parse(allTestData map[string]TestToBuildData, testInfo *TestInfo, job string, source Downloader) error {
fmt.Printf("Getting Data from %s... (Job: %s)\n", *datasource, job)
grabbedLastBuild := allGrabbedLastBuild[job]
lastBuildNumber, err := source.GetLastestBuildNumber(job)
if err != nil {
return fmt.Erro... | go | func Parse(allTestData map[string]TestToBuildData, testInfo *TestInfo, job string, source Downloader) error {
fmt.Printf("Getting Data from %s... (Job: %s)\n", *datasource, job)
grabbedLastBuild := allGrabbedLastBuild[job]
lastBuildNumber, err := source.GetLastestBuildNumber(job)
if err != nil {
return fmt.Erro... | [
"func",
"Parse",
"(",
"allTestData",
"map",
"[",
"string",
"]",
"TestToBuildData",
",",
"testInfo",
"*",
"TestInfo",
",",
"job",
"string",
",",
"source",
"Downloader",
")",
"error",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"*",
"datasource... | // Parse fetches data from the source and populates allTestData and testInfo
// for the given test job. | [
"Parse",
"fetches",
"data",
"from",
"the",
"source",
"and",
"populates",
"allTestData",
"and",
"testInfo",
"for",
"the",
"given",
"test",
"job",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/parser.go#L56-L77 | train |
kubernetes-retired/contrib | node-perf-dash/parser.go | populateMetadata | func populateMetadata(testInfo *TestInfo, testTime *TestTime, labels map[string]string) error {
test := labels["test"]
// Populate testInfo with the test description.
testInfo.Info[test] = labels["desc"]
// Populate testTime with the test end timestamp.
t, err := strconv.ParseInt(labels["timestamp"], 10, 64)
if... | go | func populateMetadata(testInfo *TestInfo, testTime *TestTime, labels map[string]string) error {
test := labels["test"]
// Populate testInfo with the test description.
testInfo.Info[test] = labels["desc"]
// Populate testTime with the test end timestamp.
t, err := strconv.ParseInt(labels["timestamp"], 10, 64)
if... | [
"func",
"populateMetadata",
"(",
"testInfo",
"*",
"TestInfo",
",",
"testTime",
"*",
"TestTime",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"test",
":=",
"labels",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Populate testInfo with the test des... | // populateMetadata populates the test description in testInfo and the test end
// timestamp in testTime using the information in the given labels. | [
"populateMetadata",
"populates",
"the",
"test",
"description",
"in",
"testInfo",
"and",
"the",
"test",
"end",
"timestamp",
"in",
"testTime",
"using",
"the",
"information",
"in",
"the",
"given",
"labels",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/parser.go#L115-L130 | train |
kubernetes-retired/contrib | node-perf-dash/parser.go | populateTimeSeriesData | func populateTimeSeriesData(testData TestToBuildData, testInfo *TestInfo, testTime *TestTime, job, build string, source Downloader) error {
contents, err := getDataFromFiles(job, build, "time_series", source)
if err != nil {
return err
}
for _, data := range contents {
// Decode the data into obj.
var obj nod... | go | func populateTimeSeriesData(testData TestToBuildData, testInfo *TestInfo, testTime *TestTime, job, build string, source Downloader) error {
contents, err := getDataFromFiles(job, build, "time_series", source)
if err != nil {
return err
}
for _, data := range contents {
// Decode the data into obj.
var obj nod... | [
"func",
"populateTimeSeriesData",
"(",
"testData",
"TestToBuildData",
",",
"testInfo",
"*",
"TestInfo",
",",
"testTime",
"*",
"TestTime",
",",
"job",
",",
"build",
"string",
",",
"source",
"Downloader",
")",
"error",
"{",
"contents",
",",
"err",
":=",
"getData... | // populateTimeSeriesData populates the time series data in testData and the
// metadata in testInfo and testTime for the given test job at the given build
// using the data fetched from source. | [
"populateTimeSeriesData",
"populates",
"the",
"time",
"series",
"data",
"in",
"testData",
"and",
"the",
"metadata",
"in",
"testInfo",
"and",
"testTime",
"for",
"the",
"given",
"test",
"job",
"at",
"the",
"given",
"build",
"using",
"the",
"data",
"fetched",
"fr... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/parser.go#L191-L223 | train |
kubernetes-retired/contrib | node-perf-dash/parser.go | populateDataForOneBuild | func populateDataForOneBuild(testData TestToBuildData, testInfo *TestInfo, job string, buildNumber int, source Downloader) error {
build := strconv.Itoa(buildNumber)
testTime := TestTime{}
if err := populatePerformanceData(testData, testInfo, &testTime, job, build, source); err != nil {
return err
}
if err := po... | go | func populateDataForOneBuild(testData TestToBuildData, testInfo *TestInfo, job string, buildNumber int, source Downloader) error {
build := strconv.Itoa(buildNumber)
testTime := TestTime{}
if err := populatePerformanceData(testData, testInfo, &testTime, job, build, source); err != nil {
return err
}
if err := po... | [
"func",
"populateDataForOneBuild",
"(",
"testData",
"TestToBuildData",
",",
"testInfo",
"*",
"TestInfo",
",",
"job",
"string",
",",
"buildNumber",
"int",
",",
"source",
"Downloader",
")",
"error",
"{",
"build",
":=",
"strconv",
".",
"Itoa",
"(",
"buildNumber",
... | // populateDataForOneBuild populates perf and time series data in testData and
// test description in testinfo for the given test job at given buildNumber
// with the data fetched from source. | [
"populateDataForOneBuild",
"populates",
"perf",
"and",
"time",
"series",
"data",
"in",
"testData",
"and",
"test",
"description",
"in",
"testinfo",
"for",
"the",
"given",
"test",
"job",
"at",
"given",
"buildNumber",
"with",
"the",
"data",
"fetched",
"from",
"sour... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/parser.go#L228-L244 | train |
kubernetes-retired/contrib | node-perf-dash/parser.go | parseTracingData | func parseTracingData(scanner *bufio.Scanner, job string, buildNumber int, result TestToBuildData) {
buff := &bytes.Buffer{}
state := scanning
build := fmt.Sprintf("%d", buildNumber)
for scanner.Scan() {
line := scanner.Text()
if state == processing {
if strings.Contains(line, timeSeriesEnd) {
state = s... | go | func parseTracingData(scanner *bufio.Scanner, job string, buildNumber int, result TestToBuildData) {
buff := &bytes.Buffer{}
state := scanning
build := fmt.Sprintf("%d", buildNumber)
for scanner.Scan() {
line := scanner.Text()
if state == processing {
if strings.Contains(line, timeSeriesEnd) {
state = s... | [
"func",
"parseTracingData",
"(",
"scanner",
"*",
"bufio",
".",
"Scanner",
",",
"job",
"string",
",",
"buildNumber",
"int",
",",
"result",
"TestToBuildData",
")",
"{",
"buff",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"state",
":=",
"scanning",
"... | // parseTracingData extracts and converts tracing data into time series data. | [
"parseTracingData",
"extracts",
"and",
"converts",
"tracing",
"data",
"into",
"time",
"series",
"data",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/parser.go#L254-L305 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go | Get | func (c *replicaSets) Get(name string) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Get().Namespace(c.ns).Resource("replicasets").Name(name).Do().Into(result)
return
} | go | func (c *replicaSets) Get(name string) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Get().Namespace(c.ns).Resource("replicasets").Name(name).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"replicaSets",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"result",
"*",
"extensions",
".",
"ReplicaSet",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"extensions",
".",
"ReplicaSet",
"{",
"}",
"\n",
"err",
"=",
"c",
... | // Get returns information about a particular ReplicaSet. | [
"Get",
"returns",
"information",
"about",
"a",
"particular",
"ReplicaSet",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go#L60-L64 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go | NewCloner | func NewCloner() *Cloner {
c := &Cloner{
deepCopyFuncs: map[reflect.Type]reflect.Value{},
generatedDeepCopyFuncs: map[reflect.Type]reflect.Value{},
}
if err := c.RegisterDeepCopyFunc(byteSliceDeepCopy); err != nil {
// If one of the deep-copy functions is malformed, detect it immediately.
panic(err)... | go | func NewCloner() *Cloner {
c := &Cloner{
deepCopyFuncs: map[reflect.Type]reflect.Value{},
generatedDeepCopyFuncs: map[reflect.Type]reflect.Value{},
}
if err := c.RegisterDeepCopyFunc(byteSliceDeepCopy); err != nil {
// If one of the deep-copy functions is malformed, detect it immediately.
panic(err)... | [
"func",
"NewCloner",
"(",
")",
"*",
"Cloner",
"{",
"c",
":=",
"&",
"Cloner",
"{",
"deepCopyFuncs",
":",
"map",
"[",
"reflect",
".",
"Type",
"]",
"reflect",
".",
"Value",
"{",
"}",
",",
"generatedDeepCopyFuncs",
":",
"map",
"[",
"reflect",
".",
"Type",
... | // NewCloner creates a new Cloner object. | [
"NewCloner",
"creates",
"a",
"new",
"Cloner",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go#L32-L42 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go | byteSliceDeepCopy | func byteSliceDeepCopy(in []byte, out *[]byte, c *Cloner) error {
if in != nil {
*out = make([]byte, len(in))
copy(*out, in)
} else {
*out = nil
}
return nil
} | go | func byteSliceDeepCopy(in []byte, out *[]byte, c *Cloner) error {
if in != nil {
*out = make([]byte, len(in))
copy(*out, in)
} else {
*out = nil
}
return nil
} | [
"func",
"byteSliceDeepCopy",
"(",
"in",
"[",
"]",
"byte",
",",
"out",
"*",
"[",
"]",
"byte",
",",
"c",
"*",
"Cloner",
")",
"error",
"{",
"if",
"in",
"!=",
"nil",
"{",
"*",
"out",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"in",
")",... | // Prevent recursing into every byte... | [
"Prevent",
"recursing",
"into",
"every",
"byte",
"..."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go#L45-L53 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go | verifyDeepCopyFunctionSignature | func verifyDeepCopyFunctionSignature(ft reflect.Type) error {
if ft.Kind() != reflect.Func {
return fmt.Errorf("expected func, got: %v", ft)
}
if ft.NumIn() != 3 {
return fmt.Errorf("expected three 'in' params, got %v", ft)
}
if ft.NumOut() != 1 {
return fmt.Errorf("expected one 'out' param, got %v", ft)
}
... | go | func verifyDeepCopyFunctionSignature(ft reflect.Type) error {
if ft.Kind() != reflect.Func {
return fmt.Errorf("expected func, got: %v", ft)
}
if ft.NumIn() != 3 {
return fmt.Errorf("expected three 'in' params, got %v", ft)
}
if ft.NumOut() != 1 {
return fmt.Errorf("expected one 'out' param, got %v", ft)
}
... | [
"func",
"verifyDeepCopyFunctionSignature",
"(",
"ft",
"reflect",
".",
"Type",
")",
"error",
"{",
"if",
"ft",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ft",
")",
"\n",
"}",
"\n",
... | // Verifies whether a deep-copy function has a correct signature. | [
"Verifies",
"whether",
"a",
"deep",
"-",
"copy",
"function",
"has",
"a",
"correct",
"signature",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go#L56-L84 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go | RegisterGeneratedDeepCopyFunc | func (c *Cloner) RegisterGeneratedDeepCopyFunc(deepCopyFunc interface{}) error {
fv := reflect.ValueOf(deepCopyFunc)
ft := fv.Type()
if err := verifyDeepCopyFunctionSignature(ft); err != nil {
return err
}
c.generatedDeepCopyFuncs[ft.In(0)] = fv
return nil
} | go | func (c *Cloner) RegisterGeneratedDeepCopyFunc(deepCopyFunc interface{}) error {
fv := reflect.ValueOf(deepCopyFunc)
ft := fv.Type()
if err := verifyDeepCopyFunctionSignature(ft); err != nil {
return err
}
c.generatedDeepCopyFuncs[ft.In(0)] = fv
return nil
} | [
"func",
"(",
"c",
"*",
"Cloner",
")",
"RegisterGeneratedDeepCopyFunc",
"(",
"deepCopyFunc",
"interface",
"{",
"}",
")",
"error",
"{",
"fv",
":=",
"reflect",
".",
"ValueOf",
"(",
"deepCopyFunc",
")",
"\n",
"ft",
":=",
"fv",
".",
"Type",
"(",
")",
"\n",
... | // Similar to RegisterDeepCopyFunc, but registers deep copy function that were
// automatically generated. | [
"Similar",
"to",
"RegisterDeepCopyFunc",
"but",
"registers",
"deep",
"copy",
"function",
"that",
"were",
"automatically",
"generated",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go#L108-L116 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go | DeepCopy | func (c *Cloner) DeepCopy(in interface{}) (interface{}, error) {
// Can be invalid if we run DeepCopy(X) where X is a nil interface type.
// For example, we get an invalid value when someone tries to deep-copy
// a nil labels.Selector.
// This does not occur if X is nil and is a pointer to a concrete type.
if in =... | go | func (c *Cloner) DeepCopy(in interface{}) (interface{}, error) {
// Can be invalid if we run DeepCopy(X) where X is a nil interface type.
// For example, we get an invalid value when someone tries to deep-copy
// a nil labels.Selector.
// This does not occur if X is nil and is a pointer to a concrete type.
if in =... | [
"func",
"(",
"c",
"*",
"Cloner",
")",
"DeepCopy",
"(",
"in",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// Can be invalid if we run DeepCopy(X) where X is a nil interface type.",
"// For example, we get an invalid value when someone t... | // DeepCopy will perform a deep copy of a given object. | [
"DeepCopy",
"will",
"perform",
"a",
"deep",
"copy",
"of",
"a",
"given",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/cloner.go#L119-L133 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go | KnownTypes | func (s *Scheme) KnownTypes(gv unversioned.GroupVersion) map[string]reflect.Type {
types := make(map[string]reflect.Type)
for gvk, t := range s.gvkToType {
if gv != gvk.GroupVersion() {
continue
}
types[gvk.Kind] = t
}
return types
} | go | func (s *Scheme) KnownTypes(gv unversioned.GroupVersion) map[string]reflect.Type {
types := make(map[string]reflect.Type)
for gvk, t := range s.gvkToType {
if gv != gvk.GroupVersion() {
continue
}
types[gvk.Kind] = t
}
return types
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"KnownTypes",
"(",
"gv",
"unversioned",
".",
"GroupVersion",
")",
"map",
"[",
"string",
"]",
"reflect",
".",
"Type",
"{",
"types",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"reflect",
".",
"Type",
")",
"\n",
... | // KnownTypes returns the types known for the given version. | [
"KnownTypes",
"returns",
"the",
"types",
"known",
"for",
"the",
"given",
"version",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go#L205-L215 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go | ObjectKind | func (s *Scheme) ObjectKind(obj Object) (unversioned.GroupVersionKind, error) {
gvks, err := s.ObjectKinds(obj)
if err != nil {
return unversioned.GroupVersionKind{}, err
}
return gvks[0], nil
} | go | func (s *Scheme) ObjectKind(obj Object) (unversioned.GroupVersionKind, error) {
gvks, err := s.ObjectKinds(obj)
if err != nil {
return unversioned.GroupVersionKind{}, err
}
return gvks[0], nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"ObjectKind",
"(",
"obj",
"Object",
")",
"(",
"unversioned",
".",
"GroupVersionKind",
",",
"error",
")",
"{",
"gvks",
",",
"err",
":=",
"s",
".",
"ObjectKinds",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // ObjectKind returns the group,version,kind of the go object,
// or an error if it's not a pointer or is unregistered. | [
"ObjectKind",
"returns",
"the",
"group",
"version",
"kind",
"of",
"the",
"go",
"object",
"or",
"an",
"error",
"if",
"it",
"s",
"not",
"a",
"pointer",
"or",
"is",
"unregistered",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go#L219-L225 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go | ObjectKinds | func (s *Scheme) ObjectKinds(obj Object) ([]unversioned.GroupVersionKind, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
t := v.Type()
gvks, ok := s.typeToGVK[t]
if !ok {
return nil, ¬RegisteredErr{t: t}
}
return gvks, nil
} | go | func (s *Scheme) ObjectKinds(obj Object) ([]unversioned.GroupVersionKind, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
t := v.Type()
gvks, ok := s.typeToGVK[t]
if !ok {
return nil, ¬RegisteredErr{t: t}
}
return gvks, nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"ObjectKinds",
"(",
"obj",
"Object",
")",
"(",
"[",
"]",
"unversioned",
".",
"GroupVersionKind",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"conversion",
".",
"EnforcePtr",
"(",
"obj",
")",
"\n",
"if",
"err",... | // ObjectKinds returns all possible group,version,kind of the go object,
// or an error if it's not a pointer or is unregistered. | [
"ObjectKinds",
"returns",
"all",
"possible",
"group",
"version",
"kind",
"of",
"the",
"go",
"object",
"or",
"an",
"error",
"if",
"it",
"s",
"not",
"a",
"pointer",
"or",
"is",
"unregistered",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go#L229-L242 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go | Copy | func (s *Scheme) Copy(src Object) (Object, error) {
dst, err := s.DeepCopy(src)
if err != nil {
return nil, err
}
return dst.(Object), nil
} | go | func (s *Scheme) Copy(src Object) (Object, error) {
dst, err := s.DeepCopy(src)
if err != nil {
return nil, err
}
return dst.(Object), nil
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"Copy",
"(",
"src",
"Object",
")",
"(",
"Object",
",",
"error",
")",
"{",
"dst",
",",
"err",
":=",
"s",
".",
"DeepCopy",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // Copy does a deep copy of an API object. | [
"Copy",
"does",
"a",
"deep",
"copy",
"of",
"an",
"API",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/scheme.go#L414-L420 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.