id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
9,700
all-9701
[ "New", "describes", "a", "new", "filename", "located", "at", "the", "given", "absolute", "path", "." ]
[ "func", "New", "(", "path", "string", ")", "(", "Lockfile", ",", "error", ")", "{", "if", "!", "filepath", ".", "IsAbs", "(", "path", ")", "{", "return", "Lockfile", "(", "\"", "\"", ")", ",", "ErrNeedAbsPath", "\n", "}", "\n", "return", "Lockfile", "(", "<mask>", ")", ",", "nil", "\n", "}" ]
9,701
all-9702
[ "Sign", "formats", "the", "signature", "and", "returns", "a", "blob", "signed", "using", "mech", "and", "keyIdentity", "(", "If", "it", "seems", "surprising", "that", "this", "is", "a", "method", "on", "untrustedSignature", "note", "that", "there", "isn’t", "a", "good", "reason", "to", "think", "that", "a", "key", "used", "by", "the", "user", "is", "trusted", "by", "any", "component", "of", "the", "system", "just", "because", "it", "is", "a", "private", "key", "—", "actually", "the", "presence", "of", "a", "private", "key", "on", "the", "system", "increases", "the", "likelihood", "of", "an", "a", "successful", "attack", "on", "that", "private", "key", "on", "that", "particular", "system", ".", ")" ]
[ "func", "(", "s", "untrustedSignature", ")", "<mask>", "(", "mech", "SigningMechanism", ",", "keyIdentity", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "json", ",", "err", ":=", "json", ".", "Marshal", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "mech", ".", "Sign", "(", "json", ",", "keyIdentity", ")", "\n", "}" ]
9,702
all-9703
[ "TODO", ":", "Consider", "pooling", "lazyCallReq", "and", "using", "pointers", "to", "the", "struct", "." ]
[ "func", "newLazyCallReq", "(", "f", "*", "Frame", ")", "lazyCallReq", "{", "if", "msgType", ":=", "f", ".", "Header", ".", "messageType", ";", "msgType", "!=", "messageTypeCallReq", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "msgType", ")", ")", "\n", "}", "\n\n", "cr", ":=", "lazyCallReq", "{", "Frame", ":", "f", "}", "\n\n", "serviceLen", ":=", "f", ".", "Payload", "[", "_serviceLenIndex", "]", "\n", "// nh:1 (hk~1 hv~1){nh}", "headerStart", ":=", "_serviceLenIndex", "+", "1", "/* length byte */", "+", "serviceLen", "\n", "numHeaders", ":=", "int", "(", "f", ".", "Payload", "[", "headerStart", "]", ")", "\n", "cur", ":=", "int", "(", "headerStart", ")", "+", "1", "\n", "for", "i", ":=", "0", ";", "i", "<", "numHeaders", ";", "i", "++", "{", "keyLen", ":=", "int", "(", "f", ".", "Payload", "[", "cur", "]", ")", "\n", "cur", "++", "\n", "key", ":=", "f", ".", "Payload", "[", "cur", ":", "cur", "+", "keyLen", "]", "\n", "cur", "+=", "keyLen", "\n\n", "valLen", ":=", "int", "(", "f", ".", "Payload", "[", "cur", "]", ")", "\n", "cur", "++", "\n", "val", ":=", "f", ".", "Payload", "[", "cur", ":", "cur", "+", "valLen", "]", "\n", "cur", "+=", "valLen", "\n\n", "if", "bytes", ".", "Equal", "(", "key", ",", "_callerNameKeyBytes", ")", "{", "cr", ".", "caller", "=", "val", "\n", "}", "else", "if", "<mask>", ".", "Equal", "(", "key", ",", "_routingDelegateKeyBytes", ")", "{", "cr", ".", "delegate", "=", "val", "\n", "}", "else", "if", "bytes", ".", "Equal", "(", "key", ",", "_routingKeyKeyBytes", ")", "{", "cr", ".", "key", "=", "val", "\n", "}", "\n", "}", "\n\n", "// csumtype:1 (csum:4){0,1} arg1~2 arg2~2 arg3~2", "checkSumType", ":=", "ChecksumType", "(", "f", ".", "Payload", "[", "cur", "]", ")", "\n", "cur", "+=", "1", "/* checksum */", "+", "checkSumType", ".", "ChecksumSize", "(", ")", "\n\n", "// arg1~2", "arg1Len", ":=", "int", "(", "binary", ".", "BigEndian", ".", "Uint16", "(", "f", ".", "Payload", "[", "cur", ":", "cur", "+", "2", "]", ")", ")", "\n", "cur", "+=", "2", "\n", "cr", ".", "method", "=", "f", ".", "Payload", "[", "cur", ":", "cur", "+", "arg1Len", "]", "\n", "return", "cr", "\n", "}" ]
9,703
all-9704
[ "Add2", "()", "is", "a", "wrapper", "around", "gtk_paned_add2", "()", "." ]
[ "func", "(", "v", "*", "Paned", ")", "Add2", "(", "<mask>", "IWidget", ")", "{", "C", ".", "gtk_paned_add2", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
9,704
all-9705
[ "SetActivateOnSingleClick", "is", "a", "wrapper", "around", "gtk_tree_view_set_activate_on_single_click", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "SetActivateOnSingleClick", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_tree_view_set_activate_on_single_click", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "show", ")", ")", "\n", "}" ]
9,705
all-9706
[ "TODO", "(", "ahmetalpbalkan", ")", "Remove", "duplication", "around", "client", "creation", ".", "This", "is", "happening", "because", "we", "auto", "-", "generate", "our", "SDK", "and", "we", "don", "t", "have", "generics", "in", "Go", ".", "We", "are", "hoping", "to", "come", "up", "with", "a", "factory", "or", "some", "defaults", "instance", "to", "set", "these", "client", "configuration", "in", "a", "central", "place", "in", "azure", "-", "sdk", "-", "for", "-", "go", "." ]
[ "func", "oauthClient", "(", ")", "autorest", ".", "Client", "{", "c", ":=", "autorest", ".", "NewClientWithUserAgent", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "version", ".", "<mask>", ")", ")", "\n", "c", ".", "RequestInspector", "=", "withInspection", "(", ")", "\n", "c", ".", "ResponseInspector", "=", "byInspecting", "(", ")", "\n", "// TODO set user agent", "return", "c", "\n", "}" ]
9,706
all-9707
[ "GetThisPathParts", "returns", "the", "same", "information", "as", "GetPathParts", "for", "the", "current", "executable", "." ]
[ "func", "GetThisPathParts", "(", ")", "(", "dirPath", ",", "fileName", ",", "absPath", "<mask>", ")", "{", "exeFile", ",", "_", ":=", "osext", ".", "Executable", "(", ")", "\n", "return", "GetPathParts", "(", "exeFile", ")", "\n", "}" ]
9,707
all-9708
[ "BuildLinuxResourceSpec", "returns", "a", "linuxResources", "object", "for", "the", "task", "cgroup" ]
[ "func", "(", "task", "*", "Task", ")", "BuildLinuxResourceSpec", "(", ")", "(", "specs", ".", "LinuxResources", ",", "error", ")", "{", "linuxResourceSpec", ":=", "specs", ".", "LinuxResources", "{", "}", "\n\n", "// If task level CPU limits are requested, set CPU quota + CPU period", "// Else set CPU shares", "if", "task", ".", "CPU", ">", "0", "{", "linuxCPUSpec", ",", "err", ":=", "task", ".", "buildExplicitLinuxCPUSpec", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "specs", ".", "LinuxResources", "{", "}", ",", "err", "\n", "}", "\n", "linuxResourceSpec", ".", "CPU", "=", "&", "linuxCPUSpec", "\n", "}", "else", "{", "linuxCPUSpec", ":=", "<mask>", ".", "buildImplicitLinuxCPUSpec", "(", ")", "\n", "linuxResourceSpec", ".", "CPU", "=", "&", "linuxCPUSpec", "\n", "}", "\n\n", "// Validate and build task memory spec", "// NOTE: task memory specifications are optional", "if", "task", ".", "Memory", ">", "0", "{", "linuxMemorySpec", ",", "err", ":=", "task", ".", "buildLinuxMemorySpec", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "specs", ".", "LinuxResources", "{", "}", ",", "err", "\n", "}", "\n", "linuxResourceSpec", ".", "Memory", "=", "&", "linuxMemorySpec", "\n", "}", "\n\n", "return", "linuxResourceSpec", ",", "nil", "\n", "}" ]
9,708
all-9709
[ "Create", "creates", "the", "VM", "instance", "acting", "as", "the", "docker", "host" ]
[ "func", "(", "d", "*", "Driver", ")", "Create", "(", ")", "error", "{", "cloudInit", ",", "err", ":=", "d", ".", "getCloudInit", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "client", ":=", "egoscale", ".", "NewClient", "(", "d", ".", "URL", ",", "d", ".", "APIKey", ",", "d", ".", "APISecretKey", ")", "\n\n", "resp", ",", "err", ":=", "client", ".", "RequestWithContext", "(", "context", ".", "TODO", "(", ")", ",", "&", "egoscale", ".", "ListZones", "{", "Name", ":", "d", ".", "AvailabilityZone", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "zones", ":=", "resp", ".", "(", "*", "egoscale", ".", "ListZonesResponse", ")", "\n", "if", "len", "(", "zones", ".", "Zone", ")", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "AvailabilityZone", ")", "\n", "}", "\n", "zone", ":=", "zones", ".", "Zone", "[", "0", "]", ".", "ID", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "d", ".", "AvailabilityZone", ",", "zone", ")", "\n\n", "// Image", "template", ":=", "egoscale", ".", "Template", "{", "IsFeatured", ":", "true", ",", "ZoneID", ":", "\"", "\"", ",", "// GVA2", "}", "\n\n", "templates", ",", "err", ":=", "client", ".", "ListWithContext", "(", "context", ".", "TODO", "(", ")", ",", "&", "template", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "image", ":=", "strings", ".", "ToLower", "(", "d", ".", "Image", ")", "\n", "re", ":=", "regexp", ".", "MustCompile", "(", "`^Linux (?P<name>.+?) (?P<version>[0-9.]+)\\b`", ")", "\n\n", "for", "_", ",", "t", ":=", "range", "templates", "{", "tpl", ":=", "t", ".", "(", "*", "egoscale", ".", "Template", ")", "\n\n", "// Keep only 10GiB images", "if", "tpl", ".", "Size", ">>", "30", "!=", "10", "{", "continue", "\n", "}", "\n\n", "fullname", ":=", "strings", ".", "ToLower", "(", "tpl", ".", "Name", ")", "\n", "if", "image", "==", "fullname", "{", "template", "=", "*", "tpl", "\n", "<mask>", "\n", "}", "\n\n", "submatch", ":=", "re", ".", "FindStringSubmatch", "(", "tpl", ".", "Name", ")", "\n", "if", "len", "(", "submatch", ")", ">", "0", "{", "name", ":=", "strings", ".", "Replace", "(", "strings", ".", "ToLower", "(", "submatch", "[", "1", "]", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "version", ":=", "submatch", "[", "2", "]", "\n", "shortname", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "version", ")", "\n\n", "if", "image", "==", "shortname", "{", "template", "=", "*", "tpl", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "template", ".", "ID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "Image", ")", "\n", "}", "\n\n", "// Reading the username from the template", "if", "name", ",", "ok", ":=", "template", ".", "Details", "[", "\"", "\"", "]", ";", "ok", "{", "d", ".", "SSHUser", "=", "name", "\n", "}", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "d", ".", "Image", ",", "template", ".", "ID", ",", "d", ".", "SSHUser", ")", "\n\n", "// Profile UUID", "resp", ",", "err", "=", "client", ".", "RequestWithContext", "(", "context", ".", "TODO", "(", ")", ",", "&", "egoscale", ".", "ListServiceOfferings", "{", "Name", ":", "d", ".", "InstanceProfile", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "profiles", ":=", "resp", ".", "(", "*", "egoscale", ".", "ListServiceOfferingsResponse", ")", "\n", "if", "len", "(", "profiles", ".", "ServiceOffering", ")", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "InstanceProfile", ")", "\n", "}", "\n", "profile", ":=", "profiles", ".", "ServiceOffering", "[", "0", "]", ".", "ID", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "d", ".", "InstanceProfile", ",", "profile", ")", "\n\n", "// Security groups", "sgs", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "d", ".", "SecurityGroups", ")", ")", "\n", "for", "_", ",", "group", ":=", "range", "d", ".", "SecurityGroups", "{", "if", "group", "==", "\"", "\"", "{", "continue", "\n", "}", "\n\n", "sg", ":=", "&", "egoscale", ".", "SecurityGroup", "{", "Name", ":", "group", "}", "\n", "if", "err", ":=", "client", ".", "Get", "(", "sg", ")", ";", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "egoscale", ".", "ErrorResponse", ")", ";", "!", "ok", "{", "return", "err", "\n", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "group", ")", "\n", "securityGroup", ",", "err", ":=", "d", ".", "createDefaultSecurityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "sg", ".", "ID", "=", "securityGroup", ".", "ID", "\n", "}", "\n\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "group", ",", "sg", ".", "ID", ")", "\n", "sgs", "=", "append", "(", "sgs", ",", "sg", ".", "ID", ")", "\n", "}", "\n\n", "// Affinity Groups", "ags", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "d", ".", "AffinityGroups", ")", ")", "\n", "for", "_", ",", "group", ":=", "range", "d", ".", "AffinityGroups", "{", "if", "group", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "ag", ":=", "&", "egoscale", ".", "AffinityGroup", "{", "Name", ":", "group", "}", "\n", "if", "err", ":=", "client", ".", "Get", "(", "ag", ")", ";", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "egoscale", ".", "ErrorResponse", ")", ";", "!", "ok", "{", "return", "err", "\n", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "group", ")", "\n", "affinityGroup", ",", "err", ":=", "d", ".", "createDefaultAffinityGroup", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ag", ".", "ID", "=", "affinityGroup", ".", "ID", "\n", "}", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "group", ",", "ag", ".", "ID", ")", "\n", "ags", "=", "append", "(", "ags", ",", "ag", ".", "ID", ")", "\n", "}", "\n\n", "// SSH key pair", "if", "d", ".", "SSHKey", "==", "\"", "\"", "{", "var", "keyPairName", "string", "\n", "keyPairName", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "MachineName", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "client", ".", "RequestWithContext", "(", "context", ".", "TODO", "(", ")", ",", "&", "egoscale", ".", "CreateSSHKeyPair", "{", "Name", ":", "keyPairName", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "keyPair", ":=", "resp", ".", "(", "*", "egoscale", ".", "CreateSSHKeyPairResponse", ")", ".", "KeyPair", "\n", "if", "err", "=", "os", ".", "MkdirAll", "(", "filepath", ".", "Dir", "(", "d", ".", "GetSSHKeyPath", "(", ")", ")", ",", "0750", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", "=", "ioutil", ".", "WriteFile", "(", "d", ".", "GetSSHKeyPath", "(", ")", ",", "[", "]", "byte", "(", "keyPair", ".", "PrivateKey", ")", ",", "0600", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "d", ".", "KeyPair", "=", "keyPairName", "\n", "}", "else", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "d", ".", "SSHKey", ")", "\n\n", "sshKey", ":=", "d", ".", "SSHKey", "\n", "if", "strings", ".", "HasPrefix", "(", "sshKey", ",", "\"", "\"", ")", "{", "usr", ",", "_", ":=", "user", ".", "Current", "(", ")", "\n", "sshKey", "=", "filepath", ".", "Join", "(", "usr", ".", "HomeDir", ",", "sshKey", "[", "2", ":", "]", ")", "\n", "}", "else", "{", "var", "err", "error", "\n", "if", "sshKey", ",", "err", "=", "filepath", ".", "Abs", "(", "sshKey", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Sending the SSH public key through the cloud-init config", "pubKey", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "sshKey", "+", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "sshAuthorizedKeys", ":=", "`\nssh_authorized_keys:\n- `", "\n", "cloudInit", "=", "bytes", ".", "Join", "(", "[", "]", "[", "]", "byte", "{", "cloudInit", ",", "[", "]", "byte", "(", "sshAuthorizedKeys", ")", ",", "pubKey", "}", ",", "[", "]", "byte", "(", "\"", "\"", ")", ")", "\n\n", "// Copying the private key into docker-machine", "if", "err", ":=", "mcnutils", ".", "CopyFile", "(", "sshKey", ",", "d", ".", "GetSSHKeyPath", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "os", ".", "Chmod", "(", "d", ".", "GetSSHKeyPath", "(", ")", ",", "0600", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "string", "(", "cloudInit", ")", ")", "\n\n", "// Base64 encode the userdata", "d", ".", "UserData", "=", "cloudInit", "\n", "encodedUserData", ":=", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "d", ".", "UserData", ")", "\n\n", "req", ":=", "&", "egoscale", ".", "DeployVirtualMachine", "{", "TemplateID", ":", "template", ".", "ID", ",", "ServiceOfferingID", ":", "profile", ",", "UserData", ":", "encodedUserData", ",", "ZoneID", ":", "zone", ",", "Name", ":", "d", ".", "MachineName", ",", "KeyPair", ":", "d", ".", "KeyPair", ",", "DisplayName", ":", "d", ".", "MachineName", ",", "RootDiskSize", ":", "d", ".", "DiskSize", ",", "SecurityGroupIDs", ":", "sgs", ",", "AffinityGroupIDs", ":", "ags", ",", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "req", ")", "\n", "resp", ",", "err", "=", "client", ".", "RequestWithContext", "(", "context", ".", "TODO", "(", ")", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "vm", ":=", "resp", ".", "(", "*", "egoscale", ".", "DeployVirtualMachineResponse", ")", ".", "VirtualMachine", "\n\n", "IPAddress", ":=", "vm", ".", "Nic", "[", "0", "]", ".", "IPAddress", "\n", "if", "IPAddress", "!=", "nil", "{", "d", ".", "IPAddress", "=", "IPAddress", ".", "String", "(", ")", "\n", "}", "\n", "d", ".", "ID", "=", "vm", ".", "ID", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "d", ".", "IPAddress", ",", "d", ".", "GetSSHUsername", "(", ")", ")", "\n\n", "if", "vm", ".", "PasswordEnabled", "{", "d", ".", "Password", "=", "vm", ".", "Password", "\n", "}", "\n\n", "// Destroy the SSH key from CloudStack", "if", "d", ".", "KeyPair", "!=", "\"", "\"", "{", "if", "err", ":=", "drivers", ".", "WaitForSSH", "(", "d", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "key", ":=", "&", "egoscale", ".", "SSHKeyPair", "{", "Name", ":", "d", ".", "KeyPair", ",", "}", "\n", "if", "err", ":=", "client", ".", "DeleteWithContext", "(", "context", ".", "TODO", "(", ")", ",", "key", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d", ".", "KeyPair", "=", "\"", "\"", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
9,709
all-9710
[ "Run", "issues", "the", "provided", "command", "on", "the", "db", "database", "and", "unmarshals", "its", "result", "in", "the", "respective", "argument", ".", "The", "cmd", "argument", "may", "be", "either", "a", "string", "with", "the", "command", "name", "itself", "in", "which", "case", "an", "empty", "document", "of", "the", "form", "bson", ".", "M", "{", "cmd", ":", "1", "}", "will", "be", "used", "or", "it", "may", "be", "a", "full", "command", "document", ".", "Note", "that", "MongoDB", "considers", "the", "first", "marshalled", "key", "as", "the", "command", "name", "so", "when", "providing", "a", "command", "with", "options", "it", "s", "important", "to", "use", "an", "ordering", "-", "preserving", "document", "such", "as", "a", "struct", "value", "or", "an", "instance", "of", "bson", ".", "D", ".", "For", "instance", ":", "db", ".", "Run", "(", "bson", ".", "D", "{{", "create", "mycollection", "}", "{", "size", "1024", "}}", ")", "For", "privilleged", "commands", "typically", "run", "on", "the", "admin", "database", "see", "the", "Run", "method", "in", "the", "Session", "type", ".", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Commands", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "List", "+", "of", "+", "Database", "+", "CommandSkips" ]
[ "func", "(", "db", "*", "Database", ")", "Run", "(", "cmd", "interface", "{", "}", ",", "result", "<mask>", "{", "}", ")", "error", "{", "socket", ",", "err", ":=", "db", ".", "Session", ".", "acquireSocket", "(", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "socket", ".", "Release", "(", ")", "\n\n", "// This is an optimized form of db.C(\"$cmd\").Find(cmd).One(result).", "return", "db", ".", "run", "(", "socket", ",", "cmd", ",", "result", ")", "\n", "}" ]
9,710
all-9711
[ "NewReaderSize", "creates", "a", "new", "Reader", "instance", "with", "given", "size", "for", "bufio", ".", "Reader", "." ]
[ "func", "NewReaderSize", "(", "r", "<mask>", ".", "Reader", ",", "size", "int", ")", "*", "Reader", "{", "return", "&", "Reader", "{", "rd", ":", "bufio", ".", "NewReaderSize", "(", "r", ",", "size", ")", ",", "tr", ":", "unicode", ".", "Cesu8ToUtf8Transformer", ",", "}", "\n", "}" ]
9,711
all-9712
[ "AppendSection", "is", "a", "wrapper", "around", "g_menu_append_section", "()", "." ]
[ "func", "(", "v", "*", "Menu", ")", "AppendSection", "(", "label", "string", ",", "section", "*", "MenuModel", ")", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "label", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "C", ".", "g_menu_append_section", "(", "v", ".", "native", "(", ")", ",", "cstr1", ",", "section", ".", "native", "(", ")", ")", "\n", "}" ]
9,712
all-9713
[ "Build", "triggers", "a", "Jenkins", "build", "for", "the", "provided", "ProwJob", ".", "The", "name", "of", "the", "ProwJob", "is", "going", "to", "be", "used", "as", "the", "Prow", "Job", "ID", "parameter", "that", "will", "help", "us", "track", "the", "build", "before", "it", "s", "scheduled", "by", "Jenkins", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Build", "(", "pj", "*", "prowapi", ".", "ProwJob", ",", "buildID", "string", ")", "error", "{", "c", ".", "logger", ".", "WithFields", "(", "pjutil", ".", "ProwJobFields", "(", "pj", ")", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "c", ".", "BuildFromSpec", "(", "&", "pj", ".", "Spec", ",", "buildID", ",", "pj", ".", "ObjectMeta", ".", "Name", ")", "\n", "}" ]
9,713
all-9714
[ "CONTRACT", ":", "data", "smaller", "than", "dataMaxSize", "is", "read", "atomically", "." ]
[ "func", "(", "sc", "*", "SecretConnection", ")", "Read", "(", "data", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "0", "<", "len", "(", "sc", ".", "recvBuffer", ")", "{", "n_", ":=", "copy", "(", "data", ",", "sc", ".", "recvBuffer", ")", "\n", "sc", ".", "recvBuffer", "=", "sc", ".", "recvBuffer", "[", "n_", ":", "]", "\n", "return", "\n", "}", "\n\n", "sealedFrame", ":=", "make", "(", "[", "]", "byte", ",", "sealedFrameSize", ")", "\n", "_", ",", "err", "=", "io", ".", "ReadFull", "(", "sc", ".", "conn", ",", "sealedFrame", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// decrypt the frame", "var", "frame", "=", "make", "(", "[", "]", "byte", ",", "totalFrameSize", ")", "\n", "// fmt.Printf(\"secretbox.Open(sealed:%X,recvNonce:%X,shrSecret:%X\\n\", sealedFrame, sc.recvNonce, sc.shrSecret)", "_", ",", "ok", ":=", "secretbox", ".", "Open", "(", "frame", "[", ":", "0", "]", ",", "sealedFrame", ",", "sc", ".", "recvNonce", ",", "sc", ".", "shrSecret", ")", "\n", "if", "!", "ok", "{", "return", "n", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "incr2Nonce", "(", "sc", ".", "recvNonce", ")", "\n", "// end decryption", "var", "chunkLength", "=", "binary", ".", "BigEndian", ".", "Uint16", "(", "frame", ")", "// read the first two bytes", "\n", "if", "chunkLength", ">", "dataMaxSize", "{", "return", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "chunk", "=", "frame", "[", "dataLenSize", ":", "dataLenSize", "+", "chunkLength", "]", "\n\n", "n", "=", "copy", "(", "data", ",", "chunk", ")", "\n", "sc", ".", "recvBuffer", "=", "chunk", "[", "n", ":", "]", "\n", "return", "\n", "}" ]
9,714
all-9715
[ "GetDisabled", "returns", "the", "Disabled", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "u", "*", "<mask>", ")", "GetDisabled", "(", ")", "bool", "{", "if", "u", "==", "nil", "||", "u", ".", "Disabled", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "*", "u", ".", "Disabled", "\n", "}" ]
9,715
all-9716
[ "getSnapshots", "returns", "all", "the", "known", "snapshots", "." ]
[ "func", "(", "f", "*", "FileSnapshotStore", ")", "getSnapshots", "(", ")", "(", "[", "]", "*", "fileSnapshotMeta", ",", "error", ")", "{", "// Get the eligible snapshots", "snapshots", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "f", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Populate the metadata", "var", "snapMeta", "[", "]", "*", "fileSnapshotMeta", "\n", "for", "_", ",", "snap", ":=", "<mask>", "snapshots", "{", "// Ignore any files", "if", "!", "snap", ".", "IsDir", "(", ")", "{", "continue", "\n", "}", "\n\n", "// Ignore any temporary snapshots", "dirName", ":=", "snap", ".", "Name", "(", ")", "\n", "if", "strings", ".", "HasSuffix", "(", "dirName", ",", "tmpSuffix", ")", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "dirName", ")", "\n", "continue", "\n", "}", "\n\n", "// Try to read the meta data", "meta", ",", "err", ":=", "f", ".", "readMeta", "(", "dirName", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "dirName", ",", "err", ")", "\n", "continue", "\n", "}", "\n\n", "// Make sure we can understand this version.", "if", "meta", ".", "Version", "<", "SnapshotVersionMin", "||", "meta", ".", "Version", ">", "SnapshotVersionMax", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "dirName", ",", "meta", ".", "Version", ")", "\n", "continue", "\n", "}", "\n\n", "// Append, but only return up to the retain count", "snapMeta", "=", "append", "(", "snapMeta", ",", "meta", ")", "\n", "}", "\n\n", "// Sort the snapshot, reverse so we get new -> old", "sort", ".", "Sort", "(", "sort", ".", "Reverse", "(", "snapMetaSlice", "(", "snapMeta", ")", ")", ")", "\n\n", "return", "snapMeta", ",", "nil", "\n", "}" ]
9,716
all-9717
[ "Close", "closes", "the", "XMPP", "connection" ]
[ "func", "(", "c", "*", "Client", ")", "Close", "(", ")", "error", "{", "if", "c", ".", "conn", "!=", "(", "*", "tls", ".", "Conn", ")", "(", "nil", ")", "{", "return", "c", ".", "<mask>", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
9,717
all-9718
[ "Remove", "()", "is", "a", "wrapper", "around", "gtk_text_tag_table_remove", "()", "." ]
[ "func", "(", "v", "*", "TextTagTable", ")", "Remove", "(", "<mask>", "*", "TextTag", ")", "{", "C", ".", "gtk_text_tag_table_remove", "(", "v", ".", "native", "(", ")", ",", "tag", ".", "native", "(", ")", ")", "\n", "}" ]
9,718
all-9719
[ "Do", "executes", "DOM", ".", "setNodeName", "against", "the", "provided", "context", ".", "returns", ":", "nodeID", "-", "New", "node", "s", "id", "." ]
[ "func", "(", "p", "*", "SetNodeNameParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "nodeID", "cdp", ".", "NodeID", ",", "err", "error", ")", "{", "// execute", "var", "res", "SetNodeNameReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetNodeName", ",", "p", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "NodeID", ",", "nil", "\n", "}" ]
9,719
all-9720
[ "findHeapInfo", "finds", "the", "heapInfo", "structure", "for", "a", ".", "Returns", "nil", "if", "a", "is", "not", "a", "heap", "address", "." ]
[ "func", "(", "p", "*", "Process", ")", "findHeapInfo", "(", "a", "core", ".", "Address", ")", "*", "heapInfo", "{", "k", ":=", "a", "/", "heapInfoSize", "/", "pageTableSize", "\n", "i", ":=", "a", "/", "heapInfoSize", "%", "pageTableSize", "\n", "t", ":=", "p", ".", "pageTable", "[", "k", "]", "\n", "if", "t", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "h", ":=", "&", "t", "[", "i", "]", "\n", "if", "h", ".", "<mask>", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "h", "\n", "}" ]
9,720
all-9721
[ "waitVMPowerState", "polls", "the", "Virtual", "Machine", "instance", "view", "until", "it", "reaches", "the", "specified", "goal", "power", "state", "or", "times", "out", ".", "If", "checking", "for", "virtual", "machine", "state", "fails", "or", "waiting", "times", "out", "an", "error", "is", "returned", "." ]
[ "func", "(", "a", "AzureClient", ")", "waitVMPowerState", "(", "resourceGroup", ",", "name", "string", ",", "goalState", "VMPowerState", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "// NOTE(ahmetalpbalkan): Azure APIs for Start and Stop are actually async", "// operations on which our SDK blocks and does polling until the operation", "// is complete.", "//", "// By the time the issued power cycle operation is complete, the VM will be", "// already in the goal PowerState. Hence, this method will return in the", "// first check, however there is no harm in being defensive.", "log", ".", "Debug", "(", "\"", "\"", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "name", ",", "\"", "\"", ":", "goalState", ",", "\"", "\"", ":", "timeout", ",", "}", ")", "\n\n", "chErr", ":=", "make", "(", "chan", "error", ")", "\n", "go", "func", "(", "ch", "chan", "error", ")", "{", "for", "{", "select", "{", "case", "<-", "ch", ":", "// channel closed", "return", "\n", "default", ":", "state", ",", "err", ":=", "a", ".", "GetVirtualMachinePowerState", "(", "resourceGroup", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "ch", "<-", "err", "\n", "return", "\n", "}", "\n", "if", "state", "!=", "goalState", "{", "log", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "powerStatePollingInterval", ")", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "goalState", ",", "\"", "\"", ":", "state", ",", "}", ")", "\n", "time", ".", "Sleep", "(", "powerStatePollingInterval", ")", "\n", "}", "else", "{", "<mask>", ".", "Debug", "(", "\"", "\"", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "state", "}", ")", "\n", "ch", "<-", "nil", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "(", "chErr", ")", "\n\n", "select", "{", "case", "<-", "time", ".", "After", "(", "timeout", ")", ":", "close", "(", "chErr", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "goalState", ",", "timeout", ")", "\n", "case", "err", ":=", "<-", "chErr", ":", "return", "err", "\n", "}", "\n", "}" ]
9,721
all-9722
[ "SelectItem", "selects", "item", "which", "number", "in", "the", "list", "equals", "id", ".", "If", "the", "item", "exists", "the", "ListBox", "scrolls", "the", "list", "to", "make", "the", "item", "visible", ".", "Returns", "true", "if", "the", "item", "is", "selected", "successfully" ]
[ "func", "(", "l", "*", "ListBox", ")", "SelectItem", "(", "id", "int", ")", "bool", "{", "if", "len", "(", "l", ".", "items", ")", "<=", "id", "||", "id", "<", "0", "{", "return", "<mask>", "\n", "}", "\n\n", "l", ".", "currSelection", "=", "id", "\n", "l", ".", "EnsureVisible", "(", ")", "\n", "return", "true", "\n", "}" ]
9,722
all-9723
[ "same", "with", "Warn", "()" ]
[ "func", "(", "f", "*", "FileLogger", ")", "W", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "f", ".", "Warn", "(", "<mask>", ",", "v", "...", ")", "\n", "}" ]
9,723
all-9724
[ "NewNoopRegistry", "returns", "new", "NoopRegistry", "object" ]
[ "func", "NewNoopRegistry", "(", "provider", "provider", ".", "<mask>", ")", "(", "*", "NoopRegistry", ",", "error", ")", "{", "return", "&", "NoopRegistry", "{", "provider", ":", "provider", ",", "}", ",", "nil", "\n", "}" ]
9,724
all-9725
[ "waitSync", "waits", "until", "the", "minimum", "status", "update", "period", "has", "elapsed", "then", "syncs", "returning", "the", "sync", "start", "time", ".", "If", "newPoolPending", "is", "closed", "while", "waiting", "(", "indicating", "a", "shutdown", "request", ")", "this", "function", "returns", "immediately", "without", "syncing", "." ]
[ "func", "(", "sc", "*", "statusController", ")", "waitSync", "(", ")", "{", "// wait for the min sync period time to elapse if needed.", "wait", ":=", "<mask>", ".", "After", "(", "time", ".", "Until", "(", "sc", ".", "lastSyncStart", ".", "Add", "(", "sc", ".", "config", "(", ")", ".", "Tide", ".", "StatusUpdatePeriod", ")", ")", ")", "\n", "for", "{", "select", "{", "case", "<-", "wait", ":", "sc", ".", "Lock", "(", ")", "\n", "pool", ":=", "sc", ".", "poolPRs", "\n", "sc", ".", "Unlock", "(", ")", "\n", "sc", ".", "sync", "(", "pool", ")", "\n", "return", "\n", "case", "more", ":=", "<-", "sc", ".", "newPoolPending", ":", "if", "!", "more", "{", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
9,725
all-9726
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ScopeType", ")", "UnmarshalEasyJSON", "(", "<mask>", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "ScopeType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "ScopeTypeGlobal", ":", "*", "t", "=", "ScopeTypeGlobal", "\n", "case", "ScopeTypeLocal", ":", "*", "t", "=", "ScopeTypeLocal", "\n", "case", "ScopeTypeWith", ":", "*", "t", "=", "ScopeTypeWith", "\n", "case", "ScopeTypeClosure", ":", "*", "t", "=", "ScopeTypeClosure", "\n", "case", "ScopeTypeCatch", ":", "*", "t", "=", "ScopeTypeCatch", "\n", "case", "ScopeTypeBlock", ":", "*", "t", "=", "ScopeTypeBlock", "\n", "case", "ScopeTypeScript", ":", "*", "t", "=", "ScopeTypeScript", "\n", "case", "ScopeTypeEval", ":", "*", "t", "=", "ScopeTypeEval", "\n", "case", "ScopeTypeModule", ":", "*", "t", "=", "ScopeTypeModule", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
9,726
all-9727
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventDetached", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoInspector2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
9,727
all-9728
[ "SortMaps", "returns", "a", "Transformer", "option", "that", "flattens", "map", "[", "K", "]", "V", "types", "to", "be", "a", "sorted", "[]", "struct", "{", "K", "V", "}", ".", "The", "less", "function", "must", "be", "of", "the", "form", "func", "(", "T", "T", ")", "bool", "which", "is", "used", "to", "sort", "any", "map", "with", "key", "K", "that", "is", "assignable", "to", "T", ".", "Flattening", "the", "map", "into", "a", "slice", "has", "the", "property", "that", "cmp", ".", "Equal", "is", "able", "to", "use", "Comparers", "on", "K", "or", "the", "K", ".", "Equal", "method", "if", "it", "exists", ".", "The", "less", "function", "must", "be", ":", "•", "Deterministic", ":", "less", "(", "x", "y", ")", "==", "less", "(", "x", "y", ")", "•", "Irreflexive", ":", "!less", "(", "x", "x", ")", "•", "Transitive", ":", "if", "!less", "(", "x", "y", ")", "and", "!less", "(", "y", "z", ")", "then", "!less", "(", "x", "z", ")", "•", "Total", ":", "if", "x", "!", "=", "y", "then", "either", "less", "(", "x", "y", ")", "or", "less", "(", "y", "x", ")", "SortMaps", "can", "be", "used", "in", "conjunction", "with", "EquateEmpty", "." ]
[ "func", "SortMaps", "(", "lessFunc", "interface", "{", "}", ")", "cmp", ".", "Option", "{", "vf", ":=", "reflect", ".", "ValueOf", "(", "lessFunc", ")", "\n", "if", "!", "function", ".", "IsType", "(", "vf", ".", "Type", "(", ")", ",", "function", ".", "Less", ")", "||", "vf", ".", "IsNil", "(", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "lessFunc", ")", ")", "\n", "}", "\n", "ms", ":=", "mapSorter", "{", "vf", ".", "<mask>", "(", ")", ".", "In", "(", "0", ")", ",", "vf", "}", "\n", "return", "cmp", ".", "FilterValues", "(", "ms", ".", "filter", ",", "cmp", ".", "Transformer", "(", "\"", "\"", ",", "ms", ".", "sort", ")", ")", "\n", "}" ]
9,728
all-9729
[ "Destroy", "delete", "redis", "session", "by", "id" ]
[ "func", "(", "rp", "*", "redisProvider", ")", "Destroy", "(", "sid", "string", ")", "error", "{", "<mask>", "err", "error", "\n", "redisPool", ".", "Exec", "(", "func", "(", "c", "*", "redis", ".", "Client", ")", "{", "err", "=", "c", ".", "Del", "(", "sid", ")", ".", "Err", "(", ")", "\n", "}", ")", "\n", "return", "err", "\n", "}" ]
9,729
all-9730
[ "NewDefaultLogger", "return", "a", "logger", "split", "by", "fileSize", "by", "default" ]
[ "func", "NewDefaultLogger", "(", "fileDir", ",", "fileName", "<mask>", ")", "*", "FileLogger", "{", "return", "NewSizeLogger", "(", "fileDir", ",", "fileName", ",", "\"", "\"", ",", "DEFAULT_FILE_COUNT", ",", "DEFAULT_FILE_SIZE", ",", "DEFAULT_FILE_UNIT", ",", "DEFAULT_LOG_SCAN", ",", "DEFAULT_LOG_SEQ", ")", "\n", "}" ]
9,730
all-9731
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetPausedInDebuggerMessageParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
9,731
all-9732
[ "Create", "a", "new", "backup" ]
[ "func", "backupCreate", "(", "s", "*", "<mask>", ".", "State", ",", "args", "db", ".", "ContainerBackupArgs", ",", "sourceContainer", "container", ")", "error", "{", "// Create the database entry", "err", ":=", "s", ".", "Cluster", ".", "ContainerBackupCreate", "(", "args", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "db", ".", "ErrAlreadyDefined", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "args", ".", "Name", ")", "\n", "}", "\n\n", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Get the backup struct", "b", ",", "err", ":=", "backupLoadByName", "(", "s", ",", "sourceContainer", ".", "Project", "(", ")", ",", "args", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Now create the empty snapshot", "err", "=", "sourceContainer", ".", "Storage", "(", ")", ".", "ContainerBackupCreate", "(", "*", "b", ",", "sourceContainer", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "Cluster", ".", "ContainerBackupRemove", "(", "args", ".", "Name", ")", "\n", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
9,732
all-9733
[ "CloneVM", "clones", "a", "virtual", "machine", "to", "a", "datastore", "cluster", "via", "the", "StorageResourceManager", "API", ".", "It", "mimics", "our", "helper", "in", "the", "virtualmachine", "package", "in", "functionality", "returning", "a", "VM", "helper", "object", "on", "success", "." ]
[ "func", "CloneVM", "(", "client", "*", "govmomi", ".", "Client", ",", "src", "*", "object", ".", "VirtualMachine", ",", "fo", "*", "object", ".", "Folder", ",", "name", "string", ",", "spec", "types", ".", "VirtualMachineCloneSpec", ",", "timeout", "int", ",", "pod", "*", "object", ".", "StoragePod", ",", ")", "(", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "sdrsEnabled", ",", "err", ":=", "StorageDRSEnabled", "(", "pod", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "sdrsEnabled", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pod", ".", "Name", "(", ")", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "src", ".", "InventoryPath", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fo", ".", "InventoryPath", ",", "name", ")", ",", "pod", ".", "Name", "(", ")", ",", ")", "\n\n", "sps", ":=", "types", ".", "StoragePlacementSpec", "{", "Folder", ":", "types", ".", "NewReference", "(", "fo", ".", "Reference", "(", ")", ")", ",", "Vm", ":", "types", ".", "NewReference", "(", "src", ".", "Reference", "(", ")", ")", ",", "CloneName", ":", "name", ",", "CloneSpec", ":", "&", "spec", ",", "PodSelectionSpec", ":", "types", ".", "StorageDrsPodSelectionSpec", "{", "StoragePod", ":", "types", ".", "NewReference", "(", "pod", ".", "Reference", "(", ")", ")", ",", "}", ",", "<mask>", ":", "string", "(", "types", ".", "StoragePlacementSpecPlacementTypeClone", ")", ",", "}", "\n\n", "return", "recommendAndApplySDRS", "(", "client", ",", "sps", ",", "time", ".", "Minute", "*", "time", ".", "Duration", "(", "timeout", ")", ")", "\n", "}" ]
9,733
all-9734
[ "LazyPrintf", "evaluates", "its", "arguments", "with", "fmt", ".", "Sprintf", "each", "time", "the", "/", "debug", "/", "requests", "page", "is", "rendered", ".", "Any", "memory", "referenced", "by", "a", "will", "be", "pinned", "until", "the", "trace", "is", "finished", "and", "later", "discarded", "." ]
[ "func", "(", "t", "*", "trace", ")", "LazyPrintf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "newfmt", ",", "newvals", ":=", "addTrace", "(", "t", ",", "<mask>", ",", "a", "...", ")", "\n", "Log", ".", "Printf", "(", "newfmt", ",", "newvals", "...", ")", "\n", "t", ".", "trace", ".", "LazyPrintf", "(", "format", ",", "a", "...", ")", "\n", "}" ]
9,734
all-9735
[ "Returns", "information", "about", "an", "active", "attribute", "variable", "for", "the", "specified", "program", "object" ]
[ "func", "GetActiveAttrib", "(", "program", "uint32", ",", "index", "uint32", ",", "bufSize", "int32", ",", "<mask>", "*", "int32", ",", "size", "*", "int32", ",", "xtype", "*", "uint32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowGetActiveAttrib", "(", "gpGetActiveAttrib", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "size", ")", ")", ",", "(", "*", "C", ".", "GLenum", ")", "(", "unsafe", ".", "Pointer", "(", "xtype", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "}" ]
9,735
all-9736
[ "ContainerByID", "returns", "an", "apicontainer", ".", "DockerContainer", "for", "a", "given", "container", "ID" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "ContainerByID", "(", "id", "string", ")", "(", "*", "apicontainer", ".", "DockerContainer", ",", "bool", ")", "{", "state", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "c", ",", "ok", ":=", "<mask>", ".", "idToContainer", "[", "id", "]", "\n", "return", "c", ",", "ok", "\n", "}" ]
9,736
all-9737
[ "Private", "stuff", ".", "nameArguments", "is", "a", "post", "-", "processing", "step", "where", "Args", "are", "named", "with", "numbers", "." ]
[ "func", "nameArguments", "(", "goroutines", "[", "]", "*", "Goroutine", ")", "{", "// Set a name for any pointer occurring more than once.", "type", "object", "struct", "{", "args", "[", "]", "*", "Arg", "\n", "inPrimary", "bool", "\n", "id", "int", "\n", "}", "\n", "objects", ":=", "map", "[", "uint64", "]", "object", "{", "}", "\n", "// Enumerate all the arguments.", "for", "i", ":=", "range", "goroutines", "{", "for", "j", ":=", "range", "goroutines", "[", "i", "]", ".", "Stack", ".", "Calls", "{", "for", "k", ":=", "range", "goroutines", "[", "i", "]", ".", "Stack", ".", "Calls", "[", "j", "]", ".", "Args", ".", "Values", "{", "arg", ":=", "goroutines", "[", "i", "]", ".", "Stack", ".", "Calls", "[", "j", "]", ".", "Args", ".", "Values", "[", "k", "]", "\n", "if", "arg", ".", "IsPtr", "(", ")", "{", "objects", "[", "arg", ".", "Value", "]", "=", "object", "{", "args", ":", "append", "(", "objects", "[", "arg", ".", "Value", "]", ".", "args", ",", "&", "goroutines", "[", "i", "]", ".", "Stack", ".", "Calls", "[", "j", "]", ".", "Args", ".", "Values", "[", "k", "]", ")", ",", "inPrimary", ":", "objects", "[", "arg", ".", "Value", "]", ".", "inPrimary", "||", "i", "==", "0", ",", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "// CreatedBy.Args is never set.", "}", "\n", "order", ":=", "make", "(", "uint64Slice", ",", "0", ",", "len", "(", "objects", ")", "/", "2", ")", "\n", "for", "k", ",", "obj", ":=", "range", "objects", "{", "if", "len", "(", "obj", ".", "args", ")", ">", "1", "&&", "obj", ".", "inPrimary", "{", "order", "=", "append", "(", "order", ",", "k", ")", "\n", "}", "\n", "}", "\n", "sort", ".", "Sort", "(", "order", ")", "\n", "nextID", ":=", "1", "\n", "for", "_", ",", "k", ":=", "range", "order", "{", "for", "_", ",", "arg", ":=", "range", "objects", "[", "k", "]", ".", "args", "{", "arg", ".", "Name", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "nextID", ")", "\n", "}", "\n", "nextID", "++", "\n", "}", "\n\n", "// Now do the rest. This is done so the output is deterministic.", "order", "=", "make", "(", "uint64Slice", ",", "0", ",", "len", "(", "objects", ")", ")", "\n", "for", "k", ":=", "range", "objects", "{", "order", "=", "append", "(", "order", ",", "k", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "order", ")", "\n", "for", "_", ",", "k", ":=", "range", "order", "{", "// Process the remaining pointers, they were not referenced by primary", "// thread so will have higher IDs.", "if", "objects", "[", "k", "]", ".", "inPrimary", "{", "continue", "\n", "}", "\n", "for", "_", ",", "arg", ":=", "<mask>", "objects", "[", "k", "]", ".", "args", "{", "arg", ".", "Name", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "nextID", ")", "\n", "}", "\n", "nextID", "++", "\n", "}", "\n", "}" ]
9,737
all-9738
[ "putNode", "allocates", "a", "node", "in", "the", "arena", ".", "The", "node", "is", "aligned", "on", "a", "pointer", "-", "sized", "boundary", ".", "The", "arena", "offset", "of", "the", "node", "is", "returned", "." ]
[ "func", "(", "s", "*", "Arena", ")", "putNode", "(", "height", "int", ")", "uint32", "{", "// Compute the amount of the tower that will never be used, since the height", "// is less than maxHeight.", "unusedSize", ":=", "(", "maxHeight", "-", "<mask>", ")", "*", "offsetSize", "\n\n", "// Pad the allocation with enough bytes to ensure pointer alignment.", "l", ":=", "uint32", "(", "MaxNodeSize", "-", "unusedSize", "+", "nodeAlign", ")", "\n", "n", ":=", "atomic", ".", "AddUint32", "(", "&", "s", ".", "n", ",", "l", ")", "\n", "y", ".", "AssertTruef", "(", "int", "(", "n", ")", "<=", "len", "(", "s", ".", "buf", ")", ",", "\"", "\"", ",", "l", ",", "n", ",", "len", "(", "s", ".", "buf", ")", ")", "\n\n", "// Return the aligned offset.", "m", ":=", "(", "n", "-", "l", "+", "uint32", "(", "nodeAlign", ")", ")", "&", "^", "uint32", "(", "nodeAlign", ")", "\n", "return", "m", "\n", "}" ]
9,738
all-9739
[ "AddResultf", "functions", "as", "AddResult", "but", "takes", "a", "printf", "-", "style", "format", "string", "and", "arguments", "." ]
[ "func", "(", "c", "*", "Check", ")", "AddResultf", "(", "status", "Status", ",", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "v", "...", ")", "\n", "c", ".", "AddResult", "(", "<mask>", ",", "msg", ")", "\n", "}" ]
9,739
all-9740
[ "New", "creates", "a", "new", "Clientset", "for", "the", "given", "RESTClient", "." ]
[ "func", "New", "(", "c", "rest", ".", "Interface", ")", "*", "Clientset", "{", "<mask>", "cs", "Clientset", "\n", "cs", ".", "prowV1", "=", "prowv1", ".", "New", "(", "c", ")", "\n\n", "cs", ".", "DiscoveryClient", "=", "discovery", ".", "NewDiscoveryClient", "(", "c", ")", "\n", "return", "&", "cs", "\n", "}" ]
9,740
all-9741
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "Refs", "." ]
[ "func", "(", "in", "*", "Refs", ")", "DeepCopy", "(", ")", "*", "Refs", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "Refs", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "<mask>", "\n", "}" ]
9,741
all-9742
[ "WriteTo", "writes", "data", "to", "w", "." ]
[ "func", "(", "e", "*", "plainTextInner", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "s", ":=", "\"", "\"", "\n\n", "if", "(", "e", ".", "<mask>", ".", "Base", "(", ")", ".", "ln", ".", "indent", "+", "1", ")", "*", "2", "<=", "len", "(", "e", ".", "ln", ".", "str", ")", "{", "s", "=", "e", ".", "ln", ".", "str", "[", "(", "e", ".", "parent", ".", "Base", "(", ")", ".", "ln", ".", "indent", "+", "1", ")", "*", "2", ":", "]", "\n", "}", "\n\n", "if", "e", ".", "insertBr", "&&", "!", "e", ".", "lastChild", "{", "s", "+=", "htmlBr", "\n", "}", "\n\n", "i", ",", "err", ":=", "w", ".", "Write", "(", "[", "]", "byte", "(", "s", "+", "lf", ")", ")", "\n\n", "return", "int64", "(", "i", ")", ",", "err", "\n", "}" ]
9,742
all-9743
[ "render", "multiple", "sets", "of", "primitives", "from", "array", "data" ]
[ "func", "MultiDrawArrays", "(", "mode", "uint32", ",", "first", "*", "int32", ",", "<mask>", "*", "int32", ",", "drawcount", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpMultiDrawArrays", ",", "4", ",", "uintptr", "(", "mode", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "first", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "count", ")", ")", ",", "uintptr", "(", "drawcount", ")", ",", "0", ",", "0", ")", "\n", "}" ]
9,743
all-9744
[ "Records", "makes", "on", "average", "C", "+", "2", "*", "Z", "requests", "(", "Z", "=", "number", "of", "zones", ")", ":", "1", "login", "+", "1", "fetchAllRecords", "A", "cache", "is", "used", "to", "avoid", "querying", "for", "every", "single", "record", "found", ".", "C", "is", "proportional", "to", "the", "number", "of", "expired", "/", "changed", "records" ]
[ "func", "(", "d", "*", "dynProviderState", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "client", ",", "err", ":=", "d", ".", "login", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "client", ".", "Logout", "(", ")", "\n\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "d", ".", "DynVersion", ")", "\n\n", "var", "result", "[", "]", "*", "endpoint", ".", "Endpoint", "\n\n", "zones", ":=", "d", ".", "zones", "(", "client", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "zones", ")", "\n", "for", "_", ",", "zone", ":=", "range", "zones", "{", "serial", ",", "err", ":=", "d", ".", "fetchZoneSerial", "(", "client", ",", "zone", ")", "\n", "if", "err", "!=", "nil", "{", "if", "strings", ".", "Index", "(", "err", ".", "Error", "(", ")", ",", "\"", "\"", ")", ">=", "0", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "zone", ")", "\n", "continue", "\n", "}", "\n\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "relevantRecords", ":=", "d", ".", "ZoneSnapshot", ".", "GetRecordsForSerial", "(", "zone", ",", "serial", ")", "\n", "if", "relevantRecords", "!=", "nil", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "relevantRecords", ")", ",", "zone", ",", "serial", ")", "\n", "result", "=", "append", "(", "result", ",", "relevantRecords", "...", ")", "\n", "<mask>", "\n", "}", "\n\n", "//Fetch All Records", "records", ",", "err", ":=", "d", ".", "fetchAllRecordsInZone", "(", "zone", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "relevantRecords", "=", "d", ".", "allRecordsToEndpoints", "(", "records", ")", "\n\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "relevantRecords", ")", "\n\n", "d", ".", "ZoneSnapshot", ".", "StoreRecordsForSerial", "(", "zone", ",", "serial", ",", "relevantRecords", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "relevantRecords", ")", ",", "zone", ",", "serial", ")", "\n", "result", "=", "append", "(", "result", ",", "relevantRecords", "...", ")", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
9,744
all-9745
[ "NewClientHandler", "generates", "a", "muxed", "http", ".", "Handler", "with", "the", "given", "parameters", "to", "serve", "etcd", "client", "requests", "." ]
[ "func", "NewClientHandler", "(", "lg", "*", "zap", ".", "Logger", ",", "server", "etcdserver", ".", "ServerPeer", ",", "timeout", "<mask>", ".", "Duration", ")", "http", ".", "Handler", "{", "mux", ":=", "http", ".", "NewServeMux", "(", ")", "\n", "etcdhttp", ".", "HandleBasic", "(", "mux", ",", "server", ")", "\n", "handleV2", "(", "lg", ",", "mux", ",", "server", ",", "timeout", ")", "\n", "return", "requestLogger", "(", "lg", ",", "mux", ")", "\n", "}" ]
9,745
all-9746
[ "parseFuncName", "returns", "the", "package", "path", "and", "function", "signature", "for", "a", "give", "Func", "name", "." ]
[ "func", "parseFuncName", "(", "fnName", "string", ")", "(", "packagePath", ",", "signature", "string", ")", "{", "regEx", ":=", "regexp", ".", "MustCompile", "(", "\"", "\\\\", "\\\\", "\"", ")", "\n", "<mask>", ":=", "regEx", ".", "FindStringSubmatch", "(", "fnName", ")", "\n", "packagePath", "=", "parts", "[", "1", "]", "\n", "signature", "=", "parts", "[", "2", "]", "\n", "return", "\n", "}" ]
9,746
all-9747
[ "Contains", "check", "if", "value", "exists", "in", "the", "set", "." ]
[ "func", "(", "s", "*", "Set", ")", "Contains", "(", "value", "<mask>", "{", "}", ")", "bool", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "_", ",", "ok", ":=", "s", ".", "m", "[", "value", "]", "\n", "return", "ok", "\n", "}" ]
9,747
all-9748
[ "/", "*", "Set", "a", "transaction", "attribute", ".", "Up", "to", "the", "first", "50", "attributes", "added", "are", "sent", "with", "each", "transaction", "." ]
[ "func", "TransactionAddAttribute", "(", "id", "int64", ",", "name", ",", "value", "string", ")", "(", "int", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "cvalue", ":=", "C", ".", "CString", "(", "value", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cvalue", ")", ")", "\n\n", "return", "errNo", "(", "C", ".", "newrelic_transaction_add_attribute", "(", "C", ".", "long", "(", "id", ")", ",", "cname", ",", "cvalue", ")", ")", "\n", "}" ]
9,748
all-9749
[ "Read", "is", "implementation", "of", "io", ".", "Reader", "s", "Read", "." ]
[ "func", "(", "s", "*", "Stream", ")", "Read", "(", "p", "[", "]", "<mask>", ")", "(", "int", ",", "error", ")", "{", "return", "s", ".", "inner", ".", "Read", "(", "p", ")", "\n", "}" ]
9,749
all-9750
[ "NewFromMap", "creates", "a", "new", "schema", "Schema", "with", "the", "updates", "specified", "in", "the", "given", "map", ".", "The", "keys", "of", "the", "map", "are", "schema", "versions", "that", "when", "upgraded", "will", "trigger", "the", "associated", "Update", "value", ".", "It", "s", "required", "that", "the", "minimum", "key", "in", "the", "map", "is", "1", "and", "if", "key", "N", "is", "present", "then", "N", "-", "1", "is", "present", "too", "with", "N", ">", "1", "(", "i", ".", "e", ".", "there", "are", "no", "missing", "versions", ")", ".", "NOTE", ":", "the", "regular", "New", "()", "constructor", "would", "be", "formally", "enough", "but", "for", "extra", "clarity", "we", "also", "support", "a", "map", "that", "indicates", "the", "version", "explicitly", "see", "also", "PR", "#3704", "." ]
[ "func", "NewFromMap", "(", "versionsToUpdates", "<mask>", "[", "int", "]", "Update", ")", "*", "Schema", "{", "// Collect all version keys.", "versions", ":=", "[", "]", "int", "{", "}", "\n", "for", "version", ":=", "range", "versionsToUpdates", "{", "versions", "=", "append", "(", "versions", ",", "version", ")", "\n", "}", "\n\n", "// Sort the versions,", "sort", ".", "Sort", "(", "sort", ".", "IntSlice", "(", "versions", ")", ")", "\n\n", "// Build the updates slice.", "updates", ":=", "[", "]", "Update", "{", "}", "\n", "for", "i", ",", "version", ":=", "range", "versions", "{", "// Assert that we start from 1 and there are no gaps.", "if", "version", "!=", "i", "+", "1", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", "+", "1", ")", ")", "\n", "}", "\n\n", "updates", "=", "append", "(", "updates", ",", "versionsToUpdates", "[", "version", "]", ")", "\n", "}", "\n\n", "return", "&", "Schema", "{", "updates", ":", "updates", ",", "}", "\n", "}" ]
9,750
all-9751
[ "Network", "device", "handling" ]
[ "func", "(", "c", "*", "containerLXC", ")", "createNetworkDevice", "(", "name", "string", ",", "m", "types", ".", "<mask>", ")", "(", "string", ",", "error", ")", "{", "var", "dev", ",", "n1", "string", "\n\n", "if", "shared", ".", "StringInSlice", "(", "m", "[", "\"", "\"", "]", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", "{", "// Host Virtual NIC name", "if", "m", "[", "\"", "\"", "]", "!=", "\"", "\"", "{", "n1", "=", "m", "[", "\"", "\"", "]", "\n", "}", "else", "{", "n1", "=", "deviceNextVeth", "(", ")", "\n", "}", "\n", "}", "\n\n", "if", "m", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "dev", "=", "m", "[", "\"", "\"", "]", "\n", "}", "\n\n", "// Handle bridged and p2p", "if", "shared", ".", "StringInSlice", "(", "m", "[", "\"", "\"", "]", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ")", "{", "n2", ":=", "deviceNextVeth", "(", ")", "\n\n", "_", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "n1", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "n2", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "n1", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n1", ",", "err", ")", "\n", "}", "\n\n", "if", "m", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "err", "=", "networkAttachInterface", "(", "m", "[", "\"", "\"", "]", ",", "n1", ")", "\n", "if", "err", "!=", "nil", "{", "deviceRemoveInterface", "(", "n2", ")", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Attempt to disable router advertisement acceptance", "networkSysctlSet", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n1", ")", ",", "\"", "\"", ")", "\n", "}", "\n\n", "dev", "=", "n2", "\n", "}", "\n\n", "// Handle physical and macvlan", "if", "shared", ".", "StringInSlice", "(", "m", "[", "\"", "\"", "]", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ")", "{", "// Deal with VLAN", "device", ":=", "m", "[", "\"", "\"", "]", "\n", "if", "m", "[", "\"", "\"", "]", "!=", "\"", "\"", "{", "device", "=", "networkGetHostDevice", "(", "m", "[", "\"", "\"", "]", ",", "m", "[", "\"", "\"", "]", ")", "\n", "if", "!", "shared", ".", "PathExists", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "device", ")", ")", "{", "_", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "m", "[", "\"", "\"", "]", ",", "\"", "\"", ",", "device", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "m", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// Attempt to disable IPv6 router advertisement acceptance", "networkSysctlSet", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "device", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Handle physical", "if", "m", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "dev", "=", "device", "\n", "}", "\n\n", "// Handle macvlan", "if", "m", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "_", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "n1", ",", "\"", "\"", ",", "device", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "dev", "=", "n1", "\n", "}", "\n", "}", "\n\n", "// Set the MAC address", "if", "m", "[", "\"", "\"", "]", "!=", "\"", "\"", "{", "_", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "dev", ",", "\"", "\"", ",", "m", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "deviceRemoveInterface", "(", "dev", ")", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Bring the interface up", "_", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "dev", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "deviceRemoveInterface", "(", "dev", ")", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Set the filter", "if", "m", "[", "\"", "\"", "]", "==", "\"", "\"", "&&", "shared", ".", "IsTrue", "(", "m", "[", "\"", "\"", "]", ")", "{", "err", "=", "c", ".", "createNetworkFilter", "(", "dev", ",", "m", "[", "\"", "\"", "]", ",", "m", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "dev", ",", "nil", "\n", "}" ]
9,751
all-9752
[ "NewFileQuery", "creates", "a", "file", "dependency", "from", "the", "given", "path", "." ]
[ "func", "NewFileQuery", "(", "s", "string", ")", "(", "*", "FileQuery", ",", "error", ")", "{", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n\n", "return", "&", "FileQuery", "{", "stopCh", ":", "<mask>", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "path", ":", "s", ",", "}", ",", "nil", "\n", "}" ]
9,752
all-9753
[ "FillStyle", "demonstrates", "the", "difference", "between", "even", "odd", "and", "non", "zero", "winding", "rule", "." ]
[ "func", "FillStyle", "(", "gc", "draw2d", ".", "GraphicContext", ",", "x", ",", "y", ",", "width", ",", "height", "float64", ")", "{", "sx", ",", "sy", ":=", "width", "/", "232", ",", "height", "/", "220", "\n", "gc", ".", "SetLineWidth", "(", "width", "/", "40", ")", "\n\n", "draw2dkit", ".", "Rectangle", "(", "gc", ",", "x", "+", "sx", "*", "0", ",", "y", "+", "sy", "*", "12", ",", "x", "+", "sx", "*", "232", ",", "y", "+", "sy", "*", "70", ")", "\n\n", "<mask>", "wheel1", ",", "wheel2", "draw2d", ".", "Path", "\n", "wheel1", ".", "ArcTo", "(", "x", "+", "sx", "*", "52", ",", "y", "+", "sy", "*", "70", ",", "sx", "*", "40", ",", "sy", "*", "40", ",", "0", ",", "2", "*", "math", ".", "Pi", ")", "\n", "wheel2", ".", "ArcTo", "(", "x", "+", "sx", "*", "180", ",", "y", "+", "sy", "*", "70", ",", "sx", "*", "40", ",", "sy", "*", "40", ",", "0", ",", "-", "2", "*", "math", ".", "Pi", ")", "\n\n", "gc", ".", "SetFillRule", "(", "draw2d", ".", "FillRuleEvenOdd", ")", "\n", "gc", ".", "SetFillColor", "(", "color", ".", "NRGBA", "{", "0", ",", "0xB2", ",", "0", ",", "0xFF", "}", ")", "\n\n", "gc", ".", "SetStrokeColor", "(", "image", ".", "Black", ")", "\n", "gc", ".", "FillStroke", "(", "&", "wheel1", ",", "&", "wheel2", ")", "\n\n", "draw2dkit", ".", "Rectangle", "(", "gc", ",", "x", ",", "y", "+", "sy", "*", "140", ",", "x", "+", "sx", "*", "232", ",", "y", "+", "sy", "*", "198", ")", "\n", "wheel1", ".", "Clear", "(", ")", "\n", "wheel1", ".", "ArcTo", "(", "x", "+", "sx", "*", "52", ",", "y", "+", "sy", "*", "198", ",", "sx", "*", "40", ",", "sy", "*", "40", ",", "0", ",", "2", "*", "math", ".", "Pi", ")", "\n", "wheel2", ".", "Clear", "(", ")", "\n", "wheel2", ".", "ArcTo", "(", "x", "+", "sx", "*", "180", ",", "y", "+", "sy", "*", "198", ",", "sx", "*", "40", ",", "sy", "*", "40", ",", "0", ",", "-", "2", "*", "math", ".", "Pi", ")", "\n\n", "gc", ".", "SetFillRule", "(", "draw2d", ".", "FillRuleWinding", ")", "\n", "gc", ".", "SetFillColor", "(", "color", ".", "NRGBA", "{", "0", ",", "0", ",", "0xE5", ",", "0xFF", "}", ")", "\n", "gc", ".", "FillStroke", "(", "&", "wheel1", ",", "&", "wheel2", ")", "\n", "}" ]
9,753
all-9754
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Histogram", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
9,754
all-9755
[ "Health", "implements", "the", "Health", "method", "for", "healthServer", "." ]
[ "func", "(", "h", "*", "healthServer", ")", "Health", "(", "context", ".", "Context", ",", "*", "<mask>", ".", "Empty", ")", "(", "*", "types", ".", "Empty", ",", "error", ")", "{", "if", "!", "h", ".", "ready", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "types", ".", "Empty", "{", "}", ",", "nil", "\n", "}" ]
9,755
all-9756
[ "GetHideValue", "returns", "the", "HideValue", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetConditionalFormat", ")", "GetHideValue", "(", ")", "bool", "{", "if", "w", "==", "nil", "||", "w", ".", "HideValue", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "HideValue", "\n", "}" ]
9,756
all-9757
[ "parseVirtualNetwork", "parses", "Virtual", "Network", "input", "format", "[", "resourcegroup", ":", "]", "name", "into", "Resource", "Group", "(", "uses", "provided", "one", "if", "omitted", ")", "and", "Virtual", "Network", "Name" ]
[ "func", "parseVirtualNetwork", "(", "<mask>", "string", ",", "defaultRG", "string", ")", "(", "string", ",", "string", ")", "{", "l", ":=", "strings", ".", "SplitN", "(", "name", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "l", ")", "==", "2", "{", "return", "l", "[", "0", "]", ",", "l", "[", "1", "]", "\n", "}", "\n", "return", "defaultRG", ",", "name", "\n", "}" ]
9,757
all-9758
[ "indicate", "modifications", "to", "a", "range", "of", "a", "mapped", "buffer" ]
[ "func", "FlushMappedNamedBufferRange", "(", "buffer", "uint32", ",", "offset", "int", ",", "length", "int", ")", "{", "C", ".", "glowFlushMappedNamedBufferRange", "(", "gpFlushMappedNamedBufferRange", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "offset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "length", ")", ")", "\n", "}" ]
9,758
all-9759
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetWindowBoundsReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
9,759
all-9760
[ "HasPalette", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequestStyle", ")", "HasPalette", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Palette", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
9,760
all-9761
[ "replaceAll", "replaces", "all", "occurrences", "of", "a", "value", "in", "a", "string", "with", "the", "given", "replacement", "value", "." ]
[ "func", "replaceAll", "(", "f", ",", "t", ",", "s", "string", ")", "(", "<mask>", ",", "error", ")", "{", "return", "strings", ".", "Replace", "(", "s", ",", "f", ",", "t", ",", "-", "1", ")", ",", "nil", "\n", "}" ]
9,761
all-9762
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetCookieReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork14", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
9,762
all-9763
[ "MustOffer", "retrieves", "the", "Offer", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "LedgerKey", ")", "MustOffer", "(", ")", "LedgerKeyOffer", "{", "val", ",", "<mask>", ":=", "u", ".", "GetOffer", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
9,763
all-9764
[ "SyncMacroFile", "syncs", "the", "file", "s", "syntax", "tree", "with", "another", "file", "s", ".", "This", "is", "useful", "for", "keeping", "multiple", "macro", "definitions", "from", "the", "same", ".", "bzl", "file", "in", "sync", "." ]
[ "func", "(", "f", "*", "File", ")", "SyncMacroFile", "(", "from", "*", "File", ")", "{", "fromFunc", ":=", "*", "from", ".", "function", ".", "stmt", "\n", "_", ",", "_", ",", "toFunc", ":=", "scanExprs", "(", "from", ".", "function", ".", "stmt", ".", "Name", ",", "f", ".", "File", ".", "Stmt", ")", "\n", "if", "toFunc", "!=", "nil", "{", "*", "toFunc", "=", "fromFunc", "\n", "}", "else", "{", "f", ".", "File", ".", "Stmt", "=", "<mask>", "(", "f", ".", "File", ".", "Stmt", ",", "&", "fromFunc", ")", "\n", "}", "\n", "}" ]
9,764
all-9765
[ "Return", "a", "new", "cache", "with", "a", "given", "default", "expiration", "duration", "and", "cleanup", "interval", ".", "If", "the", "expiration", "duration", "is", "less", "than", "one", "(", "or", "NoExpiration", ")", "the", "items", "in", "the", "cache", "never", "expire", "(", "by", "default", ")", "and", "must", "be", "deleted", "manually", ".", "If", "the", "cleanup", "interval", "is", "less", "than", "one", "expired", "items", "are", "not", "deleted", "from", "the", "cache", "before", "calling", "c", ".", "DeleteExpired", "()", ".", "NewFrom", "()", "also", "accepts", "an", "items", "map", "which", "will", "serve", "as", "the", "underlying", "map", "for", "the", "cache", ".", "This", "is", "useful", "for", "starting", "from", "a", "deserialized", "cache", "(", "serialized", "using", "e", ".", "g", ".", "gob", ".", "Encode", "()", "on", "c", ".", "Items", "()", ")", "or", "passing", "in", "e", ".", "g", ".", "make", "(", "map", "[", "string", "]", "Item", "500", ")", "to", "improve", "startup", "performance", "when", "the", "cache", "is", "expected", "to", "reach", "a", "certain", "minimum", "size", ".", "Only", "the", "cache", "s", "methods", "synchronize", "access", "to", "this", "map", "so", "it", "is", "not", "recommended", "to", "keep", "any", "references", "to", "the", "map", "around", "after", "creating", "a", "cache", ".", "If", "need", "be", "the", "map", "can", "be", "accessed", "at", "a", "later", "point", "using", "c", ".", "Items", "()", "(", "subject", "to", "the", "same", "caveat", ".", ")", "Note", "regarding", "serialization", ":", "When", "using", "e", ".", "g", ".", "gob", "make", "sure", "to", "gob", ".", "Register", "()", "the", "individual", "types", "stored", "in", "the", "cache", "before", "encoding", "a", "map", "retrieved", "with", "c", ".", "Items", "()", "and", "to", "register", "those", "same", "types", "before", "decoding", "a", "blob", "containing", "an", "items", "map", "." ]
[ "func", "NewFrom", "(", "defaultExpiration", ",", "cleanupInterval", "time", ".", "Duration", ",", "items", "map", "[", "string", "]", "Item", ")", "*", "Cache", "{", "return", "newCacheWithJanitor", "(", "defaultExpiration", ",", "cleanupInterval", ",", "<mask>", ")", "\n", "}" ]
9,765
all-9766
[ "NewOutgoingSticker", "creates", "a", "new", "outgoing", "sticker", "message", "." ]
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingSticker", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingSticker", "{", "return", "&", "OutgoingSticker", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":", "api", ",", "Recipient", ":", "recipient", ",", "}", ",", "}", ",", "outgoingFileBase", ":", "outgoingFileBase", "{", "fileName", ":", "fileName", ",", "r", ":", "<mask>", ",", "}", ",", "}", "\n", "}" ]
9,766
all-9767
[ "NewLinear", "creates", "a", "new", "backoff", "using", "the", "linear", "backoff", "algorithm", "." ]
[ "func", "NewLinear", "(", "start", "time", ".", "Duration", ",", "<mask>", "time", ".", "Duration", ")", "*", "Backoff", "{", "return", "NewBackoff", "(", "linear", "{", "}", ",", "start", ",", "limit", ")", "\n", "}" ]
9,767
all-9768
[ "DialAndSend", "opens", "a", "connection", "to", "the", "SMTP", "server", "sends", "the", "given", "emails", "and", "closes", "the", "connection", "." ]
[ "func", "(", "d", "*", "Dialer", ")", "DialAndSend", "(", "m", "...", "*", "<mask>", ")", "error", "{", "s", ",", "err", ":=", "d", ".", "Dial", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "return", "Send", "(", "s", ",", "m", "...", ")", "\n", "}" ]
9,768
all-9769
[ "ServerLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ServerLocator", "(", "href", "<mask>", ")", "*", "ServerLocator", "{", "return", "&", "ServerLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
9,769
all-9770
[ "ListDeploys", "returns", "the", "list", "of", "deploy", "that", "match", "a", "given", "filter", "." ]
[ "func", "ListDeploys", "(", "filter", "*", "Filter", ",", "skip", ",", "limit", "int", ")", "(", "[", "]", "DeployData", ",", "error", ")", "{", "appsList", ",", "err", ":=", "List", "(", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "apps", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "appsList", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "appsList", "{", "apps", "[", "i", "]", "=", "a", ".", "GetName", "(", ")", "\n", "}", "\n", "evts", ",", "err", ":=", "event", ".", "List", "(", "&", "event", ".", "Filter", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "<mask>", ".", "TargetTypeApp", "}", ",", "Raw", ":", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "apps", "}", "}", ",", "KindNames", ":", "[", "]", "string", "{", "permission", ".", "PermAppDeploy", ".", "FullName", "(", ")", "}", ",", "KindType", ":", "event", ".", "KindTypePermission", ",", "Limit", ":", "limit", ",", "Skip", ":", "skip", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "validImages", ",", "err", ":=", "findValidImages", "(", "appsList", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "list", ":=", "make", "(", "[", "]", "DeployData", ",", "len", "(", "evts", ")", ")", "\n", "for", "i", ":=", "range", "evts", "{", "list", "[", "i", "]", "=", "*", "eventToDeployData", "(", "&", "evts", "[", "i", "]", ",", "validImages", ",", "false", ")", "\n", "}", "\n", "return", "list", ",", "nil", "\n", "}" ]
9,770
all-9771
[ "AddTask", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "AddTask", "(", "arg0", "*", "<mask>", ".", "Task", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
9,771
all-9772
[ "SetArtists", "is", "a", "wrapper", "around", "gtk_about_dialog_set_artists", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "SetArtists", "(", "artists", "[", "]", "string", ")", "{", "cartists", ":=", "C", ".", "make_strings", "(", "C", ".", "int", "(", "len", "(", "artists", ")", "+", "1", ")", ")", "\n", "for", "i", ",", "artist", ":=", "range", "artists", "{", "cstr", ":=", "C", ".", "CString", "(", "artist", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "set_string", "(", "cartists", ",", "C", ".", "int", "(", "i", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}", "\n\n", "C", ".", "set_string", "(", "cartists", ",", "C", ".", "int", "(", "len", "(", "artists", ")", ")", ",", "nil", ")", "\n", "C", ".", "gtk_about_dialog_set_artists", "(", "v", ".", "native", "(", ")", ",", "cartists", ")", "\n", "C", ".", "destroy_strings", "(", "cartists", ")", "\n", "}" ]
9,772
all-9773
[ "GetIter", "()", "is", "a", "wrapper", "around", "gtk_tree_model_get_iter", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "GetIter", "(", "<mask>", "*", "TreePath", ")", "(", "*", "TreeIter", ",", "error", ")", "{", "var", "iter", "C", ".", "GtkTreeIter", "\n", "c", ":=", "C", ".", "gtk_tree_model_get_iter", "(", "v", ".", "native", "(", ")", ",", "&", "iter", ",", "path", ".", "native", "(", ")", ")", "\n", "if", "!", "gobool", "(", "c", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "t", ":=", "&", "TreeIter", "{", "iter", "}", "\n", "return", "t", ",", "nil", "\n", "}" ]
9,773
all-9774
[ "GetTemplates", "returns", "templates", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetTemplates", "(", "tkn", ",", "tplType", "string", ")", "(", "[", "]", "data", ".", "Template", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "tplType", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "var", "templates", "[", "]", "reform", ".", "Struct", "\n\n", "var", "err", "error", "\n", "if", "tplType", "!=", "\"", "\"", "{", "templates", ",", "err", "=", "h", ".", "selectAllFrom", "(", "logger", ",", "data", ".", "TemplateTable", ",", "\"", "\"", ",", "tplType", ")", "\n", "}", "else", "{", "templates", ",", "err", "=", "h", ".", "selectAllFrom", "(", "logger", ",", "data", ".", "TemplateTable", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "result", ":=", "make", "(", "[", "]", "data", ".", "<mask>", ",", "0", ")", "\n\n", "for", "_", ",", "v", ":=", "range", "templates", "{", "result", "=", "append", "(", "result", ",", "*", "v", ".", "(", "*", "data", ".", "Template", ")", ")", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
9,774
all-9775
[ "render", "multiple", "instances", "of", "primitives", "using", "a", "count", "derived", "from", "a", "transform", "feedback", "object" ]
[ "func", "DrawTransformFeedbackInstanced", "(", "mode", "uint32", ",", "id", "uint32", ",", "instancecount", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpDrawTransformFeedbackInstanced", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "id", ")", ",", "uintptr", "(", "instancecount", ")", ")", "\n", "}" ]
9,775
all-9776
[ "Remove", "an", "interface", "from", "the", "bridge", "This", "is", "is", "identical", "to", "to", "running", ":", "ip", "link", "$name", "set", "nomaster" ]
[ "func", "NetworkSetNoMaster", "(", "iface", "*", "net", ".", "Interface", ")", "error", "{", "data", ":=", "uint32Attr", "(", "syscall", ".", "IFLA_MASTER", ",", "0", ")", "\n", "return", "networkMasterAction", "(", "iface", ",", "<mask>", ")", "\n", "}" ]
9,776
all-9777
[ "NewAccountId", "creates", "a", "new", "AccountId", "." ]
[ "func", "NewAccountId", "(", "aType", "CryptoKeyType", ",", "value", "interface", "{", "}", ")", "(", "result", "AccountId", ",", "err", "error", ")", "{", "u", ",", "err", ":=", "NewPublicKey", "(", "aType", ",", "<mask>", ")", "\n", "result", "=", "AccountId", "(", "u", ")", "\n", "return", "\n", "}" ]
9,777
all-9778
[ "announce", "announces", "whether", "or", "not", "this", "node", "is", "interested", "in", "a", "given", "topic", "Only", "called", "from", "processLoop", "." ]
[ "func", "(", "p", "*", "PubSub", ")", "announce", "(", "topic", "string", ",", "sub", "bool", ")", "{", "subopt", ":=", "&", "pb", ".", "RPC_SubOpts", "{", "Topicid", ":", "&", "topic", ",", "Subscribe", ":", "&", "sub", ",", "}", "\n\n", "out", ":=", "rpcWithSubs", "(", "subopt", ")", "\n", "for", "pid", ",", "peer", ":=", "range", "p", ".", "peers", "{", "select", "{", "case", "peer", "<-", "out", ":", "default", ":", "<mask>", ".", "Infof", "(", "\"", "\"", ",", "pid", ")", "\n", "go", "p", ".", "announceRetry", "(", "pid", ",", "topic", ",", "sub", ")", "\n", "}", "\n", "}", "\n", "}" ]
9,778
all-9779
[ "export", "goTreeModelFilterFuncs" ]
[ "func", "goTreeModelFilterFuncs", "(", "filter", "*", "C", ".", "GtkTreeModelFilter", ",", "iter", "*", "C", ".", "GtkTreeIter", ",", "data", "C", ".", "gpointer", ")", "C", ".", "gboolean", "{", "id", ":=", "int", "(", "uintptr", "(", "<mask>", ")", ")", "\n\n", "treeModelVisibleFilterFuncRegistry", ".", "Lock", "(", ")", "\n", "r", ":=", "treeModelVisibleFilterFuncRegistry", ".", "m", "[", "id", "]", "\n", "treeModelVisibleFilterFuncRegistry", ".", "Unlock", "(", ")", "\n\n", "goIter", ":=", "&", "TreeIter", "{", "(", "C", ".", "GtkTreeIter", ")", "(", "*", "iter", ")", "}", "\n", "return", "gbool", "(", "r", ".", "fn", "(", "wrapTreeModelFilter", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "filter", ")", ")", ")", ",", "goIter", ",", "r", ".", "userData", ")", ")", "\n", "}" ]
9,779
all-9780
[ "ping", "sends", "a", "ping", "message", "and", "waits", "for", "a", "ping", "response", "." ]
[ "func", "(", "c", "*", "Connection", ")", "ping", "(", "ctx", "<mask>", ".", "Context", ")", "error", "{", "req", ":=", "&", "pingReq", "{", "id", ":", "c", ".", "NextMessageID", "(", ")", "}", "\n", "mex", ",", "err", ":=", "c", ".", "outbound", ".", "newExchange", "(", "ctx", ",", "c", ".", "opts", ".", "FramePool", ",", "req", ".", "messageType", "(", ")", ",", "req", ".", "ID", "(", ")", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "c", ".", "connectionError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "outbound", ".", "removeExchange", "(", "req", ".", "ID", "(", ")", ")", "\n\n", "if", "err", ":=", "c", ".", "sendMessage", "(", "req", ")", ";", "err", "!=", "nil", "{", "return", "c", ".", "connectionError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "c", ".", "recvMessage", "(", "ctx", ",", "&", "pingRes", "{", "}", ",", "mex", ")", "\n", "}" ]
9,780
all-9781
[ "NewDestination", "returns", "a", "tarfile", ".", "Destination", "for", "the", "specified", "io", ".", "Writer", "." ]
[ "func", "NewDestination", "(", "dest", "io", ".", "<mask>", ",", "ref", "reference", ".", "NamedTagged", ")", "*", "Destination", "{", "repoTags", ":=", "[", "]", "reference", ".", "NamedTagged", "{", "}", "\n", "if", "ref", "!=", "nil", "{", "repoTags", "=", "append", "(", "repoTags", ",", "ref", ")", "\n", "}", "\n", "return", "&", "Destination", "{", "writer", ":", "dest", ",", "tar", ":", "tar", ".", "NewWriter", "(", "dest", ")", ",", "repoTags", ":", "repoTags", ",", "blobs", ":", "make", "(", "map", "[", "digest", ".", "Digest", "]", "types", ".", "BlobInfo", ")", ",", "}", "\n", "}" ]
9,781
all-9782
[ "Counter", "returns", "the", "HOTP", "s", "8", "-", "byte", "counter", "as", "an", "unsigned", "64", "-", "bit", "integer", "." ]
[ "func", "(", "otp", "HOTP", ")", "Counter", "(", ")", "uint64", "{", "counter", ":=", "binary", ".", "BigEndian", ".", "Uint64", "(", "otp", ".", "<mask>", "[", ":", "]", ")", "\n", "return", "counter", "\n", "}" ]
9,782
all-9783
[ "applyTransaction", "applies", "the", "transaction", "t", "to", "message", "pb", "by", "using", "the", "relevant", "setter", "passed", "to", "RegisterTransactionSetter", "." ]
[ "func", "applyTransaction", "(", "pb", "proto", ".", "Message", ",", "t", "*", "pb", ".", "Transaction", ")", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "pb", ")", "\n", "if", "f", ",", "ok", ":=", "transactionSetters", "[", "v", ".", "<mask>", "(", ")", "]", ";", "ok", "{", "f", ".", "Call", "(", "[", "]", "reflect", ".", "Value", "{", "v", ",", "reflect", ".", "ValueOf", "(", "t", ")", "}", ")", "\n", "}", "\n", "}" ]
9,783
all-9784
[ "Creates", "a", "new", "minioClient", "S3V2", "structure", "and", "returns" ]
[ "func", "newMinioClientV2", "(", "endpoint", ",", "bucket", ",", "id", ",", "secret", "string", ",", "<mask>", "bool", ")", "(", "*", "minioClient", ",", "error", ")", "{", "mclient", ",", "err", ":=", "minio", ".", "NewV2", "(", "endpoint", ",", "id", ",", "secret", ",", "secure", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "minioClient", "{", "bucket", ":", "bucket", ",", "Client", ":", "mclient", ",", "}", ",", "nil", "\n", "}" ]
9,784
all-9785
[ "NetworkLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "NetworkLocator", "(", "href", "<mask>", ")", "*", "NetworkLocator", "{", "return", "&", "NetworkLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
9,785
all-9786
[ "SetClipRect", "defines", "a", "new", "clipping", "rect", ".", "Maybe", "useful", "with", "PopClip", "and", "PushClip", "functions" ]
[ "func", "SetClipRect", "(", "x", ",", "y", ",", "w", ",", "h", "int", ")", "{", "if", "x", "<", "0", "{", "x", "=", "0", "\n", "}", "\n", "if", "y", "<", "0", "{", "y", "=", "0", "\n", "}", "\n", "if", "x", "+", "w", ">", "canvas", ".", "<mask>", "{", "w", "=", "canvas", ".", "width", "-", "x", "\n", "}", "\n", "if", "y", "+", "h", ">", "canvas", ".", "height", "{", "h", "=", "canvas", ".", "height", "-", "h", "\n", "}", "\n\n", "canvas", ".", "clipX", "=", "x", "\n", "canvas", ".", "clipY", "=", "y", "\n", "canvas", ".", "clipW", "=", "w", "\n", "canvas", ".", "clipH", "=", "h", "\n", "}" ]
9,786
all-9787
[ "MustSuccess", "retrieves", "the", "Success", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "ManageOfferResult", ")", "MustSuccess", "(", ")", "ManageOfferSuccessResult", "{", "val", ",", "<mask>", ":=", "u", ".", "GetSuccess", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
9,787
all-9788
[ "Seek", "implements", "the", "io", ".", "Seeker", "interface" ]
[ "func", "(", "rws", "*", "ReadWriteSeeker", ")", "Seek", "(", "offset", "int64", ",", "whence", "int", ")", "(", "int64", ",", "error", ")", "{", "newPos", ",", "offs", ":=", "0", ",", "int", "(", "offset", ")", "\n", "switch", "whence", "{", "case", "io", ".", "SeekStart", ":", "newPos", "=", "offs", "\n", "case", "io", ".", "SeekCurrent", ":", "newPos", "=", "rws", ".", "pos", "+", "offs", "\n", "case", "<mask>", ".", "SeekEnd", ":", "newPos", "=", "len", "(", "rws", ".", "buf", ")", "+", "offs", "\n", "}", "\n", "if", "newPos", "<", "0", "{", "return", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "rws", ".", "pos", "=", "newPos", "\n", "return", "int64", "(", "newPos", ")", ",", "nil", "\n", "}" ]
9,788
all-9789
[ "Labels", "returns", "a", "sorted", "list", "of", "labels", "unique", "by", "name" ]
[ "func", "(", "c", "Configuration", ")", "Labels", "(", ")", "[", "]", "Label", "{", "var", "labelarrays", "[", "]", "[", "]", "Label", "\n", "labelarrays", "=", "append", "(", "labelarrays", ",", "c", ".", "Default", ".", "Labels", ")", "\n", "for", "_", ",", "repo", ":=", "range", "c", ".", "Repos", "{", "labelarrays", "=", "append", "(", "labelarrays", ",", "repo", ".", "Labels", ")", "\n", "}", "\n\n", "labelmap", ":=", "make", "(", "map", "[", "string", "]", "Label", ")", "\n", "for", "_", ",", "labels", ":=", "range", "labelarrays", "{", "for", "_", ",", "l", ":=", "range", "labels", "{", "name", ":=", "strings", ".", "ToLower", "(", "l", ".", "Name", ")", "\n", "if", "_", ",", "ok", ":=", "labelmap", "[", "name", "]", ";", "!", "ok", "{", "labelmap", "[", "name", "]", "=", "l", "\n", "}", "\n", "}", "\n", "}", "\n\n", "var", "labels", "[", "]", "Label", "\n", "for", "_", ",", "label", ":=", "<mask>", "labelmap", "{", "labels", "=", "append", "(", "labels", ",", "label", ")", "\n", "}", "\n", "sort", ".", "Slice", "(", "labels", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "labels", "[", "i", "]", ".", "Name", "<", "labels", "[", "j", "]", ".", "Name", "}", ")", "\n", "return", "labels", "\n", "}" ]
9,789
all-9790
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventIndexedDBListUpdated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoStorage7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
9,790
all-9791
[ "RecentManagerGetDefault", "is", "a", "wrapper", "around", "gtk_recent_manager_get_default", "()", "." ]
[ "func", "RecentManagerGetDefault", "(", ")", "(", "*", "RecentManager", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_recent_manager_get_default", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "v", ":=", "wrapRecentManager", "(", "obj", ")", "\n", "return", "v", ",", "nil", "\n", "}" ]
9,791
all-9792
[ "Delete", "deletes", "a", "key", "." ]
[ "func", "(", "tx", "Tx", ")", "Delete", "(", "k", "[", "]", "[", "]", "<mask>", ")", "error", "{", "if", "len", "(", "k", ")", "==", "1", "{", "return", "errorsp", ".", "WithStacks", "(", "tx", ".", "Tx", ".", "DeleteBucket", "(", "k", "[", "0", "]", ")", ")", "\n", "}", "\n", "return", "tx", ".", "Bucket", "(", "k", "[", ":", "len", "(", "k", ")", "-", "1", "]", ",", "func", "(", "b", "Bucket", ")", "error", "{", "return", "errorsp", ".", "WithStacks", "(", "b", ".", "Bucket", ".", "Delete", "(", "k", "[", "len", "(", "k", ")", "-", "1", "]", ")", ")", "\n", "}", ")", "\n", "}" ]
9,792
all-9793
[ "export", "FrameSet_Normalize" ]
[ "func", "FrameSet_Normalize", "(", "id", "FrameSetId", ")", "FrameSetId", "{", "fs", ",", "ok", ":=", "sFrameSets", ".", "Get", "(", "<mask>", ")", "\n", "if", "!", "ok", "{", "return", "0", "\n", "}", "\n", "normalized", ":=", "fs", ".", "Normalize", "(", ")", "\n", "normalizedId", ":=", "sFrameSets", ".", "Add", "(", "*", "normalized", ")", "\n", "return", "normalizedId", "\n", "}" ]
9,793
all-9794
[ "TODO", "Has", "issues", "with", "6", "digit", "dates" ]
[ "func", "dateWithoutSepMatchHelper", "(", "password", "string", ")", "(", "matches", "[", "]", "match", ".", "DateMatch", ")", "{", "for", "_", ",", "v", ":=", "range", "dateWithOutSepMatch", ".", "FindAllString", "(", "password", ",", "len", "(", "password", ")", ")", "{", "i", ":=", "strings", ".", "Index", "(", "password", ",", "v", ")", "\n", "j", ":=", "i", "+", "len", "(", "v", ")", "\n", "length", ":=", "len", "(", "v", ")", "\n", "lastIndex", ":=", "length", "-", "1", "\n", "var", "candidatesRoundOne", "[", "]", "dateMatchCandidate", "\n\n", "if", "length", "<=", "6", "{", "//2-digit year prefix", "candidatesRoundOne", "=", "<mask>", "(", "candidatesRoundOne", ",", "buildDateMatchCandidate", "(", "v", "[", "2", ":", "]", ",", "v", "[", "0", ":", "2", "]", ",", "i", ",", "j", ")", ")", "\n\n", "//2-digityear suffix", "candidatesRoundOne", "=", "append", "(", "candidatesRoundOne", ",", "buildDateMatchCandidate", "(", "v", "[", "0", ":", "lastIndex", "-", "2", "]", ",", "v", "[", "lastIndex", "-", "2", ":", "]", ",", "i", ",", "j", ")", ")", "\n", "}", "\n", "if", "length", ">=", "6", "{", "//4-digit year prefix", "candidatesRoundOne", "=", "append", "(", "candidatesRoundOne", ",", "buildDateMatchCandidate", "(", "v", "[", "4", ":", "]", ",", "v", "[", "0", ":", "4", "]", ",", "i", ",", "j", ")", ")", "\n\n", "//4-digit year sufix", "candidatesRoundOne", "=", "append", "(", "candidatesRoundOne", ",", "buildDateMatchCandidate", "(", "v", "[", "0", ":", "lastIndex", "-", "3", "]", ",", "v", "[", "lastIndex", "-", "3", ":", "]", ",", "i", ",", "j", ")", ")", "\n", "}", "\n\n", "var", "candidatesRoundTwo", "[", "]", "dateMatchCandidateTwo", "\n", "for", "_", ",", "c", ":=", "range", "candidatesRoundOne", "{", "if", "len", "(", "c", ".", "DayMonth", ")", "==", "2", "{", "candidatesRoundTwo", "=", "append", "(", "candidatesRoundTwo", ",", "buildDateMatchCandidateTwo", "(", "c", ".", "DayMonth", "[", "0", ":", "0", "]", ",", "c", ".", "DayMonth", "[", "1", ":", "1", "]", ",", "c", ".", "Year", ",", "c", ".", "I", ",", "c", ".", "J", ")", ")", "\n", "}", "else", "if", "len", "(", "c", ".", "DayMonth", ")", "==", "3", "{", "candidatesRoundTwo", "=", "append", "(", "candidatesRoundTwo", ",", "buildDateMatchCandidateTwo", "(", "c", ".", "DayMonth", "[", "0", ":", "2", "]", ",", "c", ".", "DayMonth", "[", "2", ":", "2", "]", ",", "c", ".", "Year", ",", "c", ".", "I", ",", "c", ".", "J", ")", ")", "\n", "candidatesRoundTwo", "=", "append", "(", "candidatesRoundTwo", ",", "buildDateMatchCandidateTwo", "(", "c", ".", "DayMonth", "[", "0", ":", "0", "]", ",", "c", ".", "DayMonth", "[", "1", ":", "3", "]", ",", "c", ".", "Year", ",", "c", ".", "I", ",", "c", ".", "J", ")", ")", "\n", "}", "else", "if", "len", "(", "c", ".", "DayMonth", ")", "==", "4", "{", "candidatesRoundTwo", "=", "append", "(", "candidatesRoundTwo", ",", "buildDateMatchCandidateTwo", "(", "c", ".", "DayMonth", "[", "0", ":", "2", "]", ",", "c", ".", "DayMonth", "[", "2", ":", "4", "]", ",", "c", ".", "Year", ",", "c", ".", "I", ",", "c", ".", "J", ")", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "candidate", ":=", "range", "candidatesRoundTwo", "{", "intDay", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "candidate", ".", "Day", ",", "10", ",", "16", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "intMonth", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "candidate", ".", "Month", ",", "10", ",", "16", ")", "\n\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "intYear", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "candidate", ".", "Year", ",", "10", ",", "16", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "if", "ok", ",", "_", ",", "_", ",", "_", ":=", "checkDate", "(", "intDay", ",", "intMonth", ",", "intYear", ")", ";", "ok", "{", "matches", "=", "append", "(", "matches", ",", "match", ".", "DateMatch", "{", "Token", ":", "password", ",", "Pattern", ":", "\"", "\"", ",", "Day", ":", "intDay", ",", "Month", ":", "intMonth", ",", "Year", ":", "intYear", ",", "I", ":", "i", ",", "J", ":", "j", "}", ")", "\n", "}", "\n\n", "}", "\n", "}", "\n\n", "return", "matches", "\n", "}" ]
9,794
all-9795
[ "BeginningOfDay", "beginning", "of", "day" ]
[ "func", "(", "now", "*", "Now", ")", "BeginningOfDay", "(", ")", "time", ".", "Time", "{", "y", ",", "m", ",", "d", ":=", "<mask>", ".", "Date", "(", ")", "\n", "return", "time", ".", "Date", "(", "y", ",", "m", ",", "d", ",", "0", ",", "0", ",", "0", ",", "0", ",", "now", ".", "Time", ".", "Location", "(", ")", ")", "\n", "}" ]
9,795
all-9796
[ "Write", "writes", "request", "header", "to", "w", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "Write", "(", "w", "*", "bufio", ".", "Writer", ")", "error", "{", "_", ",", "err", ":=", "w", ".", "Write", "(", "h", ".", "<mask>", "(", ")", ")", "\n", "return", "err", "\n", "}" ]
9,796
all-9797
[ "Sign", "creates", "a", "(", "non", "-", "detached", ")", "signature", "of", "input", "using", "keyIdentity", ".", "Fails", "with", "a", "SigningNotSupportedError", "if", "the", "mechanism", "does", "not", "support", "signing", "." ]
[ "func", "(", "m", "*", "openpgpSigningMechanism", ")", "Sign", "(", "<mask>", "[", "]", "byte", ",", "keyIdentity", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "nil", ",", "SigningNotSupportedError", "(", "\"", "\"", ")", "\n", "}" ]
9,797
all-9798
[ "CancelSearch", "stops", "the", "current", "search", "and", "returns", "the", "list", "to", "its", "original", "order", "." ]
[ "func", "(", "l", "*", "List", ")", "CancelSearch", "(", ")", "{", "l", ".", "cursor", "=", "0", "\n", "l", ".", "<mask>", "=", "0", "\n", "l", ".", "scope", "=", "l", ".", "items", "\n", "}" ]
9,798
all-9799
[ "Fetch", "file", "from", "the", "specified", "Path" ]
[ "func", "(", "f", "*", "File", ")", "Fetch", "(", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "//only delay after first fetch", "if", "f", ".", "delay", "{", "time", ".", "Sleep", "(", "f", ".", "Interval", ")", "\n", "}", "\n", "f", ".", "<mask>", "=", "true", "\n", "lastHash", ":=", "f", ".", "hash", "\n", "if", "err", ":=", "f", ".", "updateHash", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// no change", "if", "lastHash", "==", "f", ".", "hash", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "// changed!", "file", ",", "err", ":=", "os", ".", "Open", "(", "f", ".", "Path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "//check every 1/4s for 5s to", "//ensure its not mid-copy", "const", "rate", "=", "250", "*", "time", ".", "Millisecond", "\n", "const", "total", "=", "int", "(", "5", "*", "time", ".", "Second", "/", "rate", ")", "\n", "attempt", ":=", "1", "\n", "for", "{", "if", "attempt", "==", "total", "{", "file", ".", "Close", "(", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "attempt", "++", "\n", "//sleep", "time", ".", "Sleep", "(", "rate", ")", "\n", "//check hash!", "if", "err", ":=", "f", ".", "updateHash", "(", ")", ";", "err", "!=", "nil", "{", "file", ".", "Close", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "//check until no longer changing", "if", "lastHash", "==", "f", ".", "hash", "{", "break", "\n", "}", "\n", "lastHash", "=", "f", ".", "hash", "\n", "}", "\n", "return", "file", ",", "nil", "\n", "}" ]
9,799
all-9800
[ "New", "App", "instance" ]
[ "func", "New", "(", "configFilename", "string", ")", "*", "App", "{", "app", ":=", "&", "App", "{", "ConfigFilename", ":", "configFilename", ",", "Config", ":", "NewConfig", "(", ")", ",", "PromRegistry", ":", "prometheus", ".", "NewPedanticRegistry", "(", ")", ",", "<mask>", ":", "make", "(", "chan", "bool", ")", ",", "}", "\n\n", "return", "app", "\n", "}" ]