id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
10,100 | all-10101 | [
"Process",
"populates",
"the",
"specified",
"struct",
"based",
"on",
"environment",
"variables"
] | [
"func",
"Process",
"(",
"<mask>",
"string",
",",
"spec",
"interface",
"{",
"}",
")",
"error",
"{",
"infos",
",",
"err",
":=",
"gatherInfo",
"(",
"prefix",
",",
"spec",
")",
"\n\n",
"for",
"_",
",",
"info",
":=",
"range",
"infos",
"{",
"// `os.Getenv` cannot differentiate between an explicitly set empty value",
"// and an unset value. `os.LookupEnv` is preferred to `syscall.Getenv`,",
"// but it is only available in go1.5 or newer. We're using Go build tags",
"// here to use os.LookupEnv for >=go1.5",
"value",
",",
"ok",
":=",
"lookupEnv",
"(",
"info",
".",
"Key",
")",
"\n",
"if",
"!",
"ok",
"&&",
"info",
".",
"Alt",
"!=",
"\"",
"\"",
"{",
"value",
",",
"ok",
"=",
"lookupEnv",
"(",
"info",
".",
"Alt",
")",
"\n",
"}",
"\n\n",
"def",
":=",
"info",
".",
"Tags",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"def",
"!=",
"\"",
"\"",
"&&",
"!",
"ok",
"{",
"value",
"=",
"def",
"\n",
"}",
"\n\n",
"req",
":=",
"info",
".",
"Tags",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"ok",
"&&",
"def",
"==",
"\"",
"\"",
"{",
"if",
"isTrue",
"(",
"req",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"Key",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"err",
"=",
"processField",
"(",
"value",
",",
"info",
".",
"Field",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"ParseError",
"{",
"KeyName",
":",
"info",
".",
"Key",
",",
"FieldName",
":",
"info",
".",
"Name",
",",
"TypeName",
":",
"info",
".",
"Field",
".",
"Type",
"(",
")",
".",
"String",
"(",
")",
",",
"Value",
":",
"value",
",",
"Err",
":",
"err",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
10,101 | all-10102 | [
"title",
":",
"template",
"create",
"path",
":",
"/",
"iaas",
"/",
"templates",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"201",
":",
"Template",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"409",
":",
"Existent",
"template"
] | [
"func",
"templateCreate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"token",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"var",
"paramTemplate",
"iaas",
".",
"Template",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"paramTemplate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"iaasCtx",
":=",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxIaaS",
",",
"paramTemplate",
".",
"IaaSName",
")",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"token",
",",
"permission",
".",
"PermMachineTemplateCreate",
",",
"iaasCtx",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeIaas",
",",
"Value",
":",
"paramTemplate",
".",
"IaaSName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermMachineTemplateCreate",
",",
"Owner",
":",
"token",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermMachineReadEvents",
",",
"iaasCtx",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"iaas",
".",
"FindTemplate",
"(",
"paramTemplate",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"mgo",
".",
"ErrNotFound",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"paramTemplate",
".",
"Name",
")",
"}",
"\n",
"}",
"\n",
"err",
"=",
"paramTemplate",
".",
"Save",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,102 | all-10103 | [
"String",
"returns",
"a",
"JSON",
"representation",
"of",
"the",
"RouteInfo"
] | [
"func",
"(",
"ri",
"RouteInfo",
")",
"<mask>",
"(",
")",
"string",
"{",
"b",
",",
"_",
":=",
"json",
".",
"MarshalIndent",
"(",
"ri",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"string",
"(",
"b",
")",
"\n",
"}"
] |
10,103 | all-10104 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"TrackCacheStorageForOriginParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,104 | all-10105 | [
"add",
"puts",
"a",
"watcher",
"into",
"receiving",
"a",
"broadcast",
"if",
"its",
"revision",
"at",
"least",
"meets",
"the",
"broadcast",
"revision",
".",
"Returns",
"true",
"if",
"added",
"."
] | [
"func",
"(",
"wb",
"*",
"watchBroadcast",
")",
"add",
"(",
"w",
"*",
"watcher",
")",
"bool",
"{",
"wb",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"wb",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"wb",
".",
"nextrev",
">",
"w",
".",
"nextrev",
"||",
"(",
"wb",
".",
"nextrev",
"==",
"0",
"&&",
"w",
".",
"nextrev",
"!=",
"0",
")",
"{",
"// wb is too far ahead, w will miss events",
"// or wb is being established with a current watcher",
"return",
"false",
"\n",
"}",
"\n",
"if",
"wb",
".",
"responses",
"==",
"0",
"{",
"// Newly created; create event will be sent by etcd.",
"wb",
".",
"receivers",
"[",
"w",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"// already sent by etcd; emulate create event",
"<mask>",
":=",
"w",
".",
"post",
"(",
"&",
"pb",
".",
"WatchResponse",
"{",
"Header",
":",
"&",
"pb",
".",
"ResponseHeader",
"{",
"// todo: fill in ClusterId",
"// todo: fill in MemberId:",
"Revision",
":",
"w",
".",
"nextrev",
",",
"// todo: fill in RaftTerm:",
"}",
",",
"WatchId",
":",
"w",
".",
"id",
",",
"Created",
":",
"true",
",",
"}",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"wb",
".",
"receivers",
"[",
"w",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"watchersCoalescing",
".",
"Inc",
"(",
")",
"\n\n",
"return",
"true",
"\n",
"}"
] |
10,105 | all-10106 | [
"UnixSocket",
"returns",
"the",
"full",
"path",
"to",
"the",
"unix",
".",
"socket",
"file",
"that",
"this",
"daemon",
"is",
"listening",
"on",
".",
"Used",
"by",
"tests",
"."
] | [
"func",
"(",
"d",
"*",
"Daemon",
")",
"UnixSocket",
"(",
")",
"string",
"{",
"path",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"path",
"!=",
"\"",
"\"",
"{",
"return",
"path",
"\n",
"}",
"\n\n",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"<mask>",
".",
"VarDir",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
10,106 | all-10107 | [
"Wrapper",
"for",
"http",
".",
"HandlerFunc"
] | [
"func",
"RouteHandlerFunc",
"(",
"<mask>",
"http",
".",
"HandlerFunc",
")",
"r2router",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"_",
"r2router",
".",
"Params",
")",
"{",
"next",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
10,107 | all-10108 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StepIntoParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,108 | all-10109 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SearchInContentReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger20",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,109 | all-10110 | [
"GetActivatesDefault",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_activates_default",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetActivatesDefault",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_activates_default",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
10,110 | all-10111 | [
"CreateStoragePool",
"defines",
"a",
"new",
"storage",
"pool",
"using",
"the",
"provided",
"StoragePool",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateStoragePool",
"(",
"pool",
"api",
".",
"StoragePoolsPost",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"pool",
".",
"Driver",
"==",
"\"",
"\"",
"&&",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"pool",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,111 | all-10112 | [
"Seek",
"would",
"seek",
"to",
"the",
"provided",
"key",
"if",
"present",
".",
"If",
"absent",
"it",
"would",
"seek",
"to",
"the",
"next",
"smallest",
"key",
"greater",
"than",
"the",
"provided",
"key",
"if",
"iterating",
"in",
"the",
"forward",
"direction",
".",
"Behavior",
"would",
"be",
"reversed",
"if",
"iterating",
"backwards",
"."
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Seek",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"for",
"i",
":=",
"it",
".",
"data",
".",
"pop",
"(",
")",
";",
"i",
"!=",
"nil",
";",
"i",
"=",
"it",
".",
"<mask>",
".",
"pop",
"(",
")",
"{",
"i",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"it",
".",
"waste",
".",
"push",
"(",
"i",
")",
"\n",
"}",
"\n\n",
"it",
".",
"lastKey",
"=",
"it",
".",
"lastKey",
"[",
":",
"0",
"]",
"\n",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"key",
"=",
"it",
".",
"opt",
".",
"Prefix",
"\n",
"}",
"\n",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"it",
".",
"iitr",
".",
"Rewind",
"(",
")",
"\n",
"it",
".",
"prefetch",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"!",
"it",
".",
"opt",
".",
"Reverse",
"{",
"key",
"=",
"y",
".",
"KeyWithTs",
"(",
"key",
",",
"it",
".",
"txn",
".",
"readTs",
")",
"\n",
"}",
"else",
"{",
"key",
"=",
"y",
".",
"KeyWithTs",
"(",
"key",
",",
"0",
")",
"\n",
"}",
"\n",
"it",
".",
"iitr",
".",
"Seek",
"(",
"key",
")",
"\n",
"it",
".",
"prefetch",
"(",
")",
"\n",
"}"
] |
10,112 | all-10113 | [
"LogMessages",
"causes",
"all",
"messages",
"sent",
"and",
"received",
"on",
"conn",
"to",
"be",
"logged",
"using",
"the",
"provided",
"logger",
"."
] | [
"func",
"LogMessages",
"(",
"log",
"Logger",
")",
"ConnOpt",
"{",
"return",
"func",
"(",
"c",
"*",
"Conn",
")",
"{",
"// Remember reqs we have received so we can helpfully show the",
"// request method in OnSend for responses.",
"var",
"(",
"mu",
"sync",
".",
"Mutex",
"\n",
"reqMethods",
"=",
"map",
"[",
"ID",
"]",
"string",
"{",
"}",
"\n",
")",
"\n\n",
"OnRecv",
"(",
"func",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"<mask>",
")",
"{",
"switch",
"{",
"case",
"req",
"!=",
"nil",
"&&",
"resp",
"==",
"nil",
":",
"mu",
".",
"Lock",
"(",
")",
"\n",
"reqMethods",
"[",
"req",
".",
"ID",
"]",
"=",
"req",
".",
"Method",
"\n",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"params",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"req",
".",
"Params",
")",
"\n",
"if",
"req",
".",
"Notif",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"req",
".",
"Method",
",",
"params",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"req",
".",
"ID",
",",
"req",
".",
"Method",
",",
"params",
")",
"\n",
"}",
"\n\n",
"case",
"resp",
"!=",
"nil",
":",
"var",
"method",
"string",
"\n",
"if",
"req",
"!=",
"nil",
"{",
"method",
"=",
"req",
".",
"Method",
"\n",
"}",
"else",
"{",
"method",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"switch",
"{",
"case",
"resp",
".",
"Result",
"!=",
"nil",
":",
"result",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"resp",
".",
"Result",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resp",
".",
"ID",
",",
"method",
",",
"result",
")",
"\n",
"case",
"resp",
".",
"Error",
"!=",
"nil",
":",
"err",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"resp",
".",
"Error",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resp",
".",
"ID",
",",
"method",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"(",
"c",
")",
"\n",
"OnSend",
"(",
"func",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"Response",
")",
"{",
"switch",
"{",
"case",
"req",
"!=",
"nil",
":",
"params",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"req",
".",
"Params",
")",
"\n",
"if",
"req",
".",
"Notif",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"req",
".",
"Method",
",",
"params",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"req",
".",
"ID",
",",
"req",
".",
"Method",
",",
"params",
")",
"\n",
"}",
"\n\n",
"case",
"resp",
"!=",
"nil",
":",
"mu",
".",
"Lock",
"(",
")",
"\n",
"method",
":=",
"reqMethods",
"[",
"resp",
".",
"ID",
"]",
"\n",
"delete",
"(",
"reqMethods",
",",
"resp",
".",
"ID",
")",
"\n",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"method",
"==",
"\"",
"\"",
"{",
"method",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"Result",
"!=",
"nil",
"{",
"result",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"resp",
".",
"Result",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resp",
".",
"ID",
",",
"method",
",",
"result",
")",
"\n",
"}",
"else",
"{",
"err",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"resp",
".",
"Error",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resp",
".",
"ID",
",",
"method",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"(",
"c",
")",
"\n",
"}",
"\n",
"}"
] |
10,113 | all-10114 | [
"SignedURL",
"creates",
"a",
"signed",
"URL",
"using",
"the",
"given",
"Client",
"where",
"route",
"is",
"the",
"url",
"path",
"relative",
"to",
"the",
"BaseURL",
"stored",
"in",
"the",
"Client",
"query",
"is",
"the",
"set",
"of",
"query",
"string",
"parameters",
"if",
"any",
"and",
"duration",
"is",
"the",
"amount",
"of",
"time",
"that",
"the",
"signed",
"URL",
"should",
"remain",
"valid",
"for",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"SignedURL",
"(",
"route",
"string",
",",
"query",
"url",
".",
"Values",
",",
"duration",
"time",
".",
"Duration",
")",
"(",
"u",
"*",
"url",
".",
"URL",
",",
"err",
"error",
")",
"{",
"u",
",",
"err",
"=",
"setURL",
"(",
"client",
",",
"route",
",",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"credentials",
":=",
"&",
"hawk",
".",
"Credentials",
"{",
"<mask>",
":",
"client",
".",
"Credentials",
".",
"ClientID",
",",
"Key",
":",
"client",
".",
"Credentials",
".",
"AccessToken",
",",
"Hash",
":",
"sha256",
".",
"New",
",",
"}",
"\n",
"reqAuth",
",",
"err",
":=",
"hawk",
".",
"NewURLAuth",
"(",
"u",
".",
"String",
"(",
")",
",",
"credentials",
",",
"duration",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"reqAuth",
".",
"Ext",
",",
"err",
"=",
"getExtHeader",
"(",
"client",
".",
"Credentials",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"bewitSignature",
":=",
"reqAuth",
".",
"Bewit",
"(",
")",
"\n",
"if",
"query",
"==",
"nil",
"{",
"query",
"=",
"url",
".",
"Values",
"{",
"}",
"\n",
"}",
"\n",
"query",
".",
"Set",
"(",
"\"",
"\"",
",",
"bewitSignature",
")",
"\n",
"u",
".",
"RawQuery",
"=",
"query",
".",
"Encode",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
10,114 | all-10115 | [
"NewFakeSource",
"creates",
"a",
"new",
"fakeSource",
"with",
"the",
"given",
"config",
"."
] | [
"func",
"NewFakeSource",
"(",
"fqdnTemplate",
"string",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"if",
"fqdnTemplate",
"==",
"\"",
"\"",
"{",
"fqdnTemplate",
"=",
"defaultFQDNTemplate",
"\n",
"}",
"\n\n",
"return",
"&",
"fakeSource",
"{",
"dnsName",
":",
"fqdnTemplate",
",",
"}",
",",
"nil",
"\n",
"}"
] |
10,115 | all-10116 | [
"RegisterReviewEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"ReviewEvent",
"handler",
"."
] | [
"func",
"RegisterReviewEventHandler",
"(",
"<mask>",
"string",
",",
"fn",
"ReviewEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"reviewEventHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] |
10,116 | all-10117 | [
"Delete",
"the",
"Transcription",
"with",
"the",
"given",
"sid",
".",
"If",
"the",
"Transcription",
"has",
"already",
"been",
"deleted",
"or",
"does",
"not",
"exist",
"Delete",
"returns",
"nil",
".",
"If",
"another",
"error",
"or",
"a",
"timeout",
"occurs",
"the",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"TranscriptionService",
")",
"Delete",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"sid",
"string",
")",
"error",
"{",
"return",
"c",
".",
"client",
".",
"DeleteResource",
"(",
"ctx",
",",
"transcriptionPathPart",
",",
"sid",
")",
"\n",
"}"
] |
10,117 | all-10118 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GenerateTestReportParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage44",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,118 | all-10119 | [
"Free",
"deallocates",
"the",
"map",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"Free",
"(",
")",
"{",
"C",
".",
"mapnik_map_free",
"(",
"m",
".",
"m",
")",
"\n",
"m",
".",
"m",
"=",
"nil",
"\n",
"}"
] |
10,119 | all-10120 | [
"stop",
"closes",
"http",
"closes",
"all",
"channels",
"and",
"stops",
"raft",
"."
] | [
"func",
"(",
"rc",
"*",
"raftNode",
")",
"stop",
"(",
")",
"{",
"rc",
".",
"stopHTTP",
"(",
")",
"\n",
"close",
"(",
"rc",
".",
"commitC",
")",
"\n",
"<mask>",
"(",
"rc",
".",
"errorC",
")",
"\n",
"rc",
".",
"node",
".",
"Stop",
"(",
")",
"\n",
"}"
] |
10,120 | all-10121 | [
"FromURL",
"parses",
"a",
"new",
"HOTP",
"from",
"a",
"URL",
"string",
".",
"It",
"returns",
"the",
"OTP",
"the",
"label",
"associated",
"with",
"the",
"OTP",
"and",
"any",
"errors",
"that",
"occurred",
"."
] | [
"func",
"FromURL",
"(",
"urlString",
"string",
")",
"(",
"*",
"HOTP",
",",
"string",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"<mask>",
".",
"Parse",
"(",
"urlString",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Scheme",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"else",
"if",
"u",
".",
"Host",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n\n",
"v",
":=",
"u",
".",
"Query",
"(",
")",
"\n",
"if",
"len",
"(",
"v",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n",
"if",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"else",
"if",
"algo",
":=",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"algo",
"!=",
"\"",
"\"",
"&&",
"algo",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n\n",
"var",
"identity",
"string",
"\n",
"if",
"len",
"(",
"u",
".",
"Path",
")",
">",
"1",
"{",
"identity",
"=",
"u",
".",
"Path",
"[",
"1",
":",
"]",
"\n",
"}",
"\n\n",
"var",
"counter",
"uint64",
"\n",
"if",
"ctr",
":=",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"ctr",
"!=",
"\"",
"\"",
"{",
"counter",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"ctr",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n",
"}",
"\n\n",
"secret",
",",
"err",
":=",
"base32",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n\n",
"var",
"digits",
"int64",
"=",
"6",
"\n",
"if",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"digits",
",",
"err",
"=",
"strconv",
".",
"ParseInt",
"(",
"v",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"10",
",",
"8",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrInvalidHOTPURL",
"\n",
"}",
"\n",
"}",
"\n\n",
"otp",
":=",
"NewHOTP",
"(",
"secret",
",",
"counter",
",",
"int",
"(",
"digits",
")",
")",
"\n",
"return",
"otp",
",",
"identity",
",",
"nil",
"\n",
"}"
] |
10,121 | all-10122 | [
"CreateMonitor",
"adds",
"a",
"new",
"monitor",
"to",
"the",
"system",
".",
"This",
"returns",
"a",
"pointer",
"to",
"a",
"monitor",
"so",
"you",
"can",
"pass",
"that",
"to",
"UpdateMonitor",
"later",
"if",
"needed"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateMonitor",
"(",
"monitor",
"*",
"Monitor",
")",
"(",
"*",
"Monitor",
",",
"error",
")",
"{",
"var",
"out",
"Monitor",
"\n",
"// TODO: is this more pretty of frowned upon?",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"monitor",
",",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
10,122 | all-10123 | [
"EnvLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"EnvLocator",
"(",
"href",
"string",
")",
"*",
"EnvLocator",
"{",
"<mask>",
"&",
"EnvLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
10,123 | all-10124 | [
"NewDeploymentManifestFromFile",
"-",
"will",
"read",
"any",
"implementor",
"of",
"os",
".",
"File",
"and",
"initialize",
"a",
"deployment",
"manifest",
"from",
"its",
"bytes",
".",
"this",
"can",
"be",
"used",
"to",
"read",
"a",
"file",
"or",
"os",
".",
"Stdin"
] | [
"func",
"NewDeploymentManifestFromFile",
"(",
"f",
"*",
"os",
".",
"<mask>",
")",
"*",
"DeploymentManifest",
"{",
"var",
"b",
"[",
"]",
"byte",
"\n",
"fi",
",",
"_",
":=",
"f",
".",
"Stat",
"(",
")",
"\n\n",
"if",
"fi",
".",
"Size",
"(",
")",
">",
"0",
"{",
"b",
",",
"_",
"=",
"ioutil",
".",
"ReadAll",
"(",
"f",
")",
"\n",
"}",
"\n",
"return",
"NewDeploymentManifest",
"(",
"b",
")",
"\n",
"}"
] |
10,124 | all-10125 | [
"valueOrEnv",
"provides",
"a",
"way",
"of",
"suppling",
"configuration",
"values",
"through",
"environment",
"variables",
".",
"Defined",
"values",
"always",
"take",
"priority",
"."
] | [
"func",
"valueOrEnv",
"(",
"config",
"map",
"[",
"string",
"]",
"string",
",",
"key",
",",
"env",
"string",
")",
"string",
"{",
"if",
"v",
":=",
"config",
"[",
"<mask>",
"]",
";",
"v",
"!=",
"\"",
"\"",
"{",
"return",
"v",
"\n",
"}",
"\n",
"if",
"v",
":=",
"os",
".",
"Getenv",
"(",
"env",
")",
";",
"v",
"!=",
"\"",
"\"",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"env",
",",
"key",
")",
"\n",
"return",
"v",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
10,125 | all-10126 | [
"nodeFunc",
"returns",
"or",
"accumulates",
"catalog",
"node",
"dependency",
"."
] | [
"func",
"nodeFunc",
"(",
"b",
"*",
"Brain",
",",
"used",
",",
"missing",
"*",
"dep",
".",
"Set",
")",
"func",
"(",
"...",
"string",
")",
"(",
"*",
"dep",
".",
"CatalogNode",
",",
"error",
")",
"{",
"return",
"func",
"(",
"s",
"...",
"string",
")",
"(",
"*",
"dep",
".",
"CatalogNode",
",",
"error",
")",
"{",
"d",
",",
"err",
":=",
"dep",
".",
"NewCatalogNodeQuery",
"(",
"strings",
".",
"Join",
"(",
"s",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"used",
".",
"Add",
"(",
"d",
")",
"\n\n",
"if",
"value",
",",
"<mask>",
":=",
"b",
".",
"Recall",
"(",
"d",
")",
";",
"ok",
"{",
"return",
"value",
".",
"(",
"*",
"dep",
".",
"CatalogNode",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"missing",
".",
"Add",
"(",
"d",
")",
"\n\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
10,126 | all-10127 | [
"PrependPage",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_prepend_page",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"PrependPage",
"(",
"child",
"IWidget",
",",
"tabLabel",
"IWidget",
")",
"int",
"{",
"cTabLabel",
":=",
"nullableWidget",
"(",
"tabLabel",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_notebook_prepend_page",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
",",
"cTabLabel",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
10,127 | all-10128 | [
"Expected",
"returns",
"the",
"Firewall",
"structure",
"of",
"what",
"is",
"Expected",
"."
] | [
"func",
"(",
"r",
"*",
"Firewall",
")",
"Expected",
"(",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"newResource",
":=",
"&",
"Firewall",
"{",
"Shared",
":",
"Shared",
"{",
"Name",
":",
"r",
".",
"Name",
",",
"CloudID",
":",
"r",
".",
"ServerPool",
".",
"Identifier",
",",
"}",
",",
"InboundRules",
":",
"r",
".",
"InboundRules",
",",
"OutboundRules",
":",
"r",
".",
"OutboundRules",
",",
"DropletIDs",
":",
"r",
".",
"DropletIDs",
",",
"Tags",
":",
"r",
".",
"Tags",
",",
"FirewallID",
":",
"r",
".",
"FirewallID",
",",
"<mask>",
":",
"r",
".",
"Status",
",",
"Created",
":",
"r",
".",
"Created",
",",
"}",
"\n\n",
"//logger.Info(\"Expected firewall returned is %+v\", immutable)",
"newCluster",
":=",
"r",
".",
"immutableRender",
"(",
"newResource",
",",
"immutable",
")",
"\n",
"return",
"newCluster",
",",
"newResource",
",",
"nil",
"\n\n",
"}"
] |
10,128 | all-10129 | [
"title",
":",
"set",
"app",
"certificate",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"certificate",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"setCertificate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateCertificateSet",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"cname",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"certificate",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"key",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"if",
"cname",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"a",
".",
"<mask>",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateCertificateSet",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
",",
"\"",
"\"",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"a",
".",
"SetCertificate",
"(",
"cname",
",",
"certificate",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,129 | all-10130 | [
"Repaint",
"draws",
"the",
"control",
"on",
"its",
"View",
"surface",
".",
"Horizontal",
"ProgressBar",
"supports",
"custom",
"title",
"over",
"the",
"bar",
".",
"One",
"can",
"set",
"title",
"using",
"method",
"SetTitle",
".",
"There",
"are",
"a",
"few",
"predefined",
"variables",
"that",
"can",
"be",
"used",
"inside",
"title",
"to",
"show",
"value",
"or",
"total",
"progress",
".",
"Variable",
"must",
"be",
"enclosed",
"with",
"double",
"curly",
"brackets",
".",
"Available",
"variables",
":",
"percent",
"-",
"the",
"current",
"percentage",
"rounded",
"to",
"closest",
"integer",
"value",
"-",
"raw",
"ProgressBar",
"value",
"min",
"-",
"lower",
"ProgressBar",
"limit",
"max",
"-",
"upper",
"ProgressBar",
"limit",
"Examples",
":",
"pb",
".",
"SetTitle",
"(",
"{{",
"value",
"}}",
"of",
"{{",
"max",
"}}",
")",
"pb",
".",
"SetTitle",
"(",
"{{",
"percent",
"}}",
"%",
")"
] | [
"func",
"(",
"b",
"*",
"ProgressBar",
")",
"Draw",
"(",
")",
"{",
"if",
"b",
".",
"hidden",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"b",
".",
"max",
"<=",
"b",
".",
"min",
"{",
"return",
"\n",
"}",
"\n\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"fgOff",
",",
"fgOn",
":=",
"RealColor",
"(",
"b",
".",
"fg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorProgressText",
")",
",",
"RealColor",
"(",
"b",
".",
"fgActive",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorProgressActiveText",
")",
"\n",
"bgOff",
",",
"bgOn",
":=",
"RealColor",
"(",
"b",
".",
"bg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorProgressBack",
")",
",",
"RealColor",
"(",
"b",
".",
"bgActive",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorProgressActiveBack",
")",
"\n\n",
"parts",
":=",
"[",
"]",
"rune",
"(",
"SysObject",
"(",
"ObjProgressBar",
")",
")",
"\n",
"cFilled",
",",
"cEmpty",
":=",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
"\n\n",
"prc",
":=",
"0",
"\n",
"if",
"b",
".",
"value",
">=",
"b",
".",
"max",
"{",
"prc",
"=",
"100",
"\n",
"}",
"else",
"if",
"b",
".",
"value",
"<",
"b",
".",
"max",
"&&",
"b",
".",
"value",
">",
"b",
".",
"min",
"{",
"prc",
"=",
"(",
"100",
"*",
"(",
"b",
".",
"value",
"-",
"b",
".",
"min",
")",
")",
"/",
"(",
"b",
".",
"max",
"-",
"b",
".",
"min",
")",
"\n",
"}",
"\n\n",
"var",
"title",
"string",
"\n",
"if",
"b",
".",
"direction",
"==",
"Horizontal",
"&&",
"b",
".",
"Title",
"(",
")",
"!=",
"\"",
"\"",
"{",
"<mask>",
"=",
"b",
".",
"Title",
"(",
")",
"\n",
"title",
"=",
"strings",
".",
"Replace",
"(",
"title",
",",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"prc",
")",
",",
"-",
"1",
")",
"\n",
"title",
"=",
"strings",
".",
"Replace",
"(",
"title",
",",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"b",
".",
"value",
")",
",",
"-",
"1",
")",
"\n",
"title",
"=",
"strings",
".",
"Replace",
"(",
"title",
",",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"b",
".",
"min",
")",
",",
"-",
"1",
")",
"\n",
"title",
"=",
"strings",
".",
"Replace",
"(",
"title",
",",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"b",
".",
"max",
")",
",",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"x",
",",
"y",
":=",
"b",
".",
"Pos",
"(",
")",
"\n",
"w",
",",
"h",
":=",
"b",
".",
"Size",
"(",
")",
"\n\n",
"if",
"b",
".",
"direction",
"==",
"Horizontal",
"{",
"filled",
":=",
"prc",
"*",
"w",
"/",
"100",
"\n",
"sFilled",
":=",
"strings",
".",
"Repeat",
"(",
"string",
"(",
"cFilled",
")",
",",
"filled",
")",
"\n",
"sEmpty",
":=",
"strings",
".",
"Repeat",
"(",
"string",
"(",
"cEmpty",
")",
",",
"w",
"-",
"filled",
")",
"\n\n",
"for",
"yy",
":=",
"y",
";",
"yy",
"<",
"y",
"+",
"h",
";",
"yy",
"++",
"{",
"SetTextColor",
"(",
"fgOn",
")",
"\n",
"SetBackColor",
"(",
"bgOn",
")",
"\n",
"DrawRawText",
"(",
"x",
",",
"yy",
",",
"sFilled",
")",
"\n",
"SetTextColor",
"(",
"fgOff",
")",
"\n",
"SetBackColor",
"(",
"bgOff",
")",
"\n",
"DrawRawText",
"(",
"x",
"+",
"filled",
",",
"yy",
",",
"sEmpty",
")",
"\n",
"}",
"\n\n",
"if",
"title",
"!=",
"\"",
"\"",
"{",
"shift",
",",
"str",
":=",
"AlignText",
"(",
"title",
",",
"w",
",",
"b",
".",
"align",
")",
"\n",
"titleClr",
":=",
"RealColor",
"(",
"b",
".",
"titleFg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorProgressTitleText",
")",
"\n",
"var",
"sOn",
",",
"sOff",
"string",
"\n",
"if",
"filled",
"==",
"0",
"||",
"shift",
">=",
"filled",
"{",
"sOff",
"=",
"str",
"\n",
"}",
"else",
"if",
"w",
"==",
"filled",
"||",
"shift",
"+",
"xs",
".",
"Len",
"(",
"str",
")",
"<",
"filled",
"{",
"sOn",
"=",
"str",
"\n",
"}",
"else",
"{",
"r",
":=",
"filled",
"-",
"shift",
"\n",
"sOn",
"=",
"xs",
".",
"Slice",
"(",
"str",
",",
"0",
",",
"r",
")",
"\n",
"sOff",
"=",
"xs",
".",
"Slice",
"(",
"str",
",",
"r",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"SetTextColor",
"(",
"titleClr",
")",
"\n",
"if",
"sOn",
"!=",
"\"",
"\"",
"{",
"SetBackColor",
"(",
"bgOn",
")",
"\n",
"DrawRawText",
"(",
"x",
"+",
"shift",
",",
"y",
",",
"sOn",
")",
"\n",
"}",
"\n",
"if",
"sOff",
"!=",
"\"",
"\"",
"{",
"SetBackColor",
"(",
"bgOff",
")",
"\n",
"DrawRawText",
"(",
"x",
"+",
"shift",
"+",
"xs",
".",
"Len",
"(",
"sOn",
")",
",",
"y",
",",
"sOff",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"filled",
":=",
"prc",
"*",
"h",
"/",
"100",
"\n",
"sFilled",
":=",
"strings",
".",
"Repeat",
"(",
"string",
"(",
"cFilled",
")",
",",
"w",
")",
"\n",
"sEmpty",
":=",
"strings",
".",
"Repeat",
"(",
"string",
"(",
"cEmpty",
")",
",",
"w",
")",
"\n",
"for",
"yy",
":=",
"y",
";",
"yy",
"<",
"y",
"+",
"h",
"-",
"filled",
";",
"yy",
"++",
"{",
"SetTextColor",
"(",
"fgOff",
")",
"\n",
"SetBackColor",
"(",
"bgOff",
")",
"\n",
"DrawRawText",
"(",
"x",
",",
"yy",
",",
"sEmpty",
")",
"\n",
"}",
"\n",
"for",
"yy",
":=",
"y",
"+",
"h",
"-",
"filled",
";",
"yy",
"<",
"y",
"+",
"h",
";",
"yy",
"++",
"{",
"SetTextColor",
"(",
"fgOff",
")",
"\n",
"SetBackColor",
"(",
"bgOff",
")",
"\n",
"DrawRawText",
"(",
"x",
",",
"yy",
",",
"sFilled",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,130 | all-10131 | [
"Match",
"is",
"unlabeled"
] | [
"func",
"(",
"u",
"UnlabelEvent",
")",
"Match",
"(",
"eventName",
",",
"label",
"string",
")",
"bool",
"{",
"return",
"eventName",
"==",
"\"",
"\"",
"&&",
"label",
"==",
"u",
".",
"<mask>",
"\n",
"}"
] |
10,131 | all-10132 | [
"=====",
"Actions",
"POST",
"/",
"api",
"/",
"patterns",
"Create",
"a",
"new",
"Pattern",
"."
] | [
"func",
"(",
"loc",
"*",
"PatternLocator",
")",
"Create",
"(",
"months",
"string",
",",
"name",
"string",
",",
"operation",
"string",
",",
"type_",
"string",
",",
"value",
"float64",
",",
"years",
"string",
",",
"options",
"rsapi",
".",
"APIParams",
")",
"(",
"*",
"PatternLocator",
",",
"error",
")",
"{",
"var",
"res",
"*",
"PatternLocator",
"\n",
"if",
"months",
"==",
"\"",
"\"",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"operation",
"==",
"\"",
"\"",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"type_",
"==",
"\"",
"\"",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"years",
"==",
"\"",
"\"",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"params",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"viewOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"viewOpt",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"viewOpt",
"\n",
"}",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"\"",
"\"",
":",
"months",
",",
"\"",
"\"",
":",
"name",
",",
"\"",
"\"",
":",
"operation",
",",
"\"",
"\"",
":",
"type_",
",",
"\"",
"\"",
":",
"value",
",",
"\"",
"\"",
":",
"years",
",",
"}",
"\n",
"var",
"summaryOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"summaryOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"summaryOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"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",
"<mask>",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"location",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"location",
")",
"==",
"0",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"return",
"&",
"PatternLocator",
"{",
"Href",
"(",
"location",
")",
",",
"loc",
".",
"api",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
10,132 | all-10133 | [
"title",
":",
"set",
"a",
"pool",
"constraint",
"path",
":",
"/",
"constraints",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized"
] | [
"func",
"poolConstraintSet",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPoolUpdateConstraintsSet",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"poolConstraint",
"pool",
".",
"PoolConstraint",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"poolConstraint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"poolConstraint",
".",
"PoolExpr",
"==",
"\"",
"\"",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"poolConstraint",
".",
"PoolExpr",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPoolUpdateConstraintsSet",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"append",
":=",
"false",
"\n",
"if",
"appendStr",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
";",
"appendStr",
"!=",
"\"",
"\"",
"{",
"append",
",",
"_",
"=",
"strconv",
".",
"ParseBool",
"(",
"appendStr",
")",
"\n",
"}",
"\n",
"if",
"<mask>",
"{",
"return",
"pool",
".",
"AppendPoolConstraint",
"(",
"&",
"poolConstraint",
")",
"\n",
"}",
"\n",
"return",
"pool",
".",
"SetPoolConstraint",
"(",
"&",
"poolConstraint",
")",
"\n",
"}"
] |
10,133 | all-10134 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ShadowRootType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ShadowRootType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ShadowRootTypeUserAgent",
":",
"*",
"t",
"=",
"ShadowRootTypeUserAgent",
"\n",
"case",
"ShadowRootTypeOpen",
":",
"*",
"t",
"=",
"ShadowRootTypeOpen",
"\n",
"case",
"ShadowRootTypeClosed",
":",
"*",
"t",
"=",
"ShadowRootTypeClosed",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
10,134 | all-10135 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"UpdateRegistrationParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,135 | all-10136 | [
"Precedence",
"returns",
"the",
"operator",
"precedence",
"of",
"the",
"binary",
"operator",
"op",
".",
"If",
"op",
"is",
"not",
"a",
"binary",
"operator",
"the",
"result",
"is",
"LowestPrec",
"."
] | [
"func",
"(",
"i",
"ItemType",
")",
"precedence",
"(",
")",
"int",
"{",
"switch",
"i",
"{",
"case",
"ItemLOR",
":",
"return",
"1",
"\n",
"<mask>",
"ItemLAND",
",",
"ItemLUnless",
":",
"return",
"2",
"\n",
"case",
"ItemEQL",
",",
"ItemNEQ",
",",
"ItemLTE",
",",
"ItemLSS",
",",
"ItemGTE",
",",
"ItemGTR",
":",
"return",
"3",
"\n",
"case",
"ItemADD",
",",
"ItemSUB",
":",
"return",
"4",
"\n",
"case",
"ItemMUL",
",",
"ItemDIV",
",",
"ItemMOD",
":",
"return",
"5",
"\n",
"case",
"ItemPOW",
":",
"return",
"6",
"\n",
"default",
":",
"return",
"LowestPrec",
"\n",
"}",
"\n",
"}"
] |
10,136 | all-10137 | [
"Put2",
"returns",
"the",
"skiplist",
"node",
"of",
"the",
"item",
"if",
"Put",
"()",
"succeeds"
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Put2",
"(",
"bs",
"[",
"]",
"byte",
")",
"(",
"n",
"*",
"skiplist",
".",
"Node",
")",
"{",
"var",
"success",
"bool",
"\n",
"x",
":=",
"w",
".",
"newItem",
"(",
"bs",
",",
"w",
".",
"useMemoryMgmt",
")",
"\n",
"x",
".",
"bornSn",
"=",
"w",
".",
"getCurrSn",
"(",
")",
"\n",
"n",
",",
"success",
"=",
"w",
".",
"store",
".",
"Insert2",
"(",
"unsafe",
".",
"Pointer",
"(",
"x",
")",
",",
"w",
".",
"insCmp",
",",
"w",
".",
"existCmp",
",",
"w",
".",
"buf",
",",
"w",
".",
"rand",
".",
"Float32",
",",
"&",
"w",
".",
"slSts1",
")",
"\n",
"if",
"<mask>",
"{",
"w",
".",
"count",
"++",
"\n",
"}",
"else",
"{",
"w",
".",
"freeItem",
"(",
"x",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
10,137 | all-10138 | [
"The",
"out",
"option",
"in",
"the",
"MapReduce",
"command",
"must",
"be",
"ordered",
".",
"This",
"was",
"found",
"after",
"the",
"implementation",
"was",
"accepting",
"maps",
"for",
"a",
"long",
"time",
"so",
"rather",
"than",
"breaking",
"the",
"API",
"we",
"ll",
"fix",
"the",
"order",
"if",
"necessary",
".",
"Details",
"about",
"the",
"order",
"requirement",
"may",
"be",
"seen",
"in",
"MongoDB",
"s",
"code",
":",
"http",
":",
"//",
"goo",
".",
"gl",
"/",
"L8jwJX"
] | [
"func",
"fixMROut",
"(",
"out",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"outv",
":=",
"reflect",
".",
"ValueOf",
"(",
"out",
")",
"\n",
"if",
"outv",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Map",
"||",
"outv",
".",
"Type",
"(",
")",
".",
"Key",
"(",
")",
"!=",
"reflect",
".",
"TypeOf",
"(",
"\"",
"\"",
")",
"{",
"return",
"out",
"\n",
"}",
"\n",
"outs",
":=",
"make",
"(",
"bson",
".",
"D",
",",
"outv",
".",
"Len",
"(",
")",
")",
"\n\n",
"outTypeIndex",
":=",
"-",
"1",
"\n",
"for",
"i",
",",
"k",
":=",
"range",
"outv",
".",
"MapKeys",
"(",
")",
"{",
"<mask>",
":=",
"k",
".",
"String",
"(",
")",
"\n",
"outs",
"[",
"i",
"]",
".",
"Name",
"=",
"ks",
"\n",
"outs",
"[",
"i",
"]",
".",
"Value",
"=",
"outv",
".",
"MapIndex",
"(",
"k",
")",
".",
"Interface",
"(",
")",
"\n",
"switch",
"ks",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"outTypeIndex",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"outTypeIndex",
">",
"0",
"{",
"outs",
"[",
"0",
"]",
",",
"outs",
"[",
"outTypeIndex",
"]",
"=",
"outs",
"[",
"outTypeIndex",
"]",
",",
"outs",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"outs",
"\n",
"}"
] |
10,138 | all-10139 | [
"Run",
"implements",
"the",
"discoverer",
"interface",
"."
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"ch",
"chan",
"<-",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"namespaces",
":=",
"d",
".",
"getNamespaces",
"(",
")",
"\n\n",
"switch",
"d",
".",
"role",
"{",
"case",
"RoleEndpoint",
":",
"for",
"_",
",",
"namespace",
":=",
"range",
"namespaces",
"{",
"e",
":=",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Endpoints",
"(",
"namespace",
")",
"\n",
"elw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"e",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"e",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"s",
":=",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Services",
"(",
"namespace",
")",
"\n",
"slw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"s",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"s",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"p",
":=",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Pods",
"(",
"namespace",
")",
"\n",
"plw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"p",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"p",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"eps",
":=",
"NewEndpoints",
"(",
"log",
".",
"With",
"(",
"d",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"slw",
",",
"&",
"apiv1",
".",
"Service",
"{",
"}",
",",
"resyncPeriod",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"elw",
",",
"&",
"apiv1",
".",
"Endpoints",
"{",
"}",
",",
"resyncPeriod",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"plw",
",",
"&",
"apiv1",
".",
"Pod",
"{",
"}",
",",
"resyncPeriod",
")",
",",
")",
"\n",
"d",
".",
"discoverers",
"=",
"append",
"(",
"d",
".",
"discoverers",
",",
"eps",
")",
"\n",
"<mask>",
"eps",
".",
"endpointsInf",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"go",
"eps",
".",
"serviceInf",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"go",
"eps",
".",
"podInf",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"}",
"\n",
"case",
"RolePod",
":",
"for",
"_",
",",
"namespace",
":=",
"range",
"namespaces",
"{",
"p",
":=",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Pods",
"(",
"namespace",
")",
"\n",
"plw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"p",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"p",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"pod",
":=",
"NewPod",
"(",
"log",
".",
"With",
"(",
"d",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"plw",
",",
"&",
"apiv1",
".",
"Pod",
"{",
"}",
",",
"resyncPeriod",
")",
",",
")",
"\n",
"d",
".",
"discoverers",
"=",
"append",
"(",
"d",
".",
"discoverers",
",",
"pod",
")",
"\n",
"go",
"pod",
".",
"informer",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"}",
"\n",
"case",
"RoleService",
":",
"for",
"_",
",",
"namespace",
":=",
"range",
"namespaces",
"{",
"s",
":=",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Services",
"(",
"namespace",
")",
"\n",
"slw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"s",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"s",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"svc",
":=",
"NewService",
"(",
"log",
".",
"With",
"(",
"d",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"slw",
",",
"&",
"apiv1",
".",
"Service",
"{",
"}",
",",
"resyncPeriod",
")",
",",
")",
"\n",
"d",
".",
"discoverers",
"=",
"append",
"(",
"d",
".",
"discoverers",
",",
"svc",
")",
"\n",
"go",
"svc",
".",
"informer",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"}",
"\n",
"case",
"RoleIngress",
":",
"for",
"_",
",",
"namespace",
":=",
"range",
"namespaces",
"{",
"i",
":=",
"d",
".",
"client",
".",
"ExtensionsV1beta1",
"(",
")",
".",
"Ingresses",
"(",
"namespace",
")",
"\n",
"ilw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"i",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"i",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"ingress",
":=",
"NewIngress",
"(",
"log",
".",
"With",
"(",
"d",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"ilw",
",",
"&",
"extensionsv1beta1",
".",
"Ingress",
"{",
"}",
",",
"resyncPeriod",
")",
",",
")",
"\n",
"d",
".",
"discoverers",
"=",
"append",
"(",
"d",
".",
"discoverers",
",",
"ingress",
")",
"\n",
"go",
"ingress",
".",
"informer",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"}",
"\n",
"case",
"RoleNode",
":",
"nlw",
":=",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"return",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Nodes",
"(",
")",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"metav1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"d",
".",
"client",
".",
"CoreV1",
"(",
")",
".",
"Nodes",
"(",
")",
".",
"Watch",
"(",
"options",
")",
"\n",
"}",
",",
"}",
"\n",
"node",
":=",
"NewNode",
"(",
"log",
".",
"With",
"(",
"d",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"cache",
".",
"NewSharedInformer",
"(",
"nlw",
",",
"&",
"apiv1",
".",
"Node",
"{",
"}",
",",
"resyncPeriod",
")",
",",
")",
"\n",
"d",
".",
"discoverers",
"=",
"append",
"(",
"d",
".",
"discoverers",
",",
"node",
")",
"\n",
"go",
"node",
".",
"informer",
".",
"Run",
"(",
"ctx",
".",
"Done",
"(",
")",
")",
"\n",
"default",
":",
"level",
".",
"Error",
"(",
"d",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"d",
".",
"role",
")",
"\n",
"}",
"\n\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"_",
",",
"dd",
":=",
"range",
"d",
".",
"discoverers",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"d",
"discoverer",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"d",
".",
"Run",
"(",
"ctx",
",",
"ch",
")",
"\n",
"}",
"(",
"dd",
")",
"\n",
"}",
"\n\n",
"d",
".",
"Unlock",
"(",
")",
"\n\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"<-",
"ctx",
".",
"Done",
"(",
")",
"\n",
"}"
] |
10,139 | all-10140 | [
"GetReadOnlyOk",
"returns",
"a",
"tuple",
"with",
"the",
"ReadOnly",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"GetReadOnlyOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"ReadOnly",
"==",
"nil",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"ReadOnly",
",",
"<mask>",
"\n",
"}"
] |
10,140 | all-10141 | [
"Decide",
"if",
"symlink",
"dir",
"/",
"base",
"should",
"be",
"followed",
"."
] | [
"func",
"(",
"r",
"*",
"symlinkResolver",
")",
"follow",
"(",
"c",
"*",
"config",
".",
"Config",
",",
"dir",
",",
"rel",
",",
"base",
"string",
")",
"bool",
"{",
"if",
"dir",
"==",
"c",
".",
"RepoRoot",
"&&",
"strings",
".",
"HasPrefix",
"(",
"base",
",",
"\"",
"\"",
")",
"{",
"// Links such as bazel-<workspace>, bazel-out, bazel-genfiles are created by",
"// Bazel to point to internal build directories.",
"return",
"false",
"\n",
"}",
"\n\n",
"// See if the user has explicitly directed us to follow the link.",
"wc",
":=",
"getWalkConfig",
"(",
"c",
")",
"\n",
"linkRel",
":=",
"path",
".",
"Join",
"(",
"rel",
",",
"base",
")",
"\n",
"for",
"_",
",",
"follow",
":=",
"range",
"wc",
".",
"follow",
"{",
"if",
"linkRel",
"==",
"follow",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"// See if the symlink points to a tree that has been already visited.",
"fullpath",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"base",
")",
"\n",
"dest",
",",
"err",
":=",
"filepath",
".",
"EvalSymlinks",
"(",
"fullpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"dest",
")",
"{",
"dest",
",",
"err",
"=",
"filepath",
".",
"Abs",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"dest",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"r",
".",
"visited",
"{",
"if",
"pathtools",
".",
"HasPrefix",
"(",
"dest",
",",
"p",
")",
"||",
"pathtools",
".",
"HasPrefix",
"(",
"p",
",",
"<mask>",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"r",
".",
"visited",
"=",
"append",
"(",
"r",
".",
"visited",
",",
"dest",
")",
"\n",
"stat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"fullpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"stat",
".",
"IsDir",
"(",
")",
"\n",
"}"
] |
10,141 | all-10142 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CoverageRange",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler26",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,142 | all-10143 | [
"decideClusterVersion",
"decides",
"the",
"cluster",
"version",
"based",
"on",
"the",
"versions",
"map",
".",
"The",
"returned",
"version",
"is",
"the",
"min",
"server",
"version",
"in",
"the",
"map",
"or",
"nil",
"if",
"the",
"min",
"version",
"in",
"unknown",
"."
] | [
"func",
"decideClusterVersion",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"vers",
"map",
"[",
"string",
"]",
"*",
"<mask>",
".",
"Versions",
")",
"*",
"semver",
".",
"Version",
"{",
"var",
"cv",
"*",
"semver",
".",
"Version",
"\n",
"lv",
":=",
"semver",
".",
"Must",
"(",
"semver",
".",
"NewVersion",
"(",
"version",
".",
"Version",
")",
")",
"\n\n",
"for",
"mid",
",",
"ver",
":=",
"range",
"vers",
"{",
"if",
"ver",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"v",
",",
"err",
":=",
"semver",
".",
"NewVersion",
"(",
"ver",
".",
"Server",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"mid",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"ver",
".",
"Server",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mid",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"lv",
".",
"LessThan",
"(",
"*",
"v",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"lv",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"mid",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"ver",
".",
"Server",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"lv",
".",
"String",
"(",
")",
")",
"\n",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"mid",
",",
"ver",
".",
"Server",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"cv",
"==",
"nil",
"{",
"cv",
"=",
"v",
"\n",
"}",
"else",
"if",
"v",
".",
"LessThan",
"(",
"*",
"cv",
")",
"{",
"cv",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"cv",
"\n",
"}"
] |
10,143 | all-10144 | [
"SetCustomTabLabel",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_custom_tab_label",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintOperation",
")",
"SetCustomTabLabel",
"(",
"label",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_operation_set_custom_tab_label",
"(",
"po",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
10,144 | all-10145 | [
"Stop",
"the",
"backend",
"and",
"shutdown",
"all",
"listeners",
".",
"Does",
"NOT",
"exist",
"the",
"process",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"Stop",
"(",
")",
"error",
"{",
"o",
".",
"cmdCtrlLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"cmdCtrlLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"o",
".",
"stopped",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"close",
"(",
"o",
".",
"ch",
")",
"\n",
"o",
".",
"backend",
".",
"StopListenAndServe",
"(",
")",
"\n",
"o",
".",
"backend",
".",
"Wait",
"(",
")",
"\n",
"o",
".",
"backend",
".",
"Stop",
"(",
")",
"\n",
"o",
".",
"stopped",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,145 | all-10146 | [
"validateLabelsAndMetricName",
"validates",
"the",
"label",
"names",
"/",
"values",
"and",
"metric",
"names",
"returned",
"from",
"remote",
"read",
"."
] | [
"func",
"validateLabelsAndMetricName",
"(",
"ls",
"labels",
".",
"Labels",
")",
"error",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"ls",
"{",
"if",
"l",
".",
"Name",
"==",
"labels",
".",
"MetricName",
"&&",
"!",
"model",
".",
"IsValidMetricName",
"(",
"model",
".",
"LabelValue",
"(",
"l",
".",
"Value",
")",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"Value",
")",
"\n",
"}",
"\n",
"if",
"!",
"model",
".",
"LabelName",
"(",
"l",
".",
"Name",
")",
".",
"IsValid",
"(",
")",
"{",
"return",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"!",
"model",
".",
"LabelValue",
"(",
"l",
".",
"Value",
")",
".",
"IsValid",
"(",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,146 | all-10147 | [
"isEmptyString",
"returns",
"true",
"if",
"n",
"is",
"an",
"empty",
"string",
"literal",
"."
] | [
"func",
"isEmptyString",
"(",
"n",
"ast",
".",
"Expr",
")",
"bool",
"{",
"lit",
",",
"ok",
":=",
"n",
".",
"(",
"*",
"ast",
".",
"BasicLit",
")",
"\n",
"return",
"<mask>",
"&&",
"lit",
".",
"Kind",
"==",
"token",
".",
"STRING",
"&&",
"len",
"(",
"lit",
".",
"Value",
")",
"==",
"2",
"\n",
"}"
] |
10,147 | all-10148 | [
"AddPeer",
"(",
"deprecated",
")",
"is",
"used",
"to",
"add",
"a",
"new",
"peer",
"into",
"the",
"cluster",
".",
"This",
"must",
"be",
"run",
"on",
"the",
"leader",
"or",
"it",
"will",
"fail",
".",
"Use",
"AddVoter",
"/",
"AddNonvoter",
"instead",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"AddPeer",
"(",
"peer",
"ServerAddress",
")",
"<mask>",
"{",
"if",
"r",
".",
"protocolVersion",
">",
"2",
"{",
"return",
"errorFuture",
"{",
"ErrUnsupportedProtocol",
"}",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"requestConfigChange",
"(",
"configurationChangeRequest",
"{",
"command",
":",
"AddStaging",
",",
"serverID",
":",
"ServerID",
"(",
"peer",
")",
",",
"serverAddress",
":",
"peer",
",",
"prevIndex",
":",
"0",
",",
"}",
",",
"0",
")",
"\n",
"}"
] |
10,148 | all-10149 | [
"CreateNic",
"creates",
"a",
"nic",
"on",
"a",
"server"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateNic",
"(",
"dcid",
"string",
",",
"srvid",
"string",
",",
"nic",
"Nic",
")",
"(",
"*",
"Nic",
",",
"error",
")",
"{",
"url",
":=",
"nicColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Nic",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"nic",
",",
"ret",
",",
"<mask>",
".",
"StatusAccepted",
")",
"\n\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
10,149 | all-10150 | [
"TemplateConfigMapping",
"returns",
"a",
"mapping",
"between",
"the",
"template",
"ID",
"and",
"the",
"set",
"of",
"TemplateConfig",
"represented",
"by",
"the",
"template",
"ID"
] | [
"func",
"(",
"r",
"*",
"Runner",
")",
"TemplateConfigMapping",
"(",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"TemplateConfig",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"TemplateConfig",
",",
"len",
"(",
"r",
".",
"ctemplatesMap",
")",
")",
"\n\n",
"for",
"id",
",",
"set",
":=",
"<mask>",
"r",
".",
"ctemplatesMap",
"{",
"ctmpls",
":=",
"make",
"(",
"[",
"]",
"config",
".",
"TemplateConfig",
",",
"len",
"(",
"set",
")",
")",
"\n",
"m",
"[",
"id",
"]",
"=",
"ctmpls",
"\n",
"for",
"i",
",",
"ctmpl",
":=",
"range",
"set",
"{",
"ctmpls",
"[",
"i",
"]",
"=",
"*",
"ctmpl",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"m",
"\n",
"}"
] |
10,150 | all-10151 | [
"ToQuery",
"builds",
"a",
"Query",
"proto",
"."
] | [
"func",
"ToQuery",
"(",
"from",
",",
"to",
"int64",
",",
"matchers",
"[",
"]",
"*",
"labels",
".",
"Matcher",
",",
"p",
"*",
"storage",
".",
"SelectParams",
")",
"(",
"*",
"prompb",
".",
"<mask>",
",",
"error",
")",
"{",
"ms",
",",
"err",
":=",
"toLabelMatchers",
"(",
"matchers",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"rp",
"*",
"prompb",
".",
"ReadHints",
"\n",
"if",
"p",
"!=",
"nil",
"{",
"rp",
"=",
"&",
"prompb",
".",
"ReadHints",
"{",
"StepMs",
":",
"p",
".",
"Step",
",",
"Func",
":",
"p",
".",
"Func",
",",
"StartMs",
":",
"p",
".",
"Start",
",",
"EndMs",
":",
"p",
".",
"End",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"prompb",
".",
"Query",
"{",
"StartTimestampMs",
":",
"from",
",",
"EndTimestampMs",
":",
"to",
",",
"Matchers",
":",
"ms",
",",
"Hints",
":",
"rp",
",",
"}",
",",
"nil",
"\n",
"}"
] |
10,151 | all-10152 | [
"Images",
"returns",
"a",
"list",
"of",
"all",
"the",
"images",
"that",
"are",
"used",
"by",
"a",
"pachyderm",
"deployment",
"."
] | [
"func",
"Images",
"(",
"opts",
"*",
"AssetOpts",
")",
"[",
"]",
"string",
"{",
"return",
"[",
"]",
"<mask>",
"{",
"versionedWorkerImage",
"(",
"opts",
")",
",",
"etcdImage",
",",
"grpcProxyImage",
",",
"pauseImage",
",",
"versionedPachdImage",
"(",
"opts",
")",
",",
"opts",
".",
"DashImage",
",",
"}",
"\n",
"}"
] |
10,152 | all-10153 | [
"flattenVmwareDistributedVirtualSwitchTrunkVlanSpec",
"reads",
"various",
"fields",
"from",
"a",
"VmwareDistributedVirtualSwitchTrunkVlanSpec",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenVmwareDistributedVirtualSwitchTrunkVlanSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"VmwareDistributedVirtualSwitchTrunkVlanSpec",
")",
"error",
"{",
"var",
"s",
"[",
"]",
"<mask>",
"{",
"}",
"\n",
"for",
"_",
",",
"rng",
":=",
"range",
"obj",
".",
"VlanId",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"rng",
".",
"Start",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"rng",
".",
"End",
"\n",
"s",
"=",
"append",
"(",
"s",
",",
"m",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,153 | all-10154 | [
"Chain",
"executes",
"a",
"series",
"of",
"operations",
"in",
"the",
"order",
"provided"
] | [
"func",
"Chain",
"(",
"filters",
"...",
"Op",
")",
"OpFunc",
"{",
"return",
"func",
"(",
"in",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"filters",
"==",
"nil",
"{",
"return",
"in",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"data",
":=",
"in",
"\n",
"for",
"_",
",",
"filter",
":=",
"range",
"filters",
"{",
"data",
",",
"err",
"=",
"<mask>",
".",
"Apply",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
10,154 | all-10155 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetCategoriesParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,155 | all-10156 | [
"expectType",
"checks",
"the",
"type",
"of",
"the",
"node",
"and",
"raises",
"an",
"error",
"if",
"it",
"is",
"not",
"of",
"the",
"expected",
"type",
"."
] | [
"func",
"(",
"p",
"*",
"parser",
")",
"expectType",
"(",
"<mask>",
"Node",
",",
"want",
"ValueType",
",",
"context",
"string",
")",
"{",
"t",
":=",
"p",
".",
"checkType",
"(",
"node",
")",
"\n",
"if",
"t",
"!=",
"want",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"documentedType",
"(",
"want",
")",
",",
"context",
",",
"documentedType",
"(",
"t",
")",
")",
"\n",
"}",
"\n",
"}"
] |
10,156 | all-10157 | [
"AppendEntriesPipeline",
"returns",
"an",
"interface",
"that",
"can",
"be",
"used",
"to",
"pipeline",
"AppendEntries",
"requests",
"."
] | [
"func",
"(",
"i",
"*",
"InmemTransport",
")",
"AppendEntriesPipeline",
"(",
"id",
"ServerID",
",",
"<mask>",
"ServerAddress",
")",
"(",
"AppendPipeline",
",",
"error",
")",
"{",
"i",
".",
"Lock",
"(",
")",
"\n",
"defer",
"i",
".",
"Unlock",
"(",
")",
"\n\n",
"peer",
",",
"ok",
":=",
"i",
".",
"peers",
"[",
"target",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"target",
")",
"\n",
"}",
"\n",
"pipeline",
":=",
"newInmemPipeline",
"(",
"i",
",",
"peer",
",",
"target",
")",
"\n",
"i",
".",
"pipelines",
"=",
"append",
"(",
"i",
".",
"pipelines",
",",
"pipeline",
")",
"\n",
"return",
"pipeline",
",",
"nil",
"\n",
"}"
] |
10,157 | all-10158 | [
"Do",
"executes",
"WebAudio",
".",
"getRealtimeData",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"realtimeData"
] | [
"func",
"(",
"p",
"*",
"GetRealtimeDataParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"realtimeData",
"*",
"ContextRealtimeData",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"GetRealtimeDataReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetRealtimeData",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"RealtimeData",
",",
"nil",
"\n",
"}"
] |
10,158 | all-10159 | [
"ProfileDelete",
"deletes",
"the",
"profile",
"matching",
"the",
"given",
"key",
"parameters",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProfileDelete",
"(",
"project",
"string",
",",
"name",
"string",
")",
"error",
"{",
"stmt",
":=",
"c",
".",
"stmt",
"(",
"profileDelete",
")",
"\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"<mask>",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,159 | all-10160 | [
"Delete",
"a",
"network",
"link",
".",
"This",
"is",
"identical",
"to",
"running",
":",
"ip",
"link",
"del",
"$name"
] | [
"func",
"NetworkLinkDel",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"s",
",",
"err",
":=",
"getNetlinkSocket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"iface",
",",
"err",
":=",
"net",
".",
"InterfaceByName",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"wb",
":=",
"newNetlinkRequest",
"(",
"syscall",
".",
"RTM_DELLINK",
",",
"syscall",
".",
"NLM_F_ACK",
")",
"\n\n",
"msg",
":=",
"newIfInfomsg",
"(",
"syscall",
".",
"AF_UNSPEC",
")",
"\n",
"msg",
".",
"Index",
"=",
"int32",
"(",
"iface",
".",
"Index",
")",
"\n",
"wb",
".",
"AddData",
"(",
"<mask>",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"Send",
"(",
"wb",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"HandleAck",
"(",
"wb",
".",
"Seq",
")",
"\n",
"}"
] |
10,160 | all-10161 | [
"ReplaceAtLineN",
"replaces",
"a",
"number",
"of",
"regular",
"expressions",
"mathed",
"in",
"r",
"for",
"the",
"named",
"file",
"if",
"the",
"line",
"is",
"matched",
"at",
"the",
"first",
"."
] | [
"func",
"ReplaceAtLineN",
"(",
"<mask>",
"string",
",",
"r",
"[",
"]",
"ReplacerAtLine",
",",
"n",
"int",
")",
"error",
"{",
"e",
",",
"err",
":=",
"NewEdit",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"genReplaceAtLine",
"(",
"r",
",",
"n",
")",
"\n",
"err2",
":=",
"e",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"err2",
"\n",
"}"
] |
10,161 | all-10162 | [
"NewInfobloxProvider",
"creates",
"a",
"new",
"Infoblox",
"provider",
"."
] | [
"func",
"NewInfobloxProvider",
"(",
"infobloxConfig",
"InfobloxConfig",
")",
"(",
"*",
"InfobloxProvider",
",",
"error",
")",
"{",
"hostConfig",
":=",
"ibclient",
".",
"HostConfig",
"{",
"Host",
":",
"infobloxConfig",
".",
"Host",
",",
"Port",
":",
"strconv",
".",
"Itoa",
"(",
"infobloxConfig",
".",
"Port",
")",
",",
"Username",
":",
"infobloxConfig",
".",
"Username",
",",
"Password",
":",
"infobloxConfig",
".",
"Password",
",",
"Version",
":",
"infobloxConfig",
".",
"Version",
",",
"}",
"\n\n",
"httpPoolConnections",
":=",
"lookupEnvAtoi",
"(",
"\"",
"\"",
",",
"10",
")",
"\n",
"httpRequestTimeout",
":=",
"lookupEnvAtoi",
"(",
"\"",
"\"",
",",
"60",
")",
"\n\n",
"transportConfig",
":=",
"ibclient",
".",
"NewTransportConfig",
"(",
"strconv",
".",
"FormatBool",
"(",
"infobloxConfig",
".",
"SSLVerify",
")",
",",
"httpRequestTimeout",
",",
"httpPoolConnections",
",",
")",
"\n\n",
"requestBuilder",
":=",
"&",
"ibclient",
".",
"WapiRequestBuilder",
"{",
"}",
"\n",
"requestor",
":=",
"&",
"ibclient",
".",
"WapiHttpRequestor",
"{",
"}",
"\n\n",
"client",
",",
"err",
":=",
"ibclient",
".",
"NewConnector",
"(",
"hostConfig",
",",
"transportConfig",
",",
"requestBuilder",
",",
"requestor",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"provider",
":=",
"&",
"InfobloxProvider",
"{",
"<mask>",
":",
"client",
",",
"domainFilter",
":",
"infobloxConfig",
".",
"DomainFilter",
",",
"zoneIDFilter",
":",
"infobloxConfig",
".",
"ZoneIDFilter",
",",
"dryRun",
":",
"infobloxConfig",
".",
"DryRun",
",",
"view",
":",
"infobloxConfig",
".",
"View",
",",
"}",
"\n\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
10,162 | all-10163 | [
"CustomLogFunc",
"outputs",
"custom",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"CustomLogFunc",
"(",
"<mask>",
"string",
",",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"lv",
":=",
"g",
".",
"TagStringToLevel",
"(",
"level",
")",
"\n",
"if",
"g",
".",
"isModeEnable",
"(",
"lv",
")",
"{",
"return",
"g",
".",
"out",
"(",
"lv",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,163 | all-10164 | [
"BodyBytes",
"sets",
"the",
"request",
"body",
"to",
"the",
"given",
"buffer",
"."
] | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"BodyBytes",
"(",
"body",
"[",
"]",
"byte",
")",
"*",
"RequestBuilder",
"{",
"return",
"r",
".",
"Body",
"(",
"<mask>",
".",
"NewReader",
"(",
"body",
")",
")",
"\n",
"}"
] |
10,164 | all-10165 | [
"PrintFileInfo",
"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",
"PrintFileInfo",
"(",
"w",
"io",
".",
"Writer",
",",
"fileInfo",
"*",
"pfs",
".",
"FileInfo",
",",
"fullTimestamps",
"bool",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"fileInfo",
".",
"File",
".",
"Commit",
".",
"<mask>",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"fileInfo",
".",
"File",
".",
"Path",
")",
"\n",
"if",
"fileInfo",
".",
"FileType",
"==",
"pfs",
".",
"FileType_FILE",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"}",
"\n",
"if",
"fileInfo",
".",
"Committed",
"==",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"}",
"else",
"if",
"fullTimestamps",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"fileInfo",
".",
"Committed",
".",
"String",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pretty",
".",
"Ago",
"(",
"fileInfo",
".",
"Committed",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"units",
".",
"BytesSize",
"(",
"float64",
"(",
"fileInfo",
".",
"SizeBytes",
")",
")",
")",
"\n",
"}"
] |
10,165 | all-10166 | [
"setEnv",
"sets",
"the",
"given",
"environment",
"variable",
"in",
"the",
"app",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"setEnv",
"(",
"env",
"bind",
".",
"EnvVar",
")",
"{",
"if",
"app",
".",
"Env",
"==",
"nil",
"{",
"app",
".",
"Env",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"bind",
".",
"EnvVar",
")",
"\n",
"}",
"\n",
"app",
".",
"Env",
"[",
"env",
".",
"Name",
"]",
"=",
"env",
"\n",
"if",
"env",
".",
"Public",
"{",
"app",
".",
"Log",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"env",
".",
"Name",
",",
"env",
".",
"<mask>",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
10,166 | all-10167 | [
"Extract",
"implements",
"the",
"Extractor",
"interface"
] | [
"func",
"(",
"t",
"*",
"TextMapPropagator",
")",
"Extract",
"(",
"carrier",
"interface",
"{",
"}",
")",
"(",
"MockSpanContext",
",",
"error",
")",
"{",
"reader",
",",
"<mask>",
":=",
"carrier",
".",
"(",
"opentracing",
".",
"TextMapReader",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"emptyContext",
",",
"opentracing",
".",
"ErrInvalidCarrier",
"\n",
"}",
"\n",
"rval",
":=",
"MockSpanContext",
"{",
"0",
",",
"0",
",",
"true",
",",
"nil",
"}",
"\n",
"err",
":=",
"reader",
".",
"ForeachKey",
"(",
"func",
"(",
"key",
",",
"val",
"string",
")",
"error",
"{",
"lowerKey",
":=",
"strings",
".",
"ToLower",
"(",
"key",
")",
"\n",
"switch",
"{",
"case",
"lowerKey",
"==",
"mockTextMapIdsPrefix",
"+",
"\"",
"\"",
":",
"// Ids:",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"rval",
".",
"TraceID",
"=",
"i",
"\n",
"case",
"lowerKey",
"==",
"mockTextMapIdsPrefix",
"+",
"\"",
"\"",
":",
"// Ids:",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"rval",
".",
"SpanID",
"=",
"i",
"\n",
"case",
"lowerKey",
"==",
"mockTextMapIdsPrefix",
"+",
"\"",
"\"",
":",
"b",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"rval",
".",
"Sampled",
"=",
"b",
"\n",
"case",
"strings",
".",
"HasPrefix",
"(",
"lowerKey",
",",
"mockTextMapBaggagePrefix",
")",
":",
"// Baggage:",
"if",
"rval",
".",
"Baggage",
"==",
"nil",
"{",
"rval",
".",
"Baggage",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"safeVal",
":=",
"val",
"\n",
"if",
"t",
".",
"HTTPHeaders",
"{",
"// unescape errors are ignored, nothing can be done",
"if",
"rawVal",
",",
"err",
":=",
"url",
".",
"QueryUnescape",
"(",
"val",
")",
";",
"err",
"==",
"nil",
"{",
"safeVal",
"=",
"rawVal",
"\n",
"}",
"\n",
"}",
"\n",
"rval",
".",
"Baggage",
"[",
"lowerKey",
"[",
"len",
"(",
"mockTextMapBaggagePrefix",
")",
":",
"]",
"]",
"=",
"safeVal",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"rval",
".",
"TraceID",
"==",
"0",
"||",
"rval",
".",
"SpanID",
"==",
"0",
"{",
"return",
"emptyContext",
",",
"opentracing",
".",
"ErrSpanContextNotFound",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"emptyContext",
",",
"err",
"\n",
"}",
"\n",
"return",
"rval",
",",
"nil",
"\n",
"}"
] |
10,167 | all-10168 | [
"DeepCopyInto",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"writing",
"into",
"out",
".",
"in",
"must",
"be",
"non",
"-",
"nil",
"."
] | [
"func",
"(",
"in",
"ProviderSpecific",
")",
"DeepCopyInto",
"(",
"out",
"*",
"ProviderSpecific",
")",
"{",
"{",
"<mask>",
":=",
"&",
"in",
"\n",
"*",
"out",
"=",
"make",
"(",
"ProviderSpecific",
",",
"len",
"(",
"*",
"in",
")",
")",
"\n",
"for",
"key",
",",
"val",
":=",
"range",
"*",
"in",
"{",
"(",
"*",
"out",
")",
"[",
"key",
"]",
"=",
"val",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
10,168 | all-10169 | [
"SetInt64Ptr",
"sets",
"a",
"ResourceData",
"field",
"depending",
"on",
"if",
"an",
"*",
"int64",
"exists",
"or",
"not",
".",
"The",
"field",
"is",
"not",
"set",
"if",
"it",
"s",
"nil",
"."
] | [
"func",
"SetInt64Ptr",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"key",
"string",
",",
"val",
"*",
"int64",
")",
"error",
"{",
"if",
"val",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"err",
":=",
"d",
".",
"Set",
"(",
"<mask>",
",",
"val",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
10,169 | all-10170 | [
"NewString",
"copies",
"a",
"byte",
"slice",
"into",
"the",
"arena",
"and",
"returns",
"it",
"as",
"a",
"string",
".",
"If",
"the",
"arena",
"is",
"full",
"it",
"returns",
"a",
"traditional",
"go",
"string",
"."
] | [
"func",
"(",
"sa",
"*",
"StringArena",
")",
"NewString",
"(",
"b",
"[",
"]",
"byte",
")",
"string",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"len",
"(",
"sa",
".",
"buf",
")",
"+",
"len",
"(",
"b",
")",
">",
"cap",
"(",
"sa",
".",
"buf",
")",
"{",
"return",
"string",
"(",
"b",
")",
"\n",
"}",
"\n",
"start",
":=",
"len",
"(",
"sa",
".",
"buf",
")",
"\n",
"sa",
".",
"buf",
"=",
"append",
"(",
"sa",
".",
"buf",
",",
"b",
"...",
")",
"\n",
"return",
"sa",
".",
"str",
"[",
"<mask>",
":",
"start",
"+",
"len",
"(",
"b",
")",
"]",
"\n",
"}"
] |
10,170 | all-10171 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SignedExchangeSignature",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
10,171 | all-10172 | [
"ReplaceProwJob",
"will",
"replace",
"name",
"with",
"job",
"in",
"the",
"client",
"s",
"specified",
"namespace",
".",
"Analogous",
"to",
"kubectl",
"replace",
"prowjobs",
"/",
"NAME",
"--",
"namespace",
"=",
"client",
".",
"namespace"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReplaceProwJob",
"(",
"name",
"string",
",",
"job",
"prowapi",
".",
"ProwJob",
")",
"(",
"prowapi",
".",
"ProwJob",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"job",
")",
"\n",
"var",
"retJob",
"prowapi",
".",
"ProwJob",
"\n",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPut",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"namespace",
",",
"name",
")",
",",
"requestBody",
":",
"&",
"job",
",",
"}",
",",
"&",
"retJob",
")",
"\n",
"return",
"retJob",
",",
"err",
"\n",
"}"
] |
10,172 | all-10173 | [
"Produce",
"action",
"return",
"type",
"name"
] | [
"func",
"toGoReturnTypeName",
"(",
"name",
"string",
",",
"slice",
"bool",
")",
"string",
"{",
"slicePrefix",
":=",
"\"",
"\"",
"\n",
"if",
"slice",
"{",
"slicePrefix",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"slicePrefix",
",",
"toGoTypeName",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
10,173 | all-10174 | [
"Server",
"is",
"a",
"sentinel",
"option",
"to",
"add",
"server",
"funcs",
".",
"Any",
"server",
"can",
"have",
"a",
"type",
"of",
"func",
"()",
"func",
"()",
"error",
"or",
"func",
"(",
"context",
".",
"Context",
")",
"error",
"."
] | [
"func",
"<mask>",
"(",
"serverFuncs",
"...",
"interface",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"s",
"*",
"Sentinel",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"started",
"{",
"return",
"ErrAlreadyStarted",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"s",
".",
"serverFuncs",
",",
"err",
"=",
"convertAndAppendContextFuncs",
"(",
"s",
".",
"serverFuncs",
",",
"serverFuncs",
"...",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
10,174 | all-10175 | [
"Delete",
"deletes",
"the",
"item",
"for",
"the",
"given",
"key",
".",
"ErrCacheMiss",
"is",
"returned",
"if",
"the",
"specified",
"item",
"can",
"not",
"be",
"found",
".",
"The",
"key",
"must",
"be",
"at",
"most",
"250",
"bytes",
"in",
"length",
"."
] | [
"func",
"Delete",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"string",
")",
"error",
"{",
"return",
"singleError",
"(",
"DeleteMulti",
"(",
"c",
",",
"[",
"]",
"string",
"{",
"<mask>",
"}",
")",
")",
"\n",
"}"
] |
10,175 | all-10176 | [
"map",
"all",
"or",
"part",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store",
"into",
"the",
"client",
"s",
"address",
"space"
] | [
"func",
"MapNamedBufferRange",
"(",
"buffer",
"uint32",
",",
"<mask>",
"int",
",",
"length",
"int",
",",
"access",
"uint32",
")",
"unsafe",
".",
"Pointer",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall6",
"(",
"gpMapNamedBufferRange",
",",
"4",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"length",
")",
",",
"uintptr",
"(",
"access",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"unsafe",
".",
"Pointer",
")",
"(",
"ret",
")",
"\n",
"}"
] |
10,176 | all-10177 | [
"IsMember",
"checks",
"to",
"see",
"if",
"a",
"datastore",
"is",
"a",
"member",
"of",
"the",
"datastore",
"cluster",
"in",
"question",
".",
"This",
"is",
"a",
"pretty",
"basic",
"operation",
"that",
"checks",
"that",
"the",
"parent",
"of",
"the",
"datastore",
"is",
"the",
"StoragePod",
"."
] | [
"func",
"IsMember",
"(",
"pod",
"*",
"object",
".",
"StoragePod",
",",
"ds",
"*",
"object",
".",
"Datastore",
")",
"(",
"bool",
",",
"error",
")",
"{",
"dprops",
",",
"err",
":=",
"datastore",
".",
"Properties",
"(",
"ds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ds",
".",
"Name",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"dprops",
".",
"Parent",
"==",
"nil",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"if",
"*",
"dprops",
".",
"Parent",
"!=",
"pod",
".",
"Reference",
"(",
")",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
10,177 | all-10178 | [
"WriteUint64",
"writes",
"a",
"big",
"endian",
"uint64",
"to",
"the",
"buffer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteUint64",
"(",
"n",
"uint64",
")",
"{",
"if",
"b",
":=",
"w",
".",
"reserve",
"(",
"8",
")",
";",
"b",
"!=",
"nil",
"{",
"<mask>",
".",
"BigEndian",
".",
"PutUint64",
"(",
"b",
",",
"n",
")",
"\n",
"}",
"\n",
"}"
] |
10,178 | all-10179 | [
"Send",
"sends",
"an",
"email",
"message",
"."
] | [
"func",
"Send",
"(",
"c",
"<mask>",
".",
"Context",
",",
"msg",
"*",
"Message",
")",
"error",
"{",
"return",
"send",
"(",
"c",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"}"
] |
10,179 | all-10180 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SearchInResourceParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,180 | all-10181 | [
"Circle",
"draws",
"a",
"circle",
"using",
"a",
"path",
"with",
"center",
"(",
"cx",
"cy",
")",
"and",
"radius"
] | [
"func",
"Circle",
"(",
"<mask>",
"draw2d",
".",
"PathBuilder",
",",
"cx",
",",
"cy",
",",
"radius",
"float64",
")",
"{",
"path",
".",
"ArcTo",
"(",
"cx",
",",
"cy",
",",
"radius",
",",
"radius",
",",
"0",
",",
"-",
"math",
".",
"Pi",
"*",
"2",
")",
"\n",
"path",
".",
"Close",
"(",
")",
"\n",
"}"
] |
10,181 | all-10182 | [
"findSpliceForLevel",
"returns",
"(",
"outBefore",
"outAfter",
")",
"with",
"outBefore",
".",
"key",
"<",
"=",
"key",
"<",
"=",
"outAfter",
".",
"key",
".",
"The",
"input",
"before",
"tells",
"us",
"where",
"to",
"start",
"looking",
".",
"If",
"we",
"found",
"a",
"node",
"with",
"the",
"same",
"key",
"then",
"we",
"return",
"outBefore",
"=",
"outAfter",
".",
"Otherwise",
"outBefore",
".",
"key",
"<",
"key",
"<",
"outAfter",
".",
"key",
"."
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"findSpliceForLevel",
"(",
"key",
"[",
"]",
"byte",
",",
"before",
"*",
"node",
",",
"level",
"int",
")",
"(",
"*",
"node",
",",
"*",
"node",
")",
"{",
"for",
"{",
"// Assume before.key < key.",
"next",
":=",
"s",
".",
"getNext",
"(",
"before",
",",
"level",
")",
"\n",
"if",
"next",
"==",
"nil",
"{",
"return",
"before",
",",
"next",
"\n",
"}",
"\n",
"nextKey",
":=",
"next",
".",
"key",
"(",
"s",
".",
"arena",
")",
"\n",
"cmp",
":=",
"y",
".",
"CompareKeys",
"(",
"key",
",",
"nextKey",
")",
"\n",
"if",
"cmp",
"==",
"0",
"{",
"// Equality case.",
"return",
"next",
",",
"next",
"\n",
"}",
"\n",
"if",
"cmp",
"<",
"0",
"{",
"// before.key < key < next.key. We are done for this level.",
"return",
"<mask>",
",",
"next",
"\n",
"}",
"\n",
"before",
"=",
"next",
"// Keep moving right on this level.",
"\n",
"}",
"\n",
"}"
] |
10,182 | all-10183 | [
"expandHostPortGroupSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"HostPortGroupSpec",
"."
] | [
"func",
"expandHostPortGroupSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"HostPortGroupSpec",
"{",
"obj",
":=",
"&",
"types",
".",
"HostPortGroupSpec",
"{",
"<mask>",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"VlanId",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"VswitchName",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Policy",
":",
"*",
"expandHostNetworkPolicy",
"(",
"d",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
10,183 | all-10184 | [
"NewProcessor",
"creates",
"a",
"new",
"processor",
"."
] | [
"func",
"NewProcessor",
"(",
"conf",
"*",
"Config",
",",
"<mask>",
"*",
"reform",
".",
"DB",
",",
"queue",
"job",
".",
"Queue",
")",
"*",
"Processor",
"{",
"return",
"&",
"Processor",
"{",
"conf",
":",
"conf",
",",
"db",
":",
"db",
",",
"queue",
":",
"queue",
",",
"}",
"\n",
"}"
] |
10,184 | all-10185 | [
"startIdleSweep",
"starts",
"a",
"poller",
"that",
"checks",
"for",
"idle",
"connections",
"at",
"given",
"intervals",
"."
] | [
"func",
"startIdleSweep",
"(",
"ch",
"*",
"<mask>",
",",
"opts",
"*",
"ChannelOptions",
")",
"*",
"idleSweep",
"{",
"is",
":=",
"&",
"idleSweep",
"{",
"ch",
":",
"ch",
",",
"maxIdleTime",
":",
"opts",
".",
"MaxIdleTime",
",",
"idleCheckInterval",
":",
"opts",
".",
"IdleCheckInterval",
",",
"}",
"\n\n",
"is",
".",
"start",
"(",
")",
"\n",
"return",
"is",
"\n",
"}"
] |
10,185 | all-10186 | [
"ToSSN",
"will",
"format",
"the",
"provided",
"string",
"as",
"a",
"SSN",
"."
] | [
"func",
"ToSSN",
"(",
"theString",
",",
"delimiter",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
":=",
"New",
"(",
"theString",
")",
"\n",
"f",
".",
"removeNonDigits",
"(",
")",
"\n\n",
"if",
"f",
".",
"length",
"!=",
"9",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"count",
":=",
"0",
"\n\n",
"for",
"_",
",",
"i",
":=",
"range",
"f",
".",
"theString",
"{",
"count",
"++",
"\n\n",
"buffer",
".",
"WriteString",
"(",
"string",
"(",
"i",
")",
")",
"\n\n",
"if",
"count",
"==",
"3",
"||",
"count",
"==",
"5",
"{",
"buffer",
".",
"WriteString",
"(",
"delimiter",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
10,186 | all-10187 | [
"swapSCSIDevice",
"swaps",
"out",
"the",
"supplied",
"controller",
"for",
"a",
"new",
"one",
"of",
"the",
"supplied",
"controller",
"type",
".",
"Any",
"connected",
"devices",
"are",
"re",
"-",
"connected",
"at",
"the",
"same",
"device",
"units",
"on",
"the",
"new",
"device",
".",
"A",
"list",
"of",
"changes",
"is",
"returned",
"."
] | [
"func",
"swapSCSIDevice",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"device",
"types",
".",
"BaseVirtualSCSIController",
",",
"ct",
"string",
",",
"st",
"string",
")",
"(",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"ct",
",",
"l",
".",
"Name",
"(",
"device",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
")",
"\n",
"var",
"<mask>",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n",
"bvd",
":=",
"device",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
"\n",
"cspec",
",",
"err",
":=",
"object",
".",
"VirtualDeviceList",
"{",
"bvd",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationRemove",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n\n",
"nsd",
",",
"err",
":=",
"l",
".",
"CreateSCSIController",
"(",
"ct",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"nsd",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"SharedBus",
"=",
"types",
".",
"VirtualSCSISharing",
"(",
"st",
")",
"\n",
"nsd",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"=",
"device",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"\n",
"cspec",
",",
"err",
"=",
"object",
".",
"VirtualDeviceList",
"{",
"nsd",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationAdd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"ockey",
":=",
"device",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"Key",
"\n",
"nckey",
":=",
"nsd",
".",
"GetVirtualDevice",
"(",
")",
".",
"Key",
"\n",
"for",
"_",
",",
"vd",
":=",
"range",
"l",
"{",
"if",
"vd",
".",
"GetVirtualDevice",
"(",
")",
".",
"ControllerKey",
"==",
"ockey",
"{",
"vd",
".",
"GetVirtualDevice",
"(",
")",
".",
"ControllerKey",
"=",
"nckey",
"\n",
"cspec",
",",
"err",
":=",
"object",
".",
"VirtualDeviceList",
"{",
"vd",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationEdit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"cspec",
")",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"cspec",
")",
")",
"\n",
"}",
"\n",
"// Clear the file operation",
"cspec",
"[",
"0",
"]",
".",
"GetVirtualDeviceConfigSpec",
"(",
")",
".",
"FileOperation",
"=",
"\"",
"\"",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
] |
10,187 | all-10188 | [
"GetMenuLabel",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_get_menu_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"GetMenuLabel",
"(",
"<mask>",
"IWidget",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_notebook_get_menu_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
10,188 | all-10189 | [
"Do",
"executes",
"BackgroundService",
".",
"clearEvents",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ClearEventsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandClearEvents",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
10,189 | all-10190 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetBrowserContextsReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,190 | all-10191 | [
"Format",
"formats",
"the",
"node",
"."
] | [
"func",
"(",
"node",
"*",
"ShowFilter",
")",
"Format",
"(",
"buf",
"*",
"TrackedBuffer",
")",
"{",
"if",
"node",
".",
"Like",
"!=",
"\"",
"\"",
"{",
"buf",
".",
"Myprintf",
"(",
"\"",
"\"",
",",
"node",
".",
"Like",
")",
"\n",
"}",
"else",
"{",
"buf",
".",
"Myprintf",
"(",
"\"",
"\"",
",",
"node",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
] |
10,191 | all-10192 | [
"Update",
"updates",
"the",
"inner",
"clock",
"state",
"and",
"returns",
"an",
"integer",
"value",
"indicating",
"how",
"many",
"times",
"the",
"game",
"should",
"update",
"based",
"on",
"given",
"tps",
".",
"tps",
"represents",
"TPS",
"(",
"ticks",
"per",
"second",
")",
".",
"If",
"tps",
"is",
"UncappedTPS",
"Update",
"always",
"returns",
"1",
".",
"If",
"tps",
"<",
"=",
"0",
"and",
"not",
"UncappedTPS",
"Update",
"always",
"returns",
"0",
".",
"Update",
"is",
"expected",
"to",
"be",
"called",
"per",
"frame",
"."
] | [
"func",
"Update",
"(",
"tps",
"int",
")",
"int",
"{",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"n",
":=",
"<mask>",
"(",
")",
"\n",
"c",
":=",
"0",
"\n",
"if",
"tps",
"==",
"UncappedTPS",
"{",
"c",
"=",
"1",
"\n",
"}",
"else",
"if",
"tps",
">",
"0",
"{",
"c",
"=",
"calcCountFromTPS",
"(",
"int64",
"(",
"tps",
")",
",",
"n",
")",
"\n",
"}",
"\n",
"updateFPSAndTPS",
"(",
"n",
",",
"c",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
10,192 | all-10193 | [
"NewPeer",
"returns",
"a",
"Peer",
"which",
"can",
"be",
"used",
"as",
"a",
"net",
".",
"PacketConn",
".",
"Clients",
"must",
"Register",
"a",
"mesh",
".",
"Gossip",
"before",
"calling",
"ReadFrom",
"or",
"WriteTo",
".",
"Clients",
"should",
"aggressively",
"consume",
"from",
"ReadFrom",
"."
] | [
"func",
"NewPeer",
"(",
"name",
"mesh",
".",
"PeerName",
",",
"uid",
"mesh",
".",
"PeerUID",
",",
"logger",
"mesh",
".",
"Logger",
")",
"*",
"Peer",
"{",
"p",
":=",
"&",
"Peer",
"{",
"<mask>",
":",
"name",
",",
"uid",
":",
"uid",
",",
"gossip",
":",
"nil",
",",
"// initially no gossip",
"recv",
":",
"make",
"(",
"chan",
"pkt",
")",
",",
"actions",
":",
"make",
"(",
"chan",
"func",
"(",
")",
")",
",",
"quit",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"logger",
":",
"logger",
",",
"}",
"\n",
"go",
"p",
".",
"loop",
"(",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
10,193 | all-10194 | [
"ExperimentalReplayImport",
"takes",
"a",
"data",
"stream",
"which",
"was",
"previously",
"recorded",
"by",
"the",
"import",
"logging",
"functionality",
"and",
"imports",
"it",
"to",
"Pilosa",
".",
"The",
"target",
"cluster",
"need",
"not",
"be",
"of",
"the",
"same",
"size",
"as",
"the",
"original",
"cluster",
"but",
"it",
"must",
"already",
"have",
"the",
"necessary",
"schema",
"in",
"place",
".",
"It",
"is",
"an",
"experimental",
"method",
"and",
"may",
"be",
"changed",
"or",
"removed",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ExperimentalReplayImport",
"(",
"r",
"io",
".",
"Reader",
",",
"concurrency",
"int",
")",
"error",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"// make work channel",
"work",
":=",
"make",
"(",
"chan",
"*",
"importLog",
",",
"concurrency",
"*",
"2",
")",
"\n\n",
"// spawn <concurrency> workers to read from channel",
"eg",
":=",
"&",
"errgroup",
".",
"Group",
"{",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"concurrency",
";",
"i",
"++",
"{",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"error",
"{",
"for",
"log",
":=",
"range",
"work",
"{",
"// regular import doesn't forward to replicas, so we have to get all",
"// the nodes.",
"nodes",
",",
"err",
":=",
"c",
".",
"fetchFragmentNodes",
"(",
"log",
".",
"Index",
",",
"log",
".",
"Shard",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"log",
".",
"IsRoaring",
"{",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"doRequest",
"(",
"node",
".",
"URI",
"(",
")",
",",
"\"",
"\"",
",",
"log",
".",
"<mask>",
",",
"defaultProtobufHeaders",
"(",
")",
",",
"bytes",
".",
"NewReader",
"(",
"log",
".",
"Data",
")",
")",
"\n",
"if",
"err",
"=",
"anyError",
"(",
"resp",
",",
"err",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// import-roaring forwards on to all replicas, so we only import to",
"// one node.",
"resp",
",",
"err",
":=",
"c",
".",
"doRequest",
"(",
"nodes",
"[",
"0",
"]",
".",
"URI",
"(",
")",
",",
"\"",
"\"",
",",
"log",
".",
"Path",
",",
"defaultProtobufHeaders",
"(",
")",
",",
"bytes",
".",
"NewReader",
"(",
"log",
".",
"Data",
")",
")",
"\n",
"if",
"err",
"=",
"anyError",
"(",
"resp",
",",
"err",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
"\n\n",
"// wait on importers asynchronously in case they return early with errors",
"waitErrCh",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"waitErrCh",
"<-",
"eg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"waitErrCh",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// populate work channel",
"dec",
":=",
"newImportLogDecoder",
"(",
"r",
")",
"\n",
"var",
"err",
"error",
"\n",
"for",
"{",
"log",
":=",
"importLog",
"{",
"}",
"\n",
"err",
"=",
"dec",
".",
"Decode",
"(",
"&",
"log",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"break",
"\n",
"}",
"\n",
"select",
"{",
"case",
"work",
"<-",
"&",
"log",
":",
"continue",
"\n",
"case",
"err",
"=",
"<-",
"waitErrCh",
":",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n\n",
"// close work channel (now workers can exit)",
"close",
"(",
"work",
")",
"\n",
"<-",
"waitErrCh",
"// make sure workers are complete",
"\n",
"if",
"errors",
".",
"Cause",
"(",
"err",
")",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
10,194 | all-10195 | [
"cause",
"a",
"material",
"color",
"to",
"track",
"the",
"current",
"color"
] | [
"func",
"ColorMaterial",
"(",
"face",
"uint32",
",",
"mode",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpColorMaterial",
",",
"2",
",",
"uintptr",
"(",
"face",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
")",
"\n",
"}"
] |
10,195 | all-10196 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"get",
"apps",
"app",
"routes",
"params"
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"GetAppsAppRoutesParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
10,196 | all-10197 | [
"define",
"an",
"array",
"of",
"fog",
"coordinates"
] | [
"func",
"FogCoordPointer",
"(",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowFogCoordPointer",
"(",
"gpFogCoordPointer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
10,197 | all-10198 | [
"StorageVolumeIsAvailable",
"checks",
"that",
"if",
"a",
"custom",
"volume",
"available",
"for",
"being",
"attached",
".",
"Always",
"return",
"true",
"for",
"non",
"-",
"Ceph",
"volumes",
".",
"For",
"Ceph",
"volumes",
"return",
"true",
"if",
"the",
"volume",
"is",
"either",
"not",
"attached",
"to",
"any",
"other",
"container",
"or",
"attached",
"to",
"containers",
"on",
"this",
"node",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StorageVolumeIsAvailable",
"(",
"pool",
",",
"volume",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"isAvailable",
":=",
"false",
"\n\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"id",
",",
"err",
":=",
"tx",
".",
"StoragePoolID",
"(",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"pool",
")",
"\n",
"}",
"\n\n",
"driver",
",",
"err",
":=",
"tx",
".",
"StoragePoolDriver",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"pool",
")",
"\n",
"}",
"\n\n",
"if",
"driver",
"!=",
"\"",
"\"",
"{",
"isAvailable",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"node",
",",
"err",
":=",
"tx",
".",
"NodeName",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"containers",
",",
"err",
":=",
"tx",
".",
"ContainerListExpanded",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"container",
":=",
"range",
"containers",
"{",
"for",
"_",
",",
"device",
":=",
"range",
"<mask>",
".",
"Devices",
"{",
"if",
"device",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"device",
"[",
"\"",
"\"",
"]",
"!=",
"pool",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"device",
"[",
"\"",
"\"",
"]",
"!=",
"volume",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"container",
".",
"Node",
"!=",
"node",
"{",
"// This ceph volume is already attached",
"// to a container on a different node.",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"isAvailable",
"=",
"true",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"isAvailable",
",",
"nil",
"\n",
"}"
] |
10,198 | all-10199 | [
"ValidateTaskENI",
"validates",
"the",
"eni",
"informaiton",
"sent",
"from",
"acs"
] | [
"func",
"ValidateTaskENI",
"(",
"acsenis",
"[",
"]",
"*",
"ecsacs",
".",
"ElasticNetworkInterface",
")",
"error",
"{",
"// Only one eni should be associated with the task",
"// Only one ipv4 should be associated with the eni",
"// No more than one ipv6 should be associated with the eni",
"if",
"len",
"(",
"acsenis",
")",
"!=",
"1",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"acsenis",
")",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"acsenis",
"[",
"0",
"]",
".",
"Ipv4Addresses",
")",
"!=",
"1",
"{",
"return",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"acsenis",
"[",
"0",
"]",
".",
"Ipv4Addresses",
")",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"acsenis",
"[",
"0",
"]",
".",
"Ipv6Addresses",
")",
">",
"1",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"acsenis",
"[",
"0",
"]",
".",
"Ipv6Addresses",
")",
")",
"\n",
"}",
"\n\n",
"if",
"acsenis",
"[",
"0",
"]",
".",
"MacAddress",
"==",
"nil",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"acsenis",
"[",
"0",
"]",
".",
"Ec2Id",
"==",
"nil",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,199 | all-10200 | [
"retrieve",
"a",
"named",
"parameter",
"from",
"a",
"framebuffer"
] | [
"func",
"GetFramebufferParameteriv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"C",
".",
"glowGetFramebufferParameteriv",
"(",
"gpGetFramebufferParameteriv",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.