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 | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/scale.go | ScaleSimple | func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error {
deployment, err := scaler.c.Deployments(namespace).Get(name)
if err != nil {
return ScaleError{ScaleGetFailure, "Unknown", err}
}
if preconditions != nil {
if err := preconditions.Validate... | go | func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error {
deployment, err := scaler.c.Deployments(namespace).Get(name)
if err != nil {
return ScaleError{ScaleGetFailure, "Unknown", err}
}
if preconditions != nil {
if err := preconditions.Validate... | [
"func",
"(",
"scaler",
"*",
"DeploymentScaler",
")",
"ScaleSimple",
"(",
"namespace",
",",
"name",
"string",
",",
"preconditions",
"*",
"ScalePrecondition",
",",
"newSize",
"uint",
")",
"error",
"{",
"deployment",
",",
"err",
":=",
"scaler",
".",
"c",
".",
... | // ScaleSimple is responsible for updating a deployment's desired replicas count. | [
"ScaleSimple",
"is",
"responsible",
"for",
"updating",
"a",
"deployment",
"s",
"desired",
"replicas",
"count",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/scale.go#L336-L357 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/conditions.go | ReplicaSetHasDesiredReplicas | func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc {
// If we're given a ReplicaSet where the status lags the spec, it either means that the
// ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet.
// Polling status.Replicas is... | go | func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc {
// If we're given a ReplicaSet where the status lags the spec, it either means that the
// ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet.
// Polling status.Replicas is... | [
"func",
"ReplicaSetHasDesiredReplicas",
"(",
"c",
"ExtensionsInterface",
",",
"replicaSet",
"*",
"extensions",
".",
"ReplicaSet",
")",
"wait",
".",
"ConditionFunc",
"{",
"// If we're given a ReplicaSet where the status lags the spec, it either means that the",
"// ReplicaSet is sta... | // ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count. | [
"ReplicaSetHasDesiredReplicas",
"returns",
"a",
"condition",
"that",
"will",
"be",
"true",
"if",
"and",
"only",
"if",
"the",
"desired",
"replica",
"count",
"for",
"a",
"ReplicaSet",
"s",
"ReplicaSelector",
"equals",
"the",
"Replicas",
"count",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/conditions.go#L106-L125 | train |
kubernetes-retired/contrib | exec-healthz/cmd/exechealthz/exechealthz.go | getResults | func (h *execWorker) getResults() execResult {
h.mutex.Lock()
defer h.mutex.Unlock()
return h.result
} | go | func (h *execWorker) getResults() execResult {
h.mutex.Lock()
defer h.mutex.Unlock()
return h.result
} | [
"func",
"(",
"h",
"*",
"execWorker",
")",
"getResults",
"(",
")",
"execResult",
"{",
"h",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"h",
".",
"result",
"\n",
"}"
] | // getResults returns the results of the latest execWorker run.
// The caller should treat returned results as read-only. | [
"getResults",
"returns",
"the",
"results",
"of",
"the",
"latest",
"execWorker",
"run",
".",
"The",
"caller",
"should",
"treat",
"returned",
"results",
"as",
"read",
"-",
"only",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/exec-healthz/cmd/exechealthz/exechealthz.go#L116-L120 | train |
kubernetes-retired/contrib | exec-healthz/cmd/exechealthz/exechealthz.go | start | func (h *execWorker) start() {
ticker := h.clock.Tick(h.period)
h.readyCh <- struct{}{} // For testing.
for {
select {
// If the command takes > period, the command runs continuously.
case <-ticker:
logf("Worker running %v to serve %v", h.probeCmd, h.probePath)
output, err := h.exec.Command("sh", "-c", ... | go | func (h *execWorker) start() {
ticker := h.clock.Tick(h.period)
h.readyCh <- struct{}{} // For testing.
for {
select {
// If the command takes > period, the command runs continuously.
case <-ticker:
logf("Worker running %v to serve %v", h.probeCmd, h.probePath)
output, err := h.exec.Command("sh", "-c", ... | [
"func",
"(",
"h",
"*",
"execWorker",
")",
"start",
"(",
")",
"{",
"ticker",
":=",
"h",
".",
"clock",
".",
"Tick",
"(",
"h",
".",
"period",
")",
"\n",
"h",
".",
"readyCh",
"<-",
"struct",
"{",
"}",
"{",
"}",
"// For testing.",
"\n\n",
"for",
"{",
... | // start attempts to run the probeCmd every `period` seconds.
// Meant to be called as a goroutine. | [
"start",
"attempts",
"to",
"run",
"the",
"probeCmd",
"every",
"period",
"seconds",
".",
"Meant",
"to",
"be",
"called",
"as",
"a",
"goroutine",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/exec-healthz/cmd/exechealthz/exechealthz.go#L131-L151 | train |
kubernetes-retired/contrib | exec-healthz/cmd/exechealthz/exechealthz.go | newExecWorker | func newExecWorker(probeCmd, probePath string, execPeriod time.Duration, exec utilexec.Interface, clock clock.Clock, readyCh chan<- struct{}) *execWorker {
return &execWorker{
// Initializing the result with a timestamp here allows us to
// wait maxLatency for the worker goroutine to start, and for each
// itera... | go | func newExecWorker(probeCmd, probePath string, execPeriod time.Duration, exec utilexec.Interface, clock clock.Clock, readyCh chan<- struct{}) *execWorker {
return &execWorker{
// Initializing the result with a timestamp here allows us to
// wait maxLatency for the worker goroutine to start, and for each
// itera... | [
"func",
"newExecWorker",
"(",
"probeCmd",
",",
"probePath",
"string",
",",
"execPeriod",
"time",
".",
"Duration",
",",
"exec",
"utilexec",
".",
"Interface",
",",
"clock",
"clock",
".",
"Clock",
",",
"readyCh",
"chan",
"<-",
"struct",
"{",
"}",
")",
"*",
... | // newExecWorker is a constructor for execWorker. | [
"newExecWorker",
"is",
"a",
"constructor",
"for",
"execWorker",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/exec-healthz/cmd/exechealthz/exechealthz.go#L154-L168 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/sorter.go | numLess | func numLess(a, b reflect.Value) bool {
switch a.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return a.Int() < b.Int()
case reflect.Float32, reflect.Float64:
return a.Float() < b.Float()
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, re... | go | func numLess(a, b reflect.Value) bool {
switch a.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return a.Int() < b.Int()
case reflect.Float32, reflect.Float64:
return a.Float() < b.Float()
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, re... | [
"func",
"numLess",
"(",
"a",
",",
"b",
"reflect",
".",
"Value",
")",
"bool",
"{",
"switch",
"a",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",
".",
"Int16",
",",
"reflect",
".",
"Int32",
"... | // numLess returns whether a < b.
// a and b must necessarily have the same kind. | [
"numLess",
"returns",
"whether",
"a",
"<",
"b",
".",
"a",
"and",
"b",
"must",
"necessarily",
"have",
"the",
"same",
"kind",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/sorter.go#L92-L104 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pods.go | newPods | func newPods(c *Client, namespace string) *pods {
return &pods{
r: c,
ns: namespace,
}
} | go | func newPods(c *Client, namespace string) *pods {
return &pods{
r: c,
ns: namespace,
}
} | [
"func",
"newPods",
"(",
"c",
"*",
"Client",
",",
"namespace",
"string",
")",
"*",
"pods",
"{",
"return",
"&",
"pods",
"{",
"r",
":",
"c",
",",
"ns",
":",
"namespace",
",",
"}",
"\n",
"}"
] | // newPods returns a pods | [
"newPods",
"returns",
"a",
"pods"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pods.go#L49-L54 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pods.go | UpdateStatus | func (c *pods) UpdateStatus(pod *api.Pod) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).SubResource("status").Body(pod).Do().Into(result)
return
} | go | func (c *pods) UpdateStatus(pod *api.Pod) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).SubResource("status").Body(pod).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"pods",
")",
"UpdateStatus",
"(",
"pod",
"*",
"api",
".",
"Pod",
")",
"(",
"result",
"*",
"api",
".",
"Pod",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"api",
".",
"Pod",
"{",
"}",
"\n",
"err",
"=",
"c",
".",
... | // UpdateStatus takes the name of the pod and the new status. Returns the server's representation of the pod, and an error, if it occurs. | [
"UpdateStatus",
"takes",
"the",
"name",
"of",
"the",
"pod",
"and",
"the",
"new",
"status",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"pod",
"and",
"an",
"error",
"if",
"it",
"occurs",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pods.go#L105-L109 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go | BindStringFlag | func (f FlagInfo) BindStringFlag(flags *pflag.FlagSet, target *string) {
// you can't register a flag without a long name
if len(f.LongName) > 0 {
flags.StringVarP(target, f.LongName, f.ShortName, f.Default, f.Description)
}
} | go | func (f FlagInfo) BindStringFlag(flags *pflag.FlagSet, target *string) {
// you can't register a flag without a long name
if len(f.LongName) > 0 {
flags.StringVarP(target, f.LongName, f.ShortName, f.Default, f.Description)
}
} | [
"func",
"(",
"f",
"FlagInfo",
")",
"BindStringFlag",
"(",
"flags",
"*",
"pflag",
".",
"FlagSet",
",",
"target",
"*",
"string",
")",
"{",
"// you can't register a flag without a long name",
"if",
"len",
"(",
"f",
".",
"LongName",
")",
">",
"0",
"{",
"flags",
... | // BindStringFlag binds the flag based on the provided info. If LongName == "", nothing is registered | [
"BindStringFlag",
"binds",
"the",
"flag",
"based",
"on",
"the",
"provided",
"info",
".",
"If",
"LongName",
"==",
"nothing",
"is",
"registered"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go#L84-L89 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go | RecommendedConfigOverrideFlags | func RecommendedConfigOverrideFlags(prefix string) ConfigOverrideFlags {
return ConfigOverrideFlags{
AuthOverrideFlags: RecommendedAuthOverrideFlags(prefix),
ClusterOverrideFlags: RecommendedClusterOverrideFlags(prefix),
ContextOverrideFlags: RecommendedContextOverrideFlags(prefix),
CurrentContext: Fl... | go | func RecommendedConfigOverrideFlags(prefix string) ConfigOverrideFlags {
return ConfigOverrideFlags{
AuthOverrideFlags: RecommendedAuthOverrideFlags(prefix),
ClusterOverrideFlags: RecommendedClusterOverrideFlags(prefix),
ContextOverrideFlags: RecommendedContextOverrideFlags(prefix),
CurrentContext: Fl... | [
"func",
"RecommendedConfigOverrideFlags",
"(",
"prefix",
"string",
")",
"ConfigOverrideFlags",
"{",
"return",
"ConfigOverrideFlags",
"{",
"AuthOverrideFlags",
":",
"RecommendedAuthOverrideFlags",
"(",
"prefix",
")",
",",
"ClusterOverrideFlags",
":",
"RecommendedClusterOverrid... | // RecommendedConfigOverrideFlags is a convenience method to return recommended flag names prefixed with a string of your choosing | [
"RecommendedConfigOverrideFlags",
"is",
"a",
"convenience",
"method",
"to",
"return",
"recommended",
"flag",
"names",
"prefixed",
"with",
"a",
"string",
"of",
"your",
"choosing"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go#L144-L151 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go | BindClusterFlags | func BindClusterFlags(clusterInfo *clientcmdapi.Cluster, flags *pflag.FlagSet, flagNames ClusterOverrideFlags) {
flagNames.APIServer.BindStringFlag(flags, &clusterInfo.Server)
flagNames.APIVersion.BindStringFlag(flags, &clusterInfo.APIVersion)
flagNames.CertificateAuthority.BindStringFlag(flags, &clusterInfo.Certifi... | go | func BindClusterFlags(clusterInfo *clientcmdapi.Cluster, flags *pflag.FlagSet, flagNames ClusterOverrideFlags) {
flagNames.APIServer.BindStringFlag(flags, &clusterInfo.Server)
flagNames.APIVersion.BindStringFlag(flags, &clusterInfo.APIVersion)
flagNames.CertificateAuthority.BindStringFlag(flags, &clusterInfo.Certifi... | [
"func",
"BindClusterFlags",
"(",
"clusterInfo",
"*",
"clientcmdapi",
".",
"Cluster",
",",
"flags",
"*",
"pflag",
".",
"FlagSet",
",",
"flagNames",
"ClusterOverrideFlags",
")",
"{",
"flagNames",
".",
"APIServer",
".",
"BindStringFlag",
"(",
"flags",
",",
"&",
"... | // BindClusterFlags is a convenience method to bind the specified flags to their associated variables | [
"BindClusterFlags",
"is",
"a",
"convenience",
"method",
"to",
"bind",
"the",
"specified",
"flags",
"to",
"their",
"associated",
"variables"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go#L172-L177 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go | BindOverrideFlags | func BindOverrideFlags(overrides *ConfigOverrides, flags *pflag.FlagSet, flagNames ConfigOverrideFlags) {
BindAuthInfoFlags(&overrides.AuthInfo, flags, flagNames.AuthOverrideFlags)
BindClusterFlags(&overrides.ClusterInfo, flags, flagNames.ClusterOverrideFlags)
BindContextFlags(&overrides.Context, flags, flagNames.Co... | go | func BindOverrideFlags(overrides *ConfigOverrides, flags *pflag.FlagSet, flagNames ConfigOverrideFlags) {
BindAuthInfoFlags(&overrides.AuthInfo, flags, flagNames.AuthOverrideFlags)
BindClusterFlags(&overrides.ClusterInfo, flags, flagNames.ClusterOverrideFlags)
BindContextFlags(&overrides.Context, flags, flagNames.Co... | [
"func",
"BindOverrideFlags",
"(",
"overrides",
"*",
"ConfigOverrides",
",",
"flags",
"*",
"pflag",
".",
"FlagSet",
",",
"flagNames",
"ConfigOverrideFlags",
")",
"{",
"BindAuthInfoFlags",
"(",
"&",
"overrides",
".",
"AuthInfo",
",",
"flags",
",",
"flagNames",
"."... | // BindOverrideFlags is a convenience method to bind the specified flags to their associated variables | [
"BindOverrideFlags",
"is",
"a",
"convenience",
"method",
"to",
"bind",
"the",
"specified",
"flags",
"to",
"their",
"associated",
"variables"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go#L180-L185 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go | PrintSuccess | func PrintSuccess(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource string, name string, operation string) {
resource, _ = mapper.ResourceSingularizer(resource)
if shortOutput {
// -o name: prints resource/name
if len(resource) > 0 {
fmt.Fprintf(out, "%s/%s\n", resource, name)
} else {
fmt... | go | func PrintSuccess(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource string, name string, operation string) {
resource, _ = mapper.ResourceSingularizer(resource)
if shortOutput {
// -o name: prints resource/name
if len(resource) > 0 {
fmt.Fprintf(out, "%s/%s\n", resource, name)
} else {
fmt... | [
"func",
"PrintSuccess",
"(",
"mapper",
"meta",
".",
"RESTMapper",
",",
"shortOutput",
"bool",
",",
"out",
"io",
".",
"Writer",
",",
"resource",
"string",
",",
"name",
"string",
",",
"operation",
"string",
")",
"{",
"resource",
",",
"_",
"=",
"mapper",
".... | // PrintSuccess prints message after finishing mutating operations | [
"PrintSuccess",
"prints",
"message",
"after",
"finishing",
"mutating",
"operations"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go#L51-L68 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go | ValidateOutputArgs | func ValidateOutputArgs(cmd *cobra.Command) error {
outputMode := GetFlagString(cmd, "output")
if outputMode != "" && outputMode != "name" {
return UsageError(cmd, "Unexpected -o output mode: %v. We only support '-o name'.", outputMode)
}
return nil
} | go | func ValidateOutputArgs(cmd *cobra.Command) error {
outputMode := GetFlagString(cmd, "output")
if outputMode != "" && outputMode != "name" {
return UsageError(cmd, "Unexpected -o output mode: %v. We only support '-o name'.", outputMode)
}
return nil
} | [
"func",
"ValidateOutputArgs",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"error",
"{",
"outputMode",
":=",
"GetFlagString",
"(",
"cmd",
",",
"\"",
"\"",
")",
"\n",
"if",
"outputMode",
"!=",
"\"",
"\"",
"&&",
"outputMode",
"!=",
"\"",
"\"",
"{",
"re... | // ValidateOutputArgs validates -o flag args for mutations | [
"ValidateOutputArgs",
"validates",
"-",
"o",
"flag",
"args",
"for",
"mutations"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go#L71-L77 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go | ServerResources | func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error) {
apiGroups, err := d.ServerGroups()
if err != nil {
return nil, err
}
groupVersions := ExtractGroupVersions(apiGroups)
result := map[string]*unversioned.APIResourceList{}
for _, groupVersion := range groupVersions {
... | go | func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error) {
apiGroups, err := d.ServerGroups()
if err != nil {
return nil, err
}
groupVersions := ExtractGroupVersions(apiGroups)
result := map[string]*unversioned.APIResourceList{}
for _, groupVersion := range groupVersions {
... | [
"func",
"(",
"d",
"*",
"DiscoveryClient",
")",
"ServerResources",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"unversioned",
".",
"APIResourceList",
",",
"error",
")",
"{",
"apiGroups",
",",
"err",
":=",
"d",
".",
"ServerGroups",
"(",
")",
"\n",
"if... | // ServerResources returns the supported resources for all groups and versions. | [
"ServerResources",
"returns",
"the",
"supported",
"resources",
"for",
"all",
"groups",
"and",
"versions",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go#L124-L139 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go | propagateCancel | func propagateCancel(parent Context, child canceler) {
if parent.Done() == nil {
return // parent is never canceled
}
if p, ok := parentCancelCtx(parent); ok {
p.mu.Lock()
if p.err != nil {
// parent has already been canceled
child.cancel(false, p.err)
} else {
if p.children == nil {
p.children ... | go | func propagateCancel(parent Context, child canceler) {
if parent.Done() == nil {
return // parent is never canceled
}
if p, ok := parentCancelCtx(parent); ok {
p.mu.Lock()
if p.err != nil {
// parent has already been canceled
child.cancel(false, p.err)
} else {
if p.children == nil {
p.children ... | [
"func",
"propagateCancel",
"(",
"parent",
"Context",
",",
"child",
"canceler",
")",
"{",
"if",
"parent",
".",
"Done",
"(",
")",
"==",
"nil",
"{",
"return",
"// parent is never canceled",
"\n",
"}",
"\n",
"if",
"p",
",",
"ok",
":=",
"parentCancelCtx",
"(",
... | // propagateCancel arranges for child to be canceled when parent is. | [
"propagateCancel",
"arranges",
"for",
"child",
"to",
"be",
"canceled",
"when",
"parent",
"is",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go#L226-L251 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go | removeChild | func removeChild(parent Context, child canceler) {
p, ok := parentCancelCtx(parent)
if !ok {
return
}
p.mu.Lock()
if p.children != nil {
delete(p.children, child)
}
p.mu.Unlock()
} | go | func removeChild(parent Context, child canceler) {
p, ok := parentCancelCtx(parent)
if !ok {
return
}
p.mu.Lock()
if p.children != nil {
delete(p.children, child)
}
p.mu.Unlock()
} | [
"func",
"removeChild",
"(",
"parent",
"Context",
",",
"child",
"canceler",
")",
"{",
"p",
",",
"ok",
":=",
"parentCancelCtx",
"(",
"parent",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"p",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
... | // removeChild removes a context from its parent. | [
"removeChild",
"removes",
"a",
"context",
"from",
"its",
"parent",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go#L272-L282 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go | cancel | func (c *cancelCtx) cancel(removeFromParent bool, err error) {
if err == nil {
panic("context: internal error: missing cancel error")
}
c.mu.Lock()
if c.err != nil {
c.mu.Unlock()
return // already canceled
}
c.err = err
close(c.done)
for child := range c.children {
// NOTE: acquiring the child's lock w... | go | func (c *cancelCtx) cancel(removeFromParent bool, err error) {
if err == nil {
panic("context: internal error: missing cancel error")
}
c.mu.Lock()
if c.err != nil {
c.mu.Unlock()
return // already canceled
}
c.err = err
close(c.done)
for child := range c.children {
// NOTE: acquiring the child's lock w... | [
"func",
"(",
"c",
"*",
"cancelCtx",
")",
"cancel",
"(",
"removeFromParent",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",... | // cancel closes c.done, cancels each of c's children, and, if
// removeFromParent is true, removes c from its parent's children. | [
"cancel",
"closes",
"c",
".",
"done",
"cancels",
"each",
"of",
"c",
"s",
"children",
"and",
"if",
"removeFromParent",
"is",
"true",
"removes",
"c",
"from",
"its",
"parent",
"s",
"children",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/net/context/context.go#L319-L340 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetOldRCs | func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.ReplicationController, error) {
return GetOldRCsFromLists(deployment, c,
func(namespace string, options api.ListOptions) (*api.PodList, error) {
return c.Pods(namespace).List(options)
},
func(namespace string, options api.ListOptions... | go | func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.ReplicationController, error) {
return GetOldRCsFromLists(deployment, c,
func(namespace string, options api.ListOptions) (*api.PodList, error) {
return c.Pods(namespace).List(options)
},
func(namespace string, options api.ListOptions... | [
"func",
"GetOldRCs",
"(",
"deployment",
"extensions",
".",
"Deployment",
",",
"c",
"client",
".",
"Interface",
")",
"(",
"[",
"]",
"*",
"api",
".",
"ReplicationController",
",",
"error",
")",
"{",
"return",
"GetOldRCsFromLists",
"(",
"deployment",
",",
"c",
... | // GetOldRCs returns the old RCs targeted by the given Deployment; get PodList and RCList from client interface. | [
"GetOldRCs",
"returns",
"the",
"old",
"RCs",
"targeted",
"by",
"the",
"given",
"Deployment",
";",
"get",
"PodList",
"and",
"RCList",
"from",
"client",
"interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L32-L41 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetNewRC | func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) {
return GetNewRCFromList(deployment, c,
func(namespace string, options api.ListOptions) ([]api.ReplicationController, error) {
rcList, err := c.ReplicationControllers(namespace).List(options)
return rcList.... | go | func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) {
return GetNewRCFromList(deployment, c,
func(namespace string, options api.ListOptions) ([]api.ReplicationController, error) {
rcList, err := c.ReplicationControllers(namespace).List(options)
return rcList.... | [
"func",
"GetNewRC",
"(",
"deployment",
"extensions",
".",
"Deployment",
",",
"c",
"client",
".",
"Interface",
")",
"(",
"*",
"api",
".",
"ReplicationController",
",",
"error",
")",
"{",
"return",
"GetNewRCFromList",
"(",
"deployment",
",",
"c",
",",
"func",
... | // GetNewRC returns an RC that matches the intent of the given deployment; get RCList from client interface.
// Returns nil if the new RC doesnt exist yet. | [
"GetNewRC",
"returns",
"an",
"RC",
"that",
"matches",
"the",
"intent",
"of",
"the",
"given",
"deployment",
";",
"get",
"RCList",
"from",
"client",
"interface",
".",
"Returns",
"nil",
"if",
"the",
"new",
"RC",
"doesnt",
"exist",
"yet",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L84-L90 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetNewRCFromList | func GetNewRCFromList(deployment extensions.Deployment, c client.Interface, getRcList func(string, api.ListOptions) ([]api.ReplicationController, error)) (*api.ReplicationController, error) {
namespace := deployment.ObjectMeta.Namespace
rcList, err := getRcList(namespace, api.ListOptions{})
if err != nil {
return ... | go | func GetNewRCFromList(deployment extensions.Deployment, c client.Interface, getRcList func(string, api.ListOptions) ([]api.ReplicationController, error)) (*api.ReplicationController, error) {
namespace := deployment.ObjectMeta.Namespace
rcList, err := getRcList(namespace, api.ListOptions{})
if err != nil {
return ... | [
"func",
"GetNewRCFromList",
"(",
"deployment",
"extensions",
".",
"Deployment",
",",
"c",
"client",
".",
"Interface",
",",
"getRcList",
"func",
"(",
"string",
",",
"api",
".",
"ListOptions",
")",
"(",
"[",
"]",
"api",
".",
"ReplicationController",
",",
"erro... | // GetNewRCFromList returns an RC that matches the intent of the given deployment; get RCList with the input function.
// Returns nil if the new RC doesnt exist yet. | [
"GetNewRCFromList",
"returns",
"an",
"RC",
"that",
"matches",
"the",
"intent",
"of",
"the",
"given",
"deployment",
";",
"get",
"RCList",
"with",
"the",
"input",
"function",
".",
"Returns",
"nil",
"if",
"the",
"new",
"RC",
"doesnt",
"exist",
"yet",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L94-L110 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetNewRCTemplate | func GetNewRCTemplate(deployment extensions.Deployment) api.PodTemplateSpec {
// newRC will have the same template as in deployment spec, plus a unique label in some cases.
newRCTemplate := api.PodTemplateSpec{
ObjectMeta: deployment.Spec.Template.ObjectMeta,
Spec: deployment.Spec.Template.Spec,
}
newRCTe... | go | func GetNewRCTemplate(deployment extensions.Deployment) api.PodTemplateSpec {
// newRC will have the same template as in deployment spec, plus a unique label in some cases.
newRCTemplate := api.PodTemplateSpec{
ObjectMeta: deployment.Spec.Template.ObjectMeta,
Spec: deployment.Spec.Template.Spec,
}
newRCTe... | [
"func",
"GetNewRCTemplate",
"(",
"deployment",
"extensions",
".",
"Deployment",
")",
"api",
".",
"PodTemplateSpec",
"{",
"// newRC will have the same template as in deployment spec, plus a unique label in some cases.",
"newRCTemplate",
":=",
"api",
".",
"PodTemplateSpec",
"{",
... | // Returns the desired PodTemplateSpec for the new RC corresponding to the given RC. | [
"Returns",
"the",
"desired",
"PodTemplateSpec",
"for",
"the",
"new",
"RC",
"corresponding",
"to",
"the",
"given",
"RC",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L113-L124 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetReplicaCountForRCs | func GetReplicaCountForRCs(replicationControllers []*api.ReplicationController) int {
totalReplicaCount := 0
for _, rc := range replicationControllers {
totalReplicaCount += rc.Spec.Replicas
}
return totalReplicaCount
} | go | func GetReplicaCountForRCs(replicationControllers []*api.ReplicationController) int {
totalReplicaCount := 0
for _, rc := range replicationControllers {
totalReplicaCount += rc.Spec.Replicas
}
return totalReplicaCount
} | [
"func",
"GetReplicaCountForRCs",
"(",
"replicationControllers",
"[",
"]",
"*",
"api",
".",
"ReplicationController",
")",
"int",
"{",
"totalReplicaCount",
":=",
"0",
"\n",
"for",
"_",
",",
"rc",
":=",
"range",
"replicationControllers",
"{",
"totalReplicaCount",
"+=... | // Returns the sum of Replicas of the given replication controllers. | [
"Returns",
"the",
"sum",
"of",
"Replicas",
"of",
"the",
"given",
"replication",
"controllers",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L149-L155 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go | GetAvailablePodsForRCs | func GetAvailablePodsForRCs(c client.Interface, rcs []*api.ReplicationController, minReadySeconds int) (int, error) {
allPods, err := getPodsForRCs(c, rcs)
if err != nil {
return 0, err
}
return getReadyPodsCount(allPods, minReadySeconds), nil
} | go | func GetAvailablePodsForRCs(c client.Interface, rcs []*api.ReplicationController, minReadySeconds int) (int, error) {
allPods, err := getPodsForRCs(c, rcs)
if err != nil {
return 0, err
}
return getReadyPodsCount(allPods, minReadySeconds), nil
} | [
"func",
"GetAvailablePodsForRCs",
"(",
"c",
"client",
".",
"Interface",
",",
"rcs",
"[",
"]",
"*",
"api",
".",
"ReplicationController",
",",
"minReadySeconds",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"allPods",
",",
"err",
":=",
"getPodsForRCs",
"(... | // Returns the number of available pods corresponding to the given RCs. | [
"Returns",
"the",
"number",
"of",
"available",
"pods",
"corresponding",
"to",
"the",
"given",
"RCs",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/deployment/deployment.go#L158-L164 | train |
kubernetes-retired/contrib | keepalived-vip/keepalived.go | WriteCfg | func (k *keepalived) WriteCfg(svcs []vip) error {
w, err := os.Create(keepalivedCfg)
if err != nil {
return err
}
defer w.Close()
k.vips = getVIPs(svcs)
conf := make(map[string]interface{})
conf["iptablesChain"] = iptablesChain
conf["iface"] = k.iface
conf["myIP"] = k.ip
conf["netmask"] = k.netmask
conf[... | go | func (k *keepalived) WriteCfg(svcs []vip) error {
w, err := os.Create(keepalivedCfg)
if err != nil {
return err
}
defer w.Close()
k.vips = getVIPs(svcs)
conf := make(map[string]interface{})
conf["iptablesChain"] = iptablesChain
conf["iface"] = k.iface
conf["myIP"] = k.ip
conf["netmask"] = k.netmask
conf[... | [
"func",
"(",
"k",
"*",
"keepalived",
")",
"WriteCfg",
"(",
"svcs",
"[",
"]",
"vip",
")",
"error",
"{",
"w",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"keepalivedCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
... | // WriteCfg creates a new keepalived configuration file.
// In case of an error with the generation it returns the error | [
"WriteCfg",
"creates",
"a",
"new",
"keepalived",
"configuration",
"file",
".",
"In",
"case",
"of",
"an",
"error",
"with",
"the",
"generation",
"it",
"returns",
"the",
"error"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/keepalived-vip/keepalived.go#L59-L88 | train |
kubernetes-retired/contrib | keepalived-vip/keepalived.go | Start | func (k *keepalived) Start() {
ae, err := k.ipt.EnsureChain(iptables.TableFilter, iptables.Chain(iptablesChain))
if err != nil {
glog.Fatalf("unexpected error: %v", err)
}
if ae {
glog.V(2).Infof("chain %v already existed", iptablesChain)
}
k.cmd = exec.Command("keepalived",
"--dont-fork",
"--log-console... | go | func (k *keepalived) Start() {
ae, err := k.ipt.EnsureChain(iptables.TableFilter, iptables.Chain(iptablesChain))
if err != nil {
glog.Fatalf("unexpected error: %v", err)
}
if ae {
glog.V(2).Infof("chain %v already existed", iptablesChain)
}
k.cmd = exec.Command("keepalived",
"--dont-fork",
"--log-console... | [
"func",
"(",
"k",
"*",
"keepalived",
")",
"Start",
"(",
")",
"{",
"ae",
",",
"err",
":=",
"k",
".",
"ipt",
".",
"EnsureChain",
"(",
"iptables",
".",
"TableFilter",
",",
"iptables",
".",
"Chain",
"(",
"iptablesChain",
")",
")",
"\n",
"if",
"err",
"!... | // Start starts a keepalived process in foreground.
// In case of any error it will terminate the execution with a fatal error | [
"Start",
"starts",
"a",
"keepalived",
"process",
"in",
"foreground",
".",
"In",
"case",
"of",
"any",
"error",
"it",
"will",
"terminate",
"the",
"execution",
"with",
"a",
"fatal",
"error"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/keepalived-vip/keepalived.go#L103-L130 | train |
kubernetes-retired/contrib | keepalived-vip/keepalived.go | Reload | func (k *keepalived) Reload() error {
if !k.started {
// TODO: add a warning indicating that keepalived is not started?
return nil
}
glog.Info("reloading keepalived")
err := syscall.Kill(k.cmd.Process.Pid, syscall.SIGHUP)
if err != nil {
return fmt.Errorf("error reloading keepalived: %v", err)
}
return n... | go | func (k *keepalived) Reload() error {
if !k.started {
// TODO: add a warning indicating that keepalived is not started?
return nil
}
glog.Info("reloading keepalived")
err := syscall.Kill(k.cmd.Process.Pid, syscall.SIGHUP)
if err != nil {
return fmt.Errorf("error reloading keepalived: %v", err)
}
return n... | [
"func",
"(",
"k",
"*",
"keepalived",
")",
"Reload",
"(",
")",
"error",
"{",
"if",
"!",
"k",
".",
"started",
"{",
"// TODO: add a warning indicating that keepalived is not started?",
"return",
"nil",
"\n",
"}",
"\n\n",
"glog",
".",
"Info",
"(",
"\"",
"\"",
")... | // Reload sends SIGHUP to keepalived to reload the configuration. | [
"Reload",
"sends",
"SIGHUP",
"to",
"keepalived",
"to",
"reload",
"the",
"configuration",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/keepalived-vip/keepalived.go#L133-L146 | train |
kubernetes-retired/contrib | keepalived-vip/keepalived.go | Stop | func (k *keepalived) Stop() {
for _, vip := range k.vips {
k.removeVIP(vip)
}
err := k.ipt.FlushChain(iptables.TableFilter, iptables.Chain(iptablesChain))
if err != nil {
glog.V(2).Infof("unexpected error flushing iptables chain %v: %v", err, iptablesChain)
}
err = syscall.Kill(k.cmd.Process.Pid, syscall.SI... | go | func (k *keepalived) Stop() {
for _, vip := range k.vips {
k.removeVIP(vip)
}
err := k.ipt.FlushChain(iptables.TableFilter, iptables.Chain(iptablesChain))
if err != nil {
glog.V(2).Infof("unexpected error flushing iptables chain %v: %v", err, iptablesChain)
}
err = syscall.Kill(k.cmd.Process.Pid, syscall.SI... | [
"func",
"(",
"k",
"*",
"keepalived",
")",
"Stop",
"(",
")",
"{",
"for",
"_",
",",
"vip",
":=",
"range",
"k",
".",
"vips",
"{",
"k",
".",
"removeVIP",
"(",
"vip",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"k",
".",
"ipt",
".",
"FlushChain",
"(",
"i... | // Stop stop keepalived process | [
"Stop",
"stop",
"keepalived",
"process"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/keepalived-vip/keepalived.go#L149-L163 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/parser.go | parseQuote | func (p *Parser) parseQuote(cur *ListNode) error {
Loop:
for {
switch p.next() {
case eof, '\n':
return fmt.Errorf("unterminated quoted string")
case '"':
break Loop
}
}
value := p.consumeText()
s, err := strconv.Unquote(value)
if err != nil {
return fmt.Errorf("unquote string %s error %v", value, ... | go | func (p *Parser) parseQuote(cur *ListNode) error {
Loop:
for {
switch p.next() {
case eof, '\n':
return fmt.Errorf("unterminated quoted string")
case '"':
break Loop
}
}
value := p.consumeText()
s, err := strconv.Unquote(value)
if err != nil {
return fmt.Errorf("unquote string %s error %v", value, ... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseQuote",
"(",
"cur",
"*",
"ListNode",
")",
"error",
"{",
"Loop",
":",
"for",
"{",
"switch",
"p",
".",
"next",
"(",
")",
"{",
"case",
"eof",
",",
"'\\n'",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
... | // parseQuote unquotes string inside double quote | [
"parseQuote",
"unquotes",
"string",
"inside",
"double",
"quote"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/jsonpath/parser.go#L363-L380 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/v1/defaults.go | defaultHostNetworkPorts | func defaultHostNetworkPorts(containers *[]Container) {
for i := range *containers {
for j := range (*containers)[i].Ports {
if (*containers)[i].Ports[j].HostPort == 0 {
(*containers)[i].Ports[j].HostPort = (*containers)[i].Ports[j].ContainerPort
}
}
}
} | go | func defaultHostNetworkPorts(containers *[]Container) {
for i := range *containers {
for j := range (*containers)[i].Ports {
if (*containers)[i].Ports[j].HostPort == 0 {
(*containers)[i].Ports[j].HostPort = (*containers)[i].Ports[j].ContainerPort
}
}
}
} | [
"func",
"defaultHostNetworkPorts",
"(",
"containers",
"*",
"[",
"]",
"Container",
")",
"{",
"for",
"i",
":=",
"range",
"*",
"containers",
"{",
"for",
"j",
":=",
"range",
"(",
"*",
"containers",
")",
"[",
"i",
"]",
".",
"Ports",
"{",
"if",
"(",
"*",
... | // With host networking default all container ports to host ports. | [
"With",
"host",
"networking",
"default",
"all",
"container",
"ports",
"to",
"host",
"ports",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/v1/defaults.go#L255-L263 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/validation/schema.go | validateList | func (s *SwaggerSchema) validateList(obj map[string]interface{}) []error {
allErrs := []error{}
items, exists := obj["items"]
if !exists {
return append(allErrs, fmt.Errorf("no items field in %#v", obj))
}
itemList, ok := items.([]interface{})
if !ok {
return append(allErrs, fmt.Errorf("items isn't a slice"))... | go | func (s *SwaggerSchema) validateList(obj map[string]interface{}) []error {
allErrs := []error{}
items, exists := obj["items"]
if !exists {
return append(allErrs, fmt.Errorf("no items field in %#v", obj))
}
itemList, ok := items.([]interface{})
if !ok {
return append(allErrs, fmt.Errorf("items isn't a slice"))... | [
"func",
"(",
"s",
"*",
"SwaggerSchema",
")",
"validateList",
"(",
"obj",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"error",
"{",
"allErrs",
":=",
"[",
"]",
"error",
"{",
"}",
"\n",
"items",
",",
"exists",
":=",
"obj",
"[",
... | // validateList unpacks a list and validate every item in the list.
// It return nil if every item is ok.
// Otherwise it return an error list contain errors of every item. | [
"validateList",
"unpacks",
"a",
"list",
"and",
"validate",
"every",
"item",
"in",
"the",
"list",
".",
"It",
"return",
"nil",
"if",
"every",
"item",
"is",
"ok",
".",
"Otherwise",
"it",
"return",
"an",
"error",
"list",
"contain",
"errors",
"of",
"every",
"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/validation/schema.go#L72-L121 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go | AllPtrFieldsNil | func AllPtrFieldsNil(obj interface{}) bool {
v := reflect.ValueOf(obj)
if !v.IsValid() {
panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj))
}
if v.Kind() == reflect.Ptr {
if v.IsNil() {
return true
}
v = v.Elem()
}
for i := 0; i < v.NumField(); i++ {
if v.Field(i).Kind() ... | go | func AllPtrFieldsNil(obj interface{}) bool {
v := reflect.ValueOf(obj)
if !v.IsValid() {
panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj))
}
if v.Kind() == reflect.Ptr {
if v.IsNil() {
return true
}
v = v.Elem()
}
for i := 0; i < v.NumField(); i++ {
if v.Field(i).Kind() ... | [
"func",
"AllPtrFieldsNil",
"(",
"obj",
"interface",
"{",
"}",
")",
"bool",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"obj",
")",
"\n",
"if",
"!",
"v",
".",
"IsValid",
"(",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",... | // Tests whether all pointer fields in a struct are nil. This is useful when,
// for example, an API struct is handled by plugins which need to distinguish
// "no plugin accepted this spec" from "this spec is empty".
//
// This function is only valid for structs and pointers to structs. Any other
// type will cause a... | [
"Tests",
"whether",
"all",
"pointer",
"fields",
"in",
"a",
"struct",
"are",
"nil",
".",
"This",
"is",
"useful",
"when",
"for",
"example",
"an",
"API",
"struct",
"is",
"handled",
"by",
"plugins",
"which",
"need",
"to",
"distinguish",
"no",
"plugin",
"accept... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go#L59-L76 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go | ReadDirNoExit | func ReadDirNoExit(dirname string) ([]os.FileInfo, []error, error) {
if dirname == "" {
dirname = "."
}
f, err := os.Open(dirname)
if err != nil {
return nil, nil, err
}
defer f.Close()
names, err := f.Readdirnames(-1)
list := make([]os.FileInfo, 0, len(names))
errs := make([]error, 0, len(names))
for _... | go | func ReadDirNoExit(dirname string) ([]os.FileInfo, []error, error) {
if dirname == "" {
dirname = "."
}
f, err := os.Open(dirname)
if err != nil {
return nil, nil, err
}
defer f.Close()
names, err := f.Readdirnames(-1)
list := make([]os.FileInfo, 0, len(names))
errs := make([]error, 0, len(names))
for _... | [
"func",
"ReadDirNoExit",
"(",
"dirname",
"string",
")",
"(",
"[",
"]",
"os",
".",
"FileInfo",
",",
"[",
"]",
"error",
",",
"error",
")",
"{",
"if",
"dirname",
"==",
"\"",
"\"",
"{",
"dirname",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"f",
",",
"err",
... | // borrowed from ioutil.ReadDir
// ReadDir reads the directory named by dirname and returns
// a list of directory entries, minus those with lstat errors | [
"borrowed",
"from",
"ioutil",
".",
"ReadDir",
"ReadDir",
"reads",
"the",
"directory",
"named",
"by",
"dirname",
"and",
"returns",
"a",
"list",
"of",
"directory",
"entries",
"minus",
"those",
"with",
"lstat",
"errors"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go#L90-L117 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go | IntPtrDerefOr | func IntPtrDerefOr(ptr *int, def int) int {
if ptr != nil {
return *ptr
}
return def
} | go | func IntPtrDerefOr(ptr *int, def int) int {
if ptr != nil {
return *ptr
}
return def
} | [
"func",
"IntPtrDerefOr",
"(",
"ptr",
"*",
"int",
",",
"def",
"int",
")",
"int",
"{",
"if",
"ptr",
"!=",
"nil",
"{",
"return",
"*",
"ptr",
"\n",
"}",
"\n",
"return",
"def",
"\n",
"}"
] | // IntPtrDerefOr dereference the int ptr and returns it i not nil,
// else returns def. | [
"IntPtrDerefOr",
"dereference",
"the",
"int",
"ptr",
"and",
"returns",
"it",
"i",
"not",
"nil",
"else",
"returns",
"def",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/util.go#L127-L132 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/events.go | Create | func (e *events) Create(event *api.Event) (*api.Event, error) {
if e.namespace != "" && event.Namespace != e.namespace {
return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace)
}
result := &api.Event{}
err := e.client.Post().
Namespace(event.Namespace)... | go | func (e *events) Create(event *api.Event) (*api.Event, error) {
if e.namespace != "" && event.Namespace != e.namespace {
return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace)
}
result := &api.Event{}
err := e.client.Post().
Namespace(event.Namespace)... | [
"func",
"(",
"e",
"*",
"events",
")",
"Create",
"(",
"event",
"*",
"api",
".",
"Event",
")",
"(",
"*",
"api",
".",
"Event",
",",
"error",
")",
"{",
"if",
"e",
".",
"namespace",
"!=",
"\"",
"\"",
"&&",
"event",
".",
"Namespace",
"!=",
"e",
".",
... | // Create makes a new event. Returns the copy of the event the server returns,
// or an error. The namespace to create the event within is deduced from the
// event; it must either match this event client's namespace, or this event
// client must have been created with the "" namespace. | [
"Create",
"makes",
"a",
"new",
"event",
".",
"Returns",
"the",
"copy",
"of",
"the",
"event",
"the",
"server",
"returns",
"or",
"an",
"error",
".",
"The",
"namespace",
"to",
"create",
"the",
"event",
"within",
"is",
"deduced",
"from",
"the",
"event",
";",... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/events.go#L69-L81 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/events.go | Patch | func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, error) {
result := &api.Event{}
err := e.client.Patch(api.StrategicMergePatchType).
Namespace(incompleteEvent.Namespace).
Resource("events").
Name(incompleteEvent.Name).
Body(data).
Do().
Into(result)
return result, err
} | go | func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, error) {
result := &api.Event{}
err := e.client.Patch(api.StrategicMergePatchType).
Namespace(incompleteEvent.Namespace).
Resource("events").
Name(incompleteEvent.Name).
Body(data).
Do().
Into(result)
return result, err
} | [
"func",
"(",
"e",
"*",
"events",
")",
"Patch",
"(",
"incompleteEvent",
"*",
"api",
".",
"Event",
",",
"data",
"[",
"]",
"byte",
")",
"(",
"*",
"api",
".",
"Event",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"Event",
"{",
"}",
"\n"... | // Patch modifies an existing event. It returns the copy of the event that the server returns, or an
// error. The namespace and name of the target event is deduced from the incompleteEvent. The
// namespace must either match this event client's namespace, or this event client must have been
// created with the "" name... | [
"Patch",
"modifies",
"an",
"existing",
"event",
".",
"It",
"returns",
"the",
"copy",
"of",
"the",
"event",
"that",
"the",
"server",
"returns",
"or",
"an",
"error",
".",
"The",
"namespace",
"and",
"name",
"of",
"the",
"target",
"event",
"is",
"deduced",
"... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/events.go#L104-L114 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go | scaleDown | func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desired, minAvailable, maxUnavailable, maxSurge int, config *RollingUpdaterConfig) (*api.ReplicationController, error) {
// Already scaled down; do nothing.
if oldRc.Spec.Replicas == 0 {
return oldRc, nil
}
// Block until there are any po... | go | func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desired, minAvailable, maxUnavailable, maxSurge int, config *RollingUpdaterConfig) (*api.ReplicationController, error) {
// Already scaled down; do nothing.
if oldRc.Spec.Replicas == 0 {
return oldRc, nil
}
// Block until there are any po... | [
"func",
"(",
"r",
"*",
"RollingUpdater",
")",
"scaleDown",
"(",
"newRc",
",",
"oldRc",
"*",
"api",
".",
"ReplicationController",
",",
"desired",
",",
"minAvailable",
",",
"maxUnavailable",
",",
"maxSurge",
"int",
",",
"config",
"*",
"RollingUpdaterConfig",
")"... | // scaleDown scales down oldRc to 0 at whatever increment possible given the
// thresholds defined on the config. scaleDown will safely no-op as necessary
// when it detects redundancy or other relevant conditions. | [
"scaleDown",
"scales",
"down",
"oldRc",
"to",
"0",
"at",
"whatever",
"increment",
"possible",
"given",
"the",
"thresholds",
"defined",
"on",
"the",
"config",
".",
"scaleDown",
"will",
"safely",
"no",
"-",
"op",
"as",
"necessary",
"when",
"it",
"detects",
"re... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go#L305-L349 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go | extractMaxValue | func extractMaxValue(field intstr.IntOrString, name string, value int) (int, error) {
switch field.Type {
case intstr.Int:
if field.IntVal < 0 {
return 0, fmt.Errorf("%s must be >= 0", name)
}
return field.IntValue(), nil
case intstr.String:
s := strings.Replace(field.StrVal, "%", "", -1)
v, err := strc... | go | func extractMaxValue(field intstr.IntOrString, name string, value int) (int, error) {
switch field.Type {
case intstr.Int:
if field.IntVal < 0 {
return 0, fmt.Errorf("%s must be >= 0", name)
}
return field.IntValue(), nil
case intstr.String:
s := strings.Replace(field.StrVal, "%", "", -1)
v, err := strc... | [
"func",
"extractMaxValue",
"(",
"field",
"intstr",
".",
"IntOrString",
",",
"name",
"string",
",",
"value",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"switch",
"field",
".",
"Type",
"{",
"case",
"intstr",
".",
"Int",
":",
"if",
"field",
".",
"I... | // func extractMaxValue is a helper to extract config max values as either
// absolute numbers or based on percentages of the given value. | [
"func",
"extractMaxValue",
"is",
"a",
"helper",
"to",
"extract",
"config",
"max",
"values",
"as",
"either",
"absolute",
"numbers",
"or",
"based",
"on",
"percentages",
"of",
"the",
"given",
"value",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go#L495-L514 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go | updateWithRetries | func updateWithRetries(rcClient client.ReplicationControllerInterface, rc *api.ReplicationController, applyUpdate updateFunc) (*api.ReplicationController, error) {
var err error
oldRc := rc
err = wait.Poll(10*time.Millisecond, 1*time.Minute, func() (bool, error) {
// Apply the update, then attempt to push it to th... | go | func updateWithRetries(rcClient client.ReplicationControllerInterface, rc *api.ReplicationController, applyUpdate updateFunc) (*api.ReplicationController, error) {
var err error
oldRc := rc
err = wait.Poll(10*time.Millisecond, 1*time.Minute, func() (bool, error) {
// Apply the update, then attempt to push it to th... | [
"func",
"updateWithRetries",
"(",
"rcClient",
"client",
".",
"ReplicationControllerInterface",
",",
"rc",
"*",
"api",
".",
"ReplicationController",
",",
"applyUpdate",
"updateFunc",
")",
"(",
"*",
"api",
".",
"ReplicationController",
",",
"error",
")",
"{",
"var",... | // updateWithRetries updates applies the given rc as an update. | [
"updateWithRetries",
"updates",
"applies",
"the",
"given",
"rc",
"as",
"an",
"update",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go#L726-L748 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go | Create | func (c *nodes) Create(node *api.Node) (*api.Node, error) {
result := &api.Node{}
err := c.r.Post().Resource(c.resourceName()).Body(node).Do().Into(result)
return result, err
} | go | func (c *nodes) Create(node *api.Node) (*api.Node, error) {
result := &api.Node{}
err := c.r.Post().Resource(c.resourceName()).Body(node).Do().Into(result)
return result, err
} | [
"func",
"(",
"c",
"*",
"nodes",
")",
"Create",
"(",
"node",
"*",
"api",
".",
"Node",
")",
"(",
"*",
"api",
".",
"Node",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"Node",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"r",
".",
"Post"... | // Create creates a new node. | [
"Create",
"creates",
"a",
"new",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go#L56-L60 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go | Get | func (c *nodes) Get(name string) (*api.Node, error) {
result := &api.Node{}
err := c.r.Get().Resource(c.resourceName()).Name(name).Do().Into(result)
return result, err
} | go | func (c *nodes) Get(name string) (*api.Node, error) {
result := &api.Node{}
err := c.r.Get().Resource(c.resourceName()).Name(name).Do().Into(result)
return result, err
} | [
"func",
"(",
"c",
"*",
"nodes",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"Node",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"Node",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"r",
".",
"Get",
"(",
")",
".",
... | // Get gets an existing node. | [
"Get",
"gets",
"an",
"existing",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go#L70-L74 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go | Delete | func (c *nodes) Delete(name string) error {
return c.r.Delete().Resource(c.resourceName()).Name(name).Do().Error()
} | go | func (c *nodes) Delete(name string) error {
return c.r.Delete().Resource(c.resourceName()).Name(name).Do().Error()
} | [
"func",
"(",
"c",
"*",
"nodes",
")",
"Delete",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"r",
".",
"Delete",
"(",
")",
".",
"Resource",
"(",
"c",
".",
"resourceName",
"(",
")",
")",
".",
"Name",
"(",
"name",
")",
".",
"Do",
... | // Delete deletes an existing node. | [
"Delete",
"deletes",
"an",
"existing",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/nodes.go#L77-L79 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/validation/validation.go | IsValidIPv4 | func IsValidIPv4(value string) bool {
return net.ParseIP(value) != nil && net.ParseIP(value).To4() != nil
} | go | func IsValidIPv4(value string) bool {
return net.ParseIP(value) != nil && net.ParseIP(value).To4() != nil
} | [
"func",
"IsValidIPv4",
"(",
"value",
"string",
")",
"bool",
"{",
"return",
"net",
".",
"ParseIP",
"(",
"value",
")",
"!=",
"nil",
"&&",
"net",
".",
"ParseIP",
"(",
"value",
")",
".",
"To4",
"(",
")",
"!=",
"nil",
"\n",
"}"
] | // IsValidIPv4 tests that the argument is a valid IPv4 address. | [
"IsValidIPv4",
"tests",
"that",
"the",
"argument",
"is",
"a",
"valid",
"IPv4",
"address",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/validation/validation.go#L139-L141 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/unversioned/group_version.go | IsEmpty | func (gvk GroupVersionKind) IsEmpty() bool {
return len(gvk.Group) == 0 && len(gvk.Version) == 0 && len(gvk.Kind) == 0
} | go | func (gvk GroupVersionKind) IsEmpty() bool {
return len(gvk.Group) == 0 && len(gvk.Version) == 0 && len(gvk.Kind) == 0
} | [
"func",
"(",
"gvk",
"GroupVersionKind",
")",
"IsEmpty",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"gvk",
".",
"Group",
")",
"==",
"0",
"&&",
"len",
"(",
"gvk",
".",
"Version",
")",
"==",
"0",
"&&",
"len",
"(",
"gvk",
".",
"Kind",
")",
"==",
... | // IsEmpty returns true if group, version, and kind are empty | [
"IsEmpty",
"returns",
"true",
"if",
"group",
"version",
"and",
"kind",
"are",
"empty"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/unversioned/group_version.go#L102-L104 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/unversioned/group_version.go | IsEmpty | func (gv GroupVersion) IsEmpty() bool {
return len(gv.Group) == 0 && len(gv.Version) == 0
} | go | func (gv GroupVersion) IsEmpty() bool {
return len(gv.Group) == 0 && len(gv.Version) == 0
} | [
"func",
"(",
"gv",
"GroupVersion",
")",
"IsEmpty",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"gv",
".",
"Group",
")",
"==",
"0",
"&&",
"len",
"(",
"gv",
".",
"Version",
")",
"==",
"0",
"\n",
"}"
] | // IsEmpty returns true if group and version are empty | [
"IsEmpty",
"returns",
"true",
"if",
"group",
"and",
"version",
"are",
"empty"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/api/unversioned/group_version.go#L127-L129 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go | DescribableResources | func DescribableResources() []string {
keys := make([]string, 0)
for k := range describerMap(nil) {
resource := strings.ToLower(k.Kind)
keys = append(keys, resource)
}
return keys
} | go | func DescribableResources() []string {
keys := make([]string, 0)
for k := range describerMap(nil) {
resource := strings.ToLower(k.Kind)
keys = append(keys, resource)
}
return keys
} | [
"func",
"DescribableResources",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n\n",
"for",
"k",
":=",
"range",
"describerMap",
"(",
"nil",
")",
"{",
"resource",
":=",
"strings",
".",
"ToLower",
"("... | // List of all resource types we can describe | [
"List",
"of",
"all",
"resource",
"types",
"we",
"can",
"describe"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go#L106-L114 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go | DescriberFor | func DescriberFor(kind unversioned.GroupKind, c *client.Client) (Describer, bool) {
f, ok := describerMap(c)[kind]
return f, ok
} | go | func DescriberFor(kind unversioned.GroupKind, c *client.Client) (Describer, bool) {
f, ok := describerMap(c)[kind]
return f, ok
} | [
"func",
"DescriberFor",
"(",
"kind",
"unversioned",
".",
"GroupKind",
",",
"c",
"*",
"client",
".",
"Client",
")",
"(",
"Describer",
",",
"bool",
")",
"{",
"f",
",",
"ok",
":=",
"describerMap",
"(",
"c",
")",
"[",
"kind",
"]",
"\n",
"return",
"f",
... | // Describer returns the default describe functions for each of the standard
// Kubernetes types. | [
"Describer",
"returns",
"the",
"default",
"describe",
"functions",
"for",
"each",
"of",
"the",
"standard",
"Kubernetes",
"types",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go#L118-L121 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go | DescribeContainers | func DescribeContainers(containers []api.Container, containerStatuses []api.ContainerStatus, resolverFn EnvVarResolverFunc, out io.Writer) {
statuses := map[string]api.ContainerStatus{}
for _, status := range containerStatuses {
statuses[status.Name] = status
}
for _, container := range containers {
status := ... | go | func DescribeContainers(containers []api.Container, containerStatuses []api.ContainerStatus, resolverFn EnvVarResolverFunc, out io.Writer) {
statuses := map[string]api.ContainerStatus{}
for _, status := range containerStatuses {
statuses[status.Name] = status
}
for _, container := range containers {
status := ... | [
"func",
"DescribeContainers",
"(",
"containers",
"[",
"]",
"api",
".",
"Container",
",",
"containerStatuses",
"[",
"]",
"api",
".",
"ContainerStatus",
",",
"resolverFn",
"EnvVarResolverFunc",
",",
"out",
"io",
".",
"Writer",
")",
"{",
"statuses",
":=",
"map",
... | // DescribeContainers is exported for consumers in other API groups that have container templates | [
"DescribeContainers",
"is",
"exported",
"for",
"consumers",
"in",
"other",
"API",
"groups",
"that",
"have",
"container",
"templates"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/describe.go#L718-L796 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/scale.go | Get | func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Get(... | go | func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Get(... | [
"func",
"(",
"c",
"*",
"scales",
")",
"Get",
"(",
"kind",
"string",
",",
"name",
"string",
")",
"(",
"result",
"*",
"extensions",
".",
"Scale",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"extensions",
".",
"Scale",
"{",
"}",
"\n\n",
"// TOD... | // Get takes the reference to scale subresource and returns the subresource or error, if one occurs. | [
"Get",
"takes",
"the",
"reference",
"to",
"scale",
"subresource",
"and",
"returns",
"the",
"subresource",
"or",
"error",
"if",
"one",
"occurs",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/scale.go#L50-L59 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | Getfunc | func (s *staticPageHandler) Getfunc(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(s.returnCode)
w.Write(s.pageContents)
} | go | func (s *staticPageHandler) Getfunc(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(s.returnCode)
w.Write(s.pageContents)
} | [
"func",
"(",
"s",
"*",
"staticPageHandler",
")",
"Getfunc",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"w",
".",
"WriteHeader",
"(",
"s",
".",
"returnCode",
")",
"\n",
"w",
".",
"Write",
"(",
"s",
".",... | // Get serves the error page | [
"Get",
"serves",
"the",
"error",
"page"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L252-L255 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | write | func (cfg *loadBalancerConfig) write(services map[string][]service, dryRun bool) (err error) {
var w io.Writer
if dryRun {
w = os.Stdout
} else {
w, err = os.Create(cfg.Config)
if err != nil {
return
}
}
var t *template.Template
t, err = template.ParseFiles(cfg.Template)
if err != nil {
return
}
... | go | func (cfg *loadBalancerConfig) write(services map[string][]service, dryRun bool) (err error) {
var w io.Writer
if dryRun {
w = os.Stdout
} else {
w, err = os.Create(cfg.Config)
if err != nil {
return
}
}
var t *template.Template
t, err = template.ParseFiles(cfg.Template)
if err != nil {
return
}
... | [
"func",
"(",
"cfg",
"*",
"loadBalancerConfig",
")",
"write",
"(",
"services",
"map",
"[",
"string",
"]",
"[",
"]",
"service",
",",
"dryRun",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"var",
"w",
"io",
".",
"Writer",
"\n",
"if",
"dryRun",
"{",
"w"... | // write writes the configuration file, will write to stdout if dryRun == true | [
"write",
"writes",
"the",
"configuration",
"file",
"will",
"write",
"to",
"stdout",
"if",
"dryRun",
"==",
"true"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L292-L329 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | reload | func (cfg *loadBalancerConfig) reload() error {
output, err := exec.Command("sh", "-c", cfg.ReloadCmd).CombinedOutput()
msg := fmt.Sprintf("%v -- %v", cfg.Name, string(output))
if err != nil {
return fmt.Errorf("error restarting %v: %v", msg, err)
}
glog.Infof(msg)
return nil
} | go | func (cfg *loadBalancerConfig) reload() error {
output, err := exec.Command("sh", "-c", cfg.ReloadCmd).CombinedOutput()
msg := fmt.Sprintf("%v -- %v", cfg.Name, string(output))
if err != nil {
return fmt.Errorf("error restarting %v: %v", msg, err)
}
glog.Infof(msg)
return nil
} | [
"func",
"(",
"cfg",
"*",
"loadBalancerConfig",
")",
"reload",
"(",
")",
"error",
"{",
"output",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cfg",
".",
"ReloadCmd",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"m... | // reload reloads the loadbalancer using the reload cmd specified in the json manifest. | [
"reload",
"reloads",
"the",
"loadbalancer",
"using",
"the",
"reload",
"cmd",
"specified",
"in",
"the",
"json",
"manifest",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L332-L340 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | sync | func (lbc *loadBalancerController) sync(dryRun bool) error {
if !lbc.epController.HasSynced() || !lbc.svcController.HasSynced() {
time.Sleep(100 * time.Millisecond)
return errDeferredSync
}
httpSvc, httpsTermSvc, tcpSvc := lbc.getServices()
if len(httpSvc) == 0 && len(httpsTermSvc) == 0 && len(tcpSvc) == 0 {
... | go | func (lbc *loadBalancerController) sync(dryRun bool) error {
if !lbc.epController.HasSynced() || !lbc.svcController.HasSynced() {
time.Sleep(100 * time.Millisecond)
return errDeferredSync
}
httpSvc, httpsTermSvc, tcpSvc := lbc.getServices()
if len(httpSvc) == 0 && len(httpsTermSvc) == 0 && len(tcpSvc) == 0 {
... | [
"func",
"(",
"lbc",
"*",
"loadBalancerController",
")",
"sync",
"(",
"dryRun",
"bool",
")",
"error",
"{",
"if",
"!",
"lbc",
".",
"epController",
".",
"HasSynced",
"(",
")",
"||",
"!",
"lbc",
".",
"svcController",
".",
"HasSynced",
"(",
")",
"{",
"time"... | // sync all services with the loadbalancer. | [
"sync",
"all",
"services",
"with",
"the",
"loadbalancer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L509-L530 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | worker | func (lbc *loadBalancerController) worker() {
for {
key, _ := lbc.queue.Get()
glog.Infof("Sync triggered by service %v", key)
if err := lbc.sync(false); err != nil {
glog.Warningf("Requeuing %v because of error: %v", key, err)
lbc.queue.Add(key)
}
lbc.queue.Done(key)
}
} | go | func (lbc *loadBalancerController) worker() {
for {
key, _ := lbc.queue.Get()
glog.Infof("Sync triggered by service %v", key)
if err := lbc.sync(false); err != nil {
glog.Warningf("Requeuing %v because of error: %v", key, err)
lbc.queue.Add(key)
}
lbc.queue.Done(key)
}
} | [
"func",
"(",
"lbc",
"*",
"loadBalancerController",
")",
"worker",
"(",
")",
"{",
"for",
"{",
"key",
",",
"_",
":=",
"lbc",
".",
"queue",
".",
"Get",
"(",
")",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"if",
"err",
":="... | // worker handles the work queue. | [
"worker",
"handles",
"the",
"work",
"queue",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L533-L543 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | newLoadBalancerController | func newLoadBalancerController(cfg *loadBalancerConfig, kubeClient *unversioned.Client, namespace string, tcpServices map[string]int) *loadBalancerController {
lbc := loadBalancerController{
cfg: cfg,
client: kubeClient,
queue: workqueue.New(),
reloadRateLimiter: util.NewTokenBucketRateLimiter(
reloadQP... | go | func newLoadBalancerController(cfg *loadBalancerConfig, kubeClient *unversioned.Client, namespace string, tcpServices map[string]int) *loadBalancerController {
lbc := loadBalancerController{
cfg: cfg,
client: kubeClient,
queue: workqueue.New(),
reloadRateLimiter: util.NewTokenBucketRateLimiter(
reloadQP... | [
"func",
"newLoadBalancerController",
"(",
"cfg",
"*",
"loadBalancerConfig",
",",
"kubeClient",
"*",
"unversioned",
".",
"Client",
",",
"namespace",
"string",
",",
"tcpServices",
"map",
"[",
"string",
"]",
"int",
")",
"*",
"loadBalancerController",
"{",
"lbc",
":... | // newLoadBalancerController creates a new controller from the given config. | [
"newLoadBalancerController",
"creates",
"a",
"new",
"controller",
"from",
"the",
"given",
"config",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L546-L588 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | parseCfg | func parseCfg(configPath string, defLbAlgorithm string, sslCert string, sslCaCert string) *loadBalancerConfig {
jsonBlob, err := ioutil.ReadFile(configPath)
if err != nil {
glog.Fatalf("Could not parse lb config: %v", err)
}
var cfg loadBalancerConfig
err = json.Unmarshal(jsonBlob, &cfg)
if err != nil {
glog.... | go | func parseCfg(configPath string, defLbAlgorithm string, sslCert string, sslCaCert string) *loadBalancerConfig {
jsonBlob, err := ioutil.ReadFile(configPath)
if err != nil {
glog.Fatalf("Could not parse lb config: %v", err)
}
var cfg loadBalancerConfig
err = json.Unmarshal(jsonBlob, &cfg)
if err != nil {
glog.... | [
"func",
"parseCfg",
"(",
"configPath",
"string",
",",
"defLbAlgorithm",
"string",
",",
"sslCert",
"string",
",",
"sslCaCert",
"string",
")",
"*",
"loadBalancerConfig",
"{",
"jsonBlob",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"configPath",
")",
"\n",
... | // parseCfg parses the given configuration file.
// cmd line params take precedence over config directives. | [
"parseCfg",
"parses",
"the",
"given",
"configuration",
"file",
".",
"cmd",
"line",
"params",
"take",
"precedence",
"over",
"config",
"directives",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L592-L607 | train |
kubernetes-retired/contrib | service-loadbalancer/service_loadbalancer.go | registerHandlers | func registerHandlers(s *staticPageHandler) {
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
// Delegate a check to the haproxy stats service.
response, err := http.Get(fmt.Sprintf("http://localhost:%v", *statsPort))
if err != nil {
glog.Infof("Error %v", err)
w.WriteHeader(http... | go | func registerHandlers(s *staticPageHandler) {
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
// Delegate a check to the haproxy stats service.
response, err := http.Get(fmt.Sprintf("http://localhost:%v", *statsPort))
if err != nil {
glog.Infof("Error %v", err)
w.WriteHeader(http... | [
"func",
"registerHandlers",
"(",
"s",
"*",
"staticPageHandler",
")",
"{",
"http",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Delegate a check to the haproxy s... | // registerHandlers services liveness probes. | [
"registerHandlers",
"services",
"liveness",
"probes",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/service_loadbalancer.go#L610-L638 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go | UpdateWithEventNamespace | func (e *events) UpdateWithEventNamespace(event *api.Event) (*api.Event, error) {
result := &api.Event{}
err := e.client.Put().
NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0).
Resource("events").
Name(event.Name).
Body(event).
Do().
Into(result)
return result, err
} | go | func (e *events) UpdateWithEventNamespace(event *api.Event) (*api.Event, error) {
result := &api.Event{}
err := e.client.Put().
NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0).
Resource("events").
Name(event.Name).
Body(event).
Do().
Into(result)
return result, err
} | [
"func",
"(",
"e",
"*",
"events",
")",
"UpdateWithEventNamespace",
"(",
"event",
"*",
"api",
".",
"Event",
")",
"(",
"*",
"api",
".",
"Event",
",",
"error",
")",
"{",
"result",
":=",
"&",
"api",
".",
"Event",
"{",
"}",
"\n",
"err",
":=",
"e",
".",... | // UpdateWithEventNamespace modifies an existing event. It returns the copy of the event that the server returns,
// or an error. The namespace and key to update the event within is deduced from the event. The
// namespace must either match this event client's namespace, or this event client must have been
// created w... | [
"UpdateWithEventNamespace",
"modifies",
"an",
"existing",
"event",
".",
"It",
"returns",
"the",
"copy",
"of",
"the",
"event",
"that",
"the",
"server",
"returns",
"or",
"an",
"error",
".",
"The",
"namespace",
"and",
"key",
"to",
"update",
"the",
"event",
"wit... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go#L64-L74 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go | newPodTemplates | func newPodTemplates(c *Client, namespace string) *podTemplates {
return &podTemplates{
r: c,
ns: namespace,
}
} | go | func newPodTemplates(c *Client, namespace string) *podTemplates {
return &podTemplates{
r: c,
ns: namespace,
}
} | [
"func",
"newPodTemplates",
"(",
"c",
"*",
"Client",
",",
"namespace",
"string",
")",
"*",
"podTemplates",
"{",
"return",
"&",
"podTemplates",
"{",
"r",
":",
"c",
",",
"ns",
":",
"namespace",
",",
"}",
"\n",
"}"
] | // newPodTemplates returns a podTemplates | [
"newPodTemplates",
"returns",
"a",
"podTemplates"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go#L46-L51 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go | Update | func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) {
result = &api.PodTemplate{}
err = c.r.Put().Namespace(c.ns).Resource("podTemplates").Name(podTemplate.Name).Body(podTemplate).Do().Into(result)
return
} | go | func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) {
result = &api.PodTemplate{}
err = c.r.Put().Namespace(c.ns).Resource("podTemplates").Name(podTemplate.Name).Body(podTemplate).Do().Into(result)
return
} | [
"func",
"(",
"c",
"*",
"podTemplates",
")",
"Update",
"(",
"podTemplate",
"*",
"api",
".",
"PodTemplate",
")",
"(",
"result",
"*",
"api",
".",
"PodTemplate",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"api",
".",
"PodTemplate",
"{",
"}",
"\n"... | // Update takes the representation of a podTemplate to update. Returns the server's representation of the podTemplate, and an error, if it occurs. | [
"Update",
"takes",
"the",
"representation",
"of",
"a",
"podTemplate",
"to",
"update",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"podTemplate",
"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/pod_templates.go#L80-L84 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | bytesToKey | func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
if len(b) == 0 {
return utf8.RuneError, nil
}
if !pasteActive {
switch b[0] {
case 1: // ^A
return keyHome, b[1:]
case 5: // ^E
return keyEnd, b[1:]
case 8: // ^H
return keyBackspace, b[1:]
case 11: // ^K
return keyDeleteLine, b[1:... | go | func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
if len(b) == 0 {
return utf8.RuneError, nil
}
if !pasteActive {
switch b[0] {
case 1: // ^A
return keyHome, b[1:]
case 5: // ^E
return keyEnd, b[1:]
case 8: // ^H
return keyBackspace, b[1:]
case 11: // ^K
return keyDeleteLine, b[1:... | [
"func",
"bytesToKey",
"(",
"b",
"[",
"]",
"byte",
",",
"pasteActive",
"bool",
")",
"(",
"rune",
",",
"[",
"]",
"byte",
")",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"utf8",
".",
"RuneError",
",",
"nil",
"\n",
"}",
"\n\n",
"if"... | // bytesToKey tries to parse a key sequence from b. If successful, it returns
// the key and the remainder of the input. Otherwise it returns utf8.RuneError. | [
"bytesToKey",
"tries",
"to",
"parse",
"a",
"key",
"sequence",
"from",
"b",
".",
"If",
"successful",
"it",
"returns",
"the",
"key",
"and",
"the",
"remainder",
"of",
"the",
"input",
".",
"Otherwise",
"it",
"returns",
"utf8",
".",
"RuneError",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L140-L215 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | queue | func (t *Terminal) queue(data []rune) {
t.outBuf = append(t.outBuf, []byte(string(data))...)
} | go | func (t *Terminal) queue(data []rune) {
t.outBuf = append(t.outBuf, []byte(string(data))...)
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"queue",
"(",
"data",
"[",
"]",
"rune",
")",
"{",
"t",
".",
"outBuf",
"=",
"append",
"(",
"t",
".",
"outBuf",
",",
"[",
"]",
"byte",
"(",
"string",
"(",
"data",
")",
")",
"...",
")",
"\n",
"}"
] | // queue appends data to the end of t.outBuf | [
"queue",
"appends",
"data",
"to",
"the",
"end",
"of",
"t",
".",
"outBuf"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L218-L220 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | moveCursorToPos | func (t *Terminal) moveCursorToPos(pos int) {
if !t.echo {
return
}
x := visualLength(t.prompt) + pos
y := x / t.termWidth
x = x % t.termWidth
up := 0
if y < t.cursorY {
up = t.cursorY - y
}
down := 0
if y > t.cursorY {
down = y - t.cursorY
}
left := 0
if x < t.cursorX {
left = t.cursorX - x
}... | go | func (t *Terminal) moveCursorToPos(pos int) {
if !t.echo {
return
}
x := visualLength(t.prompt) + pos
y := x / t.termWidth
x = x % t.termWidth
up := 0
if y < t.cursorY {
up = t.cursorY - y
}
down := 0
if y > t.cursorY {
down = y - t.cursorY
}
left := 0
if x < t.cursorX {
left = t.cursorX - x
}... | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"moveCursorToPos",
"(",
"pos",
"int",
")",
"{",
"if",
"!",
"t",
".",
"echo",
"{",
"return",
"\n",
"}",
"\n\n",
"x",
":=",
"visualLength",
"(",
"t",
".",
"prompt",
")",
"+",
"pos",
"\n",
"y",
":=",
"x",
"/... | // moveCursorToPos appends data to t.outBuf which will move the cursor to the
// given, logical position in the text. | [
"moveCursorToPos",
"appends",
"data",
"to",
"t",
".",
"outBuf",
"which",
"will",
"move",
"the",
"cursor",
"to",
"the",
"given",
"logical",
"position",
"in",
"the",
"text",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L232-L264 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | countToLeftWord | func (t *Terminal) countToLeftWord() int {
if t.pos == 0 {
return 0
}
pos := t.pos - 1
for pos > 0 {
if t.line[pos] != ' ' {
break
}
pos--
}
for pos > 0 {
if t.line[pos] == ' ' {
pos++
break
}
pos--
}
return t.pos - pos
} | go | func (t *Terminal) countToLeftWord() int {
if t.pos == 0 {
return 0
}
pos := t.pos - 1
for pos > 0 {
if t.line[pos] != ' ' {
break
}
pos--
}
for pos > 0 {
if t.line[pos] == ' ' {
pos++
break
}
pos--
}
return t.pos - pos
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"countToLeftWord",
"(",
")",
"int",
"{",
"if",
"t",
".",
"pos",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"pos",
":=",
"t",
".",
"pos",
"-",
"1",
"\n",
"for",
"pos",
">",
"0",
"{",
"if",
"t",
... | // countToLeftWord returns then number of characters from the cursor to the
// start of the previous word. | [
"countToLeftWord",
"returns",
"then",
"number",
"of",
"characters",
"from",
"the",
"cursor",
"to",
"the",
"start",
"of",
"the",
"previous",
"word",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L365-L386 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | countToRightWord | func (t *Terminal) countToRightWord() int {
pos := t.pos
for pos < len(t.line) {
if t.line[pos] == ' ' {
break
}
pos++
}
for pos < len(t.line) {
if t.line[pos] != ' ' {
break
}
pos++
}
return pos - t.pos
} | go | func (t *Terminal) countToRightWord() int {
pos := t.pos
for pos < len(t.line) {
if t.line[pos] == ' ' {
break
}
pos++
}
for pos < len(t.line) {
if t.line[pos] != ' ' {
break
}
pos++
}
return pos - t.pos
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"countToRightWord",
"(",
")",
"int",
"{",
"pos",
":=",
"t",
".",
"pos",
"\n",
"for",
"pos",
"<",
"len",
"(",
"t",
".",
"line",
")",
"{",
"if",
"t",
".",
"line",
"[",
"pos",
"]",
"==",
"' '",
"{",
"break... | // countToRightWord returns then number of characters from the cursor to the
// start of the next word. | [
"countToRightWord",
"returns",
"then",
"number",
"of",
"characters",
"from",
"the",
"cursor",
"to",
"the",
"start",
"of",
"the",
"next",
"word",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L390-L405 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | visualLength | func visualLength(runes []rune) int {
inEscapeSeq := false
length := 0
for _, r := range runes {
switch {
case inEscapeSeq:
if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
inEscapeSeq = false
}
case r == '\x1b':
inEscapeSeq = true
default:
length++
}
}
return length
} | go | func visualLength(runes []rune) int {
inEscapeSeq := false
length := 0
for _, r := range runes {
switch {
case inEscapeSeq:
if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
inEscapeSeq = false
}
case r == '\x1b':
inEscapeSeq = true
default:
length++
}
}
return length
} | [
"func",
"visualLength",
"(",
"runes",
"[",
"]",
"rune",
")",
"int",
"{",
"inEscapeSeq",
":=",
"false",
"\n",
"length",
":=",
"0",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"runes",
"{",
"switch",
"{",
"case",
"inEscapeSeq",
":",
"if",
"(",
"r",
... | // visualLength returns the number of visible glyphs in s. | [
"visualLength",
"returns",
"the",
"number",
"of",
"visible",
"glyphs",
"in",
"s",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L408-L426 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | addKeyToLine | func (t *Terminal) addKeyToLine(key rune) {
if len(t.line) == cap(t.line) {
newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
copy(newLine, t.line)
t.line = newLine
}
t.line = t.line[:len(t.line)+1]
copy(t.line[t.pos+1:], t.line[t.pos:])
t.line[t.pos] = key
if t.echo {
t.writeLine(t.line[t.pos:])
}... | go | func (t *Terminal) addKeyToLine(key rune) {
if len(t.line) == cap(t.line) {
newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
copy(newLine, t.line)
t.line = newLine
}
t.line = t.line[:len(t.line)+1]
copy(t.line[t.pos+1:], t.line[t.pos:])
t.line[t.pos] = key
if t.echo {
t.writeLine(t.line[t.pos:])
}... | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"addKeyToLine",
"(",
"key",
"rune",
")",
"{",
"if",
"len",
"(",
"t",
".",
"line",
")",
"==",
"cap",
"(",
"t",
".",
"line",
")",
"{",
"newLine",
":=",
"make",
"(",
"[",
"]",
"rune",
",",
"len",
"(",
"t",... | // addKeyToLine inserts the given key at the current position in the current
// line. | [
"addKeyToLine",
"inserts",
"the",
"given",
"key",
"at",
"the",
"current",
"position",
"in",
"the",
"current",
"line",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L567-L581 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | ReadPassword | func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
oldPrompt := t.prompt
t.prompt = []rune(prompt)
t.echo = false
line, err = t.readLine()
t.prompt = oldPrompt
t.echo = true
return
} | go | func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
oldPrompt := t.prompt
t.prompt = []rune(prompt)
t.echo = false
line, err = t.readLine()
t.prompt = oldPrompt
t.echo = true
return
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"ReadPassword",
"(",
"prompt",
"string",
")",
"(",
"line",
"string",
",",
"err",
"error",
")",
"{",
"t",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",... | // ReadPassword temporarily changes the prompt and reads a password, without
// echo, from the terminal. | [
"ReadPassword",
"temporarily",
"changes",
"the",
"prompt",
"and",
"reads",
"a",
"password",
"without",
"echo",
"from",
"the",
"terminal",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L643-L657 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | ReadLine | func (t *Terminal) ReadLine() (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
return t.readLine()
} | go | func (t *Terminal) ReadLine() (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
return t.readLine()
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"ReadLine",
"(",
")",
"(",
"line",
"string",
",",
"err",
"error",
")",
"{",
"t",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"t",
".",
... | // ReadLine returns a line of input from the terminal. | [
"ReadLine",
"returns",
"a",
"line",
"of",
"input",
"from",
"the",
"terminal",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L660-L665 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | SetPrompt | func (t *Terminal) SetPrompt(prompt string) {
t.lock.Lock()
defer t.lock.Unlock()
t.prompt = []rune(prompt)
} | go | func (t *Terminal) SetPrompt(prompt string) {
t.lock.Lock()
defer t.lock.Unlock()
t.prompt = []rune(prompt)
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"SetPrompt",
"(",
"prompt",
"string",
")",
"{",
"t",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"t",
".",
"prompt",
"=",
"[",
"]",
"rune",
"(",
... | // SetPrompt sets the prompt to be used when reading subsequent lines. | [
"SetPrompt",
"sets",
"the",
"prompt",
"to",
"be",
"used",
"when",
"reading",
"subsequent",
"lines",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L748-L753 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | SetBracketedPasteMode | func (t *Terminal) SetBracketedPasteMode(on bool) {
if on {
io.WriteString(t.c, "\x1b[?2004h")
} else {
io.WriteString(t.c, "\x1b[?2004l")
}
} | go | func (t *Terminal) SetBracketedPasteMode(on bool) {
if on {
io.WriteString(t.c, "\x1b[?2004h")
} else {
io.WriteString(t.c, "\x1b[?2004l")
}
} | [
"func",
"(",
"t",
"*",
"Terminal",
")",
"SetBracketedPasteMode",
"(",
"on",
"bool",
")",
"{",
"if",
"on",
"{",
"io",
".",
"WriteString",
"(",
"t",
".",
"c",
",",
"\"",
"\\x1b",
"\"",
")",
"\n",
"}",
"else",
"{",
"io",
".",
"WriteString",
"(",
"t"... | // SetBracketedPasteMode requests that the terminal bracket paste operations
// with markers. Not all terminals support this but, if it is supported, then
// enabling this mode will stop any autocomplete callback from running due to
// pastes. Additionally, any lines that are completely pasted will be returned
// from ... | [
"SetBracketedPasteMode",
"requests",
"that",
"the",
"terminal",
"bracket",
"paste",
"operations",
"with",
"markers",
".",
"Not",
"all",
"terminals",
"support",
"this",
"but",
"if",
"it",
"is",
"supported",
"then",
"enabling",
"this",
"mode",
"will",
"stop",
"any... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L846-L852 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go | NthPreviousEntry | func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
if n >= s.size {
return "", false
}
index := s.head - n
if index < 0 {
index += s.max
}
return s.entries[index], true
} | go | func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
if n >= s.size {
return "", false
}
index := s.head - n
if index < 0 {
index += s.max
}
return s.entries[index], true
} | [
"func",
"(",
"s",
"*",
"stRingBuffer",
")",
"NthPreviousEntry",
"(",
"n",
"int",
")",
"(",
"value",
"string",
",",
"ok",
"bool",
")",
"{",
"if",
"n",
">=",
"s",
".",
"size",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"index",
":=",... | // NthPreviousEntry returns the value passed to the nth previous call to Add.
// If n is zero then the immediately prior value is returned, if one, then the
// next most recent, and so on. If such an element doesn't exist then ok is
// false. | [
"NthPreviousEntry",
"returns",
"the",
"value",
"passed",
"to",
"the",
"nth",
"previous",
"call",
"to",
"Add",
".",
"If",
"n",
"is",
"zero",
"then",
"the",
"immediately",
"prior",
"value",
"is",
"returned",
"if",
"one",
"then",
"the",
"next",
"most",
"recen... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/terminal.go#L883-L892 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go | yaml_parser_parse | func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool {
// Erase the event object.
*event = yaml_event_t{}
// No events after the end of the stream or error.
if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE {
return true
}
// Generate the... | go | func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool {
// Erase the event object.
*event = yaml_event_t{}
// No events after the end of the stream or error.
if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE {
return true
}
// Generate the... | [
"func",
"yaml_parser_parse",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"// Erase the event object.",
"*",
"event",
"=",
"yaml_event_t",
"{",
"}",
"\n\n",
"// No events after the end of the stream or error.",
"if",
"parser"... | // Get the next event. | [
"Get",
"the",
"next",
"event",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go#L62-L73 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go | yaml_parser_set_parser_error | func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool {
parser.error = yaml_PARSER_ERROR
parser.problem = problem
parser.problem_mark = problem_mark
return false
} | go | func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool {
parser.error = yaml_PARSER_ERROR
parser.problem = problem
parser.problem_mark = problem_mark
return false
} | [
"func",
"yaml_parser_set_parser_error",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"problem",
"string",
",",
"problem_mark",
"yaml_mark_t",
")",
"bool",
"{",
"parser",
".",
"error",
"=",
"yaml_PARSER_ERROR",
"\n",
"parser",
".",
"problem",
"=",
"problem",
"\n",
"... | // Set parser error. | [
"Set",
"parser",
"error",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go#L76-L81 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go | yaml_parser_process_empty_scalar | func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool {
*event = yaml_event_t{
typ: yaml_SCALAR_EVENT,
start_mark: mark,
end_mark: mark,
value: nil, // Empty
implicit: true,
style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
}
return true... | go | func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool {
*event = yaml_event_t{
typ: yaml_SCALAR_EVENT,
start_mark: mark,
end_mark: mark,
value: nil, // Empty
implicit: true,
style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
}
return true... | [
"func",
"yaml_parser_process_empty_scalar",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"event",
"*",
"yaml_event_t",
",",
"mark",
"yaml_mark_t",
")",
"bool",
"{",
"*",
"event",
"=",
"yaml_event_t",
"{",
"typ",
":",
"yaml_SCALAR_EVENT",
",",
"start_mark",
":",
"ma... | // Generate an empty scalar event. | [
"Generate",
"an",
"empty",
"scalar",
"event",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go#L996-L1006 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go | yaml_parser_process_directives | func yaml_parser_process_directives(parser *yaml_parser_t,
version_directive_ref **yaml_version_directive_t,
tag_directives_ref *[]yaml_tag_directive_t) bool {
var version_directive *yaml_version_directive_t
var tag_directives []yaml_tag_directive_t
token := peek_token(parser)
if token == nil {
return false
... | go | func yaml_parser_process_directives(parser *yaml_parser_t,
version_directive_ref **yaml_version_directive_t,
tag_directives_ref *[]yaml_tag_directive_t) bool {
var version_directive *yaml_version_directive_t
var tag_directives []yaml_tag_directive_t
token := peek_token(parser)
if token == nil {
return false
... | [
"func",
"yaml_parser_process_directives",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"version_directive_ref",
"*",
"*",
"yaml_version_directive_t",
",",
"tag_directives_ref",
"*",
"[",
"]",
"yaml_tag_directive_t",
")",
"bool",
"{",
"var",
"version_directive",
"*",
"yaml_... | // Parse directives. | [
"Parse",
"directives",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go#L1014-L1073 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go | yaml_parser_append_tag_directive | func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool {
for i := range parser.tag_directives {
if bytes.Equal(value.handle, parser.tag_directives[i].handle) {
if allow_duplicates {
return true
}
return yaml_parser_set_parse... | go | func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool {
for i := range parser.tag_directives {
if bytes.Equal(value.handle, parser.tag_directives[i].handle) {
if allow_duplicates {
return true
}
return yaml_parser_set_parse... | [
"func",
"yaml_parser_append_tag_directive",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"value",
"yaml_tag_directive_t",
",",
"allow_duplicates",
"bool",
",",
"mark",
"yaml_mark_t",
")",
"bool",
"{",
"for",
"i",
":=",
"range",
"parser",
".",
"tag_directives",
"{",
"... | // Append a tag directive to the directives stack. | [
"Append",
"a",
"tag",
"directive",
"to",
"the",
"directives",
"stack",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/parserc.go#L1076-L1096 | train |
kubernetes-retired/contrib | service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/secret.go | handleFromFileSources | func handleFromFileSources(secret *api.Secret, fileSources []string) error {
for _, fileSource := range fileSources {
keyName, filePath, err := parseFileSource(fileSource)
if err != nil {
return err
}
info, err := os.Stat(filePath)
if err != nil {
switch err := err.(type) {
case *os.PathError:
r... | go | func handleFromFileSources(secret *api.Secret, fileSources []string) error {
for _, fileSource := range fileSources {
keyName, filePath, err := parseFileSource(fileSource)
if err != nil {
return err
}
info, err := os.Stat(filePath)
if err != nil {
switch err := err.(type) {
case *os.PathError:
r... | [
"func",
"handleFromFileSources",
"(",
"secret",
"*",
"api",
".",
"Secret",
",",
"fileSources",
"[",
"]",
"string",
")",
"error",
"{",
"for",
"_",
",",
"fileSource",
":=",
"range",
"fileSources",
"{",
"keyName",
",",
"filePath",
",",
"err",
":=",
"parseFile... | // handleFromFileSources adds the specified file source information into the provided secret | [
"handleFromFileSources",
"adds",
"the",
"specified",
"file",
"source",
"information",
"into",
"the",
"provided",
"secret"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/service-loadbalancer/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/secret.go#L146-L188 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/transport/transport.go | New | func New(config *Config) (http.RoundTripper, error) {
// Set transport level security
if config.Transport != nil && (config.HasCA() || config.HasCertAuth() || config.TLS.Insecure) {
return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed")
}
var (
rt h... | go | func New(config *Config) (http.RoundTripper, error) {
// Set transport level security
if config.Transport != nil && (config.HasCA() || config.HasCertAuth() || config.TLS.Insecure) {
return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed")
}
var (
rt h... | [
"func",
"New",
"(",
"config",
"*",
"Config",
")",
"(",
"http",
".",
"RoundTripper",
",",
"error",
")",
"{",
"// Set transport level security",
"if",
"config",
".",
"Transport",
"!=",
"nil",
"&&",
"(",
"config",
".",
"HasCA",
"(",
")",
"||",
"config",
"."... | // New returns an http.RoundTripper that will provide the authentication
// or transport level security defined by the provided Config. | [
"New",
"returns",
"an",
"http",
".",
"RoundTripper",
"that",
"will",
"provide",
"the",
"authentication",
"or",
"transport",
"level",
"security",
"defined",
"by",
"the",
"provided",
"Config",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/transport/transport.go#L29-L50 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go | Command | func (executor *executor) Command(cmd string, args ...string) Cmd {
return (*cmdWrapper)(osexec.Command(cmd, args...))
} | go | func (executor *executor) Command(cmd string, args ...string) Cmd {
return (*cmdWrapper)(osexec.Command(cmd, args...))
} | [
"func",
"(",
"executor",
"*",
"executor",
")",
"Command",
"(",
"cmd",
"string",
",",
"args",
"...",
"string",
")",
"Cmd",
"{",
"return",
"(",
"*",
"cmdWrapper",
")",
"(",
"osexec",
".",
"Command",
"(",
"cmd",
",",
"args",
"...",
")",
")",
"\n",
"}"... | // Command is part of the Interface interface. | [
"Command",
"is",
"part",
"of",
"the",
"Interface",
"interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go#L67-L69 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go | LookPath | func (executor *executor) LookPath(file string) (string, error) {
return osexec.LookPath(file)
} | go | func (executor *executor) LookPath(file string) (string, error) {
return osexec.LookPath(file)
} | [
"func",
"(",
"executor",
"*",
"executor",
")",
"LookPath",
"(",
"file",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"osexec",
".",
"LookPath",
"(",
"file",
")",
"\n",
"}"
] | // LookPath is part of the Interface interface | [
"LookPath",
"is",
"part",
"of",
"the",
"Interface",
"interface"
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go#L72-L74 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go | CombinedOutput | func (cmd *cmdWrapper) CombinedOutput() ([]byte, error) {
out, err := (*osexec.Cmd)(cmd).CombinedOutput()
if err != nil {
if ee, ok := err.(*osexec.ExitError); ok {
// Force a compile fail if exitErrorWrapper can't convert to ExitError.
var x ExitError = &exitErrorWrapper{ee}
return out, x
}
if ee, ok ... | go | func (cmd *cmdWrapper) CombinedOutput() ([]byte, error) {
out, err := (*osexec.Cmd)(cmd).CombinedOutput()
if err != nil {
if ee, ok := err.(*osexec.ExitError); ok {
// Force a compile fail if exitErrorWrapper can't convert to ExitError.
var x ExitError = &exitErrorWrapper{ee}
return out, x
}
if ee, ok ... | [
"func",
"(",
"cmd",
"*",
"cmdWrapper",
")",
"CombinedOutput",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"(",
"*",
"osexec",
".",
"Cmd",
")",
"(",
"cmd",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"... | // CombinedOutput is part of the Cmd interface. | [
"CombinedOutput",
"is",
"part",
"of",
"the",
"Cmd",
"interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go#L84-L100 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go | ExitStatus | func (eew exitErrorWrapper) ExitStatus() int {
ws, ok := eew.Sys().(syscall.WaitStatus)
if !ok {
panic("can't call ExitStatus() on a non-WaitStatus exitErrorWrapper")
}
return ws.ExitStatus()
} | go | func (eew exitErrorWrapper) ExitStatus() int {
ws, ok := eew.Sys().(syscall.WaitStatus)
if !ok {
panic("can't call ExitStatus() on a non-WaitStatus exitErrorWrapper")
}
return ws.ExitStatus()
} | [
"func",
"(",
"eew",
"exitErrorWrapper",
")",
"ExitStatus",
"(",
")",
"int",
"{",
"ws",
",",
"ok",
":=",
"eew",
".",
"Sys",
"(",
")",
".",
"(",
"syscall",
".",
"WaitStatus",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"... | // ExitStatus is part of the ExitError interface. | [
"ExitStatus",
"is",
"part",
"of",
"the",
"ExitError",
"interface",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/exec/exec.go#L109-L115 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/wsstream/stream.go | NewReader | func NewReader(r io.Reader, ping bool) *Reader {
return &Reader{
r: r,
err: make(chan error),
ping: ping,
}
} | go | func NewReader(r io.Reader, ping bool) *Reader {
return &Reader{
r: r,
err: make(chan error),
ping: ping,
}
} | [
"func",
"NewReader",
"(",
"r",
"io",
".",
"Reader",
",",
"ping",
"bool",
")",
"*",
"Reader",
"{",
"return",
"&",
"Reader",
"{",
"r",
":",
"r",
",",
"err",
":",
"make",
"(",
"chan",
"error",
")",
",",
"ping",
":",
"ping",
",",
"}",
"\n",
"}"
] | // NewReader creates a WebSocket pipe that will copy the contents of r to a provided
// WebSocket connection. If ping is true, a zero length message will be sent to the client
// before the stream begins reading. | [
"NewReader",
"creates",
"a",
"WebSocket",
"pipe",
"that",
"will",
"copy",
"the",
"contents",
"of",
"r",
"to",
"a",
"provided",
"WebSocket",
"connection",
".",
"If",
"ping",
"is",
"true",
"a",
"zero",
"length",
"message",
"will",
"be",
"sent",
"to",
"the",
... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/wsstream/stream.go#L52-L58 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/wsstream/stream.go | Copy | func (r *Reader) Copy(w http.ResponseWriter, req *http.Request) error {
go func() {
defer util.HandleCrash()
websocket.Server{Handshake: r.handshake, Handler: r.handle}.ServeHTTP(w, req)
}()
return <-r.err
} | go | func (r *Reader) Copy(w http.ResponseWriter, req *http.Request) error {
go func() {
defer util.HandleCrash()
websocket.Server{Handshake: r.handshake, Handler: r.handle}.ServeHTTP(w, req)
}()
return <-r.err
} | [
"func",
"(",
"r",
"*",
"Reader",
")",
"Copy",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"go",
"func",
"(",
")",
"{",
"defer",
"util",
".",
"HandleCrash",
"(",
")",
"\n",
"websocket",
".",
... | // Copy the reader to the response. The created WebSocket is closed after this
// method completes. | [
"Copy",
"the",
"reader",
"to",
"the",
"response",
".",
"The",
"created",
"WebSocket",
"is",
"closed",
"after",
"this",
"method",
"completes",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/wsstream/stream.go#L72-L78 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | flush | func flush(emitter *yaml_emitter_t) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) {
return yaml_emitter_flush(emitter)
}
return true
} | go | func flush(emitter *yaml_emitter_t) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) {
return yaml_emitter_flush(emitter)
}
return true
} | [
"func",
"flush",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"emitter",
".",
"buffer_pos",
"+",
"5",
">=",
"len",
"(",
"emitter",
".",
"buffer",
")",
"{",
"return",
"yaml_emitter_flush",
"(",
"emitter",
")",
"\n",
"}",
"\n",
"return",
... | // Flush the buffer if needed. | [
"Flush",
"the",
"buffer",
"if",
"needed",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L8-L13 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | put | func put(emitter *yaml_emitter_t, value byte) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
emitter.buffer[emitter.buffer_pos] = value
emitter.buffer_pos++
emitter.column++
return true
} | go | func put(emitter *yaml_emitter_t, value byte) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
emitter.buffer[emitter.buffer_pos] = value
emitter.buffer_pos++
emitter.column++
return true
} | [
"func",
"put",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"value",
"byte",
")",
"bool",
"{",
"if",
"emitter",
".",
"buffer_pos",
"+",
"5",
">=",
"len",
"(",
"emitter",
".",
"buffer",
")",
"&&",
"!",
"yaml_emitter_flush",
"(",
"emitter",
")",
"{",
"ret... | // Put a character to the output buffer. | [
"Put",
"a",
"character",
"to",
"the",
"output",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L16-L24 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | put_break | func put_break(emitter *yaml_emitter_t) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
switch emitter.line_break {
case yaml_CR_BREAK:
emitter.buffer[emitter.buffer_pos] = '\r'
emitter.buffer_pos += 1
case yaml_LN_BREAK:
emitter.buffer[emitter.buffer_... | go | func put_break(emitter *yaml_emitter_t) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
switch emitter.line_break {
case yaml_CR_BREAK:
emitter.buffer[emitter.buffer_pos] = '\r'
emitter.buffer_pos += 1
case yaml_LN_BREAK:
emitter.buffer[emitter.buffer_... | [
"func",
"put_break",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"emitter",
".",
"buffer_pos",
"+",
"5",
">=",
"len",
"(",
"emitter",
".",
"buffer",
")",
"&&",
"!",
"yaml_emitter_flush",
"(",
"emitter",
")",
"{",
"return",
"false",
"\n... | // Put a line break to the output buffer. | [
"Put",
"a",
"line",
"break",
"to",
"the",
"output",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L27-L48 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | write | func write(emitter *yaml_emitter_t, s []byte, i *int) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
p := emitter.buffer_pos
w := width(s[*i])
switch w {
case 4:
emitter.buffer[p+3] = s[*i+3]
fallthrough
case 3:
emitter.buffer[p+2] = s[*i+2]
fallt... | go | func write(emitter *yaml_emitter_t, s []byte, i *int) bool {
if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
return false
}
p := emitter.buffer_pos
w := width(s[*i])
switch w {
case 4:
emitter.buffer[p+3] = s[*i+3]
fallthrough
case 3:
emitter.buffer[p+2] = s[*i+2]
fallt... | [
"func",
"write",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"s",
"[",
"]",
"byte",
",",
"i",
"*",
"int",
")",
"bool",
"{",
"if",
"emitter",
".",
"buffer_pos",
"+",
"5",
">=",
"len",
"(",
"emitter",
".",
"buffer",
")",
"&&",
"!",
"yaml_emitter_flush"... | // Copy a character from a string into buffer. | [
"Copy",
"a",
"character",
"from",
"a",
"string",
"into",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L51-L76 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | write_all | func write_all(emitter *yaml_emitter_t, s []byte) bool {
for i := 0; i < len(s); {
if !write(emitter, s, &i) {
return false
}
}
return true
} | go | func write_all(emitter *yaml_emitter_t, s []byte) bool {
for i := 0; i < len(s); {
if !write(emitter, s, &i) {
return false
}
}
return true
} | [
"func",
"write_all",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"s",
"[",
"]",
"byte",
")",
"bool",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"s",
")",
";",
"{",
"if",
"!",
"write",
"(",
"emitter",
",",
"s",
",",
"&",
"i",
")",
... | // Write a whole string into buffer. | [
"Write",
"a",
"whole",
"string",
"into",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L79-L86 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | write_break | func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool {
if s[*i] == '\n' {
if !put_break(emitter) {
return false
}
*i++
} else {
if !write(emitter, s, i) {
return false
}
emitter.column = 0
emitter.line++
}
return true
} | go | func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool {
if s[*i] == '\n' {
if !put_break(emitter) {
return false
}
*i++
} else {
if !write(emitter, s, i) {
return false
}
emitter.column = 0
emitter.line++
}
return true
} | [
"func",
"write_break",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"s",
"[",
"]",
"byte",
",",
"i",
"*",
"int",
")",
"bool",
"{",
"if",
"s",
"[",
"*",
"i",
"]",
"==",
"'\\n'",
"{",
"if",
"!",
"put_break",
"(",
"emitter",
")",
"{",
"return",
"fals... | // Copy a line break character from a string into buffer. | [
"Copy",
"a",
"line",
"break",
"character",
"from",
"a",
"string",
"into",
"buffer",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L89-L103 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_set_emitter_error | func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool {
emitter.error = yaml_EMITTER_ERROR
emitter.problem = problem
return false
} | go | func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool {
emitter.error = yaml_EMITTER_ERROR
emitter.problem = problem
return false
} | [
"func",
"yaml_emitter_set_emitter_error",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"problem",
"string",
")",
"bool",
"{",
"emitter",
".",
"error",
"=",
"yaml_EMITTER_ERROR",
"\n",
"emitter",
".",
"problem",
"=",
"problem",
"\n",
"return",
"false",
"\n",
"}"
] | // Set an emitter error and return false. | [
"Set",
"an",
"emitter",
"error",
"and",
"return",
"false",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L106-L110 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit | func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.events = append(emitter.events, *event)
for !yaml_emitter_need_more_events(emitter) {
event := &emitter.events[emitter.events_head]
if !yaml_emitter_analyze_event(emitter, event) {
return false
}
if !yaml_emitter_state_mach... | go | func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.events = append(emitter.events, *event)
for !yaml_emitter_need_more_events(emitter) {
event := &emitter.events[emitter.events_head]
if !yaml_emitter_analyze_event(emitter, event) {
return false
}
if !yaml_emitter_state_mach... | [
"func",
"yaml_emitter_emit",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"emitter",
".",
"events",
"=",
"append",
"(",
"emitter",
".",
"events",
",",
"*",
"event",
")",
"\n",
"for",
"!",
"yaml_emitter_need_more... | // Emit an event. | [
"Emit",
"an",
"event",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L113-L127 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_need_more_events | func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
if emitter.events_head == len(emitter.events) {
return true
}
var accumulate int
switch emitter.events[emitter.events_head].typ {
case yaml_DOCUMENT_START_EVENT:
accumulate = 1
break
case yaml_SEQUENCE_START_EVENT:
accumulate = 2
break
... | go | func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
if emitter.events_head == len(emitter.events) {
return true
}
var accumulate int
switch emitter.events[emitter.events_head].typ {
case yaml_DOCUMENT_START_EVENT:
accumulate = 1
break
case yaml_SEQUENCE_START_EVENT:
accumulate = 2
break
... | [
"func",
"yaml_emitter_need_more_events",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"emitter",
".",
"events_head",
"==",
"len",
"(",
"emitter",
".",
"events",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"var",
"accumulate",
"int",
"\n",
... | // Check if we need to accumulate more events before emitting.
//
// We accumulate extra
// - 1 event for DOCUMENT-START
// - 2 events for SEQUENCE-START
// - 3 events for MAPPING-START
// | [
"Check",
"if",
"we",
"need",
"to",
"accumulate",
"more",
"events",
"before",
"emitting",
".",
"We",
"accumulate",
"extra",
"-",
"1",
"event",
"for",
"DOCUMENT",
"-",
"START",
"-",
"2",
"events",
"for",
"SEQUENCE",
"-",
"START",
"-",
"3",
"events",
"for",... | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L136-L170 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_append_tag_directive | func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool {
for i := 0; i < len(emitter.tag_directives); i++ {
if bytes.Equal(value.handle, emitter.tag_directives[i].handle) {
if allow_duplicates {
return true
}
return yaml_emitter_set_emitt... | go | func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool {
for i := 0; i < len(emitter.tag_directives); i++ {
if bytes.Equal(value.handle, emitter.tag_directives[i].handle) {
if allow_duplicates {
return true
}
return yaml_emitter_set_emitt... | [
"func",
"yaml_emitter_append_tag_directive",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"value",
"*",
"yaml_tag_directive_t",
",",
"allow_duplicates",
"bool",
")",
"bool",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"emitter",
".",
"tag_directives",
... | // Append a directive to the directives stack. | [
"Append",
"a",
"directive",
"to",
"the",
"directives",
"stack",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L173-L193 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_increase_indent | func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool {
emitter.indents = append(emitter.indents, emitter.indent)
if emitter.indent < 0 {
if flow {
emitter.indent = emitter.best_indent
} else {
emitter.indent = 0
}
} else if !indentless {
emitter.indent += emitter.best_... | go | func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool {
emitter.indents = append(emitter.indents, emitter.indent)
if emitter.indent < 0 {
if flow {
emitter.indent = emitter.best_indent
} else {
emitter.indent = 0
}
} else if !indentless {
emitter.indent += emitter.best_... | [
"func",
"yaml_emitter_increase_indent",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"flow",
",",
"indentless",
"bool",
")",
"bool",
"{",
"emitter",
".",
"indents",
"=",
"append",
"(",
"emitter",
".",
"indents",
",",
"emitter",
".",
"indent",
")",
"\n",
"if",... | // Increase the indentation level. | [
"Increase",
"the",
"indentation",
"level",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L196-L208 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_stream_start | func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if event.typ != yaml_STREAM_START_EVENT {
return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START")
}
if emitter.encoding == yaml_ANY_ENCODING {
emitter.encoding = event.encoding
if emitter.encoding == yaml_A... | go | func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if event.typ != yaml_STREAM_START_EVENT {
return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START")
}
if emitter.encoding == yaml_ANY_ENCODING {
emitter.encoding = event.encoding
if emitter.encoding == yaml_A... | [
"func",
"yaml_emitter_emit_stream_start",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"event",
".",
"typ",
"!=",
"yaml_STREAM_START_EVENT",
"{",
"return",
"yaml_emitter_set_emitter_error",
"(",
"emitter",
",",
"\... | // Expect STREAM-START. | [
"Expect",
"STREAM",
"-",
"START",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L272-L308 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_document_content | func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE)
return yaml_emitter_emit_node(emitter, event, true, false, false, false)
} | go | func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool {
emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE)
return yaml_emitter_emit_node(emitter, event, true, false, false, false)
} | [
"func",
"yaml_emitter_emit_document_content",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"emitter",
".",
"states",
"=",
"append",
"(",
"emitter",
".",
"states",
",",
"yaml_EMIT_DOCUMENT_END_STATE",
")",
"\n",
"retur... | // Expect the root node. | [
"Expect",
"the",
"root",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L425-L428 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_document_end | func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if event.typ != yaml_DOCUMENT_END_EVENT {
return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END")
}
if !yaml_emitter_write_indent(emitter) {
return false
}
if !event.implicit {
// [Go] Allocate the slice ... | go | func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool {
if event.typ != yaml_DOCUMENT_END_EVENT {
return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END")
}
if !yaml_emitter_write_indent(emitter) {
return false
}
if !event.implicit {
// [Go] Allocate the slice ... | [
"func",
"yaml_emitter_emit_document_end",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
")",
"bool",
"{",
"if",
"event",
".",
"typ",
"!=",
"yaml_DOCUMENT_END_EVENT",
"{",
"return",
"yaml_emitter_set_emitter_error",
"(",
"emitter",
",",
"\... | // Expect DOCUMENT-END. | [
"Expect",
"DOCUMENT",
"-",
"END",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L431-L453 | train |
kubernetes-retired/contrib | scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go | yaml_emitter_emit_flow_sequence_item | func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) {
return false
}
if !yaml_emitter_increase_indent(emitter, true, false) {
return false
}
emitter.flow_level++
... | go | func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
if first {
if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) {
return false
}
if !yaml_emitter_increase_indent(emitter, true, false) {
return false
}
emitter.flow_level++
... | [
"func",
"yaml_emitter_emit_flow_sequence_item",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"first",
"bool",
")",
"bool",
"{",
"if",
"first",
"{",
"if",
"!",
"yaml_emitter_write_indicator",
"(",
"emitter",
",",
"[",
"]",
"byte"... | // Expect a flow item node. | [
"Expect",
"a",
"flow",
"item",
"node",
"."
] | 89f6948e24578fed2a90a87871b2263729f90ac3 | https://github.com/kubernetes-retired/contrib/blob/89f6948e24578fed2a90a87871b2263729f90ac3/scale-demo/Godeps/_workspace/src/gopkg.in/yaml.v2/emitterc.go#L456-L501 | 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.