id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
10,500 | all-10501 | [
"GetPullRequestChanges",
"returns",
"the",
"file",
"modifications",
"in",
"a",
"PR",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"GetPullRequestChanges",
"(",
"org",
",",
"repo",
"string",
",",
"<mask>",
"int",
")",
"(",
"[",
"]",
"github",
".",
"PullRequestChange",
",",
"error",
")",
"{",
"return",
"f",
".",
"PullRequestChanges",
"[",
"number",
"]",
",",
"nil",
"\n",
"}"
] |
10,501 | all-10502 | [
"Map",
"all",
"of",
"the",
"keys",
"/",
"values",
"set",
"in",
"envy",
"."
] | [
"func",
"Map",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"gil",
".",
"RLock",
"(",
")",
"\n",
"defer",
"gil",
".",
"RUnlock",
"(",
")",
"\n",
"cp",
":=",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"env",
"{",
"cp",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"cp",
"\n",
"}"
] |
10,502 | all-10503 | [
"Reset",
"resets",
"the",
"stats",
"queue",
"."
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"Reset",
"(",
")",
"{",
"queue",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"queue",
".",
"lastResetTime",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"queue",
".",
"buffer",
"=",
"queue",
".",
"buffer",
"[",
":",
"0",
"]",
"\n",
"}"
] |
10,503 | all-10504 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventDomStorageItemRemoved",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
10,504 | all-10505 | [
"Sets",
"environment",
"variables",
"and",
"a",
"null",
"logger",
"."
] | [
"func",
"init",
"(",
")",
"{",
"<mask>",
".",
"SetFlags",
"(",
"0",
")",
"\n",
"log",
".",
"SetPrefix",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"BOOT",
"{",
"_ENV",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"+",
"PATH",
"}",
"// from file boot",
"\n",
"}",
"else",
"{",
"_ENV",
"=",
"os",
".",
"Environ",
"(",
")",
"\n",
"_HOME",
"=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"/*if path := os.Getenv(\"PATH\"); path == \"\" {\n\t\tif err = os.Setenv(\"PATH\", PATH); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}*/",
"}"
] |
10,505 | all-10506 | [
"Reload",
"sends",
"the",
"reload",
"signal",
"to",
"the",
"child",
"process",
"and",
"does",
"not",
"wait",
"for",
"a",
"response",
".",
"If",
"no",
"reload",
"signal",
"was",
"provided",
"the",
"process",
"is",
"restarted",
"and",
"replaces",
"the",
"process",
"attached",
"to",
"this",
"Child",
"."
] | [
"func",
"(",
"c",
"*",
"Child",
")",
"Reload",
"(",
")",
"error",
"{",
"if",
"c",
".",
"reloadSignal",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n\n",
"// Take a full lock because start is going to replace the process. We also",
"// want to make sure that no other routines attempt to send reload signals",
"// during this transition.",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
".",
"<mask>",
"(",
")",
"\n",
"return",
"c",
".",
"start",
"(",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n\n",
"// We only need a read lock here because neither the process nor the exit",
"// channel are changing.",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"reload",
"(",
")",
"\n",
"}"
] |
10,506 | all-10507 | [
"LogEventWithPayload",
"belongs",
"to",
"the",
"Span",
"interface"
] | [
"func",
"(",
"s",
"*",
"MockSpan",
")",
"LogEventWithPayload",
"(",
"event",
"string",
",",
"payload",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"LogFields",
"(",
"log",
".",
"String",
"(",
"\"",
"\"",
",",
"event",
")",
",",
"<mask>",
".",
"Object",
"(",
"\"",
"\"",
",",
"payload",
")",
")",
"\n",
"}"
] |
10,507 | all-10508 | [
"define",
"an",
"array",
"of",
"colors"
] | [
"func",
"ColorPointer",
"(",
"size",
"int32",
",",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowColorPointer",
"(",
"gpColorPointer",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"pointer",
")",
"\n",
"}"
] |
10,508 | all-10509 | [
"Get",
"returns",
"the",
"function",
"associated",
"with",
"the",
"given",
"key",
".",
"The",
"function",
"is",
"wrapped",
"as",
"reflect",
".",
"Value",
"so",
"reflection",
"can",
"be",
"used",
"to",
"determine",
"attributes",
"about",
"this",
"function"
] | [
"func",
"(",
"fc",
"*",
"FuncDepot",
")",
"Get",
"(",
"<mask>",
"string",
")",
"(",
"reflect",
".",
"Value",
",",
"bool",
")",
"{",
"f",
",",
"ok",
":=",
"fc",
".",
"depot",
"[",
"key",
"]",
"\n",
"return",
"f",
",",
"ok",
"\n",
"}"
] |
10,509 | all-10510 | [
"Register",
"registers",
"a",
"constructor",
"function",
"with",
"the",
"DI",
"container"
] | [
"func",
"(",
"di",
"*",
"dependencyInjector",
")",
"Register",
"(",
"constructorFunc",
"<mask>",
"{",
"}",
")",
"error",
"{",
"constructorType",
":=",
"reflect",
".",
"TypeOf",
"(",
"constructorFunc",
")",
"\n\n",
"if",
"(",
"constructorType",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
")",
"||",
"(",
"constructorType",
".",
"NumOut",
"(",
")",
"!=",
"1",
")",
"{",
"return",
"constructorErr",
"\n",
"}",
"\n",
"outType",
":=",
"constructorType",
".",
"Out",
"(",
"0",
")",
"\n\n",
"// make sure we can resolve the constuctor arguments",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"constructorType",
".",
"NumIn",
"(",
")",
";",
"i",
"++",
"{",
"inType",
":=",
"constructorType",
".",
"In",
"(",
"i",
")",
"\n",
"_",
",",
"ok",
":=",
"di",
".",
"registry",
"[",
"inType",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"inType",
",",
"outType",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"di",
".",
"registry",
"[",
"outType",
"]",
"=",
"constructorFunc",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,510 | all-10511 | [
"Endpoints",
"returns",
"endpoint",
"objects",
"."
] | [
"func",
"(",
"cs",
"*",
"connectorSource",
")",
"Endpoints",
"(",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"endpoints",
":=",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"{",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"remoteServer",
",",
"dialTimeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"decoder",
":=",
"gob",
".",
"NewDecoder",
"(",
"conn",
")",
"\n",
"if",
"err",
":=",
"decoder",
".",
"Decode",
"(",
"&",
"endpoints",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"endpoints",
")",
"\n\n",
"return",
"endpoints",
",",
"nil",
"\n",
"}"
] |
10,511 | all-10512 | [
"UnmarshalEasyJSON",
"sets",
"the",
"ObjectId",
"from",
"a",
"easyjson",
".",
"Lexer"
] | [
"func",
"(",
"id",
"*",
"ObjectId",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"<mask>",
":=",
"in",
".",
"String",
"(",
")",
";",
"in",
".",
"Ok",
"(",
")",
"{",
"*",
"id",
"=",
"NewObjectId",
"(",
"data",
")",
"\n",
"}",
"\n",
"}"
] |
10,512 | all-10513 | [
"TaskFromACS",
"translates",
"ecsacs",
".",
"Task",
"to",
"apitask",
".",
"Task",
"by",
"first",
"marshaling",
"the",
"received",
"ecsacs",
".",
"Task",
"to",
"json",
"and",
"unmarshaling",
"it",
"as",
"apitask",
".",
"Task"
] | [
"func",
"TaskFromACS",
"(",
"acsTask",
"*",
"ecsacs",
".",
"Task",
",",
"envelope",
"*",
"ecsacs",
".",
"PayloadMessage",
")",
"(",
"*",
"Task",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"jsonutil",
".",
"BuildJSON",
"(",
"acsTask",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"task",
":=",
"&",
"<mask>",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"task",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"task",
".",
"GetDesiredStatus",
"(",
")",
"==",
"apitaskstatus",
".",
"TaskRunning",
"&&",
"envelope",
".",
"SeqNum",
"!=",
"nil",
"{",
"task",
".",
"StartSequenceNumber",
"=",
"*",
"envelope",
".",
"SeqNum",
"\n",
"}",
"else",
"if",
"task",
".",
"GetDesiredStatus",
"(",
")",
"==",
"apitaskstatus",
".",
"TaskStopped",
"&&",
"envelope",
".",
"SeqNum",
"!=",
"nil",
"{",
"task",
".",
"StopSequenceNumber",
"=",
"*",
"envelope",
".",
"SeqNum",
"\n",
"}",
"\n\n",
"// Overrides the container command if it's set",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"if",
"(",
"container",
".",
"Overrides",
"!=",
"apicontainer",
".",
"ContainerOverrides",
"{",
"}",
")",
"&&",
"container",
".",
"Overrides",
".",
"Command",
"!=",
"nil",
"{",
"container",
".",
"Command",
"=",
"*",
"container",
".",
"Overrides",
".",
"Command",
"\n",
"}",
"\n",
"container",
".",
"TransitionDependenciesMap",
"=",
"make",
"(",
"map",
"[",
"apicontainerstatus",
".",
"ContainerStatus",
"]",
"apicontainer",
".",
"TransitionDependencySet",
")",
"\n",
"}",
"\n",
"// initialize resources map for task",
"task",
".",
"ResourcesMapUnsafe",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"taskresource",
".",
"TaskResource",
")",
"\n",
"return",
"task",
",",
"nil",
"\n",
"}"
] |
10,513 | all-10514 | [
"checkIntervals",
"tests",
"whether",
"puts",
"and",
"deletes",
"overlap",
"for",
"a",
"list",
"of",
"ops",
".",
"If",
"there",
"is",
"an",
"overlap",
"returns",
"an",
"error",
".",
"If",
"no",
"overlap",
"return",
"put",
"and",
"delete",
"sets",
"for",
"recursive",
"evaluation",
"."
] | [
"func",
"checkIntervals",
"(",
"reqs",
"[",
"]",
"*",
"pb",
".",
"RequestOp",
")",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
",",
"adt",
".",
"IntervalTree",
",",
"error",
")",
"{",
"var",
"dels",
"adt",
".",
"IntervalTree",
"\n\n",
"// collect deletes from this level; build first to check lower level overlapped puts",
"for",
"_",
",",
"req",
":=",
"range",
"reqs",
"{",
"tv",
",",
"ok",
":=",
"req",
".",
"Request",
".",
"(",
"*",
"pb",
".",
"RequestOp_RequestDeleteRange",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"dreq",
":=",
"tv",
".",
"RequestDeleteRange",
"\n",
"if",
"dreq",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"var",
"iv",
"adt",
".",
"Interval",
"\n",
"if",
"len",
"(",
"dreq",
".",
"RangeEnd",
")",
"!=",
"0",
"{",
"iv",
"=",
"adt",
".",
"NewStringAffineInterval",
"(",
"string",
"(",
"dreq",
".",
"Key",
")",
",",
"string",
"(",
"dreq",
".",
"RangeEnd",
")",
")",
"\n",
"}",
"else",
"{",
"iv",
"=",
"adt",
".",
"NewStringAffinePoint",
"(",
"string",
"(",
"dreq",
".",
"Key",
")",
")",
"\n",
"}",
"\n",
"dels",
".",
"Insert",
"(",
"iv",
",",
"struct",
"{",
"}",
"{",
"}",
")",
"\n",
"}",
"\n\n",
"// collect children puts/deletes",
"puts",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"req",
":=",
"range",
"reqs",
"{",
"tv",
",",
"<mask>",
":=",
"req",
".",
"Request",
".",
"(",
"*",
"pb",
".",
"RequestOp_RequestTxn",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"putsThen",
",",
"delsThen",
",",
"err",
":=",
"checkIntervals",
"(",
"tv",
".",
"RequestTxn",
".",
"Success",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"dels",
",",
"err",
"\n",
"}",
"\n",
"putsElse",
",",
"delsElse",
",",
"err",
":=",
"checkIntervals",
"(",
"tv",
".",
"RequestTxn",
".",
"Failure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"dels",
",",
"err",
"\n",
"}",
"\n",
"for",
"k",
":=",
"range",
"putsThen",
"{",
"if",
"_",
",",
"ok",
":=",
"puts",
"[",
"k",
"]",
";",
"ok",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"if",
"dels",
".",
"Intersects",
"(",
"adt",
".",
"NewStringAffinePoint",
"(",
"k",
")",
")",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"puts",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"k",
":=",
"range",
"putsElse",
"{",
"if",
"_",
",",
"ok",
":=",
"puts",
"[",
"k",
"]",
";",
"ok",
"{",
"// if key is from putsThen, overlap is OK since",
"// either then/else are mutually exclusive",
"if",
"_",
",",
"isSafe",
":=",
"putsThen",
"[",
"k",
"]",
";",
"!",
"isSafe",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"dels",
".",
"Intersects",
"(",
"adt",
".",
"NewStringAffinePoint",
"(",
"k",
")",
")",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"puts",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"dels",
".",
"Union",
"(",
"delsThen",
",",
"adt",
".",
"NewStringAffineInterval",
"(",
"\"",
"\\x00",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"dels",
".",
"Union",
"(",
"delsElse",
",",
"adt",
".",
"NewStringAffineInterval",
"(",
"\"",
"\\x00",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// collect and check this level's puts",
"for",
"_",
",",
"req",
":=",
"range",
"reqs",
"{",
"tv",
",",
"ok",
":=",
"req",
".",
"Request",
".",
"(",
"*",
"pb",
".",
"RequestOp_RequestPut",
")",
"\n",
"if",
"!",
"ok",
"||",
"tv",
".",
"RequestPut",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"k",
":=",
"string",
"(",
"tv",
".",
"RequestPut",
".",
"Key",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"puts",
"[",
"k",
"]",
";",
"ok",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"if",
"dels",
".",
"Intersects",
"(",
"adt",
".",
"NewStringAffinePoint",
"(",
"k",
")",
")",
"{",
"return",
"nil",
",",
"dels",
",",
"rpctypes",
".",
"ErrGRPCDuplicateKey",
"\n",
"}",
"\n",
"puts",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"return",
"puts",
",",
"dels",
",",
"nil",
"\n",
"}"
] |
10,514 | all-10515 | [
"PeerURLs",
"returns",
"a",
"list",
"of",
"all",
"peer",
"addresses",
".",
"The",
"returned",
"list",
"is",
"sorted",
"in",
"ascending",
"lexicographical",
"order",
"."
] | [
"func",
"(",
"c",
"*",
"RaftCluster",
")",
"PeerURLs",
"(",
")",
"[",
"]",
"string",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"urls",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"c",
".",
"members",
"{",
"urls",
"=",
"<mask>",
"(",
"urls",
",",
"p",
".",
"PeerURLs",
"...",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"urls",
")",
"\n",
"return",
"urls",
"\n",
"}"
] |
10,515 | all-10516 | [
"/",
"*",
"initialize",
"video",
"file",
"writer"
] | [
"func",
"NewVideoWriter",
"(",
"<mask>",
"string",
",",
"fourcc",
"int",
",",
"fps",
"float32",
",",
"frame_width",
",",
"frame_height",
",",
"is_color",
"int",
")",
"*",
"VideoWriter",
"{",
"size",
":=",
"C",
".",
"cvSize",
"(",
"C",
".",
"int",
"(",
"frame_width",
")",
",",
"C",
".",
"int",
"(",
"frame_height",
")",
")",
"\n",
"filename_c",
":=",
"C",
".",
"CString",
"(",
"filename",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"filename_c",
")",
")",
"\n\n",
"rv",
":=",
"C",
".",
"cvCreateVideoWriter",
"(",
"filename_c",
",",
"C",
".",
"int",
"(",
"fourcc",
")",
",",
"C",
".",
"double",
"(",
"fps",
")",
",",
"size",
",",
"C",
".",
"int",
"(",
"is_color",
")",
",",
")",
"\n",
"return",
"(",
"*",
"VideoWriter",
")",
"(",
"rv",
")",
"\n",
"}"
] |
10,516 | all-10517 | [
"TODO",
":",
"gtk_flow_box_selected_foreach",
"()",
"GetSelectedChildren",
"is",
"a",
"wrapper",
"around",
"gtk_flow_box_get_selected_children",
"()"
] | [
"func",
"(",
"fb",
"*",
"FlowBox",
")",
"GetSelectedChildren",
"(",
")",
"(",
"rv",
"[",
"]",
"*",
"FlowBoxChild",
")",
"{",
"c",
":=",
"C",
".",
"gtk_flow_box_get_selected_children",
"(",
"fb",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"<mask>",
":=",
"glib",
".",
"WrapList",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"for",
"l",
":=",
"list",
";",
"l",
"!=",
"nil",
";",
"l",
"=",
"l",
".",
"Next",
"(",
")",
"{",
"o",
":=",
"wrapFlowBoxChild",
"(",
"glib",
".",
"Take",
"(",
"l",
".",
"Data",
"(",
")",
".",
"(",
"unsafe",
".",
"Pointer",
")",
")",
")",
"\n",
"rv",
"=",
"append",
"(",
"rv",
",",
"o",
")",
"\n",
"}",
"\n",
"// We got a transfer container, so we must free the list.",
"list",
".",
"Free",
"(",
")",
"\n\n",
"return",
"\n",
"}"
] |
10,517 | all-10518 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Registration",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
10,518 | all-10519 | [
"Resource",
"returns",
"a",
"resource",
"filename",
"for",
"testing",
"."
] | [
"func",
"Resource",
"(",
"folder",
",",
"filename",
",",
"ext",
"string",
")",
"string",
"{",
"var",
"root",
"string",
"\n",
"if",
"ext",
"==",
"\"",
"\"",
"||",
"ext",
"==",
"\"",
"\"",
"{",
"root",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"folder",
",",
"filename",
")",
"\n",
"}"
] |
10,519 | all-10520 | [
"RecvAppendReq",
"updates",
"the",
"ServerStats",
"in",
"response",
"to",
"an",
"AppendRequest",
"from",
"the",
"given",
"leader",
"being",
"received"
] | [
"func",
"(",
"ss",
"*",
"ServerStats",
")",
"RecvAppendReq",
"(",
"leader",
"string",
",",
"reqSize",
"int",
")",
"{",
"ss",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ss",
".",
"Unlock",
"(",
")",
"\n\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"ss",
".",
"State",
"=",
"raft",
".",
"StateFollower",
"\n",
"if",
"leader",
"!=",
"ss",
".",
"LeaderInfo",
".",
"Name",
"{",
"ss",
".",
"LeaderInfo",
".",
"Name",
"=",
"leader",
"\n",
"ss",
".",
"LeaderInfo",
".",
"StartTime",
"=",
"now",
"\n",
"}",
"\n\n",
"ss",
".",
"recvRateQueue",
".",
"Insert",
"(",
"&",
"RequestStats",
"{",
"SendingTime",
":",
"<mask>",
",",
"Size",
":",
"reqSize",
",",
"}",
",",
")",
"\n",
"ss",
".",
"RecvAppendRequestCnt",
"++",
"\n",
"}"
] |
10,520 | all-10521 | [
"RegisterViewPath",
"register",
"view",
"path"
] | [
"func",
"(",
"render",
"*",
"Render",
")",
"RegisterViewPath",
"(",
"paths",
"...",
"string",
")",
"{",
"for",
"_",
",",
"pth",
":=",
"range",
"paths",
"{",
"if",
"filepath",
".",
"IsAbs",
"(",
"pth",
")",
"{",
"render",
".",
"ViewPaths",
"=",
"append",
"(",
"render",
".",
"ViewPaths",
",",
"pth",
")",
"\n",
"render",
".",
"AssetFileSystem",
".",
"RegisterPath",
"(",
"pth",
")",
"\n",
"}",
"else",
"{",
"if",
"absPath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"pth",
")",
";",
"err",
"==",
"nil",
"&&",
"isExistingDir",
"(",
"absPath",
")",
"{",
"render",
".",
"ViewPaths",
"=",
"append",
"(",
"render",
".",
"ViewPaths",
",",
"absPath",
")",
"\n",
"render",
".",
"AssetFileSystem",
".",
"RegisterPath",
"(",
"absPath",
")",
"\n",
"}",
"else",
"if",
"isExistingDir",
"(",
"filepath",
".",
"Join",
"(",
"utils",
".",
"AppRoot",
",",
"\"",
"\"",
",",
"pth",
")",
")",
"{",
"render",
".",
"AssetFileSystem",
".",
"RegisterPath",
"(",
"filepath",
".",
"Join",
"(",
"utils",
".",
"AppRoot",
",",
"\"",
"\"",
",",
"pth",
")",
")",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"gopath",
":=",
"range",
"utils",
".",
"GOPATH",
"(",
")",
"{",
"if",
"p",
":=",
"filepath",
".",
"Join",
"(",
"gopath",
",",
"\"",
"\"",
",",
"pth",
")",
";",
"isExistingDir",
"(",
"p",
")",
"{",
"render",
".",
"ViewPaths",
"=",
"append",
"(",
"render",
".",
"ViewPaths",
",",
"p",
")",
"\n",
"<mask>",
".",
"AssetFileSystem",
".",
"RegisterPath",
"(",
"p",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,521 | all-10522 | [
"Dial",
"dials",
"and",
"authenticates",
"to",
"an",
"SMTP",
"server",
".",
"The",
"returned",
"SendCloser",
"should",
"be",
"closed",
"when",
"done",
"using",
"it",
"."
] | [
"func",
"(",
"d",
"*",
"Dialer",
")",
"Dial",
"(",
")",
"(",
"SendCloser",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"NetDialTimeout",
"(",
"\"",
"\"",
",",
"addr",
"(",
"d",
".",
"Host",
",",
"d",
".",
"Port",
")",
",",
"d",
".",
"Timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"SSL",
"{",
"conn",
"=",
"tlsClient",
"(",
"conn",
",",
"d",
".",
"tlsConfig",
"(",
")",
")",
"\n",
"}",
"\n\n",
"c",
",",
"err",
":=",
"smtpNewClient",
"(",
"conn",
",",
"d",
".",
"Host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"Timeout",
">",
"0",
"{",
"conn",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"d",
".",
"Timeout",
")",
")",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"LocalName",
"!=",
"\"",
"\"",
"{",
"if",
"err",
":=",
"c",
".",
"Hello",
"(",
"d",
".",
"LocalName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"d",
".",
"SSL",
"&&",
"d",
".",
"StartTLSPolicy",
"!=",
"NoStartTLS",
"{",
"ok",
",",
"_",
":=",
"c",
".",
"Extension",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"ok",
"&&",
"d",
".",
"StartTLSPolicy",
"==",
"MandatoryStartTLS",
"{",
"err",
":=",
"StartTLSUnsupportedError",
"{",
"Policy",
":",
"d",
".",
"StartTLSPolicy",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"ok",
"{",
"if",
"err",
":=",
"c",
".",
"StartTLS",
"(",
"d",
".",
"tlsConfig",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"Auth",
"==",
"nil",
"&&",
"d",
".",
"Username",
"!=",
"\"",
"\"",
"{",
"if",
"ok",
",",
"auths",
":=",
"c",
".",
"Extension",
"(",
"\"",
"\"",
")",
";",
"ok",
"{",
"if",
"strings",
".",
"Contains",
"(",
"auths",
",",
"\"",
"\"",
")",
"{",
"d",
".",
"Auth",
"=",
"smtp",
".",
"CRAMMD5Auth",
"(",
"d",
".",
"Username",
",",
"d",
".",
"Password",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"Contains",
"(",
"auths",
",",
"\"",
"\"",
")",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"auths",
",",
"\"",
"\"",
")",
"{",
"d",
".",
"Auth",
"=",
"&",
"loginAuth",
"{",
"username",
":",
"d",
".",
"Username",
",",
"password",
":",
"d",
".",
"Password",
",",
"<mask>",
":",
"d",
".",
"Host",
",",
"}",
"\n",
"}",
"else",
"{",
"d",
".",
"Auth",
"=",
"smtp",
".",
"PlainAuth",
"(",
"\"",
"\"",
",",
"d",
".",
"Username",
",",
"d",
".",
"Password",
",",
"d",
".",
"Host",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"Auth",
"!=",
"nil",
"{",
"if",
"err",
"=",
"c",
".",
"Auth",
"(",
"d",
".",
"Auth",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"smtpSender",
"{",
"c",
",",
"conn",
",",
"d",
"}",
",",
"nil",
"\n",
"}"
] |
10,522 | all-10523 | [
"GetSettings",
"returns",
"settings",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetSettings",
"(",
"tkn",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"SettingUI",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"SettingUI",
")",
"\n\n",
"settings",
",",
"err",
":=",
"h",
".",
"selectAllFrom",
"(",
"logger",
",",
"data",
".",
"SettingTable",
",",
"settingsCondition",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"settings",
"{",
"setting",
":=",
"*",
"v",
".",
"(",
"*",
"data",
".",
"Setting",
")",
"\n",
"result",
"[",
"setting",
".",
"Key",
"]",
"=",
"SettingUI",
"{",
"setting",
".",
"Value",
",",
"PermissionsToString",
"[",
"setting",
".",
"Permissions",
"]",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
10,523 | all-10524 | [
"SetShowProgress",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_show_progress",
"()",
"."
] | [
"func",
"(",
"po",
"*",
"PrintOperation",
")",
"SetShowProgress",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_print_operation_set_show_progress",
"(",
"po",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"show",
")",
")",
"\n",
"}"
] |
10,524 | all-10525 | [
"LoadImage",
"returns",
"UnsupportedPlatformError",
"on",
"the",
"unsupported",
"platform"
] | [
"func",
"(",
"*",
"loader",
")",
"LoadImage",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"dockerClient",
"dockerapi",
".",
"DockerClient",
")",
"(",
"*",
"types",
".",
"ImageInspect",
",",
"error",
")",
"{",
"return",
"nil",
",",
"NewUnsupportedPlatformError",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"runtime",
".",
"GOOS",
",",
"runtime",
".",
"GOARCH",
")",
")",
"\n",
"}"
] |
10,525 | all-10526 | [
"export",
"PadFrameRange"
] | [
"func",
"PadFrameRange",
"(",
"frange",
"*",
"C",
".",
"<mask>",
",",
"pad",
"int",
")",
"*",
"C",
".",
"char",
"{",
"// caller must free string",
"return",
"C",
".",
"CString",
"(",
"fileseq",
".",
"PadFrameRange",
"(",
"C",
".",
"GoString",
"(",
"frange",
")",
",",
"pad",
")",
")",
"\n",
"}"
] |
10,526 | all-10527 | [
"rsyncCopy",
"copies",
"a",
"directory",
"using",
"rsync",
"(",
"with",
"the",
"--",
"devices",
"option",
")",
"."
] | [
"func",
"rsyncLocalCopy",
"(",
"source",
"string",
",",
"dest",
"string",
",",
"bwlimit",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"dest",
",",
"0755",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"rsyncVerbosity",
":=",
"\"",
"\"",
"\n",
"if",
"debug",
"{",
"rsyncVerbosity",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"bwlimit",
"==",
"\"",
"\"",
"{",
"bwlimit",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"msg",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"bwlimit",
",",
"rsyncVerbosity",
",",
"shared",
".",
"AddSlash",
"(",
"source",
")",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"runError",
",",
"ok",
":=",
"err",
".",
"(",
"<mask>",
".",
"RunError",
")",
"\n",
"if",
"ok",
"{",
"exitError",
",",
"ok",
":=",
"runError",
".",
"Err",
".",
"(",
"*",
"exec",
".",
"ExitError",
")",
"\n",
"if",
"ok",
"{",
"waitStatus",
":=",
"exitError",
".",
"Sys",
"(",
")",
".",
"(",
"syscall",
".",
"WaitStatus",
")",
"\n",
"if",
"waitStatus",
".",
"ExitStatus",
"(",
")",
"==",
"24",
"{",
"return",
"msg",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"msg",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"msg",
",",
"nil",
"\n",
"}"
] |
10,527 | all-10528 | [
"AddFlags",
"injects",
"Kubernetes",
"options",
"into",
"the",
"given",
"FlagSet",
"."
] | [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"AddFlags",
"(",
"fs",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"fs",
".",
"StringVar",
"(",
"&",
"o",
".",
"masterURL",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
".",
"StringVar",
"(",
"&",
"o",
".",
"kubeConfig",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
10,528 | all-10529 | [
"Execute",
"-",
"initializes",
"cf",
"-",
"mgmt",
"configuration"
] | [
"func",
"(",
"c",
"*",
"ExportConfigurationCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"cfMgmt",
",",
"err",
":=",
"InitializeManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"else",
"{",
"exportManager",
":=",
"export",
".",
"NewExportManager",
"(",
"c",
".",
"ConfigDirectory",
",",
"cfMgmt",
".",
"UAAManager",
",",
"cfMgmt",
".",
"SpaceManager",
",",
"cfMgmt",
".",
"UserManager",
",",
"cfMgmt",
".",
"OrgManager",
",",
"cfMgmt",
".",
"SecurityGroupManager",
",",
"cfMgmt",
".",
"IsolationSegmentManager",
",",
"cfMgmt",
".",
"PrivateDomainManager",
",",
"cfMgmt",
".",
"SharedDomainManager",
",",
"cfMgmt",
".",
"ServiceAccessManager",
",",
"cfMgmt",
".",
"QuotaManager",
")",
"\n",
"excludedOrgs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"org",
":=",
"range",
"config",
".",
"DefaultProtectedOrgs",
"{",
"excludedOrgs",
"[",
"org",
"]",
"=",
"org",
"\n",
"}",
"\n",
"for",
"_",
",",
"org",
":=",
"range",
"c",
".",
"ExcludedOrgs",
"{",
"excludedOrgs",
"[",
"org",
"]",
"=",
"org",
"\n",
"}",
"\n",
"excludedSpaces",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"space",
":=",
"<mask>",
"c",
".",
"ExcludedSpaces",
"{",
"excludedSpaces",
"[",
"space",
"]",
"=",
"space",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"config",
".",
"DefaultProtectedOrgs",
")",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"c",
".",
"ExcludedOrgs",
")",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"c",
".",
"ExcludedSpaces",
")",
"\n",
"err",
"=",
"exportManager",
".",
"ExportConfig",
"(",
"excludedOrgs",
",",
"excludedSpaces",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,529 | all-10530 | [
"NewTile",
"creates",
"a",
"new",
"Tile",
"object",
"."
] | [
"func",
"NewTile",
"(",
"value",
"int",
",",
"x",
",",
"y",
"int",
")",
"*",
"Tile",
"{",
"return",
"&",
"Tile",
"{",
"current",
":",
"TileData",
"{",
"<mask>",
":",
"value",
",",
"x",
":",
"x",
",",
"y",
":",
"y",
",",
"}",
",",
"startPoppingCount",
":",
"maxPoppingCount",
",",
"}",
"\n",
"}"
] |
10,530 | all-10531 | [
"WithNodeID",
"identifier",
"of",
"the",
"node",
"to",
"get",
"the",
"partial",
"accessibility",
"tree",
"for",
"."
] | [
"func",
"(",
"p",
"GetPartialAXTreeParams",
")",
"WithNodeID",
"(",
"nodeID",
"cdp",
".",
"NodeID",
")",
"*",
"GetPartialAXTreeParams",
"{",
"p",
".",
"NodeID",
"=",
"nodeID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
10,531 | all-10532 | [
"ResetDefinitions",
"gives",
"a",
"shallow",
"copy",
"with",
"the",
"models",
"reset"
] | [
"func",
"(",
"d",
"*",
"Document",
")",
"ResetDefinitions",
"(",
")",
"*",
"Document",
"{",
"defs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"spec",
".",
"Schema",
",",
"len",
"(",
"d",
".",
"origSpec",
".",
"Definitions",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"d",
".",
"origSpec",
".",
"Definitions",
"{",
"defs",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n\n",
"d",
".",
"<mask>",
".",
"Definitions",
"=",
"defs",
"\n",
"return",
"d",
"\n",
"}"
] |
10,532 | all-10533 | [
"Up00001",
"will",
"be",
"executed",
"as",
"part",
"of",
"a",
"forward",
"migration",
"."
] | [
"func",
"Up00001",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"query",
",",
"err",
":=",
"statik",
".",
"ReadFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"exec",
"(",
"string",
"(",
"<mask>",
")",
",",
"tx",
")",
"\n",
"}"
] |
10,533 | all-10534 | [
"New",
"generator",
"for",
"creating",
"a",
"Buffalo",
"Web",
"application"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Group",
",",
"error",
")",
"{",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"gg",
",",
"err",
":=",
"core",
".",
"New",
"(",
"opts",
".",
"Options",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n\n",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"g",
".",
"Transformer",
"(",
"genny",
".",
"Dot",
"(",
")",
")",
"\n",
"data",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"opts",
",",
"}",
"\n\n",
"helpers",
":=",
"template",
".",
"FuncMap",
"{",
"}",
"\n\n",
"t",
":=",
"gogen",
".",
"TemplateTransformer",
"(",
"<mask>",
",",
"helpers",
")",
"\n",
"g",
".",
"Transformer",
"(",
"t",
")",
"\n",
"g",
".",
"Box",
"(",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n\n",
"if",
"opts",
".",
"Webpack",
"!=",
"nil",
"{",
"// add the webpack generator",
"g",
",",
"err",
"=",
"webpack",
".",
"New",
"(",
"opts",
".",
"Webpack",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"Standard",
"!=",
"nil",
"{",
"// add the standard generator",
"g",
",",
"err",
"=",
"standard",
".",
"New",
"(",
"opts",
".",
"Standard",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n",
"}",
"\n\n",
"return",
"gg",
",",
"nil",
"\n",
"}"
] |
10,534 | all-10535 | [
"GetForProvisioner",
"gets",
"the",
"builder",
"required",
"by",
"the",
"provisioner",
"."
] | [
"func",
"GetForProvisioner",
"(",
"p",
"provision",
".",
"Provisioner",
")",
"(",
"Builder",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"get",
"(",
"p",
".",
"GetName",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"p",
".",
"(",
"provision",
".",
"BuilderDeployDockerClient",
")",
";",
"ok",
"{",
"return",
"get",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
":=",
"p",
".",
"(",
"provision",
".",
"BuilderDeployKubeClient",
")",
";",
"ok",
"{",
"return",
"get",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"builder",
",",
"err",
"\n",
"}"
] |
10,535 | all-10536 | [
"GetTitleSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"GetTitleSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"TitleSize",
",",
"<mask>",
"\n",
"}"
] |
10,536 | all-10537 | [
"title",
":",
"profile",
"handler",
"path",
":",
"/",
"debug",
"/",
"pprof",
"/",
"profile",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"profileHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermDebug",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"pprof",
".",
"Profile",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,537 | all-10538 | [
"RadioMenuItemNewWithLabel",
"is",
"a",
"wrapper",
"around",
"gtk_radio_menu_item_new_with_label",
"()",
"."
] | [
"func",
"RadioMenuItemNewWithLabel",
"(",
"<mask>",
"*",
"glib",
".",
"SList",
",",
"label",
"string",
")",
"(",
"*",
"RadioMenuItem",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_radio_menu_item_new_with_label",
"(",
"cGSList",
"(",
"group",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapRadioMenuItem",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
10,538 | all-10539 | [
"===",
"log10",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"==="
] | [
"func",
"funcLog10",
"(",
"vals",
"[",
"]",
"<mask>",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"simpleFunc",
"(",
"vals",
",",
"enh",
",",
"math",
".",
"Log10",
")",
"\n",
"}"
] |
10,539 | all-10540 | [
"GetProperty",
"returns",
"the",
"current",
"value",
"of",
"a",
"ZFS",
"property",
"from",
"the",
"receiving",
"dataset",
".",
"A",
"full",
"list",
"of",
"available",
"ZFS",
"properties",
"may",
"be",
"found",
"here",
":",
"https",
":",
"//",
"www",
".",
"freebsd",
".",
"org",
"/",
"cgi",
"/",
"man",
".",
"cgi?zfs",
"(",
"8",
")",
"."
] | [
"func",
"(",
"d",
"*",
"Dataset",
")",
"GetProperty",
"(",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"zfs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"key",
",",
"d",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"out",
"[",
"0",
"]",
"[",
"2",
"]",
",",
"nil",
"\n",
"}"
] |
10,540 | all-10541 | [
"Printf",
"prints",
"formatted",
"string",
"to",
"stdout",
".",
"This",
"is",
"same",
"as",
"fmt",
".",
"Printf",
"but",
"uses",
"gstring",
"formatting",
"."
] | [
"func",
"Printm",
"(",
"<mask>",
"string",
",",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"f",
",",
"a",
":=",
"gformat",
"(",
"format",
",",
"args",
")",
"\n",
"return",
"fmt",
".",
"Printf",
"(",
"f",
",",
"a",
"...",
")",
"\n",
"}"
] |
10,541 | all-10542 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"MemoType",
")",
"<mask>",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"memoTypeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
10,542 | all-10543 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetIgnoreCertificateErrorsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSecurity1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
10,543 | all-10544 | [
"GetDataset",
"retrieves",
"a",
"single",
"ZFS",
"dataset",
"by",
"name",
".",
"This",
"dataset",
"could",
"be",
"any",
"valid",
"ZFS",
"dataset",
"type",
"such",
"as",
"a",
"clone",
"filesystem",
"snapshot",
"or",
"volume",
"."
] | [
"func",
"GetDataset",
"(",
"name",
"string",
")",
"(",
"*",
"Dataset",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"zfs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"dsPropListOptions",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ds",
":=",
"&",
"Dataset",
"{",
"Name",
":",
"name",
"}",
"\n",
"for",
"_",
",",
"line",
":=",
"range",
"out",
"{",
"if",
"err",
":=",
"ds",
".",
"parseLine",
"(",
"line",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"ds",
",",
"nil",
"\n",
"}"
] |
10,544 | all-10545 | [
"go",
":",
"generate",
"stringer",
"-",
"type",
"=",
"connectionState"
] | [
"func",
"getTimeout",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"time",
".",
"Duration",
"{",
"deadline",
",",
"ok",
":=",
"ctx",
".",
"Deadline",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"DefaultConnectTimeout",
"\n",
"}",
"\n\n",
"return",
"deadline",
".",
"Sub",
"(",
"time",
".",
"Now",
"(",
")",
")",
"\n",
"}"
] |
10,545 | all-10546 | [
"SetFinishings",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_finishings",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetFinishings",
"(",
"dither",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"dither",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set_finishings",
"(",
"<mask>",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
10,546 | all-10547 | [
"ConfigGetInt64",
"is",
"a",
"convenience",
"for",
"loading",
"the",
"cluster",
"configuration",
"and",
"returning",
"the",
"value",
"of",
"a",
"particular",
"key",
".",
"It",
"s",
"a",
"deprecated",
"API",
"meant",
"to",
"be",
"used",
"by",
"call",
"sites",
"that",
"are",
"not",
"interacting",
"with",
"the",
"database",
"in",
"a",
"transactional",
"way",
"."
] | [
"func",
"ConfigGetInt64",
"(",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"key",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"configGet",
"(",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"config",
".",
"m",
".",
"GetInt64",
"(",
"<mask>",
")",
",",
"nil",
"\n",
"}"
] |
10,547 | all-10548 | [
"SetKnownPortBindings",
"sets",
"the",
"ports",
"for",
"a",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"SetKnownPortBindings",
"(",
"<mask>",
"[",
"]",
"PortBinding",
")",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
".",
"KnownPortBindingsUnsafe",
"=",
"ports",
"\n",
"}"
] |
10,548 | all-10549 | [
"SetBodyStream",
"sets",
"response",
"body",
"stream",
"and",
"optionally",
"body",
"size",
".",
"If",
"bodySize",
"is",
">",
"=",
"0",
"then",
"the",
"bodyStream",
"must",
"provide",
"exactly",
"bodySize",
"bytes",
"before",
"returning",
"io",
".",
"EOF",
".",
"If",
"bodySize",
"<",
"0",
"then",
"bodyStream",
"is",
"read",
"until",
"io",
".",
"EOF",
".",
"bodyStream",
".",
"Close",
"()",
"is",
"called",
"after",
"finishing",
"reading",
"all",
"body",
"data",
"if",
"it",
"implements",
"io",
".",
"Closer",
".",
"See",
"also",
"SetBodyStreamWriter",
"."
] | [
"func",
"(",
"resp",
"*",
"<mask>",
")",
"SetBodyStream",
"(",
"bodyStream",
"io",
".",
"Reader",
",",
"bodySize",
"int",
")",
"{",
"resp",
".",
"ResetBody",
"(",
")",
"\n",
"resp",
".",
"bodyStream",
"=",
"bodyStream",
"\n",
"resp",
".",
"Header",
".",
"SetContentLength",
"(",
"bodySize",
")",
"\n",
"}"
] |
10,549 | all-10550 | [
"ValidMsg",
"if",
"is",
"true",
"then",
"offering",
"message",
"corresponds",
"to",
"an",
"offer",
"template",
"scheme",
"."
] | [
"func",
"ValidMsg",
"(",
"schema",
"json",
".",
"RawMessage",
",",
"msg",
"Message",
")",
"bool",
"{",
"sch",
":=",
"gojsonschema",
".",
"NewBytesLoader",
"(",
"schema",
")",
"\n",
"<mask>",
":=",
"gojsonschema",
".",
"NewGoLoader",
"(",
"msg",
")",
"\n\n",
"result",
",",
"err",
":=",
"gojsonschema",
".",
"Validate",
"(",
"sch",
",",
"loader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"!",
"result",
".",
"Valid",
"(",
")",
"||",
"len",
"(",
"result",
".",
"Errors",
"(",
")",
")",
"!=",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
10,550 | all-10551 | [
"Rule",
"sets",
"the",
"ruleset",
"for",
"this",
"handler",
".",
"returns",
"itself",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"Rule",
"(",
"r",
"rule",
".",
"Rule",
")",
"*",
"<mask>",
"{",
"if",
"r",
"==",
"nil",
"{",
"// if nothing passed then use the allow-everyting rule",
"r",
"=",
"rule",
".",
"Satisfied",
"(",
")",
"\n",
"}",
"\n",
"h",
".",
"rule",
"=",
"r",
"\n\n",
"return",
"h",
"\n",
"}"
] |
10,551 | all-10552 | [
"Merge",
"merges",
"another",
"HandlerMap",
"into",
"itself",
"."
] | [
"func",
"(",
"hm",
"HandlerMap",
")",
"Merge",
"(",
"other",
"HandlerMap",
")",
"{",
"for",
"key",
",",
"methods",
":=",
"range",
"other",
"{",
"if",
"_",
",",
"ok",
":=",
"hm",
"[",
"key",
"]",
";",
"!",
"ok",
"{",
"hm",
"[",
"key",
"]",
"=",
"map",
"[",
"string",
"]",
"Builder",
"{",
"}",
"\n",
"}",
"\n",
"for",
"method",
",",
"builder",
":=",
"range",
"methods",
"{",
"hm",
"[",
"key",
"]",
"[",
"<mask>",
"]",
"=",
"builder",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,552 | all-10553 | [
"utility",
"function",
"to",
"create",
"a",
"URL",
"object",
"based",
"on",
"given",
"data"
] | [
"func",
"setURL",
"(",
"client",
"*",
"Client",
",",
"route",
"string",
",",
"query",
"url",
".",
"Values",
")",
"(",
"u",
"*",
"<mask>",
".",
"URL",
",",
"err",
"error",
")",
"{",
"URL",
":=",
"client",
".",
"BaseURL",
"\n",
"// See https://bugzil.la/1484702",
"// Avoid double separator; routes must start with `/`, so baseURL shouldn't",
"// end with `/`.",
"if",
"strings",
".",
"HasSuffix",
"(",
"URL",
",",
"\"",
"\"",
")",
"{",
"URL",
"=",
"URL",
"[",
":",
"len",
"(",
"URL",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"URL",
"+=",
"route",
"\n",
"u",
",",
"err",
"=",
"url",
".",
"Parse",
"(",
"URL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"URL",
",",
"client",
".",
"BaseURL",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"query",
"!=",
"nil",
"{",
"u",
".",
"RawQuery",
"=",
"query",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
10,553 | all-10554 | [
"/",
"*",
"Elides",
"a",
"specific",
"stage",
"if",
"possible",
".",
"Returns",
"the",
"unmodified",
"[",
"root",
"]",
"stage",
"if",
"it",
"cannot",
"or",
"should",
"not",
"be",
"elided",
".",
"Otherwise",
"returns",
"a",
"new",
"stage",
"representing",
"the",
"condensed",
"value",
"from",
"the",
"elided",
"stages",
"."
] | [
"func",
"elideStage",
"(",
"root",
"*",
"evaluationStage",
")",
"*",
"evaluationStage",
"{",
"var",
"leftValue",
",",
"rightValue",
",",
"result",
"interface",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"// right side must be a non-nil value. Left side must be nil or a value.",
"if",
"root",
".",
"rightStage",
"==",
"nil",
"||",
"root",
".",
"rightStage",
".",
"symbol",
"!=",
"LITERAL",
"||",
"root",
".",
"leftStage",
"==",
"nil",
"||",
"root",
".",
"leftStage",
".",
"symbol",
"!=",
"LITERAL",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"// don't elide some operators",
"switch",
"root",
".",
"symbol",
"{",
"case",
"SEPARATE",
":",
"fallthrough",
"\n",
"case",
"IN",
":",
"return",
"root",
"\n",
"}",
"\n\n",
"// both sides are values, get their actual values.",
"// errors should be near-impossible here. If we encounter them, just abort this optimization.",
"leftValue",
",",
"err",
"=",
"root",
".",
"leftStage",
".",
"operator",
"(",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"rightValue",
",",
"err",
"=",
"root",
".",
"rightStage",
".",
"operator",
"(",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"// typcheck, since the grammar checker is a bit loose with which operator symbols go together.",
"err",
"=",
"typeCheck",
"(",
"root",
".",
"leftTypeCheck",
",",
"leftValue",
",",
"root",
".",
"symbol",
",",
"root",
".",
"typeErrorFormat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"err",
"=",
"typeCheck",
"(",
"root",
".",
"rightTypeCheck",
",",
"rightValue",
",",
"root",
".",
"symbol",
",",
"root",
".",
"typeErrorFormat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"if",
"root",
".",
"typeCheck",
"!=",
"nil",
"&&",
"!",
"root",
".",
"typeCheck",
"(",
"leftValue",
",",
"rightValue",
")",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"// pre-calculate, and return a new stage representing the result.",
"result",
",",
"err",
"=",
"root",
".",
"operator",
"(",
"leftValue",
",",
"rightValue",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"root",
"\n",
"}",
"\n\n",
"return",
"&",
"evaluationStage",
"{",
"symbol",
":",
"LITERAL",
",",
"operator",
":",
"makeLiteralStage",
"(",
"result",
")",
",",
"}",
"\n",
"}"
] |
10,554 | all-10555 | [
"InstanceKeys",
"Requests",
"the",
"AWS",
"keys",
"from",
"the",
"instance",
"-",
"based",
"metadata",
"on",
"EC2",
"Assumes",
"only",
"one",
"IAM",
"role",
"."
] | [
"func",
"InstanceKeys",
"(",
")",
"(",
"keys",
"Keys",
",",
"err",
"error",
")",
"{",
"rolePath",
":=",
"\"",
"\"",
"\n",
"var",
"creds",
"mdCreds",
"\n\n",
"// request the role name for the instance",
"// assumes there is only one",
"resp",
",",
"err",
":=",
"ClientWithTimeout",
"(",
"2",
"*",
"time",
".",
"Second",
")",
".",
"Get",
"(",
"rolePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"defer",
"checkClose",
"(",
"resp",
".",
"Body",
",",
"err",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"err",
"=",
"newRespError",
"(",
"resp",
")",
"\n",
"return",
"\n",
"}",
"\n",
"role",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// request the credential metadata for the role",
"resp",
",",
"err",
"=",
"http",
".",
"Get",
"(",
"rolePath",
"+",
"string",
"(",
"role",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"defer",
"checkClose",
"(",
"resp",
".",
"Body",
",",
"err",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"err",
"=",
"newRespError",
"(",
"resp",
")",
"\n",
"return",
"\n",
"}",
"\n",
"metadata",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"<mask>",
")",
",",
"&",
"creds",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"keys",
"=",
"Keys",
"{",
"AccessKey",
":",
"creds",
".",
"AccessKeyID",
",",
"SecretKey",
":",
"creds",
".",
"SecretAccessKey",
",",
"SecurityToken",
":",
"creds",
".",
"Token",
",",
"}",
"\n\n",
"return",
"\n",
"}"
] |
10,555 | all-10556 | [
"Format",
"formats",
"the",
"error",
"optionally",
"including",
"the",
"stack",
"trace",
".",
"%s",
"the",
"error",
"message",
"%v",
"the",
"error",
"message",
"and",
"the",
"source",
"file",
"and",
"line",
"number",
"for",
"each",
"stack",
"frame",
"Format",
"accepts",
"the",
"following",
"flags",
":",
"%",
"+",
"v",
"the",
"error",
"message",
"and",
"the",
"function",
"file",
"and",
"line",
"for",
"each",
"stack",
"frame"
] | [
"func",
"(",
"e",
"PanicError",
")",
"Format",
"(",
"s",
"fmt",
".",
"State",
",",
"verb",
"rune",
")",
"{",
"switch",
"verb",
"{",
"case",
"'s'",
":",
"<mask>",
".",
"WriteString",
"(",
"s",
",",
"e",
".",
"Error",
"(",
")",
")",
"\n",
"case",
"'v'",
":",
"io",
".",
"WriteString",
"(",
"s",
",",
"e",
".",
"Error",
"(",
")",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"e",
".",
"stack",
"{",
"io",
".",
"WriteString",
"(",
"s",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"if",
"s",
".",
"Flag",
"(",
"'+'",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"s",
",",
"\"",
"\\n",
"\\t",
"\"",
",",
"f",
".",
"Function",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"s",
",",
"\"",
"\"",
",",
"f",
".",
"File",
",",
"f",
".",
"Line",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,556 | all-10557 | [
"GetDeadEntry",
"retrieves",
"the",
"DeadEntry",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"BucketEntry",
")",
"GetDeadEntry",
"(",
")",
"(",
"result",
"LedgerKey",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"DeadEntry",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
10,557 | all-10558 | [
"NewTokens",
"generates",
"new",
"tokens",
"for",
"an",
"OAuth",
"user"
] | [
"func",
"(",
"o",
"OAuth",
")",
"NewTokens",
"(",
"<mask>",
"string",
")",
"(",
"*",
"oauthTokens",
",",
"error",
")",
"{",
"return",
"o",
".",
"GetTokens",
"(",
"code",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
10,558 | all-10559 | [
"buildEgressIgnoredIPs",
"creates",
"egress",
"ignored",
"IPs",
"from",
"proxy",
"config"
] | [
"func",
"buildEgressIgnoredIPs",
"(",
"proxyConfig",
"*",
"ecsacs",
".",
"ProxyConfiguration",
")",
"[",
"]",
"string",
"{",
"<mask>",
"inputEgressIgnoredIPs",
"[",
"]",
"string",
"\n",
"if",
"proxyConfig",
".",
"Properties",
"[",
"egressIgnoredIPs",
"]",
"!=",
"nil",
"{",
"inputEgressIgnoredIPs",
"=",
"strings",
".",
"Split",
"(",
"*",
"proxyConfig",
".",
"Properties",
"[",
"egressIgnoredIPs",
"]",
",",
"splitter",
")",
"\n",
"}",
"\n",
"// append agent default egress ignored IPs",
"return",
"appendDefaultEgressIgnoredIPs",
"(",
"inputEgressIgnoredIPs",
")",
"\n",
"}"
] |
10,559 | all-10560 | [
"Sends",
"a",
"ping",
"query",
"to",
"the",
"address",
"given",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Ping",
"(",
"node",
"*",
"net",
".",
"UDPAddr",
",",
"<mask>",
"func",
"(",
"krpc",
".",
"Msg",
",",
"error",
")",
")",
"error",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"s",
".",
"ping",
"(",
"node",
",",
"callback",
")",
"\n",
"}"
] |
10,560 | all-10561 | [
"RemoveAllTags",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_remove_all_tags",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"RemoveAllTags",
"(",
"start",
",",
"<mask>",
"*",
"TextIter",
")",
"{",
"C",
".",
"gtk_text_buffer_remove_all_tags",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"start",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"end",
")",
")",
"\n",
"}"
] |
10,561 | all-10562 | [
"ReadInt",
"returns",
"an",
"int",
"(",
"of",
"pointer",
"size",
")",
"read",
"from",
"address",
"a",
"of",
"the",
"inferior",
"."
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"ReadInt",
"(",
"a",
"Address",
")",
"int64",
"{",
"if",
"p",
".",
"ptrSize",
"==",
"4",
"{",
"return",
"int64",
"(",
"p",
".",
"ReadInt32",
"(",
"a",
")",
")",
"\n",
"}",
"\n",
"return",
"p",
".",
"ReadInt64",
"(",
"a",
")",
"\n",
"}"
] |
10,562 | all-10563 | [
"CompareHashAndPassword",
"compares",
"a",
"bcrypt",
"hashed",
"password",
"with",
"its",
"possible",
"plaintext",
"equivalent",
".",
"Returns",
"nil",
"on",
"success",
"or",
"an",
"error",
"on",
"failure",
"."
] | [
"func",
"CompareHashAndPassword",
"(",
"hashedPassword",
",",
"password",
"[",
"]",
"byte",
")",
"error",
"{",
"p",
",",
"err",
":=",
"newFromHash",
"(",
"hashedPassword",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"otherHash",
",",
"err",
":=",
"bcrypt",
"(",
"password",
",",
"p",
".",
"<mask>",
",",
"p",
".",
"salt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"otherP",
":=",
"&",
"hashed",
"{",
"otherHash",
",",
"p",
".",
"salt",
",",
"p",
".",
"cost",
",",
"p",
".",
"major",
",",
"p",
".",
"minor",
"}",
"\n",
"if",
"subtle",
".",
"ConstantTimeCompare",
"(",
"p",
".",
"Hash",
"(",
")",
",",
"otherP",
".",
"Hash",
"(",
")",
")",
"==",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"ErrMismatchedHashAndPassword",
"\n",
"}"
] |
10,563 | all-10564 | [
"ReadInt64",
"reads",
"and",
"returns",
"an",
"int64",
"."
] | [
"func",
"(",
"r",
"*",
"Reader",
")",
"ReadInt64",
"(",
")",
"int64",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"var",
"n",
"int",
"\n",
"n",
",",
"r",
".",
"err",
"=",
"<mask>",
".",
"ReadFull",
"(",
"r",
".",
"rd",
",",
"r",
".",
"b",
"[",
":",
"8",
"]",
")",
"\n",
"r",
".",
"cnt",
"+=",
"n",
"\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"int64",
"(",
"binary",
".",
"LittleEndian",
".",
"Uint64",
"(",
"r",
".",
"b",
"[",
":",
"8",
"]",
")",
")",
"\n",
"}"
] |
10,564 | all-10565 | [
"lookupWithSearchPath",
"tries",
"to",
"get",
"an",
"answer",
"for",
"various",
"permutations",
"of",
"the",
"given",
"name",
"appending",
"the",
"system",
"-",
"configured",
"search",
"path",
"as",
"necessary",
".",
"There",
"are",
"three",
"possible",
"outcomes",
":",
"1",
".",
"One",
"of",
"the",
"permutations",
"of",
"the",
"given",
"name",
"is",
"recognized",
"as",
"valid",
"by",
"the",
"DNS",
"in",
"which",
"case",
"we",
"consider",
"ourselves",
"done",
"and",
"that",
"answer",
"is",
"returned",
".",
"Note",
"that",
"due",
"to",
"the",
"way",
"the",
"DNS",
"handles",
"name",
"has",
"resource",
"records",
"but",
"none",
"of",
"the",
"specified",
"type",
"the",
"answer",
"received",
"may",
"have",
"an",
"empty",
"set",
"of",
"results",
".",
"2",
".",
"All",
"of",
"the",
"permutations",
"of",
"the",
"given",
"name",
"are",
"responded",
"to",
"by",
"one",
"of",
"the",
"servers",
"in",
"the",
"nameservers",
"list",
"with",
"the",
"answer",
"that",
"name",
"does",
"not",
"exist",
"(",
"NXDOMAIN",
")",
".",
"In",
"that",
"case",
"it",
"can",
"be",
"considered",
"pseudo",
"-",
"authoritative",
"that",
"there",
"are",
"no",
"records",
"for",
"that",
"name",
".",
"3",
".",
"One",
"or",
"more",
"of",
"the",
"names",
"was",
"responded",
"to",
"by",
"all",
"servers",
"with",
"some",
"sort",
"of",
"error",
"indication",
".",
"In",
"that",
"case",
"we",
"can",
"t",
"know",
"if",
"in",
"fact",
"there",
"are",
"records",
"for",
"the",
"name",
"or",
"not",
"so",
"whatever",
"state",
"the",
"configuration",
"is",
"in",
"we",
"should",
"keep",
"it",
"that",
"way",
"until",
"we",
"know",
"for",
"sure",
"(",
"by",
"presumably",
"all",
"the",
"names",
"getting",
"answers",
"in",
"the",
"future",
")",
".",
"Outcomes",
"1",
"and",
"2",
"are",
"indicated",
"by",
"a",
"valid",
"response",
"message",
"(",
"possibly",
"an",
"empty",
"one",
")",
"and",
"no",
"error",
".",
"Outcome",
"3",
"is",
"indicated",
"by",
"an",
"error",
"return",
".",
"The",
"error",
"will",
"be",
"generic",
"-",
"looking",
"because",
"trying",
"to",
"return",
"all",
"the",
"errors",
"returned",
"by",
"the",
"combination",
"of",
"all",
"name",
"permutations",
"and",
"servers",
"is",
"a",
"nightmare",
"."
] | [
"func",
"lookupWithSearchPath",
"(",
"name",
"string",
",",
"qtype",
"uint16",
",",
"logger",
"log",
".",
"Logger",
")",
"(",
"*",
"dns",
".",
"Msg",
",",
"error",
")",
"{",
"conf",
",",
"err",
":=",
"dns",
".",
"ClientConfigFromFile",
"(",
"resolvConf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"allResponsesValid",
":=",
"true",
"\n\n",
"for",
"_",
",",
"lname",
":=",
"range",
"conf",
".",
"NameList",
"(",
"name",
")",
"{",
"response",
",",
"err",
":=",
"lookupFromAnyServer",
"(",
"lname",
",",
"qtype",
",",
"conf",
",",
"logger",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"// We can't go home yet, because a later name",
"// may give us a valid, successful answer. However",
"// we can no longer say \"this name definitely doesn't",
"// exist\", because we did not get that answer for",
"// at least one name.",
"allResponsesValid",
"=",
"false",
"\n",
"}",
"else",
"if",
"response",
".",
"Rcode",
"==",
"dns",
".",
"RcodeSuccess",
"{",
"// Outcome 1: GOLD!",
"return",
"response",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"allResponsesValid",
"{",
"// Outcome 2: everyone says NXDOMAIN, that's good enough for me",
"return",
"&",
"dns",
".",
"Msg",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"// Outcome 3: boned.",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}"
] |
10,565 | all-10566 | [
"define",
"the",
"scissor",
"box",
"for",
"a",
"specific",
"viewport"
] | [
"func",
"ScissorIndexed",
"(",
"index",
"uint32",
",",
"left",
"int32",
",",
"bottom",
"int32",
",",
"<mask>",
"int32",
",",
"height",
"int32",
")",
"{",
"C",
".",
"glowScissorIndexed",
"(",
"gpScissorIndexed",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"left",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"bottom",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
] |
10,566 | all-10567 | [
"/",
"*",
"Clients",
"can",
"be",
"instantiated",
"from",
"a",
"specially",
"-",
"crafted",
"Pusher",
"URL",
".",
"For",
"example",
":"
] | [
"func",
"ClientFromURL",
"(",
"url",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"url2",
",",
"err",
":=",
"u",
".",
"Parse",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"c",
":=",
"Client",
"{",
"Host",
":",
"url2",
".",
"Host",
",",
"}",
"\n\n",
"matches",
":=",
"pusherPathRegex",
".",
"FindStringSubmatch",
"(",
"url2",
".",
"Path",
")",
"\n",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"AppId",
"=",
"matches",
"[",
"1",
"]",
"\n\n",
"if",
"url2",
".",
"User",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"Key",
"=",
"url2",
".",
"User",
".",
"Username",
"(",
")",
"\n",
"var",
"isSet",
"bool",
"\n",
"c",
".",
"Secret",
",",
"isSet",
"=",
"url2",
".",
"User",
".",
"Password",
"(",
")",
"\n",
"if",
"!",
"isSet",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"url2",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"c",
".",
"Secure",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"&",
"c",
",",
"nil",
"\n",
"}"
] |
10,567 | all-10568 | [
"MarshalJSON",
"implements",
"json",
".",
"Marshaler",
".",
"It",
"will",
"encode",
"null",
"if",
"this",
"String",
"is",
"null",
"."
] | [
"func",
"(",
"s",
"<mask>",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"Valid",
"{",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"s",
".",
"String",
")",
"\n",
"}"
] |
10,568 | all-10569 | [
"GetMimeTypes",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_format_get_mime_types",
"()",
"."
] | [
"func",
"(",
"f",
"*",
"PixbufFormat",
")",
"GetMimeTypes",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"types",
"[",
"]",
"string",
"\n",
"c",
":=",
"C",
".",
"gdk_pixbuf_format_get_mime_types",
"(",
"f",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"*",
"c",
"!=",
"nil",
"{",
"<mask>",
"=",
"append",
"(",
"types",
",",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"*",
"c",
")",
")",
")",
"\n",
"c",
"=",
"C",
".",
"next_gcharptr",
"(",
"c",
")",
"\n",
"}",
"\n",
"return",
"types",
"\n",
"}"
] |
10,569 | all-10570 | [
"HasReadOnly",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"HasReadOnly",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"ReadOnly",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
10,570 | all-10571 | [
"Range",
"is",
"[",
"lowTs",
"highTs",
")",
"."
] | [
"func",
"findFirstInvalidTxn",
"(",
"db",
"*",
"badger",
".",
"<mask>",
",",
"lowTs",
",",
"highTs",
"uint64",
")",
"uint64",
"{",
"checkAt",
":=",
"func",
"(",
"ts",
"uint64",
")",
"error",
"{",
"txn",
":=",
"db",
".",
"NewTransactionAt",
"(",
"ts",
",",
"false",
")",
"\n",
"_",
",",
"err",
":=",
"seekTotal",
"(",
"txn",
")",
"\n",
"txn",
".",
"Discard",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"highTs",
"-",
"lowTs",
"<",
"1",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"lowTs",
")",
"\n",
"err",
":=",
"checkAt",
"(",
"lowTs",
")",
"\n",
"if",
"err",
"==",
"errFailure",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"lowTs",
")",
"\n",
"return",
"lowTs",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"lowTs",
",",
"err",
")",
"\n",
"return",
"0",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"lowTs",
")",
"\n",
"return",
"0",
"\n",
"}",
"\n\n",
"midTs",
":=",
"(",
"lowTs",
"+",
"highTs",
")",
"/",
"2",
"\n",
"log",
".",
"Println",
"(",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"lowTs",
",",
"highTs",
",",
"midTs",
")",
"\n",
"err",
":=",
"checkAt",
"(",
"midTs",
")",
"\n",
"if",
"err",
"==",
"badger",
".",
"ErrKeyNotFound",
"||",
"err",
"==",
"nil",
"{",
"// If no failure, move to higher ts.",
"return",
"findFirstInvalidTxn",
"(",
"db",
",",
"midTs",
"+",
"1",
",",
"highTs",
")",
"\n",
"}",
"\n",
"// Found an error.",
"return",
"findFirstInvalidTxn",
"(",
"db",
",",
"lowTs",
",",
"midTs",
")",
"\n",
"}"
] |
10,571 | all-10572 | [
"create",
"or",
"replace",
"a",
"display",
"list"
] | [
"func",
"NewList",
"(",
"list",
"uint32",
",",
"mode",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpNewList",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"mode",
")",
",",
"0",
")",
"\n",
"}"
] |
10,572 | all-10573 | [
"must",
"be",
"called",
"with",
"a",
"lock",
"held",
"on",
"pool",
".",
"mu"
] | [
"func",
"(",
"pool",
"*",
"WriterPool",
")",
"setSharedRates",
"(",
")",
"{",
"if",
"len",
"(",
"pool",
".",
"givenOut",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"perSecPerWriter",
":=",
"pool",
".",
"maxRate",
"/",
"len",
"(",
"pool",
".",
"givenOut",
")",
"\n",
"for",
"writer",
":=",
"<mask>",
"pool",
".",
"givenOut",
"{",
"writer",
".",
"SetRate",
"(",
"perSecPerWriter",
")",
"\n",
"}",
"\n",
"}"
] |
10,573 | all-10574 | [
"SetNPages",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_n_pages",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintOperation",
")",
"SetNPages",
"(",
"pages",
"int",
")",
"{",
"C",
".",
"gtk_print_operation_set_n_pages",
"(",
"po",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"pages",
")",
")",
"\n",
"}"
] |
10,574 | all-10575 | [
"POST",
"/",
"api",
"/",
"server_templates",
"/",
":",
"id",
"/",
"publish",
"Publishes",
"a",
"given",
"ServerTemplate",
"and",
"its",
"subordinates",
".",
"Only",
"non",
"-",
"HEAD",
"revisions",
"that",
"are",
"owned",
"by",
"the",
"account",
"can",
"be",
"published",
".",
"Required",
"parameters",
":",
"account_group_hrefs",
":",
"List",
"of",
"hrefs",
"of",
"account",
"groups",
"to",
"publish",
"to",
".",
"descriptions",
"Optional",
"parameters",
":",
"allow_comments",
":",
"Allow",
"users",
"to",
"leave",
"comments",
"on",
"this",
"ServerTemplate",
".",
"categories",
":",
"List",
"of",
"Categories",
".",
"email_comments",
":",
"Email",
"me",
"when",
"a",
"user",
"comments",
"on",
"this",
"ServerTemplate",
"."
] | [
"func",
"(",
"loc",
"*",
"ServerTemplateLocator",
")",
"Publish",
"(",
"accountGroupHrefs",
"[",
"]",
"string",
",",
"descriptions",
"*",
"Descriptions",
",",
"options",
"rsapi",
".",
"APIParams",
")",
"error",
"{",
"if",
"len",
"(",
"accountGroupHrefs",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"descriptions",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"\"",
"\"",
":",
"accountGroupHrefs",
",",
"\"",
"\"",
":",
"descriptions",
",",
"}",
"\n",
"var",
"allowCommentsOpt",
"=",
"<mask>",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"allowCommentsOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"allowCommentsOpt",
"\n",
"}",
"\n",
"var",
"categoriesOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"categoriesOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"categoriesOpt",
"\n",
"}",
"\n",
"var",
"emailCommentsOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"emailCommentsOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"emailCommentsOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"respBody",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"sr",
":=",
"string",
"(",
"respBody",
")",
"\n",
"if",
"sr",
"!=",
"\"",
"\"",
"{",
"sr",
"=",
"\"",
"\"",
"+",
"sr",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,575 | all-10576 | [
"GetAlertTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"AlertType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"Event",
")",
"GetAlertTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"AlertType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"AlertType",
",",
"true",
"\n",
"}"
] |
10,576 | all-10577 | [
"SelfUpgrade",
"deploys",
"an",
"updated",
"binary",
"to",
"disk",
"using",
"cmdctrl",
".",
"GithubUpdater"
] | [
"func",
"(",
"o",
"*",
"Server",
")",
"SelfUpgrade",
"(",
"<mask>",
"string",
",",
"bindiff",
",",
"checksum",
"[",
"]",
"byte",
")",
"(",
"bool",
",",
"string",
")",
"{",
"o",
".",
"cmdCtrlLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"cmdCtrlLock",
".",
"Unlock",
"(",
")",
"\n",
"err",
":=",
"o",
".",
"binaryUpgrade",
".",
"Upgrade",
"(",
"version",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"return",
"true",
",",
"\"",
"\"",
"\n",
"}"
] |
10,577 | all-10578 | [
"Lower",
"cases",
"first",
"char",
"of",
"string"
] | [
"func",
"lowerInitial",
"(",
"str",
"string",
")",
"string",
"{",
"for",
"i",
",",
"v",
":=",
"<mask>",
"str",
"{",
"return",
"string",
"(",
"unicode",
".",
"ToLower",
"(",
"v",
")",
")",
"+",
"str",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
10,578 | all-10579 | [
"ContainerNodeProjectList",
"returns",
"all",
"container",
"objects",
"on",
"the",
"local",
"node",
"within",
"the",
"given",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerNodeProjectList",
"(",
"project",
"string",
")",
"(",
"[",
"]",
"Container",
",",
"error",
")",
"{",
"node",
",",
"err",
":=",
"c",
".",
"NodeName",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"filter",
":=",
"ContainerFilter",
"{",
"<mask>",
":",
"project",
",",
"Node",
":",
"node",
",",
"Type",
":",
"int",
"(",
"CTypeRegular",
")",
",",
"}",
"\n\n",
"return",
"c",
".",
"ContainerList",
"(",
"filter",
")",
"\n",
"}"
] |
10,579 | all-10580 | [
"SetLobReader",
"sets",
"the",
"io",
".",
"Reader",
"if",
"a",
"Lob",
"parameter",
"field",
"."
] | [
"func",
"(",
"f",
"*",
"ParameterField",
")",
"SetLobReader",
"(",
"rd",
"<mask>",
".",
"Reader",
")",
"error",
"{",
"f",
".",
"chunkReader",
"=",
"newLobChunkReader",
"(",
"f",
".",
"TypeCode",
"(",
")",
".",
"isCharBased",
"(",
")",
",",
"rd",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,580 | all-10581 | [
"GetBranchRevision",
"returns",
"SHA",
"of",
"HEAD",
"of",
"a",
"branch"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBranchRevision",
"(",
"<mask>",
",",
"project",
",",
"branch",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"h",
",",
"ok",
":=",
"c",
".",
"handlers",
"[",
"instance",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"instance",
")",
"\n",
"}",
"\n\n",
"res",
",",
"_",
",",
"err",
":=",
"h",
".",
"projectService",
".",
"GetBranch",
"(",
"project",
",",
"branch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Revision",
",",
"nil",
"\n",
"}"
] |
10,581 | all-10582 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsLocation",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Id",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"<mask>",
"\n",
"}"
] |
10,582 | all-10583 | [
"processUnmountOperations",
"processes",
"all",
"pending",
"unmount",
"operations",
"by",
"diffing",
"old",
"and",
"new",
"and",
"removing",
"any",
"hosts",
"that",
"were",
"not",
"found",
"in",
"new",
".",
"This",
"operation",
"only",
"proceeds",
"if",
"the",
"datastore",
"field",
"in",
"the",
"processor",
"is",
"populated",
"."
] | [
"func",
"(",
"p",
"*",
"nasDatastoreMountProcessor",
")",
"processUnmountOperations",
"(",
")",
"error",
"{",
"hosts",
":=",
"p",
".",
"diffOldNew",
"(",
")",
"\n",
"if",
"len",
"(",
"hosts",
")",
"<",
"1",
"||",
"p",
".",
"ds",
"==",
"nil",
"{",
"// Nothing to do",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"hsID",
":=",
"<mask>",
"hosts",
"{",
"dss",
",",
"err",
":=",
"hostDatastoreSystemFromHostSystemID",
"(",
"p",
".",
"client",
",",
"hsID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"hostsystem",
".",
"NameOrID",
"(",
"p",
".",
"client",
",",
"hsID",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"removeDatastore",
"(",
"dss",
",",
"p",
".",
"ds",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"hostsystem",
".",
"NameOrID",
"(",
"p",
".",
"client",
",",
"hsID",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,583 | all-10584 | [
"PixbufNew",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_new",
"()",
"."
] | [
"func",
"PixbufNew",
"(",
"colorspace",
"Colorspace",
",",
"hasAlpha",
"bool",
",",
"bitsPerSample",
",",
"width",
",",
"height",
"int",
")",
"(",
"*",
"Pixbuf",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gdk_pixbuf_new",
"(",
"C",
".",
"GdkColorspace",
"(",
"colorspace",
")",
",",
"gbool",
"(",
"hasAlpha",
")",
",",
"C",
".",
"int",
"(",
"bitsPerSample",
")",
",",
"C",
".",
"int",
"(",
"width",
")",
",",
"C",
".",
"int",
"(",
"height",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"obj",
":=",
"&",
"glib",
".",
"<mask>",
"{",
"glib",
".",
"ToGObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"p",
":=",
"&",
"Pixbuf",
"{",
"obj",
"}",
"\n",
"//obj.Ref()",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"func",
"(",
"_",
"interface",
"{",
"}",
")",
"{",
"obj",
".",
"Unref",
"(",
")",
"}",
")",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
10,584 | all-10585 | [
"Echo",
"sends",
"incoming",
"messages",
"back",
"as",
"is",
"."
] | [
"func",
"Echo",
"(",
"ctx",
"*",
"neptulon",
".",
"ReqCtx",
")",
"error",
"{",
"// unmarshall incoming message into response directly",
"if",
"err",
":=",
"ctx",
".",
"Params",
"(",
"&",
"ctx",
".",
"Res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"ctx",
".",
"Next",
"(",
")",
"\n",
"}"
] |
10,585 | all-10586 | [
"ApplyTransition",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskResource",
")",
"ApplyTransition",
"(",
"arg0",
"status0",
".",
"ResourceStatus",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
10,586 | all-10587 | [
"writeLegacyLayerMetadata",
"writes",
"legacy",
"VERSION",
"and",
"configuration",
"files",
"for",
"all",
"layers"
] | [
"func",
"(",
"d",
"*",
"Destination",
")",
"writeLegacyLayerMetadata",
"(",
"layerDescriptors",
"[",
"]",
"manifest",
".",
"Schema2Descriptor",
")",
"(",
"layerPaths",
"[",
"]",
"string",
",",
"lastLayerID",
"string",
",",
"err",
"error",
")",
"{",
"var",
"chainID",
"digest",
".",
"Digest",
"\n",
"lastLayerID",
"=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"layerDescriptors",
"{",
"// This chainID value matches the computation in docker/docker/layer.CreateChainID …",
"if",
"chainID",
"==",
"\"",
"\"",
"{",
"chainID",
"=",
"l",
".",
"Digest",
"\n",
"}",
"else",
"{",
"chainID",
"=",
"digest",
".",
"Canonical",
".",
"FromString",
"(",
"chainID",
".",
"<mask>",
"(",
")",
"+",
"\"",
"\"",
"+",
"l",
".",
"Digest",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"// … but note that this image ID does not match docker/docker/image/v1.CreateID. At least recent",
"// versions allocate new IDs on load, as long as the IDs we use are unique / cannot loop.",
"//",
"// Overall, the goal of computing a digest dependent on the full history is to avoid reusing an image ID",
"// (and possibly creating a loop in the \"parent\" links) if a layer with the same DiffID appears two or more",
"// times in layersDescriptors. The ChainID values are sufficient for this, the v1.CreateID computation",
"// which also mixes in the full image configuration seems unnecessary, at least as long as we are storing",
"// only a single image per tarball, i.e. all DiffID prefixes are unique (can’t differ only with",
"// configuration).",
"layerID",
":=",
"chainID",
".",
"Hex",
"(",
")",
"\n\n",
"physicalLayerPath",
":=",
"l",
".",
"Digest",
".",
"Hex",
"(",
")",
"+",
"\"",
"\"",
"\n",
"// The layer itself has been stored into physicalLayerPath in PutManifest.",
"// So, use that path for layerPaths used in the non-legacy manifest",
"layerPaths",
"=",
"append",
"(",
"layerPaths",
",",
"physicalLayerPath",
")",
"\n",
"// ... and create a symlink for the legacy format;",
"if",
"err",
":=",
"d",
".",
"sendSymlink",
"(",
"filepath",
".",
"Join",
"(",
"layerID",
",",
"legacyLayerFileName",
")",
",",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"physicalLayerPath",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"b",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"d",
".",
"sendBytes",
"(",
"filepath",
".",
"Join",
"(",
"layerID",
",",
"legacyVersionFileName",
")",
",",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// The legacy format requires a config file per layer",
"layerConfig",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"layerConfig",
"[",
"\"",
"\"",
"]",
"=",
"layerID",
"\n\n",
"// The root layer doesn't have any parent",
"if",
"lastLayerID",
"!=",
"\"",
"\"",
"{",
"layerConfig",
"[",
"\"",
"\"",
"]",
"=",
"lastLayerID",
"\n",
"}",
"\n",
"// The root layer configuration file is generated by using subpart of the image configuration",
"if",
"i",
"==",
"len",
"(",
"layerDescriptors",
")",
"-",
"1",
"{",
"var",
"config",
"map",
"[",
"string",
"]",
"*",
"json",
".",
"RawMessage",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"d",
".",
"config",
",",
"&",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"attr",
":=",
"range",
"[",
"7",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"layerConfig",
"[",
"attr",
"]",
"=",
"config",
"[",
"attr",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"layerConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"sendBytes",
"(",
"filepath",
".",
"Join",
"(",
"layerID",
",",
"legacyConfigFileName",
")",
",",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"lastLayerID",
"=",
"layerID",
"\n",
"}",
"\n",
"return",
"layerPaths",
",",
"lastLayerID",
",",
"nil",
"\n",
"}"
] |
10,587 | all-10588 | [
"Update",
"performs",
"a",
"partial",
"update",
"with",
"the",
"given",
"value",
"at",
"the",
"specified",
"path",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Update",
"(",
"path",
"string",
",",
"value",
"<mask>",
"{",
"}",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"c",
".",
"api",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"Url",
"+",
"\"",
"\"",
"+",
"path",
",",
"c",
".",
"Auth",
",",
"body",
",",
"params",
")",
"\n\n",
"// if we've just updated the root node, clear the value so it gets looked up",
"// again and populated correctly since we just applied a diffgram",
"if",
"len",
"(",
"path",
")",
"==",
"0",
"{",
"c",
".",
"value",
"=",
"nil",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
10,588 | all-10589 | [
"WaitCondition",
"appends",
"a",
"new",
"wait",
"condition",
"to",
"the",
"query",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"WaitCondition",
"(",
"rule",
"string",
")",
"*",
"Query",
"{",
"q",
".",
"headers",
"=",
"append",
"(",
"q",
".",
"<mask>",
",",
"\"",
"\"",
"+",
"rule",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
10,589 | all-10590 | [
"ImageGetFromAnyProject",
"returns",
"an",
"image",
"matching",
"the",
"given",
"fingerprint",
"if",
"it",
"exists",
"in",
"any",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetFromAnyProject",
"(",
"fingerprint",
"string",
")",
"(",
"int",
",",
"*",
"api",
".",
"Image",
",",
"error",
")",
"{",
"var",
"create",
",",
"expire",
",",
"used",
",",
"upload",
"*",
"time",
".",
"Time",
"// These hold the db-returned times",
"\n\n",
"// The object we'll actually return",
"image",
":=",
"api",
".",
"Image",
"{",
"}",
"\n",
"id",
":=",
"-",
"1",
"\n",
"arch",
":=",
"-",
"1",
"\n\n",
"// These two humongous things will be filled by the call to DbQueryRowScan",
"outfmt",
":=",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"&",
"id",
",",
"&",
"image",
".",
"Fingerprint",
",",
"&",
"image",
".",
"Filename",
",",
"&",
"image",
".",
"Size",
",",
"&",
"image",
".",
"Cached",
",",
"&",
"image",
".",
"Public",
",",
"&",
"image",
".",
"AutoUpdate",
",",
"&",
"arch",
",",
"&",
"create",
",",
"&",
"expire",
",",
"&",
"used",
",",
"&",
"upload",
"}",
"\n\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"fingerprint",
"}",
"\n",
"query",
":=",
"`\n SELECT\n images.id, fingerprint, filename, size, cached, public, auto_update, architecture,\n creation_date, expiry_date, last_use_date, upload_date\n FROM images\n WHERE fingerprint = ?\n LIMIT 1`",
"\n\n",
"err",
":=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
",",
"nil",
",",
"err",
"// Likely: there are no rows for this fingerprint",
"\n",
"}",
"\n\n",
"err",
"=",
"c",
".",
"imageFill",
"(",
"id",
",",
"&",
"image",
",",
"create",
",",
"expire",
",",
"used",
",",
"upload",
",",
"arch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"id",
",",
"&",
"image",
",",
"nil",
"\n",
"}"
] |
10,590 | all-10591 | [
"GetUnit",
"returns",
"the",
"Unit",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"GetUnit",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Unit",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"m",
".",
"Unit",
"\n",
"}"
] |
10,591 | all-10592 | [
"Detect",
"tries",
"to",
"get",
"the",
"package",
"system",
"used",
"in",
"the",
"system",
"looking",
"for",
"executables",
"in",
"directory",
"/",
"usr",
"/",
"bin",
"."
] | [
"func",
"Detect",
"(",
")",
"(",
"PackageType",
",",
"error",
")",
"{",
"for",
"k",
",",
"v",
":=",
"<mask>",
"execPackagers",
"{",
"_",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"\"",
"\"",
"+",
"v",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"PackageType",
"(",
"k",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"-",
"1",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
10,592 | all-10593 | [
"MarshalJSON",
"implements",
"json",
".",
"Marshaler",
"."
] | [
"func",
"(",
"p",
"Point",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"v",
":=",
"strconv",
".",
"FormatFloat",
"(",
"p",
".",
"V",
",",
"'f'",
",",
"-",
"1",
",",
"64",
")",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"[",
"...",
"]",
"interface",
"{",
"}",
"{",
"float64",
"(",
"p",
".",
"T",
")",
"/",
"1000",
",",
"v",
"}",
")",
"\n",
"}"
] |
10,593 | all-10594 | [
"HasSubdomain",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationPDRequest",
")",
"HasSubdomain",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"Subdomain",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
10,594 | all-10595 | [
"Do",
"executes",
"DOMStorage",
".",
"clear",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ClearParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandClear",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
10,595 | all-10596 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"ColorM",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"<mask>",
"(",
")",
"string",
"{",
"b",
",",
"t",
":=",
"c",
".",
"impl",
".",
"UnsafeElements",
"(",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
"[",
"0",
"]",
",",
"b",
"[",
"4",
"]",
",",
"b",
"[",
"8",
"]",
",",
"b",
"[",
"12",
"]",
",",
"t",
"[",
"0",
"]",
",",
"b",
"[",
"1",
"]",
",",
"b",
"[",
"5",
"]",
",",
"b",
"[",
"9",
"]",
",",
"b",
"[",
"13",
"]",
",",
"t",
"[",
"1",
"]",
",",
"b",
"[",
"2",
"]",
",",
"b",
"[",
"6",
"]",
",",
"b",
"[",
"10",
"]",
",",
"b",
"[",
"14",
"]",
",",
"t",
"[",
"2",
"]",
",",
"b",
"[",
"3",
"]",
",",
"b",
"[",
"7",
"]",
",",
"b",
"[",
"11",
"]",
",",
"b",
"[",
"15",
"]",
",",
"t",
"[",
"3",
"]",
")",
"\n",
"}"
] |
10,596 | all-10597 | [
"Check",
"does",
"some",
"sanity",
"check",
"on",
"one",
"level",
"of",
"data",
"or",
"in",
"-",
"memory",
"index",
"."
] | [
"func",
"(",
"s",
"*",
"levelHandler",
")",
"validate",
"(",
")",
"error",
"{",
"if",
"s",
".",
"level",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"numTables",
":=",
"len",
"(",
"s",
".",
"tables",
")",
"\n",
"for",
"j",
":=",
"1",
";",
"j",
"<",
"numTables",
";",
"j",
"++",
"{",
"if",
"j",
">=",
"len",
"(",
"s",
".",
"tables",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
".",
"level",
",",
"j",
",",
"numTables",
")",
"\n",
"}",
"\n\n",
"if",
"y",
".",
"CompareKeys",
"(",
"s",
".",
"tables",
"[",
"j",
"-",
"1",
"]",
".",
"Biggest",
"(",
")",
",",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Smallest",
"(",
")",
")",
">=",
"0",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"<mask>",
".",
"Dump",
"(",
"s",
".",
"tables",
"[",
"j",
"-",
"1",
"]",
".",
"Biggest",
"(",
")",
")",
",",
"hex",
".",
"Dump",
"(",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Smallest",
"(",
")",
")",
",",
"s",
".",
"level",
",",
"j",
",",
"numTables",
")",
"\n",
"}",
"\n\n",
"if",
"y",
".",
"CompareKeys",
"(",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Smallest",
"(",
")",
",",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Biggest",
"(",
")",
")",
">",
"0",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Smallest",
"(",
")",
",",
"s",
".",
"tables",
"[",
"j",
"]",
".",
"Biggest",
"(",
")",
",",
"s",
".",
"level",
",",
"j",
",",
"numTables",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,597 | all-10598 | [
"DecodeValue",
"validates",
"and",
"decodes",
"a",
"cookie",
"value"
] | [
"func",
"(",
"c",
"CookieSigner",
")",
"DecodeValue",
"(",
"encodedvalue",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"encodedvalue",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"mac",
",",
"err",
":=",
"base64",
".",
"URLEncoding",
".",
"DecodeString",
"(",
"parts",
"[",
"0",
"]",
")",
"\n",
"value",
":=",
"parts",
"[",
"1",
"]",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"hmac",
".",
"Equal",
"(",
"c",
".",
"mac",
"(",
"value",
")",
",",
"mac",
")",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"value",
",",
"nil",
"\n",
"}"
] |
10,598 | all-10599 | [
"Scan",
"ping",
"to",
"hosts",
"in",
"CIDR",
"range",
"."
] | [
"func",
"(",
"d",
"PingScanner",
")",
"Scan",
"(",
")",
"(",
"aliveIPs",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"var",
"hostsInCidr",
"[",
"]",
"string",
"\n",
"if",
"hostsInCidr",
",",
"err",
"=",
"expandCidrIntoIPs",
"(",
"d",
".",
"CIDR",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pingChan",
":=",
"make",
"(",
"chan",
"string",
",",
"d",
".",
"NumOfConcurrency",
")",
"\n",
"pongChan",
":=",
"<mask>",
"(",
"chan",
"pong",
",",
"len",
"(",
"hostsInCidr",
")",
")",
"\n",
"doneChan",
":=",
"make",
"(",
"chan",
"[",
"]",
"pong",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"d",
".",
"NumOfConcurrency",
";",
"i",
"++",
"{",
"go",
"ping",
"(",
"pingChan",
",",
"pongChan",
",",
"d",
".",
"PingOptions",
"...",
")",
"\n",
"}",
"\n\n",
"go",
"receivePong",
"(",
"len",
"(",
"hostsInCidr",
")",
",",
"pongChan",
",",
"doneChan",
")",
"\n\n",
"for",
"_",
",",
"ip",
":=",
"range",
"hostsInCidr",
"{",
"pingChan",
"<-",
"ip",
"\n",
"}",
"\n\n",
"alives",
":=",
"<-",
"doneChan",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"alives",
"{",
"aliveIPs",
"=",
"append",
"(",
"aliveIPs",
",",
"a",
".",
"IP",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"aliveIPs",
")",
"\n",
"return",
"\n",
"}"
] |
10,599 | all-10600 | [
"HasCreatedBy",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"APIKey",
")",
"HasCreatedBy",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"CreatedBy",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.