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/scannerc.go | yaml_parser_fetch_anchor | func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool {
// An anchor or an alias could be a simple key.
if !yaml_parser_save_simple_key(parser) {
return false
}
// A simple key cannot follow an anchor or an alias.
parser.simple_key_allowed = false
// Create the ALIAS or ANCHOR token... | go | func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool {
// An anchor or an alias could be a simple key.
if !yaml_parser_save_simple_key(parser) {
return false
}
// A simple key cannot follow an anchor or an alias.
parser.simple_key_allowed = false
// Create the ALIAS or ANCHOR token... | [
"func",
"yaml_parser_fetch_anchor",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"typ",
"yaml_token_type_t",
")",
"bool",
"{",
"// An anchor or an alias could be a simple key.",
"if",
"!",
"yaml_parser_save_simple_key",
"(",
"parser",
")",
"{",
"return",
"false",
"\n",
"}"... | // Produce the ALIAS or ANCHOR token. | [
"Produce",
"the",
"ALIAS",
"or",
"ANCHOR",
"token",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L1339-L1355 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_fetch_tag | func yaml_parser_fetch_tag(parser *yaml_parser_t) bool {
// A tag could be a simple key.
if !yaml_parser_save_simple_key(parser) {
return false
}
// A simple key cannot follow a tag.
parser.simple_key_allowed = false
// Create the TAG token and append it to the queue.
var token yaml_token_t
if !yaml_parser_... | go | func yaml_parser_fetch_tag(parser *yaml_parser_t) bool {
// A tag could be a simple key.
if !yaml_parser_save_simple_key(parser) {
return false
}
// A simple key cannot follow a tag.
parser.simple_key_allowed = false
// Create the TAG token and append it to the queue.
var token yaml_token_t
if !yaml_parser_... | [
"func",
"yaml_parser_fetch_tag",
"(",
"parser",
"*",
"yaml_parser_t",
")",
"bool",
"{",
"// A tag could be a simple key.",
"if",
"!",
"yaml_parser_save_simple_key",
"(",
"parser",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// A simple key cannot follow a tag.",
"p... | // Produce the TAG token. | [
"Produce",
"the",
"TAG",
"token",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L1358-L1374 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_scan_to_next_token | func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool {
// Until the next token is not found.
for {
// Allow the BOM mark to start a line.
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
}
if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) {
sk... | go | func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool {
// Until the next token is not found.
for {
// Allow the BOM mark to start a line.
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
}
if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) {
sk... | [
"func",
"yaml_parser_scan_to_next_token",
"(",
"parser",
"*",
"yaml_parser_t",
")",
"bool",
"{",
"// Until the next token is not found.",
"for",
"{",
"// Allow the BOM mark to start a line.",
"if",
"parser",
".",
"unread",
"<",
"1",
"&&",
"!",
"yaml_parser_update_buffer",
... | // Eat whitespaces and comments until the next token is found. | [
"Eat",
"whitespaces",
"and",
"comments",
"until",
"the",
"next",
"token",
"is",
"found",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L1434-L1489 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_scan_tag_handle | func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool {
// Check the initial '!' character.
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
}
if parser.buffer[parser.buffer_pos] != '!' {
yaml_parser_set_scanner_tag_error... | go | func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool {
// Check the initial '!' character.
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
}
if parser.buffer[parser.buffer_pos] != '!' {
yaml_parser_set_scanner_tag_error... | [
"func",
"yaml_parser_scan_tag_handle",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"directive",
"bool",
",",
"start_mark",
"yaml_mark_t",
",",
"handle",
"*",
"[",
"]",
"byte",
")",
"bool",
"{",
"// Check the initial '!' character.",
"if",
"parser",
".",
"unread",
"<... | // Scan a tag handle. | [
"Scan",
"a",
"tag",
"handle",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L1914-L1956 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_scan_tag_uri | func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool {
//size_t length = head ? strlen((char *)head) : 0
var s []byte
// Copy the head if needed.
//
// Note that we don't copy the leading '!' character.
if len(head) > 1 {
s = append(s, head... | go | func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool {
//size_t length = head ? strlen((char *)head) : 0
var s []byte
// Copy the head if needed.
//
// Note that we don't copy the leading '!' character.
if len(head) > 1 {
s = append(s, head... | [
"func",
"yaml_parser_scan_tag_uri",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"directive",
"bool",
",",
"head",
"[",
"]",
"byte",
",",
"start_mark",
"yaml_mark_t",
",",
"uri",
"*",
"[",
"]",
"byte",
")",
"bool",
"{",
"//size_t length = head ? strlen((char *)head) ... | // Scan a tag. | [
"Scan",
"a",
"tag",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L1959-L2013 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_scan_uri_escapes | func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool {
// Decode the required number of characters.
w := 1024
for w > 0 {
// Check for a URI-escaped octet.
if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
return false
}
if !(pars... | go | func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool {
// Decode the required number of characters.
w := 1024
for w > 0 {
// Check for a URI-escaped octet.
if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
return false
}
if !(pars... | [
"func",
"yaml_parser_scan_uri_escapes",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"directive",
"bool",
",",
"start_mark",
"yaml_mark_t",
",",
"s",
"*",
"[",
"]",
"byte",
")",
"bool",
"{",
"// Decode the required number of characters.",
"w",
":=",
"1024",
"\n",
"fo... | // Decode an URI-escape sequence corresponding to a single UTF-8 character. | [
"Decode",
"an",
"URI",
"-",
"escape",
"sequence",
"corresponding",
"to",
"a",
"single",
"UTF",
"-",
"8",
"character",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L2016-L2059 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go | yaml_parser_scan_block_scalar_breaks | func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool {
*end_mark = parser.mark
// Eat the intendation spaces and line breaks.
max_indent := 0
for {
// Eat the intendation spaces.
if parser.unread < 1 && !yaml_parser_up... | go | func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool {
*end_mark = parser.mark
// Eat the intendation spaces and line breaks.
max_indent := 0
for {
// Eat the intendation spaces.
if parser.unread < 1 && !yaml_parser_up... | [
"func",
"yaml_parser_scan_block_scalar_breaks",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"indent",
"*",
"int",
",",
"breaks",
"*",
"[",
"]",
"byte",
",",
"start_mark",
"yaml_mark_t",
",",
"end_mark",
"*",
"yaml_mark_t",
")",
"bool",
"{",
"*",
"end_mark",
"=",... | // Scan intendation spaces and line breaks for a block scalar. Determine the
// intendation level if needed. | [
"Scan",
"intendation",
"spaces",
"and",
"line",
"breaks",
"for",
"a",
"block",
"scalar",
".",
"Determine",
"the",
"intendation",
"level",
"if",
"needed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/scannerc.go#L2250-L2301 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/helpers.go | LabelSelectorAsSelector | func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) {
if ps == nil {
return labels.Nothing(), nil
}
if len(ps.MatchLabels)+len(ps.MatchExpressions) == 0 {
return labels.Everything(), nil
}
selector := labels.NewSelector()
for k, v := range ps.MatchLabels {
r, err := labels.NewRequiremen... | go | func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) {
if ps == nil {
return labels.Nothing(), nil
}
if len(ps.MatchLabels)+len(ps.MatchExpressions) == 0 {
return labels.Everything(), nil
}
selector := labels.NewSelector()
for k, v := range ps.MatchLabels {
r, err := labels.NewRequiremen... | [
"func",
"LabelSelectorAsSelector",
"(",
"ps",
"*",
"LabelSelector",
")",
"(",
"labels",
".",
"Selector",
",",
"error",
")",
"{",
"if",
"ps",
"==",
"nil",
"{",
"return",
"labels",
".",
"Nothing",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"("... | // LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements
// labels.Selector | [
"LabelSelectorAsSelector",
"converts",
"the",
"LabelSelector",
"api",
"type",
"into",
"a",
"struct",
"that",
"implements",
"labels",
".",
"Selector"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/helpers.go#L29-L65 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/helpers.go | ScaleFromDeployment | func ScaleFromDeployment(deployment *Deployment) *Scale {
return &Scale{
ObjectMeta: api.ObjectMeta{
Name: deployment.Name,
Namespace: deployment.Namespace,
CreationTimestamp: deployment.CreationTimestamp,
},
Spec: ScaleSpec{
Replicas: deployment.Spec.Replicas,
},
Status: Sca... | go | func ScaleFromDeployment(deployment *Deployment) *Scale {
return &Scale{
ObjectMeta: api.ObjectMeta{
Name: deployment.Name,
Namespace: deployment.Namespace,
CreationTimestamp: deployment.CreationTimestamp,
},
Spec: ScaleSpec{
Replicas: deployment.Spec.Replicas,
},
Status: Sca... | [
"func",
"ScaleFromDeployment",
"(",
"deployment",
"*",
"Deployment",
")",
"*",
"Scale",
"{",
"return",
"&",
"Scale",
"{",
"ObjectMeta",
":",
"api",
".",
"ObjectMeta",
"{",
"Name",
":",
"deployment",
".",
"Name",
",",
"Namespace",
":",
"deployment",
".",
"N... | // ScaleFromDeployment returns a scale subresource for a deployment. | [
"ScaleFromDeployment",
"returns",
"a",
"scale",
"subresource",
"for",
"a",
"deployment",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/helpers.go#L68-L83 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/iptables/iptables.go | Save | func (runner *runner) Save(table Table) ([]byte, error) {
runner.mu.Lock()
defer runner.mu.Unlock()
// run and return
args := []string{"-t", string(table)}
return runner.exec.Command(cmdIptablesSave, args...).CombinedOutput()
} | go | func (runner *runner) Save(table Table) ([]byte, error) {
runner.mu.Lock()
defer runner.mu.Unlock()
// run and return
args := []string{"-t", string(table)}
return runner.exec.Command(cmdIptablesSave, args...).CombinedOutput()
} | [
"func",
"(",
"runner",
"*",
"runner",
")",
"Save",
"(",
"table",
"Table",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"runner",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"runner",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"// r... | // Save is part of Interface. | [
"Save",
"is",
"part",
"of",
"Interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/iptables/iptables.go#L291-L298 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/iptables/iptables.go | SaveAll | func (runner *runner) SaveAll() ([]byte, error) {
runner.mu.Lock()
defer runner.mu.Unlock()
// run and return
return runner.exec.Command(cmdIptablesSave, []string{}...).CombinedOutput()
} | go | func (runner *runner) SaveAll() ([]byte, error) {
runner.mu.Lock()
defer runner.mu.Unlock()
// run and return
return runner.exec.Command(cmdIptablesSave, []string{}...).CombinedOutput()
} | [
"func",
"(",
"runner",
"*",
"runner",
")",
"SaveAll",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"runner",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"runner",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"// run and return",
"... | // SaveAll is part of Interface. | [
"SaveAll",
"is",
"part",
"of",
"Interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/iptables/iptables.go#L301-L307 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/conversion_generator.go | primitiveConversion | func primitiveConversion(inType, outType reflect.Type) (string, bool) {
switch inType.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
reflect.Float32, reflect.Float64:
switch outType.Kind() {
cas... | go | func primitiveConversion(inType, outType reflect.Type) (string, bool) {
switch inType.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
reflect.Float32, reflect.Float64:
switch outType.Kind() {
cas... | [
"func",
"primitiveConversion",
"(",
"inType",
",",
"outType",
"reflect",
".",
"Type",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"inType",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",... | // primitiveConversion returns true if the two types can be converted via a cast. | [
"primitiveConversion",
"returns",
"true",
"if",
"the",
"two",
"types",
"can",
"be",
"converted",
"via",
"a",
"cast",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/conversion_generator.go#L127-L140 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/run.go | HandleResourceRequirements | func HandleResourceRequirements(params map[string]string) (api.ResourceRequirements, error) {
result := api.ResourceRequirements{}
limits, err := populateResourceList(params["limits"])
if err != nil {
return result, err
}
result.Limits = limits
requests, err := populateResourceList(params["requests"])
if err !... | go | func HandleResourceRequirements(params map[string]string) (api.ResourceRequirements, error) {
result := api.ResourceRequirements{}
limits, err := populateResourceList(params["limits"])
if err != nil {
return result, err
}
result.Limits = limits
requests, err := populateResourceList(params["requests"])
if err !... | [
"func",
"HandleResourceRequirements",
"(",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"api",
".",
"ResourceRequirements",
",",
"error",
")",
"{",
"result",
":=",
"api",
".",
"ResourceRequirements",
"{",
"}",
"\n",
"limits",
",",
"err",
":=",
... | // HandleResourceRequirements parses the limits and requests parameters if specified | [
"HandleResourceRequirements",
"parses",
"the",
"limits",
"and",
"requests",
"parameters",
"if",
"specified"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/run.go#L330-L343 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go | Decode | func Decode(payload string) (*ClaimSet, error) {
// decode returned id token to get expiry
s := strings.Split(payload, ".")
if len(s) < 2 {
// TODO(jbd): Provide more context about the error.
return nil, errors.New("jws: invalid token received")
}
decoded, err := base64Decode(s[1])
if err != nil {
return ni... | go | func Decode(payload string) (*ClaimSet, error) {
// decode returned id token to get expiry
s := strings.Split(payload, ".")
if len(s) < 2 {
// TODO(jbd): Provide more context about the error.
return nil, errors.New("jws: invalid token received")
}
decoded, err := base64Decode(s[1])
if err != nil {
return ni... | [
"func",
"Decode",
"(",
"payload",
"string",
")",
"(",
"*",
"ClaimSet",
",",
"error",
")",
"{",
"// decode returned id token to get expiry",
"s",
":=",
"strings",
".",
"Split",
"(",
"payload",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"s",
")",
"<",
... | // Decode decodes a claim set from a JWS payload. | [
"Decode",
"decodes",
"a",
"claim",
"set",
"from",
"a",
"JWS",
"payload",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go#L107-L121 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go | Encode | func Encode(header *Header, c *ClaimSet, signature *rsa.PrivateKey) (string, error) {
head, err := header.encode()
if err != nil {
return "", err
}
cs, err := c.encode()
if err != nil {
return "", err
}
ss := fmt.Sprintf("%s.%s", head, cs)
h := sha256.New()
h.Write([]byte(ss))
b, err := rsa.SignPKCS1v15(r... | go | func Encode(header *Header, c *ClaimSet, signature *rsa.PrivateKey) (string, error) {
head, err := header.encode()
if err != nil {
return "", err
}
cs, err := c.encode()
if err != nil {
return "", err
}
ss := fmt.Sprintf("%s.%s", head, cs)
h := sha256.New()
h.Write([]byte(ss))
b, err := rsa.SignPKCS1v15(r... | [
"func",
"Encode",
"(",
"header",
"*",
"Header",
",",
"c",
"*",
"ClaimSet",
",",
"signature",
"*",
"rsa",
".",
"PrivateKey",
")",
"(",
"string",
",",
"error",
")",
"{",
"head",
",",
"err",
":=",
"header",
".",
"encode",
"(",
")",
"\n",
"if",
"err",
... | // Encode encodes a signed JWS with provided header and claim set. | [
"Encode",
"encodes",
"a",
"signed",
"JWS",
"with",
"provided",
"header",
"and",
"claim",
"set",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go#L124-L142 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go | base64Decode | func base64Decode(s string) ([]byte, error) {
// add back missing padding
switch len(s) % 4 {
case 2:
s += "=="
case 3:
s += "="
}
return base64.URLEncoding.DecodeString(s)
} | go | func base64Decode(s string) ([]byte, error) {
// add back missing padding
switch len(s) % 4 {
case 2:
s += "=="
case 3:
s += "="
}
return base64.URLEncoding.DecodeString(s)
} | [
"func",
"base64Decode",
"(",
"s",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// add back missing padding",
"switch",
"len",
"(",
"s",
")",
"%",
"4",
"{",
"case",
"2",
":",
"s",
"+=",
"\"",
"\"",
"\n",
"case",
"3",
":",
"s",
"+... | // base64Decode decodes the Base64url encoded string | [
"base64Decode",
"decodes",
"the",
"Base64url",
"encoded",
"string"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/jws/jws.go#L151-L160 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go | IntoSingular | func (r *Result) IntoSingular(b *bool) *Result {
*b = r.singular
return r
} | go | func (r *Result) IntoSingular(b *bool) *Result {
*b = r.singular
return r
} | [
"func",
"(",
"r",
"*",
"Result",
")",
"IntoSingular",
"(",
"b",
"*",
"bool",
")",
"*",
"Result",
"{",
"*",
"b",
"=",
"r",
".",
"singular",
"\n",
"return",
"r",
"\n",
"}"
] | // IntoSingular sets the provided boolean pointer to true if the Builder input
// reflected a single item, or multiple. | [
"IntoSingular",
"sets",
"the",
"provided",
"boolean",
"pointer",
"to",
"true",
"if",
"the",
"Builder",
"input",
"reflected",
"a",
"single",
"item",
"or",
"multiple",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go#L85-L88 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go | AsVersionedObject | func AsVersionedObject(infos []*Info, forceList bool, version string, encoder runtime.Encoder) (runtime.Object, error) {
objects, err := AsVersionedObjects(infos, version, encoder)
if err != nil {
return nil, err
}
var object runtime.Object
if len(objects) == 1 && !forceList {
object = objects[0]
} else {
... | go | func AsVersionedObject(infos []*Info, forceList bool, version string, encoder runtime.Encoder) (runtime.Object, error) {
objects, err := AsVersionedObjects(infos, version, encoder)
if err != nil {
return nil, err
}
var object runtime.Object
if len(objects) == 1 && !forceList {
object = objects[0]
} else {
... | [
"func",
"AsVersionedObject",
"(",
"infos",
"[",
"]",
"*",
"Info",
",",
"forceList",
"bool",
",",
"version",
"string",
",",
"encoder",
"runtime",
".",
"Encoder",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"objects",
",",
"err",
":=",
"A... | // AsVersionedObject converts a list of infos into a single object - either a List containing
// the objects as children, or if only a single Object is present, as that object. The provided
// version will be preferred as the conversion target, but the Object's mapping version will be
// used if that version is not pre... | [
"AsVersionedObject",
"converts",
"a",
"list",
"of",
"infos",
"into",
"a",
"single",
"object",
"-",
"either",
"a",
"List",
"containing",
"the",
"objects",
"as",
"children",
"or",
"if",
"only",
"a",
"single",
"Object",
"is",
"present",
"as",
"that",
"object",
... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go#L213-L231 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go | AsVersionedObjects | func AsVersionedObjects(infos []*Info, version string, encoder runtime.Encoder) ([]runtime.Object, error) {
objects := []runtime.Object{}
for _, info := range infos {
if info.Object == nil {
continue
}
// TODO: use info.VersionedObject as the value?
// objects that are not part of api.Scheme must be conv... | go | func AsVersionedObjects(infos []*Info, version string, encoder runtime.Encoder) ([]runtime.Object, error) {
objects := []runtime.Object{}
for _, info := range infos {
if info.Object == nil {
continue
}
// TODO: use info.VersionedObject as the value?
// objects that are not part of api.Scheme must be conv... | [
"func",
"AsVersionedObjects",
"(",
"infos",
"[",
"]",
"*",
"Info",
",",
"version",
"string",
",",
"encoder",
"runtime",
".",
"Encoder",
")",
"(",
"[",
"]",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"objects",
":=",
"[",
"]",
"runtime",
".",
"... | // AsVersionedObjects converts a list of infos into versioned objects. The provided
// version will be preferred as the conversion target, but the Object's mapping version will be
// used if that version is not present. | [
"AsVersionedObjects",
"converts",
"a",
"list",
"of",
"infos",
"into",
"versioned",
"objects",
".",
"The",
"provided",
"version",
"will",
"be",
"preferred",
"as",
"the",
"conversion",
"target",
"but",
"the",
"Object",
"s",
"mapping",
"version",
"will",
"be",
"u... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/result.go#L236-L266 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | StandardErrorMessage | func StandardErrorMessage(err error) (string, bool) {
if debugErr, ok := err.(debugError); ok {
glog.V(4).Infof(debugErr.DebugError())
}
_, isStatus := err.(errors.APIStatus)
switch {
case isStatus:
return fmt.Sprintf("Error from server: %s", err.Error()), true
case errors.IsUnexpectedObjectError(err):
retu... | go | func StandardErrorMessage(err error) (string, bool) {
if debugErr, ok := err.(debugError); ok {
glog.V(4).Infof(debugErr.DebugError())
}
_, isStatus := err.(errors.APIStatus)
switch {
case isStatus:
return fmt.Sprintf("Error from server: %s", err.Error()), true
case errors.IsUnexpectedObjectError(err):
retu... | [
"func",
"StandardErrorMessage",
"(",
"err",
"error",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"debugErr",
",",
"ok",
":=",
"err",
".",
"(",
"debugError",
")",
";",
"ok",
"{",
"glog",
".",
"V",
"(",
"4",
")",
".",
"Infof",
"(",
"debugErr",
... | // StandardErrorMessage translates common errors into a human readable message, or returns
// false if the error is not one of the recognized types. It may also log extended
// information to glog.
//
// This method is generic to the command in use and may be used by non-Kubectl
// commands. | [
"StandardErrorMessage",
"translates",
"common",
"errors",
"into",
"a",
"human",
"readable",
"message",
"or",
"returns",
"false",
"if",
"the",
"error",
"is",
"not",
"one",
"of",
"the",
"recognized",
"types",
".",
"It",
"may",
"also",
"log",
"extended",
"informa... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L170-L195 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | isWatch | func isWatch(cmd *cobra.Command) bool {
if w, err := cmd.Flags().GetBool("watch"); w && err == nil {
return true
}
if wo, err := cmd.Flags().GetBool("watch-only"); wo && err == nil {
return true
}
return false
} | go | func isWatch(cmd *cobra.Command) bool {
if w, err := cmd.Flags().GetBool("watch"); w && err == nil {
return true
}
if wo, err := cmd.Flags().GetBool("watch-only"); wo && err == nil {
return true
}
return false
} | [
"func",
"isWatch",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"bool",
"{",
"if",
"w",
",",
"err",
":=",
"cmd",
".",
"Flags",
"(",
")",
".",
"GetBool",
"(",
"\"",
"\"",
")",
";",
"w",
"&&",
"err",
"==",
"nil",
"{",
"return",
"true",
"\n",
... | // Whether this cmd need watching objects. | [
"Whether",
"this",
"cmd",
"need",
"watching",
"objects",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L244-L254 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | GetWideFlag | func GetWideFlag(cmd *cobra.Command) bool {
f := cmd.Flags().Lookup("output")
if f.Value.String() == "wide" {
return true
}
return false
} | go | func GetWideFlag(cmd *cobra.Command) bool {
f := cmd.Flags().Lookup("output")
if f.Value.String() == "wide" {
return true
}
return false
} | [
"func",
"GetWideFlag",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"bool",
"{",
"f",
":=",
"cmd",
".",
"Flags",
"(",
")",
".",
"Lookup",
"(",
"\"",
"\"",
")",
"\n",
"if",
"f",
".",
"Value",
".",
"String",
"(",
")",
"==",
"\"",
"\"",
"{",
"... | // GetWideFlag is used to determine if "-o wide" is used | [
"GetWideFlag",
"is",
"used",
"to",
"determine",
"if",
"-",
"o",
"wide",
"is",
"used"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L282-L288 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | UpdateObject | func UpdateObject(info *resource.Info, codec runtime.Codec, updateFn func(runtime.Object) error) (runtime.Object, error) {
helper := resource.NewHelper(info.Client, info.Mapping)
if err := updateFn(info.Object); err != nil {
return nil, err
}
// Update the annotation used by kubectl apply
if err := kubectl.Upd... | go | func UpdateObject(info *resource.Info, codec runtime.Codec, updateFn func(runtime.Object) error) (runtime.Object, error) {
helper := resource.NewHelper(info.Client, info.Mapping)
if err := updateFn(info.Object); err != nil {
return nil, err
}
// Update the annotation used by kubectl apply
if err := kubectl.Upd... | [
"func",
"UpdateObject",
"(",
"info",
"*",
"resource",
".",
"Info",
",",
"codec",
"runtime",
".",
"Codec",
",",
"updateFn",
"func",
"(",
"runtime",
".",
"Object",
")",
"error",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"helper",
":=",
... | // UpdateObject updates resource object with updateFn | [
"UpdateObject",
"updates",
"resource",
"object",
"with",
"updateFn"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L437-L454 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | RecordChangeCause | func RecordChangeCause(obj runtime.Object, changeCause string) error {
meta, err := api.ObjectMetaFor(obj)
if err != nil {
return err
}
if meta.Annotations == nil {
meta.Annotations = make(map[string]string)
}
meta.Annotations[kubectl.ChangeCauseAnnotation] = changeCause
return nil
} | go | func RecordChangeCause(obj runtime.Object, changeCause string) error {
meta, err := api.ObjectMetaFor(obj)
if err != nil {
return err
}
if meta.Annotations == nil {
meta.Annotations = make(map[string]string)
}
meta.Annotations[kubectl.ChangeCauseAnnotation] = changeCause
return nil
} | [
"func",
"RecordChangeCause",
"(",
"obj",
"runtime",
".",
"Object",
",",
"changeCause",
"string",
")",
"error",
"{",
"meta",
",",
"err",
":=",
"api",
".",
"ObjectMetaFor",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",... | // RecordChangeCause annotate change-cause to input runtime object. | [
"RecordChangeCause",
"annotate",
"change",
"-",
"cause",
"to",
"input",
"runtime",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L466-L476 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | ChangeResourcePatch | func ChangeResourcePatch(info *resource.Info, changeCause string) ([]byte, error) {
oldData, err := json.Marshal(info.Object)
if err != nil {
return nil, err
}
if err := RecordChangeCause(info.Object, changeCause); err != nil {
return nil, err
}
newData, err := json.Marshal(info.Object)
if err != nil {
ret... | go | func ChangeResourcePatch(info *resource.Info, changeCause string) ([]byte, error) {
oldData, err := json.Marshal(info.Object)
if err != nil {
return nil, err
}
if err := RecordChangeCause(info.Object, changeCause); err != nil {
return nil, err
}
newData, err := json.Marshal(info.Object)
if err != nil {
ret... | [
"func",
"ChangeResourcePatch",
"(",
"info",
"*",
"resource",
".",
"Info",
",",
"changeCause",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"oldData",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"info",
".",
"Object",
")",
"\n",
"i... | // ChangeResourcePatch creates a strategic merge patch between the origin input resource info
// and the annotated with change-cause input resource info. | [
"ChangeResourcePatch",
"creates",
"a",
"strategic",
"merge",
"patch",
"between",
"the",
"origin",
"input",
"resource",
"info",
"and",
"the",
"annotated",
"with",
"change",
"-",
"cause",
"input",
"resource",
"info",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L480-L493 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | ContainsChangeCause | func ContainsChangeCause(info *resource.Info) bool {
annotations, err := info.Mapping.MetadataAccessor.Annotations(info.Object)
if err != nil {
return false
}
return len(annotations[kubectl.ChangeCauseAnnotation]) > 0
} | go | func ContainsChangeCause(info *resource.Info) bool {
annotations, err := info.Mapping.MetadataAccessor.Annotations(info.Object)
if err != nil {
return false
}
return len(annotations[kubectl.ChangeCauseAnnotation]) > 0
} | [
"func",
"ContainsChangeCause",
"(",
"info",
"*",
"resource",
".",
"Info",
")",
"bool",
"{",
"annotations",
",",
"err",
":=",
"info",
".",
"Mapping",
".",
"MetadataAccessor",
".",
"Annotations",
"(",
"info",
".",
"Object",
")",
"\n",
"if",
"err",
"!=",
"n... | // containsChangeCause checks if input resource info contains change-cause annotation. | [
"containsChangeCause",
"checks",
"if",
"input",
"resource",
"info",
"contains",
"change",
"-",
"cause",
"annotation",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L496-L502 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go | ShouldRecord | func ShouldRecord(cmd *cobra.Command, info *resource.Info) bool {
return GetRecordFlag(cmd) || ContainsChangeCause(info)
} | go | func ShouldRecord(cmd *cobra.Command, info *resource.Info) bool {
return GetRecordFlag(cmd) || ContainsChangeCause(info)
} | [
"func",
"ShouldRecord",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"info",
"*",
"resource",
".",
"Info",
")",
"bool",
"{",
"return",
"GetRecordFlag",
"(",
"cmd",
")",
"||",
"ContainsChangeCause",
"(",
"info",
")",
"\n",
"}"
] | // ShouldRecord checks if we should record current change cause | [
"ShouldRecord",
"checks",
"if",
"we",
"should",
"record",
"current",
"change",
"cause"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go#L505-L507 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go | newBuffer | func newBuffer() *buffer {
e := new(element)
b := &buffer{
Cond: newCond(),
head: e,
tail: e,
}
return b
} | go | func newBuffer() *buffer {
e := new(element)
b := &buffer{
Cond: newCond(),
head: e,
tail: e,
}
return b
} | [
"func",
"newBuffer",
"(",
")",
"*",
"buffer",
"{",
"e",
":=",
"new",
"(",
"element",
")",
"\n",
"b",
":=",
"&",
"buffer",
"{",
"Cond",
":",
"newCond",
"(",
")",
",",
"head",
":",
"e",
",",
"tail",
":",
"e",
",",
"}",
"\n",
"return",
"b",
"\n"... | // newBuffer returns an empty buffer that is not closed. | [
"newBuffer",
"returns",
"an",
"empty",
"buffer",
"that",
"is",
"not",
"closed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go#L32-L40 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go | write | func (b *buffer) write(buf []byte) {
b.Cond.L.Lock()
e := &element{buf: buf}
b.tail.next = e
b.tail = e
b.Cond.Signal()
b.Cond.L.Unlock()
} | go | func (b *buffer) write(buf []byte) {
b.Cond.L.Lock()
e := &element{buf: buf}
b.tail.next = e
b.tail = e
b.Cond.Signal()
b.Cond.L.Unlock()
} | [
"func",
"(",
"b",
"*",
"buffer",
")",
"write",
"(",
"buf",
"[",
"]",
"byte",
")",
"{",
"b",
".",
"Cond",
".",
"L",
".",
"Lock",
"(",
")",
"\n",
"e",
":=",
"&",
"element",
"{",
"buf",
":",
"buf",
"}",
"\n",
"b",
".",
"tail",
".",
"next",
"... | // write makes buf available for Read to receive.
// buf must not be modified after the call to write. | [
"write",
"makes",
"buf",
"available",
"for",
"Read",
"to",
"receive",
".",
"buf",
"must",
"not",
"be",
"modified",
"after",
"the",
"call",
"to",
"write",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go#L44-L51 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go | eof | func (b *buffer) eof() error {
b.Cond.L.Lock()
b.closed = true
b.Cond.Signal()
b.Cond.L.Unlock()
return nil
} | go | func (b *buffer) eof() error {
b.Cond.L.Lock()
b.closed = true
b.Cond.Signal()
b.Cond.L.Unlock()
return nil
} | [
"func",
"(",
"b",
"*",
"buffer",
")",
"eof",
"(",
")",
"error",
"{",
"b",
".",
"Cond",
".",
"L",
".",
"Lock",
"(",
")",
"\n",
"b",
".",
"closed",
"=",
"true",
"\n",
"b",
".",
"Cond",
".",
"Signal",
"(",
")",
"\n",
"b",
".",
"Cond",
".",
"... | // eof closes the buffer. Reads from the buffer once all
// the data has been consumed will receive os.EOF. | [
"eof",
"closes",
"the",
"buffer",
".",
"Reads",
"from",
"the",
"buffer",
"once",
"all",
"the",
"data",
"has",
"been",
"consumed",
"will",
"receive",
"os",
".",
"EOF",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go#L55-L61 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go | Read | func (b *buffer) Read(buf []byte) (n int, err error) {
b.Cond.L.Lock()
defer b.Cond.L.Unlock()
for len(buf) > 0 {
// if there is data in b.head, copy it
if len(b.head.buf) > 0 {
r := copy(buf, b.head.buf)
buf, b.head.buf = buf[r:], b.head.buf[r:]
n += r
continue
}
// if there is a next buffer, m... | go | func (b *buffer) Read(buf []byte) (n int, err error) {
b.Cond.L.Lock()
defer b.Cond.L.Unlock()
for len(buf) > 0 {
// if there is data in b.head, copy it
if len(b.head.buf) > 0 {
r := copy(buf, b.head.buf)
buf, b.head.buf = buf[r:], b.head.buf[r:]
n += r
continue
}
// if there is a next buffer, m... | [
"func",
"(",
"b",
"*",
"buffer",
")",
"Read",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"b",
".",
"Cond",
".",
"L",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"Cond",
".",
"L",
".",
"Unlock",
... | // Read reads data from the internal buffer in buf. Reads will block
// if no data is available, or until the buffer is closed. | [
"Read",
"reads",
"data",
"from",
"the",
"internal",
"buffer",
"in",
"buf",
".",
"Reads",
"will",
"block",
"if",
"no",
"data",
"is",
"available",
"or",
"until",
"the",
"buffer",
"is",
"closed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go#L65-L98 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateHorizontalPodAutoscalerName | func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string) {
// TODO: finally move it to pkg/api/validation and use nameIsDNSSubdomain function
return apivalidation.ValidateReplicationControllerName(name, prefix)
} | go | func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string) {
// TODO: finally move it to pkg/api/validation and use nameIsDNSSubdomain function
return apivalidation.ValidateReplicationControllerName(name, prefix)
} | [
"func",
"ValidateHorizontalPodAutoscalerName",
"(",
"name",
"string",
",",
"prefix",
"bool",
")",
"(",
"bool",
",",
"string",
")",
"{",
"// TODO: finally move it to pkg/api/validation and use nameIsDNSSubdomain function",
"return",
"apivalidation",
".",
"ValidateReplicationCont... | // ValidateHorizontalPodAutoscaler can be used to check whether the given autoscaler name is valid.
// Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed. | [
"ValidateHorizontalPodAutoscaler",
"can",
"be",
"used",
"to",
"check",
"whether",
"the",
"given",
"autoscaler",
"name",
"is",
"valid",
".",
"Prefix",
"indicates",
"this",
"name",
"will",
"be",
"used",
"as",
"part",
"of",
"generation",
"in",
"which",
"case",
"t... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L38-L41 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateDaemonSetName | func ValidateDaemonSetName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | go | func ValidateDaemonSetName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | [
"func",
"ValidateDaemonSetName",
"(",
"name",
"string",
",",
"prefix",
"bool",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"apivalidation",
".",
"NameIsDNSSubdomain",
"(",
"name",
",",
"prefix",
")",
"\n",
"}"
] | // ValidateDaemonSetName can be used to check whether the given daemon set name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed. | [
"ValidateDaemonSetName",
"can",
"be",
"used",
"to",
"check",
"whether",
"the",
"given",
"daemon",
"set",
"name",
"is",
"valid",
".",
"Prefix",
"indicates",
"this",
"name",
"will",
"be",
"used",
"as",
"part",
"of",
"generation",
"in",
"which",
"case",
"traili... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L212-L214 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateDeploymentName | func ValidateDeploymentName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | go | func ValidateDeploymentName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | [
"func",
"ValidateDeploymentName",
"(",
"name",
"string",
",",
"prefix",
"bool",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"apivalidation",
".",
"NameIsDNSSubdomain",
"(",
"name",
",",
"prefix",
")",
"\n",
"}"
] | // Validates that the given name can be used as a deployment name. | [
"Validates",
"that",
"the",
"given",
"name",
"can",
"be",
"used",
"as",
"a",
"deployment",
"name",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L217-L219 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateDeploymentSpec | func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, fldPath.Child("selector"))...)
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Repl... | go | func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, fldPath.Child("selector"))...)
allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Repl... | [
"func",
"ValidateDeploymentSpec",
"(",
"spec",
"*",
"extensions",
".",
"DeploymentSpec",
",",
"fldPath",
"*",
"field",
".",
"Path",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n",
"allErrs",
"=",
"append",
"... | // Validates given deployment spec. | [
"Validates",
"given",
"deployment",
"spec",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L288-L299 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateIngressName | func ValidateIngressName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | go | func ValidateIngressName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | [
"func",
"ValidateIngressName",
"(",
"name",
"string",
",",
"prefix",
"bool",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"apivalidation",
".",
"NameIsDNSSubdomain",
"(",
"name",
",",
"prefix",
")",
"\n",
"}"
] | // ValidateIngressName validates that the given name can be used as an Ingress name. | [
"ValidateIngressName",
"validates",
"that",
"the",
"given",
"name",
"can",
"be",
"used",
"as",
"an",
"Ingress",
"name",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L409-L411 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go | ValidateConfigMapName | func ValidateConfigMapName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | go | func ValidateConfigMapName(name string, prefix bool) (bool, string) {
return apivalidation.NameIsDNSSubdomain(name, prefix)
} | [
"func",
"ValidateConfigMapName",
"(",
"name",
"string",
",",
"prefix",
"bool",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"apivalidation",
".",
"NameIsDNSSubdomain",
"(",
"name",
",",
"prefix",
")",
"\n",
"}"
] | // ValidateConfigMapName can be used to check whether the given ConfigMap name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed. | [
"ValidateConfigMapName",
"can",
"be",
"used",
"to",
"check",
"whether",
"the",
"given",
"ConfigMap",
"name",
"is",
"valid",
".",
"Prefix",
"indicates",
"this",
"name",
"will",
"be",
"used",
"as",
"part",
"of",
"generation",
"in",
"which",
"case",
"trailing",
... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go#L604-L606 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/credentialprovider/keyring.go | Lookup | func (dk *BasicDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) {
// range over the index as iterating over a map does not provide a predictable ordering
ret := []docker.AuthConfiguration{}
for _, k := range dk.index {
// both k and image are schemeless URLs because even though schemes are al... | go | func (dk *BasicDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) {
// range over the index as iterating over a map does not provide a predictable ordering
ret := []docker.AuthConfiguration{}
for _, k := range dk.index {
// both k and image are schemeless URLs because even though schemes are al... | [
"func",
"(",
"dk",
"*",
"BasicDockerKeyring",
")",
"Lookup",
"(",
"image",
"string",
")",
"(",
"[",
"]",
"docker",
".",
"AuthConfiguration",
",",
"bool",
")",
"{",
"// range over the index as iterating over a map does not provide a predictable ordering",
"ret",
":=",
... | // Lookup implements the DockerKeyring method for fetching credentials based on image name.
// Multiple credentials may be returned if there are multiple potentially valid credentials
// available. This allows for rotation. | [
"Lookup",
"implements",
"the",
"DockerKeyring",
"method",
"for",
"fetching",
"credentials",
"based",
"on",
"image",
"name",
".",
"Multiple",
"credentials",
"may",
"be",
"returned",
"if",
"there",
"are",
"multiple",
"potentially",
"valid",
"credentials",
"available",... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/credentialprovider/keyring.go#L218-L243 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/credentialprovider/keyring.go | Lookup | func (dk *lazyDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) {
keyring := &BasicDockerKeyring{}
for _, p := range dk.Providers {
keyring.Add(p.Provide())
}
return keyring.Lookup(image)
} | go | func (dk *lazyDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) {
keyring := &BasicDockerKeyring{}
for _, p := range dk.Providers {
keyring.Add(p.Provide())
}
return keyring.Lookup(image)
} | [
"func",
"(",
"dk",
"*",
"lazyDockerKeyring",
")",
"Lookup",
"(",
"image",
"string",
")",
"(",
"[",
"]",
"docker",
".",
"AuthConfiguration",
",",
"bool",
")",
"{",
"keyring",
":=",
"&",
"BasicDockerKeyring",
"{",
"}",
"\n\n",
"for",
"_",
",",
"p",
":=",... | // Lookup implements the DockerKeyring method for fetching credentials
// based on image name. | [
"Lookup",
"implements",
"the",
"DockerKeyring",
"method",
"for",
"fetching",
"credentials",
"based",
"on",
"image",
"name",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/credentialprovider/keyring.go#L247-L255 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go | RequestAgentForwarding | func RequestAgentForwarding(session *ssh.Session) error {
ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
if err != nil {
return err
}
if !ok {
return errors.New("forwarding request denied")
}
return nil
} | go | func RequestAgentForwarding(session *ssh.Session) error {
ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
if err != nil {
return err
}
if !ok {
return errors.New("forwarding request denied")
}
return nil
} | [
"func",
"RequestAgentForwarding",
"(",
"session",
"*",
"ssh",
".",
"Session",
")",
"error",
"{",
"ok",
",",
"err",
":=",
"session",
".",
"SendRequest",
"(",
"\"",
"\"",
",",
"true",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err... | // RequestAgentForwarding sets up agent forwarding for the session.
// ForwardToAgent or ForwardToRemote should be called to route
// the authentication requests. | [
"RequestAgentForwarding",
"sets",
"up",
"agent",
"forwarding",
"for",
"the",
"session",
".",
"ForwardToAgent",
"or",
"ForwardToRemote",
"should",
"be",
"called",
"to",
"route",
"the",
"authentication",
"requests",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go#L19-L28 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go | ForwardToAgent | func ForwardToAgent(client *ssh.Client, keyring Agent) error {
channels := client.HandleChannelOpen(channelType)
if channels == nil {
return errors.New("agent: already have handler for " + channelType)
}
go func() {
for ch := range channels {
channel, reqs, err := ch.Accept()
if err != nil {
continue... | go | func ForwardToAgent(client *ssh.Client, keyring Agent) error {
channels := client.HandleChannelOpen(channelType)
if channels == nil {
return errors.New("agent: already have handler for " + channelType)
}
go func() {
for ch := range channels {
channel, reqs, err := ch.Accept()
if err != nil {
continue... | [
"func",
"ForwardToAgent",
"(",
"client",
"*",
"ssh",
".",
"Client",
",",
"keyring",
"Agent",
")",
"error",
"{",
"channels",
":=",
"client",
".",
"HandleChannelOpen",
"(",
"channelType",
")",
"\n",
"if",
"channels",
"==",
"nil",
"{",
"return",
"errors",
"."... | // ForwardToAgent routes authentication requests to the given keyring. | [
"ForwardToAgent",
"routes",
"authentication",
"requests",
"to",
"the",
"given",
"keyring",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go#L31-L51 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go | ForwardToRemote | func ForwardToRemote(client *ssh.Client, addr string) error {
channels := client.HandleChannelOpen(channelType)
if channels == nil {
return errors.New("agent: already have handler for " + channelType)
}
conn, err := net.Dial("unix", addr)
if err != nil {
return err
}
conn.Close()
go func() {
for ch := ra... | go | func ForwardToRemote(client *ssh.Client, addr string) error {
channels := client.HandleChannelOpen(channelType)
if channels == nil {
return errors.New("agent: already have handler for " + channelType)
}
conn, err := net.Dial("unix", addr)
if err != nil {
return err
}
conn.Close()
go func() {
for ch := ra... | [
"func",
"ForwardToRemote",
"(",
"client",
"*",
"ssh",
".",
"Client",
",",
"addr",
"string",
")",
"error",
"{",
"channels",
":=",
"client",
".",
"HandleChannelOpen",
"(",
"channelType",
")",
"\n",
"if",
"channels",
"==",
"nil",
"{",
"return",
"errors",
".",... | // ForwardToRemote routes authentication requests to the ssh-agent
// process serving on the given unix socket. | [
"ForwardToRemote",
"routes",
"authentication",
"requests",
"to",
"the",
"ssh",
"-",
"agent",
"process",
"serving",
"on",
"the",
"given",
"unix",
"socket",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go#L57-L79 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go | Create | func (c *namespaces) Create(namespace *api.Namespace) (*api.Namespace, error) {
result := &api.Namespace{}
err := c.r.Post().Resource("namespaces").Body(namespace).Do().Into(result)
return result, err
} | go | func (c *namespaces) Create(namespace *api.Namespace) (*api.Namespace, error) {
result := &api.Namespace{}
err := c.r.Post().Resource("namespaces").Body(namespace).Do().Into(result)
return result, err
} | [
"func",
"(",
"c",
"*",
"namespaces",
")",
"Create",
"(",
"namespace",
"*",
"api",
".",
"Namespace",
")",
"(",
"*",
"api",
".",
"Namespace",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"Namespace",
"{",
"}",
"\n",
"err",
":=",
"c",
".... | // Create creates a new namespace. | [
"Create",
"creates",
"a",
"new",
"namespace",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go#L52-L56 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go | List | func (c *namespaces) List(opts api.ListOptions) (*api.NamespaceList, error) {
result := &api.NamespaceList{}
err := c.r.Get().
Resource("namespaces").
VersionedParams(&opts, api.Scheme).
Do().Into(result)
return result, err
} | go | func (c *namespaces) List(opts api.ListOptions) (*api.NamespaceList, error) {
result := &api.NamespaceList{}
err := c.r.Get().
Resource("namespaces").
VersionedParams(&opts, api.Scheme).
Do().Into(result)
return result, err
} | [
"func",
"(",
"c",
"*",
"namespaces",
")",
"List",
"(",
"opts",
"api",
".",
"ListOptions",
")",
"(",
"*",
"api",
".",
"NamespaceList",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"NamespaceList",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
... | // List lists all the namespaces in the cluster. | [
"List",
"lists",
"all",
"the",
"namespaces",
"in",
"the",
"cluster",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go#L59-L66 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go | Update | func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) {
result = &api.Namespace{}
if len(namespace.ResourceVersion) == 0 {
err = fmt.Errorf("invalid update object, missing resource version: %v", namespace)
return
}
err = c.r.Put().Resource("namespaces").Name(namespace.Name).Bo... | go | func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) {
result = &api.Namespace{}
if len(namespace.ResourceVersion) == 0 {
err = fmt.Errorf("invalid update object, missing resource version: %v", namespace)
return
}
err = c.r.Put().Resource("namespaces").Name(namespace.Name).Bo... | [
"func",
"(",
"c",
"*",
"namespaces",
")",
"Update",
"(",
"namespace",
"*",
"api",
".",
"Namespace",
")",
"(",
"result",
"*",
"api",
".",
"Namespace",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"api",
".",
"Namespace",
"{",
"}",
"\n",
"if",
... | // Update takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs. | [
"Update",
"takes",
"the",
"representation",
"of",
"a",
"namespace",
"to",
"update",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"namespace",
"and",
"an",
"error",
"if",
"it",
"occurs",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go#L69-L77 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go | Delete | func (c *namespaces) Delete(name string) error {
return c.r.Delete().Resource("namespaces").Name(name).Do().Error()
} | go | func (c *namespaces) Delete(name string) error {
return c.r.Delete().Resource("namespaces").Name(name).Do().Error()
} | [
"func",
"(",
"c",
"*",
"namespaces",
")",
"Delete",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"r",
".",
"Delete",
"(",
")",
".",
"Resource",
"(",
"\"",
"\"",
")",
".",
"Name",
"(",
"name",
")",
".",
"Do",
"(",
")",
".",
"E... | // Delete deletes an existing namespace. | [
"Delete",
"deletes",
"an",
"existing",
"namespace",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go#L109-L111 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go | ReplaceType | func (g *deepCopyGenerator) ReplaceType(pkgPath, name string, t interface{}) {
g.replace[pkgPathNamePair{pkgPath, name}] = reflect.TypeOf(t)
} | go | func (g *deepCopyGenerator) ReplaceType(pkgPath, name string, t interface{}) {
g.replace[pkgPathNamePair{pkgPath, name}] = reflect.TypeOf(t)
} | [
"func",
"(",
"g",
"*",
"deepCopyGenerator",
")",
"ReplaceType",
"(",
"pkgPath",
",",
"name",
"string",
",",
"t",
"interface",
"{",
"}",
")",
"{",
"g",
".",
"replace",
"[",
"pkgPathNamePair",
"{",
"pkgPath",
",",
"name",
"}",
"]",
"=",
"reflect",
".",
... | // ReplaceType registers a replacement type to be used instead of the named type | [
"ReplaceType",
"registers",
"a",
"replacement",
"type",
"to",
"be",
"used",
"instead",
"of",
"the",
"named",
"type"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go#L197-L199 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/decode.go | Decode | func (s *Scheme) Decode(data []byte) (interface{}, error) {
return s.DecodeToVersion(data, unversioned.GroupVersion{})
} | go | func (s *Scheme) Decode(data []byte) (interface{}, error) {
return s.DecodeToVersion(data, unversioned.GroupVersion{})
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"Decode",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"s",
".",
"DecodeToVersion",
"(",
"data",
",",
"unversioned",
".",
"GroupVersion",
"{",
"}",
")",
"\n"... | // Decode converts a JSON string back into a pointer to an api object.
// Deduces the type based upon the fields added by the MetaInsertionFactory
// technique. The object will be converted, if necessary, into the
// s.InternalVersion type before being returned. Decode will not decode
// objects without version set unl... | [
"Decode",
"converts",
"a",
"JSON",
"string",
"back",
"into",
"a",
"pointer",
"to",
"an",
"api",
"object",
".",
"Deduces",
"the",
"type",
"based",
"upon",
"the",
"fields",
"added",
"by",
"the",
"MetaInsertionFactory",
"technique",
".",
"The",
"object",
"will"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/decode.go#L66-L68 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/decode.go | DecodeInto | func (s *Scheme) DecodeInto(data []byte, obj interface{}) error {
return s.DecodeIntoWithSpecifiedVersionKind(data, obj, unversioned.GroupVersionKind{})
} | go | func (s *Scheme) DecodeInto(data []byte, obj interface{}) error {
return s.DecodeIntoWithSpecifiedVersionKind(data, obj, unversioned.GroupVersionKind{})
} | [
"func",
"(",
"s",
"*",
"Scheme",
")",
"DecodeInto",
"(",
"data",
"[",
"]",
"byte",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"s",
".",
"DecodeIntoWithSpecifiedVersionKind",
"(",
"data",
",",
"obj",
",",
"unversioned",
".",
"GroupVer... | // DecodeInto parses a JSON string and stores it in obj. Returns an error
// if data.Kind is set and doesn't match the type of obj. Obj should be a
// pointer to an api type.
// If obj's version doesn't match that in data, an attempt will be made to convert
// data into obj's version. | [
"DecodeInto",
"parses",
"a",
"JSON",
"string",
"and",
"stores",
"it",
"in",
"obj",
".",
"Returns",
"an",
"error",
"if",
"data",
".",
"Kind",
"is",
"set",
"and",
"doesn",
"t",
"match",
"the",
"type",
"of",
"obj",
".",
"Obj",
"should",
"be",
"a",
"poin... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/decode.go#L117-L119 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go | newServiceAccounts | func newServiceAccounts(c *Client, ns string) ServiceAccountsInterface {
return &serviceAccounts{
client: c,
namespace: ns,
}
} | go | func newServiceAccounts(c *Client, ns string) ServiceAccountsInterface {
return &serviceAccounts{
client: c,
namespace: ns,
}
} | [
"func",
"newServiceAccounts",
"(",
"c",
"*",
"Client",
",",
"ns",
"string",
")",
"ServiceAccountsInterface",
"{",
"return",
"&",
"serviceAccounts",
"{",
"client",
":",
"c",
",",
"namespace",
":",
"ns",
",",
"}",
"\n",
"}"
] | // newServiceAccounts returns a new serviceAccounts object. | [
"newServiceAccounts",
"returns",
"a",
"new",
"serviceAccounts",
"object",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go#L44-L49 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go | List | func (s *serviceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) {
result := &api.ServiceAccountList{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.Scheme).
Do().
Into(result)
return result, err
} | go | func (s *serviceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) {
result := &api.ServiceAccountList{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.Scheme).
Do().
Into(result)
return result, err
} | [
"func",
"(",
"s",
"*",
"serviceAccounts",
")",
"List",
"(",
"opts",
"api",
".",
"ListOptions",
")",
"(",
"*",
"api",
".",
"ServiceAccountList",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"ServiceAccountList",
"{",
"}",
"\n\n",
"err",
":="... | // List returns a list of serviceAccounts matching the selectors. | [
"List",
"returns",
"a",
"list",
"of",
"serviceAccounts",
"matching",
"the",
"selectors",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go#L64-L75 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go | Get | func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) {
result := &api.ServiceAccount{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
Name(name).
Do().
Into(result)
return result, err
} | go | func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) {
result := &api.ServiceAccount{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
Name(name).
Do().
Into(result)
return result, err
} | [
"func",
"(",
"s",
"*",
"serviceAccounts",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ServiceAccount",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"ServiceAccount",
"{",
"}",
"\n",
"err",
":=",
"s",
".",
"client",
".... | // Get returns the given serviceAccount, or an error. | [
"Get",
"returns",
"the",
"given",
"serviceAccount",
"or",
"an",
"error",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go#L78-L88 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go | Watch | func (s *serviceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.Scheme).
Watch()
} | go | func (s *serviceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.Scheme).
Watch()
} | [
"func",
"(",
"s",
"*",
"serviceAccounts",
")",
"Watch",
"(",
"opts",
"api",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"s",
".",
"client",
".",
"Get",
"(",
")",
".",
"Prefix",
"(",
"\"",
"\"",
")",
... | // Watch starts watching for serviceAccounts matching the given selectors. | [
"Watch",
"starts",
"watching",
"for",
"serviceAccounts",
"matching",
"the",
"given",
"selectors",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go#L91-L98 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/config/config.go | Channel | func (m *Mux) Channel(source string) chan interface{} {
if len(source) == 0 {
panic("Channel given an empty name")
}
m.sourceLock.Lock()
defer m.sourceLock.Unlock()
channel, exists := m.sources[source]
if exists {
return channel
}
newChannel := make(chan interface{})
m.sources[source] = newChannel
go util... | go | func (m *Mux) Channel(source string) chan interface{} {
if len(source) == 0 {
panic("Channel given an empty name")
}
m.sourceLock.Lock()
defer m.sourceLock.Unlock()
channel, exists := m.sources[source]
if exists {
return channel
}
newChannel := make(chan interface{})
m.sources[source] = newChannel
go util... | [
"func",
"(",
"m",
"*",
"Mux",
")",
"Channel",
"(",
"source",
"string",
")",
"chan",
"interface",
"{",
"}",
"{",
"if",
"len",
"(",
"source",
")",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"m",
".",
"sourceLock",
".",
"Lock"... | // Channel returns a channel where a configuration source
// can send updates of new configurations. Multiple calls with the same
// source will return the same channel. This allows change and state based sources
// to use the same channel. Different source names however will be treated as a
// union. | [
"Channel",
"returns",
"a",
"channel",
"where",
"a",
"configuration",
"source",
"can",
"send",
"updates",
"of",
"new",
"configurations",
".",
"Multiple",
"calls",
"with",
"the",
"same",
"source",
"will",
"return",
"the",
"same",
"channel",
".",
"This",
"allows"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/config/config.go#L65-L79 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go | ClientForMapping | func (f ClientMapperFunc) ClientForMapping(mapping *meta.RESTMapping) (RESTClient, error) {
return f(mapping)
} | go | func (f ClientMapperFunc) ClientForMapping(mapping *meta.RESTMapping) (RESTClient, error) {
return f(mapping)
} | [
"func",
"(",
"f",
"ClientMapperFunc",
")",
"ClientForMapping",
"(",
"mapping",
"*",
"meta",
".",
"RESTMapping",
")",
"(",
"RESTClient",
",",
"error",
")",
"{",
"return",
"f",
"(",
"mapping",
")",
"\n",
"}"
] | // ClientForMapping implements ClientMapper | [
"ClientForMapping",
"implements",
"ClientMapper"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go#L44-L46 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/ssh.go | Open | func (l *SSHTunnelList) Open() error {
var openTunnels []SSHTunnelEntry
for ix := range l.entries {
if err := l.entries[ix].Tunnel.Open(); err != nil {
glog.Errorf("Failed to open tunnel %v: %v", l.entries[ix], err)
} else {
openTunnels = append(openTunnels, l.entries[ix])
}
}
l.entries = openTunnels
i... | go | func (l *SSHTunnelList) Open() error {
var openTunnels []SSHTunnelEntry
for ix := range l.entries {
if err := l.entries[ix].Tunnel.Open(); err != nil {
glog.Errorf("Failed to open tunnel %v: %v", l.entries[ix], err)
} else {
openTunnels = append(openTunnels, l.entries[ix])
}
}
l.entries = openTunnels
i... | [
"func",
"(",
"l",
"*",
"SSHTunnelList",
")",
"Open",
"(",
")",
"error",
"{",
"var",
"openTunnels",
"[",
"]",
"SSHTunnelEntry",
"\n",
"for",
"ix",
":=",
"range",
"l",
".",
"entries",
"{",
"if",
"err",
":=",
"l",
".",
"entries",
"[",
"ix",
"]",
".",
... | // Open attempts to open all tunnels in the list, and removes any tunnels that
// failed to open. | [
"Open",
"attempts",
"to",
"open",
"all",
"tunnels",
"in",
"the",
"list",
"and",
"removes",
"any",
"tunnels",
"that",
"failed",
"to",
"open",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/ssh.go#L269-L283 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/ssh.go | Close | func (l *SSHTunnelList) Close() {
for ix := range l.entries {
entry := l.entries[ix]
go func() {
defer HandleCrash()
time.Sleep(1 * time.Minute)
if err := entry.Tunnel.Close(); err != nil {
glog.Errorf("Failed to close tunnel %v: %v", entry, err)
}
}()
}
} | go | func (l *SSHTunnelList) Close() {
for ix := range l.entries {
entry := l.entries[ix]
go func() {
defer HandleCrash()
time.Sleep(1 * time.Minute)
if err := entry.Tunnel.Close(); err != nil {
glog.Errorf("Failed to close tunnel %v: %v", entry, err)
}
}()
}
} | [
"func",
"(",
"l",
"*",
"SSHTunnelList",
")",
"Close",
"(",
")",
"{",
"for",
"ix",
":=",
"range",
"l",
".",
"entries",
"{",
"entry",
":=",
"l",
".",
"entries",
"[",
"ix",
"]",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"HandleCrash",
"(",
")",
... | // Close asynchronously closes all tunnels in the list after waiting for 1
// minute. Tunnels will still be open upon this function's return, but should
// no longer be used. | [
"Close",
"asynchronously",
"closes",
"all",
"tunnels",
"in",
"the",
"list",
"after",
"waiting",
"for",
"1",
"minute",
".",
"Tunnels",
"will",
"still",
"be",
"open",
"upon",
"this",
"function",
"s",
"return",
"but",
"should",
"no",
"longer",
"be",
"used",
"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/ssh.go#L288-L299 | train |
kubernetes-retired/contrib | docker-micro-benchmark/helpers/helpers.go | LogEVar | func LogEVar(vars map[string]interface{}) {
for k, v := range vars {
fmt.Printf("%s=%v ", k, v)
}
fmt.Println()
} | go | func LogEVar(vars map[string]interface{}) {
for k, v := range vars {
fmt.Printf("%s=%v ", k, v)
}
fmt.Println()
} | [
"func",
"LogEVar",
"(",
"vars",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"vars",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Printl... | // LogEVar prints all the environment variables | [
"LogEVar",
"prints",
"all",
"the",
"environment",
"variables"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/helpers/helpers.go#L48-L53 | train |
kubernetes-retired/contrib | docker-micro-benchmark/helpers/helpers.go | LogLabels | func LogLabels(labels ...string) {
content := "time\t"
for _, percentile := range percentiles {
content += fmt.Sprintf("%%%02d\t", int(percentile*100))
}
content += strings.Join(labels, "\t")
fmt.Println(content)
} | go | func LogLabels(labels ...string) {
content := "time\t"
for _, percentile := range percentiles {
content += fmt.Sprintf("%%%02d\t", int(percentile*100))
}
content += strings.Join(labels, "\t")
fmt.Println(content)
} | [
"func",
"LogLabels",
"(",
"labels",
"...",
"string",
")",
"{",
"content",
":=",
"\"",
"\\t",
"\"",
"\n",
"for",
"_",
",",
"percentile",
":=",
"range",
"percentiles",
"{",
"content",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\"",
",",
"int",
"("... | // LogLabels prints the labels of the result table | [
"LogLabels",
"prints",
"the",
"labels",
"of",
"the",
"result",
"table"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/helpers/helpers.go#L56-L63 | train |
kubernetes-retired/contrib | docker-micro-benchmark/helpers/helpers.go | LogResult | func LogResult(latencies []int, variables ...string) {
sort.Ints(latencies)
results := []float64{}
for _, percentile := range percentiles {
n := int(math.Ceil((1 - percentile) * float64(len(latencies))))
result := float64(latencies[len(latencies)-n]) / 1000000
results = append(results, result)
}
var str stri... | go | func LogResult(latencies []int, variables ...string) {
sort.Ints(latencies)
results := []float64{}
for _, percentile := range percentiles {
n := int(math.Ceil((1 - percentile) * float64(len(latencies))))
result := float64(latencies[len(latencies)-n]) / 1000000
results = append(results, result)
}
var str stri... | [
"func",
"LogResult",
"(",
"latencies",
"[",
"]",
"int",
",",
"variables",
"...",
"string",
")",
"{",
"sort",
".",
"Ints",
"(",
"latencies",
")",
"\n",
"results",
":=",
"[",
"]",
"float64",
"{",
"}",
"\n",
"for",
"_",
",",
"percentile",
":=",
"range",... | // LogResult prints the item of the result table | [
"LogResult",
"prints",
"the",
"item",
"of",
"the",
"result",
"table"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/helpers/helpers.go#L66-L79 | train |
kubernetes-retired/contrib | docker-micro-benchmark/helpers/helpers.go | Itoas | func Itoas(nums ...int) []string {
r := []string{}
for _, n := range nums {
r = append(r, fmt.Sprintf("%d", n))
}
return r
} | go | func Itoas(nums ...int) []string {
r := []string{}
for _, n := range nums {
r = append(r, fmt.Sprintf("%d", n))
}
return r
} | [
"func",
"Itoas",
"(",
"nums",
"...",
"int",
")",
"[",
"]",
"string",
"{",
"r",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"nums",
"{",
"r",
"=",
"append",
"(",
"r",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
... | // Itoas converts int numbers to a slice of string | [
"Itoas",
"converts",
"int",
"numbers",
"to",
"a",
"slice",
"of",
"string"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/helpers/helpers.go#L82-L88 | train |
kubernetes-retired/contrib | docker-micro-benchmark/helpers/helpers.go | Ftoas | func Ftoas(nums ...float64) []string {
r := []string{}
for _, n := range nums {
r = append(r, fmt.Sprintf("%0.4f", n))
}
return r
} | go | func Ftoas(nums ...float64) []string {
r := []string{}
for _, n := range nums {
r = append(r, fmt.Sprintf("%0.4f", n))
}
return r
} | [
"func",
"Ftoas",
"(",
"nums",
"...",
"float64",
")",
"[",
"]",
"string",
"{",
"r",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"nums",
"{",
"r",
"=",
"append",
"(",
"r",
",",
"fmt",
".",
"Sprintf",
"(",
"\""... | // Ftoas converts float64 numbers to a slice of string | [
"Ftoas",
"converts",
"float64",
"numbers",
"to",
"a",
"slice",
"of",
"string"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/helpers/helpers.go#L91-L97 | train |
kubernetes-retired/contrib | docker-micro-benchmark/Godeps/_workspace/src/golang.org/x/net/proxy/per_host.go | Dial | func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) {
host, _, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
return p.dialerForRequest(host).Dial(network, addr)
} | go | func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) {
host, _, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
return p.dialerForRequest(host).Dial(network, addr)
} | [
"func",
"(",
"p",
"*",
"PerHost",
")",
"Dial",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"c",
"net",
".",
"Conn",
",",
"err",
"error",
")",
"{",
"host",
",",
"_",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"addr",
")",
"\n",
"if... | // Dial connects to the address addr on the given network through either
// defaultDialer or bypass. | [
"Dial",
"connects",
"to",
"the",
"address",
"addr",
"on",
"the",
"given",
"network",
"through",
"either",
"defaultDialer",
"or",
"bypass",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/Godeps/_workspace/src/golang.org/x/net/proxy/per_host.go#L35-L42 | train |
kubernetes-retired/contrib | docker-micro-benchmark/Godeps/_workspace/src/golang.org/x/net/proxy/per_host.go | AddHost | func (p *PerHost) AddHost(host string) {
if strings.HasSuffix(host, ".") {
host = host[:len(host)-1]
}
p.bypassHosts = append(p.bypassHosts, host)
} | go | func (p *PerHost) AddHost(host string) {
if strings.HasSuffix(host, ".") {
host = host[:len(host)-1]
}
p.bypassHosts = append(p.bypassHosts, host)
} | [
"func",
"(",
"p",
"*",
"PerHost",
")",
"AddHost",
"(",
"host",
"string",
")",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"host",
",",
"\"",
"\"",
")",
"{",
"host",
"=",
"host",
"[",
":",
"len",
"(",
"host",
")",
"-",
"1",
"]",
"\n",
"}",
"\... | // AddHost specifies a hostname that will use the bypass proxy. | [
"AddHost",
"specifies",
"a",
"hostname",
"that",
"will",
"use",
"the",
"bypass",
"proxy",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/docker-micro-benchmark/Godeps/_workspace/src/golang.org/x/net/proxy/per_host.go#L135-L140 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/io/io.go | SavePodToFile | func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error {
if filePath == "" {
return fmt.Errorf("file path not specified")
}
data, err := latest.GroupOrDie(api.GroupName).Codec.Encode(pod)
if err != nil {
return fmt.Errorf("failed encoding pod: %v", err)
}
return ioutil.WriteFile(filePath, d... | go | func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error {
if filePath == "" {
return fmt.Errorf("file path not specified")
}
data, err := latest.GroupOrDie(api.GroupName).Codec.Encode(pod)
if err != nil {
return fmt.Errorf("failed encoding pod: %v", err)
}
return ioutil.WriteFile(filePath, d... | [
"func",
"SavePodToFile",
"(",
"pod",
"*",
"api",
".",
"Pod",
",",
"filePath",
"string",
",",
"perm",
"os",
".",
"FileMode",
")",
"error",
"{",
"if",
"filePath",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",... | // SavePodToFile will encode and save a pod to a given path & permissions | [
"SavePodToFile",
"will",
"encode",
"and",
"save",
"a",
"pod",
"to",
"a",
"given",
"path",
"&",
"permissions"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/io/io.go#L49-L58 | train |
kubernetes-retired/contrib | node-perf-dash/downloader.go | NewGoogleGCSDownloader | func NewGoogleGCSDownloader() *GoogleGCSDownloader {
return &GoogleGCSDownloader{
GoogleGCSBucketUtils: utils.NewUtils(utils.KubekinsBucket, utils.LogDir),
}
} | go | func NewGoogleGCSDownloader() *GoogleGCSDownloader {
return &GoogleGCSDownloader{
GoogleGCSBucketUtils: utils.NewUtils(utils.KubekinsBucket, utils.LogDir),
}
} | [
"func",
"NewGoogleGCSDownloader",
"(",
")",
"*",
"GoogleGCSDownloader",
"{",
"return",
"&",
"GoogleGCSDownloader",
"{",
"GoogleGCSBucketUtils",
":",
"utils",
".",
"NewUtils",
"(",
"utils",
".",
"KubekinsBucket",
",",
"utils",
".",
"LogDir",
")",
",",
"}",
"\n",
... | // NewGoogleGCSDownloader creates a new GoogleGCSDownloader | [
"NewGoogleGCSDownloader",
"creates",
"a",
"new",
"GoogleGCSDownloader"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/node-perf-dash/downloader.go#L100-L104 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | HandleChannelOpen | func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
c.mu.Lock()
defer c.mu.Unlock()
if c.channelHandlers == nil {
// The SSH channel has been closed.
c := make(chan NewChannel)
close(c)
return c
}
ch := c.channelHandlers[channelType]
if ch != nil {
return nil
}
ch = make(chan ... | go | func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
c.mu.Lock()
defer c.mu.Unlock()
if c.channelHandlers == nil {
// The SSH channel has been closed.
c := make(chan NewChannel)
close(c)
return c
}
ch := c.channelHandlers[channelType]
if ch != nil {
return nil
}
ch = make(chan ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"HandleChannelOpen",
"(",
"channelType",
"string",
")",
"<-",
"chan",
"NewChannel",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"c",
".",
"c... | // HandleChannelOpen returns a channel on which NewChannel requests
// for the given type are sent. If the type already is being handled,
// nil is returned. The channel is closed when the connection is closed. | [
"HandleChannelOpen",
"returns",
"a",
"channel",
"on",
"which",
"NewChannel",
"requests",
"for",
"the",
"given",
"type",
"are",
"sent",
".",
"If",
"the",
"type",
"already",
"is",
"being",
"handled",
"nil",
"is",
"returned",
".",
"The",
"channel",
"is",
"close... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L27-L45 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | NewClient | func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
conn := &Client{
Conn: c,
channelHandlers: make(map[string]chan NewChannel, 1),
}
go conn.handleGlobalRequests(reqs)
go conn.handleChannelOpens(chans)
go func() {
conn.Wait()
conn.forwards.closeAll()
}()
go conn.f... | go | func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
conn := &Client{
Conn: c,
channelHandlers: make(map[string]chan NewChannel, 1),
}
go conn.handleGlobalRequests(reqs)
go conn.handleChannelOpens(chans)
go func() {
conn.Wait()
conn.forwards.closeAll()
}()
go conn.f... | [
"func",
"NewClient",
"(",
"c",
"Conn",
",",
"chans",
"<-",
"chan",
"NewChannel",
",",
"reqs",
"<-",
"chan",
"*",
"Request",
")",
"*",
"Client",
"{",
"conn",
":=",
"&",
"Client",
"{",
"Conn",
":",
"c",
",",
"channelHandlers",
":",
"make",
"(",
"map",
... | // NewClient creates a Client on top of the given connection. | [
"NewClient",
"creates",
"a",
"Client",
"on",
"top",
"of",
"the",
"given",
"connection",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L48-L62 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | NewClientConn | func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
fullConf := *config
fullConf.SetDefaults()
conn := &connection{
sshConn: sshConn{conn: c},
}
if err := conn.clientHandshake(addr, &fullConf); err != nil {
c.Close()
return nil, nil, nil, fmt... | go | func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
fullConf := *config
fullConf.SetDefaults()
conn := &connection{
sshConn: sshConn{conn: c},
}
if err := conn.clientHandshake(addr, &fullConf); err != nil {
c.Close()
return nil, nil, nil, fmt... | [
"func",
"NewClientConn",
"(",
"c",
"net",
".",
"Conn",
",",
"addr",
"string",
",",
"config",
"*",
"ClientConfig",
")",
"(",
"Conn",
",",
"<-",
"chan",
"NewChannel",
",",
"<-",
"chan",
"*",
"Request",
",",
"error",
")",
"{",
"fullConf",
":=",
"*",
"co... | // NewClientConn establishes an authenticated SSH connection using c
// as the underlying transport. The Request and NewChannel channels
// must be serviced or the connection will hang. | [
"NewClientConn",
"establishes",
"an",
"authenticated",
"SSH",
"connection",
"using",
"c",
"as",
"the",
"underlying",
"transport",
".",
"The",
"Request",
"and",
"NewChannel",
"channels",
"must",
"be",
"serviced",
"or",
"the",
"connection",
"will",
"hang",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L67-L80 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | clientHandshake | func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
if config.ClientVersion != "" {
c.clientVersion = []byte(config.ClientVersion)
} else {
c.clientVersion = []byte(packageVersion)
}
var err error
c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
if er... | go | func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
if config.ClientVersion != "" {
c.clientVersion = []byte(config.ClientVersion)
} else {
c.clientVersion = []byte(packageVersion)
}
var err error
c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
if er... | [
"func",
"(",
"c",
"*",
"connection",
")",
"clientHandshake",
"(",
"dialAddress",
"string",
",",
"config",
"*",
"ClientConfig",
")",
"error",
"{",
"if",
"config",
".",
"ClientVersion",
"!=",
"\"",
"\"",
"{",
"c",
".",
"clientVersion",
"=",
"[",
"]",
"byte... | // clientHandshake performs the client side key exchange. See RFC 4253 Section
// 7. | [
"clientHandshake",
"performs",
"the",
"client",
"side",
"key",
"exchange",
".",
"See",
"RFC",
"4253",
"Section",
"7",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L84-L113 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | verifyHostKeySignature | func verifyHostKeySignature(hostKey PublicKey, result *kexResult) error {
sig, rest, ok := parseSignatureBody(result.Signature)
if len(rest) > 0 || !ok {
return errors.New("ssh: signature parse error")
}
return hostKey.Verify(result.H, sig)
} | go | func verifyHostKeySignature(hostKey PublicKey, result *kexResult) error {
sig, rest, ok := parseSignatureBody(result.Signature)
if len(rest) > 0 || !ok {
return errors.New("ssh: signature parse error")
}
return hostKey.Verify(result.H, sig)
} | [
"func",
"verifyHostKeySignature",
"(",
"hostKey",
"PublicKey",
",",
"result",
"*",
"kexResult",
")",
"error",
"{",
"sig",
",",
"rest",
",",
"ok",
":=",
"parseSignatureBody",
"(",
"result",
".",
"Signature",
")",
"\n",
"if",
"len",
"(",
"rest",
")",
">",
... | // verifyHostKeySignature verifies the host key obtained in the key
// exchange. | [
"verifyHostKeySignature",
"verifies",
"the",
"host",
"key",
"obtained",
"in",
"the",
"key",
"exchange",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L117-L124 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | handleChannelOpens | func (c *Client) handleChannelOpens(in <-chan NewChannel) {
for ch := range in {
c.mu.Lock()
handler := c.channelHandlers[ch.ChannelType()]
c.mu.Unlock()
if handler != nil {
handler <- ch
} else {
ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
}
}
c.mu.Lo... | go | func (c *Client) handleChannelOpens(in <-chan NewChannel) {
for ch := range in {
c.mu.Lock()
handler := c.channelHandlers[ch.ChannelType()]
c.mu.Unlock()
if handler != nil {
handler <- ch
} else {
ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
}
}
c.mu.Lo... | [
"func",
"(",
"c",
"*",
"Client",
")",
"handleChannelOpens",
"(",
"in",
"<-",
"chan",
"NewChannel",
")",
"{",
"for",
"ch",
":=",
"range",
"in",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"handler",
":=",
"c",
".",
"channelHandlers",
"[",
"ch"... | // handleChannelOpens channel open messages from the remote side. | [
"handleChannelOpens",
"channel",
"open",
"messages",
"from",
"the",
"remote",
"side",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L145-L164 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go | Dial | func Dial(network, addr string, config *ClientConfig) (*Client, error) {
conn, err := net.Dial(network, addr)
if err != nil {
return nil, err
}
c, chans, reqs, err := NewClientConn(conn, addr, config)
if err != nil {
return nil, err
}
return NewClient(c, chans, reqs), nil
} | go | func Dial(network, addr string, config *ClientConfig) (*Client, error) {
conn, err := net.Dial(network, addr)
if err != nil {
return nil, err
}
c, chans, reqs, err := NewClientConn(conn, addr, config)
if err != nil {
return nil, err
}
return NewClient(c, chans, reqs), nil
} | [
"func",
"Dial",
"(",
"network",
",",
"addr",
"string",
",",
"config",
"*",
"ClientConfig",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"network",
",",
"addr",
")",
"\n",
"if",
"err",
"!=",
"... | // Dial starts a client connection to the given SSH server. It is a
// convenience function that connects to the given network address,
// initiates the SSH handshake, and then sets up a Client. For access
// to incoming channels and requests, use net.Dial with NewClientConn
// instead. | [
"Dial",
"starts",
"a",
"client",
"connection",
"to",
"the",
"given",
"SSH",
"server",
".",
"It",
"is",
"a",
"convenience",
"function",
"that",
"connects",
"to",
"the",
"given",
"network",
"address",
"initiates",
"the",
"SSH",
"handshake",
"and",
"then",
"set... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/client.go#L171-L181 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/meta.go | Interpret | func (SimpleMetaFactory) Interpret(data []byte) (unversioned.GroupVersionKind, error) {
findKind := struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
}{}
err := json.Unmarshal(data, &findKind)
if err != nil {
return unversioned.GroupVersionKind{}, fmt.Errorf("c... | go | func (SimpleMetaFactory) Interpret(data []byte) (unversioned.GroupVersionKind, error) {
findKind := struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
}{}
err := json.Unmarshal(data, &findKind)
if err != nil {
return unversioned.GroupVersionKind{}, fmt.Errorf("c... | [
"func",
"(",
"SimpleMetaFactory",
")",
"Interpret",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"unversioned",
".",
"GroupVersionKind",
",",
"error",
")",
"{",
"findKind",
":=",
"struct",
"{",
"APIVersion",
"string",
"`json:\"apiVersion,omitempty\"`",
"\n",
"Kind",... | // Interpret will return the group,version,kind of the JSON wire-format
// encoding of an object, or an error. | [
"Interpret",
"will",
"return",
"the",
"group",
"version",
"kind",
"of",
"the",
"JSON",
"wire",
"-",
"format",
"encoding",
"of",
"an",
"object",
"or",
"an",
"error",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/conversion/meta.go#L58-L73 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/helper.go | ServerAPIVersions | func ServerAPIVersions(c *Config) (groupVersions []string, err error) {
transport, err := TransportFor(c)
if err != nil {
return nil, err
}
client := http.Client{Transport: transport}
configCopy := *c
configCopy.GroupVersion = nil
configCopy.Prefix = ""
baseURL, err := defaultServerUrlFor(c)
if err != nil {... | go | func ServerAPIVersions(c *Config) (groupVersions []string, err error) {
transport, err := TransportFor(c)
if err != nil {
return nil, err
}
client := http.Client{Transport: transport}
configCopy := *c
configCopy.GroupVersion = nil
configCopy.Prefix = ""
baseURL, err := defaultServerUrlFor(c)
if err != nil {... | [
"func",
"ServerAPIVersions",
"(",
"c",
"*",
"Config",
")",
"(",
"groupVersions",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"transport",
",",
"err",
":=",
"TransportFor",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // ServerAPIVersions returns the GroupVersions supported by the API server.
// It creates a RESTClient based on the passed in config, but it doesn't rely
// on the Version, Codec, and Prefix of the config, because it uses AbsPath and
// takes the raw response. | [
"ServerAPIVersions",
"returns",
"the",
"GroupVersions",
"supported",
"by",
"the",
"API",
"server",
".",
"It",
"creates",
"a",
"RESTClient",
"based",
"on",
"the",
"passed",
"in",
"config",
"but",
"it",
"doesn",
"t",
"rely",
"on",
"the",
"Version",
"Codec",
"a... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/helper.go#L185-L228 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go | List | func (c *horizontalPodAutoscalers) List(opts api.ListOptions) (result *extensions.HorizontalPodAutoscalerList, err error) {
result = &extensions.HorizontalPodAutoscalerList{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").VersionedParams(&opts, api.Scheme).Do().Into(result)
return
} | go | func (c *horizontalPodAutoscalers) List(opts api.ListOptions) (result *extensions.HorizontalPodAutoscalerList, err error) {
result = &extensions.HorizontalPodAutoscalerList{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").VersionedParams(&opts, api.Scheme).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"horizontalPodAutoscalers",
")",
"List",
"(",
"opts",
"api",
".",
"ListOptions",
")",
"(",
"result",
"*",
"extensions",
".",
"HorizontalPodAutoscalerList",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"extensions",
".",
"Horizont... | // List takes label and field selectors, and returns the list of horizontalPodAutoscalers that match those selectors. | [
"List",
"takes",
"label",
"and",
"field",
"selectors",
"and",
"returns",
"the",
"list",
"of",
"horizontalPodAutoscalers",
"that",
"match",
"those",
"selectors",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go#L56-L60 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go | Get | func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
return
} | go | func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"horizontalPodAutoscalers",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"result",
"*",
"extensions",
".",
"HorizontalPodAutoscaler",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"extensions",
".",
"HorizontalPodAutoscaler",
"{",
... | // Get takes the name of the horizontalPodAutoscaler, and returns the corresponding HorizontalPodAutoscaler object, and an error if it occurs | [
"Get",
"takes",
"the",
"name",
"of",
"the",
"horizontalPodAutoscaler",
"and",
"returns",
"the",
"corresponding",
"HorizontalPodAutoscaler",
"object",
"and",
"an",
"error",
"if",
"it",
"occurs"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go#L63-L67 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go | Update | func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).B... | go | func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) {
result = &extensions.HorizontalPodAutoscaler{}
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).B... | [
"func",
"(",
"c",
"*",
"horizontalPodAutoscalers",
")",
"Update",
"(",
"horizontalPodAutoscaler",
"*",
"extensions",
".",
"HorizontalPodAutoscaler",
")",
"(",
"result",
"*",
"extensions",
".",
"HorizontalPodAutoscaler",
",",
"err",
"error",
")",
"{",
"result",
"="... | // Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs. | [
"Update",
"takes",
"the",
"representation",
"of",
"a",
"horizontalPodAutoscaler",
"and",
"updates",
"it",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"horizontalPodAutoscaler",
"and",
"an",
"error",
"if",
"it",
"occurs",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go#L82-L86 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go | List | func (c *nodes) List(opts api.ListOptions) (*api.NodeList, error) {
result := &api.NodeList{}
err := c.r.Get().Resource(c.resourceName()).VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return result, err
} | go | func (c *nodes) List(opts api.ListOptions) (*api.NodeList, error) {
result := &api.NodeList{}
err := c.r.Get().Resource(c.resourceName()).VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return result, err
} | [
"func",
"(",
"c",
"*",
"nodes",
")",
"List",
"(",
"opts",
"api",
".",
"ListOptions",
")",
"(",
"*",
"api",
".",
"NodeList",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"NodeList",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"r",
".",
... | // List takes a selector, and returns the list of nodes that match that selector in the cluster. | [
"List",
"takes",
"a",
"selector",
"and",
"returns",
"the",
"list",
"of",
"nodes",
"that",
"match",
"that",
"selector",
"in",
"the",
"cluster",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go#L61-L65 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/fake_handler.go | ValidateRequest | func (f *FakeHandler) ValidateRequest(t TestInterface, expectedPath, expectedMethod string, body *string) {
f.lock.Lock()
defer f.lock.Unlock()
if f.requestCount != 1 {
t.Logf("Expected 1 call, but got %v. Only the last call is recorded and checked.", f.requestCount)
}
f.hasBeenChecked = true
expectURL, err :=... | go | func (f *FakeHandler) ValidateRequest(t TestInterface, expectedPath, expectedMethod string, body *string) {
f.lock.Lock()
defer f.lock.Unlock()
if f.requestCount != 1 {
t.Logf("Expected 1 call, but got %v. Only the last call is recorded and checked.", f.requestCount)
}
f.hasBeenChecked = true
expectURL, err :=... | [
"func",
"(",
"f",
"*",
"FakeHandler",
")",
"ValidateRequest",
"(",
"t",
"TestInterface",
",",
"expectedPath",
",",
"expectedMethod",
"string",
",",
"body",
"*",
"string",
")",
"{",
"f",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"lock... | // ValidateRequest verifies that FakeHandler received a request with expected path, method, and body. | [
"ValidateRequest",
"verifies",
"that",
"FakeHandler",
"received",
"a",
"request",
"with",
"expected",
"path",
"method",
"and",
"body",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/fake_handler.go#L89-L119 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rollback.go | watchRollbackEvent | func watchRollbackEvent(w watch.Interface) string {
signals := make(chan os.Signal, 1)
signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGTERM)
for {
select {
case event, ok := <-w.ResultChan():
if !ok {
return ""
}
obj, ok := event.Object.(*api.Event)
if !ok {
w.Stop()
return ""
... | go | func watchRollbackEvent(w watch.Interface) string {
signals := make(chan os.Signal, 1)
signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGTERM)
for {
select {
case event, ok := <-w.ResultChan():
if !ok {
return ""
}
obj, ok := event.Object.(*api.Event)
if !ok {
w.Stop()
return ""
... | [
"func",
"watchRollbackEvent",
"(",
"w",
"watch",
".",
"Interface",
")",
"string",
"{",
"signals",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"signals",
",",
"os",
".",
"Interrupt",
",",
"os",
".... | // watchRollbackEvent watches for rollback events and returns rollback result | [
"watchRollbackEvent",
"watches",
"for",
"rollback",
"events",
"and",
"returns",
"rollback",
"result"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rollback.go#L80-L103 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rollback.go | isRollbackEvent | func isRollbackEvent(e *api.Event) (bool, string) {
rollbackEventReasons := []string{deploymentutil.RollbackRevisionNotFound, deploymentutil.RollbackTemplateUnchanged, deploymentutil.RollbackDone}
for _, reason := range rollbackEventReasons {
if e.Reason == reason {
if reason == deploymentutil.RollbackDone {
... | go | func isRollbackEvent(e *api.Event) (bool, string) {
rollbackEventReasons := []string{deploymentutil.RollbackRevisionNotFound, deploymentutil.RollbackTemplateUnchanged, deploymentutil.RollbackDone}
for _, reason := range rollbackEventReasons {
if e.Reason == reason {
if reason == deploymentutil.RollbackDone {
... | [
"func",
"isRollbackEvent",
"(",
"e",
"*",
"api",
".",
"Event",
")",
"(",
"bool",
",",
"string",
")",
"{",
"rollbackEventReasons",
":=",
"[",
"]",
"string",
"{",
"deploymentutil",
".",
"RollbackRevisionNotFound",
",",
"deploymentutil",
".",
"RollbackTemplateUncha... | // isRollbackEvent checks if the input event is about rollback, and returns true and
// related result string back if it is. | [
"isRollbackEvent",
"checks",
"if",
"the",
"input",
"event",
"is",
"about",
"rollback",
"and",
"returns",
"true",
"and",
"related",
"result",
"string",
"back",
"if",
"it",
"is",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rollback.go#L107-L118 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go | isResourceGuaranteed | func isResourceGuaranteed(container *api.Container, resource api.ResourceName) bool {
// A container resource is guaranteed if its request == limit.
// If request == limit, the user is very confident of resource consumption.
req, hasReq := container.Resources.Requests[resource]
limit, hasLimit := container.Resource... | go | func isResourceGuaranteed(container *api.Container, resource api.ResourceName) bool {
// A container resource is guaranteed if its request == limit.
// If request == limit, the user is very confident of resource consumption.
req, hasReq := container.Resources.Requests[resource]
limit, hasLimit := container.Resource... | [
"func",
"isResourceGuaranteed",
"(",
"container",
"*",
"api",
".",
"Container",
",",
"resource",
"api",
".",
"ResourceName",
")",
"bool",
"{",
"// A container resource is guaranteed if its request == limit.",
"// If request == limit, the user is very confident of resource consumpti... | // isResourceGuaranteed returns true if the container's resource requirements are Guaranteed. | [
"isResourceGuaranteed",
"returns",
"true",
"if",
"the",
"container",
"s",
"resource",
"requirements",
"are",
"Guaranteed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go#L30-L39 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go | isResourceBestEffort | func isResourceBestEffort(container *api.Container, resource api.ResourceName) bool {
// A container resource is best-effort if its request is unspecified or 0.
// If a request is specified, then the user expects some kind of resource guarantee.
req, hasReq := container.Resources.Requests[resource]
return !hasReq |... | go | func isResourceBestEffort(container *api.Container, resource api.ResourceName) bool {
// A container resource is best-effort if its request is unspecified or 0.
// If a request is specified, then the user expects some kind of resource guarantee.
req, hasReq := container.Resources.Requests[resource]
return !hasReq |... | [
"func",
"isResourceBestEffort",
"(",
"container",
"*",
"api",
".",
"Container",
",",
"resource",
"api",
".",
"ResourceName",
")",
"bool",
"{",
"// A container resource is best-effort if its request is unspecified or 0.",
"// If a request is specified, then the user expects some kin... | // isResourceBestEffort returns true if the container's resource requirements are best-effort. | [
"isResourceBestEffort",
"returns",
"true",
"if",
"the",
"container",
"s",
"resource",
"requirements",
"are",
"best",
"-",
"effort",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go#L42-L47 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go | GetQoS | func GetQoS(container *api.Container) map[api.ResourceName]string {
resourceToQoS := map[api.ResourceName]string{}
for resource := range allResources(container) {
switch {
case isResourceGuaranteed(container, resource):
resourceToQoS[resource] = Guaranteed
case isResourceBestEffort(container, resource):
r... | go | func GetQoS(container *api.Container) map[api.ResourceName]string {
resourceToQoS := map[api.ResourceName]string{}
for resource := range allResources(container) {
switch {
case isResourceGuaranteed(container, resource):
resourceToQoS[resource] = Guaranteed
case isResourceBestEffort(container, resource):
r... | [
"func",
"GetQoS",
"(",
"container",
"*",
"api",
".",
"Container",
")",
"map",
"[",
"api",
".",
"ResourceName",
"]",
"string",
"{",
"resourceToQoS",
":=",
"map",
"[",
"api",
".",
"ResourceName",
"]",
"string",
"{",
"}",
"\n",
"for",
"resource",
":=",
"r... | // GetQos returns a mapping of resource name to QoS class of a container | [
"GetQos",
"returns",
"a",
"mapping",
"of",
"resource",
"name",
"to",
"QoS",
"class",
"of",
"a",
"container"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go#L50-L63 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go | allResources | func allResources(container *api.Container) map[api.ResourceName]bool {
resources := map[api.ResourceName]bool{}
for _, resource := range supportedComputeResources {
resources[resource] = false
}
for resource := range container.Resources.Requests {
resources[resource] = true
}
for resource := range container.... | go | func allResources(container *api.Container) map[api.ResourceName]bool {
resources := map[api.ResourceName]bool{}
for _, resource := range supportedComputeResources {
resources[resource] = false
}
for resource := range container.Resources.Requests {
resources[resource] = true
}
for resource := range container.... | [
"func",
"allResources",
"(",
"container",
"*",
"api",
".",
"Container",
")",
"map",
"[",
"api",
".",
"ResourceName",
"]",
"bool",
"{",
"resources",
":=",
"map",
"[",
"api",
".",
"ResourceName",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"resource",
... | // allResources returns a set of all possible resources whose mapped key value is true if present on the container | [
"allResources",
"returns",
"a",
"set",
"of",
"all",
"possible",
"resources",
"whose",
"mapped",
"key",
"value",
"is",
"true",
"if",
"present",
"on",
"the",
"container"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go#L72-L84 | train |
kubernetes-retired/contrib | election/lib/election.go | NewSimpleElection | func NewSimpleElection(electionId, id string, callback func(leader string), c client.Interface) (*leaderelection.LeaderElector, error) {
return NewElection(electionId, id, api.NamespaceDefault, 10*time.Second, callback, c)
} | go | func NewSimpleElection(electionId, id string, callback func(leader string), c client.Interface) (*leaderelection.LeaderElector, error) {
return NewElection(electionId, id, api.NamespaceDefault, 10*time.Second, callback, c)
} | [
"func",
"NewSimpleElection",
"(",
"electionId",
",",
"id",
"string",
",",
"callback",
"func",
"(",
"leader",
"string",
")",
",",
"c",
"client",
".",
"Interface",
")",
"(",
"*",
"leaderelection",
".",
"LeaderElector",
",",
"error",
")",
"{",
"return",
"NewE... | // NewSimpleElection creates an election, it defaults namespace to 'default' and ttl to 10s | [
"NewSimpleElection",
"creates",
"an",
"election",
"it",
"defaults",
"namespace",
"to",
"default",
"and",
"ttl",
"to",
"10s"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/election/lib/election.go#L56-L58 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go | InterpretUpdateError | func InterpretUpdateError(err error, qualifiedResource unversioned.GroupResource, name string) error {
switch {
case storage.IsTestFailed(err), storage.IsNodeExist(err):
return errors.NewConflict(qualifiedResource, name, err)
case storage.IsUnreachable(err):
return errors.NewServerTimeout(qualifiedResource, "upd... | go | func InterpretUpdateError(err error, qualifiedResource unversioned.GroupResource, name string) error {
switch {
case storage.IsTestFailed(err), storage.IsNodeExist(err):
return errors.NewConflict(qualifiedResource, name, err)
case storage.IsUnreachable(err):
return errors.NewServerTimeout(qualifiedResource, "upd... | [
"func",
"InterpretUpdateError",
"(",
"err",
"error",
",",
"qualifiedResource",
"unversioned",
".",
"GroupResource",
",",
"name",
"string",
")",
"error",
"{",
"switch",
"{",
"case",
"storage",
".",
"IsTestFailed",
"(",
"err",
")",
",",
"storage",
".",
"IsNodeEx... | // InterpretUpdateError converts a generic error on a update
// operation into the appropriate API error. | [
"InterpretUpdateError",
"converts",
"a",
"generic",
"error",
"on",
"a",
"update",
"operation",
"into",
"the",
"appropriate",
"API",
"error",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go#L66-L75 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/controller/framework/controller.go | Requeue | func (c *Controller) Requeue(obj interface{}) error {
return c.config.Queue.AddIfNotPresent(cache.Deltas{
cache.Delta{
Type: cache.Sync,
Object: obj,
},
})
} | go | func (c *Controller) Requeue(obj interface{}) error {
return c.config.Queue.AddIfNotPresent(cache.Deltas{
cache.Delta{
Type: cache.Sync,
Object: obj,
},
})
} | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Requeue",
"(",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"c",
".",
"config",
".",
"Queue",
".",
"AddIfNotPresent",
"(",
"cache",
".",
"Deltas",
"{",
"cache",
".",
"Delta",
"{",
"Type",
":",
... | // Requeue adds the provided object back into the queue if it does not already exist. | [
"Requeue",
"adds",
"the",
"provided",
"object",
"back",
"into",
"the",
"queue",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/controller/framework/controller.go#L106-L113 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go | NewForConfig | func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := unversioned.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CoreClient{client}, nil
} | go | func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := unversioned.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CoreClient{client}, nil
} | [
"func",
"NewForConfig",
"(",
"c",
"*",
"unversioned",
".",
"Config",
")",
"(",
"*",
"CoreClient",
",",
"error",
")",
"{",
"config",
":=",
"*",
"c",
"\n",
"if",
"err",
":=",
"setConfigDefaults",
"(",
"&",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
... | // NewForConfig creates a new CoreClient for the given config. | [
"NewForConfig",
"creates",
"a",
"new",
"CoreClient",
"for",
"the",
"given",
"config",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go#L114-L124 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go | NewForConfigOrDie | func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
} | go | func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
} | [
"func",
"NewForConfigOrDie",
"(",
"c",
"*",
"unversioned",
".",
"Config",
")",
"*",
"CoreClient",
"{",
"client",
",",
"err",
":=",
"NewForConfig",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return"... | // NewForConfigOrDie creates a new CoreClient for the given config and
// panics if there is an error in the config. | [
"NewForConfigOrDie",
"creates",
"a",
"new",
"CoreClient",
"for",
"the",
"given",
"config",
"and",
"panics",
"if",
"there",
"is",
"an",
"error",
"in",
"the",
"config",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go#L128-L134 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go | isMemoryBestEffort | func isMemoryBestEffort(container *api.Container) bool {
// A container is memory best-effort if its memory request is unspecified or 0.
// If a request is specified, then the user expects some kind of resource guarantee.
return container.Resources.Requests.Memory().Value() == 0
} | go | func isMemoryBestEffort(container *api.Container) bool {
// A container is memory best-effort if its memory request is unspecified or 0.
// If a request is specified, then the user expects some kind of resource guarantee.
return container.Resources.Requests.Memory().Value() == 0
} | [
"func",
"isMemoryBestEffort",
"(",
"container",
"*",
"api",
".",
"Container",
")",
"bool",
"{",
"// A container is memory best-effort if its memory request is unspecified or 0.",
"// If a request is specified, then the user expects some kind of resource guarantee.",
"return",
"container"... | // isMemoryBestEffort returns true if the container's memory requirements are best-effort. | [
"isMemoryBestEffort",
"returns",
"true",
"if",
"the",
"container",
"s",
"memory",
"requirements",
"are",
"best",
"-",
"effort",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go#L30-L34 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go | isMemoryGuaranteed | func isMemoryGuaranteed(container *api.Container) bool {
// A container is memory guaranteed if its memory request == memory limit.
// If memory request == memory limit, the user is very confident of resource consumption.
memoryRequest := container.Resources.Requests.Memory()
memoryLimit := container.Resources.Limi... | go | func isMemoryGuaranteed(container *api.Container) bool {
// A container is memory guaranteed if its memory request == memory limit.
// If memory request == memory limit, the user is very confident of resource consumption.
memoryRequest := container.Resources.Requests.Memory()
memoryLimit := container.Resources.Limi... | [
"func",
"isMemoryGuaranteed",
"(",
"container",
"*",
"api",
".",
"Container",
")",
"bool",
"{",
"// A container is memory guaranteed if its memory request == memory limit.",
"// If memory request == memory limit, the user is very confident of resource consumption.",
"memoryRequest",
":="... | // isMemoryGuaranteed returns true if the container's memory requirements are Guaranteed. | [
"isMemoryGuaranteed",
"returns",
"true",
"if",
"the",
"container",
"s",
"memory",
"requirements",
"are",
"Guaranteed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go#L37-L43 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/watch/mux.go | loop | func (m *Broadcaster) loop() {
// Deliberately not catching crashes here. Yes, bring down the process if there's a
// bug in watch.Broadcaster.
for {
event, ok := <-m.incoming
if !ok {
break
}
if event.Type == internalRunFunctionMarker {
event.Object.(functionFakeRuntimeObject)()
continue
}
m.di... | go | func (m *Broadcaster) loop() {
// Deliberately not catching crashes here. Yes, bring down the process if there's a
// bug in watch.Broadcaster.
for {
event, ok := <-m.incoming
if !ok {
break
}
if event.Type == internalRunFunctionMarker {
event.Object.(functionFakeRuntimeObject)()
continue
}
m.di... | [
"func",
"(",
"m",
"*",
"Broadcaster",
")",
"loop",
"(",
")",
"{",
"// Deliberately not catching crashes here. Yes, bring down the process if there's a",
"// bug in watch.Broadcaster.",
"for",
"{",
"event",
",",
"ok",
":=",
"<-",
"m",
".",
"incoming",
"\n",
"if",
"!",
... | // loop receives from m.incoming and distributes to all watchers. | [
"loop",
"receives",
"from",
"m",
".",
"incoming",
"and",
"distributes",
"to",
"all",
"watchers",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/watch/mux.go#L197-L213 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go | Get | func (c *services) Get(name string) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Get().Namespace(c.ns).Resource("services").Name(name).Do().Into(result)
return
} | go | func (c *services) Get(name string) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Get().Namespace(c.ns).Resource("services").Name(name).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"services",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"result",
"*",
"api",
".",
"Service",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"api",
".",
"Service",
"{",
"}",
"\n",
"err",
"=",
"c",
".",
"r",
".",
"G... | // Get returns information about a particular service. | [
"Get",
"returns",
"information",
"about",
"a",
"particular",
"service",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go#L65-L69 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go | Create | func (c *services) Create(svc *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Post().Namespace(c.ns).Resource("services").Body(svc).Do().Into(result)
return
} | go | func (c *services) Create(svc *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Post().Namespace(c.ns).Resource("services").Body(svc).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"services",
")",
"Create",
"(",
"svc",
"*",
"api",
".",
"Service",
")",
"(",
"result",
"*",
"api",
".",
"Service",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"api",
".",
"Service",
"{",
"}",
"\n",
"err",
"=",
"c",... | // Create creates a new service. | [
"Create",
"creates",
"a",
"new",
"service",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go#L72-L76 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go | ProxyGet | func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper {
request := c.r.Get().
Prefix("proxy").
Namespace(c.ns).
Resource("services").
Name(util.JoinSchemeNamePort(scheme, name, port)).
Suffix(path)
for k, v := range params {
request = request.Param(k, v)
}... | go | func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper {
request := c.r.Get().
Prefix("proxy").
Namespace(c.ns).
Resource("services").
Name(util.JoinSchemeNamePort(scheme, name, port)).
Suffix(path)
for k, v := range params {
request = request.Param(k, v)
}... | [
"func",
"(",
"c",
"*",
"services",
")",
"ProxyGet",
"(",
"scheme",
",",
"name",
",",
"port",
",",
"path",
"string",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"ResponseWrapper",
"{",
"request",
":=",
"c",
".",
"r",
".",
"Get",
"(",
")... | // ProxyGet returns a response of the service by calling it through the proxy. | [
"ProxyGet",
"returns",
"a",
"response",
"of",
"the",
"service",
"by",
"calling",
"it",
"through",
"the",
"proxy",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/services.go#L101-L112 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/clientcredentials/clientcredentials.go | Token | func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) {
return retrieveToken(ctx, c, url.Values{
"grant_type": {"client_credentials"},
"scope": internal.CondVal(strings.Join(c.Scopes, " ")),
})
} | go | func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) {
return retrieveToken(ctx, c, url.Values{
"grant_type": {"client_credentials"},
"scope": internal.CondVal(strings.Join(c.Scopes, " ")),
})
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"Token",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"oauth2",
".",
"Token",
",",
"error",
")",
"{",
"return",
"retrieveToken",
"(",
"ctx",
",",
"c",
",",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",... | // Token uses client credentials to retreive a token.
// The HTTP client to use is derived from the context.
// If nil, http.DefaultClient is used. | [
"Token",
"uses",
"client",
"credentials",
"to",
"retreive",
"a",
"token",
".",
"The",
"HTTP",
"client",
"to",
"use",
"is",
"derived",
"from",
"the",
"context",
".",
"If",
"nil",
"http",
".",
"DefaultClient",
"is",
"used",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/clientcredentials/clientcredentials.go#L72-L77 | train |
kubernetes-retired/contrib | release-notes/Godeps/_workspace/src/golang.org/x/oauth2/clientcredentials/clientcredentials.go | TokenSource | func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
source := &tokenSource{
ctx: ctx,
conf: c,
}
return oauth2.ReuseTokenSource(nil, source)
} | go | func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
source := &tokenSource{
ctx: ctx,
conf: c,
}
return oauth2.ReuseTokenSource(nil, source)
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"TokenSource",
"(",
"ctx",
"context",
".",
"Context",
")",
"oauth2",
".",
"TokenSource",
"{",
"source",
":=",
"&",
"tokenSource",
"{",
"ctx",
":",
"ctx",
",",
"conf",
":",
"c",
",",
"}",
"\n",
"return",
"oauth2",... | // TokenSource returns a TokenSource that returns t until t expires,
// automatically refreshing it as necessary using the provided context and the
// client ID and client secret.
//
// Most users will use Config.Client instead. | [
"TokenSource",
"returns",
"a",
"TokenSource",
"that",
"returns",
"t",
"until",
"t",
"expires",
"automatically",
"refreshing",
"it",
"as",
"necessary",
"using",
"the",
"provided",
"context",
"and",
"the",
"client",
"ID",
"and",
"client",
"secret",
".",
"Most",
... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/release-notes/Godeps/_workspace/src/golang.org/x/oauth2/clientcredentials/clientcredentials.go#L92-L98 | train |
kubernetes-retired/contrib | service-loadbalancer/loadbalancer_log.go | newSyslogServer | func newSyslogServer(path string) (*syslogServer, error) {
glog.Infof("Starting syslog server for haproxy using %v as socket", path)
// remove the socket file if exists
os.Remove(path)
server := &syslogServer{syslog.NewServer()}
server.AddHandler(newHandler())
err := server.Listen(path)
if err != nil {
return... | go | func newSyslogServer(path string) (*syslogServer, error) {
glog.Infof("Starting syslog server for haproxy using %v as socket", path)
// remove the socket file if exists
os.Remove(path)
server := &syslogServer{syslog.NewServer()}
server.AddHandler(newHandler())
err := server.Listen(path)
if err != nil {
return... | [
"func",
"newSyslogServer",
"(",
"path",
"string",
")",
"(",
"*",
"syslogServer",
",",
"error",
")",
"{",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"// remove the socket file if exists",
"os",
".",
"Remove",
"(",
"path",
")",
"\n\n",
... | // newSyslogServer start a syslog server using a unix socket to listen for connections | [
"newSyslogServer",
"start",
"a",
"syslog",
"server",
"using",
"a",
"unix",
"socket",
"to",
"listen",
"for",
"connections"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/loadbalancer_log.go#L37-L50 | 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.