id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
12,800 | all-12801 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventConsoleProfileFinished",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler23",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
12,801 | all-12802 | [
"VerifyHeaderKV",
"returns",
"a",
"handler",
"that",
"verifies",
"the",
"request",
"contains",
"a",
"header",
"matching",
"the",
"passed",
"in",
"key",
"and",
"values",
"(",
"recall",
"that",
"a",
"http",
".",
"Header",
"is",
"a",
"mapping",
"from",
"string",
"(",
"key",
")",
"to",
"[]",
"string",
"(",
"values",
"))",
"It",
"is",
"a",
"convenience",
"wrapper",
"around",
"VerifyHeader",
"that",
"allows",
"you",
"to",
"avoid",
"having",
"to",
"create",
"an",
"http",
".",
"Header",
"object",
"."
] | [
"func",
"VerifyHeaderKV",
"(",
"key",
"string",
",",
"values",
"...",
"string",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"VerifyHeader",
"(",
"http",
".",
"<mask>",
"{",
"key",
":",
"values",
"}",
")",
"\n",
"}"
] |
12,802 | all-12803 | [
"bind",
"one",
"or",
"more",
"named",
"texture",
"images",
"to",
"a",
"sequence",
"of",
"consecutive",
"image",
"units"
] | [
"func",
"BindImageTextures",
"(",
"first",
"uint32",
",",
"<mask>",
"int32",
",",
"textures",
"*",
"uint32",
")",
"{",
"C",
".",
"glowBindImageTextures",
"(",
"gpBindImageTextures",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"first",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"textures",
")",
")",
")",
"\n",
"}"
] |
12,803 | all-12804 | [
"Chain",
"combins",
"a",
"slide",
"of",
"HandlerFunc",
"(",
"s",
")",
"in",
"to",
"one",
"request",
"."
] | [
"func",
"Chain",
"(",
"h",
"...",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"f",
":=",
"func",
"(",
"ctx",
"*",
"<mask>",
")",
"error",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"h",
"{",
"if",
"err",
":=",
"v",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"f",
"\n",
"}"
] |
12,804 | all-12805 | [
"makeStaleIfDependingOn",
"makes",
"the",
"image",
"stale",
"if",
"the",
"image",
"depends",
"on",
"target",
"."
] | [
"func",
"(",
"i",
"*",
"<mask>",
")",
"makeStaleIfDependingOn",
"(",
"target",
"*",
"Image",
")",
"{",
"if",
"i",
".",
"stale",
"{",
"return",
"\n",
"}",
"\n",
"if",
"i",
".",
"dependsOn",
"(",
"target",
")",
"{",
"i",
".",
"makeStale",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
12,805 | all-12806 | [
"NewPQLRowsQuery",
"creates",
"a",
"new",
"PQLRowsQuery",
"."
] | [
"func",
"NewPQLRowsQuery",
"(",
"pql",
"string",
",",
"index",
"*",
"<mask>",
",",
"err",
"error",
")",
"*",
"PQLRowsQuery",
"{",
"return",
"&",
"PQLRowsQuery",
"{",
"index",
":",
"index",
",",
"pql",
":",
"pql",
",",
"err",
":",
"err",
",",
"}",
"\n",
"}"
] |
12,806 | all-12807 | [
"WithInsertBeforeNodeID",
"drop",
"the",
"copy",
"before",
"this",
"node",
"(",
"if",
"absent",
"the",
"copy",
"becomes",
"the",
"last",
"child",
"of",
"targetNodeId",
")",
"."
] | [
"func",
"(",
"p",
"CopyToParams",
")",
"WithInsertBeforeNodeID",
"(",
"insertBeforeNodeID",
"cdp",
".",
"NodeID",
")",
"*",
"CopyToParams",
"{",
"p",
".",
"InsertBeforeNodeID",
"=",
"insertBeforeNodeID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
12,807 | all-12808 | [
"gtk_action_bar_get_center_widget",
"(",
"GtkActionBar",
"*",
"action_bar",
")"
] | [
"func",
"(",
"a",
"*",
"ActionBar",
")",
"GetCenterWidget",
"(",
")",
"*",
"Widget",
"{",
"w",
":=",
"C",
".",
"gtk_action_bar_get_center_widget",
"(",
"a",
".",
"native",
"(",
")",
")",
"\n",
"if",
"w",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
"&",
"Widget",
"{",
"glib",
".",
"InitiallyUnowned",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"w",
")",
")",
"}",
"}",
"\n",
"}"
] |
12,808 | all-12809 | [
"EncodeTo",
"should",
"be",
"kept",
"in",
"sync",
"with",
"the",
"Encode",
"function",
"above",
".",
"The",
"reason",
"this",
"function",
"exists",
"is",
"to",
"avoid",
"creating",
"byte",
"arrays",
"per",
"key",
"-",
"value",
"pair",
"in",
"table",
"/",
"builder",
".",
"go",
"."
] | [
"func",
"(",
"v",
"*",
"ValueStruct",
")",
"EncodeTo",
"(",
"buf",
"*",
"bytes",
".",
"Buffer",
")",
"{",
"buf",
".",
"WriteByte",
"(",
"v",
".",
"Meta",
")",
"\n",
"buf",
".",
"WriteByte",
"(",
"v",
".",
"UserMeta",
")",
"\n",
"var",
"enc",
"[",
"<mask>",
".",
"MaxVarintLen64",
"]",
"byte",
"\n",
"sz",
":=",
"binary",
".",
"PutUvarint",
"(",
"enc",
"[",
":",
"]",
",",
"v",
".",
"ExpiresAt",
")",
"\n",
"buf",
".",
"Write",
"(",
"enc",
"[",
":",
"sz",
"]",
")",
"\n",
"buf",
".",
"Write",
"(",
"v",
".",
"Value",
")",
"\n",
"}"
] |
12,809 | all-12810 | [
"wait",
"waits",
"for",
"the",
"customization",
"of",
"a",
"supplied",
"VirtualMachine",
"to",
"complete",
"either",
"due",
"to",
"success",
"or",
"error",
".",
"It",
"does",
"this",
"by",
"watching",
"specifically",
"for",
"CustomizationSucceeded",
"and",
"CustomizationFailed",
"events",
".",
"If",
"the",
"customization",
"failed",
"due",
"to",
"some",
"sort",
"of",
"error",
"the",
"full",
"formatted",
"message",
"is",
"returned",
"as",
"an",
"error",
"."
] | [
"func",
"(",
"w",
"*",
"virtualMachineCustomizationWaiter",
")",
"wait",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"vm",
"*",
"object",
".",
"VirtualMachine",
",",
"timeout",
"int",
")",
"error",
"{",
"// A timeout of less than 1 minute (zero or negative value) skips the waiter,",
"// so we return immediately.",
"if",
"timeout",
"<",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Our listener loop callback.",
"cbErr",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"cb",
":=",
"func",
"(",
"obj",
"types",
".",
"ManagedObjectReference",
",",
"<mask>",
"[",
"]",
"types",
".",
"BaseEvent",
")",
"error",
"{",
"for",
"_",
",",
"be",
":=",
"range",
"page",
"{",
"switch",
"e",
":=",
"be",
".",
"(",
"type",
")",
"{",
"case",
"types",
".",
"BaseCustomizationFailed",
":",
"cbErr",
"<-",
"errors",
".",
"New",
"(",
"e",
".",
"GetCustomizationFailed",
"(",
")",
".",
"GetEvent",
"(",
")",
".",
"FullFormattedMessage",
")",
"\n",
"case",
"*",
"types",
".",
"CustomizationSucceeded",
":",
"close",
"(",
"cbErr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"mgr",
":=",
"event",
".",
"NewManager",
"(",
"client",
".",
"Client",
")",
"\n",
"mgrErr",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"// Make a proper background context so that we can gracefully cancel the",
"// subscriber when we are done with it. This eventually gets passed down to",
"// the property collector SOAP calls.",
"pctx",
",",
"pcancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
"pcancel",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"mgrErr",
"<-",
"mgr",
".",
"Events",
"(",
"pctx",
",",
"[",
"]",
"types",
".",
"ManagedObjectReference",
"{",
"vm",
".",
"Reference",
"(",
")",
"}",
",",
"10",
",",
"true",
",",
"false",
",",
"cb",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// Wait for any error condition (including nil from the closure of the",
"// callback error channel on success). We also use a different context so",
"// that we can give a better error message on timeout without interfering",
"// with the subscriber's context.",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Duration",
"(",
"timeout",
")",
"*",
"time",
".",
"Minute",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"if",
"ctx",
".",
"Err",
"(",
")",
"==",
"context",
".",
"DeadlineExceeded",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"case",
"err",
"=",
"<-",
"mgrErr",
":",
"case",
"err",
"=",
"<-",
"cbErr",
":",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
12,810 | all-12811 | [
"NewTask",
"--"
] | [
"func",
"(",
"s",
"*",
"FakeTaskManager",
")",
"NewTask",
"(",
"callerName",
"string",
",",
"profile",
"taskmanager",
".",
"ProfileType",
",",
"status",
"string",
")",
"(",
"t",
"*",
"taskmanager",
".",
"Task",
")",
"{",
"t",
"=",
"new",
"(",
"taskmanager",
".",
"Task",
")",
"\n",
"t",
".",
"CallerName",
"=",
"callerName",
"\n",
"t",
".",
"Profile",
"=",
"profile",
"\n",
"t",
".",
"Status",
"=",
"status",
"\n",
"t",
".",
"ID",
"=",
"bson",
".",
"NewObjectId",
"(",
")",
"\n",
"t",
".",
"Timestamp",
"=",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
"\n",
"t",
".",
"MetaData",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
")",
"\n",
"t",
".",
"PrivateMetaData",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"return",
"\n",
"}"
] |
12,811 | all-12812 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"HighlightConfig",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
12,812 | all-12813 | [
"Remove",
"Remove"
] | [
"func",
"(",
"<mask>",
"*",
"MemoryStore",
")",
"Remove",
"(",
"words",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"words",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"i",
",",
"l",
":=",
"0",
",",
"len",
"(",
"words",
")",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"ms",
".",
"dataStore",
".",
"Remove",
"(",
"words",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"atomic",
".",
"AddUint64",
"(",
"&",
"ms",
".",
"version",
",",
"1",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,813 | all-12814 | [
"NewServer",
"creates",
"a",
"new",
"UI",
"server",
"."
] | [
"func",
"NewServer",
"(",
"conf",
"*",
"Config",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"rpcsrv",
":=",
"rpc",
".",
"NewServer",
"(",
")",
"\n\n",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"HandleFunc",
"(",
"HTTPPath",
",",
"rpcsrv",
".",
"ServeHTTP",
")",
"\n",
"mux",
".",
"Handle",
"(",
"WSPath",
",",
"rpcsrv",
".",
"WebsocketHandler",
"(",
"conf",
".",
"AllowedOrigins",
")",
")",
"\n\n",
"httpsrv",
":=",
"&",
"<mask>",
".",
"Server",
"{",
"Addr",
":",
"conf",
".",
"Addr",
",",
"Handler",
":",
"mux",
",",
"}",
"\n\n",
"return",
"&",
"Server",
"{",
"conf",
":",
"conf",
",",
"rpcsrv",
":",
"rpcsrv",
",",
"httpsrv",
":",
"httpsrv",
",",
"}",
",",
"nil",
"\n",
"}"
] |
12,814 | all-12815 | [
"RequestMoney",
"from",
"either",
"a",
"bitcoin",
"or",
"email",
"address"
] | [
"func",
"(",
"c",
"<mask>",
")",
"RequestMoney",
"(",
"params",
"*",
"TransactionParams",
")",
"(",
"*",
"transactionConfirmation",
",",
"error",
")",
"{",
"return",
"c",
".",
"transactionRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"params",
")",
"\n",
"}"
] |
12,815 | all-12816 | [
"HasExpired",
"returns",
"true",
"if",
"the",
"ENI",
"attachment",
"object",
"has",
"exceeded",
"the",
"threshold",
"for",
"notifying",
"the",
"backend",
"of",
"the",
"attachment"
] | [
"func",
"(",
"eni",
"*",
"ENIAttachment",
")",
"HasExpired",
"(",
")",
"bool",
"{",
"eni",
".",
"guard",
".",
"RLock",
"(",
")",
"\n",
"defer",
"eni",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"time",
".",
"Now",
"(",
")",
".",
"After",
"(",
"eni",
".",
"ExpiresAt",
")",
"\n",
"}"
] |
12,816 | all-12817 | [
"GetNewStatus",
"returns",
"the",
"NewStatus",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"ToggleStatus",
")",
"GetNewStatus",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"NewStatus",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"NewStatus",
"\n",
"}"
] |
12,817 | all-12818 | [
"Cookie",
"fills",
"cookie",
"for",
"the",
"given",
"cookie",
".",
"Key",
".",
"Returns",
"false",
"if",
"cookie",
"with",
"the",
"given",
"cookie",
".",
"Key",
"is",
"missing",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"Cookie",
"(",
"cookie",
"*",
"Cookie",
")",
"bool",
"{",
"v",
":=",
"peekArgBytes",
"(",
"h",
".",
"cookies",
",",
"<mask>",
".",
"Key",
"(",
")",
")",
"\n",
"if",
"v",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"cookie",
".",
"ParseBytes",
"(",
"v",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
12,818 | all-12819 | [
"WriteHeader",
"sends",
"an",
"HTTP",
"response",
"header",
"with",
"status",
"code",
".",
"If",
"WriteHeader",
"is",
"not",
"called",
"explicitly",
"the",
"first",
"call",
"to",
"Write",
"will",
"trigger",
"an",
"implicit",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
".",
"Thus",
"explicit",
"calls",
"to",
"WriteHeader",
"are",
"mainly",
"used",
"to",
"send",
"error",
"codes",
"."
] | [
"func",
"(",
"res",
"*",
"ResponseRecorder",
")",
"WriteHeader",
"(",
"statusCode",
"int",
")",
"{",
"if",
"res",
".",
"statusCode",
"==",
"0",
"{",
"// set it only if not setted already, we don't want logs about multiple sends",
"<mask>",
".",
"statusCode",
"=",
"statusCode",
"\n",
"res",
".",
"underline",
".",
"WriteHeader",
"(",
"statusCode",
")",
"\n",
"}",
"\n\n",
"}"
] |
12,819 | all-12820 | [
"specify",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"TextureSubImage3D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall12",
"(",
"gpTextureSubImage3D",
",",
"11",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"zoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"depth",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"pixels",
")",
",",
"0",
")",
"\n",
"}"
] |
12,820 | all-12821 | [
"GetTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Type",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Type",
",",
"true",
"\n",
"}"
] |
12,821 | all-12822 | [
"OnNetworkUp",
"is",
"called",
"by",
"the",
"LXD",
"callhook",
"when",
"the",
"LXC",
"network",
"up",
"script",
"is",
"run",
"."
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"OnNetworkUp",
"(",
"deviceName",
"string",
",",
"hostName",
"string",
")",
"error",
"{",
"device",
":=",
"c",
".",
"expandedDevices",
"[",
"deviceName",
"]",
"\n",
"device",
"[",
"\"",
"\"",
"]",
"=",
"hostName",
"\n",
"return",
"c",
".",
"setupHostVethDevice",
"(",
"<mask>",
")",
"\n",
"}"
] |
12,822 | all-12823 | [
"StopServer",
"stops",
"a",
"remote",
"Pact",
"Mock",
"Server",
"."
] | [
"func",
"(",
"p",
"*",
"mockClient",
")",
"StopServer",
"(",
"server",
"*",
"<mask>",
".",
"MockServer",
")",
"(",
"*",
"types",
".",
"MockServer",
",",
"error",
")",
"{",
"return",
"p",
".",
"StopServerResponse",
",",
"p",
".",
"StopServerError",
"\n",
"}"
] |
12,823 | all-12824 | [
"addNewMetrics",
"updates",
"a",
"check",
"bundle",
"with",
"new",
"metrics"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"addNewMetrics",
"(",
"newMetrics",
"map",
"[",
"string",
"]",
"*",
"api",
".",
"CheckBundleMetric",
")",
"bool",
"{",
"updatedCheckBundle",
":=",
"false",
"\n\n",
"if",
"cm",
".",
"checkBundle",
"==",
"nil",
"||",
"len",
"(",
"newMetrics",
")",
"==",
"0",
"{",
"return",
"updatedCheckBundle",
"\n",
"}",
"\n\n",
"cm",
".",
"cbmu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cm",
".",
"cbmu",
".",
"Unlock",
"(",
")",
"\n\n",
"numCurrMetrics",
":=",
"len",
"(",
"cm",
".",
"checkBundle",
".",
"Metrics",
")",
"\n",
"numNewMetrics",
":=",
"len",
"(",
"newMetrics",
")",
"\n\n",
"if",
"numCurrMetrics",
"+",
"numNewMetrics",
">=",
"cap",
"(",
"cm",
".",
"checkBundle",
".",
"Metrics",
")",
"{",
"nm",
":=",
"<mask>",
"(",
"[",
"]",
"api",
".",
"CheckBundleMetric",
",",
"numCurrMetrics",
"+",
"numNewMetrics",
")",
"\n",
"copy",
"(",
"nm",
",",
"cm",
".",
"checkBundle",
".",
"Metrics",
")",
"\n",
"cm",
".",
"checkBundle",
".",
"Metrics",
"=",
"nm",
"\n",
"}",
"\n\n",
"cm",
".",
"checkBundle",
".",
"Metrics",
"=",
"cm",
".",
"checkBundle",
".",
"Metrics",
"[",
"0",
":",
"numCurrMetrics",
"+",
"numNewMetrics",
"]",
"\n\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"metric",
":=",
"range",
"newMetrics",
"{",
"cm",
".",
"checkBundle",
".",
"Metrics",
"[",
"numCurrMetrics",
"+",
"i",
"]",
"=",
"*",
"metric",
"\n",
"i",
"++",
"\n",
"updatedCheckBundle",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"updatedCheckBundle",
"{",
"cm",
".",
"forceCheckUpdate",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"updatedCheckBundle",
"\n",
"}"
] |
12,824 | all-12825 | [
"title",
":",
"profile",
"trace",
"handler",
"path",
":",
"/",
"debug",
"/",
"pprof",
"/",
"trace",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"traceHandler",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermDebug",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"pprof",
".",
"Trace",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,825 | all-12826 | [
"URLPrefix",
"is",
"the",
"prefix",
"that",
"may",
"be",
"used",
"in",
"the",
"url",
"before",
"the",
"language",
"code",
"itself",
".",
"For",
"example",
"if",
"the",
"prefix",
"is",
"/",
"web",
"the",
"final",
"url",
"will",
"be",
"/",
"web",
"/",
"en",
"."
] | [
"func",
"URLPrefix",
"(",
"p",
"string",
")",
"Option",
"{",
"return",
"Option",
"{",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"urlPrefix",
"=",
"p",
"\n",
"}",
"}",
"\n",
"}"
] |
12,826 | all-12827 | [
"expandClusterDasVMConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDasVmConfigInfo",
"."
] | [
"func",
"expandClusterDasVMConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"<mask>",
"{",
"}",
",",
"vm",
"*",
"object",
".",
"VirtualMachine",
",",
")",
"(",
"*",
"types",
".",
"ClusterDasVmConfigInfo",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"resourceVSphereHAVMOverrideClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"version",
":=",
"viapi",
".",
"ParseVersionFromClient",
"(",
"client",
")",
"\n\n",
"obj",
":=",
"&",
"types",
".",
"ClusterDasVmConfigInfo",
"{",
"DasSettings",
":",
"expandClusterDasVMSettings",
"(",
"d",
",",
"version",
")",
",",
"Key",
":",
"vm",
".",
"Reference",
"(",
")",
",",
"}",
"\n\n",
"// Expand ha_vm_monitoring_use_cluster_defaults here as it's not included in",
"// the base vsphere_compute_cluster resource.",
"obj",
".",
"DasSettings",
".",
"VmToolsMonitoringSettings",
".",
"ClusterSettings",
"=",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"obj",
",",
"nil",
"\n",
"}"
] |
12,827 | all-12828 | [
"Validate",
"validates",
"Kubernetes",
"options",
"."
] | [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"Validate",
"(",
"dryRun",
"bool",
")",
"error",
"{",
"if",
"dryRun",
"&&",
"o",
".",
"masterURL",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"masterURL",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"url",
".",
"ParseRequestURI",
"(",
"o",
".",
"masterURL",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"masterURL",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"o",
".",
"kubeConfig",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"o",
".",
"kubeConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,828 | all-12829 | [
"Run",
"implements",
"the",
"Discoverer",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"<mask>",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"ch",
"chan",
"<-",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"defer",
"n",
".",
"queue",
".",
"ShutDown",
"(",
")",
"\n\n",
"if",
"!",
"cache",
".",
"WaitForCacheSync",
"(",
"ctx",
".",
"Done",
"(",
")",
",",
"n",
".",
"informer",
".",
"HasSynced",
")",
"{",
"level",
".",
"Error",
"(",
"n",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"n",
".",
"process",
"(",
"ctx",
",",
"ch",
")",
"{",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// Block until the target provider is explicitly canceled.",
"<-",
"ctx",
".",
"Done",
"(",
")",
"\n",
"}"
] |
12,829 | all-12830 | [
"NewClient",
"-",
"create",
"a",
"client",
"object",
"with",
"the",
"address",
"and",
"server",
"path"
] | [
"func",
"NewClient",
"(",
"address",
",",
"path",
"string",
",",
"eventBus",
"Bus",
")",
"*",
"Client",
"{",
"client",
":=",
"new",
"(",
"Client",
")",
"\n",
"client",
".",
"eventBus",
"=",
"eventBus",
"\n",
"client",
".",
"address",
"=",
"address",
"\n",
"client",
".",
"<mask>",
"=",
"path",
"\n",
"client",
".",
"service",
"=",
"&",
"ClientService",
"{",
"client",
",",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
",",
"false",
"}",
"\n",
"return",
"client",
"\n",
"}"
] |
12,830 | all-12831 | [
"checkBindURLs",
"returns",
"an",
"error",
"if",
"any",
"URL",
"uses",
"a",
"domain",
"name",
"."
] | [
"func",
"checkBindURLs",
"(",
"urls",
"[",
"]",
"url",
".",
"URL",
")",
"error",
"{",
"for",
"_",
",",
"url",
":=",
"range",
"urls",
"{",
"if",
"url",
".",
"Scheme",
"==",
"\"",
"\"",
"||",
"url",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"<mask>",
"\n",
"}",
"\n",
"host",
",",
"_",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"url",
".",
"Host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"host",
"==",
"\"",
"\"",
"{",
"// special case for local address",
"// TODO: support /etc/hosts ?",
"continue",
"\n",
"}",
"\n",
"if",
"net",
".",
"ParseIP",
"(",
"host",
")",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"url",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,831 | all-12832 | [
"expandDVSFailureCriteria",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"DVSFailureCriteria",
"."
] | [
"func",
"expandDVSFailureCriteria",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"DVSFailureCriteria",
"{",
"obj",
":=",
"&",
"types",
".",
"DVSFailureCriteria",
"{",
"CheckBeacon",
":",
"structure",
".",
"GetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"}",
"\n\n",
"if",
"structure",
".",
"AllFieldsEmpty",
"(",
"obj",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
12,832 | all-12833 | [
"NewAggregate",
"converts",
"a",
"slice",
"of",
"errors",
"into",
"an",
"Aggregate",
"interface",
"which",
"is",
"itself",
"an",
"implementation",
"of",
"the",
"error",
"interface",
".",
"If",
"the",
"slice",
"is",
"empty",
"this",
"returns",
"nil",
".",
"It",
"will",
"check",
"if",
"any",
"of",
"the",
"element",
"of",
"input",
"error",
"list",
"is",
"nil",
"to",
"avoid",
"nil",
"pointer",
"panic",
"when",
"call",
"Error",
"()",
"."
] | [
"func",
"NewAggregate",
"(",
"errlist",
"...",
"error",
")",
"Aggregate",
"{",
"if",
"len",
"(",
"errlist",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// In case of input error list contains nil",
"var",
"errs",
"[",
"]",
"error",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"errlist",
"{",
"if",
"e",
"!=",
"nil",
"{",
"errs",
"=",
"<mask>",
"(",
"errs",
",",
"e",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"errs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"aggregate",
"(",
"errs",
")",
"\n",
"}"
] |
12,833 | all-12834 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"l",
"*",
"LogStreamDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"<mask>",
"\n",
"}"
] |
12,834 | all-12835 | [
"TODO",
":",
"We",
"could",
"add",
"support",
"for",
"multiple",
"images",
"in",
"a",
"single",
"archive",
"so",
"that",
"people",
"could",
"use",
"docker",
"-",
"archive",
":",
"opensuse",
".",
"tar",
":",
"opensuse",
":",
"leap",
"as",
"the",
"source",
"of",
"an",
"image",
".",
"To",
"do",
"for",
"both",
"the",
"NewSourceFromFile",
"and",
"NewSourceFromStream",
"functions",
"NewSourceFromFile",
"returns",
"a",
"tarfile",
".",
"Source",
"for",
"the",
"specified",
"path",
"."
] | [
"func",
"NewSourceFromFile",
"(",
"path",
"string",
")",
"(",
"*",
"Source",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n\n",
"// If the file is already not compressed we can just return the file itself",
"// as a source. Otherwise we pass the stream to NewSourceFromStream.",
"stream",
",",
"isCompressed",
",",
"err",
":=",
"compression",
".",
"AutoDecompress",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n",
"defer",
"stream",
".",
"Close",
"(",
")",
"\n",
"if",
"!",
"isCompressed",
"{",
"return",
"&",
"Source",
"{",
"tarPath",
":",
"path",
",",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"NewSourceFromStream",
"(",
"stream",
")",
"\n",
"}"
] |
12,835 | all-12836 | [
"CertificateGet",
"gets",
"an",
"CertBaseInfo",
"object",
"from",
"the",
"database",
".",
"The",
"argument",
"fingerprint",
"will",
"be",
"queried",
"with",
"a",
"LIKE",
"query",
"means",
"you",
"can",
"pass",
"a",
"shortform",
"and",
"will",
"get",
"the",
"full",
"fingerprint",
".",
"There",
"can",
"never",
"be",
"more",
"than",
"one",
"image",
"with",
"a",
"given",
"fingerprint",
"as",
"it",
"is",
"enforced",
"by",
"a",
"UNIQUE",
"constraint",
"in",
"the",
"schema",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"CertificateGet",
"(",
"fingerprint",
"string",
")",
"(",
"cert",
"*",
"CertInfo",
",",
"err",
"error",
")",
"{",
"cert",
"=",
"new",
"(",
"CertInfo",
")",
"\n\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"fingerprint",
"+",
"\"",
"\"",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"cert",
".",
"ID",
",",
"&",
"cert",
".",
"Fingerprint",
",",
"&",
"cert",
".",
"Type",
",",
"&",
"cert",
".",
"<mask>",
",",
"&",
"cert",
".",
"Certificate",
",",
"}",
"\n\n",
"query",
":=",
"`\n\t\tSELECT\n\t\t\tid, fingerprint, type, name, certificate\n\t\tFROM\n\t\t\tcertificates\n\t\tWHERE fingerprint LIKE ?`",
"\n\n",
"if",
"err",
"=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outfmt",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"nil",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"cert",
",",
"err",
"\n",
"}"
] |
12,836 | all-12837 | [
"AppendOp",
"creates",
"and",
"appends",
"a",
"new",
"op",
"to",
"the",
"current",
"set",
"of",
"ByteCode"
] | [
"func",
"(",
"ctx",
"*",
"<mask>",
")",
"AppendOp",
"(",
"o",
"vm",
".",
"OpType",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"vm",
".",
"Op",
"{",
"return",
"ctx",
".",
"ByteCode",
".",
"AppendOp",
"(",
"o",
",",
"args",
"...",
")",
"\n",
"}"
] |
12,837 | all-12838 | [
"SafeRemoveSSH",
"removes",
"a",
"file",
"on",
"a",
"remote",
"machine",
"via",
"an",
"ssh",
"client"
] | [
"func",
"SafeRemoveSSH",
"(",
"client",
"SFTPClient",
",",
"filePath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"ssh",
":=",
"sshClientBucket",
"{",
"client",
":",
"client",
",",
"}",
"\n",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"filePath",
")",
"\n",
"if",
"!",
"ssh",
".",
"exists",
"(",
"filePath",
")",
"{",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"filePath",
")",
"\n",
"err",
"=",
"<mask>",
".",
"Remove",
"(",
"filePath",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
12,838 | all-12839 | [
"Nth",
"()",
"is",
"a",
"wrapper",
"around",
"g_list_nth",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"List",
")",
"Nth",
"(",
"n",
"uint",
")",
"*",
"<mask>",
"{",
"list",
":=",
"wrapList",
"(",
"C",
".",
"g_list_nth",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"n",
")",
")",
")",
"\n",
"list",
".",
"DataWrapper",
"(",
"v",
".",
"dataWrap",
")",
"\n",
"return",
"list",
"\n",
"}"
] |
12,839 | all-12840 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetBrowserCommandLineReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
12,840 | all-12841 | [
"MustPaymentResult",
"retrieves",
"the",
"PaymentResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustPaymentResult",
"(",
")",
"PaymentResult",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetPaymentResult",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
12,841 | all-12842 | [
"virtualMachineFromMOID",
"locates",
"a",
"virtual",
"machine",
"by",
"its",
"managed",
"object",
"reference",
"ID",
"."
] | [
"func",
"virtualMachineFromMOID",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"govmomi",
".",
"Client",
",",
"id",
"string",
")",
"(",
"*",
"object",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n\n",
"finder",
":=",
"find",
".",
"NewFinder",
"(",
"client",
".",
"Client",
",",
"false",
")",
"\n\n",
"<mask>",
":=",
"types",
".",
"ManagedObjectReference",
"{",
"Type",
":",
"\"",
"\"",
",",
"Value",
":",
"id",
",",
"}",
"\n\n",
"vm",
",",
"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",
"// VM, then we have bigger problems and to be honest we should be panicking",
"// anyway.",
"return",
"vm",
".",
"(",
"*",
"object",
".",
"VirtualMachine",
")",
",",
"nil",
"\n",
"}"
] |
12,842 | all-12843 | [
"RemoveAddress",
"removes",
"the",
"address",
"from",
"the",
"book",
"."
] | [
"func",
"(",
"a",
"*",
"AddrBook",
")",
"RemoveAddress",
"(",
"addr",
"*",
"NetAddress",
")",
"{",
"a",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"ka",
":=",
"a",
".",
"addrLookup",
"[",
"addr",
".",
"String",
"(",
")",
"]",
"\n",
"if",
"ka",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"addr",
")",
"\n",
"a",
".",
"removeFromAllBuckets",
"(",
"ka",
")",
"\n",
"}"
] |
12,843 | all-12844 | [
"openWatchClient",
"retries",
"opening",
"a",
"watch",
"client",
"until",
"success",
"or",
"halt",
".",
"manually",
"retry",
"in",
"case",
"ws",
"==",
"nil",
"&&",
"err",
"==",
"nil",
"TODO",
":",
"remove",
"FailFast",
"=",
"false"
] | [
"func",
"(",
"w",
"*",
"watchGrpcStream",
")",
"openWatchClient",
"(",
")",
"(",
"ws",
"pb",
".",
"Watch_WatchClient",
",",
"err",
"error",
")",
"{",
"backoff",
":=",
"time",
".",
"Millisecond",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"w",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
",",
"w",
".",
"ctx",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"default",
":",
"}",
"\n",
"if",
"ws",
",",
"err",
"=",
"w",
".",
"remote",
".",
"Watch",
"(",
"w",
".",
"ctx",
",",
"w",
".",
"callOpts",
"...",
")",
";",
"ws",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"if",
"isHaltErr",
"(",
"w",
".",
"ctx",
",",
"err",
")",
"{",
"return",
"nil",
",",
"v3rpc",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"isUnavailableErr",
"(",
"w",
".",
"ctx",
",",
"err",
")",
"{",
"// retry, but backoff",
"if",
"backoff",
"<",
"maxBackoff",
"{",
"// 25% backoff factor",
"backoff",
"=",
"backoff",
"+",
"backoff",
"/",
"4",
"\n",
"if",
"backoff",
">",
"maxBackoff",
"{",
"backoff",
"=",
"maxBackoff",
"\n",
"}",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"backoff",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
12,844 | all-12845 | [
"RotateLeft",
"rotates",
"the",
"player",
"p",
"in",
"the",
"left",
"direction",
"."
] | [
"func",
"(",
"p",
"*",
"player",
")",
"RotateLeft",
"(",
")",
"{",
"p",
".",
"angle",
"--",
"\n",
"if",
"p",
".",
"angle",
"<",
"0",
"{",
"p",
".",
"<mask>",
"+=",
"maxAngle",
"\n",
"}",
"\n",
"p",
".",
"lean",
"--",
"\n",
"if",
"p",
".",
"lean",
"<",
"-",
"maxLean",
"{",
"p",
".",
"lean",
"=",
"-",
"maxLean",
"\n",
"}",
"\n",
"}"
] |
12,845 | all-12846 | [
"Syntax",
":",
"recordio",
"=",
"2",
"file",
"=",
"1",
"gfs",
"*",
"=",
"3"
] | [
"func",
"(",
"m",
"*",
"ModuleSpec",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"var",
"<mask>",
"[",
"]",
"modulePat",
"\n",
"for",
"_",
",",
"pat",
":=",
"range",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"{",
"pattern",
",",
"v",
",",
"err",
":=",
"parseFilter",
"(",
"pat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"v",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"// TODO: check syntax of filter?",
"filter",
"=",
"append",
"(",
"filter",
",",
"modulePat",
"{",
"pattern",
",",
"isLiteralGlob",
"(",
"pattern",
")",
",",
"Level",
"(",
"v",
")",
"}",
")",
"\n",
"}",
"\n",
"m",
".",
"filter",
"=",
"filter",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,846 | all-12847 | [
"sourceURL",
"returns",
"the",
"source",
"URL",
"from",
"prow",
"jobs",
"repository",
"reference"
] | [
"func",
"sourceURL",
"(",
"pj",
"prowjobv1",
".",
"ProwJob",
")",
"<mask>",
"{",
"if",
"pj",
".",
"Spec",
".",
"Refs",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"sourceURL",
":=",
"pj",
".",
"Spec",
".",
"Refs",
".",
"CloneURI",
"\n",
"if",
"sourceURL",
"==",
"\"",
"\"",
"{",
"sourceURL",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pj",
".",
"Spec",
".",
"Refs",
".",
"RepoLink",
")",
"\n",
"}",
"\n",
"return",
"sourceURL",
"\n",
"}"
] |
12,847 | all-12848 | [
"Trust",
"is",
"a",
"helper",
"that",
"creates",
"ChangeTrustBuilder"
] | [
"func",
"Trust",
"(",
"code",
",",
"issuer",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"(",
"result",
"ChangeTrustBuilder",
")",
"{",
"mutators",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"CreditAsset",
"(",
"code",
",",
"issuer",
")",
",",
"}",
"\n\n",
"limitSet",
":=",
"false",
"\n\n",
"for",
"_",
",",
"mut",
":=",
"range",
"args",
"{",
"mutators",
"=",
"append",
"(",
"mutators",
",",
"mut",
")",
"\n",
"_",
",",
"isLimit",
":=",
"mut",
".",
"(",
"Limit",
")",
"\n",
"if",
"isLimit",
"{",
"limitSet",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"limitSet",
"{",
"mutators",
"=",
"append",
"(",
"mutators",
",",
"MaxLimit",
")",
"\n",
"}",
"\n\n",
"return",
"ChangeTrust",
"(",
"mutators",
"...",
")",
"\n",
"}"
] |
12,848 | all-12849 | [
"submitChanges",
"takes",
"a",
"zone",
"and",
"a",
"collection",
"of",
"Changes",
"and",
"sends",
"them",
"as",
"a",
"single",
"transaction",
"."
] | [
"func",
"(",
"p",
"*",
"LinodeProvider",
")",
"submitChanges",
"(",
"changes",
"LinodeChanges",
")",
"error",
"{",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
".",
"Creates",
"{",
"logFields",
":=",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"change",
".",
"Options",
".",
"Name",
",",
"\"",
"\"",
":",
"change",
".",
"Options",
".",
"Type",
",",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"Domain",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"ID",
",",
"}",
"\n\n",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"p",
".",
"DryRun",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"if",
"_",
",",
"err",
":=",
"p",
".",
"Client",
".",
"CreateDomainRecord",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"change",
".",
"Domain",
".",
"ID",
",",
"change",
".",
"Options",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
".",
"Deletes",
"{",
"logFields",
":=",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"change",
".",
"DomainRecord",
".",
"Name",
",",
"\"",
"\"",
":",
"change",
".",
"DomainRecord",
".",
"Type",
",",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"Domain",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"ID",
",",
"}",
"\n\n",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"p",
".",
"DryRun",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"if",
"err",
":=",
"p",
".",
"Client",
".",
"DeleteDomainRecord",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"change",
".",
"Domain",
".",
"ID",
",",
"change",
".",
"DomainRecord",
".",
"ID",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
".",
"Updates",
"{",
"logFields",
":=",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"change",
".",
"<mask>",
".",
"Name",
",",
"\"",
"\"",
":",
"change",
".",
"Options",
".",
"Type",
",",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"Domain",
",",
"\"",
"\"",
":",
"change",
".",
"Domain",
".",
"ID",
",",
"}",
"\n\n",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"p",
".",
"DryRun",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"if",
"_",
",",
"err",
":=",
"p",
".",
"Client",
".",
"UpdateDomainRecord",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"change",
".",
"Domain",
".",
"ID",
",",
"change",
".",
"DomainRecord",
".",
"ID",
",",
"change",
".",
"Options",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,849 | all-12850 | [
"Do",
"executes",
"IO",
".",
"read",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"data",
"-",
"Data",
"that",
"were",
"read",
".",
"eof",
"-",
"Set",
"if",
"the",
"end",
"-",
"of",
"-",
"file",
"condition",
"occurred",
"while",
"reading",
"."
] | [
"func",
"(",
"p",
"*",
"ReadParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"data",
"string",
",",
"eof",
"bool",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"ReadReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRead",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Data",
",",
"res",
".",
"EOF",
",",
"nil",
"\n",
"}"
] |
12,850 | all-12851 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetBrowserSamplingProfileParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
12,851 | all-12852 | [
"CheckVersion",
"checks",
"installation",
"of",
"a",
"given",
"binary",
"using",
"semver",
"-",
"compatible",
"comparisions"
] | [
"func",
"(",
"i",
"*",
"Installer",
")",
"CheckVersion",
"(",
"<mask>",
",",
"version",
"string",
")",
"error",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"binary",
",",
"\"",
"\"",
",",
"version",
")",
"\n",
"v",
",",
"err",
":=",
"goversion",
".",
"NewVersion",
"(",
"version",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"versionRange",
",",
"ok",
":=",
"versionMap",
"[",
"binary",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"binary",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"v",
",",
"\"",
"\"",
",",
"versionRange",
")",
"\n",
"constraints",
",",
"err",
":=",
"goversion",
".",
"NewConstraint",
"(",
"versionRange",
")",
"\n",
"if",
"constraints",
".",
"Check",
"(",
"v",
")",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"v",
",",
"\"",
"\"",
",",
"v",
",",
"constraints",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"version",
",",
"binary",
",",
"versionRange",
")",
"\n",
"}"
] |
12,852 | all-12853 | [
"Zones",
"returns",
"filtered",
"zones",
"as",
"specified",
"by",
"domain"
] | [
"func",
"(",
"im",
"*",
"InMemoryProvider",
")",
"Zones",
"(",
")",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"return",
"im",
".",
"filter",
".",
"Zones",
"(",
"im",
".",
"client",
".",
"Zones",
"(",
")",
")",
"\n",
"}"
] |
12,853 | all-12854 | [
"/",
"*",
"Returns",
"the",
"underlying",
"HTTP",
"client",
".",
"Useful",
"to",
"set",
"custom",
"properties",
"to",
"it",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"requestClient",
"(",
")",
"*",
"http",
".",
"Client",
"{",
"if",
"c",
".",
"HttpClient",
"==",
"nil",
"{",
"c",
".",
"HttpClient",
"=",
"&",
"http",
".",
"Client",
"{",
"Timeout",
":",
"time",
".",
"Second",
"*",
"5",
"}",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"HttpClient",
"\n",
"}"
] |
12,854 | all-12855 | [
"UnmarshalText",
"implements",
"encoding",
".",
"TextUnmarshaler",
".",
"It",
"will",
"unmarshal",
"to",
"a",
"null",
"String",
"if",
"the",
"input",
"is",
"a",
"blank",
"string",
"."
] | [
"func",
"(",
"s",
"*",
"String",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"s",
".",
"String",
"=",
"string",
"(",
"text",
")",
"\n",
"s",
".",
"Valid",
"=",
"s",
".",
"<mask>",
"!=",
"\"",
"\"",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,855 | all-12856 | [
"UpdatePullRequest",
"modifies",
"the",
"title",
"body",
"open",
"state"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdatePullRequest",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"title",
",",
"body",
"*",
"string",
",",
"open",
"*",
"bool",
",",
"branch",
"*",
"string",
",",
"canModify",
"*",
"bool",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"title",
")",
"\n",
"data",
":=",
"struct",
"{",
"State",
"*",
"string",
"`json:\"state,omitempty\"`",
"\n",
"Title",
"*",
"string",
"`json:\"title,omitempty\"`",
"\n",
"Body",
"*",
"string",
"`json:\"body,omitempty\"`",
"\n",
"<mask>",
"*",
"string",
"`json:\"base,omitempty\"`",
"\n",
"// MaintainerCanModify allows maintainers of the repo to modify this",
"// pull request, eg. push changes to it before merging.",
"MaintainerCanModify",
"*",
"bool",
"`json:\"maintainer_can_modify,omitempty\"`",
"\n",
"}",
"{",
"Title",
":",
"title",
",",
"Body",
":",
"body",
",",
"Base",
":",
"branch",
",",
"MaintainerCanModify",
":",
"canModify",
",",
"}",
"\n",
"if",
"open",
"!=",
"nil",
"&&",
"*",
"open",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"data",
".",
"State",
"=",
"&",
"op",
"\n",
"}",
"else",
"if",
"open",
"!=",
"nil",
"{",
"cl",
":=",
"\"",
"\"",
"\n",
"data",
".",
"State",
"=",
"&",
"cl",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"// allow the description and draft fields",
"// https://developer.github.com/changes/2018-02-22-label-description-search-preview/",
"// https://developer.github.com/changes/2019-02-14-draft-pull-requests/",
"accept",
":",
"\"",
"\"",
",",
"method",
":",
"http",
".",
"MethodPatch",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
",",
"requestBody",
":",
"&",
"data",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"200",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
12,856 | all-12857 | [
"IsRoleNotFound",
"returns",
"true",
"if",
"the",
"error",
"means",
"role",
"not",
"found",
"of",
"v2",
"API",
"."
] | [
"func",
"IsRoleNotFound",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"ae",
",",
"ok",
":=",
"err",
".",
"(",
"authError",
")",
";",
"<mask>",
"{",
"return",
"roleNotFoundRegExp",
".",
"MatchString",
"(",
"ae",
".",
"Message",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
12,857 | all-12858 | [
"Catch",
"panics",
"usually",
"caused",
"by",
"remote",
"disconnects",
"."
] | [
"func",
"(",
"c",
"*",
"MConnection",
")",
"_recover",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"<mask>",
":=",
"debug",
".",
"Stack",
"(",
")",
"\n",
"err",
":=",
"cmn",
".",
"StackError",
"{",
"r",
",",
"stack",
"}",
"\n",
"c",
".",
"stopForError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
12,858 | all-12859 | [
"All",
"finds",
"zero",
"or",
"more",
"elements",
"by",
"CSS",
"selector",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"All",
"(",
"selector",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"<mask>",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"CSS",
",",
"selector",
")",
")",
"\n",
"}"
] |
12,859 | all-12860 | [
"Enumerate",
"lists",
"each",
"word",
"in",
"the",
"Dictionary",
"alphabetically",
"."
] | [
"func",
"(",
"dict",
"Dictionary",
")",
"Enumerate",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
")",
"Enumerator",
"{",
"if",
"dict",
".",
"root",
"==",
"nil",
"{",
"return",
"Empty",
".",
"Enumerate",
"(",
"cancel",
")",
"\n",
"}",
"\n",
"return",
"dict",
".",
"<mask>",
".",
"Enumerate",
"(",
"cancel",
")",
"\n",
"}"
] |
12,860 | all-12861 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventIndexedDBListUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
12,861 | all-12862 | [
"NewIterator",
"creates",
"an",
"iterator",
"for",
"a",
"Nitro",
"snapshot"
] | [
"func",
"(",
"m",
"*",
"Nitro",
")",
"NewIterator",
"(",
"snap",
"*",
"Snapshot",
")",
"*",
"Iterator",
"{",
"if",
"!",
"snap",
".",
"Open",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"buf",
":=",
"snap",
".",
"db",
".",
"store",
".",
"MakeBuf",
"(",
")",
"\n",
"return",
"&",
"Iterator",
"{",
"snap",
":",
"snap",
",",
"iter",
":",
"m",
".",
"<mask>",
".",
"NewIterator",
"(",
"m",
".",
"iterCmp",
",",
"buf",
")",
",",
"buf",
":",
"buf",
",",
"}",
"\n",
"}"
] |
12,862 | all-12863 | [
"GError",
"*",
"gtk_gl_area_get_error",
"(",
"GtkGLArea",
"*",
"area",
")",
";"
] | [
"func",
"(",
"v",
"*",
"GLArea",
")",
"GetError",
"(",
")",
"error",
"{",
"var",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"err",
"=",
"C",
".",
"gtk_gl_area_get_error",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"goString",
"(",
"err",
".",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,863 | all-12864 | [
"Set",
"parses",
"a",
"command",
"line",
"set",
"of",
"strings",
"separated",
"by",
"comma",
".",
"Implements",
"flag",
".",
"Value",
"interface",
"."
] | [
"func",
"(",
"ss",
"*",
"StringsValue",
")",
"Set",
"(",
"s",
"string",
")",
"error",
"{",
"*",
"<mask>",
"=",
"strings",
".",
"Split",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,864 | all-12865 | [
"SetEnvs",
"saves",
"a",
"list",
"of",
"environment",
"variables",
"in",
"the",
"app",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"SetEnvs",
"(",
"setEnvs",
"bind",
".",
"SetEnvArgs",
")",
"error",
"{",
"if",
"len",
"(",
"setEnvs",
".",
"Envs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"env",
":=",
"range",
"setEnvs",
".",
"Envs",
"{",
"err",
":=",
"validateEnv",
"(",
"env",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"setEnvs",
".",
"<mask>",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"setEnvs",
".",
"Writer",
",",
"\"",
"\\n",
"\"",
",",
"len",
"(",
"setEnvs",
".",
"Envs",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"env",
":=",
"range",
"setEnvs",
".",
"Envs",
"{",
"app",
".",
"setEnv",
"(",
"env",
")",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Env",
"}",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"setEnvs",
".",
"ShouldRestart",
"{",
"return",
"app",
".",
"restartIfUnits",
"(",
"setEnvs",
".",
"Writer",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,865 | all-12866 | [
"Encrypt",
"produces",
"encrypted",
"JWT",
"token",
"given",
"arbitrary",
"binary",
"payload",
"key",
"management",
"and",
"encryption",
"algorithms",
"to",
"use",
"(",
"see",
"constants",
"for",
"list",
"of",
"supported",
"algs",
")",
"and",
"management",
"key",
".",
"Management",
"key",
"is",
"of",
"different",
"type",
"for",
"different",
"key",
"management",
"alg",
"see",
"specific",
"key",
"management",
"alg",
"implementation",
"documentation",
".",
"It",
"returns",
"5",
"parts",
"encrypted",
"JWT",
"token",
"as",
"string",
"and",
"not",
"nil",
"error",
"if",
"something",
"went",
"wrong",
"."
] | [
"func",
"EncryptBytes",
"(",
"payload",
"[",
"]",
"byte",
",",
"alg",
"string",
",",
"enc",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"<mask>",
"...",
"func",
"(",
"*",
"JoseConfig",
")",
")",
"(",
"token",
"string",
",",
"err",
"error",
")",
"{",
"cfg",
":=",
"&",
"JoseConfig",
"{",
"CompressionAlg",
":",
"\"",
"\"",
",",
"Headers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"}",
"\n\n",
"//apply extra options",
"for",
"_",
",",
"option",
":=",
"range",
"options",
"{",
"option",
"(",
"cfg",
")",
"\n",
"}",
"\n\n",
"//make sure required headers are managed by us",
"cfg",
".",
"Headers",
"[",
"\"",
"\"",
"]",
"=",
"alg",
"\n",
"cfg",
".",
"Headers",
"[",
"\"",
"\"",
"]",
"=",
"enc",
"\n\n",
"byteContent",
":=",
"payload",
"\n\n",
"if",
"cfg",
".",
"CompressionAlg",
"!=",
"\"",
"\"",
"{",
"if",
"zipAlg",
",",
"ok",
":=",
"jwcCompressors",
"[",
"cfg",
".",
"CompressionAlg",
"]",
";",
"ok",
"{",
"byteContent",
"=",
"zipAlg",
".",
"Compress",
"(",
"[",
"]",
"byte",
"(",
"payload",
")",
")",
"\n",
"cfg",
".",
"Headers",
"[",
"\"",
"\"",
"]",
"=",
"cfg",
".",
"CompressionAlg",
"\n",
"}",
"else",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cfg",
".",
"CompressionAlg",
")",
")",
"\n",
"}",
"\n\n",
"}",
"else",
"{",
"delete",
"(",
"cfg",
".",
"Headers",
",",
"\"",
"\"",
")",
"//we not allow to manage 'zip' header manually for encryption",
"\n",
"}",
"\n\n",
"return",
"encrypt",
"(",
"byteContent",
",",
"cfg",
".",
"Headers",
",",
"key",
")",
"\n",
"}"
] |
12,866 | all-12867 | [
"WriteJSON",
"encodes",
"the",
"body",
"as",
"JSON",
"and",
"sends",
"it",
"back",
"to",
"the",
"client"
] | [
"func",
"WriteJSON",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"body",
"interface",
"{",
"}",
",",
"debug",
"bool",
")",
"error",
"{",
"var",
"output",
"io",
".",
"Writer",
"\n",
"var",
"captured",
"*",
"bytes",
".",
"Buffer",
"\n\n",
"output",
"=",
"w",
"\n",
"if",
"<mask>",
"{",
"captured",
"=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"output",
"=",
"io",
".",
"MultiWriter",
"(",
"w",
",",
"captured",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"json",
".",
"NewEncoder",
"(",
"output",
")",
".",
"Encode",
"(",
"body",
")",
"\n\n",
"if",
"captured",
"!=",
"nil",
"{",
"shared",
".",
"DebugJson",
"(",
"captured",
")",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
12,867 | all-12868 | [
"OCSPServer",
"is",
"an",
"Option",
"for",
"setting",
"the",
"identity",
"s",
"certificate",
"s",
"OCSPServer",
"."
] | [
"func",
"OCSPServer",
"(",
"<mask>",
"...",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"configuration",
")",
"{",
"c",
".",
"ocspServer",
"=",
"append",
"(",
"c",
".",
"ocspServer",
",",
"value",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
12,868 | all-12869 | [
"StartPoller",
"--"
] | [
"func",
"(",
"s",
"*",
"SkuM1Small",
")",
"StartPoller",
"(",
"requestID",
"string",
",",
"<mask>",
"*",
"taskmanager",
".",
"Task",
")",
"(",
"err",
"error",
")",
"{",
"var",
"(",
"clnt",
"innkeeperclient",
".",
"InnkeeperClient",
"\n",
"resp",
"innkeeperclient",
".",
"GetStatusResponse",
"\n",
")",
"\n\n",
"if",
"clnt",
",",
"err",
"=",
"s",
".",
"GetInnkeeperClient",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"resp",
",",
"err",
"=",
"s",
".",
"waitForStatusComplete",
"(",
"requestID",
",",
"clnt",
")",
";",
"err",
"==",
"nil",
"{",
"s",
".",
"updateTaskForStatusComplete",
"(",
"task",
",",
"resp",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
12,869 | all-12870 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsAssertion",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Type",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
12,870 | all-12871 | [
"DeleteBranch",
"deletes",
"a",
"branch",
"but",
"leaves",
"the",
"commits",
"themselves",
"intact",
".",
"In",
"other",
"words",
"those",
"commits",
"can",
"still",
"be",
"accessed",
"via",
"commit",
"IDs",
"and",
"other",
"branches",
"they",
"happen",
"to",
"be",
"on",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"DeleteBranch",
"(",
"repoName",
"string",
",",
"branch",
"string",
",",
"<mask>",
"bool",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"DeleteBranch",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"DeleteBranchRequest",
"{",
"Branch",
":",
"NewBranch",
"(",
"repoName",
",",
"branch",
")",
",",
"Force",
":",
"force",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
12,871 | all-12872 | [
"Every",
"returns",
"a",
"Schedule",
"that",
"always",
"returns",
"the",
"given",
"time",
"interval",
"."
] | [
"func",
"Every",
"(",
"interval",
"time",
".",
"Duration",
",",
"options",
"...",
"EveryOption",
")",
"Schedule",
"{",
"every",
":=",
"&",
"every",
"{",
"}",
"\n",
"for",
"_",
",",
"option",
":=",
"range",
"<mask>",
"{",
"option",
"(",
"every",
")",
"\n",
"}",
"\n",
"first",
":=",
"true",
"\n",
"return",
"func",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"if",
"first",
"&&",
"every",
".",
"skipFirst",
"{",
"err",
"=",
"ErrSkip",
"\n",
"}",
"\n",
"first",
"=",
"false",
"\n",
"return",
"interval",
",",
"err",
"\n",
"}",
"\n",
"}"
] |
12,872 | all-12873 | [
"HasNewStatus",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ToggleStatus",
")",
"HasNewStatus",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"NewStatus",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
12,873 | all-12874 | [
"Exists",
"checks",
"if",
"key",
"exists"
] | [
"func",
"(",
"c",
"GConfig",
")",
"Exists",
"(",
"key",
"string",
")",
"bool",
"{",
"v",
":=",
"c",
".",
"getValue",
"(",
"key",
")",
"\n",
"if",
"v",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
12,874 | all-12875 | [
"getLeaf",
"returns",
"Leaf",
"object",
"if",
"a",
"route",
"has",
"been",
"registered",
"."
] | [
"func",
"(",
"rm",
"*",
"routeMap",
")",
"getLeaf",
"(",
"method",
",",
"pattern",
"string",
")",
"*",
"Leaf",
"{",
"rm",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"rm",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"rm",
".",
"routes",
"[",
"method",
"]",
"[",
"pattern",
"]",
"\n",
"}"
] |
12,875 | all-12876 | [
"Bounds",
"returns",
"the",
"bounds",
"of",
"the",
"image",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"Bounds",
"(",
")",
"image",
".",
"Rectangle",
"{",
"if",
"!",
"i",
".",
"isSubImage",
"(",
")",
"{",
"w",
",",
"h",
":=",
"i",
".",
"mipmap",
".",
"<mask>",
"(",
")",
".",
"Size",
"(",
")",
"\n",
"return",
"image",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"w",
",",
"h",
")",
"\n",
"}",
"\n",
"return",
"i",
".",
"bounds",
"\n",
"}"
] |
12,876 | all-12877 | [
"AddSaveable",
"is",
"an",
"option",
"that",
"adds",
"a",
"given",
"saveable",
"as",
"one",
"that",
"should",
"be",
"saved",
"under",
"the",
"given",
"name",
".",
"The",
"name",
"must",
"be",
"the",
"same",
"across",
"uses",
"of",
"the",
"statemanager",
"(",
"e",
".",
"g",
".",
"program",
"invocations",
")",
"for",
"it",
"to",
"be",
"serialized",
"and",
"deserialized",
"correctly",
"."
] | [
"func",
"AddSaveable",
"(",
"name",
"string",
",",
"saveable",
"Saveable",
")",
"Option",
"{",
"return",
"(",
"Option",
")",
"(",
"func",
"(",
"m",
"StateManager",
")",
"{",
"manager",
",",
"ok",
":=",
"m",
".",
"(",
"*",
"basicStateManager",
")",
"\n",
"if",
"!",
"ok",
"{",
"log",
".",
"Crit",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"<mask>",
".",
"state",
".",
"Data",
"[",
"name",
"]",
"=",
"&",
"saveable",
"\n",
"}",
")",
"\n",
"}"
] |
12,877 | all-12878 | [
"updateGroundImage",
"updates",
"the",
"ground",
"image",
"according",
"to",
"the",
"current",
"player",
"s",
"position",
"."
] | [
"func",
"updateGroundImage",
"(",
"ground",
"*",
"ebiten",
".",
"<mask>",
")",
"{",
"ground",
".",
"Clear",
"(",
")",
"\n\n",
"x16",
",",
"y16",
":=",
"thePlayer",
".",
"Position",
"(",
")",
"\n",
"a",
":=",
"thePlayer",
".",
"Angle",
"(",
")",
"\n",
"gw",
",",
"gh",
":=",
"ground",
".",
"Size",
"(",
")",
"\n",
"w",
",",
"h",
":=",
"gophersImage",
".",
"Size",
"(",
")",
"\n",
"op",
":=",
"&",
"ebiten",
".",
"DrawImageOptions",
"{",
"}",
"\n",
"op",
".",
"GeoM",
".",
"Translate",
"(",
"float64",
"(",
"-",
"x16",
")",
"/",
"16",
",",
"float64",
"(",
"-",
"y16",
")",
"/",
"16",
")",
"\n",
"op",
".",
"GeoM",
".",
"Translate",
"(",
"float64",
"(",
"-",
"w",
"*",
"2",
")",
",",
"float64",
"(",
"-",
"h",
"*",
"2",
")",
")",
"\n",
"op",
".",
"GeoM",
".",
"Rotate",
"(",
"float64",
"(",
"-",
"a",
")",
"*",
"2",
"*",
"math",
".",
"Pi",
"/",
"maxAngle",
"+",
"math",
".",
"Pi",
"*",
"3.0",
"/",
"2.0",
")",
"\n",
"op",
".",
"GeoM",
".",
"Translate",
"(",
"float64",
"(",
"gw",
")",
"/",
"2",
",",
"float64",
"(",
"gh",
")",
"-",
"32",
")",
"\n",
"ground",
".",
"DrawImage",
"(",
"repeatedGophersImage",
",",
"op",
")",
"\n",
"}"
] |
12,878 | all-12879 | [
"roleRevokePermissionCommandFunc",
"executes",
"the",
"role",
"revoke",
"-",
"permission",
"command",
"."
] | [
"func",
"roleRevokePermissionCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"<",
"2",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"key",
",",
"rangeEnd",
":=",
"permRange",
"(",
"args",
"[",
"1",
":",
"]",
")",
"\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Auth",
".",
"RoleRevokePermission",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"args",
"[",
"0",
"]",
",",
"<mask>",
",",
"rangeEnd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n",
"display",
".",
"RoleRevokePermission",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
"]",
",",
"rangeEnd",
",",
"*",
"resp",
")",
"\n",
"}"
] |
12,879 | all-12880 | [
"NewGateway",
"creates",
"a",
"new",
"Gateway",
"for",
"managing",
"access",
"to",
"the",
"dqlite",
"cluster",
".",
"When",
"a",
"new",
"gateway",
"is",
"created",
"the",
"node",
"-",
"level",
"database",
"is",
"queried",
"to",
"check",
"what",
"kind",
"of",
"role",
"this",
"node",
"plays",
"and",
"if",
"it",
"s",
"exposed",
"over",
"the",
"network",
".",
"It",
"will",
"initialize",
"internal",
"data",
"structures",
"accordingly",
"for",
"example",
"starting",
"a",
"dqlite",
"driver",
"if",
"this",
"node",
"is",
"a",
"database",
"node",
".",
"After",
"creation",
"the",
"Daemon",
"is",
"expected",
"to",
"expose",
"whatever",
"http",
"handlers",
"the",
"HandlerFuncs",
"method",
"returns",
"and",
"to",
"access",
"the",
"dqlite",
"cluster",
"using",
"the",
"gRPC",
"dialer",
"returned",
"by",
"the",
"Dialer",
"method",
"."
] | [
"func",
"NewGateway",
"(",
"db",
"*",
"db",
".",
"Node",
",",
"cert",
"*",
"shared",
".",
"CertInfo",
",",
"options",
"...",
"Option",
")",
"(",
"*",
"Gateway",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n\n",
"o",
":=",
"newOptions",
"(",
")",
"\n",
"for",
"_",
",",
"option",
":=",
"range",
"options",
"{",
"option",
"(",
"o",
")",
"\n\n",
"}",
"\n\n",
"gateway",
":=",
"&",
"Gateway",
"{",
"db",
":",
"db",
",",
"cert",
":",
"cert",
",",
"options",
":",
"o",
",",
"ctx",
":",
"ctx",
",",
"cancel",
":",
"cancel",
",",
"upgradeCh",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"16",
")",
",",
"acceptCh",
":",
"make",
"(",
"chan",
"net",
".",
"Conn",
")",
",",
"<mask>",
":",
"&",
"dqliteServerStore",
"{",
"}",
",",
"}",
"\n\n",
"err",
":=",
"gateway",
".",
"init",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"gateway",
",",
"nil",
"\n",
"}"
] |
12,880 | all-12881 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform1iv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"C",
".",
"glowProgramUniform1iv",
"(",
"gpProgramUniform1iv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
12,881 | all-12882 | [
"set",
"front",
"and",
"back",
"stencil",
"test",
"actions"
] | [
"func",
"StencilOp",
"(",
"fail",
"uint32",
",",
"zfail",
"uint32",
",",
"zpass",
"uint32",
")",
"{",
"C",
".",
"glowStencilOp",
"(",
"gpStencilOp",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"zfail",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"zpass",
")",
")",
"\n",
"}"
] |
12,882 | all-12883 | [
"PeerURLsMapAndToken",
"sets",
"up",
"an",
"initial",
"peer",
"URLsMap",
"and",
"cluster",
"token",
"for",
"bootstrap",
"or",
"discovery",
"."
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"PeerURLsMapAndToken",
"(",
"which",
"string",
")",
"(",
"urlsmap",
"types",
".",
"URLsMap",
",",
"token",
"string",
",",
"err",
"error",
")",
"{",
"token",
"=",
"cfg",
".",
"InitialClusterToken",
"\n",
"switch",
"{",
"case",
"cfg",
".",
"Durl",
"!=",
"\"",
"\"",
":",
"urlsmap",
"=",
"types",
".",
"URLsMap",
"{",
"}",
"\n",
"// If using discovery, generate a temporary cluster based on",
"// self's advertised peer URLs",
"urlsmap",
"[",
"cfg",
".",
"Name",
"]",
"=",
"cfg",
".",
"APUrls",
"\n",
"token",
"=",
"cfg",
".",
"Durl",
"\n\n",
"case",
"cfg",
".",
"DNSCluster",
"!=",
"\"",
"\"",
":",
"clusterStrs",
",",
"cerr",
":=",
"cfg",
".",
"GetDNSClusterNames",
"(",
")",
"\n",
"lg",
":=",
"cfg",
".",
"logger",
"\n",
"if",
"cerr",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"cerr",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cerr",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"\"",
"\"",
",",
"cerr",
"\n",
"}",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"clusterStrs",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"}",
"\n",
"clusterStr",
":=",
"strings",
".",
"Join",
"(",
"clusterStrs",
",",
"\"",
"\"",
")",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"clusterStr",
",",
"\"",
"\"",
")",
"&&",
"cfg",
".",
"PeerTLSInfo",
".",
"TrustedCAFile",
"==",
"\"",
"\"",
"{",
"cfg",
".",
"PeerTLSInfo",
".",
"ServerName",
"=",
"cfg",
".",
"DNSCluster",
"\n",
"}",
"\n",
"urlsmap",
",",
"err",
"=",
"types",
".",
"NewURLsMap",
"(",
"clusterStr",
")",
"\n",
"// only etcd member must belong to the discovered cluster.",
"// proxy does not need to belong to the discovered cluster.",
"if",
"which",
"==",
"\"",
"\"",
"{",
"if",
"_",
",",
"<mask>",
":=",
"urlsmap",
"[",
"cfg",
".",
"Name",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cfg",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"default",
":",
"// We're statically configured, and cluster has appropriately been set.",
"urlsmap",
",",
"err",
"=",
"types",
".",
"NewURLsMap",
"(",
"cfg",
".",
"InitialCluster",
")",
"\n",
"}",
"\n",
"return",
"urlsmap",
",",
"token",
",",
"err",
"\n",
"}"
] |
12,883 | all-12884 | [
"MigrateHostMetadataV0ToHostMetadataV1",
"fills",
"nested",
"host",
"metadata",
"and",
"modifies",
"if",
"needed",
"this",
"is",
"used",
"for",
"configuration",
"updates"
] | [
"func",
"MigrateHostMetadataV0ToHostMetadataV1",
"(",
"m",
"*",
"MetadataV0",
")",
"*",
"Metadata",
"{",
"hostMetadata",
":=",
"&",
"Metadata",
"{",
"}",
"\n",
"hostMetadata",
".",
"DriverName",
"=",
"m",
".",
"DriverName",
"\n",
"hostMetadata",
".",
"HostOptions",
".",
"EngineOptions",
"=",
"&",
"<mask>",
".",
"Options",
"{",
"}",
"\n",
"hostMetadata",
".",
"HostOptions",
".",
"AuthOptions",
"=",
"&",
"auth",
".",
"Options",
"{",
"StorePath",
":",
"m",
".",
"StorePath",
",",
"CaCertPath",
":",
"m",
".",
"CaCertPath",
",",
"CaCertRemotePath",
":",
"\"",
"\"",
",",
"ServerCertPath",
":",
"m",
".",
"ServerCertPath",
",",
"ServerKeyPath",
":",
"m",
".",
"ServerKeyPath",
",",
"ClientKeyPath",
":",
"\"",
"\"",
",",
"ServerCertRemotePath",
":",
"\"",
"\"",
",",
"ServerKeyRemotePath",
":",
"\"",
"\"",
",",
"CaPrivateKeyPath",
":",
"m",
".",
"PrivateKeyPath",
",",
"ClientCertPath",
":",
"m",
".",
"ClientCertPath",
",",
"}",
"\n\n",
"hostMetadata",
".",
"ConfigVersion",
"=",
"m",
".",
"ConfigVersion",
"\n\n",
"return",
"hostMetadata",
"\n",
"}"
] |
12,884 | all-12885 | [
"ClearHandlers",
"removes",
"all",
"handlers",
"from",
"current",
"logger",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"ClearHandlers",
"(",
")",
"{",
"logger",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"logger",
".",
"closeHandlers",
"(",
")",
"\n",
"logger",
".",
"Handlers",
"=",
"make",
"(",
"[",
"]",
"Handler",
",",
"0",
")",
"\n",
"logger",
".",
"flushBuffer",
"(",
")",
"\n",
"logger",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
12,885 | all-12886 | [
"Gets",
"the",
"logFile",
"and",
"acquires",
"and",
"RLock",
"()",
"for",
"the",
"mmap",
".",
"You",
"must",
"call",
"RUnlock",
"on",
"the",
"file",
"(",
"if",
"non",
"-",
"nil",
")"
] | [
"func",
"(",
"vlog",
"*",
"valueLog",
")",
"getFileRLocked",
"(",
"fid",
"uint32",
")",
"(",
"*",
"logFile",
",",
"error",
")",
"{",
"vlog",
".",
"filesLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"vlog",
".",
"filesLock",
".",
"RUnlock",
"(",
")",
"\n",
"<mask>",
",",
"ok",
":=",
"vlog",
".",
"filesMap",
"[",
"fid",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// log file has gone away, will need to retry the operation.",
"return",
"nil",
",",
"ErrRetry",
"\n",
"}",
"\n",
"ret",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
12,886 | all-12887 | [
"OpenRepository",
"opens",
"a",
"repository",
"by",
"its",
"filepath",
".",
"You",
"can",
"use",
"DiscoverRepositoryPath",
"to",
"discover",
"the",
"repository",
"from",
"any",
"directory",
"and",
"use",
"the",
"result",
"of",
"this",
"call",
"as",
"parameter",
"for",
"OpenRepository",
".",
"OpenRepository",
"will",
"return",
"an",
"error",
"if",
"the",
"given",
"path",
"does",
"not",
"appear",
"to",
"be",
"a",
"git",
"repository",
"."
] | [
"func",
"OpenRepository",
"(",
"p",
"string",
")",
"(",
"*",
"Repository",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"p",
",",
"\"",
"\"",
")",
"&&",
"!",
"strings",
".",
"HasSuffix",
"(",
"p",
",",
"\"",
"\"",
")",
"{",
"p",
"=",
"filepath",
".",
"Join",
"(",
"p",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"p",
"=",
"strings",
".",
"TrimRight",
"(",
"p",
",",
"\"",
"\"",
")",
"\n",
"fi",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"filepath",
".",
"Join",
"(",
"p",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"!",
"fi",
".",
"IsDir",
"(",
")",
"{",
"return",
"&",
"Repository",
"{",
"path",
":",
"p",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrRepositoryNotFound",
"\n",
"}"
] |
12,887 | all-12888 | [
"recvKeepAlive",
"updates",
"a",
"lease",
"based",
"on",
"its",
"LeaseKeepAliveResponse"
] | [
"func",
"(",
"l",
"*",
"lessor",
")",
"recvKeepAlive",
"(",
"resp",
"*",
"pb",
".",
"LeaseKeepAliveResponse",
")",
"{",
"karesp",
":=",
"&",
"LeaseKeepAliveResponse",
"{",
"ResponseHeader",
":",
"resp",
".",
"GetHeader",
"(",
")",
",",
"ID",
":",
"LeaseID",
"(",
"resp",
".",
"ID",
")",
",",
"TTL",
":",
"resp",
".",
"TTL",
",",
"}",
"\n\n",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"ka",
",",
"ok",
":=",
"l",
".",
"keepAlives",
"[",
"karesp",
".",
"ID",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"karesp",
".",
"TTL",
"<=",
"0",
"{",
"// lease expired; close all keep alive channels",
"<mask>",
"(",
"l",
".",
"keepAlives",
",",
"karesp",
".",
"ID",
")",
"\n",
"ka",
".",
"close",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// send update to all channels",
"nextKeepAlive",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"(",
"time",
".",
"Duration",
"(",
"karesp",
".",
"TTL",
")",
"*",
"time",
".",
"Second",
")",
"/",
"3.0",
")",
"\n",
"ka",
".",
"deadline",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Duration",
"(",
"karesp",
".",
"TTL",
")",
"*",
"time",
".",
"Second",
")",
"\n",
"for",
"_",
",",
"ch",
":=",
"range",
"ka",
".",
"chs",
"{",
"select",
"{",
"case",
"ch",
"<-",
"karesp",
":",
"default",
":",
"if",
"l",
".",
"lg",
"!=",
"nil",
"{",
"l",
".",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"len",
"(",
"ch",
")",
")",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"cap",
"(",
"ch",
")",
")",
",",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// still advance in order to rate-limit keep-alive sends",
"ka",
".",
"nextKeepAlive",
"=",
"nextKeepAlive",
"\n",
"}",
"\n",
"}"
] |
12,888 | all-12889 | [
"MarshalJSON",
"marshals",
"the",
"app",
"in",
"json",
"format",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"repo",
",",
"_",
":=",
"repository",
".",
"Manager",
"(",
")",
".",
"GetRepository",
"(",
"app",
".",
"Name",
")",
"\n",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Name",
"\n",
"<mask>",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Platform",
"\n",
"if",
"version",
":=",
"app",
".",
"GetPlatformVersion",
"(",
")",
";",
"version",
"!=",
"\"",
"\"",
"{",
"result",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"app",
".",
"Platform",
",",
"version",
")",
"\n",
"}",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Teams",
"\n",
"units",
",",
"err",
":=",
"app",
".",
"Units",
"(",
")",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"units",
"\n",
"var",
"errMsgs",
"[",
"]",
"string",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errMsgs",
"=",
"append",
"(",
"errMsgs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"repo",
".",
"ReadWriteURL",
"\n",
"plan",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"app",
".",
"Plan",
".",
"Name",
",",
"\"",
"\"",
":",
"app",
".",
"Plan",
".",
"Memory",
",",
"\"",
"\"",
":",
"app",
".",
"Plan",
".",
"Swap",
",",
"\"",
"\"",
":",
"app",
".",
"Plan",
".",
"CpuShare",
",",
"}",
"\n",
"routers",
",",
"err",
":=",
"app",
".",
"GetRoutersWithAddr",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errMsgs",
"=",
"append",
"(",
"errMsgs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"routers",
")",
">",
"0",
"{",
"result",
"[",
"\"",
"\"",
"]",
"=",
"routers",
"[",
"0",
"]",
".",
"Address",
"\n",
"plan",
"[",
"\"",
"\"",
"]",
"=",
"routers",
"[",
"0",
"]",
".",
"Name",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"routers",
"[",
"0",
"]",
".",
"Name",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"routers",
"[",
"0",
"]",
".",
"Opts",
"\n",
"}",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"CName",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Owner",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Pool",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Description",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Deploys",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"TeamOwner",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"plan",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Lock",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"app",
".",
"Tags",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"routers",
"\n",
"if",
"len",
"(",
"errMsgs",
")",
">",
"0",
"{",
"result",
"[",
"\"",
"\"",
"]",
"=",
"strings",
".",
"Join",
"(",
"errMsgs",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"&",
"result",
")",
"\n",
"}"
] |
12,889 | all-12890 | [
"WithDelims",
"sets",
"the",
"delimiters",
"used",
"in",
"templates",
"."
] | [
"func",
"WithDelims",
"(",
"open",
",",
"<mask>",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"delimOpen",
"=",
"open",
"\n",
"o",
".",
"delimClose",
"=",
"close",
"\n",
"}",
"\n",
"}"
] |
12,890 | all-12891 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"FrameID",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
12,891 | all-12892 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Returns",
"a",
"list",
"of",
"artifacts",
"and",
"associated",
"meta",
"-",
"data",
"for",
"a",
"given",
"run",
".",
"As",
"a",
"task",
"may",
"have",
"many",
"artifacts",
"paging",
"may",
"be",
"necessary",
".",
"If",
"this",
"end",
"-",
"point",
"returns",
"a",
"continuationToken",
"you",
"should",
"call",
"the",
"end",
"-",
"point",
"again",
"with",
"the",
"continuationToken",
"as",
"the",
"query",
"-",
"string",
"option",
":",
"continuationToken",
".",
"By",
"default",
"this",
"end",
"-",
"point",
"will",
"list",
"up",
"-",
"to",
"1000",
"artifacts",
"in",
"a",
"single",
"page",
"you",
"may",
"limit",
"this",
"with",
"the",
"query",
"-",
"string",
"parameter",
"limit",
".",
"See",
"#listArtifacts"
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"ListArtifacts",
"(",
"taskId",
",",
"runId",
",",
"continuationToken",
",",
"limit",
"string",
")",
"(",
"*",
"ListArtifactsResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"queue",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"taskId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"runId",
")",
"+",
"\"",
"\"",
",",
"new",
"(",
"ListArtifactsResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListArtifactsResponse",
")",
",",
"err",
"\n",
"}"
] |
12,892 | all-12893 | [
"SetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"resource",
"s",
"creation",
"time"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"SetCreatedAt",
"(",
"createdAt",
"time",
".",
"Time",
")",
"{",
"if",
"createdAt",
".",
"IsZero",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"cgroup",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"cgroup",
".",
"createdAt",
"=",
"createdAt",
"\n",
"}"
] |
12,893 | all-12894 | [
"checkMissingAndDeprecated",
"checks",
"all",
"zero",
"-",
"valued",
"fields",
"for",
"tags",
"of",
"the",
"form",
"missing",
":",
"STRING",
"and",
"acts",
"based",
"on",
"that",
"string",
".",
"Current",
"options",
"are",
":",
"fatal",
"warn",
".",
"Fatal",
"will",
"result",
"in",
"an",
"error",
"being",
"returned",
"warn",
"will",
"result",
"in",
"a",
"warning",
"that",
"the",
"field",
"is",
"missing",
"being",
"logged",
"."
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"checkMissingAndDepreciated",
"(",
")",
"error",
"{",
"cfgElem",
":=",
"reflect",
".",
"ValueOf",
"(",
"cfg",
")",
".",
"Elem",
"(",
")",
"\n",
"cfgStructField",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"cfg",
")",
")",
".",
"Type",
"(",
")",
"\n\n",
"fatalFields",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"cfgElem",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"cfgField",
":=",
"cfgElem",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"utils",
".",
"ZeroOrNil",
"(",
"cfgField",
".",
"Interface",
"(",
")",
")",
"{",
"missingTag",
":=",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"missingTag",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"switch",
"missingTag",
"{",
"case",
"\"",
"\"",
":",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"Name",
")",
"\n",
"case",
"\"",
"\"",
":",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"Name",
")",
"\n",
"fatalFields",
"=",
"append",
"(",
"fatalFields",
",",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"Name",
")",
"\n",
"default",
":",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"missingTag",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// present",
"deprecatedTag",
":=",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"deprecatedTag",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"cfgStructField",
".",
"Field",
"(",
"i",
")",
".",
"<mask>",
",",
"deprecatedTag",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"fatalFields",
")",
">",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"fatalFields",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,894 | all-12895 | [
"ReceiveIssue",
"calls",
"plugin",
".",
"ReceiveIssue",
"()",
"if",
"the",
"author",
"is",
"not",
"filtered"
] | [
"func",
"(",
"a",
"*",
"AuthorFilterPluginWrapper",
")",
"ReceiveIssue",
"(",
"issue",
"sql",
".",
"Issue",
")",
"[",
"]",
"Point",
"{",
"if",
"a",
".",
"match",
"(",
"issue",
".",
"User",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"a",
".",
"plugin",
".",
"ReceiveIssue",
"(",
"<mask>",
")",
"\n",
"}"
] |
12,895 | all-12896 | [
"PushNote",
"sends",
"a",
"note",
"to",
"the",
"specific",
"Channel",
"with",
"the",
"given",
"title",
"and",
"body"
] | [
"func",
"(",
"s",
"*",
"Subscription",
")",
"PushNote",
"(",
"title",
",",
"body",
"string",
")",
"error",
"{",
"return",
"s",
".",
"Client",
".",
"PushNoteToChannel",
"(",
"s",
".",
"Channel",
".",
"<mask>",
",",
"title",
",",
"body",
")",
"\n",
"}"
] |
12,896 | all-12897 | [
"copy",
"pixels",
"into",
"a",
"1D",
"texture",
"image"
] | [
"func",
"CopyTexImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"border",
"int32",
")",
"{",
"C",
".",
"glowCopyTexImage1D",
"(",
"gpCopyTexImage1D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
")",
"\n",
"}"
] |
12,897 | all-12898 | [
"CloseWatcher",
"closes",
"the",
"wathcer",
"."
] | [
"func",
"CloseWatcher",
"(",
")",
"error",
"{",
"for",
"i",
":=",
"uint32",
"(",
"0",
")",
";",
"i",
"<",
"watcher",
".",
"<mask>",
";",
"i",
"++",
"{",
"watcher",
".",
"closer",
"<-",
"true",
"\n",
"}",
"\n",
"return",
"watcher",
".",
"Close",
"(",
")",
"\n",
"}"
] |
12,898 | all-12899 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Cloud",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"CloudLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"CloudLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,899 | all-12900 | [
"ValueInit",
"is",
"a",
"wrapper",
"around",
"g_value_init",
"()",
"and",
"allocates",
"and",
"initializes",
"a",
"new",
"Value",
"with",
"the",
"Type",
"t",
".",
"A",
"runtime",
"finalizer",
"is",
"set",
"to",
"call",
"g_value_unset",
"()",
"on",
"the",
"underlying",
"GValue",
"after",
"leaving",
"scope",
".",
"ValueInit",
"()",
"returns",
"a",
"non",
"-",
"nil",
"error",
"if",
"the",
"allocation",
"failed",
"."
] | [
"func",
"ValueInit",
"(",
"t",
"Type",
")",
"(",
"*",
"Value",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"_g_value_init",
"(",
"C",
".",
"GType",
"(",
"t",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"errNilPtr",
"\n",
"}",
"\n\n",
"v",
":=",
"&",
"<mask>",
"{",
"c",
"}",
"\n\n",
"runtime",
".",
"SetFinalizer",
"(",
"v",
",",
"(",
"*",
"Value",
")",
".",
"unset",
")",
"\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.