id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
15,900 | all-15901 | [
"Pull",
"retrieves",
"current",
"Docker",
"image",
"from",
"Docker",
"repository",
".",
"Returns",
"ExternalCmdError",
"on",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Pull",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"s",
".",
"docker",
".",
"Run",
"(",
"\"",
"\"",
",",
"s",
".",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,901 | all-15902 | [
"DeliverPushMessage",
"[",
"no",
"description",
"]",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"ServiceWorker#method",
"-",
"deliverPushMessage",
"parameters",
":",
"origin",
"registrationID",
"data"
] | [
"func",
"DeliverPushMessage",
"(",
"origin",
"string",
",",
"registrationID",
"RegistrationID",
",",
"data",
"string",
")",
"*",
"DeliverPushMessageParams",
"{",
"return",
"&",
"DeliverPushMessageParams",
"{",
"Origin",
":",
"<mask>",
",",
"RegistrationID",
":",
"registrationID",
",",
"Data",
":",
"data",
",",
"}",
"\n",
"}"
] |
15,902 | all-15903 | [
"AttachPersistentDisk",
"updates",
"the",
"agent",
"settings",
"in",
"order",
"to",
"add",
"an",
"attached",
"persistent",
"disk",
"."
] | [
"func",
"(",
"as",
"AgentSettings",
")",
"AttachEphemeralDisk",
"(",
"path",
"string",
")",
"AgentSettings",
"{",
"as",
".",
"Disks",
".",
"Ephemeral",
"=",
"<mask>",
"\n\n",
"return",
"as",
"\n",
"}"
] |
15,903 | all-15904 | [
"parsePattern",
"parses",
"a",
"gitattributes",
"pattern",
"string",
"into",
"the",
"Pattern",
"structure",
".",
"The",
"rules",
"by",
"which",
"the",
"pattern",
"matches",
"paths",
"are",
"the",
"same",
"as",
"in",
".",
"gitignore",
"files",
"(",
"see",
"https",
":",
"//",
"git",
"-",
"scm",
".",
"com",
"/",
"docs",
"/",
"gitignore",
")",
"with",
"a",
"few",
"exceptions",
":",
"-",
"negative",
"patterns",
"are",
"forbidden",
"-",
"patterns",
"that",
"match",
"a",
"directory",
"do",
"not",
"recursively",
"match",
"paths",
"inside",
"that",
"directory",
"https",
":",
"//",
"git",
"-",
"scm",
".",
"com",
"/",
"docs",
"/",
"gitattributes"
] | [
"func",
"parsePattern",
"(",
"p",
"string",
")",
"(",
"Pattern",
",",
"error",
")",
"{",
"res",
":=",
"pattern",
"{",
"}",
"\n\n",
"// negative patterns are forbidden",
"if",
"strings",
".",
"HasPrefix",
"(",
"p",
",",
"negativePrefix",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"}",
"\n\n",
"// trailing spaces are ignored unless they are quoted with backslash",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"p",
",",
"`\\ `",
")",
"{",
"p",
"=",
"strings",
".",
"TrimRight",
"(",
"p",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// patterns that match a directory do not recursively match paths inside that directory",
"if",
"strings",
".",
"HasSuffix",
"(",
"p",
",",
"patternDirSep",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"p",
",",
"patternDirSep",
")",
"{",
"res",
".",
"isPath",
"=",
"true",
"\n",
"}",
"\n\n",
"res",
".",
"pattern",
"=",
"strings",
".",
"Split",
"(",
"p",
",",
"patternDirSep",
")",
"\n",
"return",
"&",
"<mask>",
",",
"nil",
"\n",
"}"
] |
15,904 | all-15905 | [
"Set",
"a",
"file",
"output",
"."
] | [
"func",
"yaml_emitter_set_output_writer",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"w",
"io",
".",
"<mask>",
")",
"{",
"if",
"emitter",
".",
"write_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"emitter",
".",
"write_handler",
"=",
"yaml_writer_write_handler",
"\n",
"emitter",
".",
"output_writer",
"=",
"w",
"\n",
"}"
] |
15,905 | all-15906 | [
"configureTeamRepos",
"updates",
"the",
"list",
"of",
"repos",
"that",
"the",
"team",
"has",
"permissions",
"for",
"when",
"necessary"
] | [
"func",
"configureTeamRepos",
"(",
"<mask>",
"teamRepoClient",
",",
"githubTeams",
"map",
"[",
"string",
"]",
"github",
".",
"Team",
",",
"name",
",",
"orgName",
"string",
",",
"team",
"org",
".",
"Team",
")",
"error",
"{",
"gt",
",",
"ok",
":=",
"githubTeams",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// configureTeams is buggy if this is the case",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"want",
":=",
"team",
".",
"Repos",
"\n",
"have",
":=",
"map",
"[",
"string",
"]",
"github",
".",
"RepoPermissionLevel",
"{",
"}",
"\n",
"repos",
",",
"err",
":=",
"client",
".",
"ListTeamRepos",
"(",
"gt",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"gt",
".",
"ID",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"repo",
":=",
"range",
"repos",
"{",
"have",
"[",
"repo",
".",
"Name",
"]",
"=",
"github",
".",
"LevelFromPermissions",
"(",
"repo",
".",
"Permissions",
")",
"\n",
"}",
"\n\n",
"actions",
":=",
"map",
"[",
"string",
"]",
"github",
".",
"RepoPermissionLevel",
"{",
"}",
"\n",
"for",
"wantRepo",
",",
"wantPermission",
":=",
"range",
"want",
"{",
"if",
"havePermission",
",",
"haveRepo",
":=",
"have",
"[",
"wantRepo",
"]",
";",
"haveRepo",
"&&",
"havePermission",
"==",
"wantPermission",
"{",
"// nothing to do",
"continue",
"\n",
"}",
"\n",
"// create or update this permission",
"actions",
"[",
"wantRepo",
"]",
"=",
"wantPermission",
"\n",
"}",
"\n\n",
"for",
"haveRepo",
":=",
"range",
"have",
"{",
"if",
"_",
",",
"wantRepo",
":=",
"want",
"[",
"haveRepo",
"]",
";",
"!",
"wantRepo",
"{",
"// should remove these permissions",
"actions",
"[",
"haveRepo",
"]",
"=",
"github",
".",
"None",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"updateErrors",
"[",
"]",
"error",
"\n",
"for",
"repo",
",",
"permission",
":=",
"range",
"actions",
"{",
"var",
"err",
"error",
"\n",
"if",
"permission",
"==",
"github",
".",
"None",
"{",
"err",
"=",
"client",
".",
"RemoveTeamRepo",
"(",
"gt",
".",
"ID",
",",
"orgName",
",",
"repo",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"client",
".",
"UpdateTeamRepo",
"(",
"gt",
".",
"ID",
",",
"orgName",
",",
"repo",
",",
"permission",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"updateErrors",
"=",
"append",
"(",
"updateErrors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"gt",
".",
"ID",
",",
"name",
",",
"repo",
",",
"permission",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"errorutil",
".",
"NewAggregate",
"(",
"updateErrors",
"...",
")",
"\n",
"}"
] |
15,906 | all-15907 | [
"Make",
"an",
"API",
"call",
"and",
"fetch",
"the",
"audit",
"entries",
"matching",
"specified",
"criteria"
] | [
"func",
"fetchAuditEntries",
"(",
"<mask>",
"*",
"cm15",
".",
"API",
",",
"filterEmail",
"string",
")",
"(",
"[",
"]",
"*",
"cm15",
".",
"AuditEntry",
",",
"error",
")",
"{",
"auditLocator",
":=",
"client",
".",
"AuditEntryLocator",
"(",
"\"",
"\"",
")",
"\n",
"var",
"apiParams",
"=",
"rsapi",
".",
"APIParams",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"+",
"filterEmail",
"}",
"}",
"\n",
"auditEntries",
",",
"err",
":=",
"auditLocator",
".",
"Index",
"(",
"tomorrow",
"(",
")",
",",
"// End date",
"\"",
"\"",
",",
"// Limit",
"yesterday",
"(",
")",
",",
"// Start date",
"apiParams",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"auditEntries",
",",
"err",
"\n",
"}",
"\n",
"return",
"auditEntries",
",",
"nil",
"\n",
"}"
] |
15,907 | all-15908 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"image",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTexImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"border",
"int32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTexImage1D",
"(",
"gpCompressedTexImage1D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"data",
")",
"\n",
"}"
] |
15,908 | all-15909 | [
"SetPageSize",
"is",
"a",
"wrapper",
"around",
"gtk_adjustment_set_page_size",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Adjustment",
")",
"SetPageSize",
"(",
"value",
"float64",
")",
"{",
"C",
".",
"gtk_adjustment_set_page_size",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
15,909 | all-15910 | [
"SetSentStatus",
"safely",
"sets",
"the",
"SentStatusUnsafe",
"of",
"the",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"SetSentStatus",
"(",
"status",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"{",
"c",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
".",
"SentStatusUnsafe",
"=",
"status",
"\n",
"}"
] |
15,910 | all-15911 | [
"Err",
"is",
"the",
"error",
"value",
"if",
"this",
"WatchResponse",
"holds",
"an",
"error",
"."
] | [
"func",
"(",
"wr",
"*",
"WatchResponse",
")",
"Err",
"(",
")",
"error",
"{",
"switch",
"{",
"case",
"wr",
".",
"closeErr",
"!=",
"nil",
":",
"return",
"v3rpc",
".",
"Error",
"(",
"wr",
".",
"closeErr",
")",
"\n",
"case",
"wr",
".",
"CompactRevision",
"!=",
"0",
":",
"return",
"v3rpc",
".",
"ErrCompacted",
"\n",
"case",
"wr",
".",
"Canceled",
":",
"if",
"len",
"(",
"wr",
".",
"cancelReason",
")",
"!=",
"0",
"{",
"return",
"v3rpc",
".",
"Error",
"(",
"status",
".",
"<mask>",
"(",
"codes",
".",
"FailedPrecondition",
",",
"wr",
".",
"cancelReason",
")",
")",
"\n",
"}",
"\n",
"return",
"v3rpc",
".",
"ErrFutureRev",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,911 | all-15912 | [
"expandBaseCustomizationIdentitySettings",
"returns",
"a",
"BaseCustomizationIdentitySettings",
"depending",
"on",
"what",
"is",
"defined",
".",
"Only",
"one",
"of",
"the",
"three",
"types",
"of",
"identity",
"settings",
"can",
"be",
"specified",
":",
"Linux",
"settings",
"(",
"from",
"linux_options",
")",
"Windows",
"settings",
"(",
"from",
"windows_options",
")",
"and",
"the",
"raw",
"Windows",
"sysprep",
"file",
"(",
"via",
"windows_sysprep_text",
")",
"."
] | [
"func",
"expandBaseCustomizationIdentitySettings",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"family",
"string",
")",
"<mask>",
".",
"BaseCustomizationIdentitySettings",
"{",
"var",
"obj",
"types",
".",
"BaseCustomizationIdentitySettings",
"\n",
"_",
",",
"windowsExists",
":=",
"d",
".",
"GetOkExists",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"_",
",",
"sysprepExists",
":=",
"d",
".",
"GetOkExists",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"switch",
"{",
"case",
"family",
"==",
"string",
"(",
"types",
".",
"VirtualMachineGuestOsFamilyLinuxGuest",
")",
":",
"obj",
"=",
"expandCustomizationLinuxPrep",
"(",
"d",
")",
"\n",
"case",
"family",
"==",
"string",
"(",
"types",
".",
"VirtualMachineGuestOsFamilyWindowsGuest",
")",
"&&",
"windowsExists",
":",
"obj",
"=",
"expandCustomizationSysprep",
"(",
"d",
")",
"\n",
"case",
"family",
"==",
"string",
"(",
"types",
".",
"VirtualMachineGuestOsFamilyWindowsGuest",
")",
"&&",
"sysprepExists",
":",
"obj",
"=",
"expandCustomizationSysprepText",
"(",
"d",
")",
"\n",
"default",
":",
"obj",
"=",
"&",
"types",
".",
"CustomizationIdentitySettings",
"{",
"}",
"\n",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
15,912 | all-15913 | [
"newVSphereClient",
"returns",
"a",
"new",
"vSphereClient",
"after",
"setting",
"up",
"the",
"necessary",
"connections",
"."
] | [
"func",
"newVSphereClient",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"host",
",",
"user",
",",
"password",
"string",
",",
"insecure",
"bool",
")",
"(",
"*",
"vSphereClient",
",",
"error",
")",
"{",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"client",
":=",
"new",
"(",
"vSphereClient",
")",
"\n\n",
"u",
",",
"err",
":=",
"vimURL",
"(",
"host",
",",
"user",
",",
"password",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Set up the VIM/govmomi client connection",
"client",
".",
"VimClient",
",",
"err",
"=",
"newVimSession",
"(",
"ctx",
",",
"u",
",",
"insecure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
".",
"TagsClient",
",",
"err",
"=",
"newRestSession",
"(",
"ctx",
",",
"u",
",",
"insecure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
15,913 | all-15914 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Account",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"AccountLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"AccountLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,914 | all-15915 | [
"MustNewLedgerVersion",
"retrieves",
"the",
"NewLedgerVersion",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerUpgrade",
")",
"MustNewLedgerVersion",
"(",
")",
"Uint32",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetNewLedgerVersion",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
15,915 | all-15916 | [
"CacheRemoteFunc",
"receives",
"a",
"handler",
"function",
"its",
"cache",
"expiration",
"and",
"the",
"remote",
"address",
"of",
"the",
"remote",
"cache",
"server",
"(",
"look",
"ListenAndServe",
")",
"returns",
"a",
"remote",
"-",
"cached",
"handler",
"function",
"You",
"CAN",
"NOT",
"add",
"validators",
"with",
"this",
"function"
] | [
"func",
"CacheRemoteFunc",
"(",
"bodyHandler",
"func",
"(",
"<mask>",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
",",
"expiration",
"time",
".",
"Duration",
",",
"remoteServerAddr",
"string",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"CacheRemote",
"(",
"http",
".",
"HandlerFunc",
"(",
"bodyHandler",
")",
",",
"expiration",
",",
"remoteServerAddr",
")",
".",
"ServeHTTP",
"\n",
"}"
] |
15,916 | all-15917 | [
"VerifyMessageProviderRaw",
"runs",
"provider",
"message",
"verification",
".",
"A",
"Message",
"Producer",
"is",
"analagous",
"to",
"Consumer",
"in",
"the",
"HTTP",
"Interaction",
"model",
".",
"It",
"is",
"the",
"initiator",
"of",
"an",
"interaction",
"and",
"expects",
"something",
"on",
"the",
"other",
"end",
"of",
"the",
"interaction",
"to",
"respond",
"-",
"just",
"in",
"this",
"case",
"not",
"immediately",
"."
] | [
"func",
"(",
"p",
"*",
"Pact",
")",
"VerifyMessageProviderRaw",
"(",
"request",
"VerifyMessageRequest",
")",
"(",
"types",
".",
"ProviderVerifierResponse",
",",
"error",
")",
"{",
"p",
".",
"Setup",
"(",
"false",
")",
"\n",
"response",
":=",
"types",
".",
"ProviderVerifierResponse",
"{",
"}",
"\n\n",
"// Starts the message wrapper API with hooks back to the message handlers",
"// This maps the 'description' field of a message pact, to a function handler",
"// that will implement the message producer. This function must return an object and optionally",
"// and error. The object will be marshalled to JSON for comparison.",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n\n",
"port",
",",
"err",
":=",
"utils",
".",
"GetFreePort",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"response",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Construct verifier request",
"verificationRequest",
":=",
"<mask>",
".",
"VerifyRequest",
"{",
"ProviderBaseURL",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"port",
")",
",",
"PactURLs",
":",
"request",
".",
"PactURLs",
",",
"BrokerURL",
":",
"request",
".",
"BrokerURL",
",",
"Tags",
":",
"request",
".",
"Tags",
",",
"BrokerUsername",
":",
"request",
".",
"BrokerUsername",
",",
"BrokerPassword",
":",
"request",
".",
"BrokerPassword",
",",
"BrokerToken",
":",
"request",
".",
"BrokerToken",
",",
"PublishVerificationResults",
":",
"request",
".",
"PublishVerificationResults",
",",
"ProviderVersion",
":",
"request",
".",
"ProviderVersion",
",",
"Provider",
":",
"p",
".",
"Provider",
",",
"}",
"\n\n",
"mux",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"messageVerificationHandler",
"(",
"request",
".",
"MessageHandlers",
",",
"request",
".",
"StateHandlers",
")",
")",
"\n\n",
"ln",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"port",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"defer",
"ln",
".",
"Close",
"(",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"port",
",",
"ln",
".",
"Addr",
"(",
")",
")",
"\n",
"go",
"http",
".",
"Serve",
"(",
"ln",
",",
"mux",
")",
"\n\n",
"portErr",
":=",
"waitForPort",
"(",
"port",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"p",
".",
"ClientTimeout",
",",
"fmt",
".",
"Sprintf",
"(",
"`Timed out waiting for pact proxy on port %d - check for errors`",
",",
"port",
")",
")",
"\n\n",
"if",
"portErr",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"response",
",",
"portErr",
"\n",
"}",
"\n\n",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"p",
".",
"pactClient",
".",
"VerifyProvider",
"(",
"verificationRequest",
")",
"\n",
"}"
] |
15,917 | all-15918 | [
"LabelNewWithMnemonic",
"is",
"a",
"wrapper",
"around",
"gtk_label_new_with_mnemonic",
"()",
"."
] | [
"func",
"LabelNewWithMnemonic",
"(",
"str",
"string",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_label_new_with_mnemonic",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapLabel",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
15,918 | all-15919 | [
"newImageSource",
"returns",
"a",
"types",
".",
"ImageSource",
"for",
"the",
"specified",
"image",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageSource",
".",
"It",
"would",
"be",
"great",
"if",
"we",
"were",
"able",
"to",
"stream",
"the",
"input",
"tar",
"as",
"it",
"is",
"being",
"sent",
";",
"but",
"Docker",
"sends",
"the",
"top",
"-",
"level",
"manifest",
"which",
"determines",
"which",
"paths",
"to",
"look",
"for",
"at",
"the",
"end",
"so",
"in",
"we",
"will",
"need",
"to",
"seek",
"back",
"and",
"re",
"-",
"read",
"several",
"times",
".",
"(",
"We",
"could",
"perhaps",
"expect",
"an",
"exact",
"sequence",
"assume",
"that",
"the",
"first",
"plaintext",
"file",
"is",
"the",
"config",
"and",
"that",
"the",
"following",
"len",
"(",
"RootFS",
")",
"files",
"are",
"the",
"layers",
"but",
"that",
"feels",
"way",
"too",
"brittle",
".",
")"
] | [
"func",
"newImageSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"daemonReference",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"newDockerClient",
"(",
"sys",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Per NewReference(), ref.StringWithinTransport() is either an image ID (config digest), or a !reference.NameOnly() reference.",
"// Either way ImageSave should create a tarball with exactly one image.",
"inputStream",
",",
"err",
":=",
"c",
".",
"ImageSave",
"(",
"ctx",
",",
"[",
"]",
"string",
"{",
"ref",
".",
"StringWithinTransport",
"(",
")",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"inputStream",
".",
"Close",
"(",
")",
"\n\n",
"src",
",",
"err",
":=",
"tarfile",
".",
"NewSourceFromStream",
"(",
"inputStream",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"daemonImageSource",
"{",
"ref",
":",
"ref",
",",
"Source",
":",
"src",
",",
"}",
",",
"nil",
"\n",
"}"
] |
15,919 | all-15920 | [
"Configure",
"the",
"sqlite",
"connection",
"so",
"that",
"it",
"s",
"safe",
"to",
"access",
"the",
"dqlite",
"-",
"managed",
"sqlite",
"file",
"also",
"without",
"setting",
"up",
"raft",
"."
] | [
"func",
"sqliteDirectAccess",
"(",
"conn",
"*",
"sqlite3",
".",
"SQLiteConn",
")",
"error",
"{",
"// Ensure journal mode is set to WAL, as this is a requirement for",
"// replication.",
"_",
",",
"err",
":=",
"conn",
".",
"Exec",
"(",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Ensure we don't truncate or checkpoint the WAL on exit, as this",
"// would bork replication which must be in full control of the WAL",
"// file.",
"_",
",",
"err",
"=",
"<mask>",
".",
"Exec",
"(",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Ensure WAL autocheckpoint is disabled, since checkpoints are",
"// triggered explicitly by dqlite.",
"_",
",",
"err",
"=",
"conn",
".",
"Exec",
"(",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,920 | all-15921 | [
"ip",
"retrieves",
"and",
"returns",
"the",
"external",
"IP",
"address",
"of",
"the",
"instance",
"."
] | [
"func",
"(",
"c",
"*",
"ComputeUtil",
")",
"<mask>",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"instance",
",",
"err",
":=",
"c",
".",
"service",
".",
"Instances",
".",
"Get",
"(",
"c",
".",
"project",
",",
"c",
".",
"zone",
",",
"c",
".",
"instanceName",
")",
".",
"Do",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"unwrapGoogleError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"nic",
":=",
"instance",
".",
"NetworkInterfaces",
"[",
"0",
"]",
"\n",
"if",
"c",
".",
"useInternalIP",
"{",
"return",
"nic",
".",
"NetworkIP",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nic",
".",
"AccessConfigs",
"[",
"0",
"]",
".",
"NatIP",
",",
"nil",
"\n",
"}"
] |
15,921 | all-15922 | [
"NewWriter",
"creates",
"a",
"stackless",
"writer",
"around",
"a",
"writer",
"returned",
"from",
"newWriter",
".",
"The",
"returned",
"writer",
"writes",
"data",
"to",
"dstW",
".",
"Writers",
"that",
"use",
"a",
"lot",
"of",
"stack",
"space",
"may",
"be",
"wrapped",
"into",
"stackless",
"writer",
"thus",
"saving",
"stack",
"space",
"for",
"high",
"number",
"of",
"concurrently",
"running",
"goroutines",
"."
] | [
"func",
"NewWriter",
"(",
"dstW",
"io",
".",
"Writer",
",",
"newWriter",
"NewWriterFunc",
")",
"<mask>",
"{",
"w",
":=",
"&",
"writer",
"{",
"dstW",
":",
"dstW",
",",
"}",
"\n",
"w",
".",
"zw",
"=",
"newWriter",
"(",
"&",
"w",
".",
"xw",
")",
"\n",
"return",
"w",
"\n",
"}"
] |
15,922 | all-15923 | [
"simultaneously",
"specify",
"storage",
"for",
"all",
"levels",
"of",
"a",
"two",
"-",
"dimensional",
"or",
"one",
"-",
"dimensional",
"array",
"texture"
] | [
"func",
"TexStorage2D",
"(",
"target",
"uint32",
",",
"levels",
"int32",
",",
"internalformat",
"uint32",
",",
"<mask>",
"int32",
",",
"height",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTexStorage2D",
",",
"5",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"levels",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"0",
")",
"\n",
"}"
] |
15,923 | all-15924 | [
"ListenAndServe",
"starts",
"to",
"listen",
"and",
"to",
"serve",
"requests",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"ListenAndServe",
"(",
")",
"error",
"{",
"if",
"s",
".",
"conf",
".",
"TLS",
"!=",
"nil",
"{",
"return",
"s",
".",
"httpsrv",
".",
"ListenAndServeTLS",
"(",
"s",
".",
"conf",
".",
"TLS",
".",
"CertFile",
",",
"s",
".",
"conf",
".",
"TLS",
".",
"KeyFile",
")",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"httpsrv",
".",
"ListenAndServe",
"(",
")",
"\n",
"}"
] |
15,924 | all-15925 | [
"SaveToPngFile",
"create",
"and",
"save",
"an",
"image",
"to",
"a",
"file",
"using",
"PNG",
"format"
] | [
"func",
"SaveToPngFile",
"(",
"filePath",
"string",
",",
"m",
"<mask>",
".",
"Image",
")",
"error",
"{",
"// Create the file",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"filePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n",
"// Create Writer from file",
"b",
":=",
"bufio",
".",
"NewWriter",
"(",
"f",
")",
"\n",
"// Write the image into the buffer",
"err",
"=",
"png",
".",
"Encode",
"(",
"b",
",",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"b",
".",
"Flush",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,925 | all-15926 | [
"ListAll",
"retrieves",
"all",
"the",
"files",
"under",
"a",
"directory",
"(",
"or",
"a",
"file",
"if",
"the",
"path",
"is",
"a",
"file",
")",
"."
] | [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"ListAll",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"*",
"NodeProto",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"*",
"NodeProto",
"\n",
"if",
"err",
":=",
"h",
".",
"List",
"(",
"path",
",",
"func",
"(",
"node",
"*",
"NodeProto",
")",
"error",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"node",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
15,926 | all-15927 | [
"ReceiveEvent",
"will",
"send",
"the",
"event",
"to",
"each",
"individual",
"state",
"and",
"update",
"them",
"if",
"they",
"change",
"."
] | [
"func",
"(",
"m",
"*",
"MultiState",
")",
"ReceiveEvent",
"(",
"eventName",
",",
"label",
"string",
",",
"t",
"time",
".",
"Time",
")",
"(",
"State",
",",
"bool",
")",
"{",
"oneChanged",
":=",
"false",
"\n",
"for",
"i",
":=",
"range",
"m",
".",
"states",
"{",
"state",
",",
"<mask>",
":=",
"m",
".",
"states",
"[",
"i",
"]",
".",
"ReceiveEvent",
"(",
"eventName",
",",
"label",
",",
"t",
")",
"\n",
"if",
"changed",
"{",
"oneChanged",
"=",
"true",
"\n",
"}",
"\n",
"m",
".",
"states",
"[",
"i",
"]",
"=",
"state",
"\n\n",
"}",
"\n",
"return",
"m",
",",
"oneChanged",
"\n",
"}"
] |
15,927 | all-15928 | [
"Return",
"valid",
"json",
"."
] | [
"func",
"(",
"l",
"linesByTimestamp",
")",
"String",
"(",
")",
"string",
"{",
"sort",
".",
"Sort",
"(",
"l",
")",
"\n\n",
"var",
"log",
"string",
"\n",
"for",
"i",
",",
"<mask>",
":=",
"range",
"l",
"{",
"switch",
"i",
"{",
"case",
"len",
"(",
"l",
")",
"-",
"1",
":",
"log",
"+=",
"string",
"(",
"line",
".",
"actual",
")",
"\n",
"default",
":",
"// buf.ReadBytes('\\n') does not remove the newline",
"log",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"strings",
".",
"TrimSuffix",
"(",
"string",
"(",
"line",
".",
"actual",
")",
",",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"log",
")",
"\n",
"}"
] |
15,928 | all-15929 | [
"Type",
"gets",
"a",
"string",
"describing",
"the",
"type",
"of",
"this",
"Value",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"Type",
"(",
")",
"string",
"{",
"var",
"str",
"string",
"\n",
"var",
"<mask>",
"bool",
"\n",
"if",
"str",
",",
"ok",
"=",
"v",
".",
"Data",
".",
"(",
"string",
")",
";",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Data",
")",
"\n",
"}",
"\n",
"if",
"isRegex",
"(",
"str",
")",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
15,929 | all-15930 | [
"SetCookie",
"sets",
"a",
"cookie",
"on",
"the",
"page",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"SetCookie",
"(",
"cookie",
"*",
"http",
".",
"Cookie",
")",
"error",
"{",
"if",
"cookie",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"expiry",
"int64",
"\n",
"if",
"!",
"cookie",
".",
"Expires",
".",
"IsZero",
"(",
")",
"{",
"expiry",
"=",
"cookie",
".",
"Expires",
".",
"Unix",
"(",
")",
"\n",
"}",
"\n\n",
"apiCookie",
":=",
"&",
"api",
".",
"Cookie",
"{",
"<mask>",
":",
"cookie",
".",
"Name",
",",
"Value",
":",
"cookie",
".",
"Value",
",",
"Path",
":",
"cookie",
".",
"Path",
",",
"Domain",
":",
"cookie",
".",
"Domain",
",",
"Secure",
":",
"cookie",
".",
"Secure",
",",
"HTTPOnly",
":",
"cookie",
".",
"HttpOnly",
",",
"Expiry",
":",
"float64",
"(",
"expiry",
")",
",",
"}",
"\n\n",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetCookie",
"(",
"apiCookie",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,930 | all-15931 | [
"SetLabel",
"is",
"a",
"wrapper",
"around",
"gtk_frame_set_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Frame",
")",
"SetLabel",
"(",
"label",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_frame_set_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
15,931 | all-15932 | [
"StatusIconNewFromFile",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_new_from_file",
"()"
] | [
"func",
"StatusIconNewFromFile",
"(",
"filename",
"string",
")",
"(",
"*",
"StatusIcon",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_status_icon_new_from_file",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapStatusIcon",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
15,932 | all-15933 | [
"WithCid",
"adds",
"the",
"cid",
"to",
"the",
"get",
"Vm",
"by",
"cid",
"params"
] | [
"func",
"(",
"o",
"*",
"GetVMByCidParams",
")",
"WithCid",
"(",
"cid",
"int32",
")",
"*",
"GetVMByCidParams",
"{",
"o",
".",
"SetCid",
"(",
"cid",
")",
"\n",
"<mask>",
"o",
"\n",
"}"
] |
15,933 | all-15934 | [
"guestbookKey",
"returns",
"the",
"key",
"used",
"for",
"all",
"guestbook",
"entries",
"."
] | [
"func",
"guestbookKey",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"datastore",
".",
"Key",
"{",
"// The string \"default_guestbook\" here could be varied to have multiple guestbooks.",
"return",
"datastore",
".",
"NewKey",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
",",
"nil",
")",
"\n",
"}"
] |
15,934 | all-15935 | [
"SetDeviceOrientationOverride",
"overrides",
"the",
"Device",
"Orientation",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DeviceOrientation#method",
"-",
"setDeviceOrientationOverride",
"parameters",
":",
"alpha",
"-",
"Mock",
"alpha",
"beta",
"-",
"Mock",
"beta",
"gamma",
"-",
"Mock",
"gamma"
] | [
"func",
"SetDeviceOrientationOverride",
"(",
"<mask>",
"float64",
",",
"beta",
"float64",
",",
"gamma",
"float64",
")",
"*",
"SetDeviceOrientationOverrideParams",
"{",
"return",
"&",
"SetDeviceOrientationOverrideParams",
"{",
"Alpha",
":",
"alpha",
",",
"Beta",
":",
"beta",
",",
"Gamma",
":",
"gamma",
",",
"}",
"\n",
"}"
] |
15,935 | all-15936 | [
"ServeHTTP",
"is",
"the",
"single",
"method",
"of",
"the",
"http",
".",
"Handler",
"interface",
"that",
"makes",
"Mux",
"interoperable",
"with",
"the",
"standard",
"library",
".",
"It",
"uses",
"a",
"sync",
".",
"Pool",
"to",
"get",
"and",
"reuse",
"routing",
"contexts",
"for",
"each",
"request",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Ensure the mux has some routes defined on the mux",
"if",
"mx",
".",
"handler",
"==",
"nil",
"{",
"mx",
".",
"NotFoundHandler",
"(",
")",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Check if a routing context already exists from a parent router.",
"rctx",
",",
"_",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"RouteCtxKey",
")",
".",
"(",
"*",
"Context",
")",
"\n",
"if",
"rctx",
"!=",
"nil",
"{",
"mx",
".",
"handler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Fetch a RouteContext object from the sync pool, and call the computed",
"// mx.handler that is comprised of mx.middlewares + mx.routeHTTP.",
"// Once the request is finished, reset the routing context and put it back",
"// into the pool for reuse from another request.",
"rctx",
"=",
"mx",
".",
"pool",
".",
"Get",
"(",
")",
".",
"(",
"*",
"<mask>",
")",
"\n",
"rctx",
".",
"Reset",
"(",
")",
"\n",
"rctx",
".",
"Routes",
"=",
"mx",
"\n",
"r",
"=",
"r",
".",
"WithContext",
"(",
"context",
".",
"WithValue",
"(",
"r",
".",
"Context",
"(",
")",
",",
"RouteCtxKey",
",",
"rctx",
")",
")",
"\n",
"mx",
".",
"handler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"mx",
".",
"pool",
".",
"Put",
"(",
"rctx",
")",
"\n",
"}"
] |
15,936 | all-15937 | [
"NewAmazonClientFromSecret",
"constructs",
"an",
"amazon",
"client",
"by",
"reading",
"credentials",
"from",
"a",
"mounted",
"AmazonSecret",
".",
"You",
"may",
"pass",
"for",
"bucket",
"in",
"which",
"case",
"it",
"will",
"read",
"the",
"bucket",
"from",
"the",
"secret",
"."
] | [
"func",
"NewAmazonClientFromSecret",
"(",
"bucket",
"string",
",",
"reversed",
"...",
"bool",
")",
"(",
"Client",
",",
"error",
")",
"{",
"// Get AWS region (required for constructing an AWS client)",
"region",
",",
"err",
":=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Use or retrieve S3 bucket",
"if",
"bucket",
"==",
"\"",
"\"",
"{",
"bucket",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Retrieve either static or vault credentials; if neither are found, we will",
"// use IAM roles (i.e. the EC2 metadata service)",
"var",
"creds",
"AmazonCreds",
"\n",
"creds",
".",
"ID",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"creds",
".",
"Secret",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"creds",
".",
"Token",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"<mask>",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"creds",
".",
"VaultAddress",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"creds",
".",
"VaultRole",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"creds",
".",
"VaultToken",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Get Cloudfront distribution (not required, though we can log a warning)",
"distribution",
",",
"err",
":=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"return",
"NewAmazonClient",
"(",
"region",
",",
"bucket",
",",
"&",
"creds",
",",
"distribution",
",",
"reversed",
"...",
")",
"\n",
"}"
] |
15,937 | all-15938 | [
"returns",
"true",
"if",
"the",
"next",
"n",
"values",
"in",
"in",
"can",
"be",
"packed",
"using",
"bits",
"bits",
"per",
"value",
"."
] | [
"func",
"canPack",
"(",
"src",
"[",
"]",
"uint32",
",",
"bits",
",",
"n",
"int",
")",
"bool",
"{",
"if",
"len",
"(",
"src",
")",
"<",
"n",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"end",
":=",
"len",
"(",
"src",
")",
"\n",
"if",
"n",
"<",
"end",
"{",
"end",
"=",
"n",
"\n",
"}",
"\n\n",
"max",
":=",
"uint32",
"(",
"(",
"2",
"<<",
"uint32",
"(",
"bits",
"-",
"1",
")",
")",
"-",
"1",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"end",
";",
"i",
"++",
"{",
"if",
"src",
"[",
"i",
"]",
">",
"<mask>",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
15,938 | all-15939 | [
"RestoreSnapshot",
"restores",
"a",
"cluster",
"from",
"a",
"given",
"snapshot",
"file",
"on",
"disk",
".",
"It",
"s",
"meant",
"to",
"requested",
"remotely",
"so",
"that",
"local",
"member",
"can",
"load",
"the",
"snapshot",
"file",
"from",
"local",
"disk",
"."
] | [
"func",
"(",
"m",
"*",
"Member",
")",
"RestoreSnapshot",
"(",
"lg",
"*",
"zap",
".",
"Logger",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"<mask>",
".",
"RemoveAll",
"(",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"DataDir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"os",
".",
"RemoveAll",
"(",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"WALDir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"Etcd",
".",
"Name",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"Etcd",
".",
"AdvertiseClientURLs",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotPath",
")",
",",
")",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"mgr",
":=",
"snapshot",
".",
"NewV3",
"(",
"lg",
")",
"\n",
"err",
"=",
"mgr",
".",
"Restore",
"(",
"snapshot",
".",
"RestoreConfig",
"{",
"SnapshotPath",
":",
"m",
".",
"SnapshotInfo",
".",
"SnapshotPath",
",",
"Name",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"Name",
",",
"OutputDataDir",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"DataDir",
",",
"OutputWALDir",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"WALDir",
",",
"PeerURLs",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"AdvertisePeerURLs",
",",
"InitialCluster",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"InitialCluster",
",",
"InitialClusterToken",
":",
"m",
".",
"EtcdOnSnapshotRestore",
".",
"InitialClusterToken",
",",
"SkipHashCheck",
":",
"false",
",",
"// TODO: set SkipHashCheck it true, to recover from existing db file",
"}",
")",
"\n",
"took",
":=",
"time",
".",
"Since",
"(",
"now",
")",
"\n",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"MemberName",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"MemberClientURLs",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotPath",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"SnapshotFileSize",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"SnapshotTotalSize",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"SnapshotTotalKey",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"SnapshotHash",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"m",
".",
"SnapshotInfo",
".",
"SnapshotRevision",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"took",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
15,939 | all-15940 | [
"/",
"*",
"----------",
"Path",
"=",
"Badges",
".",
"xml",
"Size",
"=",
"4065633",
"Packed",
"Size",
"=",
"18990516",
"Modified",
"=",
"2015",
"-",
"03",
"-",
"09",
"14",
":",
"30",
":",
"49",
"Attributes",
"=",
"....",
"A",
"CRC",
"=",
"2C468F32",
"Encrypted",
"=",
"-",
"Method",
"=",
"BZip2",
"Block",
"=",
"0"
] | [
"func",
"advanceToFirstEntry",
"(",
"scanner",
"*",
"bufio",
".",
"Scanner",
")",
"error",
"{",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"s",
":=",
"scanner",
".",
"<mask>",
"(",
")",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"err",
":=",
"scanner",
".",
"Err",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"ErrNoEntries",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,940 | all-15941 | [
"SetTaceLocation",
"sets",
"the",
"location",
"file",
":",
"N",
"which",
"when",
"encountered",
"will",
"cause",
"logging",
"to",
"emit",
"a",
"stack",
"trace"
] | [
"func",
"(",
"l",
"*",
"Log",
")",
"SetTraceLocation",
"(",
"<mask>",
"TraceLocation",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"traceLocation",
"=",
"location",
"\n",
"}"
] |
15,941 | all-15942 | [
"Execute",
"should",
"be",
"called",
"once",
"the",
"default",
"flags",
"have",
"been",
"initialized",
"by",
"flag",
".",
"Parse",
".",
"It",
"finds",
"the",
"correct",
"subcommand",
"and",
"executes",
"it",
"and",
"returns",
"an",
"ExitStatus",
"with",
"the",
"result",
".",
"On",
"a",
"usage",
"error",
"an",
"appropriate",
"message",
"is",
"printed",
"to",
"os",
".",
"Stderr",
"and",
"ExitUsageError",
"is",
"returned",
".",
"The",
"additional",
"args",
"are",
"provided",
"as",
"-",
"is",
"to",
"the",
"Execute",
"method",
"of",
"the",
"selected",
"Command",
".",
"It",
"is",
"a",
"wrapper",
"around",
"DefaultCommander",
".",
"Execute",
"."
] | [
"func",
"Execute",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"ExitStatus",
"{",
"return",
"DefaultCommander",
".",
"Execute",
"(",
"ctx",
",",
"args",
"...",
")",
"\n",
"}"
] |
15,942 | all-15943 | [
"New",
"creates",
"new",
"Cloud",
"Pub",
"/",
"Sub",
"Client"
] | [
"func",
"(",
"c",
"*",
"pubSubClient",
")",
"new",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"project",
"string",
")",
"(",
"pubsubClientInterface",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"pubsub",
".",
"NewClient",
"(",
"ctx",
",",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"client",
"=",
"client",
"\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
15,943 | all-15944 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"BringToFrontParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage81",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,944 | all-15945 | [
"GetConsoleCursorInfo",
"retrieves",
"information",
"about",
"the",
"size",
"and",
"visiblity",
"of",
"the",
"console",
"cursor",
".",
"See",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms683163",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
] | [
"func",
"GetConsoleCursorInfo",
"(",
"<mask>",
"uintptr",
",",
"cursorInfo",
"*",
"CONSOLE_CURSOR_INFO",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"getConsoleCursorInfoProc",
".",
"Call",
"(",
"handle",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"cursorInfo",
")",
")",
",",
"0",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
] |
15,945 | all-15946 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkEntry",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkEntry",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkEntry",
"(",
"p",
")",
"\n",
"}"
] |
15,946 | all-15947 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2i",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"int32",
",",
"v1",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform2i",
",",
"4",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"v0",
")",
",",
"uintptr",
"(",
"v1",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
15,947 | all-15948 | [
"NewGCSArtifact",
"returns",
"a",
"new",
"GCSArtifact",
"with",
"a",
"given",
"handle",
"canonical",
"link",
"and",
"path",
"within",
"the",
"job"
] | [
"func",
"NewGCSArtifact",
"(",
"ctx",
"context",
".",
"Context",
",",
"handle",
"artifactHandle",
",",
"link",
"string",
",",
"path",
"string",
",",
"sizeLimit",
"int64",
")",
"*",
"GCSArtifact",
"{",
"return",
"&",
"GCSArtifact",
"{",
"<mask>",
":",
"handle",
",",
"link",
":",
"link",
",",
"path",
":",
"path",
",",
"sizeLimit",
":",
"sizeLimit",
",",
"ctx",
":",
"ctx",
",",
"}",
"\n",
"}"
] |
15,948 | all-15949 | [
"byKey",
"accepts",
"a",
"slice",
"of",
"KV",
"pairs",
"and",
"returns",
"a",
"map",
"of",
"the",
"top",
"-",
"level",
"key",
"to",
"all",
"its",
"subkeys",
".",
"For",
"example",
":",
"elasticsearch",
"/",
"a",
"//",
"=",
">",
"1",
"elasticsearch",
"/",
"b",
"//",
"=",
">",
"2",
"redis",
"/",
"a",
"/",
"b",
"//",
"=",
">",
"3",
"Passing",
"the",
"result",
"from",
"Consul",
"through",
"byTag",
"would",
"yield",
":",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
"{",
"elasticsearch",
":",
"&dep",
".",
"KeyPair",
"{",
"a",
":",
"1",
"}",
"&dep",
".",
"KeyPair",
"{",
"b",
":",
"2",
"}",
"redis",
":",
"&dep",
".",
"KeyPair",
"{",
"a",
"/",
"b",
":",
"3",
"}",
"}",
"Note",
"that",
"the",
"top",
"-",
"most",
"key",
"is",
"stripped",
"from",
"the",
"Key",
"value",
".",
"Keys",
"that",
"have",
"no",
"prefix",
"after",
"stripping",
"are",
"removed",
"from",
"the",
"list",
"."
] | [
"func",
"byKey",
"(",
"pairs",
"[",
"]",
"*",
"dep",
".",
"KeyPair",
")",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"*",
"dep",
".",
"KeyPair",
",",
"error",
")",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"*",
"dep",
".",
"KeyPair",
")",
"\n",
"for",
"_",
",",
"pair",
":=",
"range",
"pairs",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"pair",
".",
"Key",
",",
"\"",
"\"",
")",
"\n",
"top",
":=",
"parts",
"[",
"0",
"]",
"\n",
"key",
":=",
"strings",
".",
"Join",
"(",
"parts",
"[",
"1",
":",
"]",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"key",
"==",
"\"",
"\"",
"{",
"// Do not add a key if it has no prefix after stripping.",
"continue",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"m",
"[",
"top",
"]",
";",
"!",
"ok",
"{",
"m",
"[",
"top",
"]",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"dep",
".",
"KeyPair",
")",
"\n",
"}",
"\n\n",
"newPair",
":=",
"*",
"pair",
"\n",
"newPair",
".",
"Key",
"=",
"<mask>",
"\n",
"m",
"[",
"top",
"]",
"[",
"key",
"]",
"=",
"&",
"newPair",
"\n",
"}",
"\n\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
15,949 | all-15950 | [
"ExtractVariables",
"takes",
"a",
"resource",
"href",
"and",
"extracts",
"the",
"variables",
"(",
"cloud_id",
"id",
"etc",
".",
")",
"that",
"make",
"it",
"up",
".",
"It",
"does",
"that",
"by",
"matching",
"the",
"href",
"against",
"all",
"the",
"resource",
"action",
"path",
"patterns",
"and",
"finding",
"the",
"longest",
"one",
"that",
"matches",
"."
] | [
"func",
"(",
"r",
"*",
"Resource",
")",
"ExtractVariables",
"(",
"href",
"string",
")",
"(",
"[",
"]",
"*",
"PathVariable",
",",
"error",
")",
"{",
"matches",
":=",
"r",
".",
"findMatches",
"(",
"href",
")",
"\n",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"href",
",",
"\"",
"\"",
")",
"{",
"href",
"=",
"\"",
"\"",
"+",
"href",
"\n",
"matches",
"=",
"r",
".",
"findMatches",
"(",
"href",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"href",
",",
"r",
".",
"Name",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"ByLen",
"(",
"matches",
")",
")",
"\n",
"pattern",
":=",
"matches",
"[",
"0",
"]",
"\n",
"submatches",
":=",
"<mask>",
".",
"Regexp",
".",
"FindAllStringSubmatch",
"(",
"href",
",",
"-",
"1",
")",
"\n",
"if",
"len",
"(",
"submatches",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"*",
"PathVariable",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"submatches",
")",
">",
"1",
"{",
"// Not right... there should only be one",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"href",
",",
"r",
".",
"Name",
")",
"\n",
"}",
"\n",
"submatch",
":=",
"submatches",
"[",
"0",
"]",
"\n",
"variables",
":=",
"make",
"(",
"[",
"]",
"*",
"PathVariable",
",",
"len",
"(",
"submatch",
")",
"-",
"1",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"submatch",
"[",
"1",
":",
"]",
"{",
"variables",
"[",
"i",
"]",
"=",
"&",
"PathVariable",
"{",
"Name",
":",
"pattern",
".",
"Variables",
"[",
"i",
"]",
",",
"Value",
":",
"v",
"}",
"\n\n",
"}",
"\n",
"return",
"variables",
",",
"nil",
"\n",
"}"
] |
15,950 | all-15951 | [
"SetSharedFolderState",
"modifies",
"the",
"state",
"of",
"a",
"shared",
"folder",
"mounted",
"in",
"the",
"virtual",
"machine",
".",
"Parameters",
":",
"name",
":",
"Specifies",
"the",
"name",
"of",
"the",
"shared",
"folder",
".",
"hostpath",
":",
"Specifies",
"the",
"host",
"path",
"of",
"the",
"shared",
"folder",
".",
"options",
":",
"The",
"new",
"flag",
"settings",
".",
"Remarks",
":",
"*",
"This",
"function",
"modifies",
"the",
"state",
"flags",
"of",
"an",
"existing",
"shared",
"folder",
".",
"*",
"If",
"the",
"shared",
"folder",
"does",
"not",
"exist",
"before",
"calling",
"this",
"function",
"the",
"function",
"will",
"return",
"a",
"not",
"found",
"error",
".",
"*",
"Shared",
"folders",
"are",
"not",
"supported",
"for",
"the",
"following",
"guest",
"operating",
"systems",
":",
"Windows",
"ME",
"Windows",
"98",
"Windows",
"95",
"Windows",
"3",
".",
"x",
"and",
"DOS",
".",
"*",
"In",
"this",
"release",
"this",
"function",
"requires",
"the",
"virtual",
"machine",
"to",
"be",
"powered",
"on",
"with",
"VMware",
"Tools",
"installed",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0"
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"SetSharedFolderState",
"(",
"name",
",",
"hostpath",
"string",
",",
"options",
"SharedFolderOption",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"sfname",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"hpath",
":=",
"C",
".",
"CString",
"(",
"hostpath",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"sfname",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"hpath",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_SetSharedFolderState",
"(",
"v",
".",
"handle",
",",
"//vmHandle",
"sfname",
",",
"//shareName",
"hpath",
",",
"//hostPathName",
"C",
".",
"VixMsgSharedFolderOptions",
"(",
"options",
")",
",",
"//flags",
"nil",
",",
"//callbackProc",
"nil",
")",
"//clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"<mask>",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"C",
".",
"Vix_ReleaseHandle",
"(",
"v",
".",
"handle",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,951 | all-15952 | [
"Logger",
"returns",
"a",
"new",
"logger",
"for",
"a",
"particular",
"subsystem",
"that",
"writes",
"to",
"the",
"Backend",
"b",
".",
"A",
"tag",
"describes",
"the",
"subsystem",
"and",
"is",
"included",
"in",
"all",
"log",
"messages",
".",
"The",
"logger",
"uses",
"the",
"info",
"verbosity",
"level",
"by",
"default",
"."
] | [
"func",
"(",
"b",
"*",
"Backend",
")",
"Logger",
"(",
"subsystemTag",
"<mask>",
")",
"Logger",
"{",
"return",
"&",
"slog",
"{",
"LevelInfo",
",",
"subsystemTag",
",",
"b",
"}",
"\n",
"}"
] |
15,952 | all-15953 | [
"/",
"*",
"SectionNames",
"returns",
"the",
"names",
"for",
"each",
"of",
"the",
"sections",
"in",
"a",
"config",
"structure",
".",
"If",
"the",
"config",
"was",
"assigned",
"a",
"name",
"that",
"name",
"is",
"included",
"in",
"the",
"list",
".",
"If",
"the",
"name",
"is",
"not",
"set",
"then",
"only",
"explicitely",
"named",
"sections",
"are",
"returned",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"SectionNames",
"(",
")",
"[",
"]",
"string",
"{",
"sectionNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"config",
".",
"sections",
")",
")",
"\n",
"for",
"name",
":=",
"range",
"config",
".",
"sections",
"{",
"sectionNames",
"=",
"append",
"(",
"sectionNames",
",",
"name",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"config",
".",
"<mask>",
")",
">",
"0",
"{",
"sectionNames",
"=",
"append",
"(",
"sectionNames",
",",
"config",
".",
"name",
")",
"\n",
"}",
"\n\n",
"sort",
".",
"Strings",
"(",
"sectionNames",
")",
"\n\n",
"return",
"sectionNames",
"\n",
"}"
] |
15,953 | all-15954 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"KeyframeRule",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss33",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,954 | all-15955 | [
"StdoutWriter",
"sets",
"the",
"StdoutWriter"
] | [
"func",
"(",
"e",
"*",
"execStreamerBuilder",
")",
"StdoutWriter",
"(",
"writer",
"<mask>",
".",
"Writer",
")",
"ExecStreamerBuilder",
"{",
"e",
".",
"d",
".",
"StdoutWriter",
"=",
"writer",
"\n",
"return",
"e",
"\n",
"}"
] |
15,955 | all-15956 | [
"FiltersFromRequest",
"returns",
"mvcc",
".",
"FilterFunc",
"from",
"a",
"given",
"watch",
"create",
"request",
"."
] | [
"func",
"FiltersFromRequest",
"(",
"creq",
"*",
"pb",
".",
"WatchCreateRequest",
")",
"[",
"]",
"mvcc",
".",
"FilterFunc",
"{",
"filters",
":=",
"make",
"(",
"[",
"]",
"mvcc",
".",
"FilterFunc",
",",
"0",
",",
"len",
"(",
"creq",
".",
"Filters",
")",
")",
"\n",
"for",
"_",
",",
"ft",
":=",
"range",
"creq",
".",
"Filters",
"{",
"<mask>",
"ft",
"{",
"case",
"pb",
".",
"WatchCreateRequest_NOPUT",
":",
"filters",
"=",
"append",
"(",
"filters",
",",
"filterNoPut",
")",
"\n",
"case",
"pb",
".",
"WatchCreateRequest_NODELETE",
":",
"filters",
"=",
"append",
"(",
"filters",
",",
"filterNoDelete",
")",
"\n",
"default",
":",
"}",
"\n",
"}",
"\n",
"return",
"filters",
"\n",
"}"
] |
15,956 | all-15957 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventDetached",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoInspector2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
15,957 | all-15958 | [
"UpdatedImage",
"returns",
"a",
"types",
".",
"Image",
"modified",
"according",
"to",
"options",
".",
"This",
"does",
"not",
"change",
"the",
"state",
"of",
"the",
"original",
"Image",
"object",
"."
] | [
"func",
"(",
"m",
"*",
"manifestOCI1",
")",
"UpdatedImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"options",
"types",
".",
"ManifestUpdateOptions",
")",
"(",
"types",
".",
"Image",
",",
"error",
")",
"{",
"copy",
":=",
"manifestOCI1",
"{",
"// NOTE: This is not a deep copy, it still shares slices etc.",
"src",
":",
"m",
".",
"src",
",",
"configBlob",
":",
"m",
".",
"configBlob",
",",
"m",
":",
"manifest",
".",
"OCI1Clone",
"(",
"m",
".",
"m",
")",
",",
"}",
"\n",
"if",
"options",
".",
"LayerInfos",
"!=",
"nil",
"{",
"if",
"err",
":=",
"copy",
".",
"m",
".",
"UpdateLayerInfos",
"(",
"<mask>",
".",
"LayerInfos",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"// Ignore options.EmbeddedDockerReference: it may be set when converting from schema1, but we really don't care.",
"switch",
"options",
".",
"ManifestMIMEType",
"{",
"case",
"\"",
"\"",
":",
"// No conversion, OK",
"case",
"manifest",
".",
"DockerV2Schema1MediaType",
",",
"manifest",
".",
"DockerV2Schema1SignedMediaType",
":",
"// We can't directly convert to V1, but we can transitively convert via a V2 image",
"m2",
",",
"err",
":=",
"copy",
".",
"convertToManifestSchema2",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"m2",
".",
"UpdatedImage",
"(",
"ctx",
",",
"types",
".",
"ManifestUpdateOptions",
"{",
"ManifestMIMEType",
":",
"options",
".",
"ManifestMIMEType",
",",
"InformationOnly",
":",
"options",
".",
"InformationOnly",
",",
"}",
")",
"\n",
"case",
"manifest",
".",
"DockerV2Schema2MediaType",
":",
"return",
"copy",
".",
"convertToManifestSchema2",
"(",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"imgspecv1",
".",
"MediaTypeImageManifest",
",",
"options",
".",
"ManifestMIMEType",
")",
"\n",
"}",
"\n\n",
"return",
"memoryImageFromManifest",
"(",
"&",
"copy",
")",
",",
"nil",
"\n",
"}"
] |
15,958 | all-15959 | [
"Am",
"tries",
"to",
"apply",
"the",
"patch",
"in",
"the",
"given",
"path",
"into",
"the",
"current",
"branch",
"by",
"performing",
"a",
"three",
"-",
"way",
"merge",
"(",
"similar",
"to",
"git",
"cherry",
"-",
"pick",
")",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"patch",
"cannot",
"be",
"applied",
"."
] | [
"func",
"(",
"r",
"*",
"Repo",
")",
"Am",
"(",
"path",
"string",
")",
"error",
"{",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"co",
":=",
"r",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"path",
")",
"\n",
"b",
",",
"err",
":=",
"co",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"output",
":=",
"string",
"(",
"b",
")",
"\n",
"r",
".",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"if",
"b",
",",
"abortErr",
":=",
"r",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
".",
"CombinedOutput",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"r",
".",
"logger",
".",
"WithError",
"(",
"abortErr",
")",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n",
"applyMsg",
":=",
"\"",
"\"",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"output",
",",
"applyMsg",
")",
"{",
"i",
":=",
"strings",
".",
"Index",
"(",
"output",
",",
"applyMsg",
")",
"\n",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"output",
"[",
":",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,959 | all-15960 | [
"IsSelfImport",
"returns",
"true",
"if",
"the",
"result",
"s",
"label",
"matches",
"the",
"given",
"label",
"or",
"the",
"result",
"s",
"rule",
"transitively",
"embeds",
"the",
"rule",
"with",
"the",
"given",
"label",
".",
"Self",
"imports",
"cause",
"cyclic",
"dependencies",
"so",
"the",
"caller",
"may",
"want",
"to",
"omit",
"the",
"dependency",
"or",
"report",
"an",
"error",
"."
] | [
"func",
"(",
"r",
"FindResult",
")",
"IsSelfImport",
"(",
"from",
"label",
".",
"<mask>",
")",
"bool",
"{",
"if",
"from",
".",
"Equal",
"(",
"r",
".",
"Label",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"r",
".",
"Embeds",
"{",
"if",
"from",
".",
"Equal",
"(",
"e",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
15,960 | all-15961 | [
"GetTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Type",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Type",
",",
"<mask>",
"\n",
"}"
] |
15,961 | all-15962 | [
"GetForwarder",
"retreives",
"a",
"forwarder",
"with",
"the",
"given",
"name"
] | [
"func",
"(",
"dom",
"*",
"Domain",
")",
"GetForwarder",
"(",
"name",
"string",
")",
"(",
"*",
"Forwarder",
",",
"error",
")",
"{",
"var",
"f",
"string",
"\n",
"err",
":=",
"dom",
".",
"cgp",
".",
"request",
"(",
"getForwarder",
"{",
"Param",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"dom",
".",
"<mask>",
")",
"}",
",",
"&",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Forwarder",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Forwarder",
"{",
"Domain",
":",
"dom",
",",
"Name",
":",
"name",
",",
"To",
":",
"f",
"}",
",",
"nil",
"\n",
"}"
] |
15,962 | all-15963 | [
"GetEmail",
"returns",
"the",
"Email",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"CreatedBy",
")",
"GetEmail",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Email",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Email",
"\n",
"}"
] |
15,963 | all-15964 | [
"LookupAction",
"is",
"a",
"wrapper",
"around",
"g_action_map_lookup_action"
] | [
"func",
"(",
"v",
"*",
"ActionMap",
")",
"LookupAction",
"(",
"actionName",
"string",
")",
"*",
"<mask>",
"{",
"c",
":=",
"C",
".",
"g_action_map_lookup_action",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"actionName",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapAction",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
15,964 | all-15965 | [
"Ensures",
"the",
"given",
"slice",
"of",
"strings",
"are",
"unique",
"and",
"that",
"none",
"are",
"empty",
"strings"
] | [
"func",
"uniquify",
"(",
"in",
"[",
"]",
"string",
")",
"(",
"out",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"i",
":=",
"range",
"in",
"{",
"if",
"i",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"out",
"{",
"if",
"i",
"==",
"o",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"out",
"=",
"append",
"(",
"out",
",",
"i",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
15,965 | all-15966 | [
"Sorted",
"returns",
"all",
"nodes",
"in",
"a",
"topologically",
"sorted",
"order"
] | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Sorted",
"(",
")",
"[",
"]",
"string",
"{",
"seen",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"<mask>",
":=",
"range",
"d",
".",
"parents",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"dfs",
"(",
"id",
",",
"d",
".",
"parents",
",",
"seen",
")",
"...",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
15,966 | all-15967 | [
"DefaultCompiler",
"sets",
"up",
"and",
"assigns",
"the",
"default",
"compiler",
"to",
"be",
"used",
"by",
"Xslate",
".",
"Given",
"an",
"unconfigured",
"Xslate",
"instance",
"and",
"arguments",
"sets",
"up",
"the",
"compiler",
"of",
"said",
"Xslate",
"instance",
".",
"Current",
"implementation",
"just",
"uses",
"compiler",
".",
"New",
"()"
] | [
"func",
"DefaultCompiler",
"(",
"tx",
"*",
"Xslate",
",",
"args",
"Args",
")",
"error",
"{",
"<mask>",
".",
"Compiler",
"=",
"compiler",
".",
"New",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,967 | all-15968 | [
"NumberLines",
"prefixes",
"its",
"item",
"with",
"its",
"index",
"in",
"the",
"input",
"sequence",
"(",
"starting",
"at",
"1",
")",
"followed",
"by",
"a",
"space",
"."
] | [
"func",
"NumberLines",
"(",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"line",
":=",
"1",
"\n",
"for",
"s",
":=",
"range",
"arg",
".",
"In",
"{",
"arg",
".",
"Out",
"<-",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"line",
",",
"s",
")",
"\n",
"<mask>",
"++",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
15,968 | all-15969 | [
"Commits",
"commits",
"the",
"container",
"creating",
"an",
"image",
"in",
"Docker",
".",
"It",
"then",
"returns",
"the",
"image",
"identifier",
"for",
"usage",
"in",
"future",
"container",
"creation",
"."
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"Commit",
"(",
"client",
"provision",
".",
"BuilderDockerClient",
",",
"limiter",
"provision",
".",
"ActionLimiter",
",",
"writer",
"io",
".",
"Writer",
",",
"isDeploy",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"c",
".",
"ID",
")",
"\n",
"repository",
",",
"tag",
":=",
"image",
".",
"SplitImageName",
"(",
"c",
".",
"BuildingImage",
")",
"\n",
"opts",
":=",
"docker",
".",
"CommitContainerOptions",
"{",
"Container",
":",
"c",
".",
"ID",
",",
"Repository",
":",
"repository",
",",
"Tag",
":",
"tag",
"}",
"\n",
"done",
":=",
"limiter",
".",
"Start",
"(",
"c",
".",
"HostAddr",
")",
"\n",
"image",
",",
"err",
":=",
"client",
".",
"CommitContainer",
"(",
"opts",
")",
"\n",
"done",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"log",
".",
"WrapError",
"(",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"c",
".",
"ID",
")",
")",
"\n",
"}",
"\n",
"tags",
":=",
"[",
"]",
"string",
"{",
"tag",
"}",
"\n",
"if",
"isDeploy",
"&&",
"tag",
"!=",
"\"",
"\"",
"{",
"tags",
"=",
"append",
"(",
"tags",
",",
"\"",
"\"",
")",
"\n",
"err",
"=",
"client",
".",
"TagImage",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"repository",
",",
"tag",
")",
",",
"docker",
".",
"TagImageOptions",
"{",
"Repo",
":",
"repository",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Force",
":",
"true",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"log",
".",
"WrapError",
"(",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"c",
".",
"ID",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"imgHistory",
",",
"err",
":=",
"client",
".",
"ImageHistory",
"(",
"c",
".",
"BuildingImage",
")",
"\n",
"imgSize",
":=",
"\"",
"\"",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"len",
"(",
"imgHistory",
")",
">",
"0",
"{",
"fullSize",
":=",
"imgHistory",
"[",
"0",
"]",
".",
"Size",
"\n",
"if",
"len",
"(",
"imgHistory",
")",
">",
"1",
"&&",
"strings",
".",
"Contains",
"(",
"imgHistory",
"[",
"1",
"]",
".",
"CreatedBy",
",",
"\"",
"\"",
")",
"{",
"fullSize",
"+=",
"imgHistory",
"[",
"1",
"]",
".",
"Size",
"\n",
"}",
"\n",
"imgSize",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"float64",
"(",
"fullSize",
")",
"/",
"1024",
"/",
"1024",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"writer",
",",
"\"",
"\\n",
"\"",
",",
"imgSize",
")",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"image",
".",
"ID",
",",
"c",
".",
"ID",
")",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"tags",
"{",
"maxTry",
",",
"_",
":=",
"config",
".",
"GetInt",
"(",
"\"",
"\"",
")",
"\n",
"if",
"maxTry",
"<=",
"0",
"{",
"maxTry",
"=",
"3",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"maxTry",
";",
"i",
"++",
"{",
"err",
"=",
"dockercommon",
".",
"PushImage",
"(",
"client",
",",
"repository",
",",
"tag",
",",
"dockercommon",
".",
"RegistryAuthConfig",
"(",
"repository",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"writer",
",",
"\"",
"\\n",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"BuildingImage",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Second",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"log",
".",
"WrapError",
"(",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"c",
".",
"BuildingImage",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"c",
".",
"BuildingImage",
",",
"nil",
"\n",
"}"
] |
15,969 | all-15970 | [
"GetState",
"returns",
"the",
"current",
"state",
"of",
"a",
"terminal",
"which",
"may",
"be",
"useful",
"to",
"restore",
"the",
"terminal",
"after",
"a",
"signal",
"."
] | [
"func",
"GetState",
"(",
"fd",
"int",
")",
"(",
"*",
"State",
",",
"error",
")",
"{",
"termios",
":=",
"syscall",
".",
"Termios",
"{",
"}",
"\n\n",
"ret",
",",
"err",
":=",
"C",
".",
"tcgetattr",
"(",
"C",
".",
"int",
"(",
"fd",
")",
",",
"(",
"*",
"C",
".",
"struct_termios",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"termios",
")",
")",
")",
"\n",
"if",
"ret",
"!=",
"0",
"{",
"return",
"nil",
",",
"err",
".",
"(",
"syscall",
".",
"Errno",
")",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"State",
"{",
"}",
"\n",
"state",
".",
"Termios",
"=",
"termios",
"\n\n",
"return",
"&",
"state",
",",
"nil",
"\n",
"}"
] |
15,970 | all-15971 | [
"WhitelistReadableFields",
"will",
"enforce",
"the",
"authorization",
"by",
"making",
"sure",
"only",
"the",
"specified",
"fields",
"are",
"returned",
"for",
"the",
"client",
".",
"Note",
":",
"This",
"enforcer",
"cannot",
"be",
"used",
"to",
"authorize",
"Delete",
"ResourceAction",
"and",
"CollectionAction",
"operations",
"."
] | [
"func",
"WhitelistReadableFields",
"(",
"fields",
"...",
"string",
")",
"*",
"Enforcer",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"fire",
".",
"Except",
"(",
"fire",
".",
"Delete",
",",
"fire",
".",
"ResourceAction",
",",
"fire",
".",
"CollectionAction",
")",
",",
"func",
"(",
"ctx",
"*",
"fire",
".",
"Context",
")",
"error",
"{",
"// set new list",
"ctx",
".",
"ReadableFields",
"=",
"<mask>",
".",
"Intersect",
"(",
"ctx",
".",
"ReadableFields",
",",
"fields",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
15,971 | all-15972 | [
"LeftF",
"is",
"the",
"filter",
"form",
"of",
"Left",
"."
] | [
"func",
"LeftF",
"(",
"n",
"int",
")",
"func",
"(",
"<mask>",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"Left",
"(",
"s",
",",
"n",
")",
"\n",
"}",
"\n",
"}"
] |
15,972 | all-15973 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"HideHighlightParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
15,973 | all-15974 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDatabaseTableNamesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,974 | all-15975 | [
"Limit",
"restricts",
"the",
"maximum",
"number",
"of",
"documents",
"retrieved",
"to",
"n",
"and",
"also",
"changes",
"the",
"batch",
"size",
"to",
"the",
"same",
"value",
".",
"Once",
"n",
"documents",
"have",
"been",
"returned",
"by",
"Next",
"the",
"following",
"call",
"will",
"return",
"ErrNotFound",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Limit",
"(",
"n",
"int",
")",
"*",
"Query",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"switch",
"{",
"case",
"n",
"==",
"1",
":",
"q",
".",
"limit",
"=",
"1",
"\n",
"q",
".",
"op",
".",
"<mask>",
"=",
"-",
"1",
"\n",
"case",
"n",
"==",
"math",
".",
"MinInt32",
":",
"// -MinInt32 == -MinInt32",
"q",
".",
"limit",
"=",
"math",
".",
"MaxInt32",
"\n",
"q",
".",
"op",
".",
"limit",
"=",
"math",
".",
"MinInt32",
"+",
"1",
"\n",
"case",
"n",
"<",
"0",
":",
"q",
".",
"limit",
"=",
"int32",
"(",
"-",
"n",
")",
"\n",
"q",
".",
"op",
".",
"limit",
"=",
"int32",
"(",
"n",
")",
"\n",
"default",
":",
"q",
".",
"limit",
"=",
"int32",
"(",
"n",
")",
"\n",
"q",
".",
"op",
".",
"limit",
"=",
"int32",
"(",
"n",
")",
"\n",
"}",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
15,975 | all-15976 | [
"statelessCompare",
"compares",
"two",
"values",
"and",
"returns",
"the",
"result",
".",
"This",
"function",
"is",
"stateless",
"in",
"that",
"it",
"does",
"not",
"alter",
"the",
"current",
"result",
"or",
"output",
"to",
"any",
"registered",
"reporters",
"."
] | [
"func",
"(",
"s",
"*",
"state",
")",
"statelessCompare",
"(",
"<mask>",
"PathStep",
")",
"diff",
".",
"Result",
"{",
"// We do not save and restore the curPath because all of the compareX",
"// methods should properly push and pop from the path.",
"// It is an implementation bug if the contents of curPath differs from",
"// when calling this function to when returning from it.",
"oldResult",
",",
"oldReporters",
":=",
"s",
".",
"result",
",",
"s",
".",
"reporters",
"\n",
"s",
".",
"result",
"=",
"diff",
".",
"Result",
"{",
"}",
"// Reset result",
"\n",
"s",
".",
"reporters",
"=",
"nil",
"// Remove reporters to avoid spurious printouts",
"\n",
"s",
".",
"compareAny",
"(",
"step",
")",
"\n",
"res",
":=",
"s",
".",
"result",
"\n",
"s",
".",
"result",
",",
"s",
".",
"reporters",
"=",
"oldResult",
",",
"oldReporters",
"\n",
"return",
"res",
"\n",
"}"
] |
15,976 | all-15977 | [
"StdoutPrefix",
"sets",
"the",
"StdoutPrefix"
] | [
"func",
"(",
"e",
"*",
"execStreamerBuilder",
")",
"StdoutPrefix",
"(",
"prefix",
"string",
")",
"ExecStreamerBuilder",
"{",
"e",
".",
"d",
".",
"StdoutPrefix",
"=",
"<mask>",
"\n",
"return",
"e",
"\n",
"}"
] |
15,977 | all-15978 | [
"Select",
"adds",
"equality",
"matchers",
"for",
"all",
"external",
"labels",
"to",
"the",
"list",
"of",
"matchers",
"before",
"calling",
"the",
"wrapped",
"storage",
".",
"Queryable",
".",
"The",
"added",
"external",
"labels",
"are",
"removed",
"from",
"the",
"returned",
"series",
"sets",
"."
] | [
"func",
"(",
"q",
"externalLabelsQuerier",
")",
"Select",
"(",
"p",
"*",
"storage",
".",
"SelectParams",
",",
"matchers",
"...",
"*",
"labels",
".",
"Matcher",
")",
"(",
"<mask>",
".",
"SeriesSet",
",",
"storage",
".",
"Warnings",
",",
"error",
")",
"{",
"m",
",",
"added",
":=",
"q",
".",
"addExternalLabels",
"(",
"matchers",
")",
"\n",
"s",
",",
"warnings",
",",
"err",
":=",
"q",
".",
"Querier",
".",
"Select",
"(",
"p",
",",
"m",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"warnings",
",",
"err",
"\n",
"}",
"\n",
"return",
"newSeriesSetFilter",
"(",
"s",
",",
"added",
")",
",",
"warnings",
",",
"nil",
"\n",
"}"
] |
15,978 | all-15979 | [
"DeleteGroup",
"deletes",
"a",
"group"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteGroup",
"(",
"groupid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umGroupPath",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"<mask>",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
15,979 | all-15980 | [
"CollectionOnSession",
"..."
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"collectionOnSession",
"(",
"sess",
"*",
"mgo",
".",
"Session",
")",
"*",
"mgo",
".",
"Collection",
"{",
"return",
"sess",
".",
"DB",
"(",
"c",
".",
"Database",
")",
".",
"C",
"(",
"c",
".",
"<mask>",
")",
"\n",
"}"
] |
15,980 | all-15981 | [
"isHelperMethod",
"returns",
"true",
"if",
"the",
"line",
"is",
"a",
"helper",
"method",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"isHelperMethod",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"l",
".",
"tokens",
")",
">",
"1",
"&&",
"l",
".",
"tokens",
"[",
"0",
"]",
"==",
"equal",
"\n",
"}"
] |
15,981 | all-15982 | [
"Properties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"HostSystem",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
] | [
"func",
"Properties",
"(",
"host",
"*",
"object",
".",
"HostSystem",
")",
"(",
"*",
"mo",
".",
"HostSystem",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"props",
"mo",
".",
"HostSystem",
"\n",
"if",
"err",
":=",
"host",
".",
"Properties",
"(",
"ctx",
",",
"host",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
15,982 | all-15983 | [
"NewSSMSecretResource",
"creates",
"a",
"new",
"SSMSecretResource",
"object"
] | [
"func",
"NewSSMSecretResource",
"(",
"taskARN",
"string",
",",
"ssmSecrets",
"map",
"[",
"string",
"]",
"[",
"]",
"apicontainer",
".",
"Secret",
",",
"executionCredentialsID",
"string",
",",
"credentialsManager",
"credentials",
".",
"<mask>",
",",
"ssmClientCreator",
"factory",
".",
"SSMClientCreator",
")",
"*",
"SSMSecretResource",
"{",
"s",
":=",
"&",
"SSMSecretResource",
"{",
"taskARN",
":",
"taskARN",
",",
"requiredSecrets",
":",
"ssmSecrets",
",",
"credentialsManager",
":",
"credentialsManager",
",",
"executionCredentialsID",
":",
"executionCredentialsID",
",",
"ssmClientCreator",
":",
"ssmClientCreator",
",",
"}",
"\n\n",
"s",
".",
"initStatusToTransition",
"(",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
15,983 | all-15984 | [
"NewHandler",
"creates",
"a",
"new",
"session",
"handler",
"."
] | [
"func",
"NewHandler",
"(",
"logger",
"log",
".",
"Logger",
",",
"db",
"*",
"reform",
".",
"DB",
",",
"countryConf",
"*",
"country",
".",
"Config",
",",
"queue",
"job",
".",
"Queue",
")",
"*",
"Handler",
"{",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"&",
"Handler",
"{",
"db",
":",
"<mask>",
",",
"logger",
":",
"logger",
",",
"countryConf",
":",
"countryConf",
",",
"queue",
":",
"queue",
",",
"}",
"\n",
"}"
] |
15,984 | all-15985 | [
"NewFromData",
"builds",
"a",
"new",
"message",
"with",
"raw",
"template",
"data",
"given"
] | [
"func",
"NewFromData",
"(",
"<mask>",
"render",
".",
"Data",
")",
"Message",
"{",
"d",
":=",
"render",
".",
"Data",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"d",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"m",
":=",
"NewMessage",
"(",
")",
"\n",
"m",
".",
"Data",
"=",
"d",
"\n",
"return",
"m",
"\n",
"}"
] |
15,985 | all-15986 | [
"NotBefore",
"is",
"an",
"option",
"that",
"toggles",
"whether",
"or",
"not",
"the",
"Not",
"Before",
"(",
"nbf",
")",
"field",
"is",
"generated",
"for",
"the",
"token",
"."
] | [
"func",
"NotBefore",
"(",
"<mask>",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"tok",
"*",
"Bearer",
")",
"error",
"{",
"tok",
".",
"addNotBefore",
"=",
"enable",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
15,986 | all-15987 | [
"expr",
"lowers",
"a",
"single",
"-",
"result",
"expression",
"e",
"to",
"SSA",
"form",
"emitting",
"code",
"to",
"fn",
"and",
"returning",
"the",
"Value",
"defined",
"by",
"the",
"expression",
"."
] | [
"func",
"(",
"b",
"*",
"builder",
")",
"expr",
"(",
"fn",
"*",
"Function",
",",
"e",
"ast",
".",
"Expr",
")",
"Value",
"{",
"e",
"=",
"unparen",
"(",
"e",
")",
"\n\n",
"tv",
":=",
"fn",
".",
"Pkg",
".",
"info",
".",
"Types",
"[",
"e",
"]",
"\n\n",
"// Is expression a constant?",
"if",
"tv",
".",
"Value",
"!=",
"nil",
"{",
"return",
"NewConst",
"(",
"tv",
".",
"Value",
",",
"tv",
".",
"Type",
")",
"\n",
"}",
"\n\n",
"var",
"v",
"Value",
"\n",
"if",
"<mask>",
".",
"Addressable",
"(",
")",
"{",
"// Prefer pointer arithmetic ({Index,Field}Addr) followed",
"// by Load over subelement extraction (e.g. Index, Field),",
"// to avoid large copies.",
"v",
"=",
"b",
".",
"addr",
"(",
"fn",
",",
"e",
",",
"false",
")",
".",
"load",
"(",
"fn",
")",
"\n",
"}",
"else",
"{",
"v",
"=",
"b",
".",
"expr0",
"(",
"fn",
",",
"e",
",",
"tv",
")",
"\n",
"}",
"\n",
"if",
"fn",
".",
"debugInfo",
"(",
")",
"{",
"emitDebugRef",
"(",
"fn",
",",
"e",
",",
"v",
",",
"false",
")",
"\n",
"}",
"\n",
"return",
"v",
"\n",
"}"
] |
15,987 | all-15988 | [
"CreateAppLogCollection",
"creates",
"a",
"new",
"capped",
"collection",
"to",
"store",
"logs",
"for",
"an",
"app",
"."
] | [
"func",
"(",
"s",
"*",
"LogStorage",
")",
"CreateAppLogCollection",
"(",
"appName",
"string",
")",
"(",
"*",
"storage",
".",
"<mask>",
",",
"error",
")",
"{",
"c",
":=",
"s",
".",
"AppLogCollection",
"(",
"appName",
")",
"\n",
"err",
":=",
"c",
".",
"Create",
"(",
"&",
"logCappedInfo",
")",
"\n",
"return",
"c",
",",
"err",
"\n",
"}"
] |
15,988 | all-15989 | [
"resourceVSphereComputeClusterImportSetDefaults",
"sets",
"configuration",
"defaults",
"for",
"resource",
"attributes",
"that",
"are",
"not",
"managed",
"by",
"read",
".",
"This",
"gives",
"completeness",
"for",
"import",
"in",
"addition",
"to",
"reducing",
"the",
"number",
"of",
"post",
"-",
"import",
"diffs",
"that",
"may",
"need",
"to",
"happen",
"."
] | [
"func",
"resourceVSphereComputeClusterImportSetDefaults",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"error",
"{",
"s",
":=",
"resourceVSphereComputeCluster",
"(",
")",
".",
"Schema",
"\n",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"\"",
"\"",
":",
"s",
"[",
"\"",
"\"",
"]",
".",
"Default",
",",
"}",
")",
"\n",
"}"
] |
15,989 | all-15990 | [
"Do",
"executes",
"Target",
".",
"exposeDevToolsProtocol",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ExposeDevToolsProtocolParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandExposeDevToolsProtocol",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
15,990 | all-15991 | [
"ProfileCleanupLeftover",
"removes",
"unreferenced",
"profiles",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ProfileCleanupLeftover",
"(",
")",
"error",
"{",
"stmt",
":=",
"`\nDELETE FROM profiles_config WHERE profile_id NOT IN (SELECT id FROM profiles);\nDELETE FROM profiles_devices WHERE profile_id NOT IN (SELECT id FROM profiles);\nDELETE FROM profiles_devices_config WHERE profile_device_id NOT IN (SELECT id FROM profiles_devices);\n`",
"\n",
"err",
":=",
"exec",
"(",
"c",
".",
"<mask>",
",",
"stmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,991 | all-15992 | [
"AcknowledgeHostProblem",
"creates",
"a",
"new",
"ACKNOWLEDGE_HOST_PROBLEM",
"Nagios",
"command",
".",
"Allows",
"you",
"to",
"acknowledge",
"the",
"current",
"problem",
"for",
"the",
"specified",
"host",
".",
"By",
"acknowledging",
"the",
"current",
"problem",
"future",
"notifications",
"(",
"for",
"the",
"same",
"host",
"state",
")",
"are",
"disabled",
".",
"If",
"the",
"sticky",
"option",
"is",
"set",
"to",
"two",
"(",
"2",
")",
"the",
"acknowledgement",
"will",
"remain",
"until",
"the",
"host",
"returns",
"to",
"an",
"UP",
"state",
".",
"Otherwise",
"the",
"acknowledgement",
"will",
"automatically",
"be",
"removed",
"when",
"the",
"host",
"changes",
"state",
".",
"If",
"the",
"notify",
"option",
"is",
"set",
"to",
"one",
"(",
"1",
")",
"a",
"notification",
"will",
"be",
"sent",
"out",
"to",
"contacts",
"indicating",
"that",
"the",
"current",
"host",
"problem",
"has",
"been",
"acknowledged",
".",
"If",
"the",
"persistent",
"option",
"is",
"set",
"to",
"one",
"(",
"1",
")",
"the",
"comment",
"associated",
"with",
"the",
"acknowledgement",
"will",
"survive",
"across",
"restarts",
"of",
"the",
"Nagios",
"process",
".",
"If",
"not",
"the",
"comment",
"will",
"be",
"deleted",
"the",
"next",
"time",
"Nagios",
"restarts",
"."
] | [
"func",
"AcknowledgeHostProblem",
"(",
"host_name",
"string",
",",
"sticky",
"bool",
",",
"notify",
"bool",
",",
"persistent",
"bool",
",",
"<mask>",
"string",
",",
"comment",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"sticky",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"notify",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"persistent",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"author",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"comment",
")",
",",
")",
"\n",
"}"
] |
15,992 | all-15993 | [
"UnmarshalJSON",
"overrides",
"the",
"logic",
"for",
"parsing",
"the",
"JSON",
"-",
"encoded",
"ResourceStatus",
"data"
] | [
"func",
"(",
"as",
"*",
"SSMSecretStatus",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"strings",
".",
"ToLower",
"(",
"string",
"(",
"b",
")",
")",
"==",
"\"",
"\"",
"{",
"*",
"as",
"=",
"SSMSecretStatusNone",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"b",
"[",
"0",
"]",
"!=",
"'\"'",
"||",
"b",
"[",
"len",
"(",
"b",
")",
"-",
"1",
"]",
"!=",
"'\"'",
"{",
"*",
"as",
"=",
"SSMSecretStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n\n",
"strStatus",
":=",
"string",
"(",
"b",
"[",
"1",
":",
"len",
"(",
"b",
")",
"-",
"1",
"]",
")",
"\n",
"stat",
",",
"ok",
":=",
"ssmSecretStatusMap",
"[",
"strStatus",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"*",
"as",
"=",
"SSMSecretStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"*",
"as",
"=",
"stat",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,993 | all-15994 | [
"title",
":",
"volume",
"delete",
"path",
":",
"/",
"volumes",
"/",
"{",
"name",
"}",
"method",
":",
"DELETE",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Volume",
"deleted",
"401",
":",
"Unauthorized",
"404",
":",
"Volume",
"not",
"found"
] | [
"func",
"volumeDelete",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"volumeName",
":=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"dbVolume",
",",
"err",
":=",
"volume",
".",
"Load",
"(",
"volumeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"volume",
".",
"ErrVolumeNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"canDelete",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermVolumeDelete",
",",
"contextsForVolume",
"(",
"dbVolume",
")",
"...",
")",
"\n",
"if",
"!",
"canDelete",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeVolume",
",",
"Value",
":",
"volumeName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermVolumeDelete",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermVolumeReadEvents",
",",
"contextsForVolume",
"(",
"dbVolume",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"return",
"dbVolume",
".",
"Delete",
"(",
")",
"\n",
"}"
] |
15,994 | all-15995 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SynthesizePinchGestureParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,995 | all-15996 | [
"GetWidthOk",
"returns",
"a",
"tuple",
"with",
"the",
"Width",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetLayout",
")",
"GetWidthOk",
"(",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Width",
"==",
"nil",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Width",
",",
"true",
"\n",
"}"
] |
15,996 | all-15997 | [
"Error",
"adds",
"an",
"error",
"with",
"the",
"key",
"error",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
] | [
"func",
"<mask>",
"(",
"err",
"error",
")",
"Field",
"{",
"return",
"Field",
"{",
"key",
":",
"\"",
"\"",
",",
"fieldType",
":",
"errorType",
",",
"interfaceVal",
":",
"err",
",",
"}",
"\n",
"}"
] |
15,997 | all-15998 | [
"DisableProject",
"disables",
"a",
"project"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DisableProject",
"(",
"account",
",",
"repo",
"string",
")",
"error",
"{",
"return",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"repo",
")",
",",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
15,998 | all-15999 | [
"signRequestFunc",
"is",
"a",
"MakeRequestHookFunc",
"that",
"signs",
"each",
"generated",
"request"
] | [
"func",
"signRequestFunc",
"(",
"url",
",",
"region",
"string",
",",
"credentialProvider",
"*",
"credentials",
".",
"Credentials",
")",
"wsclient",
".",
"MakeRequestHookFunc",
"{",
"return",
"func",
"(",
"payload",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"reqBody",
":=",
"bytes",
".",
"NewReader",
"(",
"payload",
")",
"\n\n",
"request",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"reqBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"utils",
".",
"SignHTTPRequest",
"(",
"request",
",",
"region",
",",
"\"",
"\"",
",",
"credentialProvider",
",",
"reqBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"request",
".",
"Header",
".",
"Add",
"(",
"\"",
"\"",
",",
"request",
".",
"Host",
")",
"\n",
"var",
"dataBuffer",
"bytes",
".",
"Buffer",
"\n",
"request",
".",
"Header",
".",
"Write",
"(",
"&",
"dataBuffer",
")",
"\n",
"io",
".",
"WriteString",
"(",
"&",
"dataBuffer",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
"\n\n",
"data",
":=",
"dataBuffer",
".",
"Bytes",
"(",
")",
"\n",
"data",
"=",
"append",
"(",
"data",
",",
"payload",
"...",
")",
"\n\n",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
15,999 | all-16000 | [
"ParseVersionFromClient",
"returns",
"a",
"populated",
"VSphereVersion",
"from",
"a",
"client",
"connection",
"."
] | [
"func",
"ParseVersionFromClient",
"(",
"client",
"*",
"govmomi",
".",
"<mask>",
")",
"VSphereVersion",
"{",
"return",
"parseVersionFromAboutInfo",
"(",
"client",
".",
"Client",
".",
"ServiceContent",
".",
"About",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.