id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
18,300
all-18301
[ "requiresSSMSecret", "returns", "true", "if", "at", "least", "one", "container", "in", "the", "task", "needs", "to", "retrieve", "secret", "from", "SSM", "parameter" ]
[ "func", "(", "<mask>", "*", "Task", ")", "requiresSSMSecret", "(", ")", "bool", "{", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "if", "container", ".", "ShouldCreateWithSSMSecret", "(", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
18,301
all-18302
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ResolveAnimationReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,302
all-18303
[ "WithContext", "adds", "the", "context", "to", "the", "put", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "PutAppsAppRoutesRouteParams", ")", "WithContext", "(", "ctx", "context", ".", "<mask>", ")", "*", "PutAppsAppRoutesRouteParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
18,303
all-18304
[ "AddRequestHandler", "indicates", "an", "expected", "call", "of", "AddRequestHandler" ]
[ "func", "(", "mr", "*", "MockClientServerMockRecorder", ")", "AddRequestHandler", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockClientServer", ")", "(", "nil", ")", ".", "AddRequestHandler", ")", ",", "arg0", ")", "\n", "}" ]
18,304
all-18305
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "WindowState", ")", "MarshalEasyJSON", "(", "<mask>", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
18,305
all-18306
[ "execPrefix", "simply", "see", "if", "the", "given", "urlStr", "has", "a", "leading", "pattern", "." ]
[ "func", "(", "e", "*", "Entry", ")", "execPrefix", "(", "method", ",", "urlStr", "string", ")", "(", "*", "Route", ",", "[", "]", "string", ")", "{", "if", "!", "strings", ".", "HasPrefix", "(", "urlStr", ",", "e", ".", "pattern", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "if", "len", "(", "urlStr", ")", "==", "len", "(", "e", ".", "<mask>", ")", "{", "return", "e", ".", "GetHandler", "(", "method", ")", ",", "nil", "\n", "}", "\n", "return", "e", ".", "traverse", "(", "method", ",", "urlStr", "[", "len", "(", "e", ".", "pattern", ")", ":", "]", ")", "\n", "}" ]
18,306
all-18307
[ "PutFile", "puts", "a", "file", "in", "the", "hashtree", "." ]
[ "func", "(", "o", "*", "Ordered", ")", "PutFile", "(", "path", "string", ",", "hash", "[", "]", "<mask>", ",", "size", "int64", ",", "fileNodeProto", "*", "FileNodeProto", ")", "{", "path", "=", "clean", "(", "path", ")", "\n", "nodeProto", ":=", "&", "NodeProto", "{", "Name", ":", "base", "(", "path", ")", ",", "Hash", ":", "hash", ",", "SubtreeSize", ":", "size", ",", "FileNode", ":", "fileNodeProto", ",", "}", "\n", "o", ".", "putFile", "(", "path", ",", "nodeProto", ")", "\n", "}" ]
18,307
all-18308
[ "NewFileLogger", "creates", "a", "new", "file", "logger", "." ]
[ "func", "NewFileLogger", "(", "conf", "*", "FileConfig", ")", "(", "Logger", ",", "io", ".", "Closer", ",", "error", ")", "{", "now", ":=", "time", ".", "Now", "(", ")", "\n", "if", "conf", ".", "UTC", "{", "<mask>", "=", "now", ".", "UTC", "(", ")", "\n", "}", "\n\n", "file", ",", "err", ":=", "os", ".", "OpenFile", "(", "timeutil", ".", "Strftime", "(", "&", "now", ",", "conf", ".", "Filename", ")", ",", "os", ".", "O_APPEND", "|", "os", ".", "O_CREATE", "|", "os", ".", "O_WRONLY", ",", "conf", ".", "FileMode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "logger", ",", "err", ":=", "NewWriterLogger", "(", "conf", ".", "WriterConfig", ",", "file", ")", "\n", "if", "err", "!=", "nil", "{", "file", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "logger", ",", "file", ",", "nil", "\n", "}" ]
18,308
all-18309
[ "HasMessage", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "HasMessage", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Message", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,309
all-18310
[ "Stat", "callback" ]
[ "func", "(", "p", "*", "Whisper", ")", "Stat", "(", "send", "helper", ".", "StatCallback", ")", "{", "updateOperations", ":=", "atomic", ".", "LoadUint32", "(", "&", "p", ".", "updateOperations", ")", "\n", "committedPoints", ":=", "atomic", ".", "LoadUint32", "(", "&", "p", ".", "committedPoints", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "p", ".", "updateOperations", ",", "-", "updateOperations", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "p", ".", "committedPoints", ",", "-", "committedPoints", ")", "\n\n", "<mask>", ":=", "atomic", ".", "LoadUint32", "(", "&", "p", ".", "created", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "p", ".", "created", ",", "-", "created", ")", "\n\n", "throttledCreates", ":=", "atomic", ".", "LoadUint32", "(", "&", "p", ".", "throttledCreates", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "p", ".", "throttledCreates", ",", "-", "throttledCreates", ")", "\n\n", "send", "(", "\"", "\"", ",", "float64", "(", "updateOperations", ")", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "committedPoints", ")", ")", "\n", "if", "updateOperations", ">", "0", "{", "send", "(", "\"", "\"", ",", "float64", "(", "committedPoints", ")", "/", "float64", "(", "updateOperations", ")", ")", "\n", "}", "else", "{", "send", "(", "\"", "\"", ",", "0.0", ")", "\n", "}", "\n\n", "send", "(", "\"", "\"", ",", "float64", "(", "created", ")", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "throttledCreates", ")", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "p", ".", "maxCreatesPerSecond", ")", ")", "\n\n", "send", "(", "\"", "\"", ",", "float64", "(", "p", ".", "maxUpdatesPerSecond", ")", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "p", ".", "workersCount", ")", ")", "\n\n", "// helper.SendAndSubstractUint64(\"blockThrottleNs\", &p.blockThrottleNs, send)", "// helper.SendAndSubstractUint64(\"blockQueueGetNs\", &p.blockQueueGetNs, send)", "// helper.SendAndSubstractUint64(\"blockAvoidConcurrentNs\", &p.blockAvoidConcurrentNs, send)", "// helper.SendAndSubstractUint64(\"blockUpdateManyNs\", &p.blockUpdateManyNs, send)", "}" ]
18,310
all-18311
[ "NOTE", ":", "addr", "must", "not", "be", "nil" ]
[ "func", "(", "a", "*", "AddrBook", ")", "AddAddress", "(", "addr", "*", "NetAddress", ",", "src", "*", "NetAddress", ")", "{", "a", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "mtx", ".", "Unlock", "(", ")", "\n", "<mask>", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "addr", ",", "\"", "\"", ",", "src", ")", "\n", "a", ".", "addAddress", "(", "addr", ",", "src", ")", "\n", "}" ]
18,311
all-18312
[ "Config", "fetches", "all", "LXD", "cluster", "config", "keys", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "Config", "(", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "query", ".", "SelectConfig", "(", "c", ".", "<mask>", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
18,312
all-18313
[ "Size", "returns", "the", "board", "size", "." ]
[ "func", "(", "b", "*", "Board", ")", "Size", "(", ")", "(", "int", ",", "int", ")", "{", "x", ":=", "b", ".", "size", "*", "tileSize", "+", "(", "b", ".", "<mask>", "+", "1", ")", "*", "tileMargin", "\n", "y", ":=", "x", "\n", "return", "x", ",", "y", "\n", "}" ]
18,313
all-18314
[ "synchronizeContainerStatus", "checks", "and", "updates", "the", "container", "status", "with", "docker" ]
[ "func", "(", "engine", "*", "DockerTaskEngine", ")", "synchronizeContainerStatus", "(", "container", "*", "apicontainer", ".", "DockerContainer", ",", "task", "*", "apitask", ".", "Task", ")", "{", "if", "container", ".", "DockerID", "==", "\"", "\"", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "<mask>", ".", "DockerName", ")", "\n", "// Figure out the dockerid", "describedContainer", ",", "err", ":=", "engine", ".", "client", ".", "InspectContainer", "(", "engine", ".", "ctx", ",", "container", ".", "DockerName", ",", "dockerclient", ".", "InspectContainerTimeout", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "container", ".", "DockerName", ",", "err", ")", "\n", "}", "else", "{", "// update the container metadata in case the container was created during agent restart", "metadata", ":=", "dockerapi", ".", "MetadataFromContainer", "(", "describedContainer", ")", "\n", "updateContainerMetadata", "(", "&", "metadata", ",", "container", ".", "Container", ",", "task", ")", "\n", "container", ".", "DockerID", "=", "describedContainer", ".", "ID", "\n\n", "container", ".", "Container", ".", "SetKnownStatus", "(", "dockerapi", ".", "DockerStateToState", "(", "describedContainer", ".", "State", ")", ")", "\n", "// update mappings that need dockerid", "engine", ".", "state", ".", "AddContainer", "(", "container", ",", "task", ")", "\n", "engine", ".", "imageManager", ".", "RecordContainerReference", "(", "container", ".", "Container", ")", "\n", "}", "\n", "return", "\n", "}", "\n\n", "currentState", ",", "metadata", ":=", "engine", ".", "client", ".", "DescribeContainer", "(", "engine", ".", "ctx", ",", "container", ".", "DockerID", ")", "\n", "if", "metadata", ".", "Error", "!=", "nil", "{", "currentState", "=", "apicontainerstatus", ".", "ContainerStopped", "\n", "// If this is a Docker API error", "if", "metadata", ".", "Error", ".", "ErrorName", "(", ")", "==", "dockerapi", ".", "CannotDescribeContainerErrorName", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "container", ".", "DockerID", ",", "container", ".", "DockerName", ",", "metadata", ".", "Error", ")", "\n", "if", "!", "container", ".", "Container", ".", "KnownTerminal", "(", ")", "{", "container", ".", "Container", ".", "ApplyingError", "=", "apierrors", ".", "NewNamedError", "(", "&", "ContainerVanishedError", "{", "}", ")", "\n", "engine", ".", "imageManager", ".", "RemoveContainerReferenceFromImageState", "(", "container", ".", "Container", ")", "\n", "}", "\n", "}", "else", "{", "// If this is a container state error", "updateContainerMetadata", "(", "&", "metadata", ",", "container", ".", "Container", ",", "task", ")", "\n", "container", ".", "Container", ".", "ApplyingError", "=", "apierrors", ".", "NewNamedError", "(", "metadata", ".", "Error", ")", "\n", "}", "\n", "}", "else", "{", "// update the container metadata in case the container status/metadata changed during agent restart", "updateContainerMetadata", "(", "&", "metadata", ",", "container", ".", "Container", ",", "task", ")", "\n", "engine", ".", "imageManager", ".", "RecordContainerReference", "(", "container", ".", "Container", ")", "\n", "if", "engine", ".", "cfg", ".", "ContainerMetadataEnabled", "&&", "!", "container", ".", "Container", ".", "IsMetadataFileUpdated", "(", ")", "{", "go", "engine", ".", "updateMetadataFile", "(", "task", ",", "container", ")", "\n", "}", "\n", "}", "\n", "if", "currentState", ">", "container", ".", "Container", ".", "GetKnownStatus", "(", ")", "{", "// update the container known status", "container", ".", "Container", ".", "SetKnownStatus", "(", "currentState", ")", "\n", "}", "\n", "// Update task ExecutionStoppedAt timestamp", "task", ".", "RecordExecutionStoppedAt", "(", "container", ".", "Container", ")", "\n", "}" ]
18,314
all-18315
[ "In", "test", "mode", "we", "use", "unique", "names", "for", "cache", "groups", "since", "we", "might", "want", "to", "run", "multiple", "block", "servers", "locally", "which", "would", "conflict", "if", "groups", "had", "the", "same", "name", ".", "We", "also", "do", "not", "report", "stats", "to", "prometheus" ]
[ "func", "newObjBlockAPIServer", "(", "dir", "string", ",", "cacheBytes", "int64", ",", "etcdAddress", "string", ",", "objClient", "obj", ".", "Client", ",", "test", "bool", ")", "(", "*", "objBlockAPIServer", ",", "error", ")", "{", "// defensive measure to make sure storage is working and error early if it's not", "// this is where we'll find out if the credentials have been misconfigured", "if", "err", ":=", "obj", ".", "TestStorage", "(", "context", ".", "Background", "(", ")", ",", "objClient", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "oneCacheShare", ":=", "cacheBytes", "/", "(", "objectCacheShares", "+", "tagCacheShares", "+", "objectInfoCacheShares", "+", "blockCacheShares", ")", "\n", "s", ":=", "&", "objBlockAPIServer", "{", "Logger", ":", "log", ".", "NewLogger", "(", "\"", "\"", ")", ",", "dir", ":", "dir", ",", "objClient", ":", "objClient", ",", "objectIndexes", ":", "make", "(", "<mask>", "[", "string", "]", "*", "pfsclient", ".", "ObjectIndex", ")", ",", "objectCacheBytes", ":", "oneCacheShare", "*", "objectCacheShares", ",", "}", "\n\n", "objectGroupName", ":=", "\"", "\"", "\n", "tagGroupName", ":=", "\"", "\"", "\n", "objectInfoGroupName", ":=", "\"", "\"", "\n", "blockGroupName", ":=", "\"", "\"", "\n\n", "if", "test", "{", "uuid", ":=", "uuid", ".", "New", "(", ")", "\n", "objectGroupName", "+=", "uuid", "\n", "tagGroupName", "+=", "uuid", "\n", "objectInfoGroupName", "+=", "uuid", "\n", "blockGroupName", "+=", "uuid", "\n", "}", "\n\n", "s", ".", "objectCache", "=", "groupcache", ".", "NewGroup", "(", "objectGroupName", ",", "oneCacheShare", "*", "objectCacheShares", ",", "groupcache", ".", "GetterFunc", "(", "s", ".", "objectGetter", ")", ")", "\n", "s", ".", "tagCache", "=", "groupcache", ".", "NewGroup", "(", "tagGroupName", ",", "oneCacheShare", "*", "tagCacheShares", ",", "groupcache", ".", "GetterFunc", "(", "s", ".", "tagGetter", ")", ")", "\n", "s", ".", "objectInfoCache", "=", "groupcache", ".", "NewGroup", "(", "objectInfoGroupName", ",", "oneCacheShare", "*", "objectInfoCacheShares", ",", "groupcache", ".", "GetterFunc", "(", "s", ".", "objectInfoGetter", ")", ")", "\n", "s", ".", "blockCache", "=", "groupcache", ".", "NewGroup", "(", "blockGroupName", ",", "oneCacheShare", "*", "blockCacheShares", ",", "groupcache", ".", "GetterFunc", "(", "s", ".", "blockGetter", ")", ")", "\n\n", "if", "!", "test", "{", "RegisterCacheStats", "(", "\"", "\"", ",", "&", "s", ".", "tagCache", ".", "Stats", ")", "\n", "RegisterCacheStats", "(", "\"", "\"", ",", "&", "s", ".", "objectCache", ".", "Stats", ")", "\n", "RegisterCacheStats", "(", "\"", "\"", ",", "&", "s", ".", "objectInfoCache", ".", "Stats", ")", "\n", "}", "\n\n", "go", "s", ".", "watchGC", "(", "etcdAddress", ")", "\n", "return", "s", ",", "nil", "\n", "}" ]
18,315
all-18316
[ "Config", "handling" ]
[ "func", "(", "c", "*", "containerLXC", ")", "expandConfig", "(", "profiles", "[", "]", "api", ".", "Profile", ")", "error", "{", "if", "profiles", "==", "nil", "&&", "len", "(", "c", ".", "profiles", ")", ">", "0", "{", "var", "err", "error", "\n", "profiles", ",", "err", "=", "c", ".", "<mask>", ".", "Cluster", ".", "ProfilesGet", "(", "c", ".", "project", ",", "c", ".", "profiles", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "c", ".", "expandedConfig", "=", "db", ".", "ProfilesExpandConfig", "(", "c", ".", "localConfig", ",", "profiles", ")", "\n\n", "return", "nil", "\n", "}" ]
18,316
all-18317
[ "JSONFieldsFromStruct", "returns", "the", "names", "of", "JSON", "fields", "associated", "with", "the", "given", "struct", ".", "Returns", "nil", "if", "v", "is", "not", "a", "struct" ]
[ "func", "JSONFieldsFromStruct", "(", "v", "reflect", ".", "Value", ")", "[", "]", "string", "{", "if", "v", ".", "Kind", "(", ")", "!=", "reflect", ".", "Struct", "{", "return", "nil", "\n", "}", "\n\n", "m", ":=", "getType2jfm", "(", "v", ".", "Type", "(", ")", ")", "\n", "m", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "l", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "m", ".", "fields", ")", ")", "\n", "for", "k", ":=", "range", "m", ".", "fields", "{", "l", "=", "append", "(", "l", ",", "k", ")", "\n", "}", "\n", "return", "l", "\n", "}" ]
18,317
all-18318
[ "signatureFunc", "returns", "a", "function", "that", "calculates", "the", "signature", "for", "a", "metric", "ignoring", "the", "provided", "labels", ".", "If", "on", "then", "the", "given", "labels", "are", "only", "used", "instead", "." ]
[ "func", "signatureFunc", "(", "on", "bool", ",", "names", "...", "string", ")", "func", "(", "labels", ".", "Labels", ")", "uint64", "{", "// TODO(fabxc): ensure names are sorted and then use that and sortedness", "// of labels by names to speed up the operations below.", "// Alternatively, inline the hashing and don't build new label sets.", "if", "on", "{", "return", "func", "(", "lset", "labels", ".", "Labels", ")", "uint64", "{", "return", "lset", ".", "HashForLabels", "(", "names", "...", ")", "}", "\n", "}", "\n", "return", "func", "(", "lset", "labels", ".", "Labels", ")", "uint64", "{", "return", "lset", ".", "HashWithoutLabels", "(", "<mask>", "...", ")", "}", "\n", "}" ]
18,318
all-18319
[ "readAtLeast", "is", "an", "optimized", "version", "of", "io", ".", "ReadAtLeast", "which", "omits", "some", "checks", "that", "don", "t", "need", "to", "be", "performed", "when", "called", "from", "Read", "()", "in", "this", "package", "." ]
[ "func", "readAtLeast", "(", "r", "<mask>", ".", "Reader", ",", "buf", "[", "]", "byte", ",", "min", "int", ")", "error", "{", "var", "n", "int", "\n", "var", "err", "error", "\n", "// Most common case, we get all the bytes in one read", "if", "n", ",", "err", "=", "r", ".", "Read", "(", "buf", ")", ";", "n", "==", "min", "{", "return", "nil", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// Fall back to looping", "var", "nn", "int", "\n", "for", "n", "<", "min", "{", "nn", ",", "err", "=", "r", ".", "Read", "(", "buf", "[", "n", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "&&", "n", ">", "0", "{", "err", "=", "io", ".", "ErrUnexpectedEOF", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "n", "+=", "nn", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,319
all-18320
[ "GetFileReadSeeker", "returns", "a", "reader", "for", "the", "contents", "of", "a", "file", "at", "a", "specific", "Commit", "that", "permits", "Seeking", "to", "different", "points", "in", "the", "file", "." ]
[ "func", "(", "c", "APIClient", ")", "GetFileReadSeeker", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ")", "(", "io", ".", "ReadSeeker", ",", "error", ")", "{", "fileInfo", ",", "err", ":=", "c", ".", "InspectFile", "(", "repoName", ",", "commitID", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "reader", ",", "err", ":=", "c", ".", "GetFileReader", "(", "repoName", ",", "commitID", ",", "path", ",", "0", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "getFileReadSeeker", "{", "Reader", ":", "reader", ",", "file", ":", "NewFile", "(", "repoName", ",", "commitID", ",", "<mask>", ")", ",", "offset", ":", "0", ",", "size", ":", "int64", "(", "fileInfo", ".", "SizeBytes", ")", ",", "c", ":", "c", ",", "}", ",", "nil", "\n", "}" ]
18,320
all-18321
[ "SyncQuery", "executes", "an", "arbitrary", "query", "string", "and", "returns", "the", "result", "synchronously", "(", "unless", "the", "response", "takes", "longer", "than", "the", "provided", "timeout", ")" ]
[ "func", "(", "c", "*", "Client", ")", "SyncQuery", "(", "dataset", ",", "project", ",", "queryStr", "string", ",", "maxResults", "int64", ")", "(", "[", "]", "[", "]", "interface", "{", "}", ",", "error", ")", "{", "service", ",", "err", ":=", "c", ".", "<mask>", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "datasetRef", ":=", "&", "bigquery", ".", "DatasetReference", "{", "DatasetId", ":", "dataset", ",", "ProjectId", ":", "project", ",", "}", "\n\n", "query", ":=", "&", "bigquery", ".", "QueryRequest", "{", "DefaultDataset", ":", "datasetRef", ",", "MaxResults", ":", "maxResults", ",", "Kind", ":", "\"", "\"", ",", "Query", ":", "queryStr", ",", "}", "\n\n", "results", ",", "err", ":=", "service", ".", "Jobs", ".", "Query", "(", "project", ",", "query", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "printDebug", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// credit to https://github.com/getlantern/statshub for the row building approach", "numRows", ":=", "int", "(", "results", ".", "TotalRows", ")", "\n", "if", "numRows", ">", "int", "(", "maxResults", ")", "{", "numRows", "=", "int", "(", "maxResults", ")", "\n", "}", "\n\n", "_", ",", "rows", ":=", "c", ".", "headersAndRows", "(", "results", ".", "Schema", ",", "results", ".", "Rows", ")", "\n", "return", "rows", ",", "nil", "\n", "}" ]
18,321
all-18322
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DatabaseWithObjectStores", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,322
all-18323
[ "SearchContactGroups", "returns", "contact", "groups", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "contact", "groups", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchContactGroups", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "ContactGroup", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchContactGroups", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "ContactGroupPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "<mask>", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "groups", "[", "]", "ContactGroup", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "groups", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "groups", ",", "nil", "\n", "}" ]
18,323
all-18324
[ "GetIsLandscape", "returns", "the", "IsLandscape", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsLocation", ")", "GetIsLandscape", "(", ")", "bool", "{", "if", "s", "==", "nil", "||", "s", ".", "IsLandscape", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "s", ".", "IsLandscape", "\n", "}" ]
18,324
all-18325
[ "GetAttachedVolume", "gets", "an", "attached", "volume" ]
[ "func", "(", "c", "*", "Client", ")", "GetAttachedVolume", "(", "dcid", ",", "srvid", ",", "volid", "string", ")", "(", "*", "Volume", ",", "error", ")", "{", "url", ":=", "serverVolumePath", "(", "dcid", ",", "srvid", ",", "volid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "<mask>", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Volume", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n\n", "return", "ret", ",", "err", "\n", "}" ]
18,325
all-18326
[ "PatchesMarkApplied", "marks", "the", "patch", "with", "the", "given", "name", "as", "applied", "on", "this", "node", "." ]
[ "func", "(", "n", "*", "Node", ")", "PatchesMarkApplied", "(", "<mask>", "string", ")", "error", "{", "stmt", ":=", "`INSERT INTO patches (name, applied_at) VALUES (?, strftime(\"%s\"));`", "\n", "_", ",", "err", ":=", "n", ".", "db", ".", "Exec", "(", "stmt", ",", "patch", ")", "\n", "return", "err", "\n", "}" ]
18,326
all-18327
[ "GetSystemVisual", "is", "a", "wrapper", "around", "gdk_screen_get_system_visual", "()", "." ]
[ "func", "(", "v", "*", "Screen", ")", "GetSystemVisual", "(", ")", "(", "*", "Visual", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gdk_screen_get_system_visual", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "return", "&", "Visual", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", ",", "nil", "\n", "}" ]
18,327
all-18328
[ "MustNewBaseFee", "retrieves", "the", "NewBaseFee", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "LedgerUpgrade", ")", "MustNewBaseFee", "(", ")", "Uint32", "{", "val", ",", "<mask>", ":=", "u", ".", "GetNewBaseFee", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
18,328
all-18329
[ "RealIP", "is", "a", "middleware", "that", "sets", "a", "http", ".", "Request", "s", "RemoteAddr", "to", "the", "results", "of", "parsing", "either", "the", "X", "-", "Forwarded", "-", "For", "header", "or", "the", "X", "-", "Real", "-", "IP", "header", "(", "in", "that", "order", ")", ".", "This", "middleware", "should", "be", "inserted", "fairly", "early", "in", "the", "middleware", "stack", "to", "ensure", "that", "subsequent", "layers", "(", "e", ".", "g", ".", "request", "loggers", ")", "which", "examine", "the", "RemoteAddr", "will", "see", "the", "intended", "value", ".", "You", "should", "only", "use", "this", "middleware", "if", "you", "can", "trust", "the", "headers", "passed", "to", "you", "(", "in", "particular", "the", "two", "headers", "this", "middleware", "uses", ")", "for", "example", "because", "you", "have", "placed", "a", "reverse", "proxy", "like", "HAProxy", "or", "nginx", "in", "front", "of", "chi", ".", "If", "your", "reverse", "proxies", "are", "configured", "to", "pass", "along", "arbitrary", "header", "values", "from", "the", "client", "or", "if", "you", "use", "this", "middleware", "without", "a", "reverse", "proxy", "malicious", "clients", "will", "be", "able", "to", "make", "you", "very", "sad", "(", "or", "depending", "on", "how", "you", "re", "using", "RemoteAddr", "vulnerable", "to", "an", "attack", "of", "some", "sort", ")", "." ]
[ "func", "RealIP", "(", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "fn", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "if", "rip", ":=", "realIP", "(", "r", ")", ";", "rip", "!=", "\"", "\"", "{", "r", ".", "RemoteAddr", "=", "rip", "\n", "}", "\n", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "\n\n", "return", "http", ".", "HandlerFunc", "(", "fn", ")", "\n", "}" ]
18,329
all-18330
[ "Time", "returns", "the", "timestamp", "part", "of", "the", "id", ".", "It", "s", "a", "runtime", "error", "to", "call", "this", "method", "with", "an", "invalid", "id", "." ]
[ "func", "(", "id", "ObjectId", ")", "Time", "(", ")", "time", ".", "Time", "{", "// First 4 bytes of ObjectId is 32-bit big-endian seconds from epoch.", "secs", ":=", "int64", "(", "binary", ".", "BigEndian", ".", "Uint32", "(", "id", ".", "byteSlice", "(", "0", ",", "4", ")", ")", ")", "\n", "return", "<mask>", ".", "Unix", "(", "secs", ",", "0", ")", "\n", "}" ]
18,330
all-18331
[ "Remove", "removes", "the", "watcher", "from", "watcherHub", "The", "actual", "remove", "function", "is", "guaranteed", "to", "only", "be", "executed", "once" ]
[ "func", "(", "w", "*", "watcher", ")", "Remove", "(", ")", "{", "w", ".", "hub", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "hub", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "<mask>", "(", "w", ".", "eventChan", ")", "\n", "if", "w", ".", "remove", "!=", "nil", "{", "w", ".", "remove", "(", ")", "\n", "}", "\n", "}" ]
18,331
all-18332
[ "Read", "reads", "VMX", "file", "from", "disk", "and", "unmarshals", "it" ]
[ "func", "(", "vmxfile", "*", "VMXFile", ")", "Read", "(", ")", "error", "{", "<mask>", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "vmxfile", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "model", ":=", "new", "(", "vmx", ".", "VirtualMachine", ")", "\n\n", "err", "=", "vmx", ".", "Unmarshal", "(", "data", ",", "model", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "vmxfile", ".", "model", "=", "model", "\n\n", "return", "nil", "\n", "}" ]
18,332
all-18333
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SignedExchangeInfo", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,333
all-18334
[ "Reader", "read", "handler", "." ]
[ "func", "yaml_reader_read_handler", "(", "parser", "*", "yaml_parser_t", ",", "buffer", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "parser", ".", "input_reader", ".", "Read", "(", "<mask>", ")", "\n", "}" ]
18,334
all-18335
[ "InspectJob", "returns", "info", "about", "a", "specific", "job", ".", "blockState", "will", "cause", "the", "call", "to", "block", "until", "the", "job", "reaches", "a", "terminal", "state", "(", "failure", "or", "success", ")", "." ]
[ "func", "(", "c", "APIClient", ")", "InspectJob", "(", "jobID", "string", ",", "blockState", "bool", ")", "(", "*", "pps", ".", "JobInfo", ",", "error", ")", "{", "jobInfo", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "InspectJob", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pps", ".", "InspectJobRequest", "{", "<mask>", ":", "NewJob", "(", "jobID", ")", ",", "BlockState", ":", "blockState", ",", "}", ")", "\n", "return", "jobInfo", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
18,335
all-18336
[ "InMemoryNetwork", "creates", "a", "fully", "in", "-", "memory", "listener", "and", "dial", "function", ".", "Each", "time", "the", "dial", "function", "is", "invoked", "a", "new", "pair", "of", "net", ".", "Conn", "objects", "will", "be", "created", "using", "net", ".", "Pipe", ":", "the", "listener", "s", "Accept", "method", "will", "unblock", "and", "return", "one", "end", "of", "the", "pipe", "and", "the", "other", "end", "will", "be", "returned", "by", "the", "dial", "function", "." ]
[ "func", "InMemoryNetwork", "(", ")", "(", "net", ".", "Listener", ",", "func", "(", ")", "net", ".", "Conn", ")", "{", "listener", ":=", "&", "inMemoryListener", "{", "conns", ":", "make", "(", "chan", "net", ".", "Conn", ",", "16", ")", ",", "closed", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "dialer", ":=", "func", "(", ")", "net", ".", "Conn", "{", "<mask>", ",", "client", ":=", "net", ".", "Pipe", "(", ")", "\n", "listener", ".", "conns", "<-", "server", "\n", "return", "client", "\n", "}", "\n", "return", "listener", ",", "dialer", "\n", "}" ]
18,336
all-18337
[ "Left", "returns", "the", "number", "of", "remaining", "requests", "for", "id", "during", "a", "current", "period", "." ]
[ "func", "(", "r", "*", "RateLimiter", ")", "Left", "(", "id", "string", ")", "(", "int64", ",", "error", ")", "{", "// Retrieve attempted count.", "attempted", ",", "err", ":=", "r", ".", "Attempted", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// Left is max minus attempted.", "left", ":=", "r", ".", "max", "-", "attempted", "\n", "if", "left", "<", "0", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "return", "left", ",", "nil", "\n", "}" ]
18,337
all-18338
[ "Method", "adds", "the", "route", "pattern", "that", "matches", "method", "http", "method", "to", "execute", "the", "handler", "http", ".", "Handler", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Method", "(", "method", ",", "pattern", "string", ",", "handler", "http", ".", "Handler", ")", "{", "m", ",", "ok", ":=", "methodMap", "[", "strings", ".", "ToUpper", "(", "method", ")", "]", "\n", "if", "!", "ok", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ")", "\n", "}", "\n", "mx", ".", "handle", "(", "m", ",", "pattern", ",", "handler", ")", "\n", "}" ]
18,338
all-18339
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TakeHeapSnapshotParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,339
all-18340
[ "PATCH", "/", "api", "/", "patterns", "/", ":", "id", "Update", "the", "provided", "attributes", "of", "a", "Pattern", "." ]
[ "func", "(", "loc", "*", "PatternLocator", ")", "Update", "(", "options", "rsapi", ".", "APIParams", ")", "(", "*", "Pattern", ",", "error", ")", "{", "var", "res", "*", "Pattern", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "params", "=", "rsapi", ".", "APIParams", "{", "}", "\n", "<mask>", "viewOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "viewOpt", "!=", "nil", "{", "params", "[", "\"", "\"", "]", "=", "viewOpt", "\n", "}", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "}", "\n", "var", "monthsOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "monthsOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "monthsOpt", "\n", "}", "\n", "var", "nameOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "nameOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "nameOpt", "\n", "}", "\n", "var", "operationOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "operationOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "operationOpt", "\n", "}", "\n", "var", "summaryOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "summaryOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "summaryOpt", "\n", "}", "\n", "var", "type_Opt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "type_Opt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "type_Opt", "\n", "}", "\n", "var", "valueOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "valueOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "valueOpt", "\n", "}", "\n", "var", "yearsOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "yearsOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "yearsOpt", "\n", "}", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "Path", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "sr", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "sr", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "respBody", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "err", "=", "json", ".", "Unmarshal", "(", "respBody", ",", "&", "res", ")", "\n", "return", "res", ",", "err", "\n", "}" ]
18,340
all-18341
[ "String", "is", "the", "fully", "qualified", "function", "name", ".", "Sadly", "Go", "is", "a", "bit", "confused", "when", "the", "package", "name", "doesn", "t", "match", "the", "directory", "containing", "the", "source", "file", "and", "will", "use", "the", "directory", "name", "instead", "of", "the", "real", "package", "name", "." ]
[ "func", "(", "f", "*", "Func", ")", "String", "(", ")", "string", "{", "s", ",", "_", ":=", "<mask>", ".", "QueryUnescape", "(", "f", ".", "Raw", ")", "\n", "return", "s", "\n", "}" ]
18,341
all-18342
[ "String", "returns", "the", "textual", "representation", "of", "this", "AST" ]
[ "func", "(", "ast", "*", "AST", ")", "<mask>", "(", ")", "string", "{", "buf", ":=", "rbpool", ".", "Get", "(", ")", "\n", "defer", "rbpool", ".", "Release", "(", "buf", ")", "\n\n", "c", ":=", "ast", ".", "Visit", "(", ")", "\n", "k", ":=", "0", "\n", "for", "v", ":=", "range", "c", "{", "k", "++", "\n", "fmt", ".", "Fprintf", "(", "buf", ",", "\"", "\\n", "\"", ",", "k", ",", "v", ")", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
18,342
all-18343
[ "Tag", "returns", "a", "single", "tag" ]
[ "func", "(", "s", "*", "MockSpan", ")", "<mask>", "(", "k", "string", ")", "interface", "{", "}", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "return", "s", ".", "tags", "[", "k", "]", "\n", "}" ]
18,343
all-18344
[ "simple", "CLI", "interface", ".", "Sample", "usage", ":", "goner", "-", "n", "=", "8", "-", "min", "=", "8", "-", "max", "=", "10", "-", "digits", "=", "3", "-", "punctuation", "=", "3", "-", "uppercase", "=", "4", "Flags", ":", "-", "n", ":", "number", "of", "passwords", "to", "generate", "-", "min", ":", "minimum", "length", "-", "max", ":", "maximum", "length", "-", "digits", ":", "digits", "(", "0", "-", "9", ")", "characters", "-", "punctuation", ":", "punctuation", "characters", "-", "uppercase", ":", "uppercase", "characters" ]
[ "func", "main", "(", ")", "{", "n", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "8", ",", "\"", "\"", ")", "\n", "min", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "12", ",", "\"", "\"", ")", "\n", "max", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "digits", ":=", "<mask>", ".", "Int", "(", "\"", "\"", ",", "3", ",", "\"", "\"", ")", "\n", "punctuation", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "1", ",", "\"", "\"", ")", "\n", "uppercase", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "1", ",", "\"", "\"", ")", "\n", "flag", ".", "Parse", "(", ")", "\n", "reqs", ":=", "garbler", ".", "PasswordStrengthRequirements", "{", "MinimumTotalLength", ":", "*", "min", ",", "MaximumTotalLength", ":", "*", "max", ",", "Uppercase", ":", "*", "uppercase", ",", "Digits", ":", "*", "digits", ",", "Punctuation", ":", "*", "punctuation", ",", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "*", "n", ";", "i", "++", "{", "pass", ",", "err", ":=", "garbler", ".", "NewPassword", "(", "&", "reqs", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "err", ")", "\n", "return", "\n", "}", "\n", "fmt", ".", "Println", "(", "pass", ")", "\n", "}", "\n", "}" ]
18,344
all-18345
[ "NewResponseWrapper", "creates", "a", "new", "wrapper", ".", "The", "passed", "http", ".", "ResponseWriter", "is", "used", "in", "case", "the", "wrapper", "needs", "to", "be", "hijacked", "." ]
[ "func", "NewResponseWrapper", "(", "w", "<mask>", ".", "ResponseWriter", ")", "*", "ResponseWrapper", "{", "return", "&", "ResponseWrapper", "{", "ResponseRecorder", ":", "httptest", ".", "NewRecorder", "(", ")", ",", "writer", ":", "w", "}", "\n", "}" ]
18,345
all-18346
[ "GetStart", "returns", "the", "Start", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "GetStart", "(", ")", "int", "{", "if", "m", "==", "nil", "||", "m", ".", "Start", "==", "nil", "{", "<mask>", "0", "\n", "}", "\n", "return", "*", "m", ".", "Start", "\n", "}" ]
18,346
all-18347
[ "scratchCommitPrefix", "returns", "an", "etcd", "prefix", "that", "s", "used", "to", "temporarily", "store", "the", "state", "of", "a", "file", "in", "an", "open", "commit", ".", "Once", "the", "commit", "is", "finished", "the", "scratch", "space", "is", "removed", "." ]
[ "func", "(", "d", "*", "driver", ")", "scratchCommitPrefix", "(", "<mask>", "*", "pfs", ".", "Commit", ")", "string", "{", "// TODO(msteffen) this doesn't currenty (2018-2-4) use d.scratchPrefix(),", "// but probably should? If this is changed, filepathFromEtcdPath will also", "// need to change.", "return", "path", ".", "Join", "(", "commit", ".", "Repo", ".", "Name", ",", "commit", ".", "ID", ")", "\n", "}" ]
18,347
all-18348
[ "DiscoverRepositoryPath", "finds", "the", "path", "of", "the", "repository", "from", "a", "given", "directory", ".", "It", "returns", "the", "path", "to", "the", "repository", "or", "an", "an", "empty", "string", "and", "a", "non", "-", "nil", "error", "if", "it", "can", "t", "find", "the", "repository", "." ]
[ "func", "DiscoverRepositoryPath", "(", "dir", "string", ")", "(", "string", ",", "error", ")", "{", "_", ",", "err", ":=", "<mask>", ".", "Stat", "(", "dir", ")", "\n", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "\"", "\"", ",", "ErrRepositoryNotFound", "\n", "}", "\n", "dir", "=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n", "for", "dir", "!=", "\"", "\"", "{", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "dir", ")", "\n", "if", "err", "==", "nil", "&&", "fi", ".", "IsDir", "(", ")", "{", "return", "dir", ",", "nil", "\n", "}", "\n", "dir", "=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "\"", "\"", ",", "ErrRepositoryNotFound", "\n", "}" ]
18,348
all-18349
[ "calcSize", "calculates", "the", "total", "retained", "size", "for", "each", "vertex", "." ]
[ "func", "(", "d", "*", "dominators", ")", "calcSize", "(", "p", "*", "Process", ")", "{", "d", ".", "size", "=", "make", "(", "[", "]", "int64", ",", "len", "(", "d", ".", "idom", ")", ")", "\n", "type", "workItem", "struct", "{", "v", "vName", "\n", "<mask>", "dfsMode", "\n", "}", "\n", "work", ":=", "[", "]", "workItem", "{", "{", "pseudoRoot", ",", "down", "}", "}", "\n\n", "for", "len", "(", "work", ")", ">", "0", "{", "item", ":=", "&", "work", "[", "len", "(", "work", ")", "-", "1", "]", "\n\n", "kids", ":=", "d", ".", "redge", "[", "d", ".", "ridx", "[", "item", ".", "v", "]", ":", "d", ".", "ridx", "[", "item", ".", "v", "+", "1", "]", "]", "\n", "if", "item", ".", "mode", "==", "down", "&&", "len", "(", "kids", ")", "!=", "0", "{", "item", ".", "mode", "=", "up", "\n", "for", "_", ",", "w", ":=", "range", "kids", "{", "if", "w", "==", "0", "{", "// bogus self-edge. Ignore.", "continue", "\n", "}", "\n", "work", "=", "append", "(", "work", ",", "workItem", "{", "w", ",", "down", "}", ")", "\n", "}", "\n", "continue", "\n", "}", "\n\n", "work", "=", "work", "[", ":", "len", "(", "work", ")", "-", "1", "]", "\n\n", "root", ",", "obj", ":=", "d", ".", "findVertexByName", "(", "item", ".", "v", ")", "\n", "var", "size", "int64", "\n", "switch", "{", "case", "item", ".", "v", "==", "pseudoRoot", ":", "break", "\n", "case", "root", "!=", "nil", ":", "size", "+=", "root", ".", "Type", ".", "Size", "\n", "default", ":", "size", "+=", "p", ".", "Size", "(", "obj", ")", "\n", "}", "\n", "for", "_", ",", "w", ":=", "range", "kids", "{", "size", "+=", "d", ".", "size", "[", "w", "]", "\n", "}", "\n", "d", ".", "size", "[", "item", ".", "v", "]", "=", "size", "\n", "}", "\n", "}" ]
18,349
all-18350
[ "title", ":", "plan", "list", "path", ":", "/", "plans", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "204", ":", "No", "content" ]
[ "func", "listPlans", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "plans", ",", "err", ":=", "servicemanager", ".", "Plan", ".", "List", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "plans", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "plans", ")", "\n", "}" ]
18,350
all-18351
[ "GetImageFingerprints", "returns", "a", "list", "of", "available", "image", "fingerprints" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetImageFingerprints", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "urls", ":=", "[", "]", "string", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "urls", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Parse it", "fingerprints", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "<mask>", ":=", "range", "urls", "{", "fields", ":=", "strings", ".", "Split", "(", "url", ",", "\"", "\"", ")", "\n", "fingerprints", "=", "append", "(", "fingerprints", ",", "fields", "[", "len", "(", "fields", ")", "-", "1", "]", ")", "\n", "}", "\n\n", "return", "fingerprints", ",", "nil", "\n", "}" ]
18,351
all-18352
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PerformSearchParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom28", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,352
all-18353
[ "modifyJSON", "writes", "to", "auth", ".", "json", "if", "the", "dockerConfigFile", "has", "been", "updated" ]
[ "func", "modifyJSON", "(", "sys", "*", "types", ".", "SystemContext", ",", "editor", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "bool", ",", "error", ")", ")", "error", "{", "path", ",", "err", ":=", "getPathToAuth", "(", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "dir", ":=", "filepath", ".", "Dir", "(", "path", ")", "\n", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "dir", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "err", "=", "os", ".", "MkdirAll", "(", "dir", ",", "0700", ")", ";", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dir", ")", "\n", "}", "\n", "}", "\n\n", "auths", ",", "err", ":=", "readJSONFile", "(", "path", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "updated", ",", "err", ":=", "editor", "(", "&", "auths", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "if", "updated", "{", "newData", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "auths", ",", "\"", "\"", ",", "\"", "\\t", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "if", "err", "=", "ioutil", ".", "WriteFile", "(", "path", ",", "newData", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,353
all-18354
[ "TODO", "cairo_surface_create_similar_image", "(", "since", "1", ".", "12", ")", "CreateForRectangle", "is", "a", "wrapper", "around", "cairo_surface_create_for_rectangle", "()", "." ]
[ "func", "(", "v", "*", "Surface", ")", "CreateForRectangle", "(", "x", ",", "y", ",", "width", ",", "height", "float64", ")", "*", "Surface", "{", "c", ":=", "C", ".", "cairo_surface_create_for_rectangle", "(", "v", ".", "native", "(", ")", ",", "C", ".", "double", "(", "x", ")", ",", "C", ".", "double", "(", "y", ")", ",", "C", ".", "double", "(", "<mask>", ")", ",", "C", ".", "double", "(", "height", ")", ")", "\n", "s", ":=", "wrapSurface", "(", "c", ")", "\n", "runtime", ".", "SetFinalizer", "(", "s", ",", "(", "*", "Surface", ")", ".", "destroy", ")", "\n", "return", "s", "\n", "}" ]
18,354
all-18355
[ "Params", "reads", "request", "parameters", "into", "given", "object", ".", "Object", "should", "be", "passed", "by", "reference", "." ]
[ "func", "(", "ctx", "*", "ReqCtx", ")", "Params", "(", "v", "interface", "{", "}", ")", "error", "{", "if", "ctx", ".", "params", "==", "nil", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "ctx", ".", "params", ",", "v", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,355
all-18356
[ "ForceSet", "is", "used", "to", "force", "set", "the", "value", "of", "a", "dependency", "for", "a", "given", "hash", "code" ]
[ "func", "(", "b", "*", "Brain", ")", "ForceSet", "(", "hashCode", "string", ",", "<mask>", "interface", "{", "}", ")", "{", "b", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "Unlock", "(", ")", "\n\n", "b", ".", "data", "[", "hashCode", "]", "=", "data", "\n", "b", ".", "receivedData", "[", "hashCode", "]", "=", "struct", "{", "}", "{", "}", "\n", "}" ]
18,356
all-18357
[ "PingOfferings", "given", "offerings", "ids", "pings", "each", "of", "them", "and", "returns", "result", "of", "the", "test", "." ]
[ "func", "(", "h", "*", "Handler", ")", "PingOfferings", "(", "tkn", "string", ",", "ids", "[", "]", "string", ")", "(", "map", "[", "string", "]", "bool", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "ids", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "ret", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n\n", "wg", ":=", "new", "(", "sync", ".", "WaitGroup", ")", "\n", "wg", ".", "Add", "(", "len", "(", "ids", ")", ")", "\n", "for", "_", ",", "id", ":=", "range", "ids", "{", "offering", ",", "err", ":=", "h", ".", "findActiveOfferingByID", "(", "logger", ",", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "go", "func", "(", "offering", "*", "data", ".", "Offering", ")", "{", "err", ":=", "h", ".", "pingOffering", "(", "logger", ",", "offering", ")", "\n", "if", "err", "==", "nil", "{", "ret", "[", "offering", ".", "ID", "]", "=", "true", "\n", "offering", ".", "SOMCSuccessPing", "=", "&", "now", "\n", "err", "=", "update", "(", "logger", ",", "h", ".", "db", ".", "Querier", ",", "offering", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "else", "{", "ret", "[", "offering", ".", "ID", "]", "=", "false", "\n", "logger", ".", "Debug", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "wg", ".", "Done", "(", ")", "\n", "}", "(", "offering", ")", "\n", "}", "\n", "wg", ".", "Wait", "(", ")", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
18,357
all-18358
[ "MustOffer", "retrieves", "the", "Offer", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "LedgerEntryData", ")", "MustOffer", "(", ")", "OfferEntry", "{", "val", ",", "ok", ":=", "u", ".", "GetOffer", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
18,358
all-18359
[ "CloudIPs", "retrieves", "a", "list", "of", "all", "cloud", "ips" ]
[ "func", "(", "c", "*", "<mask>", ")", "CloudIPs", "(", ")", "(", "[", "]", "CloudIP", ",", "error", ")", "{", "var", "cloudips", "[", "]", "CloudIP", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "cloudips", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "cloudips", ",", "err", "\n", "}" ]
18,359
all-18360
[ "DeleteRange", "implements", "the", "LogStore", "interface", "." ]
[ "func", "(", "i", "*", "InmemStore", ")", "DeleteRange", "(", "min", ",", "<mask>", "uint64", ")", "error", "{", "i", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "l", ".", "Unlock", "(", ")", "\n", "for", "j", ":=", "min", ";", "j", "<=", "max", ";", "j", "++", "{", "delete", "(", "i", ".", "logs", ",", "j", ")", "\n", "}", "\n", "if", "min", "<=", "i", ".", "lowIndex", "{", "i", ".", "lowIndex", "=", "max", "+", "1", "\n", "}", "\n", "if", "max", ">=", "i", ".", "highIndex", "{", "i", ".", "highIndex", "=", "min", "-", "1", "\n", "}", "\n", "if", "i", ".", "lowIndex", ">", "i", ".", "highIndex", "{", "i", ".", "lowIndex", "=", "0", "\n", "i", ".", "highIndex", "=", "0", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,360
all-18361
[ "advertiseLoop", "readvertises", "the", "service", "approximately", "every", "minute", "(", "with", "some", "fuzzing", ")", "." ]
[ "func", "(", "c", "*", "Client", ")", "advertiseLoop", "(", ")", "{", "sleepFor", ":=", "c", ".", "fuzzedAdvertiseInterval", "(", ")", "\n", "consecutiveFailures", ":=", "uint", "(", "0", ")", "\n\n", "for", "{", "c", ".", "sleep", "(", "sleepFor", ")", "\n", "if", "c", ".", "IsClosed", "(", ")", "{", "c", ".", "tchan", ".", "Logger", "(", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "sendAdvertise", "(", ")", ";", "err", "!=", "nil", "{", "consecutiveFailures", "++", "\n", "errLogger", ":=", "c", ".", "tchan", ".", "Logger", "(", ")", ".", "WithFields", "(", "tchannel", ".", "ErrField", "(", "err", ")", ")", "\n", "if", "consecutiveFailures", ">=", "maxAdvertiseFailures", "&&", "c", ".", "opts", ".", "FailStrategy", "==", "FailStrategyFatal", "{", "c", ".", "opts", ".", "Handler", ".", "OnError", "(", "ErrAdvertiseFailed", "{", "Cause", ":", "err", ",", "WillRetry", ":", "false", "}", ")", "\n", "errLogger", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n\n", "c", ".", "logFailedRegistrationRetry", "(", "errLogger", ",", "consecutiveFailures", ")", "\n", "c", ".", "opts", ".", "Handler", ".", "OnError", "(", "ErrAdvertiseFailed", "{", "Cause", ":", "err", ",", "WillRetry", ":", "true", "}", ")", "\n\n", "// Even after many failures, cap backoff.", "if", "consecutiveFailures", "<", "maxAdvertiseFailures", "{", "sleepFor", "=", "fuzzInterval", "(", "advertiseRetryInterval", "*", "time", ".", "Duration", "(", "1", "<<", "consecutiveFailures", ")", ")", "\n", "}", "\n", "}", "else", "{", "c", ".", "opts", ".", "<mask>", ".", "On", "(", "Readvertised", ")", "\n", "sleepFor", "=", "c", ".", "fuzzedAdvertiseInterval", "(", ")", "\n", "consecutiveFailures", "=", "0", "\n", "}", "\n", "}", "\n", "}" ]
18,361
all-18362
[ "Update", "updates", "the", "current", "game", "state", "." ]
[ "func", "(", "g", "*", "Game", ")", "Update", "(", ")", "error", "{", "g", ".", "<mask>", ".", "Update", "(", ")", "\n", "if", "err", ":=", "g", ".", "board", ".", "Update", "(", "g", ".", "input", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,362
all-18363
[ "CreateOffer", "creates", "a", "new", "offer" ]
[ "func", "CreateOffer", "(", "rate", "Rate", ",", "amount", "Amount", ")", "(", "result", "ManageOfferBuilder", ")", "{", "return", "ManageOffer", "(", "false", ",", "rate", ",", "<mask>", ")", "\n", "}" ]
18,363
all-18364
[ "init", "sets", "up", "command", "line", "flags" ]
[ "func", "init", "(", ")", "{", "flag", ".", "Usage", "=", "func", "(", ")", "{", "fmt", ".", "Fprintf", "(", "<mask>", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "os", ".", "Args", "[", "0", "]", ")", "\n", "flag", ".", "PrintDefaults", "(", ")", "\n", "}", "\n", "flag", ".", "Parse", "(", ")", "\n", "log", ".", "SetLevel", "(", "log", ".", "InfoLevel", ")", "\n", "}" ]
18,364
all-18365
[ "Stop", "stops", "the", "specified", "version", "of", "the", "specified", "module", ".", "If", "either", "module", "or", "version", "are", "the", "empty", "string", "it", "means", "the", "default", "." ]
[ "func", "Stop", "(", "c", "context", ".", "Context", ",", "module", ",", "version", "string", ")", "error", "{", "req", ":=", "&", "pb", ".", "StopModuleRequest", "{", "}", "\n", "if", "module", "!=", "\"", "\"", "{", "req", ".", "Module", "=", "&", "module", "\n", "}", "\n", "if", "version", "!=", "\"", "\"", "{", "req", ".", "Version", "=", "&", "version", "\n", "}", "\n", "<mask>", ":=", "&", "pb", ".", "StopModuleResponse", "{", "}", "\n", "return", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "}" ]
18,365
all-18366
[ "HasLayoutType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GroupDefinition", ")", "HasLayoutType", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "LayoutType", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,366
all-18367
[ "Returns", "a", "string", "at", "the", "key", "or", "the", "specified", "value", "if", "it", "doesn", "t", "exist", "or", "isn", "t", "a", "string" ]
[ "func", "(", "t", "Typed", ")", "StringOr", "(", "key", "string", ",", "d", "string", ")", "string", "{", "if", "value", ",", "exists", ":=", "t", ".", "StringIf", "(", "<mask>", ")", ";", "exists", "{", "return", "value", "\n", "}", "\n", "return", "d", "\n", "}" ]
18,367
all-18368
[ "RegisterWatchHandler", "registers", "the", "http", "handlers", "for", "service", "Watch", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
[ "func", "RegisterWatchHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterWatchHandlerClient", "(", "ctx", ",", "mux", ",", "etcdserverpb", ".", "NewWatchClient", "(", "<mask>", ")", ")", "\n", "}" ]
18,368
all-18369
[ "Set", "a", "value", "onto", "the", "Context", ".", "Any", "value", "set", "onto", "the", "Context", "will", "be", "automatically", "available", "in", "templates", "." ]
[ "func", "(", "d", "*", "DefaultContext", ")", "Set", "(", "key", "string", ",", "<mask>", "interface", "{", "}", ")", "{", "d", ".", "moot", ".", "Lock", "(", ")", "\n", "d", ".", "data", "[", "key", "]", "=", "value", "\n", "d", ".", "moot", ".", "Unlock", "(", ")", "\n", "}" ]
18,369
all-18370
[ "Return", "a", "TreePath", "from", "the", "GList" ]
[ "func", "TreePathFromList", "(", "list", "*", "glib", ".", "List", ")", "*", "TreePath", "{", "if", "list", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "TreePath", "{", "(", "*", "C", ".", "GtkTreePath", ")", "(", "<mask>", ".", "Data", "(", ")", ".", "(", "unsafe", ".", "Pointer", ")", ")", "}", "\n", "}" ]
18,370
all-18371
[ "Retry", "on", "transport", "failures", ".", "Does", "not", "retry", "on", "500s", "." ]
[ "func", "(", "c", "*", "Client", ")", "requestRetry", "(", "r", "*", "request", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "fake", "&&", "r", ".", "deckPath", "==", "\"", "\"", "{", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}", "\n", "resp", ",", "err", ":=", "c", ".", "retry", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "defer", "resp", ".", "<mask>", ".", "Close", "(", ")", "\n", "rb", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "resp", ".", "StatusCode", "==", "404", "{", "return", "nil", ",", "NewNotFoundError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "rb", ")", ")", ")", "\n", "}", "else", "if", "resp", ".", "StatusCode", "==", "409", "{", "return", "nil", ",", "NewConflictError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "rb", ")", ")", ")", "\n", "}", "else", "if", "resp", ".", "StatusCode", "==", "422", "{", "return", "nil", ",", "NewUnprocessableEntityError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "rb", ")", ")", ")", "\n", "}", "else", "if", "resp", ".", "StatusCode", "==", "404", "{", "return", "nil", ",", "NewNotFoundError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "rb", ")", ")", ")", "\n", "}", "else", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "resp", ".", "Status", ",", "string", "(", "rb", ")", ")", "\n", "}", "\n", "return", "rb", ",", "nil", "\n", "}" ]
18,371
all-18372
[ "/", "*", "Warningf", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelWarning" ]
[ "func", "(", "b", "*", "Base", ")", "Warningf", "(", "msg", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "b", ".", "<mask>", "(", "LevelWarning", ",", "nil", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
18,372
all-18373
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PrivatePropertyDescriptor", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime16", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,373
all-18374
[ "Stop", "kills", "the", "poller", "checking", "for", "idle", "connections", "." ]
[ "func", "(", "is", "*", "idleSweep", ")", "Stop", "(", ")", "{", "if", "!", "is", ".", "<mask>", "{", "return", "\n", "}", "\n\n", "is", ".", "started", "=", "false", "\n", "is", ".", "ch", ".", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "close", "(", "is", ".", "stopCh", ")", "\n", "}" ]
18,374
all-18375
[ "Check", "检查model" ]
[ "func", "(", "m", "*", "<mask>", ")", "Check", "(", ")", "error", "{", "validate", "=", "validator", ".", "New", "(", ")", "\n", "err", ":=", "validate", ".", "Struct", "(", "m", ")", "\n", "return", "err", "\n", "}" ]
18,375
all-18376
[ "AddAttribute", "()", "is", "a", "wrapper", "around", "gtk_cell_layout_add_attribute", "()", "." ]
[ "func", "(", "v", "*", "CellLayout", ")", "AddAttribute", "(", "<mask>", "ICellRenderer", ",", "attribute", "string", ",", "column", "int", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "attribute", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_cell_layout_add_attribute", "(", "v", ".", "native", "(", ")", ",", "cell", ".", "toCellRenderer", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gint", "(", "column", ")", ")", "\n", "}" ]
18,376
all-18377
[ "GetUser", "gets", "a", "user" ]
[ "func", "(", "c", "*", "Client", ")", "GetUser", "(", "usrid", "string", ")", "(", "*", "User", ",", "error", ")", "{", "url", ":=", "umUsersPath", "(", "usrid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "<mask>", ":=", "&", "User", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
18,377
all-18378
[ "parseUser", "parses", "the", "row", "of", "an", "user", "." ]
[ "func", "parseUser", "(", "row", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "fields", ":=", "strings", ".", "Split", "(", "row", ",", "\"", "\"", ")", "\n", "if", "len", "(", "fields", ")", "!=", "7", "{", "return", "nil", ",", "rowError", "{", "_USER_FILE", ",", "row", "}", "\n", "}", "\n\n", "uid", ",", "err", ":=", "strconv", ".", "Atoi", "(", "fields", "[", "2", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "atoiError", "{", "_USER_FILE", ",", "row", ",", "\"", "\"", "}", "\n", "}", "\n", "gid", ",", "err", ":=", "strconv", ".", "Atoi", "(", "fields", "[", "3", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "atoiError", "{", "_USER_FILE", ",", "row", ",", "\"", "\"", "}", "\n", "}", "\n\n", "return", "&", "User", "{", "Name", ":", "fields", "[", "0", "]", ",", "password", ":", "fields", "[", "1", "]", ",", "UID", ":", "uid", ",", "GID", ":", "gid", ",", "Gecos", ":", "fields", "[", "4", "]", ",", "Dir", ":", "fields", "[", "5", "]", ",", "Shell", ":", "fields", "[", "6", "]", ",", "}", ",", "nil", "\n", "}" ]
18,378
all-18379
[ "schemaHostVirtualSwitchBondBridge", "returns", "schema", "items", "for", "resources", "that", "need", "to", "work", "with", "a", "HostVirtualSwitchBondBridge", "such", "as", "virtual", "switches", "." ]
[ "func", "schemaHostVirtualSwitchBondBridge", "(", ")", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "return", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "// HostVirtualSwitchBeaconConfig", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Default", ":", "1", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", ",", "// LinkDiscoveryProtocolConfig", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "<mask>", ":", "string", "(", "types", ".", "LinkDiscoveryProtocolConfigOperationTypeListen", ")", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "linkDiscoveryProtocolConfigOperationAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Default", ":", "string", "(", "types", ".", "LinkDiscoveryProtocolConfigProtocolTypeCdp", ")", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "linkDiscoveryProtocolConfigProtocolAllowedValues", ",", "false", ")", ",", "}", ",", "// HostVirtualSwitchBondBridge", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeList", ",", "Required", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "}", "\n", "}" ]
18,379
all-18380
[ "checkIPNetCollision", "returns", "true", "if", "any", "host", "interfaces", "conflict", "with", "the", "host", "-", "only", "network", "mask", "passed", "as", "a", "parameter", ".", "This", "works", "with", "IPv4", "or", "IPv6", "ip", "addresses", "." ]
[ "func", "checkIPNetCollision", "(", "hostonly", "*", "<mask>", ".", "IPNet", ",", "hostIfaces", "map", "[", "string", "]", "*", "net", ".", "IPNet", ")", "(", "bool", ",", "error", ")", "{", "for", "_", ",", "ifaceNet", ":=", "range", "hostIfaces", "{", "if", "hostonly", ".", "IP", ".", "Equal", "(", "ifaceNet", ".", "IP", ".", "Mask", "(", "ifaceNet", ".", "Mask", ")", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "false", ",", "nil", "\n", "}" ]
18,380
all-18381
[ "Done", "decrements", "the", "waitgroup", "at", "the", "given", "sequence", "by", "one" ]
[ "func", "(", "s", "*", "SequentialWaitGroup", ")", "Done", "(", "sequence", "int64", ")", "{", "s", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mutex", ".", "Unlock", "(", ")", "\n", "_", ",", "ok", ":=", "s", ".", "semaphores", "[", "sequence", "]", "\n", "if", "<mask>", "{", "s", ".", "semaphores", "[", "sequence", "]", "--", "\n", "if", "s", ".", "semaphores", "[", "sequence", "]", "==", "0", "{", "delete", "(", "s", ".", "semaphores", ",", "sequence", ")", "\n", "s", ".", "change", ".", "Broadcast", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
18,381
all-18382
[ "Dot2D", "derives", "the", "dot", "product", "of", "two", "vectors", "on", "the", "xz", "-", "plane", ".", "u", ".", "v", "The", "vectors", "are", "projected", "onto", "the", "xz", "-", "plane", "so", "the", "y", "-", "values", "are", "ignored", "." ]
[ "func", "(", "v", "Vec3", ")", "Dot2D", "(", "u", "Vec3", ")", "float32", "{", "<mask>", "v", "[", "0", "]", "*", "u", "[", "0", "]", "+", "v", "[", "2", "]", "*", "u", "[", "2", "]", "\n", "}" ]
18,382
all-18383
[ "Do", "executes", "Tracing", ".", "getCategories", "against", "the", "provided", "context", ".", "returns", ":", "categories", "-", "A", "list", "of", "supported", "tracing", "categories", "." ]
[ "func", "(", "p", "*", "GetCategoriesParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "categories", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetCategoriesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetCategories", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Categories", ",", "nil", "\n", "}" ]
18,383
all-18384
[ "SanitizeTitle", "transforme", "un", "titre", "en", "chaîne", "de", "caractères", "utilisable", "pour", "l", "affichage", "dans", "une", "URL" ]
[ "func", "SanitizeTitle", "(", "s", "string", ")", "<mask>", "{", "p", ":=", "SanitizeAccent", "(", "s", ")", "\n", "r", ",", "_", ":=", "regexp", ".", "Compile", "(", "\"", "\"", ")", "\n", "p", "=", "r", ".", "ReplaceAllString", "(", "p", ",", "\"", "\"", ")", "\n", "p", "=", "strings", ".", "Replace", "(", "p", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "r", ",", "_", "=", "regexp", ".", "Compile", "(", "\"", "\"", ")", "\n", "p", "=", "r", ".", "ReplaceAllString", "(", "p", ",", "\"", "\"", ")", "\n", "p", "=", "strings", ".", "Replace", "(", "p", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "r", ",", "_", "=", "regexp", ".", "Compile", "(", "\"", "\"", ")", "\n", "p", "=", "r", ".", "ReplaceAllString", "(", "p", ",", "\"", "\"", ")", "\n", "p", "=", "strings", ".", "Replace", "(", "p", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "p", "=", "strings", ".", "ToLower", "(", "p", ")", "\n", "return", "p", "\n", "}" ]
18,384
all-18385
[ "MenuItemNew", "()", "is", "a", "wrapper", "around", "gtk_menu_item_new", "()", "." ]
[ "func", "MenuItemNew", "(", ")", "(", "*", "MenuItem", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_menu_item_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapMenuItem", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
18,385
all-18386
[ "HasIcon", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "HasIcon", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Icon", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,386
all-18387
[ "Trailer", "returns", "the", "file", "s", "Trailer", "value", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Trailer", "(", ")", "Value", "{", "return", "<mask>", "{", "r", ",", "r", ".", "trailerptr", ",", "r", ".", "trailer", "}", "\n", "}" ]
18,387
all-18388
[ "IntrospectNumConnections", "returns", "the", "number", "of", "connections", "returns", "the", "number", "of", "connections", ".", "Note", ":", "like", "other", "introspection", "APIs", "this", "is", "not", "a", "stable", "API", "." ]
[ "func", "(", "ch", "*", "<mask>", ")", "IntrospectNumConnections", "(", ")", "int", "{", "ch", ".", "mutable", ".", "RLock", "(", ")", "\n", "numConns", ":=", "len", "(", "ch", ".", "mutable", ".", "conns", ")", "\n", "ch", ".", "mutable", ".", "RUnlock", "(", ")", "\n", "return", "numConns", "\n", "}" ]
18,388
all-18389
[ "Value", "returns", "the", "field", "s", "value", "as", "interface", "{}", "." ]
[ "func", "(", "lf", "<mask>", ")", "Value", "(", ")", "interface", "{", "}", "{", "switch", "lf", ".", "fieldType", "{", "case", "stringType", ":", "return", "lf", ".", "stringVal", "\n", "case", "boolType", ":", "return", "lf", ".", "numericVal", "!=", "0", "\n", "case", "intType", ":", "return", "int", "(", "lf", ".", "numericVal", ")", "\n", "case", "int32Type", ":", "return", "int32", "(", "lf", ".", "numericVal", ")", "\n", "case", "int64Type", ":", "return", "int64", "(", "lf", ".", "numericVal", ")", "\n", "case", "uint32Type", ":", "return", "uint32", "(", "lf", ".", "numericVal", ")", "\n", "case", "uint64Type", ":", "return", "uint64", "(", "lf", ".", "numericVal", ")", "\n", "case", "float32Type", ":", "return", "math", ".", "Float32frombits", "(", "uint32", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "float64Type", ":", "return", "math", ".", "Float64frombits", "(", "uint64", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "errorType", ",", "objectType", ",", "lazyLoggerType", ":", "return", "lf", ".", "interfaceVal", "\n", "case", "noopType", ":", "return", "nil", "\n", "default", ":", "return", "nil", "\n", "}", "\n", "}" ]
18,389
all-18390
[ "ConfigGetString", "is", "a", "convenience", "for", "loading", "the", "cluster", "configuration", "and", "returning", "the", "value", "of", "a", "particular", "key", ".", "It", "s", "a", "deprecated", "API", "meant", "to", "be", "used", "by", "call", "sites", "that", "are", "not", "interacting", "with", "the", "database", "in", "a", "transactional", "way", "." ]
[ "func", "ConfigGetString", "(", "cluster", "*", "db", ".", "Cluster", ",", "<mask>", "string", ")", "(", "string", ",", "error", ")", "{", "config", ",", "err", ":=", "configGet", "(", "cluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "config", ".", "m", ".", "GetString", "(", "key", ")", ",", "nil", "\n", "}" ]
18,390
all-18391
[ "PromoteHandlerFunc", "turns", "a", "HandlerFunc", "into", "a", "Handler", "." ]
[ "func", "PromoteHandlerFunc", "(", "fn", "HandlerFunc", ",", "args", "...", "string", ")", "Handler", "{", "stdin", ",", "stdinPipe", ":=", "io", ".", "Pipe", "(", ")", "\n", "stdoutPipe", ",", "stdout", ":=", "io", ".", "Pipe", "(", ")", "\n", "stderrPipe", ",", "stderr", ":=", "io", ".", "Pipe", "(", ")", "\n\n", "argsCopy", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "args", ")", ")", "\n", "for", "i", ",", "datum", ":=", "range", "args", "{", "argsCopy", "[", "i", "]", "=", "datum", "\n", "}", "\n\n", "handler", ":=", "internalPromotedHandlerFunc", "{", "err", ":", "nil", ",", "fn", ":", "fn", ",", "stdin", ":", "stdin", ",", "stdout", ":", "stdout", ",", "stderr", ":", "stderr", ",", "stdinPipe", ":", "stdinPipe", ",", "stdoutPipe", ":", "stdoutPipe", ",", "stderrPipe", ":", "stderrPipe", ",", "args", ":", "argsCopy", ",", "}", "\n\n", "return", "&", "<mask>", "\n", "}" ]
18,391
all-18392
[ "Reset", "removes", "all", "loaded", "themes", "from", "cache", "and", "reinitialize", "the", "default", "theme" ]
[ "func", "ThemeReset", "(", ")", "{", "thememtx", ".", "Lock", "(", ")", "\n", "defer", "thememtx", ".", "Unlock", "(", ")", "\n\n", "themeManager", ".", "current", "=", "defaultTheme", "\n", "themeManager", ".", "themes", "=", "make", "(", "map", "[", "string", "]", "theme", ",", "0", ")", "\n\n", "defTheme", ":=", "theme", "{", "parent", ":", "\"", "\"", ",", "title", ":", "\"", "\"", ",", "author", ":", "\"", "\"", ",", "version", ":", "\"", "\"", "}", "\n", "defTheme", ".", "colors", "=", "make", "(", "map", "[", "string", "]", "term", ".", "Attribute", ",", "0", ")", "\n", "defTheme", ".", "objects", "=", "make", "(", "map", "[", "string", "]", "string", ",", "0", ")", "\n\n", "defTheme", ".", "objects", "[", "ObjSingleBorder", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjDoubleBorder", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjEdit", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjScrollBar", "]", "=", "\"", "", "\n", "defTheme", ".", "<mask>", "[", "ObjViewButtons", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjCheckBox", "]", "=", "\"", "\"", "\n", "defTheme", ".", "objects", "[", "ObjRadio", "]", "=", "\"", "\"", "\n", "defTheme", ".", "objects", "[", "ObjProgressBar", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjBarChart", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjSparkChart", "]", "=", "\"", "", "\n", "defTheme", ".", "objects", "[", "ObjTableView", "]", "=", "\"", "", "\n\n", "defTheme", ".", "colors", "[", "ColorDisabledText", "]", "=", "ColorBlackBold", "\n", "defTheme", ".", "colors", "[", "ColorDisabledBack", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorViewBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorViewText", "]", "=", "ColorWhite", "\n\n", "defTheme", ".", "colors", "[", "ColorControlText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorControlBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorControlActiveText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorControlActiveBack", "]", "=", "ColorMagenta", "\n", "defTheme", ".", "colors", "[", "ColorControlShadow", "]", "=", "ColorBlue", "\n", "defTheme", ".", "colors", "[", "ColorControlDisabledText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorControlDisabledBack", "]", "=", "ColorBlack", "\n\n", "defTheme", ".", "colors", "[", "ColorButtonText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorButtonBack", "]", "=", "ColorGreen", "\n", "defTheme", ".", "colors", "[", "ColorButtonActiveText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorButtonActiveBack", "]", "=", "ColorMagenta", "\n", "defTheme", ".", "colors", "[", "ColorButtonShadow", "]", "=", "ColorBlue", "\n", "defTheme", ".", "colors", "[", "ColorButtonDisabledText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorButtonDisabledBack", "]", "=", "ColorBlack", "\n\n", "defTheme", ".", "colors", "[", "ColorEditText", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorEditBack", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorEditActiveText", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorEditActiveBack", "]", "=", "ColorYellow", "\n", "defTheme", ".", "colors", "[", "ColorSelectionText", "]", "=", "ColorYellow", "\n", "defTheme", ".", "colors", "[", "ColorSelectionBack", "]", "=", "ColorBlue", "\n\n", "defTheme", ".", "colors", "[", "ColorScrollBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorScrollText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorThumbBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorThumbText", "]", "=", "ColorWhite", "\n\n", "defTheme", ".", "colors", "[", "ColorProgressText", "]", "=", "ColorBlue", "\n", "defTheme", ".", "colors", "[", "ColorProgressBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorProgressActiveText", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorProgressActiveBack", "]", "=", "ColorBlue", "\n", "defTheme", ".", "colors", "[", "ColorProgressTitleText", "]", "=", "ColorWhite", "\n\n", "defTheme", ".", "colors", "[", "ColorBarChartBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorBarChartText", "]", "=", "ColorWhite", "\n\n", "defTheme", ".", "colors", "[", "ColorSparkChartBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorSparkChartText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorSparkChartBarBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorSparkChartBarText", "]", "=", "ColorCyan", "\n", "defTheme", ".", "colors", "[", "ColorSparkChartMaxBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorSparkChartMaxText", "]", "=", "ColorCyanBold", "\n\n", "defTheme", ".", "colors", "[", "ColorTableText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorTableBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorTableSelectedText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorTableSelectedBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorTableActiveCellText", "]", "=", "ColorWhiteBold", "\n", "defTheme", ".", "colors", "[", "ColorTableActiveCellBack", "]", "=", "ColorBlack", "\n", "defTheme", ".", "colors", "[", "ColorTableLineText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorTableHeaderText", "]", "=", "ColorWhite", "\n", "defTheme", ".", "colors", "[", "ColorTableHeaderBack", "]", "=", "ColorBlack", "\n\n", "themeManager", ".", "themes", "[", "defaultTheme", "]", "=", "defTheme", "\n", "}" ]
18,392
all-18393
[ "openOrCreateManifestFile", "opens", "a", "Badger", "manifest", "file", "if", "it", "exists", "or", "creates", "on", "if", "one", "doesn’t", "." ]
[ "func", "openOrCreateManifestFile", "(", "dir", "string", ",", "readOnly", "bool", ")", "(", "<mask>", "*", "manifestFile", ",", "result", "Manifest", ",", "err", "error", ")", "{", "return", "helpOpenOrCreateManifestFile", "(", "dir", ",", "readOnly", ",", "manifestDeletionsRewriteThreshold", ")", "\n", "}" ]
18,393
all-18394
[ "Reset", "the", "gateway", "shutting", "it", "down", "and", "starting", "against", "from", "scratch", "using", "the", "given", "certificate", ".", "This", "is", "used", "when", "disabling", "clustering", "on", "a", "node", "." ]
[ "func", "(", "g", "*", "Gateway", ")", "Reset", "(", "cert", "*", "shared", ".", "CertInfo", ")", "error", "{", "err", ":=", "g", ".", "Shutdown", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "<mask>", ".", "RemoveAll", "(", "filepath", ".", "Join", "(", "g", ".", "db", ".", "Dir", "(", ")", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "g", ".", "db", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "NodeTx", ")", "error", "{", "return", "tx", ".", "RaftNodesReplace", "(", "nil", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "g", ".", "cert", "=", "cert", "\n", "return", "g", ".", "init", "(", ")", "\n", "}" ]
18,394
all-18395
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ForcePseudoStateParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss49", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,395
all-18396
[ "ContainerBackupRename", "renames", "a", "container", "backup", "from", "the", "given", "current", "name", "to", "the", "new", "one", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerBackupRename", "(", "oldName", ",", "newName", "string", ")", "error", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "str", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ")", "\n", "stmt", ",", "err", ":=", "<mask>", ".", "tx", ".", "Prepare", "(", "str", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n\n", "logger", ".", "Debug", "(", "\"", "\"", ",", "log", ".", "Ctx", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "oldName", ",", "\"", "\"", ":", "newName", "}", ")", "\n", "if", "_", ",", "err", ":=", "stmt", ".", "Exec", "(", "newName", ",", "oldName", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "return", "err", "\n", "}" ]
18,396
all-18397
[ "DownloadISO", "downloads", "boot2docker", "ISO", "image", "for", "the", "given", "tag", "and", "save", "it", "at", "dest", "." ]
[ "func", "(", "b", "*", "B2dUtils", ")", "DownloadISO", "(", "dir", ",", "file", ",", "isoURL", "string", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "b", ".", "<mask>", "(", ")", ",", "isoURL", ")", "\n", "return", "b", ".", "download", "(", "dir", ",", "file", ",", "isoURL", ")", "\n", "}" ]
18,397
all-18398
[ "lookupZones", "retrieves", "the", "zones", "of", "the", "project", "and", "filters", "them", "by", "pattern", "." ]
[ "func", "lookupZones", "(", "svc", "*", "compute", ".", "Service", ",", "project", ",", "pattern", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "call", ":=", "svc", ".", "Zones", ".", "List", "(", "project", ")", "\n", "if", "pattern", "!=", "\"", "\"", "{", "<mask>", "=", "call", ".", "Filter", "(", "\"", "\"", "+", "pattern", ")", "\n", "}", "\n\n", "var", "zones", "[", "]", "string", "\n", "f", ":=", "func", "(", "page", "*", "compute", ".", "ZoneList", ")", "error", "{", "for", "_", ",", "v", ":=", "range", "page", ".", "Items", "{", "zones", "=", "append", "(", "zones", ",", "v", ".", "Name", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "call", ".", "Pages", "(", "oauth2", ".", "NoContext", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "zones", ",", "nil", "\n", "}" ]
18,398
all-18399
[ "GetFile", "returns", "the", "bytes", "of", "the", "file", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "GetFile", "(", "org", ",", "repo", ",", "file", ",", "commit", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "contents", ",", "ok", ":=", "f", ".", "RemoteFiles", "[", "file", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "file", ")", "\n", "}", "\n", "if", "commit", "==", "\"", "\"", "{", "if", "master", ",", "ok", ":=", "contents", "[", "\"", "\"", "]", ";", "ok", "{", "return", "[", "]", "byte", "(", "master", ")", ",", "nil", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "file", ")", "\n", "}", "\n\n", "if", "content", ",", "<mask>", ":=", "contents", "[", "commit", "]", ";", "ok", "{", "return", "[", "]", "byte", "(", "content", ")", ",", "nil", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "file", ",", "commit", ")", "\n", "}" ]
18,399
all-18400
[ "AddDir", "adds", "a", "directory", "recursively", "with", "all", "of", "the", "files", "under", "it" ]
[ "func", "(", "s", "*", "Shell", ")", "AddDir", "(", "dir", "string", ")", "(", "string", ",", "error", ")", "{", "stat", ",", "err", ":=", "os", ".", "Lstat", "(", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "sf", ",", "err", ":=", "files", ".", "NewSerialFile", "(", "dir", ",", "false", ",", "stat", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "slf", ":=", "files", ".", "NewSliceDirectory", "(", "[", "]", "files", ".", "DirEntry", "{", "files", ".", "FileEntry", "(", "filepath", ".", "Base", "(", "dir", ")", ",", "sf", ")", "}", ")", "\n", "reader", ":=", "files", ".", "NewMultiFileReader", "(", "slf", ",", "true", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "Request", "(", "\"", "\"", ")", ".", "Option", "(", "\"", "\"", ",", "true", ")", ".", "Body", "(", "reader", ")", ".", "Send", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "defer", "resp", ".", "Close", "(", ")", "\n\n", "if", "resp", ".", "Error", "!=", "nil", "{", "return", "\"", "\"", ",", "resp", ".", "Error", "\n", "}", "\n\n", "dec", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Output", ")", "\n", "<mask>", "final", "string", "\n", "for", "{", "var", "out", "object", "\n", "err", "=", "dec", ".", "Decode", "(", "&", "out", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "final", "=", "out", ".", "Hash", "\n", "}", "\n\n", "if", "final", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "final", ",", "nil", "\n", "}" ]