id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
7,200 | all-7201 | [
"StartObsessingOverSvc",
"creates",
"a",
"new",
"START_OBSESSING_OVER_SVC",
"Nagios",
"command",
".",
"Enables",
"processing",
"of",
"service",
"checks",
"via",
"the",
"OCSP",
"command",
"for",
"the",
"specified",
"service",
"."
] | [
"func",
"StartObsessingOverSvc",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"<mask>",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
")",
"\n",
"}"
] |
7,201 | all-7202 | [
"SetQueryStringBytes",
"sets",
"URI",
"query",
"string",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"SetQueryStringBytes",
"(",
"queryString",
"[",
"]",
"byte",
")",
"{",
"u",
".",
"queryString",
"=",
"append",
"(",
"u",
".",
"queryString",
"[",
":",
"0",
"]",
",",
"queryString",
"...",
")",
"\n",
"u",
".",
"parsedQueryArgs",
"=",
"<mask>",
"\n",
"}"
] |
7,202 | all-7203 | [
"Set",
"stores",
"the",
"function",
"under",
"the",
"name",
"key"
] | [
"func",
"(",
"fc",
"*",
"FuncDepot",
")",
"<mask>",
"(",
"key",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"{",
"fc",
".",
"depot",
"[",
"key",
"]",
"=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"}"
] |
7,203 | all-7204 | [
"getNodeOffset",
"returns",
"the",
"offset",
"of",
"node",
"in",
"the",
"arena",
".",
"If",
"the",
"node",
"pointer",
"is",
"nil",
"then",
"the",
"zero",
"offset",
"is",
"returned",
"."
] | [
"func",
"(",
"s",
"*",
"Arena",
")",
"getNodeOffset",
"(",
"nd",
"*",
"node",
")",
"uint32",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"return",
"uint32",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"nd",
")",
")",
"-",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"s",
".",
"buf",
"[",
"0",
"]",
")",
")",
")",
"\n",
"}"
] |
7,204 | all-7205 | [
"/",
"*",
"Makes",
"a",
"new",
"matrix",
"from",
"<rect",
">",
"subrectangle",
"of",
"input",
"array",
".",
"No",
"data",
"is",
"copied"
] | [
"func",
"GetSubRect",
"(",
"arr",
"Arr",
",",
"submat",
"*",
"Mat",
",",
"rect",
"Rect",
")",
"*",
"Mat",
"{",
"mat_new",
":=",
"C",
".",
"cvGetSubRect",
"(",
"unsafe",
".",
"Pointer",
"(",
"arr",
")",
",",
"(",
"*",
"C",
".",
"CvMat",
")",
"(",
"submat",
")",
",",
"(",
"C",
".",
"CvRect",
")",
"(",
"rect",
")",
",",
")",
"\n",
"<mask>",
"(",
"*",
"Mat",
")",
"(",
"mat_new",
")",
"\n",
"}"
] |
7,205 | all-7206 | [
"FindLabels",
"returns",
"the",
"list",
"of",
"labels",
"matching",
"the",
"regex"
] | [
"func",
"(",
"<mask>",
"*",
"Issue",
")",
"FindLabels",
"(",
"regex",
"*",
"regexp",
".",
"Regexp",
")",
"[",
"]",
"Label",
"{",
"labels",
":=",
"[",
"]",
"Label",
"{",
"}",
"\n\n",
"for",
"_",
",",
"label",
":=",
"range",
"issue",
".",
"Labels",
"{",
"if",
"regex",
".",
"MatchString",
"(",
"label",
".",
"Name",
")",
"{",
"labels",
"=",
"append",
"(",
"labels",
",",
"label",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"labels",
"\n",
"}"
] |
7,206 | all-7207 | [
"SetPaused",
"sets",
"the",
"paused",
"state",
"of",
"a",
"set",
"of",
"animations",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Animation#method",
"-",
"setPaused",
"parameters",
":",
"animations",
"-",
"Animations",
"to",
"set",
"the",
"pause",
"state",
"of",
".",
"paused",
"-",
"Paused",
"state",
"to",
"set",
"to",
"."
] | [
"func",
"SetPaused",
"(",
"animations",
"[",
"]",
"<mask>",
",",
"paused",
"bool",
")",
"*",
"SetPausedParams",
"{",
"return",
"&",
"SetPausedParams",
"{",
"Animations",
":",
"animations",
",",
"Paused",
":",
"paused",
",",
"}",
"\n",
"}"
] |
7,207 | all-7208 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"PaymentResult"
] | [
"func",
"(",
"u",
"PaymentResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"<mask>",
"PaymentResultCode",
"(",
"sw",
")",
"{",
"case",
"PaymentResultCodePaymentSuccess",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
7,208 | all-7209 | [
"HandleError",
"prints",
"provided",
"error",
"to",
"stderr",
"."
] | [
"func",
"(",
"handler",
"*",
"NullHandler",
")",
"HandleError",
"(",
"err",
"error",
")",
"error",
"{",
"<mask>",
".",
"Stderr",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"time",
".",
"Now",
"(",
")",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,209 | all-7210 | [
"Attach",
"attaches",
"a",
"file",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"Attach",
"(",
"file",
"string",
")",
"error",
"{",
"return",
"m",
".",
"attach",
"(",
"file",
",",
"false",
")",
"\n",
"}"
] |
7,210 | all-7211 | [
"title",
":",
"app",
"list",
"path",
":",
"/",
"apps",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"List",
"apps",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
] | [
"func",
"appList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"filter",
":=",
"&",
"app",
".",
"Filter",
"{",
"}",
"\n",
"if",
"name",
":=",
"r",
".",
"<mask>",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"name",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"NameMatches",
"=",
"name",
"\n",
"}",
"\n",
"if",
"platform",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"platform",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"Platform",
"=",
"platform",
"\n",
"}",
"\n",
"if",
"teamOwner",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"teamOwner",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"TeamOwner",
"=",
"teamOwner",
"\n",
"}",
"\n",
"if",
"owner",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"owner",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"UserOwner",
"=",
"owner",
"\n",
"}",
"\n",
"if",
"pool",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"pool",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"Pool",
"=",
"pool",
"\n",
"}",
"\n",
"locked",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"locked",
"{",
"filter",
".",
"Locked",
"=",
"true",
"\n",
"}",
"\n",
"if",
"status",
",",
"ok",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"filter",
".",
"Statuses",
"=",
"status",
"\n",
"}",
"\n",
"if",
"tags",
",",
"ok",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"filter",
".",
"Tags",
"=",
"tags",
"\n",
"}",
"\n",
"contexts",
":=",
"permission",
".",
"ContextsForPermission",
"(",
"t",
",",
"permission",
".",
"PermAppRead",
")",
"\n",
"if",
"len",
"(",
"contexts",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"apps",
",",
"err",
":=",
"app",
".",
"List",
"(",
"appFilterByContext",
"(",
"contexts",
",",
"filter",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"apps",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"simple",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"miniApps",
":=",
"make",
"(",
"[",
"]",
"miniApp",
",",
"len",
"(",
"apps",
")",
")",
"\n",
"if",
"simple",
"{",
"for",
"i",
",",
"ap",
":=",
"range",
"apps",
"{",
"ur",
":=",
"app",
".",
"AppUnitsResponse",
"{",
"Units",
":",
"nil",
",",
"Err",
":",
"nil",
"}",
"\n",
"miniApps",
"[",
"i",
"]",
",",
"err",
"=",
"minifyApp",
"(",
"ap",
",",
"ur",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"miniApps",
")",
"\n",
"}",
"\n",
"appUnits",
",",
"err",
":=",
"app",
".",
"Units",
"(",
"apps",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"i",
",",
"app",
":=",
"range",
"apps",
"{",
"miniApps",
"[",
"i",
"]",
",",
"err",
"=",
"minifyApp",
"(",
"app",
",",
"appUnits",
"[",
"app",
".",
"Name",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"miniApps",
")",
"\n",
"}"
] |
7,211 | all-7212 | [
"InfoFunc",
"outputs",
"Info",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"InfoFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"isModeEnable",
"(",
"<mask>",
")",
"{",
"return",
"glg",
".",
"out",
"(",
"INFO",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,212 | all-7213 | [
"GetRenotifyIntervalOk",
"returns",
"a",
"tuple",
"with",
"the",
"RenotifyInterval",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"GetRenotifyIntervalOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"o",
"==",
"nil",
"||",
"o",
".",
"RenotifyInterval",
"==",
"nil",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"o",
".",
"RenotifyInterval",
",",
"true",
"\n",
"}"
] |
7,213 | all-7214 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetCertificateReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork36",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,214 | all-7215 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RestartFrameParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger26",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
7,215 | all-7216 | [
"MACValue",
"returns",
"the",
"value",
"of",
"the",
"MAC",
"pointer",
"passed",
"in",
"or",
"the",
"default",
"value",
"if",
"the",
"pointer",
"is",
"nil",
"."
] | [
"func",
"MACValue",
"(",
"v",
"*",
"strfmt",
".",
"MAC",
")",
"strfmt",
".",
"MAC",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"strfmt",
".",
"MAC",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"<mask>",
"*",
"v",
"\n",
"}"
] |
7,216 | all-7217 | [
"DefaultConfig",
"returns",
"the",
"default",
"configuration",
"for",
"Linux"
] | [
"func",
"DefaultConfig",
"(",
")",
"Config",
"{",
"return",
"Config",
"{",
"DockerEndpoint",
":",
"\"",
"\"",
",",
"ReservedPorts",
":",
"[",
"]",
"uint16",
"{",
"SSHPort",
",",
"DockerReservedPort",
",",
"DockerReservedSSLPort",
",",
"AgentIntrospectionPort",
",",
"AgentCredentialsPort",
"}",
",",
"ReservedPortsUDP",
":",
"[",
"]",
"uint16",
"{",
"}",
",",
"DataDir",
":",
"\"",
"\"",
",",
"DataDirOnHost",
":",
"\"",
"\"",
",",
"DisableMetrics",
":",
"false",
",",
"ReservedMemory",
":",
"0",
",",
"AvailableLoggingDrivers",
":",
"[",
"]",
"dockerclient",
".",
"LoggingDriver",
"{",
"dockerclient",
".",
"JSONFileDriver",
",",
"dockerclient",
".",
"NoneDriver",
"}",
",",
"TaskCleanupWaitDuration",
":",
"DefaultTaskCleanupWaitDuration",
",",
"DockerStopTimeout",
":",
"defaultDockerStopTimeout",
",",
"ContainerStartTimeout",
":",
"defaultContainerStartTimeout",
",",
"CredentialsAuditLogFile",
":",
"defaultCredentialsAuditLogFile",
",",
"CredentialsAuditLogDisabled",
":",
"false",
",",
"ImageCleanupDisabled",
":",
"false",
",",
"MinimumImageDeletionAge",
":",
"DefaultImageDeletionAge",
",",
"ImageCleanupInterval",
":",
"DefaultImageCleanupTimeInterval",
",",
"ImagePullInactivityTimeout",
":",
"defaultImagePullInactivityTimeout",
",",
"NumImagesToDeletePerCycle",
":",
"DefaultNumImagesToDeletePerCycle",
",",
"NumNonECSContainersToDeletePerCycle",
":",
"DefaultNumNonECSContainersToDeletePerCycle",
",",
"CNIPluginsPath",
":",
"defaultCNIPluginsPath",
",",
"PauseContainerTarballPath",
":",
"pauseContainerTarballPath",
",",
"PauseContainerImageName",
":",
"DefaultPauseContainerImageName",
",",
"PauseContainerTag",
":",
"DefaultPauseContainerTag",
",",
"AWSVPCBlockInstanceMetdata",
":",
"false",
",",
"ContainerMetadataEnabled",
":",
"<mask>",
",",
"TaskCPUMemLimit",
":",
"DefaultEnabled",
",",
"CgroupPath",
":",
"defaultCgroupPath",
",",
"TaskMetadataSteadyStateRate",
":",
"DefaultTaskMetadataSteadyStateRate",
",",
"TaskMetadataBurstRate",
":",
"DefaultTaskMetadataBurstRate",
",",
"SharedVolumeMatchFullConfig",
":",
"false",
",",
"// only requiring shared volumes to match on name, which is default docker behavior",
"ContainerInstancePropagateTagsFrom",
":",
"ContainerInstancePropagateTagsFromNoneType",
",",
"PrometheusMetricsEnabled",
":",
"false",
",",
"PollMetrics",
":",
"false",
",",
"PollingMetricsWaitDuration",
":",
"DefaultPollingMetricsWaitDuration",
",",
"NvidiaRuntime",
":",
"DefaultNvidiaRuntime",
",",
"}",
"\n",
"}"
] |
7,217 | all-7218 | [
"GetAlertType",
"returns",
"the",
"AlertType",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetAlertType",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"AlertType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"AlertType",
"\n",
"}"
] |
7,218 | all-7219 | [
"GetPrivateIPAddress",
"attempts",
"to",
"retrieve",
"private",
"IP",
"address",
"of",
"the",
"specified",
"network",
"interface",
"name",
".",
"If",
"IP",
"address",
"is",
"not",
"allocated",
"yet",
"returns",
"empty",
"string",
"."
] | [
"func",
"(",
"a",
"AzureClient",
")",
"GetPrivateIPAddress",
"(",
"resourceGroup",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
":=",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"name",
"}",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"f",
")",
"\n",
"nic",
",",
"err",
":=",
"a",
".",
"networkInterfacesClient",
"(",
")",
".",
"Get",
"(",
"resourceGroup",
",",
"name",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"nic",
".",
"Properties",
"==",
"nil",
"||",
"nic",
".",
"Properties",
".",
"IPConfigurations",
"==",
"nil",
"||",
"len",
"(",
"*",
"nic",
".",
"Properties",
".",
"IPConfigurations",
")",
"==",
"0",
"{",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
",",
"f",
")",
"\n",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"return",
"to",
".",
"String",
"(",
"(",
"*",
"nic",
".",
"Properties",
".",
"IPConfigurations",
")",
"[",
"0",
"]",
".",
"Properties",
".",
"PrivateIPAddress",
")",
",",
"nil",
"\n",
"}"
] |
7,219 | all-7220 | [
"ListIssueEvents",
"gets",
"a",
"list",
"events",
"from",
"GitHub",
"s",
"events",
"API",
"that",
"pertain",
"to",
"the",
"specified",
"issue",
".",
"The",
"events",
"that",
"are",
"returned",
"have",
"a",
"different",
"format",
"than",
"webhook",
"events",
"and",
"certain",
"event",
"types",
"are",
"excluded",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"issues",
"/",
"events",
"/"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListIssueEvents",
"(",
"org",
",",
"repo",
"string",
",",
"num",
"int",
")",
"(",
"[",
"]",
"ListedIssueEvent",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"num",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"num",
")",
"\n",
"var",
"<mask>",
"[",
"]",
"ListedIssueEvent",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"ListedIssueEvent",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"ListedIssueEvent",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"events",
",",
"nil",
"\n",
"}"
] |
7,220 | all-7221 | [
"/",
"*",
"Fatal",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelFatal"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Fatal",
"(",
"msg",
"string",
")",
"error",
"{",
"return",
"la",
".",
"<mask>",
"(",
"LevelFatal",
",",
"nil",
",",
"msg",
")",
"\n",
"}"
] |
7,221 | all-7222 | [
"LoadWithEnvTOML",
"loads",
"TOML",
"files",
"with",
"Env"
] | [
"func",
"LoadWithEnvTOML",
"(",
"conf",
"<mask>",
"{",
"}",
",",
"configPaths",
"...",
"string",
")",
"error",
"{",
"return",
"loadWithFunc",
"(",
"conf",
",",
"configPaths",
",",
"envReplacer",
",",
"toml",
".",
"Unmarshal",
")",
"\n",
"}"
] |
7,222 | all-7223 | [
"mapPackage",
"turns",
"appengine",
"into",
"google",
".",
"golang",
".",
"org",
"/",
"appengine",
"etc",
"."
] | [
"func",
"mapPackage",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"stutterPackage",
"{",
"s",
"+=",
"\"",
"\"",
"+",
"<mask>",
".",
"Base",
"(",
"s",
")",
"\n",
"}",
"\n",
"return",
"newPackageBase",
"+",
"s",
"\n",
"}"
] |
7,223 | all-7224 | [
"WithDelta",
"if",
"true",
"retrieve",
"delta",
"since",
"last",
"call",
"."
] | [
"func",
"(",
"p",
"GetHistogramParams",
")",
"WithDelta",
"(",
"delta",
"bool",
")",
"*",
"GetHistogramParams",
"{",
"p",
".",
"Delta",
"=",
"delta",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
7,224 | all-7225 | [
"StoreFileInfo",
"inserts",
"initial",
"sample",
"info",
"into",
"database",
"creating",
"a",
"placeholder",
"for",
"it"
] | [
"func",
"(",
"db",
"*",
"Database",
")",
"StoreFileInfo",
"(",
"sample",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"elastic",
".",
"IndexResponse",
",",
"error",
")",
"{",
"if",
"len",
"(",
"db",
".",
"Plugins",
")",
"==",
"0",
"{",
"return",
"elastic",
".",
"IndexResponse",
"{",
"}",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Test connection to ElasticSearch",
"err",
":=",
"db",
".",
"TestConnection",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"elastic",
".",
"IndexResponse",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"elastic",
".",
"NewSimpleClient",
"(",
"elastic",
".",
"SetURL",
"(",
"db",
".",
"URL",
")",
",",
"elastic",
".",
"SetBasicAuth",
"(",
"utils",
".",
"Getopts",
"(",
"<mask>",
".",
"Username",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"utils",
".",
"Getopts",
"(",
"db",
".",
"Password",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"elastic",
".",
"IndexResponse",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// NOTE: I am not setting ID because I want to be able to re-scan files with updated signatures in the future",
"fInfo",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"// \"id\": sample.SHA256,",
"\"",
"\"",
":",
"sample",
",",
"\"",
"\"",
":",
"db",
".",
"Plugins",
",",
"\"",
"\"",
":",
"time",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"time",
".",
"RFC3339Nano",
")",
",",
"}",
"\n\n",
"newScan",
",",
"err",
":=",
"client",
".",
"Index",
"(",
")",
".",
"Index",
"(",
"db",
".",
"Index",
")",
".",
"Type",
"(",
"db",
".",
"Type",
")",
".",
"OpType",
"(",
"\"",
"\"",
")",
".",
"// Id(\"1\").",
"BodyJson",
"(",
"fInfo",
")",
".",
"Do",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"elastic",
".",
"IndexResponse",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"newScan",
".",
"Id",
",",
"\"",
"\"",
":",
"newScan",
".",
"Index",
",",
"\"",
"\"",
":",
"newScan",
".",
"Type",
",",
"}",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"*",
"newScan",
",",
"nil",
"\n",
"}"
] |
7,225 | all-7226 | [
"AssociationByTypeAndContainer",
"gets",
"a",
"list",
"of",
"names",
"of",
"all",
"the",
"associations",
"associated",
"with",
"a",
"container",
"and",
"of",
"a",
"certain",
"type"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"AssociationsByTypeAndContainer",
"(",
"associationType",
",",
"containerName",
"string",
")",
"[",
"]",
"string",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"<mask>",
"associationNames",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"association",
":=",
"range",
"task",
".",
"Associations",
"{",
"if",
"association",
".",
"Type",
"==",
"associationType",
"{",
"for",
"_",
",",
"associatedContainerName",
":=",
"range",
"association",
".",
"Containers",
"{",
"if",
"associatedContainerName",
"==",
"containerName",
"{",
"associationNames",
"=",
"append",
"(",
"associationNames",
",",
"association",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"associationNames",
"\n",
"}"
] |
7,226 | all-7227 | [
"Command",
"returns",
"the",
"Cmd",
"struct",
"to",
"execute",
"the",
"named",
"program",
"with",
"the",
"given",
"arguments",
".",
"It",
"sets",
"only",
"the",
"Path",
"and",
"Args",
"in",
"the",
"returned",
"structure",
".",
"If",
"name",
"contains",
"no",
"path",
"separators",
"Command",
"uses",
"LookPath",
"to",
"resolve",
"name",
"to",
"a",
"complete",
"path",
"if",
"possible",
".",
"Otherwise",
"it",
"uses",
"name",
"directly",
"as",
"Path",
".",
"The",
"returned",
"Cmd",
"s",
"Args",
"field",
"is",
"constructed",
"from",
"the",
"command",
"name",
"followed",
"by",
"the",
"elements",
"of",
"arg",
"so",
"arg",
"should",
"not",
"include",
"the",
"command",
"name",
"itself",
".",
"For",
"example",
"Command",
"(",
"echo",
"hello",
")",
".",
"Args",
"[",
"0",
"]",
"is",
"always",
"name",
"not",
"the",
"possibly",
"resolved",
"Path",
"."
] | [
"func",
"Command",
"(",
"name",
"string",
",",
"arg",
"...",
"string",
")",
"*",
"Cmd",
"{",
"cmd",
":=",
"&",
"Cmd",
"{",
"Path",
":",
"name",
",",
"Args",
":",
"append",
"(",
"[",
"]",
"string",
"{",
"<mask>",
"}",
",",
"arg",
"...",
")",
",",
"}",
"\n",
"if",
"filepath",
".",
"Base",
"(",
"name",
")",
"==",
"name",
"{",
"if",
"lp",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"cmd",
".",
"lookPathErr",
"=",
"err",
"\n",
"}",
"else",
"{",
"cmd",
".",
"Path",
"=",
"lp",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"cmd",
"\n",
"}"
] |
7,227 | all-7228 | [
"Add",
"creates",
"a",
"new",
"unique",
"token",
"and",
"stores",
"it",
"into",
"current",
"SessionCache",
"instance",
".",
"The",
"token",
"creation",
"will",
"take",
"at",
"least",
"200",
"microseconds",
"but",
"could",
"normally",
"take",
"2",
".",
"5",
"milliseconds",
".",
"The",
"token",
"generation",
"function",
"it",
"is",
"built",
"with",
"security",
"over",
"performance",
"."
] | [
"func",
"(",
"s",
"*",
"SessionCache",
")",
"Add",
"(",
")",
"string",
"{",
"strSum",
":=",
"s",
".",
"salter",
".",
"DefaultToken",
"(",
")",
"\n\n",
"err",
":=",
"s",
".",
"<mask>",
".",
"Add",
"(",
"strSum",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"strSum",
"\n",
"}"
] |
7,228 | all-7229 | [
"Register",
"the",
"standard",
"HandlerFuncs",
"from",
"the",
"net",
"/",
"http",
"/",
"pprof",
"package",
"with",
"the",
"provided",
"gin",
".",
"Engine",
".",
"prefixOptions",
"is",
"a",
"optional",
".",
"If",
"not",
"prefixOptions",
"the",
"default",
"path",
"prefix",
"is",
"used",
"otherwise",
"first",
"prefixOptions",
"will",
"be",
"path",
"prefix",
"."
] | [
"func",
"Register",
"(",
"r",
"*",
"gin",
".",
"Engine",
",",
"prefixOptions",
"...",
"string",
")",
"{",
"prefix",
":=",
"getPrefix",
"(",
"prefixOptions",
"...",
")",
"\n\n",
"prefixRouter",
":=",
"r",
".",
"Group",
"(",
"prefix",
")",
"\n",
"{",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Index",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Cmdline",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Profile",
")",
")",
"\n",
"prefixRouter",
".",
"POST",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Symbol",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Symbol",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Trace",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Handler",
"(",
"\"",
"\"",
")",
".",
"ServeHTTP",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Handler",
"(",
"\"",
"\"",
")",
".",
"ServeHTTP",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Handler",
"(",
"\"",
"\"",
")",
".",
"ServeHTTP",
")",
")",
"\n",
"prefixRouter",
".",
"GET",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Handler",
"(",
"\"",
"\"",
")",
".",
"ServeHTTP",
")",
")",
"\n",
"prefixRouter",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"pprofHandler",
"(",
"pprof",
".",
"Handler",
"(",
"\"",
"\"",
")",
".",
"ServeHTTP",
")",
")",
"\n",
"}",
"\n",
"}"
] |
7,229 | all-7230 | [
"flush",
"flushes",
"the",
"first",
"n",
"bytes",
"of",
"the",
"buffer",
".",
"If",
"n",
"is",
"0",
"the",
"whole",
"buffer",
"is",
"flushed",
"."
] | [
"func",
"(",
"c",
"*",
"conn",
")",
"flush",
"(",
"n",
"int",
")",
"{",
"if",
"len",
"(",
"c",
".",
"buf",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"if",
"n",
"==",
"0",
"{",
"n",
"=",
"len",
"(",
"c",
".",
"buf",
")",
"\n",
"}",
"\n\n",
"// Trim the last \\n, StatsD does not like it.",
"_",
",",
"err",
":=",
"c",
".",
"w",
".",
"Write",
"(",
"c",
".",
"buf",
"[",
":",
"n",
"-",
"1",
"]",
")",
"\n",
"c",
".",
"handleError",
"(",
"err",
")",
"\n",
"if",
"n",
"<",
"len",
"(",
"c",
".",
"buf",
")",
"{",
"<mask>",
"(",
"c",
".",
"buf",
",",
"c",
".",
"buf",
"[",
"n",
":",
"]",
")",
"\n",
"}",
"\n",
"c",
".",
"buf",
"=",
"c",
".",
"buf",
"[",
":",
"len",
"(",
"c",
".",
"buf",
")",
"-",
"n",
"]",
"\n",
"}"
] |
7,230 | all-7231 | [
"NetworkAddress",
"returns",
"the",
"network",
"addresss",
"of",
"the",
"network",
"endpoint",
"or",
"an",
"empty",
"string",
"if",
"there",
"s",
"no",
"network",
"endpoint"
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"NetworkAddress",
"(",
")",
"string",
"{",
"e",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"listener",
":=",
"e",
".",
"listeners",
"[",
"<mask>",
"]",
"\n",
"if",
"listener",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"listener",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
"\n",
"}"
] |
7,231 | all-7232 | [
"Close",
"must",
"be",
"called",
"after",
"you",
"re",
"done",
"using",
"a",
"putFileClient",
".",
"Further",
"requests",
"will",
"throw",
"errors",
"."
] | [
"func",
"(",
"c",
"*",
"putFileClient",
")",
"Close",
"(",
")",
"error",
"{",
"_",
",",
"<mask>",
":=",
"c",
".",
"c",
".",
"CloseAndRecv",
"(",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
7,232 | all-7233 | [
"Int64",
"defines",
"an",
"int64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"an",
"int64",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"Int64",
"(",
"name",
"string",
",",
"value",
"int64",
",",
"usage",
"string",
")",
"*",
"int64",
"{",
"return",
"EnvironmentFlags",
".",
"Int64",
"(",
"name",
",",
"value",
",",
"<mask>",
")",
"\n",
"}"
] |
7,233 | all-7234 | [
"OnGossipBroadcast",
"receives",
"broadcasts",
"of",
"TopologyGossipData",
".",
"It",
"returns",
"the",
"received",
"update",
"unchanged",
"."
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"OnGossipBroadcast",
"(",
"_",
"PeerName",
",",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"GossipData",
",",
"error",
")",
"{",
"origUpdate",
",",
"_",
",",
"err",
":=",
"router",
".",
"applyTopologyUpdate",
"(",
"update",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"origUpdate",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"topologyGossipData",
"{",
"peers",
":",
"router",
".",
"Peers",
",",
"update",
":",
"origUpdate",
"}",
",",
"nil",
"\n",
"}"
] |
7,234 | all-7235 | [
"buildActions",
"is",
"the",
"top",
"level",
"action",
"builder",
"it",
"determines",
"whether",
"to",
"build",
"a",
"new",
"actions",
"/",
"foo",
".",
"go",
"file",
"or",
"append",
"to",
"an",
"existing",
"one"
] | [
"func",
"buildActions",
"(",
"pres",
"*",
"presenter",
")",
"genny",
".",
"RunFn",
"{",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"fn",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pres",
".",
"<mask>",
".",
"File",
"(",
")",
")",
"\n",
"xf",
",",
"err",
":=",
"r",
".",
"FindFile",
"(",
"fn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"buildNewActions",
"(",
"fn",
",",
"pres",
")",
"(",
"r",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"appendActions",
"(",
"xf",
",",
"pres",
")",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
7,235 | all-7236 | [
"copy",
"a",
"http",
".",
"Request",
"see",
":",
"https",
":",
"//",
"go",
"-",
"review",
".",
"googlesource",
".",
"com",
"/",
"c",
"/",
"go",
"/",
"+",
"/",
"36483",
"/",
"3",
"/",
"src",
"/",
"net",
"/",
"http",
"/",
"server",
".",
"go"
] | [
"func",
"dupeRequest",
"(",
"original",
"*",
"http",
".",
"Request",
")",
"*",
"http",
".",
"Request",
"{",
"r2",
":=",
"new",
"(",
"http",
".",
"Request",
")",
"\n",
"*",
"r2",
"=",
"*",
"original",
"\n",
"r2",
".",
"URL",
"=",
"<mask>",
"(",
"url",
".",
"URL",
")",
"\n",
"*",
"r2",
".",
"URL",
"=",
"*",
"original",
".",
"URL",
"\n",
"return",
"r2",
"\n",
"}"
] |
7,236 | all-7237 | [
"Parameter",
"callback",
"has",
"type",
"C",
".",
"GLDEBUGPROCAMD",
"."
] | [
"func",
"DebugMessageCallbackAMD",
"(",
"callback",
"unsafe",
".",
"Pointer",
",",
"userParam",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDebugMessageCallbackAMD",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"userParam",
")",
",",
"0",
")",
"\n",
"}"
] |
7,237 | all-7238 | [
"writeFinishedCommit",
"writes",
"these",
"changes",
"to",
"etcd",
":",
"1",
")",
"it",
"closes",
"the",
"input",
"commit",
"(",
"i",
".",
"e",
".",
"it",
"writes",
"any",
"changes",
"made",
"to",
"it",
"and",
"removes",
"it",
"from",
"the",
"open",
"commits",
")",
"2",
")",
"if",
"the",
"commit",
"is",
"the",
"new",
"HEAD",
"of",
"master",
"it",
"updates",
"the",
"repo",
"size"
] | [
"func",
"(",
"d",
"*",
"driver",
")",
"writeFinishedCommit",
"(",
"ctx",
"context",
".",
"Context",
",",
"commit",
"*",
"pfs",
".",
"Commit",
",",
"commitInfo",
"*",
"pfs",
".",
"CommitInfo",
")",
"error",
"{",
"_",
",",
"err",
":=",
"col",
".",
"NewSTM",
"(",
"ctx",
",",
"d",
".",
"etcdClient",
",",
"func",
"(",
"stm",
"col",
".",
"STM",
")",
"error",
"{",
"commits",
":=",
"d",
".",
"commits",
"(",
"commit",
".",
"Repo",
".",
"Name",
")",
".",
"ReadWrite",
"(",
"stm",
")",
"\n",
"if",
"err",
":=",
"commits",
".",
"Put",
"(",
"commit",
".",
"ID",
",",
"commitInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"openCommits",
".",
"ReadWrite",
"(",
"stm",
")",
".",
"Delete",
"(",
"commit",
".",
"ID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"commit",
".",
"ID",
",",
"err",
")",
"\n",
"}",
"\n",
"// update the repo size if this is the head of master",
"repos",
":=",
"d",
".",
"repos",
".",
"ReadWrite",
"(",
"stm",
")",
"\n",
"repoInfo",
":=",
"new",
"(",
"pfs",
".",
"RepoInfo",
")",
"\n",
"if",
"err",
":=",
"repos",
".",
"Get",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"repoInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"branch",
":=",
"range",
"repoInfo",
".",
"Branches",
"{",
"if",
"branch",
".",
"<mask>",
"==",
"\"",
"\"",
"{",
"branchInfo",
":=",
"&",
"pfs",
".",
"BranchInfo",
"{",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"branches",
"(",
"commit",
".",
"Repo",
".",
"Name",
")",
".",
"ReadWrite",
"(",
"stm",
")",
".",
"Get",
"(",
"branch",
".",
"Name",
",",
"branchInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// If the head commit of master has been deleted, we could get here if another branch",
"// had shared its head commit with master, and then we created a new commit on that branch",
"if",
"branchInfo",
".",
"Head",
"!=",
"nil",
"&&",
"branchInfo",
".",
"Head",
".",
"ID",
"==",
"commit",
".",
"ID",
"{",
"repoInfo",
".",
"SizeBytes",
"=",
"commitInfo",
".",
"SizeBytes",
"\n",
"if",
"err",
":=",
"repos",
".",
"Put",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"repoInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,238 | all-7239 | [
"export",
"FileSequence_InvertedFrameRangePadded"
] | [
"func",
"FileSequence_InvertedFrameRangePadded",
"(",
"id",
"FileSeqId",
")",
"*",
"C",
".",
"char",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"// caller must free string",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"CString",
"(",
"<mask>",
".",
"InvertedFrameRangePadded",
"(",
")",
")",
"\n",
"}"
] |
7,239 | all-7240 | [
"selectToValue",
"returns",
"a",
"single",
"value",
"fetched",
"from",
"rows",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"selectToValue",
"(",
"rows",
"*",
"sql",
".",
"Rows",
",",
"t",
"reflect",
".",
"Type",
")",
"(",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"ptrN",
":=",
"0",
"\n",
"for",
";",
"t",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
";",
"ptrN",
"++",
"{",
"t",
"=",
"t",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"dest",
":=",
"reflect",
".",
"New",
"(",
"t",
")",
".",
"Elem",
"(",
")",
"\n",
"if",
"rows",
".",
"Next",
"(",
")",
"{",
"if",
"err",
":=",
"rows",
".",
"Scan",
"(",
"dest",
".",
"Addr",
"(",
")",
".",
"Interface",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"reflect",
".",
"Value",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"ptrN",
";",
"i",
"++",
"{",
"<mask>",
"=",
"dest",
".",
"Addr",
"(",
")",
"\n",
"}",
"\n",
"return",
"dest",
",",
"nil",
"\n",
"}"
] |
7,240 | all-7241 | [
"String",
"is",
"a",
"wrapper",
"around",
"gtk_tree_path_to_string",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreePath",
")",
"<mask>",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_tree_path_to_string",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"goString",
"(",
"c",
")",
"\n",
"}"
] |
7,241 | all-7242 | [
"protoToAppLogs",
"takes",
"as",
"input",
"an",
"array",
"of",
"pointers",
"to",
"LogLines",
"the",
"internal",
"Protocol",
"Buffer",
"representation",
"of",
"a",
"single",
"application",
"-",
"level",
"log",
"and",
"converts",
"it",
"to",
"an",
"array",
"of",
"AppLogs",
"the",
"external",
"representation",
"of",
"an",
"application",
"-",
"level",
"log",
"."
] | [
"func",
"protoToAppLogs",
"(",
"logLines",
"[",
"]",
"*",
"pb",
".",
"LogLine",
")",
"[",
"]",
"AppLog",
"{",
"appLogs",
":=",
"make",
"(",
"[",
"]",
"AppLog",
",",
"len",
"(",
"logLines",
")",
")",
"\n\n",
"for",
"i",
",",
"line",
":=",
"range",
"logLines",
"{",
"appLogs",
"[",
"i",
"]",
"=",
"AppLog",
"{",
"Time",
":",
"time",
".",
"Unix",
"(",
"0",
",",
"*",
"line",
".",
"Time",
"*",
"1e3",
")",
",",
"Level",
":",
"int",
"(",
"*",
"line",
".",
"Level",
")",
",",
"<mask>",
":",
"*",
"line",
".",
"LogMessage",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"appLogs",
"\n",
"}"
] |
7,242 | all-7243 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"<mask>",
"\n",
"}"
] |
7,243 | all-7244 | [
"Create",
"a",
"rafthttp",
".",
"Dial",
"function",
"that",
"connects",
"over",
"TLS",
"using",
"the",
"given",
"cluster",
"(",
"and",
"optionally",
"CA",
")",
"certificate",
"both",
"as",
"client",
"and",
"remote",
"certificate",
"."
] | [
"func",
"raftDial",
"(",
"cert",
"*",
"shared",
".",
"CertInfo",
")",
"(",
"rafthttp",
".",
"Dial",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"tlsClientConfig",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dial",
":=",
"rafthttp",
".",
"NewDialTLS",
"(",
"config",
")",
"\n",
"return",
"dial",
",",
"nil",
"\n",
"}"
] |
7,244 | all-7245 | [
"GenerateNumberSequence",
"will",
"generate",
"a",
"slice",
"of",
"integers",
"at",
"the",
"provided",
"length",
"and",
"convert",
"them",
"each",
"to",
"a",
"string"
] | [
"func",
"GenerateNumberSequence",
"(",
"length",
"int",
")",
"[",
"]",
"string",
"{",
"numSeq",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"<mask>",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
"{",
"numSeq",
"[",
"i",
"]",
"=",
"strconv",
".",
"Itoa",
"(",
"i",
")",
"\n",
"}",
"\n",
"return",
"numSeq",
"\n",
"}"
] |
7,245 | all-7246 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CompositingReasonsParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,246 | all-7247 | [
"Repaint",
"draws",
"the",
"control",
"on",
"its",
"View",
"surface"
] | [
"func",
"(",
"b",
"*",
"BarChart",
")",
"Draw",
"(",
")",
"{",
"if",
"b",
".",
"hidden",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"fg",
",",
"bg",
":=",
"RealColor",
"(",
"b",
".",
"fg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorBarChartText",
")",
",",
"RealColor",
"(",
"b",
".",
"bg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorBarChartBack",
")",
"\n",
"SetTextColor",
"(",
"fg",
")",
"\n",
"SetBackColor",
"(",
"bg",
")",
"\n\n",
"FillRect",
"(",
"b",
".",
"x",
",",
"b",
".",
"y",
",",
"b",
".",
"<mask>",
",",
"b",
".",
"height",
",",
"' '",
")",
"\n\n",
"if",
"len",
"(",
"b",
".",
"data",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"drawRulers",
"(",
")",
"\n",
"b",
".",
"drawValues",
"(",
")",
"\n",
"b",
".",
"drawLegend",
"(",
")",
"\n",
"b",
".",
"drawBars",
"(",
")",
"\n",
"}"
] |
7,247 | all-7248 | [
"ReadFrom",
"implements",
"net",
".",
"PacketConn",
".",
"Clients",
"should",
"consume",
"from",
"ReadFrom",
"without",
"blocking",
"."
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"ReadFrom",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"remote",
"net",
".",
"Addr",
",",
"err",
"error",
")",
"{",
"c",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"p",
".",
"actions",
"<-",
"func",
"(",
")",
"{",
"go",
"func",
"(",
")",
"{",
"// so as not to block loop",
"defer",
"close",
"(",
"c",
")",
"\n",
"select",
"{",
"case",
"pkt",
":=",
"<-",
"p",
".",
"recv",
":",
"n",
"=",
"copy",
"(",
"b",
",",
"pkt",
".",
"Buf",
")",
"\n",
"remote",
"=",
"MeshAddr",
"{",
"PeerName",
":",
"pkt",
".",
"SrcName",
",",
"PeerUID",
":",
"pkt",
".",
"SrcUID",
"}",
"\n",
"if",
"n",
"<",
"len",
"(",
"pkt",
".",
"Buf",
")",
"{",
"err",
"=",
"ErrShortRead",
"\n",
"}",
"\n",
"<mask>",
"<-",
"p",
".",
"quit",
":",
"err",
"=",
"ErrPeerClosed",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"<-",
"c",
"\n",
"return",
"n",
",",
"remote",
",",
"err",
"\n",
"}"
] |
7,248 | all-7249 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDOMStorageItemsReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,249 | all-7250 | [
"customCheckRetry",
"is",
"a",
"fork",
"of",
"etcd",
"s",
"DefaultCheckRetry",
"except",
"that",
"it",
"issues",
"more",
"retries",
"before",
"giving",
"up",
".",
"Because",
"Pachyderm",
"often",
"starts",
"before",
"etcd",
"is",
"ready",
"retrying",
"Pachd",
"s",
"connection",
"to",
"etcd",
"in",
"a",
"tight",
"loop",
"(",
"<1s",
")",
"is",
"often",
"much",
"faster",
"than",
"waiting",
"for",
"kubernetes",
"to",
"restart",
"the",
"pachd",
"pod",
"."
] | [
"func",
"customCheckRetry",
"(",
"cluster",
"*",
"etcd",
".",
"Cluster",
",",
"numReqs",
"int",
",",
"lastResp",
"http",
".",
"Response",
",",
"err",
"error",
")",
"error",
"{",
"// Retry for 5 minutes, unless the cluster is super huge",
"maxRetries",
":=",
"2",
"*",
"len",
"(",
"cluster",
".",
"Machines",
")",
"\n",
"if",
"600",
">",
"maxRetries",
"{",
"maxRetries",
"=",
"600",
"\n",
"}",
"\n",
"if",
"numReqs",
">",
"maxRetries",
"{",
"errStr",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cluster",
".",
"Machines",
",",
"err",
")",
"\n",
"return",
"&",
"etcd",
".",
"EtcdError",
"{",
"ErrorCode",
":",
"etcd",
".",
"ErrCodeEtcdNotReachable",
",",
"Message",
":",
"\"",
"\"",
",",
"Cause",
":",
"errStr",
",",
"Index",
":",
"0",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"lastResp",
".",
"StatusCode",
"==",
"0",
"{",
"// always retry if it failed to get a response",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"lastResp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusInternalServerError",
"{",
"// The status code indicates that etcd is no longer in leader election.",
"// Something is wrong",
"body",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n",
"if",
"lastResp",
".",
"Body",
"!=",
"nil",
"{",
"if",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"lastResp",
".",
"Body",
")",
";",
"err",
"==",
"nil",
"{",
"body",
"=",
"b",
"\n",
"}",
"\n",
"}",
"\n",
"errStr",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"http",
".",
"StatusText",
"(",
"lastResp",
".",
"StatusCode",
")",
",",
"body",
")",
"\n",
"return",
"&",
"etcd",
".",
"EtcdError",
"{",
"ErrorCode",
":",
"etcd",
".",
"ErrCodeUnhandledHTTPStatus",
",",
"Message",
":",
"\"",
"\"",
",",
"Cause",
":",
"errStr",
",",
"<mask>",
":",
"0",
",",
"}",
"\n",
"}",
"\n\n",
"// sleep some time and expect leader election finish",
"time",
".",
"Sleep",
"(",
"time",
".",
"Millisecond",
"*",
"500",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"lastResp",
".",
"StatusCode",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,250 | all-7251 | [
"seekForPrev",
"will",
"reset",
"iterator",
"and",
"seek",
"to",
"<",
"=",
"key",
"."
] | [
"func",
"(",
"itr",
"*",
"Iterator",
")",
"seekForPrev",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"// TODO: Optimize this. We shouldn't have to take a Prev step.",
"itr",
".",
"seekFrom",
"(",
"<mask>",
",",
"origin",
")",
"\n",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"itr",
".",
"Key",
"(",
")",
",",
"key",
")",
"{",
"itr",
".",
"prev",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
7,251 | all-7252 | [
"specify",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTextureSubImage3D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTextureSubImage3D",
"(",
"gpCompressedTextureSubImage3D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"zoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
7,252 | all-7253 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform1i",
"(",
"<mask>",
"int32",
",",
"v0",
"int32",
")",
"{",
"C",
".",
"glowUniform1i",
"(",
"gpUniform1i",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v0",
")",
")",
"\n",
"}"
] |
7,253 | all-7254 | [
"CreateOffline",
"creates",
"a",
"new",
"reference",
"to",
"an",
"offline",
"keypair",
"It",
"returns",
"the",
"created",
"key",
"info"
] | [
"func",
"(",
"kb",
"dbKeybase",
")",
"CreateOffline",
"(",
"name",
"string",
",",
"pub",
"crypto",
".",
"PubKey",
")",
"(",
"Info",
",",
"error",
")",
"{",
"return",
"kb",
".",
"writeOfflineKey",
"(",
"pub",
",",
"<mask>",
")",
",",
"nil",
"\n",
"}"
] |
7,254 | all-7255 | [
"ExpandToPath",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_expand_to_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"ExpandToPath",
"(",
"path",
"*",
"TreePath",
")",
"{",
"C",
".",
"gtk_tree_view_expand_to_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
7,255 | all-7256 | [
"MiddlewareFunc",
"makes",
"TimerMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"IfMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"if",
"mw",
".",
"Condition",
"==",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"ifTrueHandler",
"HandlerFunc",
"\n",
"if",
"mw",
".",
"IfTrue",
"!=",
"nil",
"{",
"ifTrueHandler",
"=",
"mw",
".",
"IfTrue",
".",
"MiddlewareFunc",
"(",
"h",
")",
"\n",
"}",
"else",
"{",
"ifTrueHandler",
"=",
"h",
"\n",
"}",
"\n\n",
"<mask>",
"ifFalseHandler",
"HandlerFunc",
"\n",
"if",
"mw",
".",
"IfFalse",
"!=",
"nil",
"{",
"ifFalseHandler",
"=",
"mw",
".",
"IfFalse",
".",
"MiddlewareFunc",
"(",
"h",
")",
"\n",
"}",
"else",
"{",
"ifFalseHandler",
"=",
"h",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"Request",
")",
"{",
"if",
"mw",
".",
"Condition",
"(",
"r",
")",
"{",
"ifTrueHandler",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"else",
"{",
"ifFalseHandler",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n\n",
"}",
"\n",
"}"
] |
7,256 | all-7257 | [
"AddBytesK",
"adds",
"key",
"=",
"value",
"argument",
".",
"Multiple",
"values",
"for",
"the",
"same",
"key",
"may",
"be",
"added",
"."
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"AddBytesK",
"(",
"key",
"[",
"]",
"byte",
",",
"<mask>",
"string",
")",
"{",
"a",
".",
"args",
"=",
"appendArg",
"(",
"a",
".",
"args",
",",
"b2s",
"(",
"key",
")",
",",
"value",
",",
"argsHasValue",
")",
"\n",
"}"
] |
7,257 | all-7258 | [
"RenderToFile",
"writes",
"the",
"map",
"as",
"an",
"encoded",
"image",
"to",
"the",
"file",
"system",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"RenderToFile",
"(",
"opts",
"RenderOpts",
",",
"path",
"string",
")",
"error",
"{",
"scaleFactor",
":=",
"opts",
".",
"ScaleFactor",
"\n",
"if",
"scaleFactor",
"==",
"0.0",
"{",
"scaleFactor",
"=",
"1.0",
"\n",
"}",
"\n",
"cs",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"var",
"format",
"*",
"C",
".",
"char",
"\n",
"if",
"opts",
".",
"Format",
"!=",
"\"",
"\"",
"{",
"<mask>",
"=",
"C",
".",
"CString",
"(",
"opts",
".",
"Format",
")",
"\n",
"}",
"else",
"{",
"format",
"=",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"format",
")",
")",
"\n",
"if",
"C",
".",
"mapnik_map_render_to_file",
"(",
"m",
".",
"m",
",",
"cs",
",",
"C",
".",
"double",
"(",
"opts",
".",
"Scale",
")",
",",
"C",
".",
"double",
"(",
"scaleFactor",
")",
",",
"format",
")",
"!=",
"0",
"{",
"return",
"m",
".",
"lastError",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,258 | all-7259 | [
"MustAccount",
"retrieves",
"the",
"Account",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"MustAccount",
"(",
")",
"LedgerKeyAccount",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetAccount",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
7,259 | all-7260 | [
"creates",
"and",
"initializes",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"BufferData",
"(",
"target",
"uint32",
",",
"size",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
",",
"<mask>",
"uint32",
")",
"{",
"C",
".",
"glowBufferData",
"(",
"gpBufferData",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"data",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"usage",
")",
")",
"\n",
"}"
] |
7,260 | all-7261 | [
"CoveredNetworks",
"returns",
"the",
"list",
"of",
"RangerEntry",
"(",
"s",
")",
"the",
"given",
"ipnet",
"covers",
".",
"That",
"is",
"the",
"networks",
"that",
"are",
"completely",
"subsumed",
"by",
"the",
"specified",
"network",
"."
] | [
"func",
"(",
"p",
"*",
"prefixTrie",
")",
"CoveredNetworks",
"(",
"network",
"net",
".",
"IPNet",
")",
"(",
"[",
"]",
"RangerEntry",
",",
"error",
")",
"{",
"net",
":=",
"rnet",
".",
"NewNetwork",
"(",
"network",
")",
"\n",
"return",
"p",
".",
"coveredNetworks",
"(",
"<mask>",
")",
"\n",
"}"
] |
7,261 | all-7262 | [
"Redirect",
"a",
"request",
"with",
"the",
"given",
"status",
"to",
"the",
"given",
"URL",
"."
] | [
"func",
"(",
"d",
"*",
"DefaultContext",
")",
"Redirect",
"(",
"status",
"int",
",",
"url",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"d",
".",
"Flash",
"(",
")",
".",
"persist",
"(",
"d",
".",
"Session",
"(",
")",
")",
"\n\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"{",
"if",
"len",
"(",
"args",
")",
">",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"args",
")",
"\n",
"}",
"\n",
"var",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"{",
"rv",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"args",
"[",
"0",
"]",
")",
")",
"\n",
"if",
"!",
"rv",
".",
"Type",
"(",
")",
".",
"ConvertibleTo",
"(",
"mapType",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"args",
")",
"\n",
"}",
"\n",
"m",
"=",
"rv",
".",
"Convert",
"(",
"mapType",
")",
".",
"Interface",
"(",
")",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"h",
",",
"ok",
":=",
"d",
".",
"Value",
"(",
"strings",
".",
"TrimSuffix",
"(",
"url",
",",
"\"",
"\"",
")",
")",
".",
"(",
"RouteHelperFunc",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"url",
")",
"\n",
"}",
"\n",
"url",
",",
"err",
":=",
"h",
"(",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"http",
".",
"Redirect",
"(",
"d",
".",
"Response",
"(",
")",
",",
"d",
".",
"Request",
"(",
")",
",",
"string",
"(",
"url",
")",
",",
"status",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"args",
")",
">",
"0",
"{",
"url",
"=",
"fmt",
".",
"Sprintf",
"(",
"url",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"http",
".",
"Redirect",
"(",
"d",
".",
"Response",
"(",
")",
",",
"d",
".",
"Request",
"(",
")",
",",
"url",
",",
"status",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,262 | all-7263 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ServiceName",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
7,263 | all-7264 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ContinueToLocationParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger47",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
7,264 | all-7265 | [
"Lex",
"an",
"XPath",
"expresion",
"on",
"the",
"io",
".",
"Reader"
] | [
"func",
"Lex",
"(",
"xpath",
"string",
")",
"chan",
"XItem",
"{",
"l",
":=",
"&",
"Lexer",
"{",
"input",
":",
"xpath",
",",
"items",
":",
"make",
"(",
"chan",
"XItem",
")",
",",
"}",
"\n",
"go",
"l",
".",
"run",
"(",
")",
"\n",
"return",
"l",
".",
"<mask>",
"\n",
"}"
] |
7,265 | all-7266 | [
"Write",
"serializes",
"the",
"command",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Command",
"interface",
"."
] | [
"func",
"(",
"c",
"Touch",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"if",
"_",
",",
"err",
"=",
"w",
".",
"WriteString",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"c",
".",
"MessageID",
".",
"WriteTo",
"(",
"w",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"w",
".",
"WriteByte",
"(",
"'\\n'",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
7,266 | all-7267 | [
"SetBufferSize",
"sets",
"the",
"pixel",
"buffer",
"at",
"the",
"map",
"image",
"edges",
"where",
"Mapnik",
"should",
"not",
"render",
"any",
"labels",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"SetBufferSize",
"(",
"s",
"int",
")",
"{",
"C",
".",
"mapnik_map_set_buffer_size",
"(",
"m",
".",
"m",
",",
"C",
".",
"int",
"(",
"s",
")",
")",
"\n",
"}"
] |
7,267 | all-7268 | [
"FlushJobAll",
"returns",
"all",
"the",
"jobs",
"which",
"were",
"triggered",
"by",
"commits",
".",
"If",
"toPipelines",
"is",
"non",
"-",
"nil",
"then",
"only",
"the",
"jobs",
"between",
"commits",
"and",
"those",
"pipelines",
"in",
"the",
"DAG",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"FlushJobAll",
"(",
"commits",
"[",
"]",
"*",
"pfs",
".",
"Commit",
",",
"toPipelines",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"pps",
".",
"JobInfo",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"*",
"pps",
".",
"JobInfo",
"\n",
"if",
"err",
":=",
"c",
".",
"FlushJob",
"(",
"commits",
",",
"toPipelines",
",",
"func",
"(",
"ji",
"*",
"pps",
".",
"JobInfo",
")",
"error",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"ji",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
7,268 | all-7269 | [
"DoUpdates",
"iterates",
"generated",
"update",
"data",
"and",
"adds",
"and",
"/",
"or",
"modifies",
"labels",
"on",
"repositories",
"Uses",
"AddLabel",
"GH",
"API",
"to",
"add",
"missing",
"labels",
"And",
"UpdateLabel",
"GH",
"API",
"to",
"update",
"color",
"or",
"name",
"(",
"name",
"only",
"when",
"case",
"differs",
")"
] | [
"func",
"(",
"ru",
"RepoUpdates",
")",
"DoUpdates",
"(",
"org",
"string",
",",
"gc",
"client",
")",
"error",
"{",
"var",
"numUpdates",
"int",
"\n",
"for",
"_",
",",
"updates",
":=",
"range",
"ru",
"{",
"numUpdates",
"+=",
"len",
"(",
"updates",
")",
"\n",
"}",
"\n\n",
"updateChan",
":=",
"make",
"(",
"chan",
"repoUpdate",
",",
"numUpdates",
")",
"\n",
"for",
"repo",
",",
"updates",
":=",
"range",
"ru",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"org",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"repo",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"len",
"(",
"updates",
")",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"updates",
"{",
"updateChan",
"<-",
"repoUpdate",
"{",
"repo",
":",
"repo",
",",
"update",
":",
"item",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"close",
"(",
"updateChan",
")",
"\n\n",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"wg",
".",
"Add",
"(",
"maxConcurrentWorkers",
")",
"\n",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"numUpdates",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"maxConcurrentWorkers",
";",
"i",
"++",
"{",
"<mask>",
"func",
"(",
"updates",
"<-",
"chan",
"repoUpdate",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"item",
":=",
"range",
"updates",
"{",
"repo",
":=",
"item",
".",
"repo",
"\n",
"update",
":=",
"item",
".",
"update",
"\n",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"org",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"repo",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"update",
".",
"Why",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"switch",
"update",
".",
"Why",
"{",
"case",
"\"",
"\"",
":",
"err",
":=",
"gc",
".",
"AddRepoLabel",
"(",
"org",
",",
"repo",
",",
"update",
".",
"Wanted",
".",
"Name",
",",
"update",
".",
"Wanted",
".",
"Description",
",",
"update",
".",
"Wanted",
".",
"Color",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"err",
":=",
"gc",
".",
"UpdateRepoLabel",
"(",
"org",
",",
"repo",
",",
"update",
".",
"Current",
".",
"Name",
",",
"update",
".",
"Wanted",
".",
"Name",
",",
"update",
".",
"Wanted",
".",
"Description",
",",
"update",
".",
"Wanted",
".",
"Color",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"err",
":=",
"gc",
".",
"DeleteRepoLabel",
"(",
"org",
",",
"repo",
",",
"update",
".",
"Current",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"issues",
",",
"err",
":=",
"gc",
".",
"FindIssues",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"org",
",",
"repo",
",",
"update",
".",
"Current",
".",
"Name",
",",
"update",
".",
"Wanted",
".",
"Name",
")",
",",
"\"",
"\"",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"issues",
")",
"==",
"0",
"{",
"if",
"err",
"=",
"gc",
".",
"DeleteRepoLabel",
"(",
"org",
",",
"repo",
",",
"update",
".",
"Current",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"issues",
"{",
"if",
"err",
"=",
"gc",
".",
"AddLabel",
"(",
"org",
",",
"repo",
",",
"i",
".",
"Number",
",",
"update",
".",
"Wanted",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"err",
"=",
"gc",
".",
"RemoveLabel",
"(",
"org",
",",
"repo",
",",
"i",
".",
"Number",
",",
"update",
".",
"Current",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"errChan",
"<-",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"update",
".",
"Why",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
"updateChan",
")",
"\n",
"}",
"\n\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"errChan",
")",
"\n\n",
"var",
"overallErr",
"error",
"\n",
"if",
"len",
"(",
"errChan",
")",
">",
"0",
"{",
"var",
"updateErrs",
"[",
"]",
"error",
"\n",
"for",
"updateErr",
":=",
"range",
"errChan",
"{",
"updateErrs",
"=",
"append",
"(",
"updateErrs",
",",
"updateErr",
")",
"\n",
"}",
"\n",
"overallErr",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"updateErrs",
")",
"\n",
"}",
"\n\n",
"return",
"overallErr",
"\n",
"}"
] |
7,269 | all-7270 | [
"GzipDecompressor",
"is",
"a",
"DecompressorFunc",
"for",
"the",
"gzip",
"compression",
"algorithm",
"."
] | [
"func",
"GzipDecompressor",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"return",
"pgzip",
".",
"NewReader",
"(",
"r",
")",
"\n",
"}"
] |
7,270 | all-7271 | [
"GetLiveEntry",
"retrieves",
"the",
"LiveEntry",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"BucketEntry",
")",
"GetLiveEntry",
"(",
")",
"(",
"result",
"LedgerEntry",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"LiveEntry",
"\n",
"ok",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
7,271 | all-7272 | [
"GetDefaultOk",
"returns",
"a",
"tuple",
"with",
"the",
"Default",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TemplateVariable",
")",
"GetDefaultOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Default",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
7,272 | all-7273 | [
"shouldWatch",
"returns",
"whether",
"the",
"service",
"of",
"the",
"given",
"name",
"should",
"be",
"watched",
"based",
"on",
"its",
"name",
"."
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"shouldWatchFromName",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"// If there's no fixed set of watched services, we watch everything.",
"if",
"len",
"(",
"d",
".",
"watchedServices",
")",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"sn",
":=",
"range",
"d",
".",
"watchedServices",
"{",
"if",
"sn",
"==",
"name",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
7,273 | all-7274 | [
"GetIDOk",
"returns",
"a",
"tuple",
"with",
"the",
"ID",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"l",
"*",
"LogSet",
")",
"GetIDOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"ID",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
7,274 | all-7275 | [
"parseGroup",
"parses",
"the",
"row",
"of",
"a",
"group",
"."
] | [
"func",
"parseGroup",
"(",
"row",
"string",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"fields",
":=",
"strings",
".",
"Split",
"(",
"row",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"fields",
")",
"!=",
"4",
"{",
"return",
"nil",
",",
"rowError",
"{",
"_GROUP_FILE",
",",
"row",
"}",
"\n",
"}",
"\n\n",
"gid",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"fields",
"[",
"2",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"atoiError",
"{",
"_GROUP_FILE",
",",
"row",
",",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"Group",
"{",
"Name",
":",
"<mask>",
"[",
"0",
"]",
",",
"password",
":",
"fields",
"[",
"1",
"]",
",",
"GID",
":",
"gid",
",",
"UserList",
":",
"strings",
".",
"Split",
"(",
"fields",
"[",
"3",
"]",
",",
"\"",
"\"",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
7,275 | all-7276 | [
"ReplyJSON",
"encodes",
"the",
"passed",
"objec",
"as",
"application",
"/",
"json",
"and",
"writes",
"a",
"reply",
"with",
"a",
"given",
"HTTP",
"status",
"code",
"to",
"w",
"ReplyJSON",
"(",
"w",
"404",
"map",
"[",
"string",
"]",
"interface",
"{}",
"{",
"msg",
":",
"not",
"found",
"}",
")"
] | [
"func",
"ReplyJSON",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"code",
"int",
",",
"obj",
"interface",
"{",
"}",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"code",
")",
"\n",
"out",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
"=",
"[",
"]",
"byte",
"(",
"`{\"msg\": \"internal marshal error\"}`",
")",
"\n",
"}",
"\n",
"w",
".",
"Write",
"(",
"out",
")",
"\n",
"}"
] |
7,276 | all-7277 | [
"Name",
"assign",
"a",
"name",
"to",
"the",
"container",
"."
] | [
"func",
"(",
"s",
"*",
"RunConfig",
")",
"Name",
"(",
"name",
"string",
")",
"{",
"s",
".",
"<mask>",
"=",
"append",
"(",
"s",
".",
"Options",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"}"
] |
7,277 | all-7278 | [
"simulateRequest",
"simulates",
"a",
"request",
"by",
"returning",
"a",
"sample",
"JSON",
"from",
"file"
] | [
"func",
"(",
"r",
"rpc",
")",
"simulateRequest",
"(",
"endpoint",
"string",
",",
"method",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Test files conform to replacing '/' in endpoint with '_'",
"fileName",
":=",
"strings",
".",
"Replace",
"(",
"endpoint",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"// file names also have method type prepended to ensure uniqueness",
"filePath",
":=",
"basePath",
"+",
"\"",
"\"",
"+",
"method",
"+",
"\"",
"\"",
"+",
"fileName",
"+",
"\"",
"\"",
"\n",
"<mask>",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"data",
",",
"nil",
"\n",
"}"
] |
7,278 | all-7279 | [
"Write",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFile",
")",
"Write",
"(",
"arg0",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"int",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
7,279 | all-7280 | [
"CanonicalURLPath",
"returns",
"the",
"canonical",
"url",
"path",
"for",
"p",
"which",
"follows",
"the",
"rules",
":",
"1",
".",
"the",
"path",
"always",
"starts",
"with",
"/",
"2",
".",
"replace",
"multiple",
"slashes",
"with",
"a",
"single",
"slash",
"3",
".",
"replace",
"each",
".",
"..",
"path",
"name",
"element",
"with",
"equivalent",
"one",
"4",
".",
"keep",
"the",
"trailing",
"slash",
"The",
"function",
"is",
"borrowed",
"from",
"stdlib",
"http",
".",
"cleanPath",
"in",
"server",
".",
"go",
"."
] | [
"func",
"CanonicalURLPath",
"(",
"p",
"string",
")",
"string",
"{",
"if",
"p",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"p",
"[",
"0",
"]",
"!=",
"'/'",
"{",
"p",
"=",
"\"",
"\"",
"+",
"p",
"\n",
"}",
"\n",
"np",
":=",
"<mask>",
".",
"Clean",
"(",
"p",
")",
"\n",
"// path.Clean removes trailing slash except for root,",
"// put the trailing slash back if necessary.",
"if",
"p",
"[",
"len",
"(",
"p",
")",
"-",
"1",
"]",
"==",
"'/'",
"&&",
"np",
"!=",
"\"",
"\"",
"{",
"np",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"np",
"\n",
"}"
] |
7,280 | all-7281 | [
"GetSignatures",
"returns",
"the",
"image",
"s",
"signatures",
".",
"It",
"may",
"use",
"a",
"remote",
"(",
"=",
"slow",
")",
"service",
".",
"If",
"instanceDigest",
"is",
"not",
"nil",
"it",
"contains",
"a",
"digest",
"of",
"the",
"specific",
"manifest",
"instance",
"to",
"retrieve",
"signatures",
"for",
"(",
"when",
"the",
"primary",
"manifest",
"is",
"a",
"manifest",
"list",
")",
";",
"this",
"never",
"happens",
"if",
"the",
"primary",
"manifest",
"is",
"not",
"a",
"manifest",
"list",
"(",
"e",
".",
"g",
".",
"if",
"the",
"source",
"never",
"returns",
"manifest",
"lists",
")",
"."
] | [
"func",
"(",
"s",
"*",
"Source",
")",
"GetSignatures",
"(",
"ctx",
"context",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"[",
"]",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"instanceDigest",
"!=",
"nil",
"{",
"// How did we even get here? GetManifest(ctx, nil) has returned a manifest.DockerV2Schema2MediaType.",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"`Manifest lists are not supported by \"docker-daemon:\"`",
")",
"\n",
"}",
"\n",
"return",
"[",
"]",
"[",
"]",
"byte",
"{",
"}",
",",
"nil",
"\n",
"}"
] |
7,281 | all-7282 | [
"ObjectStat",
"gets",
"stats",
"for",
"the",
"DAG",
"object",
"named",
"by",
"key",
".",
"It",
"returns",
"the",
"stats",
"of",
"the",
"requested",
"Object",
"or",
"an",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"StatsBW",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"p2pmetrics",
".",
"Stats",
",",
"error",
")",
"{",
"v",
":=",
"&",
"p2pmetrics",
".",
"Stats",
"{",
"}",
"\n",
"err",
":=",
"s",
".",
"Request",
"(",
"\"",
"\"",
")",
".",
"Exec",
"(",
"ctx",
",",
"&",
"v",
")",
"\n",
"return",
"v",
",",
"err",
"\n",
"}"
] |
7,282 | all-7283 | [
"validateJobConfig",
"validates",
"if",
"all",
"the",
"jobspecs",
"/",
"presets",
"are",
"valid",
"if",
"you",
"are",
"mutating",
"the",
"jobs",
"please",
"add",
"it",
"to",
"finalizeJobConfig",
"above"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"validateJobConfig",
"(",
")",
"error",
"{",
"type",
"orgRepoJobName",
"struct",
"{",
"orgRepo",
",",
"jobName",
"string",
"\n",
"}",
"\n\n",
"// Validate presubmits.",
"// Checking that no duplicate job in prow config exists on the same org / repo / branch.",
"validPresubmits",
":=",
"map",
"[",
"orgRepoJobName",
"]",
"[",
"]",
"Presubmit",
"{",
"}",
"\n",
"for",
"repo",
",",
"jobs",
":=",
"range",
"c",
".",
"Presubmits",
"{",
"for",
"_",
",",
"job",
":=",
"range",
"jobs",
"{",
"repoJobName",
":=",
"orgRepoJobName",
"{",
"repo",
",",
"job",
".",
"Name",
"}",
"\n",
"for",
"_",
",",
"existingJob",
":=",
"range",
"validPresubmits",
"[",
"repoJobName",
"]",
"{",
"if",
"existingJob",
".",
"Brancher",
".",
"Intersects",
"(",
"job",
".",
"Brancher",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"validPresubmits",
"[",
"repoJobName",
"]",
"=",
"append",
"(",
"validPresubmits",
"[",
"repoJobName",
"]",
",",
"job",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"c",
".",
"AllPresubmits",
"(",
"nil",
")",
"{",
"if",
"err",
":=",
"validateJobBase",
"(",
"v",
".",
"JobBase",
",",
"prowapi",
".",
"PresubmitJob",
",",
"c",
".",
"PodNamespace",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"validateTriggering",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Validate postsubmits.",
"// Checking that no duplicate job in prow config exists on the same org / repo / branch.",
"validPostsubmits",
":=",
"<mask>",
"[",
"orgRepoJobName",
"]",
"[",
"]",
"Postsubmit",
"{",
"}",
"\n",
"for",
"repo",
",",
"jobs",
":=",
"range",
"c",
".",
"Postsubmits",
"{",
"for",
"_",
",",
"job",
":=",
"range",
"jobs",
"{",
"repoJobName",
":=",
"orgRepoJobName",
"{",
"repo",
",",
"job",
".",
"Name",
"}",
"\n",
"for",
"_",
",",
"existingJob",
":=",
"range",
"validPostsubmits",
"[",
"repoJobName",
"]",
"{",
"if",
"existingJob",
".",
"Brancher",
".",
"Intersects",
"(",
"job",
".",
"Brancher",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"validPostsubmits",
"[",
"repoJobName",
"]",
"=",
"append",
"(",
"validPostsubmits",
"[",
"repoJobName",
"]",
",",
"job",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"j",
":=",
"range",
"c",
".",
"AllPostsubmits",
"(",
"nil",
")",
"{",
"if",
"err",
":=",
"validateJobBase",
"(",
"j",
".",
"JobBase",
",",
"prowapi",
".",
"PostsubmitJob",
",",
"c",
".",
"PodNamespace",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// validate no duplicated periodics",
"validPeriodics",
":=",
"sets",
".",
"NewString",
"(",
")",
"\n",
"// Ensure that the periodic durations are valid and specs exist.",
"for",
"_",
",",
"p",
":=",
"range",
"c",
".",
"AllPeriodics",
"(",
")",
"{",
"if",
"validPeriodics",
".",
"Has",
"(",
"p",
".",
"Name",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
")",
"\n",
"}",
"\n",
"validPeriodics",
".",
"Insert",
"(",
"p",
".",
"Name",
")",
"\n",
"if",
"err",
":=",
"validateJobBase",
"(",
"p",
".",
"JobBase",
",",
"prowapi",
".",
"PeriodicJob",
",",
"c",
".",
"PodNamespace",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// Set the interval on the periodic jobs. It doesn't make sense to do this",
"// for child jobs.",
"for",
"j",
",",
"p",
":=",
"range",
"c",
".",
"Periodics",
"{",
"if",
"p",
".",
"Cron",
"!=",
"\"",
"\"",
"&&",
"p",
".",
"Interval",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
")",
"\n",
"}",
"else",
"if",
"p",
".",
"Cron",
"==",
"\"",
"\"",
"&&",
"p",
".",
"Interval",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
")",
"\n",
"}",
"else",
"if",
"p",
".",
"Cron",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"cron",
".",
"Parse",
"(",
"p",
".",
"Cron",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"Cron",
",",
"p",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"d",
",",
"err",
":=",
"time",
".",
"ParseDuration",
"(",
"c",
".",
"Periodics",
"[",
"j",
"]",
".",
"Interval",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"Periodics",
"[",
"j",
"]",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"c",
".",
"Periodics",
"[",
"j",
"]",
".",
"interval",
"=",
"d",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,283 | all-7284 | [
"HasLocked",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"HasLocked",
"(",
")",
"bool",
"{",
"if",
"o",
"!=",
"nil",
"&&",
"o",
".",
"Locked",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
7,284 | all-7285 | [
"GetPrecisionOk",
"returns",
"a",
"tuple",
"with",
"the",
"Precision",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetPrecisionOk",
"(",
")",
"(",
"PrecisionT",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Precision",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Precision",
",",
"true",
"\n",
"}"
] |
7,285 | all-7286 | [
"Parse",
"the",
"structure",
"declaration",
"with",
"the",
"given",
"name",
"found",
"in",
"the",
"given",
"Go",
"package",
"."
] | [
"func",
"Parse",
"(",
"pkg",
"*",
"ast",
".",
"Package",
",",
"name",
"string",
")",
"(",
"*",
"Mapping",
",",
"error",
")",
"{",
"str",
":=",
"findStruct",
"(",
"pkg",
".",
"Scope",
",",
"name",
")",
"\n",
"if",
"str",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"parseStruct",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"m",
":=",
"&",
"Mapping",
"{",
"Package",
":",
"pkg",
".",
"Name",
",",
"Name",
":",
"name",
",",
"Fields",
":",
"fields",
",",
"}",
"\n\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
7,286 | all-7287 | [
"getClientConfig",
"returns",
"the",
"config",
"for",
"the",
"ecr",
"client",
"based",
"on",
"authData"
] | [
"func",
"getClientConfig",
"(",
"httpClient",
"*",
"http",
".",
"Client",
",",
"authData",
"*",
"apicontainer",
".",
"ECRAuthData",
")",
"(",
"*",
"aws",
".",
"Config",
",",
"error",
")",
"{",
"cfg",
":=",
"aws",
".",
"NewConfig",
"(",
")",
".",
"WithRegion",
"(",
"authData",
".",
"Region",
")",
".",
"WithHTTPClient",
"(",
"httpClient",
")",
"\n",
"if",
"authData",
".",
"EndpointOverride",
"!=",
"\"",
"\"",
"{",
"cfg",
".",
"Endpoint",
"=",
"aws",
".",
"<mask>",
"(",
"authData",
".",
"EndpointOverride",
")",
"\n",
"}",
"\n\n",
"if",
"authData",
".",
"UseExecutionRole",
"{",
"if",
"authData",
".",
"GetPullCredentials",
"(",
")",
"==",
"(",
"credentials",
".",
"IAMRoleCredentials",
"{",
"}",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"creds",
":=",
"awscreds",
".",
"NewStaticCredentials",
"(",
"authData",
".",
"GetPullCredentials",
"(",
")",
".",
"AccessKeyID",
",",
"authData",
".",
"GetPullCredentials",
"(",
")",
".",
"SecretAccessKey",
",",
"authData",
".",
"GetPullCredentials",
"(",
")",
".",
"SessionToken",
")",
"\n",
"cfg",
"=",
"cfg",
".",
"WithCredentials",
"(",
"creds",
")",
"\n",
"}",
"\n\n",
"return",
"cfg",
",",
"nil",
"\n",
"}"
] |
7,287 | all-7288 | [
"constructNetworkConfig",
"takes",
"in",
"the",
"config",
"from",
"agent",
"and",
"construct",
"the",
"configuration",
"that",
"s",
"accepted",
"by",
"the",
"libcni"
] | [
"func",
"(",
"client",
"*",
"cniClient",
")",
"constructNetworkConfig",
"(",
"cfg",
"<mask>",
"{",
"}",
",",
"plugin",
"string",
")",
"(",
"*",
"libcni",
".",
"NetworkConfig",
",",
"error",
")",
"{",
"configBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"plugin",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"networkConfig",
":=",
"&",
"libcni",
".",
"NetworkConfig",
"{",
"Network",
":",
"&",
"cnitypes",
".",
"NetConf",
"{",
"Type",
":",
"plugin",
",",
"}",
",",
"Bytes",
":",
"configBytes",
",",
"}",
"\n\n",
"return",
"networkConfig",
",",
"nil",
"\n",
"}"
] |
7,288 | all-7289 | [
"HasId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"Dashboard",
")",
"HasId",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"Id",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
7,289 | all-7290 | [
"SessionUser",
"will",
"try",
"to",
"read",
"a",
"unique",
"user",
"ID",
"out",
"of",
"the",
"session",
".",
"Then",
"it",
"tries",
"to",
"populate",
"an",
"anonymous",
"user",
"object",
"from",
"the",
"database",
"based",
"on",
"that",
"ID",
".",
"If",
"this",
"is",
"successful",
"the",
"valid",
"user",
"is",
"mapped",
"into",
"the",
"context",
".",
"Otherwise",
"the",
"anonymous",
"user",
"is",
"mapped",
"into",
"the",
"contact",
".",
"The",
"newUser",
"()",
"function",
"should",
"provide",
"a",
"valid",
"0value",
"structure",
"for",
"the",
"caller",
"s",
"user",
"type",
"."
] | [
"func",
"SessionUser",
"(",
"newUser",
"func",
"(",
")",
"User",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"s",
"sessions",
".",
"Session",
",",
"c",
"martini",
".",
"Context",
",",
"l",
"*",
"log",
".",
"Logger",
")",
"{",
"userId",
":=",
"s",
".",
"Get",
"(",
"SessionKey",
")",
"\n",
"<mask>",
":=",
"newUser",
"(",
")",
"\n\n",
"if",
"userId",
"!=",
"nil",
"{",
"err",
":=",
"user",
".",
"GetById",
"(",
"userId",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"l",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"user",
".",
"Login",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"c",
".",
"MapTo",
"(",
"user",
",",
"(",
"*",
"User",
")",
"(",
"nil",
")",
")",
"\n",
"}",
"\n",
"}"
] |
7,290 | all-7291 | [
"GetLogset",
"returns",
"the",
"Logset",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"l",
"*",
"LogStreamDefinition",
")",
"GetLogset",
"(",
")",
"string",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"Logset",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"Logset",
"\n",
"}"
] |
7,291 | all-7292 | [
"schemaDVSCreateSpec",
"returns",
"schema",
"items",
"for",
"resources",
"that",
"need",
"to",
"work",
"with",
"a",
"DVSCreateSpec",
"."
] | [
"func",
"schemaDVSCreateSpec",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"s",
":=",
"<mask>",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"// DistributedVirtualSwitchProductSpec",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"Optional",
":",
"true",
",",
"ValidateFunc",
":",
"validation",
".",
"StringInSlice",
"(",
"dvsVersions",
",",
"false",
")",
",",
"}",
",",
"}",
"\n",
"structure",
".",
"MergeSchema",
"(",
"s",
",",
"schemaVMwareDVSConfigSpec",
"(",
")",
")",
"\n\n",
"return",
"s",
"\n",
"}"
] |
7,292 | all-7293 | [
"IsPaused",
"returns",
"whether",
"sending",
"log",
"entries",
"to",
"this",
"node",
"has",
"been",
"paused",
".",
"A",
"node",
"may",
"be",
"paused",
"because",
"it",
"has",
"rejected",
"recent",
"MsgApps",
"is",
"currently",
"waiting",
"for",
"a",
"snapshot",
"or",
"has",
"reached",
"the",
"MaxInflightMsgs",
"limit",
"."
] | [
"func",
"(",
"pr",
"*",
"Progress",
")",
"IsPaused",
"(",
")",
"bool",
"{",
"switch",
"pr",
".",
"State",
"{",
"case",
"ProgressStateProbe",
":",
"return",
"pr",
".",
"Paused",
"\n",
"case",
"ProgressStateReplicate",
":",
"return",
"pr",
".",
"ins",
".",
"full",
"(",
")",
"\n",
"<mask>",
"ProgressStateSnapshot",
":",
"return",
"true",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
7,293 | all-7294 | [
"SetKeyBytes",
"sets",
"cookie",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"SetKeyBytes",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"c",
".",
"key",
"=",
"append",
"(",
"c",
".",
"<mask>",
"[",
":",
"0",
"]",
",",
"key",
"...",
")",
"\n",
"}"
] |
7,294 | all-7295 | [
"SetupCertificates",
"opens",
"all",
".",
"crt",
".",
"cert",
"and",
".",
"key",
"files",
"in",
"dir",
"and",
"appends",
"/",
"loads",
"certs",
"and",
"key",
"pairs",
"as",
"appropriate",
"to",
"tlsc"
] | [
"func",
"SetupCertificates",
"(",
"dir",
"string",
",",
"tlsc",
"*",
"tls",
".",
"Config",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dir",
")",
"\n",
"fs",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"os",
".",
"IsPermission",
"(",
"err",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dir",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"fs",
"{",
"fullPath",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"f",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fullPath",
")",
"\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"fullPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// Dangling symbolic link?",
"// Race with someone who deleted the",
"// file after we read the directory's",
"// list of contents?",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"fullPath",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"tlsc",
".",
"RootCAs",
"==",
"nil",
"{",
"systemPool",
",",
"err",
":=",
"tlsconfig",
".",
"SystemCertPool",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"tlsc",
".",
"RootCAs",
"=",
"systemPool",
"\n",
"}",
"\n",
"tlsc",
".",
"RootCAs",
".",
"AppendCertsFromPEM",
"(",
"data",
")",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"f",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"certName",
":=",
"f",
".",
"Name",
"(",
")",
"\n",
"keyName",
":=",
"certName",
"[",
":",
"len",
"(",
"certName",
")",
"-",
"5",
"]",
"+",
"\"",
"\"",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fullPath",
")",
"\n",
"if",
"!",
"hasFile",
"(",
"fs",
",",
"keyName",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"keyName",
",",
"certName",
")",
"\n",
"}",
"\n",
"cert",
",",
"err",
":=",
"tls",
".",
"LoadX509KeyPair",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"certName",
")",
",",
"filepath",
".",
"Join",
"(",
"dir",
",",
"keyName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"tlsc",
".",
"Certificates",
"=",
"append",
"(",
"tlsc",
".",
"Certificates",
",",
"cert",
")",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"f",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"keyName",
":=",
"f",
".",
"Name",
"(",
")",
"\n",
"certName",
":=",
"keyName",
"[",
":",
"len",
"(",
"keyName",
")",
"-",
"4",
"]",
"+",
"\"",
"\"",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fullPath",
")",
"\n",
"if",
"!",
"hasFile",
"(",
"fs",
",",
"certName",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"certName",
",",
"keyName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,295 | all-7296 | [
"reducedSqueezeRow0",
"erforms",
"a",
"reduced",
"squeeze",
"operation",
"for",
"a",
"single",
"row",
"from",
"the",
"highest",
"to",
"the",
"lowest",
"index",
"using",
"the",
"reduced",
"-",
"round",
"Blake2b",
"s",
"G",
"function",
"as",
"the",
"internal",
"permutation"
] | [
"func",
"reducedSqueezeRow0",
"(",
"state",
"[",
"]",
"uint64",
",",
"rowOut",
"[",
"]",
"uint64",
",",
"nCols",
"int",
")",
"{",
"ptr",
":=",
"(",
"nCols",
"-",
"1",
")",
"*",
"blockLenInt64",
"\n",
"//M[row][C-1-col] = H.reduced_squeeze()",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"nCols",
";",
"i",
"++",
"{",
"ptrWord",
":=",
"rowOut",
"[",
"ptr",
":",
"]",
"//In Lyra2: pointer to M[0][C-1]",
"\n",
"ptrWord",
"[",
"0",
"]",
"=",
"state",
"[",
"0",
"]",
"\n",
"ptrWord",
"[",
"1",
"]",
"=",
"state",
"[",
"1",
"]",
"\n",
"ptrWord",
"[",
"2",
"]",
"=",
"state",
"[",
"2",
"]",
"\n",
"ptrWord",
"[",
"3",
"]",
"=",
"state",
"[",
"3",
"]",
"\n",
"ptrWord",
"[",
"4",
"]",
"=",
"state",
"[",
"4",
"]",
"\n",
"ptrWord",
"[",
"5",
"]",
"=",
"state",
"[",
"5",
"]",
"\n",
"ptrWord",
"[",
"6",
"]",
"=",
"state",
"[",
"6",
"]",
"\n",
"ptrWord",
"[",
"7",
"]",
"=",
"state",
"[",
"7",
"]",
"\n",
"ptrWord",
"[",
"8",
"]",
"=",
"state",
"[",
"8",
"]",
"\n",
"ptrWord",
"[",
"9",
"]",
"=",
"state",
"[",
"9",
"]",
"\n",
"ptrWord",
"[",
"10",
"]",
"=",
"<mask>",
"[",
"10",
"]",
"\n",
"ptrWord",
"[",
"11",
"]",
"=",
"state",
"[",
"11",
"]",
"\n\n",
"//Goes to next block (column) that will receive the squeezed data",
"ptr",
"-=",
"blockLenInt64",
"\n\n",
"//Applies the reduced-round transformation f to the sponge's state",
"reducedBlake2bLyra",
"(",
"state",
")",
"\n",
"}",
"\n",
"}"
] |
7,296 | all-7297 | [
"HandleLogout",
"handles",
"GitHub",
"logout",
"request",
"from",
"front",
"-",
"end",
".",
"It",
"invalidates",
"cookie",
"sessions",
"and",
"redirect",
"back",
"to",
"the",
"front",
"page",
"."
] | [
"func",
"(",
"ga",
"*",
"Agent",
")",
"HandleLogout",
"(",
"client",
"OAuthClient",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"accessTokenSession",
",",
"err",
":=",
"ga",
".",
"gc",
".",
"CookieStore",
".",
"Get",
"(",
"r",
",",
"tokenSession",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ga",
".",
"serverError",
"(",
"w",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"// Clear session",
"accessTokenSession",
".",
"Options",
".",
"MaxAge",
"=",
"-",
"1",
"\n",
"if",
"err",
":=",
"accessTokenSession",
".",
"Save",
"(",
"r",
",",
"w",
")",
";",
"err",
"!=",
"nil",
"{",
"ga",
".",
"serverError",
"(",
"w",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"loginCookie",
",",
"err",
":=",
"r",
".",
"Cookie",
"(",
"loginSession",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"loginCookie",
".",
"MaxAge",
"=",
"-",
"1",
"\n",
"loginCookie",
".",
"Expires",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"-",
"time",
".",
"Hour",
"*",
"24",
")",
"\n",
"<mask>",
".",
"SetCookie",
"(",
"w",
",",
"loginCookie",
")",
"\n",
"}",
"\n",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"ga",
".",
"gc",
".",
"FinalRedirectURL",
",",
"http",
".",
"StatusFound",
")",
"\n",
"}",
"\n",
"}"
] |
7,297 | all-7298 | [
"removeIDToContainerTaskUnsafe",
"removes",
"the",
"container",
"from",
"the",
"idToContainer",
"and",
"idToTask",
"maps",
".",
"They",
"key",
"to",
"the",
"maps",
"is",
"either",
"the",
"Docker",
"-",
"generated",
"ID",
"or",
"the",
"agent",
"-",
"generated",
"name",
"(",
"if",
"the",
"ID",
"is",
"not",
"available",
")",
".",
"This",
"function",
"assumes",
"that",
"the",
"ID",
"takes",
"precedence",
"and",
"will",
"delete",
"by",
"the",
"ID",
"when",
"the",
"ID",
"is",
"available",
"."
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"removeIDToContainerTaskUnsafe",
"(",
"container",
"*",
"apicontainer",
".",
"DockerContainer",
")",
"{",
"// The key to these maps is either the Docker ID or agent-generated name. We use the agent-generated name",
"// before a Docker ID is available.",
"key",
":=",
"container",
".",
"DockerID",
"\n",
"if",
"key",
"==",
"\"",
"\"",
"{",
"key",
"=",
"container",
".",
"DockerName",
"\n",
"}",
"\n",
"delete",
"(",
"state",
".",
"idToTask",
",",
"key",
")",
"\n",
"delete",
"(",
"state",
".",
"idToContainer",
",",
"<mask>",
")",
"\n",
"}"
] |
7,298 | all-7299 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RareStringData",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,299 | all-7300 | [
"specify",
"the",
"width",
"of",
"rasterized",
"lines"
] | [
"func",
"LineWidth",
"(",
"width",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpLineWidth",
",",
"1",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"<mask>",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.