id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
19,300 | all-19301 | [
"Transformer",
"returns",
"an",
"Option",
"that",
"applies",
"a",
"transformation",
"function",
"that",
"converts",
"values",
"of",
"a",
"certain",
"type",
"into",
"that",
"of",
"another",
".",
"The",
"transformer",
"f",
"must",
"be",
"a",
"function",
"func",
"(",
"T",
")",
"R",
"that",
"converts",
"values",
"of",
"type",
"T",
"to",
"those",
"of",
"type",
"R",
"and",
"is",
"implicitly",
"filtered",
"to",
"input",
"values",
"assignable",
"to",
"T",
".",
"The",
"transformer",
"must",
"not",
"mutate",
"T",
"in",
"any",
"way",
".",
"To",
"help",
"prevent",
"some",
"cases",
"of",
"infinite",
"recursive",
"cycles",
"applying",
"the",
"same",
"transform",
"to",
"the",
"output",
"of",
"itself",
"(",
"e",
".",
"g",
".",
"in",
"the",
"case",
"where",
"the",
"input",
"and",
"output",
"types",
"are",
"the",
"same",
")",
"an",
"implicit",
"filter",
"is",
"added",
"such",
"that",
"a",
"transformer",
"is",
"applicable",
"only",
"if",
"that",
"exact",
"transformer",
"is",
"not",
"already",
"in",
"the",
"tail",
"of",
"the",
"Path",
"since",
"the",
"last",
"non",
"-",
"Transform",
"step",
".",
"For",
"situations",
"where",
"the",
"implicit",
"filter",
"is",
"still",
"insufficient",
"consider",
"using",
"cmpopts",
".",
"AcyclicTransformer",
"which",
"adds",
"a",
"filter",
"to",
"prevent",
"the",
"transformer",
"from",
"being",
"recursively",
"applied",
"upon",
"itself",
".",
"The",
"name",
"is",
"a",
"user",
"provided",
"label",
"that",
"is",
"used",
"as",
"the",
"Transform",
".",
"Name",
"in",
"the",
"transformation",
"PathStep",
"(",
"and",
"eventually",
"shown",
"in",
"the",
"Diff",
"output",
")",
".",
"The",
"name",
"must",
"be",
"a",
"valid",
"identifier",
"or",
"qualified",
"identifier",
"in",
"Go",
"syntax",
".",
"If",
"empty",
"an",
"arbitrary",
"name",
"is",
"used",
"."
]
| [
"func",
"Transformer",
"(",
"name",
"string",
",",
"f",
"interface",
"{",
"}",
")",
"Option",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"f",
")",
"\n",
"if",
"!",
"function",
".",
"IsType",
"(",
"v",
".",
"Type",
"(",
")",
",",
"function",
".",
"Transformer",
")",
"||",
"v",
".",
"IsNil",
"(",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
")",
")",
"\n",
"}",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"name",
"=",
"function",
".",
"NameOf",
"(",
"v",
")",
"\n",
"if",
"!",
"identsRx",
".",
"MatchString",
"(",
"name",
")",
"{",
"name",
"=",
"\"",
" ",
"/ Lambda-symbol as placeholder name",
"\n",
"}",
"\n",
"}",
"else",
"if",
"!",
"identsRx",
".",
"MatchString",
"(",
"<mask>",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
")",
"\n",
"}",
"\n",
"tr",
":=",
"&",
"transformer",
"{",
"name",
":",
"name",
",",
"fnc",
":",
"reflect",
".",
"ValueOf",
"(",
"f",
")",
"}",
"\n",
"if",
"ti",
":=",
"v",
".",
"Type",
"(",
")",
".",
"In",
"(",
"0",
")",
";",
"ti",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Interface",
"||",
"ti",
".",
"NumMethod",
"(",
")",
">",
"0",
"{",
"tr",
".",
"typ",
"=",
"ti",
"\n",
"}",
"\n",
"return",
"tr",
"\n",
"}"
]
|
19,301 | all-19302 | [
"validColor",
"will",
"make",
"sure",
"the",
"given",
"color",
"is",
"actually",
"allowed"
]
| [
"func",
"validColor",
"(",
"c",
"string",
")",
"bool",
"{",
"valid",
":=",
"false",
"\n",
"if",
"validColors",
"[",
"c",
"]",
"{",
"<mask>",
"=",
"true",
"\n",
"}",
"\n",
"return",
"valid",
"\n",
"}"
]
|
19,302 | all-19303 | [
"HasOverallState",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"m",
"*",
"Monitor",
")",
"HasOverallState",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"OverallState",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,303 | all-19304 | [
"NewServer",
"-",
"create",
"a",
"new",
"Server",
"at",
"the",
"address",
"and",
"path"
]
| [
"func",
"NewServer",
"(",
"address",
",",
"path",
"string",
",",
"eventBus",
"Bus",
")",
"*",
"Server",
"{",
"<mask>",
":=",
"new",
"(",
"Server",
")",
"\n",
"server",
".",
"eventBus",
"=",
"eventBus",
"\n",
"server",
".",
"address",
"=",
"address",
"\n",
"server",
".",
"path",
"=",
"path",
"\n",
"server",
".",
"subscribers",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"SubscribeArg",
")",
"\n",
"server",
".",
"service",
"=",
"&",
"ServerService",
"{",
"server",
",",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
",",
"false",
"}",
"\n",
"return",
"server",
"\n",
"}"
]
|
19,304 | all-19305 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetDefaultBackgroundColorOverrideParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,305 | all-19306 | [
"PublishPort",
"publish",
"a",
"container",
"s",
"port",
"to",
"the",
"host",
"."
]
| [
"func",
"(",
"s",
"*",
"RunConfig",
")",
"PublishPort",
"(",
"hostPort",
",",
"containerPort",
"uint16",
")",
"{",
"s",
".",
"Options",
"=",
"append",
"(",
"s",
".",
"<mask>",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hostPort",
",",
"containerPort",
")",
")",
"\n",
"}"
]
|
19,306 | all-19307 | [
"HasMustShowHits",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasMustShowHits",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"MustShowHits",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
19,307 | all-19308 | [
"migrateLibraryEmbed",
"converts",
"library",
"attributes",
"to",
"embed",
"attributes",
"preserving",
"comments",
".",
"This",
"only",
"applies",
"to",
"Go",
"rules",
"and",
"only",
"if",
"there",
"is",
"no",
"keep",
"comment",
"on",
"library",
"and",
"no",
"existing",
"embed",
"attribute",
"."
]
| [
"func",
"migrateLibraryEmbed",
"(",
"c",
"*",
"config",
".",
"Config",
",",
"f",
"*",
"rule",
".",
"File",
")",
"{",
"for",
"_",
",",
"r",
":=",
"<mask>",
"f",
".",
"Rules",
"{",
"if",
"!",
"isGoRule",
"(",
"r",
".",
"Kind",
"(",
")",
")",
"{",
"continue",
"\n",
"}",
"\n",
"libExpr",
":=",
"r",
".",
"Attr",
"(",
"\"",
"\"",
")",
"\n",
"if",
"libExpr",
"==",
"nil",
"||",
"rule",
".",
"ShouldKeep",
"(",
"libExpr",
")",
"||",
"r",
".",
"Attr",
"(",
"\"",
"\"",
")",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"r",
".",
"DelAttr",
"(",
"\"",
"\"",
")",
"\n",
"r",
".",
"SetAttr",
"(",
"\"",
"\"",
",",
"&",
"bzl",
".",
"ListExpr",
"{",
"List",
":",
"[",
"]",
"bzl",
".",
"Expr",
"{",
"libExpr",
"}",
"}",
")",
"\n",
"}",
"\n",
"}"
]
|
19,308 | all-19309 | [
"GetComparator",
"returns",
"the",
"Comparator",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"GetComparator",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Comparator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"c",
".",
"Comparator",
"\n",
"}"
]
|
19,309 | all-19310 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"GestureType",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
]
|
19,310 | all-19311 | [
"CompareAndSwap",
"writes",
"the",
"given",
"item",
"that",
"was",
"previously",
"returned",
"by",
"Get",
"if",
"the",
"value",
"was",
"neither",
"modified",
"or",
"evicted",
"between",
"the",
"Get",
"and",
"the",
"CompareAndSwap",
"calls",
".",
"The",
"item",
"s",
"Key",
"should",
"not",
"change",
"between",
"calls",
"but",
"all",
"other",
"item",
"fields",
"may",
"differ",
".",
"ErrCASConflict",
"is",
"returned",
"if",
"the",
"value",
"was",
"modified",
"in",
"between",
"the",
"calls",
".",
"ErrNotStored",
"is",
"returned",
"if",
"the",
"value",
"was",
"evicted",
"in",
"between",
"the",
"calls",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"CompareAndSwap",
"(",
"<mask>",
"*",
"Item",
")",
"error",
"{",
"return",
"c",
".",
"populateOne",
"(",
"cmdSet",
",",
"item",
",",
"item",
".",
"casid",
")",
"\n",
"}"
]
|
19,311 | all-19312 | [
"UntagResourceRequest",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"UntagResourceRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"UntagResourceInput",
")",
"(",
"*",
"<mask>",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"UntagResourceOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"UntagResourceOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
19,312 | all-19313 | [
"mergeTags",
"will",
"merge",
"the",
"local",
"tags",
"and",
"ec2",
"tags",
"for",
"the",
"overlap",
"part",
"ec2",
"tags",
"will",
"be",
"overridden",
"by",
"local",
"tags",
"."
]
| [
"func",
"mergeTags",
"(",
"localTags",
"[",
"]",
"*",
"ecs",
".",
"Tag",
",",
"ec2Tags",
"[",
"]",
"*",
"ecs",
".",
"Tag",
")",
"[",
"]",
"*",
"ecs",
".",
"Tag",
"{",
"tagsMap",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n\n",
"for",
"_",
",",
"ec2Tag",
":=",
"range",
"ec2Tags",
"{",
"tagsMap",
"[",
"aws",
".",
"StringValue",
"(",
"ec2Tag",
".",
"Key",
")",
"]",
"=",
"aws",
".",
"StringValue",
"(",
"ec2Tag",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"localTag",
":=",
"range",
"localTags",
"{",
"tagsMap",
"[",
"aws",
".",
"StringValue",
"(",
"localTag",
".",
"Key",
")",
"]",
"=",
"aws",
".",
"StringValue",
"(",
"localTag",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"return",
"utils",
".",
"MapToTags",
"(",
"tagsMap",
")",
"\n",
"}"
]
|
19,313 | all-19314 | [
"Do",
"executes",
"DOM",
".",
"getFrameOwner",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"backendNodeID",
"-",
"Resulting",
"node",
".",
"nodeID",
"-",
"Id",
"of",
"the",
"node",
"at",
"given",
"coordinates",
"only",
"when",
"enabled",
"and",
"requested",
"document",
"."
]
| [
"func",
"(",
"p",
"*",
"GetFrameOwnerParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"backendNodeID",
"cdp",
".",
"BackendNodeID",
",",
"nodeID",
"cdp",
".",
"NodeID",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"GetFrameOwnerReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetFrameOwner",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"BackendNodeID",
",",
"res",
".",
"NodeID",
",",
"nil",
"\n",
"}"
]
|
19,314 | all-19315 | [
"Get",
"indicates",
"an",
"expected",
"call",
"of",
"Get"
]
| [
"func",
"(",
"mr",
"*",
"MockClientMockRecorder",
")",
"Get",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockClient",
")",
"(",
"nil",
")",
".",
"Get",
")",
",",
"arg0",
")",
"\n",
"}"
]
|
19,315 | all-19316 | [
"Run",
"starts",
"the",
"background",
"processing"
]
| [
"func",
"(",
"m",
"*",
"Manager",
")",
"Run",
"(",
")",
"error",
"{",
"go",
"m",
".",
"sender",
"(",
")",
"\n",
"for",
"<mask>",
"m",
".",
"ctx",
".",
"Done",
"(",
")",
"{",
"m",
".",
"cancelDiscoverers",
"(",
")",
"\n",
"return",
"m",
".",
"ctx",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,316 | all-19317 | [
"title",
":",
"dump",
"goroutines",
"path",
":",
"/",
"debug",
"/",
"goroutines",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"Ok"
]
| [
"func",
"dumpGoroutines",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"<mask>",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermDebug",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"return",
"pprof",
".",
"Lookup",
"(",
"\"",
"\"",
")",
".",
"WriteTo",
"(",
"w",
",",
"2",
")",
"\n",
"}"
]
|
19,317 | all-19318 | [
"Add",
"response",
"nodes",
"to",
"node",
"table",
"."
]
| [
"func",
"(",
"s",
"*",
"Server",
")",
"addResponseNodes",
"(",
"d",
"krpc",
".",
"Msg",
")",
"{",
"if",
"d",
".",
"R",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"d",
".",
"R",
".",
"ForAllNodes",
"(",
"func",
"(",
"ni",
"krpc",
".",
"NodeInfo",
")",
"{",
"s",
".",
"getNode",
"(",
"NewAddr",
"(",
"ni",
".",
"Addr",
".",
"UDP",
"(",
")",
")",
",",
"int160FromByteArray",
"(",
"ni",
".",
"<mask>",
")",
",",
"true",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
19,318 | all-19319 | [
"PangoFontDescription",
"*",
"pango_font_description_copy_static",
"(",
"const",
"PangoFontDescription",
"*",
"desc",
")",
";"
]
| [
"func",
"(",
"v",
"*",
"FontDescription",
")",
"CopyStatic",
"(",
")",
"*",
"FontDescription",
"{",
"c",
":=",
"C",
".",
"pango_font_description_copy_static",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"v2",
":=",
"<mask>",
"(",
"FontDescription",
")",
"\n",
"v2",
".",
"pangoFontDescription",
"=",
"c",
"\n",
"return",
"v2",
"\n",
"}"
]
|
19,319 | all-19320 | [
"newImageSource",
"returns",
"a",
"types",
".",
"ImageSource",
"for",
"the",
"specified",
"image",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageSource",
"."
]
| [
"func",
"newImageSource",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"ref",
"archiveReference",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"if",
"ref",
".",
"destinationRef",
"!=",
"nil",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"src",
",",
"err",
":=",
"tarfile",
".",
"NewSourceFromFile",
"(",
"ref",
".",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"archiveImageSource",
"{",
"Source",
":",
"src",
",",
"ref",
":",
"ref",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
19,320 | all-19321 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"LedgerUpgrade"
]
| [
"func",
"(",
"u",
"LedgerUpgrade",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"LedgerUpgradeType",
"(",
"sw",
")",
"{",
"case",
"LedgerUpgradeTypeLedgerUpgradeVersion",
":",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"case",
"LedgerUpgradeTypeLedgerUpgradeBaseFee",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
]
|
19,321 | all-19322 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"CrashParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,322 | all-19323 | [
"/",
"*",
"Initializes",
"sparse",
"array",
"iterator",
"(",
"returns",
"the",
"first",
"node",
"or",
"NULL",
"if",
"the",
"array",
"is",
"empty",
")"
]
| [
"func",
"(",
"mat",
"*",
"SparseMat",
")",
"InitSparseMatIterator",
"(",
"iter",
"*",
"SparseMatIterator",
")",
"*",
"SparseNode",
"{",
"mat_c",
":=",
"(",
"*",
"C",
".",
"CvSparseMat",
")",
"(",
"mat",
")",
"\n",
"<mask>",
":=",
"C",
".",
"cvInitSparseMatIterator",
"(",
"mat_c",
",",
"(",
"*",
"C",
".",
"CvSparseMatIterator",
")",
"(",
"iter",
")",
")",
"\n",
"return",
"(",
"*",
"SparseNode",
")",
"(",
"node",
")",
"\n",
"}"
]
|
19,323 | all-19324 | [
"AssociateNic",
"attach",
"a",
"nic",
"to",
"load",
"balancer"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"AssociateNic",
"(",
"dcid",
"string",
",",
"lbalid",
"string",
",",
"nicid",
"string",
")",
"(",
"*",
"Nic",
",",
"error",
")",
"{",
"sm",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"nicid",
"}",
"\n",
"url",
":=",
"balnicColPath",
"(",
"dcid",
",",
"lbalid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"<mask>",
":=",
"&",
"Nic",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"sm",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
19,324 | all-19325 | [
"Detect",
"returns",
"the",
"Linux",
"distribution",
"."
]
| [
"func",
"Detect",
"(",
")",
"(",
"Distro",
",",
"error",
")",
"{",
"var",
"id",
"string",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"\"",
"\"",
")",
";",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"cfg",
",",
"err",
":=",
"shconf",
".",
"ParseFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"id",
",",
"err",
"=",
"cfg",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"v",
",",
"found",
":=",
"idToDistro",
"[",
"<mask>",
"]",
";",
"found",
"{",
"return",
"v",
",",
"nil",
"\n",
"}",
"\n\n",
"}",
"else",
"if",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"\"",
"\"",
")",
";",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"CentOS",
",",
"nil",
"\n",
"}",
"else",
"if",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"\"",
"\"",
")",
";",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"PCLinuxOS",
",",
"nil",
"\n",
"}",
"\n\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
19,325 | all-19326 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventDocumentUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom61",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,326 | all-19327 | [
"StringMapHasStringKey",
"returns",
"true",
"if",
"any",
"of",
"the",
"supplied",
"keys",
"are",
"present",
"in",
"the",
"map",
"."
]
| [
"func",
"StringMapHasStringKey",
"(",
"m",
"map",
"[",
"string",
"]",
"string",
",",
"keys",
"...",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"k",
":=",
"range",
"keys",
"{",
"if",
"_",
",",
"ok",
":=",
"m",
"[",
"k",
"]",
";",
"<mask>",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,327 | all-19328 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventContextCreated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
19,328 | all-19329 | [
"selfCmder",
"returns",
"a",
"Cmder",
"that",
"creates",
"a",
"command",
"that",
"re",
"-",
"invokes",
"the",
"currently",
"running",
"executable",
"."
]
| [
"func",
"selfCmder",
"(",
")",
"(",
"Cmder",
",",
"error",
")",
"{",
"pathToSelf",
",",
"err",
":=",
"osext",
".",
"Executable",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"PathCmder",
"(",
"pathToSelf",
")",
",",
"nil",
"\n",
"}"
]
|
19,329 | all-19330 | [
"SavePNG",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_save",
"()",
".",
"Compression",
"is",
"a",
"number",
"between",
"0",
"...",
"9"
]
| [
"func",
"(",
"v",
"*",
"Pixbuf",
")",
"SavePNG",
"(",
"<mask>",
"string",
",",
"compression",
"int",
")",
"error",
"{",
"cpath",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"ccompression",
":=",
"C",
".",
"CString",
"(",
"strconv",
".",
"Itoa",
"(",
"compression",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpath",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"ccompression",
")",
")",
"\n\n",
"var",
"err",
"*",
"C",
".",
"GError",
"\n",
"c",
":=",
"C",
".",
"_gdk_pixbuf_save_png",
"(",
"v",
".",
"native",
"(",
")",
",",
"cpath",
",",
"&",
"err",
",",
"ccompression",
")",
"\n",
"if",
"!",
"gobool",
"(",
"c",
")",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,330 | all-19331 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"This",
"method",
"is",
"only",
"for",
"debugging",
"the",
"ec2",
"-",
"manager",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#listWorkerTypes"
]
| [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"ListWorkerTypes",
"(",
")",
"(",
"*",
"ListOfWorkerTypes",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"<mask>",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"ListOfWorkerTypes",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListOfWorkerTypes",
")",
",",
"err",
"\n",
"}"
]
|
19,331 | all-19332 | [
"NewDashboardAgent",
"creates",
"a",
"new",
"user",
"dashboard",
"agent",
"."
]
| [
"func",
"NewDashboardAgent",
"(",
"repos",
"[",
"]",
"string",
",",
"config",
"*",
"config",
".",
"GitHubOAuthConfig",
",",
"<mask>",
"*",
"logrus",
".",
"Entry",
")",
"*",
"DashboardAgent",
"{",
"return",
"&",
"DashboardAgent",
"{",
"repos",
":",
"repos",
",",
"goac",
":",
"config",
",",
"log",
":",
"log",
",",
"}",
"\n",
"}"
]
|
19,332 | all-19333 | [
"CredentialsHandlerImpl",
"is",
"the",
"major",
"logic",
"in",
"CredentialsHandler",
"abstract",
"this",
"out",
"because",
"v2",
".",
"CredentialsHandler",
"also",
"uses",
"the",
"same",
"logic",
"."
]
| [
"func",
"CredentialsHandlerImpl",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"auditLogger",
"audit",
".",
"AuditLogger",
",",
"credentialsManager",
"credentials",
".",
"<mask>",
",",
"credentialsID",
"string",
",",
"errPrefix",
"string",
")",
"{",
"responseJSON",
",",
"arn",
",",
"roleType",
",",
"errorMessage",
",",
"err",
":=",
"processCredentialsRequest",
"(",
"credentialsManager",
",",
"r",
",",
"credentialsID",
",",
"errPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"errorMessage",
")",
"\n",
"writeCredentialsRequestResponse",
"(",
"w",
",",
"r",
",",
"errorMessage",
".",
"HTTPErrorCode",
",",
"audit",
".",
"GetCredentialsEventType",
"(",
"roleType",
")",
",",
"arn",
",",
"auditLogger",
",",
"errResponseJSON",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"writeCredentialsRequestResponse",
"(",
"w",
",",
"r",
",",
"http",
".",
"StatusOK",
",",
"audit",
".",
"GetCredentialsEventType",
"(",
"roleType",
")",
",",
"arn",
",",
"auditLogger",
",",
"responseJSON",
")",
"\n",
"}"
]
|
19,333 | all-19334 | [
"DeleteRecords",
"deletes",
"a",
"given",
"set",
"of",
"DNS",
"records",
"in",
"a",
"given",
"zone",
"."
]
| [
"func",
"(",
"p",
"*",
"GoogleProvider",
")",
"DeleteRecords",
"(",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"error",
"{",
"change",
":=",
"&",
"dns",
".",
"Change",
"{",
"}",
"\n\n",
"change",
".",
"Deletions",
"=",
"append",
"(",
"change",
".",
"Deletions",
",",
"p",
".",
"newFilteredRecords",
"(",
"endpoints",
")",
"...",
")",
"\n\n",
"return",
"p",
".",
"submitChange",
"(",
"<mask>",
")",
"\n",
"}"
]
|
19,334 | all-19335 | [
"ElectionTimeout",
"returns",
"an",
"election",
"timeout",
"duration",
"."
]
| [
"func",
"(",
"m",
"*",
"Member",
")",
"ElectionTimeout",
"(",
")",
"time",
".",
"Duration",
"{",
"return",
"<mask>",
".",
"Duration",
"(",
"m",
".",
"Etcd",
".",
"ElectionTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
"\n",
"}"
]
|
19,335 | all-19336 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetProcessInfoReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,336 | all-19337 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"BaseAudioContext",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,337 | all-19338 | [
"ApplySnapshot",
"overwrites",
"the",
"contents",
"of",
"this",
"Storage",
"object",
"with",
"those",
"of",
"the",
"given",
"snapshot",
"."
]
| [
"func",
"(",
"ms",
"*",
"MemoryStorage",
")",
"ApplySnapshot",
"(",
"snap",
"pb",
".",
"Snapshot",
")",
"error",
"{",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ms",
".",
"Unlock",
"(",
")",
"\n\n",
"//handle check for old snapshot being applied",
"msIndex",
":=",
"ms",
".",
"snapshot",
".",
"Metadata",
".",
"Index",
"\n",
"snapIndex",
":=",
"snap",
".",
"Metadata",
".",
"Index",
"\n",
"if",
"msIndex",
">=",
"snapIndex",
"{",
"return",
"ErrSnapOutOfDate",
"\n",
"}",
"\n\n",
"ms",
".",
"snapshot",
"=",
"snap",
"\n",
"ms",
".",
"ents",
"=",
"[",
"]",
"pb",
".",
"Entry",
"{",
"{",
"Term",
":",
"snap",
".",
"Metadata",
".",
"Term",
",",
"Index",
":",
"snap",
".",
"Metadata",
".",
"Index",
"}",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,338 | all-19339 | [
"/",
"*",
"Set",
"the",
"transaction",
"type",
"to",
"WebTransaction",
".",
"This",
"will",
"automatically",
"change",
"the",
"category",
"to",
"Uri",
".",
"You",
"can",
"change",
"the",
"transaction",
"category",
"using",
"newrelic_transaction_set_category",
"."
]
| [
"func",
"TransactionSetTypeWeb",
"(",
"id",
"int64",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"errNo",
"(",
"C",
".",
"newrelic_transaction_set_type_web",
"(",
"C",
".",
"<mask>",
"(",
"id",
")",
")",
")",
"\n",
"}"
]
|
19,339 | all-19340 | [
"First",
"letter",
"of",
"sentance",
"captitilized",
"Uses",
"custom",
"friendly",
"replacements",
"via",
"AddHuman",
"()"
]
| [
"func",
"(",
"rs",
"*",
"Ruleset",
")",
"Humanize",
"(",
"word",
"string",
")",
"string",
"{",
"word",
"=",
"replaceLast",
"(",
"word",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"// strip foreign key kinds",
"\n",
"// replace and strings in humans list",
"for",
"_",
",",
"rule",
":=",
"range",
"rs",
".",
"humans",
"{",
"word",
"=",
"strings",
".",
"Replace",
"(",
"word",
",",
"rule",
".",
"suffix",
",",
"<mask>",
".",
"replacement",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"sentance",
":=",
"rs",
".",
"seperatedWords",
"(",
"word",
",",
"\"",
"\"",
")",
"\n",
"return",
"strings",
".",
"ToUpper",
"(",
"sentance",
"[",
":",
"1",
"]",
")",
"+",
"sentance",
"[",
"1",
":",
"]",
"\n",
"}"
]
|
19,340 | all-19341 | [
"ParseMessageID",
"attempts",
"to",
"parse",
"s",
"which",
"should",
"be",
"an",
"hexadecimal",
"representation",
"of",
"an",
"8",
"byte",
"message",
"ID",
"."
]
| [
"func",
"ParseMessageID",
"(",
"s",
"string",
")",
"(",
"id",
"MessageID",
",",
"err",
"error",
")",
"{",
"var",
"v",
"uint64",
"\n",
"v",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"s",
",",
"16",
",",
"64",
")",
"\n",
"<mask>",
"=",
"MessageID",
"(",
"v",
")",
"\n",
"return",
"\n",
"}"
]
|
19,341 | all-19342 | [
"Append",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_list_store_append",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"ListStore",
")",
"Append",
"(",
")",
"*",
"TreeIter",
"{",
"<mask>",
"ti",
"C",
".",
"GtkTreeIter",
"\n",
"C",
".",
"gtk_list_store_append",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"ti",
")",
"\n",
"iter",
":=",
"&",
"TreeIter",
"{",
"ti",
"}",
"\n",
"return",
"iter",
"\n",
"}"
]
|
19,342 | all-19343 | [
"DeployCmds",
"deploys",
"an",
"unit",
"builded",
"by",
"tsuru",
"."
]
| [
"func",
"DeployCmds",
"(",
"app",
"provision",
".",
"App",
")",
"[",
"]",
"string",
"{",
"uaCmds",
":=",
"unitAgentCmds",
"(",
"app",
")",
"\n",
"uaCmds",
"=",
"<mask>",
"(",
"uaCmds",
",",
"\"",
"\"",
")",
"\n",
"finalCmd",
":=",
"strings",
".",
"Join",
"(",
"uaCmds",
",",
"\"",
"\"",
")",
"\n",
"return",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"finalCmd",
"}",
"\n",
"}"
]
|
19,343 | all-19344 | [
"determineTimeout",
"decides",
"the",
"timeout",
"value",
"used",
"for",
"build"
]
| [
"func",
"determineTimeout",
"(",
"spec",
"*",
"buildv1alpha1",
".",
"BuildSpec",
",",
"dc",
"*",
"prowjobv1",
".",
"DecorationConfig",
",",
"defaultTimeout",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"switch",
"{",
"case",
"<mask>",
".",
"Timeout",
"!=",
"nil",
":",
"return",
"spec",
".",
"Timeout",
".",
"Duration",
"\n",
"case",
"dc",
"!=",
"nil",
"&&",
"dc",
".",
"Timeout",
".",
"Duration",
">",
"0",
":",
"return",
"dc",
".",
"Timeout",
".",
"Duration",
"\n",
"default",
":",
"return",
"defaultTimeout",
"\n",
"}",
"\n",
"}"
]
|
19,344 | all-19345 | [
"less",
"compares",
"two",
"Stack",
"where",
"the",
"ones",
"that",
"are",
"less",
"are",
"more",
"important",
"so",
"they",
"come",
"up",
"front",
".",
"A",
"Stack",
"with",
"more",
"private",
"functions",
"is",
"less",
"so",
"it",
"is",
"at",
"the",
"top",
".",
"Inversely",
"a",
"Stack",
"with",
"only",
"public",
"functions",
"is",
"more",
"so",
"it",
"is",
"at",
"the",
"bottom",
"."
]
| [
"func",
"(",
"s",
"*",
"Stack",
")",
"less",
"(",
"r",
"*",
"Stack",
")",
"bool",
"{",
"lStdlib",
":=",
"0",
"\n",
"lPrivate",
":=",
"0",
"\n",
"for",
"_",
",",
"c",
":=",
"<mask>",
"s",
".",
"Calls",
"{",
"if",
"c",
".",
"IsStdlib",
"{",
"lStdlib",
"++",
"\n",
"}",
"else",
"{",
"lPrivate",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"rStdlib",
":=",
"0",
"\n",
"rPrivate",
":=",
"0",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"r",
".",
"Calls",
"{",
"if",
"s",
".",
"IsStdlib",
"{",
"rStdlib",
"++",
"\n",
"}",
"else",
"{",
"rPrivate",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"lPrivate",
">",
"rPrivate",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"lPrivate",
"<",
"rPrivate",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"lStdlib",
">",
"rStdlib",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"lStdlib",
"<",
"rStdlib",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// Stack lengths are the same.",
"for",
"x",
":=",
"range",
"s",
".",
"Calls",
"{",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"Func",
".",
"Raw",
"<",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"Func",
".",
"Raw",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"Func",
".",
"Raw",
">",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"Func",
".",
"Raw",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"PkgSrc",
"(",
")",
"<",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"PkgSrc",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"PkgSrc",
"(",
")",
">",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"PkgSrc",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"Line",
"<",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"Line",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"s",
".",
"Calls",
"[",
"x",
"]",
".",
"Line",
">",
"r",
".",
"Calls",
"[",
"x",
"]",
".",
"Line",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
19,345 | all-19346 | [
"ProwJobID",
"extracts",
"the",
"ProwJob",
"identifier",
"for",
"the",
"Jenkins",
"build",
"in",
"order",
"to",
"correlate",
"the",
"build",
"with",
"a",
"ProwJob",
".",
"If",
"the",
"build",
"has",
"an",
"empty",
"PROW_JOB_ID",
"it",
"didn",
"t",
"start",
"by",
"prow",
"."
]
| [
"func",
"(",
"jb",
"*",
"Build",
")",
"ProwJobID",
"(",
")",
"string",
"{",
"for",
"_",
",",
"action",
":=",
"range",
"jb",
".",
"Actions",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"action",
".",
"Parameters",
"{",
"if",
"p",
".",
"Name",
"==",
"prowJobID",
"{",
"value",
",",
"ok",
":=",
"p",
".",
"<mask>",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"logrus",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
",",
"jb",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
19,346 | all-19347 | [
"Start",
"starts",
"a",
"transaction",
"setting",
"the",
"id",
"."
]
| [
"func",
"(",
"t",
"*",
"tx",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"t",
".",
"id",
"!=",
"0",
"{",
"return",
"ErrTxAlreadyStarted",
"\n",
"}",
"\n",
"if",
"t",
".",
"id",
",",
"err",
"=",
"t",
".",
"Tracer",
".",
"BeginTransaction",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"t",
".",
"Tracer",
".",
"SetTransactionName",
"(",
"t",
".",
"id",
",",
"t",
".",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"t",
".",
"Tracer",
".",
"SetTransactionType",
"(",
"t",
".",
"id",
",",
"t",
".",
"txnType",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"t",
".",
"url",
"!=",
"\"",
"\"",
"{",
"if",
"err",
"=",
"t",
".",
"Tracer",
".",
"SetTransactionRequestURL",
"(",
"t",
".",
"<mask>",
",",
"t",
".",
"url",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"t",
".",
"category",
"!=",
"\"",
"\"",
"{",
"if",
"err",
"=",
"t",
".",
"Tracer",
".",
"SetTransactionCategory",
"(",
"t",
".",
"id",
",",
"t",
".",
"category",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,347 | all-19348 | [
"BoolEnvDef",
"get",
"environemnt",
"variable",
"and",
"return",
"bool",
"."
]
| [
"func",
"BoolEnvDef",
"(",
"env",
"string",
",",
"def",
"bool",
")",
"bool",
"{",
"val",
":=",
"<mask>",
".",
"Getenv",
"(",
"env",
")",
"\n",
"if",
"val",
"==",
"\"",
"\"",
"{",
"return",
"def",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"def",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}"
]
|
19,348 | all-19349 | [
"ListTeamMembers",
"return",
"a",
"fake",
"team",
"with",
"a",
"single",
"sig",
"-",
"lead",
"GitHub",
"teammember"
]
| [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListTeamMembers",
"(",
"teamID",
"int",
",",
"role",
"string",
")",
"(",
"[",
"]",
"github",
".",
"TeamMember",
",",
"error",
")",
"{",
"if",
"role",
"!=",
"github",
".",
"RoleAll",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"role",
")",
"\n",
"}",
"\n",
"teams",
":=",
"<mask>",
"[",
"int",
"]",
"[",
"]",
"github",
".",
"TeamMember",
"{",
"0",
":",
"{",
"{",
"Login",
":",
"\"",
"\"",
"}",
"}",
",",
"42",
":",
"{",
"{",
"Login",
":",
"\"",
"\"",
"}",
"}",
",",
"}",
"\n",
"members",
",",
"ok",
":=",
"teams",
"[",
"teamID",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"[",
"]",
"github",
".",
"TeamMember",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"members",
",",
"nil",
"\n",
"}"
]
|
19,349 | all-19350 | [
"removeImageState",
"removes",
"the",
"imageState",
"from",
"the",
"list",
"of",
"imageState",
"objects",
"in",
"ImageManager"
]
| [
"func",
"(",
"imageManager",
"*",
"dockerImageManager",
")",
"removeImageState",
"(",
"imageStateToBeRemoved",
"*",
"<mask>",
".",
"ImageState",
")",
"{",
"for",
"i",
",",
"imageState",
":=",
"range",
"imageManager",
".",
"imageStates",
"{",
"if",
"imageState",
".",
"Image",
".",
"ImageID",
"==",
"imageStateToBeRemoved",
".",
"Image",
".",
"ImageID",
"{",
"// Image State found; hence remove it",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"imageState",
".",
"String",
"(",
")",
")",
"\n",
"imageManager",
".",
"imageStates",
"=",
"append",
"(",
"imageManager",
".",
"imageStates",
"[",
":",
"i",
"]",
",",
"imageManager",
".",
"imageStates",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
19,350 | all-19351 | [
"DescribeTags",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockClientSDK",
")",
"DescribeTags",
"(",
"arg0",
"*",
"ec20",
".",
"DescribeTagsInput",
")",
"(",
"*",
"ec20",
".",
"DescribeTagsOutput",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"ec20",
".",
"DescribeTagsOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
19,351 | all-19352 | [
"SetOutput",
"sets",
"the",
"output",
"destination",
"for",
"log",
"messages",
"."
]
| [
"func",
"(",
"w",
"*",
"Writer",
")",
"SetOutput",
"(",
"<mask>",
"io",
".",
"Writer",
")",
"{",
"w",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"w",
".",
"printer",
"=",
"newPrinter",
"(",
"out",
")",
"\n",
"w",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
19,352 | all-19353 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"UsageForType",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,353 | all-19354 | [
"HTMLSnippet",
"returns",
"an",
"HTML",
"snippet",
"representing",
"this",
"alerting",
"rule",
".",
"The",
"resulting",
"snippet",
"is",
"expected",
"to",
"be",
"presented",
"in",
"a",
"<pre",
">",
"element",
"so",
"that",
"line",
"breaks",
"and",
"other",
"returned",
"whitespace",
"is",
"respected",
"."
]
| [
"func",
"(",
"r",
"*",
"AlertingRule",
")",
"HTMLSnippet",
"(",
"pathPrefix",
"string",
")",
"html_template",
".",
"HTML",
"{",
"alertMetric",
":=",
"model",
".",
"Metric",
"{",
"model",
".",
"MetricNameLabel",
":",
"alertMetricName",
",",
"alertNameLabel",
":",
"model",
".",
"LabelValue",
"(",
"r",
".",
"name",
")",
",",
"}",
"\n\n",
"labelsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"r",
".",
"labels",
")",
")",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"r",
".",
"labels",
"{",
"labelsMap",
"[",
"l",
".",
"Name",
"]",
"=",
"html_template",
".",
"HTMLEscapeString",
"(",
"l",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"annotationsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"r",
".",
"annotations",
")",
")",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"r",
".",
"annotations",
"{",
"annotationsMap",
"[",
"l",
".",
"Name",
"]",
"=",
"html_template",
".",
"HTMLEscapeString",
"(",
"l",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"ar",
":=",
"rulefmt",
".",
"Rule",
"{",
"Alert",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pathPrefix",
"+",
"strutil",
".",
"TableLinkForExpression",
"(",
"alertMetric",
".",
"String",
"(",
")",
")",
",",
"r",
".",
"name",
")",
",",
"Expr",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pathPrefix",
"+",
"strutil",
".",
"TableLinkForExpression",
"(",
"r",
".",
"vector",
".",
"String",
"(",
")",
")",
",",
"html_template",
".",
"HTMLEscapeString",
"(",
"r",
".",
"vector",
".",
"String",
"(",
")",
")",
")",
",",
"For",
":",
"model",
".",
"Duration",
"(",
"r",
".",
"holdDuration",
")",
",",
"Labels",
":",
"labelsMap",
",",
"Annotations",
":",
"annotationsMap",
",",
"}",
"\n\n",
"byt",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"html_template",
".",
"HTML",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"html_template",
".",
"HTMLEscapeString",
"(",
"err",
".",
"Error",
"(",
")",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"html_template",
".",
"HTML",
"(",
"byt",
")",
"\n",
"}"
]
|
19,354 | all-19355 | [
"Write",
"writes",
"the",
"data",
"to",
"the",
"connection",
"as",
"part",
"of",
"an",
"HTTP",
"reply",
".",
"If",
"WriteHeader",
"has",
"not",
"yet",
"been",
"called",
"Write",
"calls",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"before",
"writing",
"the",
"data",
".",
"If",
"the",
"Header",
"does",
"not",
"contain",
"a",
"Content",
"-",
"Type",
"line",
"Write",
"adds",
"a",
"Content",
"-",
"Type",
"set",
"to",
"the",
"result",
"of",
"passing",
"the",
"initial",
"512",
"bytes",
"of",
"written",
"data",
"to",
"DetectContentType",
".",
"Depending",
"on",
"the",
"HTTP",
"protocol",
"version",
"and",
"the",
"client",
"calling",
"Write",
"or",
"WriteHeader",
"may",
"prevent",
"future",
"reads",
"on",
"the",
"Request",
".",
"Body",
".",
"For",
"HTTP",
"/",
"1",
".",
"x",
"requests",
"handlers",
"should",
"read",
"any",
"needed",
"request",
"body",
"data",
"before",
"writing",
"the",
"response",
".",
"Once",
"the",
"headers",
"have",
"been",
"flushed",
"(",
"due",
"to",
"either",
"an",
"explicit",
"Flusher",
".",
"Flush",
"call",
"or",
"writing",
"enough",
"data",
"to",
"trigger",
"a",
"flush",
")",
"the",
"request",
"body",
"may",
"be",
"unavailable",
".",
"For",
"HTTP",
"/",
"2",
"requests",
"the",
"Go",
"HTTP",
"server",
"permits",
"handlers",
"to",
"continue",
"to",
"read",
"the",
"request",
"body",
"while",
"concurrently",
"writing",
"the",
"response",
".",
"However",
"such",
"behavior",
"may",
"not",
"be",
"supported",
"by",
"all",
"HTTP",
"/",
"2",
"clients",
".",
"Handlers",
"should",
"read",
"before",
"writing",
"if",
"possible",
"to",
"maximize",
"compatibility",
"."
]
| [
"func",
"(",
"res",
"*",
"ResponseRecorder",
")",
"Write",
"(",
"contents",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"res",
".",
"statusCode",
"==",
"0",
"{",
"// if not setted set it here",
"res",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"}",
"\n",
"res",
".",
"chunks",
"=",
"<mask>",
"(",
"res",
".",
"chunks",
",",
"contents",
")",
"\n",
"return",
"res",
".",
"underline",
".",
"Write",
"(",
"contents",
")",
"\n",
"}"
]
|
19,355 | all-19356 | [
"ApplyChanges",
"filters",
"out",
"records",
"not",
"owned",
"the",
"External",
"-",
"DNS",
"additionally",
"it",
"adds",
"the",
"required",
"label",
"inserted",
"in",
"the",
"AWS",
"SD",
"instance",
"as",
"a",
"CreateID",
"field"
]
| [
"func",
"(",
"sdr",
"*",
"AWSSDRegistry",
")",
"ApplyChanges",
"(",
"changes",
"*",
"plan",
".",
"Changes",
")",
"error",
"{",
"filteredChanges",
":=",
"&",
"<mask>",
".",
"Changes",
"{",
"Create",
":",
"changes",
".",
"Create",
",",
"UpdateNew",
":",
"filterOwnedRecords",
"(",
"sdr",
".",
"ownerID",
",",
"changes",
".",
"UpdateNew",
")",
",",
"UpdateOld",
":",
"filterOwnedRecords",
"(",
"sdr",
".",
"ownerID",
",",
"changes",
".",
"UpdateOld",
")",
",",
"Delete",
":",
"filterOwnedRecords",
"(",
"sdr",
".",
"ownerID",
",",
"changes",
".",
"Delete",
")",
",",
"}",
"\n\n",
"sdr",
".",
"updateLabels",
"(",
"filteredChanges",
".",
"Create",
")",
"\n",
"sdr",
".",
"updateLabels",
"(",
"filteredChanges",
".",
"UpdateNew",
")",
"\n",
"sdr",
".",
"updateLabels",
"(",
"filteredChanges",
".",
"UpdateOld",
")",
"\n",
"sdr",
".",
"updateLabels",
"(",
"filteredChanges",
".",
"Delete",
")",
"\n\n",
"return",
"sdr",
".",
"provider",
".",
"ApplyChanges",
"(",
"filteredChanges",
")",
"\n",
"}"
]
|
19,356 | all-19357 | [
"HasLegendSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasLegendSize",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"LegendSize",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,357 | all-19358 | [
"ReadSetting",
"reads",
"value",
"of",
"a",
"given",
"setting",
"."
]
| [
"func",
"ReadSetting",
"(",
"db",
"*",
"reform",
".",
"Querier",
",",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"st",
"Setting",
"\n",
"if",
"err",
":=",
"FindByPrimaryKeyTo",
"(",
"<mask>",
",",
"&",
"st",
",",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"st",
".",
"Value",
",",
"nil",
"\n",
"}"
]
|
19,358 | all-19359 | [
"export",
"gogpgme_passfunc"
]
| [
"func",
"gogpgme_passfunc",
"(",
"hook",
"unsafe",
".",
"Pointer",
",",
"uid_hint",
",",
"passphrase_info",
"*",
"C",
".",
"char",
",",
"prev_was_bad",
",",
"fd",
"C",
".",
"int",
")",
"C",
".",
"gpgme_error_t",
"{",
"c",
":=",
"callbackLookup",
"(",
"uintptr",
"(",
"<mask>",
")",
")",
".",
"(",
"*",
"Context",
")",
"\n",
"go_uid_hint",
":=",
"C",
".",
"GoString",
"(",
"uid_hint",
")",
"\n",
"f",
":=",
"os",
".",
"NewFile",
"(",
"uintptr",
"(",
"fd",
")",
",",
"go_uid_hint",
")",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n",
"err",
":=",
"c",
".",
"callback",
"(",
"go_uid_hint",
",",
"prev_was_bad",
"!=",
"0",
",",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"C",
".",
"GPG_ERR_CANCELED",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
]
|
19,359 | all-19360 | [
"CleanAll",
"cleans",
"all",
"of",
"the",
"resources",
"for",
"all",
"of",
"the",
"regions",
"visible",
"to",
"the",
"provided",
"AWS",
"session",
"."
]
| [
"func",
"CleanAll",
"(",
"sess",
"*",
"session",
".",
"Session",
",",
"<mask>",
"string",
")",
"error",
"{",
"acct",
",",
"err",
":=",
"account",
".",
"GetAccount",
"(",
"sess",
",",
"regions",
".",
"Default",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"klog",
".",
"V",
"(",
"1",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"acct",
")",
"\n\n",
"var",
"regionList",
"[",
"]",
"string",
"\n",
"if",
"region",
"==",
"\"",
"\"",
"{",
"regionList",
",",
"err",
"=",
"regions",
".",
"GetAll",
"(",
"sess",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"regionList",
"=",
"[",
"]",
"string",
"{",
"region",
"}",
"\n",
"}",
"\n",
"klog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"regionList",
")",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"regionList",
"{",
"for",
"_",
",",
"typ",
":=",
"range",
"RegionalTypeList",
"{",
"set",
",",
"err",
":=",
"typ",
".",
"ListAll",
"(",
"sess",
",",
"acct",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"typ",
".",
"MarkAndSweep",
"(",
"sess",
",",
"acct",
",",
"r",
",",
"set",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"typ",
":=",
"range",
"GlobalTypeList",
"{",
"set",
",",
"err",
":=",
"typ",
".",
"ListAll",
"(",
"sess",
",",
"acct",
",",
"regions",
".",
"Default",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"typ",
".",
"MarkAndSweep",
"(",
"sess",
",",
"acct",
",",
"regions",
".",
"Default",
",",
"set",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,360 | all-19361 | [
"Merge",
"merges",
"a",
"collection",
"of",
"hashtree",
"readers",
"into",
"a",
"hashtree",
"writer",
"."
]
| [
"func",
"Merge",
"(",
"w",
"*",
"Writer",
",",
"rs",
"[",
"]",
"*",
"Reader",
")",
"error",
"{",
"if",
"len",
"(",
"rs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"mq",
":=",
"&",
"mergePQ",
"{",
"q",
":",
"make",
"(",
"[",
"]",
"*",
"nodeStream",
",",
"len",
"(",
"<mask>",
")",
"+",
"1",
")",
"}",
"\n",
"// Setup first set of nodes",
"for",
"_",
",",
"r",
":=",
"range",
"rs",
"{",
"if",
"err",
":=",
"mq",
".",
"insert",
"(",
"&",
"nodeStream",
"{",
"r",
":",
"r",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"mq",
".",
"q",
"[",
"1",
"]",
"!=",
"nil",
"{",
"// Get next nodes to merge",
"ns",
",",
"err",
":=",
"mq",
".",
"next",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Merge nodes",
"n",
",",
"err",
":=",
"merge",
"(",
"ns",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Write out result",
"if",
"err",
":=",
"w",
".",
"Write",
"(",
"n",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,361 | all-19362 | [
"Parse",
"parse",
"string",
"to",
"time"
]
| [
"func",
"(",
"now",
"*",
"Now",
")",
"Parse",
"(",
"strs",
"...",
"string",
")",
"(",
"t",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"var",
"(",
"setCurrentTime",
"bool",
"\n",
"parseTime",
"[",
"]",
"int",
"\n",
"currentTime",
"=",
"[",
"]",
"int",
"{",
"now",
".",
"Nanosecond",
"(",
")",
",",
"now",
".",
"Second",
"(",
")",
",",
"now",
".",
"Minute",
"(",
")",
",",
"now",
".",
"Hour",
"(",
")",
",",
"now",
".",
"Day",
"(",
")",
",",
"int",
"(",
"now",
".",
"Month",
"(",
")",
")",
",",
"now",
".",
"Year",
"(",
")",
"}",
"\n",
"currentLocation",
"=",
"now",
".",
"<mask>",
"(",
")",
"\n",
"onlyTimeInStr",
"=",
"true",
"\n",
")",
"\n\n",
"for",
"_",
",",
"str",
":=",
"range",
"strs",
"{",
"hasTimeInStr",
":=",
"hasTimeRegexp",
".",
"MatchString",
"(",
"str",
")",
"// match 15:04:05, 15",
"\n",
"onlyTimeInStr",
"=",
"hasTimeInStr",
"&&",
"onlyTimeInStr",
"&&",
"onlyTimeRegexp",
".",
"MatchString",
"(",
"str",
")",
"\n",
"if",
"t",
",",
"err",
"=",
"parseWithFormat",
"(",
"str",
")",
";",
"err",
"==",
"nil",
"{",
"location",
":=",
"t",
".",
"Location",
"(",
")",
"\n",
"if",
"location",
".",
"String",
"(",
")",
"==",
"\"",
"\"",
"{",
"location",
"=",
"currentLocation",
"\n",
"}",
"\n\n",
"parseTime",
"=",
"[",
"]",
"int",
"{",
"t",
".",
"Nanosecond",
"(",
")",
",",
"t",
".",
"Second",
"(",
")",
",",
"t",
".",
"Minute",
"(",
")",
",",
"t",
".",
"Hour",
"(",
")",
",",
"t",
".",
"Day",
"(",
")",
",",
"int",
"(",
"t",
".",
"Month",
"(",
")",
")",
",",
"t",
".",
"Year",
"(",
")",
"}",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"parseTime",
"{",
"// Don't reset hour, minute, second if current time str including time",
"if",
"hasTimeInStr",
"&&",
"i",
"<=",
"3",
"{",
"continue",
"\n",
"}",
"\n\n",
"// If value is zero, replace it with current time",
"if",
"v",
"==",
"0",
"{",
"if",
"setCurrentTime",
"{",
"parseTime",
"[",
"i",
"]",
"=",
"currentTime",
"[",
"i",
"]",
"\n",
"}",
"\n",
"}",
"else",
"{",
"setCurrentTime",
"=",
"true",
"\n",
"}",
"\n\n",
"// if current time only includes time, should change day, month to current time",
"if",
"onlyTimeInStr",
"{",
"if",
"i",
"==",
"4",
"||",
"i",
"==",
"5",
"{",
"parseTime",
"[",
"i",
"]",
"=",
"currentTime",
"[",
"i",
"]",
"\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"t",
"=",
"time",
".",
"Date",
"(",
"parseTime",
"[",
"6",
"]",
",",
"time",
".",
"Month",
"(",
"parseTime",
"[",
"5",
"]",
")",
",",
"parseTime",
"[",
"4",
"]",
",",
"parseTime",
"[",
"3",
"]",
",",
"parseTime",
"[",
"2",
"]",
",",
"parseTime",
"[",
"1",
"]",
",",
"parseTime",
"[",
"0",
"]",
",",
"location",
")",
"\n",
"currentTime",
"=",
"[",
"]",
"int",
"{",
"t",
".",
"Nanosecond",
"(",
")",
",",
"t",
".",
"Second",
"(",
")",
",",
"t",
".",
"Minute",
"(",
")",
",",
"t",
".",
"Hour",
"(",
")",
",",
"t",
".",
"Day",
"(",
")",
",",
"int",
"(",
"t",
".",
"Month",
"(",
")",
")",
",",
"t",
".",
"Year",
"(",
")",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
19,362 | all-19363 | [
"align",
"returns",
"the",
"smallest",
"y",
">",
"=",
"x",
"such",
"that",
"y",
"%",
"a",
"==",
"0",
"."
]
| [
"func",
"<mask>",
"(",
"x",
",",
"a",
"int64",
")",
"int64",
"{",
"y",
":=",
"x",
"+",
"a",
"-",
"1",
"\n",
"return",
"y",
"-",
"y",
"%",
"a",
"\n",
"}"
]
|
19,363 | all-19364 | [
"New",
"render",
".",
"Engine",
"ready",
"to",
"go",
"with",
"your",
"Options",
"and",
"some",
"defaults",
"we",
"think",
"you",
"might",
"like",
"."
]
| [
"func",
"New",
"(",
"opts",
"Options",
")",
"*",
"Engine",
"{",
"if",
"opts",
".",
"Helpers",
"==",
"nil",
"{",
"opts",
".",
"Helpers",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"TemplateEngines",
"==",
"nil",
"{",
"opts",
".",
"TemplateEngines",
"=",
"map",
"[",
"string",
"]",
"TemplateEngine",
"{",
"}",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"plush",
".",
"BuffaloRenderer",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"plush",
".",
"BuffaloRenderer",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"plush",
".",
"BuffaloRenderer",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"plush",
".",
"BuffaloRenderer",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"MDTemplateEngine",
"\n",
"}",
"\n",
"if",
"_",
",",
"<mask>",
":=",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"opts",
".",
"TemplateEngines",
"[",
"\"",
"\"",
"]",
"=",
"GoTemplateEngine",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"DefaultContentType",
"==",
"\"",
"\"",
"{",
"opts",
".",
"DefaultContentType",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"e",
":=",
"&",
"Engine",
"{",
"Options",
":",
"opts",
",",
"}",
"\n",
"return",
"e",
"\n",
"}"
]
|
19,364 | all-19365 | [
"String",
"returns",
"the",
"human",
"-",
"friendly",
"version",
"of",
"this",
"dependency",
"."
]
| [
"func",
"(",
"d",
"*",
"CatalogNodeQuery",
")",
"String",
"(",
")",
"string",
"{",
"name",
":=",
"d",
".",
"name",
"\n",
"if",
"d",
".",
"dc",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"name",
"+",
"\"",
"\"",
"+",
"d",
".",
"dc",
"\n",
"}",
"\n\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}"
]
|
19,365 | all-19366 | [
"AddDevice",
"adds",
"a",
"device",
"for",
"a",
"customer"
]
| [
"func",
"(",
"c",
"*",
"CustomerIO",
")",
"AddDevice",
"(",
"customerID",
"string",
",",
"deviceID",
"string",
",",
"platform",
"string",
",",
"data",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"customerID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"deviceID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"platform",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"body",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"{",
"\"",
"\"",
":",
"deviceID",
",",
"\"",
"\"",
":",
"platform",
"}",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"body",
"[",
"\"",
"\"",
"]",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"j",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"body",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"status",
",",
"responseBody",
",",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"c",
".",
"deviceURL",
"(",
"customerID",
")",
",",
"j",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"status",
"!=",
"200",
"{",
"return",
"&",
"CustomerIOError",
"{",
"status",
",",
"c",
".",
"deviceURL",
"(",
"customerID",
")",
",",
"responseBody",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,366 | all-19367 | [
"Fatalf",
"logging"
]
| [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Fatalf",
"(",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"logfFunc",
"(",
"FatalLevel",
",",
"l",
".",
"context",
",",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
]
|
19,367 | all-19368 | [
"Mask",
"returns",
"the",
"result",
"of",
"masking",
"the",
"address",
"with",
"mask",
"."
]
| [
"func",
"(",
"address",
"HardwareAddr",
")",
"Mask",
"(",
"mask",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"n",
":=",
"len",
"(",
"address",
")",
"\n",
"if",
"n",
"!=",
"len",
"(",
"mask",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"n",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"out",
"[",
"i",
"]",
"=",
"<mask>",
"[",
"i",
"]",
"&",
"mask",
"[",
"i",
"]",
"\n",
"}",
"\n",
"return",
"out",
"\n",
"}"
]
|
19,368 | all-19369 | [
"DeleteOffer",
"deletes",
"an",
"existing",
"offer"
]
| [
"func",
"DeleteOffer",
"(",
"rate",
"Rate",
",",
"offerID",
"OfferID",
")",
"(",
"result",
"ManageOfferBuilder",
")",
"{",
"return",
"ManageOffer",
"(",
"false",
",",
"<mask>",
",",
"Amount",
"(",
"\"",
"\"",
")",
",",
"offerID",
")",
"\n",
"}"
]
|
19,369 | all-19370 | [
"Do",
"executes",
"IO",
".",
"close",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"CloseParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandClose",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
19,370 | all-19371 | [
"ClientAfterOfferingDelete",
"sets",
"offer",
"status",
"to",
"remove",
";"
]
| [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientAfterOfferingDelete",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"return",
"w",
".",
"updateRelatedOffering",
"(",
"job",
",",
"data",
".",
"JobClientAfterOfferingDelete",
",",
"<mask>",
".",
"OfferRemoved",
")",
"\n",
"}"
]
|
19,371 | all-19372 | [
"NewSTM",
"intiates",
"a",
"new",
"STM",
"operation",
".",
"It",
"uses",
"a",
"serializable",
"model",
"."
]
| [
"func",
"NewSTM",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"return",
"newSTMSerializable",
"(",
"ctx",
",",
"c",
",",
"<mask>",
",",
"false",
")",
"\n",
"}"
]
|
19,372 | all-19373 | [
"Next",
"returns",
"the",
"next",
"word",
"or",
"an",
"error",
".",
"If",
"there",
"are",
"no",
"more",
"words",
"the",
"error",
"will",
"be",
"io",
".",
"EOF",
"."
]
| [
"func",
"(",
"l",
"*",
"Lexer",
")",
"Next",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"for",
"{",
"<mask>",
",",
"err",
":=",
"(",
"*",
"Tokenizer",
")",
"(",
"l",
")",
".",
"Next",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"switch",
"token",
".",
"tokenType",
"{",
"case",
"WordToken",
":",
"return",
"token",
".",
"value",
",",
"nil",
"\n",
"case",
"CommentToken",
":",
"// skip comments",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"token",
".",
"tokenType",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
19,373 | all-19374 | [
"ListDirectories",
"gets",
"a",
"list",
"a",
"sub",
"-",
"directories",
"that",
"contains",
"source",
"code",
"."
]
| [
"func",
"(",
"covList",
"CoverageList",
")",
"ListDirectories",
"(",
")",
"[",
"]",
"string",
"{",
"dirSet",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"cov",
":=",
"range",
"covList",
".",
"Group",
"{",
"dirSet",
"[",
"path",
".",
"Dir",
"(",
"cov",
".",
"Name",
")",
"]",
"=",
"true",
"\n",
"}",
"\n",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"<mask>",
":=",
"range",
"dirSet",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"key",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
]
|
19,374 | all-19375 | [
"Set",
"writes",
"the",
"given",
"item",
"unconditionally",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Set",
"(",
"item",
"*",
"Item",
")",
"error",
"{",
"return",
"c",
".",
"populateOne",
"(",
"cmdSet",
",",
"<mask>",
",",
"0",
")",
"\n",
"}"
]
|
19,375 | all-19376 | [
"LastModified",
"returns",
"time",
"when",
"the",
"target",
"template",
"file",
"was",
"last",
"modified"
]
| [
"func",
"(",
"s",
"*",
"FileSource",
")",
"LastModified",
"(",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"// Calling os.Stat() for *every* Render of the same source is a waste",
"// Only call os.Stat() if we haven't done so in the last 1 second",
"if",
"<mask>",
".",
"Since",
"(",
"s",
".",
"LastStat",
")",
"<",
"time",
".",
"Second",
"{",
"// A-ha! it's not that long ago we calculated this value, just return",
"// the same thing as our last call",
"return",
"s",
".",
"LastStatResult",
".",
"ModTime",
"(",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"// If we got here, our previous check was too old or this is the first",
"// time we're checking for os.Stat()",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"s",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"time",
".",
"Time",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// Save these for later...",
"s",
".",
"LastStat",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"s",
".",
"LastStatResult",
"=",
"fi",
"\n\n",
"return",
"s",
".",
"LastStatResult",
".",
"ModTime",
"(",
")",
",",
"nil",
"\n",
"}"
]
|
19,376 | all-19377 | [
"Delete",
"does",
"nothing",
"on",
"a",
"dry",
"-",
"run",
"client"
]
| [
"func",
"(",
"c",
"*",
"dryRunProwJobClient",
")",
"Delete",
"(",
"name",
"string",
",",
"<mask>",
"*",
"metav1",
".",
"DeleteOptions",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
]
|
19,377 | all-19378 | [
"MarshalBinary",
"interface",
"implementation"
]
| [
"func",
"(",
"m",
"*",
"Route",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"swag",
".",
"WriteJSON",
"(",
"m",
")",
"\n",
"}"
]
|
19,378 | all-19379 | [
"Simple",
"authentication",
"middleware"
]
| [
"func",
"IsAuthenticated",
"(",
")",
"gin",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"fmt",
".",
"Println",
"(",
"c",
".",
"GetHeader",
"(",
"\"",
"\"",
")",
")",
"\n\n",
"if",
"c",
".",
"GetHeader",
"(",
"\"",
"\"",
")",
"==",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"getAuthToken",
"(",
")",
")",
"{",
"c",
".",
"Next",
"(",
")",
"\n",
"}",
"else",
"{",
"c",
".",
"JSON",
"(",
"<mask>",
".",
"StatusUnauthorized",
",",
"gin",
".",
"H",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
19,379 | all-19380 | [
"Generate",
"API",
"client",
"code",
"drives",
"the",
"code",
"writer",
"."
]
| [
"func",
"GenerateClient",
"(",
"version",
"string",
",",
"descriptor",
"*",
"gen",
".",
"APIDescriptor",
",",
"codegen",
",",
"pkg",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"codegen",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
",",
"err",
":=",
"NewClientWriter",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"kingpin",
".",
"FatalIfError",
"(",
"c",
".",
"WriteHeader",
"(",
"pkg",
",",
"version",
",",
"descriptor",
".",
"NeedTime",
",",
"descriptor",
".",
"NeedJSON",
",",
"f",
")",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"descriptor",
".",
"ResourceNames",
"{",
"resource",
":=",
"descriptor",
".",
"Resources",
"[",
"name",
"]",
"\n",
"c",
".",
"WriteResourceHeader",
"(",
"name",
",",
"f",
")",
"\n",
"kingpin",
".",
"FatalIfError",
"(",
"c",
".",
"WriteResource",
"(",
"resource",
",",
"f",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"WriteTypeSectionHeader",
"(",
"f",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"descriptor",
".",
"TypeNames",
"{",
"t",
":=",
"descriptor",
".",
"Types",
"[",
"<mask>",
"]",
"\n",
"c",
".",
"WriteType",
"(",
"t",
",",
"f",
")",
"\n",
"}",
"\n",
"f",
".",
"Close",
"(",
")",
"\n",
"o",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"codegen",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"o",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,380 | all-19381 | [
"SortInput",
"sorts",
"an",
"Input",
"."
]
| [
"func",
"SortInput",
"(",
"input",
"*",
"Input",
")",
"{",
"VisitInput",
"(",
"input",
",",
"func",
"(",
"input",
"*",
"Input",
")",
"{",
"SortInputs",
":=",
"func",
"(",
"inputs",
"[",
"]",
"*",
"Input",
")",
"{",
"sort",
".",
"SliceStable",
"(",
"inputs",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"InputName",
"(",
"inputs",
"[",
"i",
"]",
")",
"<",
"InputName",
"(",
"inputs",
"[",
"j",
"]",
")",
"}",
")",
"\n",
"}",
"\n",
"<mask>",
"{",
"case",
"input",
".",
"Cross",
"!=",
"nil",
":",
"SortInputs",
"(",
"input",
".",
"Cross",
")",
"\n",
"case",
"input",
".",
"Union",
"!=",
"nil",
":",
"SortInputs",
"(",
"input",
".",
"Union",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
]
|
19,381 | all-19382 | [
"Float32",
"returns",
"param",
"as",
"float32"
]
| [
"func",
"(",
"p",
"Param",
")",
"Float32",
"(",
")",
"(",
"float32",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"string",
"(",
"p",
")",
",",
"32",
")",
"\n",
"return",
"float32",
"(",
"f",
")",
",",
"<mask>",
"\n",
"}"
]
|
19,382 | all-19383 | [
"Translate",
"translates",
"the",
"matrix",
"by",
"(",
"r",
"g",
"b",
"a",
")",
"."
]
| [
"func",
"(",
"c",
"*",
"ColorM",
")",
"Translate",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"float32",
")",
"*",
"ColorM",
"{",
"if",
"!",
"c",
".",
"isInited",
"(",
")",
"{",
"return",
"&",
"ColorM",
"{",
"translate",
":",
"[",
"]",
"float32",
"{",
"r",
",",
"g",
",",
"b",
",",
"a",
"}",
",",
"}",
"\n",
"}",
"\n",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"float32",
",",
"len",
"(",
"colorMIdentityTranslate",
")",
")",
"\n",
"if",
"c",
".",
"translate",
"!=",
"nil",
"{",
"copy",
"(",
"es",
",",
"c",
".",
"translate",
")",
"\n",
"}",
"\n",
"es",
"[",
"0",
"]",
"+=",
"r",
"\n",
"es",
"[",
"1",
"]",
"+=",
"g",
"\n",
"es",
"[",
"2",
"]",
"+=",
"b",
"\n",
"es",
"[",
"3",
"]",
"+=",
"a",
"\n",
"return",
"&",
"ColorM",
"{",
"body",
":",
"c",
".",
"body",
",",
"translate",
":",
"es",
",",
"}",
"\n",
"}"
]
|
19,383 | all-19384 | [
"PprofAddress",
"returns",
"the",
"network",
"addresss",
"of",
"the",
"pprof",
"endpoint",
"or",
"an",
"empty",
"string",
"if",
"there",
"s",
"no",
"pprof",
"endpoint"
]
| [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"PprofAddress",
"(",
")",
"string",
"{",
"e",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"listener",
":=",
"e",
".",
"listeners",
"[",
"pprof",
"]",
"\n",
"if",
"listener",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"listener",
".",
"Addr",
"(",
")",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
19,384 | all-19385 | [
"Resize",
"changes",
"the",
"size",
"of",
"the",
"underlying",
"buffer"
]
| [
"func",
"(",
"s",
"*",
"Stack",
")",
"Resize",
"(",
"size",
"int",
")",
"{",
"newl",
":=",
"<mask>",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"*",
"s",
")",
",",
"size",
")",
"\n",
"copy",
"(",
"newl",
",",
"*",
"s",
")",
"\n",
"*",
"s",
"=",
"newl",
"\n",
"}"
]
|
19,385 | all-19386 | [
"UpdateAcknowledgement",
"updates",
"passed",
"acknowledgement",
"."
]
| [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateAcknowledgement",
"(",
"cfg",
"*",
"Acknowledgement",
")",
"(",
"*",
"Acknowledgement",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"acknowledgementCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"AcknowledgementCIDRegex",
",",
"acknowledgementCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"acknowledgementCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"acknowledgementCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"acknowledgement",
":=",
"&",
"Acknowledgement",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"acknowledgement",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"acknowledgement",
",",
"nil",
"\n",
"}"
]
|
19,386 | all-19387 | [
"String",
"returns",
"the",
"name",
"of",
"the",
"operation",
"."
]
| [
"func",
"(",
"o",
"Operation",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"o",
"{",
"case",
"List",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Find",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Create",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Update",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"Delete",
":",
"return",
"\"",
"\"",
"\n",
"case",
"CollectionAction",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ResourceAction",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
19,387 | all-19388 | [
"Do",
"executes",
"DOM",
".",
"getSearchResults",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"nodeIds",
"-",
"Ids",
"of",
"the",
"search",
"result",
"nodes",
"."
]
| [
"func",
"(",
"p",
"*",
"GetSearchResultsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"nodeIds",
"[",
"]",
"cdp",
".",
"NodeID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetSearchResultsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetSearchResults",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"NodeIds",
",",
"nil",
"\n",
"}"
]
|
19,388 | all-19389 | [
"Write",
"serializes",
"the",
"command",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Command",
"interface",
"."
]
| [
"func",
"(",
"c",
"Pub",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"[",
"...",
"]",
"string",
"{",
"\"",
"\"",
",",
"c",
".",
"Topic",
",",
"\"",
"\\n",
"\"",
",",
"}",
"{",
"if",
"_",
",",
"err",
"=",
"w",
".",
"WriteString",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"<mask>",
".",
"Write",
"(",
"w",
",",
"binary",
".",
"BigEndian",
",",
"uint32",
"(",
"len",
"(",
"c",
".",
"Message",
")",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"c",
".",
"Message",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
19,389 | all-19390 | [
"Get",
"returns",
"the",
"descriptor",
"if",
"it",
"exists",
"or",
"nil",
"otherwise"
]
| [
"func",
"(",
"r",
"*",
"registry",
")",
"Get",
"(",
"code",
"Code",
")",
"*",
"ErrDescriptor",
"{",
"r",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"r",
".",
"byCode",
"[",
"<mask>",
"]",
"\n",
"}"
]
|
19,390 | all-19391 | [
"Report",
"takes",
"a",
"prowjob",
"and",
"generate",
"a",
"pubsub",
"ReportMessage",
"and",
"publish",
"to",
"specific",
"Pub",
"/",
"Sub",
"topic",
"based",
"on",
"Pub",
"/",
"Sub",
"related",
"labels",
"if",
"they",
"exist",
"in",
"this",
"prowjob"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Report",
"(",
"pj",
"*",
"prowapi",
".",
"ProwJob",
")",
"(",
"[",
"]",
"*",
"prowapi",
".",
"ProwJob",
",",
"error",
")",
"{",
"message",
":=",
"c",
".",
"generateMessageFromPJ",
"(",
"pj",
")",
"\n\n",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"client",
",",
"err",
":=",
"pubsub",
".",
"NewClient",
"(",
"ctx",
",",
"message",
".",
"<mask>",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"topic",
":=",
"client",
".",
"Topic",
"(",
"message",
".",
"Topic",
")",
"\n\n",
"d",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"message",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"res",
":=",
"topic",
".",
"Publish",
"(",
"ctx",
",",
"&",
"pubsub",
".",
"Message",
"{",
"Data",
":",
"d",
",",
"}",
")",
"\n\n",
"_",
",",
"err",
"=",
"res",
".",
"Get",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"message",
".",
"RunID",
",",
"message",
".",
"Project",
",",
"message",
".",
"Topic",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"[",
"]",
"*",
"prowapi",
".",
"ProwJob",
"{",
"pj",
"}",
",",
"nil",
"\n",
"}"
]
|
19,391 | all-19392 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Get",
"all",
"active",
"worker",
"-",
"types",
"for",
"the",
"given",
"provisioner",
".",
"The",
"response",
"is",
"paged",
".",
"If",
"this",
"end",
"-",
"point",
"returns",
"a",
"continuationToken",
"you",
"should",
"call",
"the",
"end",
"-",
"point",
"again",
"with",
"the",
"continuationToken",
"as",
"a",
"query",
"-",
"string",
"option",
".",
"By",
"default",
"this",
"end",
"-",
"point",
"will",
"list",
"up",
"to",
"1000",
"worker",
"-",
"types",
"in",
"a",
"single",
"page",
".",
"You",
"may",
"limit",
"this",
"with",
"the",
"query",
"-",
"string",
"parameter",
"limit",
".",
"See",
"#listWorkerTypes"
]
| [
"func",
"(",
"queue",
"*",
"Queue",
")",
"ListWorkerTypes",
"(",
"provisionerId",
",",
"continuationToken",
",",
"limit",
"string",
")",
"(",
"*",
"ListWorkerTypesResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"queue",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"provisionerId",
")",
"+",
"\"",
"\"",
",",
"new",
"(",
"ListWorkerTypesResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListWorkerTypesResponse",
")",
",",
"err",
"\n",
"}"
]
|
19,392 | all-19393 | [
"get",
"the",
"process_resident_memory_bytes",
"from",
"<server",
":",
"2379",
">",
"/",
"metrics"
]
| [
"func",
"endpointMemoryMetrics",
"(",
"host",
"string",
")",
"float64",
"{",
"residentMemoryKey",
":=",
"\"",
"\"",
"\n",
"var",
"residentMemoryValue",
"string",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"host",
",",
"`http://`",
")",
"{",
"host",
"=",
"\"",
"\"",
"+",
"host",
"\n",
"}",
"\n",
"url",
":=",
"host",
"+",
"\"",
"\"",
"\n",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"return",
"0.0",
"\n",
"}",
"\n",
"byts",
",",
"readerr",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"readerr",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
",",
"readerr",
")",
")",
"\n",
"return",
"0.0",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"line",
":=",
"range",
"strings",
".",
"Split",
"(",
"string",
"(",
"byts",
")",
",",
"\"",
"\\n",
"\"",
")",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"<mask>",
",",
"residentMemoryKey",
")",
"{",
"residentMemoryValue",
"=",
"strings",
".",
"TrimSpace",
"(",
"strings",
".",
"TrimPrefix",
"(",
"line",
",",
"residentMemoryKey",
")",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"residentMemoryValue",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"residentMemoryKey",
")",
")",
"\n",
"return",
"0.0",
"\n",
"}",
"\n",
"residentMemoryBytes",
",",
"parseErr",
":=",
"strconv",
".",
"ParseFloat",
"(",
"residentMemoryValue",
",",
"64",
")",
"\n",
"if",
"parseErr",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"parseErr",
")",
")",
"\n",
"return",
"0.0",
"\n",
"}",
"\n\n",
"return",
"residentMemoryBytes",
"\n",
"}"
]
|
19,393 | all-19394 | [
"Set",
"is",
"a",
"wrapper",
"around",
"gtk_arrow_set",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Arrow",
")",
"<mask>",
"(",
"arrowType",
"ArrowType",
",",
"shadowType",
"ShadowType",
")",
"{",
"C",
".",
"gtk_arrow_set",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkArrowType",
"(",
"arrowType",
")",
",",
"C",
".",
"GtkShadowType",
"(",
"shadowType",
")",
")",
"\n",
"}"
]
|
19,394 | all-19395 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniform3uiv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"<mask>",
"*",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform3uiv",
"(",
"gpProgramUniform3uiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
]
|
19,395 | all-19396 | [
"adjustForPlatform",
"makes",
"Windows",
"-",
"specific",
"changes",
"to",
"the",
"task",
"after",
"unmarshal"
]
| [
"func",
"(",
"task",
"*",
"<mask>",
")",
"adjustForPlatform",
"(",
"cfg",
"*",
"config",
".",
"Config",
")",
"{",
"task",
".",
"downcaseAllVolumePaths",
"(",
")",
"\n",
"platformFields",
":=",
"PlatformFields",
"{",
"CpuUnbounded",
":",
"cfg",
".",
"PlatformVariables",
".",
"CPUUnbounded",
",",
"}",
"\n",
"task",
".",
"PlatformFields",
"=",
"platformFields",
"\n",
"}"
]
|
19,396 | all-19397 | [
"UnaryClientInterceptor",
"logs",
"unary",
"RPCs",
"on",
"the",
"client",
"side"
]
| [
"func",
"UnaryClientInterceptor",
"(",
"log",
"ttnlog",
".",
"Interface",
")",
"grpc",
".",
"UnaryClientInterceptor",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"req",
",",
"reply",
"interface",
"{",
"}",
",",
"cc",
"*",
"grpc",
".",
"ClientConn",
",",
"invoker",
"grpc",
".",
"UnaryInvoker",
",",
"opts",
"...",
"grpc",
".",
"CallOption",
")",
"(",
"err",
"error",
")",
"{",
"log",
":=",
"getLog",
"(",
"log",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"method",
")",
"\n",
"log",
"=",
"<mask>",
".",
"WithFields",
"(",
"FieldsFromOutgoingContext",
"(",
"ctx",
")",
")",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"err",
"=",
"invoker",
"(",
"ctx",
",",
"method",
",",
"req",
",",
"reply",
",",
"cc",
",",
"opts",
"...",
")",
"\n",
"log",
"=",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
]
|
19,397 | all-19398 | [
"SetLvar",
"sets",
"the",
"frame",
"local",
"variable",
"at",
"position",
"i"
]
| [
"func",
"(",
"f",
"*",
"Frame",
")",
"SetLvar",
"(",
"i",
"int",
",",
"v",
"interface",
"{",
"}",
")",
"{",
"f",
".",
"<mask>",
".",
"Set",
"(",
"i",
",",
"v",
")",
"\n",
"}"
]
|
19,398 | all-19399 | [
"Decode",
"verifies",
"decrypts",
"and",
"decompresses",
"given",
"JWT",
"token",
"using",
"management",
"key",
".",
"Management",
"key",
"is",
"of",
"different",
"type",
"for",
"different",
"key",
"management",
"or",
"signing",
"algorithms",
"see",
"specific",
"alg",
"implementation",
"documentation",
".",
"Returns",
"decoded",
"payload",
"as",
"a",
"string",
"headers",
"and",
"not",
"nil",
"error",
"if",
"something",
"went",
"wrong",
"."
]
| [
"func",
"Decode",
"(",
"token",
"string",
",",
"key",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"payload",
",",
"<mask>",
",",
"err",
":=",
"DecodeBytes",
"(",
"token",
",",
"key",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"string",
"(",
"payload",
")",
",",
"headers",
",",
"nil",
"\n",
"}"
]
|
19,399 | all-19400 | [
"Total",
"counts",
"number",
"of",
"active",
"state",
"and",
"total",
"age",
"(",
"in",
"minutes",
"to",
"compute",
"average",
")"
]
| [
"func",
"(",
"b",
"BundledStates",
")",
"Total",
"(",
"t",
"time",
".",
"Time",
")",
"(",
"count",
"int",
",",
"sum",
"int64",
")",
"{",
"for",
"_",
",",
"<mask>",
":=",
"range",
"b",
".",
"ages",
"(",
"t",
")",
"{",
"count",
"++",
"\n",
"sum",
"+=",
"int64",
"(",
"age",
"/",
"time",
".",
"Minute",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.