id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
13,900 | all-13901 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"RegionLaunchSpec",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
] | [
"func",
"(",
"this",
"*",
"RegionLaunchSpec",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
] |
13,901 | all-13902 | [
"checkoutCommit",
"checks",
"out",
"the",
"specified",
"commitHash",
"."
] | [
"func",
"(",
"r",
"*",
"Repo",
")",
"checkoutCommit",
"(",
"commitHash",
"string",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"params",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"commitHash",
"}",
"\n",
"if",
"err",
"=",
"r",
".",
"gitCmd",
"(",
"params",
",",
"r",
".",
"Path",
")",
";",
"err",
"==",
"nil",
"{",
"Logger",
"(",
")",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"commitHash",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
13,902 | all-13903 | [
"get",
"is",
"an",
"internal",
"wrapper",
"around",
"etcdClient",
".",
"Get",
"that",
"wraps",
"the",
"call",
"in",
"a",
"trace"
] | [
"func",
"(",
"c",
"*",
"readonlyCollection",
")",
"<mask>",
"(",
"key",
"string",
",",
"opts",
"...",
"etcd",
".",
"OpOption",
")",
"(",
"*",
"etcd",
".",
"GetResponse",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"AddSpanToAnyExisting",
"(",
"c",
".",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"tracing",
".",
"FinishAnySpan",
"(",
"span",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"etcdClient",
".",
"Get",
"(",
"ctx",
",",
"key",
",",
"opts",
"...",
")",
"\n",
"return",
"resp",
",",
"err",
"\n",
"}"
] |
13,903 | all-13904 | [
"NewClient",
"is",
"the",
"constructor",
"for",
"Client"
] | [
"func",
"NewClient",
"(",
"gc",
"*",
"git",
".",
"Client",
",",
"ghc",
"*",
"github",
".",
"Client",
",",
"mdYAMLEnabled",
"func",
"(",
"org",
",",
"repo",
"string",
")",
"bool",
",",
"skipCollaborators",
"func",
"(",
"org",
",",
"repo",
"string",
")",
"bool",
",",
"ownersDirBlacklist",
"func",
"(",
")",
"prowConf",
".",
"OwnersDirBlacklist",
",",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"git",
":",
"gc",
",",
"ghc",
":",
"ghc",
",",
"logger",
":",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"<mask>",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"cacheEntry",
")",
",",
"mdYAMLEnabled",
":",
"mdYAMLEnabled",
",",
"skipCollaborators",
":",
"skipCollaborators",
",",
"ownersDirBlacklist",
":",
"ownersDirBlacklist",
",",
"}",
"\n",
"}"
] |
13,904 | all-13905 | [
"WithColor",
"the",
"highlight",
"fill",
"color",
"(",
"default",
":",
"transparent",
")",
"."
] | [
"func",
"(",
"p",
"HighlightRectParams",
")",
"WithColor",
"(",
"color",
"*",
"cdp",
".",
"RGBA",
")",
"*",
"HighlightRectParams",
"{",
"p",
".",
"<mask>",
"=",
"color",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
13,905 | all-13906 | [
"GetTimezoneOk",
"returns",
"a",
"tuple",
"with",
"the",
"Timezone",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"Downtime",
")",
"GetTimezoneOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Timezone",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"Timezone",
",",
"true",
"\n",
"}"
] |
13,906 | all-13907 | [
"SetText",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_buffer_set_text",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"EntryBuffer",
")",
"SetText",
"(",
"text",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_entry_buffer_set_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"len",
"(",
"text",
")",
")",
")",
"\n",
"}"
] |
13,907 | all-13908 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EntryPreview",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime39",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,908 | all-13909 | [
"NewClient",
"returns",
"new",
"client",
"instance",
"based",
"given",
"somc",
"type",
"and",
"data",
"."
] | [
"func",
"(",
"b",
"*",
"ClientBuilder",
")",
"NewClient",
"(",
"somcType",
"uint8",
",",
"somcData",
"<mask>",
".",
"Base64String",
")",
"(",
"Client",
",",
"error",
")",
"{",
"if",
"somcType",
"==",
"data",
".",
"OfferingSOMCTor",
"{",
"hostnameBytes",
",",
"err",
":=",
"data",
".",
"ToBytes",
"(",
"somcData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"torClient",
",",
"err",
":=",
"tor",
".",
"NewHTTPClient",
"(",
"b",
".",
"torSocks",
")",
"\n",
"return",
"somcsrv",
".",
"NewClient",
"(",
"torClient",
",",
"string",
"(",
"hostnameBytes",
")",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"ErrUnknownSOMCType",
"\n",
"}"
] |
13,909 | all-13910 | [
"SetTeardown",
"to",
"assign",
"a",
"teardown",
"function"
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"SetTeardown",
"(",
"tf",
"TeardownFunc",
")",
"{",
"if",
"tf",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"p",
".",
"Lock",
"(",
")",
"\n",
"if",
"p",
".",
"teardown",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"p",
".",
"teardown",
"=",
"tf",
"\n",
"select",
"{",
"case",
"<-",
"p",
".",
"Closed",
"(",
")",
":",
"p",
".",
"closeErr",
"=",
"tf",
"(",
")",
"\n",
"default",
":",
"}",
"\n",
"p",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
13,910 | all-13911 | [
"Deny",
"deny",
"permission",
"mode",
"for",
"roles"
] | [
"func",
"(",
"permission",
"*",
"Permission",
")",
"Deny",
"(",
"mode",
"PermissionMode",
",",
"roles",
"...",
"string",
")",
"*",
"Permission",
"{",
"if",
"mode",
"==",
"CRUD",
"{",
"return",
"permission",
".",
"Deny",
"(",
"Create",
",",
"roles",
"...",
")",
".",
"Deny",
"(",
"Update",
",",
"roles",
"...",
")",
".",
"Deny",
"(",
"Read",
",",
"roles",
"...",
")",
".",
"Deny",
"(",
"Delete",
",",
"roles",
"...",
")",
"\n",
"}",
"\n\n",
"if",
"permission",
".",
"DeniedRoles",
"[",
"mode",
"]",
"==",
"nil",
"{",
"permission",
".",
"DeniedRoles",
"[",
"mode",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"permission",
".",
"DeniedRoles",
"[",
"mode",
"]",
"=",
"append",
"(",
"permission",
".",
"DeniedRoles",
"[",
"<mask>",
"]",
",",
"roles",
"...",
")",
"\n",
"return",
"permission",
"\n",
"}"
] |
13,911 | all-13912 | [
"Retrieve",
"returns",
"nil",
"if",
"it",
"successfully",
"retrieved",
"the",
"value",
".",
"Error",
"is",
"returned",
"if",
"the",
"value",
"were",
"not",
"obtainable",
"or",
"empty",
"."
] | [
"func",
"(",
"v",
"*",
"vaultCredentialsProvider",
")",
"Retrieve",
"(",
")",
"(",
"credentials",
".",
"Value",
",",
"error",
")",
"{",
"var",
"emptyCreds",
",",
"result",
"credentials",
".",
"Value",
"// result",
"\n\n",
"// retrieve AWS creds from vault",
"vaultSecret",
",",
"err",
":=",
"v",
".",
"vaultClient",
".",
"Logical",
"(",
")",
".",
"Read",
"(",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"v",
".",
"vaultRole",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"emptyCreds",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"accessKeyIface",
",",
"accessKeyOk",
":=",
"vaultSecret",
".",
"Data",
"[",
"\"",
"\"",
"]",
"\n",
"awsSecretIface",
",",
"awsSecretOk",
":=",
"vaultSecret",
".",
"Data",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"accessKeyOk",
"||",
"!",
"awsSecretOk",
"{",
"return",
"emptyCreds",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Convert access key & secret in response to strings",
"result",
".",
"AccessKeyID",
",",
"accessKeyOk",
"=",
"accessKeyIface",
".",
"(",
"string",
")",
"\n",
"<mask>",
".",
"SecretAccessKey",
",",
"awsSecretOk",
"=",
"awsSecretIface",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"accessKeyOk",
"||",
"!",
"awsSecretOk",
"{",
"return",
"emptyCreds",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"accessKeyIface",
",",
"awsSecretIface",
")",
"\n",
"}",
"\n\n",
"// update the lease values in 'v', and spawn a goroutine to renew the lease",
"v",
".",
"updateLease",
"(",
"vaultSecret",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"// renew at half the lease duration or one day, whichever is greater",
"// (lease must expire eventually)",
"renewInterval",
":=",
"v",
".",
"getLeaseDuration",
"(",
")",
"\n",
"if",
"renewInterval",
".",
"Seconds",
"(",
")",
"<",
"oneDayInSeconds",
"{",
"renewInterval",
"=",
"oneDayInSeconds",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n\n",
"// Wait until 'renewInterval' has elapsed, then renew the lease",
"time",
".",
"Sleep",
"(",
"renewInterval",
")",
"\n",
"backoff",
".",
"RetryNotify",
"(",
"func",
"(",
")",
"error",
"{",
"// every two days, renew the lease for this node's AWS credentials",
"vaultSecret",
",",
"err",
":=",
"v",
".",
"vaultClient",
".",
"Sys",
"(",
")",
".",
"Renew",
"(",
"v",
".",
"leaseID",
",",
"twoDaysInSeconds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"v",
".",
"updateLease",
"(",
"vaultSecret",
")",
"\n",
"return",
"nil",
"\n",
"}",
",",
"backoff",
".",
"NewExponentialBackOff",
"(",
")",
",",
"func",
"(",
"err",
"error",
",",
"_",
"time",
".",
"Duration",
")",
"error",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// Per https://www.vaultproject.io/docs/secrets/aws/index.html#usage, wait",
"// until token is usable",
"time",
".",
"Sleep",
"(",
"10",
"*",
"time",
".",
"Second",
")",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
13,912 | all-13913 | [
"oneOfEquals",
"is",
"a",
"helper",
"function",
"for",
"EqualOneOf",
"OneOfEquals",
"and",
"NoneEquals",
"that",
"simply",
"returns",
"a",
"bool",
"indicating",
"whether",
"elem",
"is",
"in",
"slice",
".",
"sliceName",
"is",
"used",
"for",
"errors"
] | [
"func",
"oneOfEquals",
"(",
"sliceName",
"string",
",",
"slice",
"interface",
"{",
"}",
",",
"elem",
"interface",
"{",
"}",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
":=",
"reflect",
".",
"ValueOf",
"(",
"elem",
")",
"\n",
"sl",
":=",
"reflect",
".",
"ValueOf",
"(",
"<mask>",
")",
"\n",
"if",
"slice",
"==",
"nil",
"||",
"sl",
".",
"IsNil",
"(",
")",
"{",
"sl",
"=",
"reflect",
".",
"MakeSlice",
"(",
"reflect",
".",
"SliceOf",
"(",
"e",
".",
"Type",
"(",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}",
"\n",
"if",
"sl",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Slice",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"sliceName",
",",
"sl",
".",
"Type",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"e",
".",
"Type",
"(",
")",
"!=",
"sl",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"arePtrs",
":=",
"e",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"sl",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"if",
"!",
"arePtrs",
"&&",
"reflect",
".",
"DeepEqual",
"(",
"e",
".",
"Interface",
"(",
")",
",",
"sl",
".",
"Index",
"(",
"i",
")",
".",
"Interface",
"(",
")",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"else",
"if",
"arePtrs",
"&&",
"reflect",
".",
"DeepEqual",
"(",
"e",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
",",
"sl",
".",
"Index",
"(",
"i",
")",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
13,913 | all-13914 | [
"publishHealthMetrics",
"send",
"the",
"container",
"health",
"information",
"to",
"backend"
] | [
"func",
"(",
"<mask>",
"*",
"clientServer",
")",
"publishHealthMetrics",
"(",
")",
"{",
"if",
"cs",
".",
"publishTicker",
"==",
"nil",
"{",
"seelog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Publish metrics immediately after we connect and wait for ticks. This makes",
"// sure that there is no data loss when a scheduled metrics publishing fails",
"// due to a connection reset.",
"err",
":=",
"cs",
".",
"publishHealthMetricsOnce",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"cs",
".",
"publishHealthTicker",
".",
"C",
":",
"err",
":=",
"cs",
".",
"publishHealthMetricsOnce",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"case",
"<-",
"cs",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,914 | all-13915 | [
"isTornEntry",
"determines",
"whether",
"the",
"last",
"entry",
"of",
"the",
"WAL",
"was",
"partially",
"written",
"and",
"corrupted",
"because",
"of",
"a",
"torn",
"write",
"."
] | [
"func",
"(",
"d",
"*",
"decoder",
")",
"isTornEntry",
"(",
"data",
"[",
"]",
"byte",
")",
"bool",
"{",
"if",
"len",
"(",
"d",
".",
"brs",
")",
"!=",
"1",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"fileOff",
":=",
"d",
".",
"lastValidOff",
"+",
"frameSizeBytes",
"\n",
"curOff",
":=",
"0",
"\n",
"chunks",
":=",
"[",
"]",
"[",
"]",
"byte",
"{",
"}",
"\n",
"// split data on sector boundaries",
"for",
"curOff",
"<",
"len",
"(",
"data",
")",
"{",
"chunkLen",
":=",
"int",
"(",
"minSectorSize",
"-",
"(",
"fileOff",
"%",
"minSectorSize",
")",
")",
"\n",
"if",
"chunkLen",
">",
"len",
"(",
"data",
")",
"-",
"curOff",
"{",
"chunkLen",
"=",
"len",
"(",
"data",
")",
"-",
"curOff",
"\n",
"}",
"\n",
"chunks",
"=",
"append",
"(",
"chunks",
",",
"data",
"[",
"curOff",
":",
"curOff",
"+",
"chunkLen",
"]",
")",
"\n",
"fileOff",
"+=",
"int64",
"(",
"chunkLen",
")",
"\n",
"curOff",
"+=",
"chunkLen",
"\n",
"}",
"\n\n",
"// if any data for a sector chunk is all 0, it's a torn write",
"for",
"_",
",",
"sect",
":=",
"range",
"chunks",
"{",
"isZero",
":=",
"<mask>",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"sect",
"{",
"if",
"v",
"!=",
"0",
"{",
"isZero",
"=",
"false",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"isZero",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
13,915 | all-13916 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"order",
"Vm",
"by",
"filter",
"params"
] | [
"func",
"(",
"o",
"*",
"OrderVMByFilterParams",
")",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"OrderVMByFilterParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
13,916 | all-13917 | [
"render",
"primitives",
"from",
"array",
"data",
"with",
"a",
"per",
"-",
"element",
"offset"
] | [
"func",
"DrawRangeElementsBaseVertex",
"(",
"mode",
"uint32",
",",
"start",
"uint32",
",",
"end",
"uint32",
",",
"count",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
",",
"basevertex",
"int32",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpDrawRangeElementsBaseVertex",
",",
"7",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"start",
")",
",",
"uintptr",
"(",
"end",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"indices",
")",
",",
"uintptr",
"(",
"basevertex",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,917 | all-13918 | [
"Various",
"container",
"paths"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"Path",
"(",
")",
"string",
"{",
"<mask>",
":=",
"projectPrefix",
"(",
"c",
".",
"Project",
"(",
")",
",",
"c",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"containerPath",
"(",
"name",
",",
"c",
".",
"IsSnapshot",
"(",
")",
")",
"\n",
"}"
] |
13,918 | all-13919 | [
"clearRect",
"draws",
"a",
"white",
"rectangle"
] | [
"func",
"clearRect",
"(",
"gc",
"*",
"GraphicContext",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"float64",
")",
"{",
"// save state",
"f",
":=",
"gc",
".",
"Current",
".",
"FillColor",
"\n",
"x",
",",
"y",
":=",
"gc",
".",
"pdf",
".",
"GetXY",
"(",
")",
"\n",
"// cover page with white rectangle",
"gc",
".",
"SetFillColor",
"(",
"<mask>",
")",
"\n",
"draw2dkit",
".",
"Rectangle",
"(",
"gc",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n",
"// restore state",
"gc",
".",
"SetFillColor",
"(",
"f",
")",
"\n",
"gc",
".",
"pdf",
".",
"MoveTo",
"(",
"x",
",",
"y",
")",
"\n",
"}"
] |
13,919 | all-13920 | [
"GetShuffledApprovers",
"shuffles",
"the",
"potential",
"approvers",
"so",
"that",
"we",
"don",
"t",
"always",
"suggest",
"the",
"same",
"people",
"."
] | [
"func",
"(",
"o",
"Owners",
")",
"GetShuffledApprovers",
"(",
")",
"[",
"]",
"string",
"{",
"approversList",
":=",
"o",
".",
"GetAllPotentialApprovers",
"(",
")",
"\n",
"order",
":=",
"rand",
".",
"New",
"(",
"rand",
".",
"NewSource",
"(",
"o",
".",
"seed",
")",
")",
".",
"Perm",
"(",
"len",
"(",
"approversList",
")",
")",
"\n",
"people",
":=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"approversList",
")",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"order",
"{",
"people",
"=",
"append",
"(",
"people",
",",
"approversList",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"people",
"\n",
"}"
] |
13,920 | all-13921 | [
"bind",
"a",
"level",
"of",
"a",
"texture",
"to",
"an",
"image",
"unit"
] | [
"func",
"BindImageTexture",
"(",
"unit",
"uint32",
",",
"texture",
"uint32",
",",
"<mask>",
"int32",
",",
"layered",
"bool",
",",
"layer",
"int32",
",",
"access",
"uint32",
",",
"format",
"uint32",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpBindImageTexture",
",",
"7",
",",
"uintptr",
"(",
"unit",
")",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"boolToUintptr",
"(",
"layered",
")",
",",
"uintptr",
"(",
"layer",
")",
",",
"uintptr",
"(",
"access",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,921 | all-13922 | [
"title",
":",
"remove",
"app",
"path",
":",
"/",
"apps",
"/",
"{",
"name",
"}",
"method",
":",
"DELETE",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"App",
"removed",
"401",
":",
"Unauthorized",
"404",
":",
"Not",
"found"
] | [
"func",
"appDelete",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"canDelete",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppDelete",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"canDelete",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"a",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppDelete",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"<mask>",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"keepAliveWriter",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"30",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"writer",
":=",
"&",
"tsuruIo",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
"}",
"\n",
"evt",
".",
"SetLogWriter",
"(",
"writer",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"app",
".",
"Delete",
"(",
"&",
"a",
",",
"evt",
",",
"requestIDHeader",
"(",
"r",
")",
")",
"\n",
"}"
] |
13,922 | all-13923 | [
"Error",
"returns",
"an",
"error",
"string"
] | [
"func",
"(",
"err",
"*",
"WSError",
")",
"Error",
"(",
")",
"string",
"{",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"err",
".",
"ErrObj",
")",
"\n",
"if",
"val",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"val",
"=",
"val",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"var",
"typeStr",
"=",
"\"",
"\"",
"\n",
"if",
"val",
".",
"IsValid",
"(",
")",
"{",
"typeStr",
"=",
"val",
".",
"Type",
"(",
")",
".",
"Name",
"(",
")",
"\n",
"msg",
":=",
"val",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"msg",
".",
"IsValid",
"(",
")",
"&&",
"msg",
".",
"CanInterface",
"(",
")",
"{",
"str",
",",
"ok",
":=",
"msg",
".",
"Interface",
"(",
")",
".",
"(",
"*",
"string",
")",
"\n",
"if",
"ok",
"{",
"if",
"str",
"==",
"nil",
"{",
"return",
"typeStr",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"typeStr",
"+",
"\"",
"\"",
"+",
"*",
"str",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"asErr",
",",
"<mask>",
":=",
"err",
".",
"ErrObj",
".",
"(",
"error",
")",
";",
"ok",
"{",
"return",
"err",
".",
"Type",
"+",
"\"",
"\"",
"+",
"asErr",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
".",
"Type",
"+",
"\"",
"\"",
"+",
"typeStr",
"+",
"\"",
"\"",
"\n",
"}"
] |
13,923 | all-13924 | [
"Errorf",
"logs",
"at",
"the",
"ERROR",
"log",
"level",
"using",
"a",
"standard",
"printf",
"format",
"string"
] | [
"func",
"Errorf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"Log",
"!=",
"nil",
"{",
"Log",
".",
"<mask>",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}",
"\n",
"}"
] |
13,924 | all-13925 | [
"control",
"the",
"front",
"and",
"/",
"or",
"back",
"writing",
"of",
"individual",
"bits",
"in",
"the",
"stencil",
"planes"
] | [
"func",
"StencilMaskSeparate",
"(",
"face",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpStencilMaskSeparate",
",",
"2",
",",
"uintptr",
"(",
"face",
")",
",",
"uintptr",
"(",
"mask",
")",
",",
"0",
")",
"\n",
"}"
] |
13,925 | all-13926 | [
"/",
"*",
"MinimumEntropyMatchSequence",
"returns",
"the",
"minimum",
"entropy"
] | [
"func",
"MinimumEntropyMatchSequence",
"(",
"password",
"string",
",",
"matches",
"[",
"]",
"match",
".",
"Match",
")",
"MinEntropyMatch",
"{",
"bruteforceCardinality",
":=",
"float64",
"(",
"entropy",
".",
"CalcBruteForceCardinality",
"(",
"password",
")",
")",
"\n",
"upToK",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"len",
"(",
"password",
")",
")",
"\n",
"backPointers",
":=",
"make",
"(",
"[",
"]",
"<mask>",
".",
"Match",
",",
"len",
"(",
"password",
")",
")",
"\n\n",
"for",
"k",
":=",
"0",
";",
"k",
"<",
"len",
"(",
"password",
")",
";",
"k",
"++",
"{",
"upToK",
"[",
"k",
"]",
"=",
"get",
"(",
"upToK",
",",
"k",
"-",
"1",
")",
"+",
"math",
".",
"Log2",
"(",
"bruteforceCardinality",
")",
"\n\n",
"for",
"_",
",",
"match",
":=",
"range",
"matches",
"{",
"if",
"match",
".",
"J",
"!=",
"k",
"{",
"continue",
"\n",
"}",
"\n\n",
"i",
",",
"j",
":=",
"match",
".",
"I",
",",
"match",
".",
"J",
"\n",
"//see if best entropy up to i-1 + entropy of match is less that current min at j",
"upTo",
":=",
"get",
"(",
"upToK",
",",
"i",
"-",
"1",
")",
"\n",
"candidateEntropy",
":=",
"upTo",
"+",
"match",
".",
"Entropy",
"\n\n",
"if",
"candidateEntropy",
"<",
"upToK",
"[",
"j",
"]",
"{",
"upToK",
"[",
"j",
"]",
"=",
"candidateEntropy",
"\n",
"match",
".",
"Entropy",
"=",
"candidateEntropy",
"\n",
"backPointers",
"[",
"j",
"]",
"=",
"match",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"//walk backwards and decode the best sequence",
"var",
"matchSequence",
"[",
"]",
"match",
".",
"Match",
"\n",
"passwordLen",
":=",
"len",
"(",
"password",
")",
"\n",
"passwordLen",
"--",
"\n",
"for",
"k",
":=",
"passwordLen",
";",
"k",
">=",
"0",
";",
"{",
"match",
":=",
"backPointers",
"[",
"k",
"]",
"\n",
"if",
"match",
".",
"Pattern",
"!=",
"\"",
"\"",
"{",
"matchSequence",
"=",
"append",
"(",
"matchSequence",
",",
"match",
")",
"\n",
"k",
"=",
"match",
".",
"I",
"-",
"1",
"\n\n",
"}",
"else",
"{",
"k",
"--",
"\n",
"}",
"\n\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"match",
".",
"Matches",
"(",
"matchSequence",
")",
")",
"\n\n",
"makeBruteForceMatch",
":=",
"func",
"(",
"i",
",",
"j",
"int",
")",
"match",
".",
"Match",
"{",
"return",
"match",
".",
"Match",
"{",
"Pattern",
":",
"\"",
"\"",
",",
"I",
":",
"i",
",",
"J",
":",
"j",
",",
"Token",
":",
"password",
"[",
"i",
":",
"j",
"+",
"1",
"]",
",",
"Entropy",
":",
"math",
".",
"Log2",
"(",
"math",
".",
"Pow",
"(",
"bruteforceCardinality",
",",
"float64",
"(",
"j",
"-",
"i",
")",
")",
")",
"}",
"\n\n",
"}",
"\n\n",
"k",
":=",
"0",
"\n",
"var",
"matchSequenceCopy",
"[",
"]",
"match",
".",
"Match",
"\n",
"for",
"_",
",",
"match",
":=",
"range",
"matchSequence",
"{",
"i",
",",
"j",
":=",
"match",
".",
"I",
",",
"match",
".",
"J",
"\n",
"if",
"i",
"-",
"k",
">",
"0",
"{",
"matchSequenceCopy",
"=",
"append",
"(",
"matchSequenceCopy",
",",
"makeBruteForceMatch",
"(",
"k",
",",
"i",
"-",
"1",
")",
")",
"\n",
"}",
"\n",
"k",
"=",
"j",
"+",
"1",
"\n",
"matchSequenceCopy",
"=",
"append",
"(",
"matchSequenceCopy",
",",
"match",
")",
"\n",
"}",
"\n\n",
"if",
"k",
"<",
"len",
"(",
"password",
")",
"{",
"matchSequenceCopy",
"=",
"append",
"(",
"matchSequenceCopy",
",",
"makeBruteForceMatch",
"(",
"k",
",",
"len",
"(",
"password",
")",
"-",
"1",
")",
")",
"\n",
"}",
"\n",
"var",
"minEntropy",
"float64",
"\n",
"if",
"len",
"(",
"password",
")",
"==",
"0",
"{",
"minEntropy",
"=",
"float64",
"(",
"0",
")",
"\n",
"}",
"else",
"{",
"minEntropy",
"=",
"upToK",
"[",
"len",
"(",
"password",
")",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"crackTime",
":=",
"roundToXDigits",
"(",
"entropyToCrackTime",
"(",
"minEntropy",
")",
",",
"3",
")",
"\n",
"return",
"MinEntropyMatch",
"{",
"Password",
":",
"password",
",",
"Entropy",
":",
"roundToXDigits",
"(",
"minEntropy",
",",
"3",
")",
",",
"MatchSequence",
":",
"matchSequenceCopy",
",",
"CrackTime",
":",
"crackTime",
",",
"CrackTimeDisplay",
":",
"displayTime",
"(",
"crackTime",
")",
",",
"Score",
":",
"crackTimeToScore",
"(",
"crackTime",
")",
"}",
"\n\n",
"}"
] |
13,926 | all-13927 | [
"DrawTriangles",
"draws",
"a",
"given",
"image",
"img",
"to",
"the",
"image",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"DrawTriangles",
"(",
"img",
"*",
"Image",
",",
"vertices",
"[",
"]",
"float32",
",",
"indices",
"[",
"]",
"uint16",
",",
"colorm",
"*",
"affine",
".",
"ColorM",
",",
"mode",
"graphics",
".",
"CompositeMode",
",",
"filter",
"graphics",
".",
"Filter",
",",
"address",
"graphics",
".",
"Address",
")",
"{",
"if",
"i",
".",
"priority",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"vertices",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"theImages",
".",
"makeStaleIfDependingOn",
"(",
"i",
")",
"\n\n",
"if",
"img",
".",
"stale",
"||",
"img",
".",
"volatile",
"||",
"i",
".",
"screen",
"||",
"!",
"IsRestoringEnabled",
"(",
")",
"||",
"i",
".",
"volatile",
"{",
"i",
".",
"makeStale",
"(",
")",
"\n",
"}",
"else",
"{",
"i",
".",
"appendDrawTrianglesHistory",
"(",
"img",
",",
"vertices",
",",
"indices",
",",
"colorm",
",",
"mode",
",",
"<mask>",
",",
"address",
")",
"\n",
"}",
"\n",
"i",
".",
"image",
".",
"DrawTriangles",
"(",
"img",
".",
"image",
",",
"vertices",
",",
"indices",
",",
"colorm",
",",
"mode",
",",
"filter",
",",
"address",
")",
"\n",
"}"
] |
13,927 | all-13928 | [
"GetIPV4Addresses",
"returns",
"a",
"list",
"of",
"ipv4",
"addresses",
"allocated",
"to",
"the",
"ENI"
] | [
"func",
"(",
"eni",
"*",
"ENI",
")",
"GetIPV4Addresses",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"addresses",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"eni",
".",
"IPV4Addresses",
"{",
"addresses",
"=",
"append",
"(",
"addresses",
",",
"addr",
".",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"addresses",
"\n",
"}"
] |
13,928 | all-13929 | [
"note",
":",
"this",
"is",
"not",
"a",
"standard",
"s3",
"error"
] | [
"func",
"invalidFilePathError",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"writeError",
"(",
"w",
",",
"r",
",",
"http",
".",
"StatusBadRequest",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
13,929 | all-13930 | [
"TreeViewColumnNewWithAttribute",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_column_new_with_attributes",
"()",
"that",
"only",
"sets",
"one",
"attribute",
"for",
"one",
"column",
"."
] | [
"func",
"TreeViewColumnNewWithAttribute",
"(",
"title",
"string",
",",
"renderer",
"ICellRenderer",
",",
"<mask>",
"string",
",",
"column",
"int",
")",
"(",
"*",
"TreeViewColumn",
",",
"error",
")",
"{",
"t_cstr",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"t_cstr",
")",
")",
"\n",
"a_cstr",
":=",
"C",
".",
"CString",
"(",
"attribute",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"a_cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"_gtk_tree_view_column_new_with_attributes_one",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"t_cstr",
")",
",",
"renderer",
".",
"toCellRenderer",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"a_cstr",
")",
",",
"C",
".",
"gint",
"(",
"column",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapTreeViewColumn",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
13,930 | all-13931 | [
"Init",
"-",
"externally",
"available",
"init",
"method"
] | [
"func",
"Init",
"(",
")",
"{",
"s",
":=",
"new",
"(",
"SkuM1SmallBuilder",
")",
"\n",
"s",
".",
"<mask>",
",",
"_",
"=",
"new",
"(",
"SkuM1Small",
")",
".",
"GetInnkeeperClient",
"(",
")",
"\n",
"skurepo",
".",
"Register",
"(",
"SkuName",
",",
"s",
")",
"\n",
"}"
] |
13,931 | all-13932 | [
"Do",
"executes",
"Runtime",
".",
"compileScript",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"scriptID",
"-",
"Id",
"of",
"the",
"script",
".",
"exceptionDetails",
"-",
"Exception",
"details",
"."
] | [
"func",
"(",
"p",
"*",
"CompileScriptParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"scriptID",
"ScriptID",
",",
"exceptionDetails",
"*",
"ExceptionDetails",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"CompileScriptReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCompileScript",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"ScriptID",
",",
"res",
".",
"ExceptionDetails",
",",
"nil",
"\n",
"}"
] |
13,932 | all-13933 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"order",
"Vm",
"by",
"filter",
"params"
] | [
"func",
"(",
"o",
"*",
"OrderVMByFilterParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"OrderVMByFilterParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
13,933 | all-13934 | [
"WithNodeID",
"identifier",
"of",
"the",
"node",
"."
] | [
"func",
"(",
"p",
"FocusParams",
")",
"WithNodeID",
"(",
"nodeID",
"cdp",
".",
"NodeID",
")",
"*",
"FocusParams",
"{",
"p",
".",
"NodeID",
"=",
"nodeID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
13,934 | all-13935 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ScreenOrientation",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,935 | all-13936 | [
"NewTarget",
"creates",
"a",
"reasonably",
"configured",
"target",
"for",
"querying",
"."
] | [
"func",
"NewTarget",
"(",
"labels",
",",
"discoveredLabels",
"labels",
".",
"Labels",
",",
"params",
"<mask>",
".",
"Values",
")",
"*",
"Target",
"{",
"return",
"&",
"Target",
"{",
"labels",
":",
"labels",
",",
"discoveredLabels",
":",
"discoveredLabels",
",",
"params",
":",
"params",
",",
"health",
":",
"HealthUnknown",
",",
"}",
"\n",
"}"
] |
13,936 | all-13937 | [
"DeleteStoragePoolVolume",
"deletes",
"a",
"storage",
"pool"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteStoragePoolVolume",
"(",
"pool",
"string",
",",
"volType",
"string",
",",
"name",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"pool",
")",
",",
"url",
".",
"QueryEscape",
"(",
"volType",
")",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"path",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,937 | all-13938 | [
"SendHook",
"sends",
"a",
"GitHub",
"event",
"of",
"type",
"eventType",
"to",
"the",
"provided",
"address",
"."
] | [
"func",
"SendHook",
"(",
"address",
",",
"eventType",
"string",
",",
"payload",
",",
"hmac",
"[",
"]",
"byte",
")",
"error",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"http",
".",
"MethodPost",
",",
"address",
",",
"bytes",
".",
"NewBuffer",
"(",
"payload",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"eventType",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"github",
".",
"PayloadSignature",
"(",
"payload",
",",
"hmac",
")",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"c",
":=",
"&",
"http",
".",
"Client",
"{",
"}",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"rb",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
",",
"string",
"(",
"bytes",
".",
"TrimSpace",
"(",
"rb",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,938 | all-13939 | [
"GetMeta",
"unmarshals",
"the",
"optional",
"metadata",
"field",
"associated",
"with",
"the",
"file",
"into",
"the",
"result",
"parameter",
".",
"The",
"meaning",
"of",
"keys",
"under",
"that",
"field",
"is",
"user",
"-",
"defined",
".",
"For",
"example",
":",
"result",
":",
"=",
"struct",
"{",
"INode",
"int",
"}",
"{}",
"err",
"=",
"file",
".",
"GetMeta",
"(",
"&result",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"panic",
"(",
"err",
".",
"String",
"()",
")",
"}",
"fmt",
".",
"Printf",
"(",
"inode",
":",
"%d",
"\\",
"n",
"result",
".",
"INode",
")"
] | [
"func",
"(",
"file",
"*",
"GridFile",
")",
"GetMeta",
"(",
"result",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"<mask>",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"if",
"file",
".",
"doc",
".",
"Metadata",
"!=",
"nil",
"{",
"err",
"=",
"bson",
".",
"Unmarshal",
"(",
"file",
".",
"doc",
".",
"Metadata",
".",
"Data",
",",
"result",
")",
"\n",
"}",
"\n",
"file",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
13,939 | all-13940 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PageTimings",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHar5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
13,940 | all-13941 | [
"Info",
"formats",
"a",
"given",
"message",
"according",
"to",
"given",
"params",
"to",
"log",
"with",
"level",
"Info",
"."
] | [
"func",
"(",
"dl",
"*",
"DefaultLogger",
")",
"Info",
"(",
"message",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"{",
"dl",
".",
"logger",
".",
"Infof",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"caller",
"(",
")",
",",
"<mask>",
")",
",",
"params",
"...",
")",
"\n",
"}"
] |
13,941 | all-13942 | [
"SnapshotDatabaseServer",
"requests",
"a",
"snapshot",
"of",
"an",
"existing",
"database",
"server",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"SnapshotDatabaseServer",
"(",
"identifier",
"string",
")",
"(",
"*",
"DatabaseSnapshot",
",",
"error",
")",
"{",
"dbs",
":=",
"new",
"(",
"DatabaseServer",
")",
"\n",
"res",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
"+",
"\"",
"\"",
",",
"nil",
",",
"&",
"dbs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"snapID",
":=",
"getLinkRel",
"(",
"<mask>",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"snapID",
"!=",
"nil",
"{",
"snap",
":=",
"new",
"(",
"DatabaseSnapshot",
")",
"\n",
"snap",
".",
"Id",
"=",
"*",
"snapID",
"\n",
"return",
"snap",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
13,942 | all-13943 | [
"OnKeyPress",
"sets",
"the",
"callback",
"that",
"is",
"called",
"when",
"a",
"user",
"presses",
"a",
"Key",
"while",
"the",
"controls",
"is",
"active",
".",
"If",
"a",
"handler",
"processes",
"the",
"key",
"it",
"should",
"return",
"true",
".",
"If",
"handler",
"returns",
"false",
"it",
"means",
"that",
"the",
"default",
"handler",
"will",
"process",
"the",
"key"
] | [
"func",
"(",
"e",
"*",
"EditField",
")",
"OnKeyPress",
"(",
"fn",
"func",
"(",
"<mask>",
".",
"Key",
",",
"rune",
")",
"bool",
")",
"{",
"e",
".",
"onKeyPress",
"=",
"fn",
"\n",
"}"
] |
13,943 | all-13944 | [
"ProfileGet",
"returns",
"the",
"profile",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ProfileGet",
"(",
"project",
",",
"name",
"string",
")",
"(",
"int64",
",",
"*",
"api",
".",
"Profile",
",",
"error",
")",
"{",
"var",
"result",
"*",
"api",
".",
"Profile",
"\n",
"var",
"id",
"int64",
"\n\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasProfiles",
"(",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"enabled",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"profile",
",",
"err",
":=",
"<mask>",
".",
"ProfileGet",
"(",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"result",
"=",
"ProfileToAPI",
"(",
"profile",
")",
"\n",
"id",
"=",
"int64",
"(",
"profile",
".",
"ID",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"id",
",",
"result",
",",
"nil",
"\n",
"}"
] |
13,944 | all-13945 | [
"GetAlignment",
"is",
"a",
"wrapper",
"around",
"gtk_misc_get_alignment",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Misc",
")",
"GetAlignment",
"(",
")",
"(",
"xAlign",
",",
"yAlign",
"float32",
")",
"{",
"<mask>",
"x",
",",
"y",
"C",
".",
"gfloat",
"\n",
"C",
".",
"gtk_misc_get_alignment",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"x",
",",
"&",
"y",
")",
"\n",
"return",
"float32",
"(",
"x",
")",
",",
"float32",
"(",
"y",
")",
"\n",
"}"
] |
13,945 | all-13946 | [
"initJaeger",
"returns",
"an",
"instance",
"of",
"Jaeger",
"Tracer",
"that",
"samples",
"100%",
"of",
"traces",
"and",
"logs",
"all",
"spans",
"to",
"stdout",
"."
] | [
"func",
"initJaeger",
"(",
"service",
",",
"node",
",",
"agentAddress",
"string",
",",
"log",
"*",
"zap",
".",
"Logger",
")",
"(",
"opentracing",
".",
"Tracer",
",",
"io",
".",
"Closer",
",",
"error",
")",
"{",
"cfg",
":=",
"&",
"config",
".",
"Configuration",
"{",
"Sampler",
":",
"&",
"config",
".",
"SamplerConfig",
"{",
"Type",
":",
"\"",
"\"",
",",
"Param",
":",
"1",
",",
"}",
",",
"Tags",
":",
"[",
"]",
"opentracing",
".",
"Tag",
"{",
"{",
"Key",
":",
"constant",
".",
"Subsystem",
"+",
"\"",
"\"",
",",
"<mask>",
":",
"node",
",",
"}",
"}",
",",
"Reporter",
":",
"&",
"config",
".",
"ReporterConfig",
"{",
"LogSpans",
":",
"true",
",",
"LocalAgentHostPort",
":",
"agentAddress",
",",
"}",
",",
"}",
"\n\n",
"tracer",
",",
"closer",
",",
"err",
":=",
"cfg",
".",
"New",
"(",
"service",
",",
"config",
".",
"Logger",
"(",
"zapjaeger",
".",
"NewLogger",
"(",
"log",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"tracer",
",",
"closer",
",",
"nil",
"\n",
"}"
] |
13,946 | all-13947 | [
"NewFromServers",
"returns",
"a",
"new",
"Client",
"using",
"the",
"provided",
"Servers",
"."
] | [
"func",
"NewFromServers",
"(",
"servers",
"Servers",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"timeout",
":",
"DefaultTimeout",
",",
"maxIdlePerAddr",
":",
"maxIdleConnsPerAddr",
",",
"servers",
":",
"servers",
",",
"freeconn",
":",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"chan",
"*",
"conn",
")",
",",
"bufPool",
":",
"make",
"(",
"chan",
"[",
"]",
"byte",
",",
"poolSize",
"(",
")",
")",
",",
"}",
"\n",
"}"
] |
13,947 | all-13948 | [
"MostSpecific",
"returns",
"the",
"most",
"specific",
"from",
"a",
"list",
"of",
"types",
"in",
"an",
"hierarchy",
"behaviour",
"is",
"undefined",
"if",
"any",
"of",
"the",
"types",
"are",
"siblings",
"."
] | [
"func",
"MostSpecificType",
"(",
"types",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"len",
"(",
"types",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"sorted",
",",
"err",
":=",
"SortTypes",
"(",
"types",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"sorted",
"[",
"len",
"(",
"sorted",
")",
"-",
"1",
"]",
",",
"nil",
"\n",
"}"
] |
13,948 | all-13949 | [
"Detect",
"whether",
"err",
"is",
"an",
"errno",
"."
] | [
"func",
"GetErrno",
"(",
"err",
"error",
")",
"(",
"errno",
"error",
",",
"iserrno",
"bool",
")",
"{",
"sysErr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"os",
".",
"SyscallError",
")",
"\n",
"if",
"ok",
"{",
"return",
"sysErr",
".",
"Err",
",",
"true",
"\n",
"}",
"\n\n",
"pathErr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"os",
".",
"PathError",
")",
"\n",
"if",
"ok",
"{",
"return",
"pathErr",
".",
"Err",
",",
"true",
"\n",
"}",
"\n\n",
"tmpErrno",
",",
"<mask>",
":=",
"err",
".",
"(",
"syscall",
".",
"Errno",
")",
"\n",
"if",
"ok",
"{",
"return",
"tmpErrno",
",",
"true",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
13,949 | all-13950 | [
"StoragePoolDelete",
"deletes",
"storage",
"pool",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolDelete",
"(",
"poolName",
"string",
")",
"(",
"*",
"api",
".",
"StoragePool",
",",
"error",
")",
"{",
"poolID",
",",
"pool",
",",
"err",
":=",
"c",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"exec",
"(",
"c",
".",
"<mask>",
",",
"\"",
"\"",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"pool",
",",
"nil",
"\n",
"}"
] |
13,950 | all-13951 | [
"setSocket",
"binds",
"socket",
"to",
"this",
"section",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"setSocket",
"(",
"socket",
"*",
"mongoSocket",
")",
"{",
"info",
":=",
"socket",
".",
"Acquire",
"(",
")",
"\n",
"if",
"<mask>",
".",
"Master",
"{",
"if",
"s",
".",
"masterSocket",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"s",
".",
"masterSocket",
"=",
"socket",
"\n",
"}",
"else",
"{",
"if",
"s",
".",
"slaveSocket",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"s",
".",
"slaveSocket",
"=",
"socket",
"\n",
"}",
"\n",
"}"
] |
13,951 | all-13952 | [
"HasName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TemplateVariable",
")",
"HasName",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Name",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
13,952 | all-13953 | [
"GetEnvironment",
"returns",
"a",
"Mongo",
"configuration",
"for",
"the",
"specified",
"environment",
"in",
"parameter"
] | [
"func",
"(",
"m",
"*",
"Environment",
")",
"GetEnvironment",
"(",
"environment",
"string",
")",
"interface",
"{",
"}",
"{",
"for",
"env",
",",
"conf",
":=",
"range",
"m",
".",
"Env",
"{",
"if",
"strings",
".",
"Compare",
"(",
"<mask>",
",",
"env",
")",
"==",
"0",
"{",
"return",
"conf",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,953 | all-13954 | [
"NewIterator",
"returns",
"a",
"new",
"iterator",
"of",
"the",
"Table"
] | [
"func",
"(",
"t",
"*",
"Table",
")",
"NewIterator",
"(",
"reversed",
"bool",
")",
"*",
"Iterator",
"{",
"t",
".",
"IncrRef",
"(",
")",
"// Important.",
"\n",
"ti",
":=",
"&",
"Iterator",
"{",
"t",
":",
"t",
",",
"reversed",
":",
"reversed",
"}",
"\n",
"ti",
".",
"<mask>",
"(",
")",
"\n",
"return",
"ti",
"\n",
"}"
] |
13,954 | all-13955 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventSecurityStateChanged",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoSecurity2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,955 | all-13956 | [
"Printf",
"logs",
"a",
"formatted",
"line",
"to",
"the",
"logging",
"output",
"."
] | [
"func",
"(",
"tl",
"txnLogger",
")",
"Printf",
"(",
"fmt",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"args",
"=",
"append",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"tl",
".",
"nonce",
"}",
",",
"args",
"...",
")",
"\n",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
"+",
"fmt",
",",
"args",
"...",
")",
"\n",
"}"
] |
13,956 | all-13957 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetCertificateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork37",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,957 | all-13958 | [
"if",
"cookie",
"secret",
"is",
"set",
"to",
"then",
"SetSecureCookie",
"would",
"not",
"work"
] | [
"func",
"ContextRender",
"(",
"cookiesecret",
"string",
",",
"options",
"...",
"RenderOptions",
")",
"Handler",
"{",
"return",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
",",
"c",
"Context",
")",
"{",
"rd",
":=",
"Renderor",
"(",
"w",
",",
"req",
",",
"c",
",",
"options",
"...",
")",
"\n\n",
"if",
"rd",
".",
"Data",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"{",
"rd",
".",
"Data",
"[",
"\"",
"\"",
"]",
"=",
"time",
".",
"Since",
"(",
"rd",
".",
"Data",
"[",
"\"",
"\"",
"]",
".",
"(",
"time",
".",
"Time",
")",
")",
".",
"Nanoseconds",
"(",
")",
"/",
"1e6",
"\n",
"rd",
".",
"Data",
"[",
"\"",
"\"",
"]",
"=",
"nil",
"//set zero to clean up the RequestStartTime",
"\n",
"}",
"\n\n",
"ctx",
":=",
"&",
"Cotex",
"{",
"req",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
",",
"cookiesecret",
",",
"w",
",",
"rd",
"}",
"\n",
"//set some default headers",
"tm",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
"\n\n",
"//ignore errors from ParseForm because it's usually harmless.",
"req",
".",
"ParseForm",
"(",
")",
"\n",
"if",
"len",
"(",
"req",
".",
"Form",
")",
">",
"0",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"req",
".",
"Form",
"{",
"ctx",
".",
"Form",
"[",
"k",
"]",
"=",
"v",
"[",
"0",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"ctx",
".",
"SetHeader",
"(",
"\"",
"\"",
",",
"webTime",
"(",
"tm",
")",
",",
"true",
")",
"\n",
"//Set the default content-type",
"ctx",
".",
"SetHeader",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"true",
")",
"\n\n",
"// set martini context for web.Cotex",
"c",
".",
"Map",
"(",
"rd",
")",
"\n",
"c",
".",
"Map",
"(",
"ctx",
")",
"\n",
"c",
".",
"Next",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
13,958 | all-13959 | [
"RecordValue",
"adds",
"a",
"value",
"to",
"a",
"histogram"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"RecordValue",
"(",
"metric",
"<mask>",
",",
"val",
"float64",
")",
"{",
"m",
".",
"SetHistogramValue",
"(",
"metric",
",",
"val",
")",
"\n",
"}"
] |
13,959 | all-13960 | [
"Reset",
"clears",
"the",
"state",
"of",
"the",
"Writer",
"z",
"such",
"that",
"it",
"is",
"equivalent",
"to",
"its",
"initial",
"state",
"from",
"NewWriter",
"but",
"instead",
"writing",
"to",
"w",
".",
"No",
"access",
"to",
"the",
"underlying",
"io",
".",
"Writer",
"is",
"performed",
"."
] | [
"func",
"(",
"z",
"*",
"Writer",
")",
"Reset",
"(",
"w",
"io",
".",
"<mask>",
")",
"{",
"z",
".",
"Header",
"=",
"Header",
"{",
"}",
"\n",
"z",
".",
"dst",
"=",
"w",
"\n",
"z",
".",
"checksum",
".",
"Reset",
"(",
")",
"\n",
"z",
".",
"zdata",
"=",
"z",
".",
"zdata",
"[",
":",
"0",
"]",
"\n",
"z",
".",
"data",
"=",
"z",
".",
"data",
"[",
":",
"0",
"]",
"\n",
"z",
".",
"idx",
"=",
"0",
"\n",
"}"
] |
13,960 | all-13961 | [
"GetTaskHealthMetrics",
"returns",
"the",
"container",
"health",
"metrics"
] | [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"GetTaskHealthMetrics",
"(",
")",
"(",
"*",
"ecstcs",
".",
"HealthMetadata",
",",
"[",
"]",
"*",
"ecstcs",
".",
"TaskHealth",
",",
"error",
")",
"{",
"<mask>",
"taskHealths",
"[",
"]",
"*",
"ecstcs",
".",
"TaskHealth",
"\n",
"metadata",
":=",
"&",
"ecstcs",
".",
"HealthMetadata",
"{",
"Cluster",
":",
"aws",
".",
"String",
"(",
"engine",
".",
"cluster",
")",
",",
"ContainerInstance",
":",
"aws",
".",
"String",
"(",
"engine",
".",
"containerInstanceArn",
")",
",",
"MessageId",
":",
"aws",
".",
"String",
"(",
"uuid",
".",
"NewRandom",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"}",
"\n\n",
"if",
"!",
"engine",
".",
"containerHealthsToMonitor",
"(",
")",
"{",
"return",
"metadata",
",",
"taskHealths",
",",
"nil",
"\n",
"}",
"\n\n",
"engine",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"engine",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"for",
"taskARN",
":=",
"range",
"engine",
".",
"tasksToHealthCheckContainers",
"{",
"taskHealth",
":=",
"engine",
".",
"getTaskHealthUnsafe",
"(",
"taskARN",
")",
"\n",
"if",
"taskHealth",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"taskHealths",
"=",
"append",
"(",
"taskHealths",
",",
"taskHealth",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"taskHealths",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
",",
"EmptyHealthMetricsError",
"\n",
"}",
"\n\n",
"return",
"metadata",
",",
"taskHealths",
",",
"nil",
"\n",
"}"
] |
13,961 | all-13962 | [
"title",
":",
"add",
"default",
"role",
"path",
":",
"/",
"role",
"/",
"default",
"method",
":",
"POST",
"consme",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized"
] | [
"func",
"addDefaultRole",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermRoleDefaultCreate",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"rolesMap",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"evtName",
":=",
"range",
"permTypes",
".",
"RoleEventMap",
"{",
"roles",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"evtName",
")",
"\n",
"for",
"_",
",",
"roleName",
":=",
"range",
"roles",
"{",
"rolesMap",
"[",
"roleName",
"]",
"=",
"append",
"(",
"rolesMap",
"[",
"roleName",
"]",
",",
"evtName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"roleName",
",",
"evts",
":=",
"range",
"rolesMap",
"{",
"evt",
",",
"err",
":=",
"<mask>",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeRole",
",",
"Value",
":",
"roleName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermRoleDefaultCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermRoleReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"role",
",",
"err",
":=",
"permission",
".",
"FindRole",
"(",
"roleName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"permTypes",
".",
"ErrRoleNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"evtName",
":=",
"range",
"evts",
"{",
"err",
"=",
"role",
".",
"AddEvent",
"(",
"evtName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"permTypes",
".",
"ErrRoleEventWrongContext",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,962 | all-13963 | [
"Compare",
"tests",
"if",
"v",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"versionB",
"returning",
"-",
"1",
"0",
"or",
"+",
"1",
"respectively",
"."
] | [
"func",
"(",
"v",
"<mask>",
")",
"Compare",
"(",
"versionB",
"Version",
")",
"int",
"{",
"if",
"cmp",
":=",
"recursiveCompare",
"(",
"v",
".",
"Slice",
"(",
")",
",",
"versionB",
".",
"Slice",
"(",
")",
")",
";",
"cmp",
"!=",
"0",
"{",
"return",
"cmp",
"\n",
"}",
"\n",
"return",
"preReleaseCompare",
"(",
"v",
",",
"versionB",
")",
"\n",
"}"
] |
13,963 | all-13964 | [
"Functions",
"dealing",
"with",
"storage",
"volumes",
"."
] | [
"func",
"(",
"s",
"*",
"storageBtrfs",
")",
"StoragePoolVolumeCreate",
"(",
")",
"error",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n\n",
"_",
",",
"err",
":=",
"s",
".",
"StoragePoolMount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"isSnapshot",
":=",
"shared",
".",
"IsSnapshot",
"(",
"s",
".",
"volume",
".",
"Name",
")",
"\n\n",
"// Create subvolume path on the storage pool.",
"<mask>",
"customSubvolumePath",
"string",
"\n\n",
"if",
"isSnapshot",
"{",
"customSubvolumePath",
"=",
"s",
".",
"getCustomSnapshotSubvolumePath",
"(",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"}",
"else",
"{",
"customSubvolumePath",
"=",
"s",
".",
"getCustomSubvolumePath",
"(",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"customSubvolumePath",
")",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"customSubvolumePath",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Create subvolume.",
"var",
"customSubvolumeName",
"string",
"\n\n",
"if",
"isSnapshot",
"{",
"customSubvolumeName",
"=",
"getStoragePoolVolumeSnapshotMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"s",
".",
"volume",
".",
"Name",
")",
"\n",
"}",
"else",
"{",
"customSubvolumeName",
"=",
"getStoragePoolVolumeMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"s",
".",
"volume",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"btrfsSubVolumeCreate",
"(",
"customSubvolumeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// apply quota",
"if",
"s",
".",
"volume",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"size",
",",
"err",
":=",
"shared",
".",
"ParseByteSizeString",
"(",
"s",
".",
"volume",
".",
"Config",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"s",
".",
"StorageEntitySetQuota",
"(",
"storagePoolVolumeTypeCustom",
",",
"size",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,964 | all-13965 | [
"NodeAddress",
"returns",
"the",
"address",
"of",
"the",
"node",
"this",
"method",
"is",
"invoked",
"on",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeAddress",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"\"",
"\"",
"\n",
"addresses",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"stmt",
",",
"c",
".",
"nodeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"switch",
"len",
"(",
"addresses",
")",
"{",
"<mask>",
"0",
":",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"case",
"1",
":",
"return",
"addresses",
"[",
"0",
"]",
",",
"nil",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
13,965 | all-13966 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"LayoutTreeNode",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,966 | all-13967 | [
"AddOutputPaths",
"adds",
"output",
"paths",
"to",
"the",
"existing",
"output",
"paths",
"resolving",
"conflicts",
"."
] | [
"func",
"AddOutputPaths",
"(",
"cfg",
"zap",
".",
"Config",
",",
"outputPaths",
",",
"errorOutputPaths",
"[",
"]",
"string",
")",
"zap",
".",
"Config",
"{",
"outputs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"cfg",
".",
"OutputPaths",
"{",
"outputs",
"[",
"v",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"outputPaths",
"{",
"outputs",
"[",
"v",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"outputSlice",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"outputs",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"// \"/dev/null\" to discard all",
"outputSlice",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"else",
"{",
"for",
"k",
":=",
"<mask>",
"outputs",
"{",
"outputSlice",
"=",
"append",
"(",
"outputSlice",
",",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n",
"cfg",
".",
"OutputPaths",
"=",
"outputSlice",
"\n",
"sort",
".",
"Strings",
"(",
"cfg",
".",
"OutputPaths",
")",
"\n\n",
"errOutputs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"cfg",
".",
"ErrorOutputPaths",
"{",
"errOutputs",
"[",
"v",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"errorOutputPaths",
"{",
"errOutputs",
"[",
"v",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"errOutputSlice",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"errOutputs",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"// \"/dev/null\" to discard all",
"errOutputSlice",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"else",
"{",
"for",
"k",
":=",
"range",
"errOutputs",
"{",
"errOutputSlice",
"=",
"append",
"(",
"errOutputSlice",
",",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n",
"cfg",
".",
"ErrorOutputPaths",
"=",
"errOutputSlice",
"\n",
"sort",
".",
"Strings",
"(",
"cfg",
".",
"ErrorOutputPaths",
")",
"\n\n",
"return",
"cfg",
"\n",
"}"
] |
13,967 | all-13968 | [
"GetNewHostDelayOk",
"returns",
"a",
"tuple",
"with",
"the",
"NewHostDelay",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"GetNewHostDelayOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"o",
"==",
"nil",
"||",
"o",
".",
"NewHostDelay",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"o",
".",
"NewHostDelay",
",",
"true",
"\n",
"}"
] |
13,968 | all-13969 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetAsyncCallStackDepthParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger18",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
13,969 | all-13970 | [
"GetStatusOk",
"returns",
"a",
"tuple",
"with",
"the",
"Status",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"GetStatusOk",
"(",
")",
"(",
"<mask>",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Status",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Status",
",",
"true",
"\n",
"}"
] |
13,970 | all-13971 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventFontsUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss55",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,971 | all-13972 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AddRuleReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss63",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,972 | all-13973 | [
"GetClientOfferingsFilterParams",
"returns",
"offerings",
"filter",
"parameters",
"for",
"client",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetClientOfferingsFilterParams",
"(",
"tkn",
"string",
")",
"(",
"*",
"GetClientOfferingsFilterParamsResult",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"countries",
",",
"err",
":=",
"h",
".",
"offeringCountries",
"(",
"logger",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"min",
",",
"<mask>",
",",
"err",
":=",
"h",
".",
"offeringsMinMaxPrice",
"(",
"logger",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"GetClientOfferingsFilterParamsResult",
"{",
"countries",
",",
"min",
",",
"max",
"}",
",",
"nil",
"\n",
"}"
] |
13,973 | all-13974 | [
"AddWindow",
"is",
"a",
"wrapper",
"around",
"gtk_application_add_window",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"AddWindow",
"(",
"w",
"*",
"Window",
")",
"{",
"C",
".",
"gtk_application_add_window",
"(",
"v",
".",
"native",
"(",
")",
",",
"w",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
13,974 | all-13975 | [
"PeerInfo",
"returns",
"the",
"current",
"peer",
"info",
"for",
"the",
"channel"
] | [
"func",
"(",
"ch",
"*",
"<mask>",
")",
"PeerInfo",
"(",
")",
"LocalPeerInfo",
"{",
"ch",
".",
"mutable",
".",
"RLock",
"(",
")",
"\n",
"peerInfo",
":=",
"ch",
".",
"mutable",
".",
"peerInfo",
"\n",
"ch",
".",
"mutable",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"peerInfo",
"\n",
"}"
] |
13,975 | all-13976 | [
"VerifyBytes",
"creates",
"a",
"signature",
"for",
"buf",
"comparing",
"it",
"against",
"the",
"raw",
"sig",
".",
"If",
"the",
"sig",
"is",
"invalid",
"then",
"ErrInvalidSignature",
"is",
"returned",
"."
] | [
"func",
"(",
"hs",
"*",
"HmacSigner",
")",
"VerifyBytes",
"(",
"buf",
",",
"sig",
"[",
"]",
"<mask>",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"// check hs.key",
"if",
"hs",
".",
"key",
"==",
"nil",
"{",
"return",
"ErrMissingPrivateKey",
"\n",
"}",
"\n\n",
"// hash",
"h",
":=",
"hmac",
".",
"New",
"(",
"hs",
".",
"hash",
".",
"New",
",",
"hs",
".",
"key",
")",
"\n",
"_",
",",
"err",
"=",
"h",
".",
"Write",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// verify",
"if",
"!",
"hmac",
".",
"Equal",
"(",
"h",
".",
"Sum",
"(",
"nil",
")",
",",
"sig",
")",
"{",
"return",
"ErrInvalidSignature",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,976 | all-13977 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewPatchAppsAppOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"400",
":",
"result",
":=",
"NewPatchAppsAppBadRequest",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewPatchAppsAppNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"<mask>",
":=",
"NewPatchAppsAppDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"Code",
"(",
")",
"/",
"100",
"==",
"2",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
13,977 | all-13978 | [
"ReplacePattern",
"replaces",
"string",
"with",
"regexp",
"string",
".",
"ReplacePattern",
"returns",
"a",
"copy",
"of",
"src",
"replacing",
"matches",
"of",
"the",
"Regexp",
"with",
"the",
"replacement",
"string",
"repl",
".",
"Inside",
"repl",
"$",
"signs",
"are",
"interpreted",
"as",
"in",
"Expand",
"so",
"for",
"instance",
"$1",
"represents",
"the",
"text",
"of",
"the",
"first",
"submatch",
"."
] | [
"func",
"ReplacePattern",
"(",
"s",
",",
"pattern",
",",
"repl",
"string",
")",
"string",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"<mask>",
")",
"\n",
"return",
"r",
".",
"ReplaceAllString",
"(",
"s",
",",
"repl",
")",
"\n",
"}"
] |
13,978 | all-13979 | [
"WithPreferCSSPageSize",
"whether",
"or",
"not",
"to",
"prefer",
"page",
"size",
"as",
"defined",
"by",
"css",
".",
"Defaults",
"to",
"false",
"in",
"which",
"case",
"the",
"content",
"will",
"be",
"scaled",
"to",
"fit",
"the",
"paper",
"size",
"."
] | [
"func",
"(",
"p",
"PrintToPDFParams",
")",
"WithPreferCSSPageSize",
"(",
"preferCSSPageSize",
"bool",
")",
"*",
"PrintToPDFParams",
"{",
"p",
".",
"PreferCSSPageSize",
"=",
"preferCSSPageSize",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
13,979 | all-13980 | [
"PrintJobInfo",
"pretty",
"-",
"prints",
"job",
"info",
"."
] | [
"func",
"PrintJobInfo",
"(",
"w",
"io",
".",
"Writer",
",",
"jobInfo",
"*",
"ppsclient",
".",
"JobInfo",
",",
"fullTimestamps",
"bool",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"Job",
".",
"ID",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"Pipeline",
".",
"Name",
")",
"\n",
"if",
"fullTimestamps",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"Started",
".",
"String",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pretty",
".",
"Ago",
"(",
"jobInfo",
".",
"Started",
")",
")",
"\n",
"}",
"\n",
"if",
"jobInfo",
".",
"Finished",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"<mask>",
".",
"TimeDifference",
"(",
"jobInfo",
".",
"Started",
",",
"jobInfo",
".",
"Finished",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"Restart",
")",
"\n",
"if",
"jobInfo",
".",
"DataRecovered",
"!=",
"0",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"DataProcessed",
",",
"jobInfo",
".",
"DataSkipped",
",",
"jobInfo",
".",
"DataRecovered",
",",
"jobInfo",
".",
"DataTotal",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"jobInfo",
".",
"DataProcessed",
",",
"jobInfo",
".",
"DataSkipped",
",",
"jobInfo",
".",
"DataTotal",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pretty",
".",
"Size",
"(",
"jobInfo",
".",
"Stats",
".",
"DownloadBytes",
")",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pretty",
".",
"Size",
"(",
"jobInfo",
".",
"Stats",
".",
"UploadBytes",
")",
")",
"\n",
"if",
"jobInfo",
".",
"State",
"==",
"ppsclient",
".",
"JobState_JOB_FAILURE",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"jobState",
"(",
"jobInfo",
".",
"State",
")",
",",
"safeTrim",
"(",
"jobInfo",
".",
"Reason",
",",
"jobReasonLen",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"jobState",
"(",
"jobInfo",
".",
"State",
")",
")",
"\n",
"}",
"\n",
"}"
] |
13,980 | all-13981 | [
"SetDouble",
"is",
"a",
"wrapper",
"around",
"g_value_set_double",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetDouble",
"(",
"val",
"float64",
")",
"{",
"C",
".",
"g_value_set_double",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"val",
")",
")",
"\n",
"}"
] |
13,981 | all-13982 | [
"UnmarshalJSON",
"restores",
"a",
"previously",
"marshaled",
"task",
"-",
"engine",
"state",
"from",
"json"
] | [
"func",
"(",
"<mask>",
"*",
"DockerTaskEngine",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"engine",
".",
"state",
".",
"UnmarshalJSON",
"(",
"data",
")",
"\n",
"}"
] |
13,982 | all-13983 | [
"title",
":",
"list",
"app",
"routers",
"path",
":",
"/",
"app",
"/",
"{",
"app",
"}",
"/",
"routers",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"204",
":",
"No",
"content",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"listAppRouters",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"r",
".",
"<mask>",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"canRead",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppReadRouter",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"canRead",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"routers",
",",
"err",
":=",
"a",
".",
"GetRoutersWithAddr",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"routers",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"routers",
")",
"\n",
"}"
] |
13,983 | all-13984 | [
"stmtList",
"emits",
"to",
"fn",
"code",
"for",
"all",
"statements",
"in",
"list",
"."
] | [
"func",
"(",
"b",
"*",
"builder",
")",
"stmtList",
"(",
"fn",
"*",
"Function",
",",
"list",
"[",
"]",
"ast",
".",
"Stmt",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"<mask>",
"{",
"b",
".",
"stmt",
"(",
"fn",
",",
"s",
")",
"\n",
"}",
"\n",
"}"
] |
13,984 | all-13985 | [
"NewServer",
"makes",
"a",
"new",
"example",
"server",
"."
] | [
"func",
"NewServer",
"(",
")",
"http",
".",
"Handler",
"{",
"r",
":=",
"mux",
".",
"NewRouter",
"(",
")",
"\n",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
")",
".",
"Methods",
"(",
"\"",
"\"",
")",
".",
"HandlerFunc",
"(",
"handleHello",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
13,985 | all-13986 | [
"GetPageIterator",
"returns",
"an",
"iterator",
"which",
"can",
"be",
"used",
"to",
"retrieve",
"pages",
"."
] | [
"func",
"(",
"c",
"*",
"IncomingNumberService",
")",
"GetPageIterator",
"(",
"<mask>",
"url",
".",
"Values",
")",
"*",
"IncomingPhoneNumberPageIterator",
"{",
"iter",
":=",
"NewPageIterator",
"(",
"c",
".",
"client",
",",
"data",
",",
"numbersPathPart",
")",
"\n",
"return",
"&",
"IncomingPhoneNumberPageIterator",
"{",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
13,986 | all-13987 | [
"SetDesiredStatus",
"safely",
"sets",
"the",
"desired",
"status",
"of",
"the",
"resource"
] | [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"SetDesiredStatus",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"{",
"<mask>",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"secret",
".",
"desiredStatusUnsafe",
"=",
"status",
"\n",
"}"
] |
13,987 | all-13988 | [
"resize",
"sets",
"new",
"x",
"and",
"y",
"maxima",
".",
"resize",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"resize",
"(",
"x",
",",
"y",
"int",
")",
"{",
"w",
".",
"x",
"=",
"x",
"\n",
"w",
".",
"y",
"=",
"y",
"\n",
"w",
".",
"backingStore",
"=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"x",
"*",
"y",
")",
"\n\n",
"// iterate over widgets",
"for",
"_",
",",
"widget",
":=",
"range",
"w",
".",
"widgets",
"{",
"widget",
".",
"Resize",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
13,988 | all-13989 | [
"finds",
"best",
"suitable",
"DNS",
"zone",
"for",
"the",
"hostname"
] | [
"func",
"(",
"p",
"designateProvider",
")",
"getHostZoneID",
"(",
"hostname",
"string",
",",
"managedZones",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"longestZoneLength",
":=",
"0",
"\n",
"resultID",
":=",
"\"",
"\"",
"\n\n",
"for",
"zoneID",
",",
"zoneName",
":=",
"<mask>",
"managedZones",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"hostname",
",",
"zoneName",
")",
"{",
"continue",
"\n",
"}",
"\n",
"ln",
":=",
"len",
"(",
"zoneName",
")",
"\n",
"if",
"ln",
">",
"longestZoneLength",
"{",
"resultID",
"=",
"zoneID",
"\n",
"longestZoneLength",
"=",
"ln",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"resultID",
",",
"nil",
"\n",
"}"
] |
13,989 | all-13990 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDOMStorageItemsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,990 | all-13991 | [
"GetNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"Name",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"Alert",
")",
"GetNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Name",
",",
"true",
"\n",
"}"
] |
13,991 | all-13992 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"TakeCoverageDeltaReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
13,992 | all-13993 | [
"Move",
"a",
"particular",
"network",
"interface",
"to",
"a",
"particular",
"mounted",
"network",
"namespace",
"specified",
"by",
"file",
"descriptor",
".",
"This",
"is",
"idential",
"to",
"running",
":",
"ip",
"link",
"set",
"dev",
"$name",
"netns",
"$fd"
] | [
"func",
"NetworkSetNsFd",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"fd",
"int",
")",
"error",
"{",
"<mask>",
":=",
"uint32Attr",
"(",
"IFLA_NET_NS_FD",
",",
"uint32",
"(",
"fd",
")",
")",
"\n",
"return",
"networkSetNsAction",
"(",
"iface",
",",
"data",
")",
"\n",
"}"
] |
13,993 | all-13994 | [
"Orgs",
"reads",
"the",
"config",
"for",
"all",
"orgs",
"."
] | [
"func",
"(",
"m",
"*",
"yamlManager",
")",
"Orgs",
"(",
")",
"(",
"*",
"Orgs",
",",
"error",
")",
"{",
"configFile",
":=",
"filepath",
".",
"Join",
"(",
"m",
".",
"ConfigDir",
",",
"\"",
"\"",
")",
"\n",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"configFile",
")",
"\n",
"input",
":=",
"&",
"Orgs",
"{",
"}",
"\n",
"if",
"err",
":=",
"LoadFile",
"(",
"configFile",
",",
"&",
"input",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
13,994 | all-13995 | [
"NetworkInterfaceRefreshOperation",
"processes",
"a",
"refresh",
"operation",
"for",
"all",
"of",
"the",
"disks",
"in",
"the",
"resource",
".",
"This",
"functions",
"similar",
"to",
"NetworkInterfaceApplyOperation",
"but",
"nothing",
"to",
"change",
"is",
"returned",
"all",
"necessary",
"values",
"are",
"just",
"set",
"and",
"committed",
"to",
"state",
"."
] | [
"func",
"NetworkInterfaceRefreshOperation",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"c",
"*",
"govmomi",
".",
"Client",
",",
"l",
"object",
".",
"VirtualDeviceList",
")",
"error",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"devices",
":=",
"l",
".",
"Select",
"(",
"func",
"(",
"device",
"types",
".",
"BaseVirtualDevice",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"types",
".",
"BaseVirtualEthernetCard",
")",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"devices",
")",
")",
"\n",
"curSet",
":=",
"d",
".",
"Get",
"(",
"subresourceTypeNetworkInterface",
")",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"subresourceListString",
"(",
"curSet",
")",
")",
"\n",
"urange",
",",
"err",
":=",
"nicUnitRange",
"(",
"devices",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"newSet",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"urange",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"len",
"(",
"devices",
")",
",",
"urange",
")",
"\n",
"// First check for negative keys. These are freshly added devices that are",
"// usually coming into read post-create.",
"//",
"// If we find what we are looking for, we remove the device from the working",
"// set so that we don't try and process it in the next few passes.",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"n",
",",
"item",
":=",
"range",
"curSet",
"{",
"m",
":=",
"item",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
"<",
"1",
"{",
"r",
":=",
"NewNetworkInterfaceSubresource",
"(",
"c",
",",
"d",
",",
"m",
",",
"nil",
",",
"n",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"Read",
"(",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
"<",
"1",
"{",
"// This should not have happened - if it did, our device",
"// creation/update logic failed somehow that we were not able to track.",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
",",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"idx",
",",
"err",
":=",
"splitDevAddr",
"(",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
",",
"err",
")",
"\n",
"}",
"\n",
"newSet",
"[",
"idx",
"-",
"networkInterfacePciDeviceOffset",
"]",
"=",
"r",
".",
"Data",
"(",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"devices",
")",
";",
"i",
"++",
"{",
"device",
":=",
"devices",
"[",
"i",
"]",
"\n",
"if",
"device",
".",
"GetVirtualDevice",
"(",
")",
".",
"Key",
"==",
"int32",
"(",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
"{",
"devices",
"=",
"append",
"(",
"devices",
"[",
":",
"i",
"]",
",",
"devices",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"i",
"--",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"devices",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"subresourceListString",
"(",
"newSet",
")",
")",
"\n\n",
"// Go over the remaining devices, refresh via key, and then remove their",
"// entries as well.",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"devices",
")",
";",
"i",
"++",
"{",
"device",
":=",
"devices",
"[",
"i",
"]",
"\n",
"for",
"n",
",",
"item",
":=",
"range",
"curSet",
"{",
"m",
":=",
"item",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
"<",
"0",
"{",
"// Skip any of these keys as we won't be matching any of those anyway here",
"continue",
"\n",
"}",
"\n",
"if",
"device",
".",
"GetVirtualDevice",
"(",
")",
".",
"Key",
"!=",
"int32",
"(",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
")",
"{",
"// Skip any device that doesn't match key as well",
"continue",
"\n",
"}",
"\n",
"// We should have our device -> resource match, so read now.",
"r",
":=",
"NewNetworkInterfaceSubresource",
"(",
"c",
",",
"d",
",",
"m",
",",
"nil",
",",
"n",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"Read",
"(",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"// Done reading, push this onto our new set and remove the device from",
"// the list",
"_",
",",
"_",
",",
"idx",
",",
"err",
":=",
"splitDevAddr",
"(",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
",",
"err",
")",
"\n",
"}",
"\n",
"newSet",
"[",
"idx",
"-",
"networkInterfacePciDeviceOffset",
"]",
"=",
"r",
".",
"Data",
"(",
")",
"\n",
"devices",
"=",
"append",
"(",
"devices",
"[",
":",
"i",
"]",
",",
"devices",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"i",
"--",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"subresourceListString",
"(",
"newSet",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"devices",
")",
")",
"\n\n",
"// Finally, any device that is still here is orphaned. They should be added",
"// as new devices.",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"n",
",",
"device",
":=",
"range",
"devices",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"vd",
":=",
"device",
".",
"GetVirtualDevice",
"(",
")",
"\n",
"ctlr",
":=",
"l",
".",
"FindByKey",
"(",
"vd",
".",
"ControllerKey",
")",
"\n",
"if",
"ctlr",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"vd",
".",
"Key",
")",
"\n",
"}",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"int",
"(",
"vd",
".",
"Key",
")",
"\n",
"var",
"err",
"error",
"\n",
"m",
"[",
"\"",
"\"",
"]",
",",
"err",
"=",
"computeDevAddr",
"(",
"vd",
",",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"r",
":=",
"NewNetworkInterfaceSubresource",
"(",
"c",
",",
"d",
",",
"m",
",",
"nil",
",",
"n",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"Read",
"(",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"idx",
",",
"err",
":=",
"splitDevAddr",
"(",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
",",
"err",
")",
"\n",
"}",
"\n",
"newSet",
"[",
"idx",
"-",
"networkInterfacePciDeviceOffset",
"]",
"=",
"r",
".",
"Data",
"(",
")",
"\n",
"}",
"\n\n",
"// Prune any nils from the new device state. This could potentially happen in",
"// edge cases where device unit numbers are not 100% sequential.",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"newSet",
")",
";",
"i",
"++",
"{",
"if",
"newSet",
"[",
"i",
"]",
"==",
"nil",
"{",
"newSet",
"=",
"append",
"(",
"newSet",
"[",
":",
"i",
"]",
",",
"newSet",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"i",
"--",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"subresourceListString",
"(",
"newSet",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"d",
".",
"Set",
"(",
"subresourceTypeNetworkInterface",
",",
"newSet",
")",
"\n",
"}"
] |
13,995 | all-13996 | [
"Do",
"executes",
"Memory",
".",
"getAllTimeSamplingProfile",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"profile"
] | [
"func",
"(",
"p",
"*",
"GetAllTimeSamplingProfileParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"profile",
"*",
"SamplingProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetAllTimeSamplingProfileReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetAllTimeSamplingProfile",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Profile",
",",
"nil",
"\n",
"}"
] |
13,996 | all-13997 | [
"GetUntilOccurrences",
"returns",
"the",
"UntilOccurrences",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"r",
"*",
"Recurrence",
")",
"GetUntilOccurrences",
"(",
")",
"int",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"UntilOccurrences",
"==",
"nil",
"{",
"<mask>",
"0",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"UntilOccurrences",
"\n",
"}"
] |
13,997 | all-13998 | [
"----------------------------------------",
"Misc",
".",
"CONTRACT",
":",
"rv",
"implements",
"json",
".",
"Marshaler",
"."
] | [
"func",
"invokeMarshalJSON",
"(",
"w",
"io",
".",
"Writer",
",",
"rv",
"reflect",
".",
"<mask>",
")",
"error",
"{",
"blob",
",",
"err",
":=",
"rv",
".",
"Interface",
"(",
")",
".",
"(",
"json",
".",
"Marshaler",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"blob",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
13,998 | all-13999 | [
"newFramebufferFromTexture",
"creates",
"a",
"framebuffer",
"from",
"the",
"given",
"texture",
"."
] | [
"func",
"newFramebufferFromTexture",
"(",
"context",
"*",
"context",
",",
"texture",
"textureNative",
",",
"<mask>",
",",
"height",
"int",
")",
"(",
"*",
"framebuffer",
",",
"error",
")",
"{",
"native",
",",
"err",
":=",
"context",
".",
"newFramebuffer",
"(",
"texture",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"framebuffer",
"{",
"native",
":",
"native",
",",
"width",
":",
"width",
",",
"height",
":",
"height",
",",
"}",
",",
"nil",
"\n",
"}"
] |
13,999 | all-14000 | [
"LogViewTemplate",
"executes",
"the",
"log",
"viewer",
"template",
"ready",
"for",
"rendering"
] | [
"func",
"executeTemplate",
"(",
"resourceDir",
",",
"templateName",
"string",
",",
"data",
"<mask>",
"{",
"}",
")",
"string",
"{",
"t",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"err",
":=",
"t",
".",
"ParseFiles",
"(",
"filepath",
".",
"Join",
"(",
"resourceDir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"t",
".",
"ExecuteTemplate",
"(",
"&",
"buf",
",",
"templateName",
",",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.