id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
19,600 | all-19601 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"KeyRange",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,601 | all-19602 | [
"Navigate",
"navigates",
"to",
"the",
"provided",
"URL",
"."
]
| [
"func",
"(",
"p",
"*",
"Page",
")",
"Navigate",
"(",
"url",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetURL",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,602 | all-19603 | [
"GetMessage",
"returns",
"the",
"Message",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"d",
"*",
"Downtime",
")",
"GetMessage",
"(",
")",
"string",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"Message",
"\n",
"}"
]
|
19,603 | all-19604 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetDOMCountersReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,604 | all-19605 | [
"NeedUpdate",
"returns",
"true",
"if",
"all",
"connections",
"are",
"down",
"or",
"addresses",
"do",
"not",
"include",
"current",
"pinned",
"address",
"."
]
| [
"func",
"(",
"b",
"*",
"GRPC17Health",
")",
"NeedUpdate",
"(",
")",
"bool",
"{",
"// updating notifyCh can trigger new connections,",
"// need update addrs if all connections are down",
"// or addrs does not include pinAddr.",
"b",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"<mask>",
":=",
"!",
"hasAddr",
"(",
"b",
".",
"addrs",
",",
"b",
".",
"pinAddr",
")",
"\n",
"b",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"update",
"\n",
"}"
]
|
19,605 | all-19606 | [
"BuildJob",
"-",
"function",
"to",
"create",
"a",
"compiled",
"version",
"of",
"the",
"current",
"job"
]
| [
"func",
"BuildJob",
"(",
"jobMeta",
"BoshJobMeta",
",",
"dest",
"string",
")",
"error",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"jobMeta",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"string",
"(",
"b",
")",
")",
"\n",
"monitFile",
",",
"specFile",
",",
"err",
":=",
"createJobFiles",
"(",
"dest",
",",
"jobMeta",
".",
"Name",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"monitFile",
".",
"Close",
"(",
")",
"\n",
"defer",
"specFile",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"writeMonitFile",
"(",
"monitFile",
",",
"jobMeta",
".",
"Name",
",",
"jobMeta",
".",
"PIDFile",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"writeSpecFile",
"(",
"specFile",
",",
"jobMeta",
".",
"<mask>",
",",
"jobMeta",
".",
"JobProperties",
",",
"jobMeta",
".",
"Packages",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
19,606 | all-19607 | [
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"Hijacker",
"interface",
"."
]
| [
"func",
"(",
"w",
"*",
"gzipResponseWriter",
")",
"Hijack",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"*",
"bufio",
".",
"ReadWriter",
",",
"error",
")",
"{",
"hijacker",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"<mask>",
".",
"Hijacker",
")",
"\n",
"return",
"hijacker",
".",
"Hijack",
"(",
")",
"\n",
"}"
]
|
19,607 | all-19608 | [
"CheckDisallowed",
"checks",
"that",
"no",
"environment",
"variables",
"with",
"the",
"prefix",
"are",
"set",
"that",
"we",
"don",
"t",
"know",
"how",
"or",
"want",
"to",
"parse",
".",
"This",
"is",
"likely",
"only",
"meaningful",
"with",
"a",
"non",
"-",
"empty",
"prefix",
"."
]
| [
"func",
"CheckDisallowed",
"(",
"prefix",
"string",
",",
"spec",
"interface",
"{",
"}",
")",
"error",
"{",
"infos",
",",
"err",
":=",
"gatherInfo",
"(",
"prefix",
",",
"spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"vars",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"info",
":=",
"range",
"infos",
"{",
"vars",
"[",
"info",
".",
"Key",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"prefix",
"=",
"strings",
".",
"ToUpper",
"(",
"prefix",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"env",
":=",
"range",
"os",
".",
"Environ",
"(",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"env",
",",
"prefix",
")",
"{",
"continue",
"\n",
"}",
"\n",
"v",
":=",
"strings",
".",
"SplitN",
"(",
"env",
",",
"\"",
"\"",
",",
"2",
")",
"[",
"0",
"]",
"\n",
"if",
"_",
",",
"<mask>",
":=",
"vars",
"[",
"v",
"]",
";",
"!",
"found",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,608 | all-19609 | [
"void",
"pango_font_description_set_absolute_size",
"(",
"PangoFontDescription",
"*",
"desc",
"double",
"size",
")",
";"
]
| [
"func",
"(",
"v",
"*",
"FontDescription",
")",
"SetAbsoluteSize",
"(",
"<mask>",
"float64",
")",
"{",
"C",
".",
"pango_font_description_set_absolute_size",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"C",
".",
"double",
")",
"(",
"size",
")",
")",
"\n",
"}"
]
|
19,609 | all-19610 | [
"MustSourceAccountBalance",
"retrieves",
"the",
"SourceAccountBalance",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"AccountMergeResult",
")",
"MustSourceAccountBalance",
"(",
")",
"Int64",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetSourceAccountBalance",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
19,610 | all-19611 | [
"NewNodeChanFilter",
"创建节点过滤器,实现敏感词的过滤",
"从通道中读取敏感词数据"
]
| [
"func",
"NewNodeChanFilter",
"(",
"text",
"<-",
"chan",
"string",
")",
"DirtyFilter",
"{",
"nf",
":=",
"&",
"nodeFilter",
"{",
"root",
":",
"newNode",
"(",
")",
",",
"}",
"\n",
"for",
"v",
":=",
"<mask>",
"text",
"{",
"nf",
".",
"addDirtyWords",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"nf",
"\n",
"}"
]
|
19,611 | all-19612 | [
"Fuzz",
"the",
"expression",
"parser",
"."
]
| [
"func",
"FuzzParseExpr",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"int",
"{",
"_",
",",
"err",
":=",
"ParseExpr",
"(",
"string",
"(",
"in",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"fuzzInteresting",
"\n",
"}",
"\n\n",
"return",
"fuzzMeh",
"\n",
"}"
]
|
19,612 | all-19613 | [
"Minimum",
"is",
"used",
"to",
"return",
"the",
"minimum",
"value",
"in",
"the",
"tree"
]
| [
"func",
"(",
"t",
"*",
"Tree",
")",
"Minimum",
"(",
")",
"(",
"string",
",",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"n",
":=",
"t",
".",
"root",
"\n",
"for",
"{",
"if",
"n",
".",
"isLeaf",
"(",
")",
"{",
"return",
"n",
".",
"leaf",
".",
"key",
",",
"n",
".",
"leaf",
".",
"val",
",",
"true",
"\n",
"}",
"\n",
"if",
"len",
"(",
"n",
".",
"edges",
")",
">",
"0",
"{",
"n",
"=",
"n",
".",
"edges",
"[",
"0",
"]",
".",
"<mask>",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"nil",
",",
"false",
"\n",
"}"
]
|
19,613 | all-19614 | [
"GenCassandra",
"generates",
"a",
"cassandra",
"DSN",
"from",
"the",
"passed",
"URL",
"."
]
| [
"func",
"GenCassandra",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"host",
",",
"port",
",",
"dbname",
":=",
"\"",
"\"",
",",
"\"",
"\"",
",",
"strings",
".",
"TrimPrefix",
"(",
"u",
".",
"Path",
",",
"\"",
"\"",
")",
"\n",
"if",
"h",
":=",
"hostname",
"(",
"u",
".",
"Host",
")",
";",
"h",
"!=",
"\"",
"\"",
"{",
"host",
"=",
"h",
"\n",
"}",
"\n",
"if",
"p",
":=",
"hostport",
"(",
"u",
".",
"Host",
")",
";",
"p",
"!=",
"\"",
"\"",
"{",
"<mask>",
"=",
"p",
"\n",
"}",
"\n",
"q",
":=",
"u",
".",
"Query",
"(",
")",
"\n",
"// add user/pass",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"u",
".",
"User",
".",
"Username",
"(",
")",
")",
"\n",
"if",
"pass",
",",
"_",
":=",
"u",
".",
"User",
".",
"Password",
"(",
")",
";",
"pass",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"pass",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// add dbname",
"if",
"dbname",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"dbname",
")",
"\n",
"}",
"\n",
"return",
"host",
"+",
"\"",
"\"",
"+",
"port",
"+",
"genQueryOptions",
"(",
"q",
")",
",",
"nil",
"\n",
"}"
]
|
19,614 | all-19615 | [
"MarshalBinary",
"allocates",
"a",
"byte",
"slice",
"containing",
"the",
"data",
"from",
"a",
"ConfigArg",
".",
"If",
"any",
"of",
"the",
"following",
"conditions",
"occur",
"ErrorBadArgumentParameter",
"is",
"returned",
":",
"-",
"c",
".",
"Command",
"is",
"larger",
"than",
"a",
"4",
"-",
"bit",
"integer",
"(",
"0xf",
")",
"-",
"c",
".",
"StringLength",
"does",
"not",
"indicate",
"the",
"actual",
"length",
"of",
"c",
".",
"String",
"-",
"c",
".",
"StringLength",
"is",
"greater",
"than",
"1024"
]
| [
"func",
"(",
"c",
"*",
"ConfigArg",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Command must be a 4-bit integer",
"if",
"c",
".",
"Command",
">",
"0xf",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"// StringLength must indicate actual length of String",
"if",
"int",
"(",
"c",
".",
"StringLength",
")",
"!=",
"len",
"(",
"c",
".",
"String",
")",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"// StringLength must not be greater than 1024, per AoEr11, Section 3.2.",
"if",
"c",
".",
"StringLength",
">",
"1024",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"// Allocate correct number of bytes for argument and config string",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"configArgLen",
"+",
"int",
"(",
"c",
".",
"StringLength",
")",
")",
"\n\n",
"// Store basic information",
"binary",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
"[",
"0",
":",
"2",
"]",
",",
"c",
".",
"BufferCount",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
"[",
"2",
":",
"4",
"]",
",",
"c",
".",
"FirmwareVersion",
")",
"\n",
"b",
"[",
"4",
"]",
"=",
"c",
".",
"SectorCount",
"\n\n",
"// Set version in 4 most significant bits of byte 5; command in least",
"// significant 4 bits",
"var",
"vc",
"uint8",
"\n",
"vc",
"|=",
"c",
".",
"Version",
"<<",
"4",
"\n",
"vc",
"|=",
"uint8",
"(",
"c",
".",
"Command",
")",
"\n",
"b",
"[",
"5",
"]",
"=",
"vc",
"\n\n",
"// Store config string length and string itself",
"binary",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
"[",
"6",
":",
"8",
"]",
",",
"c",
".",
"StringLength",
")",
"\n",
"copy",
"(",
"b",
"[",
"8",
":",
"]",
",",
"c",
".",
"<mask>",
")",
"\n\n",
"return",
"b",
",",
"nil",
"\n",
"}"
]
|
19,615 | all-19616 | [
"Get",
"returns",
"a",
"Counter",
"for",
"a",
"route",
".",
"If",
"there",
"is",
"no",
"entry",
"it",
"will",
"create",
"a",
"new",
"one",
".",
"It",
"will",
"lock",
"during",
"creation"
]
| [
"func",
"(",
"t",
"*",
"Timer",
")",
"Get",
"(",
"name",
"string",
")",
"*",
"Counter",
"{",
"if",
"c",
",",
"exist",
":=",
"t",
".",
"routes",
"[",
"name",
"]",
";",
"exist",
"{",
"return",
"c",
"\n",
"}",
"\n",
"t",
".",
"mux",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mux",
".",
"Unlock",
"(",
")",
"\n",
"// could be a race so check again",
"// could loose som small data but good not to",
"if",
"c",
",",
"exist",
":=",
"t",
".",
"routes",
"[",
"name",
"]",
";",
"exist",
"{",
"return",
"c",
"\n",
"}",
"\n",
"t",
".",
"routes",
"[",
"name",
"]",
"=",
"&",
"Counter",
"{",
"}",
"\n",
"t",
".",
"routes",
"[",
"<mask>",
"]",
".",
"Min",
"=",
"1",
"<<",
"63",
"-",
"1",
"\n",
"return",
"t",
".",
"routes",
"[",
"name",
"]",
"\n",
"}"
]
|
19,616 | all-19617 | [
"StatusMessage",
"returns",
"HTTP",
"status",
"message",
"for",
"the",
"given",
"status",
"code",
"."
]
| [
"func",
"StatusMessage",
"(",
"statusCode",
"int",
")",
"<mask>",
"{",
"s",
":=",
"statusMessages",
"[",
"statusCode",
"]",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"{",
"s",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
]
|
19,617 | all-19618 | [
"readVMCode",
"reads",
"the",
"raw",
"bytes",
"for",
"the",
"code",
"/",
"commands",
"used",
"in",
"a",
"vm",
"filter"
]
| [
"func",
"readVMCode",
"(",
"br",
"*",
"rarBitReader",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"br",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"n",
">",
"maxCodeSize",
"||",
"n",
"==",
"0",
"{",
"return",
"nil",
",",
"errInvalidFilter",
"\n",
"}",
"\n",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"n",
")",
"\n",
"err",
"=",
"br",
".",
"readFull",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"x",
"byte",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"buf",
"[",
"1",
":",
"]",
"{",
"x",
"^=",
"c",
"\n",
"}",
"\n",
"// simple xor checksum on data",
"if",
"x",
"!=",
"buf",
"[",
"0",
"]",
"{",
"return",
"nil",
",",
"errInvalidFilter",
"\n",
"}",
"\n",
"return",
"buf",
",",
"nil",
"\n",
"}"
]
|
19,618 | all-19619 | [
"ValidateRequest",
"validates",
"the",
"token",
"within",
"the",
"http",
"request",
".",
"A",
"default",
"leeway",
"value",
"of",
"one",
"minute",
"is",
"used",
"to",
"compare",
"time",
"values",
"."
]
| [
"func",
"(",
"v",
"*",
"JWTValidator",
")",
"ValidateRequest",
"(",
"r",
"*",
"<mask>",
".",
"Request",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"return",
"v",
".",
"validateRequestWithLeeway",
"(",
"r",
",",
"jwt",
".",
"DefaultLeeway",
")",
"\n",
"}"
]
|
19,619 | all-19620 | [
"DecodeError",
"tries",
"to",
"find",
"a",
"specific",
"error",
"which",
"occurs",
"when",
"an",
"invalid",
"key",
"is",
"passed",
"to",
"the",
"server"
]
| [
"func",
"DecodeError",
"(",
"info",
"types",
".",
"LicenseManagerLicenseInfo",
")",
"error",
"{",
"for",
"_",
",",
"property",
":=",
"range",
"info",
".",
"Properties",
"{",
"if",
"<mask>",
".",
"Key",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"property",
".",
"Value",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,620 | all-19621 | [
"Error",
"implements",
"error"
]
| [
"func",
"(",
"err",
"*",
"DefaultNamedError",
")",
"Error",
"(",
")",
"string",
"{",
"if",
"err",
".",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"+",
"err",
".",
"Err",
"\n",
"}",
"\n",
"return",
"err",
".",
"Name",
"+",
"\"",
"\"",
"+",
"err",
".",
"Err",
"\n",
"}"
]
|
19,621 | all-19622 | [
"InsertPageMenu",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_insert_page_menu",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Notebook",
")",
"InsertPageMenu",
"(",
"<mask>",
"IWidget",
",",
"tabLabel",
"IWidget",
",",
"menuLabel",
"IWidget",
",",
"position",
"int",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_notebook_insert_page_menu",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"tabLabel",
".",
"toWidget",
"(",
")",
",",
"menuLabel",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
]
|
19,622 | all-19623 | [
"reportStatus",
"should",
"be",
"called",
"on",
"any",
"prowjob",
"status",
"changes"
]
| [
"func",
"reportStatus",
"(",
"ghc",
"GitHubClient",
",",
"pj",
"prowapi",
".",
"ProwJob",
")",
"error",
"{",
"refs",
":=",
"pj",
".",
"Spec",
".",
"Refs",
"\n",
"if",
"pj",
".",
"Spec",
".",
"Report",
"{",
"contextState",
",",
"err",
":=",
"prowjobStateToGitHubStatus",
"(",
"pj",
".",
"Status",
".",
"State",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"sha",
":=",
"refs",
".",
"BaseSHA",
"\n",
"if",
"len",
"(",
"refs",
".",
"Pulls",
")",
">",
"0",
"{",
"sha",
"=",
"refs",
".",
"Pulls",
"[",
"0",
"]",
".",
"SHA",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ghc",
".",
"CreateStatus",
"(",
"refs",
".",
"Org",
",",
"refs",
".",
"Repo",
",",
"sha",
",",
"github",
".",
"Status",
"{",
"State",
":",
"contextState",
",",
"Description",
":",
"truncate",
"(",
"pj",
".",
"Status",
".",
"Description",
")",
",",
"Context",
":",
"pj",
".",
"Spec",
".",
"Context",
",",
"// consider truncating this too",
"TargetURL",
":",
"pj",
".",
"Status",
".",
"<mask>",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,623 | all-19624 | [
"EditScriptForMatrix",
"returns",
"an",
"optimal",
"edit",
"script",
"based",
"on",
"the",
"given",
"Levenshtein",
"matrix",
"."
]
| [
"func",
"EditScriptForMatrix",
"(",
"matrix",
"[",
"]",
"[",
"]",
"int",
",",
"op",
"<mask>",
")",
"EditScript",
"{",
"return",
"backtrace",
"(",
"len",
"(",
"matrix",
")",
"-",
"1",
",",
"len",
"(",
"matrix",
"[",
"0",
"]",
")",
"-",
"1",
",",
"matrix",
",",
"op",
")",
"\n",
"}"
]
|
19,624 | all-19625 | [
"Delete",
"the",
"secret",
"associated",
"with",
"some",
"key",
".",
"Required",
"scopes",
":",
"secrets",
":",
"set",
":",
"<name",
">",
"See",
"#remove"
]
| [
"func",
"(",
"secrets",
"*",
"Secrets",
")",
"Remove",
"(",
"name",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"secrets",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
19,625 | all-19626 | [
"change",
"timeout",
"to",
"time",
".",
"Duration"
]
| [
"func",
"request",
"(",
"client",
"*",
"http",
".",
"Client",
",",
"method",
",",
"url",
"string",
",",
"body",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"bytes",
".",
"NewBuffer",
"(",
"<mask>",
")",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"resp",
",",
"err",
":=",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"return",
"processResponse",
"(",
"resp",
")",
"\n",
"}"
]
|
19,626 | all-19627 | [
"makeStale",
"makes",
"the",
"image",
"stale",
"."
]
| [
"func",
"(",
"i",
"*",
"Image",
")",
"makeStale",
"(",
")",
"{",
"i",
".",
"basePixels",
"=",
"nil",
"\n",
"i",
".",
"drawTrianglesHistory",
"=",
"nil",
"\n",
"i",
".",
"stale",
"=",
"<mask>",
"\n\n",
"// Don't have to call makeStale recursively here.",
"// Restoring is done after topological sorting is done.",
"// If an image depends on another stale image, this means that",
"// the former image can be restored from the latest state of the latter image.",
"}"
]
|
19,627 | all-19628 | [
"Choose",
"an",
"available",
"short",
"ID",
"at",
"random",
"."
]
| [
"func",
"(",
"peers",
"*",
"Peers",
")",
"chooseShortID",
"(",
")",
"(",
"PeerShortID",
",",
"bool",
")",
"{",
"rng",
":=",
"rand",
".",
"New",
"(",
"rand",
".",
"NewSource",
"(",
"int64",
"(",
"randUint64",
"(",
")",
")",
")",
")",
"\n\n",
"// First, just try picking some short IDs at random, and",
"// seeing if they are available:",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"10",
";",
"i",
"++",
"{",
"shortID",
":=",
"PeerShortID",
"(",
"rng",
".",
"Intn",
"(",
"1",
"<<",
"peerShortIDBits",
")",
")",
"\n",
"if",
"peers",
".",
"byShortID",
"[",
"shortID",
"]",
".",
"peer",
"==",
"nil",
"{",
"return",
"shortID",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Looks like most short IDs are used. So count the number of",
"// unused ones, and pick one at random.",
"available",
":=",
"int",
"(",
"1",
"<<",
"peerShortIDBits",
")",
"\n",
"for",
"_",
",",
"entry",
":=",
"range",
"peers",
".",
"byShortID",
"{",
"if",
"entry",
".",
"peer",
"!=",
"nil",
"{",
"available",
"--",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"available",
"==",
"0",
"{",
"// All short IDs are used.",
"return",
"0",
",",
"false",
"\n",
"}",
"\n\n",
"n",
":=",
"rng",
".",
"Intn",
"(",
"<mask>",
")",
"\n",
"var",
"i",
"PeerShortID",
"\n",
"for",
"{",
"if",
"peers",
".",
"byShortID",
"[",
"i",
"]",
".",
"peer",
"==",
"nil",
"{",
"if",
"n",
"==",
"0",
"{",
"return",
"i",
",",
"true",
"\n",
"}",
"\n\n",
"n",
"--",
"\n",
"}",
"\n\n",
"i",
"++",
"\n",
"}",
"\n",
"}"
]
|
19,628 | all-19629 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetVariableValueParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,629 | all-19630 | [
"AppendDuration",
"appends",
"a",
"human",
"-",
"readable",
"representation",
"of",
"d",
"to",
"b",
".",
"The",
"function",
"copies",
"the",
"implementation",
"of",
"time",
".",
"Duration",
".",
"String",
"but",
"prevents",
"Go",
"from",
"making",
"a",
"dynamic",
"memory",
"allocation",
"on",
"the",
"returned",
"value",
"."
]
| [
"func",
"AppendDuration",
"(",
"b",
"[",
"]",
"byte",
",",
"d",
"time",
".",
"Duration",
")",
"[",
"]",
"byte",
"{",
"// Largest time is 2540400h10m10.000000000s",
"var",
"buf",
"[",
"32",
"]",
"<mask>",
"\n",
"w",
":=",
"len",
"(",
"buf",
")",
"\n\n",
"u",
":=",
"uint64",
"(",
"d",
")",
"\n",
"neg",
":=",
"d",
"<",
"0",
"\n",
"if",
"neg",
"{",
"u",
"=",
"-",
"u",
"\n",
"}",
"\n\n",
"if",
"u",
"<",
"uint64",
"(",
"time",
".",
"Second",
")",
"{",
"// Special case: if duration is smaller than a second,",
"// use smaller units, like 1.2ms",
"var",
"prec",
"int",
"\n",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'s'",
"\n",
"w",
"--",
"\n",
"switch",
"{",
"case",
"u",
"==",
"0",
":",
"return",
"append",
"(",
"b",
",",
"'0'",
",",
"'s'",
")",
"\n",
"case",
"u",
"<",
"uint64",
"(",
"time",
".",
"Microsecond",
")",
":",
"// print nanoseconds",
"prec",
"=",
"0",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'n'",
"\n",
"case",
"u",
"<",
"uint64",
"(",
"time",
".",
"Millisecond",
")",
":",
"// print microseconds",
"prec",
"=",
"3",
"\n",
"// U+00B5 'µ' micro sign == 0xC2 0xB5",
"w",
"--",
"// Need room for two bytes.",
"\n",
"copy",
"(",
"buf",
"[",
"w",
":",
"]",
",",
"\"",
")",
"",
"\n",
"default",
":",
"// print milliseconds",
"prec",
"=",
"6",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'m'",
"\n",
"}",
"\n",
"w",
",",
"u",
"=",
"fmtFrac",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
",",
"prec",
")",
"\n",
"w",
"=",
"fmtInt",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
")",
"\n",
"}",
"else",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'s'",
"\n\n",
"w",
",",
"u",
"=",
"fmtFrac",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
",",
"9",
")",
"\n\n",
"// u is now integer seconds",
"w",
"=",
"fmtInt",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
"%",
"60",
")",
"\n",
"u",
"/=",
"60",
"\n\n",
"// u is now integer minutes",
"if",
"u",
">",
"0",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'m'",
"\n",
"w",
"=",
"fmtInt",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
"%",
"60",
")",
"\n",
"u",
"/=",
"60",
"\n\n",
"// u is now integer hours",
"// Stop at hours because days can be different lengths.",
"if",
"u",
">",
"0",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'h'",
"\n",
"w",
"=",
"fmtInt",
"(",
"buf",
"[",
":",
"w",
"]",
",",
"u",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"neg",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'-'",
"\n",
"}",
"\n\n",
"return",
"append",
"(",
"b",
",",
"buf",
"[",
"w",
":",
"]",
"...",
")",
"\n",
"}"
]
|
19,630 | all-19631 | [
"Field",
"returns",
"the",
"part",
"of",
"r",
"which",
"contains",
"the",
"field",
"f",
".",
"r",
"must",
"contain",
"a",
"struct",
"and",
"f",
"must",
"be",
"one",
"of",
"its",
"fields",
"."
]
| [
"func",
"(",
"r",
"region",
")",
"<mask>",
"(",
"f",
"string",
")",
"region",
"{",
"finfo",
":=",
"r",
".",
"typ",
".",
"field",
"(",
"f",
")",
"\n",
"if",
"finfo",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"r",
".",
"typ",
".",
"Name",
"+",
"\"",
"\"",
"+",
"f",
")",
"\n",
"}",
"\n",
"return",
"region",
"{",
"p",
":",
"r",
".",
"p",
",",
"a",
":",
"r",
".",
"a",
".",
"Add",
"(",
"finfo",
".",
"Off",
")",
",",
"typ",
":",
"finfo",
".",
"Type",
"}",
"\n",
"}"
]
|
19,631 | all-19632 | [
"ContainerToArgs",
"is",
"a",
"convenience",
"to",
"convert",
"the",
"new",
"Container",
"db",
"struct",
"into",
"the",
"legacy",
"ContainerArgs",
"."
]
| [
"func",
"ContainerToArgs",
"(",
"container",
"*",
"Container",
")",
"ContainerArgs",
"{",
"args",
":=",
"ContainerArgs",
"{",
"ID",
":",
"container",
".",
"ID",
",",
"Project",
":",
"container",
".",
"Project",
",",
"Name",
":",
"<mask>",
".",
"Name",
",",
"Node",
":",
"container",
".",
"Node",
",",
"Ctype",
":",
"ContainerType",
"(",
"container",
".",
"Type",
")",
",",
"Architecture",
":",
"container",
".",
"Architecture",
",",
"Ephemeral",
":",
"container",
".",
"Ephemeral",
",",
"CreationDate",
":",
"container",
".",
"CreationDate",
",",
"Stateful",
":",
"container",
".",
"Stateful",
",",
"LastUsedDate",
":",
"container",
".",
"LastUseDate",
",",
"Description",
":",
"container",
".",
"Description",
",",
"Config",
":",
"container",
".",
"Config",
",",
"Devices",
":",
"container",
".",
"Devices",
",",
"Profiles",
":",
"container",
".",
"Profiles",
",",
"ExpiryDate",
":",
"container",
".",
"ExpiryDate",
",",
"}",
"\n\n",
"if",
"args",
".",
"Devices",
"==",
"nil",
"{",
"args",
".",
"Devices",
"=",
"types",
".",
"Devices",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"args",
"\n",
"}"
]
|
19,632 | all-19633 | [
"Permtation",
"generator",
"for",
"int",
"slice"
]
| [
"func",
"permutations",
"(",
"list",
"[",
"]",
"int",
",",
"select_num",
",",
"buf",
"int",
")",
"(",
"c",
"chan",
"[",
"]",
"int",
")",
"{",
"c",
"=",
"make",
"(",
"chan",
"[",
"]",
"int",
",",
"buf",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"switch",
"select_num",
"{",
"case",
"1",
":",
"for",
"_",
",",
"v",
":=",
"range",
"list",
"{",
"c",
"<-",
"[",
"]",
"int",
"{",
"v",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"case",
"0",
":",
"return",
"\n",
"case",
"len",
"(",
"list",
")",
":",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"list",
")",
";",
"i",
"++",
"{",
"top",
",",
"sub_list",
":=",
"pop",
"(",
"list",
",",
"i",
")",
"\n",
"for",
"perm",
":=",
"<mask>",
"permutations",
"(",
"sub_list",
",",
"select_num",
"-",
"1",
",",
"buf",
")",
"{",
"c",
"<-",
"append",
"(",
"[",
"]",
"int",
"{",
"top",
"}",
",",
"perm",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"for",
"comb",
":=",
"range",
"combinations",
"(",
"list",
",",
"select_num",
",",
"buf",
")",
"{",
"for",
"perm",
":=",
"range",
"permutations",
"(",
"comb",
",",
"select_num",
",",
"buf",
")",
"{",
"c",
"<-",
"perm",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"\n",
"}"
]
|
19,633 | all-19634 | [
"GetToken",
"returns",
"token",
"if",
"password",
"is",
"correct",
"."
]
| [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetToken",
"(",
"password",
"string",
")",
"(",
"*",
"string",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"h",
".",
"checkPassword",
"(",
"logger",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"v",
",",
"err",
":=",
"h",
".",
"token",
".",
"Make",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"&",
"v",
",",
"nil",
"\n",
"}"
]
|
19,634 | all-19635 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetRemoteLocationsParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,635 | all-19636 | [
"NewCachedByteCodeLoader",
"creates",
"a",
"new",
"CachedByteCodeLoader"
]
| [
"func",
"NewCachedByteCodeLoader",
"(",
"cache",
"Cache",
",",
"cacheLevel",
"CacheStrategy",
",",
"fetcher",
"TemplateFetcher",
",",
"<mask>",
"parser",
".",
"Parser",
",",
"compiler",
"compiler",
".",
"Compiler",
",",
")",
"*",
"CachedByteCodeLoader",
"{",
"return",
"&",
"CachedByteCodeLoader",
"{",
"NewStringByteCodeLoader",
"(",
"parser",
",",
"compiler",
")",
",",
"NewReaderByteCodeLoader",
"(",
"parser",
",",
"compiler",
")",
",",
"fetcher",
",",
"[",
"]",
"Cache",
"{",
"MemoryCache",
"{",
"}",
",",
"cache",
"}",
",",
"cacheLevel",
",",
"}",
"\n",
"}"
]
|
19,636 | all-19637 | [
"toBytes",
"returns",
"the",
"2ch",
"little",
"endian",
"16bit",
"byte",
"sequence",
"with",
"the",
"given",
"left",
"/",
"right",
"sequence",
"."
]
| [
"func",
"toBytes",
"(",
"l",
",",
"r",
"[",
"]",
"int16",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"l",
")",
"!=",
"len",
"(",
"r",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"l",
")",
"*",
"4",
")",
"\n",
"for",
"i",
":=",
"<mask>",
"l",
"{",
"b",
"[",
"4",
"*",
"i",
"]",
"=",
"byte",
"(",
"l",
"[",
"i",
"]",
")",
"\n",
"b",
"[",
"4",
"*",
"i",
"+",
"1",
"]",
"=",
"byte",
"(",
"l",
"[",
"i",
"]",
">>",
"8",
")",
"\n",
"b",
"[",
"4",
"*",
"i",
"+",
"2",
"]",
"=",
"byte",
"(",
"r",
"[",
"i",
"]",
")",
"\n",
"b",
"[",
"4",
"*",
"i",
"+",
"3",
"]",
"=",
"byte",
"(",
"r",
"[",
"i",
"]",
">>",
"8",
")",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}"
]
|
19,637 | all-19638 | [
"CreateIntegrationSlack",
"creates",
"new",
"Slack",
"Integrations",
".",
"Use",
"this",
"if",
"you",
"want",
"to",
"setup",
"the",
"integration",
"for",
"the",
"first",
"time",
"or",
"to",
"add",
"more",
"channels",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateIntegrationSlack",
"(",
"slackIntegration",
"*",
"IntegrationSlackRequest",
")",
"error",
"{",
"return",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"slackIntegration",
",",
"nil",
")",
"\n",
"}"
]
|
19,638 | all-19639 | [
"EmitDeletedText",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_buffer_emit_deleted_text",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"EntryBuffer",
")",
"EmitDeletedText",
"(",
"pos",
",",
"nChars",
"uint",
")",
"{",
"C",
".",
"gtk_entry_buffer_emit_deleted_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"<mask>",
")",
",",
"C",
".",
"guint",
"(",
"nChars",
")",
")",
"\n",
"}"
]
|
19,639 | all-19640 | [
"We",
"create",
"a",
"MetricsClient",
"for",
"all",
"managed",
"APIs",
"(",
"APIs",
"for",
"which",
"we",
"will",
"collect",
"metrics",
")"
]
| [
"func",
"NewMetricsEngine",
"(",
"cfg",
"*",
"config",
".",
"Config",
",",
"registry",
"*",
"prometheus",
".",
"Registry",
")",
"*",
"MetricsEngine",
"{",
"metricsEngine",
":=",
"&",
"MetricsEngine",
"{",
"cfg",
":",
"cfg",
",",
"Registry",
":",
"registry",
",",
"managedMetrics",
":",
"make",
"(",
"<mask>",
"[",
"APIType",
"]",
"MetricsClient",
")",
",",
"}",
"\n",
"for",
"managedAPI",
",",
"_",
":=",
"range",
"managedAPIs",
"{",
"aClient",
":=",
"NewMetricsClient",
"(",
"managedAPI",
",",
"metricsEngine",
".",
"Registry",
")",
"\n",
"metricsEngine",
".",
"managedMetrics",
"[",
"managedAPI",
"]",
"=",
"aClient",
"\n",
"}",
"\n",
"return",
"metricsEngine",
"\n",
"}"
]
|
19,640 | all-19641 | [
"logicalBinop",
"emits",
"code",
"to",
"fn",
"to",
"evaluate",
"e",
"a",
"&&",
"-",
"or",
"||",
"-",
"expression",
"whose",
"reified",
"boolean",
"value",
"is",
"wanted",
".",
"The",
"value",
"is",
"returned",
"."
]
| [
"func",
"(",
"b",
"*",
"builder",
")",
"logicalBinop",
"(",
"fn",
"*",
"Function",
",",
"e",
"*",
"ast",
".",
"BinaryExpr",
")",
"Value",
"{",
"rhs",
":=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"\n",
"done",
":=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"\n\n",
"// T(e) = T(e.X) = T(e.Y) after untyped constants have been",
"// eliminated.",
"// TODO(adonovan): not true; MyBool==MyBool yields UntypedBool.",
"t",
":=",
"fn",
".",
"Pkg",
".",
"typeOf",
"(",
"e",
")",
"\n\n",
"var",
"short",
"Value",
"// value of the short-circuit path",
"\n",
"switch",
"e",
".",
"Op",
"{",
"case",
"token",
".",
"LAND",
":",
"b",
".",
"cond",
"(",
"fn",
",",
"e",
".",
"X",
",",
"rhs",
",",
"done",
")",
"\n",
"short",
"=",
"NewConst",
"(",
"exact",
".",
"MakeBool",
"(",
"false",
")",
",",
"t",
")",
"\n\n",
"case",
"token",
".",
"LOR",
":",
"b",
".",
"cond",
"(",
"fn",
",",
"e",
".",
"X",
",",
"done",
",",
"rhs",
")",
"\n",
"short",
"=",
"NewConst",
"(",
"exact",
".",
"MakeBool",
"(",
"true",
")",
",",
"t",
")",
"\n",
"}",
"\n\n",
"// Is rhs unreachable?",
"if",
"rhs",
".",
"Preds",
"==",
"nil",
"{",
"// Simplify false&&y to false, true||y to true.",
"fn",
".",
"currentBlock",
"=",
"done",
"\n",
"return",
"short",
"\n",
"}",
"\n\n",
"// Is done unreachable?",
"if",
"done",
".",
"Preds",
"==",
"nil",
"{",
"// Simplify true&&y (or false||y) to y.",
"fn",
".",
"currentBlock",
"=",
"rhs",
"\n",
"return",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"Y",
")",
"\n",
"}",
"\n\n",
"// All edges from e.X to done carry the short-circuit value.",
"var",
"edges",
"[",
"]",
"Value",
"\n",
"for",
"range",
"done",
".",
"Preds",
"{",
"edges",
"=",
"<mask>",
"(",
"edges",
",",
"short",
")",
"\n",
"}",
"\n\n",
"// The edge from e.Y to done carries the value of e.Y.",
"fn",
".",
"currentBlock",
"=",
"rhs",
"\n",
"edges",
"=",
"append",
"(",
"edges",
",",
"b",
".",
"expr",
"(",
"fn",
",",
"e",
".",
"Y",
")",
")",
"\n",
"emitJump",
"(",
"fn",
",",
"done",
")",
"\n",
"fn",
".",
"currentBlock",
"=",
"done",
"\n\n",
"phi",
":=",
"&",
"Phi",
"{",
"Edges",
":",
"edges",
",",
"Comment",
":",
"e",
".",
"Op",
".",
"String",
"(",
")",
"}",
"\n",
"phi",
".",
"pos",
"=",
"e",
".",
"OpPos",
"\n",
"phi",
".",
"typ",
"=",
"t",
"\n",
"return",
"done",
".",
"emit",
"(",
"phi",
")",
"\n",
"}"
]
|
19,641 | all-19642 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniformMatrix4x3fv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniformMatrix4x3fv",
",",
"5",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
")",
"\n",
"}"
]
|
19,642 | all-19643 | [
"AddAssignees",
"adds",
"assignees",
"to",
"the",
"list"
]
| [
"func",
"(",
"ap",
"*",
"Approvers",
")",
"AddAssignees",
"(",
"logins",
"...",
"string",
")",
"{",
"for",
"_",
",",
"login",
":=",
"<mask>",
"logins",
"{",
"ap",
".",
"assignees",
".",
"Insert",
"(",
"strings",
".",
"ToLower",
"(",
"login",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
19,643 | all-19644 | [
"GetDisplayName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_get_display_name",
"()",
"."
]
| [
"func",
"(",
"ps",
"*",
"PaperSize",
")",
"GetDisplayName",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_paper_size_get_display_name",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
]
|
19,644 | all-19645 | [
"NewController",
"constructs",
"a",
"new",
"instance",
"of",
"the",
"crier",
"controller",
"."
]
| [
"func",
"NewController",
"(",
"pjclientset",
"clientset",
".",
"Interface",
",",
"queue",
"workqueue",
".",
"RateLimitingInterface",
",",
"informer",
"pjinformers",
".",
"ProwJobInformer",
",",
"reporter",
"reportClient",
",",
"numWorkers",
"int",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
")",
"*",
"<mask>",
"{",
"return",
"&",
"Controller",
"{",
"pjclientset",
":",
"pjclientset",
",",
"queue",
":",
"queue",
",",
"informer",
":",
"informer",
",",
"reporter",
":",
"reporter",
",",
"numWorkers",
":",
"numWorkers",
",",
"wg",
":",
"wg",
",",
"}",
"\n",
"}"
]
|
19,645 | all-19646 | [
"MapCloudIPtoServer",
"is",
"a",
"convenience",
"method",
"to",
"map",
"a",
"Cloud",
"IP",
"to",
"a",
"server",
".",
"First",
"looks",
"up",
"the",
"server",
"to",
"get",
"the",
"network",
"interface",
"id",
".",
"Uses",
"the",
"first",
"interface",
"found",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"MapCloudIPtoServer",
"(",
"identifier",
"string",
",",
"serverid",
"string",
")",
"error",
"{",
"server",
",",
"err",
":=",
"c",
".",
"Server",
"(",
"serverid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"server",
".",
"Interfaces",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"server",
".",
"<mask>",
",",
"identifier",
")",
"\n",
"}",
"\n",
"destination",
":=",
"server",
".",
"Interfaces",
"[",
"0",
"]",
".",
"Id",
"\n",
"err",
"=",
"c",
".",
"MapCloudIP",
"(",
"identifier",
",",
"destination",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,646 | all-19647 | [
"cephRBDSnapshotListClones",
"list",
"all",
"clones",
"of",
"an",
"RBD",
"snapshot"
]
| [
"func",
"cephRBDSnapshotListClones",
"(",
"clusterName",
"string",
",",
"poolName",
"string",
",",
"volumeName",
"string",
",",
"volumeType",
"string",
",",
"snapshotName",
"string",
",",
"userName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"msg",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"userName",
",",
"\"",
"\"",
",",
"clusterName",
",",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"volumeType",
",",
"volumeName",
")",
",",
"\"",
"\"",
",",
"snapshotName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"msg",
"=",
"strings",
".",
"TrimSpace",
"(",
"msg",
")",
"\n",
"clones",
":=",
"strings",
".",
"Fields",
"(",
"<mask>",
")",
"\n",
"if",
"len",
"(",
"clones",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"db",
".",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"clones",
",",
"nil",
"\n",
"}"
]
|
19,647 | all-19648 | [
"SetFloat",
"is",
"a",
"wrapper",
"around",
"g_value_set_float",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetFloat",
"(",
"val",
"float32",
")",
"{",
"C",
".",
"g_value_set_float",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gfloat",
"(",
"val",
")",
")",
"\n",
"}"
]
|
19,648 | all-19649 | [
"Rename",
"a",
"particular",
"interface",
"to",
"a",
"different",
"name",
"!!!",
"Note",
"that",
"you",
"can",
"t",
"rename",
"an",
"active",
"interface",
".",
"You",
"need",
"to",
"bring",
"it",
"down",
"before",
"renaming",
"it",
".",
"This",
"is",
"identical",
"to",
"running",
":",
"ip",
"link",
"set",
"dev",
"$",
"{",
"oldName",
"}",
"name",
"$",
"{",
"newName",
"}"
]
| [
"func",
"NetworkChangeName",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"newName",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"newName",
")",
">=",
"IFNAMSIZ",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"newName",
")",
"\n",
"}",
"\n\n",
"s",
",",
"err",
":=",
"getNetlinkSocket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"wb",
":=",
"newNetlinkRequest",
"(",
"syscall",
".",
"RTM_SETLINK",
",",
"syscall",
".",
"NLM_F_ACK",
")",
"\n\n",
"msg",
":=",
"newIfInfomsg",
"(",
"syscall",
".",
"AF_UNSPEC",
")",
"\n",
"msg",
".",
"Index",
"=",
"int32",
"(",
"iface",
".",
"Index",
")",
"\n",
"msg",
".",
"Change",
"=",
"DEFAULT_CHANGE",
"\n",
"wb",
".",
"AddData",
"(",
"<mask>",
")",
"\n\n",
"nameData",
":=",
"newRtAttr",
"(",
"syscall",
".",
"IFLA_IFNAME",
",",
"zeroTerminated",
"(",
"newName",
")",
")",
"\n",
"wb",
".",
"AddData",
"(",
"nameData",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"Send",
"(",
"wb",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"HandleAck",
"(",
"wb",
".",
"Seq",
")",
"\n",
"}"
]
|
19,649 | all-19650 | [
"GetStringBounds",
"returns",
"the",
"approximate",
"pixel",
"bounds",
"of",
"the",
"string",
"s",
"at",
"x",
"y",
".",
"The",
"the",
"left",
"edge",
"of",
"the",
"em",
"square",
"of",
"the",
"first",
"character",
"of",
"s",
"and",
"the",
"baseline",
"intersect",
"at",
"0",
"0",
"in",
"the",
"returned",
"coordinates",
".",
"Therefore",
"the",
"top",
"and",
"left",
"coordinates",
"may",
"well",
"be",
"negative",
"."
]
| [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"GetStringBounds",
"(",
"s",
"string",
")",
"(",
"left",
",",
"<mask>",
",",
"right",
",",
"bottom",
"float64",
")",
"{",
"f",
",",
"err",
":=",
"gc",
".",
"loadCurrentFont",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"err",
")",
"\n",
"return",
"0",
",",
"0",
",",
"0",
",",
"0",
"\n",
"}",
"\n",
"top",
",",
"left",
",",
"bottom",
",",
"right",
"=",
"10e6",
",",
"10e6",
",",
"-",
"10e6",
",",
"-",
"10e6",
"\n",
"cursor",
":=",
"0.0",
"\n",
"prev",
",",
"hasPrev",
":=",
"truetype",
".",
"Index",
"(",
"0",
")",
",",
"false",
"\n",
"for",
"_",
",",
"rune",
":=",
"range",
"s",
"{",
"index",
":=",
"f",
".",
"Index",
"(",
"rune",
")",
"\n",
"if",
"hasPrev",
"{",
"cursor",
"+=",
"fUnitsToFloat64",
"(",
"f",
".",
"Kern",
"(",
"fixed",
".",
"Int26_6",
"(",
"gc",
".",
"Current",
".",
"Scale",
")",
",",
"prev",
",",
"index",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"gc",
".",
"glyphBuf",
".",
"Load",
"(",
"gc",
".",
"Current",
".",
"Font",
",",
"fixed",
".",
"Int26_6",
"(",
"gc",
".",
"Current",
".",
"Scale",
")",
",",
"index",
",",
"font",
".",
"HintingNone",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"err",
")",
"\n",
"return",
"0",
",",
"0",
",",
"0",
",",
"0",
"\n",
"}",
"\n",
"e0",
":=",
"0",
"\n",
"for",
"_",
",",
"e1",
":=",
"range",
"gc",
".",
"glyphBuf",
".",
"Ends",
"{",
"ps",
":=",
"gc",
".",
"glyphBuf",
".",
"Points",
"[",
"e0",
":",
"e1",
"]",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"ps",
"{",
"x",
",",
"y",
":=",
"pointToF64Point",
"(",
"p",
")",
"\n",
"top",
"=",
"math",
".",
"Min",
"(",
"top",
",",
"y",
")",
"\n",
"bottom",
"=",
"math",
".",
"Max",
"(",
"bottom",
",",
"y",
")",
"\n",
"left",
"=",
"math",
".",
"Min",
"(",
"left",
",",
"x",
"+",
"cursor",
")",
"\n",
"right",
"=",
"math",
".",
"Max",
"(",
"right",
",",
"x",
"+",
"cursor",
")",
"\n",
"}",
"\n",
"}",
"\n",
"cursor",
"+=",
"fUnitsToFloat64",
"(",
"f",
".",
"HMetric",
"(",
"fixed",
".",
"Int26_6",
"(",
"gc",
".",
"Current",
".",
"Scale",
")",
",",
"index",
")",
".",
"AdvanceWidth",
")",
"\n",
"prev",
",",
"hasPrev",
"=",
"index",
",",
"true",
"\n",
"}",
"\n",
"return",
"left",
",",
"top",
",",
"right",
",",
"bottom",
"\n",
"}"
]
|
19,650 | all-19651 | [
"NewClient",
"is",
"a",
"constructor",
"for",
"Client",
"object"
]
| [
"func",
"NewClient",
"(",
"username",
",",
"password",
"string",
")",
"*",
"Client",
"{",
"c",
":=",
"newPBRestClient",
"(",
"username",
",",
"password",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"true",
")",
"\n",
"return",
"&",
"Client",
"{",
"userName",
":",
"c",
".",
"username",
",",
"password",
":",
"c",
".",
"password",
",",
"<mask>",
":",
"c",
",",
"}",
"\n",
"}"
]
|
19,651 | all-19652 | [
"CompactPrintBranch",
"renders",
"b",
"as",
"a",
"compact",
"string",
"e",
".",
"g",
".",
"myrepo"
]
| [
"func",
"CompactPrintBranch",
"(",
"b",
"*",
"pfs",
".",
"Branch",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
".",
"Repo",
".",
"<mask>",
",",
"b",
".",
"Name",
")",
"\n",
"}"
]
|
19,652 | all-19653 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"ExceptionsState",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ExceptionsState",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ExceptionsStateNone",
":",
"*",
"t",
"=",
"ExceptionsStateNone",
"\n",
"case",
"ExceptionsStateUncaught",
":",
"*",
"t",
"=",
"ExceptionsStateUncaught",
"\n",
"case",
"ExceptionsStateAll",
":",
"*",
"t",
"=",
"ExceptionsStateAll",
"\n\n",
"default",
":",
"<mask>",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
19,653 | all-19654 | [
"AccountUpdateBalances",
"updates",
"ptc",
"psc",
"and",
"eth",
"balance",
"values",
"."
]
| [
"func",
"(",
"w",
"*",
"Worker",
")",
"AccountUpdateBalances",
"(",
"job",
"*",
"<mask>",
".",
"Job",
")",
"error",
"{",
"return",
"w",
".",
"updateAccountBalancesJob",
"(",
"job",
",",
"data",
".",
"JobAccountUpdateBalances",
")",
"\n",
"}"
]
|
19,654 | all-19655 | [
"DeleteRepo",
"deletes",
"a",
"repo",
"and",
"reclaims",
"the",
"storage",
"space",
"it",
"was",
"using",
".",
"Note",
"that",
"as",
"of",
"1",
".",
"0",
"we",
"do",
"not",
"reclaim",
"the",
"blocks",
"that",
"the",
"Repo",
"was",
"referencing",
"this",
"is",
"because",
"they",
"may",
"also",
"be",
"referenced",
"by",
"other",
"Repos",
"and",
"deleting",
"them",
"would",
"make",
"those",
"Repos",
"inaccessible",
".",
"This",
"will",
"be",
"resolved",
"in",
"later",
"versions",
".",
"If",
"force",
"is",
"set",
"to",
"true",
"the",
"repo",
"will",
"be",
"removed",
"regardless",
"of",
"errors",
".",
"This",
"argument",
"should",
"be",
"used",
"with",
"care",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"DeleteRepo",
"(",
"repoName",
"string",
",",
"force",
"bool",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"DeleteRepo",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"DeleteRepoRequest",
"{",
"Repo",
":",
"NewRepo",
"(",
"repoName",
")",
",",
"Force",
":",
"<mask>",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
]
|
19,655 | all-19656 | [
"<template",
"-",
"args",
">",
"::",
"=",
"I",
"<template",
"-",
"arg",
">",
"+",
"E"
]
| [
"func",
"(",
"st",
"*",
"state",
")",
"templateArgs",
"(",
")",
"[",
"]",
"AST",
"{",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"(",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'I'",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'J'",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n\n",
"<mask>",
"ret",
"[",
"]",
"AST",
"\n",
"for",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'E'",
"{",
"arg",
":=",
"st",
".",
"templateArg",
"(",
")",
"\n",
"ret",
"=",
"append",
"(",
"ret",
",",
"arg",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"return",
"ret",
"\n",
"}"
]
|
19,656 | all-19657 | [
"GetCreatedBy",
"returns",
"the",
"CreatedBy",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetCreatedBy",
"(",
")",
"SyntheticsUser",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"CreatedBy",
"==",
"nil",
"{",
"return",
"SyntheticsUser",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"CreatedBy",
"\n",
"}"
]
|
19,657 | all-19658 | [
"Produce",
"go",
"type",
"name",
"from",
"given",
"ruby",
"type",
"name"
]
| [
"func",
"toGoTypeName",
"(",
"name",
"string",
")",
"string",
"{",
"switch",
"name",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"\"",
"\"",
":",
"return",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"panic",
"(",
"\"",
"\"",
"+",
"name",
"+",
"\"",
"\"",
")",
"\n",
"default",
":",
"if",
"strings",
".",
"Contains",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"elems",
":=",
"strings",
".",
"Split",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"elems",
"[",
"2",
":",
"len",
"(",
"elems",
")",
"]",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"name",
"\n",
"}",
"\n\n",
"}"
]
|
19,658 | all-19659 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"CookieSameSite",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
19,659 | all-19660 | [
"listen",
"is",
"used",
"to",
"handling",
"incoming",
"connections",
"."
]
| [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"listen",
"(",
")",
"{",
"const",
"baseDelay",
"=",
"5",
"*",
"time",
".",
"Millisecond",
"\n",
"const",
"maxDelay",
"=",
"1",
"*",
"time",
".",
"Second",
"\n\n",
"var",
"loopDelay",
"time",
".",
"Duration",
"\n",
"for",
"{",
"// Accept incoming connections",
"conn",
",",
"err",
":=",
"n",
".",
"<mask>",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"loopDelay",
"==",
"0",
"{",
"loopDelay",
"=",
"baseDelay",
"\n",
"}",
"else",
"{",
"loopDelay",
"*=",
"2",
"\n",
"}",
"\n\n",
"if",
"loopDelay",
">",
"maxDelay",
"{",
"loopDelay",
"=",
"maxDelay",
"\n",
"}",
"\n\n",
"if",
"!",
"n",
".",
"IsShutdown",
"(",
")",
"{",
"n",
".",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"select",
"{",
"case",
"<-",
"n",
".",
"shutdownCh",
":",
"return",
"\n",
"case",
"<-",
"time",
".",
"After",
"(",
"loopDelay",
")",
":",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"// No error, reset loop delay",
"loopDelay",
"=",
"0",
"\n\n",
"n",
".",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"n",
".",
"LocalAddr",
"(",
")",
",",
"conn",
".",
"RemoteAddr",
"(",
")",
")",
"\n\n",
"// Handle the connection in dedicated routine",
"go",
"n",
".",
"handleConn",
"(",
"n",
".",
"getStreamContext",
"(",
")",
",",
"conn",
")",
"\n",
"}",
"\n",
"}"
]
|
19,660 | all-19661 | [
"Reconstruct",
"payload",
"map",
"from",
"flatten",
"values"
]
| [
"func",
"buildPayload",
"(",
"values",
"[",
"]",
"APIParams",
")",
"(",
"APIParams",
",",
"error",
")",
"{",
"payload",
":=",
"APIParams",
"{",
"}",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"values",
"{",
"// Only one iteration below, flatten params only have one element each",
"for",
"name",
",",
"param",
":=",
"range",
"value",
"{",
"if",
"_",
",",
"err",
":=",
"Normalize",
"(",
"payload",
",",
"name",
",",
"param",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"payload",
",",
"nil",
"\n",
"}"
]
|
19,661 | all-19662 | [
"AddEntryAt",
"adds",
"an",
"entry",
"if",
"missing",
"returns",
"the",
"entry",
"at",
"specific",
"position",
"."
]
| [
"func",
"(",
"geoIndex",
"*",
"geoIndex",
")",
"AddEntryAt",
"(",
"point",
"Point",
")",
"interface",
"{",
"}",
"{",
"square",
":=",
"cellOf",
"(",
"point",
",",
"geoIndex",
".",
"resolution",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"geoIndex",
".",
"index",
"[",
"square",
"]",
";",
"!",
"ok",
"{",
"geoIndex",
".",
"index",
"[",
"square",
"]",
"=",
"geoIndex",
".",
"newEntry",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"geoIndex",
".",
"<mask>",
"[",
"square",
"]",
"\n",
"}"
]
|
19,662 | all-19663 | [
"DataSize",
"parses",
"human",
"readable",
"data",
"sizes",
"(",
"e",
".",
"g",
".",
"4K",
"20M",
"or",
"5G",
")",
"and",
"returns",
"the",
"amount",
"of",
"bytes",
"they",
"represent",
"."
]
| [
"func",
"DataSize",
"(",
"str",
"string",
")",
"uint64",
"{",
"const",
"msg",
"=",
"\"",
"\"",
"\n\n",
"// check length",
"if",
"len",
"(",
"str",
")",
"<",
"2",
"{",
"panic",
"(",
"msg",
")",
"\n",
"}",
"\n\n",
"// get symbol",
"sym",
":=",
"string",
"(",
"str",
"[",
"len",
"(",
"str",
")",
"-",
"1",
"]",
")",
"\n\n",
"// parse number",
"num",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"str",
"[",
":",
"len",
"(",
"str",
")",
"-",
"1",
"]",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"<mask>",
")",
"\n",
"}",
"\n\n",
"// calculate size",
"switch",
"sym",
"{",
"case",
"\"",
"\"",
":",
"return",
"num",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"return",
"num",
"*",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"return",
"num",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"\n",
"}",
"\n\n",
"panic",
"(",
"msg",
")",
"\n",
"}"
]
|
19,663 | all-19664 | [
"hasSynced",
"returns",
"true",
"when",
"every",
"prowjob",
"and",
"pipeline",
"informer",
"has",
"synced",
"."
]
| [
"func",
"(",
"c",
"*",
"controller",
")",
"hasSynced",
"(",
")",
"bool",
"{",
"if",
"!",
"c",
".",
"pjInformer",
".",
"HasSynced",
"(",
")",
"{",
"if",
"c",
".",
"wait",
"!=",
"\"",
"\"",
"{",
"c",
".",
"wait",
"=",
"\"",
"\"",
"\n",
"ns",
":=",
"c",
".",
"pjNamespace",
"(",
")",
"\n",
"if",
"ns",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"ns",
")",
"\n",
"}",
"\n",
"return",
"false",
"// still syncing prowjobs",
"\n",
"}",
"\n",
"if",
"!",
"c",
".",
"prowJobsDone",
"{",
"c",
".",
"prowJobsDone",
"=",
"true",
"\n",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"pipelinesDone",
"==",
"nil",
"{",
"c",
".",
"pipelinesDone",
"=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"}",
"\n",
"for",
"n",
",",
"cfg",
":=",
"range",
"c",
".",
"pipelines",
"{",
"if",
"!",
"cfg",
".",
"informer",
".",
"Informer",
"(",
")",
".",
"HasSynced",
"(",
")",
"{",
"if",
"c",
".",
"wait",
"!=",
"n",
"{",
"c",
".",
"wait",
"=",
"n",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"return",
"false",
"// still syncing pipelines in at least one cluster",
"\n",
"}",
"else",
"if",
"!",
"c",
".",
"pipelinesDone",
"[",
"n",
"]",
"{",
"c",
".",
"pipelinesDone",
"[",
"n",
"]",
"=",
"true",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"// Everyone is synced",
"\n",
"}"
]
|
19,664 | all-19665 | [
"Do",
"executes",
"DOM",
".",
"setAttributeValue",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetAttributeValueParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetAttributeValue",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
19,665 | all-19666 | [
"FetchByShortID",
"returns",
"a",
"peer",
"matching",
"the",
"passed",
"short",
"ID",
".",
"If",
"no",
"matching",
"peer",
"is",
"found",
"FetchByShortID",
"returns",
"nil",
"."
]
| [
"func",
"(",
"peers",
"*",
"Peers",
")",
"FetchByShortID",
"(",
"shortID",
"PeerShortID",
")",
"*",
"Peer",
"{",
"peers",
".",
"RLock",
"(",
")",
"\n",
"defer",
"peers",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"peers",
".",
"byShortID",
"[",
"shortID",
"]",
".",
"<mask>",
"\n",
"}"
]
|
19,666 | all-19667 | [
"Diff",
"returns",
"the",
"diff",
"of",
"two",
"hashtrees",
"at",
"particular",
"paths",
"."
]
| [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"Diff",
"(",
"oldHashTree",
"HashTree",
",",
"newPath",
"string",
",",
"oldPath",
"string",
",",
"recursiveDepth",
"int64",
",",
"f",
"func",
"(",
"path",
"string",
",",
"node",
"*",
"NodeProto",
",",
"new",
"bool",
")",
"error",
")",
"(",
"retErr",
"error",
")",
"{",
"// Setup a txn for each hashtree, this is a bit complicated because we don't want to make 2 read tx to the same tree, if we did then should someone start a write tx inbetween them we would have a deadlock",
"old",
":=",
"oldHashTree",
".",
"(",
"*",
"dbHashTree",
")",
"\n",
"if",
"old",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"rollback",
":=",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"{",
"if",
"err",
":=",
"tx",
".",
"Rollback",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"newTx",
"*",
"bolt",
".",
"Tx",
"\n",
"var",
"oldTx",
"*",
"bolt",
".",
"Tx",
"\n",
"if",
"h",
"==",
"oldHashTree",
"{",
"tx",
",",
"err",
":=",
"h",
".",
"Begin",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"newTx",
"=",
"tx",
"\n",
"oldTx",
"=",
"tx",
"\n",
"defer",
"rollback",
"(",
"tx",
")",
"\n",
"}",
"else",
"{",
"var",
"err",
"error",
"\n",
"newTx",
",",
"err",
"=",
"h",
".",
"Begin",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"rollback",
"(",
"newTx",
")",
"\n",
"oldTx",
",",
"err",
"=",
"<mask>",
".",
"Begin",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"rollback",
"(",
"oldTx",
")",
"\n",
"}",
"\n",
"return",
"diff",
"(",
"newTx",
",",
"oldTx",
",",
"newPath",
",",
"oldPath",
",",
"recursiveDepth",
",",
"f",
")",
"\n",
"}"
]
|
19,667 | all-19668 | [
"HasQueryType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"HasQueryType",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"QueryType",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,668 | all-19669 | [
"TimeoutErrorWithResponse",
"marks",
"the",
"ctx",
"as",
"timed",
"out",
"and",
"sends",
"the",
"given",
"response",
"to",
"the",
"client",
".",
"All",
"ctx",
"modifications",
"after",
"TimeoutErrorWithResponse",
"call",
"are",
"ignored",
".",
"TimeoutErrorWithResponse",
"MUST",
"be",
"called",
"before",
"returning",
"from",
"RequestHandler",
"if",
"there",
"are",
"references",
"to",
"ctx",
"and",
"/",
"or",
"its",
"members",
"in",
"other",
"goroutines",
"remain",
".",
"Usage",
"of",
"this",
"function",
"is",
"discouraged",
".",
"Prefer",
"eliminating",
"ctx",
"references",
"from",
"pending",
"goroutines",
"instead",
"of",
"using",
"this",
"function",
"."
]
| [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"TimeoutErrorWithResponse",
"(",
"resp",
"*",
"<mask>",
")",
"{",
"respCopy",
":=",
"&",
"Response",
"{",
"}",
"\n",
"resp",
".",
"CopyTo",
"(",
"respCopy",
")",
"\n",
"ctx",
".",
"timeoutResponse",
"=",
"respCopy",
"\n",
"}"
]
|
19,669 | all-19670 | [
"New",
"returns",
"a",
"new",
"parser",
"of",
"the",
"byte",
"slice",
"."
]
| [
"func",
"New",
"(",
"b",
"[",
"]",
"<mask>",
",",
"contentType",
"string",
")",
"Parser",
"{",
"mediaType",
",",
"_",
",",
"err",
":=",
"mime",
".",
"ParseMediaType",
"(",
"contentType",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"mediaType",
"==",
"\"",
"\"",
"{",
"return",
"NewOpenMetricsParser",
"(",
"b",
")",
"\n",
"}",
"\n",
"return",
"NewPromParser",
"(",
"b",
")",
"\n",
"}"
]
|
19,670 | all-19671 | [
"SetMarkupColumn",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_markup_column",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetMarkupColumn",
"(",
"column",
"int",
")",
"{",
"C",
".",
"gtk_icon_view_set_markup_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
19,671 | all-19672 | [
"PolicyConfigurationNamespaces",
"returns",
"a",
"list",
"of",
"other",
"policy",
"configuration",
"namespaces",
"to",
"search",
"for",
"if",
"explicit",
"configuration",
"for",
"PolicyConfigurationIdentity",
"()",
"is",
"not",
"set",
".",
"The",
"list",
"will",
"be",
"processed",
"in",
"order",
"terminating",
"on",
"first",
"match",
"and",
"an",
"implicit",
"is",
"always",
"checked",
"at",
"the",
"end",
".",
"It",
"is",
"STRONGLY",
"recommended",
"for",
"the",
"first",
"element",
"if",
"any",
"to",
"be",
"a",
"prefix",
"of",
"PolicyConfigurationIdentity",
"()",
"and",
"each",
"following",
"element",
"to",
"be",
"a",
"prefix",
"of",
"the",
"element",
"preceding",
"it",
"."
]
| [
"func",
"(",
"ref",
"ociReference",
")",
"PolicyConfigurationNamespaces",
"(",
")",
"[",
"]",
"string",
"{",
"res",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"path",
":=",
"ref",
".",
"resolvedDir",
"\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",
"<mask>",
"=",
"append",
"(",
"res",
",",
"path",
")",
"\n",
"path",
"=",
"path",
"[",
":",
"lastSlash",
"]",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
19,672 | all-19673 | [
"NewOAuthAuthenticator",
"returns",
"a",
"authenticator",
"that",
"uses",
"a",
"oauth",
"refresh",
"token",
"to",
"create",
"access",
"tokens",
".",
"The",
"refresh",
"token",
"can",
"be",
"found",
"in",
"the",
"CM",
"dashboard",
"under",
"Settings",
">",
"Account",
"Settings",
">",
"API",
"Credentials",
".",
"Specifying",
"the",
"accountID",
"is",
"only",
"required",
"if",
"the",
"API",
"requires",
"the",
"X",
"-",
"Account",
"header",
"to",
"be",
"set",
"(",
"this",
"is",
"true",
"of",
"CM",
"1",
".",
"6",
"at",
"the",
"moment",
")",
"."
]
| [
"func",
"NewOAuthAuthenticator",
"(",
"token",
"string",
",",
"accountID",
"int",
")",
"Authenticator",
"{",
"return",
"&",
"oAuthSigner",
"{",
"refreshToken",
":",
"token",
",",
"refreshAt",
":",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"-",
"2",
"*",
"<mask>",
".",
"Minute",
")",
",",
"client",
":",
"httpclient",
".",
"New",
"(",
")",
",",
"accountID",
":",
"accountID",
",",
"}",
"\n",
"}"
]
|
19,673 | all-19674 | [
"DeleteVolume",
"deletes",
"a",
"volume"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteVolume",
"(",
"dcid",
",",
"volid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"<mask>",
":=",
"volumePath",
"(",
"dcid",
",",
"volid",
")",
"\n",
"ret",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
19,674 | all-19675 | [
"/",
"*",
"Set",
"the",
"name",
"of",
"a",
"transaction",
"."
]
| [
"func",
"TransactionSetName",
"(",
"id",
"int64",
",",
"name",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"cname",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cname",
")",
")",
"\n\n",
"return",
"errNo",
"(",
"C",
".",
"newrelic_transaction_set_name",
"(",
"C",
".",
"long",
"(",
"id",
")",
",",
"cname",
")",
")",
"\n",
"}"
]
|
19,675 | all-19676 | [
"GetLiveOk",
"returns",
"a",
"tuple",
"with",
"the",
"Live",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TimeRange",
")",
"GetLiveOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Live",
"==",
"nil",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Live",
",",
"<mask>",
"\n",
"}"
]
|
19,676 | all-19677 | [
"/",
"*",
"func",
"printKeyInfo",
"(",
"privKeyBytes",
"[]",
"byte",
"pubKeyBytes",
"[]",
"byte",
"chain",
"[]",
"byte",
")",
"{",
"if",
"pubKeyBytes",
"==",
"nil",
"{",
"pubKeyBytes",
"=",
"PubKeyBytesFromPrivKeyBytes",
"(",
"privKeyBytes",
"true",
")",
"}",
"addr",
":",
"=",
"AddrFromPubKeyBytes",
"(",
"pubKeyBytes",
")",
"log",
".",
"Println",
"(",
"\\",
"nprikey",
":",
"\\",
"t%v",
"\\",
"npubKeyBytes",
":",
"\\",
"t%v",
"\\",
"naddr",
":",
"\\",
"t%v",
"\\",
"nchain",
":",
"\\",
"t%v",
"HexEncode",
"(",
"privKeyBytes",
")",
"HexEncode",
"(",
"pubKeyBytes",
")",
"addr",
"HexEncode",
"(",
"chain",
"))",
"}",
"-------------------------------------------------------------------",
"DerivePrivateKeyForPath",
"derives",
"the",
"private",
"key",
"by",
"following",
"the",
"path",
"from",
"privKeyBytes",
"using",
"the",
"given",
"chainCode",
"."
]
| [
"func",
"DerivePrivateKeyForPath",
"(",
"privKeyBytes",
"[",
"]",
"byte",
",",
"chainCode",
"[",
"]",
"byte",
",",
"path",
"string",
")",
"[",
"]",
"<mask>",
"{",
"data",
":=",
"privKeyBytes",
"\n",
"parts",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"part",
":=",
"range",
"parts",
"{",
"prime",
":=",
"part",
"[",
"len",
"(",
"part",
")",
"-",
"1",
":",
"]",
"==",
"\"",
"\"",
"\n",
"// prime == private derivation. Otherwise public.",
"if",
"prime",
"{",
"part",
"=",
"part",
"[",
":",
"len",
"(",
"part",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"part",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"i",
"<",
"0",
"{",
"panic",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"data",
",",
"chainCode",
"=",
"DerivePrivateKey",
"(",
"data",
",",
"chainCode",
",",
"uint32",
"(",
"i",
")",
",",
"prime",
")",
"\n",
"//printKeyInfo(data, nil, chain)",
"}",
"\n",
"return",
"data",
"\n",
"}"
]
|
19,677 | all-19678 | [
"UpdateTeamRepo",
"adds",
"the",
"repo",
"to",
"the",
"team",
"with",
"the",
"provided",
"role",
".",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"teams",
"/",
"#add",
"-",
"or",
"-",
"update",
"-",
"team",
"-",
"repository"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateTeamRepo",
"(",
"id",
"int",
",",
"org",
",",
"repo",
"string",
",",
"permission",
"RepoPermissionLevel",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"id",
",",
"org",
",",
"repo",
",",
"permission",
")",
"\n",
"if",
"c",
".",
"fake",
"||",
"c",
".",
"dry",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"data",
":=",
"struct",
"{",
"Permission",
"string",
"`json:\"permission\"`",
"\n",
"}",
"{",
"Permission",
":",
"string",
"(",
"permission",
")",
",",
"}",
"\n\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPut",
",",
"<mask>",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
",",
"org",
",",
"repo",
")",
",",
"requestBody",
":",
"&",
"data",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
19,678 | all-19679 | [
"GetColumnProjectCard",
"of",
"a",
"specific",
"issue",
"or",
"PR",
"for",
"a",
"specific",
"column",
"in",
"a",
"board",
"/",
"project",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"projects",
"/",
"cards",
"/",
"#list",
"-",
"project",
"-",
"cards"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"GetColumnProjectCard",
"(",
"columnID",
"int",
",",
"cardNumber",
"int",
")",
"(",
"*",
"ProjectCard",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"columnID",
",",
"cardNumber",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"columnID",
")",
"\n",
"var",
"cards",
"[",
"]",
"ProjectCard",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"ProjectCard",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"cards",
"=",
"append",
"(",
"cards",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"ProjectCard",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"cards",
"{",
"if",
"card",
".",
"ContentID",
"==",
"cardNumber",
"{",
"return",
"&",
"card",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
]
|
19,679 | all-19680 | [
"Update",
"updates",
"the",
"current",
"stored",
"value",
"."
]
| [
"func",
"(",
"g",
"*",
"Gauge",
")",
"Update",
"(",
"v",
"float64",
")",
"{",
"atomic",
".",
"StoreUint64",
"(",
"&",
"g",
".",
"<mask>",
",",
"math",
".",
"Float64bits",
"(",
"v",
")",
")",
"\n",
"}"
]
|
19,680 | all-19681 | [
"NewFilteredAppInformer",
"constructs",
"a",
"new",
"informer",
"for",
"App",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
".",
"This",
"reduces",
"memory",
"footprint",
"and",
"number",
"of",
"connections",
"to",
"the",
"server",
"."
]
| [
"func",
"NewFilteredAppInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"cache",
".",
"Indexers",
",",
"tweakListOptions",
"internalinterfaces",
".",
"TweakListOptionsFunc",
")",
"cache",
".",
"SharedIndexInformer",
"{",
"return",
"cache",
".",
"NewSharedIndexInformer",
"(",
"&",
"cache",
".",
"ListWatch",
"{",
"ListFunc",
":",
"func",
"(",
"options",
"meta_v1",
".",
"ListOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"error",
")",
"{",
"if",
"tweakListOptions",
"!=",
"nil",
"{",
"tweakListOptions",
"(",
"&",
"options",
")",
"\n",
"}",
"\n",
"return",
"client",
".",
"TsuruV1",
"(",
")",
".",
"Apps",
"(",
"namespace",
")",
".",
"List",
"(",
"options",
")",
"\n",
"}",
",",
"WatchFunc",
":",
"func",
"(",
"options",
"meta_v1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"if",
"tweakListOptions",
"!=",
"nil",
"{",
"tweakListOptions",
"(",
"&",
"options",
")",
"\n",
"}",
"\n",
"return",
"client",
".",
"TsuruV1",
"(",
")",
".",
"Apps",
"(",
"namespace",
")",
".",
"Watch",
"(",
"<mask>",
")",
"\n",
"}",
",",
"}",
",",
"&",
"tsuru_v1",
".",
"App",
"{",
"}",
",",
"resyncPeriod",
",",
"indexers",
",",
")",
"\n",
"}"
]
|
19,681 | all-19682 | [
"AcquireTimer",
"returns",
"a",
"time",
".",
"Timer",
"from",
"the",
"pool",
"and",
"updates",
"it",
"to",
"send",
"the",
"current",
"time",
"on",
"its",
"channel",
"after",
"at",
"least",
"timeout",
".",
"The",
"returned",
"Timer",
"may",
"be",
"returned",
"to",
"the",
"pool",
"with",
"ReleaseTimer",
"when",
"no",
"longer",
"needed",
".",
"This",
"allows",
"reducing",
"GC",
"load",
"."
]
| [
"func",
"AcquireTimer",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"<mask>",
".",
"Timer",
"{",
"v",
":=",
"timerPool",
".",
"Get",
"(",
")",
"\n",
"if",
"v",
"==",
"nil",
"{",
"return",
"time",
".",
"NewTimer",
"(",
"timeout",
")",
"\n",
"}",
"\n",
"t",
":=",
"v",
".",
"(",
"*",
"time",
".",
"Timer",
")",
"\n",
"initTimer",
"(",
"t",
",",
"timeout",
")",
"\n",
"return",
"t",
"\n",
"}"
]
|
19,682 | all-19683 | [
"Ring",
"returns",
"an",
"instance",
"of",
"the",
"current",
"Ring"
]
| [
"func",
"(",
"o",
"*",
"<mask>",
")",
"Ring",
"(",
")",
"ring",
".",
"Ring",
"{",
"o",
".",
"RLock",
"(",
")",
"\n",
"defer",
"o",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"o",
".",
"ring",
"\n",
"}"
]
|
19,683 | all-19684 | [
"AddTask",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskEngine",
")",
"AddTask",
"(",
"arg0",
"*",
"<mask>",
".",
"Task",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
]
|
19,684 | all-19685 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
]
| [
"func",
"(",
"r",
"*",
"Password",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// validation is performed later on",
"*",
"r",
"=",
"Password",
"(",
"string",
"(",
"<mask>",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,685 | all-19686 | [
"Sync",
"converts",
"target",
"groups",
"into",
"actual",
"scrape",
"targets",
"and",
"synchronizes",
"the",
"currently",
"running",
"scraper",
"with",
"the",
"resulting",
"set",
"and",
"returns",
"all",
"scraped",
"and",
"dropped",
"targets",
"."
]
| [
"func",
"(",
"sp",
"*",
"scrapePool",
")",
"Sync",
"(",
"tgs",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"var",
"all",
"[",
"]",
"*",
"Target",
"\n",
"sp",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"sp",
".",
"droppedTargets",
"=",
"[",
"]",
"*",
"Target",
"{",
"}",
"\n",
"for",
"_",
",",
"tg",
":=",
"range",
"tgs",
"{",
"targets",
",",
"err",
":=",
"targetsFromGroup",
"(",
"tg",
",",
"sp",
".",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"sp",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"targets",
"{",
"if",
"t",
".",
"Labels",
"(",
")",
".",
"Len",
"(",
")",
">",
"0",
"{",
"all",
"=",
"append",
"(",
"all",
",",
"t",
")",
"\n",
"}",
"else",
"if",
"t",
".",
"DiscoveredLabels",
"(",
")",
".",
"Len",
"(",
")",
">",
"0",
"{",
"sp",
".",
"droppedTargets",
"=",
"<mask>",
"(",
"sp",
".",
"droppedTargets",
",",
"t",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"sp",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"sp",
".",
"sync",
"(",
"all",
")",
"\n\n",
"targetSyncIntervalLength",
".",
"WithLabelValues",
"(",
"sp",
".",
"config",
".",
"JobName",
")",
".",
"Observe",
"(",
"time",
".",
"Since",
"(",
"start",
")",
".",
"Seconds",
"(",
")",
",",
")",
"\n",
"targetScrapePoolSyncsCounter",
".",
"WithLabelValues",
"(",
"sp",
".",
"config",
".",
"JobName",
")",
".",
"Inc",
"(",
")",
"\n",
"}"
]
|
19,686 | all-19687 | [
"lexIdentifier",
"scans",
"an",
"alphanumeric",
"identifier",
".",
"The",
"next",
"character",
"is",
"known",
"to",
"be",
"a",
"letter",
"."
]
| [
"func",
"lexIdentifier",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"for",
"isAlphaNumeric",
"(",
"l",
".",
"<mask>",
"(",
")",
")",
"{",
"// absorb",
"}",
"\n",
"l",
".",
"backup",
"(",
")",
"\n",
"l",
".",
"emit",
"(",
"ItemIdentifier",
")",
"\n",
"return",
"lexStatements",
"\n",
"}"
]
|
19,687 | all-19688 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"TrustLineFlags"
]
| [
"func",
"(",
"e",
"TrustLineFlags",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"trustLineFlagsMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
]
|
19,688 | all-19689 | [
"/",
"*",
"Utilities",
"randomAzureStorageAccountName",
"generates",
"a",
"valid",
"storage",
"account",
"name",
"prefixed",
"with",
"a",
"predefined",
"string",
".",
"Availability",
"of",
"the",
"name",
"is",
"not",
"checked",
".",
"Uses",
"maximum",
"length",
"to",
"maximise",
"randomness",
"."
]
| [
"func",
"randomAzureStorageAccountName",
"(",
")",
"<mask>",
"{",
"const",
"(",
"maxLen",
"=",
"24",
"\n",
"chars",
"=",
"\"",
"\"",
"\n",
")",
"\n",
"return",
"storageAccountPrefix",
"+",
"randomString",
"(",
"maxLen",
"-",
"len",
"(",
"storageAccountPrefix",
")",
",",
"chars",
")",
"\n",
"}"
]
|
19,689 | all-19690 | [
"ns1SubmitChanges",
"takes",
"an",
"array",
"of",
"changes",
"and",
"sends",
"them",
"to",
"NS1"
]
| [
"func",
"(",
"p",
"*",
"NS1Provider",
")",
"ns1SubmitChanges",
"(",
"changes",
"[",
"]",
"*",
"ns1Change",
")",
"error",
"{",
"// return early if there is nothing to change",
"if",
"len",
"(",
"changes",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"zones",
",",
"err",
":=",
"p",
".",
"zonesFiltered",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// separate into per-zone change sets to be passed to the API.",
"changesByZone",
":=",
"ns1ChangesByZone",
"(",
"zones",
",",
"<mask>",
")",
"\n",
"for",
"zoneName",
",",
"changes",
":=",
"range",
"changesByZone",
"{",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
"{",
"record",
":=",
"ns1BuildRecord",
"(",
"zoneName",
",",
"change",
")",
"\n",
"logFields",
":=",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"record",
".",
"Domain",
",",
"\"",
"\"",
":",
"record",
".",
"Type",
",",
"\"",
"\"",
":",
"record",
".",
"TTL",
",",
"\"",
"\"",
":",
"change",
".",
"Action",
",",
"\"",
"\"",
":",
"zoneName",
",",
"}",
"\n\n",
"log",
".",
"WithFields",
"(",
"logFields",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"p",
".",
"dryRun",
"{",
"continue",
"\n",
"}",
"\n\n",
"switch",
"change",
".",
"Action",
"{",
"case",
"ns1Create",
":",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"CreateRecord",
"(",
"record",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"ns1Delete",
":",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"DeleteRecord",
"(",
"zoneName",
",",
"record",
".",
"Domain",
",",
"record",
".",
"Type",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"ns1Update",
":",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"UpdateRecord",
"(",
"record",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,690 | all-19691 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
]
| [
"func",
"(",
"r",
"*",
"IdentityProvider",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"IdentityProviderLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"IdentityProviderLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,691 | all-19692 | [
"QuoteItems",
"quotes",
"all",
"items",
"in",
"array",
"mostly",
"for",
"debugging",
"."
]
| [
"func",
"QuoteItems",
"(",
"arr",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"<mask>",
"(",
"arr",
",",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"strconv",
".",
"Quote",
"(",
"s",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
19,692 | all-19693 | [
"GetDate",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_get_date",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Calendar",
")",
"GetDate",
"(",
")",
"(",
"year",
",",
"<mask>",
",",
"day",
"uint",
")",
"{",
"var",
"cyear",
",",
"cmonth",
",",
"cday",
"C",
".",
"guint",
"\n",
"C",
".",
"gtk_calendar_get_date",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"cyear",
",",
"&",
"cmonth",
",",
"&",
"cday",
")",
"\n",
"return",
"uint",
"(",
"cyear",
")",
",",
"uint",
"(",
"cmonth",
")",
",",
"uint",
"(",
"cday",
")",
"\n",
"}"
]
|
19,693 | all-19694 | [
"Get",
"retrieves",
"an",
"error",
"from",
"the",
"request",
"s",
"context",
".",
"It",
"returns",
"nil",
"if",
"the",
"request",
"was",
"not",
"configured",
"to",
"store",
"errors",
"."
]
| [
"func",
"Get",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"errptr",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"errorKey",
")",
".",
"(",
"*",
"error",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"*",
"errptr",
"\n",
"}"
]
|
19,694 | all-19695 | [
"mergeLabels",
"merges",
"two",
"sets",
"of",
"sorted",
"proto",
"labels",
"preferring",
"those",
"in",
"primary",
"to",
"those",
"in",
"secondary",
"when",
"there",
"is",
"an",
"overlap",
"."
]
| [
"func",
"mergeLabels",
"(",
"primary",
",",
"secondary",
"[",
"]",
"prompb",
".",
"Label",
")",
"[",
"]",
"prompb",
".",
"Label",
"{",
"result",
":=",
"<mask>",
"(",
"[",
"]",
"prompb",
".",
"Label",
",",
"0",
",",
"len",
"(",
"primary",
")",
"+",
"len",
"(",
"secondary",
")",
")",
"\n",
"i",
",",
"j",
":=",
"0",
",",
"0",
"\n",
"for",
"i",
"<",
"len",
"(",
"primary",
")",
"&&",
"j",
"<",
"len",
"(",
"secondary",
")",
"{",
"if",
"primary",
"[",
"i",
"]",
".",
"Name",
"<",
"secondary",
"[",
"j",
"]",
".",
"Name",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"primary",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"}",
"else",
"if",
"primary",
"[",
"i",
"]",
".",
"Name",
">",
"secondary",
"[",
"j",
"]",
".",
"Name",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"secondary",
"[",
"j",
"]",
")",
"\n",
"j",
"++",
"\n",
"}",
"else",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"primary",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"j",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"for",
";",
"i",
"<",
"len",
"(",
"primary",
")",
";",
"i",
"++",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"primary",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"for",
";",
"j",
"<",
"len",
"(",
"secondary",
")",
";",
"j",
"++",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"secondary",
"[",
"j",
"]",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
]
|
19,695 | all-19696 | [
"NewReader",
"creates",
"a",
"new",
"hashtree",
"reader",
"."
]
| [
"func",
"NewReader",
"(",
"r",
"io",
".",
"Reader",
",",
"filter",
"Filter",
")",
"*",
"Reader",
"{",
"return",
"&",
"Reader",
"{",
"pbr",
":",
"pbutil",
".",
"NewReader",
"(",
"r",
")",
",",
"filter",
":",
"<mask>",
",",
"}",
"\n",
"}"
]
|
19,696 | all-19697 | [
"SizeGroupNew",
"is",
"a",
"wrapper",
"around",
"gtk_size_group_new",
"()",
"."
]
| [
"func",
"SizeGroupNew",
"(",
"mode",
"SizeGroupMode",
")",
"(",
"*",
"SizeGroup",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_size_group_new",
"(",
"C",
".",
"GtkSizeGroupMode",
"(",
"<mask>",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapSizeGroup",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
]
|
19,697 | all-19698 | [
"Encode",
"serializes",
"a",
"JWT",
"using",
"the",
"Algorithm",
"and",
"Signer",
"."
]
| [
"func",
"(",
"alg",
"Algorithm",
")",
"Encode",
"(",
"signer",
"Signer",
",",
"obj",
"<mask>",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"Encode",
"(",
"alg",
",",
"signer",
",",
"obj",
")",
"\n",
"}"
]
|
19,698 | all-19699 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetScriptSourceReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger33",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,699 | all-19700 | [
"Watching",
"determines",
"if",
"the",
"given",
"dependency",
"is",
"being",
"watched",
"."
]
| [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Watching",
"(",
"d",
"dep",
".",
"Dependency",
")",
"bool",
"{",
"w",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"Unlock",
"(",
")",
"\n\n",
"_",
",",
"ok",
":=",
"w",
".",
"depViewMap",
"[",
"d",
".",
"String",
"(",
")",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.