id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,600 | all-17601 | [
"InClip",
"is",
"a",
"wrapper",
"around",
"cairo_in_clip",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"InClip",
"(",
"x",
",",
"y",
"float64",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"cairo_in_clip",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"x",
")",
",",
"C",
".",
"double",
"(",
"y",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
17,601 | all-17602 | [
"Get",
"all",
"storage",
"pools",
"matching",
"the",
"given",
"WHERE",
"filter",
"(",
"if",
"given",
")",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"storagePools",
"(",
"where",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"name",
"string",
"\n",
"stmt",
":=",
"\"",
"\"",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"<mask>",
"}",
"\n\n",
"if",
"where",
"!=",
"\"",
"\"",
"{",
"stmt",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"where",
")",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"args",
"{",
"inargs",
"=",
"append",
"(",
"inargs",
",",
"arg",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"stmt",
",",
"inargs",
",",
"outargs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"result",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"pools",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"result",
"{",
"pools",
"=",
"append",
"(",
"pools",
",",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"return",
"pools",
",",
"nil",
"\n",
"}"
]
|
17,602 | all-17603 | [
"Resolve",
"gets",
"resolves",
"the",
"string",
"provided",
"to",
"an",
"/",
"ipns",
"/",
"[",
"name",
"]",
".",
"If",
"asked",
"to",
"resolve",
"an",
"empty",
"string",
"resolve",
"instead",
"resolves",
"the",
"node",
"s",
"own",
"/",
"ipns",
"value",
"."
]
| [
"func",
"(",
"s",
"*",
"Shell",
")",
"Resolve",
"(",
"id",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"s",
".",
"Request",
"(",
"\"",
"\"",
")",
"\n",
"if",
"id",
"!=",
"\"",
"\"",
"{",
"req",
".",
"Arguments",
"(",
"id",
")",
"\n",
"}",
"\n",
"var",
"out",
"struct",
"{",
"Path",
"string",
"}",
"\n",
"err",
":=",
"req",
".",
"Exec",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"<mask>",
")",
"\n",
"return",
"out",
".",
"Path",
",",
"err",
"\n",
"}"
]
|
17,603 | all-17604 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniform4fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform4fv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
]
|
17,604 | all-17605 | [
"Encode",
"writes",
"this",
"Part",
"and",
"all",
"its",
"children",
"to",
"the",
"specified",
"writer",
"in",
"MIME",
"format",
"."
]
| [
"func",
"(",
"p",
"*",
"<mask>",
")",
"Encode",
"(",
"writer",
"io",
".",
"Writer",
")",
"error",
"{",
"if",
"p",
".",
"Header",
"==",
"nil",
"{",
"p",
".",
"Header",
"=",
"make",
"(",
"textproto",
".",
"MIMEHeader",
")",
"\n",
"}",
"\n",
"cte",
":=",
"p",
".",
"setupMIMEHeaders",
"(",
")",
"\n",
"// Encode this part.",
"b",
":=",
"bufio",
".",
"NewWriter",
"(",
"writer",
")",
"\n",
"p",
".",
"encodeHeader",
"(",
"b",
")",
"\n",
"if",
"len",
"(",
"p",
".",
"Content",
")",
">",
"0",
"{",
"b",
".",
"Write",
"(",
"crnl",
")",
"\n",
"if",
"err",
":=",
"p",
".",
"encodeContent",
"(",
"b",
",",
"cte",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"p",
".",
"FirstChild",
"==",
"nil",
"{",
"return",
"b",
".",
"Flush",
"(",
")",
"\n",
"}",
"\n",
"// Encode children.",
"endMarker",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\\r",
"\\n",
"\"",
"+",
"p",
".",
"Boundary",
"+",
"\"",
"\"",
")",
"\n",
"marker",
":=",
"endMarker",
"[",
":",
"len",
"(",
"endMarker",
")",
"-",
"2",
"]",
"\n",
"c",
":=",
"p",
".",
"FirstChild",
"\n",
"for",
"c",
"!=",
"nil",
"{",
"b",
".",
"Write",
"(",
"marker",
")",
"\n",
"b",
".",
"Write",
"(",
"crnl",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"Encode",
"(",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
"=",
"c",
".",
"NextSibling",
"\n",
"}",
"\n",
"b",
".",
"Write",
"(",
"endMarker",
")",
"\n",
"b",
".",
"Write",
"(",
"crnl",
")",
"\n",
"return",
"b",
".",
"Flush",
"(",
")",
"\n",
"}"
]
|
17,605 | all-17606 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventTargetInfoChanged",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
17,606 | all-17607 | [
"GetProcessQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"ProcessQuery",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"GetProcessQueryOk",
"(",
")",
"(",
"WidgetProcessQuery",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"ProcessQuery",
"==",
"nil",
"{",
"return",
"WidgetProcessQuery",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"ProcessQuery",
",",
"<mask>",
"\n",
"}"
]
|
17,607 | all-17608 | [
"BodyData",
"returns",
"the",
"full",
"request",
"body"
]
| [
"func",
"(",
"r",
"*",
"Request",
")",
"BodyData",
"(",
")",
"[",
"]",
"byte",
"{",
"var",
"err",
"error",
"\n",
"if",
"!",
"r",
".",
"bodyRead",
"{",
"if",
"r",
".",
"Body",
"!=",
"nil",
"{",
"r",
".",
"bodyData",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// catch i/o timeout errors",
"neterr",
",",
"isNetError",
":=",
"err",
".",
"(",
"net",
".",
"<mask>",
")",
"\n",
"if",
"isNetError",
"&&",
"neterr",
".",
"Timeout",
"(",
")",
"{",
"panic",
"(",
"ghttp",
".",
"NewHttpError",
"(",
"err",
",",
"http",
".",
"StatusRequestTimeout",
")",
")",
"\n",
"}",
"else",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"r",
".",
"bodyRead",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"bodyData",
"\n",
"}"
]
|
17,608 | all-17609 | [
"Adds",
"an",
"element",
"to",
"the",
"sequence",
"end",
".",
"Returns",
"a",
"pointer",
"to",
"the",
"element",
"added",
"."
]
| [
"func",
"(",
"seq",
"*",
"Seq",
")",
"Push",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"cvSeqPush",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"<mask>",
")",
")",
"\n",
"}"
]
|
17,609 | all-17610 | [
"FromMOID",
"locates",
"a",
"portgroup",
"by",
"its",
"managed",
"object",
"reference",
"ID",
"."
]
| [
"func",
"FromMOID",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"id",
"string",
")",
"(",
"*",
"object",
".",
"DistributedVirtualPortgroup",
",",
"error",
")",
"{",
"finder",
":=",
"<mask>",
".",
"NewFinder",
"(",
"client",
".",
"Client",
",",
"false",
")",
"\n\n",
"ref",
":=",
"types",
".",
"ManagedObjectReference",
"{",
"Type",
":",
"\"",
"\"",
",",
"Value",
":",
"id",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"ds",
",",
"err",
":=",
"finder",
".",
"ObjectReference",
"(",
"ctx",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// Should be safe to return here. If our reference returned here and is not a",
"// DistributedVirtualPortgroup, then we have bigger problems and to be",
"// honest we should be panicking anyway.",
"return",
"ds",
".",
"(",
"*",
"object",
".",
"DistributedVirtualPortgroup",
")",
",",
"nil",
"\n",
"}"
]
|
17,610 | all-17611 | [
"MustTransaction",
"retrieves",
"the",
"Transaction",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"StellarMessage",
")",
"MustTransaction",
"(",
")",
"TransactionEnvelope",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetTransaction",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
17,611 | all-17612 | [
"GetHashTreeObject",
"is",
"a",
"convenience",
"function",
"to",
"deserialize",
"a",
"HashTree",
"from",
"an",
"object",
"in",
"the",
"object",
"store",
"."
]
| [
"func",
"GetHashTreeObject",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"storageRoot",
"string",
",",
"treeRef",
"*",
"pfs",
".",
"<mask>",
")",
"(",
"HashTree",
",",
"error",
")",
"{",
"return",
"getHashTree",
"(",
"storageRoot",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"pachClient",
".",
"GetObject",
"(",
"treeRef",
".",
"Hash",
",",
"w",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
17,612 | all-17613 | [
"title",
":",
"service",
"broker",
"list",
"path",
":",
"/",
"brokers",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"List",
"service",
"brokers",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
]
| [
"func",
"serviceBrokerList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceBrokerRead",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"brokers",
",",
"err",
":=",
"servicemanager",
".",
"ServiceBroker",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"brokers",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"brokers",
",",
"}",
")",
"\n",
"}"
]
|
17,613 | all-17614 | [
"GetSyntheticsLocations",
"get",
"all",
"test",
"locations"
]
| [
"func",
"(",
"client",
"*",
"<mask>",
")",
"GetSyntheticsLocations",
"(",
")",
"(",
"[",
"]",
"SyntheticsLocation",
",",
"error",
")",
"{",
"var",
"out",
"struct",
"{",
"Locations",
"[",
"]",
"SyntheticsLocation",
"`json:\"locations,omitempty\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Locations",
",",
"nil",
"\n",
"}"
]
|
17,614 | all-17615 | [
"UpdateContainer",
"updates",
"the",
"container",
"definition"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateContainer",
"(",
"name",
"string",
",",
"container",
"api",
".",
"ContainerPut",
",",
"ETag",
"string",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"container",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
]
|
17,615 | all-17616 | [
"Do",
"executes",
"CSS",
".",
"setKeyframeKey",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"keyText",
"-",
"The",
"resulting",
"key",
"text",
"after",
"modification",
"."
]
| [
"func",
"(",
"p",
"*",
"SetKeyframeKeyParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"keyText",
"*",
"<mask>",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"SetKeyframeKeyReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetKeyframeKey",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"KeyText",
",",
"nil",
"\n",
"}"
]
|
17,616 | all-17617 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"MemoType"
]
| [
"func",
"(",
"e",
"MemoType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"memoTypeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,617 | all-17618 | [
"NewHOTP",
"intialises",
"a",
"new",
"HOTP",
"instance",
"with",
"the",
"key",
"and",
"counter",
"values",
".",
"No",
"check",
"is",
"done",
"on",
"the",
"digits",
"but",
"typical",
"values",
"are",
"6",
"and",
"8",
"."
]
| [
"func",
"NewHOTP",
"(",
"key",
"[",
"]",
"byte",
",",
"counter",
"uint64",
",",
"digits",
"int",
")",
"*",
"HOTP",
"{",
"otp",
":=",
"&",
"HOTP",
"{",
"Key",
":",
"key",
",",
"Digits",
":",
"digits",
",",
"}",
"\n",
"otp",
".",
"counter",
"=",
"new",
"(",
"[",
"ctrSize",
"]",
"byte",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint64",
"(",
"otp",
".",
"counter",
"[",
":",
"]",
",",
"<mask>",
")",
"\n\n",
"return",
"otp",
"\n",
"}"
]
|
17,618 | all-17619 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
]
| [
"func",
"Uniform4i",
"(",
"<mask>",
"int32",
",",
"v0",
"int32",
",",
"v1",
"int32",
",",
"v2",
"int32",
",",
"v3",
"int32",
")",
"{",
"C",
".",
"glowUniform4i",
"(",
"gpUniform4i",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v1",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v2",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v3",
")",
")",
"\n",
"}"
]
|
17,619 | all-17620 | [
"DashDeployment",
"creates",
"a",
"Deployment",
"for",
"the",
"pachyderm",
"dashboard",
"."
]
| [
"func",
"DashDeployment",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"apps",
".",
"Deployment",
"{",
"return",
"&",
"apps",
".",
"Deployment",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"dashName",
",",
"labels",
"(",
"dashName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"apps",
".",
"DeploymentSpec",
"{",
"Selector",
":",
"&",
"metav1",
".",
"LabelSelector",
"{",
"MatchLabels",
":",
"labels",
"(",
"dashName",
")",
",",
"}",
",",
"Template",
":",
"v1",
".",
"PodTemplateSpec",
"{",
"ObjectMeta",
":",
"objectMeta",
"(",
"dashName",
",",
"labels",
"(",
"dashName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"v1",
".",
"PodSpec",
"{",
"Containers",
":",
"[",
"]",
"v1",
".",
"Container",
"{",
"{",
"<mask>",
":",
"dashName",
",",
"Image",
":",
"AddRegistry",
"(",
"opts",
".",
"Registry",
",",
"opts",
".",
"DashImage",
")",
",",
"Ports",
":",
"[",
"]",
"v1",
".",
"ContainerPort",
"{",
"{",
"ContainerPort",
":",
"8080",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"ImagePullPolicy",
":",
"\"",
"\"",
",",
"}",
",",
"{",
"Name",
":",
"grpcProxyName",
",",
"Image",
":",
"AddRegistry",
"(",
"opts",
".",
"Registry",
",",
"grpcProxyImage",
")",
",",
"Ports",
":",
"[",
"]",
"v1",
".",
"ContainerPort",
"{",
"{",
"ContainerPort",
":",
"8081",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"ImagePullPolicy",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"ImagePullSecrets",
":",
"imagePullSecrets",
"(",
"opts",
")",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
]
|
17,620 | all-17621 | [
"addr",
"lowers",
"a",
"single",
"-",
"result",
"addressable",
"expression",
"e",
"to",
"SSA",
"form",
"emitting",
"code",
"to",
"fn",
"and",
"returning",
"the",
"location",
"(",
"an",
"lvalue",
")",
"defined",
"by",
"the",
"expression",
".",
"If",
"escaping",
"is",
"true",
"addr",
"marks",
"the",
"base",
"variable",
"of",
"the",
"addressable",
"expression",
"e",
"as",
"being",
"a",
"potentially",
"escaping",
"pointer",
"value",
".",
"For",
"example",
"in",
"this",
"code",
":",
"a",
":",
"=",
"A",
"{",
"b",
":",
"[",
"1",
"]",
"B",
"{",
"B",
"{",
"c",
":",
"1",
"}}",
"}",
"return",
"&a",
".",
"b",
"[",
"0",
"]",
".",
"c",
"the",
"application",
"of",
"&",
"causes",
"a",
".",
"b",
"[",
"0",
"]",
".",
"c",
"to",
"have",
"its",
"address",
"taken",
"which",
"means",
"that",
"ultimately",
"the",
"local",
"variable",
"a",
"must",
"be",
"heap",
"-",
"allocated",
".",
"This",
"is",
"a",
"simple",
"but",
"very",
"conservative",
"escape",
"analysis",
".",
"Operations",
"forming",
"potentially",
"escaping",
"pointers",
"include",
":",
"-",
"&x",
"including",
"when",
"implicit",
"in",
"method",
"call",
"or",
"composite",
"literals",
".",
"-",
"a",
"[",
":",
"]",
"iff",
"a",
"is",
"an",
"array",
"(",
"not",
"*",
"array",
")",
"-",
"references",
"to",
"variables",
"in",
"lexically",
"enclosing",
"functions",
"."
]
| [
"func",
"(",
"b",
"*",
"<mask>",
")",
"addr",
"(",
"fn",
"*",
"Function",
",",
"e",
"ast",
".",
"Expr",
",",
"escaping",
"bool",
")",
"lvalue",
"{",
"switch",
"e",
":=",
"e",
".",
"(",
"type",
")",
"{",
"case",
"*",
"ast",
".",
"Ident",
":",
"if",
"isBlankIdent",
"(",
"e",
")",
"{",
"return",
"blank",
"{",
"}",
"\n",
"}",
"\n",
"obj",
":=",
"fn",
".",
"Pkg",
".",
"objectOf",
"(",
"e",
")",
"\n",
"v",
":=",
"fn",
".",
"Prog",
".",
"packageLevelValue",
"(",
"obj",
")",
"// var (address)",
"\n",
"if",
"v",
"==",
"nil",
"{",
"v",
"=",
"fn",
".",
"lookup",
"(",
"obj",
",",
"escaping",
")",
"\n",
"}",
"\n",
"return",
"&",
"address",
"{",
"addr",
":",
"v",
",",
"pos",
":",
"e",
".",
"Pos",
"(",
")",
",",
"expr",
":",
"e",
"}",
"\n\n",
"case",
"*",
"ast",
".",
"CompositeLit",
":",
"t",
":=",
"deref",
"(",
"fn",
".",
"Pkg",
".",
"typeOf",
"(",
"e",
")",
")",
"\n",
"var",
"v",
"*",
"Alloc",
"\n",
"if",
"escaping",
"{",
"v",
"=",
"emitNew",
"(",
"fn",
",",
"t",
",",
"e",
".",
"Lbrace",
")",
"\n",
"}",
"else",
"{",
"v",
"=",
"fn",
".",
"addLocal",
"(",
"t",
",",
"e",
".",
"Lbrace",
")",
"\n",
"}",
"\n",
"v",
".",
"Comment",
"=",
"\"",
"\"",
"\n",
"var",
"sb",
"storebuf",
"\n",
"b",
".",
"compLit",
"(",
"fn",
",",
"v",
",",
"e",
",",
"true",
",",
"&",
"sb",
")",
"\n",
"sb",
".",
"emit",
"(",
"fn",
")",
"\n",
"return",
"&",
"address",
"{",
"addr",
":",
"v",
",",
"pos",
":",
"e",
".",
"Lbrace",
",",
"expr",
":",
"e",
"}",
"\n\n",
"case",
"*",
"ast",
".",
"ParenExpr",
":",
"return",
"b",
".",
"addr",
"(",
"fn",
",",
"e",
".",
"X",
",",
"escaping",
")",
"\n\n",
"case",
"*",
"ast",
".",
"SelectorExpr",
":",
"sel",
",",
"ok",
":=",
"fn",
".",
"Pkg",
".",
"info",
".",
"Selections",
"[",
"e",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// qualified identifier",
"return",
"b",
".",
"addr",
"(",
"fn",
",",
"e",
".",
"Sel",
",",
"escaping",
")",
"\n",
"}",
"\n",
"if",
"sel",
".",
"Kind",
"(",
")",
"!=",
"types",
".",
"FieldVal",
"{",
"panic",
"(",
"sel",
")",
"\n",
"}",
"\n",
"wantAddr",
":=",
"true",
"\n",
"v",
":=",
"b",
".",
"receiver",
"(",
"fn",
",",
"e",
".",
"X",
",",
"wantAddr",
",",
"escaping",
",",
"sel",
")",
"\n",
"last",
":=",
"len",
"(",
"sel",
".",
"Index",
"(",
")",
")",
"-",
"1",
"\n",
"return",
"&",
"address",
"{",
"addr",
":",
"emitFieldSelection",
"(",
"fn",
",",
"v",
",",
"sel",
".",
"Index",
"(",
")",
"[",
"last",
"]",
",",
"true",
",",
"e",
".",
"Sel",
")",
",",
"pos",
":",
"e",
".",
"Sel",
".",
"Pos",
"(",
")",
",",
"expr",
":",
"e",
".",
"Sel",
",",
"}",
"\n\n",
"case",
"*",
"ast",
".",
"IndexExpr",
":",
"var",
"x",
"Value",
"\n",
"var",
"et",
"types",
".",
"Type",
"\n",
"switch",
"t",
":=",
"fn",
".",
"Pkg",
".",
"typeOf",
"(",
"e",
".",
"X",
")",
".",
"Underlying",
"(",
")",
".",
"(",
"type",
")",
"{",
"case",
"*",
"types",
".",
"Array",
":",
"x",
"=",
"b",
".",
"addr",
"(",
"fn",
",",
"e",
".",
"X",
",",
"escaping",
")",
".",
"address",
"(",
"fn",
")",
"\n",
"et",
"=",
"types",
".",
"NewPointer",
"(",
"t",
".",
"Elem",
"(",
")",
")",
"\n",
"case",
"*",
"types",
".",
"Pointer",
":",
"// *array",
"x",
"=",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"X",
")",
"\n",
"et",
"=",
"types",
".",
"NewPointer",
"(",
"t",
".",
"Elem",
"(",
")",
".",
"Underlying",
"(",
")",
".",
"(",
"*",
"types",
".",
"Array",
")",
".",
"Elem",
"(",
")",
")",
"\n",
"case",
"*",
"types",
".",
"Slice",
":",
"x",
"=",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"X",
")",
"\n",
"et",
"=",
"types",
".",
"NewPointer",
"(",
"t",
".",
"Elem",
"(",
")",
")",
"\n",
"case",
"*",
"types",
".",
"Map",
":",
"return",
"&",
"element",
"{",
"m",
":",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"X",
")",
",",
"k",
":",
"emitConv",
"(",
"fn",
",",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"Index",
")",
",",
"t",
".",
"Key",
"(",
")",
")",
",",
"t",
":",
"t",
".",
"Elem",
"(",
")",
",",
"pos",
":",
"e",
".",
"Lbrack",
",",
"}",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
"+",
"t",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"v",
":=",
"&",
"IndexAddr",
"{",
"X",
":",
"x",
",",
"Index",
":",
"emitConv",
"(",
"fn",
",",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"Index",
")",
",",
"tInt",
")",
",",
"}",
"\n",
"v",
".",
"setPos",
"(",
"e",
".",
"Lbrack",
")",
"\n",
"v",
".",
"setType",
"(",
"et",
")",
"\n",
"return",
"&",
"address",
"{",
"addr",
":",
"fn",
".",
"emit",
"(",
"v",
")",
",",
"pos",
":",
"e",
".",
"Lbrack",
",",
"expr",
":",
"e",
"}",
"\n\n",
"case",
"*",
"ast",
".",
"StarExpr",
":",
"return",
"&",
"address",
"{",
"addr",
":",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"X",
")",
",",
"pos",
":",
"e",
".",
"Star",
",",
"expr",
":",
"e",
"}",
"\n",
"}",
"\n\n",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
")",
")",
"\n",
"}"
]
|
17,621 | all-17622 | [
"Start",
"starts",
"the",
"test",
"server",
"called",
"by",
"the",
"Client",
"and",
"other",
"upstream",
"servers",
"."
]
| [
"func",
"(",
"s",
"*",
"Server",
")",
"Start",
"(",
")",
"error",
"{",
"if",
"s",
".",
"HostPort",
"==",
"\"",
"\"",
"{",
"s",
".",
"HostPort",
"=",
"\"",
"\"",
"+",
"common",
".",
"DefaultServerPort",
"\n",
"}",
"\n",
"channelOpts",
":=",
"&",
"tchannel",
".",
"ChannelOptions",
"{",
"Tracer",
":",
"s",
".",
"Tracer",
",",
"}",
"\n",
"ch",
",",
"err",
":=",
"tchannel",
".",
"NewChannel",
"(",
"<mask>",
".",
"DefaultServiceName",
",",
"channelOpts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ch",
".",
"ListenAndServe",
"(",
"s",
".",
"HostPort",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"HostPort",
"=",
"ch",
".",
"PeerInfo",
"(",
")",
".",
"HostPort",
"// override in case it was \":0\"",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"s",
".",
"HostPort",
")",
"\n",
"s",
".",
"Ch",
"=",
"ch",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,622 | all-17623 | [
"FixedDuration",
"returns",
"a",
"string",
"representation",
"of",
"the",
"given",
"duration",
"with",
"the",
"hours",
"minutes",
"and",
"seconds",
"."
]
| [
"func",
"FixedDuration",
"(",
"d",
"time",
".",
"Duration",
")",
"string",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"int",
"(",
"d",
".",
"Seconds",
"(",
")",
")",
"%",
"60",
")",
"\n",
"if",
"d",
">=",
"time",
".",
"Minute",
"{",
"str",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"int",
"(",
"d",
".",
"Minutes",
"(",
")",
")",
"%",
"60",
")",
"+",
"str",
"\n",
"}",
"\n",
"if",
"d",
">=",
"<mask>",
".",
"Hour",
"{",
"str",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"int",
"(",
"d",
".",
"Hours",
"(",
")",
")",
")",
"+",
"str",
"\n",
"}",
"\n",
"return",
"str",
"\n",
"}"
]
|
17,623 | all-17624 | [
"generateSSHKey",
"creates",
"a",
"ssh",
"key",
"pair",
"locally",
"and",
"saves",
"the",
"public",
"key",
"file",
"contents",
"in",
"OpenSSH",
"format",
"to",
"the",
"DeploymentContext",
"."
]
| [
"func",
"(",
"d",
"*",
"Driver",
")",
"generateSSHKey",
"(",
"ctx",
"*",
"azureutil",
".",
"DeploymentContext",
")",
"error",
"{",
"privPath",
":=",
"d",
".",
"GetSSHKeyPath",
"(",
")",
"\n",
"pubPath",
":=",
"privPath",
"+",
"\"",
"\"",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"pubPath",
",",
"\"",
"\"",
":",
"privPath",
",",
"}",
")",
"\n\n",
"if",
"err",
":=",
"ssh",
".",
"GenerateSSHKey",
"(",
"privPath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"publicKey",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"pubPath",
")",
"\n",
"ctx",
".",
"SSHPublicKey",
"=",
"string",
"(",
"publicKey",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,624 | all-17625 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
]
| [
"func",
"(",
"o",
"*",
"AddVMReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"<mask>",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewAddVMOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"default",
":",
"result",
":=",
"NewAddVMDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
]
|
17,625 | all-17626 | [
"SetBodyString",
"sets",
"response",
"body",
"."
]
| [
"func",
"(",
"resp",
"*",
"Response",
")",
"SetBodyString",
"(",
"<mask>",
"string",
")",
"{",
"resp",
".",
"closeBodyStream",
"(",
")",
"\n",
"bodyBuf",
":=",
"resp",
".",
"bodyBuffer",
"(",
")",
"\n",
"bodyBuf",
".",
"Reset",
"(",
")",
"\n",
"bodyBuf",
".",
"WriteString",
"(",
"body",
")",
"\n",
"}"
]
|
17,626 | all-17627 | [
"String",
"returns",
"stirng",
"representation",
"of",
"log",
"level",
"."
]
| [
"func",
"(",
"level",
"Level",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"<mask>",
"{",
"case",
"EMERGENCY",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ALERT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"CRITICAL",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ERROR",
":",
"return",
"\"",
"\"",
"\n",
"case",
"WARNING",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NOTICE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"INFO",
":",
"return",
"\"",
"\"",
"\n",
"default",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
]
|
17,627 | all-17628 | [
"GetManageStatusTitleTextOk",
"returns",
"a",
"tuple",
"with",
"the",
"ManageStatusTitleText",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetManageStatusTitleTextOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"ManageStatusTitleText",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"ManageStatusTitleText",
",",
"true",
"\n",
"}"
]
|
17,628 | all-17629 | [
"LoadFromReader",
"accepts",
"raw",
"data",
"directly",
"from",
"a",
"reader",
"and",
"returns",
"a",
"new",
"configuration",
"representation",
".",
"You",
"must",
"use",
"ReloadData",
"to",
"reload",
".",
"You",
"cannot",
"append",
"files",
"a",
"configfile",
"read",
"this",
"way",
"."
]
| [
"func",
"LoadFromReader",
"(",
"in",
"io",
".",
"Reader",
")",
"(",
"c",
"*",
"ConfigFile",
",",
"err",
"error",
")",
"{",
"c",
"=",
"newConfigFile",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
")",
"\n",
"err",
"=",
"c",
".",
"<mask>",
"(",
"in",
")",
"\n",
"return",
"c",
",",
"err",
"\n",
"}"
]
|
17,629 | all-17630 | [
"/",
"*",
"Debugf",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelDebug"
]
| [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Debugf",
"(",
"msg",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"la",
".",
"<mask>",
"(",
"LevelDebug",
",",
"nil",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
]
|
17,630 | all-17631 | [
"CreateFork",
"creates",
"a",
"fork",
"for",
"the",
"authenticated",
"user",
".",
"Forking",
"a",
"repository",
"happens",
"asynchronously",
".",
"Therefore",
"we",
"may",
"have",
"to",
"wait",
"a",
"short",
"period",
"before",
"accessing",
"the",
"git",
"objects",
".",
"If",
"this",
"takes",
"longer",
"than",
"5",
"minutes",
"GitHub",
"recommends",
"contacting",
"their",
"support",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"repos",
"/",
"forks",
"/",
"#create",
"-",
"a",
"-",
"fork"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateFork",
"(",
"owner",
",",
"repo",
"string",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"<mask>",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPost",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"202",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,631 | all-17632 | [
"PrintDatumInfo",
"pretty",
"-",
"prints",
"file",
"info",
".",
"If",
"recurse",
"is",
"false",
"and",
"directory",
"size",
"is",
"0",
"display",
"-",
"instead",
"If",
"fast",
"is",
"true",
"and",
"file",
"size",
"is",
"0",
"display",
"-",
"instead"
]
| [
"func",
"PrintDatumInfo",
"(",
"w",
"io",
".",
"Writer",
",",
"datumInfo",
"*",
"ppsclient",
".",
"DatumInfo",
")",
"{",
"totalTime",
":=",
"\"",
"\"",
"\n",
"if",
"datumInfo",
".",
"Stats",
"!=",
"nil",
"{",
"totalTime",
"=",
"units",
".",
"HumanDuration",
"(",
"<mask>",
".",
"GetDatumTotalTime",
"(",
"datumInfo",
".",
"Stats",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\t",
"\\n",
"\"",
",",
"datumInfo",
".",
"Datum",
".",
"ID",
",",
"datumState",
"(",
"datumInfo",
".",
"State",
")",
",",
"totalTime",
")",
"\n",
"}"
]
|
17,632 | all-17633 | [
"check",
"the",
"types",
"of",
"the",
"children",
"of",
"each",
"node",
"and",
"raise",
"an",
"error",
"if",
"they",
"do",
"not",
"form",
"a",
"valid",
"node",
".",
"Some",
"of",
"these",
"checks",
"are",
"redundant",
"as",
"the",
"parsing",
"stage",
"does",
"not",
"allow",
"them",
"but",
"the",
"costs",
"are",
"small",
"and",
"might",
"reveal",
"errors",
"when",
"making",
"changes",
"."
]
| [
"func",
"(",
"p",
"*",
"parser",
")",
"checkType",
"(",
"node",
"Node",
")",
"(",
"typ",
"ValueType",
")",
"{",
"// For expressions the type is determined by their Type function.",
"// Lists do not have a type but are not invalid either.",
"switch",
"n",
":=",
"node",
".",
"(",
"<mask>",
")",
"{",
"case",
"Expressions",
":",
"typ",
"=",
"ValueTypeNone",
"\n",
"case",
"Expr",
":",
"typ",
"=",
"n",
".",
"Type",
"(",
")",
"\n",
"default",
":",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"node",
")",
"\n",
"}",
"\n\n",
"// Recursively check correct typing for child nodes and raise",
"// errors in case of bad typing.",
"switch",
"n",
":=",
"node",
".",
"(",
"type",
")",
"{",
"case",
"*",
"EvalStmt",
":",
"ty",
":=",
"p",
".",
"checkType",
"(",
"n",
".",
"Expr",
")",
"\n",
"if",
"ty",
"==",
"ValueTypeNone",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"documentedType",
"(",
"ty",
")",
")",
"\n",
"}",
"\n\n",
"case",
"Expressions",
":",
"for",
"_",
",",
"e",
":=",
"range",
"n",
"{",
"ty",
":=",
"p",
".",
"checkType",
"(",
"e",
")",
"\n",
"if",
"ty",
"==",
"ValueTypeNone",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"documentedType",
"(",
"ty",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"*",
"AggregateExpr",
":",
"if",
"!",
"n",
".",
"Op",
".",
"isAggregator",
"(",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Op",
")",
"\n",
"}",
"\n",
"p",
".",
"expectType",
"(",
"n",
".",
"Expr",
",",
"ValueTypeVector",
",",
"\"",
"\"",
")",
"\n",
"if",
"n",
".",
"Op",
"==",
"ItemTopK",
"||",
"n",
".",
"Op",
"==",
"ItemBottomK",
"||",
"n",
".",
"Op",
"==",
"ItemQuantile",
"{",
"p",
".",
"expectType",
"(",
"n",
".",
"Param",
",",
"ValueTypeScalar",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
".",
"Op",
"==",
"ItemCountValues",
"{",
"p",
".",
"expectType",
"(",
"n",
".",
"Param",
",",
"ValueTypeString",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"case",
"*",
"BinaryExpr",
":",
"lt",
":=",
"p",
".",
"checkType",
"(",
"n",
".",
"LHS",
")",
"\n",
"rt",
":=",
"p",
".",
"checkType",
"(",
"n",
".",
"RHS",
")",
"\n\n",
"if",
"!",
"n",
".",
"Op",
".",
"isOperator",
"(",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Op",
")",
"\n",
"}",
"\n",
"if",
"(",
"lt",
"!=",
"ValueTypeScalar",
"&&",
"lt",
"!=",
"ValueTypeVector",
")",
"||",
"(",
"rt",
"!=",
"ValueTypeScalar",
"&&",
"rt",
"!=",
"ValueTypeVector",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"(",
"lt",
"!=",
"ValueTypeVector",
"||",
"rt",
"!=",
"ValueTypeVector",
")",
"&&",
"n",
".",
"VectorMatching",
"!=",
"nil",
"{",
"if",
"len",
"(",
"n",
".",
"VectorMatching",
".",
"MatchingLabels",
")",
">",
"0",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
".",
"VectorMatching",
"=",
"nil",
"\n",
"}",
"else",
"{",
"// Both operands are Vectors.",
"if",
"n",
".",
"Op",
".",
"isSetOperator",
"(",
")",
"{",
"if",
"n",
".",
"VectorMatching",
".",
"Card",
"==",
"CardOneToMany",
"||",
"n",
".",
"VectorMatching",
".",
"Card",
"==",
"CardManyToOne",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Op",
")",
"\n",
"}",
"\n",
"if",
"n",
".",
"VectorMatching",
".",
"Card",
"!=",
"CardManyToMany",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"(",
"lt",
"==",
"ValueTypeScalar",
"||",
"rt",
"==",
"ValueTypeScalar",
")",
"&&",
"n",
".",
"Op",
".",
"isSetOperator",
"(",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Op",
")",
"\n",
"}",
"\n\n",
"case",
"*",
"Call",
":",
"nargs",
":=",
"len",
"(",
"n",
".",
"Func",
".",
"ArgTypes",
")",
"\n",
"if",
"n",
".",
"Func",
".",
"Variadic",
"==",
"0",
"{",
"if",
"nargs",
"!=",
"len",
"(",
"n",
".",
"Args",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"nargs",
",",
"n",
".",
"Func",
".",
"Name",
",",
"len",
"(",
"n",
".",
"Args",
")",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"na",
":=",
"nargs",
"-",
"1",
"\n",
"if",
"na",
">",
"len",
"(",
"n",
".",
"Args",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"na",
",",
"n",
".",
"Func",
".",
"Name",
",",
"len",
"(",
"n",
".",
"Args",
")",
")",
"\n",
"}",
"else",
"if",
"nargsmax",
":=",
"na",
"+",
"n",
".",
"Func",
".",
"Variadic",
";",
"n",
".",
"Func",
".",
"Variadic",
">",
"0",
"&&",
"nargsmax",
"<",
"len",
"(",
"n",
".",
"Args",
")",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"nargsmax",
",",
"n",
".",
"Func",
".",
"Name",
",",
"len",
"(",
"n",
".",
"Args",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"arg",
":=",
"range",
"n",
".",
"Args",
"{",
"if",
"i",
">=",
"len",
"(",
"n",
".",
"Func",
".",
"ArgTypes",
")",
"{",
"i",
"=",
"len",
"(",
"n",
".",
"Func",
".",
"ArgTypes",
")",
"-",
"1",
"\n",
"}",
"\n",
"p",
".",
"expectType",
"(",
"arg",
",",
"n",
".",
"Func",
".",
"ArgTypes",
"[",
"i",
"]",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"n",
".",
"Func",
".",
"Name",
")",
")",
"\n",
"}",
"\n\n",
"case",
"*",
"ParenExpr",
":",
"p",
".",
"checkType",
"(",
"n",
".",
"Expr",
")",
"\n\n",
"case",
"*",
"UnaryExpr",
":",
"if",
"n",
".",
"Op",
"!=",
"ItemADD",
"&&",
"n",
".",
"Op",
"!=",
"ItemSUB",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"t",
":=",
"p",
".",
"checkType",
"(",
"n",
".",
"Expr",
")",
";",
"t",
"!=",
"ValueTypeScalar",
"&&",
"t",
"!=",
"ValueTypeVector",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"documentedType",
"(",
"t",
")",
")",
"\n",
"}",
"\n\n",
"case",
"*",
"SubqueryExpr",
":",
"ty",
":=",
"p",
".",
"checkType",
"(",
"n",
".",
"Expr",
")",
"\n",
"if",
"ty",
"!=",
"ValueTypeVector",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ty",
",",
"n",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"case",
"*",
"NumberLiteral",
",",
"*",
"MatrixSelector",
",",
"*",
"StringLiteral",
",",
"*",
"VectorSelector",
":",
"// Nothing to do for terminals.",
"default",
":",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"node",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,633 | all-17634 | [
"HaveCount",
"passes",
"when",
"the",
"expected",
"element",
"count",
"is",
"equal",
"to",
"the",
"actual",
"number",
"of",
"elements",
"in",
"the",
"selection",
"."
]
| [
"func",
"HaveCount",
"(",
"count",
"int",
")",
"<mask>",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"ValueMatcher",
"{",
"Method",
":",
"\"",
"\"",
",",
"Property",
":",
"\"",
"\"",
",",
"Expected",
":",
"count",
"}",
"\n",
"}"
]
|
17,634 | all-17635 | [
"This",
"is",
"useful",
"with",
"survey",
"prompting",
"library"
]
| [
"func",
"(",
"o",
"*",
"BoolOption",
")",
"WriteAnswer",
"(",
"<mask>",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"v",
",",
"ok",
":=",
"value",
".",
"(",
"bool",
")",
";",
"ok",
"{",
"o",
".",
"Value",
"=",
"v",
"\n",
"o",
".",
"Defined",
"=",
"true",
"\n",
"o",
".",
"Source",
"=",
"\"",
"\"",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
",",
"o",
".",
"Value",
",",
"value",
")",
"\n",
"}"
]
|
17,635 | all-17636 | [
"filterByAnnotations",
"filters",
"a",
"list",
"of",
"services",
"by",
"a",
"given",
"annotation",
"selector",
"."
]
| [
"func",
"(",
"sc",
"*",
"serviceSource",
")",
"filterByAnnotations",
"(",
"services",
"[",
"]",
"*",
"v1",
".",
"Service",
")",
"(",
"[",
"]",
"*",
"v1",
".",
"Service",
",",
"error",
")",
"{",
"labelSelector",
",",
"err",
":=",
"metav1",
".",
"ParseToLabelSelector",
"(",
"sc",
".",
"annotationFilter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"selector",
",",
"err",
":=",
"metav1",
".",
"LabelSelectorAsSelector",
"(",
"labelSelector",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// empty filter returns original list",
"if",
"selector",
".",
"Empty",
"(",
")",
"{",
"return",
"services",
",",
"nil",
"\n",
"}",
"\n\n",
"filteredList",
":=",
"[",
"]",
"*",
"v1",
".",
"Service",
"{",
"}",
"\n\n",
"for",
"_",
",",
"service",
":=",
"range",
"services",
"{",
"// convert the service's annotations to an equivalent label selector",
"annotations",
":=",
"labels",
".",
"Set",
"(",
"service",
".",
"Annotations",
")",
"\n\n",
"// include service if its annotations match the selector",
"if",
"selector",
".",
"Matches",
"(",
"annotations",
")",
"{",
"filteredList",
"=",
"<mask>",
"(",
"filteredList",
",",
"service",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"filteredList",
",",
"nil",
"\n",
"}"
]
|
17,636 | all-17637 | [
"GetComparatorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Comparator",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"GetComparatorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Comparator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Comparator",
",",
"<mask>",
"\n",
"}"
]
|
17,637 | all-17638 | [
"CreateCluster",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockECSSDK",
")",
"CreateCluster",
"(",
"arg0",
"*",
"ecs",
".",
"CreateClusterInput",
")",
"(",
"*",
"ecs",
".",
"CreateClusterOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"ecs",
".",
"CreateClusterOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
17,638 | all-17639 | [
"MarshalEasyJSON",
"writes",
"the",
"Email",
"to",
"a",
"easyjson",
".",
"Writer"
]
| [
"func",
"(",
"e",
"Email",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"e",
")",
")",
"\n",
"}"
]
|
17,639 | all-17640 | [
"Render",
"atomically",
"renders",
"a",
"file",
"contents",
"to",
"disk",
"returning",
"a",
"result",
"of",
"whether",
"it",
"would",
"have",
"rendered",
"and",
"actually",
"did",
"render",
"."
]
| [
"func",
"Render",
"(",
"i",
"*",
"RenderInput",
")",
"(",
"*",
"RenderResult",
",",
"error",
")",
"{",
"existing",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"i",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"bytes",
".",
"Equal",
"(",
"existing",
",",
"i",
".",
"Contents",
")",
"{",
"return",
"&",
"RenderResult",
"{",
"DidRender",
":",
"false",
",",
"WouldRender",
":",
"<mask>",
",",
"Contents",
":",
"existing",
",",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"Dry",
"{",
"fmt",
".",
"Fprintf",
"(",
"i",
".",
"DryStream",
",",
"\"",
"\\n",
"\"",
",",
"i",
".",
"Path",
",",
"i",
".",
"Contents",
")",
"\n",
"}",
"else",
"{",
"if",
"err",
":=",
"AtomicWrite",
"(",
"i",
".",
"Path",
",",
"i",
".",
"CreateDestDirs",
",",
"i",
".",
"Contents",
",",
"i",
".",
"Perms",
",",
"i",
".",
"Backup",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"RenderResult",
"{",
"DidRender",
":",
"true",
",",
"WouldRender",
":",
"true",
",",
"Contents",
":",
"i",
".",
"Contents",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,640 | all-17641 | [
"LabelProtosToMetric",
"unpack",
"a",
"[]",
"*",
"prompb",
".",
"Label",
"to",
"a",
"model",
".",
"Metric"
]
| [
"func",
"LabelProtosToMetric",
"(",
"labelPairs",
"[",
"]",
"*",
"prompb",
".",
"Label",
")",
"model",
".",
"Metric",
"{",
"metric",
":=",
"make",
"(",
"model",
".",
"Metric",
",",
"len",
"(",
"labelPairs",
")",
")",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"labelPairs",
"{",
"metric",
"[",
"model",
".",
"LabelName",
"(",
"l",
".",
"<mask>",
")",
"]",
"=",
"model",
".",
"LabelValue",
"(",
"l",
".",
"Value",
")",
"\n",
"}",
"\n",
"return",
"metric",
"\n",
"}"
]
|
17,641 | all-17642 | [
"anyMessageHandler",
"handles",
"any",
"server",
"message",
".",
"Any",
"server",
"message",
"means",
"the",
"connection",
"is",
"active"
]
| [
"func",
"anyMessageHandler",
"(",
"client",
"wsclient",
".",
"ClientServer",
")",
"func",
"(",
"<mask>",
"{",
"}",
")",
"{",
"return",
"func",
"(",
"interface",
"{",
"}",
")",
"{",
"seelog",
".",
"Trace",
"(",
"\"",
"\"",
")",
"\n",
"// Reset read deadline as there's activity on the channel",
"if",
"err",
":=",
"client",
".",
"SetReadDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"wsRWTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,642 | all-17643 | [
"Items",
"returns",
"a",
"slice",
"equal",
"to",
"the",
"size",
"of",
"the",
"list",
"with",
"the",
"current",
"visible",
"items",
"and",
"the",
"index",
"of",
"the",
"active",
"item",
"in",
"this",
"list",
"."
]
| [
"func",
"(",
"l",
"*",
"List",
")",
"Items",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"int",
")",
"{",
"var",
"result",
"[",
"]",
"interface",
"{",
"}",
"\n",
"max",
":=",
"len",
"(",
"l",
".",
"scope",
")",
"\n",
"end",
":=",
"l",
".",
"<mask>",
"+",
"l",
".",
"size",
"\n\n",
"if",
"end",
">",
"max",
"{",
"end",
"=",
"max",
"\n",
"}",
"\n\n",
"active",
":=",
"NotFound",
"\n\n",
"for",
"i",
",",
"j",
":=",
"l",
".",
"start",
",",
"0",
";",
"i",
"<",
"end",
";",
"i",
",",
"j",
"=",
"i",
"+",
"1",
",",
"j",
"+",
"1",
"{",
"if",
"l",
".",
"cursor",
"==",
"i",
"{",
"active",
"=",
"j",
"\n",
"}",
"\n\n",
"result",
"=",
"append",
"(",
"result",
",",
"*",
"l",
".",
"scope",
"[",
"i",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"active",
"\n",
"}"
]
|
17,643 | all-17644 | [
"CreatePangoContext",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_context_create_pango_context",
"()",
"."
]
| [
"func",
"(",
"pc",
"*",
"PrintContext",
")",
"CreatePangoContext",
"(",
")",
"*",
"pango",
".",
"Context",
"{",
"c",
":=",
"C",
".",
"gtk_print_context_create_pango_context",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"pango",
".",
"WrapContext",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
]
|
17,644 | all-17645 | [
"AlertTemplateData",
"returns",
"the",
"interface",
"to",
"be",
"used",
"in",
"expanding",
"the",
"template",
"."
]
| [
"func",
"AlertTemplateData",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"externalLabels",
"map",
"[",
"string",
"]",
"string",
",",
"value",
"float64",
")",
"<mask>",
"{",
"}",
"{",
"return",
"struct",
"{",
"Labels",
"map",
"[",
"string",
"]",
"string",
"\n",
"ExternalLabels",
"map",
"[",
"string",
"]",
"string",
"\n",
"Value",
"float64",
"\n",
"}",
"{",
"Labels",
":",
"labels",
",",
"ExternalLabels",
":",
"externalLabels",
",",
"Value",
":",
"value",
",",
"}",
"\n",
"}"
]
|
17,645 | all-17646 | [
"loadStandard",
"takes",
"paths",
"and",
"loads",
"them",
"into",
"the",
"dir",
"input",
"channel",
"for",
"processing"
]
| [
"func",
"(",
"w",
"*",
"workManager",
")",
"<mask>",
"(",
"paths",
"[",
"]",
"string",
")",
"{",
"dirs",
",",
"seqs",
":=",
"preparePaths",
"(",
"paths",
")",
"\n\n",
"for",
"_",
",",
"s",
":=",
"range",
"seqs",
"{",
"w",
".",
"inSeqs",
"<-",
"s",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"dirs",
"{",
"w",
".",
"inDirs",
"<-",
"r",
"\n",
"}",
"\n",
"}"
]
|
17,646 | all-17647 | [
"GetIntWithDefault",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_int_with_default",
"()",
"."
]
| [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetIntWithDefault",
"(",
"key",
"string",
",",
"def",
"int",
")",
"int",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_print_settings_get_int_with_default",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"def",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
]
|
17,647 | all-17648 | [
"resourceVSphereComputeClusterGetCluster",
"gets",
"the",
"ComputeClusterResource",
"from",
"the",
"ID",
"in",
"the",
"supplied",
"ResourceData",
"."
]
| [
"func",
"resourceVSphereComputeClusterGetCluster",
"(",
"d",
"structure",
".",
"ResourceIDStringer",
",",
"meta",
"interface",
"{",
"}",
",",
")",
"(",
"*",
"<mask>",
".",
"ClusterComputeResource",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"clustercomputeresource",
".",
"FromID",
"(",
"client",
",",
"d",
".",
"Id",
"(",
")",
")",
"\n",
"}"
]
|
17,648 | all-17649 | [
"draw",
"multiple",
"instances",
"of",
"a",
"range",
"of",
"elements",
"with",
"offset",
"applied",
"to",
"instanced",
"attributes"
]
| [
"func",
"DrawArraysInstancedBaseInstance",
"(",
"mode",
"uint32",
",",
"first",
"int32",
",",
"count",
"int32",
",",
"instancecount",
"int32",
",",
"baseinstance",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpDrawArraysInstancedBaseInstance",
",",
"5",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"first",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"instancecount",
")",
",",
"uintptr",
"(",
"baseinstance",
")",
",",
"0",
")",
"\n",
"}"
]
|
17,649 | all-17650 | [
"MustManageOfferResult",
"retrieves",
"the",
"ManageOfferResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustManageOfferResult",
"(",
")",
"ManageOfferResult",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetManageOfferResult",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
17,650 | all-17651 | [
"PaperSizeNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_new",
"()",
"."
]
| [
"func",
"PaperSizeNew",
"(",
"name",
"string",
")",
"(",
"*",
"PaperSize",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"var",
"gName",
"*",
"C",
".",
"gchar",
"\n\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"gName",
"=",
"nil",
"\n",
"}",
"else",
"{",
"gName",
"=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
"\n",
"}",
"\n\n",
"c",
":=",
"C",
".",
"gtk_paper_size_new",
"(",
"gName",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"t",
":=",
"&",
"PaperSize",
"{",
"c",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"t",
",",
"(",
"*",
"PaperSize",
")",
".",
"free",
")",
"\n",
"return",
"t",
",",
"nil",
"\n",
"}"
]
|
17,651 | all-17652 | [
"PageSetupLoadKeyFile",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_load_key_file",
"()",
".",
"PageSetupToFile",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_to_file",
"()",
"."
]
| [
"func",
"(",
"ps",
"*",
"PageSetup",
")",
"PageSetupToFile",
"(",
"name",
"string",
")",
"error",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"var",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"res",
":=",
"C",
".",
"gtk_page_setup_to_file",
"(",
"ps",
".",
"native",
"(",
")",
",",
"cstr",
",",
"&",
"err",
")",
"\n",
"if",
"!",
"gobool",
"(",
"res",
")",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,652 | all-17653 | [
"NewChildCursor",
"creates",
"a",
"new",
"child",
"cursor",
"."
]
| [
"func",
"NewChildCursor",
"(",
"<mask>",
"*",
"bolt",
".",
"Tx",
",",
"path",
"string",
")",
"*",
"ChildCursor",
"{",
"path",
"=",
"clean",
"(",
"path",
")",
"\n",
"c",
":=",
"fs",
"(",
"tx",
")",
".",
"Cursor",
"(",
")",
"\n",
"dir",
":=",
"b",
"(",
"path",
")",
"\n",
"k",
",",
"v",
":=",
"c",
".",
"Seek",
"(",
"append",
"(",
"dir",
",",
"nullByte",
"[",
"0",
"]",
")",
")",
"\n",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"dir",
",",
"nullByte",
")",
"{",
"dir",
"=",
"append",
"(",
"dir",
",",
"nullByte",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"!",
"bytes",
".",
"HasPrefix",
"(",
"k",
",",
"dir",
")",
"{",
"k",
",",
"v",
"=",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"ChildCursor",
"{",
"c",
":",
"c",
",",
"dir",
":",
"dir",
",",
"k",
":",
"k",
",",
"v",
":",
"v",
",",
"}",
"\n",
"}"
]
|
17,653 | all-17654 | [
"ReadWithoutAdvance",
"()",
":",
"if",
"you",
"want",
"to",
"Read",
"the",
"data",
"and",
"leave",
"it",
"in",
"the",
"buffer",
"so",
"as",
"to",
"peek",
"ahead",
"for",
"example",
"."
]
| [
"func",
"(",
"b",
"*",
"PointerRingBuf",
")",
"ReadWithoutAdvance",
"(",
"p",
"[",
"]",
"interface",
"{",
"}",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"b",
".",
"readAndMaybeAdvance",
"(",
"p",
",",
"<mask>",
")",
"\n",
"}"
]
|
17,654 | all-17655 | [
"Cleanup",
"removes",
"the",
"cgroup",
"root",
"created",
"for",
"the",
"task"
]
| [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"Cleanup",
"(",
")",
"error",
"{",
"err",
":=",
"cgroup",
".",
"control",
".",
"Remove",
"(",
"cgroup",
".",
"cgroupRoot",
")",
"\n",
"// Explicitly handle cgroup deleted error",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"cgroups",
".",
"ErrCgroupDeleted",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"cgroup",
".",
"cgroupRoot",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"cgroup",
".",
"cgroupRoot",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,655 | all-17656 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"CreateTargetReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget22",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
17,656 | all-17657 | [
"NewPortBindingsResponse",
"creates",
"PortResponse",
"for",
"a",
"container",
"."
]
| [
"func",
"NewPortBindingsResponse",
"(",
"dockerContainer",
"*",
"apicontainer",
".",
"DockerContainer",
",",
"eni",
"*",
"apieni",
".",
"ENI",
")",
"[",
"]",
"PortResponse",
"{",
"<mask>",
":=",
"dockerContainer",
".",
"Container",
"\n",
"resp",
":=",
"[",
"]",
"PortResponse",
"{",
"}",
"\n\n",
"bindings",
":=",
"container",
".",
"GetKnownPortBindings",
"(",
")",
"\n\n",
"// if KnownPortBindings list is empty, then we use the port mapping",
"// information that was passed down from ACS.",
"if",
"len",
"(",
"bindings",
")",
"==",
"0",
"{",
"bindings",
"=",
"container",
".",
"Ports",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"binding",
":=",
"range",
"bindings",
"{",
"port",
":=",
"PortResponse",
"{",
"ContainerPort",
":",
"binding",
".",
"ContainerPort",
",",
"Protocol",
":",
"binding",
".",
"Protocol",
".",
"String",
"(",
")",
",",
"}",
"\n\n",
"if",
"eni",
"==",
"nil",
"{",
"port",
".",
"HostPort",
"=",
"binding",
".",
"HostPort",
"\n",
"}",
"else",
"{",
"port",
".",
"HostPort",
"=",
"port",
".",
"ContainerPort",
"\n",
"}",
"\n\n",
"resp",
"=",
"append",
"(",
"resp",
",",
"port",
")",
"\n",
"}",
"\n",
"return",
"resp",
"\n",
"}"
]
|
17,657 | all-17658 | [
"DeleteService",
"deletes",
"service",
"record",
"from",
"etcd"
]
| [
"func",
"(",
"c",
"etcdClient",
")",
"DeleteService",
"(",
"key",
"string",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"c",
".",
"ctx",
",",
"etcdTimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"_",
",",
"err",
":=",
"c",
".",
"<mask>",
".",
"Delete",
"(",
"ctx",
",",
"key",
",",
"etcdcv3",
".",
"WithPrefix",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,658 | all-17659 | [
"machineCommand",
"maps",
"the",
"command",
"name",
"to",
"the",
"corresponding",
"machine",
"command",
".",
"We",
"run",
"commands",
"concurrently",
"and",
"communicate",
"back",
"an",
"error",
"if",
"there",
"was",
"one",
"."
]
| [
"func",
"machineCommand",
"(",
"actionName",
"string",
",",
"<mask>",
"*",
"host",
".",
"Host",
",",
"errorChan",
"chan",
"<-",
"error",
")",
"{",
"// TODO: These actions should have their own type.",
"commands",
":=",
"map",
"[",
"string",
"]",
"(",
"func",
"(",
")",
"error",
")",
"{",
"\"",
"\"",
":",
"host",
".",
"ConfigureAuth",
",",
"\"",
"\"",
":",
"host",
".",
"ConfigureAllAuth",
",",
"\"",
"\"",
":",
"host",
".",
"Start",
",",
"\"",
"\"",
":",
"host",
".",
"Stop",
",",
"\"",
"\"",
":",
"host",
".",
"Restart",
",",
"\"",
"\"",
":",
"host",
".",
"Kill",
",",
"\"",
"\"",
":",
"host",
".",
"Upgrade",
",",
"\"",
"\"",
":",
"printIP",
"(",
"host",
")",
",",
"\"",
"\"",
":",
"host",
".",
"Provision",
",",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"actionName",
",",
"host",
".",
"Name",
")",
"\n\n",
"errorChan",
"<-",
"commands",
"[",
"actionName",
"]",
"(",
")",
"\n",
"}"
]
|
17,659 | all-17660 | [
"String",
"returns",
"the",
"human",
"-",
"friendly",
"version",
"of",
"this",
"dependency",
"."
]
| [
"func",
"(",
"d",
"*",
"VaultWriteQuery",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"d",
".",
"path",
",",
"d",
".",
"dataHash",
")",
"\n",
"}"
]
|
17,660 | all-17661 | [
"Envs",
"returns",
"a",
"map",
"representing",
"the",
"apps",
"environment",
"variables",
"."
]
| [
"func",
"(",
"app",
"*",
"App",
")",
"Envs",
"(",
")",
"<mask>",
"[",
"string",
"]",
"bind",
".",
"EnvVar",
"{",
"mergedEnvs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bind",
".",
"EnvVar",
",",
"len",
"(",
"app",
".",
"Env",
")",
"+",
"len",
"(",
"app",
".",
"ServiceEnvs",
")",
"+",
"1",
")",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"app",
".",
"Env",
"{",
"mergedEnvs",
"[",
"e",
".",
"Name",
"]",
"=",
"e",
"\n",
"}",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"app",
".",
"ServiceEnvs",
"{",
"mergedEnvs",
"[",
"e",
".",
"Name",
"]",
"=",
"e",
".",
"EnvVar",
"\n",
"}",
"\n",
"mergedEnvs",
"[",
"TsuruServicesEnvVar",
"]",
"=",
"serviceEnvsFromEnvVars",
"(",
"app",
".",
"ServiceEnvs",
")",
"\n",
"return",
"mergedEnvs",
"\n",
"}"
]
|
17,661 | all-17662 | [
"SetActionName",
"is",
"a",
"wrapper",
"around",
"gtk_actionable_set_action_name",
"()",
".",
"Since",
"3",
".",
"4"
]
| [
"func",
"(",
"v",
"*",
"Actionable",
")",
"SetActionName",
"(",
"action_name",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"action_name",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_actionable_set_action_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
17,662 | all-17663 | [
"Error",
"writes",
"the",
"given",
"HTTP",
"status",
"to",
"the",
"current",
"ResponseWriter"
]
| [
"func",
"(",
"r",
"*",
"Render",
")",
"Error",
"(",
"status",
"int",
",",
"message",
"...",
"string",
")",
"{",
"r",
".",
"WriteHeader",
"(",
"status",
")",
"\n",
"if",
"len",
"(",
"<mask>",
")",
">",
"0",
"{",
"r",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"message",
"[",
"0",
"]",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,663 | all-17664 | [
"GetBlob",
"returns",
"a",
"stream",
"for",
"the",
"specified",
"blob",
"and",
"the",
"blob’s",
"size",
"(",
"or",
"-",
"1",
"if",
"unknown",
")",
".",
"The",
"Digest",
"field",
"in",
"BlobInfo",
"is",
"guaranteed",
"to",
"be",
"provided",
"Size",
"may",
"be",
"-",
"1",
"and",
"MediaType",
"may",
"be",
"optionally",
"provided",
".",
"May",
"update",
"BlobInfoCache",
"preferably",
"after",
"it",
"knows",
"for",
"certain",
"that",
"a",
"blob",
"truly",
"exists",
"at",
"a",
"specific",
"location",
"."
]
| [
"func",
"(",
"s",
"*",
"ostreeImageSource",
")",
"GetBlob",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
")",
"(",
"io",
".",
"ReadCloser",
",",
"int64",
",",
"error",
")",
"{",
"blob",
":=",
"info",
".",
"Digest",
".",
"Hex",
"(",
")",
"\n\n",
"// Ensure s.compressed is initialized. It is build by LayerInfosForCopy.",
"if",
"s",
".",
"compressed",
"==",
"nil",
"{",
"_",
",",
"err",
":=",
"s",
".",
"LayerInfosForCopy",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"-",
"1",
",",
"err",
"\n",
"}",
"\n\n",
"}",
"\n",
"compressedBlob",
",",
"found",
":=",
"s",
".",
"compressed",
"[",
"info",
".",
"Digest",
"]",
"\n",
"if",
"found",
"{",
"blob",
"=",
"compressedBlob",
".",
"Hex",
"(",
")",
"\n",
"}",
"\n",
"branch",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"blob",
")",
"\n\n",
"if",
"s",
".",
"repo",
"==",
"nil",
"{",
"repo",
",",
"err",
":=",
"openRepo",
"(",
"s",
".",
"ref",
".",
"repo",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"s",
".",
"repo",
"=",
"repo",
"\n",
"}",
"\n\n",
"layerSize",
",",
"err",
":=",
"s",
".",
"getLayerSize",
"(",
"blob",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"tarsplit",
",",
"err",
":=",
"s",
".",
"getTarSplitData",
"(",
"blob",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// if tarsplit is nil we are looking at the manifest. Return directly the file in /content",
"if",
"tarsplit",
"==",
"nil",
"{",
"file",
",",
"err",
":=",
"s",
".",
"readSingleFile",
"(",
"branch",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"file",
",",
"layerSize",
",",
"nil",
"\n",
"}",
"\n\n",
"mf",
":=",
"bytes",
".",
"NewReader",
"(",
"tarsplit",
")",
"\n",
"mfz",
",",
"err",
":=",
"pgzip",
".",
"NewReader",
"(",
"mf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"metaUnpacker",
":=",
"storage",
".",
"NewJSONUnpacker",
"(",
"mfz",
")",
"\n\n",
"getter",
",",
"err",
":=",
"newOSTreePathFileGetter",
"(",
"s",
".",
"repo",
",",
"branch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"mfz",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"ots",
":=",
"asm",
".",
"NewOutputTarStream",
"(",
"getter",
",",
"metaUnpacker",
")",
"\n\n",
"rc",
":=",
"ioutils",
".",
"NewReadCloserWrapper",
"(",
"ots",
",",
"func",
"(",
")",
"error",
"{",
"getter",
".",
"Close",
"(",
")",
"\n",
"mfz",
".",
"Close",
"(",
")",
"\n",
"return",
"ots",
".",
"Close",
"(",
")",
"\n",
"}",
")",
"\n",
"return",
"rc",
",",
"layerSize",
",",
"nil",
"\n",
"}"
]
|
17,664 | all-17665 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetMediaQueriesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss39",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
17,665 | all-17666 | [
"paginate",
"is",
"a",
"stub",
"but",
"very",
"possible",
"to",
"implement",
"middleware",
"logic",
"to",
"handle",
"the",
"request",
"params",
"for",
"handling",
"a",
"paginated",
"request",
"."
]
| [
"func",
"paginate",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"// just a stub.. some ideas are to look at URL query params for something like",
"// the page number, or the limit, and send a query cursor down the chain",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
17,666 | all-17667 | [
"columnFromTag",
"returns",
"the",
"column",
"name",
".",
"If",
"column",
"tag",
"specified",
"to",
"struct",
"field",
"returns",
"it",
".",
"Otherwise",
"it",
"returns",
"snake",
"-",
"cased",
"field",
"name",
"as",
"column",
"name",
"."
]
| [
"func",
"(",
"db",
"*",
"DB",
")",
"columnFromTag",
"(",
"field",
"reflect",
".",
"StructField",
")",
"string",
"{",
"col",
":=",
"<mask>",
".",
"Tag",
".",
"Get",
"(",
"dbColumnTag",
")",
"\n",
"if",
"col",
"==",
"\"",
"\"",
"{",
"return",
"stringutil",
".",
"ToSnakeCase",
"(",
"field",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"col",
"\n",
"}"
]
|
17,667 | all-17668 | [
"StartConsumer",
"creates",
"and",
"starts",
"consuming",
"from",
"NSQ",
"right",
"away",
".",
"This",
"is",
"the",
"fastest",
"way",
"to",
"get",
"up",
"and",
"running",
"."
]
| [
"func",
"StartConsumer",
"(",
"config",
"ConsumerConfig",
")",
"(",
"c",
"*",
"<mask>",
",",
"err",
"error",
")",
"{",
"c",
",",
"err",
"=",
"NewConsumer",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"c",
".",
"Start",
"(",
")",
"\n",
"return",
"\n",
"}"
]
|
17,668 | all-17669 | [
"GetDefaultClient",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockFactory",
")",
"GetDefaultClient",
"(",
")",
"(",
"sdkclient",
".",
"Client",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"sdkclient",
".",
"Client",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
17,669 | all-17670 | [
"GetInstanceIPAddresses",
"can",
"be",
"short",
"-",
"circuited",
"with",
"the",
"server",
"s",
"AccessIPv4Addr",
"on",
"Rackspace",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"GetInstanceIPAddresses",
"(",
"d",
"*",
"openstack",
".",
"Driver",
")",
"(",
"[",
"]",
"openstack",
".",
"IPAddress",
",",
"error",
")",
"{",
"server",
",",
"err",
":=",
"c",
".",
"GetServerDetail",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"[",
"]",
"openstack",
".",
"IPAddress",
"{",
"{",
"Network",
":",
"\"",
"\"",
",",
"<mask>",
":",
"server",
".",
"AccessIPv4",
",",
"AddressType",
":",
"openstack",
".",
"Fixed",
",",
"}",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,670 | all-17671 | [
"CreateApp",
"creates",
"a",
"new",
"app",
".",
"Creating",
"a",
"new",
"app",
"is",
"a",
"process",
"composed",
"of",
"the",
"following",
"steps",
":",
"1",
".",
"Save",
"the",
"app",
"in",
"the",
"database",
"2",
".",
"Create",
"the",
"git",
"repository",
"using",
"the",
"repository",
"manager",
"3",
".",
"Provision",
"the",
"app",
"using",
"the",
"provisioner"
]
| [
"func",
"CreateApp",
"(",
"app",
"*",
"App",
",",
"user",
"*",
"auth",
".",
"User",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"GetByName",
"(",
"app",
".",
"GetName",
"(",
")",
")",
";",
"err",
"!=",
"appTypes",
".",
"ErrAppNotFound",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"appTypes",
".",
"AppCreationError",
"{",
"Err",
":",
"ErrAppAlreadyExists",
",",
"App",
":",
"app",
".",
"GetName",
"(",
")",
"}",
"\n",
"}",
"\n",
"var",
"plan",
"*",
"appTypes",
".",
"Plan",
"\n",
"var",
"err",
"error",
"\n",
"if",
"app",
".",
"Plan",
".",
"Name",
"==",
"\"",
"\"",
"{",
"<mask>",
",",
"err",
"=",
"servicemanager",
".",
"Plan",
".",
"DefaultPlan",
"(",
")",
"\n",
"}",
"else",
"{",
"plan",
",",
"err",
"=",
"servicemanager",
".",
"Plan",
".",
"FindByName",
"(",
"app",
".",
"Plan",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"app",
".",
"Plan",
"=",
"*",
"plan",
"\n",
"err",
"=",
"app",
".",
"SetPool",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"app",
".",
"configureCreateRouters",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"app",
".",
"Teams",
"=",
"[",
"]",
"string",
"{",
"app",
".",
"TeamOwner",
"}",
"\n",
"app",
".",
"Owner",
"=",
"user",
".",
"Email",
"\n",
"app",
".",
"Tags",
"=",
"processTags",
"(",
"app",
".",
"Tags",
")",
"\n",
"if",
"app",
".",
"Platform",
"!=",
"\"",
"\"",
"{",
"app",
".",
"Platform",
",",
"app",
".",
"PlatformVersion",
",",
"err",
"=",
"getPlatformNameAndVersion",
"(",
"app",
".",
"Platform",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"err",
"=",
"app",
".",
"validateNew",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"actions",
":=",
"[",
"]",
"*",
"action",
".",
"Action",
"{",
"&",
"reserveUserApp",
",",
"&",
"insertApp",
",",
"&",
"createAppToken",
",",
"&",
"exportEnvironmentsAction",
",",
"&",
"createRepository",
",",
"&",
"provisionApp",
",",
"&",
"addRouterBackend",
",",
"}",
"\n",
"pipeline",
":=",
"action",
".",
"NewPipeline",
"(",
"actions",
"...",
")",
"\n",
"err",
"=",
"pipeline",
".",
"Execute",
"(",
"app",
",",
"user",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"appTypes",
".",
"AppCreationError",
"{",
"App",
":",
"app",
".",
"Name",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,671 | all-17672 | [
"ReadUintptr",
"returns",
"a",
"uint",
"of",
"pointer",
"size",
"read",
"from",
"address",
"a",
"of",
"the",
"inferior",
"."
]
| [
"func",
"(",
"p",
"*",
"Process",
")",
"ReadUintptr",
"(",
"a",
"<mask>",
")",
"uint64",
"{",
"if",
"p",
".",
"ptrSize",
"==",
"4",
"{",
"return",
"uint64",
"(",
"p",
".",
"ReadUint32",
"(",
"a",
")",
")",
"\n",
"}",
"\n",
"return",
"p",
".",
"ReadUint64",
"(",
"a",
")",
"\n",
"}"
]
|
17,672 | all-17673 | [
"DeployVApp",
"-",
"fake",
"out",
"calling",
"deploy",
"vapp"
]
| [
"func",
"(",
"s",
"*",
"FakeVCDClient",
")",
"DeployVApp",
"(",
"templateName",
",",
"templateHref",
",",
"vcdHref",
"<mask>",
")",
"(",
"vapp",
"*",
"vcloudclient",
".",
"VApp",
",",
"err",
"error",
")",
"{",
"return",
"s",
".",
"FakeVApp",
",",
"s",
".",
"ErrUnDeployFake",
"\n",
"}"
]
|
17,673 | all-17674 | [
"CompareAndSwap",
"writes",
"the",
"given",
"item",
"that",
"was",
"previously",
"returned",
"by",
"Get",
"if",
"the",
"value",
"was",
"neither",
"modified",
"or",
"evicted",
"between",
"the",
"Get",
"and",
"the",
"CompareAndSwap",
"calls",
".",
"The",
"item",
"s",
"Key",
"should",
"not",
"change",
"between",
"calls",
"but",
"all",
"other",
"item",
"fields",
"may",
"differ",
".",
"ErrCASConflict",
"is",
"returned",
"if",
"the",
"value",
"was",
"modified",
"in",
"between",
"the",
"calls",
".",
"ErrNotStored",
"is",
"returned",
"if",
"the",
"value",
"was",
"evicted",
"in",
"between",
"the",
"calls",
"."
]
| [
"func",
"(",
"cd",
"Codec",
")",
"CompareAndSwap",
"(",
"c",
"context",
".",
"Context",
",",
"item",
"*",
"Item",
")",
"error",
"{",
"return",
"singleError",
"(",
"cd",
".",
"set",
"(",
"c",
",",
"[",
"]",
"*",
"Item",
"{",
"<mask>",
"}",
",",
"pb",
".",
"MemcacheSetRequest_CAS",
")",
")",
"\n",
"}"
]
|
17,674 | all-17675 | [
"NewTLSServer",
"sets",
"up",
"a",
"Pantheon",
"(",
"TM",
")",
"type",
"of",
"tls",
"server",
"that",
"Requires",
"and",
"Verifies",
"peer",
"cert"
]
| [
"func",
"NewTLSServer",
"(",
"config",
"TLSServerConfig",
")",
"*",
"http",
".",
"Server",
"{",
"// Setup our TLS config",
"tlsConfig",
":=",
"NewTLSConfig",
"(",
"config",
".",
"TLSConfigLevel",
")",
"\n\n",
"// By default this server will require client MTLS certs and verify cert validity against the config.CertPool CA bundle",
"tlsConfig",
".",
"ClientAuth",
"=",
"tls",
".",
"RequireAndVerifyClientCert",
"\n",
"tlsConfig",
".",
"ClientCAs",
"=",
"config",
".",
"CertPool",
"\n\n",
"// Setup client authentication",
"server",
":=",
"&",
"http",
".",
"Server",
"{",
"ReadTimeout",
":",
"5",
"*",
"<mask>",
".",
"Second",
",",
"WriteTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"TLSConfig",
":",
"tlsConfig",
",",
"Addr",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"config",
".",
"BindAddress",
",",
"config",
".",
"Port",
")",
",",
"Handler",
":",
"config",
".",
"Router",
",",
"}",
"\n",
"server",
".",
"TLSConfig",
".",
"BuildNameToCertificate",
"(",
")",
"\n",
"return",
"server",
"\n",
"}"
]
|
17,675 | all-17676 | [
"Fetch",
"retrieves",
"this",
"dependency",
"and",
"returns",
"the",
"result",
"or",
"any",
"errors",
"that",
"occur",
"in",
"the",
"process",
"."
]
| [
"func",
"(",
"d",
"*",
"VaultAgentTokenQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"d",
".",
"path",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"return",
"\"",
"\"",
",",
"nil",
",",
"ErrStopped",
"\n",
"case",
"r",
":=",
"<-",
"d",
".",
"watch",
"(",
"d",
".",
"stat",
")",
":",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"r",
".",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"token",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"d",
".",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"d",
".",
"stat",
"=",
"r",
".",
"stat",
"\n",
"clients",
".",
"Vault",
"(",
")",
".",
"SetToken",
"(",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"token",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"respWithMetadata",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,676 | all-17677 | [
"GetScreenboard",
"returns",
"a",
"single",
"screenboard",
"created",
"on",
"this",
"account",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"GetScreenboard",
"(",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"*",
"Screenboard",
",",
"error",
")",
"{",
"stringId",
",",
"err",
":=",
"GetStringId",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"out",
":=",
"&",
"Screenboard",
"{",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"stringId",
")",
",",
"nil",
",",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
",",
"nil",
"\n",
"}"
]
|
17,677 | all-17678 | [
"Records",
"a",
"call",
"s",
"start",
"and",
"returns",
"a",
"function",
"to",
"be",
"deferred",
".",
"Wrapper",
"functions",
"will",
"use",
"this",
"function",
"for",
"GenericMetricsClients",
".",
"If",
"Metrics",
"collection",
"is",
"enabled",
"from",
"the",
"cfg",
"we",
"record",
"a",
"metric",
"with",
"callID",
"as",
"an",
"empty",
"string",
"(",
"signaling",
"a",
"call",
"start",
")",
"and",
"then",
"return",
"a",
"function",
"to",
"record",
"a",
"second",
"metric",
"with",
"a",
"non",
"-",
"empty",
"callID",
".",
"We",
"use",
"a",
"channel",
"holding",
"1",
"bool",
"to",
"ensure",
"that",
"the",
"FireCallEnd",
"is",
"called",
"AFTER",
"the",
"FireCallStart",
"(",
"because",
"these",
"are",
"done",
"in",
"separate",
"go",
"routines",
")",
"Recording",
"a",
"metric",
"in",
"an",
"API",
"needs",
"only",
"a",
"wrapper",
"function",
"that",
"supplies",
"the",
"APIType",
"and",
"called",
"using",
"the",
"following",
"format",
":",
"defer",
"metrics",
".",
"MetricsEngineGlobal",
".",
"RecordMetricWrapper",
"(",
"callName",
")",
"()"
]
| [
"func",
"(",
"engine",
"*",
"MetricsEngine",
")",
"recordGenericMetric",
"(",
"apiType",
"APIType",
",",
"callName",
"string",
")",
"func",
"(",
")",
"{",
"callStarted",
":=",
"make",
"(",
"chan",
"bool",
",",
"1",
")",
"\n",
"if",
"<mask>",
"==",
"nil",
"||",
"!",
"engine",
".",
"collection",
"{",
"return",
"func",
"(",
")",
"{",
"}",
"\n",
"}",
"\n",
"callID",
":=",
"engine",
".",
"recordMetric",
"(",
"apiType",
",",
"callName",
",",
"\"",
"\"",
",",
"callStarted",
")",
"\n",
"return",
"func",
"(",
")",
"{",
"engine",
".",
"recordMetric",
"(",
"apiType",
",",
"callName",
",",
"callID",
",",
"callStarted",
")",
"\n",
"}",
"\n",
"}"
]
|
17,678 | all-17679 | [
"/",
"*",
"get",
"native",
"window",
"handle",
"(",
"HWND",
"in",
"case",
"of",
"Win32",
"and",
"Widget",
"in",
"case",
"of",
"X",
"Window",
")"
]
| [
"func",
"(",
"win",
"*",
"Window",
")",
"GetHandle",
"(",
")",
"unsafe",
".",
"Pointer",
"{",
"p",
":=",
"C",
".",
"cvGetWindowHandle",
"(",
"win",
".",
"name_c",
")",
"\n",
"<mask>",
"unsafe",
".",
"Pointer",
"(",
"p",
")",
"\n",
"}"
]
|
17,679 | all-17680 | [
"HasLegendSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"HasLegendSize",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"LegendSize",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,680 | all-17681 | [
"Parse",
"data",
"type",
"in",
"context"
]
| [
"func",
"(",
"p",
"*",
"ParamAnalyzer",
")",
"parseDataType",
"(",
"path",
"string",
",",
"child",
"*",
"gen",
".",
"ActionParam",
")",
"gen",
".",
"DataType",
"{",
"param",
":=",
"p",
".",
"rawParams",
"[",
"path",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"class",
":=",
"\"",
"\"",
"\n",
"if",
"c",
",",
"ok",
":=",
"param",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"class",
"=",
"c",
"\n",
"}",
"\n",
"var",
"res",
"gen",
".",
"DataType",
"\n",
"switch",
"class",
"{",
"case",
"\"",
"\"",
":",
"i",
":=",
"gen",
".",
"BasicDataType",
"(",
"\"",
"\"",
")",
"\n",
"res",
"=",
"&",
"i",
"\n",
"case",
"\"",
"\"",
":",
"s",
":=",
"gen",
".",
"BasicDataType",
"(",
"\"",
"\"",
")",
"\n",
"res",
"=",
"&",
"s",
"\n",
"case",
"\"",
"\"",
":",
"if",
"child",
"!=",
"nil",
"{",
"res",
"=",
"&",
"gen",
".",
"ArrayDataType",
"{",
"child",
"}",
"\n",
"}",
"else",
"{",
"s",
":=",
"gen",
".",
"BasicDataType",
"(",
"\"",
"\"",
")",
"\n",
"p",
":=",
"p",
".",
"newParam",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
")",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"&",
"s",
")",
"\n",
"res",
"=",
"&",
"gen",
".",
"ArrayDataType",
"{",
"p",
"}",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"res",
"=",
"new",
"(",
"gen",
".",
"SourceUploadDataType",
")",
"\n",
"<mask>",
"\"",
"\"",
",",
"\"",
"\"",
":",
"res",
"=",
"&",
"gen",
".",
"UploadDataType",
"{",
"TypeName",
":",
"\"",
"\"",
"}",
"\n",
"case",
"\"",
"\"",
":",
"res",
"=",
"new",
"(",
"gen",
".",
"EnumerableDataType",
")",
"\n",
"case",
"\"",
"\"",
":",
"if",
"current",
",",
"ok",
":=",
"p",
".",
"parsed",
"[",
"path",
"]",
";",
"ok",
"{",
"res",
"=",
"current",
".",
"Type",
"\n",
"o",
":=",
"res",
".",
"(",
"*",
"gen",
".",
"ObjectDataType",
")",
"\n",
"o",
".",
"Fields",
"=",
"appendSorted",
"(",
"o",
".",
"Fields",
",",
"child",
")",
"\n",
"}",
"else",
"{",
"oname",
":=",
"p",
".",
"typeName",
"(",
"path",
")",
"\n",
"res",
"=",
"&",
"gen",
".",
"ObjectDataType",
"{",
"oname",
",",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"child",
"}",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
17,681 | all-17682 | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"an",
"array",
"and",
"a",
"scalar",
".",
"dst",
"=",
"src",
"-",
"value"
]
| [
"func",
"SubScalar",
"(",
"src",
"*",
"IplImage",
",",
"<mask>",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"SubScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
]
|
17,682 | all-17683 | [
"RemoveHandler",
"removes",
"a",
"function",
"to",
"be",
"called",
"whenever",
"an",
"event",
"is",
"received"
]
| [
"func",
"(",
"e",
"*",
"EventListener",
")",
"RemoveHandler",
"(",
"target",
"*",
"EventTarget",
")",
"error",
"{",
"if",
"target",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Handle locking",
"e",
".",
"targetsLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"targetsLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Locate and remove the function from the list",
"for",
"i",
",",
"entry",
":=",
"<mask>",
"e",
".",
"targets",
"{",
"if",
"entry",
"==",
"target",
"{",
"copy",
"(",
"e",
".",
"targets",
"[",
"i",
":",
"]",
",",
"e",
".",
"targets",
"[",
"i",
"+",
"1",
":",
"]",
")",
"\n",
"e",
".",
"targets",
"[",
"len",
"(",
"e",
".",
"targets",
")",
"-",
"1",
"]",
"=",
"nil",
"\n",
"e",
".",
"targets",
"=",
"e",
".",
"targets",
"[",
":",
"len",
"(",
"e",
".",
"targets",
")",
"-",
"1",
"]",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,683 | all-17684 | [
"SetColumnAttrs",
"creates",
"a",
"SetColumnAttrs",
"query",
".",
"SetColumnAttrs",
"associates",
"arbitrary",
"key",
"/",
"value",
"pairs",
"with",
"a",
"column",
"in",
"an",
"index",
".",
"Following",
"types",
"are",
"accepted",
":",
"integer",
"float",
"string",
"and",
"boolean",
"types",
"."
]
| [
"func",
"(",
"idx",
"*",
"Index",
")",
"SetColumnAttrs",
"(",
"colIDOrKey",
"interface",
"{",
"}",
",",
"attrs",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"PQLBaseQuery",
"{",
"colStr",
",",
"err",
":=",
"formatIDKey",
"(",
"colIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"err",
")",
"\n",
"}",
"\n",
"attrsString",
",",
"err",
":=",
"createAttributesString",
"(",
"attrs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"err",
")",
"\n",
"}",
"\n",
"q",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"colStr",
",",
"attrsString",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"q",
",",
"idx",
",",
"nil",
")",
"\n",
"}"
]
|
17,684 | all-17685 | [
"Find",
"the",
"path",
"to",
"package",
"main",
"by",
"looking",
"at",
"the",
"root",
"Caller",
"."
]
| [
"func",
"findMainPath",
"(",
")",
"string",
"{",
"pc",
":=",
"make",
"(",
"[",
"]",
"uintptr",
",",
"100",
")",
"\n",
"n",
":=",
"runtime",
".",
"Callers",
"(",
"2",
",",
"pc",
")",
"\n",
"frames",
":=",
"runtime",
".",
"CallersFrames",
"(",
"pc",
"[",
":",
"n",
"]",
")",
"\n",
"for",
"{",
"frame",
",",
"more",
":=",
"frames",
".",
"Next",
"(",
")",
"\n",
"// Tests won't have package main, instead they have testing.tRunner",
"if",
"frame",
".",
"Function",
"==",
"\"",
"\"",
"||",
"<mask>",
".",
"Function",
"==",
"\"",
"\"",
"{",
"return",
"frame",
".",
"File",
"\n",
"}",
"\n",
"if",
"!",
"more",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
17,685 | all-17686 | [
"Size",
"returns",
"the",
"file",
"size",
"in",
"bytes",
"."
]
| [
"func",
"(",
"file",
"*",
"GridFile",
")",
"Size",
"(",
")",
"(",
"bytes",
"int64",
")",
"{",
"file",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"bytes",
"=",
"file",
".",
"doc",
".",
"Length",
"\n",
"<mask>",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
]
|
17,686 | all-17687 | [
"Status",
"is",
"a",
"wrapper",
"around",
"cairo_surface_status",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Surface",
")",
"<mask>",
"(",
")",
"Status",
"{",
"c",
":=",
"C",
".",
"cairo_surface_status",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"Status",
"(",
"c",
")",
"\n",
"}"
]
|
17,687 | all-17688 | [
"EncodeValue",
"encodes",
"one",
"bind",
"variable",
"value",
"into",
"the",
"query",
"."
]
| [
"func",
"EncodeValue",
"(",
"buf",
"*",
"bytes",
".",
"Buffer",
",",
"value",
"*",
"querypb",
".",
"BindVariable",
")",
"{",
"if",
"value",
".",
"Type",
"!=",
"querypb",
".",
"Type_TUPLE",
"{",
"// Since we already check for TUPLE, we don't expect an error.",
"v",
",",
"_",
":=",
"sqltypes",
".",
"BindVariableToValue",
"(",
"value",
")",
"\n",
"v",
".",
"EncodeSQL",
"(",
"buf",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// It's a TUPLE.",
"buf",
".",
"WriteByte",
"(",
"'('",
")",
"\n",
"for",
"i",
",",
"bv",
":=",
"range",
"<mask>",
".",
"Values",
"{",
"if",
"i",
"!=",
"0",
"{",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"sqltypes",
".",
"ProtoToValue",
"(",
"bv",
")",
".",
"EncodeSQL",
"(",
"buf",
")",
"\n",
"}",
"\n",
"buf",
".",
"WriteByte",
"(",
"')'",
")",
"\n",
"}"
]
|
17,688 | all-17689 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
]
| [
"func",
"UniformMatrix3x2fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowUniformMatrix3x2fv",
"(",
"gpUniformMatrix3x2fv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"transpose",
")",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
]
|
17,689 | all-17690 | [
"MustCreatePassiveOfferResult",
"retrieves",
"the",
"CreatePassiveOfferResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustCreatePassiveOfferResult",
"(",
")",
"ManageOfferResult",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetCreatePassiveOfferResult",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
17,690 | all-17691 | [
"SetStopSequenceNumber",
"sets",
"the",
"stop",
"seqence",
"number",
"of",
"a",
"task"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"SetStopSequenceNumber",
"(",
"seqnum",
"int64",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"task",
".",
"StopSequenceNumber",
"=",
"seqnum",
"\n",
"}"
]
|
17,691 | all-17692 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"delete",
"Vm",
"params"
]
| [
"func",
"(",
"o",
"*",
"DeleteVMParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"*",
"DeleteVMParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
]
|
17,692 | all-17693 | [
"ServeHTTP",
"serves",
"an",
"HTTP",
"response",
"for",
"a",
"request",
"."
]
| [
"func",
"(",
"h",
"AuthHandler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"valid",
",",
"entity",
",",
"err",
":=",
"h",
".",
"authenticate",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"h",
".",
"error",
"(",
"w",
",",
"r",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"h",
".",
"PostAuthFunc",
"!=",
"nil",
"{",
"rr",
",",
"err",
":=",
"h",
".",
"PostAuthFunc",
"(",
"w",
",",
"r",
",",
"valid",
",",
"entity",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"h",
".",
"error",
"(",
"w",
",",
"r",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"rr",
"!=",
"nil",
"{",
"r",
"=",
"rr",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"valid",
"{",
"h",
".",
"unauthorized",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"h",
".",
"Handler",
"!=",
"nil",
"{",
"h",
".",
"<mask>",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
]
|
17,693 | all-17694 | [
"VersionCmd",
"represents",
"the",
"version",
"command"
]
| [
"func",
"VersionCmd",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"return",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Use this command to check the version of Kubicorn.\n\t\n\tThis command will return the version of the Kubicorn binary.`",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"<mask>",
".",
"GetVersionJSON",
"(",
")",
")",
"\n",
"}",
",",
"}",
"\n",
"}"
]
|
17,694 | all-17695 | [
"merge",
"applies",
"the",
"properties",
"of",
"the",
"passed",
"-",
"in",
"User",
"to",
"the",
"User",
"on",
"which",
"it",
"is",
"called",
"and",
"returns",
"a",
"new",
"User",
"with",
"these",
"modifications",
"applied",
".",
"Think",
"of",
"all",
"Users",
"as",
"immutable",
"sets",
"of",
"data",
".",
"Merge",
"allows",
"you",
"to",
"perform",
"the",
"set",
"operations",
"(",
"desired",
"grants",
"and",
"revokes",
")",
"atomically"
]
| [
"func",
"(",
"ou",
"User",
")",
"merge",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"nu",
"User",
",",
"s",
"PasswordStore",
")",
"(",
"User",
",",
"error",
")",
"{",
"var",
"out",
"User",
"\n",
"if",
"ou",
".",
"User",
"!=",
"nu",
".",
"User",
"{",
"return",
"out",
",",
"authErr",
"(",
"http",
".",
"StatusConflict",
",",
"\"",
"\"",
",",
"ou",
".",
"User",
",",
"nu",
".",
"User",
")",
"\n",
"}",
"\n",
"out",
".",
"User",
"=",
"ou",
".",
"User",
"\n",
"if",
"nu",
".",
"Password",
"!=",
"\"",
"\"",
"{",
"hash",
",",
"err",
":=",
"s",
".",
"HashPassword",
"(",
"nu",
".",
"Password",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"ou",
",",
"err",
"\n",
"}",
"\n",
"out",
".",
"Password",
"=",
"hash",
"\n",
"}",
"else",
"{",
"out",
".",
"Password",
"=",
"ou",
".",
"Password",
"\n",
"}",
"\n",
"currentRoles",
":=",
"types",
".",
"NewUnsafeSet",
"(",
"ou",
".",
"Roles",
"...",
")",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"nu",
".",
"Grant",
"{",
"if",
"currentRoles",
".",
"Contains",
"(",
"g",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"nu",
".",
"User",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"g",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"g",
",",
"nu",
".",
"User",
")",
"\n",
"}",
"\n",
"return",
"User",
"{",
"}",
",",
"authErr",
"(",
"http",
".",
"StatusConflict",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"g",
",",
"nu",
".",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"currentRoles",
".",
"Add",
"(",
"g",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"nu",
".",
"Revoke",
"{",
"if",
"!",
"currentRoles",
".",
"Contains",
"(",
"r",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"nu",
".",
"User",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"r",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"r",
",",
"nu",
".",
"User",
")",
"\n",
"}",
"\n",
"return",
"User",
"{",
"}",
",",
"authErr",
"(",
"http",
".",
"StatusConflict",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
",",
"nu",
".",
"User",
")",
")",
"\n",
"}",
"\n",
"currentRoles",
".",
"Remove",
"(",
"r",
")",
"\n",
"}",
"\n",
"out",
".",
"Roles",
"=",
"currentRoles",
".",
"Values",
"(",
")",
"\n",
"sort",
".",
"Strings",
"(",
"out",
".",
"Roles",
")",
"\n",
"return",
"out",
",",
"nil",
"\n",
"}"
]
|
17,695 | all-17696 | [
"compileApplicableBlockades",
"filters",
"the",
"specified",
"blockades",
"and",
"compiles",
"those",
"that",
"apply",
"to",
"the",
"repo",
"."
]
| [
"func",
"compileApplicableBlockades",
"(",
"org",
",",
"repo",
"string",
",",
"<mask>",
"*",
"logrus",
".",
"Entry",
",",
"blockades",
"[",
"]",
"plugins",
".",
"Blockade",
")",
"[",
"]",
"blockade",
"{",
"if",
"len",
"(",
"blockades",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"orgRepo",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"var",
"compiled",
"[",
"]",
"blockade",
"\n",
"for",
"_",
",",
"raw",
":=",
"range",
"blockades",
"{",
"// Only consider blockades that apply to this repo.",
"if",
"!",
"stringInSlice",
"(",
"org",
",",
"raw",
".",
"Repos",
")",
"&&",
"!",
"stringInSlice",
"(",
"orgRepo",
",",
"raw",
".",
"Repos",
")",
"{",
"continue",
"\n",
"}",
"\n",
"b",
":=",
"blockade",
"{",
"}",
"\n",
"for",
"_",
",",
"str",
":=",
"range",
"raw",
".",
"BlockRegexps",
"{",
"if",
"reg",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"str",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"str",
")",
"\n",
"}",
"else",
"{",
"b",
".",
"blockRegexps",
"=",
"append",
"(",
"b",
".",
"blockRegexps",
",",
"reg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"b",
".",
"blockRegexps",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"raw",
".",
"Explanation",
"==",
"\"",
"\"",
"{",
"b",
".",
"explanation",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"b",
".",
"explanation",
"=",
"raw",
".",
"Explanation",
"\n",
"}",
"\n",
"for",
"_",
",",
"str",
":=",
"range",
"raw",
".",
"ExceptionRegexps",
"{",
"if",
"reg",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"str",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"str",
")",
"\n",
"}",
"else",
"{",
"b",
".",
"exceptionRegexps",
"=",
"append",
"(",
"b",
".",
"exceptionRegexps",
",",
"reg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"compiled",
"=",
"append",
"(",
"compiled",
",",
"b",
")",
"\n",
"}",
"\n",
"return",
"compiled",
"\n",
"}"
]
|
17,696 | all-17697 | [
"RunOnce",
"runs",
"a",
"single",
"iteration",
"of",
"a",
"reconciliation",
"loop",
"."
]
| [
"func",
"(",
"c",
"*",
"Controller",
")",
"RunOnce",
"(",
")",
"error",
"{",
"records",
",",
"err",
":=",
"c",
".",
"Registry",
".",
"Records",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"registryErrors",
".",
"Inc",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"registryEndpointsTotal",
".",
"Set",
"(",
"float64",
"(",
"len",
"(",
"records",
")",
")",
")",
"\n\n",
"endpoints",
",",
"err",
":=",
"c",
".",
"Source",
".",
"Endpoints",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"sourceErrors",
".",
"Inc",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"sourceEndpointsTotal",
".",
"<mask>",
"(",
"float64",
"(",
"len",
"(",
"endpoints",
")",
")",
")",
"\n\n",
"plan",
":=",
"&",
"plan",
".",
"Plan",
"{",
"Policies",
":",
"[",
"]",
"plan",
".",
"Policy",
"{",
"c",
".",
"Policy",
"}",
",",
"Current",
":",
"records",
",",
"Desired",
":",
"endpoints",
",",
"}",
"\n\n",
"plan",
"=",
"plan",
".",
"Calculate",
"(",
")",
"\n\n",
"err",
"=",
"c",
".",
"Registry",
".",
"ApplyChanges",
"(",
"plan",
".",
"Changes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"registryErrors",
".",
"Inc",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,697 | all-17698 | [
"Close",
"closes",
"the",
"open",
"table",
".",
"(",
"Releases",
"resources",
"back",
"to",
"the",
"OS",
".",
")"
]
| [
"func",
"(",
"t",
"*",
"<mask>",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"t",
".",
"loadingMode",
"==",
"options",
".",
"MemoryMap",
"{",
"y",
".",
"Munmap",
"(",
"t",
".",
"mmap",
")",
"\n",
"}",
"\n\n",
"return",
"t",
".",
"fd",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
17,698 | all-17699 | [
"POST",
"/",
"api",
"/",
"catalog",
"/",
"catalogs",
"/",
":",
"catalog_id",
"/",
"applications",
"/",
":",
"id",
"/",
"actions",
"/",
"launch",
"Launches",
"an",
"Application",
"by",
"creating",
"an",
"Execution",
"with",
"ScheduledActions",
"as",
"needed",
"to",
"match",
"the",
"optional",
"Schedule",
"provided",
"."
]
| [
"func",
"(",
"loc",
"*",
"ApplicationLocator",
")",
"Launch",
"(",
"options",
"rsapi",
".",
"APIParams",
")",
"error",
"{",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"deferLaunchOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"deferLaunchOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"deferLaunchOpt",
"\n",
"}",
"\n",
"var",
"descriptionOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"descriptionOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"descriptionOpt",
"\n",
"}",
"\n",
"var",
"endDateOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"endDateOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"endDateOpt",
"\n",
"}",
"\n",
"<mask>",
"nameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"nameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"nameOpt",
"\n",
"}",
"\n",
"var",
"options_Opt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"options_Opt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"options_Opt",
"\n",
"}",
"\n",
"var",
"scheduleNameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"scheduleNameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"scheduleNameOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"respBody",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"sr",
":=",
"string",
"(",
"respBody",
")",
"\n",
"if",
"sr",
"!=",
"\"",
"\"",
"{",
"sr",
"=",
"\"",
"\"",
"+",
"sr",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,699 | all-17700 | [
"postEOFCheck",
"returns",
"false",
"if",
"there",
"is",
"more",
"data",
"in",
"a",
"LimitedReader",
"after",
"hitting",
"EOF"
]
| [
"func",
"postEOFCheck",
"(",
"c",
"*",
"Cmp",
",",
"r",
"io",
".",
"Reader",
",",
"buf",
"[",
"]",
"byte",
")",
"bool",
"{",
"tmpLR",
",",
"isLR",
":=",
"r",
".",
"(",
"*",
"io",
".",
"LimitedReader",
")",
"\n",
"if",
"isLR",
"{",
"// If the limit wasn't reached, then we don't need to check for",
"// more data after the EOF",
"if",
"tmpLR",
".",
"N",
">",
"0",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"// Use the internal Reader for checking for more data",
"r",
"=",
"tmpLR",
".",
"R",
"\n",
"}",
"else",
"{",
"c",
".",
"debugf",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n\n",
"// Attempt to read more bytes from the original readers, to determine",
"// if we should return an error for exceeding the MaxSize read limit.",
"n",
",",
"_",
":=",
"readPartial",
"(",
"c",
",",
"r",
",",
"buf",
",",
"0",
",",
"len",
"(",
"buf",
")",
")",
"\n",
"return",
"n",
"==",
"0",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.