id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
13,100 | all-13101 | [
"Ensure",
"that",
"prefix",
"-",
"conflicting",
"implementing",
"concrete",
"types",
"are",
"all",
"registered",
"in",
"the",
"priority",
"list",
".",
"Returns",
"an",
"error",
"if",
"a",
"disamb",
"conflict",
"is",
"found",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"checkConflictsInPrio_nolock",
"(",
"iinfo",
"*",
"TypeInfo",
")",
"error",
"{",
"for",
"_",
",",
"cinfos",
":=",
"range",
"iinfo",
".",
"Implementers",
"{",
"if",
"len",
"(",
"cinfos",
")",
"<",
"2",
"{",
"<mask>",
"\n",
"}",
"\n",
"for",
"_",
",",
"cinfo",
":=",
"range",
"cinfos",
"{",
"var",
"inPrio",
"=",
"false",
"\n",
"for",
"_",
",",
"disfix",
":=",
"range",
"iinfo",
".",
"InterfaceInfo",
".",
"Priority",
"{",
"if",
"cinfo",
".",
"GetDisfix",
"(",
")",
"==",
"disfix",
"{",
"inPrio",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"inPrio",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cinfo",
".",
"Type",
",",
"len",
"(",
"cinfos",
")",
",",
"iinfo",
".",
"Type",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,101 | all-13102 | [
"GetIndices",
"is",
"a",
"wrapper",
"around",
"gtk_tree_path_get_indices_with_depth"
] | [
"func",
"(",
"v",
"*",
"TreePath",
")",
"GetIndices",
"(",
")",
"[",
"]",
"int",
"{",
"var",
"depth",
"C",
".",
"gint",
"\n",
"var",
"goindices",
"[",
"]",
"int",
"\n",
"var",
"ginthelp",
"C",
".",
"gint",
"\n",
"indices",
":=",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"gtk_tree_path_get_indices_with_depth",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"depth",
")",
")",
")",
"\n",
"<mask>",
":=",
"unsafe",
".",
"Sizeof",
"(",
"ginthelp",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"int",
"(",
"depth",
")",
";",
"i",
"++",
"{",
"goind",
":=",
"int",
"(",
"*",
"(",
"(",
"*",
"C",
".",
"gint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"indices",
")",
")",
")",
")",
"\n",
"goindices",
"=",
"append",
"(",
"goindices",
",",
"goind",
")",
"\n",
"indices",
"+=",
"size",
"\n",
"}",
"\n",
"return",
"goindices",
"\n",
"}"
] |
13,102 | all-13103 | [
"Sync",
"runs",
"one",
"sync",
"iteration",
"."
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Sync",
"(",
")",
"error",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"duration",
":=",
"time",
".",
"Since",
"(",
"start",
")",
"\n",
"c",
".",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"duration",
".",
"String",
"(",
")",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"tideMetrics",
".",
"syncDuration",
".",
"Set",
"(",
"duration",
".",
"Seconds",
"(",
")",
")",
"\n",
"}",
"(",
")",
"\n",
"defer",
"c",
".",
"changedFiles",
".",
"prune",
"(",
")",
"\n\n",
"c",
".",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"prs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"PullRequest",
")",
"\n",
"for",
"_",
",",
"query",
":=",
"<mask>",
"c",
".",
"config",
"(",
")",
".",
"Tide",
".",
"Queries",
"{",
"q",
":=",
"query",
".",
"Query",
"(",
")",
"\n",
"results",
",",
"err",
":=",
"search",
"(",
"c",
".",
"ghc",
".",
"Query",
",",
"c",
".",
"logger",
",",
"q",
",",
"time",
".",
"Time",
"{",
"}",
",",
"time",
".",
"Now",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"len",
"(",
"results",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"q",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"q",
")",
".",
"Warning",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"pr",
":=",
"range",
"results",
"{",
"prs",
"[",
"prKey",
"(",
"&",
"pr",
")",
"]",
"=",
"pr",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
".",
"String",
"(",
")",
",",
")",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"len",
"(",
"prs",
")",
")",
"\n\n",
"var",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
"\n",
"var",
"blocks",
"blockers",
".",
"Blockers",
"\n",
"var",
"err",
"error",
"\n",
"if",
"len",
"(",
"prs",
")",
">",
"0",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"pjList",
",",
"err",
":=",
"c",
".",
"prowJobClient",
".",
"List",
"(",
"metav1",
".",
"ListOptions",
"{",
"LabelSelector",
":",
"labels",
".",
"Everything",
"(",
")",
".",
"String",
"(",
")",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
".",
"String",
"(",
")",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"c",
".",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
".",
"String",
"(",
")",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"pjs",
"=",
"pjList",
".",
"Items",
"\n\n",
"if",
"label",
":=",
"c",
".",
"config",
"(",
")",
".",
"Tide",
".",
"BlockerLabel",
";",
"label",
"!=",
"\"",
"\"",
"{",
"c",
".",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"label",
")",
"\n",
"orgExcepts",
",",
"repos",
":=",
"c",
".",
"config",
"(",
")",
".",
"Tide",
".",
"Queries",
".",
"OrgExceptionsAndRepos",
"(",
")",
"\n",
"orgs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"orgExcepts",
")",
")",
"\n",
"for",
"org",
":=",
"range",
"orgExcepts",
"{",
"orgs",
"=",
"append",
"(",
"orgs",
",",
"org",
")",
"\n",
"}",
"\n",
"orgRepoQuery",
":=",
"orgRepoQueryString",
"(",
"orgs",
",",
"repos",
".",
"UnsortedList",
"(",
")",
",",
"orgExcepts",
")",
"\n",
"blocks",
",",
"err",
"=",
"blockers",
".",
"FindAll",
"(",
"c",
".",
"ghc",
",",
"c",
".",
"logger",
",",
"label",
",",
"orgRepoQuery",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Partition PRs into subpools and filter out non-pool PRs.",
"rawPools",
",",
"err",
":=",
"c",
".",
"dividePool",
"(",
"prs",
",",
"pjs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"filteredPools",
":=",
"c",
".",
"filterSubpools",
"(",
"c",
".",
"config",
"(",
")",
".",
"Tide",
".",
"MaxGoroutines",
",",
"rawPools",
")",
"\n\n",
"// Notify statusController about the new pool.",
"c",
".",
"sc",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"sc",
".",
"poolPRs",
"=",
"poolPRMap",
"(",
"filteredPools",
")",
"\n",
"select",
"{",
"case",
"c",
".",
"sc",
".",
"newPoolPending",
"<-",
"true",
":",
"default",
":",
"}",
"\n",
"c",
".",
"sc",
".",
"Unlock",
"(",
")",
"\n\n",
"// Sync subpools in parallel.",
"poolChan",
":=",
"make",
"(",
"chan",
"Pool",
",",
"len",
"(",
"filteredPools",
")",
")",
"\n",
"subpoolsInParallel",
"(",
"c",
".",
"config",
"(",
")",
".",
"Tide",
".",
"MaxGoroutines",
",",
"filteredPools",
",",
"func",
"(",
"sp",
"*",
"subpool",
")",
"{",
"pool",
",",
"err",
":=",
"c",
".",
"syncSubpool",
"(",
"*",
"sp",
",",
"blocks",
".",
"GetApplicable",
"(",
"sp",
".",
"org",
",",
"sp",
".",
"repo",
",",
"sp",
".",
"branch",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"sp",
".",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"poolChan",
"<-",
"pool",
"\n",
"}",
",",
")",
"\n\n",
"close",
"(",
"poolChan",
")",
"\n",
"pools",
":=",
"make",
"(",
"[",
"]",
"Pool",
",",
"0",
",",
"len",
"(",
"poolChan",
")",
")",
"\n",
"for",
"pool",
":=",
"range",
"poolChan",
"{",
"pools",
"=",
"append",
"(",
"pools",
",",
"pool",
")",
"\n",
"}",
"\n",
"sortPools",
"(",
"pools",
")",
"\n",
"c",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"pools",
"=",
"pools",
"\n",
"c",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
".",
"History",
".",
"Flush",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,103 | all-13104 | [
"native",
"()",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkScaleButton",
"."
] | [
"func",
"(",
"v",
"*",
"ScaleButton",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkScaleButton",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkScaleButton",
"(",
"p",
")",
"\n",
"}"
] |
13,104 | all-13105 | [
"query",
"the",
"bindings",
"of",
"color",
"indices",
"to",
"user",
"-",
"defined",
"varying",
"out",
"variables"
] | [
"func",
"GetFragDataIndex",
"(",
"program",
"uint32",
",",
"name",
"*",
"uint8",
")",
"int32",
"{",
"ret",
":=",
"C",
".",
"glowGetFragDataIndex",
"(",
"gpGetFragDataIndex",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
13,105 | all-13106 | [
"ContainerConfigInsert",
"inserts",
"a",
"new",
"config",
"for",
"the",
"container",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"ContainerConfigInsert",
"(",
"<mask>",
"*",
"sql",
".",
"Tx",
",",
"id",
"int",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"str",
":=",
"\"",
"\"",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"config",
"{",
"if",
"v",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"_",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"id",
",",
"k",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"k",
",",
"v",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,106 | all-13107 | [
"MoveAfter",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_list_store_move_after",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ListStore",
")",
"MoveAfter",
"(",
"iter",
",",
"position",
"*",
"TreeIter",
")",
"{",
"C",
".",
"gtk_list_store_move_after",
"(",
"v",
".",
"native",
"(",
")",
",",
"iter",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
13,107 | all-13108 | [
"endpointsForHostname",
"returns",
"the",
"endpoint",
"objects",
"for",
"each",
"host",
"-",
"target",
"combination",
"."
] | [
"func",
"endpointsForHostname",
"(",
"hostname",
"string",
",",
"targets",
"endpoint",
".",
"Targets",
",",
"ttl",
"endpoint",
".",
"TTL",
",",
"providerSpecific",
"endpoint",
".",
"ProviderSpecific",
")",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"{",
"var",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"\n\n",
"var",
"aTargets",
"endpoint",
".",
"Targets",
"\n",
"var",
"cnameTargets",
"endpoint",
".",
"Targets",
"\n\n",
"for",
"_",
",",
"t",
":=",
"<mask>",
"targets",
"{",
"switch",
"suitableType",
"(",
"t",
")",
"{",
"case",
"endpoint",
".",
"RecordTypeA",
":",
"aTargets",
"=",
"append",
"(",
"aTargets",
",",
"t",
")",
"\n",
"default",
":",
"cnameTargets",
"=",
"append",
"(",
"cnameTargets",
",",
"t",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"aTargets",
")",
">",
"0",
"{",
"epA",
":=",
"&",
"endpoint",
".",
"Endpoint",
"{",
"DNSName",
":",
"strings",
".",
"TrimSuffix",
"(",
"hostname",
",",
"\"",
"\"",
")",
",",
"Targets",
":",
"aTargets",
",",
"RecordTTL",
":",
"ttl",
",",
"RecordType",
":",
"endpoint",
".",
"RecordTypeA",
",",
"Labels",
":",
"endpoint",
".",
"NewLabels",
"(",
")",
",",
"ProviderSpecific",
":",
"providerSpecific",
",",
"}",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"epA",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"cnameTargets",
")",
">",
"0",
"{",
"epCNAME",
":=",
"&",
"endpoint",
".",
"Endpoint",
"{",
"DNSName",
":",
"strings",
".",
"TrimSuffix",
"(",
"hostname",
",",
"\"",
"\"",
")",
",",
"Targets",
":",
"cnameTargets",
",",
"RecordTTL",
":",
"ttl",
",",
"RecordType",
":",
"endpoint",
".",
"RecordTypeCNAME",
",",
"Labels",
":",
"endpoint",
".",
"NewLabels",
"(",
")",
",",
"ProviderSpecific",
":",
"providerSpecific",
",",
"}",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"epCNAME",
")",
"\n",
"}",
"\n\n",
"return",
"endpoints",
"\n",
"}"
] |
13,108 | all-13109 | [
"LimitBody",
"will",
"limit",
"reading",
"from",
"the",
"body",
"of",
"the",
"supplied",
"request",
"to",
"the",
"specified",
"amount",
"of",
"bytes",
".",
"Earlier",
"calls",
"to",
"LimitBody",
"will",
"be",
"overwritten",
"which",
"essentially",
"allows",
"callers",
"to",
"increase",
"the",
"limit",
"from",
"a",
"default",
"limit",
"."
] | [
"func",
"LimitBody",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"n",
"int64",
")",
"{",
"// get original body from existing limiter",
"if",
"bl",
",",
"ok",
":=",
"r",
".",
"Body",
".",
"(",
"*",
"BodyLimiter",
")",
";",
"ok",
"{",
"r",
".",
"Body",
"=",
"bl",
".",
"Original",
"\n",
"}",
"\n\n",
"// set new limiter",
"r",
".",
"<mask>",
"=",
"NewBodyLimiter",
"(",
"w",
",",
"r",
",",
"n",
")",
"\n",
"}"
] |
13,109 | all-13110 | [
"New",
"returns",
"a",
"new",
"DB",
".",
"If",
"any",
"error",
"occurs",
"it",
"returns",
"nil",
"and",
"error",
"."
] | [
"func",
"New",
"(",
"dialect",
"Dialect",
",",
"dsn",
"string",
")",
"(",
"*",
"DB",
",",
"error",
")",
"{",
"db",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"dialect",
".",
"Name",
"(",
")",
",",
"dsn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"DB",
"{",
"db",
":",
"<mask>",
",",
"dialect",
":",
"dialect",
",",
"logger",
":",
"defaultLogger",
"}",
",",
"nil",
"\n",
"}"
] |
13,110 | all-13111 | [
"backoff",
"computes",
"a",
"random",
"exponential",
"backoff",
"value",
"for",
"a",
"given",
"number",
"of",
"attempts",
"and",
"boundaries",
"of",
"min",
"and",
"max",
"backoff",
"durations",
"."
] | [
"func",
"backoff",
"(",
"rand",
"*",
"rand",
".",
"Rand",
",",
"attempt",
"int",
",",
"min",
",",
"max",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"if",
"attempt",
"<=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"<mask>",
">",
"max",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Hardcoded backoff coefficient, maybe we'll make it configuration in the",
"// future?",
"const",
"coeff",
"=",
"2.0",
"\n",
"return",
"jitteredBackoff",
"(",
"rand",
",",
"attempt",
",",
"min",
",",
"max",
",",
"coeff",
")",
"\n",
"}"
] |
13,111 | all-13112 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ResolveAnimationReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,112 | all-13113 | [
"Redirect",
"Redirect",
"replies",
"to",
"the",
"request",
"with",
"a",
"redirect",
"to",
"url",
"which",
"may",
"be",
"a",
"path",
"relative",
"to",
"the",
"request",
"path",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"Redirect",
"(",
"<mask>",
"string",
",",
"code",
"int",
")",
"{",
"http",
".",
"Redirect",
"(",
"ctx",
".",
"ResponseWriter",
",",
"ctx",
".",
"Request",
",",
"url",
",",
"code",
")",
"\n",
"}"
] |
13,113 | all-13114 | [
"Delete",
"deletes",
"the",
"item",
"with",
"the",
"provided",
"key",
".",
"The",
"error",
"ErrCacheMiss",
"is",
"returned",
"if",
"the",
"item",
"didn",
"t",
"already",
"exist",
"in",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Delete",
"(",
"key",
"string",
")",
"error",
"{",
"cn",
",",
"err",
":=",
"c",
".",
"sendCommand",
"(",
"<mask>",
",",
"cmdDelete",
",",
"nil",
",",
"0",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"err",
"=",
"c",
".",
"parseResponse",
"(",
"key",
",",
"cn",
")",
"\n",
"c",
".",
"condRelease",
"(",
"cn",
",",
"&",
"err",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
13,114 | all-13115 | [
"loadTarManifest",
"loads",
"and",
"decodes",
"the",
"manifest",
".",
"json",
"."
] | [
"func",
"(",
"s",
"*",
"Source",
")",
"loadTarManifest",
"(",
")",
"(",
"[",
"]",
"ManifestItem",
",",
"error",
")",
"{",
"// FIXME? Do we need to deal with the legacy format?",
"bytes",
",",
"err",
":=",
"s",
".",
"readTarComponent",
"(",
"manifestFileName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"items",
"[",
"]",
"ManifestItem",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"&",
"items",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"items",
",",
"nil",
"\n",
"}"
] |
13,115 | all-13116 | [
"ClientPreServiceTerminate",
"terminates",
"service",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientPreServiceTerminate",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
")",
"\n\n",
"ch",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobClientPreServiceTerminate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n\n",
"if",
"ch",
".",
"ServiceStatus",
"==",
"data",
".",
"ServiceActive",
"{",
"ch",
".",
"ServiceStatus",
"=",
"data",
".",
"ServiceTerminating",
"\n",
"}",
"else",
"{",
"ch",
".",
"ServiceStatus",
"=",
"data",
".",
"ServiceTerminated",
"\n",
"}",
"\n\n",
"changedTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"ch",
".",
"ServiceChangedTime",
"=",
"&",
"changedTime",
"\n",
"err",
"=",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"ch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,116 | all-13117 | [
"Save",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"store",
"src"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"Save",
"(",
"store",
"string",
",",
"src",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"store",
",",
"src",
")",
"\n\n",
"var",
"r0",
"string",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"string",
",",
"<mask>",
"{",
"}",
")",
"string",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"store",
",",
"src",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"var",
"r1",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"1",
")",
".",
"(",
"func",
"(",
"string",
",",
"interface",
"{",
"}",
")",
"error",
")",
";",
"ok",
"{",
"r1",
"=",
"rf",
"(",
"store",
",",
"src",
")",
"\n",
"}",
"else",
"{",
"r1",
"=",
"ret",
".",
"Error",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
",",
"r1",
"\n",
"}"
] |
13,117 | all-13118 | [
"title",
":",
"add",
"permissions",
"path",
":",
"/",
"roles",
"/",
"{",
"name",
"}",
"/",
"permissions",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"409",
":",
"Permission",
"not",
"allowed"
] | [
"func",
"addPermissions",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermRoleUpdatePermissionAdd",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"roleName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"<mask>",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeRole",
",",
"Value",
":",
"roleName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermRoleUpdatePermissionAdd",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermRoleReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"role",
",",
"err",
":=",
"permission",
".",
"FindRole",
"(",
"roleName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"users",
",",
"err",
":=",
"auth",
".",
"ListUsersWithRole",
"(",
"roleName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"runWithPermSync",
"(",
"users",
",",
"func",
"(",
")",
"error",
"{",
"permissions",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"return",
"role",
".",
"AddPermissions",
"(",
"permissions",
"...",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"==",
"permTypes",
".",
"ErrInvalidPermissionName",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"perr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"permTypes",
".",
"ErrPermissionNotFound",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"perr",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"perr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"permTypes",
".",
"ErrPermissionNotAllowed",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"perr",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
13,118 | all-13119 | [
"HasOperator",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsAssertion",
")",
"HasOperator",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Operator",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
13,119 | all-13120 | [
"Parameter",
"image",
"has",
"type",
"C",
".",
"GLeglImageOES",
"."
] | [
"func",
"EGLImageTargetTexStorageEXT",
"(",
"target",
"uint32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"attrib_list",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpEGLImageTargetTexStorageEXT",
",",
"3",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"image",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"attrib_list",
")",
")",
")",
"\n",
"}"
] |
13,120 | all-13121 | [
"isTerminator",
"returns",
"true",
"for",
"--",
"BOUNDARY",
"--"
] | [
"func",
"(",
"b",
"*",
"boundaryReader",
")",
"isTerminator",
"(",
"buf",
"[",
"]",
"byte",
")",
"bool",
"{",
"idx",
":=",
"bytes",
".",
"<mask>",
"(",
"buf",
",",
"b",
".",
"final",
")",
"\n",
"return",
"idx",
"!=",
"-",
"1",
"\n",
"}"
] |
13,121 | all-13122 | [
"SetSize",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_loader_set_size",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"PixbufLoader",
")",
"SetSize",
"(",
"width",
",",
"height",
"int",
")",
"{",
"C",
".",
"gdk_pixbuf_loader_set_size",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"int",
"(",
"width",
")",
",",
"C",
".",
"int",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
13,122 | all-13123 | [
"ImageLocate",
"returns",
"the",
"address",
"of",
"an",
"online",
"node",
"that",
"has",
"a",
"local",
"copy",
"of",
"the",
"given",
"image",
"or",
"an",
"empty",
"string",
"if",
"the",
"image",
"is",
"already",
"available",
"on",
"this",
"node",
".",
"If",
"the",
"image",
"is",
"not",
"available",
"on",
"any",
"online",
"node",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageLocate",
"(",
"fingerprint",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"`\nSELECT nodes.address FROM nodes\n LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id\n LEFT JOIN images ON images_nodes.image_id = images.id\nWHERE images.fingerprint = ?\n`",
"\n",
"var",
"localAddress",
"string",
"// Address of this node",
"\n",
"var",
"addresses",
"[",
"]",
"string",
"// Addresses of online nodes with the image",
"\n\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"offlineThreshold",
",",
"err",
":=",
"tx",
".",
"NodeOfflineThreshold",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"localAddress",
",",
"err",
"=",
"tx",
".",
"NodeAddress",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allAddresses",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"tx",
".",
"tx",
",",
"stmt",
",",
"fingerprint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"address",
":=",
"range",
"allAddresses",
"{",
"node",
",",
"err",
":=",
"tx",
".",
"NodeByAddress",
"(",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"address",
"!=",
"localAddress",
"&&",
"node",
".",
"IsOffline",
"(",
"offlineThreshold",
")",
"{",
"continue",
"\n",
"}",
"\n",
"addresses",
"=",
"<mask>",
"(",
"addresses",
",",
"address",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"addresses",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"address",
":=",
"range",
"addresses",
"{",
"if",
"address",
"==",
"localAddress",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"addresses",
"[",
"0",
"]",
",",
"nil",
"\n",
"}"
] |
13,123 | all-13124 | [
"Set",
"sets",
"the",
"value",
"at",
"the",
"sequence",
"of",
"subfields",
"with",
"the",
"value",
"a",
".",
"Numeric",
"indices",
"start",
"from",
"1",
"as",
"in",
"Lua",
":",
"if",
"we",
"started",
"from",
"zero",
"access",
"to",
"index",
"0",
"or",
"negative",
"indices",
"would",
"be",
"shifted",
"awkwardly",
"."
] | [
"func",
"(",
"lo",
"*",
"LuaObject",
")",
"Set",
"(",
"a",
"interface",
"{",
"}",
",",
"subfields",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"parentKeys",
":=",
"subfields",
"[",
":",
"len",
"(",
"subfields",
")",
"-",
"1",
"]",
"\n",
"<mask>",
",",
"err",
":=",
"lo",
".",
"GetObject",
"(",
"parentKeys",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"L",
":=",
"parent",
".",
"l",
"\n",
"parent",
".",
"Push",
"(",
")",
"\n",
"defer",
"L",
".",
"Pop",
"(",
"1",
")",
"\n\n",
"lastField",
":=",
"subfields",
"[",
"len",
"(",
"subfields",
")",
"-",
"1",
"]",
"\n",
"if",
"L",
".",
"IsTable",
"(",
"-",
"1",
")",
"{",
"GoToLuaProxy",
"(",
"L",
",",
"lastField",
")",
"\n",
"GoToLuaProxy",
"(",
"L",
",",
"a",
")",
"\n",
"L",
".",
"SetTable",
"(",
"-",
"3",
")",
"\n",
"}",
"else",
"if",
"L",
".",
"GetMetaField",
"(",
"-",
"1",
",",
"\"",
"\"",
")",
"{",
"L",
".",
"PushValue",
"(",
"-",
"2",
")",
"\n",
"GoToLuaProxy",
"(",
"L",
",",
"lastField",
")",
"\n",
"GoToLuaProxy",
"(",
"L",
",",
"a",
")",
"\n",
"err",
":=",
"L",
".",
"Call",
"(",
"3",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"L",
".",
"Pop",
"(",
"1",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"return",
"ErrLuaObjectIndexable",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,124 | all-13125 | [
"return",
"parameters",
"of",
"a",
"buffer",
"object"
] | [
"func",
"GetNamedBufferParameteriv",
"(",
"buffer",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetNamedBufferParameteriv",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
13,125 | all-13126 | [
"WriteCesu8",
"writes",
"an",
"UTF",
"-",
"8",
"byte",
"slice",
"as",
"CESU",
"-",
"8",
"and",
"returns",
"the",
"CESU",
"-",
"8",
"bytes",
"written",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteCesu8",
"(",
"p",
"[",
"]",
"byte",
")",
"int",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"w",
".",
"tr",
".",
"Reset",
"(",
")",
"\n",
"cnt",
":=",
"0",
"\n",
"i",
":=",
"0",
"\n",
"for",
"i",
"<",
"len",
"(",
"p",
")",
"{",
"m",
",",
"n",
",",
"err",
":=",
"w",
".",
"tr",
".",
"Transform",
"(",
"w",
".",
"b",
",",
"p",
"[",
"i",
":",
"]",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"<mask>",
".",
"ErrShortDst",
"{",
"w",
".",
"err",
"=",
"err",
"\n",
"return",
"cnt",
"\n",
"}",
"\n",
"if",
"m",
"==",
"0",
"{",
"w",
".",
"err",
"=",
"transform",
".",
"ErrShortDst",
"\n",
"return",
"cnt",
"\n",
"}",
"\n",
"o",
",",
"_",
":=",
"w",
".",
"wr",
".",
"Write",
"(",
"w",
".",
"b",
"[",
":",
"m",
"]",
")",
"\n",
"cnt",
"+=",
"o",
"\n",
"i",
"+=",
"n",
"\n",
"}",
"\n",
"return",
"cnt",
"\n",
"}"
] |
13,126 | all-13127 | [
"GetClientEmail",
"returns",
"the",
"ClientEmail",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCP",
")",
"GetClientEmail",
"(",
")",
"string",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"ClientEmail",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"i",
".",
"ClientEmail",
"\n",
"}"
] |
13,127 | all-13128 | [
"GetValue",
"returns",
"the",
"Value",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"GetValue",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Value",
"\n",
"}"
] |
13,128 | all-13129 | [
"MarshalPublicKey",
"converts",
"a",
"public",
"key",
"object",
"into",
"a",
"protobuf",
"serialized",
"public",
"key"
] | [
"func",
"MarshalPublicKey",
"(",
"k",
"PubKey",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pbmes",
":=",
"<mask>",
"(",
"pb",
".",
"PublicKey",
")",
"\n",
"pbmes",
".",
"Type",
"=",
"k",
".",
"Type",
"(",
")",
"\n",
"data",
",",
"err",
":=",
"k",
".",
"Raw",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pbmes",
".",
"Data",
"=",
"data",
"\n\n",
"return",
"proto",
".",
"Marshal",
"(",
"pbmes",
")",
"\n",
"}"
] |
13,129 | all-13130 | [
"Called",
"when",
"a",
"new",
"cluster",
"membership",
"configuration",
"is",
"created",
":",
"it",
"will",
"be",
"used",
"to",
"determine",
"commitment",
"from",
"now",
"on",
".",
"configuration",
"is",
"the",
"servers",
"in",
"the",
"cluster",
"."
] | [
"func",
"(",
"c",
"*",
"commitment",
")",
"setConfiguration",
"(",
"configuration",
"Configuration",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"oldMatchIndexes",
":=",
"c",
".",
"matchIndexes",
"\n",
"c",
".",
"matchIndexes",
"=",
"<mask>",
"(",
"map",
"[",
"ServerID",
"]",
"uint64",
")",
"\n",
"for",
"_",
",",
"server",
":=",
"range",
"configuration",
".",
"Servers",
"{",
"if",
"server",
".",
"Suffrage",
"==",
"Voter",
"{",
"c",
".",
"matchIndexes",
"[",
"server",
".",
"ID",
"]",
"=",
"oldMatchIndexes",
"[",
"server",
".",
"ID",
"]",
"// defaults to 0",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"recalculate",
"(",
")",
"\n",
"}"
] |
13,130 | all-13131 | [
"specify",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"TexSubImage3D",
"(",
"<mask>",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTexSubImage3D",
"(",
"gpTexSubImage3D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"zoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
] |
13,131 | all-13132 | [
"since",
"returns",
"revisions",
"since",
"the",
"given",
"rev",
".",
"Only",
"the",
"revision",
"with",
"the",
"largest",
"sub",
"revision",
"will",
"be",
"returned",
"if",
"multiple",
"revisions",
"have",
"the",
"same",
"main",
"revision",
"."
] | [
"func",
"(",
"ki",
"*",
"keyIndex",
")",
"since",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"rev",
"int64",
")",
"[",
"]",
"revision",
"{",
"if",
"ki",
".",
"isEmpty",
"(",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"string",
"(",
"ki",
".",
"key",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"string",
"(",
"ki",
".",
"key",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"since",
":=",
"revision",
"{",
"rev",
",",
"0",
"}",
"\n",
"var",
"gi",
"int",
"\n",
"// find the generations to start checking",
"for",
"gi",
"=",
"len",
"(",
"ki",
".",
"generations",
")",
"-",
"1",
";",
"gi",
">",
"0",
";",
"gi",
"--",
"{",
"g",
":=",
"ki",
".",
"generations",
"[",
"gi",
"]",
"\n",
"if",
"g",
".",
"isEmpty",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"since",
".",
"GreaterThan",
"(",
"g",
".",
"created",
")",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"revs",
"[",
"]",
"revision",
"\n",
"var",
"last",
"int64",
"\n",
"for",
";",
"gi",
"<",
"len",
"(",
"ki",
".",
"generations",
")",
";",
"gi",
"++",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"ki",
".",
"generations",
"[",
"gi",
"]",
".",
"revs",
"{",
"if",
"since",
".",
"GreaterThan",
"(",
"r",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"r",
".",
"main",
"==",
"last",
"{",
"// replace the revision with a new one that has higher sub value,",
"// because the original one should not be seen by external",
"revs",
"[",
"len",
"(",
"revs",
")",
"-",
"1",
"]",
"=",
"r",
"\n",
"<mask>",
"\n",
"}",
"\n",
"revs",
"=",
"append",
"(",
"revs",
",",
"r",
")",
"\n",
"last",
"=",
"r",
".",
"main",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"revs",
"\n",
"}"
] |
13,132 | all-13133 | [
"returns",
"a",
"new",
"Client",
"to",
"use",
"the",
"pricing",
"API"
] | [
"func",
"NewPricingClient",
"(",
"accountSid",
"string",
",",
"authToken",
"string",
",",
"httpClient",
"*",
"http",
".",
"Client",
")",
"*",
"Client",
"{",
"if",
"httpClient",
"==",
"nil",
"{",
"httpClient",
"=",
"&",
"http",
".",
"Client",
"{",
"Timeout",
":",
"defaultTimeout",
"}",
"\n",
"}",
"\n",
"restClient",
":=",
"rest",
".",
"NewClient",
"(",
"accountSid",
",",
"authToken",
",",
"PricingBaseURL",
")",
"\n",
"c",
":=",
"&",
"Client",
"{",
"Client",
":",
"restClient",
",",
"AccountSid",
":",
"accountSid",
",",
"AuthToken",
":",
"authToken",
"}",
"\n",
"c",
".",
"APIVersion",
"=",
"PricingVersion",
"\n",
"c",
".",
"FullPath",
"=",
"func",
"(",
"pathPart",
"string",
")",
"string",
"{",
"return",
"\"",
"\"",
"+",
"c",
".",
"APIVersion",
"+",
"\"",
"\"",
"+",
"pathPart",
"\n",
"}",
"\n",
"c",
".",
"Voice",
"=",
"&",
"VoicePriceService",
"{",
"Countries",
":",
"&",
"CountryVoicePriceService",
"{",
"<mask>",
":",
"c",
"}",
",",
"Numbers",
":",
"&",
"NumberVoicePriceService",
"{",
"client",
":",
"c",
"}",
",",
"}",
"\n",
"c",
".",
"Messaging",
"=",
"&",
"MessagingPriceService",
"{",
"Countries",
":",
"&",
"CountryMessagingPriceService",
"{",
"client",
":",
"c",
"}",
",",
"}",
"\n",
"c",
".",
"PhoneNumbers",
"=",
"&",
"PhoneNumberPriceService",
"{",
"Countries",
":",
"&",
"CountryPhoneNumberPriceService",
"{",
"client",
":",
"c",
"}",
",",
"}",
"\n",
"return",
"c",
"\n",
"}"
] |
13,133 | all-13134 | [
"parseUintBytes",
"is",
"like",
"strconv",
".",
"ParseUint",
"but",
"using",
"a",
"[]",
"byte",
"."
] | [
"func",
"parseUintBytes",
"(",
"s",
"[",
"]",
"byte",
",",
"base",
"int",
",",
"bitSize",
"int",
")",
"(",
"n",
"uint64",
",",
"err",
"error",
")",
"{",
"var",
"cutoff",
",",
"maxVal",
"uint64",
"\n\n",
"if",
"bitSize",
"==",
"0",
"{",
"bitSize",
"=",
"int",
"(",
"strconv",
".",
"IntSize",
")",
"\n",
"}",
"\n\n",
"s0",
":=",
"s",
"\n",
"switch",
"{",
"case",
"len",
"(",
"s",
")",
"<",
"1",
":",
"err",
"=",
"strconv",
".",
"ErrSyntax",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n\n",
"case",
"2",
"<=",
"<mask>",
"&&",
"base",
"<=",
"36",
":",
"// valid base; nothing to do",
"case",
"base",
"==",
"0",
":",
"// Look for octal, hex prefix.",
"switch",
"{",
"case",
"s",
"[",
"0",
"]",
"==",
"'0'",
"&&",
"len",
"(",
"s",
")",
">",
"1",
"&&",
"(",
"s",
"[",
"1",
"]",
"==",
"'x'",
"||",
"s",
"[",
"1",
"]",
"==",
"'X'",
")",
":",
"base",
"=",
"16",
"\n",
"s",
"=",
"s",
"[",
"2",
":",
"]",
"\n",
"if",
"len",
"(",
"s",
")",
"<",
"1",
"{",
"err",
"=",
"strconv",
".",
"ErrSyntax",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"case",
"s",
"[",
"0",
"]",
"==",
"'0'",
":",
"base",
"=",
"8",
"\n",
"default",
":",
"base",
"=",
"10",
"\n",
"}",
"\n\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"base",
")",
")",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n\n",
"n",
"=",
"0",
"\n",
"cutoff",
"=",
"cutoff64",
"(",
"base",
")",
"\n",
"maxVal",
"=",
"1",
"<<",
"uint",
"(",
"bitSize",
")",
"-",
"1",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"s",
")",
";",
"i",
"++",
"{",
"var",
"v",
"byte",
"\n",
"d",
":=",
"s",
"[",
"i",
"]",
"\n",
"switch",
"{",
"case",
"'0'",
"<=",
"d",
"&&",
"d",
"<=",
"'9'",
":",
"v",
"=",
"d",
"-",
"'0'",
"\n",
"case",
"'a'",
"<=",
"d",
"&&",
"d",
"<=",
"'z'",
":",
"v",
"=",
"d",
"-",
"'a'",
"+",
"10",
"\n",
"case",
"'A'",
"<=",
"d",
"&&",
"d",
"<=",
"'Z'",
":",
"v",
"=",
"d",
"-",
"'A'",
"+",
"10",
"\n",
"default",
":",
"n",
"=",
"0",
"\n",
"err",
"=",
"strconv",
".",
"ErrSyntax",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"if",
"int",
"(",
"v",
")",
">=",
"base",
"{",
"n",
"=",
"0",
"\n",
"err",
"=",
"strconv",
".",
"ErrSyntax",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n\n",
"if",
"n",
">=",
"cutoff",
"{",
"// n*base overflows",
"n",
"=",
"1",
"<<",
"64",
"-",
"1",
"\n",
"err",
"=",
"strconv",
".",
"ErrRange",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"n",
"*=",
"uint64",
"(",
"base",
")",
"\n\n",
"n1",
":=",
"n",
"+",
"uint64",
"(",
"v",
")",
"\n",
"if",
"n1",
"<",
"n",
"||",
"n1",
">",
"maxVal",
"{",
"// n+v overflows",
"n",
"=",
"1",
"<<",
"64",
"-",
"1",
"\n",
"err",
"=",
"strconv",
".",
"ErrRange",
"\n",
"return",
"n",
",",
"&",
"strconv",
".",
"NumError",
"{",
"Func",
":",
"\"",
"\"",
",",
"Num",
":",
"string",
"(",
"s0",
")",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"n",
"=",
"n1",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
13,134 | all-13135 | [
"SendJSON",
"is",
"a",
"helper",
"function",
"that",
"sends",
"a",
"JSON",
"-",
"encoded",
"value",
"on",
"the",
"channel",
"associated",
"with",
"clientID",
"."
] | [
"func",
"SendJSON",
"(",
"c",
"<mask>",
".",
"Context",
",",
"clientID",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"m",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"Send",
"(",
"c",
",",
"clientID",
",",
"string",
"(",
"m",
")",
")",
"\n",
"}"
] |
13,135 | all-13136 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"WaitForDebuggerParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,136 | all-13137 | [
"Returns",
"the",
"version",
"of",
"Internet",
"Explorer",
"or",
"a",
"-",
"1",
"(",
"indicating",
"the",
"use",
"of",
"another",
"browser",
")",
".",
"http",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"ms537509",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx"
] | [
"func",
"getInternetExplorerVersion",
"(",
"ua",
"string",
")",
"(",
"float64",
",",
"error",
")",
"{",
"matches",
":=",
"uare",
".",
"FindStringSubmatch",
"(",
"ua",
")",
"\n\n",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"{",
"return",
"0.0",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"strconv",
".",
"ParseFloat",
"(",
"matches",
"[",
"1",
"]",
",",
"64",
")",
"\n",
"}"
] |
13,137 | all-13138 | [
"describeCluster",
"returns",
"details",
"from",
"gcloud",
"container",
"clusters",
"describe",
"."
] | [
"func",
"describeCluster",
"(",
"o",
"options",
")",
"(",
"*",
"describe",
",",
"error",
")",
"{",
"if",
"o",
".",
"account",
"!=",
"\"",
"\"",
"{",
"act",
",",
"err",
":=",
"getAccount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"setAccount",
"(",
"act",
")",
"\n",
"if",
"err",
"=",
"setAccount",
"(",
"o",
".",
"account",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"account",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"args",
",",
"cmd",
":=",
"command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"o",
".",
"cluster",
",",
"\"",
"\"",
",",
"o",
".",
"project",
",",
"\"",
"\"",
",",
"o",
".",
"zone",
",",
"\"",
"\"",
",",
")",
"\n",
"data",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"args",
",",
"\"",
"\"",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"<mask>",
"d",
"describe",
"\n",
"if",
"yaml",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"Endpoint",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"d",
".",
"Auth",
".",
"ClusterCACertificate",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"d",
".",
"Auth",
".",
"ClientKey",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"d",
".",
"Auth",
".",
"ClientCertificate",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"d",
",",
"nil",
"\n",
"}"
] |
13,138 | all-13139 | [
"execute",
"runs",
"a",
"list",
"of",
"commands",
"on",
"the",
"vm",
"."
] | [
"func",
"(",
"v",
"*",
"vm",
")",
"execute",
"(",
"cmd",
"[",
"]",
"<mask>",
")",
"{",
"v",
".",
"ip",
"=",
"0",
"// reset instruction pointer",
"\n",
"for",
"n",
":=",
"0",
";",
"n",
"<",
"maxCommands",
";",
"n",
"++",
"{",
"ip",
":=",
"v",
".",
"ip",
"\n",
"if",
"ip",
">=",
"uint32",
"(",
"len",
"(",
"cmd",
")",
")",
"{",
"return",
"\n",
"}",
"\n",
"ins",
":=",
"cmd",
"[",
"ip",
"]",
"\n",
"ins",
".",
"f",
"(",
"v",
",",
"ins",
".",
"bm",
",",
"ins",
".",
"op",
")",
"// run cpu instruction",
"\n",
"if",
"v",
".",
"ipMod",
"{",
"// command modified ip, don't increment",
"v",
".",
"ipMod",
"=",
"false",
"\n",
"}",
"else",
"{",
"v",
".",
"ip",
"++",
"// increment ip for next command",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,139 | all-13140 | [
"Expected",
"is",
"used",
"to",
"build",
"a",
"cluster",
"expected",
"to",
"be",
"on",
"the",
"cloud",
"provider",
"."
] | [
"func",
"(",
"r",
"*",
"InstanceGroup",
")",
"Expected",
"(",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"if",
"r",
".",
"CachedExpected",
"!=",
"nil",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"immutable",
",",
"r",
".",
"CachedExpected",
",",
"nil",
"\n",
"}",
"\n",
"expected",
":=",
"&",
"InstanceGroup",
"{",
"Shared",
":",
"Shared",
"{",
"Name",
":",
"r",
".",
"Name",
",",
"CloudID",
":",
"r",
".",
"ServerPool",
".",
"Identifier",
",",
"}",
",",
"Size",
":",
"r",
".",
"ServerPool",
".",
"Size",
",",
"Location",
":",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"Location",
",",
"<mask>",
":",
"r",
".",
"ServerPool",
".",
"Image",
",",
"Count",
":",
"r",
".",
"ServerPool",
".",
"MaxCount",
",",
"SSHFingerprint",
":",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"SSH",
".",
"PublicKeyFingerprint",
",",
"BootstrapScripts",
":",
"r",
".",
"ServerPool",
".",
"BootstrapScripts",
",",
"}",
"\n",
"r",
".",
"CachedExpected",
"=",
"expected",
"\n",
"return",
"immutable",
",",
"expected",
",",
"nil",
"\n",
"}"
] |
13,140 | all-13141 | [
"GetLogQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"LogQuery",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"GetLogQueryOk",
"(",
")",
"(",
"WidgetApmOrLogQuery",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"LogQuery",
"==",
"nil",
"{",
"return",
"WidgetApmOrLogQuery",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"LogQuery",
",",
"<mask>",
"\n",
"}"
] |
13,141 | all-13142 | [
"String",
"satisfies",
"stringer",
"interface",
"."
] | [
"func",
"(",
"ns",
"NodeState",
")",
"String",
"(",
")",
"string",
"{",
"var",
"s",
"[",
"]",
"string",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"nodeStateNames",
"{",
"if",
"ns",
"&",
"k",
"!=",
"0",
"{",
"s",
"=",
"append",
"(",
"s",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"s",
",",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"\n",
"}"
] |
13,142 | all-13143 | [
"dealias",
"recursivly",
"dealiases",
"a",
"command",
"until",
"a",
"non",
"-",
"aliased",
"command",
"is",
"reached",
"."
] | [
"func",
"dealias",
"(",
"cmd",
"Command",
")",
"Command",
"{",
"if",
"alias",
",",
"ok",
":=",
"cmd",
".",
"(",
"*",
"aliaser",
")",
";",
"<mask>",
"{",
"return",
"dealias",
"(",
"alias",
".",
"Command",
")",
"\n",
"}",
"\n\n",
"return",
"cmd",
"\n",
"}"
] |
13,143 | all-13144 | [
"read",
"a",
"block",
"of",
"pixels",
"from",
"the",
"frame",
"buffer"
] | [
"func",
"ReadPixels",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowReadPixels",
"(",
"gpReadPixels",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
] |
13,144 | all-13145 | [
"LoadImage",
"helps",
"load",
"the",
"pause",
"container",
"image",
"for",
"the",
"agent"
] | [
"func",
"(",
"*",
"<mask>",
")",
"LoadImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"dockerClient",
"dockerapi",
".",
"DockerClient",
")",
"(",
"*",
"types",
".",
"ImageInspect",
",",
"error",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cfg",
".",
"PauseContainerTarballPath",
")",
"\n",
"if",
"err",
":=",
"loadFromFile",
"(",
"ctx",
",",
"cfg",
".",
"PauseContainerTarballPath",
",",
"dockerClient",
",",
"os",
".",
"Default",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"getPauseContainerImage",
"(",
"config",
".",
"DefaultPauseContainerImageName",
",",
"config",
".",
"DefaultPauseContainerTag",
",",
"dockerClient",
")",
"\n",
"}"
] |
13,145 | all-13146 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetHighlightObjectForTestReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,146 | all-13147 | [
"DashService",
"creates",
"a",
"Service",
"for",
"the",
"pachyderm",
"dashboard",
"."
] | [
"func",
"DashService",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"return",
"&",
"v1",
".",
"Service",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"dashName",
",",
"labels",
"(",
"dashName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"v1",
".",
"ServiceSpec",
"{",
"Type",
":",
"v1",
".",
"ServiceTypeNodePort",
",",
"Selector",
":",
"labels",
"(",
"dashName",
")",
",",
"Ports",
":",
"[",
"]",
"v1",
".",
"ServicePort",
"{",
"{",
"Port",
":",
"8080",
",",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30080",
",",
"}",
",",
"{",
"Port",
":",
"8081",
",",
"<mask>",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30081",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
13,147 | all-13148 | [
"NewLocker",
"creates",
"a",
"sync",
".",
"Locker",
"backed",
"by",
"an",
"etcd",
"mutex",
"."
] | [
"func",
"NewLocker",
"(",
"s",
"*",
"Session",
",",
"pfx",
"string",
")",
"<mask>",
".",
"Locker",
"{",
"return",
"&",
"lockerMutex",
"{",
"NewMutex",
"(",
"s",
",",
"pfx",
")",
"}",
"\n",
"}"
] |
13,148 | all-13149 | [
"WriteHelp",
"writes",
"the",
"usage",
"string",
"followed",
"by",
"the",
"full",
"help",
"string",
"for",
"each",
"option"
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"WriteHelp",
"(",
"w",
"io",
".",
"Writer",
")",
"{",
"var",
"positionals",
",",
"options",
"[",
"]",
"*",
"spec",
"\n",
"for",
"_",
",",
"spec",
":=",
"range",
"p",
".",
"specs",
"{",
"if",
"spec",
".",
"positional",
"{",
"positionals",
"=",
"append",
"(",
"positionals",
",",
"spec",
")",
"\n",
"}",
"else",
"{",
"options",
"=",
"append",
"(",
"options",
",",
"spec",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"p",
".",
"description",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintln",
"(",
"w",
",",
"p",
".",
"description",
")",
"\n",
"}",
"\n",
"p",
".",
"WriteUsage",
"(",
"w",
")",
"\n\n",
"// write the list of positionals",
"if",
"len",
"(",
"positionals",
")",
">",
"0",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\n",
"\\n",
"\"",
")",
"\n",
"for",
"_",
",",
"spec",
":=",
"range",
"positionals",
"{",
"left",
":=",
"\"",
"\"",
"+",
"strings",
".",
"ToUpper",
"(",
"spec",
".",
"long",
")",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"left",
")",
"\n",
"if",
"spec",
".",
"help",
"!=",
"\"",
"\"",
"{",
"if",
"len",
"(",
"left",
")",
"+",
"2",
"<",
"colWidth",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"colWidth",
"-",
"len",
"(",
"left",
")",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\n",
"\"",
"+",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"colWidth",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"spec",
".",
"help",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// write the list of options",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\n",
"\\n",
"\"",
")",
"\n",
"for",
"_",
",",
"spec",
":=",
"range",
"options",
"{",
"printOption",
"(",
"w",
",",
"spec",
")",
"\n",
"}",
"\n\n",
"// write the list of built in options",
"printOption",
"(",
"w",
",",
"&",
"spec",
"{",
"boolean",
":",
"true",
",",
"long",
":",
"\"",
"\"",
",",
"short",
":",
"\"",
"\"",
",",
"help",
":",
"\"",
"\"",
"}",
")",
"\n",
"if",
"p",
".",
"version",
"!=",
"\"",
"\"",
"{",
"printOption",
"(",
"w",
",",
"&",
"spec",
"{",
"boolean",
":",
"true",
",",
"long",
":",
"\"",
"\"",
",",
"help",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
13,149 | all-13150 | [
"Search",
"returns",
"a",
"list",
"of",
"venues",
"near",
"the",
"current",
"location",
"optionally",
"matching",
"a",
"search",
"term",
".",
"https",
":",
"//",
"developer",
".",
"foursquare",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"venues",
"/",
"search"
] | [
"func",
"(",
"s",
"*",
"VenueService",
")",
"Search",
"(",
"params",
"*",
"VenueSearchParams",
")",
"(",
"[",
"]",
"Venue",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"venues",
":=",
"new",
"(",
"venueSearchResp",
")",
"\n",
"response",
":=",
"new",
"(",
"Response",
")",
"\n\n",
"resp",
",",
"err",
":=",
"s",
".",
"sling",
".",
"New",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"QueryStruct",
"(",
"params",
")",
".",
"Receive",
"(",
"response",
",",
"response",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"json",
".",
"Unmarshal",
"(",
"response",
".",
"Response",
",",
"venues",
")",
"\n",
"}",
"\n\n",
"return",
"venues",
".",
"Venues",
",",
"resp",
",",
"relevantError",
"(",
"err",
",",
"*",
"<mask>",
")",
"\n",
"}"
] |
13,150 | all-13151 | [
"DisableSvcCheck",
"creates",
"a",
"new",
"DISABLE_SVC_CHECK",
"Nagios",
"command",
".",
"Disables",
"active",
"checks",
"for",
"a",
"particular",
"service",
"."
] | [
"func",
"DisableSvcCheck",
"(",
"host_name",
"<mask>",
",",
"service_description",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
")",
"\n",
"}"
] |
13,151 | all-13152 | [
"void",
"cvInitFont",
"(",
"CvFont",
"*",
"font",
"int",
"font_face",
"double",
"hscale",
"double",
"vscale",
"double",
"shear",
"=",
"0",
"int",
"thickness",
"=",
"1",
"int",
"line_type",
"=",
"8",
")"
] | [
"func",
"InitFont",
"(",
"fontFace",
"int",
",",
"hscale",
",",
"vscale",
",",
"shear",
"float32",
",",
"thickness",
",",
"lineType",
"int",
")",
"*",
"Font",
"{",
"font",
":=",
"new",
"(",
"Font",
")",
"\n",
"C",
".",
"cvInitFont",
"(",
"&",
"font",
".",
"font",
",",
"C",
".",
"int",
"(",
"fontFace",
")",
",",
"C",
".",
"double",
"(",
"hscale",
")",
",",
"C",
".",
"double",
"(",
"vscale",
")",
",",
"C",
".",
"double",
"(",
"shear",
")",
",",
"C",
".",
"int",
"(",
"thickness",
")",
",",
"C",
".",
"int",
"(",
"lineType",
")",
",",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
13,152 | all-13153 | [
"invertAttributes",
"inverts",
"the",
"foreground",
"and",
"background",
"colors",
"of",
"a",
"Windows",
"attributes",
"value"
] | [
"func",
"invertAttributes",
"(",
"windowsMode",
"uint16",
")",
"uint16",
"{",
"<mask>",
"(",
"COMMON_LVB_MASK",
"&",
"windowsMode",
")",
"|",
"(",
"(",
"FOREGROUND_MASK",
"&",
"windowsMode",
")",
"<<",
"4",
")",
"|",
"(",
"(",
"BACKGROUND_MASK",
"&",
"windowsMode",
")",
">>",
"4",
")",
"\n",
"}"
] |
13,153 | all-13154 | [
"For",
"json",
":",
"omitempty",
".",
"Returns",
"true",
"for",
"zero",
"values",
"but",
"also",
"non",
"-",
"nil",
"zero",
"-",
"length",
"slices",
"and",
"strings",
"."
] | [
"func",
"isEmpty",
"(",
"rv",
"reflect",
".",
"Value",
",",
"zrv",
"reflect",
".",
"Value",
")",
"bool",
"{",
"if",
"!",
"rv",
".",
"IsValid",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"reflect",
".",
"DeepEqual",
"(",
"rv",
".",
"Interface",
"(",
")",
",",
"zrv",
".",
"Interface",
"(",
")",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"switch",
"rv",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Slice",
",",
"reflect",
".",
"<mask>",
",",
"reflect",
".",
"String",
":",
"if",
"rv",
".",
"Len",
"(",
")",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
13,154 | all-13155 | [
"StatusIconNewFromIconName",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_new_from_icon_name",
"()"
] | [
"func",
"StatusIconNewFromIconName",
"(",
"iconName",
"string",
")",
"(",
"*",
"StatusIcon",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"iconName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_status_icon_new_from_icon_name",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapStatusIcon",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
13,155 | all-13156 | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"post",
"apps",
"app",
"routes",
"params"
] | [
"func",
"(",
"o",
"*",
"PostAppsAppRoutesParams",
")",
"WithBody",
"(",
"body",
"*",
"<mask>",
".",
"RouteWrapper",
")",
"*",
"PostAppsAppRoutesParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
13,156 | all-13157 | [
"SetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"resource",
"s",
"creation",
"time"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"SetCreatedAt",
"(",
"createdAt",
"time",
".",
"Time",
")",
"{",
"if",
"createdAt",
".",
"IsZero",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"vol",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"vol",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"vol",
".",
"createdAtUnsafe",
"=",
"createdAt",
"\n",
"}"
] |
13,157 | all-13158 | [
"BlockWith",
"executes",
"the",
"block",
"of",
"template",
"associated",
"with",
"the",
"helper",
"think",
"the",
"block",
"inside",
"of",
"an",
"if",
"or",
"each",
"statement",
"but",
"with",
"it",
"s",
"own",
"context",
"."
] | [
"func",
"(",
"h",
"HelperContext",
")",
"BlockWith",
"(",
"hc",
"hctx",
".",
"<mask>",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"ok",
":=",
"hc",
".",
"(",
"*",
"Context",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"hc",
")",
"\n",
"}",
"\n",
"octx",
":=",
"h",
".",
"compiler",
".",
"ctx",
"\n",
"defer",
"func",
"(",
")",
"{",
"h",
".",
"compiler",
".",
"ctx",
"=",
"octx",
"}",
"(",
")",
"\n",
"h",
".",
"compiler",
".",
"ctx",
"=",
"ctx",
"\n\n",
"if",
"h",
".",
"block",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"i",
",",
"err",
":=",
"h",
".",
"compiler",
".",
"evalBlockStatement",
"(",
"h",
".",
"block",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"bb",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"h",
".",
"compiler",
".",
"write",
"(",
"bb",
",",
"i",
")",
"\n",
"return",
"bb",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
13,158 | all-13159 | [
"EncodeTime",
"writes",
"the",
"number",
"of",
"seconds",
"(",
"int64",
")",
"and",
"nanoseconds",
"(",
"int32",
")",
"with",
"millisecond",
"resolution",
"since",
"January",
"1",
"1970",
"UTC",
"to",
"the",
"Writer",
"as",
"an",
"UInt64",
".",
"Milliseconds",
"are",
"used",
"to",
"ease",
"compatibility",
"with",
"Javascript",
"which",
"does",
"not",
"support",
"finer",
"resolution",
"."
] | [
"func",
"EncodeTime",
"(",
"w",
"io",
".",
"Writer",
",",
"t",
"<mask>",
".",
"Time",
")",
"(",
"err",
"error",
")",
"{",
"s",
":=",
"t",
".",
"Unix",
"(",
")",
"\n",
"// TODO: We are hand-encoding a struct until MarshalAmino/UnmarshalAmino is supported.",
"// skip if default/zero value:",
"if",
"s",
"!=",
"0",
"{",
"if",
"s",
"<",
"minSeconds",
"||",
"s",
">=",
"maxSeconds",
"{",
"return",
"InvalidTimeErr",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"minSeconds",
",",
"maxSeconds",
",",
"s",
")",
")",
"\n",
"}",
"\n",
"err",
"=",
"encodeFieldNumberAndTyp3",
"(",
"w",
",",
"1",
",",
"Typ3_Varint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"err",
"=",
"EncodeUvarint",
"(",
"w",
",",
"uint64",
"(",
"s",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"ns",
":=",
"int32",
"(",
"t",
".",
"Nanosecond",
"(",
")",
")",
"// this int64 -> int32 cast is safe (nanos are in [0, 999999999])",
"\n",
"// skip if default/zero value:",
"if",
"ns",
"!=",
"0",
"{",
"// do not encode if nanos exceed allowed interval",
"if",
"ns",
"<",
"0",
"||",
"ns",
">",
"maxNanos",
"{",
"// we could as well panic here:",
"// time.Time.Nanosecond() guarantees nanos to be in [0, 999,999,999]",
"return",
"InvalidTimeErr",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"maxNanos",
",",
"s",
")",
")",
"\n",
"}",
"\n",
"err",
"=",
"encodeFieldNumberAndTyp3",
"(",
"w",
",",
"2",
",",
"Typ3_Varint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"err",
"=",
"EncodeUvarint",
"(",
"w",
",",
"uint64",
"(",
"ns",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
13,159 | all-13160 | [
"Mutate",
"applies",
"the",
"provided",
"mutators",
"to",
"this",
"builder",
"s",
"payment",
"or",
"operation",
"."
] | [
"func",
"(",
"b",
"*",
"AllowTrustBuilder",
")",
"Mutate",
"(",
"muts",
"...",
"interface",
"{",
"}",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"muts",
"{",
"var",
"err",
"error",
"\n",
"switch",
"mut",
":=",
"m",
".",
"(",
"type",
")",
"{",
"case",
"AllowTrustMutator",
":",
"err",
"=",
"mut",
".",
"MutateAllowTrust",
"(",
"&",
"b",
".",
"AT",
")",
"\n",
"<mask>",
"OperationMutator",
":",
"err",
"=",
"mut",
".",
"MutateOperation",
"(",
"&",
"b",
".",
"O",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"b",
".",
"Err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,160 | all-13161 | [
"ipAddress",
"returns",
"machine’s",
"private",
"or",
"public",
"IP",
"address",
"according",
"to",
"the",
"configuration",
".",
"If",
"no",
"IP",
"address",
"is",
"found",
"it",
"returns",
"empty",
"string",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"ipAddress",
"(",
")",
"(",
"ip",
"string",
",",
"err",
"error",
")",
"{",
"c",
",",
"err",
":=",
"d",
".",
"newAzureClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"ipType",
"string",
"\n",
"if",
"d",
".",
"UsePrivateIP",
"||",
"d",
".",
"NoPublicIP",
"{",
"ipType",
"=",
"\"",
"\"",
"\n",
"<mask>",
",",
"err",
"=",
"c",
".",
"GetPrivateIPAddress",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"NIC",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"ipType",
"=",
"\"",
"\"",
"\n",
"ip",
",",
"err",
"=",
"c",
".",
"GetPublicIPAddress",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"IP",
"(",
")",
",",
"d",
".",
"DNSLabel",
"!=",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ipType",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ipType",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"ip",
"==",
"\"",
"\"",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ipType",
")",
"\n",
"}",
"\n",
"return",
"ip",
",",
"nil",
"\n",
"}"
] |
13,161 | all-13162 | [
"expandLatencySensitivity",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"LatencySensitivity",
"."
] | [
"func",
"expandLatencySensitivity",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"LatencySensitivity",
"{",
"obj",
":=",
"&",
"types",
".",
"LatencySensitivity",
"{",
"Level",
":",
"types",
".",
"LatencySensitivitySensitivityLevel",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
13,162 | all-13163 | [
"New",
"initializes",
"a",
"new",
"Map",
"."
] | [
"func",
"New",
"(",
")",
"*",
"Map",
"{",
"return",
"&",
"<mask>",
"{",
"m",
":",
"C",
".",
"mapnik_map",
"(",
"C",
".",
"uint",
"(",
"800",
")",
",",
"C",
".",
"uint",
"(",
"600",
")",
")",
",",
"width",
":",
"800",
",",
"height",
":",
"600",
",",
"}",
"\n",
"}"
] |
13,163 | all-13164 | [
"Filter",
"out",
"all",
"strings",
"where",
"the",
"function",
"does",
"not",
"return",
"true",
"."
] | [
"func",
"StringFilter",
"(",
"f",
"func",
"(",
"string",
")",
"bool",
",",
"data",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"0",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"data",
"{",
"if",
"f",
"(",
"element",
")",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"element",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
13,164 | all-13165 | [
"MakeCall",
"starts",
"a",
"new",
"Call",
"from",
"the",
"given",
"phone",
"number",
"to",
"the",
"given",
"phone",
"number",
"dialing",
"the",
"url",
"when",
"the",
"call",
"connects",
".",
"MakeCall",
"is",
"a",
"wrapper",
"around",
"Create",
";",
"if",
"you",
"need",
"more",
"configuration",
"call",
"that",
"function",
"directly",
"."
] | [
"func",
"(",
"c",
"*",
"CallService",
")",
"MakeCall",
"(",
"from",
"string",
",",
"to",
"string",
",",
"u",
"*",
"url",
".",
"URL",
")",
"(",
"*",
"Call",
",",
"error",
")",
"{",
"data",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"<mask>",
".",
"Set",
"(",
"\"",
"\"",
",",
"from",
")",
"\n",
"data",
".",
"Set",
"(",
"\"",
"\"",
",",
"to",
")",
"\n",
"data",
".",
"Set",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
")",
"\n",
"return",
"c",
".",
"Create",
"(",
"context",
".",
"Background",
"(",
")",
",",
"data",
")",
"\n",
"}"
] |
13,165 | all-13166 | [
"Log",
"implements",
"log",
".",
"Logger",
"."
] | [
"func",
"(",
"d",
"*",
"Deduper",
")",
"Log",
"(",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"line",
",",
"err",
":=",
"encode",
"(",
"keyvals",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"d",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"last",
",",
"<mask>",
":=",
"d",
".",
"seen",
"[",
"line",
"]",
"\n",
"d",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"ok",
"&&",
"time",
".",
"Since",
"(",
"last",
")",
"<",
"d",
".",
"repeat",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"d",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"d",
".",
"seen",
")",
"<",
"maxEntries",
"{",
"d",
".",
"seen",
"[",
"line",
"]",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n",
"d",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"d",
".",
"next",
".",
"Log",
"(",
"keyvals",
"...",
")",
"\n",
"}"
] |
13,166 | all-13167 | [
"SetComments",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_set_comments",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"SetComments",
"(",
"comments",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"comments",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_about_dialog_set_comments",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
13,167 | all-13168 | [
"JSON",
"makes",
"a",
"HTTP",
"request",
"that",
"expects",
"application",
"/",
"json",
"response",
".",
"It",
"decodes",
"response",
"body",
"to",
"a",
"response",
"argument",
"."
] | [
"func",
"(",
"c",
"Client",
")",
"JSON",
"(",
"method",
",",
"path",
"string",
",",
"query",
"<mask>",
".",
"Values",
",",
"body",
"io",
".",
"Reader",
",",
"response",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"return",
"c",
".",
"JSONContext",
"(",
"nil",
",",
"method",
",",
"path",
",",
"query",
",",
"body",
",",
"response",
")",
"\n",
"}"
] |
13,168 | all-13169 | [
"GetAuth",
"retrieves",
"the",
"Auth",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"GetAuth",
"(",
")",
"(",
"result",
"Auth",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Auth",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
13,169 | all-13170 | [
"ToXdrObject",
"creates",
"xdr",
".",
"Asset",
"object",
"from",
"build",
".",
"Asset",
"object"
] | [
"func",
"(",
"a",
"Asset",
")",
"ToXdrObject",
"(",
")",
"(",
"xdr",
".",
"Asset",
",",
"error",
")",
"{",
"if",
"a",
".",
"Native",
"{",
"return",
"xdr",
".",
"NewAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeNative",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"var",
"issuer",
"xdr",
".",
"AccountId",
"\n",
"err",
":=",
"setAccountId",
"(",
"a",
".",
"Issuer",
",",
"&",
"issuer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"xdr",
".",
"Asset",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"length",
":=",
"len",
"(",
"a",
".",
"Code",
")",
"\n",
"switch",
"{",
"case",
"length",
">=",
"1",
"&&",
"length",
"<=",
"4",
":",
"var",
"codeArray",
"[",
"4",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"a",
".",
"Code",
")",
"\n",
"<mask>",
"(",
"codeArray",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"asset",
":=",
"xdr",
".",
"AssetAlphaNum4",
"{",
"codeArray",
",",
"issuer",
"}",
"\n",
"return",
"xdr",
".",
"NewAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum4",
",",
"asset",
")",
"\n",
"case",
"length",
">=",
"5",
"&&",
"length",
"<=",
"12",
":",
"var",
"codeArray",
"[",
"12",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"a",
".",
"Code",
")",
"\n",
"copy",
"(",
"codeArray",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"asset",
":=",
"xdr",
".",
"AssetAlphaNum12",
"{",
"codeArray",
",",
"issuer",
"}",
"\n",
"return",
"xdr",
".",
"NewAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum12",
",",
"asset",
")",
"\n",
"default",
":",
"return",
"xdr",
".",
"Asset",
"{",
"}",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
13,170 | all-13171 | [
"NewMicrosoftClientFromSecret",
"creates",
"a",
"microsoft",
"client",
"by",
"reading",
"credentials",
"from",
"a",
"mounted",
"MicrosoftSecret",
".",
"You",
"may",
"pass",
"for",
"container",
"in",
"which",
"case",
"it",
"will",
"read",
"the",
"container",
"from",
"the",
"secret",
"."
] | [
"func",
"NewMicrosoftClientFromSecret",
"(",
"container",
"string",
")",
"(",
"Client",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"container",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"id",
",",
"err",
":=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"secret",
",",
"err",
":=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"NewMicrosoftClient",
"(",
"container",
",",
"id",
",",
"secret",
")",
"\n",
"}"
] |
13,171 | all-13172 | [
"SendMailSSL",
"envoie",
"un",
"email",
"par",
"SSL"
] | [
"func",
"SendMailSSL",
"(",
"addr",
"string",
",",
"a",
"smtp",
".",
"Auth",
",",
"from",
"string",
",",
"to",
"[",
"]",
"string",
",",
"msg",
"[",
"]",
"byte",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"tls",
".",
"Dial",
"(",
"\"",
"\"",
",",
"addr",
",",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"true",
"}",
")",
"//TODO: Not secure",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"h",
",",
"_",
",",
"_",
":=",
"net",
".",
"SplitHostPort",
"(",
"addr",
")",
"\n",
"c",
",",
"err",
":=",
"smtp",
".",
"NewClient",
"(",
"<mask>",
",",
"h",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n\n",
"if",
"a",
"!=",
"nil",
"{",
"if",
"ok",
",",
"_",
":=",
"c",
".",
"Extension",
"(",
"\"",
"\"",
")",
";",
"ok",
"{",
"if",
"err",
"=",
"c",
".",
"Auth",
"(",
"a",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"c",
".",
"Mail",
"(",
"from",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"addr",
":=",
"range",
"to",
"{",
"if",
"err",
"=",
"c",
".",
"Rcpt",
"(",
"addr",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"w",
",",
"err",
":=",
"c",
".",
"Data",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"Write",
"(",
"msg",
")",
"\n",
"w",
".",
"Close",
"(",
")",
"\n\n",
"return",
"c",
".",
"Quit",
"(",
")",
"\n",
"}"
] |
13,172 | all-13173 | [
"Put",
"sets",
"the",
"value",
"for",
"a",
"key",
"in",
"the",
"transaction",
".",
"If",
"the",
"key",
"exist",
"then",
"its",
"previous",
"value",
"will",
"be",
"overwritten",
".",
"Supplied",
"value",
"must",
"remain",
"valid",
"for",
"the",
"life",
"of",
"the",
"transaction",
".",
"Returns",
"an",
"error",
"if",
"the",
"bucket",
"was",
"created",
"from",
"a",
"read",
"-",
"only",
"transaction",
"if",
"the",
"key",
"is",
"blank",
"if",
"the",
"key",
"is",
"too",
"large",
"or",
"if",
"the",
"value",
"is",
"too",
"large",
"."
] | [
"func",
"(",
"tx",
"Tx",
")",
"Put",
"(",
"k",
"[",
"]",
"[",
"]",
"byte",
",",
"v",
"[",
"]",
"byte",
")",
"error",
"{",
"b",
",",
"err",
":=",
"<mask>",
".",
"CreateBucketIfNotExists",
"(",
"k",
"[",
":",
"len",
"(",
"k",
")",
"-",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"errorsp",
".",
"WithStacks",
"(",
"b",
".",
"Bucket",
".",
"Put",
"(",
"k",
"[",
"len",
"(",
"k",
")",
"-",
"1",
"]",
",",
"v",
")",
")",
"\n",
"}"
] |
13,173 | all-13174 | [
"JoinCluster",
"will",
"connect",
"to",
"the",
"discovery",
"service",
"at",
"the",
"given",
"url",
"and",
"register",
"the",
"server",
"represented",
"by",
"the",
"given",
"id",
"and",
"config",
"to",
"the",
"cluster"
] | [
"func",
"JoinCluster",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"durl",
",",
"dproxyurl",
"string",
",",
"id",
"types",
".",
"<mask>",
",",
"config",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"d",
",",
"err",
":=",
"newDiscovery",
"(",
"lg",
",",
"durl",
",",
"dproxyurl",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"d",
".",
"joinCluster",
"(",
"config",
")",
"\n",
"}"
] |
13,174 | all-13175 | [
"Open",
"opens",
"a",
"connection"
] | [
"func",
"(",
"drv",
"*",
"Driver",
")",
"Open",
"(",
"name",
"string",
")",
"(",
"driver",
".",
"Conn",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"drv",
".",
"Driver",
".",
"Open",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"conn",
",",
"err",
"\n",
"}",
"\n\n",
"wrapped",
":=",
"&",
"Conn",
"{",
"conn",
",",
"drv",
".",
"hooks",
"}",
"\n",
"if",
"isExecer",
"(",
"conn",
")",
"&&",
"isQueryer",
"(",
"conn",
")",
"&&",
"isSessionResetter",
"(",
"conn",
")",
"{",
"return",
"&",
"ExecerQueryerContextWithSessionResetter",
"{",
"wrapped",
",",
"&",
"ExecerContext",
"{",
"wrapped",
"}",
",",
"&",
"QueryerContext",
"{",
"wrapped",
"}",
",",
"&",
"SessionResetter",
"{",
"wrapped",
"}",
"}",
",",
"nil",
"\n",
"}",
"else",
"if",
"isExecer",
"(",
"conn",
")",
"&&",
"isQueryer",
"(",
"conn",
")",
"{",
"return",
"&",
"ExecerQueryerContext",
"{",
"wrapped",
",",
"&",
"ExecerContext",
"{",
"wrapped",
"}",
",",
"&",
"QueryerContext",
"{",
"wrapped",
"}",
"}",
",",
"nil",
"\n",
"}",
"else",
"if",
"isExecer",
"(",
"conn",
")",
"{",
"// If conn implements an Execer interface, return a driver.Conn which",
"// also implements Execer",
"return",
"&",
"ExecerContext",
"{",
"wrapped",
"}",
",",
"nil",
"\n",
"}",
"else",
"if",
"isQueryer",
"(",
"<mask>",
")",
"{",
"// If conn implements an Queryer interface, return a driver.Conn which",
"// also implements Queryer",
"return",
"&",
"QueryerContext",
"{",
"wrapped",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"wrapped",
",",
"nil",
"\n",
"}"
] |
13,175 | all-13176 | [
"WithField",
"filters",
"the",
"field",
"and",
"passes",
"it",
"on",
"to",
"the",
"wrapped",
"loggers",
"WithField"
] | [
"func",
"(",
"f",
"*",
"Filtered",
")",
"WithField",
"(",
"k",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"<mask>",
".",
"Interface",
"{",
"val",
":=",
"v",
"\n\n",
"// apply the filters",
"for",
"_",
",",
"filter",
":=",
"range",
"f",
".",
"filters",
"{",
"val",
"=",
"filter",
".",
"Filter",
"(",
"k",
",",
"val",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Filtered",
"{",
"Interface",
":",
"f",
".",
"Interface",
".",
"WithField",
"(",
"k",
",",
"val",
")",
",",
"filters",
":",
"f",
".",
"filters",
",",
"}",
"\n",
"}"
] |
13,176 | all-13177 | [
"SetCanonical",
"sets",
"the",
"given",
"key",
":",
"value",
"header",
"assuming",
"that",
"key",
"is",
"in",
"canonical",
"form",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetCanonical",
"(",
"key",
",",
"value",
"[",
"]",
"byte",
")",
"{",
"switch",
"string",
"(",
"key",
")",
"{",
"case",
"\"",
"\"",
":",
"h",
".",
"SetContentTypeBytes",
"(",
"value",
")",
"\n",
"case",
"\"",
"\"",
":",
"h",
".",
"SetServerBytes",
"(",
"value",
")",
"\n",
"case",
"\"",
"\"",
":",
"var",
"kv",
"*",
"argsKV",
"\n",
"h",
".",
"cookies",
",",
"kv",
"=",
"allocArg",
"(",
"h",
".",
"cookies",
")",
"\n",
"kv",
".",
"key",
"=",
"getCookieKey",
"(",
"kv",
".",
"key",
",",
"value",
")",
"\n",
"kv",
".",
"value",
"=",
"append",
"(",
"kv",
".",
"value",
"[",
":",
"0",
"]",
",",
"value",
"...",
")",
"\n",
"case",
"\"",
"\"",
":",
"if",
"contentLength",
",",
"err",
":=",
"parseContentLength",
"(",
"value",
")",
";",
"err",
"==",
"nil",
"{",
"h",
".",
"contentLength",
"=",
"contentLength",
"\n",
"h",
".",
"contentLengthBytes",
"=",
"append",
"(",
"h",
".",
"contentLengthBytes",
"[",
":",
"0",
"]",
",",
"value",
"...",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"bytes",
".",
"Equal",
"(",
"strClose",
",",
"value",
")",
"{",
"h",
".",
"SetConnectionClose",
"(",
")",
"\n",
"}",
"else",
"{",
"h",
".",
"ResetConnectionClose",
"(",
")",
"\n",
"h",
".",
"h",
"=",
"setArgBytes",
"(",
"h",
".",
"h",
",",
"key",
",",
"value",
",",
"argsHasValue",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"// Transfer-Encoding is managed automatically.",
"case",
"\"",
"\"",
":",
"// Date is managed automatically.",
"default",
":",
"h",
".",
"h",
"=",
"setArgBytes",
"(",
"h",
".",
"h",
",",
"<mask>",
",",
"value",
",",
"argsHasValue",
")",
"\n",
"}",
"\n",
"}"
] |
13,177 | all-13178 | [
"Edit",
"an",
"article"
] | [
"func",
"Edit",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"<mask>",
":=",
"c",
".",
"MustGet",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"mgo",
".",
"Database",
")",
"\n",
"article",
":=",
"models",
".",
"Article",
"{",
"}",
"\n",
"oID",
":=",
"bson",
".",
"ObjectIdHex",
"(",
"c",
".",
"Param",
"(",
"\"",
"\"",
")",
")",
"\n",
"err",
":=",
"db",
".",
"C",
"(",
"models",
".",
"CollectionArticle",
")",
".",
"FindId",
"(",
"oID",
")",
".",
"One",
"(",
"&",
"article",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"c",
".",
"HTML",
"(",
"http",
".",
"StatusOK",
",",
"\"",
"\"",
",",
"gin",
".",
"H",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"article",
",",
"}",
")",
"\n",
"}"
] |
13,178 | all-13179 | [
"lookupCrypter",
"returns",
"the",
"first",
"crypt",
"function",
"found",
"in",
"shadowed",
"passwd",
"file",
"."
] | [
"func",
"lookupCrypter",
"(",
")",
"(",
"crypt",
".",
"Crypter",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"_SHADOW_FILE",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"buf",
":=",
"bufio",
".",
"NewReader",
"(",
"f",
")",
"\n\n",
"for",
"{",
"line",
",",
"_",
",",
"err",
":=",
"buf",
".",
"ReadLine",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
",",
"ErrShadowPasswd",
"\n",
"}",
"\n",
"<mask>",
".",
"Print",
"(",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"shadow",
",",
"err",
":=",
"parseShadow",
"(",
"string",
"(",
"line",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"shadow",
".",
"password",
"[",
"0",
"]",
"==",
"'$'",
"{",
"return",
"crypt",
".",
"NewFromHash",
"(",
"shadow",
".",
"password",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrShadowPasswd",
"\n",
"}"
] |
13,179 | all-13180 | [
"Returns",
"the",
"current",
"iterator",
".",
"Invalidates",
"previously",
"returned",
"iterators",
"."
] | [
"func",
"(",
"r",
"*",
"sampleRing",
")",
"iterator",
"(",
")",
"SeriesIterator",
"{",
"r",
".",
"<mask>",
".",
"r",
"=",
"r",
"\n",
"r",
".",
"it",
".",
"i",
"=",
"-",
"1",
"\n",
"return",
"&",
"r",
".",
"it",
"\n",
"}"
] |
13,180 | all-13181 | [
"SetBool",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_bool",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetBool",
"(",
"<mask>",
"string",
",",
"value",
"bool",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set_bool",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"gbool",
"(",
"value",
")",
")",
"\n",
"}"
] |
13,181 | all-13182 | [
"BuildHealthCheck",
"creates",
"a",
"healthcheck",
"function",
"for",
"the",
"given",
"providerName",
".",
"It",
"will",
"call",
"the",
"HealthCheck",
"()",
"method",
"in",
"the",
"provider",
"(",
"only",
"if",
"it",
"s",
"also",
"a",
"HealthChecker",
")",
"for",
"each",
"instance",
"of",
"it",
"(",
"including",
"the",
"main",
"instance",
"and",
"all",
"custom",
"IaaSes",
")",
"."
] | [
"func",
"BuildHealthCheck",
"(",
"providerName",
"string",
")",
"func",
"(",
")",
"error",
"{",
"return",
"func",
"(",
")",
"error",
"{",
"iaasConfig",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"hc",
".",
"ErrDisabledComponent",
"\n",
"}",
"\n",
"iaases",
",",
"_",
":=",
"iaasConfig",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"ifaceName",
":=",
"range",
"iaases",
"{",
"<mask>",
":=",
"ifaceName",
".",
"(",
"string",
")",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"customIaases",
":=",
"iaases",
"[",
"name",
"]",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"ifaceName",
":=",
"range",
"customIaases",
"{",
"iaas",
":=",
"customIaases",
"[",
"ifaceName",
".",
"(",
"string",
")",
"]",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"iaas",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"!=",
"providerName",
"{",
"continue",
"\n",
"}",
"\n",
"name",
"=",
"ifaceName",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"name",
"!=",
"providerName",
"{",
"continue",
"\n",
"}",
"\n",
"err",
":=",
"healthCheck",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
13,182 | all-13183 | [
"SetDisplayOptions",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_set_display_options",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Calendar",
")",
"SetDisplayOptions",
"(",
"<mask>",
"CalendarDisplayOptions",
")",
"{",
"C",
".",
"gtk_calendar_set_display_options",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkCalendarDisplayOptions",
"(",
"flags",
")",
")",
"\n",
"}"
] |
13,183 | all-13184 | [
"sanityCheck",
"returns",
"true",
"if",
"a",
"check",
"was",
"performed"
] | [
"func",
"sanityCheck",
"(",
")",
"bool",
"{",
"//sanity check",
"if",
"token",
":=",
"<mask>",
".",
"Getenv",
"(",
"envBinCheck",
")",
";",
"token",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprint",
"(",
"os",
".",
"Stdout",
",",
"token",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"//legacy sanity check using old env var",
"if",
"token",
":=",
"os",
".",
"Getenv",
"(",
"envBinCheckLegacy",
")",
";",
"token",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprint",
"(",
"os",
".",
"Stdout",
",",
"token",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
13,184 | all-13185 | [
"GetCreateFlags",
"registers",
"the",
"machine",
"create",
"flags",
"recognized",
"by",
"this",
"driver",
"including",
"their",
"help",
"text",
"and",
"defaults",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"return",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultRegionName",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultEndpointType",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultFlavorID",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHUser",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"<mask>",
":",
"defaultSSHPort",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultDockerInstall",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultActiveTimeout",
",",
"}",
",",
"}",
"\n",
"}"
] |
13,185 | all-13186 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkCssProvider",
"."
] | [
"func",
"(",
"v",
"*",
"CssProvider",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkCssProvider",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkCssProvider",
"(",
"p",
")",
"\n",
"}"
] |
13,186 | all-13187 | [
"IsEmpty",
"tests",
"the",
"Queue",
"to",
"determine",
"if",
"it",
"is",
"populate",
"or",
"not",
"."
] | [
"func",
"(",
"q",
"*",
"Queue",
")",
"IsEmpty",
"(",
")",
"bool",
"{",
"q",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"q",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"q",
".",
"underlyer",
"==",
"nil",
"||",
"q",
".",
"underlyer",
".",
"IsEmpty",
"(",
")",
"\n",
"}"
] |
13,187 | all-13188 | [
"Construct",
"a",
"peer",
"with",
"empty",
"state",
".",
"Be",
"sure",
"to",
"register",
"a",
"channel",
"later",
"so",
"we",
"can",
"make",
"outbound",
"communication",
"."
] | [
"func",
"newPeer",
"(",
"self",
"mesh",
".",
"PeerName",
",",
"logger",
"*",
"log",
".",
"Logger",
")",
"*",
"peer",
"{",
"actions",
":=",
"make",
"(",
"chan",
"func",
"(",
")",
")",
"\n",
"p",
":=",
"&",
"peer",
"{",
"st",
":",
"newState",
"(",
"self",
")",
",",
"send",
":",
"nil",
",",
"// must .register() later",
"actions",
":",
"actions",
",",
"quit",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"logger",
":",
"logger",
",",
"}",
"\n",
"go",
"p",
".",
"loop",
"(",
"<mask>",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
13,188 | all-13189 | [
"Close",
"is",
"implementation",
"of",
"io",
".",
"Closer",
"s",
"Close",
"."
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"Close",
"(",
")",
"error",
"{",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"nil",
")",
"\n",
"<mask>",
"s",
".",
"toClose",
".",
"Close",
"(",
")",
"\n",
"}"
] |
13,189 | all-13190 | [
"Helper",
"function",
"that",
"reads",
"content",
"from",
"given",
"file"
] | [
"func",
"loadFile",
"(",
"file",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"js",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"file",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"js",
",",
"nil",
"\n",
"}"
] |
13,190 | all-13191 | [
"sendKeepAliveLoop",
"sends",
"keep",
"alive",
"requests",
"for",
"the",
"lifetime",
"of",
"the",
"given",
"stream",
"."
] | [
"func",
"(",
"l",
"*",
"lessor",
")",
"sendKeepAliveLoop",
"(",
"stream",
"<mask>",
".",
"Lease_LeaseKeepAliveClient",
")",
"{",
"for",
"{",
"var",
"tosend",
"[",
"]",
"LeaseID",
"\n\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"for",
"id",
",",
"ka",
":=",
"range",
"l",
".",
"keepAlives",
"{",
"if",
"ka",
".",
"nextKeepAlive",
".",
"Before",
"(",
"now",
")",
"{",
"tosend",
"=",
"append",
"(",
"tosend",
",",
"id",
")",
"\n",
"}",
"\n",
"}",
"\n",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"id",
":=",
"range",
"tosend",
"{",
"r",
":=",
"&",
"pb",
".",
"LeaseKeepAliveRequest",
"{",
"ID",
":",
"int64",
"(",
"id",
")",
"}",
"\n",
"if",
"err",
":=",
"stream",
".",
"Send",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"// TODO do something with this error?",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"retryConnWait",
")",
":",
"case",
"<-",
"stream",
".",
"Context",
"(",
")",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"<-",
"l",
".",
"donec",
":",
"return",
"\n",
"case",
"<-",
"l",
".",
"stopCtx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,191 | all-13192 | [
"SetItemWidth",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_item_width",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetItemWidth",
"(",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_icon_view_set_item_width",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"width",
")",
")",
"\n",
"}"
] |
13,192 | all-13193 | [
"StrokeString",
"draws",
"the",
"contour",
"of",
"the",
"text",
"at",
"point",
"(",
"0",
"0",
")"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"StrokeString",
"(",
"text",
"string",
")",
"(",
"cursor",
"float64",
")",
"{",
"return",
"gc",
".",
"StrokeStringAt",
"(",
"<mask>",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,193 | all-13194 | [
"Context",
"gets",
"implements",
"RPCServer",
"interface",
"."
] | [
"func",
"(",
"sm",
"*",
"sessionManager",
")",
"Context",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"empty",
".",
"Empty",
")",
"(",
"*",
"mnemosynerpc",
".",
"ContextResponse",
",",
"error",
")",
"{",
"md",
",",
"ok",
":=",
"metadata",
".",
"FromIncomingContext",
"(",
"ctx",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"md",
"[",
"mnemosyne",
".",
"AccessTokenMetadataKey",
"]",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"at",
":=",
"md",
"[",
"mnemosyne",
".",
"AccessTokenMetadataKey",
"]",
"[",
"0",
"]",
"\n\n",
"res",
",",
"err",
":=",
"<mask>",
".",
"Get",
"(",
"ctx",
",",
"&",
"mnemosynerpc",
".",
"GetRequest",
"{",
"AccessToken",
":",
"at",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"mnemosynerpc",
".",
"ContextResponse",
"{",
"Session",
":",
"res",
".",
"Session",
",",
"}",
",",
"nil",
"\n",
"}"
] |
13,194 | all-13195 | [
"GroupId",
"is",
"an",
"adaption",
"from",
"https",
":",
"//",
"codereview",
".",
"appspot",
".",
"com",
"/",
"4589049",
"."
] | [
"func",
"GroupId",
"(",
"name",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"grp",
"C",
".",
"struct_group",
"\n",
"var",
"result",
"*",
"C",
".",
"struct_group",
"\n\n",
"bufSize",
":=",
"C",
".",
"sysconf",
"(",
"C",
".",
"_SC_GETGR_R_SIZE_MAX",
")",
"\n",
"if",
"bufSize",
"<",
"0",
"{",
"bufSize",
"=",
"4096",
"\n",
"}",
"\n\n",
"buf",
":=",
"C",
".",
"malloc",
"(",
"C",
".",
"size_t",
"(",
"bufSize",
")",
")",
"\n",
"if",
"buf",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"cname",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cname",
")",
")",
"\n\n",
"again",
":",
"rv",
",",
"errno",
":=",
"C",
".",
"getgrnam_r",
"(",
"cname",
",",
"&",
"grp",
",",
"(",
"*",
"C",
".",
"char",
")",
"(",
"buf",
")",
",",
"C",
".",
"size_t",
"(",
"bufSize",
")",
",",
"&",
"result",
")",
"\n",
"if",
"rv",
"!=",
"0",
"{",
"// OOM killer will take care of us if we end up doing this too",
"// often.",
"if",
"errno",
"==",
"syscall",
".",
"ERANGE",
"{",
"bufSize",
"*=",
"2",
"\n",
"tmp",
":=",
"C",
".",
"realloc",
"(",
"buf",
",",
"C",
".",
"size_t",
"(",
"bufSize",
")",
")",
"\n",
"if",
"tmp",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"buf",
"=",
"tmp",
"\n",
"goto",
"again",
"\n",
"}",
"\n\n",
"C",
".",
"<mask>",
"(",
"buf",
")",
"\n",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"syscall",
".",
"Errno",
"(",
"rv",
")",
")",
"\n",
"}",
"\n",
"C",
".",
"free",
"(",
"buf",
")",
"\n\n",
"if",
"result",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"int",
"(",
"C",
".",
"int",
"(",
"result",
".",
"gr_gid",
")",
")",
",",
"nil",
"\n",
"}"
] |
13,195 | all-13196 | [
"SetWebsiteLabel",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_set_website_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"SetWebsiteLabel",
"(",
"websiteLabel",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"websiteLabel",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_about_dialog_set_website_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
13,196 | all-13197 | [
"MustDeadEntry",
"retrieves",
"the",
"DeadEntry",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"BucketEntry",
")",
"MustDeadEntry",
"(",
")",
"LedgerKey",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetDeadEntry",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
13,197 | all-13198 | [
"resourceVSphereDatastoreClusterReadTags",
"reads",
"the",
"tags",
"for",
"vsphere_datastore_cluster",
"."
] | [
"func",
"resourceVSphereDatastoreClusterReadTags",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"pod",
"*",
"<mask>",
".",
"StoragePod",
")",
"error",
"{",
"if",
"tagsClient",
",",
"_",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"TagsClient",
"(",
")",
";",
"tagsClient",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"if",
"err",
":=",
"readTagsForResource",
"(",
"tagsClient",
",",
"pod",
",",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,198 | all-13199 | [
"The",
"For",
"method",
"is",
"obsolete",
"and",
"will",
"be",
"removed",
"in",
"a",
"future",
"release",
".",
"See",
"Iter",
"as",
"an",
"elegant",
"replacement",
"."
] | [
"func",
"(",
"iter",
"*",
"Iter",
")",
"For",
"(",
"result",
"interface",
"{",
"}",
",",
"f",
"func",
"(",
")",
"error",
")",
"(",
"err",
"error",
")",
"{",
"valid",
":=",
"false",
"\n",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"<mask>",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"switch",
"v",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Map",
",",
"reflect",
".",
"Ptr",
",",
"reflect",
".",
"Interface",
",",
"reflect",
".",
"Slice",
":",
"valid",
"=",
"v",
".",
"IsNil",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"valid",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"zero",
":=",
"reflect",
".",
"Zero",
"(",
"v",
".",
"Type",
"(",
")",
")",
"\n",
"for",
"{",
"v",
".",
"Set",
"(",
"zero",
")",
"\n",
"if",
"!",
"iter",
".",
"Next",
"(",
"result",
")",
"{",
"break",
"\n",
"}",
"\n",
"err",
"=",
"f",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"iter",
".",
"Err",
"(",
")",
"\n",
"}"
] |
13,199 | all-13200 | [
"UpdateConfigs",
"updates",
"configs",
"from",
"storage",
"path",
"In",
":",
"storagePath",
"-",
"the",
"path",
"to",
"read",
"the",
"config",
"file",
"from",
"Out",
":",
"nil",
"on",
"success",
"error",
"otherwise"
] | [
"func",
"(",
"m",
"*",
"Mason",
")",
"UpdateConfigs",
"(",
"storagePath",
"string",
")",
"error",
"{",
"configs",
",",
"err",
":=",
"ParseConfig",
"(",
"storagePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"m",
".",
"<mask>",
".",
"SyncConfigs",
"(",
"configs",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.