id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
20,100 | all-20101 | [
"Infof",
"formats",
"message",
"according",
"to",
"format",
"specifier",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelInfo",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
]
| [
"func",
"(",
"l",
"*",
"slog",
")",
"Infof",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelInfo",
"{",
"l",
".",
"b",
".",
"printf",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
]
|
20,101 | all-20102 | [
"Seek",
"brings",
"us",
"to",
"element",
"with",
"key",
">",
"=",
"given",
"key",
"."
]
| [
"func",
"(",
"s",
"*",
"MergeIterator",
")",
"Seek",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"for",
"_",
",",
"itr",
":=",
"range",
"s",
".",
"all",
"{",
"itr",
".",
"Seek",
"(",
"key",
")",
"\n",
"}",
"\n",
"s",
".",
"initHeap",
"(",
")",
"\n",
"}"
]
|
20,102 | all-20103 | [
"InitWatcher",
"initialzes",
"a",
"watcher",
"to",
"watch",
"templates",
"changes",
"in",
"the",
"pattern",
".",
"f",
"would",
"be",
"InitHtmlTemplates",
"or",
"InitTextTemplates",
".",
"If",
"the",
"watcher",
"raises",
"an",
"error",
"internally",
"the",
"callback",
"function",
"ef",
"will",
"be",
"executed",
".",
"ef",
"can",
"be",
"nil",
"witch",
"represents",
"ignoring",
"all",
"internal",
"errors",
"."
]
| [
"func",
"InitWatcher",
"(",
"pattern",
"string",
",",
"f",
"func",
"(",
"string",
")",
"error",
",",
"ef",
"func",
"(",
"error",
")",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"f",
"(",
"pattern",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"watcher",
".",
"Watcher",
"==",
"nil",
"{",
"watcher",
".",
"Watcher",
",",
"err",
"=",
"fsnotify",
".",
"NewWatcher",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"watcher",
".",
"closer",
"=",
"make",
"(",
"chan",
"bool",
")",
"\n",
"}",
"\n",
"go",
"func",
"(",
")",
"{",
"atomic",
".",
"AddUint32",
"(",
"&",
"watcher",
".",
"count",
",",
"1",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"watcher",
".",
"Events",
":",
"if",
"err",
":=",
"f",
"(",
"pattern",
")",
";",
"err",
"!=",
"nil",
"{",
"ef",
"(",
"err",
")",
"\n",
"}",
"\n",
"case",
"err",
":=",
"<-",
"watcher",
".",
"Errors",
":",
"if",
"ef",
"!=",
"nil",
"{",
"ef",
"(",
"err",
")",
"\n",
"}",
"\n",
"<mask>",
"<-",
"watcher",
".",
"closer",
":",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"var",
"matches",
"[",
"]",
"string",
"\n",
"matches",
",",
"err",
"=",
"filepath",
".",
"Glob",
"(",
"pattern",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"matches",
"{",
"if",
"err",
"=",
"watcher",
".",
"Add",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
20,103 | all-20104 | [
"NewSyncer",
"creates",
"a",
"Syncer",
"."
]
| [
"func",
"NewSyncer",
"(",
"c",
"*",
"clientv3",
".",
"Client",
",",
"prefix",
"string",
",",
"rev",
"int64",
")",
"Syncer",
"{",
"return",
"&",
"syncer",
"{",
"c",
":",
"c",
",",
"<mask>",
":",
"prefix",
",",
"rev",
":",
"rev",
"}",
"\n",
"}"
]
|
20,104 | all-20105 | [
"RestrictFilter",
"restricts",
"the",
"filter",
"to",
"only",
"work",
"on",
"a",
"certain",
"field"
]
| [
"func",
"RestrictFilter",
"(",
"fieldName",
"string",
",",
"<mask>",
"Filter",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"k",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"if",
"fieldName",
"==",
"k",
"{",
"return",
"filter",
".",
"Filter",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n\n",
"return",
"v",
"\n",
"}",
")",
"\n",
"}"
]
|
20,105 | all-20106 | [
"SetTooltipMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_set_tooltip_markup",
"()"
]
| [
"func",
"(",
"v",
"*",
"StatusIcon",
")",
"SetTooltipMarkup",
"(",
"markup",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"markup",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_status_icon_set_tooltip_markup",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
20,106 | all-20107 | [
"Delete",
"deletes",
"the",
"key",
"at",
"path",
"If",
"the",
"path",
"does",
"not",
"exist",
"Delete",
"returns",
"nil",
"(",
"no",
"error",
")",
"."
]
| [
"func",
"(",
"b",
"*",
"Bucket",
")",
"Delete",
"(",
"path",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"b",
".",
"delete",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// try to delete md5 file",
"if",
"b",
".",
"Md5Check",
"{",
"if",
"err",
":=",
"b",
".",
"delete",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"logger",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"path",
",",
"b",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,107 | all-20108 | [
"findDuplicate",
"returns",
"an",
"arbitrary",
"basic",
"block",
"that",
"appeared",
"more",
"than",
"once",
"in",
"blocks",
"or",
"nil",
"if",
"all",
"were",
"unique",
"."
]
| [
"func",
"findDuplicate",
"(",
"blocks",
"[",
"]",
"*",
"BasicBlock",
")",
"*",
"BasicBlock",
"{",
"if",
"len",
"(",
"blocks",
")",
"<",
"2",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"blocks",
"[",
"0",
"]",
"==",
"blocks",
"[",
"1",
"]",
"{",
"return",
"blocks",
"[",
"0",
"]",
"\n",
"}",
"\n",
"// Slow path:",
"m",
":=",
"make",
"(",
"<mask>",
"[",
"*",
"BasicBlock",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"blocks",
"{",
"if",
"m",
"[",
"b",
"]",
"{",
"return",
"b",
"\n",
"}",
"\n",
"m",
"[",
"b",
"]",
"=",
"true",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,108 | all-20109 | [
"FindByXPath",
"finds",
"exactly",
"one",
"element",
"by",
"XPath",
"selector",
"."
]
| [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByXPath",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"<mask>",
".",
"XPath",
",",
"selector",
")",
".",
"Single",
"(",
")",
")",
"\n",
"}"
]
|
20,109 | all-20110 | [
"IsClosed",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_is_closed",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Display",
")",
"IsClosed",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gdk_display_is_closed",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
20,110 | all-20111 | [
"NewScpStatementPledges",
"creates",
"a",
"new",
"ScpStatementPledges",
"."
]
| [
"func",
"NewScpStatementPledges",
"(",
"aType",
"ScpStatementType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"ScpStatementPledges",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"ScpStatementType",
"(",
"aType",
")",
"{",
"case",
"ScpStatementTypeScpStPrepare",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ScpStatementPrepare",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Prepare",
"=",
"&",
"<mask>",
"\n",
"case",
"ScpStatementTypeScpStConfirm",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ScpStatementConfirm",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Confirm",
"=",
"&",
"tv",
"\n",
"case",
"ScpStatementTypeScpStExternalize",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ScpStatementExternalize",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Externalize",
"=",
"&",
"tv",
"\n",
"case",
"ScpStatementTypeScpStNominate",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ScpNomination",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Nominate",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
20,111 | all-20112 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventStyleSheetChanged",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss52",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,112 | all-20113 | [
"Handle",
"executes",
"the",
"trigger",
"action",
"if",
"the",
"condition",
"is",
"satisfied"
]
| [
"func",
"(",
"t",
"Trigger",
")",
"Handle",
"(",
"b",
"*",
"Bot",
",",
"m",
"*",
"Message",
")",
"bool",
"{",
"return",
"t",
".",
"Condition",
"(",
"b",
",",
"m",
")",
"&&",
"t",
".",
"<mask>",
"(",
"b",
",",
"m",
")",
"\n",
"}"
]
|
20,113 | all-20114 | [
"Validate",
"validates",
"that",
"the",
"given",
"spec",
"is",
"supported",
"by",
"thrift",
"-",
"gen",
"."
]
| [
"func",
"Validate",
"(",
"svc",
"*",
"parser",
".",
"Service",
")",
"error",
"{",
"for",
"_",
",",
"m",
":=",
"<mask>",
"svc",
".",
"Methods",
"{",
"if",
"err",
":=",
"validateMethod",
"(",
"svc",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,114 | all-20115 | [
"create",
"query",
"objects"
]
| [
"func",
"CreateQueries",
"(",
"<mask>",
"uint32",
",",
"n",
"int32",
",",
"ids",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpCreateQueries",
",",
"3",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"n",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"ids",
")",
")",
")",
"\n",
"}"
]
|
20,115 | all-20116 | [
"Do",
"executes",
"Debugger",
".",
"setReturnValue",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetReturnValueParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetReturnValue",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
20,116 | all-20117 | [
"Handle",
"is",
"a",
"HTTP",
"handler",
"for",
"CORS",
"-",
"able",
"API",
"."
]
| [
"func",
"(",
"s",
"*",
"CORSMiddleware",
")",
"Handle",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"origin",
":=",
"HttpHeader_Origin",
"(",
")",
".",
"GetReader",
"(",
"r",
".",
"Header",
")",
"\n",
"if",
"r",
".",
"Method",
"!=",
"DEFAULT_CORS_PREFLIGHT_METHOD",
"&&",
"<mask>",
".",
"Value",
"!=",
"\"",
"\"",
"{",
"if",
"!",
"s",
".",
"PredicateOrigin",
"(",
"origin",
".",
"Value",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"HttpHeader_AccessControlAllowOrigin",
"(",
")",
".",
"SetValue",
"(",
"origin",
".",
"Value",
")",
".",
"SetWriter",
"(",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"HttpHeader_AccessControlAllowCredentials",
"(",
")",
".",
"SetValue",
"(",
"strconv",
".",
"FormatBool",
"(",
"s",
".",
"UseCredentials",
")",
")",
".",
"SetWriter",
"(",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"if",
"len",
"(",
"s",
".",
"Headers",
")",
">",
"0",
"{",
"HttpHeader_AccessControlAllowHeaders",
"(",
")",
".",
"SetValue",
"(",
"strings",
".",
"Join",
"(",
"s",
".",
"Headers",
",",
"\"",
"\"",
")",
")",
".",
"SetWriter",
"(",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"HttpHeader_AccessControlAllowHeaders",
"(",
")",
".",
"SetWriter",
"(",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"fn",
")",
"\n",
"}"
]
|
20,117 | all-20118 | [
"GetOffsetValue",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_level_bar_get_offset_value",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"LevelBar",
")",
"GetOffsetValue",
"(",
"name",
"string",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"var",
"value",
"C",
".",
"gdouble",
"\n",
"c",
":=",
"C",
".",
"gtk_level_bar_get_offset_value",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"&",
"<mask>",
")",
"\n",
"return",
"float64",
"(",
"value",
")",
",",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
20,118 | all-20119 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
]
| [
"func",
"(",
"r",
"*",
"ServerArray",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"ServerArrayLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"ServerArrayLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,119 | all-20120 | [
"LineReader",
"returns",
"a",
"channel",
"that",
"reads",
"the",
"contents",
"of",
"a",
"reader",
"line",
"-",
"by",
"-",
"line",
"."
]
| [
"func",
"LineReader",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"(",
"<-",
"chan",
"string",
",",
"error",
")",
"{",
"return",
"lineReader",
"(",
"func",
"(",
")",
"(",
"io",
".",
"Reader",
",",
"func",
"(",
")",
",",
"error",
")",
"{",
"return",
"r",
",",
"nil",
",",
"nil",
"}",
")",
"\n",
"}"
]
|
20,120 | all-20121 | [
"Close",
"implements",
"the",
"Query",
"interface",
"."
]
| [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Close",
"(",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"q",
".",
"matrix",
"{",
"putPointSlice",
"(",
"s",
".",
"Points",
")",
"\n",
"}",
"\n",
"}"
]
|
20,121 | all-20122 | [
"CurrentOAuth",
"returns",
"the",
"user",
"associated",
"with",
"the",
"OAuth",
"consumer",
"making",
"this",
"request",
".",
"If",
"the",
"OAuth",
"consumer",
"did",
"not",
"make",
"a",
"valid",
"OAuth",
"request",
"or",
"the",
"scopes",
"is",
"non",
"-",
"empty",
"and",
"the",
"current",
"user",
"does",
"not",
"have",
"at",
"least",
"one",
"of",
"the",
"scopes",
"this",
"method",
"will",
"return",
"an",
"error",
"."
]
| [
"func",
"CurrentOAuth",
"(",
"c",
"context",
".",
"Context",
",",
"scopes",
"...",
"string",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"GetOAuthUserRequest",
"{",
"}",
"\n",
"if",
"len",
"(",
"scopes",
")",
"!=",
"1",
"||",
"scopes",
"[",
"0",
"]",
"!=",
"\"",
"\"",
"{",
"// The signature for this function used to be CurrentOAuth(Context, string).",
"// Ignore the singular \"\" scope to preserve existing behavior.",
"req",
".",
"Scopes",
"=",
"scopes",
"\n",
"}",
"\n\n",
"res",
":=",
"&",
"pb",
".",
"GetOAuthUserResponse",
"{",
"}",
"\n\n",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"User",
"{",
"Email",
":",
"*",
"<mask>",
".",
"Email",
",",
"AuthDomain",
":",
"*",
"res",
".",
"AuthDomain",
",",
"Admin",
":",
"res",
".",
"GetIsAdmin",
"(",
")",
",",
"ID",
":",
"*",
"res",
".",
"UserId",
",",
"ClientID",
":",
"res",
".",
"GetClientId",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
20,122 | all-20123 | [
"AllPostsubmits",
"returns",
"all",
"prow",
"postsubmit",
"jobs",
"in",
"repos",
".",
"if",
"repos",
"is",
"empty",
"return",
"all",
"postsubmits",
"."
]
| [
"func",
"(",
"c",
"*",
"JobConfig",
")",
"AllPostsubmits",
"(",
"repos",
"[",
"]",
"string",
")",
"[",
"]",
"Postsubmit",
"{",
"var",
"res",
"[",
"]",
"Postsubmit",
"\n\n",
"for",
"repo",
",",
"v",
":=",
"range",
"c",
".",
"Postsubmits",
"{",
"if",
"len",
"(",
"repos",
")",
"==",
"0",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"v",
"...",
")",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"repos",
"{",
"if",
"r",
"==",
"repo",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"v",
"...",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,123 | all-20124 | [
"read",
"unsigned",
"32",
"-",
"bit",
"integer"
]
| [
"func",
"readuint32",
"(",
"pos",
"uint32",
")",
"uint32",
"{",
"pos2",
":=",
"int64",
"(",
"pos",
")",
"\n",
"var",
"retval",
"uint32",
"\n",
"data",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"_",
",",
"err",
":=",
"f",
".",
"ReadAt",
"(",
"data",
",",
"pos2",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"buf",
":=",
"bytes",
".",
"NewReader",
"(",
"data",
")",
"\n",
"err",
"=",
"binary",
".",
"Read",
"(",
"buf",
",",
"<mask>",
".",
"LittleEndian",
",",
"&",
"retval",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"retval",
"\n",
"}"
]
|
20,124 | all-20125 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"SetVariableValueParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
20,125 | all-20126 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
]
| [
"func",
"(",
"o",
"*",
"ListInt64Option",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"Int64Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,126 | all-20127 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Labels",
"."
]
| [
"func",
"(",
"in",
"Labels",
")",
"DeepCopy",
"(",
")",
"Labels",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
":=",
"new",
"(",
"Labels",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"*",
"out",
"\n",
"}"
]
|
20,127 | all-20128 | [
"NewOutgoingVenue",
"creates",
"a",
"new",
"outgoing",
"location",
"."
]
| [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingVenue",
"(",
"recipient",
"Recipient",
",",
"latitude",
",",
"longitude",
"float32",
",",
"title",
",",
"address",
"string",
")",
"*",
"OutgoingVenue",
"{",
"return",
"&",
"OutgoingVenue",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"Latitude",
":",
"latitude",
",",
"Longitude",
":",
"longitude",
",",
"Title",
":",
"<mask>",
",",
"Address",
":",
"address",
",",
"}",
"\n",
"}"
]
|
20,128 | all-20129 | [
"GoChild",
"is",
"like",
"Go",
"but",
"it",
"registers",
"the",
"returned",
"Process",
"as",
"a",
"child",
"of",
"parent",
"**",
"before",
"**",
"spawning",
"the",
"goroutine",
"which",
"ensures",
"proper",
"synchronization",
"with",
"parent",
".",
"It",
"is",
"somewhat",
"like",
"func",
"GoChild",
"(",
"parent",
"Process",
"f",
"ProcessFunc",
")",
"Process",
"{",
"p",
":",
"=",
"WithParent",
"(",
"parent",
")",
"p",
".",
"Go",
"(",
"f",
")",
"return",
"p",
"}",
"And",
"it",
"is",
"similar",
"to",
"the",
"classic",
"WaitGroup",
"use",
"case",
":",
"func",
"WaitGroupGo",
"(",
"wg",
"sync",
".",
"WaitGroup",
"child",
"func",
"()",
")",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"go",
"func",
"()",
"{",
"child",
"()",
"wg",
".",
"Done",
"()",
"}",
"()",
"}"
]
| [
"func",
"GoChild",
"(",
"parent",
"Process",
",",
"f",
"ProcessFunc",
")",
"Process",
"{",
"p",
":=",
"WithParent",
"(",
"<mask>",
")",
"\n",
"p",
".",
"Go",
"(",
"f",
")",
"\n",
"return",
"p",
"\n",
"}"
]
|
20,129 | all-20130 | [
"getIndex",
"returns",
"a",
"pointer",
"to",
"the",
"index",
"references",
"by",
"this",
"ociReference",
".",
"If",
"an",
"error",
"occurs",
"opening",
"an",
"index",
"nil",
"is",
"returned",
"together",
"with",
"an",
"error",
"."
]
| [
"func",
"(",
"ref",
"ociReference",
")",
"getIndex",
"(",
")",
"(",
"*",
"imgspecv1",
".",
"Index",
",",
"error",
")",
"{",
"indexJSON",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"ref",
".",
"indexPath",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"indexJSON",
".",
"Close",
"(",
")",
"\n\n",
"index",
":=",
"&",
"imgspecv1",
".",
"<mask>",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"indexJSON",
")",
".",
"Decode",
"(",
"index",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"index",
",",
"nil",
"\n",
"}"
]
|
20,130 | all-20131 | [
"PreviousIP",
"returns",
"the",
"previous",
"sequential",
"ip",
"."
]
| [
"func",
"PreviousIP",
"(",
"ip",
"net",
".",
"IP",
")",
"<mask>",
".",
"IP",
"{",
"return",
"NewNetworkNumber",
"(",
"ip",
")",
".",
"Previous",
"(",
")",
".",
"ToIP",
"(",
")",
"\n",
"}"
]
|
20,131 | all-20132 | [
"HasStatus",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"c",
"*",
"Check",
")",
"HasStatus",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"Status",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,132 | all-20133 | [
"example",
"input",
"M",
"/",
"/",
"testpool",
"/",
"bar",
"/",
"+",
"F",
"/",
"testpool",
"/",
"bar",
"/",
"hello",
".",
"txt",
"M",
"/",
"/",
"testpool",
"/",
"bar",
"/",
"hello",
".",
"txt",
"(",
"+",
"1",
")",
"M",
"/",
"/",
"testpool",
"/",
"bar",
"/",
"hello",
"-",
"hardlink"
]
| [
"func",
"parseInodeChanges",
"(",
"lines",
"[",
"]",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"InodeChange",
",",
"error",
")",
"{",
"changes",
":=",
"<mask>",
"(",
"[",
"]",
"*",
"InodeChange",
",",
"len",
"(",
"lines",
")",
")",
"\n\n",
"for",
"i",
",",
"line",
":=",
"range",
"lines",
"{",
"c",
",",
"err",
":=",
"parseInodeChange",
"(",
"line",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"err",
",",
"line",
")",
"\n",
"}",
"\n",
"changes",
"[",
"i",
"]",
"=",
"c",
"\n",
"}",
"\n",
"return",
"changes",
",",
"nil",
"\n",
"}"
]
|
20,133 | all-20134 | [
"Status",
"reports",
"the",
"following",
"statistics",
"of",
"the",
"cedar",
":",
"keys",
":",
"number",
"of",
"keys",
"that",
"are",
"in",
"the",
"cedar",
"nodes",
":",
"number",
"of",
"trie",
"nodes",
"(",
"slots",
"in",
"the",
"base",
"array",
")",
"has",
"been",
"taken",
"size",
":",
"the",
"size",
"of",
"the",
"base",
"array",
"used",
"by",
"the",
"cedar",
"capacity",
":",
"the",
"capicity",
"of",
"the",
"base",
"array",
"used",
"by",
"the",
"cedar",
"."
]
| [
"func",
"(",
"da",
"*",
"Cedar",
")",
"Status",
"(",
")",
"(",
"keys",
",",
"nodes",
",",
"size",
",",
"capacity",
"int",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"da",
".",
"Size",
";",
"i",
"++",
"{",
"n",
":=",
"da",
".",
"<mask>",
"[",
"i",
"]",
"\n",
"if",
"n",
".",
"Check",
">=",
"0",
"{",
"nodes",
"++",
"\n",
"if",
"n",
".",
"Value",
">=",
"0",
"{",
"keys",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"keys",
",",
"nodes",
",",
"da",
".",
"Size",
",",
"da",
".",
"Capacity",
"\n",
"}"
]
|
20,134 | all-20135 | [
"UnmarshalText",
"implements",
"the",
"TextUnmarshaler",
"interface",
"."
]
| [
"func",
"(",
"l",
"*",
"List",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"m",
":=",
"parse",
".",
"Bytes",
"(",
"text",
")",
"\n",
"defer",
"m",
".",
"Release",
"(",
")",
"\n",
"capacity",
":=",
"len",
"(",
"m",
".",
"List",
")",
"\n",
"if",
"len",
"(",
"m",
".",
"Text",
")",
"==",
"0",
"{",
"capacity",
"+=",
"2",
"\n",
"}",
"\n",
"list",
":=",
"make",
"(",
"List",
",",
"0",
",",
"capacity",
")",
"\n\n",
"if",
"len",
"(",
"m",
".",
"<mask>",
")",
">",
"0",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"\"",
"\"",
",",
"string",
"(",
"m",
".",
"Text",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"m",
".",
"List",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"string",
"(",
"v",
")",
")",
"\n",
"}",
"\n",
"*",
"l",
"=",
"list",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,135 | all-20136 | [
"stringMarkdownDash",
"-",
"output",
"dash",
"in",
"middle",
"of",
"table",
"."
]
| [
"func",
"(",
"t",
"*",
"Table",
")",
"stringMarkdownDash",
"(",
")",
"string",
"{",
"r",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"r",
"[",
"name",
"]",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"t",
".",
"fieldSizes",
"[",
"<mask>",
"]",
"-",
"2",
")",
"\n",
"}",
"\n",
"return",
"t",
".",
"rowString",
"(",
"r",
")",
"\n",
"}"
]
|
20,136 | all-20137 | [
"MoveBy",
"moves",
"the",
"sprite",
"by",
"(",
"x",
"y",
")",
"."
]
| [
"func",
"(",
"s",
"*",
"Sprite",
")",
"MoveBy",
"(",
"x",
",",
"y",
"int",
")",
"{",
"w",
",",
"h",
":=",
"s",
".",
"<mask>",
".",
"Size",
"(",
")",
"\n\n",
"s",
".",
"x",
"+=",
"x",
"\n",
"s",
".",
"y",
"+=",
"y",
"\n",
"if",
"s",
".",
"x",
"<",
"0",
"{",
"s",
".",
"x",
"=",
"0",
"\n",
"}",
"\n",
"if",
"s",
".",
"x",
">",
"screenWidth",
"-",
"w",
"{",
"s",
".",
"x",
"=",
"screenWidth",
"-",
"w",
"\n",
"}",
"\n",
"if",
"s",
".",
"y",
"<",
"0",
"{",
"s",
".",
"y",
"=",
"0",
"\n",
"}",
"\n",
"if",
"s",
".",
"y",
">",
"screenHeight",
"-",
"h",
"{",
"s",
".",
"y",
"=",
"screenHeight",
"-",
"h",
"\n",
"}",
"\n",
"}"
]
|
20,137 | all-20138 | [
"Do",
"executes",
"Emulation",
".",
"setEmitTouchEventsForMouse",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetEmitTouchEventsForMouseParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetEmitTouchEventsForMouse",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
20,138 | all-20139 | [
"***************************************************************************",
"\\",
"Basic",
"GUI",
"functions",
"*",
"\\",
"****************************************************************************",
"/",
"*",
"this",
"function",
"is",
"used",
"to",
"set",
"some",
"external",
"parameters",
"in",
"case",
"of",
"X",
"Window"
]
| [
"func",
"initSystem",
"(",
"args",
"[",
"]",
"string",
")",
"int",
"{",
"argc",
":=",
"C",
".",
"int",
"(",
"len",
"(",
"args",
")",
")",
"\n",
"argv",
":=",
"make",
"(",
"[",
"]",
"*",
"C",
".",
"<mask>",
",",
"len",
"(",
"args",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"args",
")",
";",
"i",
"++",
"{",
"argv",
"[",
"i",
"]",
"=",
"C",
".",
"CString",
"(",
"args",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"rv",
":=",
"C",
".",
"cvInitSystem",
"(",
"argc",
",",
"(",
"*",
"*",
"C",
".",
"char",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"argv",
")",
")",
")",
"\n",
"return",
"int",
"(",
"rv",
")",
"\n",
"}"
]
|
20,139 | all-20140 | [
"Aliases",
"returns",
"a",
"list",
"of",
"domain",
"aliases"
]
| [
"func",
"(",
"dom",
"Domain",
")",
"Aliases",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"vl",
"valueList",
"\n",
"err",
":=",
"dom",
".",
"cgp",
".",
"request",
"(",
"getDomainAliases",
"{",
"Domain",
":",
"dom",
".",
"<mask>",
"}",
",",
"&",
"vl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"vl",
".",
"compact",
"(",
")",
",",
"nil",
"\n",
"}"
]
|
20,140 | all-20141 | [
"SetBranch",
"sets",
"a",
"commit",
"and",
"its",
"ancestors",
"as",
"a",
"branch",
".",
"SetBranch",
"is",
"deprecated",
"in",
"favor",
"of",
"CommitBranch",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"SetBranch",
"(",
"repoName",
"string",
",",
"commit",
"string",
",",
"branch",
"string",
")",
"error",
"{",
"return",
"c",
".",
"CreateBranch",
"(",
"repoName",
",",
"branch",
",",
"<mask>",
",",
"nil",
")",
"\n",
"}"
]
|
20,141 | all-20142 | [
"authorizePipelineOp",
"checks",
"if",
"the",
"user",
"indicated",
"by",
"ctx",
"is",
"authorized",
"to",
"perform",
"operation",
"on",
"the",
"pipeline",
"in",
"info"
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"authorizePipelineOp",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"operation",
"pipelineOperation",
",",
"input",
"*",
"pps",
".",
"Input",
",",
"output",
"string",
")",
"error",
"{",
"ctx",
":=",
"pachClient",
".",
"Ctx",
"(",
")",
"\n",
"me",
",",
"err",
":=",
"pachClient",
".",
"WhoAmI",
"(",
"ctx",
",",
"&",
"auth",
".",
"WhoAmIRequest",
"{",
"}",
")",
"\n",
"if",
"auth",
".",
"IsErrNotActivated",
"(",
"err",
")",
"{",
"return",
"nil",
"// Auth isn't activated, skip authorization completely",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"input",
"!=",
"nil",
"{",
"// Check that the user is authorized to read all input repos, and write to the",
"// output repo (which the pipeline needs to be able to do on the user's",
"// behalf)",
"var",
"eg",
"errgroup",
".",
"Group",
"\n",
"done",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"// don't double-authorize repos",
"\n",
"pps",
".",
"VisitInput",
"(",
"input",
",",
"func",
"(",
"<mask>",
"*",
"pps",
".",
"Input",
")",
"{",
"var",
"repo",
"string",
"\n\n",
"if",
"in",
".",
"Pfs",
"!=",
"nil",
"{",
"repo",
"=",
"in",
".",
"Pfs",
".",
"Repo",
"\n",
"}",
"else",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"done",
"[",
"repo",
"]",
";",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"done",
"[",
"repo",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"pachClient",
".",
"Authorize",
"(",
"ctx",
",",
"&",
"auth",
".",
"AuthorizeRequest",
"{",
"Repo",
":",
"repo",
",",
"Scope",
":",
"auth",
".",
"Scope_READER",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"!",
"resp",
".",
"Authorized",
"{",
"return",
"&",
"auth",
".",
"ErrNotAuthorized",
"{",
"Subject",
":",
"me",
".",
"Username",
",",
"Repo",
":",
"repo",
",",
"Required",
":",
"auth",
".",
"Scope_READER",
",",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
":=",
"eg",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Check that the user is authorized to write to the output repo.",
"// Note: authorizePipelineOp is called before CreateRepo creates a",
"// PipelineInfo proto in etcd, so PipelineManager won't have created an output",
"// repo yet, and it's possible to check that the output repo doesn't exist",
"// (if it did exist, we'd have to check that the user has permission to write",
"// to it, and this is simpler)",
"var",
"required",
"auth",
".",
"Scope",
"\n",
"switch",
"operation",
"{",
"case",
"pipelineOpCreate",
":",
"if",
"_",
",",
"err",
":=",
"pachClient",
".",
"InspectRepo",
"(",
"output",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"output",
")",
"\n",
"}",
"else",
"if",
"!",
"isNotFoundErr",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"pipelineOpListDatum",
",",
"pipelineOpGetLogs",
":",
"required",
"=",
"auth",
".",
"Scope_READER",
"\n",
"case",
"pipelineOpUpdate",
":",
"required",
"=",
"auth",
".",
"Scope_WRITER",
"\n",
"case",
"pipelineOpDelete",
":",
"required",
"=",
"auth",
".",
"Scope_OWNER",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"operation",
")",
"\n",
"}",
"\n",
"if",
"required",
"!=",
"auth",
".",
"Scope_NONE",
"{",
"resp",
",",
"err",
":=",
"pachClient",
".",
"Authorize",
"(",
"ctx",
",",
"&",
"auth",
".",
"AuthorizeRequest",
"{",
"Repo",
":",
"output",
",",
"Scope",
":",
"required",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"!",
"resp",
".",
"Authorized",
"{",
"return",
"&",
"auth",
".",
"ErrNotAuthorized",
"{",
"Subject",
":",
"me",
".",
"Username",
",",
"Repo",
":",
"output",
",",
"Required",
":",
"required",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
20,142 | all-20143 | [
"Index",
"retrieves",
"the",
"current",
"index",
"of",
"the",
"store",
"."
]
| [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Index",
"(",
")",
"uint64",
"{",
"s",
".",
"worldLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"worldLock",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
".",
"CurrentIndex",
"\n",
"}"
]
|
20,143 | all-20144 | [
"newWatchHub",
"creates",
"a",
"watcherHub",
".",
"The",
"capacity",
"determines",
"how",
"many",
"events",
"we",
"will",
"keep",
"in",
"the",
"eventHistory",
".",
"Typically",
"we",
"only",
"need",
"to",
"keep",
"a",
"small",
"size",
"of",
"history",
"[",
"smaller",
"than",
"20K",
"]",
".",
"Ideally",
"it",
"should",
"smaller",
"than",
"20K",
"/",
"s",
"[",
"max",
"throughput",
"]",
"*",
"2",
"*",
"50ms",
"[",
"RTT",
"]",
"=",
"2000"
]
| [
"func",
"newWatchHub",
"(",
"capacity",
"int",
")",
"*",
"watcherHub",
"{",
"return",
"&",
"watcherHub",
"{",
"watchers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"list",
".",
"List",
")",
",",
"EventHistory",
":",
"newEventHistory",
"(",
"<mask>",
")",
",",
"}",
"\n",
"}"
]
|
20,144 | all-20145 | [
"Infof",
"logging"
]
| [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Infof",
"(",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"logfFunc",
"(",
"InfoLevel",
",",
"l",
".",
"context",
",",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
]
|
20,145 | all-20146 | [
"FileChooserButtonNew",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_button_new",
"()",
"."
]
| [
"func",
"FileChooserButtonNew",
"(",
"title",
"string",
",",
"<mask>",
"FileChooserAction",
")",
"(",
"*",
"FileChooserButton",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_file_chooser_button_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"(",
"C",
".",
"GtkFileChooserAction",
")",
"(",
"action",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapFileChooserButton",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
]
|
20,146 | all-20147 | [
"Receive",
"accepts",
"a",
"Dependency",
"and",
"data",
"for",
"that",
"dep",
".",
"This",
"data",
"is",
"cached",
"on",
"the",
"Runner",
".",
"This",
"data",
"is",
"then",
"used",
"to",
"determine",
"if",
"a",
"Template",
"is",
"renderable",
"(",
"i",
".",
"e",
".",
"all",
"its",
"Dependencies",
"have",
"been",
"downloaded",
"at",
"least",
"once",
")",
"."
]
| [
"func",
"(",
"r",
"*",
"Runner",
")",
"Receive",
"(",
"d",
"dep",
".",
"Dependency",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"r",
".",
"dependenciesLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"dependenciesLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Just because we received data, it does not mean that we are actually",
"// watching for that data. How is that possible you may ask? Well, this",
"// Runner's data channel is pooled, meaning it accepts multiple data views",
"// before actually blocking. Whilest this runner is performing a Run() and",
"// executing diffs, it may be possible that more data was pushed onto the",
"// data channel pool for a dependency that we no longer care about.",
"//",
"// Accepting this dependency would introduce stale data into the brain, and",
"// that is simply unacceptable. In fact, it is a fun little bug:",
"//",
"// https://github.com/hashicorp/consul-template/issues/198",
"//",
"// and by \"little\" bug, I mean really big bug.",
"if",
"_",
",",
"<mask>",
":=",
"r",
".",
"dependencies",
"[",
"d",
".",
"String",
"(",
")",
"]",
";",
"ok",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"r",
".",
"brain",
".",
"Remember",
"(",
"d",
",",
"data",
")",
"\n",
"}",
"\n",
"}"
]
|
20,147 | all-20148 | [
"DeleteSeries",
"implements",
"pb",
".",
"AdminServer",
"."
]
| [
"func",
"(",
"s",
"*",
"AdminDisabled",
")",
"DeleteSeries",
"(",
"_",
"context",
".",
"Context",
",",
"r",
"*",
"pb",
".",
"SeriesDeleteRequest",
")",
"(",
"*",
"<mask>",
".",
"SeriesDeleteResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"errAdminDisabled",
"\n",
"}"
]
|
20,148 | all-20149 | [
"RemoveKeyUsingFile",
"removes",
"an",
"existing",
"key",
"from",
"keyring",
"given",
"a",
"file"
]
| [
"func",
"(",
"k",
"*",
"Keyring",
")",
"RemoveKeyUsingFile",
"(",
"pubkey",
"string",
")",
"error",
"{",
"p",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"pubkey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"key",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
":=",
"ssh",
".",
"ParseAuthorizedKey",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"k",
".",
"RemoveKey",
"(",
"<mask>",
")",
"\n",
"}"
]
|
20,149 | all-20150 | [
"newSequentialKV",
"allocates",
"a",
"new",
"sequential",
"key",
"<prefix",
">",
"/",
"nnnnn",
"with",
"a",
"given",
"prefix",
"and",
"value",
".",
"Note",
":",
"a",
"bookkeeping",
"node",
"__<prefix",
">",
"is",
"also",
"allocated",
"."
]
| [
"func",
"newSequentialKV",
"(",
"kv",
"v3",
".",
"KV",
",",
"prefix",
",",
"val",
"string",
")",
"(",
"*",
"RemoteKV",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"kv",
".",
"Get",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"prefix",
",",
"v3",
".",
"WithLastKey",
"(",
")",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// add 1 to last key, if any",
"newSeqNum",
":=",
"0",
"\n",
"if",
"len",
"(",
"resp",
".",
"Kvs",
")",
"!=",
"0",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"resp",
".",
"Kvs",
"[",
"0",
"]",
".",
"Key",
")",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"serr",
":=",
"fmt",
".",
"Sscanf",
"(",
"fields",
"[",
"len",
"(",
"fields",
")",
"-",
"1",
"]",
",",
"\"",
"\"",
",",
"&",
"newSeqNum",
")",
"\n",
"if",
"serr",
"!=",
"nil",
"{",
"return",
"nil",
",",
"serr",
"\n",
"}",
"\n",
"newSeqNum",
"++",
"\n",
"}",
"\n",
"newKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"newSeqNum",
")",
"\n\n",
"// base prefix key must be current (i.e., <=) with the server update;",
"// the base key is important to avoid the following:",
"// N1: LastKey() == 1, start txn.",
"// N2: new Key 2, new Key 3, Delete Key 2",
"// N1: txn succeeds allocating key 2 when it shouldn't",
"baseKey",
":=",
"\"",
"\"",
"+",
"prefix",
"\n\n",
"// current revision might contain modification so +1",
"cmp",
":=",
"v3",
".",
"Compare",
"(",
"v3",
".",
"ModRevision",
"(",
"baseKey",
")",
",",
"\"",
"\"",
",",
"resp",
".",
"Header",
".",
"Revision",
"+",
"1",
")",
"\n",
"reqPrefix",
":=",
"v3",
".",
"OpPut",
"(",
"baseKey",
",",
"\"",
"\"",
")",
"\n",
"reqnewKey",
":=",
"v3",
".",
"OpPut",
"(",
"newKey",
",",
"val",
")",
"\n\n",
"txn",
":=",
"kv",
".",
"Txn",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"txnresp",
",",
"err",
":=",
"txn",
".",
"If",
"(",
"cmp",
")",
".",
"Then",
"(",
"reqPrefix",
",",
"reqnewKey",
")",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"txnresp",
".",
"Succeeded",
"{",
"return",
"newSequentialKV",
"(",
"kv",
",",
"prefix",
",",
"val",
")",
"\n",
"}",
"\n",
"return",
"&",
"RemoteKV",
"{",
"kv",
",",
"newKey",
",",
"txnresp",
".",
"Header",
".",
"Revision",
",",
"val",
"}",
",",
"nil",
"\n",
"}"
]
|
20,150 | all-20151 | [
"SetHost",
"sets",
"Host",
"header",
"value",
"."
]
| [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"SetHost",
"(",
"<mask>",
"string",
")",
"{",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n",
"h",
".",
"host",
"=",
"append",
"(",
"h",
".",
"host",
"[",
":",
"0",
"]",
",",
"host",
"...",
")",
"\n",
"}"
]
|
20,151 | all-20152 | [
"ShouldRun",
"returns",
"true",
"if",
"the",
"input",
"branch",
"matches",
"given",
"the",
"whitelist",
"/",
"blacklist",
"."
]
| [
"func",
"(",
"br",
"Brancher",
")",
"ShouldRun",
"(",
"branch",
"string",
")",
"bool",
"{",
"if",
"br",
".",
"RunsAgainstAllBranch",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// Favor SkipBranches over Branches",
"if",
"len",
"(",
"br",
".",
"SkipBranches",
")",
"!=",
"0",
"&&",
"br",
".",
"reSkip",
".",
"MatchString",
"(",
"branch",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"len",
"(",
"br",
".",
"Branches",
")",
"==",
"0",
"||",
"<mask>",
".",
"re",
".",
"MatchString",
"(",
"branch",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
20,152 | all-20153 | [
"specify",
"storage",
"for",
"a",
"two",
"-",
"dimensional",
"multisample",
"texture"
]
| [
"func",
"TextureStorage2DMultisample",
"(",
"texture",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"<mask>",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTextureStorage2DMultisample",
",",
"6",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"samples",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"boolToUintptr",
"(",
"fixedsamplelocations",
")",
")",
"\n",
"}"
]
|
20,153 | all-20154 | [
"title",
":",
"remove",
"pool",
"path",
":",
"/",
"pools",
"/",
"{",
"name",
"}",
"method",
":",
"DELETE",
"responses",
":",
"200",
":",
"Pool",
"removed",
"401",
":",
"Unauthorized",
"403",
":",
"Pool",
"still",
"has",
"apps",
"404",
":",
"Pool",
"not",
"found"
]
| [
"func",
"removePoolHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPoolDelete",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"poolName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"filter",
":=",
"&",
"app",
".",
"Filter",
"{",
"}",
"\n",
"filter",
".",
"Pool",
"=",
"poolName",
"\n",
"apps",
",",
"err",
":=",
"app",
".",
"List",
"(",
"appFilterByContext",
"(",
"[",
"]",
"permTypes",
".",
"PermissionContext",
"{",
"}",
",",
"filter",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"apps",
")",
">",
"0",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"<mask>",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"poolName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPoolDelete",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"poolName",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"pool",
".",
"RemovePool",
"(",
"poolName",
")",
"\n",
"if",
"err",
"==",
"pool",
".",
"ErrPoolNotFound",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,154 | all-20155 | [
"UpdateRepo",
"returns",
"an",
"object",
"describing",
"a",
"repository",
"at",
"the",
"most",
"recent",
"commit",
"or",
"version",
"tag",
".",
"This",
"function",
"uses",
"RemoteCache",
"to",
"retrieve",
"information",
"about",
"the",
"repository",
".",
"Depending",
"on",
"how",
"the",
"RemoteCache",
"was",
"initialized",
"and",
"used",
"earlier",
"some",
"information",
"may",
"already",
"be",
"locally",
"available",
".",
"Frequently",
"though",
"information",
"will",
"be",
"fetched",
"over",
"the",
"network",
"so",
"this",
"function",
"may",
"be",
"slow",
"."
]
| [
"func",
"UpdateRepo",
"(",
"rc",
"*",
"RemoteCache",
",",
"importPath",
"string",
")",
"(",
"Repo",
",",
"error",
")",
"{",
"root",
",",
"name",
",",
"err",
":=",
"rc",
".",
"Root",
"(",
"importPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Repo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"remote",
",",
"vcs",
",",
"err",
":=",
"rc",
".",
"Remote",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Repo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"commit",
",",
"tag",
",",
"err",
":=",
"rc",
".",
"Head",
"(",
"remote",
",",
"vcs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Repo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"repo",
":=",
"Repo",
"{",
"Name",
":",
"name",
",",
"GoPrefix",
":",
"root",
",",
"Commit",
":",
"commit",
",",
"Tag",
":",
"tag",
",",
"Remote",
":",
"<mask>",
",",
"VCS",
":",
"vcs",
",",
"}",
"\n",
"return",
"repo",
",",
"nil",
"\n",
"}"
]
|
20,155 | all-20156 | [
"StoragePoolNodeVolumeGetTypeID",
"get",
"the",
"ID",
"of",
"a",
"storage",
"volume",
"on",
"a",
"given",
"storage",
"pool",
"of",
"a",
"given",
"storage",
"volume",
"type",
"on",
"the",
"current",
"node",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolNodeVolumeGetTypeID",
"(",
"volumeName",
"<mask>",
",",
"volumeType",
"int",
",",
"poolID",
"int64",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"c",
".",
"StoragePoolVolumeGetTypeID",
"(",
"\"",
"\"",
",",
"volumeName",
",",
"volumeType",
",",
"poolID",
",",
"c",
".",
"nodeID",
")",
"\n",
"}"
]
|
20,156 | all-20157 | [
"topJobsFailed",
"returns",
"the",
"top",
"count",
"job",
"names",
"sorted",
"by",
"number",
"of",
"failing",
"builds",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"topJobsFailed",
"(",
"count",
"int",
")",
"[",
"]",
"*",
"Job",
"{",
"slice",
":=",
"make",
"(",
"[",
"]",
"*",
"Job",
",",
"len",
"(",
"c",
".",
"jobs",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"jobName",
",",
"builds",
":=",
"range",
"c",
".",
"<mask>",
"{",
"slice",
"[",
"i",
"]",
"=",
"&",
"Job",
"{",
"Name",
":",
"jobName",
",",
"Builds",
":",
"builds",
"}",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"less",
":=",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"len",
"(",
"slice",
"[",
"i",
"]",
".",
"Builds",
")",
">",
"len",
"(",
"slice",
"[",
"j",
"]",
".",
"Builds",
")",
"}",
"\n",
"sort",
".",
"SliceStable",
"(",
"slice",
",",
"less",
")",
"\n\n",
"if",
"len",
"(",
"slice",
")",
"<",
"count",
"{",
"count",
"=",
"len",
"(",
"slice",
")",
"\n",
"}",
"\n",
"return",
"slice",
"[",
"0",
":",
"count",
"]",
"\n",
"}"
]
|
20,157 | all-20158 | [
"TODO",
"(",
"jrick",
")",
"GdkRectangle",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"GetIconArea",
"()",
"{",
"}",
"SetInputPurpose",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_input_purpose",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetInputPurpose",
"(",
"purpose",
"InputPurpose",
")",
"{",
"C",
".",
"gtk_entry_set_input_purpose",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkInputPurpose",
"(",
"purpose",
")",
")",
"\n",
"}"
]
|
20,158 | all-20159 | [
"NewListener",
"creates",
"a",
"Listener",
"which",
"accepts",
"connections",
"from",
"an",
"inner",
"Listener",
"and",
"wraps",
"each",
"connection",
"with",
"Server",
".",
"The",
"configuration",
"config",
"must",
"be",
"non",
"-",
"nil",
"and",
"must",
"have",
"at",
"least",
"one",
"certificate",
"."
]
| [
"func",
"newTLSKeepaliveListener",
"(",
"inner",
"net",
".",
"Listener",
",",
"config",
"*",
"tls",
".",
"Config",
")",
"<mask>",
".",
"Listener",
"{",
"l",
":=",
"&",
"tlsKeepaliveListener",
"{",
"}",
"\n",
"l",
".",
"Listener",
"=",
"inner",
"\n",
"l",
".",
"config",
"=",
"config",
"\n",
"return",
"l",
"\n",
"}"
]
|
20,159 | all-20160 | [
"Write",
"serializes",
"the",
"frame",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Frame",
"interface",
"."
]
| [
"func",
"(",
"m",
"Message",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"writeFrameHeader",
"(",
"w",
",",
"FrameTypeMessage",
",",
"len",
"(",
"m",
".",
"Body",
")",
"+",
"26",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"binary",
".",
"Write",
"(",
"w",
",",
"binary",
".",
"BigEndian",
",",
"m",
".",
"Timestamp",
".",
"UnixNano",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"binary",
".",
"Write",
"(",
"w",
",",
"binary",
".",
"BigEndian",
",",
"m",
".",
"Attempts",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"m",
".",
"ID",
".",
"WriteTo",
"(",
"w",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"m",
".",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
20,160 | all-20161 | [
"SetUintBytes",
"sets",
"uint",
"value",
"for",
"the",
"given",
"key",
"."
]
| [
"func",
"(",
"a",
"*",
"Args",
")",
"SetUintBytes",
"(",
"key",
"[",
"]",
"byte",
",",
"<mask>",
"int",
")",
"{",
"a",
".",
"SetUint",
"(",
"b2s",
"(",
"key",
")",
",",
"value",
")",
"\n",
"}"
]
|
20,161 | all-20162 | [
"define",
"the",
"scissor",
"box"
]
| [
"func",
"Scissor",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"<mask>",
"int32",
")",
"{",
"C",
".",
"glowScissor",
"(",
"gpScissor",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
]
|
20,162 | all-20163 | [
"<closure",
"-",
"type",
"-",
"name",
">",
"::",
"=",
"Ul",
"<lambda",
"-",
"sig",
">",
"E",
"[",
"<nonnegative",
"number",
">",
"]",
"_"
]
| [
"func",
"(",
"st",
"*",
"state",
")",
"closureTypeName",
"(",
")",
"AST",
"{",
"st",
".",
"checkChar",
"(",
"'U'",
")",
"\n",
"st",
".",
"checkChar",
"(",
"'l'",
")",
"\n",
"<mask>",
":=",
"st",
".",
"parmlist",
"(",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'E'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"num",
":=",
"st",
".",
"compactNumber",
"(",
")",
"\n",
"ret",
":=",
"&",
"Closure",
"{",
"Types",
":",
"types",
",",
"Num",
":",
"num",
"}",
"\n",
"st",
".",
"subs",
".",
"add",
"(",
"ret",
")",
"\n",
"return",
"ret",
"\n",
"}"
]
|
20,163 | all-20164 | [
"Things",
"we",
"do",
"have",
"to",
"care",
"about"
]
| [
"func",
"(",
"s",
"*",
"storageZfs",
")",
"ContainerStorageReady",
"(",
"container",
"container",
")",
"bool",
"{",
"volumeName",
":=",
"projectPrefix",
"(",
"container",
".",
"Project",
"(",
")",
",",
"container",
".",
"<mask>",
"(",
")",
")",
"\n",
"fs",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"volumeName",
")",
"\n",
"return",
"zfsFilesystemEntityExists",
"(",
"s",
".",
"getOnDiskPoolName",
"(",
")",
",",
"fs",
")",
"\n",
"}"
]
|
20,164 | all-20165 | [
"Location",
"related",
"functions",
"and",
"methods",
"Create",
"a",
"Location"
]
| [
"func",
"NewLocation",
"(",
"host",
"uuid",
".",
"UUID",
",",
"lp",
"Profile",
")",
"(",
"*",
"Location",
",",
"error",
")",
"{",
"l",
":=",
"new",
"(",
"Location",
")",
"\n",
"l",
".",
"UUID",
",",
"_",
"=",
"uuid",
".",
"V4",
"(",
")",
"\n",
"l",
".",
"Active",
"=",
"true",
"\n",
"l",
".",
"Host",
"=",
"host",
"\n",
"if",
"err",
":=",
"mergo",
".",
"MergeWithOverwrite",
"(",
"&",
"l",
".",
"Profile",
",",
"lp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"err",
".",
"Error",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"Store",
"(",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"err",
".",
"Error",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"l",
",",
"nil",
"\n",
"}"
]
|
20,165 | all-20166 | [
"Accept",
"implements",
"the",
"corresponding",
"method",
"of",
"net",
".",
"Listener",
"for",
"TestListener"
]
| [
"func",
"(",
"l",
"*",
"TestListener",
")",
"Accept",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"<mask>",
":=",
"<-",
"l",
".",
"connCh",
"\n",
"if",
"conn",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"conn",
",",
"nil",
"\n",
"}"
]
|
20,166 | all-20167 | [
"getAuthConfigFromECR",
"calls",
"the",
"ECR",
"API",
"to",
"get",
"docker",
"auth",
"config"
]
| [
"func",
"(",
"authProvider",
"*",
"ecrAuthProvider",
")",
"getAuthConfigFromECR",
"(",
"image",
"string",
",",
"key",
"cacheKey",
",",
"authData",
"*",
"apicontainer",
".",
"ECRAuthData",
")",
"(",
"types",
".",
"AuthConfig",
",",
"error",
")",
"{",
"// Create ECR client to get the token",
"client",
",",
"err",
":=",
"authProvider",
".",
"factory",
".",
"GetClient",
"(",
"authData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"AuthConfig",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"image",
")",
"\n",
"ecrAuthData",
",",
"err",
":=",
"<mask>",
".",
"GetAuthorizationToken",
"(",
"authData",
".",
"RegistryID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"AuthConfig",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"if",
"ecrAuthData",
"==",
"nil",
"{",
"return",
"types",
".",
"AuthConfig",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"image",
")",
"\n",
"}",
"\n\n",
"// Verify the auth data has the correct format for ECR",
"if",
"ecrAuthData",
".",
"ProxyEndpoint",
"!=",
"nil",
"&&",
"strings",
".",
"HasPrefix",
"(",
"proxyEndpointScheme",
"+",
"image",
",",
"aws",
".",
"StringValue",
"(",
"ecrAuthData",
".",
"ProxyEndpoint",
")",
")",
"&&",
"ecrAuthData",
".",
"AuthorizationToken",
"!=",
"nil",
"{",
"// Cache the new token",
"authProvider",
".",
"tokenCache",
".",
"Set",
"(",
"key",
".",
"String",
"(",
")",
",",
"ecrAuthData",
")",
"\n",
"return",
"extractToken",
"(",
"ecrAuthData",
")",
"\n",
"}",
"\n",
"return",
"types",
".",
"AuthConfig",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"image",
")",
"\n",
"}"
]
|
20,167 | all-20168 | [
"Create",
"the",
"schema",
"table",
"."
]
| [
"func",
"createSchemaTable",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"statement",
":=",
"`\nCREATE TABLE schema (\n id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n version INTEGER NOT NULL,\n updated_at DATETIME NOT NULL,\n UNIQUE (version)\n)\n`",
"\n",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"<mask>",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
20,168 | all-20169 | [
"heartbeat",
"loop",
"triggered",
"by",
"the",
"mainLoop"
]
| [
"func",
"(",
"c",
"*",
"Consumer",
")",
"hbLoop",
"(",
"stopped",
"<-",
"chan",
"none",
")",
"{",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"c",
".",
"client",
".",
"config",
".",
"Group",
".",
"Heartbeat",
".",
"Interval",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ticker",
".",
"C",
":",
"switch",
"err",
":=",
"c",
".",
"heartbeat",
"(",
")",
";",
"err",
"{",
"case",
"nil",
",",
"sarama",
".",
"ErrNoError",
":",
"case",
"sarama",
".",
"ErrNotCoordinatorForConsumer",
",",
"sarama",
".",
"ErrRebalanceInProgress",
":",
"return",
"\n",
"default",
":",
"c",
".",
"handleError",
"(",
"&",
"<mask>",
"{",
"Ctx",
":",
"\"",
"\"",
",",
"error",
":",
"err",
"}",
")",
"\n",
"return",
"\n",
"}",
"\n",
"case",
"<-",
"stopped",
":",
"return",
"\n",
"case",
"<-",
"c",
".",
"dying",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
20,169 | all-20170 | [
"requiresASMSecret",
"returns",
"true",
"if",
"at",
"least",
"one",
"container",
"in",
"the",
"task",
"needs",
"to",
"retrieve",
"secret",
"from",
"AWS",
"Secrets",
"Manager"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"requiresASMSecret",
"(",
")",
"bool",
"{",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"if",
"container",
".",
"ShouldCreateWithASMSecret",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,170 | all-20171 | [
"SetSyncTimeout",
"sets",
"the",
"amount",
"of",
"time",
"an",
"operation",
"with",
"this",
"session",
"will",
"wait",
"before",
"returning",
"an",
"error",
"in",
"case",
"a",
"connection",
"to",
"a",
"usable",
"server",
"can",
"t",
"be",
"established",
".",
"Set",
"it",
"to",
"zero",
"to",
"wait",
"forever",
".",
"The",
"default",
"value",
"is",
"7",
"seconds",
"."
]
| [
"func",
"(",
"s",
"*",
"Session",
")",
"SetSyncTimeout",
"(",
"d",
"<mask>",
".",
"Duration",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"syncTimeout",
"=",
"d",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
20,171 | all-20172 | [
"parseSecurityRuleProtocol",
"parses",
"a",
"protocol",
"string",
"into",
"a",
"network",
".",
"SecurityRuleProtocol",
"and",
"returns",
"error",
"if",
"the",
"protocol",
"is",
"not",
"supported"
]
| [
"func",
"parseSecurityRuleProtocol",
"(",
"proto",
"string",
")",
"(",
"network",
".",
"SecurityRuleProtocol",
",",
"error",
")",
"{",
"<mask>",
"strings",
".",
"ToLower",
"(",
"proto",
")",
"{",
"case",
"\"",
"\"",
":",
"return",
"network",
".",
"TCP",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"network",
".",
"UDP",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"network",
".",
"Asterisk",
",",
"nil",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"proto",
")",
"\n",
"}",
"\n",
"}"
]
|
20,172 | all-20173 | [
"Push",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_statusbar_push",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Statusbar",
")",
"Push",
"(",
"contextID",
"uint",
",",
"text",
"string",
")",
"uint",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_statusbar_push",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"contextID",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"return",
"uint",
"(",
"c",
")",
"\n",
"}"
]
|
20,173 | all-20174 | [
"String",
"is",
"required",
"for",
"kingpin",
"to",
"generate",
"usage",
"with",
"this",
"datatype"
]
| [
"func",
"(",
"o",
"BoolOption",
")",
"String",
"(",
")",
"string",
"{",
"if",
"StringifyValue",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"o",
".",
"Value",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"o",
".",
"Source",
",",
"o",
".",
"Defined",
",",
"o",
".",
"<mask>",
")",
"\n",
"}"
]
|
20,174 | all-20175 | [
"ExpandPath",
"returns",
"working",
"directory",
"path"
]
| [
"func",
"ExpandPath",
"(",
"path",
"string",
")",
"string",
"{",
"switch",
"path",
"{",
"case",
"\"",
"\"",
":",
"wd",
",",
"err",
":=",
"os",
".",
"Getwd",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"path",
"=",
"wd",
"\n",
"case",
"\"",
"\"",
":",
"homeVar",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"homeVar",
"==",
"\"",
"\"",
"{",
"homeUser",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"path",
"=",
"homeUser",
".",
"HomeDir",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,175 | all-20176 | [
"HasTime",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"e",
"*",
"Event",
")",
"HasTime",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Time",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
20,176 | all-20177 | [
"SuspendChannel",
"tries",
"to",
"suspend",
"a",
"given",
"channel",
"."
]
| [
"func",
"(",
"p",
"*",
"Processor",
")",
"SuspendChannel",
"(",
"id",
",",
"jobCreator",
"string",
",",
"agent",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"jobType",
"string",
"\n",
"if",
"agent",
"{",
"jobType",
"=",
"data",
".",
"JobAgentPreServiceSuspend",
"\n",
"}",
"else",
"{",
"jobType",
"=",
"<mask>",
".",
"JobClientPreServiceSuspend",
"\n",
"}",
"\n\n",
"return",
"p",
".",
"alterServiceStatus",
"(",
"id",
",",
"jobCreator",
",",
"jobType",
",",
"\"",
"\"",
",",
"suspendTransitions",
",",
"false",
")",
"\n",
"}"
]
|
20,177 | all-20178 | [
"repeatingKeyPressed",
"return",
"true",
"when",
"key",
"is",
"pressed",
"considering",
"the",
"repeat",
"state",
"."
]
| [
"func",
"repeatingKeyPressed",
"(",
"<mask>",
"ebiten",
".",
"Key",
")",
"bool",
"{",
"const",
"(",
"delay",
"=",
"30",
"\n",
"interval",
"=",
"3",
"\n",
")",
"\n",
"d",
":=",
"inpututil",
".",
"KeyPressDuration",
"(",
"key",
")",
"\n",
"if",
"d",
"==",
"1",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"d",
">=",
"delay",
"&&",
"(",
"d",
"-",
"delay",
")",
"%",
"interval",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
20,178 | all-20179 | [
"Do",
"executes",
"CacheStorage",
".",
"requestEntries",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"cacheDataEntries",
"-",
"Array",
"of",
"object",
"store",
"data",
"entries",
".",
"returnCount",
"-",
"Count",
"of",
"returned",
"entries",
"from",
"this",
"storage",
".",
"If",
"pathFilter",
"is",
"empty",
"it",
"is",
"the",
"count",
"of",
"all",
"entries",
"from",
"this",
"storage",
"."
]
| [
"func",
"(",
"p",
"*",
"RequestEntriesParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"cacheDataEntries",
"[",
"]",
"*",
"DataEntry",
",",
"returnCount",
"float64",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"RequestEntriesReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRequestEntries",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"CacheDataEntries",
",",
"res",
".",
"ReturnCount",
",",
"nil",
"\n",
"}"
]
|
20,179 | all-20180 | [
"Noticef",
"logs",
"provided",
"message",
"with",
"formatting",
"in",
"NOTICE",
"level",
"."
]
| [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Noticef",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"<mask>",
"(",
"NOTICE",
",",
"format",
",",
"a",
"...",
")",
"\n",
"}"
]
|
20,180 | all-20181 | [
"Walk",
"executes",
"a",
"callback",
"against",
"every",
"node",
"in",
"the",
"subtree",
"of",
"path",
"."
]
| [
"func",
"Walk",
"(",
"rs",
"[",
"]",
"io",
".",
"ReadCloser",
",",
"walkPath",
"string",
",",
"f",
"func",
"(",
"path",
"string",
",",
"node",
"*",
"NodeProto",
")",
"error",
")",
"error",
"{",
"walkPath",
"=",
"clean",
"(",
"walkPath",
")",
"\n",
"return",
"nodes",
"(",
"rs",
",",
"func",
"(",
"path",
"string",
",",
"node",
"*",
"NodeProto",
")",
"error",
"{",
"if",
"path",
"==",
"\"",
"\"",
"{",
"path",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"path",
"!=",
"walkPath",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"path",
",",
"walkPath",
"+",
"\"",
"\"",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
"<mask>",
",",
"node",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"errutil",
".",
"ErrBreak",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
]
|
20,181 | all-20182 | [
"GetLabelAlign",
"is",
"a",
"wrapper",
"around",
"gtk_frame_get_label_align",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Frame",
")",
"GetLabelAlign",
"(",
")",
"(",
"xAlign",
",",
"yAlign",
"float32",
")",
"{",
"<mask>",
"x",
",",
"y",
"C",
".",
"gfloat",
"\n",
"C",
".",
"gtk_frame_get_label_align",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"x",
",",
"&",
"y",
")",
"\n",
"return",
"float32",
"(",
"x",
")",
",",
"float32",
"(",
"y",
")",
"\n",
"}"
]
|
20,182 | all-20183 | [
"watchGC",
"watches",
"for",
"GC",
"runs",
"and",
"invalidate",
"all",
"cache",
"when",
"GC",
"happens",
"."
]
| [
"func",
"(",
"s",
"*",
"objBlockAPIServer",
")",
"watchGC",
"(",
"etcdAddress",
"string",
")",
"{",
"b",
":=",
"backoff",
".",
"NewInfiniteBackOff",
"(",
")",
"\n",
"backoff",
".",
"RetryNotify",
"(",
"func",
"(",
")",
"error",
"{",
"etcdClient",
",",
"err",
":=",
"etcd",
".",
"New",
"(",
"etcd",
".",
"Config",
"{",
"Endpoints",
":",
"[",
"]",
"string",
"{",
"etcdAddress",
"}",
",",
"DialOptions",
":",
"client",
".",
"DefaultDialOptions",
"(",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"watcher",
",",
"err",
":=",
"watch",
".",
"NewWatcher",
"(",
"context",
".",
"Background",
"(",
")",
",",
"etcdClient",
",",
"\"",
"\"",
",",
"client",
".",
"GCGenerationKey",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"watcher",
".",
"Close",
"(",
")",
"\n\n",
"for",
"{",
"ev",
",",
"<mask>",
":=",
"<-",
"watcher",
".",
"Watch",
"(",
")",
"\n",
"if",
"ev",
".",
"Err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ev",
".",
"Err",
")",
"\n",
"}",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"newGen",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"string",
"(",
"ev",
".",
"Value",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"s",
".",
"setGeneration",
"(",
"newGen",
")",
"\n",
"}",
"\n",
"}",
",",
"b",
",",
"func",
"(",
"err",
"error",
",",
"d",
"time",
".",
"Duration",
")",
"error",
"{",
"logrus",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"d",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
]
|
20,183 | all-20184 | [
"PolicyConfigurationNamespaces",
"returns",
"a",
"list",
"of",
"other",
"policy",
"configuration",
"namespaces",
"to",
"search",
"for",
"if",
"explicit",
"configuration",
"for",
"PolicyConfigurationIdentity",
"()",
"is",
"not",
"set"
]
| [
"func",
"(",
"<mask>",
"ociArchiveReference",
")",
"PolicyConfigurationNamespaces",
"(",
")",
"[",
"]",
"string",
"{",
"res",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"path",
":=",
"ref",
".",
"resolvedFile",
"\n",
"for",
"{",
"lastSlash",
":=",
"strings",
".",
"LastIndex",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"// Note that we do not include \"/\"; it is redundant with the default \"\" global default,",
"// and rejected by ociTransport.ValidatePolicyConfigurationScope above.",
"if",
"lastSlash",
"==",
"-",
"1",
"||",
"path",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"path",
")",
"\n",
"path",
"=",
"path",
"[",
":",
"lastSlash",
"]",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
20,184 | all-20185 | [
"Read",
"downloads",
"the",
"specified",
"Release",
"to",
"the",
"local",
"cache",
"dir",
"and",
"returns",
"a",
"reader",
"to",
"the",
"underyling",
"release",
"package",
"."
]
| [
"func",
"(",
"r",
"*",
"Release",
")",
"Read",
"(",
"releaseLocation",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"r",
".",
"Pull",
"(",
"releaseLocation",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"rr",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"local",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"rr",
",",
"nil",
"\n",
"}"
]
|
20,185 | all-20186 | [
"NewClient",
"creates",
"a",
"new",
"bosh",
"client",
".",
"It",
"queries",
"bosh",
"s",
"/",
"info",
"endpoint",
"to",
"determine",
"if",
"user",
"authentication",
"should",
"be",
"done",
"via",
"UAA",
"or",
"basic",
"auth",
"."
]
| [
"func",
"NewClient",
"(",
"user",
",",
"pass",
",",
"host",
"string",
",",
"port",
"int",
",",
"sslIgnore",
"bool",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"c",
":=",
"&",
"Client",
"{",
"user",
":",
"user",
",",
"pass",
":",
"pass",
",",
"host",
":",
"host",
",",
"port",
":",
"port",
",",
"sslIgnore",
":",
"sslIgnore",
",",
"http",
":",
"&",
"http",
".",
"<mask>",
"{",
"Transport",
":",
"transport",
"(",
"sslIgnore",
")",
"}",
",",
"}",
"\n",
"c",
".",
"http",
".",
"CheckRedirect",
"=",
"func",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"via",
"[",
"]",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"req",
".",
"URL",
",",
"_",
"=",
"url",
".",
"Parse",
"(",
"req",
".",
"URL",
".",
"Scheme",
"+",
"\"",
"\"",
"+",
"via",
"[",
"0",
"]",
".",
"URL",
".",
"Host",
"+",
"req",
".",
"URL",
".",
"Path",
")",
"\n",
"setAuth",
"(",
"c",
",",
"req",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"c",
".",
"setClientToken",
"(",
")",
"\n",
"}"
]
|
20,186 | all-20187 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"ResetPageScaleFactorParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
20,187 | all-20188 | [
"NewSharedInformerFactory",
"constructs",
"a",
"new",
"instance",
"of",
"sharedInformerFactory"
]
| [
"func",
"NewSharedInformerFactory",
"(",
"<mask>",
"versioned",
".",
"Interface",
",",
"defaultResync",
"time",
".",
"Duration",
")",
"SharedInformerFactory",
"{",
"return",
"NewFilteredSharedInformerFactory",
"(",
"client",
",",
"defaultResync",
",",
"v1",
".",
"NamespaceAll",
",",
"nil",
")",
"\n",
"}"
]
|
20,188 | all-20189 | [
"NotifyStartupComplete",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_notify_startup_complete",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Display",
")",
"NotifyStartupComplete",
"(",
"startupID",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"startupID",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gdk_display_notify_startup_complete",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
20,189 | all-20190 | [
"detect",
"the",
"vmrun",
"and",
"vmware",
"-",
"vdiskmanager",
"cmds",
"path",
"if",
"needed"
]
| [
"func",
"setVmwareCmd",
"(",
"cmd",
"string",
")",
"string",
"{",
"if",
"<mask>",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"cmd",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"path",
"\n",
"}",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"cmd",
")",
"\n",
"}"
]
|
20,190 | all-20191 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetDocumentParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom47",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
20,191 | all-20192 | [
"Broadcast",
"messages",
"received",
"from",
"one",
"group",
"member",
"to",
"others",
".",
"If",
"incoming",
"messages",
"not",
"arrived",
"during",
"timeout",
"then",
"function",
"returns",
"."
]
| [
"func",
"(",
"g",
"*",
"Group",
")",
"Broadcast",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"var",
"timeoutChannel",
"<-",
"chan",
"time",
".",
"Time",
"\n",
"if",
"timeout",
"!=",
"0",
"{",
"timeoutChannel",
"=",
"time",
".",
"After",
"(",
"timeout",
")",
"\n",
"}",
"\n",
"for",
"{",
"select",
"{",
"case",
"received",
":=",
"<-",
"g",
".",
"in",
":",
"g",
".",
"memberLock",
".",
"Lock",
"(",
")",
"\n",
"g",
".",
"clockLock",
".",
"Lock",
"(",
")",
"\n",
"members",
":=",
"g",
".",
"members",
"[",
":",
"]",
"\n",
"received",
".",
"clock",
"=",
"g",
".",
"clock",
"\n",
"g",
".",
"clock",
"++",
"\n",
"g",
".",
"clockLock",
".",
"Unlock",
"(",
")",
"\n",
"g",
".",
"memberLock",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"members",
"{",
"// This is done in a goroutine because if it",
"// weren't it would be a blocking call",
"go",
"func",
"(",
"member",
"*",
"Member",
",",
"received",
"Message",
")",
"{",
"member",
".",
"send",
"<-",
"received",
"\n",
"}",
"(",
"member",
",",
"received",
")",
"\n",
"}",
"\n",
"case",
"<-",
"timeoutChannel",
":",
"if",
"timeout",
">",
"0",
"{",
"return",
"\n",
"}",
"\n",
"case",
"<-",
"g",
".",
"close",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
20,192 | all-20193 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"Metric",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPerformance1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,193 | all-20194 | [
"NewTCPTransportWithLogger",
"returns",
"a",
"NetworkTransport",
"that",
"is",
"built",
"on",
"top",
"of",
"a",
"TCP",
"streaming",
"transport",
"layer",
"with",
"log",
"output",
"going",
"to",
"the",
"supplied",
"Logger"
]
| [
"func",
"NewTCPTransportWithLogger",
"(",
"bindAddr",
"string",
",",
"advertise",
"net",
".",
"Addr",
",",
"maxPool",
"int",
",",
"timeout",
"time",
".",
"Duration",
",",
"logger",
"*",
"log",
".",
"Logger",
",",
")",
"(",
"*",
"NetworkTransport",
",",
"error",
")",
"{",
"return",
"newTCPTransport",
"(",
"bindAddr",
",",
"advertise",
",",
"func",
"(",
"<mask>",
"StreamLayer",
")",
"*",
"NetworkTransport",
"{",
"return",
"NewNetworkTransportWithLogger",
"(",
"stream",
",",
"maxPool",
",",
"timeout",
",",
"logger",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
20,194 | all-20195 | [
"FilterPresubmits",
"determines",
"which",
"presubmits",
"should",
"run",
".",
"We",
"only",
"want",
"to",
"trigger",
"jobs",
"that",
"should",
"run",
"but",
"the",
"pool",
"of",
"jobs",
"we",
"filter",
"to",
"those",
"that",
"should",
"run",
"depends",
"on",
"the",
"type",
"of",
"trigger",
"we",
"just",
"got",
":",
"-",
"if",
"we",
"get",
"a",
"/",
"test",
"foo",
"we",
"only",
"want",
"to",
"consider",
"those",
"jobs",
"that",
"match",
";",
"jobs",
"will",
"default",
"to",
"run",
"unless",
"we",
"can",
"determine",
"they",
"shouldn",
"t",
"-",
"if",
"we",
"got",
"a",
"/",
"retest",
"we",
"only",
"want",
"to",
"consider",
"those",
"jobs",
"that",
"have",
"already",
"run",
"and",
"posted",
"failing",
"contexts",
"to",
"the",
"PR",
"or",
"those",
"jobs",
"that",
"have",
"not",
"yet",
"run",
"but",
"would",
"otherwise",
"match",
"/",
"test",
"all",
";",
"jobs",
"will",
"default",
"to",
"run",
"unless",
"we",
"can",
"determine",
"they",
"shouldn",
"t",
"-",
"if",
"we",
"got",
"a",
"/",
"test",
"all",
"or",
"an",
"/",
"ok",
"-",
"to",
"-",
"test",
"we",
"want",
"to",
"consider",
"any",
"job",
"that",
"doesn",
"t",
"explicitly",
"require",
"a",
"human",
"trigger",
"comment",
";",
"jobs",
"will",
"default",
"to",
"not",
"run",
"unless",
"we",
"can",
"determine",
"that",
"they",
"should",
"If",
"a",
"comment",
"that",
"we",
"get",
"matches",
"more",
"than",
"one",
"of",
"the",
"above",
"patterns",
"we",
"consider",
"the",
"set",
"of",
"matching",
"presubmits",
"the",
"union",
"of",
"the",
"results",
"from",
"the",
"matching",
"cases",
"."
]
| [
"func",
"FilterPresubmits",
"(",
"honorOkToTest",
"bool",
",",
"gitHubClient",
"GitHubClient",
",",
"body",
"string",
",",
"pr",
"*",
"github",
".",
"PullRequest",
",",
"presubmits",
"[",
"]",
"config",
".",
"Presubmit",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"config",
".",
"Presubmit",
",",
"[",
"]",
"config",
".",
"Presubmit",
",",
"error",
")",
"{",
"org",
",",
"repo",
",",
"sha",
":=",
"pr",
".",
"Base",
".",
"Repo",
".",
"Owner",
".",
"Login",
",",
"pr",
".",
"Base",
".",
"Repo",
".",
"Name",
",",
"pr",
".",
"Head",
".",
"SHA",
"\n",
"filter",
",",
"err",
":=",
"presubmitFilter",
"(",
"honorOkToTest",
",",
"gitHubClient",
",",
"body",
",",
"org",
",",
"repo",
",",
"sha",
",",
"logger",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"number",
",",
"branch",
":=",
"pr",
".",
"Number",
",",
"pr",
".",
"<mask>",
".",
"Ref",
"\n",
"changes",
":=",
"config",
".",
"NewGitHubDeferredChangedFilesProvider",
"(",
"gitHubClient",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"toTrigger",
",",
"toSkipSuperset",
",",
"err",
":=",
"pjutil",
".",
"FilterPresubmits",
"(",
"filter",
",",
"changes",
",",
"branch",
",",
"presubmits",
",",
"logger",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"toSkip",
":=",
"determineSkippedPresubmits",
"(",
"toTrigger",
",",
"toSkipSuperset",
",",
"logger",
")",
"\n",
"return",
"toTrigger",
",",
"toSkip",
",",
"err",
"\n",
"}"
]
|
20,195 | all-20196 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventPaused",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger40",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
20,196 | all-20197 | [
"WithProcessClosed",
"returns",
"a",
"context",
".",
"Context",
"that",
"is",
"cancelled",
"after",
"Process",
"p",
"is",
"Closed",
".",
"It",
"is",
"the",
"equivalent",
"of",
":",
"func",
"WithProcessClosed",
"(",
"ctx",
"context",
".",
"Context",
"p",
"goprocess",
".",
"Process",
")",
"context",
".",
"Context",
"{",
"ctx",
"cancel",
":",
"=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"go",
"func",
"()",
"{",
"<",
"-",
"p",
".",
"Closed",
"()",
"cancel",
"()",
"}",
"()",
"return",
"ctx",
"}"
]
| [
"func",
"WithProcessClosed",
"(",
"ctx",
"context",
".",
"Context",
",",
"p",
"goprocess",
".",
"Process",
")",
"context",
".",
"Context",
"{",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"<-",
"p",
".",
"Closed",
"(",
")",
"\n",
"cancel",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"ctx",
"\n",
"}"
]
|
20,197 | all-20198 | [
"Commit",
"finishes",
"writing",
"data",
"to",
"the",
"underlying",
"io",
".",
"Writer",
".",
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"close",
"it",
"if",
"necessary",
"."
]
| [
"func",
"(",
"d",
"*",
"Destination",
")",
"Commit",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"error",
"{",
"return",
"d",
".",
"tar",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
20,198 | all-20199 | [
"Message",
"returns",
"an",
"error",
"message",
"from",
"a",
"given",
"error",
"code",
"."
]
| [
"func",
"<mask>",
"(",
"e",
"Error",
")",
"(",
"string",
",",
"bool",
")",
"{",
"msg",
",",
"ok",
":=",
"msgs",
"[",
"e",
"]",
"\n",
"return",
"msg",
",",
"ok",
"\n",
"}"
]
|
20,199 | all-20200 | [
"AsyncQuery",
"loads",
"the",
"data",
"by",
"paging",
"through",
"the",
"query",
"results",
"and",
"sends",
"back",
"payloads",
"over",
"the",
"dataChan",
"-",
"dataChan",
"sends",
"a",
"payload",
"containing",
"Data",
"objects",
"made",
"up",
"of",
"the",
"headers",
"rows",
"and",
"an",
"error",
"attribute"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"AsyncQuery",
"(",
"pageSize",
"int",
",",
"dataset",
",",
"<mask>",
",",
"queryStr",
"string",
",",
"dataChan",
"chan",
"Data",
")",
"{",
"c",
".",
"pagedQuery",
"(",
"pageSize",
",",
"dataset",
",",
"project",
",",
"queryStr",
",",
"dataChan",
")",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.