id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
13,000
all-13001
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "StreamFormat", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
13,001
all-13002
[ "NewDecoder", "creates", "a", "new", "Decoder", "using", "a", "type", "Registry", "and", "an", "io", ".", "Reader", "." ]
[ "func", "NewDecoder", "(", "reg", "Registry", ",", "r", "<mask>", ".", "Reader", ")", "Decoder", "{", "var", "buf", "[", "]", "byte", "\n", "return", "decoder", "{", "reg", ",", "DefaultMaxSize", ",", "bytes", ".", "NewBuffer", "(", "buf", ")", ",", "bufio", ".", "NewReader", "(", "r", ")", "}", "\n", "}" ]
13,002
all-13003
[ "lintHistogramSummaryReserved", "detects", "when", "other", "types", "of", "metrics", "use", "names", "or", "labels", "reserved", "for", "use", "by", "histograms", "and", "/", "or", "summaries", "." ]
[ "func", "lintHistogramSummaryReserved", "(", "mf", "dto", ".", "MetricFamily", ")", "[", "]", "Problem", "{", "// These rules do not apply to untyped metrics.", "t", ":=", "mf", ".", "GetType", "(", ")", "\n", "if", "t", "==", "dto", ".", "MetricType_UNTYPED", "{", "return", "nil", "\n", "}", "\n\n", "var", "problems", "problems", "\n\n", "isHistogram", ":=", "t", "==", "dto", ".", "MetricType_HISTOGRAM", "\n", "isSummary", ":=", "t", "==", "dto", ".", "MetricType_SUMMARY", "\n\n", "n", ":=", "mf", ".", "GetName", "(", ")", "\n\n", "if", "!", "isHistogram", "&&", "strings", ".", "HasSuffix", "(", "n", ",", "\"", "\"", ")", "{", "problems", ".", "Add", "(", "mf", ",", "`non-histogram metrics should not have \"_bucket\" suffix`", ")", "\n", "}", "\n", "if", "!", "isHistogram", "&&", "!", "isSummary", "&&", "strings", ".", "HasSuffix", "(", "n", ",", "\"", "\"", ")", "{", "problems", ".", "Add", "(", "mf", ",", "`non-histogram and non-summary metrics should not have \"_count\" suffix`", ")", "\n", "}", "\n", "if", "!", "isHistogram", "&&", "!", "isSummary", "&&", "strings", ".", "HasSuffix", "(", "n", ",", "\"", "\"", ")", "{", "problems", ".", "Add", "(", "mf", ",", "`non-histogram and non-summary metrics should not have \"_sum\" suffix`", ")", "\n", "}", "\n\n", "for", "_", ",", "m", ":=", "range", "mf", ".", "GetMetric", "(", ")", "{", "for", "_", ",", "l", ":=", "<mask>", "m", ".", "GetLabel", "(", ")", "{", "ln", ":=", "l", ".", "GetName", "(", ")", "\n\n", "if", "!", "isHistogram", "&&", "ln", "==", "\"", "\"", "{", "problems", ".", "Add", "(", "mf", ",", "`non-histogram metrics should not have \"le\" label`", ")", "\n", "}", "\n", "if", "!", "isSummary", "&&", "ln", "==", "\"", "\"", "{", "problems", ".", "Add", "(", "mf", ",", "`non-summary metrics should not have \"quantile\" label`", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "problems", "\n", "}" ]
13,003
all-13004
[ "/", "*", "Get3D", "return", "a", "specific", "element", "from", "a", "3", "-", "dimensional", "matrix", "." ]
[ "func", "(", "m", "*", "Mat", ")", "Get3D", "(", "x", ",", "y", ",", "z", "int", ")", "Scalar", "{", "<mask>", ":=", "C", ".", "cvGet3D", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "C", ".", "int", "(", "x", ")", ",", "C", ".", "int", "(", "y", ")", ",", "C", ".", "int", "(", "z", ")", ")", "\n", "return", "Scalar", "(", "ret", ")", "\n", "}" ]
13,004
all-13005
[ "Scope", "is", "an", "option", "that", "adds", "a", "Scope", "(", "scope", ")", "field", "to", "generated", "tokens", ".", "Scopes", "are", "joined", "with", "a", "space", "(", ")", "separator", "." ]
[ "func", "Scope", "(", "scopes", "...", "string", ")", "Option", "{", "return", "func", "(", "tok", "*", "Bearer", ")", "error", "{", "if", "len", "(", "scopes", ")", ">", "0", "{", "<mask>", "Claim", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "scopes", ",", "\"", "\"", ")", ")", "(", "tok", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "}" ]
13,005
all-13006
[ "NewMockECRClient", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockECRClient", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockECRClient", "{", "mock", ":=", "&", "MockECRClient", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockECRClientMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
13,006
all-13007
[ "FromAuthHeader", "is", "a", "TokenExtractor", "that", "takes", "a", "give", "request", "and", "extracts", "the", "JWT", "token", "from", "the", "Authorization", "header", "." ]
[ "func", "FromAuthHeader", "(", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "authHeader", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "authHeader", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "nil", "// No error, just no token", "\n", "}", "\n\n", "// TODO: Make this a bit more robust, parsing-wise", "authHeaderParts", ":=", "strings", ".", "Split", "(", "authHeader", ",", "\"", "\"", ")", "\n", "if", "len", "(", "authHeaderParts", ")", "!=", "2", "||", "strings", ".", "ToLower", "(", "authHeaderParts", "[", "0", "]", ")", "!=", "\"", "\"", "{", "return", "\"", "\"", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "authHeaderParts", "[", "1", "]", ",", "nil", "\n", "}" ]
13,007
all-13008
[ "*", "*", "*", "Get", "returns", "the", "string", "value", "for", "a", "given", "key", "." ]
[ "func", "(", "c", "*", "Config", ")", "Get", "(", "key", "string", ")", "(", "string", ",", "error", ")", "{", "if", "value", ",", "<mask>", ":=", "c", ".", "data", "[", "key", "]", ";", "found", "{", "return", "value", ",", "nil", "\n", "}", "\n", "return", "\"", "\"", ",", "ErrKey", "\n", "}" ]
13,008
all-13009
[ "DevLxdServer", "creates", "an", "http", ".", "Server", "capable", "of", "handling", "requests", "against", "the", "/", "dev", "/", "lxd", "Unix", "socket", "endpoint", "created", "inside", "containers", "." ]
[ "func", "DevLxdServer", "(", "d", "*", "Daemon", ")", "*", "http", ".", "Server", "{", "return", "&", "<mask>", ".", "Server", "{", "Handler", ":", "devLxdAPI", "(", "d", ")", ",", "ConnState", ":", "pidMapper", ".", "ConnStateHandler", ",", "}", "\n", "}" ]
13,009
all-13010
[ "Run", "implements", "the", "Discoverer", "interface", "." ]
[ "func", "(", "d", "*", "Discovery", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "ch", "chan", "<-", "[", "]", "*", "targetgroup", ".", "Group", ")", "{", "// Get an initial set right away.", "tgs", ",", "err", ":=", "d", ".", "refresh", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "else", "{", "select", "{", "case", "ch", "<-", "tgs", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n\n", "ticker", ":=", "time", ".", "NewTicker", "(", "d", ".", "interval", ")", "\n", "defer", "ticker", ".", "Stop", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ":", "tgs", ",", "err", ":=", "d", ".", "refresh", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "continue", "\n", "}", "\n\n", "select", "{", "case", "ch", "<-", "tgs", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
13,010
all-13011
[ "SetHostNotificationNumber", "creates", "a", "new", "SET_HOST_NOTIFICATION_NUMBER", "Nagios", "command", ".", "Sets", "the", "current", "notification", "number", "for", "a", "particular", "host", ".", "A", "value", "of", "0", "indicates", "that", "no", "notification", "has", "yet", "been", "sent", "for", "the", "current", "host", "problem", ".", "Useful", "for", "forcing", "an", "escalation", "(", "based", "on", "notification", "number", ")", "or", "replicating", "notification", "information", "in", "redundant", "monitoring", "environments", ".", "Notification", "numbers", "greater", "than", "zero", "have", "no", "noticeable", "affect", "on", "the", "notification", "process", "if", "the", "host", "is", "currently", "in", "an", "UP", "state", "." ]
[ "func", "SetHostNotificationNumber", "(", "host_name", "<mask>", ",", "notification_number", "int", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "notification_number", ")", ",", ")", "\n", "}" ]
13,011
all-13012
[ "EtcdStorageClass", "creates", "a", "storage", "class", "used", "for", "dynamic", "volume", "provisioning", ".", "Currently", "dynamic", "volume", "provisioning", "only", "works", "on", "AWS", "and", "GCE", "." ]
[ "func", "EtcdStorageClass", "(", "opts", "*", "AssetOpts", ",", "backend", "backend", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "sc", ":=", "map", "[", "string", "]", "<mask>", "{", "}", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "defaultEtcdStorageClassName", ",", "\"", "\"", ":", "labels", "(", "etcdName", ")", ",", "\"", "\"", ":", "opts", ".", "Namespace", ",", "}", ",", "}", "\n", "switch", "backend", "{", "case", "googleBackend", ":", "sc", "[", "\"", "\"", "]", "=", "\"", "\"", "\n", "sc", "[", "\"", "\"", "]", "=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "}", "\n", "case", "amazonBackend", ":", "sc", "[", "\"", "\"", "]", "=", "\"", "\"", "\n", "sc", "[", "\"", "\"", "]", "=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "}", "\n", "default", ":", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "sc", ",", "nil", "\n", "}" ]
13,012
all-13013
[ "======================================================================================================================", "Trace", "log" ]
[ "func", "(", "f", "*", "FileLogger", ")", "Trace", "(", "<mask>", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "_", ",", "file", ",", "line", ",", "_", ":=", "runtime", ".", "Caller", "(", "2", ")", "//calldepth=3", "\n", "if", "f", ".", "logLevel", "<=", "TRACE", "{", "f", ".", "logChan", "<-", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "shortFileName", "(", "file", ")", ",", "line", ")", "+", "fmt", ".", "Sprintf", "(", "\"", "\\033", "\"", "+", "format", "+", "\"", "\\033", "\"", ",", "v", "...", ")", "\n", "}", "\n", "}" ]
13,013
all-13014
[ "ChecksumString64S", "returns", "the", "checksum", "of", "the", "input", "data", "without", "creating", "a", "copy", "with", "the", "specific", "seed", "." ]
[ "func", "ChecksumString64S", "(", "s", "string", ",", "seed", "uint64", ")", "uint64", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "Checksum64S", "(", "nil", ",", "seed", ")", "\n", "}", "\n\n", "<mask>", ":=", "(", "*", "reflect", ".", "StringHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "s", ")", ")", "\n", "return", "Checksum64S", "(", "(", "*", "[", "maxInt32", "]", "byte", ")", "(", "unsafe", ".", "Pointer", "(", "ss", ".", "Data", ")", ")", "[", ":", "len", "(", "s", ")", ":", "len", "(", "s", ")", "]", ",", "seed", ")", "\n", "}" ]
13,014
all-13015
[ "/", "*", "StringFromSection", "looks", "for", "the", "specified", "key", "and", "returns", "it", "as", "a", "string", ".", "If", "not", "found", "the", "default", "value", "def", "is", "returned", "." ]
[ "func", "(", "config", "*", "Config", ")", "StringFromSection", "(", "sectionName", "string", ",", "key", "string", ",", "def", "string", ")", "string", "{", "<mask>", ":=", "config", ".", "sectionForName", "(", "sectionName", ")", "\n\n", "if", "section", "!=", "nil", "{", "return", "getString", "(", "section", ".", "values", ",", "key", ",", "def", ")", "\n", "}", "\n\n", "return", "def", "\n", "}" ]
13,015
all-13016
[ "merge", "produces", "a", "singe", "list", "of", "records", "that", "can", "be", "used", "as", "a", "replacement", ".", "Dyn", "allows", "to", "replace", "all", "records", "with", "a", "single", "call", "Invariant", ":", "the", "result", "contains", "only", "elements", "from", "the", "updateNew", "parameter" ]
[ "func", "merge", "(", "updateOld", ",", "updateNew", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "findMatch", ":=", "func", "(", "template", "*", "endpoint", ".", "Endpoint", ")", "*", "endpoint", ".", "Endpoint", "{", "for", "_", ",", "new", ":=", "range", "updateNew", "{", "if", "template", ".", "DNSName", "==", "new", ".", "DNSName", "&&", "template", ".", "RecordType", "==", "new", ".", "RecordType", "{", "return", "new", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "var", "result", "[", "]", "*", "endpoint", ".", "Endpoint", "\n", "for", "_", ",", "old", ":=", "range", "updateOld", "{", "matchingNew", ":=", "findMatch", "(", "old", ")", "\n", "if", "matchingNew", "==", "nil", "{", "// no match, shouldn't happen", "continue", "\n", "}", "\n\n", "if", "!", "matchingNew", ".", "Targets", ".", "Same", "(", "old", ".", "Targets", ")", "{", "// new target: always update, TTL will be overwritten too if necessary", "result", "=", "append", "(", "result", ",", "matchingNew", ")", "\n", "continue", "\n", "}", "\n\n", "if", "matchingNew", ".", "RecordTTL", "!=", "0", "&&", "matchingNew", ".", "RecordTTL", "!=", "<mask>", ".", "RecordTTL", "{", "// same target, but new non-zero TTL set in k8s, must update", "// probably would happen only if there is a bug in the code calling the provider", "result", "=", "append", "(", "result", ",", "matchingNew", ")", "\n", "}", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
13,016
all-13017
[ "Add", "event", "to", "eventlog" ]
[ "func", "(", "e", "*", "EventLog", ")", "Add", "(", "ev", "*", "Event", ")", "{", "ev", ".", "ID", "=", "[", "]", "byte", "(", "e", ".", "currentindex", "(", ")", ")", "\n", "ev", ".", "timestamp", "=", "time", ".", "Now", "(", ")", "\n", "(", "*", "e", ")", "=", "<mask>", "(", "(", "*", "e", ")", ",", "ev", ")", "\n", "}" ]
13,017
all-13018
[ "/", "*", "TODO", ":", "uncomment", "when", "timebased", "billing", "will", "be", "implemented", "VerifySecondsBasedChannels", "checks", "all", "active", "seconds", "based", "channels", "for", "not", "using", "more", "units", "than", "provided", "by", "quota", "and", "not", "exceeding", "over", "total", "deposit", ".", "func", "(", "m", "*", "Monitor", ")", "VerifySecondsBasedChannels", "()", "error", "{", "Selects", "all", "channels", "which", "1", ".", "used", "tokens", ">", "=", "deposit", "tokens", "2", ".", "total", "consumed", "seconds", ">", "=", "max", "offer", "units", "(", "seconds", "in", "this", "case", ")", "Only", "checks", "channels", "which", "corresponding", "offers", "are", "using", "seconds", "as", "billing", "basis", ".", "query", ":", "=", "SELECT", "channels", ".", "id", "::", "text", "FROM", "channels", "LEFT", "JOIN", "sessions", "ses", "ON", "channels", ".", "id", "=", "ses", ".", "channel" ]
[ "func", "(", "m", "*", "Monitor", ")", "VerifyUnitsBasedChannels", "(", ")", "error", "{", "<mask>", ":=", "`\n SELECT channels.id::text\n\t\tFROM channels\n LEFT JOIN sessions ses\n ON channels.id = ses.channel\n\n LEFT JOIN offerings offer\n ON channels.offering = offer.id\n INNER JOIN accounts acc\n ON channels.agent = acc.eth_addr\n WHERE channels.service_status IN ('pending', 'active')\n AND channels.channel_status NOT IN ('pending')\n AND offer.unit_type = 'units'\n AND acc.in_use\n GROUP BY channels.id, offer.setup_price,\n offer.unit_price, offer.max_unit\n HAVING offer.setup_price + coalesce(sum(ses.units_used), 0) * offer.unit_price >= channels.total_deposit\n OR COALESCE(SUM(ses.units_used), 0) >= offer.max_unit;`", "\n\n", "return", "m", ".", "processEachChannel", "(", "query", ",", "m", ".", "terminateService", ")", "\n", "}" ]
13,018
all-13019
[ "Sub", "removes", "all", "elements", "in", "other", "from", "the", "set" ]
[ "func", "(", "us", "*", "unsafeSet", ")", "Sub", "(", "other", "Set", ")", "Set", "{", "oValues", ":=", "other", ".", "Values", "(", ")", "\n", "result", ":=", "us", ".", "Copy", "(", ")", ".", "(", "*", "unsafeSet", ")", "\n\n", "for", "_", ",", "val", ":=", "range", "oValues", "{", "if", "_", ",", "ok", ":=", "result", ".", "d", "[", "val", "]", ";", "!", "ok", "{", "continue", "\n", "}", "\n", "delete", "(", "<mask>", ".", "d", ",", "val", ")", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
13,019
all-13020
[ "fetchLoop", "is", "run", "in", "a", "goroutine" ]
[ "func", "(", "mp", "*", "master", ")", "fetchLoop", "(", ")", "{", "min", ":=", "mp", ".", "Config", ".", "MinFetchInterval", "\n", "time", ".", "Sleep", "(", "<mask>", ")", "\n", "for", "{", "t0", ":=", "time", ".", "Now", "(", ")", "\n", "mp", ".", "fetch", "(", ")", "\n", "//duration fetch of fetch", "diff", ":=", "time", ".", "Now", "(", ")", ".", "Sub", "(", "t0", ")", "\n", "if", "diff", "<", "min", "{", "delay", ":=", "min", "-", "diff", "\n", "//ensures at least MinFetchInterval delay.", "//should be throttled by the fetcher!", "time", ".", "Sleep", "(", "delay", ")", "\n", "}", "\n", "}", "\n", "}" ]
13,020
all-13021
[ "LoadFromData", "accepts", "raw", "data", "directly", "from", "memory", "and", "returns", "a", "new", "configuration", "representation", ".", "Note", "that", "the", "configuration", "is", "written", "to", "the", "system", "temporary", "folder", "so", "your", "file", "should", "not", "contain", "sensitive", "information", "." ]
[ "func", "LoadFromData", "(", "data", "[", "]", "byte", ")", "(", "c", "*", "ConfigFile", ",", "err", "error", ")", "{", "// Save memory data to temporary file to support further operations.", "tmpName", ":=", "path", ".", "Join", "(", "os", ".", "TempDir", "(", ")", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "Now", "(", ")", ".", "Nanosecond", "(", ")", ")", ")", "\n", "if", "err", "=", "os", ".", "MkdirAll", "(", "path", ".", "Dir", "(", "tmpName", ")", ",", "os", ".", "ModePerm", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "ioutil", ".", "WriteFile", "(", "tmpName", ",", "data", ",", "0655", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "c", "=", "newConfigFile", "(", "[", "]", "string", "{", "tmpName", "}", ")", "\n", "err", "=", "c", ".", "read", "(", "bytes", ".", "NewBuffer", "(", "data", ")", ")", "\n", "return", "c", ",", "err", "\n", "}" ]
13,021
all-13022
[ "HasCompute", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetApmOrLogQuery", ")", "HasCompute", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Compute", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
13,022
all-13023
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Profile", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
13,023
all-13024
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "CaptureScreenshotFormat", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
13,024
all-13025
[ "Disables", "snapshots", "for", "a", "specific", "block", "volume", "at", "a", "given", "schedule", ".", "volumeId", ":", "The", "id", "of", "the", "volume", "scheduleType", ":", "HOURLY", "|", "DAILY", "|", "WEEKLY" ]
[ "func", "(", "c", "*", "ClientManager", ")", "DisableSnapshots", "(", "volumeId", "int", ",", "scheduleType", "string", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "StorageService", ".", "Id", "(", "volumeId", ")", ".", "DisableSnapshots", "(", "sl", ".", "<mask>", "(", "scheduleType", ")", ")", "\n", "return", "err", "\n", "}" ]
13,025
all-13026
[ "SetLocalOnly", "is", "a", "wrapper", "around", "gtk_file_chooser_set_local_only", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "SetLocalOnly", "(", "value", "bool", ")", "{", "C", ".", "gtk_file_chooser_set_local_only", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "<mask>", ")", ")", "\n", "}" ]
13,026
all-13027
[ "GetLineYrange", "is", "a", "wrapper", "around", "gtk_text_view_get_line_yrange", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "GetLineYrange", "(", "iter", "*", "TextIter", ")", "(", "y", ",", "<mask>", "int", ")", "{", "var", "yx", ",", "heightx", "C", ".", "gint", "\n", "C", ".", "gtk_text_view_get_line_yrange", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ",", "&", "yx", ",", "&", "heightx", ")", "\n", "return", "int", "(", "yx", ")", ",", "int", "(", "heightx", ")", "\n", "}" ]
13,027
all-13028
[ "SetMessage", "sets", "the", "message", "file", "for", "localization", "." ]
[ "func", "SetMessage", "(", "lang", ",", "filePath", "<mask>", ",", "appendFiles", "...", "string", ")", "error", "{", "return", "SetMessageWithDesc", "(", "lang", ",", "lang", ",", "filePath", ",", "appendFiles", "...", ")", "\n", "}" ]
13,028
all-13029
[ "NewKV", "wraps", "a", "KV", "instance", "so", "that", "all", "requests", "are", "wired", "through", "a", "leasing", "protocol", "." ]
[ "func", "NewKV", "(", "cl", "*", "v3", ".", "Client", ",", "pfx", "string", ",", "opts", "...", "concurrency", ".", "SessionOption", ")", "(", "v3", ".", "KV", ",", "func", "(", ")", ",", "error", ")", "{", "cctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "cl", ".", "Ctx", "(", ")", ")", "\n", "lkv", ":=", "&", "leasingKV", "{", "cl", ":", "cl", ",", "kv", ":", "cl", ".", "KV", ",", "pfx", ":", "pfx", ",", "leases", ":", "leaseCache", "{", "revokes", ":", "<mask>", "(", "map", "[", "string", "]", "time", ".", "Time", ")", "}", ",", "ctx", ":", "cctx", ",", "cancel", ":", "cancel", ",", "sessionOpts", ":", "opts", ",", "sessionc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "lkv", ".", "wg", ".", "Add", "(", "2", ")", "\n", "go", "func", "(", ")", "{", "defer", "lkv", ".", "wg", ".", "Done", "(", ")", "\n", "lkv", ".", "monitorSession", "(", ")", "\n", "}", "(", ")", "\n", "go", "func", "(", ")", "{", "defer", "lkv", ".", "wg", ".", "Done", "(", ")", "\n", "lkv", ".", "leases", ".", "clearOldRevokes", "(", "cctx", ")", "\n", "}", "(", ")", "\n", "return", "lkv", ",", "lkv", ".", "Close", ",", "lkv", ".", "waitSession", "(", "cctx", ")", "\n", "}" ]
13,029
all-13030
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetAppManifestReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage42", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
13,030
all-13031
[ "NewBasicAuthenticator", "returns", "a", "authenticator", "that", "uses", "email", "and", "password", "to", "create", "sessions", ".", "The", "returned", "authenticator", "takes", "care", "of", "refreshing", "the", "RightScale", "session", "as", "needed", "." ]
[ "func", "NewBasicAuthenticator", "(", "username", ",", "password", "string", ",", "accountID", "int", ")", "Authenticator", "{", "builder", ":=", "basicLoginRequestBuilder", "{", "username", ":", "username", ",", "password", ":", "password", ",", "accountID", ":", "accountID", "}", "\n", "return", "newCookieSigner", "(", "&", "<mask>", ",", "accountID", ")", "\n", "}" ]
13,031
all-13032
[ "expandVMwareUplinkLacpPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "VMwareUplinkLacpPolicy", "." ]
[ "func", "expandVMwareUplinkLacpPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "<mask>", ".", "VMwareUplinkLacpPolicy", "{", "obj", ":=", "&", "types", ".", "VMwareUplinkLacpPolicy", "{", "Enable", ":", "structure", ".", "GetBoolPolicy", "(", "d", ",", "\"", "\"", ")", ",", "Mode", ":", "structure", ".", "GetStringPolicy", "(", "d", ",", "\"", "\"", ")", ",", "}", "\n\n", "if", "structure", ".", "AllFieldsEmpty", "(", "obj", ")", "{", "return", "nil", "\n", "}", "\n", "return", "obj", "\n", "}" ]
13,032
all-13033
[ "Events", "are", "music", "and", "movie", "events", "at", "this", "venue", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "events" ]
[ "func", "(", "s", "*", "VenueService", ")", "Events", "(", "id", "string", ")", "(", "*", "Events", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "events", ":=", "new", "(", "venueEventResp", ")", "\n", "response", ":=", "new", "(", "<mask>", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "id", "+", "\"", "\"", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "events", ")", "\n", "}", "\n\n", "return", "&", "events", ".", "Events", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
13,033
all-13034
[ "RealNetIP", "returns", "the", "real", "local", "IP", "of", "the", "system", "or", "an", "empty", "string", "." ]
[ "func", "RealNetIP", "(", ")", "string", "{", "addrs", ",", "err", ":=", "net", ".", "InterfaceAddrs", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "err", ")", "\n", "return", "\"", "\"", "\n", "}", "\n\n", "// get real local IP", "for", "_", ",", "address", ":=", "range", "addrs", "{", "if", "ipnet", ",", "ok", ":=", "address", ".", "(", "*", "net", ".", "IPNet", ")", ";", "<mask>", "&&", "!", "ipnet", ".", "IP", ".", "IsLoopback", "(", ")", "{", "if", "ipnet", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "return", "ipnet", ".", "IP", ".", "String", "(", ")", "\n", "}", "\n\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
13,034
all-13035
[ "Remove", "finds", "a", "single", "document", "matching", "the", "provided", "selector", "document", "and", "removes", "it", "from", "the", "database", ".", "If", "the", "session", "is", "in", "safe", "mode", "(", "see", "SetSafe", ")", "a", "ErrNotFound", "error", "is", "returned", "if", "a", "document", "isn", "t", "found", "or", "a", "value", "of", "type", "*", "LastError", "when", "some", "other", "error", "is", "detected", ".", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Removing" ]
[ "func", "(", "c", "*", "Collection", ")", "Remove", "(", "selector", "<mask>", "{", "}", ")", "error", "{", "lerr", ",", "err", ":=", "c", ".", "writeQuery", "(", "&", "deleteOp", "{", "c", ".", "FullName", ",", "selector", ",", "1", "}", ")", "\n", "if", "err", "==", "nil", "&&", "lerr", "!=", "nil", "&&", "lerr", ".", "N", "==", "0", "{", "return", "ErrNotFound", "\n", "}", "\n", "return", "err", "\n", "}" ]
13,035
all-13036
[ "ValidatePolicyConfigurationScope", "checks", "that", "scope", "is", "a", "valid", "name", "for", "a", "signature", ".", "PolicyTransportScopes", "keys", "(", "i", ".", "e", ".", "a", "valid", "PolicyConfigurationIdentity", "()", "or", "PolicyConfigurationNamespaces", "()", "return", "value", ")", ".", "It", "is", "acceptable", "to", "allow", "an", "invalid", "value", "which", "will", "never", "be", "matched", "it", "can", "only", "cause", "user", "confusion", ".", "scope", "passed", "to", "this", "function", "will", "not", "be", "that", "value", "is", "always", "allowed", "." ]
[ "func", "(", "t", "openshiftTransport", ")", "ValidatePolicyConfigurationScope", "(", "<mask>", "string", ")", "error", "{", "if", "scopeRegexp", ".", "FindStringIndex", "(", "scope", ")", "==", "nil", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "scope", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,036
all-13037
[ "gitCmd", "performs", "a", "git", "command", "." ]
[ "func", "(", "r", "*", "Repo", ")", "gitCmd", "(", "params", "[", "]", "string", ",", "dir", "string", ")", "error", "{", "// if key is specified, use ssh key", "if", "r", ".", "KeyPath", "!=", "\"", "\"", "{", "return", "r", ".", "gitCmdWithKey", "(", "params", ",", "dir", ")", "\n", "}", "\n", "<mask>", "runCmd", "(", "gitBinary", ",", "params", ",", "dir", ")", "\n", "}" ]
13,037
all-13038
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
[ "func", "(", "in", "*", "App", ")", "DeepCopyInto", "(", "out", "*", "App", ")", "{", "*", "out", "=", "*", "in", "\n", "out", ".", "TypeMeta", "=", "<mask>", ".", "TypeMeta", "\n", "in", ".", "ObjectMeta", ".", "DeepCopyInto", "(", "&", "out", ".", "ObjectMeta", ")", "\n", "in", ".", "Spec", ".", "DeepCopyInto", "(", "&", "out", ".", "Spec", ")", "\n", "return", "\n", "}" ]
13,038
all-13039
[ "Update", "takes", "the", "representation", "of", "a", "prowJob", "and", "updates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "prowJob", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "prowJobs", ")", "Update", "(", "prowJob", "*", "v1", ".", "ProwJob", ")", "(", "result", "*", "v1", ".", "ProwJob", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "ProwJob", "{", "}", "\n", "err", "=", "c", ".", "client", ".", "Put", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "Name", "(", "prowJob", ".", "<mask>", ")", ".", "Body", "(", "prowJob", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
13,039
all-13040
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListStringOption", ")", "<mask>", "(", "value", "string", ")", "error", "{", "val", ":=", "StringOption", "{", "}", "\n", "val", ".", "Set", "(", "value", ")", "\n", "*", "o", "=", "append", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
13,040
all-13041
[ "IsResourceInUseError", "checks", "an", "error", "to", "see", "if", "it", "s", "of", "the", "ResourceInUse", "type", "." ]
[ "func", "IsResourceInUseError", "(", "err", "error", ")", "bool", "{", "if", "f", ",", "ok", ":=", "vimSoapFault", "(", "err", ")", ";", "<mask>", "{", "if", "_", ",", "ok", ":=", "f", ".", "(", "types", ".", "ResourceInUse", ")", ";", "ok", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
13,041
all-13042
[ "GetValueOk", "returns", "a", "tuple", "with", "the", "Value", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "p", "*", "Period", ")", "GetValueOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "p", "==", "nil", "||", "p", ".", "Value", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "p", ".", "<mask>", ",", "true", "\n", "}" ]
13,042
all-13043
[ "WithDryRun", "if", "true", "the", "change", "will", "not", "actually", "be", "applied", ".", "Dry", "run", "may", "be", "used", "to", "get", "result", "description", "without", "actually", "modifying", "the", "code", "." ]
[ "func", "(", "p", "SetScriptSourceParams", ")", "WithDryRun", "(", "dryRun", "bool", ")", "*", "SetScriptSourceParams", "{", "p", ".", "DryRun", "=", "dryRun", "\n", "<mask>", "&", "p", "\n", "}" ]
13,043
all-13044
[ "flattenHostNetworkTrafficShapingPolicy", "reads", "various", "fields", "from", "a", "HostNetworkTrafficShapingPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenHostNetworkTrafficShapingPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "HostNetworkTrafficShapingPolicy", ")", "error", "{", "if", "obj", ".", "Enabled", "!=", "nil", "{", "d", ".", "Set", "(", "\"", "\"", ",", "*", "obj", ".", "Enabled", ")", "\n", "}", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "AverageBandwidth", ")", "\n", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "BurstSize", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "PeakBandwidth", ")", "\n", "return", "nil", "\n", "}" ]
13,044
all-13045
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "HideHighlightParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
13,045
all-13046
[ "VerifyReferencesValidator", "makes", "sure", "all", "references", "in", "the", "document", "are", "existing", "by", "counting", "the", "references", "on", "the", "related", "collections", ".", "References", "are", "defined", "by", "passing", "pairs", "of", "fields", "and", "models", "who", "might", "be", "referenced", "by", "the", "current", "model", ":", "fire", ".", "VerifyReferencesValidator", "(", "map", "[", "string", "]", "coal", ".", "Model", "{", "Post", ":", "&Post", "{}", "Author", ":", "&User", "{}", "}", ")", "The", "callbacks", "supports", "to", "-", "one", "optional", "to", "-", "one", "and", "to", "-", "many", "relationships", "." ]
[ "func", "VerifyReferencesValidator", "(", "pairs", "map", "[", "string", "]", "coal", ".", "Model", ")", "*", "Callback", "{", "return", "C", "(", "\"", "\"", ",", "Only", "(", "Create", ",", "Update", ")", ",", "func", "(", "ctx", "*", "Context", ")", "error", "{", "// check all references", "for", "field", ",", "collection", ":=", "range", "pairs", "{", "// read referenced id", "ref", ":=", "ctx", ".", "Model", ".", "MustGet", "(", "<mask>", ")", "\n\n", "// continue if reference is not set", "if", "oid", ",", "ok", ":=", "ref", ".", "(", "*", "bson", ".", "ObjectId", ")", ";", "ok", "&&", "oid", "==", "nil", "{", "continue", "\n", "}", "\n\n", "// continue if slice is empty", "if", "ids", ",", "ok", ":=", "ref", ".", "(", "[", "]", "bson", ".", "ObjectId", ")", ";", "ok", "&&", "ids", "==", "nil", "{", "continue", "\n", "}", "\n\n", "// handle to-many relationships", "if", "ids", ",", "ok", ":=", "ref", ".", "(", "[", "]", "bson", ".", "ObjectId", ")", ";", "ok", "{", "// prepare query", "query", ":=", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "ids", "}", "}", "\n\n", "// count entities in database", "ctx", ".", "Tracer", ".", "Push", "(", "\"", "\"", ")", "\n", "ctx", ".", "Tracer", ".", "Tag", "(", "\"", "\"", ",", "query", ")", "\n", "n", ",", "err", ":=", "ctx", ".", "Store", ".", "DB", "(", ")", ".", "C", "(", "coal", ".", "C", "(", "collection", ")", ")", ".", "Find", "(", "query", ")", ".", "Count", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ctx", ".", "Tracer", ".", "Pop", "(", ")", "\n\n", "// check for existence", "if", "n", "!=", "len", "(", "ids", ")", "{", "return", "E", "(", "\"", "\"", "+", "field", ")", "\n", "}", "\n\n", "continue", "\n", "}", "\n\n", "// handle to-one relationships", "// count entities in database", "ctx", ".", "Tracer", ".", "Push", "(", "\"", "\"", ")", "\n", "ctx", ".", "Tracer", ".", "Tag", "(", "\"", "\"", ",", "ref", ")", "\n", "n", ",", "err", ":=", "ctx", ".", "Store", ".", "DB", "(", ")", ".", "C", "(", "coal", ".", "C", "(", "collection", ")", ")", ".", "FindId", "(", "ref", ")", ".", "Limit", "(", "1", ")", ".", "Count", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ctx", ".", "Tracer", ".", "Pop", "(", ")", "\n\n", "// check for existence", "if", "n", "!=", "1", "{", "return", "E", "(", "\"", "\"", "+", "field", ")", "\n", "}", "\n", "}", "\n\n", "// pass validation", "return", "nil", "\n", "}", ")", "\n", "}" ]
13,046
all-13047
[ "Dot", "derives", "the", "dot", "product", "of", "two", "vectors", ".", "v", ".", "v1" ]
[ "func", "(", "v", "Vec2", ")", "Dot", "(", "v1", "Vec2", ")", "float32", "{", "<mask>", "v", "[", "0", "]", "*", "v1", "[", "0", "]", "+", "v", "[", "1", "]", "*", "v1", "[", "1", "]", "\n", "}" ]
13,047
all-13048
[ "getExecMatch", "returns", "ExecFunc", "with", "the", "given", "name", "and", "mather", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "getExecMatch", "(", "name", "string", ",", "matcher", "Matcher", ")", "ExecFunc", "{", "return", "func", "(", "method", ",", "urlStr", "string", ")", "(", "*", "Route", ",", "[", "]", "string", ")", "{", "offset", ",", "matchStr", ":=", "matcher", ".", "Match", "(", "urlStr", ")", "\n", "if", "offset", "==", "-", "1", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// finish parsing", "if", "len", "(", "urlStr", ")", "==", "offset", "{", "if", "h", ":=", "e", ".", "GetHandler", "(", "method", ")", ";", "h", "!=", "nil", "{", "return", "h", ",", "[", "]", "string", "{", "name", ",", "matchStr", "}", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "for", "_", ",", "entry", ":=", "range", "e", ".", "entries", "{", "if", "h", ",", "params", ":=", "entry", ".", "exec", "(", "method", ",", "urlStr", "[", "offset", ":", "]", ")", ";", "h", "!=", "nil", "{", "params", "=", "append", "(", "params", ",", "name", ",", "matchStr", ")", "\n", "return", "h", ",", "params", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}", "\n", "}" ]
13,048
all-13049
[ "HasMonitorStatus", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "HasMonitorStatus", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "MonitorStatus", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
13,049
all-13050
[ "Read", "a", "uvarint", "that", "encodes", "the", "number", "of", "nil", "items", "to", "skip", ".", "NOTE", ":", "Currently", "does", "not", "support", "any", "number", "besides", "0", "(", "not", "nil", ")", "and", "1", "(", "nil", ")", ".", "All", "other", "values", "will", "error", "." ]
[ "func", "decodeNumNilBytes", "(", "bz", "[", "]", "byte", ")", "(", "numNil", "int64", ",", "n", "int", ",", "err", "error", ")", "{", "if", "len", "(", "bz", ")", "==", "0", "{", "err", "=", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "if", "bz", "[", "0", "]", "==", "0x00", "{", "numNil", ",", "n", "=", "0", ",", "1", "\n", "return", "\n", "}", "\n", "if", "bz", "[", "0", "]", "==", "0x01", "{", "numNil", ",", "n", "=", "1", ",", "1", "\n", "return", "\n", "}", "\n", "n", ",", "err", "=", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "bz", "[", "0", "]", ")", "\n", "return", "\n", "}" ]
13,050
all-13051
[ "Methods", "returns", "the", "goa", ".", "v2", "method" ]
[ "func", "(", "ep", "*", "Endpoint", ")", "Method", "(", ")", "string", "{", "if", "strings", ".", "Contains", "(", "ep", ".", "OperationID", ",", "\"", "\"", ")", "{", "return", "strings", ".", "Split", "(", "ep", ".", "OperationID", ",", "\"", "\"", ")", "[", "1", "]", "\n", "}", "\n", "<mask>", "\"", "\"", "\n", "}" ]
13,051
all-13052
[ "ResetOffset", "stashes", "the", "provided", "message", "offset", "See", "ResetPartitionOffset", "for", "explanation" ]
[ "func", "(", "s", "*", "OffsetStash", ")", "ResetOffset", "(", "msg", "*", "sarama", ".", "ConsumerMessage", ",", "metadata", "string", ")", "{", "s", ".", "ResetPartitionOffset", "(", "msg", ".", "<mask>", ",", "msg", ".", "Partition", ",", "msg", ".", "Offset", ",", "metadata", ")", "\n", "}" ]
13,052
all-13053
[ "DrawVerticalLine", "draws", "the", "part", "of", "the", "vertical", "line", "that", "is", "inside", "current", "clipping", "rectangle" ]
[ "func", "DrawVerticalLine", "(", "x", ",", "y", ",", "h", "int", ",", "r", "rune", ")", "{", "x", ",", "y", ",", "_", ",", "h", "=", "<mask>", "(", "x", ",", "y", ",", "1", ",", "h", ")", "\n", "if", "h", "==", "0", "{", "return", "\n", "}", "\n\n", "for", "i", ":=", "y", ";", "i", "<", "y", "+", "h", ";", "i", "++", "{", "putCharUnsafe", "(", "x", ",", "i", ",", "r", ")", "\n", "}", "\n", "}" ]
13,053
all-13054
[ "create", "a", "stand", "-", "alone", "program", "from", "an", "array", "of", "null", "-", "terminated", "source", "code", "strings" ]
[ "func", "CreateShaderProgramv", "(", "xtype", "uint32", ",", "<mask>", "int32", ",", "strings", "*", "*", "uint8", ")", "uint32", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpCreateShaderProgramv", ",", "3", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "strings", ")", ")", ")", "\n", "return", "(", "uint32", ")", "(", "ret", ")", "\n", "}" ]
13,054
all-13055
[ "EditComment", "changes", "the", "body", "of", "comment", "id", "in", "org", "/", "repo", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "comments", "/", "#edit", "-", "a", "-", "comment" ]
[ "func", "(", "c", "*", "Client", ")", "EditComment", "(", "org", ",", "repo", "string", ",", "id", "int", ",", "comment", "string", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "id", ",", "comment", ")", "\n", "ic", ":=", "IssueComment", "{", "Body", ":", "comment", ",", "}", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPatch", ",", "<mask>", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "id", ")", ",", "requestBody", ":", "&", "ic", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
13,055
all-13056
[ "SetCursorHAdjustment", "()", "is", "a", "wrapper", "around", "gtk_entry_set_cursor_hadjustment", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetCursorHAdjustment", "(", "adjustment", "*", "Adjustment", ")", "{", "C", ".", "gtk_entry_set_cursor_hadjustment", "(", "v", ".", "native", "(", ")", ",", "adjustment", ".", "native", "(", ")", ")", "\n", "}" ]
13,056
all-13057
[ "Report", "will", "report", "via", "reportlib" ]
[ "func", "(", "c", "*", "Client", ")", "Report", "(", "pj", "*", "v1", ".", "ProwJob", ")", "(", "[", "]", "*", "v1", ".", "ProwJob", ",", "error", ")", "{", "// TODO(krzyzacy): ditch ReportTemplate, and we can drop reference to config.Getter", "return", "[", "]", "*", "v1", ".", "ProwJob", "{", "pj", "}", ",", "<mask>", ".", "Report", "(", "c", ".", "gc", ",", "c", ".", "config", "(", ")", ".", "Plank", ".", "ReportTemplate", ",", "*", "pj", ",", "c", ".", "config", "(", ")", ".", "GitHubReporter", ".", "JobTypesToReport", ")", "\n", "}" ]
13,057
all-13058
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetAllTimeSamplingProfileParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory15", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
13,058
all-13059
[ "Get", "registers", "handlers", "with", "the", "given", "pattern", "for", "GET", "and", "HEAD", "method" ]
[ "func", "(", "r", "*", "<mask>", ")", "Get", "(", "pat", "string", ",", "f", "...", "HandlerFunc", ")", "{", "r", ".", "HandleMethod", "(", "pat", ",", "\"", "\"", ",", "f", "...", ")", "\n", "r", ".", "HandleMethod", "(", "pat", ",", "\"", "\"", ",", "f", "...", ")", "\n", "}" ]
13,059
all-13060
[ "MainCurrentSource", "is", "a", "wrapper", "around", "g_main_current_source", "()", "." ]
[ "func", "MainCurrentSource", "(", ")", "*", "Source", "{", "c", ":=", "C", ".", "g_main_current_source", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "(", "*", "<mask>", ")", "(", "c", ")", "\n", "}" ]
13,060
all-13061
[ "Apply", "applies", "the", "upsert", "-", "only", "policy", "which", "strips", "out", "any", "deletions", "." ]
[ "func", "(", "p", "*", "UpsertOnlyPolicy", ")", "Apply", "(", "changes", "*", "Changes", ")", "*", "Changes", "{", "return", "&", "Changes", "{", "Create", ":", "changes", ".", "Create", ",", "UpdateOld", ":", "changes", ".", "UpdateOld", ",", "UpdateNew", ":", "<mask>", ".", "UpdateNew", ",", "}", "\n", "}" ]
13,061
all-13062
[ "OpenStack", "-", "open", "or", "create", "stack" ]
[ "func", "OpenStack", "(", "filename", "string", ")", "(", "*", "Stack", ",", "error", ")", "{", "file", ",", "err", ":=", "os", ".", "OpenFile", "(", "filename", ",", "os", ".", "O_CREATE", "|", "os", ".", "O_RDWR", ",", "0755", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "NewStack", "(", "<mask>", ")", "\n", "}" ]
13,062
all-13063
[ "New", "creates", "a", "new", "History", "struct", "with", "the", "specificed", "recordLog", "size", "limit", "." ]
[ "func", "New", "(", "maxRecordsPerKey", "int", ",", "opener", "io", ".", "Opener", ",", "path", "string", ")", "(", "*", "History", ",", "error", ")", "{", "hist", ":=", "&", "History", "{", "logs", ":", "map", "[", "string", "]", "*", "recordLog", "{", "}", ",", "logSizeLimit", ":", "maxRecordsPerKey", ",", "opener", ":", "opener", ",", "path", ":", "<mask>", ",", "}", "\n\n", "if", "path", "!=", "\"", "\"", "{", "// Load existing history from GCS.", "var", "err", "error", "\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "hist", ".", "logs", ",", "err", "=", "readHistory", "(", "maxRecordsPerKey", ",", "hist", ".", "opener", ",", "hist", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "time", ".", "Since", "(", "start", ")", ".", "String", "(", ")", ",", "\"", "\"", ":", "hist", ".", "path", ",", "}", ")", ".", "Debugf", "(", "\"", "\"", ",", "len", "(", "hist", ".", "logs", ")", ")", "\n", "}", "\n\n", "return", "hist", ",", "nil", "\n", "}" ]
13,063
all-13064
[ "SyncHandler", "is", "a", "small", "wrapper", "around", "Sync", "which", "simply", "synchronises", "all", "incoming", "connections", ".", "Use", "Sync", "if", "you", "wish", "to", "implement", "user", "authentication", "or", "any", "other", "request", "-", "time", "checks", "." ]
[ "func", "SyncHandler", "(", "gostruct", "interface", "{", "}", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "conn", ",", "err", ":=", "Sync", "(", "gostruct", ",", "w", ",", "r", ")", ";", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "else", "{", "conn", ".", "Wait", "(", ")", "\n", "}", "\n", "}", ")", "\n", "}" ]
13,064
all-13065
[ "HasSpanName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "HasSpanName", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "SpanName", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
13,065
all-13066
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StartTypeProfileParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler10", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
13,066
all-13067
[ "Namespace", "returns", "a", "copy", "of", "the", "client", "pointing", "at", "the", "specified", "namespace", "." ]
[ "func", "(", "c", "*", "Client", ")", "Namespace", "(", "<mask>", "string", ")", "*", "Client", "{", "nc", ":=", "*", "c", "\n", "nc", ".", "namespace", "=", "ns", "\n", "return", "&", "nc", "\n", "}" ]
13,067
all-13068
[ "title", ":", "volume", "list", "path", ":", "/", "volumes", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "List", "volumes", "204", ":", "No", "content", "401", ":", "Unauthorized" ]
[ "func", "volumesList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "contexts", ":=", "permission", ".", "ContextsForPermission", "(", "t", ",", "permission", ".", "PermVolumeRead", ")", "\n", "if", "len", "(", "contexts", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "volumes", ",", "err", ":=", "volume", ".", "ListByFilter", "(", "volumeFilterByContext", "(", "contexts", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "volumes", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "volumes", ")", "\n", "}" ]
13,068
all-13069
[ "sendAlerts", "implements", "the", "rules", ".", "NotifyFunc", "for", "a", "Notifier", "." ]
[ "func", "sendAlerts", "(", "s", "sender", ",", "externalURL", "string", ")", "rules", ".", "NotifyFunc", "{", "return", "func", "(", "ctx", "<mask>", ".", "Context", ",", "expr", "string", ",", "alerts", "...", "*", "rules", ".", "Alert", ")", "{", "var", "res", "[", "]", "*", "notifier", ".", "Alert", "\n\n", "for", "_", ",", "alert", ":=", "range", "alerts", "{", "a", ":=", "&", "notifier", ".", "Alert", "{", "StartsAt", ":", "alert", ".", "FiredAt", ",", "Labels", ":", "alert", ".", "Labels", ",", "Annotations", ":", "alert", ".", "Annotations", ",", "GeneratorURL", ":", "externalURL", "+", "strutil", ".", "TableLinkForExpression", "(", "expr", ")", ",", "}", "\n", "if", "!", "alert", ".", "ResolvedAt", ".", "IsZero", "(", ")", "{", "a", ".", "EndsAt", "=", "alert", ".", "ResolvedAt", "\n", "}", "else", "{", "a", ".", "EndsAt", "=", "alert", ".", "ValidUntil", "\n", "}", "\n", "res", "=", "append", "(", "res", ",", "a", ")", "\n", "}", "\n\n", "if", "len", "(", "alerts", ")", ">", "0", "{", "s", ".", "Send", "(", "res", "...", ")", "\n", "}", "\n", "}", "\n", "}" ]
13,069
all-13070
[ "GetName", "safely", "returns", "the", "name", "of", "the", "resource" ]
[ "func", "(", "<mask>", "*", "ASMSecretResource", ")", "GetName", "(", ")", "string", "{", "secret", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "secret", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "ResourceName", "\n", "}" ]
13,070
all-13071
[ "setSCSIBusSharing", "takes", "a", "BaseVirtualSCSIController", "sets", "the", "sharing", "mode", "and", "applies", "that", "change", "to", "the", "VirtualDeviceList", "." ]
[ "func", "setSCSIBusSharing", "(", "l", "*", "object", ".", "VirtualDeviceList", ",", "ctlr", "types", ".", "BaseVirtualSCSIController", ",", "st", "string", ")", "(", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "var", "cspec", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", "\n", "if", "ctlr", ".", "GetVirtualSCSIController", "(", ")", ".", "SharedBus", "!=", "types", ".", "VirtualSCSISharing", "(", "st", ")", "{", "ctlr", ".", "GetVirtualSCSIController", "(", ")", ".", "SharedBus", "=", "types", ".", "VirtualSCSISharing", "(", "st", ")", "\n", "var", "err", "error", "\n", "cspec", ",", "err", "=", "object", ".", "VirtualDeviceList", "{", "ctlr", ".", "(", "<mask>", ".", "BaseVirtualDevice", ")", "}", ".", "ConfigSpec", "(", "types", ".", "VirtualDeviceConfigSpecOperationEdit", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "*", "l", "=", "applyDeviceChange", "(", "*", "l", ",", "cspec", ")", "\n", "}", "\n", "return", "cspec", ",", "nil", "\n", "}" ]
13,071
all-13072
[ "Value", "returns", "value", "." ]
[ "func", "(", "s", "*", "Iterator", ")", "Value", "(", ")", "y", ".", "ValueStruct", "{", "valOffset", ",", "valSize", ":=", "s", ".", "n", ".", "getValueOffset", "(", ")", "\n", "return", "s", ".", "<mask>", ".", "arena", ".", "getVal", "(", "valOffset", ",", "valSize", ")", "\n", "}" ]
13,072
all-13073
[ "ElementsEqual", "checks", "that", "the", "elements", "of", "the", "slice", "expecteds", "are", "exactly", "the", "elements", "of", "the", "slice", "actuals", "ignoring", "order", "(", "i", ".", "e", ".", "setwise", "-", "equal", "but", "respecting", "duplicates", ")", ".", "Note", "that", "if", "the", "elements", "of", "expecteds", "and", "actuals", "are", "pointers", "ElementsEqual", "will", "unwrap", "the", "pointers", "before", "comparing", "them", "so", "that", "the", "output", "of", "e", ".", "g", ".", "ListCommit", "()", "which", "returns", "[]", "*", "pfs", ".", "Commit", "can", "easily", "be", "verfied", ".", "Also", "treat", "nil", "and", "the", "empty", "slice", "as", "equivalent", "so", "that", "callers", "can", "pass", "nil", "for", "expecteds", "." ]
[ "func", "ElementsEqual", "(", "tb", "testing", ".", "TB", ",", "expecteds", "interface", "{", "}", ",", "actuals", "<mask>", "{", "}", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "if", "err", ":=", "ElementsEqualOrErr", "(", "expecteds", ",", "actuals", ")", ";", "err", "!=", "nil", "{", "fatal", "(", "tb", ",", "msgAndArgs", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}" ]
13,073
all-13074
[ "Reuse", "an", "established", "websocket", ".", "Conn", "." ]
[ "func", "(", "c", "*", "Conn", ")", "setConn", "(", "ws", "*", "websocket", ".", "Conn", ")", "error", "{", "c", ".", "ws", ".", "<mask>", "(", "ws", ")", "\n", "c", ".", "connected", ".", "Store", "(", "true", ")", "\n", "if", "err", ":=", "ws", ".", "SetDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "c", ".", "deadline", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,074
all-13075
[ "ApplyCmd", "represents", "the", "apply", "command" ]
[ "func", "ApplyCmd", "(", ")", "*", "cobra", ".", "Command", "{", "var", "ao", "=", "&", "cli", ".", "ApplyOptions", "{", "}", "\n", "var", "applyCmd", "=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Use this command to apply an API model in a cloud.\n\n\tThis command will attempt to find an API model in a defined state store, and then apply any changes needed directly to a cloud.\n\tThe apply will run once, and ultimately time out if something goes wrong.`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "<mask>", "len", "(", "args", ")", "{", "case", "0", ":", "ao", ".", "Name", "=", "viper", ".", "GetString", "(", "keyKubicornName", ")", "\n", "case", "1", ":", "ao", ".", "Name", "=", "args", "[", "0", "]", "\n", "default", ":", "logger", ".", "Critical", "(", "\"", "\"", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "if", "err", ":=", "runApply", "(", "ao", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "err", ".", "Error", "(", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n", "}", ",", "}", "\n\n", "fs", ":=", "applyCmd", ".", "Flags", "(", ")", "\n\n", "bindCommonStateStoreFlags", "(", "&", "ao", ".", "StateStoreOptions", ",", "fs", ")", "\n", "bindCommonAwsFlags", "(", "&", "ao", ".", "AwsOptions", ",", "fs", ")", "\n\n", "fs", ".", "StringArrayVarP", "(", "&", "ao", ".", "Set", ",", "keyKubicornSet", ",", "\"", "\"", ",", "viper", ".", "GetStringSlice", "(", "keyKubicornSet", ")", ",", "descSet", ")", "\n", "fs", ".", "StringVar", "(", "&", "ao", ".", "AwsProfile", ",", "keyAwsProfile", ",", "viper", ".", "GetString", "(", "keyAwsProfile", ")", ",", "descAwsProfile", ")", "\n", "fs", ".", "StringVar", "(", "&", "ao", ".", "GitRemote", ",", "keyGitConfig", ",", "viper", ".", "GetString", "(", "keyGitConfig", ")", ",", "descGitConfig", ")", "\n\n", "return", "applyCmd", "\n", "}" ]
13,075
all-13076
[ "AddMnemonic", "is", "a", "wrapper", "around", "gtk_window_add_mnemonic", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "AddMnemonic", "(", "keyval", "uint", ",", "target", "*", "Widget", ")", "{", "C", ".", "gtk_window_add_mnemonic", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "keyval", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
13,076
all-13077
[ "GetCellRect", "is", "a", "wrapper", "around", "gtk_icon_view_get_cell_rect", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "GetCellRect", "(", "path", "*", "TreePath", ",", "cell", "*", "CellRenderer", ")", "*", "gdk", ".", "Rectangle", "{", "var", "crect", "C", ".", "GdkRectangle", "\n\n", "C", ".", "gtk_icon_view_get_cell_rect", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ",", "cell", ".", "native", "(", ")", ",", "&", "crect", ")", "\n\n", "return", "gdk", ".", "WrapRectangle", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "&", "crect", ")", ")", ")", "\n", "}" ]
13,077
all-13078
[ "isTTY", "returns", "true", "if", "the", "io", ".", "Writer", "is", "a", "file", "and", "a", "tty", "." ]
[ "func", "isTTY", "(", "w", "io", ".", "Writer", ")", "bool", "{", "if", "f", ",", "ok", ":=", "w", ".", "(", "*", "<mask>", ".", "File", ")", ";", "ok", "{", "return", "terminal", ".", "IsTerminal", "(", "int", "(", "f", ".", "Fd", "(", ")", ")", ")", "\n", "}", "\n", "return", "false", "\n", "}" ]
13,078
all-13079
[ "ForEachObject", "calls", "fn", "with", "each", "object", "in", "the", "Go", "heap", ".", "If", "fn", "returns", "false", "ForEachObject", "returns", "immediately", "." ]
[ "func", "(", "p", "*", "Process", ")", "ForEachObject", "(", "fn", "func", "(", "x", "<mask>", ")", "bool", ")", "{", "for", "_", ",", "k", ":=", "range", "p", ".", "pages", "{", "pt", ":=", "p", ".", "pageTable", "[", "k", "]", "\n", "for", "i", ":=", "range", "pt", "{", "h", ":=", "&", "pt", "[", "i", "]", "\n", "m", ":=", "h", ".", "mark", "\n", "for", "m", "!=", "0", "{", "j", ":=", "bits", ".", "TrailingZeros64", "(", "m", ")", "\n", "m", "&=", "m", "-", "1", "\n", "x", ":=", "Object", "(", "k", ")", "*", "pageTableSize", "*", "heapInfoSize", "+", "Object", "(", "i", ")", "*", "heapInfoSize", "+", "Object", "(", "j", ")", "*", "8", "\n", "if", "!", "fn", "(", "x", ")", "{", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
13,079
all-13080
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetHeapUsageReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime25", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
13,080
all-13081
[ "ControlInRect", "returns", "true", "if", "c", "is", "within", "a", "given", "rect" ]
[ "func", "ControlInRect", "(", "c", "<mask>", ",", "x", "int", ",", "y", "int", ",", "w", "int", ",", "h", "int", ")", "bool", "{", "xx", ",", "yy", ":=", "c", ".", "Pos", "(", ")", "\n", "ww", ",", "hh", ":=", "c", ".", "Size", "(", ")", "\n\n", "return", "xx", ">=", "x", "&&", "ww", "<=", "x", "+", "w", "&&", "yy", "<=", "y", "+", "h", "&&", "yy", "+", "hh", "<=", "y", "+", "h", "&&", "yy", ">=", "y", "&&", "yy", "+", "h", ">=", "y", "\n", "}" ]
13,081
all-13082
[ "DriverName", "returns", "the", "name", "of", "the", "driver", "as", "it", "is", "registered" ]
[ "func", "(", "d", "*", "SerialDriver", ")", "DriverName", "(", ")", "<mask>", "{", "d", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "Unlock", "(", ")", "\n", "return", "d", ".", "Driver", ".", "DriverName", "(", ")", "\n", "}" ]
13,082
all-13083
[ "Do", "executes", "Browser", ".", "crash", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "CrashParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCrash", ",", "nil", ",", "nil", ")", "\n", "}" ]
13,083
all-13084
[ "camelCase", "takes", "a", "name", "with", "underscores", "such", "as", "my_arg", "and", "returns", "camelCase", "(", "e", ".", "g", ".", "myArg", ")", ".", "if", "publicName", "is", "true", "then", "it", "returns", "UpperCamelCase", ".", "This", "method", "will", "also", "fix", "common", "initialisms", "(", "e", ".", "g", ".", "ID", "API", "etc", ")", "." ]
[ "func", "camelCase", "(", "name", "string", ",", "publicName", "bool", ")", "string", "{", "parts", ":=", "strings", ".", "Split", "(", "name", ",", "\"", "\"", ")", "\n", "startAt", ":=", "1", "\n", "if", "publicName", "{", "startAt", "=", "0", "\n", "}", "\n", "for", "i", ":=", "startAt", ";", "i", "<", "len", "(", "parts", ")", ";", "i", "++", "{", "name", ":=", "parts", "[", "i", "]", "\n", "if", "name", "==", "\"", "\"", "{", "<mask>", "\n", "}", "\n\n", "// For all words except the first, if the first letter of the word is", "// uppercase, Thrift keeps the underscore.", "if", "i", ">", "0", "&&", "strings", ".", "ToUpper", "(", "name", "[", "0", ":", "1", "]", ")", "==", "name", "[", "0", ":", "1", "]", "{", "name", "=", "\"", "\"", "+", "name", "\n", "}", "else", "{", "name", "=", "strings", ".", "ToUpper", "(", "name", "[", "0", ":", "1", "]", ")", "+", "name", "[", "1", ":", "]", "\n", "}", "\n\n", "if", "isInitialism", ":=", "commonInitialisms", "[", "strings", ".", "ToUpper", "(", "name", ")", "]", ";", "isInitialism", "{", "name", "=", "strings", ".", "ToUpper", "(", "name", ")", "\n", "}", "\n\n", "parts", "[", "i", "]", "=", "name", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "parts", ",", "\"", "\"", ")", "\n", "}" ]
13,084
all-13085
[ "MouseButtonPressDuration", "returns", "how", "long", "the", "mouse", "button", "is", "pressed", "in", "frames", ".", "MouseButtonPressDuration", "is", "concurrent", "safe", "." ]
[ "func", "MouseButtonPressDuration", "(", "button", "ebiten", ".", "MouseButton", ")", "int", "{", "theInputState", ".", "m", ".", "RLock", "(", ")", "\n", "s", ":=", "theInputState", ".", "mouseButtonDurations", "[", "<mask>", "]", "\n", "theInputState", ".", "m", ".", "RUnlock", "(", ")", "\n", "return", "s", "\n", "}" ]
13,085
all-13086
[ "GetStatusString", "()", "is", "a", "wrapper", "around", "gtk_print_operation_get_status_string", "()", "." ]
[ "func", "(", "po", "*", "PrintOperation", ")", "GetStatusString", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_print_operation_get_status_string", "(", "po", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
13,086
all-13087
[ "TraceReqest", "traces", "an", "http", "request", ".", "It", "returns", "a", "new", "context", "with", "the", "transaction", "included", "in", "it", "and", "a", "trace", "object", ".", "Usage", ":", "ctx", "t", ":", "=", "TraceRequest", "(", "ctx", "name", "req", ")", "defer", "t", ".", "Done", "()" ]
[ "func", "TraceRequest", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "req", "*", "http", ".", "<mask>", ")", "(", "context", ".", "Context", ",", "*", "Trace", ")", "{", "tx", ":=", "NewRequestTx", "(", "name", ",", "req", ".", "URL", ".", "String", "(", ")", ")", "\n", "ctx", "=", "WithTx", "(", "ctx", ",", "tx", ")", "\n", "err", ":=", "tx", ".", "Start", "(", ")", "\n\n", "return", "ctx", ",", "&", "Trace", "{", "err", ":", "err", ",", "done", ":", "func", "(", ")", "error", "{", "return", "tx", ".", "End", "(", ")", "\n", "}", ",", "}", "\n", "}" ]
13,087
all-13088
[ "NewChannelMemoryBackend", "creates", "a", "simple", "in", "-", "memory", "logging", "backend", "which", "utilizes", "a", "go", "channel", "for", "communication", ".", "Start", "will", "automatically", "be", "called", "by", "this", "function", "." ]
[ "func", "NewChannelMemoryBackend", "(", "size", "int", ")", "*", "ChannelMemoryBackend", "{", "backend", ":=", "&", "ChannelMemoryBackend", "{", "maxSize", ":", "size", ",", "incoming", ":", "make", "(", "chan", "*", "Record", ",", "1024", ")", ",", "<mask>", ":", "make", "(", "chan", "event", ")", ",", "}", "\n", "backend", ".", "Start", "(", ")", "\n", "return", "backend", "\n", "}" ]
13,088
all-13089
[ "GetPageComplete", "is", "a", "wrapper", "around", "gtk_assistant_get_page_complete", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "GetPageComplete", "(", "<mask>", "IWidget", ")", "bool", "{", "c", ":=", "C", ".", "gtk_assistant_get_page_complete", "(", "v", ".", "native", "(", ")", ",", "page", ".", "toWidget", "(", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
13,089
all-13090
[ "Targets", "takes", "a", "snapshot", "of", "the", "targets", "(", "direct", "peers", ")", "either", "just", "the", "ones", "we", "are", "still", "trying", "or", "all", "of", "them", ".", "Note", "these", "are", "the", "same", "things", "that", "InitiateConnections", "and", "ForgetConnections", "talks", "about", "but", "a", "method", "to", "retrieve", "Connections", "would", "obviously", "return", "the", "current", "connections", "." ]
[ "func", "(", "cm", "*", "connectionMaker", ")", "Targets", "(", "activeOnly", "bool", ")", "[", "]", "string", "{", "resultChan", ":=", "make", "(", "chan", "[", "]", "string", ")", "\n", "cm", ".", "actionChan", "<-", "func", "(", ")", "bool", "{", "var", "slice", "[", "]", "string", "\n", "for", "peer", ",", "addr", ":=", "range", "cm", ".", "directPeers", "{", "if", "activeOnly", "{", "if", "target", ",", "ok", ":=", "cm", ".", "targets", "[", "cm", ".", "completeAddr", "(", "*", "addr", ")", "]", ";", "<mask>", "&&", "target", ".", "tryAfter", ".", "IsZero", "(", ")", "{", "continue", "\n", "}", "\n", "}", "\n", "slice", "=", "append", "(", "slice", ",", "peer", ")", "\n", "}", "\n", "resultChan", "<-", "slice", "\n", "return", "false", "\n", "}", "\n", "return", "<-", "resultChan", "\n", "}" ]
13,090
all-13091
[ "Pop", "removes", "an", "element", "from", "the", "map", "and", "returns", "it" ]
[ "func", "(", "c", "*", "Cache", ")", "Pop", "(", "key", "string", ")", "(", "p", "*", "points", ".", "Points", ",", "exists", "bool", ")", "{", "// Try to get shard.", "shard", ":=", "c", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "Lock", "(", ")", "\n", "p", ",", "exists", "=", "shard", ".", "items", "[", "key", "]", "\n", "delete", "(", "shard", ".", "items", ",", "key", ")", "\n", "shard", ".", "Unlock", "(", ")", "\n\n", "if", "exists", "{", "atomic", ".", "AddInt32", "(", "&", "c", ".", "stat", ".", "<mask>", ",", "-", "int32", "(", "len", "(", "p", ".", "Data", ")", ")", ")", "\n", "}", "\n\n", "return", "p", ",", "exists", "\n", "}" ]
13,091
all-13092
[ "PreAccountAddBalance", "adds", "balance", "to", "psc", "." ]
[ "func", "(", "w", "*", "Worker", ")", "PreAccountAddBalance", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "acc", ",", "err", ":=", "w", ".", "relatedAccount", "(", "logger", ",", "job", ",", "data", ".", "JobPreAccountAddBalance", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "jobData", ",", "err", ":=", "w", ".", "approvedBalanceData", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "key", ",", "err", ":=", "w", ".", "key", "(", "logger", ",", "acc", ".", "PrivateKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "auth", ":=", "bind", ".", "NewKeyedTransactor", "(", "key", ")", "\n", "auth", ".", "GasLimit", "=", "w", ".", "gasConf", ".", "PSC", ".", "AddBalanceERC20", "\n", "auth", ".", "GasPrice", "=", "new", "(", "big", ".", "Int", ")", ".", "SetUint64", "(", "jobData", ".", "GasPrice", ")", "\n", "<mask>", ",", "err", ":=", "w", ".", "ethBack", ".", "PSCAddBalanceERC20", "(", "auth", ",", "uint64", "(", "jobData", ".", "Amount", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrPSCAddBalance", "\n", "}", "\n\n", "return", "w", ".", "saveEthTX", "(", "logger", ",", "job", ",", "tx", ",", "\"", "\"", ",", "job", ".", "RelatedType", ",", "job", ".", "RelatedID", ",", "acc", ".", "EthAddr", ",", "data", ".", "HexFromBytes", "(", "w", ".", "pscAddr", ".", "Bytes", "(", ")", ")", ")", "\n", "}" ]
13,092
all-13093
[ "Delete", "an", "item", "Delete", "always", "succeed", "if", "an", "item", "exists", "." ]
[ "func", "(", "w", "*", "Writer", ")", "Delete", "(", "bs", "[", "]", "byte", ")", "(", "success", "bool", ")", "{", "_", ",", "<mask>", "=", "w", ".", "Delete2", "(", "bs", ")", "\n", "return", "\n", "}" ]
13,093
all-13094
[ "CONTRACT", ":", "rv", ".", "CanAddr", "()", "is", "true", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "decodeReflectBinaryInterface", "(", "bz", "[", "]", "byte", ",", "iinfo", "*", "TypeInfo", ",", "rv", "reflect", ".", "Value", ",", "fopts", "FieldOptions", ",", "bare", "bool", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "!", "rv", ".", "CanAddr", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "printLog", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "defer", "func", "(", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "(", ")", "\n", "}", "\n", "if", "!", "rv", ".", "IsNil", "(", ")", "{", "// JAE: Heed this note, this is very tricky.", "// I've forgotten the reason a second time,", "// but I'm pretty sure that reason exists.", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "if", "!", "bare", "{", "// Read byte-length prefixed byteslice.", "var", "buf", ",", "_n", "=", "[", "]", "byte", "(", "nil", ")", ",", "int", "(", "0", ")", "\n", "buf", ",", "_n", ",", "err", "=", "DecodeByteSlice", "(", "bz", ")", "\n", "if", "slide", "(", "&", "bz", ",", "nil", ",", "_n", ")", "&&", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "// This is a trick for debuggability -- we slide on &n more later.", "n", "+=", "UvarintSize", "(", "uint64", "(", "len", "(", "buf", ")", ")", ")", "\n", "bz", "=", "buf", "\n", "}", "\n\n", "// Consume disambiguation / prefix bytes.", "disamb", ",", "hasDisamb", ",", "prefix", ",", "hasPrefix", ",", "_n", ",", "err", ":=", "DecodeDisambPrefixBytes", "(", "bz", ")", "\n", "if", "slide", "(", "&", "bz", ",", "&", "n", ",", "_n", ")", "&&", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Get concrete type info from disfix/prefix.", "var", "cinfo", "*", "TypeInfo", "\n", "if", "hasDisamb", "{", "cinfo", ",", "err", "=", "cdc", ".", "getTypeInfoFromDisfix_rlock", "(", "toDisfix", "(", "disamb", ",", "prefix", ")", ")", "\n", "}", "else", "if", "hasPrefix", "{", "cinfo", ",", "err", "=", "cdc", ".", "getTypeInfoFromPrefix_rlock", "(", "iinfo", ",", "prefix", ")", "\n", "}", "else", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Construct the concrete type.", "<mask>", "crv", ",", "irvSet", "=", "constructConcreteType", "(", "cinfo", ")", "\n\n", "// Decode into the concrete type.", "_n", ",", "err", "=", "cdc", ".", "decodeReflectBinary", "(", "bz", ",", "cinfo", ",", "crv", ",", "fopts", ",", "true", ")", "\n", "if", "slide", "(", "&", "bz", ",", "&", "n", ",", "_n", ")", "&&", "err", "!=", "nil", "{", "rv", ".", "Set", "(", "irvSet", ")", "// Helps with debugging", "\n", "return", "\n", "}", "\n\n", "// Earlier, we set bz to the byteslice read from buf.", "// Ensure that all of bz was consumed.", "if", "len", "(", "bz", ")", ">", "0", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "// We need to set here, for when !PointerPreferred and the type", "// is say, an array of bytes (e.g. [32]byte), then we must call", "// rv.Set() *after* the value was acquired.", "// NOTE: rv.Set() should succeed because it was validated", "// already during Register[Interface/Concrete].", "rv", ".", "Set", "(", "irvSet", ")", "\n", "return", "\n", "}" ]
13,094
all-13095
[ "Do", "executes", "HeadlessExperimental", ".", "beginFrame", "against", "the", "provided", "context", ".", "returns", ":", "hasDamage", "-", "Whether", "the", "BeginFrame", "resulted", "in", "damage", "and", "thus", "a", "new", "frame", "was", "committed", "to", "the", "display", ".", "Reported", "for", "diagnostic", "uses", "may", "be", "removed", "in", "the", "future", ".", "screenshotData", "-", "Base64", "-", "encoded", "image", "data", "of", "the", "screenshot", "if", "one", "was", "requested", "and", "successfully", "taken", "." ]
[ "func", "(", "p", "*", "BeginFrameParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "hasDamage", "bool", ",", "screenshotData", "[", "]", "byte", ",", "err", "error", ")", "{", "// execute", "<mask>", "res", "BeginFrameReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandBeginFrame", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "nil", ",", "err", "\n", "}", "\n\n", "// decode", "var", "dec", "[", "]", "byte", "\n", "dec", ",", "err", "=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "ScreenshotData", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "HasDamage", ",", "dec", ",", "nil", "\n", "}" ]
13,095
all-13096
[ "Wait", "waits", "for", "all", "message", "/", "connection", "handler", "goroutines", "in", "all", "connections", "to", "exit", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Wait", "(", ")", "{", "s", ".", "conns", ".", "Range", "(", "func", "(", "c", "interface", "{", "}", ")", "{", "c", ".", "(", "*", "Conn", ")", ".", "Wait", "(", "180", ")", "\n", "}", ")", "\n", "}" ]
13,096
all-13097
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetDocumentReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom46", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
13,097
all-13098
[ "Fuzz", "Fills", "passed", "interface", "with", "random", "data", "based", "on", "the", "struct", "field", "type", "take", "a", "look", "at", "fuzzValueFor", "for", "details", "on", "supported", "data", "types", "." ]
[ "func", "Fuzz", "(", "e", "<mask>", "{", "}", ")", "{", "ty", ":=", "reflect", ".", "TypeOf", "(", "e", ")", "\n\n", "if", "ty", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "ty", "=", "ty", ".", "Elem", "(", ")", "\n", "}", "\n\n", "if", "ty", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "{", "value", ":=", "reflect", ".", "ValueOf", "(", "e", ")", ".", "Elem", "(", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "ty", ".", "NumField", "(", ")", ";", "i", "++", "{", "field", ":=", "value", ".", "Field", "(", "i", ")", "\n\n", "if", "field", ".", "CanSet", "(", ")", "{", "field", ".", "Set", "(", "fuzzValueFor", "(", "field", ".", "Kind", "(", ")", ")", ")", "\n", "}", "\n", "}", "\n\n", "}", "\n", "}" ]
13,098
all-13099
[ "fallback", "computes", "the", "ops", "to", "fetch", "all", "possible", "conflicting", "leasing", "keys", "for", "a", "list", "of", "ops", "." ]
[ "func", "(", "txn", "*", "txnLeasing", ")", "fallback", "(", "ops", "[", "]", "v3", ".", "Op", ")", "(", "fbOps", "[", "]", "v3", ".", "Op", ")", "{", "for", "_", ",", "op", ":=", "<mask>", "ops", "{", "if", "op", ".", "IsGet", "(", ")", "{", "continue", "\n", "}", "\n", "lkey", ",", "lend", ":=", "txn", ".", "lkv", ".", "pfx", "+", "string", "(", "op", ".", "KeyBytes", "(", ")", ")", ",", "\"", "\"", "\n", "if", "len", "(", "op", ".", "RangeBytes", "(", ")", ")", ">", "0", "{", "lend", "=", "txn", ".", "lkv", ".", "pfx", "+", "string", "(", "op", ".", "RangeBytes", "(", ")", ")", "\n", "}", "\n", "fbOps", "=", "append", "(", "fbOps", ",", "v3", ".", "OpGet", "(", "lkey", ",", "v3", ".", "WithRange", "(", "lend", ")", ")", ")", "\n", "}", "\n", "return", "fbOps", "\n", "}" ]
13,099
all-13100
[ "ReadAll", "ReadAll" ]
[ "func", "(", "ms", "*", "MongoStore", ")", "ReadAll", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "(", "item", "_Dirties", "\n", "result", "[", "]", "string", "\n", "err", "error", "\n", ")", "\n\n", "<mask>", ".", "c", "(", "func", "(", "c", "*", "mgo", ".", "Collection", ")", "{", "iter", ":=", "c", ".", "Find", "(", "nil", ")", ".", "Select", "(", "bson", ".", "M", "{", "\"", "\"", ":", "0", "}", ")", ".", "Sort", "(", "\"", "\"", ")", ".", "Iter", "(", ")", "\n", "for", "iter", ".", "Next", "(", "&", "item", ")", "{", "result", "=", "append", "(", "result", ",", "item", ".", "Value", ")", "\n", "}", "\n", "err", "=", "iter", ".", "Err", "(", ")", "\n", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]