id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
15,400 | all-15401 | [
"Insert",
"inserts",
"a",
"RangerEntry",
"into",
"ranger",
"."
] | [
"func",
"(",
"b",
"*",
"bruteRanger",
")",
"Insert",
"(",
"entry",
"RangerEntry",
")",
"error",
"{",
"network",
":=",
"entry",
".",
"Network",
"(",
")",
"\n",
"key",
":=",
"network",
".",
"String",
"(",
")",
"\n",
"if",
"_",
",",
"<mask>",
":=",
"b",
".",
"ipV4Entries",
"[",
"key",
"]",
";",
"!",
"found",
"{",
"entries",
",",
"err",
":=",
"b",
".",
"getEntriesByVersion",
"(",
"entry",
".",
"Network",
"(",
")",
".",
"IP",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"entries",
"[",
"key",
"]",
"=",
"entry",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,401 | all-15402 | [
"CanonicalLink",
"returns",
"a",
"link",
"to",
"where",
"pod",
"logs",
"are",
"streamed"
] | [
"func",
"(",
"a",
"*",
"PodLogArtifact",
")",
"CanonicalLink",
"(",
")",
"string",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"a",
".",
"<mask>",
"}",
",",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"a",
".",
"buildID",
"}",
",",
"}",
"\n",
"u",
":=",
"url",
".",
"URL",
"{",
"Path",
":",
"\"",
"\"",
",",
"RawQuery",
":",
"q",
".",
"Encode",
"(",
")",
",",
"}",
"\n",
"return",
"u",
".",
"String",
"(",
")",
"\n",
"}"
] |
15,402 | all-15403 | [
"failEarlier",
"is",
"like",
"fail",
"but",
"decrements",
"the",
"offset",
"to",
"indicate",
"that",
"the",
"point",
"of",
"failure",
"occurred",
"earlier",
"in",
"the",
"string",
"."
] | [
"func",
"(",
"st",
"*",
"<mask>",
")",
"failEarlier",
"(",
"err",
"string",
",",
"dec",
"int",
")",
"{",
"if",
"st",
".",
"off",
"<",
"dec",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"panic",
"(",
"demangleErr",
"{",
"err",
":",
"err",
",",
"off",
":",
"st",
".",
"off",
"-",
"dec",
"}",
")",
"\n",
"}"
] |
15,403 | all-15404 | [
"Account",
"returns",
"an",
"account",
"type",
"with",
"the",
"given",
"name"
] | [
"func",
"(",
"dom",
"*",
"Domain",
")",
"Account",
"(",
"name",
"string",
")",
"*",
"Account",
"{",
"return",
"&",
"Account",
"{",
"<mask>",
":",
"dom",
",",
"Name",
":",
"name",
"}",
"\n",
"}"
] |
15,404 | all-15405 | [
"renderGlyph",
"renders",
"a",
"glyph",
"then",
"caches",
"and",
"returns",
"it"
] | [
"func",
"renderGlyph",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"fontName",
"string",
",",
"chr",
"rune",
")",
"*",
"Glyph",
"{",
"gc",
".",
"Save",
"(",
")",
"\n",
"defer",
"gc",
".",
"Restore",
"(",
")",
"\n",
"gc",
".",
"BeginPath",
"(",
")",
"\n",
"width",
":=",
"gc",
".",
"CreateStringPath",
"(",
"string",
"(",
"chr",
")",
",",
"0",
",",
"0",
")",
"\n",
"<mask>",
":=",
"gc",
".",
"GetPath",
"(",
")",
"\n",
"return",
"&",
"Glyph",
"{",
"Path",
":",
"&",
"path",
",",
"Width",
":",
"width",
",",
"}",
"\n",
"}"
] |
15,405 | all-15406 | [
"EnvForType",
"returns",
"the",
"slice",
"of",
"environment",
"variables",
"to",
"export",
"for",
"jobType"
] | [
"func",
"EnvForType",
"(",
"jobType",
"prowapi",
".",
"ProwJobType",
")",
"[",
"]",
"string",
"{",
"baseEnv",
":=",
"[",
"]",
"string",
"{",
"jobNameEnv",
",",
"JobSpecEnv",
",",
"jobTypeEnv",
",",
"prowJobIDEnv",
",",
"buildIDEnv",
",",
"prowBuildIDEnv",
"}",
"\n",
"refsEnv",
":=",
"[",
"]",
"string",
"{",
"repoOwnerEnv",
",",
"repoNameEnv",
",",
"pullBaseRefEnv",
",",
"pullBaseShaEnv",
",",
"pullRefsEnv",
"}",
"\n",
"pullEnv",
":=",
"[",
"]",
"string",
"{",
"pullNumberEnv",
",",
"pullPullShaEnv",
"}",
"\n\n",
"switch",
"jobType",
"{",
"<mask>",
"prowapi",
".",
"PeriodicJob",
":",
"return",
"baseEnv",
"\n",
"case",
"prowapi",
".",
"PostsubmitJob",
",",
"prowapi",
".",
"BatchJob",
":",
"return",
"append",
"(",
"baseEnv",
",",
"refsEnv",
"...",
")",
"\n",
"case",
"prowapi",
".",
"PresubmitJob",
":",
"return",
"append",
"(",
"append",
"(",
"baseEnv",
",",
"refsEnv",
"...",
")",
",",
"pullEnv",
"...",
")",
"\n",
"default",
":",
"return",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"}"
] |
15,406 | all-15407 | [
"DialContext",
"connects",
"to",
"the",
"address",
"on",
"the",
"named",
"network",
"using",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"d",
"*",
"DialerWithRetry",
")",
"DialContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"network",
",",
"address",
"string",
")",
"(",
"<mask>",
".",
"Conn",
",",
"error",
")",
"{",
"// Always bump the retry count by 1 in order to equal the actual number of",
"// attempts. For example, if a retry count of 2 is specified, the intent",
"// is for three attempts -- the initial attempt with two retries in case",
"// the initial attempt times out.",
"count",
":=",
"d",
".",
"RetryCount",
"+",
"1",
"\n",
"sleep",
":=",
"d",
".",
"RetrySleep",
"\n",
"i",
":=",
"uint",
"(",
"0",
")",
"\n",
"for",
"{",
"conn",
",",
"err",
":=",
"d",
".",
"Dialer",
".",
"DialContext",
"(",
"ctx",
",",
"network",
",",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"isDialErrorRetriable",
"(",
"err",
")",
"{",
"if",
"i",
"<",
"count",
"-",
"1",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"sleep",
")",
":",
"i",
"++",
"\n",
"continue",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"conn",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
15,407 | all-15408 | [
"GetTitleAlign",
"returns",
"the",
"TitleAlign",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"EventTimelineDefinition",
")",
"GetTitleAlign",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"TitleAlign",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"TitleAlign",
"\n",
"}"
] |
15,408 | all-15409 | [
"Okf",
"logs",
"a",
"formatted",
"line",
"with",
"an",
"OK",
"prefix",
"."
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Okf",
"(",
"format",
"string",
",",
"vals",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"s",
":=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"vals",
"...",
")",
"\n",
"l",
".",
"logger",
".",
"Output",
"(",
"2",
",",
"\"",
"\"",
"+",
"s",
")",
"\n",
"l",
".",
"callHandlers",
"(",
"LevelOK",
",",
"s",
")",
"\n",
"}"
] |
15,409 | all-15410 | [
"SetHeaders",
"sets",
"the",
"application",
"headers",
"for",
"this",
"Context",
".",
"If",
"there",
"is",
"a",
"ParentContext",
"its",
"headers",
"will",
"be",
"ignored",
"after",
"the",
"call",
"to",
"this",
"method",
"."
] | [
"func",
"(",
"cb",
"*",
"ContextBuilder",
")",
"SetHeaders",
"(",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"ContextBuilder",
"{",
"cb",
".",
"Headers",
"=",
"<mask>",
"\n",
"cb",
".",
"replaceParentHeaders",
"=",
"true",
"\n",
"return",
"cb",
"\n",
"}"
] |
15,410 | all-15411 | [
"SetNCopies",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_n_copies",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetNCopies",
"(",
"copies",
"int",
")",
"{",
"C",
".",
"gtk_print_settings_set_n_copies",
"(",
"<mask>",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"copies",
")",
")",
"\n",
"}"
] |
15,411 | all-15412 | [
"printVaultWarnings",
"prints",
"warnings",
"for",
"a",
"given",
"dependency",
"."
] | [
"func",
"printVaultWarnings",
"(",
"d",
"Dependency",
",",
"warnings",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"w",
":=",
"range",
"warnings",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"w",
")",
"\n",
"}",
"\n",
"}"
] |
15,412 | all-15413 | [
"NewFetcher",
"creates",
"a",
"new",
"Fetcher",
"and",
"initializes",
"the",
"output",
"channels"
] | [
"func",
"NewFetcher",
"(",
"repository",
"string",
")",
"*",
"Fetcher",
"{",
"return",
"&",
"Fetcher",
"{",
"IssuesChannel",
":",
"<mask>",
"(",
"chan",
"sql",
".",
"Issue",
",",
"100",
")",
",",
"EventsCommentsChannel",
":",
"make",
"(",
"chan",
"interface",
"{",
"}",
",",
"100",
")",
",",
"repository",
":",
"repository",
",",
"}",
"\n",
"}"
] |
15,413 | all-15414 | [
"fill",
"a",
"buffer",
"object",
"s",
"data",
"store",
"with",
"a",
"fixed",
"value"
] | [
"func",
"ClearNamedBufferData",
"(",
"buffer",
"uint32",
",",
"internalformat",
"uint32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowClearNamedBufferData",
"(",
"gpClearNamedBufferData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"data",
")",
"\n",
"}"
] |
15,414 | all-15415 | [
"GetNextKnownStateProgression",
"returns",
"the",
"state",
"that",
"the",
"container",
"should",
"progress",
"to",
"based",
"on",
"its",
"KnownState",
".",
"The",
"progression",
"is",
"incremental",
"until",
"the",
"container",
"reaches",
"its",
"steady",
"state",
".",
"From",
"then",
"on",
"it",
"transitions",
"to",
"ContainerStopped",
".",
"For",
"example",
":",
"a",
".",
"if",
"the",
"steady",
"state",
"of",
"the",
"container",
"is",
"defined",
"as",
"ContainerRunning",
"the",
"progression",
"is",
":",
"Container",
":",
"None",
"-",
">",
"Pulled",
"-",
">",
"Created",
"-",
">",
"Running",
"*",
"-",
">",
"Stopped",
"-",
">",
"Zombie",
"b",
".",
"if",
"the",
"steady",
"state",
"of",
"the",
"container",
"is",
"defined",
"as",
"ContainerResourcesProvisioned",
"the",
"progression",
"is",
":",
"Container",
":",
"None",
"-",
">",
"Pulled",
"-",
">",
"Created",
"-",
">",
"Running",
"-",
">",
"Provisioned",
"*",
"-",
">",
"Stopped",
"-",
">",
"Zombie",
"c",
".",
"if",
"the",
"steady",
"state",
"of",
"the",
"container",
"is",
"defined",
"as",
"ContainerCreated",
"the",
"progression",
"is",
":",
"Container",
":",
"None",
"-",
">",
"Pulled",
"-",
">",
"Created",
"*",
"-",
">",
"Stopped",
"-",
">",
"Zombie"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetNextKnownStateProgression",
"(",
")",
"apicontainerstatus",
".",
"ContainerStatus",
"{",
"if",
"c",
".",
"IsKnownSteadyState",
"(",
")",
"{",
"return",
"apicontainerstatus",
".",
"ContainerStopped",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"GetKnownStatus",
"(",
")",
"+",
"1",
"\n",
"}"
] |
15,415 | all-15416 | [
"endpointToRecord",
"puts",
"the",
"Target",
"of",
"an",
"Endpoint",
"in",
"the",
"correct",
"field",
"of",
"DataBlock",
".",
"See",
"DataBlock",
"comments",
"for",
"more",
"info"
] | [
"func",
"endpointToRecord",
"(",
"ep",
"*",
"endpoint",
".",
"Endpoint",
")",
"*",
"dynect",
".",
"DataBlock",
"{",
"<mask>",
":=",
"dynect",
".",
"DataBlock",
"{",
"}",
"\n\n",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeA",
"{",
"result",
".",
"Address",
"=",
"ep",
".",
"Targets",
"[",
"0",
"]",
"\n",
"}",
"else",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeCNAME",
"{",
"result",
".",
"CName",
"=",
"ep",
".",
"Targets",
"[",
"0",
"]",
"\n",
"}",
"else",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeTXT",
"{",
"result",
".",
"TxtData",
"=",
"ep",
".",
"Targets",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"return",
"&",
"result",
"\n",
"}"
] |
15,416 | all-15417 | [
"GetSort",
"returns",
"the",
"Sort",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"p",
"*",
"Params",
")",
"GetSort",
"(",
")",
"<mask>",
"{",
"if",
"p",
"==",
"nil",
"||",
"p",
".",
"Sort",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"p",
".",
"Sort",
"\n",
"}"
] |
15,417 | all-15418 | [
"SetPageLoad",
"sets",
"the",
"page",
"load",
"timeout",
"(",
"in",
"ms",
")"
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"SetPageLoad",
"(",
"timeout",
"int",
")",
"error",
"{",
"return",
"p",
".",
"<mask>",
".",
"SetPageLoad",
"(",
"timeout",
")",
"\n",
"}"
] |
15,418 | all-15419 | [
"WriteInflate",
"writes",
"inflated",
"p",
"to",
"w",
"and",
"returns",
"the",
"number",
"of",
"uncompressed",
"bytes",
"written",
"to",
"w",
"."
] | [
"func",
"WriteInflate",
"(",
"w",
"io",
".",
"<mask>",
",",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"r",
":=",
"&",
"byteSliceReader",
"{",
"p",
"}",
"\n",
"zr",
",",
"err",
":=",
"acquireFlateReader",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"copyZeroAlloc",
"(",
"w",
",",
"zr",
")",
"\n",
"releaseFlateReader",
"(",
"zr",
")",
"\n",
"nn",
":=",
"int",
"(",
"n",
")",
"\n",
"if",
"int64",
"(",
"nn",
")",
"!=",
"n",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"return",
"nn",
",",
"err",
"\n",
"}"
] |
15,419 | all-15420 | [
"SearchBrokers",
"returns",
"brokers",
"matching",
"the",
"specified",
"search",
"query",
"and",
"/",
"or",
"filter",
".",
"If",
"nil",
"is",
"passed",
"for",
"both",
"parameters",
"all",
"brokers",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"SearchBrokers",
"(",
"searchCriteria",
"*",
"SearchQueryType",
",",
"filterCriteria",
"*",
"SearchFilterType",
")",
"(",
"*",
"[",
"]",
"Broker",
",",
"error",
")",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"if",
"searchCriteria",
"!=",
"nil",
"&&",
"*",
"searchCriteria",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"string",
"(",
"*",
"searchCriteria",
")",
")",
"\n",
"}",
"\n\n",
"if",
"filterCriteria",
"!=",
"nil",
"&&",
"len",
"(",
"*",
"filterCriteria",
")",
">",
"0",
"{",
"for",
"filter",
",",
"criteria",
":=",
"<mask>",
"*",
"filterCriteria",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"criteria",
"{",
"q",
".",
"Add",
"(",
"filter",
",",
"val",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"Encode",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"a",
".",
"FetchBrokers",
"(",
")",
"\n",
"}",
"\n\n",
"reqURL",
":=",
"url",
".",
"URL",
"{",
"Path",
":",
"config",
".",
"BrokerPrefix",
",",
"RawQuery",
":",
"q",
".",
"Encode",
"(",
")",
",",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"reqURL",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"brokers",
"[",
"]",
"Broker",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"brokers",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"brokers",
",",
"nil",
"\n",
"}"
] |
15,420 | all-15421 | [
"SearchMaintenanceWindows",
"returns",
"maintenance",
"[",
"windows",
"]",
"matching",
"the",
"specified",
"search",
"query",
"and",
"/",
"or",
"filter",
".",
"If",
"nil",
"is",
"passed",
"for",
"both",
"parameters",
"all",
"maintenance",
"[",
"windows",
"]",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"SearchMaintenanceWindows",
"(",
"searchCriteria",
"*",
"SearchQueryType",
",",
"filterCriteria",
"*",
"SearchFilterType",
")",
"(",
"*",
"[",
"]",
"Maintenance",
",",
"error",
")",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"if",
"searchCriteria",
"!=",
"nil",
"&&",
"*",
"searchCriteria",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"string",
"(",
"*",
"searchCriteria",
")",
")",
"\n",
"}",
"\n\n",
"if",
"filterCriteria",
"!=",
"nil",
"&&",
"len",
"(",
"*",
"filterCriteria",
")",
">",
"0",
"{",
"for",
"<mask>",
",",
"criteria",
":=",
"range",
"*",
"filterCriteria",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"criteria",
"{",
"q",
".",
"Add",
"(",
"filter",
",",
"val",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"Encode",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"a",
".",
"FetchMaintenanceWindows",
"(",
")",
"\n",
"}",
"\n\n",
"reqURL",
":=",
"url",
".",
"URL",
"{",
"Path",
":",
"config",
".",
"MaintenancePrefix",
",",
"RawQuery",
":",
"q",
".",
"Encode",
"(",
")",
",",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"reqURL",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"windows",
"[",
"]",
"Maintenance",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"windows",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"windows",
",",
"nil",
"\n",
"}"
] |
15,421 | all-15422 | [
"startContainerTransitions",
"steps",
"through",
"each",
"container",
"in",
"the",
"task",
"and",
"calls",
"the",
"passed",
"transition",
"function",
"when",
"a",
"transition",
"should",
"occur",
"."
] | [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"startContainerTransitions",
"(",
"transitionFunc",
"containerTransitionFunc",
")",
"(",
"bool",
",",
"map",
"[",
"string",
"]",
"apicontainer",
".",
"DependsOn",
",",
"map",
"[",
"string",
"]",
"apicontainerstatus",
".",
"ContainerStatus",
",",
"[",
"]",
"error",
")",
"{",
"anyCanTransition",
":=",
"false",
"\n",
"var",
"reasons",
"[",
"]",
"error",
"\n",
"blocked",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"apicontainer",
".",
"DependsOn",
")",
"\n",
"transitions",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"\n",
"for",
"_",
",",
"cont",
":=",
"range",
"mtask",
".",
"Containers",
"{",
"transition",
":=",
"mtask",
".",
"containerNextState",
"(",
"cont",
")",
"\n",
"if",
"transition",
".",
"reason",
"!=",
"nil",
"{",
"// container can't be transitioned",
"reasons",
"=",
"append",
"(",
"reasons",
",",
"transition",
".",
"reason",
")",
"\n",
"if",
"transition",
".",
"blockedOn",
"!=",
"nil",
"{",
"blocked",
"[",
"cont",
".",
"Name",
"]",
"=",
"*",
"transition",
".",
"blockedOn",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// If the container is already in a transition, skip",
"if",
"transition",
".",
"actionRequired",
"&&",
"!",
"cont",
".",
"SetAppliedStatus",
"(",
"transition",
".",
"nextState",
")",
"{",
"// At least one container is able to be moved forwards, so we're not deadlocked",
"anyCanTransition",
"=",
"true",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// At least one container is able to be moved forwards, so we're not deadlocked",
"anyCanTransition",
"=",
"true",
"\n\n",
"if",
"!",
"transition",
".",
"actionRequired",
"{",
"// Updating the container status without calling any docker API, send in",
"// a goroutine so that it won't block here before the waitForContainerTransition",
"// was called after this function. And all the events sent to mtask.dockerMessages",
"// will be handled by handleContainerChange.",
"go",
"func",
"(",
"cont",
"*",
"apicontainer",
".",
"Container",
",",
"<mask>",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"{",
"mtask",
".",
"dockerMessages",
"<-",
"dockerContainerChange",
"{",
"container",
":",
"cont",
",",
"event",
":",
"dockerapi",
".",
"DockerContainerChangeEvent",
"{",
"Status",
":",
"status",
",",
"}",
",",
"}",
"\n",
"}",
"(",
"cont",
",",
"transition",
".",
"nextState",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"transitions",
"[",
"cont",
".",
"Name",
"]",
"=",
"transition",
".",
"nextState",
"\n",
"go",
"transitionFunc",
"(",
"cont",
",",
"transition",
".",
"nextState",
")",
"\n",
"}",
"\n\n",
"return",
"anyCanTransition",
",",
"blocked",
",",
"transitions",
",",
"reasons",
"\n",
"}"
] |
15,422 | all-15423 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetBypassServiceWorkerParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork17",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,423 | all-15424 | [
"GetReverse",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_reverse",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"GetReverse",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_reverse",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
15,424 | all-15425 | [
"Vault",
"returns",
"the",
"Vault",
"client",
"for",
"this",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ClientSet",
")",
"Vault",
"(",
")",
"*",
"vaultapi",
".",
"<mask>",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"vault",
".",
"client",
"\n",
"}"
] |
15,425 | all-15426 | [
"NOTE",
":",
"Order",
"of",
"fields",
"for",
"DBRef",
"above",
"does",
"matter",
"per",
"documentation",
".",
"FindRef",
"returns",
"a",
"query",
"that",
"looks",
"for",
"the",
"document",
"in",
"the",
"provided",
"reference",
".",
"If",
"the",
"reference",
"includes",
"the",
"DB",
"field",
"the",
"document",
"will",
"be",
"retrieved",
"from",
"the",
"respective",
"database",
".",
"See",
"also",
"the",
"DBRef",
"type",
"and",
"the",
"FindRef",
"method",
"on",
"Session",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Database",
"+",
"References"
] | [
"func",
"(",
"db",
"*",
"Database",
")",
"FindRef",
"(",
"ref",
"*",
"DBRef",
")",
"*",
"Query",
"{",
"var",
"c",
"*",
"Collection",
"\n",
"if",
"ref",
".",
"Database",
"==",
"\"",
"\"",
"{",
"c",
"=",
"db",
".",
"C",
"(",
"ref",
".",
"Collection",
")",
"\n",
"}",
"else",
"{",
"c",
"=",
"db",
".",
"Session",
".",
"DB",
"(",
"ref",
".",
"Database",
")",
".",
"C",
"(",
"ref",
".",
"Collection",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"FindId",
"(",
"ref",
".",
"<mask>",
")",
"\n",
"}"
] |
15,426 | all-15427 | [
"IsBranchNotFoundErr",
"returns",
"true",
"if",
"err",
"is",
"an",
"error",
"message",
"about",
"a",
"branch",
"not",
"being",
"found"
] | [
"func",
"IsBranchNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"branchNotFoundRe",
".",
"MatchString",
"(",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
15,427 | all-15428 | [
"Delete",
"removes",
"the",
"current",
"item",
"from",
"the",
"skiplist"
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Delete",
"(",
")",
"{",
"<mask>",
".",
"s",
".",
"softDelete",
"(",
"it",
".",
"curr",
",",
"&",
"it",
".",
"s",
".",
"Stats",
")",
"\n",
"// It will observe that current item is deleted",
"// Run delete helper and move to the next possible item",
"it",
".",
"Next",
"(",
")",
"\n",
"it",
".",
"deleted",
"=",
"true",
"\n",
"}"
] |
15,428 | all-15429 | [
"VerifyKeySignature",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"of",
"signed",
"."
] | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifyKeySignature",
"(",
"signed",
"*",
"PublicKey",
",",
"sig",
"*",
"Signature",
")",
"(",
"err",
"error",
")",
"{",
"h",
",",
"err",
":=",
"keySignatureHash",
"(",
"pk",
",",
"<mask>",
",",
"sig",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"pk",
".",
"VerifySignature",
"(",
"h",
",",
"sig",
")",
"\n",
"}"
] |
15,429 | all-15430 | [
"FindKnownAPIVersions",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFactory",
")",
"FindKnownAPIVersions",
"(",
")",
"[",
"]",
"dockerclient",
".",
"DockerVersion",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"dockerclient",
".",
"DockerVersion",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
15,430 | all-15431 | [
"ForwardChars",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_forward_chars",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"ForwardChars",
"(",
"v1",
"int",
")",
"bool",
"{",
"<mask>",
"gobool",
"(",
"C",
".",
"gtk_text_iter_forward_chars",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"v1",
")",
")",
")",
"\n",
"}"
] |
15,431 | all-15432 | [
"btrfsPoolVolumesDelete",
"is",
"the",
"recursive",
"variant",
"on",
"btrfsPoolVolumeDelete",
"it",
"first",
"deletes",
"subvolumes",
"of",
"the",
"subvolume",
"and",
"then",
"the",
"subvolume",
"itself",
"."
] | [
"func",
"btrfsSubVolumesDelete",
"(",
"subvol",
"string",
")",
"error",
"{",
"// Delete subsubvols.",
"subsubvols",
",",
"err",
":=",
"btrfsSubVolumesGet",
"(",
"subvol",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"<mask>",
".",
"Reverse",
"(",
"sort",
".",
"StringSlice",
"(",
"subsubvols",
")",
")",
")",
"\n\n",
"for",
"_",
",",
"subsubvol",
":=",
"range",
"subsubvols",
"{",
"err",
":=",
"btrfsSubVolumeDelete",
"(",
"path",
".",
"Join",
"(",
"subvol",
",",
"subsubvol",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Delete the subvol itself",
"err",
"=",
"btrfsSubVolumeDelete",
"(",
"subvol",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,432 | all-15433 | [
"TSSControlLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"TSSControlLocator",
"(",
"href",
"<mask>",
")",
"*",
"TSSControlLocator",
"{",
"return",
"&",
"TSSControlLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
15,433 | all-15434 | [
"PrintHistogram",
"builds",
"and",
"displays",
"the",
"key",
"-",
"value",
"size",
"histogram",
".",
"When",
"keyPrefix",
"is",
"set",
"only",
"the",
"keys",
"that",
"have",
"prefix",
"keyPrefix",
"are",
"considered",
"for",
"creating",
"the",
"histogram"
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"PrintHistogram",
"(",
"keyPrefix",
"[",
"]",
"byte",
")",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"histogram",
":=",
"db",
".",
"buildHistogram",
"(",
"keyPrefix",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"histogram",
".",
"keySizeHistogram",
".",
"printHistogram",
"(",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"histogram",
".",
"valueSizeHistogram",
".",
"printHistogram",
"(",
")",
"\n",
"}"
] |
15,434 | all-15435 | [
"GetDNSClusterNames",
"uses",
"DNS",
"SRV",
"records",
"to",
"get",
"a",
"list",
"of",
"initial",
"nodes",
"for",
"cluster",
"bootstrapping",
"."
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"GetDNSClusterNames",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"(",
"clusterStrs",
"[",
"]",
"string",
"\n",
"cerr",
"error",
"\n",
"serviceNameSuffix",
"string",
"\n",
")",
"\n",
"if",
"cfg",
".",
"DNSClusterServiceName",
"!=",
"\"",
"\"",
"{",
"serviceNameSuffix",
"=",
"\"",
"\"",
"+",
"cfg",
".",
"DNSClusterServiceName",
"\n",
"}",
"\n\n",
"lg",
":=",
"cfg",
".",
"GetLogger",
"(",
")",
"\n\n",
"// Use both etcd-server-ssl and etcd-server for discovery.",
"// Combine the results if both are available.",
"clusterStrs",
",",
"cerr",
"=",
"srv",
".",
"GetCluster",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"serviceNameSuffix",
",",
"cfg",
".",
"Name",
",",
"cfg",
".",
"DNSCluster",
",",
"cfg",
".",
"APUrls",
")",
"\n",
"if",
"cerr",
"!=",
"nil",
"{",
"clusterStrs",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"}",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"serviceNameSuffix",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"cfg",
".",
"Name",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"cfg",
".",
"DNSCluster",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"cfg",
".",
"getAPURLs",
"(",
")",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"clusterStrs",
")",
",",
"zap",
".",
"<mask>",
"(",
"cerr",
")",
",",
")",
"\n",
"}",
"\n\n",
"defaultHTTPClusterStrs",
",",
"httpCerr",
":=",
"srv",
".",
"GetCluster",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"serviceNameSuffix",
",",
"cfg",
".",
"Name",
",",
"cfg",
".",
"DNSCluster",
",",
"cfg",
".",
"APUrls",
")",
"\n",
"if",
"httpCerr",
"!=",
"nil",
"{",
"clusterStrs",
"=",
"append",
"(",
"clusterStrs",
",",
"defaultHTTPClusterStrs",
"...",
")",
"\n",
"}",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"serviceNameSuffix",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"cfg",
".",
"Name",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"cfg",
".",
"DNSCluster",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"cfg",
".",
"getAPURLs",
"(",
")",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"clusterStrs",
")",
",",
"zap",
".",
"Error",
"(",
"httpCerr",
")",
",",
")",
"\n",
"}",
"\n\n",
"return",
"clusterStrs",
",",
"cerr",
"\n",
"}"
] |
15,435 | all-15436 | [
"Stop",
"stops",
"the",
"existing",
"VM",
"instance",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Stop",
"(",
")",
"error",
"{",
"cs",
":=",
"d",
".",
"client",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"cs",
".",
"RequestWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"&",
"egoscale",
".",
"StopVirtualMachine",
"{",
"ID",
":",
"d",
".",
"<mask>",
",",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
15,436 | all-15437 | [
"Commit",
"marks",
"the",
"process",
"of",
"storing",
"the",
"image",
"as",
"successful",
"and",
"asks",
"for",
"the",
"image",
"to",
"be",
"persisted",
".",
"WARNING",
":",
"This",
"does",
"not",
"have",
"any",
"transactional",
"semantics",
":",
"-",
"Uploaded",
"data",
"MAY",
"be",
"visible",
"to",
"others",
"before",
"Commit",
"()",
"is",
"called",
"-",
"Uploaded",
"data",
"MAY",
"be",
"removed",
"or",
"MAY",
"remain",
"around",
"if",
"Close",
"()",
"is",
"called",
"without",
"Commit",
"()",
"(",
"i",
".",
"e",
".",
"rollback",
"is",
"allowed",
"but",
"not",
"guaranteed",
")"
] | [
"func",
"(",
"d",
"*",
"openshiftImageDestination",
")",
"Commit",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"error",
"{",
"return",
"d",
".",
"docker",
".",
"Commit",
"(",
"ctx",
")",
"\n",
"}"
] |
15,437 | all-15438 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"PermissionType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"PermissionType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"PermissionTypeAccessibilityEvents",
":",
"*",
"t",
"=",
"PermissionTypeAccessibilityEvents",
"\n",
"case",
"PermissionTypeAudioCapture",
":",
"*",
"t",
"=",
"PermissionTypeAudioCapture",
"\n",
"case",
"PermissionTypeBackgroundSync",
":",
"*",
"t",
"=",
"PermissionTypeBackgroundSync",
"\n",
"<mask>",
"PermissionTypeBackgroundFetch",
":",
"*",
"t",
"=",
"PermissionTypeBackgroundFetch",
"\n",
"case",
"PermissionTypeClipboardRead",
":",
"*",
"t",
"=",
"PermissionTypeClipboardRead",
"\n",
"case",
"PermissionTypeClipboardWrite",
":",
"*",
"t",
"=",
"PermissionTypeClipboardWrite",
"\n",
"case",
"PermissionTypeDurableStorage",
":",
"*",
"t",
"=",
"PermissionTypeDurableStorage",
"\n",
"case",
"PermissionTypeFlash",
":",
"*",
"t",
"=",
"PermissionTypeFlash",
"\n",
"case",
"PermissionTypeGeolocation",
":",
"*",
"t",
"=",
"PermissionTypeGeolocation",
"\n",
"case",
"PermissionTypeMidi",
":",
"*",
"t",
"=",
"PermissionTypeMidi",
"\n",
"case",
"PermissionTypeMidiSysex",
":",
"*",
"t",
"=",
"PermissionTypeMidiSysex",
"\n",
"case",
"PermissionTypeNotifications",
":",
"*",
"t",
"=",
"PermissionTypeNotifications",
"\n",
"case",
"PermissionTypePaymentHandler",
":",
"*",
"t",
"=",
"PermissionTypePaymentHandler",
"\n",
"case",
"PermissionTypeProtectedMediaIdentifier",
":",
"*",
"t",
"=",
"PermissionTypeProtectedMediaIdentifier",
"\n",
"case",
"PermissionTypeSensors",
":",
"*",
"t",
"=",
"PermissionTypeSensors",
"\n",
"case",
"PermissionTypeVideoCapture",
":",
"*",
"t",
"=",
"PermissionTypeVideoCapture",
"\n",
"case",
"PermissionTypeIdleDetection",
":",
"*",
"t",
"=",
"PermissionTypeIdleDetection",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
15,438 | all-15439 | [
"loadCACert",
"loads",
"the",
"CA",
"cert",
"for",
"the",
"broker",
"designated",
"by",
"the",
"submission",
"url"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"loadCACert",
"(",
")",
"error",
"{",
"if",
"cm",
".",
"certPool",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"cm",
".",
"certPool",
"=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n\n",
"<mask>",
"cert",
"[",
"]",
"byte",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"cm",
".",
"enabled",
"{",
"// only attempt to retrieve broker CA cert if",
"// the check is being managed.",
"cert",
",",
"err",
"=",
"cm",
".",
"fetchCert",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"cert",
"==",
"nil",
"{",
"cert",
"=",
"circonusCA",
"\n",
"}",
"\n\n",
"cm",
".",
"certPool",
".",
"AppendCertsFromPEM",
"(",
"cert",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,439 | all-15440 | [
"DoDeadline",
"performs",
"the",
"given",
"request",
"and",
"waits",
"for",
"response",
"until",
"the",
"given",
"deadline",
".",
"Request",
"must",
"contain",
"at",
"least",
"non",
"-",
"zero",
"RequestURI",
"with",
"full",
"url",
"(",
"including",
"scheme",
"and",
"host",
")",
"or",
"non",
"-",
"zero",
"Host",
"header",
"+",
"RequestURI",
".",
"Client",
"determines",
"the",
"server",
"to",
"be",
"requested",
"in",
"the",
"following",
"order",
":",
"-",
"from",
"RequestURI",
"if",
"it",
"contains",
"full",
"url",
"with",
"scheme",
"and",
"host",
";",
"-",
"from",
"Host",
"header",
"otherwise",
".",
"The",
"function",
"doesn",
"t",
"follow",
"redirects",
".",
"Use",
"Get",
"*",
"for",
"following",
"redirects",
".",
"Response",
"is",
"ignored",
"if",
"resp",
"is",
"nil",
".",
"ErrTimeout",
"is",
"returned",
"if",
"the",
"response",
"wasn",
"t",
"returned",
"until",
"the",
"given",
"deadline",
".",
"ErrNoFreeConns",
"is",
"returned",
"if",
"all",
"DefaultMaxConnsPerHost",
"connections",
"to",
"the",
"requested",
"host",
"are",
"busy",
".",
"It",
"is",
"recommended",
"obtaining",
"req",
"and",
"resp",
"via",
"AcquireRequest",
"and",
"AcquireResponse",
"in",
"performance",
"-",
"critical",
"code",
"."
] | [
"func",
"DoDeadline",
"(",
"req",
"*",
"<mask>",
",",
"resp",
"*",
"Response",
",",
"deadline",
"time",
".",
"Time",
")",
"error",
"{",
"return",
"defaultClient",
".",
"DoDeadline",
"(",
"req",
",",
"resp",
",",
"deadline",
")",
"\n",
"}"
] |
15,440 | all-15441 | [
"parseBigInt",
"treats",
"the",
"given",
"bytes",
"as",
"a",
"big",
"-",
"endian",
"signed",
"integer",
"and",
"returns",
"the",
"result",
"."
] | [
"func",
"parseBigInt",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"*",
"big",
".",
"Int",
",",
"error",
")",
"{",
"if",
"err",
":=",
"checkInteger",
"(",
"bytes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
":=",
"new",
"(",
"big",
".",
"Int",
")",
"\n",
"if",
"len",
"(",
"bytes",
")",
">",
"0",
"&&",
"bytes",
"[",
"0",
"]",
"&",
"0x80",
"==",
"0x80",
"{",
"// This is a negative number.",
"notBytes",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"bytes",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"notBytes",
"{",
"notBytes",
"[",
"i",
"]",
"=",
"^",
"bytes",
"[",
"i",
"]",
"\n",
"}",
"\n",
"ret",
".",
"SetBytes",
"(",
"notBytes",
")",
"\n",
"ret",
".",
"Add",
"(",
"ret",
",",
"bigOne",
")",
"\n",
"ret",
".",
"Neg",
"(",
"ret",
")",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}",
"\n",
"ret",
".",
"SetBytes",
"(",
"bytes",
")",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
15,441 | all-15442 | [
"registriesDirPath",
"returns",
"a",
"path",
"to",
"registries",
".",
"d"
] | [
"func",
"registriesDirPath",
"(",
"sys",
"*",
"<mask>",
".",
"SystemContext",
")",
"string",
"{",
"if",
"sys",
"!=",
"nil",
"{",
"if",
"sys",
".",
"RegistriesDirPath",
"!=",
"\"",
"\"",
"{",
"return",
"sys",
".",
"RegistriesDirPath",
"\n",
"}",
"\n",
"if",
"sys",
".",
"RootForImplicitAbsolutePaths",
"!=",
"\"",
"\"",
"{",
"return",
"filepath",
".",
"Join",
"(",
"sys",
".",
"RootForImplicitAbsolutePaths",
",",
"systemRegistriesDirPath",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"systemRegistriesDirPath",
"\n",
"}"
] |
15,442 | all-15443 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"NodeType",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"Int64",
"(",
"int64",
"(",
"t",
")",
")",
"\n",
"}"
] |
15,443 | all-15444 | [
"GetCustomFgColorOk",
"returns",
"a",
"tuple",
"with",
"the",
"CustomFgColor",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"GetCustomFgColorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"CustomFgColor",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"CustomFgColor",
",",
"true",
"\n",
"}"
] |
15,444 | all-15445 | [
"Write",
"implements",
"the",
"io",
".",
"Writer",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"sessionConn",
")",
"Write",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"//set timeout",
"if",
"err",
":=",
"c",
".",
"conn",
".",
"SetWriteDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"c",
".",
"timeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"c",
".",
"conn",
".",
"Write",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errLogger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"conn",
".",
"LocalAddr",
"(",
")",
",",
"c",
".",
"conn",
".",
"RemoteAddr",
"(",
")",
",",
"err",
")",
"\n",
"c",
".",
"isBad",
"=",
"<mask>",
"\n",
"c",
".",
"badError",
"=",
"err",
"\n",
"return",
"n",
",",
"driver",
".",
"ErrBadConn",
"\n",
"}",
"\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
15,445 | all-15446 | [
"MustExternalize",
"retrieves",
"the",
"Externalize",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"ScpStatementPledges",
")",
"MustExternalize",
"(",
")",
"ScpStatementExternalize",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetExternalize",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
15,446 | all-15447 | [
"GoString",
"defines",
"the",
"printable",
"version",
"of",
"this",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"TemplateConfig",
")",
"GoString",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"BoolGoString",
"(",
"c",
".",
"Backup",
")",
",",
"StringGoString",
"(",
"c",
".",
"Command",
")",
",",
"TimeDurationGoString",
"(",
"c",
".",
"CommandTimeout",
")",
",",
"StringGoString",
"(",
"c",
".",
"Contents",
")",
",",
"BoolGoString",
"(",
"c",
".",
"CreateDestDirs",
")",
",",
"StringGoString",
"(",
"c",
".",
"Destination",
")",
",",
"BoolGoString",
"(",
"c",
".",
"ErrMissingKey",
")",
",",
"c",
".",
"Exec",
",",
"FileModeGoString",
"(",
"c",
".",
"Perms",
")",
",",
"StringGoString",
"(",
"c",
".",
"<mask>",
")",
",",
"c",
".",
"Wait",
",",
"StringGoString",
"(",
"c",
".",
"LeftDelim",
")",
",",
"StringGoString",
"(",
"c",
".",
"RightDelim",
")",
",",
")",
"\n",
"}"
] |
15,447 | all-15448 | [
"IsCommitFinishedErr",
"returns",
"true",
"of",
"err",
"has",
"an",
"error",
"message",
"that",
"matches",
"ErrCommitFinished"
] | [
"func",
"IsCommitFinishedErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"commitFinishedRe",
".",
"MatchString",
"(",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
15,448 | all-15449 | [
"title",
":",
"remove",
"plan",
"path",
":",
"/",
"plans",
"/",
"{",
"name",
"}",
"method",
":",
"DELETE",
"responses",
":",
"200",
":",
"Plan",
"removed",
"401",
":",
"Unauthorized",
"404",
":",
"Plan",
"not",
"found"
] | [
"func",
"removePlan",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlanDelete",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"planName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePlan",
",",
"Value",
":",
"planName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPlanDelete",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPlanReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"servicemanager",
".",
"Plan",
".",
"Remove",
"(",
"planName",
")",
"\n",
"if",
"err",
"==",
"appTypes",
".",
"ErrPlanNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,449 | all-15450 | [
"TrimPrefix",
"returns",
"p",
"without",
"the",
"provided",
"prefix",
".",
"If",
"p",
"doesn",
"t",
"start",
"with",
"prefix",
"it",
"returns",
"p",
"unchanged",
".",
"Unlike",
"strings",
".",
"HasPrefix",
"this",
"function",
"respects",
"component",
"boundaries",
"(",
"assuming",
"slash",
"-",
"separated",
"paths",
")",
"so",
"TrimPrefix",
"(",
"foo",
"/",
"bar",
"foo",
")",
"returns",
"baz",
"."
] | [
"func",
"TrimPrefix",
"(",
"p",
",",
"prefix",
"string",
")",
"string",
"{",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"p",
"\n",
"}",
"\n",
"if",
"prefix",
"==",
"p",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"strings",
".",
"TrimPrefix",
"(",
"p",
",",
"prefix",
"+",
"\"",
"\"",
")",
"\n",
"}"
] |
15,450 | all-15451 | [
"Selected",
"returns",
"the",
"number",
"of",
"currently",
"selected",
"radio",
"button",
"inside",
"the",
"group",
"or",
"-",
"1",
"if",
"no",
"button",
"is",
"selected"
] | [
"func",
"(",
"c",
"*",
"RadioGroup",
")",
"Selected",
"(",
")",
"int",
"{",
"selected",
":=",
"-",
"1",
"\n\n",
"for",
"id",
",",
"item",
":=",
"range",
"c",
".",
"items",
"{",
"if",
"item",
".",
"Selected",
"(",
")",
"{",
"selected",
"=",
"<mask>",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"selected",
"\n",
"}"
] |
15,451 | all-15452 | [
"IfModifiedSince",
"returns",
"true",
"if",
"lastModified",
"exceeds",
"If",
"-",
"Modified",
"-",
"Since",
"value",
"from",
"the",
"request",
"header",
".",
"The",
"function",
"returns",
"true",
"also",
"If",
"-",
"Modified",
"-",
"Since",
"request",
"header",
"is",
"missing",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"IfModifiedSince",
"(",
"lastModified",
"time",
".",
"Time",
")",
"bool",
"{",
"ifModStr",
":=",
"ctx",
".",
"Request",
".",
"<mask>",
".",
"peek",
"(",
"strIfModifiedSince",
")",
"\n",
"if",
"len",
"(",
"ifModStr",
")",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"ifMod",
",",
"err",
":=",
"ParseHTTPDate",
"(",
"ifModStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"lastModified",
"=",
"lastModified",
".",
"Truncate",
"(",
"time",
".",
"Second",
")",
"\n",
"return",
"ifMod",
".",
"Before",
"(",
"lastModified",
")",
"\n",
"}"
] |
15,452 | all-15453 | [
"AddImageState",
"adds",
"an",
"image",
".",
"ImageState",
"to",
"be",
"stored"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"AddImageState",
"(",
"imageState",
"*",
"image",
".",
"ImageState",
")",
"{",
"if",
"imageState",
"==",
"nil",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"imageState",
".",
"Image",
".",
"ImageID",
"==",
"\"",
"\"",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"state",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"state",
".",
"imageStates",
"[",
"imageState",
".",
"Image",
".",
"ImageID",
"]",
"=",
"imageState",
"\n",
"}"
] |
15,453 | all-15454 | [
"WriteFloat64",
"writes",
"a",
"float64",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteFloat64",
"(",
"f",
"float64",
")",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"bits",
":=",
"math",
".",
"Float64bits",
"(",
"f",
")",
"\n",
"<mask>",
".",
"LittleEndian",
".",
"PutUint64",
"(",
"w",
".",
"b",
"[",
":",
"8",
"]",
",",
"bits",
")",
"\n",
"w",
".",
"wr",
".",
"Write",
"(",
"w",
".",
"b",
"[",
":",
"8",
"]",
")",
"\n",
"}"
] |
15,454 | all-15455 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"UpdateVMWithStateReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewUpdateVMWithStateOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewUpdateVMWithStateNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewUpdateVMWithStateDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
15,455 | all-15456 | [
"scanStream",
"scans",
"the",
"stream",
"for",
"the",
"next",
"token",
"using",
"the",
"internal",
"state",
"machine",
".",
"It",
"will",
"panic",
"if",
"it",
"encounters",
"a",
"rune",
"which",
"it",
"does",
"not",
"know",
"how",
"to",
"handle",
"."
] | [
"func",
"(",
"t",
"*",
"Tokenizer",
")",
"scanStream",
"(",
")",
"(",
"*",
"Token",
",",
"error",
")",
"{",
"state",
":=",
"startState",
"\n",
"var",
"tokenType",
"TokenType",
"\n",
"var",
"value",
"[",
"]",
"rune",
"\n",
"var",
"nextRune",
"rune",
"\n",
"var",
"nextRuneType",
"runeTokenClass",
"\n",
"var",
"err",
"error",
"\n\n",
"for",
"{",
"nextRune",
",",
"_",
",",
"err",
"=",
"t",
".",
"input",
".",
"ReadRune",
"(",
")",
"\n",
"nextRuneType",
"=",
"t",
".",
"classifier",
".",
"ClassifyRune",
"(",
"nextRune",
")",
"\n\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"nextRuneType",
"=",
"eofRuneClass",
"\n",
"err",
"=",
"nil",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"switch",
"state",
"{",
"case",
"startState",
":",
"// no runes read yet",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"return",
"nil",
",",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"case",
"spaceRuneClass",
":",
"{",
"}",
"\n",
"case",
"escapingQuoteRuneClass",
":",
"{",
"tokenType",
"=",
"WordToken",
"\n",
"state",
"=",
"quotingEscapingState",
"\n",
"}",
"\n",
"case",
"nonEscapingQuoteRuneClass",
":",
"{",
"tokenType",
"=",
"WordToken",
"\n",
"state",
"=",
"quotingState",
"\n",
"}",
"\n",
"case",
"escapeRuneClass",
":",
"{",
"tokenType",
"=",
"WordToken",
"\n",
"state",
"=",
"escapingState",
"\n",
"}",
"\n",
"case",
"commentRuneClass",
":",
"{",
"tokenType",
"=",
"CommentToken",
"\n",
"state",
"=",
"commentState",
"\n",
"}",
"\n",
"default",
":",
"{",
"tokenType",
"=",
"WordToken",
"\n",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"state",
"=",
"inWordState",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"inWordState",
":",
"// in a regular word",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"case",
"spaceRuneClass",
":",
"{",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"escapingQuoteRuneClass",
":",
"{",
"state",
"=",
"quotingEscapingState",
"\n",
"}",
"\n",
"case",
"nonEscapingQuoteRuneClass",
":",
"{",
"state",
"=",
"quotingState",
"\n",
"}",
"\n",
"case",
"escapeRuneClass",
":",
"{",
"state",
"=",
"escapingState",
"\n",
"}",
"\n",
"default",
":",
"{",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"escapingState",
":",
"// the rune after an escape character",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"default",
":",
"{",
"state",
"=",
"inWordState",
"\n",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"escapingQuotedState",
":",
"// the next rune after an escape character, in double quotes",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"default",
":",
"{",
"state",
"=",
"quotingEscapingState",
"\n",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"quotingEscapingState",
":",
"// in escaping double quotes",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"case",
"escapingQuoteRuneClass",
":",
"{",
"state",
"=",
"inWordState",
"\n",
"}",
"\n",
"case",
"escapeRuneClass",
":",
"{",
"state",
"=",
"escapingQuotedState",
"\n",
"}",
"\n",
"default",
":",
"{",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"quotingState",
":",
"// in non-escaping single quotes",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"case",
"nonEscapingQuoteRuneClass",
":",
"{",
"state",
"=",
"inWordState",
"\n",
"}",
"\n",
"default",
":",
"{",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"commentState",
":",
"// in a comment",
"{",
"switch",
"nextRuneType",
"{",
"case",
"eofRuneClass",
":",
"{",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"\n",
"case",
"spaceRuneClass",
":",
"{",
"if",
"nextRune",
"==",
"'\\n'",
"{",
"state",
"=",
"startState",
"\n",
"token",
":=",
"&",
"Token",
"{",
"tokenType",
":",
"tokenType",
",",
"value",
":",
"string",
"(",
"value",
")",
"}",
"\n",
"return",
"token",
",",
"err",
"\n",
"}",
"else",
"{",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"{",
"value",
"=",
"append",
"(",
"value",
",",
"nextRune",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"state",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
15,456 | all-15457 | [
"read",
"a",
"block",
"of",
"pixels",
"from",
"the",
"frame",
"buffer"
] | [
"func",
"ReadnPixels",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"<mask>",
"uint32",
",",
"xtype",
"uint32",
",",
"bufSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowReadnPixels",
"(",
"gpReadnPixels",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"data",
")",
"\n",
"}"
] |
15,457 | all-15458 | [
"Add",
"an",
"entry",
"to",
"the",
"hosts",
"file",
"."
] | [
"func",
"(",
"h",
"*",
"Hosts",
")",
"Add",
"(",
"ip",
"string",
",",
"hosts",
"...",
"string",
")",
"error",
"{",
"if",
"net",
".",
"ParseIP",
"(",
"ip",
")",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ip",
")",
")",
"\n",
"}",
"\n\n",
"position",
":=",
"h",
".",
"getIpPosition",
"(",
"ip",
")",
"\n",
"if",
"position",
"==",
"-",
"1",
"{",
"endLine",
":=",
"NewHostsLine",
"(",
"buildRawLine",
"(",
"ip",
",",
"hosts",
")",
")",
"\n",
"// Ip line is not in file, so we just append our new line.",
"h",
".",
"Lines",
"=",
"append",
"(",
"h",
".",
"Lines",
",",
"endLine",
")",
"\n",
"}",
"else",
"{",
"// Otherwise, we replace the line in the correct position",
"newHosts",
":=",
"h",
".",
"Lines",
"[",
"position",
"]",
".",
"Hosts",
"\n",
"for",
"_",
",",
"addHost",
":=",
"<mask>",
"hosts",
"{",
"if",
"itemInSlice",
"(",
"addHost",
",",
"newHosts",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"newHosts",
"=",
"append",
"(",
"newHosts",
",",
"addHost",
")",
"\n",
"}",
"\n",
"endLine",
":=",
"NewHostsLine",
"(",
"buildRawLine",
"(",
"ip",
",",
"newHosts",
")",
")",
"\n",
"h",
".",
"Lines",
"[",
"position",
"]",
"=",
"endLine",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,458 | all-15459 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"ISBN",
"."
] | [
"func",
"(",
"u",
"*",
"ISBN",
")",
"DeepCopy",
"(",
")",
"*",
"ISBN",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"<mask>",
"(",
"ISBN",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
15,459 | all-15460 | [
"LoadJSONBytes",
"loads",
"JSON",
"bytes"
] | [
"func",
"LoadJSONBytes",
"(",
"conf",
"interface",
"{",
"}",
",",
"src",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"loadConfigBytes",
"(",
"conf",
",",
"src",
",",
"nil",
",",
"json",
".",
"Unmarshal",
")",
"\n",
"}"
] |
15,460 | all-15461 | [
"NewOutgoingVideoResend",
"creates",
"a",
"new",
"outgoing",
"video",
"file",
"for",
"re",
"-",
"sending",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingVideoResend",
"(",
"recipient",
"Recipient",
",",
"fileID",
"string",
")",
"*",
"OutgoingVideo",
"{",
"<mask>",
"&",
"OutgoingVideo",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileID",
":",
"fileID",
",",
"}",
",",
"}",
"\n",
"}"
] |
15,461 | all-15462 | [
"WithBackoff",
"sets",
"the",
"BackoffFunc",
"used",
"to",
"control",
"time",
"between",
"retries",
"."
] | [
"func",
"withBackoff",
"(",
"bf",
"backoffFunc",
")",
"retryOption",
"{",
"return",
"retryOption",
"{",
"applyFunc",
":",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"backoffFunc",
"=",
"bf",
"\n",
"}",
"}",
"\n",
"}"
] |
15,462 | all-15463 | [
"New",
"creates",
"a",
"new",
"Registry",
"without",
"a",
"background",
"flush",
"thread",
"."
] | [
"func",
"NewUnstarted",
"(",
"prefix",
"string",
",",
"tags",
"...",
"string",
")",
"*",
"Registry",
"{",
"return",
"&",
"Registry",
"{",
"instruments",
":",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"prefix",
":",
"prefix",
",",
"tags",
":",
"tags",
",",
"}",
"\n",
"}"
] |
15,463 | all-15464 | [
"RefFields",
"returns",
"the",
"fields",
"that",
"are",
"one",
"-",
"to",
"-",
"many",
"references",
"to",
"other",
"tables",
"."
] | [
"func",
"(",
"m",
"*",
"Mapping",
")",
"RefFields",
"(",
")",
"[",
"]",
"*",
"Field",
"{",
"fields",
":=",
"[",
"]",
"*",
"Field",
"{",
"}",
"\n\n",
"for",
"_",
",",
"field",
":=",
"range",
"m",
".",
"Fields",
"{",
"if",
"<mask>",
".",
"Type",
".",
"Code",
"==",
"TypeSlice",
"||",
"field",
".",
"Type",
".",
"Code",
"==",
"TypeMap",
"{",
"fields",
"=",
"append",
"(",
"fields",
",",
"field",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"fields",
"\n",
"}"
] |
15,464 | all-15465 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetRequestPostDataReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork32",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,465 | all-15466 | [
"Remove",
"ensures",
"that",
"word",
"is",
"not",
"in",
"the",
"Dictionary",
".",
"Returns",
"whether",
"or",
"not",
"an",
"item",
"was",
"removed",
".",
"Time",
"complexity",
":",
"O",
"(",
"m",
")",
"where",
"m",
"is",
"the",
"length",
"of",
"word",
"."
] | [
"func",
"(",
"dict",
"*",
"Dictionary",
")",
"Remove",
"(",
"word",
"string",
")",
"(",
"wasRemoved",
"bool",
")",
"{",
"lastPos",
":=",
"len",
"(",
"word",
")",
"-",
"1",
"\n",
"parent",
":=",
"dict",
".",
"root",
".",
"Navigate",
"(",
"word",
"[",
":",
"lastPos",
"]",
")",
"\n",
"if",
"parent",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"lastLetter",
":=",
"rune",
"(",
"<mask>",
"[",
"lastPos",
"]",
")",
"\n\n",
"subject",
",",
"ok",
":=",
"parent",
".",
"Children",
"[",
"lastLetter",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"wasRemoved",
"=",
"subject",
".",
"IsWord",
"\n\n",
"if",
"wasRemoved",
"{",
"dict",
".",
"size",
"--",
"\n",
"}",
"\n\n",
"subject",
".",
"IsWord",
"=",
"false",
"\n",
"if",
"subject",
".",
"Population",
"(",
")",
"==",
"0",
"{",
"delete",
"(",
"parent",
".",
"Children",
",",
"lastLetter",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
15,466 | all-15467 | [
"RemoveAllServers",
"stops",
"all",
"remote",
"Pact",
"Mock",
"Servers",
"."
] | [
"func",
"(",
"p",
"*",
"PactClient",
")",
"RemoveAllServers",
"(",
"server",
"*",
"types",
".",
"MockServer",
")",
"[",
"]",
"*",
"types",
".",
"MockServer",
"{",
"<mask>",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"for",
"_",
",",
"s",
":=",
"range",
"p",
".",
"verificationSvcManager",
".",
"List",
"(",
")",
"{",
"if",
"s",
"!=",
"nil",
"{",
"p",
".",
"pactMockSvcManager",
".",
"Stop",
"(",
"s",
".",
"Process",
".",
"Pid",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,467 | all-15468 | [
"Export",
"a",
"tarball",
"of",
"the",
"images",
"needed",
"by",
"a",
"deployment",
"."
] | [
"func",
"Export",
"(",
"opts",
"*",
"assets",
".",
"AssetOpts",
",",
"out",
"io",
".",
"Writer",
")",
"error",
"{",
"client",
",",
"err",
":=",
"docker",
".",
"NewClientFromEnv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"authConfigs",
",",
"err",
":=",
"docker",
".",
"NewAuthConfigurationsFromDockerCfg",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"authConfigs",
".",
"Configs",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"images",
":=",
"assets",
".",
"Images",
"(",
"opts",
")",
"\n",
"for",
"_",
",",
"image",
":=",
"<mask>",
"images",
"{",
"repository",
",",
"tag",
":=",
"docker",
".",
"ParseRepositoryTag",
"(",
"image",
")",
"\n",
"pulled",
":=",
"false",
"\n",
"var",
"loopErr",
"[",
"]",
"error",
"\n",
"for",
"registry",
",",
"authConfig",
":=",
"range",
"authConfigs",
".",
"Configs",
"{",
"if",
"err",
":=",
"client",
".",
"PullImage",
"(",
"docker",
".",
"PullImageOptions",
"{",
"Repository",
":",
"repository",
",",
"Tag",
":",
"tag",
",",
"InactivityTimeout",
":",
"5",
"*",
"time",
".",
"Second",
",",
"}",
",",
"authConfig",
",",
")",
";",
"err",
"!=",
"nil",
"{",
"loopErr",
"=",
"append",
"(",
"loopErr",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"registry",
",",
"err",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"pulled",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"if",
"!",
"pulled",
"{",
"errStr",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"err",
":=",
"range",
"loopErr",
"{",
"errStr",
"+=",
"err",
".",
"Error",
"(",
")",
"+",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"repository",
",",
"tag",
",",
"errStr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"client",
".",
"ExportImages",
"(",
"docker",
".",
"ExportImagesOptions",
"{",
"Names",
":",
"images",
",",
"OutputStream",
":",
"out",
",",
"}",
")",
"\n",
"}"
] |
15,468 | all-15469 | [
"Return",
"the",
"first",
"prefix",
"found",
"or",
"the",
"empty",
"string",
"."
] | [
"func",
"(",
"w",
"*",
"SnowballWord",
")",
"FirstPrefix",
"(",
"prefixes",
"...",
"string",
")",
"(",
"foundPrefix",
"string",
",",
"foundPrefixRunes",
"[",
"]",
"rune",
")",
"{",
"found",
":=",
"false",
"\n",
"rsLen",
":=",
"len",
"(",
"w",
".",
"RS",
")",
"\n\n",
"for",
"_",
",",
"prefix",
":=",
"range",
"prefixes",
"{",
"prefixRunes",
":=",
"[",
"]",
"rune",
"(",
"prefix",
")",
"\n",
"if",
"len",
"(",
"prefixRunes",
")",
">",
"rsLen",
"{",
"<mask>",
"\n",
"}",
"\n\n",
"found",
"=",
"true",
"\n",
"for",
"i",
",",
"r",
":=",
"range",
"prefixRunes",
"{",
"if",
"i",
">",
"rsLen",
"-",
"1",
"||",
"(",
"w",
".",
"RS",
")",
"[",
"i",
"]",
"!=",
"r",
"{",
"found",
"=",
"false",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"found",
"{",
"foundPrefix",
"=",
"prefix",
"\n",
"foundPrefixRunes",
"=",
"prefixRunes",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
15,469 | all-15470 | [
"taskShouldBeSent",
"checks",
"whether",
"the",
"event",
"should",
"be",
"sent",
"this",
"includes",
"both",
"task",
"state",
"change",
"and",
"container",
"state",
"change",
"events"
] | [
"func",
"(",
"<mask>",
"*",
"sendableEvent",
")",
"taskShouldBeSent",
"(",
")",
"bool",
"{",
"event",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"event",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"event",
".",
"isContainerEvent",
"{",
"return",
"false",
"\n",
"}",
"\n",
"tevent",
":=",
"event",
".",
"taskChange",
"\n",
"if",
"event",
".",
"taskSent",
"{",
"return",
"false",
"// redundant event",
"\n",
"}",
"\n\n",
"// task and container change event should have task != nil",
"if",
"tevent",
".",
"Task",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Task event should be sent",
"if",
"tevent",
".",
"Task",
".",
"GetSentStatus",
"(",
")",
"<",
"tevent",
".",
"Status",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// Container event should be sent",
"for",
"_",
",",
"containerStateChange",
":=",
"range",
"tevent",
".",
"Containers",
"{",
"container",
":=",
"containerStateChange",
".",
"Container",
"\n",
"if",
"container",
".",
"GetSentStatus",
"(",
")",
"<",
"container",
".",
"GetKnownStatus",
"(",
")",
"{",
"// We found a container that needs its state",
"// change to be sent to ECS.",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
15,470 | all-15471 | [
"DeRef",
"returns",
"the",
"value",
"pointed",
"to",
"by",
"the",
"interface",
"if",
"the",
"interface",
"is",
"a",
"pointer",
"and",
"is",
"not",
"nil",
"otherwise",
"returns",
"nil",
"or",
"the",
"direct",
"value",
"if",
"it",
"s",
"not",
"a",
"pointer",
"."
] | [
"func",
"DeRef",
"(",
"v",
"<mask>",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"k",
":=",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
".",
"Kind",
"(",
")",
"\n",
"if",
"k",
"!=",
"reflect",
".",
"Ptr",
"{",
"return",
"v",
"\n",
"}",
"\n",
"if",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"==",
"reflect",
".",
"Zero",
"(",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
")",
"{",
"// All zero-value pointers are nil",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
"\n",
"}"
] |
15,471 | all-15472 | [
"SetValueBytes",
"sets",
"cookie",
"value",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"SetValueBytes",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"c",
".",
"value",
"=",
"append",
"(",
"c",
".",
"value",
"[",
":",
"0",
"]",
",",
"value",
"...",
")",
"\n",
"}"
] |
15,472 | all-15473 | [
"GetKeyMeta",
"returns",
"the",
"metadata",
"for",
"the",
"key",
"at",
"the",
"given",
"keystore",
"path",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetKeyMeta",
"(",
"<mask>",
"string",
")",
"(",
"*",
"KeyMeta",
",",
"error",
")",
"{",
"k",
":=",
"&",
"KeyMeta",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"get",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"path",
"}",
",",
"nil",
",",
"k",
")",
"\n",
"return",
"k",
",",
"err",
"\n",
"}"
] |
15,473 | all-15474 | [
"ConfigKeyChecker",
"returns",
"a",
"function",
"that",
"will",
"check",
"whether",
"or",
"not",
"a",
"provide",
"value",
"is",
"valid",
"for",
"the",
"associate",
"config",
"key",
".",
"Returns",
"an",
"error",
"if",
"the",
"key",
"is",
"not",
"known",
".",
"The",
"checker",
"function",
"only",
"performs",
"syntactic",
"checking",
"of",
"the",
"value",
"semantic",
"and",
"usage",
"checking",
"must",
"be",
"done",
"by",
"the",
"caller",
".",
"User",
"defined",
"keys",
"are",
"always",
"considered",
"to",
"be",
"valid",
"e",
".",
"g",
".",
"user",
".",
"*",
"and",
"environment",
".",
"*",
"keys",
"."
] | [
"func",
"ConfigKeyChecker",
"(",
"key",
"string",
")",
"(",
"func",
"(",
"value",
"string",
")",
"error",
",",
"error",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"KnownContainerConfigKeys",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"f",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"&&",
"(",
"len",
"(",
"key",
")",
">",
"len",
"(",
"\"",
"\"",
")",
")",
"{",
"return",
"IsAny",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"}"
] |
15,474 | all-15475 | [
"SetStack",
"is",
"a",
"wrapper",
"around",
"gtk_stack_switcher_set_stack",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"StackSwitcher",
")",
"SetStack",
"(",
"<mask>",
"*",
"Stack",
")",
"{",
"C",
".",
"gtk_stack_switcher_set_stack",
"(",
"v",
".",
"native",
"(",
")",
",",
"stack",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
15,475 | all-15476 | [
"MetadataAsStruct",
"parses",
"the",
"Response",
"metadata",
"into",
"a",
"provided",
"struct"
] | [
"func",
"(",
"r",
"*",
"Response",
")",
"MetadataAsStruct",
"(",
"target",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"json",
".",
"Unmarshal",
"(",
"r",
".",
"Metadata",
",",
"&",
"target",
")",
"\n",
"}"
] |
15,476 | all-15477 | [
"Returns",
"the",
"information",
"log",
"for",
"a",
"shader",
"object"
] | [
"func",
"GetShaderInfoLog",
"(",
"shader",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"infoLog",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetShaderInfoLog",
",",
"4",
",",
"uintptr",
"(",
"shader",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"infoLog",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
15,477 | all-15478 | [
"Exists",
"implements",
"storage",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Exists",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"labels",
":=",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
"\n\n",
"err",
"=",
"s",
".",
"<mask>",
".",
"QueryRowContext",
"(",
"ctx",
",",
"s",
".",
"queryExists",
",",
"accessToken",
")",
".",
"Scan",
"(",
"&",
"exists",
",",
")",
"\n",
"s",
".",
"incQueries",
"(",
"labels",
",",
"start",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"incError",
"(",
"labels",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
15,478 | all-15479 | [
"GetMetricQuery",
"returns",
"the",
"MetricQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"ToplistRequest",
")",
"GetMetricQuery",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"MetricQuery",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"t",
".",
"MetricQuery",
"\n",
"}"
] |
15,479 | all-15480 | [
"MoveTo",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroup",
")",
"MoveTo",
"(",
"arg0",
"cgroups",
".",
"Cgroup",
")",
"error",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
15,480 | all-15481 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SimulatePressureNotificationParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,481 | all-15482 | [
"Stop",
"functions"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"Stop",
"(",
"stateful",
"bool",
")",
"error",
"{",
"var",
"ctxMap",
"log",
".",
"Ctx",
"\n\n",
"// Check that we're not already stopped",
"if",
"!",
"c",
".",
"IsRunning",
"(",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Setup a new operation",
"op",
",",
"err",
":=",
"c",
".",
"createOperation",
"(",
"\"",
"\"",
",",
"false",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ctxMap",
"=",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"c",
".",
"project",
",",
"\"",
"\"",
":",
"c",
".",
"name",
",",
"\"",
"\"",
":",
"op",
".",
"action",
",",
"\"",
"\"",
":",
"c",
".",
"creationDate",
",",
"\"",
"\"",
":",
"c",
".",
"ephemeral",
",",
"\"",
"\"",
":",
"c",
".",
"lastUsedDate",
",",
"\"",
"\"",
":",
"stateful",
"}",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n\n",
"// Handle stateful stop",
"if",
"stateful",
"{",
"// Cleanup any existing state",
"stateDir",
":=",
"c",
".",
"StatePath",
"(",
")",
"\n",
"os",
".",
"RemoveAll",
"(",
"stateDir",
")",
"\n\n",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"stateDir",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"op",
".",
"Done",
"(",
"err",
")",
"\n",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"criuMigrationArgs",
":=",
"CriuMigrationArgs",
"{",
"cmd",
":",
"lxc",
".",
"MIGRATE_DUMP",
",",
"stateDir",
":",
"stateDir",
",",
"<mask>",
":",
"\"",
"\"",
",",
"stop",
":",
"true",
",",
"actionScript",
":",
"false",
",",
"dumpDir",
":",
"\"",
"\"",
",",
"preDumpDir",
":",
"\"",
"\"",
",",
"}",
"\n\n",
"// Checkpoint",
"err",
"=",
"c",
".",
"Migrate",
"(",
"&",
"criuMigrationArgs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"op",
".",
"Done",
"(",
"err",
")",
"\n",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"op",
".",
"Wait",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"c",
".",
"IsRunning",
"(",
")",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"c",
".",
"stateful",
"=",
"true",
"\n",
"err",
"=",
"c",
".",
"state",
".",
"Cluster",
".",
"ContainerSetStateful",
"(",
"c",
".",
"id",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"op",
".",
"Done",
"(",
"err",
")",
"\n",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"op",
".",
"Done",
"(",
"nil",
")",
"\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"eventSendLifecycle",
"(",
"c",
".",
"project",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"name",
")",
",",
"nil",
")",
"\n",
"return",
"nil",
"\n",
"}",
"else",
"if",
"shared",
".",
"PathExists",
"(",
"c",
".",
"StatePath",
"(",
")",
")",
"{",
"os",
".",
"RemoveAll",
"(",
"c",
".",
"StatePath",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Load the go-lxc struct",
"err",
"=",
"c",
".",
"initLXC",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"op",
".",
"Done",
"(",
"err",
")",
"\n",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Fork-bomb mitigation, prevent forking from this point on",
"if",
"c",
".",
"state",
".",
"OS",
".",
"CGroupPidsController",
"{",
"// Attempt to disable forking new processes",
"c",
".",
"CGroupSet",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"c",
".",
"state",
".",
"OS",
".",
"CGroupFreezerController",
"{",
"// Attempt to freeze the container",
"freezer",
":=",
"make",
"(",
"chan",
"bool",
",",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"c",
".",
"Freeze",
"(",
")",
"\n",
"freezer",
"<-",
"true",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"freezer",
":",
"case",
"<-",
"time",
".",
"After",
"(",
"time",
".",
"Second",
"*",
"5",
")",
":",
"c",
".",
"Unfreeze",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"c",
".",
"Stop",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"op",
".",
"Done",
"(",
"err",
")",
"\n",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"op",
".",
"Wait",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"c",
".",
"IsRunning",
"(",
")",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"ctxMap",
")",
"\n",
"eventSendLifecycle",
"(",
"c",
".",
"project",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"name",
")",
",",
"nil",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,482 | all-15483 | [
"AddButton",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_dialog_add_button",
"()",
".",
"text",
"may",
"be",
"either",
"the",
"literal",
"button",
"text",
"or",
"if",
"using",
"GTK",
"3",
".",
"8",
"or",
"earlier",
"a",
"Stock",
"type",
"converted",
"to",
"a",
"string",
"."
] | [
"func",
"(",
"v",
"*",
"Dialog",
")",
"AddButton",
"(",
"text",
"string",
",",
"<mask>",
"ResponseType",
")",
"(",
"*",
"Button",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_dialog_add_button",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"id",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapButton",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
15,483 | all-15484 | [
"Bit",
"returns",
"uint32",
"representing",
"the",
"bit",
"value",
"at",
"given",
"position",
"e",
".",
"g",
".",
"128",
".",
"0",
".",
"0",
".",
"0",
"has",
"bit",
"value",
"of",
"1",
"at",
"position",
"31",
"and",
"0",
"for",
"positions",
"30",
"to",
"0",
"."
] | [
"func",
"(",
"n",
"NetworkNumber",
")",
"Bit",
"(",
"position",
"uint",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"if",
"int",
"(",
"<mask>",
")",
">",
"len",
"(",
"n",
")",
"*",
"BitsPerUint32",
"-",
"1",
"{",
"return",
"0",
",",
"ErrInvalidBitPosition",
"\n",
"}",
"\n",
"idx",
":=",
"len",
"(",
"n",
")",
"-",
"1",
"-",
"int",
"(",
"position",
"/",
"BitsPerUint32",
")",
"\n",
"// Mod 31 to get array index.",
"rShift",
":=",
"position",
"&",
"(",
"BitsPerUint32",
"-",
"1",
")",
"\n",
"return",
"(",
"n",
"[",
"idx",
"]",
">>",
"rShift",
")",
"&",
"1",
",",
"nil",
"\n",
"}"
] |
15,484 | all-15485 | [
"FindTask",
"--"
] | [
"func",
"(",
"s",
"*",
"FakeTaskManager",
")",
"FindTask",
"(",
"id",
"string",
")",
"(",
"t",
"*",
"taskmanager",
".",
"<mask>",
",",
"err",
"error",
")",
"{",
"return",
"s",
".",
"ReturnedTask",
",",
"s",
".",
"ReturnedErr",
"\n",
"}"
] |
15,485 | all-15486 | [
"Do",
"executes",
"Browser",
".",
"setWindowBounds",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetWindowBoundsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetWindowBounds",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
15,486 | all-15487 | [
"needSnapshotAbort",
"returns",
"true",
"if",
"snapshot",
"progress",
"s",
"Match",
"is",
"equal",
"or",
"higher",
"than",
"the",
"pendingSnapshot",
"."
] | [
"func",
"(",
"pr",
"*",
"Progress",
")",
"needSnapshotAbort",
"(",
")",
"bool",
"{",
"<mask>",
"pr",
".",
"State",
"==",
"ProgressStateSnapshot",
"&&",
"pr",
".",
"Match",
">=",
"pr",
".",
"PendingSnapshot",
"\n",
"}"
] |
15,487 | all-15488 | [
"AgentPreServiceTerminate",
"terminates",
"the",
"service",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentPreServiceTerminate",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"channel",
",",
"err",
":=",
"w",
".",
"agentUpdateServiceStatus",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentPreServiceTerminate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"channel",
".",
"ReceiptBalance",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"agentCooperativeClose",
"(",
"logger",
",",
"job",
",",
"channel",
")",
"\n",
"}"
] |
15,488 | all-15489 | [
"Takes",
"an",
"IPv4",
"address",
"string",
"and",
"returns",
"the",
"country",
"code",
"for",
"that",
"IP",
"and",
"the",
"netmask",
"for",
"that",
"IP",
"range",
"."
] | [
"func",
"(",
"gi",
"*",
"GeoIP",
")",
"GetCountry",
"(",
"ip",
"string",
")",
"(",
"cc",
"string",
",",
"netmask",
"int",
")",
"{",
"if",
"gi",
".",
"db",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"gi",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"gi",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"cip",
":=",
"C",
".",
"CString",
"(",
"ip",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cip",
")",
")",
"\n",
"ccountry",
":=",
"C",
".",
"GeoIP_country_code_by_addr",
"(",
"gi",
".",
"db",
",",
"cip",
")",
"\n\n",
"if",
"ccountry",
"!=",
"nil",
"{",
"cc",
"=",
"C",
".",
"GoString",
"(",
"ccountry",
")",
"\n",
"netmask",
"=",
"int",
"(",
"C",
".",
"GeoIP_last_netmask",
"(",
"gi",
".",
"<mask>",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
15,489 | all-15490 | [
"isErrFieldMismatch",
"returns",
"whether",
"err",
"is",
"a",
"datastore",
".",
"ErrFieldMismatch",
".",
"The",
"blobstore",
"stores",
"blob",
"metadata",
"in",
"the",
"datastore",
".",
"When",
"loading",
"that",
"metadata",
"it",
"may",
"contain",
"fields",
"that",
"we",
"don",
"t",
"care",
"about",
".",
"datastore",
".",
"Get",
"will",
"return",
"datastore",
".",
"ErrFieldMismatch",
"in",
"that",
"case",
"so",
"we",
"ignore",
"that",
"specific",
"error",
"."
] | [
"func",
"isErrFieldMismatch",
"(",
"err",
"error",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"datastore",
".",
"ErrFieldMismatch",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
15,490 | all-15491 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"TransferMode",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
15,491 | all-15492 | [
"Run",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_run",
"()",
"."
] | [
"func",
"(",
"po",
"*",
"PrintOperation",
")",
"Run",
"(",
"action",
"PrintOperationAction",
",",
"parent",
"*",
"Window",
")",
"(",
"PrintOperationResult",
",",
"error",
")",
"{",
"<mask>",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"c",
":=",
"C",
".",
"gtk_print_operation_run",
"(",
"po",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkPrintOperationAction",
"(",
"action",
")",
",",
"parent",
".",
"native",
"(",
")",
",",
"&",
"err",
")",
"\n",
"res",
":=",
"PrintOperationResult",
"(",
"c",
")",
"\n",
"if",
"res",
"==",
"PRINT_OPERATION_RESULT_ERROR",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"res",
",",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
15,492 | all-15493 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"/",
"{",
"name",
"}",
"/",
"volumes",
"/",
"{",
"type",
"}",
"Create",
"a",
"storage",
"volume",
"in",
"a",
"given",
"storage",
"pool",
"."
] | [
"func",
"storagePoolVolumesTypePost",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"response",
":=",
"ForwardedResponseIfTargetIsRemote",
"(",
"d",
",",
"r",
")",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"req",
":=",
"api",
".",
"StorageVolumesPost",
"{",
"}",
"\n\n",
"// Parse the request.",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Sanity checks.",
"if",
"req",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"req",
".",
"Name",
",",
"\"",
"\"",
")",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"req",
".",
"Type",
"=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"// We currently only allow to create storage volumes of type",
"// storagePoolVolumeTypeCustom. So check, that nothing else was",
"// requested.",
"if",
"req",
".",
"Type",
"!=",
"storagePoolVolumeTypeNameCustom",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"`Currently not allowed to create `",
"+",
"`storage volumes of type %s`",
",",
"req",
".",
"Type",
")",
")",
"\n",
"}",
"\n\n",
"poolName",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"switch",
"req",
".",
"Source",
".",
"Type",
"{",
"case",
"\"",
"\"",
":",
"return",
"doVolumeCreateOrCopy",
"(",
"d",
",",
"poolName",
",",
"&",
"req",
")",
"\n",
"<mask>",
"\"",
"\"",
":",
"return",
"doVolumeCreateOrCopy",
"(",
"d",
",",
"poolName",
",",
"&",
"req",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"doVolumeMigration",
"(",
"d",
",",
"poolName",
",",
"&",
"req",
")",
"\n",
"default",
":",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"Source",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"}"
] |
15,493 | all-15494 | [
"MustError",
"retrieves",
"the",
"Error",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"MustError",
"(",
")",
"<mask>",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetError",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
15,494 | all-15495 | [
"PathsForJob",
"determines",
"the",
"following",
"for",
"a",
"job",
":",
"-",
"path",
"in",
"GCS",
"under",
"the",
"bucket",
"where",
"job",
"artifacts",
"will",
"be",
"uploaded",
"for",
":",
"-",
"the",
"job",
"-",
"this",
"specific",
"run",
"of",
"the",
"job",
"(",
"if",
"any",
"subdir",
"is",
"present",
")",
"The",
"builder",
"for",
"the",
"job",
"is",
"also",
"returned",
"for",
"use",
"in",
"other",
"path",
"resolution",
"."
] | [
"func",
"PathsForJob",
"(",
"options",
"*",
"prowapi",
".",
"GCSConfiguration",
",",
"spec",
"*",
"downwardapi",
".",
"JobSpec",
",",
"subdir",
"string",
")",
"(",
"string",
",",
"string",
",",
"gcs",
".",
"RepoPathBuilder",
")",
"{",
"builder",
":=",
"builderForStrategy",
"(",
"options",
".",
"PathStrategy",
",",
"options",
".",
"DefaultOrg",
",",
"options",
".",
"DefaultRepo",
")",
"\n",
"jobBasePath",
":=",
"gcs",
".",
"PathForSpec",
"(",
"spec",
",",
"builder",
")",
"\n",
"if",
"options",
".",
"PathPrefix",
"!=",
"\"",
"\"",
"{",
"jobBasePath",
"=",
"path",
".",
"Join",
"(",
"<mask>",
".",
"PathPrefix",
",",
"jobBasePath",
")",
"\n",
"}",
"\n",
"var",
"gcsPath",
"string",
"\n",
"if",
"subdir",
"==",
"\"",
"\"",
"{",
"gcsPath",
"=",
"jobBasePath",
"\n",
"}",
"else",
"{",
"gcsPath",
"=",
"path",
".",
"Join",
"(",
"jobBasePath",
",",
"subdir",
")",
"\n",
"}",
"\n\n",
"return",
"jobBasePath",
",",
"gcsPath",
",",
"builder",
"\n",
"}"
] |
15,495 | all-15496 | [
"Close",
"indicates",
"an",
"expected",
"call",
"of",
"Close"
] | [
"func",
"(",
"mr",
"*",
"MockFileMockRecorder",
")",
"Close",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"<mask>",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockFile",
")",
"(",
"nil",
")",
".",
"Close",
")",
")",
"\n",
"}"
] |
15,496 | all-15497 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"BoxModel",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom78",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,497 | all-15498 | [
"Discovery",
"describes",
"the",
"remote",
"OpenGDPR",
"speciication",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Discovery",
"(",
")",
"(",
"*",
"DiscoveryResponse",
",",
"error",
")",
"{",
"discResp",
":=",
"&",
"DiscoveryResponse",
"{",
"}",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"caller",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"endpoint",
"+",
"\"",
"\"",
",",
"nil",
")",
"\n",
"return",
"discResp",
",",
"c",
".",
"json",
"(",
"resp",
",",
"err",
",",
"<mask>",
",",
"discResp",
")",
"\n",
"}"
] |
15,498 | all-15499 | [
"GetConfig",
"returns",
"a",
"Server",
"configurations"
] | [
"func",
"GetConfig",
"(",
"<mask>",
"interface",
"{",
"}",
",",
"environment",
"string",
")",
"(",
"server",
"Config",
",",
"err",
"error",
")",
"{",
"var",
"serverEnvironment",
"ServerEnvironment",
"\n",
"i",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"source",
",",
"environment",
",",
"&",
"serverEnvironment",
")",
"\n",
"server",
"=",
"i",
".",
"(",
"Config",
")",
"\n",
"return",
"\n",
"}"
] |
15,499 | all-15500 | [
"Close",
"closes",
"the",
"connection",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Close",
"(",
")",
"error",
"{",
"c",
".",
"connected",
".",
"Store",
"(",
"false",
")",
"\n",
"<mask>",
":=",
"c",
".",
"ws",
".",
"Load",
"(",
")",
".",
"(",
"*",
"websocket",
".",
"Conn",
")",
"\n",
"if",
"ws",
"!=",
"nil",
"{",
"ws",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.