id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
17,800
all-17801
[ "GoString", "defines", "the", "printable", "version", "of", "this", "struct", "." ]
[ "func", "(", "c", "*", "VaultConfig", ")", "GoString", "(", ")", "string", "{", "if", "c", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", ",", "StringGoString", "(", "c", ".", "<mask>", ")", ",", "BoolGoString", "(", "c", ".", "Enabled", ")", ",", "TimeDurationGoString", "(", "c", ".", "Grace", ")", ",", "StringGoString", "(", "c", ".", "Namespace", ")", ",", "BoolGoString", "(", "c", ".", "RenewToken", ")", ",", "c", ".", "Retry", ",", "c", ".", "SSL", ",", "StringPresent", "(", "c", ".", "Token", ")", ",", "StringPresent", "(", "c", ".", "VaultAgentTokenFile", ")", ",", "c", ".", "Transport", ",", "BoolGoString", "(", "c", ".", "UnwrapToken", ")", ",", ")", "\n", "}" ]
17,801
all-17802
[ "operate", "on", "the", "accumulation", "buffer" ]
[ "func", "Accum", "(", "op", "uint32", ",", "value", "float32", ")", "{", "C", ".", "glowAccum", "(", "gpAccum", ",", "(", "C", ".", "GLenum", ")", "(", "op", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "<mask>", ")", ")", "\n", "}" ]
17,802
all-17803
[ "WithContext", "assigns", "a", "context", "to", "the", "session", "instead", "of", "defaulting", "to", "using", "the", "client", "context", ".", "This", "is", "useful", "for", "canceling", "NewSession", "and", "Close", "operations", "immediately", "without", "having", "to", "close", "the", "client", ".", "If", "the", "context", "is", "canceled", "before", "Close", "()", "completes", "the", "session", "s", "lease", "will", "be", "abandoned", "and", "left", "to", "expire", "instead", "of", "being", "revoked", "." ]
[ "func", "WithContext", "(", "ctx", "<mask>", ".", "Context", ")", "SessionOption", "{", "return", "func", "(", "so", "*", "sessionOptions", ")", "{", "so", ".", "ctx", "=", "ctx", "\n", "}", "\n", "}" ]
17,803
all-17804
[ "RoleBinding", "returns", "a", "RoleBinding", "that", "binds", "Pachyderm", "s", "Role", "to", "its", "ServiceAccount", "." ]
[ "func", "RoleBinding", "(", "opts", "*", "AssetOpts", ")", "*", "rbacv1", ".", "RoleBinding", "{", "return", "&", "rbacv1", ".", "RoleBinding", "{", "TypeMeta", ":", "metav1", ".", "TypeMeta", "{", "Kind", ":", "\"", "\"", ",", "APIVersion", ":", "\"", "\"", ",", "}", ",", "ObjectMeta", ":", "objectMeta", "(", "roleBindingName", ",", "labels", "(", "\"", "\"", ")", ",", "nil", ",", "opts", ".", "Namespace", ")", ",", "Subjects", ":", "[", "]", "rbacv1", ".", "Subject", "{", "{", "Kind", ":", "\"", "\"", ",", "Name", ":", "ServiceAccountName", ",", "Namespace", ":", "opts", ".", "Namespace", ",", "}", "}", ",", "RoleRef", ":", "rbacv1", ".", "RoleRef", "{", "Kind", ":", "\"", "\"", ",", "<mask>", ":", "roleName", ",", "}", ",", "}", "\n", "}" ]
17,804
all-17805
[ "Make", "a", "small", "SVG", "badge", "that", "looks", "like", "[", "subject", "|", "status", "]", "with", "the", "status", "text", "in", "the", "given", "color", ".", "Provides", "a", "local", "version", "of", "the", "shields", ".", "io", "service", "." ]
[ "func", "makeShield", "(", "subject", ",", "status", ",", "color", "string", ")", "[", "]", "byte", "{", "// TODO(rmmh): Use better font-size metrics for prettier badges-- estimating", "// character widths as 6px isn't very accurate.", "// See also: https://github.com/badges/shields/blob/master/measure-text.js", "p", ":=", "struct", "{", "Width", ",", "RightStart", ",", "RightWidth", "int", "\n", "XposLeft", ",", "XposRight", "float64", "\n", "Subject", ",", "Status", "string", "\n", "<mask>", "string", "\n", "}", "{", "Subject", ":", "subject", ",", "Status", ":", "status", ",", "RightStart", ":", "13", "+", "6", "*", "len", "(", "subject", ")", ",", "RightWidth", ":", "13", "+", "6", "*", "len", "(", "status", ")", ",", "}", "\n", "p", ".", "Width", "=", "p", ".", "RightStart", "+", "p", ".", "RightWidth", "\n", "p", ".", "XposLeft", "=", "float64", "(", "p", ".", "RightStart", ")", "*", "0.5", "\n", "p", ".", "XposRight", "=", "float64", "(", "p", ".", "RightStart", ")", "+", "float64", "(", "p", ".", "RightWidth", "-", "2", ")", "*", "0.5", "\n", "switch", "color", "{", "case", "\"", "\"", ":", "p", ".", "Color", "=", "\"", "\"", "\n", "case", "\"", "\"", ":", "p", ".", "Color", "=", "\"", "\"", "\n", "default", ":", "p", ".", "Color", "=", "color", "\n", "}", "\n", "var", "buf", "bytes", ".", "Buffer", "\n", "svgTemplate", ".", "Execute", "(", "&", "buf", ",", "p", ")", "\n", "return", "buf", ".", "Bytes", "(", ")", "\n", "}" ]
17,805
all-17806
[ "Returns", "the", "account", "ID", "given", "dnsimple", "credentials" ]
[ "func", "(", "p", "*", "dnsimpleProvider", ")", "GetAccountID", "(", "credentials", "dnsimple", ".", "Credentials", ",", "<mask>", "dnsimple", ".", "Client", ")", "(", "accountID", "string", ",", "err", "error", ")", "{", "// get DNSimple client accountID", "whoamiResponse", ",", "err", ":=", "client", ".", "Identity", ".", "Whoami", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "strconv", ".", "Itoa", "(", "whoamiResponse", ".", "Data", ".", "Account", ".", "ID", ")", ",", "nil", "\n", "}" ]
17,806
all-17807
[ "WithContext", "adds", "the", "context", "to", "the", "post", "apps", "params" ]
[ "func", "(", "o", "*", "PostAppsParams", ")", "WithContext", "(", "ctx", "context", ".", "<mask>", ")", "*", "PostAppsParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
17,807
all-17808
[ "setBuildTags", "sets", "genericTags", "by", "parsing", "as", "a", "comma", "separated", "list", ".", "An", "error", "will", "be", "returned", "for", "tags", "that", "wouldn", "t", "be", "recognized", "by", "go", "build", ".", "preprocessTags", "should", "be", "called", "before", "this", "." ]
[ "func", "(", "gc", "*", "goConfig", ")", "setBuildTags", "(", "tags", "string", ")", "error", "{", "if", "tags", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "for", "_", ",", "t", ":=", "range", "strings", ".", "Split", "(", "tags", ",", "\"", "\"", ")", "{", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "gc", ".", "genericTags", "[", "t", "]", "=", "<mask>", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,808
all-17809
[ "ByID", "finds", "a", "user", "by", "their", "ID" ]
[ "func", "(", "u", "*", "UserRepository", ")", "ByID", "(", "ID", "int", ")", "(", "*", "User", ",", "error", ")", "{", "for", "_", ",", "<mask>", ":=", "range", "u", ".", "Users", "{", "if", "user", ".", "ID", "==", "ID", "{", "return", "user", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "ErrNotFound", "\n", "}" ]
17,809
all-17810
[ "FullURI", "returns", "full", "uri", "in", "the", "form", "{", "Scheme", "}", ":", "//", "{", "Host", "}", "{", "RequestURI", "}", "#", "{", "Hash", "}", "." ]
[ "func", "(", "u", "*", "URI", ")", "FullURI", "(", ")", "[", "]", "<mask>", "{", "u", ".", "fullURI", "=", "u", ".", "AppendBytes", "(", "u", ".", "fullURI", "[", ":", "0", "]", ")", "\n", "return", "u", ".", "fullURI", "\n", "}" ]
17,810
all-17811
[ "Sigs", "is", "a", "sentinel", "option", "to", "set", "the", "specified", "signals", "for", "shutdown", "." ]
[ "func", "Sigs", "(", "sigs", "...", "os", ".", "Signal", ")", "Option", "{", "return", "func", "(", "s", "*", "Sentinel", ")", "error", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "if", "s", ".", "<mask>", "{", "return", "ErrAlreadyStarted", "\n", "}", "\n\n", "s", ".", "shutdownSigs", "=", "sigs", "\n", "return", "nil", "\n", "}", "\n", "}" ]
17,811
all-17812
[ "double", "pango_gravity_to_rotation", "(", "PangoGravity", "gravity", ")", "G_GNUC_CONST", ";" ]
[ "func", "GravityToRotation", "(", "gravity", "Gravity", ")", "float64", "{", "c", ":=", "C", ".", "pango_gravity_to_rotation", "(", "(", "C", ".", "PangoGravity", ")", "(", "gravity", ")", ")", "\n", "<mask>", "float64", "(", "c", ")", "\n", "}" ]
17,812
all-17813
[ "NewCentosCluster", "creates", "a", "basic", "CentOS", "DigitalOcean", "cluster", "." ]
[ "func", "NewCentosCluster", "(", "<mask>", "string", ")", "*", "cluster", ".", "Cluster", "{", "controlPlaneProviderConfig", ":=", "&", "cluster", ".", "ControlPlaneProviderConfig", "{", "Cloud", ":", "cluster", ".", "CloudDigitalOcean", ",", "Location", ":", "\"", "\"", ",", "SSH", ":", "&", "cluster", ".", "SSH", "{", "PublicKeyPath", ":", "\"", "\"", ",", "User", ":", "\"", "\"", ",", "}", ",", "KubernetesAPI", ":", "&", "cluster", ".", "KubernetesAPI", "{", "Port", ":", "\"", "\"", ",", "}", ",", "Values", ":", "&", "cluster", ".", "Values", "{", "ItemMap", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "kubeadm", ".", "GetRandomToken", "(", ")", ",", "}", ",", "}", ",", "}", "\n", "machineSetsProviderConfigs", ":=", "[", "]", "*", "cluster", ".", "MachineProviderConfig", "{", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeMaster", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "EgressRules", ":", "[", "]", "*", "cluster", ".", "EgressRule", "{", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeNode", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "2", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "EgressRules", ":", "[", "]", "*", "cluster", ".", "EgressRule", "{", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "c", ":=", "cluster", ".", "NewCluster", "(", "name", ")", "\n", "c", ".", "SetProviderConfig", "(", "controlPlaneProviderConfig", ")", "\n", "c", ".", "NewMachineSetsFromProviderConfigs", "(", "machineSetsProviderConfigs", ")", "\n\n", "secret", ":=", "&", "apiv1", ".", "Secret", "{", "ObjectMeta", ":", "metav1", ".", "ObjectMeta", "{", "Name", ":", "\"", "\"", ",", "Namespace", ":", "\"", "\"", ",", "}", ",", "StringData", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "string", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "}", ",", "}", "\n", "c", ".", "APITokenSecret", "=", "secret", "\n\n", "return", "c", "\n", "}" ]
17,813
all-17814
[ "resourceVSphereHAVMOverrideObjects", "handles", "the", "fetching", "of", "the", "cluster", "and", "virtual", "machine", "depending", "on", "what", "attributes", "are", "available", ":", "*", "If", "the", "resource", "ID", "is", "available", "the", "data", "is", "derived", "from", "the", "ID", ".", "*", "If", "not", "it", "s", "derived", "from", "the", "compute_cluster_id", "and", "virtual_machine_id", "attributes", "." ]
[ "func", "resourceVSphereHAVMOverrideObjects", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", ")", "(", "*", "<mask>", ".", "ClusterComputeResource", ",", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "if", "d", ".", "Id", "(", ")", "!=", "\"", "\"", "{", "return", "resourceVSphereHAVMOverrideObjectsFromID", "(", "d", ",", "meta", ")", "\n", "}", "\n", "return", "resourceVSphereHAVMOverrideObjectsFromAttributes", "(", "d", ",", "meta", ")", "\n", "}" ]
17,814
all-17815
[ "UpdatedImage", "returns", "a", "types", ".", "Image", "modified", "according", "to", "options", ".", "This", "does", "not", "change", "the", "state", "of", "the", "original", "Image", "object", "." ]
[ "func", "(", "m", "*", "manifestSchema1", ")", "UpdatedImage", "(", "ctx", "context", ".", "Context", ",", "options", "types", ".", "ManifestUpdateOptions", ")", "(", "types", ".", "Image", ",", "error", ")", "{", "copy", ":=", "manifestSchema1", "{", "m", ":", "manifest", ".", "Schema1Clone", "(", "m", ".", "m", ")", "}", "\n", "if", "options", ".", "LayerInfos", "!=", "nil", "{", "if", "err", ":=", "copy", ".", "m", ".", "UpdateLayerInfos", "(", "options", ".", "LayerInfos", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "if", "<mask>", ".", "EmbeddedDockerReference", "!=", "nil", "{", "copy", ".", "m", ".", "Name", "=", "reference", ".", "Path", "(", "options", ".", "EmbeddedDockerReference", ")", "\n", "if", "tagged", ",", "isTagged", ":=", "options", ".", "EmbeddedDockerReference", ".", "(", "reference", ".", "NamedTagged", ")", ";", "isTagged", "{", "copy", ".", "m", ".", "Tag", "=", "tagged", ".", "Tag", "(", ")", "\n", "}", "else", "{", "copy", ".", "m", ".", "Tag", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "switch", "options", ".", "ManifestMIMEType", "{", "case", "\"", "\"", ":", "// No conversion, OK", "case", "manifest", ".", "DockerV2Schema1MediaType", ",", "manifest", ".", "DockerV2Schema1SignedMediaType", ":", "// We have 2 MIME types for schema 1, which are basically equivalent (even the un-\"Signed\" MIME type will be rejected if there isn’t a signature; so,", "// handle conversions between them by doing nothing.", "case", "manifest", ".", "DockerV2Schema2MediaType", ":", "m2", ",", "err", ":=", "copy", ".", "convertToManifestSchema2", "(", "options", ".", "InformationOnly", ".", "LayerInfos", ",", "options", ".", "InformationOnly", ".", "LayerDiffIDs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "memoryImageFromManifest", "(", "m2", ")", ",", "nil", "\n", "case", "imgspecv1", ".", "MediaTypeImageManifest", ":", "// We can't directly convert to OCI, but we can transitively convert via a Docker V2.2 Distribution manifest", "m2", ",", "err", ":=", "copy", ".", "convertToManifestSchema2", "(", "options", ".", "InformationOnly", ".", "LayerInfos", ",", "options", ".", "InformationOnly", ".", "LayerDiffIDs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "m2", ".", "UpdatedImage", "(", "ctx", ",", "types", ".", "ManifestUpdateOptions", "{", "ManifestMIMEType", ":", "imgspecv1", ".", "MediaTypeImageManifest", ",", "InformationOnly", ":", "options", ".", "InformationOnly", ",", "}", ")", "\n", "default", ":", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "manifest", ".", "DockerV2Schema1SignedMediaType", ",", "options", ".", "ManifestMIMEType", ")", "\n", "}", "\n\n", "return", "memoryImageFromManifest", "(", "&", "copy", ")", ",", "nil", "\n", "}" ]
17,815
all-17816
[ "Attach", "()", "is", "a", "wrapper", "around", "gtk_grid_attach", "()", "." ]
[ "func", "(", "v", "*", "Grid", ")", "Attach", "(", "child", "IWidget", ",", "left", ",", "top", ",", "width", ",", "height", "int", ")", "{", "C", ".", "gtk_grid_attach", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "C", ".", "gint", "(", "left", ")", ",", "C", ".", "gint", "(", "top", ")", ",", "C", ".", "gint", "(", "width", ")", ",", "C", ".", "gint", "(", "height", ")", ")", "\n", "}" ]
17,816
all-17817
[ "Write", "the", "cache", "s", "items", "(", "using", "Gob", ")", "to", "an", "io", ".", "Writer", ".", "NOTE", ":", "This", "method", "is", "deprecated", "in", "favor", "of", "c", ".", "Items", "()", "and", "NewFrom", "()", "(", "see", "the", "documentation", "for", "NewFrom", "()", ".", ")" ]
[ "func", "(", "c", "*", "<mask>", ")", "Save", "(", "w", "io", ".", "Writer", ")", "(", "err", "error", ")", "{", "enc", ":=", "gob", ".", "NewEncoder", "(", "w", ")", "\n", "defer", "func", "(", ")", "{", "if", "x", ":=", "recover", "(", ")", ";", "x", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "(", ")", "\n", "c", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "for", "_", ",", "v", ":=", "range", "c", ".", "items", "{", "gob", ".", "Register", "(", "v", ".", "Object", ")", "\n", "}", "\n", "err", "=", "enc", ".", "Encode", "(", "&", "c", ".", "items", ")", "\n", "return", "\n", "}" ]
17,817
all-17818
[ "BodyWriter", "returns", "writer", "for", "populating", "response", "body", ".", "If", "used", "inside", "RequestHandler", "the", "returned", "writer", "must", "not", "be", "used", "after", "returning", "from", "RequestHandler", ".", "Use", "RequestCtx", ".", "Write", "or", "SetBodyStreamWriter", "in", "this", "case", "." ]
[ "func", "(", "resp", "*", "Response", ")", "BodyWriter", "(", ")", "io", ".", "<mask>", "{", "resp", ".", "w", ".", "r", "=", "resp", "\n", "return", "&", "resp", ".", "w", "\n", "}" ]
17,818
all-17819
[ "HashString", "works", "like", "hash", "but", "accept", "string", "as", "an", "input", "." ]
[ "func", "HashString", "(", "<mask>", "string", ",", "numBuckets", "int", ")", "int32", "{", "// jump.Hash returns values from 0.", "k", ":=", "Hash", "(", "Sum64", "(", "key", ")", ",", "numBuckets", ")", "\n\n", "return", "k", "\n", "}" ]
17,819
all-17820
[ "HasProcessQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DistributionRequest", ")", "HasProcessQuery", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "ProcessQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
17,820
all-17821
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScreenboardLite", ")", "HasId", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Id", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
17,821
all-17822
[ "Error", "logging" ]
[ "func", "(", "l", "*", "StdLevelLogger", ")", "Error", "(", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "logFunc", "(", "ErrorLevel", ",", "l", ".", "<mask>", ",", "args", "...", ")", "\n", "}" ]
17,822
all-17823
[ "Copy", "into", "PrefixBytes" ]
[ "func", "NewPrefixBytes", "(", "prefixBytes", "[", "]", "byte", ")", "PrefixBytes", "{", "pb", ":=", "PrefixBytes", "{", "}", "\n", "copy", "(", "pb", "[", ":", "]", ",", "prefixBytes", ")", "\n", "return", "<mask>", "\n", "}" ]
17,823
all-17824
[ "IdleWithFallback", "tries", "to", "idle", "if", "the", "server", "supports", "it", ".", "If", "it", "doesn", "t", "it", "falls", "back", "to", "polling", ".", "If", "pollInterval", "is", "zero", "a", "sensible", "default", "will", "be", "used", "." ]
[ "func", "(", "c", "*", "Client", ")", "IdleWithFallback", "(", "stop", "<-", "chan", "struct", "{", "}", ",", "pollInterval", "time", ".", "Duration", ")", "error", "{", "if", "ok", ",", "err", ":=", "c", ".", "SupportIdle", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "else", "if", "ok", "{", "return", "c", ".", "Idle", "(", "stop", ")", "\n", "}", "\n\n", "if", "pollInterval", "==", "0", "{", "pollInterval", "=", "defaultPollInterval", "\n", "}", "\n\n", "t", ":=", "time", ".", "NewTicker", "(", "pollInterval", ")", "\n", "defer", "t", ".", "Stop", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "t", ".", "C", ":", "if", "err", ":=", "c", ".", "c", ".", "Noop", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "<-", "stop", ":", "return", "nil", "\n", "<mask>", "<-", "c", ".", "c", ".", "LoggedOut", "(", ")", ":", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}" ]
17,824
all-17825
[ "Usage", "prints", "to", "stdout", "information", "about", "the", "tool" ]
[ "func", "Usage", "(", ")", "{", "fmt", ".", "Fprintf", "(", "errorWriter", ",", "\"", "\\n", "\"", ")", "\n", "fmt", ".", "Fprintf", "(", "errorWriter", ",", "\"", "\\n", "\"", ",", "path", ".", "Base", "(", "<mask>", ".", "Args", "[", "0", "]", ")", ")", "\n", "}" ]
17,825
all-17826
[ "GetFontSize", "returns", "the", "FontSize", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "n", "*", "NoteDefinition", ")", "GetFontSize", "(", ")", "<mask>", "{", "if", "n", "==", "nil", "||", "n", ".", "FontSize", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "n", ".", "FontSize", "\n", "}" ]
17,826
all-17827
[ "Parse", "parses", "the", "environment", "flags", "from", "os", ".", "Environ", ".", "Must", "be", "called", "after", "all", "flags", "are", "defined", "and", "before", "flags", "are", "accessed", "by", "the", "program", "." ]
[ "func", "Parse", "(", ")", "{", "env", ":=", "os", ".", "Environ", "(", ")", "\n", "// Clean up and \"fake\" some flag k/v pairs.", "args", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "env", ")", ")", "\n", "for", "_", ",", "value", ":=", "range", "env", "{", "if", "Lookup", "(", "<mask>", "[", ":", "strings", ".", "Index", "(", "value", ",", "\"", "\"", ")", "]", ")", "==", "nil", "{", "continue", "\n", "}", "\n", "args", "=", "append", "(", "args", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "value", ")", ")", "\n", "}", "\n", "EnvironmentFlags", ".", "Parse", "(", "args", ")", "\n", "}" ]
17,827
all-17828
[ "NewTimeoutDetector", "creates", "the", "TimeoutDetector", "." ]
[ "func", "NewTimeoutDetector", "(", "maxDuration", "time", ".", "Duration", ")", "*", "TimeoutDetector", "{", "return", "&", "TimeoutDetector", "{", "maxDuration", ":", "maxDuration", ",", "records", ":", "make", "(", "<mask>", "[", "uint64", "]", "time", ".", "Time", ")", ",", "}", "\n", "}" ]
17,828
all-17829
[ "peekField", "looks", "at", "an", "undecoded", "JWT", "JSON", "decoding", "the", "data", "at", "pos", "and", "returning", "the", "specified", "field", "s", "value", "as", "string", ".", "If", "the", "fieldName", "is", "not", "present", "then", "an", "error", "will", "be", "returned", "." ]
[ "func", "peekField", "(", "buf", "[", "]", "byte", ",", "fieldName", "string", ",", "pos", "tokenPosition", ")", "(", "string", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// split token", "ut", ":=", "UnverifiedToken", "{", "}", "\n", "err", "=", "DecodeUnverifiedToken", "(", "buf", ",", "&", "ut", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// determine position decode", "var", "typ", "string", "\n", "var", "b", "[", "]", "byte", "\n", "switch", "pos", "{", "<mask>", "tokenPositionHeader", ":", "typ", "=", "\"", "\"", "\n", "b", "=", "ut", ".", "Header", "\n", "case", "tokenPositionPayload", ":", "typ", "=", "\"", "\"", "\n", "b", "=", "ut", ".", "Payload", "\n\n", "default", ":", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pos", ")", "\n", "}", "\n\n", "// b64 decode", "dec", ",", "err", ":=", "b64", ".", "DecodeString", "(", "string", "(", "b", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "typ", ")", "\n", "}", "\n\n", "// json decode", "m", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "dec", ",", "&", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "if", "val", ",", "ok", ":=", "m", "[", "fieldName", "]", ";", "ok", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val", ")", ",", "nil", "\n", "}", "\n\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "typ", ",", "fieldName", ")", "\n", "}" ]
17,829
all-17830
[ "Extract", "returns", "positional", "and", "named", "variables", "extracted", "from", "the", "URL", "host", "." ]
[ "func", "(", "m", "*", "RegexpHost", ")", "Extract", "(", "result", "*", "Result", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "result", ".", "Values", "=", "mergeValues", "(", "result", ".", "Values", ",", "m", ".", "Values", "(", "getHost", "(", "r", ")", ")", ")", "\n", "}" ]
17,830
all-17831
[ "Filter", "获取敏感词过滤接口" ]
[ "func", "(", "dm", "*", "DirtyManager", ")", "Filter", "(", ")", "DirtyFilter", "{", "dm", ".", "filterMux", ".", "RLock", "(", ")", "\n", "filter", ":=", "dm", ".", "filter", "\n", "dm", ".", "filterMux", ".", "RUnlock", "(", ")", "\n", "return", "<mask>", "\n", "}" ]
17,831
all-17832
[ "Read", "in", "config", "file", "and", "ENV", "variables", "if", "set", "." ]
[ "func", "initConfig", "(", ")", "{", "if", "cfgFile", "!=", "\"", "\"", "{", "// enable ability to specify config file via flag", "Viper", ".", "SetConfigFile", "(", "cfgFile", ")", "\n", "}", "\n\n", "Viper", ".", "SetConfigName", "(", "\"", "\"", ")", "// name of config file (without extension)", "\n", "Viper", ".", "AddConfigPath", "(", "\"", "\"", ")", "// adding home directory as first search path", "\n", "Viper", ".", "AddConfigPath", "(", "\"", "\"", ")", "// adding local directory as second search path", "\n", "Viper", ".", "AutomaticEnv", "(", ")", "// read in environment variables that match", "\n\n", "// If a config file is found, read it in.", "if", "err", ":=", "Viper", ".", "ReadInConfig", "(", ")", ";", "<mask>", "==", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "Viper", ".", "ConfigFileUsed", "(", ")", ")", "\n", "}", "\n", "}" ]
17,832
all-17833
[ "GetTriggerWindow", "returns", "the", "TriggerWindow", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ThresholdWindows", ")", "GetTriggerWindow", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "TriggerWindow", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "TriggerWindow", "\n", "}" ]
17,833
all-17834
[ "Do", "executes", "Storage", ".", "trackIndexedDBForOrigin", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "TrackIndexedDBForOriginParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandTrackIndexedDBForOrigin", ",", "p", ",", "nil", ")", "\n", "}" ]
17,834
all-17835
[ "LazyLog", "adds", "x", "to", "the", "event", "log", ".", "It", "will", "be", "evaluated", "each", "time", "the", "/", "debug", "/", "requests", "page", "is", "rendered", ".", "Any", "memory", "referenced", "by", "x", "will", "be", "pinned", "until", "the", "trace", "is", "finished", "and", "later", "discarded", "." ]
[ "func", "(", "t", "*", "<mask>", ")", "LazyLog", "(", "x", "fmt", ".", "Stringer", ",", "sensitive", "bool", ")", "{", "Log", ".", "Println", "(", "logMessageWithTrace", "(", "t", ",", "x", ".", "String", "(", ")", ")", ")", "\n", "t", ".", "trace", ".", "LazyLog", "(", "x", ",", "sensitive", ")", "\n", "}" ]
17,835
all-17836
[ "Endpoint", "gets", "endpoint", "message", "through", "tor", "net", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Endpoint", "(", "channelKey", "data", ".", "Base64String", ")", "(", "data", ".", "Base64String", ",", "error", ")", "{", "return", "c", ".", "requestWithPayload", "(", "\"", "\"", ",", "string", "(", "channelKey", ")", ")", "\n", "}" ]
17,836
all-17837
[ "readRestSessionID", "reads", "a", "saved", "REST", "session", "ID", "and", "returns", "it", ".", "An", "empty", "string", "is", "returned", "if", "session", "does", "not", "exist", "." ]
[ "func", "(", "c", "*", "Config", ")", "readRestSessionID", "(", ")", "(", "string", ",", "error", ")", "{", "if", "!", "c", ".", "Persist", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "p", ",", "err", ":=", "c", ".", "restSessionFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "p", ")", "\n", "id", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "p", ")", "\n", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "string", "(", "id", ")", ",", "nil", "\n", "}" ]
17,837
all-17838
[ "finalizeNamespace", "drops", "the", "caps", "sets", "the", "correct", "user", "and", "working", "dir", "and", "closes", "any", "leaked", "file", "descriptors", "before", "executing", "the", "command", "inside", "the", "namespace" ]
[ "func", "finalizeNamespace", "(", "config", "*", "initConfig", ")", "error", "{", "// Ensure that all unwanted fds we may have accidentally", "// inherited are marked close-on-exec so they stay out of the", "// container", "if", "err", ":=", "utils", ".", "CloseExecFrom", "(", "config", ".", "PassedFilesCount", "+", "3", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "capabilities", ":=", "config", ".", "Config", ".", "Capabilities", "\n", "if", "config", ".", "Capabilities", "!=", "nil", "{", "capabilities", "=", "config", ".", "Capabilities", "\n", "}", "\n", "w", ",", "err", ":=", "newCapWhitelist", "(", "capabilities", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// drop capabilities in bounding set before changing user", "if", "err", ":=", "w", ".", "dropBoundingSet", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// preserve existing capabilities while we change users", "if", "err", ":=", "system", ".", "SetKeepCaps", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "setupUser", "(", "config", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "<mask>", ".", "ClearKeepCaps", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// drop all other capabilities", "if", "err", ":=", "w", ".", "drop", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "config", ".", "Cwd", "!=", "\"", "\"", "{", "if", "err", ":=", "syscall", ".", "Chdir", "(", "config", ".", "Cwd", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,838
all-17839
[ "StringFind", "returns", "in", "found", "if", "token", "has", "been", "found", "in", "s", "and", "returns", "the", "remaining", "string", "afte", "token", "in", "remainder", ".", "The", "whole", "string", "s", "will", "be", "returned", "if", "found", "is", "false", "." ]
[ "func", "StringFind", "(", "s", ",", "token", "string", ")", "(", "remainder", "string", ",", "found", "bool", ")", "{", "i", ":=", "strings", ".", "<mask>", "(", "s", ",", "token", ")", "\n", "if", "i", "==", "-", "1", "{", "return", "s", ",", "false", "\n", "}", "\n", "return", "s", "[", "i", "+", "len", "(", "token", ")", ":", "]", ",", "true", "\n", "}" ]
17,839
all-17840
[ "HasValue", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TriggeringValue", ")", "HasValue", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Value", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
17,840
all-17841
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBackgroundColorsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss47", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
17,841
all-17842
[ "SetDesiredStatus", "safely", "sets", "the", "desired", "status", "of", "the", "resource" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "SetDesiredStatus", "(", "status", "resourcestatus", ".", "ResourceStatus", ")", "{", "cgroup", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "cgroup", ".", "desiredStatusUnsafe", "=", "<mask>", "\n", "}" ]
17,842
all-17843
[ "NewsItem", "related", "functions", "and", "methods", "Create", "a", "NewsItem" ]
[ "func", "NewNewsItem", "(", "itemdata", "NewsItem", ",", "author", "uuid", ".", "UUID", ")", "(", "*", "NewsItem", ",", "error", ")", "{", "c", ":=", "new", "(", "NewsItem", ")", "\n", "if", "err", ":=", "mergo", ".", "MergeWithOverwrite", "(", "c", ",", "itemdata", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "err", ".", "Error", "(", ")", "+", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "UUID", ",", "_", "=", "uuid", ".", "V4", "(", ")", "\n", "c", ".", "Author", "=", "author", "\n", "c", ".", "Created", "=", "time", ".", "Now", "(", ")", "\n", "if", "err", ":=", "storage", ".", "Store", "(", "c", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "err", ".", "Error", "(", ")", "+", "\"", "\"", ")", "\n", "}", "\n", "eventqueue", ".", "Publish", "(", "utils", ".", "CKPTEvent", "{", "Type", ":", "utils", ".", "NEWS_EVENT", ",", "Subject", ":", "\"", "\"", ",", "Message", ":", "\"", "}", ")", "", "\n", "return", "c", ",", "nil", "\n", "}" ]
17,843
all-17844
[ "render", "primitives", "from", "array", "data" ]
[ "func", "DrawRangeElements", "(", "mode", "uint32", ",", "start", "uint32", ",", "end", "uint32", ",", "count", "int32", ",", "xtype", "uint32", ",", "indices", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowDrawRangeElements", "(", "gpDrawRangeElements", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "C", ".", "GLuint", ")", "(", "start", ")", ",", "(", "C", ".", "GLuint", ")", "(", "end", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "indices", ")", "\n", "}" ]
17,844
all-17845
[ "NewZoneTagFilter", "returns", "a", "new", "ZoneTagFilter", "given", "a", "list", "of", "zone", "tags" ]
[ "func", "NewZoneTagFilter", "(", "tags", "[", "]", "string", ")", "ZoneTagFilter", "{", "if", "len", "(", "tags", ")", "==", "1", "&&", "len", "(", "tags", "[", "0", "]", ")", "==", "0", "{", "tags", "=", "[", "]", "string", "{", "}", "\n", "}", "\n", "return", "ZoneTagFilter", "{", "zoneTags", ":", "<mask>", "}", "\n", "}" ]
17,845
all-17846
[ "emitContainerEvent", "passes", "a", "given", "event", "up", "through", "the", "containerEvents", "channel", "if", "necessary", ".", "It", "will", "omit", "events", "the", "backend", "would", "not", "process", "and", "will", "perform", "best", "-", "effort", "deduplication", "of", "events", "." ]
[ "func", "(", "mtask", "*", "managedTask", ")", "emitContainerEvent", "(", "task", "*", "apitask", ".", "Task", ",", "cont", "*", "apicontainer", ".", "Container", ",", "reason", "string", ")", "{", "event", ",", "err", ":=", "api", ".", "NewContainerStateChangeEvent", "(", "task", ",", "cont", ",", "reason", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "cont", ".", "Name", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "mtask", ".", "Arn", ",", "cont", ".", "Name", ",", "event", ".", "<mask>", "(", ")", ")", "\n", "mtask", ".", "stateChangeEvents", "<-", "event", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "mtask", ".", "Arn", ",", "cont", ".", "Name", ",", "event", ".", "String", "(", ")", ")", "\n", "}" ]
17,846
all-17847
[ "Records", "retuns", "a", "list", "of", "endpoints", "in", "a", "given", "zone" ]
[ "func", "(", "p", "*", "dnsimpleProvider", ")", "Records", "(", ")", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "_", "error", ")", "{", "zones", ",", "err", ":=", "p", ".", "Zones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "<mask>", ":=", "range", "zones", "{", "page", ":=", "1", "\n", "listOptions", ":=", "&", "dnsimple", ".", "ZoneRecordListOptions", "{", "}", "\n", "for", "{", "listOptions", ".", "Page", "=", "page", "\n", "records", ",", "err", ":=", "p", ".", "client", ".", "ListRecords", "(", "p", ".", "accountID", ",", "zone", ".", "Name", ",", "listOptions", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "record", ":=", "range", "records", ".", "Data", "{", "switch", "record", ".", "Type", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "break", "\n", "default", ":", "continue", "\n", "}", "\n", "endpoints", "=", "append", "(", "endpoints", ",", "endpoint", ".", "NewEndpointWithTTL", "(", "record", ".", "Name", "+", "\"", "\"", "+", "record", ".", "ZoneID", ",", "record", ".", "Type", ",", "endpoint", ".", "TTL", "(", "record", ".", "TTL", ")", ",", "record", ".", "Content", ")", ")", "\n", "}", "\n", "page", "++", "\n", "if", "page", ">", "records", ".", "Pagination", ".", "TotalPages", "{", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "endpoints", ",", "nil", "\n", "}" ]
17,847
all-17848
[ "HandleLogin", "handles", "GitHub", "login", "request", "from", "front", "-", "end", ".", "It", "starts", "a", "new", "git", "oauth", "session", "and", "redirect", "user", "to", "GitHub", "OAuth", "end", "-", "point", "for", "authentication", "." ]
[ "func", "(", "ga", "*", "Agent", ")", "HandleLogin", "(", "client", "OAuthClient", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "stateToken", ":=", "xsrftoken", ".", "Generate", "(", "ga", ".", "gc", ".", "ClientSecret", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "<mask>", ":=", "hex", ".", "EncodeToString", "(", "[", "]", "byte", "(", "stateToken", ")", ")", "\n", "oauthSession", ",", "err", ":=", "ga", ".", "gc", ".", "CookieStore", ".", "New", "(", "r", ",", "oauthSessionCookie", ")", "\n", "oauthSession", ".", "Options", ".", "Secure", "=", "true", "\n", "oauthSession", ".", "Options", ".", "HttpOnly", "=", "true", "\n", "if", "err", "!=", "nil", "{", "ga", ".", "serverError", "(", "w", ",", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "oauthSession", ".", "Options", ".", "MaxAge", "=", "10", "*", "60", "\n", "oauthSession", ".", "Values", "[", "stateKey", "]", "=", "state", "\n\n", "if", "err", ":=", "oauthSession", ".", "Save", "(", "r", ",", "w", ")", ";", "err", "!=", "nil", "{", "ga", ".", "serverError", "(", "w", ",", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "redirectURL", ":=", "client", ".", "AuthCodeURL", "(", "state", ",", "oauth2", ".", "ApprovalForce", ",", "oauth2", ".", "AccessTypeOnline", ")", "\n", "http", ".", "Redirect", "(", "w", ",", "r", ",", "redirectURL", ",", "http", ".", "StatusFound", ")", "\n", "}", "\n", "}" ]
17,848
all-17849
[ "NewOutgoingLocation", "creates", "a", "new", "outgoing", "location", "." ]
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingLocation", "(", "recipient", "Recipient", ",", "latitude", ",", "longitude", "float32", ")", "*", "OutgoingLocation", "{", "<mask>", "&", "OutgoingLocation", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":", "api", ",", "Recipient", ":", "recipient", ",", "}", ",", "}", ",", "Latitude", ":", "latitude", ",", "Longitude", ":", "longitude", ",", "}", "\n", "}" ]
17,849
all-17850
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RareIntegerData", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
17,850
all-17851
[ "create", "returns", "a", "new", "blank", "Engine", "instance", "without", "any", "middleware", "attached", "." ]
[ "func", "create", "(", ")", "*", "Engine", "{", "engine", ":=", "&", "Engine", "{", "RouterGroup", ":", "RouterGroup", "{", "Handlers", ":", "nil", ",", "basePath", ":", "\"", "\"", ",", "<mask>", ":", "true", ",", "}", ",", "trees", ":", "make", "(", "methodTrees", ",", "0", ",", "9", ")", ",", "}", "\n", "engine", ".", "RouterGroup", ".", "engine", "=", "engine", "\n", "return", "engine", "\n", "}" ]
17,851
all-17852
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetEventListenersReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
17,852
all-17853
[ "GetWidth", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_width", "()", "." ]
[ "func", "(", "<mask>", "*", "PaperSize", ")", "GetWidth", "(", "unit", "Unit", ")", "float64", "{", "c", ":=", "C", ".", "gtk_paper_size_get_width", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
17,853
all-17854
[ "SyncConfig", "updates", "resource", "list", "from", "a", "file" ]
[ "func", "(", "r", "*", "Ranch", ")", "SyncConfig", "(", "config", "string", ")", "error", "{", "resources", ",", "err", ":=", "ParseConfig", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "r", ".", "<mask>", ".", "SyncResources", "(", "resources", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,854
all-17855
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetMediaTextReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
17,855
all-17856
[ "Returns", "information", "about", "an", "active", "uniform", "variable", "for", "the", "specified", "program", "object" ]
[ "func", "GetActiveUniform", "(", "program", "uint32", ",", "index", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "size", "*", "int32", ",", "xtype", "*", "uint32", ",", "name", "*", "uint8", ")", "{", "syscall", ".", "Syscall9", "(", "gpGetActiveUniform", ",", "7", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "index", ")", ",", "uintptr", "(", "bufSize", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "xtype", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
17,856
all-17857
[ "End", "ends", "a", "transaction", "." ]
[ "func", "(", "t", "*", "tx", ")", "End", "(", ")", "error", "{", "t", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "for", "t", ".", "ss", ".", "Peek", "(", ")", "!=", "rootSegment", "{", "t", ".", "EndSegment", "(", ")", "// discarding errors?", "\n", "}", "\n", "return", "t", ".", "Tracer", ".", "EndTransaction", "(", "t", ".", "<mask>", ")", "\n", "}" ]
17,857
all-17858
[ "SignBytes", "signs", "bytes", "using", "a", "private", "key", "unique", "to", "your", "application", "." ]
[ "func", "SignBytes", "(", "c", "context", ".", "Context", ",", "bytes", "[", "]", "byte", ")", "(", "keyName", "string", ",", "signature", "[", "]", "byte", ",", "err", "error", ")", "{", "req", ":=", "&", "pb", ".", "SignForAppRequest", "{", "BytesToSign", ":", "bytes", "}", "\n", "<mask>", ":=", "&", "pb", ".", "SignForAppResponse", "{", "}", "\n\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "GetKeyName", "(", ")", ",", "res", ".", "GetSignatureBytes", "(", ")", ",", "nil", "\n", "}" ]
17,858
all-17859
[ "Do", "executes", "Fetch", ".", "fulfillRequest", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "FulfillRequestParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandFulfillRequest", ",", "p", ",", "nil", ")", "\n", "}" ]
17,859
all-17860
[ "Set", "value", "in", "redis", "session" ]
[ "func", "(", "rp", "*", "redisProvider", ")", "Set", "(", "key", "string", ",", "values", "map", "[", "string", "]", "string", ")", "(", "*", "redisStore", ",", "error", ")", "{", "rs", ":=", "&", "redisStore", "{", "SID", ":", "key", ",", "Values", ":", "<mask>", "}", "\n", "err", ":=", "provider", ".", "refresh", "(", "rs", ")", "\n", "return", "rs", ",", "err", "\n", "}" ]
17,860
all-17861
[ "Sign", "signs", "the", "msg", "with", "the", "named", "key", ".", "It", "returns", "an", "error", "if", "the", "key", "doesn", "t", "exist", "or", "the", "decryption", "fails", "." ]
[ "func", "(", "kb", "dbKeybase", ")", "Sign", "(", "name", ",", "passphrase", "string", ",", "msg", "[", "]", "byte", ")", "(", "sig", "crypto", ".", "Signature", ",", "pub", "crypto", ".", "PubKey", ",", "err", "error", ")", "{", "info", ",", "err", ":=", "kb", ".", "Get", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "var", "priv", "crypto", ".", "PrivKey", "\n", "switch", "info", ".", "(", "type", ")", "{", "case", "localInfo", ":", "linfo", ":=", "info", ".", "(", "localInfo", ")", "\n", "if", "linfo", ".", "PrivKeyArmor", "==", "\"", "\"", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "priv", ",", "err", "=", "unarmorDecryptPrivKey", "(", "linfo", ".", "PrivKeyArmor", ",", "passphrase", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "case", "ledgerInfo", ":", "linfo", ":=", "info", ".", "(", "ledgerInfo", ")", "\n", "priv", ",", "err", "=", "crypto", ".", "NewPrivKeyLedgerSecp256k1", "(", "linfo", ".", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "case", "offlineInfo", ":", "linfo", ":=", "info", ".", "(", "offlineInfo", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "msg", ")", "\n", "buf", ":=", "bufio", ".", "NewReader", "(", "os", ".", "Stdin", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\"", ")", "\n", "// Will block until user inputs the signature", "signed", ",", "err", ":=", "buf", ".", "ReadString", "(", "'\\n'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "cdc", ".", "MustUnmarshalBinary", "(", "[", "]", "byte", "(", "signed", ")", ",", "sig", ")", "\n", "return", "sig", ",", "linfo", ".", "GetPubKey", "(", ")", ",", "nil", "\n", "}", "\n", "sig", ",", "err", "=", "priv", ".", "Sign", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "pub", "=", "priv", ".", "PubKey", "(", ")", "\n", "return", "sig", ",", "pub", ",", "nil", "\n", "}" ]
17,861
all-17862
[ "restClientFor", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernets", "/", "pkg", "/", "client", "/", "restclient", ".", "RESTClientFor", ".", "RESTClientFor", "returns", "a", "RESTClient", "that", "satisfies", "the", "requested", "attributes", "on", "a", "client", "Config", "object", ".", "Note", "that", "a", "RESTClient", "may", "require", "fields", "that", "are", "optional", "when", "initializing", "a", "Client", ".", "A", "RESTClient", "created", "by", "this", "method", "is", "generic", "-", "it", "expects", "to", "operate", "on", "an", "API", "that", "follows", "the", "Kubernetes", "conventions", "but", "may", "not", "be", "the", "Kubernetes", "API", "." ]
[ "func", "restClientFor", "(", "config", "*", "restConfig", ")", "(", "*", "url", ".", "URL", ",", "*", "http", ".", "Client", ",", "error", ")", "{", "// REMOVED: Configurable GroupVersion, Codec", "// REMOVED: Configurable versionedAPIPath", "baseURL", ",", "err", ":=", "defaultServerURLFor", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "transport", ",", "err", ":=", "transportFor", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "httpClient", "*", "http", ".", "Client", "\n", "if", "transport", "!=", "http", ".", "DefaultTransport", "{", "httpClient", "=", "&", "http", ".", "<mask>", "{", "Transport", ":", "transport", "}", "\n", "}", "\n\n", "// REMOVED: Configurable QPS, Burst, ContentConfig", "// REMOVED: Actually returning a RESTClient object.", "return", "baseURL", ",", "httpClient", ",", "nil", "\n", "}" ]
17,862
all-17863
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StyleDeclarationEdit", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
17,863
all-17864
[ "Register", "adds", "a", "codec", "for", "a", "mimetype", "to", "r", "." ]
[ "func", "(", "reg", "*", "Registry", ")", "Register", "(", "mimetype", "string", ",", "codec", "Codec", ")", "{", "defer", "reg", ".", "mutex", ".", "Unlock", "(", ")", "\n", "reg", ".", "mutex", ".", "Lock", "(", ")", "\n\n", "if", "reg", ".", "codecs", "==", "nil", "{", "reg", ".", "codecs", "=", "<mask>", "(", "map", "[", "string", "]", "Codec", ")", "\n", "}", "\n\n", "reg", ".", "codecs", "[", "mimetype", "]", "=", "codec", "\n", "}" ]
17,864
all-17865
[ "GetBoard", "returns", "a", "single", "dashboard", "created", "on", "this", "account", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetBoard", "(", "id", "string", ")", "(", "*", "Board", ",", "error", ")", "{", "var", "board", "Board", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ")", ",", "nil", ",", "&", "board", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "<mask>", ",", "nil", "\n", "}" ]
17,865
all-17866
[ "Copy", "works", "just", "like", "New", "but", "preserves", "the", "exact", "authentication", "information", "from", "the", "original", "session", "." ]
[ "func", "(", "s", "*", "Session", ")", "Copy", "(", ")", "*", "<mask>", "{", "s", ".", "m", ".", "Lock", "(", ")", "\n", "scopy", ":=", "copySession", "(", "s", ",", "true", ")", "\n", "s", ".", "m", ".", "Unlock", "(", ")", "\n", "scopy", ".", "Refresh", "(", ")", "\n", "return", "scopy", "\n", "}" ]
17,866
all-17867
[ "alarmDisarmCommandFunc", "executes", "the", "alarm", "disarm", "command", "." ]
[ "func", "alarmDisarmCommandFunc", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "!=", "0", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "ctx", ",", "cancel", ":=", "commandCtx", "(", "cmd", ")", "\n", "resp", ",", "err", ":=", "mustClientFromCmd", "(", "cmd", ")", ".", "AlarmDisarm", "(", "ctx", ",", "&", "v3", ".", "AlarmMember", "{", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "ExitWithError", "(", "ExitError", ",", "err", ")", "\n", "}", "\n", "<mask>", ".", "Alarm", "(", "*", "resp", ")", "\n", "}" ]
17,867
all-17868
[ "/", "*", "header", "formats", "a", "log", "header", "as", "defined", "by", "the", "C", "++", "implementation", ".", "It", "returns", "a", "buffer", "containing", "the", "formatted", "header", ".", "The", "depth", "specifies", "how", "many", "stack", "frames", "above", "lives", "the", "source", "line", "to", "be", "identified", "in", "the", "log", "message", "." ]
[ "func", "(", "l", "*", "Log", ")", "header", "(", "s", "Severity", ",", "depth", "int", ")", "(", "*", "buffer", ",", "string", ",", "int", ")", "{", "// Lmmdd hh:mm:ss.uuuuuu threadid file:line]", "now", ":=", "timeNow", "(", ")", "\n", "_", ",", "file", ",", "<mask>", ",", "ok", ":=", "runtime", ".", "Caller", "(", "l", ".", "skip", "+", "depth", ")", "\n", "if", "!", "ok", "{", "file", "=", "\"", "\"", "\n", "line", "=", "1", "\n", "}", "else", "{", "slash", ":=", "strings", ".", "LastIndex", "(", "file", ",", "\"", "\"", ")", "\n", "if", "slash", ">=", "0", "{", "file", "=", "file", "[", "slash", "+", "1", ":", "]", "\n", "}", "\n", "}", "\n", "if", "line", "<", "0", "{", "line", "=", "0", "// not a real line number, but acceptable to someDigits", "\n", "}", "\n", "if", "s", ">", "FatalLog", "{", "s", "=", "InfoLog", "// for safety.", "\n", "}", "\n", "buf", ":=", "l", ".", "getBuffer", "(", ")", "\n\n", "// Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.", "// It's worth about 3X. Fprintf is hard.", "_", ",", "month", ",", "day", ":=", "now", ".", "Date", "(", ")", "\n", "hour", ",", "minute", ",", "second", ":=", "now", ".", "Clock", "(", ")", "\n", "buf", ".", "tmp", "[", "0", "]", "=", "severityChar", "[", "s", "]", "\n", "buf", ".", "twoDigits", "(", "1", ",", "int", "(", "month", ")", ")", "\n", "buf", ".", "twoDigits", "(", "3", ",", "day", ")", "\n", "buf", ".", "tmp", "[", "5", "]", "=", "' '", "\n", "buf", ".", "twoDigits", "(", "6", ",", "hour", ")", "\n", "buf", ".", "tmp", "[", "8", "]", "=", "':'", "\n", "buf", ".", "twoDigits", "(", "9", ",", "minute", ")", "\n", "buf", ".", "tmp", "[", "11", "]", "=", "':'", "\n", "buf", ".", "twoDigits", "(", "12", ",", "second", ")", "\n", "buf", ".", "tmp", "[", "14", "]", "=", "'.'", "\n", "buf", ".", "nDigits", "(", "6", ",", "15", ",", "now", ".", "Nanosecond", "(", ")", "/", "1000", ",", "'0'", ")", "\n", "buf", ".", "tmp", "[", "21", "]", "=", "' '", "\n", "buf", ".", "nDigits", "(", "7", ",", "22", ",", "pid", ",", "' '", ")", "// TODO: should be TID", "\n", "buf", ".", "tmp", "[", "29", "]", "=", "' '", "\n", "buf", ".", "Write", "(", "buf", ".", "tmp", "[", ":", "30", "]", ")", "\n", "buf", ".", "WriteString", "(", "file", ")", "\n", "buf", ".", "tmp", "[", "0", "]", "=", "':'", "\n", "n", ":=", "buf", ".", "someDigits", "(", "1", ",", "line", ")", "\n", "buf", ".", "tmp", "[", "n", "+", "1", "]", "=", "']'", "\n", "buf", ".", "tmp", "[", "n", "+", "2", "]", "=", "' '", "\n", "buf", ".", "Write", "(", "buf", ".", "tmp", "[", ":", "n", "+", "3", "]", ")", "\n", "return", "buf", ",", "file", ",", "line", "\n", "}" ]
17,868
all-17869
[ "Close", "closes", "the", "writer", "." ]
[ "func", "(", "w", "*", "PutObjectWriteCloserAsync", ")", "Close", "(", ")", "error", "{", "w", ".", "writeChan", "<-", "w", ".", "buf", "\n", "close", "(", "w", ".", "writeChan", ")", "\n", "err", ":=", "<-", "w", ".", "errChan", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "w", ".", "<mask>", ",", "err", "=", "w", ".", "client", ".", "CloseAndRecv", "(", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
17,869
all-17870
[ "Init", "validates", "git", "installation", "locates", "the", "git", "executable", "binary", "in", "PATH", "and", "check", "for", "available", "shell", "to", "use", "." ]
[ "func", "Init", "(", ")", "error", "{", "// prevent concurrent call", "initMutex", ".", "Lock", "(", ")", "\n", "defer", "initMutex", ".", "Unlock", "(", ")", "\n\n", "// if validation has been done before and binary located in", "// PATH, return.", "if", "gitBinary", "!=", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "// locate git binary in path", "<mask>", "err", "error", "\n", "if", "gitBinary", ",", "err", "=", "gos", ".", "LookPath", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// locate bash in PATH. If not found, fallback to sh.", "// If neither is found, return error.", "shell", "=", "\"", "\"", "\n", "if", "_", ",", "err", "=", "gos", ".", "LookPath", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "shell", "=", "\"", "\"", "\n", "if", "_", ",", "err", "=", "gos", ".", "LookPath", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,870
all-17871
[ "NewFromMap", "returns", "a", "new", "tree", "containing", "the", "keys", "from", "an", "existing", "map" ]
[ "func", "NewFromMap", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "Tree", "{", "t", ":=", "&", "Tree", "{", "root", ":", "&", "<mask>", "{", "}", "}", "\n", "for", "k", ",", "v", ":=", "range", "m", "{", "t", ".", "Insert", "(", "k", ",", "v", ")", "\n", "}", "\n", "return", "t", "\n", "}" ]
17,871
all-17872
[ "CreateRequest", "formats", "a", "request", "with", "all", "the", "necessary", "headers" ]
[ "func", "(", "r", "rpc", ")", "createRequest", "(", "method", "string", ",", "endpoint", "string", ",", "params", "[", "]", "byte", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "endpoint", "=", "r", ".", "auth", ".", "getBaseUrl", "(", ")", "+", "endpoint", "//BaseUrl depends on Auth type used", "\n\n", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "method", ",", "endpoint", ",", "bytes", ".", "NewBuffer", "(", "params", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Authenticate the request", "r", ".", "auth", ".", "authenticate", "(", "req", ",", "endpoint", ",", "params", ")", "\n\n", "req", ".", "Header", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "return", "req", ",", "nil", "\n", "}" ]
17,872
all-17873
[ "Disconnect", "from", "a", "peer", "gracefully", ".", "TODO", ":", "handle", "graceful", "disconnects", "." ]
[ "func", "(", "sw", "*", "Switch", ")", "StopPeerGracefully", "(", "peer", "*", "Peer", ")", "{", "<mask>", ".", "Notice", "(", "\"", "\"", ")", "\n", "sw", ".", "stopAndRemovePeer", "(", "peer", ",", "nil", ")", "\n", "}" ]
17,873
all-17874
[ "RestoreURL", "restures", "cluster", "state", "from", "object", "storage", "." ]
[ "func", "(", "c", "APIClient", ")", "RestoreURL", "(", "url", "string", ")", "(", "retErr", "error", ")", "{", "restoreClient", ",", "err", ":=", "c", ".", "AdminAPIClient", ".", "Restore", "(", "c", ".", "Ctx", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "_", ",", "err", ":=", "restoreClient", ".", "CloseAndRecv", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "}", "(", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "restoreClient", ".", "Send", "(", "&", "admin", ".", "RestoreRequest", "{", "<mask>", ":", "url", "}", ")", ")", "\n", "}" ]
17,874
all-17875
[ "invalidate", "the", "entirety", "a", "texture", "image" ]
[ "func", "InvalidateTexImage", "(", "texture", "uint32", ",", "<mask>", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpInvalidateTexImage", ",", "2", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "level", ")", ",", "0", ")", "\n", "}" ]
17,875
all-17876
[ "transitionResource", "calls", "applyResourceState", "and", "then", "notifies", "the", "managed", "task", "of", "the", "change", ".", "transitionResource", "is", "called", "by", "progressTask" ]
[ "func", "(", "mtask", "*", "managedTask", ")", "transitionResource", "(", "resource", "taskresource", ".", "TaskResource", ",", "to", "resourcestatus", ".", "ResourceStatus", ")", "{", "err", ":=", "mtask", ".", "applyResourceState", "(", "resource", ",", "to", ")", "\n\n", "if", "mtask", ".", "<mask>", ".", "isTaskManaged", "(", "mtask", ".", "Arn", ")", "{", "mtask", ".", "emitResourceChange", "(", "resourceStateChange", "{", "resource", ":", "resource", ",", "nextState", ":", "to", ",", "err", ":", "err", ",", "}", ")", "\n", "}", "\n", "}" ]
17,876
all-17877
[ "select", "a", "polygon", "rasterization", "mode" ]
[ "func", "PolygonMode", "(", "face", "uint32", ",", "mode", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpPolygonMode", ",", "2", ",", "uintptr", "(", "face", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ")", "\n", "}" ]
17,877
all-17878
[ "Explain", "returns", "a", "number", "of", "details", "about", "how", "the", "MongoDB", "server", "would", "execute", "the", "requested", "query", "such", "as", "the", "number", "of", "objects", "examined", "the", "number", "of", "times", "the", "read", "lock", "was", "yielded", "to", "allow", "writes", "to", "go", "in", "and", "so", "on", ".", "For", "example", ":", "m", ":", "=", "bson", ".", "M", "{}", "err", ":", "=", "collection", ".", "Find", "(", "bson", ".", "M", "{", "filename", ":", "name", "}", ")", ".", "Explain", "(", "m", ")", "if", "err", "==", "nil", "{", "fmt", ".", "Printf", "(", "Explain", ":", "%#v", "\\", "n", "m", ")", "}", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Optimization", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Query", "+", "Optimizer" ]
[ "func", "(", "q", "*", "Query", ")", "Explain", "(", "result", "interface", "{", "}", ")", "error", "{", "q", ".", "m", ".", "Lock", "(", ")", "\n", "clone", ":=", "&", "<mask>", "{", "session", ":", "q", ".", "session", ",", "query", ":", "q", ".", "query", "}", "\n", "q", ".", "m", ".", "Unlock", "(", ")", "\n", "clone", ".", "op", ".", "options", ".", "Explain", "=", "true", "\n", "clone", ".", "op", ".", "hasOptions", "=", "true", "\n", "if", "clone", ".", "op", ".", "limit", ">", "0", "{", "clone", ".", "op", ".", "limit", "=", "-", "q", ".", "op", ".", "limit", "\n", "}", "\n", "iter", ":=", "clone", ".", "Iter", "(", ")", "\n", "if", "iter", ".", "Next", "(", "result", ")", "{", "return", "nil", "\n", "}", "\n", "return", "iter", ".", "Close", "(", ")", "\n", "}" ]
17,878
all-17879
[ "YubiKey", "reads", "an", "OATH", "-", "HOTP", "string", "as", "returned", "by", "a", "YubiKey", "and", "returns", "three", "values", ".", "The", "first", "value", "contains", "the", "actual", "OTP", "the", "second", "value", "contains", "the", "YubiKey", "s", "token", "identifier", "and", "the", "final", "value", "indicates", "whether", "the", "input", "string", "was", "a", "valid", "YubiKey", "OTP", ".", "This", "does", "not", "check", "whether", "the", "code", "is", "correct", "or", "not", "it", "only", "ensures", "that", "it", "is", "well", "-", "formed", "output", "from", "a", "token", "and", "splits", "the", "output", "into", "the", "code", "and", "the", "public", "identity", "." ]
[ "func", "(", "otp", "*", "HOTP", ")", "YubiKey", "(", "in", "string", ")", "(", "string", ",", "string", ",", "bool", ")", "{", "if", "len", "(", "in", ")", "<", "otp", ".", "Digits", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "false", "\n", "}", "\n\n", "otpStart", ":=", "len", "(", "<mask>", ")", "-", "otp", ".", "Digits", "\n", "code", ":=", "in", "[", "otpStart", ":", "]", "\n", "pubid", ":=", "in", "[", ":", "otpStart", "]", "\n", "return", "code", ",", "pubid", ",", "true", "\n", "}" ]
17,879
all-17880
[ "Helper", "method", "to", "make", "requests", "which", "take", "no", "arguments", "and", "return", "simply", "a", "string", "e", ".", "g", ".", "GetIP", "." ]
[ "func", "(", "c", "*", "RPCClientDriver", ")", "rpcStringCall", "(", "<mask>", "string", ")", "(", "string", ",", "error", ")", "{", "var", "info", "string", "\n\n", "if", "err", ":=", "c", ".", "Client", ".", "Call", "(", "method", ",", "struct", "{", "}", "{", "}", ",", "&", "info", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "info", ",", "nil", "\n", "}" ]
17,880
all-17881
[ "Create", "explicitly", "creates", "the", "c", "collection", "with", "details", "of", "info", ".", "MongoDB", "creates", "collections", "automatically", "on", "use", "so", "this", "method", "is", "only", "necessary", "when", "creating", "collection", "with", "non", "-", "default", "characteristics", "such", "as", "capped", "collections", ".", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "createCollection", "+", "Command", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Capped", "+", "Collections" ]
[ "func", "(", "c", "*", "Collection", ")", "Create", "(", "info", "*", "CollectionInfo", ")", "error", "{", "cmd", ":=", "make", "(", "bson", ".", "D", ",", "0", ",", "4", ")", "\n", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "c", ".", "Name", "}", ")", "\n", "if", "info", ".", "Capped", "{", "if", "info", ".", "MaxBytes", "<", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "true", "}", ")", "\n", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "<mask>", ".", "MaxBytes", "}", ")", "\n", "if", "info", ".", "MaxDocs", ">", "0", "{", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "info", ".", "MaxDocs", "}", ")", "\n", "}", "\n", "}", "\n", "if", "info", ".", "DisableIdIndex", "{", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "false", "}", ")", "\n", "}", "\n", "if", "info", ".", "ForceIdIndex", "{", "cmd", "=", "append", "(", "cmd", ",", "bson", ".", "DocElem", "{", "\"", "\"", ",", "true", "}", ")", "\n", "}", "\n", "return", "c", ".", "Database", ".", "Run", "(", "cmd", ",", "nil", ")", "\n", "}" ]
17,881
all-17882
[ "validateTLSCertificate", "checks", "if", "c", "is", "ready", "for", "use", "in", "a", "production", "env", ".", "When", "c", "is", "not", "a", "good", "one", "returns", "a", "non", "-", "nil", "error", "describing", "the", "problem", "otherwise", "returns", "nil", "indicating", "success", ".", "A", "good", "certificate", "should", "be", "issued", "(", "even", "though", "indirectly", "when", "providing", "intermediates", ")", "by", "roots", ";", "within", "the", "issuing", "time", "boundary", ";", "and", "match", "the", "Common", "Name", "or", "SAN", "extension", "with", "the", "server", "s", "hostname", "(", "defined", "by", "host", "entry", "in", "the", "API", "config", "file", ")", ".", "See", "x509", ".", "Verify", "to", "more", "detailed", "info", "." ]
[ "func", "validateTLSCertificate", "(", "c", "*", "tls", ".", "Certificate", ",", "<mask>", "*", "x509", ".", "CertPool", ")", "error", "{", "configHost", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "urlHost", ",", "err", ":=", "url", ".", "Parse", "(", "configHost", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "hostname", ":=", "urlHost", ".", "Hostname", "(", ")", "\n", "if", "c", "==", "nil", "||", "len", "(", "c", ".", "Certificate", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "intermediateCertPool", "*", "x509", ".", "CertPool", "\n", "if", "len", "(", "c", ".", "Certificate", ")", ">", "1", "{", "intermediateCertPool", "=", "x509", ".", "NewCertPool", "(", ")", "\n", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "c", ".", "Certificate", ")", ";", "i", "++", "{", "var", "intermerdiateCert", "*", "x509", ".", "Certificate", "\n", "if", "intermerdiateCert", ",", "err", "=", "x509", ".", "ParseCertificate", "(", "c", ".", "Certificate", "[", "i", "]", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "intermediateCertPool", ".", "AddCert", "(", "intermerdiateCert", ")", "\n", "}", "\n", "}", "\n", "leafCert", ",", "err", ":=", "x509", ".", "ParseCertificate", "(", "c", ".", "Certificate", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "leafCert", ".", "Verify", "(", "x509", ".", "VerifyOptions", "{", "DNSName", ":", "hostname", ",", "Roots", ":", "roots", ",", "Intermediates", ":", "intermediateCertPool", ",", "}", ")", "\n", "return", "err", "\n", "}" ]
17,882
all-17883
[ "Deletes", "the", "specified", "snapshot", "object", ".", "snapshotId", ":", "The", "ID", "of", "the", "snapshot", "object", "to", "delete", "." ]
[ "func", "(", "c", "*", "ClientManager", ")", "DeleteSnapshot", "(", "snapshotId", "int", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "StorageService", ".", "<mask>", "(", "snapshotId", ")", ".", "DeleteObject", "(", ")", "\n", "return", "err", "\n", "}" ]
17,883
all-17884
[ "ContainerProjectAndName", "returns", "the", "project", "and", "the", "name", "of", "the", "container", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerProjectAndName", "(", "id", "int", ")", "(", "string", ",", "string", ",", "error", ")", "{", "q", ":=", "`\nSELECT projects.name, containers.name\n FROM containers\n JOIN projects ON projects.id = containers.project_id\nWHERE containers.id=?\n`", "\n", "project", ":=", "\"", "\"", "\n", "name", ":=", "\"", "\"", "\n", "arg1", ":=", "[", "]", "interface", "{", "}", "{", "id", "}", "\n", "arg2", ":=", "[", "]", "interface", "{", "}", "{", "&", "<mask>", ",", "&", "name", "}", "\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "q", ",", "arg1", ",", "arg2", ")", "\n", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "project", ",", "name", ",", "err", "\n", "}" ]
17,884
all-17885
[ "copyConfig", "copies", "config", ".", "json", "if", "any", "from", "src", "to", "dest", "." ]
[ "func", "(", "c", "*", "copier", ")", "copyConfig", "(", "ctx", "context", ".", "Context", ",", "src", "types", ".", "<mask>", ")", "error", "{", "srcInfo", ":=", "src", ".", "ConfigInfo", "(", ")", "\n", "if", "srcInfo", ".", "Digest", "!=", "\"", "\"", "{", "configBlob", ",", "err", ":=", "src", ".", "ConfigBlob", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "srcInfo", ".", "Digest", ")", "\n", "}", "\n\n", "destInfo", ",", "err", ":=", "func", "(", ")", "(", "types", ".", "BlobInfo", ",", "error", ")", "{", "// A scope for defer", "progressPool", ",", "progressCleanup", ":=", "c", ".", "newProgressPool", "(", "ctx", ")", "\n", "defer", "progressCleanup", "(", ")", "\n", "bar", ":=", "c", ".", "createProgressBar", "(", "progressPool", ",", "srcInfo", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "destInfo", ",", "err", ":=", "c", ".", "copyBlobFromStream", "(", "ctx", ",", "bytes", ".", "NewReader", "(", "configBlob", ")", ",", "srcInfo", ",", "nil", ",", "false", ",", "true", ",", "bar", ")", "\n", "if", "err", "!=", "nil", "{", "return", "types", ".", "BlobInfo", "{", "}", ",", "err", "\n", "}", "\n", "bar", ".", "SetTotal", "(", "int64", "(", "len", "(", "configBlob", ")", ")", ",", "true", ")", "\n", "return", "destInfo", ",", "nil", "\n", "}", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "destInfo", ".", "Digest", "!=", "srcInfo", ".", "Digest", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "srcInfo", ".", "Digest", ",", "destInfo", ".", "Digest", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,885
all-17886
[ "title", ":", "get", "auth", "scheme", "path", ":", "/", "auth", "/", "scheme", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK" ]
[ "func", "authScheme", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "error", "{", "info", ",", "err", ":=", "app", ".", "AuthScheme", ".", "Info", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "data", ":=", "schemeData", "{", "Name", ":", "app", ".", "AuthScheme", ".", "Name", "(", ")", ",", "Data", ":", "info", "}", "\n", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "data", ")", "\n", "}" ]
17,886
all-17887
[ "Revert", "builds", "a", "string", "for", "this", "regexp", "using", "the", "given", "values", ".", "Positional", "values", "use", "an", "empty", "string", "as", "key", ".", "The", "values", "are", "modified", "in", "place", "and", "only", "the", "unused", "ones", "are", "left", "." ]
[ "func", "(", "r", "*", "Regexp", ")", "Revert", "(", "values", "url", ".", "Values", ")", "(", "string", ",", "error", ")", "{", "vars", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "r", ".", "groups", ")", ")", "\n", "for", "k", ",", "v", ":=", "<mask>", "r", ".", "groups", "{", "if", "len", "(", "values", "[", "v", "]", ")", "==", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "v", ",", "len", "(", "r", ".", "groups", ")", ")", "\n", "}", "\n", "vars", "[", "k", "]", "=", "values", "[", "v", "]", "[", "0", "]", "\n", "values", "[", "v", "]", "=", "values", "[", "v", "]", "[", "1", ":", "]", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "r", ".", "template", ",", "vars", "...", ")", ",", "nil", "\n", "}" ]
17,887
all-17888
[ "AllByClass", "finds", "zero", "or", "more", "elements", "with", "a", "given", "CSS", "class", "." ]
[ "func", "(", "s", "*", "selectable", ")", "AllByClass", "(", "text", "string", ")", "*", "MultiSelection", "{", "return", "newMultiSelection", "(", "s", ".", "<mask>", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "Class", ",", "text", ")", ")", "\n", "}" ]
17,888
all-17889
[ "RunIODirPath", "runs", "the", "command", "with", "the", "given", "IO", "and", "arguments", "in", "the", "given", "directory", "specified", "by", "dirPath", "." ]
[ "func", "RunIODirPath", "(", "ioObj", "IO", ",", "dirPath", "string", ",", "args", "...", "string", ")", "error", "{", "<mask>", "debugStderr", "io", ".", "ReadWriter", "=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "var", "stderr", "io", ".", "Writer", "=", "debugStderr", "\n", "if", "ioObj", ".", "Stderr", "!=", "nil", "{", "stderr", "=", "io", ".", "MultiWriter", "(", "debugStderr", ",", "ioObj", ".", "Stderr", ")", "\n", "}", "\n", "cmd", ":=", "exec", ".", "Command", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "...", ")", "\n", "cmd", ".", "Stdin", "=", "ioObj", ".", "Stdin", "\n", "cmd", ".", "Stdout", "=", "ioObj", ".", "Stdout", "\n", "cmd", ".", "Stderr", "=", "stderr", "\n", "cmd", ".", "Dir", "=", "dirPath", "\n", "if", "err", ":=", "cmd", ".", "Run", "(", ")", ";", "err", "!=", "nil", "{", "data", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "debugStderr", ")", "\n", "if", "data", "!=", "nil", "&&", "len", "(", "data", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "strings", ".", "Join", "(", "args", ",", "\"", "\"", ")", ",", "err", ".", "Error", "(", ")", ",", "string", "(", "data", ")", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "args", ",", "\"", "\"", ")", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
17,889
all-17890
[ "GetAllowTrustOp", "retrieves", "the", "AllowTrustOp", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "OperationBody", ")", "GetAllowTrustOp", "(", ")", "(", "result", "AllowTrustOp", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "<mask>", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "AllowTrustOp", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
17,890
all-17891
[ "valueToProto", "converts", "a", "named", "value", "to", "a", "newly", "allocated", "Property", ".", "The", "returned", "error", "string", "is", "empty", "on", "success", "." ]
[ "func", "valueToProto", "(", "defaultAppID", ",", "name", "string", ",", "v", "reflect", ".", "Value", ",", "multiple", "bool", ")", "(", "p", "*", "pb", ".", "Property", ",", "errStr", "string", ")", "{", "var", "(", "pv", "pb", ".", "PropertyValue", "\n", "unsupported", "bool", "\n", ")", "\n", "switch", "v", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Invalid", ":", "// No-op.", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "pv", ".", "Int64Value", "=", "proto", ".", "Int64", "(", "v", ".", "Int", "(", ")", ")", "\n", "case", "reflect", ".", "Bool", ":", "pv", ".", "BooleanValue", "=", "proto", ".", "Bool", "(", "v", ".", "Bool", "(", ")", ")", "\n", "case", "reflect", ".", "String", ":", "pv", ".", "StringValue", "=", "proto", ".", "String", "(", "v", ".", "String", "(", ")", ")", "\n", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "pv", ".", "DoubleValue", "=", "proto", ".", "Float64", "(", "v", ".", "Float", "(", ")", ")", "\n", "case", "reflect", ".", "Ptr", ":", "if", "k", ",", "ok", ":=", "v", ".", "Interface", "(", ")", ".", "(", "*", "Key", ")", ";", "ok", "{", "if", "k", "!=", "nil", "{", "pv", ".", "Referencevalue", "=", "keyToReferenceValue", "(", "defaultAppID", ",", "k", ")", "\n", "}", "\n", "}", "else", "{", "unsupported", "=", "true", "\n", "}", "\n", "case", "reflect", ".", "Struct", ":", "switch", "t", ":=", "v", ".", "Interface", "(", ")", ".", "(", "type", ")", "{", "case", "time", ".", "Time", ":", "if", "t", ".", "Before", "(", "minTime", ")", "||", "t", ".", "After", "(", "maxTime", ")", "{", "return", "nil", ",", "\"", "\"", "\n", "}", "\n", "pv", ".", "Int64Value", "=", "proto", ".", "Int64", "(", "toUnixMicro", "(", "t", ")", ")", "\n", "case", "appengine", ".", "GeoPoint", ":", "if", "!", "t", ".", "Valid", "(", ")", "{", "return", "nil", ",", "\"", "\"", "\n", "}", "\n", "// NOTE: Strangely, latitude maps to X, longitude to Y.", "pv", ".", "Pointvalue", "=", "&", "pb", ".", "PropertyValue_PointValue", "{", "X", ":", "&", "t", ".", "Lat", ",", "Y", ":", "&", "t", ".", "Lng", "}", "\n", "default", ":", "unsupported", "=", "<mask>", "\n", "}", "\n", "case", "reflect", ".", "Slice", ":", "if", "b", ",", "ok", ":=", "v", ".", "Interface", "(", ")", ".", "(", "[", "]", "byte", ")", ";", "ok", "{", "pv", ".", "StringValue", "=", "proto", ".", "String", "(", "string", "(", "b", ")", ")", "\n", "}", "else", "{", "// nvToProto should already catch slice values.", "// If we get here, we have a slice of slice values.", "unsupported", "=", "true", "\n", "}", "\n", "default", ":", "unsupported", "=", "true", "\n", "}", "\n", "if", "unsupported", "{", "return", "nil", ",", "\"", "\"", "+", "v", ".", "Type", "(", ")", ".", "String", "(", ")", "\n", "}", "\n", "p", "=", "&", "pb", ".", "Property", "{", "Name", ":", "proto", ".", "String", "(", "name", ")", ",", "Value", ":", "&", "pv", ",", "Multiple", ":", "proto", ".", "Bool", "(", "multiple", ")", ",", "}", "\n", "if", "v", ".", "IsValid", "(", ")", "{", "switch", "v", ".", "Interface", "(", ")", ".", "(", "type", ")", "{", "case", "[", "]", "byte", ":", "p", ".", "Meaning", "=", "pb", ".", "Property_BLOB", ".", "Enum", "(", ")", "\n", "case", "ByteString", ":", "p", ".", "Meaning", "=", "pb", ".", "Property_BYTESTRING", ".", "Enum", "(", ")", "\n", "case", "appengine", ".", "BlobKey", ":", "p", ".", "Meaning", "=", "pb", ".", "Property_BLOBKEY", ".", "Enum", "(", ")", "\n", "case", "time", ".", "Time", ":", "p", ".", "Meaning", "=", "pb", ".", "Property_GD_WHEN", ".", "Enum", "(", ")", "\n", "case", "appengine", ".", "GeoPoint", ":", "p", ".", "Meaning", "=", "pb", ".", "Property_GEORSS_POINT", ".", "Enum", "(", ")", "\n", "}", "\n", "}", "\n", "return", "p", ",", "\"", "\"", "\n", "}" ]
17,891
all-17892
[ "AssignDefaultSecurityGroups", "-" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "AssignDefaultSecurityGroups", "(", ")", "error", "{", "sgs", ",", "err", ":=", "m", ".", "ListSecurityGroups", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "globalConfig", ",", "err", ":=", "m", ".", "Cfg", ".", "GetGlobalConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "runningGroup", ":=", "range", "globalConfig", ".", "RunningSecurityGroups", "{", "if", "group", ",", "ok", ":=", "sgs", "[", "runningGroup", "]", ";", "ok", "{", "if", "!", "group", ".", "Running", "{", "err", "=", "m", ".", "AssignRunningSecurityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "runningGroup", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "stagingGroup", ":=", "range", "globalConfig", ".", "StagingSecurityGroups", "{", "if", "group", ",", "ok", ":=", "sgs", "[", "stagingGroup", "]", ";", "ok", "{", "if", "!", "group", ".", "Staging", "{", "err", "=", "m", ".", "AssignStagingSecurityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "stagingGroup", ")", "\n", "}", "\n", "}", "\n\n", "if", "globalConfig", ".", "EnableUnassignSecurityGroups", "{", "for", "groupName", ",", "group", ":=", "range", "sgs", "{", "if", "group", ".", "Running", "&&", "!", "m", ".", "contains", "(", "globalConfig", ".", "RunningSecurityGroups", ",", "groupName", ")", "{", "err", "=", "m", ".", "UnassignRunningSecurityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "<mask>", ".", "Staging", "&&", "!", "m", ".", "contains", "(", "globalConfig", ".", "StagingSecurityGroups", ",", "groupName", ")", "{", "err", "=", "m", ".", "UnassignStagingSecurityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
17,892
all-17893
[ "Returns", "true", "if", "the", "item", "has", "expired", "." ]
[ "func", "(", "item", "Item", ")", "Expired", "(", ")", "bool", "{", "if", "<mask>", ".", "Expiration", "==", "0", "{", "return", "false", "\n", "}", "\n", "return", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ">", "item", ".", "Expiration", "\n", "}" ]
17,893
all-17894
[ "GetDisplay", "()", "is", "a", "wrapper", "around", "gdk_device_manager_get_display", "()", "." ]
[ "func", "(", "v", "*", "DeviceManager", ")", "GetDisplay", "(", ")", "(", "*", "Display", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_device_manager_get_display", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "return", "&", "Display", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", ",", "nil", "\n", "}" ]
17,894
all-17895
[ "GetResolution", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_resolution", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetResolution", "(", ")", "int", "{", "c", ":=", "C", ".", "gtk_print_settings_get_resolution", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
17,895
all-17896
[ "RemovedProperty", "adds", "a", "new", "removed", "job", "property", "to", "the", "list", "of", "differences" ]
[ "func", "(", "dj", "*", "DeltaJob", ")", "RemovedProperty", "(", "name", "string", ",", "p", "*", "enaml", ".", "JobManifestProperty", ")", "{", "dj", ".", "RemovedProperties", "[", "<mask>", "]", "=", "*", "p", "\n", "}" ]
17,896
all-17897
[ "Go", "starts", "the", "protocol", "request", "and", "response", "logging", "." ]
[ "func", "(", "s", "*", "Sniffer", ")", "Go", "(", ")", "{", "defer", "s", ".", "dbConn", ".", "Close", "(", ")", "\n", "defer", "s", ".", "conn", ".", "Close", "(", ")", "\n\n", "req", ":=", "newInitRequest", "(", ")", "\n", "if", "err", ":=", "s", ".", "streamFragment", "(", "dir", "(", "true", ")", ",", "s", ".", "clRd", ",", "s", ".", "dbWr", ",", "req", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "rep", ":=", "newInitReply", "(", ")", "\n", "if", "err", ":=", "s", ".", "streamFragment", "(", "dir", "(", "false", ")", ",", "s", ".", "dbRd", ",", "s", ".", "clWr", ",", "rep", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "for", "{", "//up stream", "if", "err", ":=", "s", ".", "stream", "(", "dir", "(", "true", ")", ",", "s", ".", "clRd", ",", "s", ".", "dbWr", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "//down stream", "if", "err", ":=", "s", ".", "<mask>", "(", "dir", "(", "false", ")", ",", "s", ".", "dbRd", ",", "s", ".", "clWr", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "}" ]
17,897
all-17898
[ "NewSource", "creates", "and", "returns", "source", "." ]
[ "func", "NewSource", "(", "base", ",", "inner", "*", "File", ",", "includes", "[", "]", "*", "File", ")", "*", "source", "{", "return", "&", "source", "{", "base", ":", "base", ",", "inner", ":", "inner", ",", "includes", ":", "<mask>", ",", "}", "\n", "}" ]
17,898
all-17899
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StackTrace", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
17,899
all-17900
[ "NewSTM", "initiates", "a", "new", "STM", "instance", "using", "serializable", "snapshot", "isolation", "by", "default", "." ]
[ "func", "NewSTM", "(", "c", "*", "v3", ".", "<mask>", ",", "apply", "func", "(", "STM", ")", "error", ",", "so", "...", "stmOption", ")", "(", "*", "v3", ".", "TxnResponse", ",", "error", ")", "{", "opts", ":=", "&", "stmOptions", "{", "ctx", ":", "c", ".", "Ctx", "(", ")", "}", "\n", "for", "_", ",", "f", ":=", "range", "so", "{", "f", "(", "opts", ")", "\n", "}", "\n", "if", "len", "(", "opts", ".", "prefetch", ")", "!=", "0", "{", "f", ":=", "apply", "\n", "apply", "=", "func", "(", "s", "STM", ")", "error", "{", "s", ".", "Get", "(", "opts", ".", "prefetch", "...", ")", "\n", "return", "f", "(", "s", ")", "\n", "}", "\n", "}", "\n", "return", "runSTM", "(", "mkSTM", "(", "c", ",", "opts", ")", ",", "apply", ")", "\n", "}" ]