id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
20,000 | all-20001 | [
"FindIndex",
"accepts",
"a",
"JSON",
"array",
"and",
"return",
"the",
"value",
"of",
"the",
"element",
"at",
"the",
"specified",
"index"
]
| [
"func",
"FindIndex",
"(",
"in",
"[",
"]",
"byte",
",",
"pos",
",",
"index",
"int",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pos",
",",
"err",
":=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"v",
":=",
"in",
"[",
"pos",
"]",
";",
"v",
"!=",
"'['",
"{",
"return",
"nil",
",",
"newError",
"(",
"pos",
",",
"v",
")",
"\n",
"}",
"\n",
"pos",
"++",
"\n\n",
"idx",
":=",
"0",
"\n",
"for",
"{",
"<mask>",
",",
"err",
"=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"itemStart",
":=",
"pos",
"\n",
"// data",
"pos",
",",
"err",
"=",
"Any",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"index",
"==",
"idx",
"{",
"return",
"in",
"[",
"itemStart",
":",
"pos",
"]",
",",
"nil",
"\n",
"}",
"\n\n",
"pos",
",",
"err",
"=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"switch",
"in",
"[",
"pos",
"]",
"{",
"case",
"','",
":",
"pos",
"++",
"\n",
"case",
"']'",
":",
"return",
"nil",
",",
"errIndexOutOfBounds",
"\n",
"}",
"\n\n",
"idx",
"++",
"\n",
"}",
"\n",
"}"
]
|
20,001 | all-20002 | [
"title",
":",
"service",
"instance",
"status",
"path",
":",
"/",
"services",
"/",
"{",
"service",
"}",
"/",
"instances",
"/",
"{",
"instance",
"}",
"/",
"status",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"List",
"services",
"instances",
"401",
":",
"Unauthorized",
"404",
":",
"Service",
"instance",
"not",
"found"
]
| [
"func",
"serviceInstanceStatus",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"instanceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"serviceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"serviceInstance",
",",
"err",
":=",
"getServiceInstanceOrError",
"(",
"serviceName",
",",
"instanceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceInstanceReadStatus",
",",
"contextsForServiceInstance",
"(",
"serviceInstance",
",",
"serviceName",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"b",
"string",
"\n",
"requestID",
":=",
"requestIDHeader",
"(",
"r",
")",
"\n",
"if",
"b",
",",
"err",
"=",
"serviceInstance",
".",
"Status",
"(",
"requestID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"`Service instance \"%s\" is %s`",
",",
"instanceName",
",",
"b",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,002 | all-20003 | [
"New",
"ValidationError",
".",
"New"
]
| [
"func",
"(",
"e",
"*",
"ValidationError",
")",
"New",
"(",
"message",
"string",
")",
"*",
"ValidationError",
"{",
"e",
".",
"HTTPCode",
"=",
"<mask>",
".",
"StatusBadRequest",
"\n",
"e",
".",
"Errno",
"=",
"0",
"\n",
"e",
".",
"Message",
"=",
"message",
"\n",
"return",
"e",
"\n",
"}"
]
|
20,003 | all-20004 | [
"SaveUser",
"adds",
"a",
"new",
"user",
"replacing",
"if",
"the",
"same",
"username",
"is",
"in",
"use",
"."
]
| [
"func",
"(",
"m",
"MongoDb",
")",
"SaveUser",
"(",
"user",
"models",
".",
"User",
")",
"error",
"{",
"c",
":=",
"m",
".",
"Connect",
"(",
"models",
".",
"COLL_NAME_USER",
")",
"\n",
"defer",
"m",
".",
"Close",
"(",
"c",
")",
"\n\n",
"_",
",",
"err",
":=",
"c",
".",
"Upsert",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"user",
".",
"Username",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"user",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Get",
"(",
")",
".",
"Error",
"(",
"\"",
"\"",
",",
"user",
".",
"Username",
",",
"err",
")",
"\n",
"return",
"mkmgoerror",
"(",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,004 | all-20005 | [
"Stop",
"stops",
"sending",
"samples",
"to",
"the",
"remote",
"storage",
"and",
"waits",
"for",
"pending",
"sends",
"to",
"complete",
"."
]
| [
"func",
"(",
"t",
"*",
"QueueManager",
")",
"Stop",
"(",
")",
"{",
"level",
".",
"Info",
"(",
"t",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"defer",
"level",
".",
"Info",
"(",
"t",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"close",
"(",
"t",
".",
"quit",
")",
"\n",
"t",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"// Wait for all QueueManager routines to end before stopping shards and WAL watcher. This",
"// is to ensure we don't end up executing a reshard and shards.stop() at the same time, which",
"// causes a closed channel panic.",
"t",
".",
"shards",
".",
"stop",
"(",
")",
"\n",
"t",
".",
"watcher",
".",
"Stop",
"(",
")",
"\n\n",
"// On shutdown, release the strings in the labels from the intern pool.",
"t",
".",
"seriesMtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"seriesMtx",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"labels",
":=",
"range",
"t",
".",
"seriesLabels",
"{",
"<mask>",
"(",
"labels",
")",
"\n",
"}",
"\n",
"// Delete metrics so we don't have alerts for queues that are gone.",
"name",
":=",
"t",
".",
"client",
".",
"Name",
"(",
")",
"\n",
"queueHighestSentTimestamp",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"queuePendingSamples",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"enqueueRetriesTotal",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"droppedSamplesTotal",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"numShards",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"failedSamplesTotal",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"sentBatchDuration",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"succeededSamplesTotal",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"retriedSamplesTotal",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"shardCapacity",
".",
"DeleteLabelValues",
"(",
"name",
")",
"\n",
"}"
]
|
20,005 | all-20006 | [
"GetAll",
"runs",
"the",
"query",
"in",
"the",
"given",
"context",
"and",
"returns",
"all",
"keys",
"that",
"match",
"that",
"query",
"as",
"well",
"as",
"appending",
"the",
"values",
"to",
"dst",
".",
"dst",
"must",
"have",
"type",
"*",
"[]",
"S",
"or",
"*",
"[]",
"*",
"S",
"or",
"*",
"[]",
"P",
"for",
"some",
"struct",
"type",
"S",
"or",
"some",
"non",
"-",
"interface",
"non",
"-",
"pointer",
"type",
"P",
"such",
"that",
"P",
"or",
"*",
"P",
"implements",
"PropertyLoadSaver",
".",
"As",
"a",
"special",
"case",
"*",
"PropertyList",
"is",
"an",
"invalid",
"type",
"for",
"dst",
"even",
"though",
"a",
"PropertyList",
"is",
"a",
"slice",
"of",
"structs",
".",
"It",
"is",
"treated",
"as",
"invalid",
"to",
"avoid",
"being",
"mistakenly",
"passed",
"when",
"*",
"[]",
"PropertyList",
"was",
"intended",
".",
"The",
"keys",
"returned",
"by",
"GetAll",
"will",
"be",
"in",
"a",
"1",
"-",
"1",
"correspondence",
"with",
"the",
"entities",
"added",
"to",
"dst",
".",
"If",
"q",
"is",
"a",
"keys",
"-",
"only",
"query",
"GetAll",
"ignores",
"dst",
"and",
"only",
"returns",
"the",
"keys",
".",
"The",
"running",
"time",
"and",
"number",
"of",
"API",
"calls",
"made",
"by",
"GetAll",
"scale",
"linearly",
"with",
"the",
"sum",
"of",
"the",
"query",
"s",
"offset",
"and",
"limit",
".",
"Unless",
"the",
"result",
"count",
"is",
"expected",
"to",
"be",
"small",
"it",
"is",
"best",
"to",
"specify",
"a",
"limit",
";",
"otherwise",
"GetAll",
"will",
"continue",
"until",
"it",
"finishes",
"collecting",
"results",
"or",
"the",
"provided",
"context",
"expires",
"."
]
| [
"func",
"(",
"q",
"*",
"Query",
")",
"GetAll",
"(",
"c",
"context",
".",
"Context",
",",
"dst",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"Key",
",",
"error",
")",
"{",
"var",
"(",
"dv",
"reflect",
".",
"Value",
"\n",
"mat",
"multiArgType",
"\n",
"elemType",
"reflect",
".",
"Type",
"\n",
"errFieldMismatch",
"error",
"\n",
")",
"\n",
"if",
"!",
"q",
".",
"keysOnly",
"{",
"dv",
"=",
"reflect",
".",
"ValueOf",
"(",
"dst",
")",
"\n",
"if",
"dv",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"||",
"dv",
".",
"IsNil",
"(",
")",
"{",
"return",
"nil",
",",
"ErrInvalidEntityType",
"\n",
"}",
"\n",
"dv",
"=",
"dv",
".",
"Elem",
"(",
")",
"\n",
"mat",
",",
"elemType",
"=",
"checkMultiArg",
"(",
"dv",
")",
"\n",
"if",
"mat",
"==",
"multiArgTypeInvalid",
"||",
"mat",
"==",
"multiArgTypeInterface",
"{",
"return",
"nil",
",",
"ErrInvalidEntityType",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"keys",
"[",
"]",
"*",
"<mask>",
"\n",
"for",
"t",
":=",
"q",
".",
"Run",
"(",
"c",
")",
";",
";",
"{",
"k",
",",
"e",
",",
"err",
":=",
"t",
".",
"next",
"(",
")",
"\n",
"if",
"err",
"==",
"Done",
"{",
"break",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"keys",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"q",
".",
"keysOnly",
"{",
"ev",
":=",
"reflect",
".",
"New",
"(",
"elemType",
")",
"\n",
"if",
"elemType",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Map",
"{",
"// This is a special case. The zero values of a map type are",
"// not immediately useful; they have to be make'd.",
"//",
"// Funcs and channels are similar, in that a zero value is not useful,",
"// but even a freshly make'd channel isn't useful: there's no fixed",
"// channel buffer size that is always going to be large enough, and",
"// there's no goroutine to drain the other end. Theoretically, these",
"// types could be supported, for example by sniffing for a constructor",
"// method or requiring prior registration, but for now it's not a",
"// frequent enough concern to be worth it. Programmers can work around",
"// it by explicitly using Iterator.Next instead of the Query.GetAll",
"// convenience method.",
"x",
":=",
"reflect",
".",
"MakeMap",
"(",
"elemType",
")",
"\n",
"ev",
".",
"Elem",
"(",
")",
".",
"Set",
"(",
"x",
")",
"\n",
"}",
"\n",
"if",
"err",
"=",
"loadEntity",
"(",
"ev",
".",
"Interface",
"(",
")",
",",
"e",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"ErrFieldMismatch",
")",
";",
"ok",
"{",
"// We continue loading entities even in the face of field mismatch errors.",
"// If we encounter any other error, that other error is returned. Otherwise,",
"// an ErrFieldMismatch is returned.",
"errFieldMismatch",
"=",
"err",
"\n",
"}",
"else",
"{",
"return",
"keys",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"mat",
"!=",
"multiArgTypeStructPtr",
"{",
"ev",
"=",
"ev",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"dv",
".",
"Set",
"(",
"reflect",
".",
"Append",
"(",
"dv",
",",
"ev",
")",
")",
"\n",
"}",
"\n",
"keys",
"=",
"append",
"(",
"keys",
",",
"k",
")",
"\n",
"}",
"\n",
"return",
"keys",
",",
"errFieldMismatch",
"\n",
"}"
]
|
20,006 | all-20007 | [
"Mutate",
"executes",
"a",
"single",
"GraphQL",
"mutation",
"request",
"with",
"a",
"mutation",
"derived",
"from",
"m",
"populating",
"the",
"response",
"into",
"it",
".",
"m",
"should",
"be",
"a",
"pointer",
"to",
"struct",
"that",
"corresponds",
"to",
"the",
"GitHub",
"GraphQL",
"schema",
".",
"Provided",
"input",
"will",
"be",
"set",
"as",
"a",
"variable",
"named",
"input",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Mutate",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"interface",
"{",
"}",
",",
"input",
"<mask>",
",",
"variables",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"variables",
"==",
"nil",
"{",
"variables",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"input",
"}",
"\n",
"}",
"else",
"{",
"variables",
"[",
"\"",
"\"",
"]",
"=",
"input",
"\n",
"}",
"\n",
"return",
"c",
".",
"client",
".",
"Mutate",
"(",
"ctx",
",",
"m",
",",
"variables",
")",
"\n",
"}"
]
|
20,007 | all-20008 | [
"HasProjectID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationGCP",
")",
"HasProjectID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ProjectID",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
20,008 | all-20009 | [
"PutSecretValue",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"PutSecretValue",
"(",
"arg0",
"*",
"secretsmanager",
".",
"PutSecretValueInput",
")",
"(",
"*",
"secretsmanager",
".",
"PutSecretValueOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"PutSecretValueOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
20,009 | all-20010 | [
"IsEquivalent",
"returns",
"true",
"if",
"other",
"represents",
"the",
"same",
"data",
"type",
"as",
"the",
"target",
"."
]
| [
"func",
"(",
"p",
"*",
"ActionParam",
")",
"IsEquivalent",
"(",
"other",
"*",
"ActionParam",
")",
"bool",
"{",
"return",
"p",
".",
"Name",
"==",
"other",
".",
"<mask>",
"&&",
"p",
".",
"Type",
".",
"IsEquivalent",
"(",
"other",
".",
"Type",
")",
"\n",
"}"
]
|
20,010 | all-20011 | [
"MakeBuf",
"creates",
"an",
"action",
"buffer"
]
| [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"MakeBuf",
"(",
")",
"*",
"ActionBuffer",
"{",
"return",
"&",
"ActionBuffer",
"{",
"preds",
":",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"MaxLevel",
"+",
"1",
")",
",",
"succs",
":",
"make",
"(",
"[",
"]",
"*",
"<mask>",
",",
"MaxLevel",
"+",
"1",
")",
",",
"}",
"\n",
"}"
]
|
20,011 | all-20012 | [
"New",
"--",
"return",
"a",
"new",
"SKU",
"provider"
]
| [
"func",
"(",
"s",
"*",
"SkuM1SmallBuilder",
")",
"New",
"(",
"tm",
"skurepo",
".",
"TaskManager",
",",
"meta",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"skurepo",
".",
"Sku",
"{",
"var",
"procurementMeta",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"var",
"userIdentifier",
"string",
"\n\n",
"if",
"meta",
"!=",
"nil",
"{",
"if",
"v",
",",
"ok",
":=",
"meta",
"[",
"procurementMetaFieldName",
"]",
";",
"ok",
"{",
"procurementMeta",
"=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n\n",
"if",
"v",
",",
"<mask>",
":=",
"meta",
"[",
"userIdentifierMetaFieldName",
"]",
";",
"ok",
"{",
"userIdentifier",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"SkuM1Small",
"{",
"Client",
":",
"s",
".",
"Client",
",",
"ProcurementMeta",
":",
"procurementMeta",
",",
"TaskManager",
":",
"tm",
",",
"UserIdentifier",
":",
"userIdentifier",
",",
"}",
"\n",
"}"
]
|
20,012 | all-20013 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"WebSocketFrame",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
20,013 | all-20014 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventContextDestroyed",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,014 | all-20015 | [
"Unmarshal",
"message",
"from",
"byte",
"array",
"."
]
| [
"func",
"Unmarshal",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"<mask>",
"msg",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"msg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"msg",
",",
"nil",
"\n",
"}"
]
|
20,015 | all-20016 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"StreamCompression",
")",
"UnmarshalEasyJSON",
"(",
"<mask>",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"StreamCompression",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"StreamCompressionNone",
":",
"*",
"t",
"=",
"StreamCompressionNone",
"\n",
"case",
"StreamCompressionGzip",
":",
"*",
"t",
"=",
"StreamCompressionGzip",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
20,016 | all-20017 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"ClearDeviceMetricsOverrideParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation19",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
20,017 | all-20018 | [
"doHttp",
"uses",
"the",
"clients",
"internal",
"TLS",
"configuration",
"for",
"doing",
"the",
"provided",
"HTTP",
"request",
".",
"It",
"returns",
"the",
"response",
"and",
"an",
"error",
"on",
"failure",
"."
]
| [
"func",
"(",
"c",
"*",
"dockerClient",
")",
"doHTTP",
"(",
"req",
"*",
"<mask>",
".",
"Request",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"tr",
":=",
"tlsclientconfig",
".",
"NewTransport",
"(",
")",
"\n",
"tr",
".",
"TLSClientConfig",
"=",
"c",
".",
"tlsClientConfig",
"\n",
"httpClient",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"tr",
"}",
"\n",
"return",
"httpClient",
".",
"Do",
"(",
"req",
")",
"\n",
"}"
]
|
20,018 | all-20019 | [
"NewRunner",
"accepts",
"a",
"slice",
"of",
"TemplateConfigs",
"and",
"returns",
"a",
"pointer",
"to",
"the",
"new",
"Runner",
"and",
"any",
"error",
"that",
"occurred",
"during",
"creation",
"."
]
| [
"func",
"NewRunner",
"(",
"config",
"*",
"config",
".",
"Config",
",",
"dry",
",",
"once",
"bool",
")",
"(",
"*",
"Runner",
",",
"error",
")",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"dry",
",",
"once",
")",
"\n\n",
"runner",
":=",
"&",
"Runner",
"{",
"config",
":",
"config",
",",
"dry",
":",
"dry",
",",
"once",
":",
"once",
",",
"}",
"\n\n",
"if",
"err",
":=",
"runner",
".",
"init",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"runner",
",",
"nil",
"\n",
"}"
]
|
20,019 | all-20020 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"PseudoType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
20,020 | all-20021 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventFrameDetached",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage65",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,021 | all-20022 | [
"determine",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"transform",
"feedback",
"object"
]
| [
"func",
"IsTransformFeedback",
"(",
"id",
"uint32",
")",
"bool",
"{",
"<mask>",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpIsTransformFeedback",
",",
"1",
",",
"uintptr",
"(",
"id",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"ret",
"!=",
"0",
"\n",
"}"
]
|
20,022 | all-20023 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventWorkerErrorReported",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker12",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,023 | all-20024 | [
"GetScopeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Scope",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"Series",
")",
"GetScopeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Scope",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Scope",
",",
"true",
"\n",
"}"
]
|
20,024 | all-20025 | [
"SetMilestone",
"sets",
"the",
"milestone",
"."
]
| [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"SetMilestone",
"(",
"org",
",",
"repo",
"<mask>",
",",
"issueNum",
",",
"milestoneNum",
"int",
")",
"error",
"{",
"if",
"milestoneNum",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"f",
".",
"Milestone",
"=",
"milestoneNum",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,025 | all-20026 | [
"SetAccelPath",
"is",
"a",
"wrapper",
"around",
"gtk_menu_set_accel_path",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Menu",
")",
"SetAccelPath",
"(",
"path",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_menu_set_accel_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
20,026 | all-20027 | [
"ApplyChanges",
"applies",
"a",
"given",
"set",
"of",
"changes",
"to",
"a",
"given",
"zone",
"."
]
| [
"func",
"(",
"p",
"*",
"OCIProvider",
")",
"ApplyChanges",
"(",
"changes",
"*",
"plan",
".",
"Changes",
")",
"error",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"changes",
")",
"\n\n",
"ops",
":=",
"[",
"]",
"dns",
".",
"RecordOperation",
"{",
"}",
"\n",
"ops",
"=",
"append",
"(",
"ops",
",",
"p",
".",
"newFilteredRecordOperations",
"(",
"changes",
".",
"Create",
",",
"dns",
".",
"RecordOperationOperationAdd",
")",
"...",
")",
"\n\n",
"ops",
"=",
"append",
"(",
"ops",
",",
"p",
".",
"newFilteredRecordOperations",
"(",
"changes",
".",
"UpdateNew",
",",
"dns",
".",
"RecordOperationOperationAdd",
")",
"...",
")",
"\n",
"ops",
"=",
"append",
"(",
"ops",
",",
"p",
".",
"newFilteredRecordOperations",
"(",
"changes",
".",
"UpdateOld",
",",
"dns",
".",
"RecordOperationOperationRemove",
")",
"...",
")",
"\n\n",
"ops",
"=",
"append",
"(",
"ops",
",",
"p",
".",
"newFilteredRecordOperations",
"(",
"changes",
".",
"Delete",
",",
"dns",
".",
"RecordOperationOperationRemove",
")",
"...",
")",
"\n\n",
"if",
"len",
"(",
"ops",
")",
"==",
"0",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"zones",
",",
"err",
":=",
"p",
".",
"zones",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Separate into per-zone change sets to be passed to OCI API.",
"opsByZone",
":=",
"operationsByZone",
"(",
"zones",
",",
"ops",
")",
"\n",
"for",
"zoneID",
",",
"ops",
":=",
"<mask>",
"opsByZone",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"zoneID",
")",
"\n",
"for",
"_",
",",
"op",
":=",
"range",
"ops",
"{",
"log",
".",
"Info",
"(",
"op",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"p",
".",
"dryRun",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"zoneID",
",",
"ops",
":=",
"range",
"opsByZone",
"{",
"if",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"PatchZoneRecords",
"(",
"ctx",
",",
"dns",
".",
"PatchZoneRecordsRequest",
"{",
"CompartmentId",
":",
"&",
"p",
".",
"cfg",
".",
"CompartmentID",
",",
"ZoneNameOrId",
":",
"&",
"zoneID",
",",
"PatchZoneRecordsDetails",
":",
"dns",
".",
"PatchZoneRecordsDetails",
"{",
"Items",
":",
"ops",
"}",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
20,027 | all-20028 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Ensure",
"that",
"a",
"keypair",
"of",
"a",
"given",
"name",
"does",
"not",
"exist",
".",
"Required",
"scopes",
":",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"key",
"-",
"pairs",
":",
"<name",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#removeKeyPair"
]
| [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"RemoveKeyPair",
"(",
"name",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,028 | all-20029 | [
"RegisterBuilder",
"creates",
"and",
"registers",
"a",
"builder",
".",
"Since",
"this",
"function",
"calls",
"balancer",
".",
"Register",
"it",
"must",
"be",
"invoked",
"at",
"initialization",
"time",
"."
]
| [
"func",
"RegisterBuilder",
"(",
"cfg",
"Config",
")",
"{",
"bb",
":=",
"&",
"builder",
"{",
"cfg",
"}",
"\n",
"balancer",
".",
"Register",
"(",
"bb",
")",
"\n\n",
"bb",
".",
"cfg",
".",
"Logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"bb",
".",
"cfg",
".",
"Policy",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"bb",
".",
"cfg",
".",
"Name",
")",
",",
")",
"\n",
"}"
]
|
20,029 | all-20030 | [
"HandleSubConnStateChange",
"implements",
"grpc",
"/",
"balancer",
".",
"Balancer",
"interface",
"."
]
| [
"func",
"(",
"bb",
"*",
"baseBalancer",
")",
"HandleSubConnStateChange",
"(",
"sc",
"balancer",
".",
"SubConn",
",",
"s",
"connectivity",
".",
"State",
")",
"{",
"bb",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bb",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"old",
",",
"ok",
":=",
"bb",
".",
"scToSt",
"[",
"sc",
"]",
"\n",
"if",
"!",
"ok",
"{",
"bb",
".",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"bb",
".",
"id",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"scToString",
"(",
"sc",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"String",
"(",
")",
")",
",",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"bb",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"bb",
".",
"id",
")",
",",
"zap",
".",
"Bool",
"(",
"\"",
"\"",
",",
"s",
"==",
"connectivity",
".",
"Ready",
")",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"scToString",
"(",
"sc",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"bb",
".",
"scToAddr",
"[",
"sc",
"]",
".",
"Addr",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"old",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"String",
"(",
")",
")",
",",
")",
"\n\n",
"bb",
".",
"scToSt",
"[",
"sc",
"]",
"=",
"s",
"\n",
"switch",
"s",
"{",
"case",
"connectivity",
".",
"Idle",
":",
"sc",
".",
"Connect",
"(",
")",
"\n",
"case",
"connectivity",
".",
"Shutdown",
":",
"// When an address was removed by resolver, b called RemoveSubConn but",
"// kept the sc's state in scToSt. Remove state for this sc here.",
"delete",
"(",
"bb",
".",
"scToAddr",
",",
"sc",
")",
"\n",
"delete",
"(",
"bb",
".",
"scToSt",
",",
"sc",
")",
"\n",
"}",
"\n\n",
"oldAggrState",
":=",
"bb",
".",
"currentState",
"\n",
"bb",
".",
"currentState",
"=",
"bb",
".",
"csEvltr",
".",
"recordTransition",
"(",
"old",
",",
"s",
")",
"\n\n",
"// Regenerate picker when one of the following happens:",
"// - this sc became ready from not-ready",
"// - this sc became not-ready from ready",
"// - the aggregated state of balancer became TransientFailure from non-TransientFailure",
"// - the aggregated state of balancer became non-TransientFailure from TransientFailure",
"if",
"(",
"s",
"==",
"connectivity",
".",
"Ready",
")",
"!=",
"(",
"old",
"==",
"connectivity",
".",
"Ready",
")",
"||",
"(",
"bb",
".",
"currentState",
"==",
"connectivity",
".",
"TransientFailure",
")",
"!=",
"(",
"oldAggrState",
"==",
"connectivity",
".",
"TransientFailure",
")",
"{",
"bb",
".",
"regeneratePicker",
"(",
")",
"\n",
"}",
"\n\n",
"bb",
".",
"currentConn",
".",
"UpdateBalancerState",
"(",
"bb",
".",
"currentState",
",",
"bb",
".",
"Picker",
")",
"\n",
"return",
"\n",
"}"
]
|
20,030 | all-20031 | [
"NewEllipticSigner",
"creates",
"an",
"Elliptic",
"Curve",
"Signer",
"for",
"the",
"specified",
"curve",
"."
]
| [
"func",
"NewEllipticSigner",
"(",
"alg",
"Algorithm",
",",
"curve",
"elliptic",
".",
"Curve",
")",
"func",
"(",
"Store",
",",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"curveBitSize",
":=",
"curve",
".",
"Params",
"(",
")",
".",
"BitSize",
"\n\n",
"// precompute curve key len",
"keyLen",
":=",
"curveBitSize",
"/",
"8",
"\n",
"if",
"curveBitSize",
"%",
"8",
">",
"0",
"{",
"keyLen",
"++",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"store",
"Store",
",",
"hash",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"var",
"ok",
"bool",
"\n",
"var",
"privRaw",
",",
"pubRaw",
"interface",
"{",
"}",
"\n",
"var",
"priv",
"*",
"ecdsa",
".",
"PrivateKey",
"\n",
"var",
"pub",
"*",
"ecdsa",
".",
"PublicKey",
"\n\n",
"// check private key",
"if",
"privRaw",
",",
"ok",
"=",
"store",
".",
"PrivateKey",
"(",
")",
";",
"<mask>",
"{",
"if",
"priv",
",",
"ok",
"=",
"privRaw",
".",
"(",
"*",
"ecdsa",
".",
"PrivateKey",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidPrivateKey",
"\n",
"}",
"\n\n",
"// check curve type matches private key curve type",
"if",
"curveBitSize",
"!=",
"priv",
".",
"Curve",
".",
"Params",
"(",
")",
".",
"BitSize",
"{",
"return",
"nil",
",",
"ErrInvalidPrivateKeySize",
"\n",
"}",
"\n",
"}",
"\n\n",
"// check public key",
"if",
"pubRaw",
",",
"ok",
"=",
"store",
".",
"PublicKey",
"(",
")",
";",
"ok",
"{",
"if",
"pub",
",",
"ok",
"=",
"pubRaw",
".",
"(",
"*",
"ecdsa",
".",
"PublicKey",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidPublicKey",
"\n",
"}",
"\n",
"}",
"\n\n",
"// check that either a private or public key has been provided",
"if",
"priv",
"==",
"nil",
"&&",
"pub",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrMissingPrivateOrPublicKey",
"\n",
"}",
"\n\n",
"return",
"&",
"EccSigner",
"{",
"alg",
":",
"alg",
",",
"curve",
":",
"curve",
",",
"hash",
":",
"hash",
",",
"priv",
":",
"priv",
",",
"pub",
":",
"pub",
",",
"keyLen",
":",
"keyLen",
",",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
]
|
20,031 | all-20032 | [
"FinishReportAndFlushUserAction",
"immediately",
"reports",
"the",
"metric",
"but",
"does",
"not",
"block",
"execution",
".",
"It",
"returns",
"a",
"wait",
"function",
"which",
"waits",
"or",
"times",
"out",
"after",
"5s",
".",
"It",
"is",
"used",
"by",
"the",
"pachctl",
"binary",
"and",
"runs",
"on",
"users",
"machines"
]
| [
"func",
"FinishReportAndFlushUserAction",
"(",
"action",
"string",
",",
"err",
"error",
",",
"start",
"time",
".",
"Time",
")",
"func",
"(",
")",
"{",
"var",
"wait",
"func",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"wait",
"=",
"reportAndFlushUserAction",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"action",
")",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"wait",
"=",
"reportAndFlushUserAction",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"action",
")",
",",
"time",
".",
"Since",
"(",
"<mask>",
")",
".",
"Seconds",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"wait",
"\n",
"}"
]
|
20,032 | all-20033 | [
"FieldColumnName",
"returns",
"the",
"column",
"name",
"of",
"the",
"field",
"with",
"the",
"given",
"name",
"prefixed",
"with",
"the",
"entity",
"s",
"table",
"name",
"."
]
| [
"func",
"(",
"m",
"*",
"Mapping",
")",
"FieldColumnName",
"(",
"name",
"string",
")",
"string",
"{",
"field",
":=",
"m",
".",
"FieldByName",
"(",
"<mask>",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"entityTable",
"(",
"m",
".",
"Name",
")",
",",
"field",
".",
"Column",
"(",
")",
")",
"\n",
"}"
]
|
20,033 | all-20034 | [
"DatacenterLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
]
| [
"func",
"(",
"api",
"*",
"API",
")",
"DatacenterLocator",
"(",
"href",
"<mask>",
")",
"*",
"DatacenterLocator",
"{",
"return",
"&",
"DatacenterLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
]
|
20,034 | all-20035 | [
"DeepCopy",
"copies",
"src",
"to",
"dest",
"by",
"using",
"encoding",
"/",
"gob",
"so",
"its",
"not",
"that",
"fast",
"."
]
| [
"func",
"DeepCopy",
"(",
"src",
",",
"dest",
"interface",
"{",
"}",
")",
"error",
"{",
"buff",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"enc",
":=",
"gob",
".",
"NewEncoder",
"(",
"buff",
")",
"\n",
"dec",
":=",
"gob",
".",
"NewDecoder",
"(",
"buff",
")",
"\n",
"if",
"err",
":=",
"enc",
".",
"Encode",
"(",
"src",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"dec",
".",
"Decode",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
20,035 | all-20036 | [
"NewGShadow",
"returns",
"a",
"new",
"GShadow",
"."
]
| [
"func",
"NewGShadow",
"(",
"username",
"string",
",",
"members",
"...",
"string",
")",
"*",
"GShadow",
"{",
"return",
"&",
"GShadow",
"{",
"<mask>",
":",
"username",
",",
"UserList",
":",
"members",
",",
"}",
"\n",
"}"
]
|
20,036 | all-20037 | [
"ConfigSchema",
"returns",
"the",
"schema",
"for",
"custom",
"attribute",
"configuration",
"for",
"each",
"resource",
"that",
"needs",
"it",
".",
"The",
"key",
"should",
"be",
"set",
"to",
"the",
"ConfigKey",
"constant",
"and",
"should",
"be",
"a",
"map",
"of",
"custom",
"attribute",
"ids",
"to",
"values",
"."
]
| [
"func",
"ConfigSchema",
"(",
")",
"*",
"schema",
".",
"Schema",
"{",
"return",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeMap",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Optional",
":",
"true",
",",
"}",
"\n",
"}"
]
|
20,037 | all-20038 | [
"Uint16",
"returns",
"the",
"uint16",
"value",
"stored",
"in",
"r",
".",
"r",
"must",
"have",
"type",
"uint16",
"."
]
| [
"func",
"(",
"r",
"<mask>",
")",
"Uint16",
"(",
")",
"uint16",
"{",
"if",
"r",
".",
"typ",
".",
"Kind",
"!=",
"KindUint",
"||",
"r",
".",
"typ",
".",
"Size",
"!=",
"2",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"r",
".",
"typ",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"p",
".",
"proc",
".",
"ReadUint16",
"(",
"r",
".",
"a",
")",
"\n",
"}"
]
|
20,038 | all-20039 | [
"UnmarshalJSON",
"sets",
"the",
"ObjectId",
"from",
"JSON"
]
| [
"func",
"(",
"id",
"*",
"ObjectId",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"l",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"id",
".",
"UnmarshalEasyJSON",
"(",
"&",
"l",
")",
"\n",
"return",
"l",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
20,039 | all-20040 | [
"loadClusterConfig",
"loads",
"connection",
"configuration",
"for",
"the",
"cluster",
"we",
"re",
"deploying",
"to",
".",
"We",
"prefer",
"to",
"use",
"in",
"-",
"cluster",
"configuration",
"if",
"possible",
"but",
"will",
"fall",
"back",
"to",
"using",
"default",
"rules",
"otherwise",
"."
]
| [
"func",
"loadClusterConfig",
"(",
")",
"(",
"*",
"<mask>",
".",
"Config",
",",
"error",
")",
"{",
"clusterConfig",
",",
"err",
":=",
"rest",
".",
"InClusterConfig",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"clusterConfig",
",",
"nil",
"\n",
"}",
"\n\n",
"credentials",
",",
"err",
":=",
"clientcmd",
".",
"NewDefaultClientConfigLoadingRules",
"(",
")",
".",
"Load",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"clusterConfig",
",",
"err",
"=",
"clientcmd",
".",
"NewDefaultClientConfig",
"(",
"*",
"credentials",
",",
"&",
"clientcmd",
".",
"ConfigOverrides",
"{",
"}",
")",
".",
"ClientConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"clusterConfig",
",",
"nil",
"\n",
"}"
]
|
20,040 | all-20041 | [
"GetDisplayFormatOk",
"returns",
"a",
"tuple",
"with",
"the",
"DisplayFormat",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"m",
"*",
"ManageStatusDefinition",
")",
"GetDisplayFormatOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"DisplayFormat",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"DisplayFormat",
",",
"true",
"\n",
"}"
]
|
20,041 | all-20042 | [
"For",
"debugging"
]
| [
"func",
"dumpJSON",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"enc",
":=",
"json",
".",
"NewEncoder",
"(",
"buf",
")",
"\n",
"enc",
".",
"SetIndent",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"enc",
".",
"Encode",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"return",
"string",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"}"
]
|
20,042 | all-20043 | [
"NewReader",
"returns",
"a",
"new",
"Reader",
"that",
"reads",
"from",
"r",
"."
]
| [
"func",
"NewReader",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"*",
"Reader",
"{",
"return",
"&",
"Reader",
"{",
"Reader",
":",
"csv",
".",
"NewReader",
"(",
"r",
")",
",",
"}",
"\n",
"}"
]
|
20,043 | all-20044 | [
"TODO",
":",
"gtk_container_foreach",
"GetChildren",
"is",
"a",
"wrapper",
"around",
"gtk_container_get_children",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Container",
")",
"GetChildren",
"(",
")",
"*",
"glib",
".",
"List",
"{",
"clist",
":=",
"C",
".",
"gtk_container_get_children",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"glist",
":=",
"glib",
".",
"WrapList",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"clist",
")",
")",
")",
"\n",
"glist",
".",
"DataWrapper",
"(",
"func",
"(",
"ptr",
"unsafe",
".",
"Pointer",
")",
"<mask>",
"{",
"}",
"{",
"return",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"ptr",
")",
")",
"\n",
"}",
")",
"\n\n",
"return",
"glist",
"\n",
"}"
]
|
20,044 | all-20045 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"PausedReason",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
]
|
20,045 | all-20046 | [
"XzDecompressor",
"is",
"a",
"DecompressorFunc",
"for",
"the",
"xz",
"compression",
"algorithm",
"."
]
| [
"func",
"XzDecompressor",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"<mask>",
".",
"ReadCloser",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"xz",
".",
"NewReader",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"NopCloser",
"(",
"r",
")",
",",
"nil",
"\n",
"}"
]
|
20,046 | all-20047 | [
"Adopt",
"()",
":",
"non",
"-",
"standard",
".",
"For",
"efficiency",
"s",
"sake",
"(",
"possibly",
")",
"take",
"ownership",
"of",
"already",
"allocated",
"slice",
"offered",
"in",
"me",
".",
"If",
"me",
"is",
"large",
"we",
"will",
"adopt",
"it",
"and",
"we",
"will",
"potentially",
"then",
"write",
"to",
"the",
"me",
"buffer",
".",
"If",
"we",
"already",
"have",
"a",
"bigger",
"buffer",
"copy",
"me",
"into",
"the",
"existing",
"buffer",
"instead",
"."
]
| [
"func",
"(",
"b",
"*",
"Float64RingBuf",
")",
"Adopt",
"(",
"me",
"[",
"]",
"float64",
")",
"{",
"n",
":=",
"len",
"(",
"me",
")",
"\n",
"if",
"n",
">",
"b",
".",
"N",
"{",
"b",
".",
"A",
"=",
"<mask>",
"\n",
"b",
".",
"N",
"=",
"n",
"\n",
"b",
".",
"Beg",
"=",
"0",
"\n",
"b",
".",
"Readable",
"=",
"n",
"\n",
"}",
"else",
"{",
"// we already have a larger buffer, reuse it.",
"copy",
"(",
"b",
".",
"A",
",",
"me",
")",
"\n",
"b",
".",
"Beg",
"=",
"0",
"\n",
"b",
".",
"Readable",
"=",
"n",
"\n",
"}",
"\n",
"}"
]
|
20,047 | all-20048 | [
"ParseReference",
"converts",
"a",
"string",
"which",
"should",
"not",
"start",
"with",
"the",
"ImageTransport",
".",
"Name",
"prefix",
"into",
"an",
"ImageReference",
"."
]
| [
"func",
"(",
"t",
"daemonTransport",
")",
"ParseReference",
"(",
"<mask>",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"return",
"ParseReference",
"(",
"reference",
")",
"\n",
"}"
]
|
20,048 | all-20049 | [
"/",
"*",
"GetTokenKindString",
"returns",
"a",
"string",
"that",
"describes",
"the",
"given",
"TokenKind",
".",
"e",
".",
"g",
".",
"when",
"passed",
"the",
"NUMERIC",
"TokenKind",
"this",
"returns",
"the",
"string",
"NUMERIC",
"."
]
| [
"func",
"(",
"kind",
"TokenKind",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"kind",
"{",
"case",
"PREFIX",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"NUMERIC",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BOOLEAN",
":",
"return",
"\"",
"\"",
"\n",
"case",
"STRING",
":",
"return",
"\"",
"\"",
"\n",
"case",
"PATTERN",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TIME",
":",
"return",
"\"",
"\"",
"\n",
"case",
"VARIABLE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"FUNCTION",
":",
"return",
"\"",
"\"",
"\n",
"case",
"SEPARATOR",
":",
"return",
"\"",
"\"",
"\n",
"case",
"COMPARATOR",
":",
"return",
"\"",
"\"",
"\n",
"case",
"LOGICALOP",
":",
"return",
"\"",
"\"",
"\n",
"case",
"MODIFIER",
":",
"return",
"\"",
"\"",
"\n",
"case",
"CLAUSE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"CLAUSE_CLOSE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TERNARY",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ACCESSOR",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
20,049 | all-20050 | [
"NewTokensRequest",
"generates",
"new",
"tokens",
"for",
"OAuth",
"user",
"given",
"an",
"http",
"request",
"containing",
"the",
"query",
"parameter",
"code"
]
| [
"func",
"(",
"o",
"OAuth",
")",
"NewTokensFromRequest",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"oauthTokens",
",",
"error",
")",
"{",
"<mask>",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
"\n",
"code",
":=",
"query",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"return",
"o",
".",
"GetTokens",
"(",
"code",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
20,050 | all-20051 | [
"Keys",
"returns",
"the",
"keys",
"in",
"sorted",
"order",
"."
]
| [
"func",
"(",
"c",
"*",
"Cache",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"var",
"keys",
"[",
"]",
"string",
"\n",
"for",
"key",
":=",
"range",
"c",
".",
"keys",
"{",
"keys",
"=",
"append",
"(",
"keys",
",",
"key",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,051 | all-20052 | [
"DescribeSecretRequest",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"DescribeSecretRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"DescribeSecretInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"DescribeSecretOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"DescribeSecretOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
20,052 | all-20053 | [
"findRoots",
"sets",
"member",
"GOROOT",
"and",
"GOPATHs",
"."
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"findRoots",
"(",
")",
"{",
"c",
".",
"GOPATHs",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"getFiles",
"(",
"c",
".",
"Goroutines",
")",
"{",
"// TODO(maruel): Could a stack dump have mixed cases? I think it's",
"// possible, need to confirm and handle.",
"//log.Printf(\" Analyzing %s\", f)",
"if",
"c",
".",
"GOROOT",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"HasPrefix",
"(",
"f",
",",
"c",
".",
"GOROOT",
"+",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"hasPathPrefix",
"(",
"f",
",",
"c",
".",
"GOPATHs",
")",
"{",
"continue",
"\n",
"}",
"\n",
"parts",
":=",
"splitPath",
"(",
"f",
")",
"\n",
"if",
"c",
".",
"GOROOT",
"==",
"\"",
"\"",
"{",
"if",
"r",
":=",
"rootedIn",
"(",
"c",
".",
"localgoroot",
",",
"parts",
")",
";",
"r",
"!=",
"\"",
"\"",
"{",
"c",
".",
"GOROOT",
"=",
"r",
"\n",
"//log.Printf(\"Found GOROOT=%s\", c.GOROOT)",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"found",
":=",
"false",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"c",
".",
"localgopaths",
"{",
"if",
"r",
":=",
"rootedIn",
"(",
"l",
",",
"parts",
")",
";",
"r",
"!=",
"\"",
"\"",
"{",
"//log.Printf(\"Found GOPATH=%s\", r)",
"c",
".",
"GOPATHs",
"[",
"r",
"]",
"=",
"l",
"\n",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"found",
"{",
"// If the source is not found, just too bad.",
"//log.Printf(\"Failed to find locally: %s / %s\", f, goroot)",
"}",
"\n",
"}",
"\n",
"}"
]
|
20,053 | all-20054 | [
"twoDigits",
"formats",
"a",
"zero",
"-",
"prefixed",
"two",
"-",
"digit",
"integer",
"at",
"buf",
".",
"tmp",
"[",
"i",
"]",
"."
]
| [
"func",
"(",
"buf",
"*",
"<mask>",
")",
"twoDigits",
"(",
"i",
",",
"d",
"int",
")",
"{",
"buf",
".",
"tmp",
"[",
"i",
"+",
"1",
"]",
"=",
"digits",
"[",
"d",
"%",
"10",
"]",
"\n",
"d",
"/=",
"10",
"\n",
"buf",
".",
"tmp",
"[",
"i",
"]",
"=",
"digits",
"[",
"d",
"%",
"10",
"]",
"\n",
"}"
]
|
20,054 | all-20055 | [
"ProjectMap",
"returns",
"the",
"names",
"and",
"ids",
"of",
"all",
"available",
"projects",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProjectMap",
"(",
")",
"(",
"map",
"[",
"int64",
"]",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"\"",
"\"",
"\n\n",
"rows",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Query",
"(",
"stmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"rows",
".",
"Close",
"(",
")",
"\n\n",
"result",
":=",
"map",
"[",
"int64",
"]",
"string",
"{",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"rows",
".",
"Next",
"(",
")",
";",
"i",
"++",
"{",
"var",
"<mask>",
"int64",
"\n",
"var",
"name",
"string",
"\n\n",
"err",
":=",
"rows",
".",
"Scan",
"(",
"&",
"id",
",",
"&",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"result",
"[",
"id",
"]",
"=",
"name",
"\n",
"}",
"\n\n",
"err",
"=",
"rows",
".",
"Err",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
]
|
20,055 | all-20056 | [
"Remove",
"perfective",
"gerund",
"endings",
"and",
"return",
"true",
"if",
"one",
"was",
"removed",
"."
]
| [
"func",
"removePerfectiveGerundEnding",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"suffix",
",",
"suffixRunes",
":=",
"word",
".",
"FirstSuffixIn",
"(",
"word",
".",
"RVstart",
",",
"len",
"(",
"<mask>",
".",
"RS",
")",
",",
"\"",
"ш",
"и",
"ь",
"\"",
"и",
"ш",
",",
" ",
"в",
"\"",
",",
"\"",
",",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
")",
"\n",
"switch",
"suffix",
"{",
"case",
"\"",
",",
" ",
"в",
"в",
"ш",
"с",
"",
"",
"// These are \"Group 1\" perfective gerund endings.",
"// Group 1 endings must follow а (a) or я (ia) in RV.",
"if",
"precededByARinRV",
"(",
"word",
",",
"len",
"(",
"suffixRunes",
")",
")",
"==",
"false",
"{",
"suffix",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"if",
"suffix",
"!=",
"\"",
"\"",
"{",
"word",
".",
"RemoveLastNRunes",
"(",
"len",
"(",
"suffixRunes",
")",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
20,056 | all-20057 | [
"/",
"*",
"ProcessEvent",
"processes",
"all",
"events",
"come",
"from",
"the",
"control",
"parent",
".",
"If",
"a",
"control",
"processes",
"an",
"event",
"it",
"should",
"return",
"true",
".",
"If",
"the",
"method",
"returns",
"false",
"it",
"means",
"that",
"the",
"control",
"do",
"not",
"want",
"or",
"cannot",
"process",
"the",
"event",
"and",
"the",
"caller",
"sends",
"the",
"event",
"to",
"the",
"control",
"parent"
]
| [
"func",
"(",
"e",
"*",
"EditField",
")",
"ProcessEvent",
"(",
"event",
"Event",
")",
"bool",
"{",
"if",
"!",
"e",
".",
"Active",
"(",
")",
"||",
"!",
"e",
".",
"Enabled",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Type",
"==",
"EventActivate",
"&&",
"event",
".",
"X",
"==",
"0",
"{",
"term",
".",
"HideCursor",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Type",
"==",
"EventMouse",
"&&",
"event",
".",
"Key",
"==",
"term",
".",
"MouseLeft",
"{",
"e",
".",
"lastEvent",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Type",
"==",
"EventKey",
"&&",
"event",
".",
"Key",
"!=",
"term",
".",
"KeyTab",
"{",
"if",
"e",
".",
"onKeyPress",
"!=",
"nil",
"{",
"res",
":=",
"e",
".",
"onKeyPress",
"(",
"event",
".",
"Key",
",",
"event",
".",
"Ch",
")",
"\n",
"if",
"res",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"switch",
"event",
".",
"Key",
"{",
"case",
"term",
".",
"KeyEnter",
":",
"return",
"false",
"\n",
"case",
"term",
".",
"KeySpace",
":",
"e",
".",
"insertRune",
"(",
"' '",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyBackspace",
",",
"term",
".",
"KeyBackspace2",
":",
"e",
".",
"backspace",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyDelete",
":",
"e",
".",
"del",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyArrowLeft",
":",
"e",
".",
"charLeft",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyHome",
":",
"e",
".",
"home",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyEnd",
":",
"e",
".",
"end",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyCtrlR",
":",
"if",
"!",
"e",
".",
"readonly",
"{",
"e",
".",
"Clear",
"(",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyArrowRight",
":",
"e",
".",
"charRight",
"(",
")",
"\n",
"return",
"true",
"\n",
"default",
":",
"if",
"<mask>",
".",
"Ch",
"!=",
"0",
"{",
"elapsed",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"e",
".",
"lastEvent",
")",
"\n",
"if",
"elapsed",
">",
"time",
".",
"Duration",
"(",
"charInvervalMs",
")",
"*",
"time",
".",
"Millisecond",
"{",
"e",
".",
"insertRune",
"(",
"event",
".",
"Ch",
")",
"\n",
"e",
".",
"lastEvent",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
20,057 | all-20058 | [
"BaseFromPath",
"returns",
"a",
"BaseComputeResource",
"for",
"a",
"given",
"path",
"."
]
| [
"func",
"BaseFromPath",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"path",
"string",
")",
"(",
"BaseComputeResource",
",",
"error",
")",
"{",
"finder",
":=",
"find",
".",
"NewFinder",
"(",
"client",
".",
"Client",
",",
"false",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"list",
",",
"err",
":=",
"finder",
".",
"ManagedObjectList",
"(",
"ctx",
",",
"path",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"list",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"list",
")",
">",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"list",
"[",
"0",
"]",
".",
"Path",
",",
"path",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"list",
"[",
"0",
"]",
".",
"Path",
",",
"path",
")",
"\n",
"}",
"\n",
"return",
"BaseFromReference",
"(",
"client",
",",
"list",
"[",
"0",
"]",
".",
"Object",
".",
"Reference",
"(",
")",
")",
"\n",
"}"
]
|
20,058 | all-20059 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetEventListenerBreakpointParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
20,059 | all-20060 | [
"New",
"is",
"used",
"to",
"create",
"a",
"new",
"cgroup",
"hierarchy"
]
| [
"func",
"(",
"c",
"*",
"GlobalCgroupFactory",
")",
"New",
"(",
"hierarchy",
"cgroups",
".",
"Hierarchy",
",",
"path",
"cgroups",
".",
"<mask>",
",",
"specs",
"*",
"specs",
".",
"LinuxResources",
")",
"(",
"cgroups",
".",
"Cgroup",
",",
"error",
")",
"{",
"return",
"cgroups",
".",
"New",
"(",
"hierarchy",
",",
"path",
",",
"specs",
")",
"\n",
"}"
]
|
20,060 | all-20061 | [
"StoragePoolErrored",
"sets",
"the",
"state",
"of",
"the",
"given",
"pool",
"to",
"Errored",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolErrored",
"(",
"<mask>",
"string",
")",
"error",
"{",
"return",
"c",
".",
"storagePoolState",
"(",
"name",
",",
"storagePoolErrored",
")",
"\n",
"}"
]
|
20,061 | all-20062 | [
"This",
"endpoint",
"will",
"return",
"a",
"list",
"of",
"all",
"hook",
"groups",
"with",
"at",
"least",
"one",
"hook",
".",
"See",
"#listHookGroups"
]
| [
"func",
"(",
"hooks",
"*",
"Hooks",
")",
"ListHookGroups",
"(",
")",
"(",
"*",
"HookGroups",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"hooks",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"<mask>",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"HookGroups",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"HookGroups",
")",
",",
"err",
"\n",
"}"
]
|
20,062 | all-20063 | [
"GetUsers",
"returns",
"all",
"user",
"or",
"an",
"error",
"if",
"not",
"found"
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"GetUsers",
"(",
")",
"(",
"users",
"[",
"]",
"User",
",",
"err",
"error",
")",
"{",
"var",
"udata",
"usersData",
"\n",
"uri",
":=",
"\"",
"\"",
"\n",
"err",
"=",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"nil",
",",
"&",
"udata",
")",
"\n",
"users",
"=",
"udata",
".",
"Users",
"\n",
"return",
"\n",
"}"
]
|
20,063 | all-20064 | [
"TopUpChannel",
"initiates",
"JobClientPreChannelTopUp",
"job",
"."
]
| [
"func",
"(",
"h",
"*",
"Handler",
")",
"TopUpChannel",
"(",
"tkn",
",",
"channel",
"string",
",",
"deposit",
",",
"gasPrice",
"uint64",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"channel",
",",
"\"",
"\"",
",",
"deposit",
",",
"\"",
"\"",
",",
"gasPrice",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"ch",
":=",
"&",
"data",
".",
"Channel",
"{",
"}",
"\n",
"if",
"err",
":=",
"h",
".",
"findByPrimaryKey",
"(",
"logger",
",",
"ErrChannelNotFound",
",",
"ch",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"jobData",
",",
"err",
":=",
"h",
".",
"topUpChannelJobData",
"(",
"logger",
",",
"deposit",
",",
"gasPrice",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"job",
".",
"AddWithData",
"(",
"h",
".",
"queue",
",",
"nil",
",",
"data",
".",
"JobClientPreChannelTopUp",
",",
"data",
".",
"JobChannel",
",",
"ch",
".",
"ID",
",",
"data",
".",
"JobUser",
",",
"jobData",
")",
"\n",
"}"
]
|
20,064 | all-20065 | [
"SetBSON",
"sets",
"the",
"Password",
"from",
"raw",
"bson",
"data"
]
| [
"func",
"(",
"r",
"*",
"Password",
")",
"SetBSON",
"(",
"raw",
"bson",
".",
"Raw",
")",
"error",
"{",
"var",
"m",
"bson",
".",
"M",
"\n",
"if",
"err",
":=",
"raw",
".",
"Unmarshal",
"(",
"&",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"data",
",",
"ok",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"<mask>",
"{",
"*",
"r",
"=",
"Password",
"(",
"data",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
20,065 | all-20066 | [
"DefaultVaultConfig",
"returns",
"a",
"configuration",
"that",
"is",
"populated",
"with",
"the",
"default",
"values",
"."
]
| [
"func",
"DefaultVaultConfig",
"(",
")",
"*",
"VaultConfig",
"{",
"v",
":=",
"&",
"VaultConfig",
"{",
"Retry",
":",
"DefaultRetryConfig",
"(",
")",
",",
"SSL",
":",
"DefaultSSLConfig",
"(",
")",
",",
"Transport",
":",
"DefaultTransportConfig",
"(",
")",
",",
"}",
"\n\n",
"// Force SSL when communicating with Vault.",
"v",
".",
"SSL",
".",
"Enabled",
"=",
"Bool",
"(",
"<mask>",
")",
"\n\n",
"return",
"v",
"\n",
"}"
]
|
20,066 | all-20067 | [
"ctx",
"may",
"be",
"nil",
"."
]
| [
"func",
"insertContext",
"(",
"f",
"*",
"ast",
".",
"File",
",",
"<mask>",
"*",
"ast",
".",
"CallExpr",
",",
"ctx",
"*",
"ast",
".",
"Ident",
")",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"// context is unknown, so use a plain \"ctx\".",
"ctx",
"=",
"ast",
".",
"NewIdent",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"// Create a fresh *ast.Ident so we drop the position information.",
"ctx",
"=",
"ast",
".",
"NewIdent",
"(",
"ctx",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"call",
".",
"Args",
"=",
"append",
"(",
"[",
"]",
"ast",
".",
"Expr",
"{",
"ctx",
"}",
",",
"call",
".",
"Args",
"...",
")",
"\n",
"}"
]
|
20,067 | all-20068 | [
"parsePullURL",
"parses",
"PR",
"history",
"URLs",
".",
"Expects",
"this",
"format",
":",
"...",
"/",
"pr",
"-",
"history?org",
"=",
"<org",
">",
"&repo",
"=",
"<repo",
">",
"&pr",
"=",
"<pr",
"number",
">"
]
| [
"func",
"parsePullURL",
"(",
"u",
"*",
"url",
".",
"<mask>",
")",
"(",
"org",
",",
"repo",
"string",
",",
"pr",
"int",
",",
"err",
"error",
")",
"{",
"var",
"prStr",
"string",
"\n",
"vals",
":=",
"u",
".",
"Query",
"(",
")",
"\n",
"if",
"org",
"=",
"vals",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"org",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"repo",
"=",
"vals",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"repo",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"prStr",
"=",
"vals",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"pr",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"prStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"prStr",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"org",
",",
"repo",
",",
"pr",
",",
"nil",
"\n",
"}"
]
|
20,068 | all-20069 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EventLastSeenObjectID",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
20,069 | all-20070 | [
"nicUnitRange",
"calculates",
"a",
"range",
"of",
"units",
"given",
"a",
"certain",
"VirtualDeviceList",
"which",
"should",
"be",
"network",
"interfaces",
".",
"It",
"s",
"used",
"in",
"network",
"interface",
"refresh",
"logic",
"to",
"determine",
"how",
"many",
"subresources",
"may",
"end",
"up",
"in",
"state",
"."
]
| [
"func",
"nicUnitRange",
"(",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"int",
",",
"error",
")",
"{",
"// No NICs means no range",
"if",
"len",
"(",
"l",
")",
"<",
"1",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n\n",
"high",
":=",
"int32",
"(",
"networkInterfacePciDeviceOffset",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"l",
"{",
"d",
":=",
"v",
".",
"GetVirtualDevice",
"(",
")",
"\n",
"if",
"d",
".",
"UnitNumber",
"==",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"*",
"d",
".",
"UnitNumber",
">",
"high",
"{",
"high",
"=",
"*",
"d",
".",
"UnitNumber",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"int",
"(",
"high",
"-",
"networkInterfacePciDeviceOffset",
"+",
"1",
")",
",",
"nil",
"\n",
"}"
]
|
20,070 | all-20071 | [
"StreamServerInterceptor",
"applies",
"fn",
"to",
"errors",
"returned",
"by",
"server",
"."
]
| [
"func",
"StreamServerInterceptor",
"(",
"fn",
"ConvertFunc",
")",
"grpc",
".",
"StreamServerInterceptor",
"{",
"return",
"func",
"(",
"srv",
"interface",
"{",
"}",
",",
"ss",
"grpc",
".",
"ServerStream",
",",
"info",
"*",
"grpc",
".",
"StreamServerInfo",
",",
"<mask>",
"grpc",
".",
"StreamHandler",
")",
"(",
"err",
"error",
")",
"{",
"return",
"fn",
"(",
"handler",
"(",
"srv",
",",
"ss",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
20,071 | all-20072 | [
"Network",
"sets",
"a",
"network",
"endpoints",
"for",
"ICMP",
"ping",
"and",
"returns",
"the",
"previous",
"setting",
".",
"network",
"arg",
"should",
"be",
"ip",
"or",
"udp",
"string",
"or",
"if",
"others",
"are",
"specified",
"it",
"returns",
"an",
"error",
".",
"If",
"this",
"function",
"isn",
"t",
"called",
"Pinger",
"uses",
"ip",
"as",
"default",
"."
]
| [
"func",
"(",
"p",
"*",
"Pinger",
")",
"Network",
"(",
"network",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"origNet",
":=",
"p",
".",
"network",
"\n",
"<mask>",
"network",
"{",
"case",
"\"",
"\"",
":",
"fallthrough",
"\n",
"case",
"\"",
"\"",
":",
"p",
".",
"network",
"=",
"network",
"\n",
"default",
":",
"return",
"origNet",
",",
"errors",
".",
"New",
"(",
"network",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"origNet",
",",
"nil",
"\n",
"}"
]
|
20,072 | all-20073 | [
"ImportField",
"imports",
"records",
"from",
"the",
"given",
"iterator",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ImportField",
"(",
"<mask>",
"*",
"Field",
",",
"iterator",
"RecordIterator",
",",
"options",
"...",
"ImportOption",
")",
"error",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"importOptions",
":=",
"ImportOptions",
"{",
"}",
"\n",
"for",
"_",
",",
"option",
":=",
"range",
"options",
"{",
"if",
"err",
":=",
"option",
"(",
"&",
"importOptions",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"importOptions",
"=",
"importOptions",
".",
"withDefaults",
"(",
")",
"\n",
"if",
"importOptions",
".",
"importRecordsFunction",
"==",
"nil",
"{",
"// if import records function was not already set, set it.",
"if",
"field",
".",
"options",
"!=",
"nil",
"&&",
"field",
".",
"options",
".",
"fieldType",
"==",
"FieldTypeInt",
"{",
"importRecordsFunction",
"(",
"c",
".",
"importValues",
")",
"(",
"&",
"importOptions",
")",
"\n",
"}",
"else",
"{",
"// Check whether roaring imports is available",
"if",
"importOptions",
".",
"wantRoaring",
"!=",
"nil",
"&&",
"*",
"importOptions",
".",
"wantRoaring",
"==",
"true",
"{",
"importOptions",
".",
"hasRoaring",
"=",
"c",
".",
"hasRoaringImportSupport",
"(",
"field",
")",
"\n",
"}",
"\n",
"importRecordsFunction",
"(",
"c",
".",
"importColumns",
")",
"(",
"&",
"importOptions",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// if the index doesn't have its shardWidth set, we need to get it from the schema",
"if",
"field",
".",
"index",
".",
"shardWidth",
"==",
"0",
"{",
"indexes",
",",
"err",
":=",
"c",
".",
"readSchema",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"index",
":=",
"range",
"indexes",
"{",
"if",
"index",
".",
"Name",
"!=",
"field",
".",
"index",
".",
"name",
"{",
"continue",
"\n",
"}",
"\n",
"indexCopy",
":=",
"field",
".",
"index",
".",
"copy",
"(",
")",
"\n",
"indexCopy",
".",
"shardWidth",
"=",
"index",
".",
"ShardWidth",
"\n",
"field",
"=",
"field",
".",
"copy",
"(",
")",
"\n",
"field",
".",
"index",
"=",
"indexCopy",
"\n",
"break",
"\n",
"}",
"\n",
"if",
"field",
".",
"index",
".",
"shardWidth",
"==",
"0",
"{",
"// the index does not have shard width, use the default",
"field",
".",
"index",
".",
"shardWidth",
"=",
"DefaultShardWidth",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"c",
".",
"importManager",
".",
"run",
"(",
"field",
",",
"iterator",
",",
"importOptions",
")",
"\n",
"}"
]
|
20,073 | all-20074 | [
"Subset",
"returns",
"the",
"subset",
"obtained",
"through",
"applying",
"filter"
]
| [
"func",
"(",
"covList",
"*",
"CoverageList",
")",
"Subset",
"(",
"prefix",
"string",
")",
"*",
"CoverageList",
"{",
"s",
":=",
"newCoverageList",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"covList",
".",
"Group",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"c",
".",
"Name",
",",
"<mask>",
")",
"{",
"covList",
".",
"Group",
"=",
"append",
"(",
"covList",
".",
"Group",
",",
"c",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
]
|
20,074 | all-20075 | [
"Get",
"Broker",
"to",
"use",
"when",
"creating",
"a",
"check"
]
| [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"getBroker",
"(",
")",
"(",
"*",
"api",
".",
"Broker",
",",
"error",
")",
"{",
"if",
"cm",
".",
"brokerID",
"!=",
"0",
"{",
"cid",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cm",
".",
"brokerID",
")",
"\n",
"broker",
",",
"err",
":=",
"cm",
".",
"apih",
".",
"FetchBroker",
"(",
"api",
".",
"CIDType",
"(",
"&",
"cid",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"cm",
".",
"isValidBroker",
"(",
"broker",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cm",
".",
"brokerID",
",",
"broker",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"broker",
",",
"nil",
"\n",
"}",
"\n",
"broker",
",",
"err",
":=",
"cm",
".",
"selectBroker",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"broker",
",",
"nil",
"\n",
"}"
]
|
20,075 | all-20076 | [
"StartDefaultTerminationHandler",
"defines",
"a",
"default",
"termination",
"handler",
"suitable",
"for",
"running",
"in",
"a",
"process"
]
| [
"func",
"StartDefaultTerminationHandler",
"(",
"saver",
"statemanager",
".",
"Saver",
",",
"taskEngine",
"engine",
".",
"TaskEngine",
")",
"{",
"signalChannel",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"2",
")",
"\n",
"signal",
".",
"Notify",
"(",
"signalChannel",
",",
"os",
".",
"Interrupt",
",",
"syscall",
".",
"SIGTERM",
")",
"\n\n",
"sig",
":=",
"<-",
"signalChannel",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"sig",
".",
"String",
"(",
")",
")",
"\n\n",
"err",
":=",
"FinalSave",
"(",
"saver",
",",
"taskEngine",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"// Terminal because it's a sigterm; the user doesn't want it to restart",
"os",
".",
"Exit",
"(",
"exitcodes",
".",
"ExitTerminal",
")",
"\n",
"}",
"\n",
"<mask>",
".",
"Exit",
"(",
"exitcodes",
".",
"ExitSuccess",
")",
"\n",
"}"
]
|
20,076 | all-20077 | [
"KeyStretcher",
"returns",
"a",
"set",
"of",
"keys",
"for",
"each",
"party",
"by",
"stretching",
"the",
"shared",
"key",
".",
"(",
"myIV",
"theirIV",
"myCipherKey",
"theirCipherKey",
"myMACKey",
"theirMACKey",
")"
]
| [
"func",
"KeyStretcher",
"(",
"cipherType",
"string",
",",
"hashType",
"string",
",",
"secret",
"[",
"]",
"byte",
")",
"(",
"StretchedKeys",
",",
"StretchedKeys",
")",
"{",
"var",
"cipherKeySize",
"int",
"\n",
"var",
"ivSize",
"int",
"\n",
"switch",
"cipherType",
"{",
"case",
"\"",
"\"",
":",
"ivSize",
"=",
"16",
"\n",
"cipherKeySize",
"=",
"16",
"\n",
"case",
"\"",
"\"",
":",
"ivSize",
"=",
"16",
"\n",
"cipherKeySize",
"=",
"32",
"\n",
"case",
"\"",
"\"",
":",
"ivSize",
"=",
"8",
"\n",
"// Note: 24 arbitrarily selected, needs more thought",
"cipherKeySize",
"=",
"32",
"\n",
"}",
"\n\n",
"hmacKeySize",
":=",
"20",
"\n\n",
"seed",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"2",
"*",
"(",
"ivSize",
"+",
"cipherKeySize",
"+",
"hmacKeySize",
")",
")",
"\n\n",
"var",
"h",
"func",
"(",
")",
"hash",
".",
"Hash",
"\n\n",
"switch",
"hashType",
"{",
"case",
"\"",
"\"",
":",
"h",
"=",
"sha1",
".",
"New",
"\n",
"case",
"\"",
"\"",
":",
"h",
"=",
"sha256",
".",
"New",
"\n",
"case",
"\"",
"\"",
":",
"h",
"=",
"sha512",
".",
"New",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"m",
":=",
"hmac",
".",
"New",
"(",
"h",
",",
"<mask>",
")",
"\n",
"// note: guaranteed to never return an error",
"m",
".",
"Write",
"(",
"seed",
")",
"\n\n",
"a",
":=",
"m",
".",
"Sum",
"(",
"nil",
")",
"\n\n",
"j",
":=",
"0",
"\n",
"for",
"j",
"<",
"len",
"(",
"result",
")",
"{",
"m",
".",
"Reset",
"(",
")",
"\n\n",
"// note: guaranteed to never return an error.",
"m",
".",
"Write",
"(",
"a",
")",
"\n",
"m",
".",
"Write",
"(",
"seed",
")",
"\n\n",
"b",
":=",
"m",
".",
"Sum",
"(",
"nil",
")",
"\n\n",
"todo",
":=",
"len",
"(",
"b",
")",
"\n\n",
"if",
"j",
"+",
"todo",
">",
"len",
"(",
"result",
")",
"{",
"todo",
"=",
"len",
"(",
"result",
")",
"-",
"j",
"\n",
"}",
"\n\n",
"copy",
"(",
"result",
"[",
"j",
":",
"j",
"+",
"todo",
"]",
",",
"b",
")",
"\n\n",
"j",
"+=",
"todo",
"\n\n",
"m",
".",
"Reset",
"(",
")",
"\n\n",
"// note: guaranteed to never return an error.",
"m",
".",
"Write",
"(",
"a",
")",
"\n\n",
"a",
"=",
"m",
".",
"Sum",
"(",
"nil",
")",
"\n",
"}",
"\n\n",
"half",
":=",
"len",
"(",
"result",
")",
"/",
"2",
"\n",
"r1",
":=",
"result",
"[",
":",
"half",
"]",
"\n",
"r2",
":=",
"result",
"[",
"half",
":",
"]",
"\n\n",
"var",
"k1",
"StretchedKeys",
"\n",
"var",
"k2",
"StretchedKeys",
"\n\n",
"k1",
".",
"IV",
"=",
"r1",
"[",
"0",
":",
"ivSize",
"]",
"\n",
"k1",
".",
"CipherKey",
"=",
"r1",
"[",
"ivSize",
":",
"ivSize",
"+",
"cipherKeySize",
"]",
"\n",
"k1",
".",
"MacKey",
"=",
"r1",
"[",
"ivSize",
"+",
"cipherKeySize",
":",
"]",
"\n\n",
"k2",
".",
"IV",
"=",
"r2",
"[",
"0",
":",
"ivSize",
"]",
"\n",
"k2",
".",
"CipherKey",
"=",
"r2",
"[",
"ivSize",
":",
"ivSize",
"+",
"cipherKeySize",
"]",
"\n",
"k2",
".",
"MacKey",
"=",
"r2",
"[",
"ivSize",
"+",
"cipherKeySize",
":",
"]",
"\n\n",
"return",
"k1",
",",
"k2",
"\n",
"}"
]
|
20,077 | all-20078 | [
"render",
"calls",
"the",
"user",
"provided",
"Render",
"and",
"than",
"renders",
"the",
"widgets",
"in",
"the",
"window",
"."
]
| [
"func",
"(",
"w",
"*",
"Window",
")",
"render",
"(",
")",
"{",
"w",
".",
"mgr",
".",
"Render",
"(",
"w",
")",
"\n\n",
"// iterate over widgets",
"for",
"_",
",",
"widget",
":=",
"<mask>",
"w",
".",
"widgets",
"{",
"widget",
".",
"Render",
"(",
")",
"\n",
"}",
"\n\n",
"// focus on a widget",
"w",
".",
"focusWidget",
"(",
")",
"\n",
"}"
]
|
20,078 | all-20079 | [
"ParseWithDefaults",
"will",
"load",
"options",
"from",
"the",
"specified",
"map",
"or",
"set",
"defaults",
"where",
"appropriate"
]
| [
"func",
"(",
"opts",
"*",
"jwtOptions",
")",
"ParseWithDefaults",
"(",
"optMap",
"<mask>",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"if",
"opts",
".",
"TTL",
"==",
"0",
"&&",
"optMap",
"[",
"optTTL",
"]",
"==",
"\"",
"\"",
"{",
"opts",
".",
"TTL",
"=",
"DefaultTTL",
"\n",
"}",
"\n\n",
"return",
"opts",
".",
"Parse",
"(",
"optMap",
")",
"\n",
"}"
]
|
20,079 | all-20080 | [
"doDec",
"decodes",
"in",
"as",
"a",
"JWT",
"."
]
| [
"func",
"doDec",
"(",
"signer",
"jwt",
".",
"Signer",
",",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// decode token",
"ut",
":=",
"UnstructuredToken",
"{",
"}",
"\n",
"err",
"=",
"signer",
".",
"Decode",
"(",
"bytes",
".",
"TrimSpace",
"(",
"in",
")",
",",
"&",
"ut",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// pretty format output",
"out",
",",
"err",
":=",
"json",
".",
"MarshalIndent",
"(",
"&",
"ut",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"out",
",",
"nil",
"\n",
"}"
]
|
20,080 | all-20081 | [
"Lexes",
"a",
"comment",
"line"
]
| [
"func",
"lexComment",
"(",
"l",
"*",
"Lexer",
")",
"stateFn",
"{",
"l",
".",
"skipWhitespace",
"(",
")",
"\n\n",
"// if strings.HasPrefix(l.remaining(), comment) {",
"// skip comment //",
"l",
".",
"Pos",
"+=",
"len",
"(",
"comment",
")",
"\n\n",
"// find next new line and add location to pos which",
"// advances the scanner",
"if",
"index",
":=",
"strings",
".",
"<mask>",
"(",
"l",
".",
"remaining",
"(",
")",
",",
"\"",
"\\n",
"\"",
")",
";",
"index",
">",
"0",
"{",
"l",
".",
"Pos",
"+=",
"index",
"\n",
"}",
"else",
"{",
"l",
".",
"Pos",
"+=",
"len",
"(",
"l",
".",
"remaining",
"(",
")",
")",
"\n",
"// l.emit(TokenComment)",
"// break",
"}",
"\n\n",
"// emit the comment string",
"l",
".",
"emit",
"(",
"TokenComment",
")",
"\n\n",
"l",
".",
"skipWhitespace",
"(",
")",
"\n",
"// }",
"// continue on scanner",
"return",
"lexText",
"\n",
"}"
]
|
20,081 | all-20082 | [
"ExplainCmd",
"represents",
"the",
"explain",
"command"
]
| [
"func",
"ExplainCmd",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"exo",
"=",
"&",
"cli",
".",
"ExplainOptions",
"{",
"}",
"\n\n",
"var",
"cmd",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Output expected and actual state of the given cluster`",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"switch",
"len",
"(",
"args",
")",
"{",
"case",
"0",
":",
"exo",
".",
"Name",
"=",
"viper",
".",
"GetString",
"(",
"keyKubicornName",
")",
"\n",
"case",
"1",
":",
"exo",
".",
"<mask>",
"=",
"args",
"[",
"0",
"]",
"\n",
"default",
":",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"runExplain",
"(",
"exo",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"}",
",",
"}",
"\n\n",
"fs",
":=",
"cmd",
".",
"Flags",
"(",
")",
"\n\n",
"bindCommonStateStoreFlags",
"(",
"&",
"exo",
".",
"StateStoreOptions",
",",
"fs",
")",
"\n",
"bindCommonAwsFlags",
"(",
"&",
"exo",
".",
"AwsOptions",
",",
"fs",
")",
"\n\n",
"fs",
".",
"StringVarP",
"(",
"&",
"exo",
".",
"Output",
",",
"keyOutput",
",",
"\"",
"\"",
",",
"viper",
".",
"GetString",
"(",
"keyOutput",
")",
",",
"descOutput",
")",
"\n",
"fs",
".",
"StringVar",
"(",
"&",
"exo",
".",
"GitRemote",
",",
"keyGitConfig",
",",
"viper",
".",
"GetString",
"(",
"keyGitConfig",
")",
",",
"descGitConfig",
")",
"\n\n",
"return",
"cmd",
"\n",
"}"
]
|
20,082 | all-20083 | [
"withStateFuncs",
"adds",
"functions",
"to",
"the",
"template",
"that",
"are",
"dependent",
"upon",
"state",
"."
]
| [
"func",
"(",
"t",
"*",
"Template",
")",
"withStateFuncs",
"(",
"td",
"TemplateData",
")",
"*",
"template",
".",
"<mask>",
"{",
"return",
"t",
".",
"template",
".",
"Funcs",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"td",
".",
"global",
".",
"goType",
",",
"}",
")",
"\n",
"}"
]
|
20,083 | all-20084 | [
"AddJobIndexes",
"will",
"add",
"job",
"indexes",
"to",
"the",
"specified",
"indexer",
".",
"If",
"removeAfter",
"is",
"specified",
"completed",
"and",
"cancelled",
"jobs",
"are",
"automatically",
"removed",
"when",
"their",
"finished",
"timestamp",
"falls",
"behind",
"the",
"specified",
"duration",
".",
"Note",
":",
"It",
"is",
"recommended",
"to",
"create",
"custom",
"indexes",
"that",
"support",
"the",
"exact",
"nature",
"of",
"data",
"and",
"access",
"patterns",
"."
]
| [
"func",
"AddJobIndexes",
"(",
"indexer",
"*",
"coal",
".",
"Indexer",
",",
"removeAfter",
"time",
".",
"Duration",
")",
"{",
"// add name index",
"indexer",
".",
"Add",
"(",
"&",
"Job",
"{",
"}",
",",
"false",
",",
"0",
",",
"\"",
"\"",
")",
"\n\n",
"// add status index",
"indexer",
".",
"Add",
"(",
"&",
"Job",
"{",
"}",
",",
"false",
",",
"0",
",",
"\"",
"\"",
")",
"\n\n",
"// add finished index",
"indexer",
".",
"Add",
"(",
"&",
"Job",
"{",
"}",
",",
"<mask>",
",",
"removeAfter",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
20,084 | all-20085 | [
"DrawHorizontalLine",
"draws",
"the",
"part",
"of",
"the",
"horizontal",
"line",
"that",
"is",
"inside",
"current",
"clipping",
"rectangle"
]
| [
"func",
"DrawHorizontalLine",
"(",
"x",
",",
"y",
",",
"w",
"int",
",",
"r",
"rune",
")",
"{",
"x",
",",
"y",
",",
"w",
",",
"_",
"=",
"<mask>",
"(",
"x",
",",
"y",
",",
"w",
",",
"1",
")",
"\n",
"if",
"w",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"x",
";",
"i",
"<",
"x",
"+",
"w",
";",
"i",
"++",
"{",
"putCharUnsafe",
"(",
"i",
",",
"y",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
]
|
20,085 | all-20086 | [
"retrieve",
"the",
"index",
"of",
"a",
"named",
"uniform",
"block"
]
| [
"func",
"GetUniformBlockIndex",
"(",
"program",
"uint32",
",",
"uniformBlockName",
"*",
"uint8",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGetUniformBlockIndex",
",",
"2",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformBlockName",
")",
")",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
]
|
20,086 | all-20087 | [
"ScrubGRPC",
"removes",
"GRPC",
"error",
"code",
"information",
"from",
"err",
"if",
"it",
"came",
"from",
"GRPC",
"(",
"and",
"returns",
"it",
"unchanged",
"otherwise",
")"
]
| [
"func",
"ScrubGRPC",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"s",
",",
"ok",
":=",
"status",
".",
"FromError",
"(",
"err",
")",
";",
"ok",
"{",
"return",
"<mask>",
".",
"New",
"(",
"s",
".",
"Message",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,087 | all-20088 | [
"join",
"is",
"a",
"version",
"of",
"strings",
".",
"Join",
"that",
"can",
"be",
"piped"
]
| [
"func",
"<mask>",
"(",
"sep",
"string",
",",
"a",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"strings",
".",
"Join",
"(",
"a",
",",
"sep",
")",
",",
"nil",
"\n",
"}"
]
|
20,088 | all-20089 | [
"NewIter",
"returns",
"a",
"newly",
"created",
"iterator",
"with",
"the",
"provided",
"parameters",
".",
"Using",
"this",
"method",
"is",
"not",
"recommended",
"unless",
"the",
"desired",
"functionality",
"is",
"not",
"yet",
"exposed",
"via",
"a",
"more",
"convenient",
"interface",
"(",
"Find",
"Pipe",
"etc",
")",
".",
"The",
"optional",
"session",
"parameter",
"associates",
"the",
"lifetime",
"of",
"the",
"returned",
"iterator",
"to",
"an",
"arbitrary",
"session",
".",
"If",
"nil",
"the",
"iterator",
"will",
"be",
"bound",
"to",
"c",
"s",
"session",
".",
"Documents",
"in",
"firstBatch",
"will",
"be",
"individually",
"provided",
"by",
"the",
"returned",
"iterator",
"before",
"documents",
"from",
"cursorId",
"are",
"made",
"available",
".",
"If",
"cursorId",
"is",
"zero",
"only",
"the",
"documents",
"in",
"firstBatch",
"are",
"provided",
".",
"If",
"err",
"is",
"not",
"nil",
"the",
"iterator",
"s",
"Err",
"method",
"will",
"report",
"it",
"after",
"exhausting",
"documents",
"in",
"firstBatch",
".",
"NewIter",
"must",
"be",
"called",
"right",
"after",
"the",
"cursor",
"id",
"is",
"obtained",
"and",
"must",
"not",
"be",
"called",
"on",
"a",
"collection",
"in",
"Eventual",
"mode",
"because",
"the",
"cursor",
"id",
"is",
"associated",
"with",
"the",
"specific",
"server",
"that",
"returned",
"it",
".",
"The",
"provided",
"session",
"parameter",
"may",
"be",
"in",
"any",
"mode",
"or",
"state",
"though",
"."
]
| [
"func",
"(",
"c",
"*",
"Collection",
")",
"NewIter",
"(",
"session",
"*",
"Session",
",",
"firstBatch",
"[",
"]",
"bson",
".",
"Raw",
",",
"cursorId",
"int64",
",",
"err",
"error",
")",
"*",
"Iter",
"{",
"var",
"server",
"*",
"mongoServer",
"\n",
"csession",
":=",
"c",
".",
"Database",
".",
"Session",
"\n",
"csession",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"socket",
":=",
"csession",
".",
"masterSocket",
"\n",
"if",
"socket",
"==",
"nil",
"{",
"socket",
"=",
"csession",
".",
"slaveSocket",
"\n",
"}",
"\n",
"if",
"socket",
"!=",
"nil",
"{",
"server",
"=",
"socket",
".",
"Server",
"(",
")",
"\n",
"}",
"\n",
"csession",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"server",
"==",
"nil",
"{",
"if",
"csession",
".",
"Mode",
"(",
")",
"==",
"Eventual",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"session",
"==",
"nil",
"{",
"<mask>",
"=",
"csession",
"\n",
"}",
"\n\n",
"iter",
":=",
"&",
"Iter",
"{",
"session",
":",
"session",
",",
"server",
":",
"server",
",",
"timeout",
":",
"-",
"1",
",",
"err",
":",
"err",
",",
"}",
"\n",
"iter",
".",
"gotReply",
".",
"L",
"=",
"&",
"iter",
".",
"m",
"\n",
"for",
"_",
",",
"doc",
":=",
"range",
"firstBatch",
"{",
"iter",
".",
"docData",
".",
"Push",
"(",
"doc",
".",
"Data",
")",
"\n",
"}",
"\n",
"if",
"cursorId",
"!=",
"0",
"{",
"iter",
".",
"op",
".",
"cursorId",
"=",
"cursorId",
"\n",
"iter",
".",
"op",
".",
"collection",
"=",
"c",
".",
"FullName",
"\n",
"iter",
".",
"op",
".",
"replyFunc",
"=",
"iter",
".",
"replyFunc",
"(",
")",
"\n",
"}",
"\n",
"return",
"iter",
"\n",
"}"
]
|
20,089 | all-20090 | [
"AddStatus",
"is",
"an",
"alternative",
"Label",
"initializer",
".",
"A",
"Status",
"is",
"a",
"label",
"that",
"has",
"the",
"property",
"that",
"it",
"fills",
"an",
"entire",
"line",
"and",
"is",
"justified",
".",
"This",
"call",
"implements",
"the",
"NewWidget",
"convention",
"by",
"taking",
"a",
"*",
"Window",
"and",
"and",
"an",
"anchor",
"point",
"to",
"render",
"the",
"widget",
"."
]
| [
"func",
"(",
"w",
"*",
"Window",
")",
"AddStatus",
"(",
"y",
"int",
",",
"j",
"Justify",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"Label",
"{",
"l",
",",
"_",
":=",
"w",
".",
"AddWidget",
"(",
"WidgetLabel",
",",
"0",
",",
"y",
")",
"\n",
"label",
":=",
"l",
".",
"(",
"*",
"Label",
")",
"\n",
"label",
".",
"Resize",
"(",
")",
"\n",
"<mask>",
".",
"status",
"=",
"true",
"\n",
"label",
".",
"justify",
"=",
"j",
"\n\n",
"// flip attributes",
"a",
":=",
"defaultAttributes",
"(",
")",
"\n",
"a2",
":=",
"Attributes",
"{",
"Fg",
":",
"a",
".",
"Bg",
",",
"Bg",
":",
"a",
".",
"Fg",
",",
"}",
"\n",
"label",
".",
"SetAttributes",
"(",
"a2",
")",
"\n\n",
"// print",
"label",
".",
"SetText",
"(",
"format",
",",
"args",
"...",
")",
"\n\n",
"return",
"label",
"\n",
"}"
]
|
20,090 | all-20091 | [
"ResolvedAt",
"returns",
"true",
"iff",
"the",
"activity",
"interval",
"ended",
"before",
"the",
"given",
"timestamp",
"."
]
| [
"func",
"(",
"a",
"*",
"Alert",
")",
"ResolvedAt",
"(",
"ts",
"time",
".",
"Time",
")",
"bool",
"{",
"if",
"a",
".",
"EndsAt",
".",
"IsZero",
"(",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"!",
"a",
".",
"EndsAt",
".",
"After",
"(",
"ts",
")",
"\n",
"}"
]
|
20,091 | all-20092 | [
"yaml_writer_write_handler",
"uses",
"emitter",
".",
"output_writer",
"to",
"write",
"the",
"emitted",
"text",
"."
]
| [
"func",
"yaml_writer_write_handler",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"_",
",",
"err",
":=",
"emitter",
".",
"output_writer",
".",
"Write",
"(",
"buffer",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,092 | all-20093 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Return",
"a",
"list",
"of",
"possible",
"prices",
"for",
"EC2",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#getPrices"
]
| [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"GetPrices",
"(",
")",
"(",
"*",
"ListOfPrices",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"eC2Manager",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"ListOfPrices",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListOfPrices",
")",
",",
"err",
"\n",
"}"
]
|
20,093 | all-20094 | [
"NewErrorStatus",
"creates",
"an",
"error",
"that",
"implements",
"ErrorStatus",
"based",
"off",
"a",
"string"
]
| [
"func",
"NewErrorStatus",
"(",
"status",
"int",
",",
"err",
"string",
")",
"error",
"{",
"return",
"&",
"errStatus",
"{",
"error",
":",
"errors",
".",
"New",
"(",
"err",
")",
",",
"status",
":",
"<mask>",
",",
"}",
"\n",
"}"
]
|
20,094 | all-20095 | [
"GetScreen",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_screen",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Display",
")",
"GetScreen",
"(",
"screenNum",
"int",
")",
"(",
"*",
"Screen",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_screen",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"screenNum",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"Screen",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
]
|
20,095 | all-20096 | [
"OperationLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
]
| [
"func",
"(",
"api",
"*",
"API",
")",
"OperationLocator",
"(",
"href",
"<mask>",
")",
"*",
"OperationLocator",
"{",
"return",
"&",
"OperationLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
]
|
20,096 | all-20097 | [
"BuilderNew",
"is",
"a",
"wrapper",
"around",
"gtk_builder_new",
"()",
"."
]
| [
"func",
"BuilderNew",
"(",
")",
"(",
"*",
"Builder",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_builder_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"&",
"<mask>",
"{",
"obj",
"}",
",",
"nil",
"\n",
"}"
]
|
20,097 | all-20098 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetFrameOwnerParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom41",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
20,098 | all-20099 | [
"GetUri",
"is",
"a",
"wrapper",
"around",
"gtk_link_button_get_uri",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"LinkButton",
")",
"GetUri",
"(",
")",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_link_button_get_uri",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"goString",
"(",
"c",
")",
"\n",
"}"
]
|
20,099 | all-20100 | [
"HeaderByNumber",
"returns",
"a",
"Ethereum",
"block",
"header",
"from",
"the",
"current",
"canonical",
"chain",
".",
"If",
"number",
"is",
"nil",
"the",
"latest",
"known",
"header",
"is",
"returned",
"."
]
| [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"HeaderByNumber",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"number",
"*",
"big",
".",
"Int",
")",
"(",
"*",
"types",
".",
"Header",
",",
"error",
")",
"{",
"return",
"b",
".",
"conn",
".",
"ethClient",
"(",
")",
".",
"HeaderByNumber",
"(",
"ctx",
",",
"number",
")",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.