id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
154,400
salsaflow/salsaflow
Godeps/_workspace/src/gopkg.in/tchap/gocli.v2/command.go
Run
func (cmd *Command) Run(args []string) { cmd.Flags.SetOutput(ioutil.Discard) err := cmd.Flags.Parse(args) if err != nil { cmd.Usage() fmt.Fprintf(os.Stderr, "\nError: %v\n", err) os.Exit(2) } subArgs := cmd.Flags.Args() if len(subArgs) == 0 { cmd.Action(cmd, subArgs) return } name := subArgs[0] for _, subcmd := range cmd.Subcmds { if subcmd.Name() == name { subcmd.Run(subArgs[1:]) return } } cmd.Action(cmd, subArgs) }
go
func (cmd *Command) Run(args []string) { cmd.Flags.SetOutput(ioutil.Discard) err := cmd.Flags.Parse(args) if err != nil { cmd.Usage() fmt.Fprintf(os.Stderr, "\nError: %v\n", err) os.Exit(2) } subArgs := cmd.Flags.Args() if len(subArgs) == 0 { cmd.Action(cmd, subArgs) return } name := subArgs[0] for _, subcmd := range cmd.Subcmds { if subcmd.Name() == name { subcmd.Run(subArgs[1:]) return } } cmd.Action(cmd, subArgs) }
[ "func", "(", "cmd", "*", "Command", ")", "Run", "(", "args", "[", "]", "string", ")", "{", "cmd", ".", "Flags", ".", "SetOutput", "(", "ioutil", ".", "Discard", ")", "\n\n", "err", ":=", "cmd", ".", "Flags", ".", "Parse", "(", "args", ")", "\n", ...
// Run the command with supplied arguments. This is called recursively if a // subcommand is detected, just a prefix is cut off from the arguments.
[ "Run", "the", "command", "with", "supplied", "arguments", ".", "This", "is", "called", "recursively", "if", "a", "subcommand", "is", "detected", "just", "a", "prefix", "is", "cut", "off", "from", "the", "arguments", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/gopkg.in/tchap/gocli.v2/command.go#L105-L130
154,401
salsaflow/salsaflow
Godeps/_workspace/src/gopkg.in/tchap/gocli.v2/command.go
MustRegisterSubcommand
func (cmd *Command) MustRegisterSubcommand(subcmd *Command) { // Require some fields to be non-empty. switch { case subcmd.Short == "": panic("Short not set") case subcmd.UsageLine == "": panic("UsageLine not set") } // Fill in the unexported fields. subcmd.helpTemplate = CommandHelpTemplate subcmd.helpTemplateData = subcmd // Print help if there is no action defined. if subcmd.Action == nil { subcmd.Action = helpAction(1) } // Define the help flag. subcmd.Flags.Var((*helpValue)(subcmd), "h", "print help and exit") // Easy if there are no subcommands defined yet. if cmd.Subcmds == nil { cmd.Subcmds = []*Command{subcmd} return } // Check for subcommand name collisions. for _, c := range cmd.Subcmds { if c.Name() == subcmd.Name() { panic(fmt.Sprintf("Subcommand %s already defined", subcmd.Name)) } } cmd.Subcmds = append(cmd.Subcmds, subcmd) }
go
func (cmd *Command) MustRegisterSubcommand(subcmd *Command) { // Require some fields to be non-empty. switch { case subcmd.Short == "": panic("Short not set") case subcmd.UsageLine == "": panic("UsageLine not set") } // Fill in the unexported fields. subcmd.helpTemplate = CommandHelpTemplate subcmd.helpTemplateData = subcmd // Print help if there is no action defined. if subcmd.Action == nil { subcmd.Action = helpAction(1) } // Define the help flag. subcmd.Flags.Var((*helpValue)(subcmd), "h", "print help and exit") // Easy if there are no subcommands defined yet. if cmd.Subcmds == nil { cmd.Subcmds = []*Command{subcmd} return } // Check for subcommand name collisions. for _, c := range cmd.Subcmds { if c.Name() == subcmd.Name() { panic(fmt.Sprintf("Subcommand %s already defined", subcmd.Name)) } } cmd.Subcmds = append(cmd.Subcmds, subcmd) }
[ "func", "(", "cmd", "*", "Command", ")", "MustRegisterSubcommand", "(", "subcmd", "*", "Command", ")", "{", "// Require some fields to be non-empty.", "switch", "{", "case", "subcmd", ".", "Short", "==", "\"", "\"", ":", "panic", "(", "\"", "\"", ")", "\n", ...
// Register a new subcommand with the command. Panic if something is wrong.
[ "Register", "a", "new", "subcommand", "with", "the", "command", ".", "Panic", "if", "something", "is", "wrong", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/gopkg.in/tchap/gocli.v2/command.go#L133-L168
154,402
itchio/httpkit
progress/bar.go
writer
func (pb *Bar) writer() { pb.Update() for { select { case <-pb.finish: return case <-time.After(pb.RefreshRate): pb.Update() } } }
go
func (pb *Bar) writer() { pb.Update() for { select { case <-pb.finish: return case <-time.After(pb.RefreshRate): pb.Update() } } }
[ "func", "(", "pb", "*", "Bar", ")", "writer", "(", ")", "{", "pb", ".", "Update", "(", ")", "\n", "for", "{", "select", "{", "case", "<-", "pb", ".", "finish", ":", "return", "\n", "case", "<-", "time", ".", "After", "(", "pb", ".", "RefreshRat...
// Internal loop for writing progressbar
[ "Internal", "loop", "for", "writing", "progressbar" ]
f7051ef345456d077d49344cf6ec98b4059214f5
https://github.com/itchio/httpkit/blob/f7051ef345456d077d49344cf6ec98b4059214f5/progress/bar.go#L383-L393
154,403
timehop/gos2
r2/rect.go
ApproxEquals
func (r Rect) ApproxEquals(r2 Rect) bool { return r.X.ApproxEqual(r2.X) && r.Y.ApproxEqual(r2.Y) }
go
func (r Rect) ApproxEquals(r2 Rect) bool { return r.X.ApproxEqual(r2.X) && r.Y.ApproxEqual(r2.Y) }
[ "func", "(", "r", "Rect", ")", "ApproxEquals", "(", "r2", "Rect", ")", "bool", "{", "return", "r", ".", "X", ".", "ApproxEqual", "(", "r2", ".", "X", ")", "&&", "r", ".", "Y", ".", "ApproxEqual", "(", "r2", ".", "Y", ")", "\n", "}" ]
// ApproxEquals returns true if the x- and y-intervals of the two rectangles are // the same up to the given tolerance.
[ "ApproxEquals", "returns", "true", "if", "the", "x", "-", "and", "y", "-", "intervals", "of", "the", "two", "rectangles", "are", "the", "same", "up", "to", "the", "given", "tolerance", "." ]
004cde1d85c2ef02a66c6c769d44b293d28879f5
https://github.com/timehop/gos2/blob/004cde1d85c2ef02a66c6c769d44b293d28879f5/r2/rect.go#L181-L183
154,404
seven5/seven5
client/integer.go
Equal
func (self IntEqualer) Equal(e Equaler) bool { return self.I == e.(IntEqualer).I }
go
func (self IntEqualer) Equal(e Equaler) bool { return self.I == e.(IntEqualer).I }
[ "func", "(", "self", "IntEqualer", ")", "Equal", "(", "e", "Equaler", ")", "bool", "{", "return", "self", ".", "I", "==", "e", ".", "(", "IntEqualer", ")", ".", "I", "\n", "}" ]
//Equal compares two values, must be IntEqualers, to see if they //are the same.
[ "Equal", "compares", "two", "values", "must", "be", "IntEqualers", "to", "see", "if", "they", "are", "the", "same", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/integer.go#L29-L31
154,405
seven5/seven5
client/integer.go
NewIntegerSimple
func NewIntegerSimple(i int) IntegerAttribute { result := &IntegerSimple{ NewAttribute(NORMAL, nil, nil), } result.Set(i) return result }
go
func NewIntegerSimple(i int) IntegerAttribute { result := &IntegerSimple{ NewAttribute(NORMAL, nil, nil), } result.Set(i) return result }
[ "func", "NewIntegerSimple", "(", "i", "int", ")", "IntegerAttribute", "{", "result", ":=", "&", "IntegerSimple", "{", "NewAttribute", "(", "NORMAL", ",", "nil", ",", "nil", ")", ",", "}", "\n", "result", ".", "Set", "(", "i", ")", "\n", "return", "resu...
//NewIntegerSimple creates a new IntegerAttribute with a simple //int initial value.
[ "NewIntegerSimple", "creates", "a", "new", "IntegerAttribute", "with", "a", "simple", "int", "initial", "value", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/integer.go#L48-L54
154,406
salsaflow/salsaflow
modules/issue_tracking/github/api_utils.go
updateIssues
func updateIssues( client *github.Client, owner string, repo string, issues []*github.Issue, updateFunc issueUpdateFunc, rollbackFunc issueUpdateFunc, ) ([]*github.Issue, action.Action, error) { // Prepare a function that can be used to apply the given updateFunc. // It is later used to both update issues and revert changes. update := func( issues []*github.Issue, updateFunc issueUpdateFunc, ) (newIssues []*github.Issue, errHint string, err error) { // Send the requests concurrently. retCh := make(chan *issueUpdateResult, len(issues)) for _, issue := range issues { go func(issue *github.Issue) { var ( updatedIssue *github.Issue err error ) withRequestAllocated(func() { updatedIssue, err = updateFunc(client, owner, repo, issue) }) if err == nil { // On success, return the updated story. retCh <- &issueUpdateResult{updatedIssue, nil} } else { // On error, keep the original story, add the error. retCh <- &issueUpdateResult{nil, err} } }(issue) } // Wait for the requests to complete. var ( updatedIssues = make([]*github.Issue, 0, len(issues)) errFailed = errors.New("failed to update GitHub issues") stderr bytes.Buffer ) for range issues { if ret := <-retCh; ret.err != nil { fmt.Fprintln(&stderr, ret.err) err = errFailed } else { updatedIssues = append(updatedIssues, ret.issue) } } return updatedIssues, stderr.String(), err } // Apply the update function. updatedIssues, errHint, err := update(issues, updateFunc) if err != nil { // In case there is an error, generate the error hint. var errHintAcc bytes.Buffer errHintAcc.WriteString("\nUpdate Errors\n-------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") // Revert the changes. _, errHint, ex := update(updatedIssues, rollbackFunc) if ex != nil { // In case there is an error during rollback, extend the error hint. errHintAcc.WriteString("Rollback Errors\n---------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") } return nil, nil, errs.NewErrorWithHint("Update GitHub issues", err, errHintAcc.String()) } // On success, return the updated issues and a rollback function. act := action.ActionFunc(func() error { _, errHint, err := update(updatedIssues, rollbackFunc) if err != nil { var errHintAcc bytes.Buffer errHintAcc.WriteString("\nRollback Errors\n---------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") return errs.NewErrorWithHint("Revert GitHub issue updates", err, errHintAcc.String()) } return nil }) return updatedIssues, act, nil }
go
func updateIssues( client *github.Client, owner string, repo string, issues []*github.Issue, updateFunc issueUpdateFunc, rollbackFunc issueUpdateFunc, ) ([]*github.Issue, action.Action, error) { // Prepare a function that can be used to apply the given updateFunc. // It is later used to both update issues and revert changes. update := func( issues []*github.Issue, updateFunc issueUpdateFunc, ) (newIssues []*github.Issue, errHint string, err error) { // Send the requests concurrently. retCh := make(chan *issueUpdateResult, len(issues)) for _, issue := range issues { go func(issue *github.Issue) { var ( updatedIssue *github.Issue err error ) withRequestAllocated(func() { updatedIssue, err = updateFunc(client, owner, repo, issue) }) if err == nil { // On success, return the updated story. retCh <- &issueUpdateResult{updatedIssue, nil} } else { // On error, keep the original story, add the error. retCh <- &issueUpdateResult{nil, err} } }(issue) } // Wait for the requests to complete. var ( updatedIssues = make([]*github.Issue, 0, len(issues)) errFailed = errors.New("failed to update GitHub issues") stderr bytes.Buffer ) for range issues { if ret := <-retCh; ret.err != nil { fmt.Fprintln(&stderr, ret.err) err = errFailed } else { updatedIssues = append(updatedIssues, ret.issue) } } return updatedIssues, stderr.String(), err } // Apply the update function. updatedIssues, errHint, err := update(issues, updateFunc) if err != nil { // In case there is an error, generate the error hint. var errHintAcc bytes.Buffer errHintAcc.WriteString("\nUpdate Errors\n-------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") // Revert the changes. _, errHint, ex := update(updatedIssues, rollbackFunc) if ex != nil { // In case there is an error during rollback, extend the error hint. errHintAcc.WriteString("Rollback Errors\n---------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") } return nil, nil, errs.NewErrorWithHint("Update GitHub issues", err, errHintAcc.String()) } // On success, return the updated issues and a rollback function. act := action.ActionFunc(func() error { _, errHint, err := update(updatedIssues, rollbackFunc) if err != nil { var errHintAcc bytes.Buffer errHintAcc.WriteString("\nRollback Errors\n---------------\n") errHintAcc.WriteString(errHint) errHintAcc.WriteString("\n") return errs.NewErrorWithHint("Revert GitHub issue updates", err, errHintAcc.String()) } return nil }) return updatedIssues, act, nil }
[ "func", "updateIssues", "(", "client", "*", "github", ".", "Client", ",", "owner", "string", ",", "repo", "string", ",", "issues", "[", "]", "*", "github", ".", "Issue", ",", "updateFunc", "issueUpdateFunc", ",", "rollbackFunc", "issueUpdateFunc", ",", ")", ...
// updateIssues can be used to update multiple issues at once concurrently. // It basically calls the given update function on all given issues and // collects the results. In case there is any error, updateIssues tries // to revert partial changes. The error returned contains the complete list // of API call errors as the error hint.
[ "updateIssues", "can", "be", "used", "to", "update", "multiple", "issues", "at", "once", "concurrently", ".", "It", "basically", "calls", "the", "given", "update", "function", "on", "all", "given", "issues", "and", "collects", "the", "results", ".", "In", "c...
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/api_utils.go#L30-L119
154,407
salsaflow/salsaflow
modules/issue_tracking/github/api_utils.go
setMilestone
func setMilestone(milestone *github.Milestone) issueUpdateFunc { return func( client *github.Client, owner string, repo string, issue *github.Issue, ) (*github.Issue, error) { issue, _, err := client.Issues.Edit(owner, repo, *issue.Number, &github.IssueRequest{ Milestone: milestone.Number, }) return issue, err } }
go
func setMilestone(milestone *github.Milestone) issueUpdateFunc { return func( client *github.Client, owner string, repo string, issue *github.Issue, ) (*github.Issue, error) { issue, _, err := client.Issues.Edit(owner, repo, *issue.Number, &github.IssueRequest{ Milestone: milestone.Number, }) return issue, err } }
[ "func", "setMilestone", "(", "milestone", "*", "github", ".", "Milestone", ")", "issueUpdateFunc", "{", "return", "func", "(", "client", "*", "github", ".", "Client", ",", "owner", "string", ",", "repo", "string", ",", "issue", "*", "github", ".", "Issue",...
// setMilestone returns an update function that can be passed into // updateIssues to set the milestone to the given value.
[ "setMilestone", "returns", "an", "update", "function", "that", "can", "be", "passed", "into", "updateIssues", "to", "set", "the", "milestone", "to", "the", "given", "value", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/api_utils.go#L123-L136
154,408
salsaflow/salsaflow
modules/issue_tracking/github/api_utils.go
unsetMilestone
func unsetMilestone() issueUpdateFunc { return func( client *github.Client, owner string, repo string, issue *github.Issue, ) (*github.Issue, error) { // It is not possible to unset the milestone using go-github // in a nice way, we have to do it manually. u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, *issue.Number) req, err := client.NewRequest("PATCH", u, json.RawMessage([]byte("{milestone:null}"))) if err != nil { return nil, err } var i github.Issue if _, err := client.Do(req, &i); err != nil { return nil, err } return &i, nil } }
go
func unsetMilestone() issueUpdateFunc { return func( client *github.Client, owner string, repo string, issue *github.Issue, ) (*github.Issue, error) { // It is not possible to unset the milestone using go-github // in a nice way, we have to do it manually. u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, *issue.Number) req, err := client.NewRequest("PATCH", u, json.RawMessage([]byte("{milestone:null}"))) if err != nil { return nil, err } var i github.Issue if _, err := client.Do(req, &i); err != nil { return nil, err } return &i, nil } }
[ "func", "unsetMilestone", "(", ")", "issueUpdateFunc", "{", "return", "func", "(", "client", "*", "github", ".", "Client", ",", "owner", "string", ",", "repo", "string", ",", "issue", "*", "github", ".", "Issue", ",", ")", "(", "*", "github", ".", "Iss...
// unsetMilestone returns an update function that can be passed into // updateIssues to clear the milestone.
[ "unsetMilestone", "returns", "an", "update", "function", "that", "can", "be", "passed", "into", "updateIssues", "to", "clear", "the", "milestone", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/api_utils.go#L140-L162
154,409
salsaflow/salsaflow
modules/issue_tracking/github/story_utils.go
labeled
func labeled(issue *github.Issue, label string) bool { for _, l := range issue.Labels { if *l.Name == label { return true } } return false }
go
func labeled(issue *github.Issue, label string) bool { for _, l := range issue.Labels { if *l.Name == label { return true } } return false }
[ "func", "labeled", "(", "issue", "*", "github", ".", "Issue", ",", "label", "string", ")", "bool", "{", "for", "_", ",", "l", ":=", "range", "issue", ".", "Labels", "{", "if", "*", "l", ".", "Name", "==", "label", "{", "return", "true", "\n", "}"...
// labeled returns true when the given issue is labeled with the given label.
[ "labeled", "returns", "true", "when", "the", "given", "issue", "is", "labeled", "with", "the", "given", "label", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/story_utils.go#L23-L30
154,410
salsaflow/salsaflow
modules/issue_tracking/github/story_utils.go
pruneStateLabels
func pruneStateLabels( config *moduleConfig, labels []github.Label, ) (remainingLabels, prunedLabels []github.Label) { stateLabels := map[string]struct{}{ config.ApprovedLabel: struct{}{}, config.BeingImplementedLabel: struct{}{}, config.ImplementedLabel: struct{}{}, config.ReviewedLabel: struct{}{}, config.SkipReviewLabel: struct{}{}, config.PassedTestingLabel: struct{}{}, config.FailedTestingLabel: struct{}{}, config.SkipTestingLabel: struct{}{}, config.StagedLabel: struct{}{}, config.RejectedLabel: struct{}{}, } var ( remaining = make([]github.Label, 0, len(labels)) pruned = make([]github.Label, 0, len(labels)) ) for _, label := range labels { if _, ok := stateLabels[*label.Name]; ok { pruned = append(pruned, label) } else { remaining = append(remaining, label) } } return remaining, pruned }
go
func pruneStateLabels( config *moduleConfig, labels []github.Label, ) (remainingLabels, prunedLabels []github.Label) { stateLabels := map[string]struct{}{ config.ApprovedLabel: struct{}{}, config.BeingImplementedLabel: struct{}{}, config.ImplementedLabel: struct{}{}, config.ReviewedLabel: struct{}{}, config.SkipReviewLabel: struct{}{}, config.PassedTestingLabel: struct{}{}, config.FailedTestingLabel: struct{}{}, config.SkipTestingLabel: struct{}{}, config.StagedLabel: struct{}{}, config.RejectedLabel: struct{}{}, } var ( remaining = make([]github.Label, 0, len(labels)) pruned = make([]github.Label, 0, len(labels)) ) for _, label := range labels { if _, ok := stateLabels[*label.Name]; ok { pruned = append(pruned, label) } else { remaining = append(remaining, label) } } return remaining, pruned }
[ "func", "pruneStateLabels", "(", "config", "*", "moduleConfig", ",", "labels", "[", "]", "github", ".", "Label", ",", ")", "(", "remainingLabels", ",", "prunedLabels", "[", "]", "github", ".", "Label", ")", "{", "stateLabels", ":=", "map", "[", "string", ...
// pruneStateLabels gets the label slice passed in and splits it // into the state labels as used by SalsaFlow and the rest.
[ "pruneStateLabels", "gets", "the", "label", "slice", "passed", "in", "and", "splits", "it", "into", "the", "state", "labels", "as", "used", "by", "SalsaFlow", "and", "the", "rest", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/story_utils.go#L34-L64
154,411
salsaflow/salsaflow
modules/issue_tracking/github/story_utils.go
abstractState
func abstractState(issue *github.Issue, config *moduleConfig) common.StoryState { if *issue.State == "closed" { return common.StoryStateAccepted } var ( approvedLabel = config.ApprovedLabel beingImplementedLabel = config.BeingImplementedLabel implementedLabel = config.ImplementedLabel reviewedLabel = config.ReviewedLabel skipReviewLabel = config.SkipReviewLabel passedTestingLabel = config.PassedTestingLabel skipTestingLabel = config.SkipTestingLabel stagedLabel = config.StagedLabel rejectedLabel = config.RejectedLabel ) for _, label := range issue.Labels { switch *label.Name { case approvedLabel: return common.StoryStateApproved case beingImplementedLabel: return common.StoryStateBeingImplemented case implementedLabel: return common.StoryStateImplemented case reviewedLabel: fallthrough case skipReviewLabel: fallthrough case passedTestingLabel: fallthrough case skipTestingLabel: reviewed := labeled(issue, reviewedLabel) || labeled(issue, skipReviewLabel) tested := labeled(issue, passedTestingLabel) || labeled(issue, skipTestingLabel) switch { case reviewed && tested: return common.StoryStateTested case reviewed: return common.StoryStateReviewed case tested: return common.StoryStateImplemented } case stagedLabel: return common.StoryStateStaged case rejectedLabel: return common.StoryStateRejected } } return common.StoryStateInvalid }
go
func abstractState(issue *github.Issue, config *moduleConfig) common.StoryState { if *issue.State == "closed" { return common.StoryStateAccepted } var ( approvedLabel = config.ApprovedLabel beingImplementedLabel = config.BeingImplementedLabel implementedLabel = config.ImplementedLabel reviewedLabel = config.ReviewedLabel skipReviewLabel = config.SkipReviewLabel passedTestingLabel = config.PassedTestingLabel skipTestingLabel = config.SkipTestingLabel stagedLabel = config.StagedLabel rejectedLabel = config.RejectedLabel ) for _, label := range issue.Labels { switch *label.Name { case approvedLabel: return common.StoryStateApproved case beingImplementedLabel: return common.StoryStateBeingImplemented case implementedLabel: return common.StoryStateImplemented case reviewedLabel: fallthrough case skipReviewLabel: fallthrough case passedTestingLabel: fallthrough case skipTestingLabel: reviewed := labeled(issue, reviewedLabel) || labeled(issue, skipReviewLabel) tested := labeled(issue, passedTestingLabel) || labeled(issue, skipTestingLabel) switch { case reviewed && tested: return common.StoryStateTested case reviewed: return common.StoryStateReviewed case tested: return common.StoryStateImplemented } case stagedLabel: return common.StoryStateStaged case rejectedLabel: return common.StoryStateRejected } } return common.StoryStateInvalid }
[ "func", "abstractState", "(", "issue", "*", "github", ".", "Issue", ",", "config", "*", "moduleConfig", ")", "common", ".", "StoryState", "{", "if", "*", "issue", ".", "State", "==", "\"", "\"", "{", "return", "common", ".", "StoryStateAccepted", "\n", "...
// abstractState gets the given GitHub issues and returns the associated abstract state.
[ "abstractState", "gets", "the", "given", "GitHub", "issues", "and", "returns", "the", "associated", "abstract", "state", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/story_utils.go#L67-L123
154,412
salsaflow/salsaflow
modules/issue_tracking/github/story_utils.go
dedupeIssues
func dedupeIssues(issues []*github.Issue) []*github.Issue { set := make(map[int]struct{}, len(issues)) return filterIssues(issues, func(issue *github.Issue) bool { num := *issue.Number if _, seen := set[num]; seen { return false } set[num] = struct{}{} return true }) }
go
func dedupeIssues(issues []*github.Issue) []*github.Issue { set := make(map[int]struct{}, len(issues)) return filterIssues(issues, func(issue *github.Issue) bool { num := *issue.Number if _, seen := set[num]; seen { return false } set[num] = struct{}{} return true }) }
[ "func", "dedupeIssues", "(", "issues", "[", "]", "*", "github", ".", "Issue", ")", "[", "]", "*", "github", ".", "Issue", "{", "set", ":=", "make", "(", "map", "[", "int", "]", "struct", "{", "}", ",", "len", "(", "issues", ")", ")", "\n", "ret...
// dedupeIssues makes sure the list contains only 1 issue object for every issue number.
[ "dedupeIssues", "makes", "sure", "the", "list", "contains", "only", "1", "issue", "object", "for", "every", "issue", "number", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/issue_tracking/github/story_utils.go#L137-L147
154,413
seven5/seven5
dispatch.go
ServeHTTP
func (self *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { if self.err != nil { w = &ErrWrapper{w, r, self.err} } self.ServeMux.ServeHTTP(w, r) }
go
func (self *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { if self.err != nil { w = &ErrWrapper{w, r, self.err} } self.ServeMux.ServeHTTP(w, r) }
[ "func", "(", "self", "*", "ServeMux", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "self", ".", "err", "!=", "nil", "{", "w", "=", "&", "ErrWrapper", "{", "w", ",", "r", ",", ...
//ServeHTTP is a simple wrapper around the http.ServeMux method of the same name that incorporates //an error wrapper to allow it to implement the ErrorDispatcher protocol.
[ "ServeHTTP", "is", "a", "simple", "wrapper", "around", "the", "http", ".", "ServeMux", "method", "of", "the", "same", "name", "that", "incorporates", "an", "error", "wrapper", "to", "allow", "it", "to", "implement", "the", "ErrorDispatcher", "protocol", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/dispatch.go#L55-L60
154,414
seven5/seven5
dispatch.go
Dispatch
func (self *ServeMux) Dispatch(pattern string, dispatcher Dispatcher) { h := func(w http.ResponseWriter, r *http.Request) { defer func() { if err := recover(); err != nil { fmt.Fprintf(os.Stderr, "++++++++++++ PANIC +++++++++++++++++++\n") fmt.Fprintf(os.Stderr, "++++++++++++ ORIGINAL ERROR: %v ++++++++++++n", err) buf := make([]byte, 16384) l := runtime.Stack(buf, false) fmt.Fprintf(os.Stderr, "%s\n", string(buf[:l])) fmt.Fprintf(os.Stderr, "++++++++++++++++++++++++++++++++++++++\n") if self.err != nil { self.err.PanicDispatch(err, w, r) } else { fmt.Fprintf(os.Stderr, "++++++++++++ FORCING ANOTHER PANIC: %v ++++++++++++\n", err) panic(err) } } }() w.Header().Add("Cache-Control", "no-cache, must-revalidate") //HTTP 1.1 w.Header().Add("Pragma", "no-cache") //HTTP 1.0 b := dispatcher.Dispatch(self, w, r) if b != nil { b.ServeHTTP(w, r) } } self.ServeMux.HandleFunc(pattern, h) }
go
func (self *ServeMux) Dispatch(pattern string, dispatcher Dispatcher) { h := func(w http.ResponseWriter, r *http.Request) { defer func() { if err := recover(); err != nil { fmt.Fprintf(os.Stderr, "++++++++++++ PANIC +++++++++++++++++++\n") fmt.Fprintf(os.Stderr, "++++++++++++ ORIGINAL ERROR: %v ++++++++++++n", err) buf := make([]byte, 16384) l := runtime.Stack(buf, false) fmt.Fprintf(os.Stderr, "%s\n", string(buf[:l])) fmt.Fprintf(os.Stderr, "++++++++++++++++++++++++++++++++++++++\n") if self.err != nil { self.err.PanicDispatch(err, w, r) } else { fmt.Fprintf(os.Stderr, "++++++++++++ FORCING ANOTHER PANIC: %v ++++++++++++\n", err) panic(err) } } }() w.Header().Add("Cache-Control", "no-cache, must-revalidate") //HTTP 1.1 w.Header().Add("Pragma", "no-cache") //HTTP 1.0 b := dispatcher.Dispatch(self, w, r) if b != nil { b.ServeHTTP(w, r) } } self.ServeMux.HandleFunc(pattern, h) }
[ "func", "(", "self", "*", "ServeMux", ")", "Dispatch", "(", "pattern", "string", ",", "dispatcher", "Dispatcher", ")", "{", "h", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "defer", "func", ...
//Dispatch has the same function as "HandleFunc" on an http.ServeMux with the exception that //we require the Dispatcher interface rather than a "HandleFunc" function.
[ "Dispatch", "has", "the", "same", "function", "as", "HandleFunc", "on", "an", "http", ".", "ServeMux", "with", "the", "exception", "that", "we", "require", "the", "Dispatcher", "interface", "rather", "than", "a", "HandleFunc", "function", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/dispatch.go#L64-L91
154,415
seven5/seven5
dispatch.go
WriteHeader
func (self *ErrWrapper) WriteHeader(status int) { if (status / 100) > 2 { self.err.ErrorDispatch(status, self.ResponseWriter, self.req) } }
go
func (self *ErrWrapper) WriteHeader(status int) { if (status / 100) > 2 { self.err.ErrorDispatch(status, self.ResponseWriter, self.req) } }
[ "func", "(", "self", "*", "ErrWrapper", ")", "WriteHeader", "(", "status", "int", ")", "{", "if", "(", "status", "/", "100", ")", ">", "2", "{", "self", ".", "err", ".", "ErrorDispatch", "(", "status", ",", "self", ".", "ResponseWriter", ",", "self",...
//WriteHeader is a wrapper around the http.ResponseWriter method of the same name. It simply //traps status code writes of 300 or greater and calls the error dispatcher to handle it.
[ "WriteHeader", "is", "a", "wrapper", "around", "the", "http", ".", "ResponseWriter", "method", "of", "the", "same", "name", ".", "It", "simply", "traps", "status", "code", "writes", "of", "300", "or", "greater", "and", "calls", "the", "error", "dispatcher", ...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/dispatch.go#L103-L107
154,416
seven5/seven5
page.go
NewSimplePageMapper
func NewSimplePageMapper(errUrl string, loginUrl string, logoutUrl string) *SimplePageMapper { return &SimplePageMapper{ errorPage: errUrl, loginOk: loginUrl, logoutOk: logoutUrl, } }
go
func NewSimplePageMapper(errUrl string, loginUrl string, logoutUrl string) *SimplePageMapper { return &SimplePageMapper{ errorPage: errUrl, loginOk: loginUrl, logoutOk: logoutUrl, } }
[ "func", "NewSimplePageMapper", "(", "errUrl", "string", ",", "loginUrl", "string", ",", "logoutUrl", "string", ")", "*", "SimplePageMapper", "{", "return", "&", "SimplePageMapper", "{", "errorPage", ":", "errUrl", ",", "loginOk", ":", "loginUrl", ",", "logoutOk"...
//NewSimplePageMapper returns an PageMapper that has a simple mapping scheme for where //the application URLs just constants.
[ "NewSimplePageMapper", "returns", "an", "PageMapper", "that", "has", "a", "simple", "mapping", "scheme", "for", "where", "the", "application", "URLs", "just", "constants", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/page.go#L28-L34
154,417
seven5/seven5
page.go
ErrorPage
func (self *SimplePageMapper) ErrorPage(conn OauthConnector, errorText string) string { v := url.Values{ "service": []string{conn.Name()}, "error": []string{errorText}, } return fmt.Sprintf("%s?%s", self.errorPage, v.Encode()) }
go
func (self *SimplePageMapper) ErrorPage(conn OauthConnector, errorText string) string { v := url.Values{ "service": []string{conn.Name()}, "error": []string{errorText}, } return fmt.Sprintf("%s?%s", self.errorPage, v.Encode()) }
[ "func", "(", "self", "*", "SimplePageMapper", ")", "ErrorPage", "(", "conn", "OauthConnector", ",", "errorText", "string", ")", "string", "{", "v", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "conn", ".", "Name", "(", "...
//Returns the error page and passes the error text message and service name as query parameters to the //page.
[ "Returns", "the", "error", "page", "and", "passes", "the", "error", "text", "message", "and", "service", "name", "as", "query", "parameters", "to", "the", "page", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/page.go#L38-L44
154,418
seven5/seven5
page.go
LoginLandingPage
func (self *SimplePageMapper) LoginLandingPage(conn OauthConnector, state string, code string) string { v := url.Values{ "service": []string{conn.Name()}, "state": []string{state}, } return fmt.Sprintf("%s?%s", self.loginOk, v.Encode()) }
go
func (self *SimplePageMapper) LoginLandingPage(conn OauthConnector, state string, code string) string { v := url.Values{ "service": []string{conn.Name()}, "state": []string{state}, } return fmt.Sprintf("%s?%s", self.loginOk, v.Encode()) }
[ "func", "(", "self", "*", "SimplePageMapper", ")", "LoginLandingPage", "(", "conn", "OauthConnector", ",", "state", "string", ",", "code", "string", ")", "string", "{", "v", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "co...
//Returns the login landing page constant with the service name and state passed through as a query parameter. //Note, the 'code' probably should not be passed through the client side code!
[ "Returns", "the", "login", "landing", "page", "constant", "with", "the", "service", "name", "and", "state", "passed", "through", "as", "a", "query", "parameter", ".", "Note", "the", "code", "probably", "should", "not", "be", "passed", "through", "the", "clie...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/page.go#L48-L54
154,419
seven5/seven5
page.go
LogoutLandingPage
func (self *SimplePageMapper) LogoutLandingPage(conn OauthConnector) string { v := url.Values{ "service": []string{conn.Name()}, } return fmt.Sprintf("%s?%s", self.logoutOk, v.Encode()) }
go
func (self *SimplePageMapper) LogoutLandingPage(conn OauthConnector) string { v := url.Values{ "service": []string{conn.Name()}, } return fmt.Sprintf("%s?%s", self.logoutOk, v.Encode()) }
[ "func", "(", "self", "*", "SimplePageMapper", ")", "LogoutLandingPage", "(", "conn", "OauthConnector", ")", "string", "{", "v", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "conn", ".", "Name", "(", ")", "}", ",", "}", ...
//Returns the logout landing page constant. Add's the name of the service to the URL as a query parameter.
[ "Returns", "the", "logout", "landing", "page", "constant", ".", "Add", "s", "the", "name", "of", "the", "service", "to", "the", "URL", "as", "a", "query", "parameter", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/page.go#L57-L62
154,420
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go
compactCCC
func compactCCC() { m := make(map[uint8]uint8) for i := range chars { c := &chars[i] m[c.ccc] = 0 } cccs := []int{} for v, _ := range m { cccs = append(cccs, int(v)) } sort.Ints(cccs) for i, c := range cccs { cccMap[uint8(i)] = uint8(c) m[uint8(c)] = uint8(i) } for i := range chars { c := &chars[i] c.origCCC = c.ccc c.ccc = m[c.ccc] } if len(m) >= 1<<6 { log.Fatalf("too many difference CCC values: %d >= 64", len(m)) } }
go
func compactCCC() { m := make(map[uint8]uint8) for i := range chars { c := &chars[i] m[c.ccc] = 0 } cccs := []int{} for v, _ := range m { cccs = append(cccs, int(v)) } sort.Ints(cccs) for i, c := range cccs { cccMap[uint8(i)] = uint8(c) m[uint8(c)] = uint8(i) } for i := range chars { c := &chars[i] c.origCCC = c.ccc c.ccc = m[c.ccc] } if len(m) >= 1<<6 { log.Fatalf("too many difference CCC values: %d >= 64", len(m)) } }
[ "func", "compactCCC", "(", ")", "{", "m", ":=", "make", "(", "map", "[", "uint8", "]", "uint8", ")", "\n", "for", "i", ":=", "range", "chars", "{", "c", ":=", "&", "chars", "[", "i", "]", "\n", "m", "[", "c", ".", "ccc", "]", "=", "0", "\n"...
// compactCCC converts the sparse set of CCC values to a continguous one, // reducing the number of bits needed from 8 to 6.
[ "compactCCC", "converts", "the", "sparse", "set", "of", "CCC", "values", "to", "a", "continguous", "one", "reducing", "the", "number", "of", "bits", "needed", "from", "8", "to", "6", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go#L240-L263
154,421
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go
insertOrdered
func insertOrdered(b Decomposition, r rune) Decomposition { n := len(b) b = append(b, 0) cc := ccc(r) if cc > 0 { // Use bubble sort. for ; n > 0; n-- { if ccc(b[n-1]) <= cc { break } b[n] = b[n-1] } } b[n] = r return b }
go
func insertOrdered(b Decomposition, r rune) Decomposition { n := len(b) b = append(b, 0) cc := ccc(r) if cc > 0 { // Use bubble sort. for ; n > 0; n-- { if ccc(b[n-1]) <= cc { break } b[n] = b[n-1] } } b[n] = r return b }
[ "func", "insertOrdered", "(", "b", "Decomposition", ",", "r", "rune", ")", "Decomposition", "{", "n", ":=", "len", "(", "b", ")", "\n", "b", "=", "append", "(", "b", ",", "0", ")", "\n", "cc", ":=", "ccc", "(", "r", ")", "\n", "if", "cc", ">", ...
// Insert a rune in a buffer, ordered by Canonical Combining Class.
[ "Insert", "a", "rune", "in", "a", "buffer", "ordered", "by", "Canonical", "Combining", "Class", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go#L333-L348
154,422
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go
decomposeRecursive
func decomposeRecursive(form int, r rune, d Decomposition) Decomposition { dcomp := chars[r].forms[form].decomp if len(dcomp) == 0 { return insertOrdered(d, r) } for _, c := range dcomp { d = decomposeRecursive(form, c, d) } return d }
go
func decomposeRecursive(form int, r rune, d Decomposition) Decomposition { dcomp := chars[r].forms[form].decomp if len(dcomp) == 0 { return insertOrdered(d, r) } for _, c := range dcomp { d = decomposeRecursive(form, c, d) } return d }
[ "func", "decomposeRecursive", "(", "form", "int", ",", "r", "rune", ",", "d", "Decomposition", ")", "Decomposition", "{", "dcomp", ":=", "chars", "[", "r", "]", ".", "forms", "[", "form", "]", ".", "decomp", "\n", "if", "len", "(", "dcomp", ")", "=="...
// Recursively decompose.
[ "Recursively", "decompose", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go#L351-L360
154,423
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go
makeEntry
func makeEntry(f *FormInfo, c *Char) uint16 { e := uint16(0) if r := c.codePoint; HangulBase <= r && r < HangulEnd { e |= 0x40 } if f.combinesForward { e |= 0x20 } if f.quickCheck[MDecomposed] == QCNo { e |= 0x4 } switch f.quickCheck[MComposed] { case QCYes: case QCNo: e |= 0x10 case QCMaybe: e |= 0x18 default: log.Fatalf("Illegal quickcheck value %v.", f.quickCheck[MComposed]) } e |= uint16(c.nTrailingNonStarters) return e }
go
func makeEntry(f *FormInfo, c *Char) uint16 { e := uint16(0) if r := c.codePoint; HangulBase <= r && r < HangulEnd { e |= 0x40 } if f.combinesForward { e |= 0x20 } if f.quickCheck[MDecomposed] == QCNo { e |= 0x4 } switch f.quickCheck[MComposed] { case QCYes: case QCNo: e |= 0x10 case QCMaybe: e |= 0x18 default: log.Fatalf("Illegal quickcheck value %v.", f.quickCheck[MComposed]) } e |= uint16(c.nTrailingNonStarters) return e }
[ "func", "makeEntry", "(", "f", "*", "FormInfo", ",", "c", "*", "Char", ")", "uint16", "{", "e", ":=", "uint16", "(", "0", ")", "\n", "if", "r", ":=", "c", ".", "codePoint", ";", "HangulBase", "<=", "r", "&&", "r", "<", "HangulEnd", "{", "e", "|...
// See forminfo.go for format.
[ "See", "forminfo", ".", "go", "for", "format", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go#L524-L546
154,424
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go
verifyComputed
func verifyComputed() { for i, c := range chars { for _, f := range c.forms { isNo := (f.quickCheck[MDecomposed] == QCNo) if (len(f.decomp) > 0) != isNo && !isHangul(rune(i)) { log.Fatalf("%U: NF*D QC must be No if rune decomposes", i) } isMaybe := f.quickCheck[MComposed] == QCMaybe if f.combinesBackward != isMaybe { log.Fatalf("%U: NF*C QC must be Maybe if combinesBackward", i) } if len(f.decomp) > 0 && f.combinesForward && isMaybe { log.Fatalf("%U: NF*C QC must be Yes or No if combinesForward and decomposes", i) } if len(f.expandedDecomp) != 0 { continue } if a, b := c.nLeadingNonStarters > 0, (c.ccc > 0 || f.combinesBackward); a != b { // We accept these runes to be treated differently (it only affects // segment breaking in iteration, most likely on improper use), but // reconsider if more characters are added. // U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;; // U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;; // U+3133 HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;; // U+318E HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;; // U+FFA3 HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;; // U+FFDC HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;; if i != 0xFF9E && i != 0xFF9F && !(0x3133 <= i && i <= 0x318E) && !(0xFFA3 <= i && i <= 0xFFDC) { log.Fatalf("%U: nLead was %v; want %v", i, a, b) } } } nfc := c.forms[FCanonical] nfkc := c.forms[FCompatibility] if nfc.combinesBackward != nfkc.combinesBackward { log.Fatalf("%U: Cannot combine combinesBackward\n", c.codePoint) } } }
go
func verifyComputed() { for i, c := range chars { for _, f := range c.forms { isNo := (f.quickCheck[MDecomposed] == QCNo) if (len(f.decomp) > 0) != isNo && !isHangul(rune(i)) { log.Fatalf("%U: NF*D QC must be No if rune decomposes", i) } isMaybe := f.quickCheck[MComposed] == QCMaybe if f.combinesBackward != isMaybe { log.Fatalf("%U: NF*C QC must be Maybe if combinesBackward", i) } if len(f.decomp) > 0 && f.combinesForward && isMaybe { log.Fatalf("%U: NF*C QC must be Yes or No if combinesForward and decomposes", i) } if len(f.expandedDecomp) != 0 { continue } if a, b := c.nLeadingNonStarters > 0, (c.ccc > 0 || f.combinesBackward); a != b { // We accept these runes to be treated differently (it only affects // segment breaking in iteration, most likely on improper use), but // reconsider if more characters are added. // U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;; // U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;; // U+3133 HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;; // U+318E HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;; // U+FFA3 HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;; // U+FFDC HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;; if i != 0xFF9E && i != 0xFF9F && !(0x3133 <= i && i <= 0x318E) && !(0xFFA3 <= i && i <= 0xFFDC) { log.Fatalf("%U: nLead was %v; want %v", i, a, b) } } } nfc := c.forms[FCanonical] nfkc := c.forms[FCompatibility] if nfc.combinesBackward != nfkc.combinesBackward { log.Fatalf("%U: Cannot combine combinesBackward\n", c.codePoint) } } }
[ "func", "verifyComputed", "(", ")", "{", "for", "i", ",", "c", ":=", "range", "chars", "{", "for", "_", ",", "f", ":=", "range", "c", ".", "forms", "{", "isNo", ":=", "(", "f", ".", "quickCheck", "[", "MDecomposed", "]", "==", "QCNo", ")", "\n", ...
// verifyComputed does various consistency tests.
[ "verifyComputed", "does", "various", "consistency", "tests", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/maketables.go#L815-L855
154,425
seven5/seven5
client/collection.go
Equal
func (self EqList) Equal(o Equaler) bool { if o == nil { return false } other := o.(EqList) if len(other) == 0 { return false } curr := []Model(self) if len(curr) == 0 { return false } if len(curr) != len(other) { return false } for i, e := range other { if !curr[i].Equal(e) { return false } } return true }
go
func (self EqList) Equal(o Equaler) bool { if o == nil { return false } other := o.(EqList) if len(other) == 0 { return false } curr := []Model(self) if len(curr) == 0 { return false } if len(curr) != len(other) { return false } for i, e := range other { if !curr[i].Equal(e) { return false } } return true }
[ "func", "(", "self", "EqList", ")", "Equal", "(", "o", "Equaler", ")", "bool", "{", "if", "o", "==", "nil", "{", "return", "false", "\n", "}", "\n", "other", ":=", "o", ".", "(", "EqList", ")", "\n", "if", "len", "(", "other", ")", "==", "0", ...
//Equal handles comparison of our list to another collection. We define //equality to be is same length and has the same contents. Empty collections //are not equal to anything.
[ "Equal", "handles", "comparison", "of", "our", "list", "to", "another", "collection", ".", "We", "define", "equality", "to", "be", "is", "same", "length", "and", "has", "the", "same", "contents", ".", "Empty", "collections", "are", "not", "equal", "to", "a...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L30-L51
154,426
seven5/seven5
client/collection.go
EmptyAttribute
func (self *Collection) EmptyAttribute() BooleanAttribute { result := &computedEmpty{ NewAttribute(VALUE_ONLY, self.empty, nil), self, } //console.Log("emtpy attr is ", result.id()) newEdge(self.coll, result) //console.Log("introducing edge", self.id(), "to", result.id()) return result }
go
func (self *Collection) EmptyAttribute() BooleanAttribute { result := &computedEmpty{ NewAttribute(VALUE_ONLY, self.empty, nil), self, } //console.Log("emtpy attr is ", result.id()) newEdge(self.coll, result) //console.Log("introducing edge", self.id(), "to", result.id()) return result }
[ "func", "(", "self", "*", "Collection", ")", "EmptyAttribute", "(", ")", "BooleanAttribute", "{", "result", ":=", "&", "computedEmpty", "{", "NewAttribute", "(", "VALUE_ONLY", ",", "self", ".", "empty", ",", "nil", ")", ",", "self", ",", "}", "\n", "//co...
//EmptyAttribute should be used by callers to assess if the list is //is empty or not. It is a BooleanAttribute so it can be used in //constraint functions.
[ "EmptyAttribute", "should", "be", "used", "by", "callers", "to", "assess", "if", "the", "list", "is", "is", "empty", "or", "not", ".", "It", "is", "a", "BooleanAttribute", "so", "it", "can", "be", "used", "in", "constraint", "functions", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L80-L88
154,427
seven5/seven5
client/collection.go
LengthAttribute
func (self *Collection) LengthAttribute() IntegerAttribute { result := &computedLength{ NewAttribute(VALUE_ONLY, self.length, nil), self, } return result }
go
func (self *Collection) LengthAttribute() IntegerAttribute { result := &computedLength{ NewAttribute(VALUE_ONLY, self.length, nil), self, } return result }
[ "func", "(", "self", "*", "Collection", ")", "LengthAttribute", "(", ")", "IntegerAttribute", "{", "result", ":=", "&", "computedLength", "{", "NewAttribute", "(", "VALUE_ONLY", ",", "self", ".", "length", ",", "nil", ")", ",", "self", ",", "}", "\n", "r...
//LengthAttribute should be used by callers to assess how many items //are in the list. The return value is an attribute that can be used //in constraint functions.
[ "LengthAttribute", "should", "be", "used", "by", "callers", "to", "assess", "how", "many", "items", "are", "in", "the", "list", ".", "The", "return", "value", "is", "an", "attribute", "that", "can", "be", "used", "in", "constraint", "functions", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L117-L122
154,428
seven5/seven5
client/collection.go
PopRaw
func (self *Collection) PopRaw() Model { if self.coll.Demand() == nil || len(self.coll.Demand().(EqList)) == 0 { panic("can't pop from a empty ListNode!") } obj := self.coll.Demand().(EqList) self.coll.markDirty() result := obj[len(obj)-1] if len(obj) == 1 { self.coll.SetEqualer(nil) } else { self.coll.SetEqualer(obj[:len(obj)-1]) } if self.join != nil { for _, j := range self.join { j.Remove(len(obj)-1, result) } } return result }
go
func (self *Collection) PopRaw() Model { if self.coll.Demand() == nil || len(self.coll.Demand().(EqList)) == 0 { panic("can't pop from a empty ListNode!") } obj := self.coll.Demand().(EqList) self.coll.markDirty() result := obj[len(obj)-1] if len(obj) == 1 { self.coll.SetEqualer(nil) } else { self.coll.SetEqualer(obj[:len(obj)-1]) } if self.join != nil { for _, j := range self.join { j.Remove(len(obj)-1, result) } } return result }
[ "func", "(", "self", "*", "Collection", ")", "PopRaw", "(", ")", "Model", "{", "if", "self", ".", "coll", ".", "Demand", "(", ")", "==", "nil", "||", "len", "(", "self", ".", "coll", ".", "Demand", "(", ")", ".", "(", "EqList", ")", ")", "==", ...
//PopRaw is the way to access the last node of the list without any //checking. This will panic if the list is empty. This implies an //update to the length and empty attribute. If there are Joiners //they are called after the PopRaw completes.
[ "PopRaw", "is", "the", "way", "to", "access", "the", "last", "node", "of", "the", "list", "without", "any", "checking", ".", "This", "will", "panic", "if", "the", "list", "is", "empty", ".", "This", "implies", "an", "update", "to", "the", "length", "an...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L152-L173
154,429
seven5/seven5
client/collection.go
NewList
func NewList(joiner Joiner) *Collection { result := &Collection{ coll: NewAttribute(VALUE_ONLY, nil, nil), } if joiner != nil { result.join = []Joiner{joiner} } return result }
go
func NewList(joiner Joiner) *Collection { result := &Collection{ coll: NewAttribute(VALUE_ONLY, nil, nil), } if joiner != nil { result.join = []Joiner{joiner} } return result }
[ "func", "NewList", "(", "joiner", "Joiner", ")", "*", "Collection", "{", "result", ":=", "&", "Collection", "{", "coll", ":", "NewAttribute", "(", "VALUE_ONLY", ",", "nil", ",", "nil", ")", ",", "}", "\n", "if", "joiner", "!=", "nil", "{", "result", ...
//NewCollection returns an empty Collection. You should a supply a joiner here //if you want to run a transform on insert or remove from thelist. You can //pass nil if you don't need any joiner at the point you create the //collection.
[ "NewCollection", "returns", "an", "empty", "Collection", ".", "You", "should", "a", "supply", "a", "joiner", "here", "if", "you", "want", "to", "run", "a", "transform", "on", "insert", "or", "remove", "from", "thelist", ".", "You", "can", "pass", "nil", ...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L179-L187
154,430
seven5/seven5
client/collection.go
Remove
func (self *Collection) Remove(m Model) { obj := self.coll.Demand().(EqList) for i, e := range obj { //console.Log("demand checking %O %O", e, m) if e.Equal(m) { //last? if i == len(obj)-1 { self.PopRaw() } else { copy(obj[i:], obj[i+1:]) obj[len(obj)-1] = nil self.coll.SetEqualer(EqList(obj[:len(obj)-1])) if self.join != nil { for _, j := range self.join { j.Remove(i, m) } } } break } } }
go
func (self *Collection) Remove(m Model) { obj := self.coll.Demand().(EqList) for i, e := range obj { //console.Log("demand checking %O %O", e, m) if e.Equal(m) { //last? if i == len(obj)-1 { self.PopRaw() } else { copy(obj[i:], obj[i+1:]) obj[len(obj)-1] = nil self.coll.SetEqualer(EqList(obj[:len(obj)-1])) if self.join != nil { for _, j := range self.join { j.Remove(i, m) } } } break } } }
[ "func", "(", "self", "*", "Collection", ")", "Remove", "(", "m", "Model", ")", "{", "obj", ":=", "self", ".", "coll", ".", "Demand", "(", ")", ".", "(", "EqList", ")", "\n\n", "for", "i", ",", "e", ":=", "range", "obj", "{", "//console.Log(\"demand...
//Remove checks to see that the model is in the collection and //then removes it. If the element is in the collection multiple times, only //the first one is removed. Calling this on an empty collection is useless //but not an error. If the list has joiners, they are notified about //the removal of the element but after the removal //has occured. The object that was removed is supplied to the Joiner.
[ "Remove", "checks", "to", "see", "that", "the", "model", "is", "in", "the", "collection", "and", "then", "removes", "it", ".", "If", "the", "element", "is", "in", "the", "collection", "multiple", "times", "only", "the", "first", "one", "is", "removed", "...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L214-L236
154,431
seven5/seven5
client/collection.go
All
func (self *Collection) All() []Model { if self.coll.Demand() == nil { return nil } curr := self.coll.Demand().(EqList) result := make([]Model, len(curr)) for i, c := range curr { result[i] = c } return result }
go
func (self *Collection) All() []Model { if self.coll.Demand() == nil { return nil } curr := self.coll.Demand().(EqList) result := make([]Model, len(curr)) for i, c := range curr { result[i] = c } return result }
[ "func", "(", "self", "*", "Collection", ")", "All", "(", ")", "[", "]", "Model", "{", "if", "self", ".", "coll", ".", "Demand", "(", ")", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "curr", ":=", "self", ".", "coll", ".", "Demand", "(",...
//All returns all the models in this collection. This is a copy //of the objects internal data.
[ "All", "returns", "all", "the", "models", "in", "this", "collection", ".", "This", "is", "a", "copy", "of", "the", "objects", "internal", "data", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L240-L250
154,432
seven5/seven5
client/collection.go
AllFold
func (self *Collection) AllFold( targ Attribute, initial interface{}, puller Puller, folder FoldingIterator, empty Equaler) Constraint { result := &foldedConstraint{ fn: folder, initial: initial, pull: puller, targ: targ, empty: empty, } self.join = append(self.join, result) targ.Attach(result) return result }
go
func (self *Collection) AllFold( targ Attribute, initial interface{}, puller Puller, folder FoldingIterator, empty Equaler) Constraint { result := &foldedConstraint{ fn: folder, initial: initial, pull: puller, targ: targ, empty: empty, } self.join = append(self.join, result) targ.Attach(result) return result }
[ "func", "(", "self", "*", "Collection", ")", "AllFold", "(", "targ", "Attribute", ",", "initial", "interface", "{", "}", ",", "puller", "Puller", ",", "folder", "FoldingIterator", ",", "empty", "Equaler", ")", "Constraint", "{", "result", ":=", "&", "folde...
//AllFold creates a constraint that depends on the same //attribute in _every_ model in the collection. The attribute to be computed //is the first parameter. The initial value of the iterative folding //is the second argument, and fed to the Folder on the first iteration. //The puller is used whenever the models in the collection change to //extract a particular Attribute that the constraint depends on.
[ "AllFold", "creates", "a", "constraint", "that", "depends", "on", "the", "same", "attribute", "in", "_every_", "model", "in", "the", "collection", ".", "The", "attribute", "to", "be", "computed", "is", "the", "first", "parameter", ".", "The", "initial", "val...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/collection.go#L270-L289
154,433
salsaflow/salsaflow
config/config.go
writeConfig
func writeConfig(absolutePath string, content interface{}, perm os.FileMode) error { task := "Write a configuration file" // Check the configuration directory and make sure it exists. configDir := filepath.Dir(absolutePath) info, err := os.Stat(configDir) if err != nil { if !os.IsNotExist(err) { return errs.NewError(task, err) } // The directory doesn't exist. if err := os.MkdirAll(configDir, 0750); err != nil { return errs.NewError(task, err) } } if !info.IsDir() { return errs.NewError(task, errors.New("not a directory: "+configDir)) } // Marshal the content. raw, err := Marshal(content) if err != nil { return errs.NewError(task, err) } // Write the raw content into the file. if err := ioutil.WriteFile(absolutePath, raw, perm); err != nil { return errs.NewError(task, err) } return nil }
go
func writeConfig(absolutePath string, content interface{}, perm os.FileMode) error { task := "Write a configuration file" // Check the configuration directory and make sure it exists. configDir := filepath.Dir(absolutePath) info, err := os.Stat(configDir) if err != nil { if !os.IsNotExist(err) { return errs.NewError(task, err) } // The directory doesn't exist. if err := os.MkdirAll(configDir, 0750); err != nil { return errs.NewError(task, err) } } if !info.IsDir() { return errs.NewError(task, errors.New("not a directory: "+configDir)) } // Marshal the content. raw, err := Marshal(content) if err != nil { return errs.NewError(task, err) } // Write the raw content into the file. if err := ioutil.WriteFile(absolutePath, raw, perm); err != nil { return errs.NewError(task, err) } return nil }
[ "func", "writeConfig", "(", "absolutePath", "string", ",", "content", "interface", "{", "}", ",", "perm", "os", ".", "FileMode", ")", "error", "{", "task", ":=", "\"", "\"", "\n\n", "// Check the configuration directory and make sure it exists.", "configDir", ":=", ...
// WriteLocalConfig writes the given configuration struct // into the local configuration file. // // In case the target path does not exist, it is created, // including the parent directories. // // In case the file exists, it is truncated.
[ "WriteLocalConfig", "writes", "the", "given", "configuration", "struct", "into", "the", "local", "configuration", "file", ".", "In", "case", "the", "target", "path", "does", "not", "exist", "it", "is", "created", "including", "the", "parent", "directories", ".",...
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/config/config.go#L32-L63
154,434
salsaflow/salsaflow
pkg/common.go
doInstall
func doInstall( client *github.Client, owner string, repo string, assets []github.ReleaseAsset, version string, dstDir string, ) (err error) { // Choose the asset to be downloaded. task := "Pick the most suitable release asset" var ( assetName = getAssetName(version) assetURL string ) for _, asset := range assets { if *asset.Name == assetName { assetURL = *asset.BrowserDownloadURL } } if assetURL == "" { return errs.NewError(task, errors.New("no suitable release asset found")) } // Make sure the destination folder exists. task = "Make sure the destination directory exists" dstDir, act, err := ensureDstDirExists(dstDir) if err != nil { return errs.NewError(task, err) } defer action.RollbackOnError(&err, act) // Download the selected release asset. return downloadAndInstallAsset(assetName, assetURL, dstDir) }
go
func doInstall( client *github.Client, owner string, repo string, assets []github.ReleaseAsset, version string, dstDir string, ) (err error) { // Choose the asset to be downloaded. task := "Pick the most suitable release asset" var ( assetName = getAssetName(version) assetURL string ) for _, asset := range assets { if *asset.Name == assetName { assetURL = *asset.BrowserDownloadURL } } if assetURL == "" { return errs.NewError(task, errors.New("no suitable release asset found")) } // Make sure the destination folder exists. task = "Make sure the destination directory exists" dstDir, act, err := ensureDstDirExists(dstDir) if err != nil { return errs.NewError(task, err) } defer action.RollbackOnError(&err, act) // Download the selected release asset. return downloadAndInstallAsset(assetName, assetURL, dstDir) }
[ "func", "doInstall", "(", "client", "*", "github", ".", "Client", ",", "owner", "string", ",", "repo", "string", ",", "assets", "[", "]", "github", ".", "ReleaseAsset", ",", "version", "string", ",", "dstDir", "string", ",", ")", "(", "err", "error", "...
// doInstall performs the common step that both install and upgrade need to do. // // Given a GitHub release, it downloads and unpacks the fitting artifacts // and replaces the current executables with the ones just downloaded.
[ "doInstall", "performs", "the", "common", "step", "that", "both", "install", "and", "upgrade", "need", "to", "do", ".", "Given", "a", "GitHub", "release", "it", "downloads", "and", "unpacks", "the", "fitting", "artifacts", "and", "replaces", "the", "current", ...
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/pkg/common.go#L66-L100
154,435
GoBike/envflag
envflag.go
parseWithEnv
func (e Envflag) parseWithEnv(args []string) { if !e.Cli.Parsed() { e.Cli.Parse(args) } for name := range e.unsetFlags() { if val, ok := os.LookupEnv(maskEnvName(name)); ok { e.Cli.Set(name, val) } } }
go
func (e Envflag) parseWithEnv(args []string) { if !e.Cli.Parsed() { e.Cli.Parse(args) } for name := range e.unsetFlags() { if val, ok := os.LookupEnv(maskEnvName(name)); ok { e.Cli.Set(name, val) } } }
[ "func", "(", "e", "Envflag", ")", "parseWithEnv", "(", "args", "[", "]", "string", ")", "{", "if", "!", "e", ".", "Cli", ".", "Parsed", "(", ")", "{", "e", ".", "Cli", ".", "Parse", "(", "args", ")", "\n", "}", "\n\n", "for", "name", ":=", "r...
// parseWithEnv first parses cli-values into flag-values. Next, for any unset // flag-values, it attempts to lookup and load from environment variables, by flag-name.
[ "parseWithEnv", "first", "parses", "cli", "-", "values", "into", "flag", "-", "values", ".", "Next", "for", "any", "unset", "flag", "-", "values", "it", "attempts", "to", "lookup", "and", "load", "from", "environment", "variables", "by", "flag", "-", "name...
ae3268980a293939fc31d786fe86f1453333d386
https://github.com/GoBike/envflag/blob/ae3268980a293939fc31d786fe86f1453333d386/envflag.go#L28-L39
154,436
GoBike/envflag
envflag.go
maskEnvName
func maskEnvName(flagname string) string { var ret string ret = strings.Replace(flagname, "-", "_", -1) ret = strings.Replace(ret, ".", "_", -1) return strings.ToUpper(ret) }
go
func maskEnvName(flagname string) string { var ret string ret = strings.Replace(flagname, "-", "_", -1) ret = strings.Replace(ret, ".", "_", -1) return strings.ToUpper(ret) }
[ "func", "maskEnvName", "(", "flagname", "string", ")", "string", "{", "var", "ret", "string", "\n\n", "ret", "=", "strings", ".", "Replace", "(", "flagname", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "ret", "=", "strings", ".", "R...
// maskEnvName returns a qualified environement variable, naming convention.
[ "maskEnvName", "returns", "a", "qualified", "environement", "variable", "naming", "convention", "." ]
ae3268980a293939fc31d786fe86f1453333d386
https://github.com/GoBike/envflag/blob/ae3268980a293939fc31d786fe86f1453333d386/envflag.go#L42-L48
154,437
GoBike/envflag
envflag.go
unsetFlags
func (e Envflag) unsetFlags() map[string]struct{} { flags := make(map[string]struct{}) // get all flag-names. e.Cli.VisitAll(func(f *flag.Flag) { flags[f.Name] = struct{}{} }) // MINUS from set flag-names. e.Cli.Visit(func(f *flag.Flag) { delete(flags, f.Name) }) return flags }
go
func (e Envflag) unsetFlags() map[string]struct{} { flags := make(map[string]struct{}) // get all flag-names. e.Cli.VisitAll(func(f *flag.Flag) { flags[f.Name] = struct{}{} }) // MINUS from set flag-names. e.Cli.Visit(func(f *flag.Flag) { delete(flags, f.Name) }) return flags }
[ "func", "(", "e", "Envflag", ")", "unsetFlags", "(", ")", "map", "[", "string", "]", "struct", "{", "}", "{", "flags", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n\n", "// get all flag-names.", "e", ".", "Cli", ".", "V...
// unsetFlags returns flag-values that hasn't been set via CLI.
[ "unsetFlags", "returns", "flag", "-", "values", "that", "hasn", "t", "been", "set", "via", "CLI", "." ]
ae3268980a293939fc31d786fe86f1453333d386
https://github.com/GoBike/envflag/blob/ae3268980a293939fc31d786fe86f1453333d386/envflag.go#L51-L66
154,438
itchio/httpkit
rate/limiter.go
NewLimiter
func NewLimiter(opts LimiterOpts) Limiter { if opts.RequestsPerSecond <= 0 { panic("RequestsPerSecond must be > 0") } c := make(chan struct{}, opts.Burst) l := &limiter{ c: c, interval: time.Duration(1.0 / float64(opts.RequestsPerSecond) * float64(time.Second)), } go l.run() return l }
go
func NewLimiter(opts LimiterOpts) Limiter { if opts.RequestsPerSecond <= 0 { panic("RequestsPerSecond must be > 0") } c := make(chan struct{}, opts.Burst) l := &limiter{ c: c, interval: time.Duration(1.0 / float64(opts.RequestsPerSecond) * float64(time.Second)), } go l.run() return l }
[ "func", "NewLimiter", "(", "opts", "LimiterOpts", ")", "Limiter", "{", "if", "opts", ".", "RequestsPerSecond", "<=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "c", ":=", "make", "(", "chan", "struct", "{", "}", ",", "opts", ".", "...
// NewLimiter returns a new Limiter configured // to only allow rps requests per seconds.
[ "NewLimiter", "returns", "a", "new", "Limiter", "configured", "to", "only", "allow", "rps", "requests", "per", "seconds", "." ]
f7051ef345456d077d49344cf6ec98b4059214f5
https://github.com/itchio/httpkit/blob/f7051ef345456d077d49344cf6ec98b4059214f5/rate/limiter.go#L28-L40
154,439
seven5/seven5
client/float.go
Equal
func (self FloatEqualer) Equal(e Equaler) bool { return self.F == e.(FloatEqualer).F }
go
func (self FloatEqualer) Equal(e Equaler) bool { return self.F == e.(FloatEqualer).F }
[ "func", "(", "self", "FloatEqualer", ")", "Equal", "(", "e", "Equaler", ")", "bool", "{", "return", "self", ".", "F", "==", "e", ".", "(", "FloatEqualer", ")", ".", "F", "\n", "}" ]
//Equal compares two values, must be FloatEqualers, to see if they //are the same.
[ "Equal", "compares", "two", "values", "must", "be", "FloatEqualers", "to", "see", "if", "they", "are", "the", "same", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/float.go#L28-L30
154,440
seven5/seven5
client/float.go
NewFloatSimple
func NewFloatSimple(f float64) FloatAttribute { result := &FloatSimple{ NewAttribute(NORMAL, nil, nil), } result.Set(f) return result }
go
func NewFloatSimple(f float64) FloatAttribute { result := &FloatSimple{ NewAttribute(NORMAL, nil, nil), } result.Set(f) return result }
[ "func", "NewFloatSimple", "(", "f", "float64", ")", "FloatAttribute", "{", "result", ":=", "&", "FloatSimple", "{", "NewAttribute", "(", "NORMAL", ",", "nil", ",", "nil", ")", ",", "}", "\n", "result", ".", "Set", "(", "f", ")", "\n", "return", "result...
//NewFloatSimple creates a new FloatAttribute with a simple //float64 initial value.
[ "NewFloatSimple", "creates", "a", "new", "FloatAttribute", "with", "a", "simple", "float64", "initial", "value", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/float.go#L47-L53
154,441
salsaflow/salsaflow
git/config.go
LoadConfig
func LoadConfig() (*Config, error) { // Load the configuration according to the spec. task := "Load Git-related configuration" spec := newConfigSpec() if err := loader.LoadConfig(spec); err != nil { return nil, errs.NewError(task, err) } // Get the remote name, which may be stored in git config. task = "Get the remote name for the main project repository" remoteName, err := GetConfigString(GitConfigKeyRemote) if err != nil { return nil, errs.NewError(task, err) } if remoteName == "" { remoteName = DefaultRemoteName } // Return the main config struct. return &Config{ LocalConfig: *spec.local, RemoteName: remoteName, }, nil }
go
func LoadConfig() (*Config, error) { // Load the configuration according to the spec. task := "Load Git-related configuration" spec := newConfigSpec() if err := loader.LoadConfig(spec); err != nil { return nil, errs.NewError(task, err) } // Get the remote name, which may be stored in git config. task = "Get the remote name for the main project repository" remoteName, err := GetConfigString(GitConfigKeyRemote) if err != nil { return nil, errs.NewError(task, err) } if remoteName == "" { remoteName = DefaultRemoteName } // Return the main config struct. return &Config{ LocalConfig: *spec.local, RemoteName: remoteName, }, nil }
[ "func", "LoadConfig", "(", ")", "(", "*", "Config", ",", "error", ")", "{", "// Load the configuration according to the spec.", "task", ":=", "\"", "\"", "\n", "spec", ":=", "newConfigSpec", "(", ")", "\n", "if", "err", ":=", "loader", ".", "LoadConfig", "("...
// LoadConfig can be used to load Git-related configuration for SalsaFlow.
[ "LoadConfig", "can", "be", "used", "to", "load", "Git", "-", "related", "configuration", "for", "SalsaFlow", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/git/config.go#L27-L50
154,442
salsaflow/salsaflow
prompt/prompt.go
Prompt
func Prompt(msg string) (string, error) { stdin, err := OpenConsole(os.O_RDONLY) if err != nil { return "", err } defer stdin.Close() fmt.Print(msg) scanner := bufio.NewScanner(stdin) scanner.Scan() if err := scanner.Err(); err != nil { return "", err } input := scanner.Text() if input == "" { return "", ErrCanceled } return input, nil }
go
func Prompt(msg string) (string, error) { stdin, err := OpenConsole(os.O_RDONLY) if err != nil { return "", err } defer stdin.Close() fmt.Print(msg) scanner := bufio.NewScanner(stdin) scanner.Scan() if err := scanner.Err(); err != nil { return "", err } input := scanner.Text() if input == "" { return "", ErrCanceled } return input, nil }
[ "func", "Prompt", "(", "msg", "string", ")", "(", "string", ",", "error", ")", "{", "stdin", ",", "err", ":=", "OpenConsole", "(", "os", ".", "O_RDONLY", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n",...
// Prompt prints the given message and waits for user input. // In case the input is empty, ErrCanceled is returned.
[ "Prompt", "prints", "the", "given", "message", "and", "waits", "for", "user", "input", ".", "In", "case", "the", "input", "is", "empty", "ErrCanceled", "is", "returned", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/prompt/prompt.go#L88-L107
154,443
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
unpack
func (res *rpcResponse) unpack() (result map[string]interface{}, err error) { if res.Error != nil { err = fmt.Errorf(`Kodi error (%v): %v`, res.Error.Code, res.Error.Message) } else if res.Result != nil { result = *res.Result } else { log.WithField(`response`, res).Debug(`Received unknown response type from Kodi`) } return result, err }
go
func (res *rpcResponse) unpack() (result map[string]interface{}, err error) { if res.Error != nil { err = fmt.Errorf(`Kodi error (%v): %v`, res.Error.Code, res.Error.Message) } else if res.Result != nil { result = *res.Result } else { log.WithField(`response`, res).Debug(`Received unknown response type from Kodi`) } return result, err }
[ "func", "(", "res", "*", "rpcResponse", ")", "unpack", "(", ")", "(", "result", "map", "[", "string", "]", "interface", "{", "}", ",", "err", "error", ")", "{", "if", "res", ".", "Error", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", ...
// Unpack the result and any errors from the Response
[ "Unpack", "the", "result", "and", "any", "errors", "from", "the", "Response" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L172-L181
154,444
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
init
func (c *Connection) init(address string, timeout time.Duration) (err error) { if c.address == `` { c.address = address } if c.timeout == 0 && timeout != 0 { c.timeout = timeout } if err = c.connect(); err != nil { return err } c.write = make(chan interface{}, 16) c.Notifications = make(chan Notification, 16) c.responses = make(map[uint32]*chan *rpcResponse) go c.reader() go c.writer() rchan, _ := c.Send(Request{Method: `JSONRPC.Version`}, true) if err != nil { log.WithField(`error`, err).Error(`Connection closed`) return err } res, err := rchan.Read(c.timeout) if err != nil { log.WithField(`error`, err).Error(`Kodi responded`) return err } if version := res[`version`].(map[string]interface{}); version != nil { if version[`major`].(float64) < KODI_MIN_VERSION { return errors.New(`Kodi version too low, upgrade to Frodo or later`) } } return }
go
func (c *Connection) init(address string, timeout time.Duration) (err error) { if c.address == `` { c.address = address } if c.timeout == 0 && timeout != 0 { c.timeout = timeout } if err = c.connect(); err != nil { return err } c.write = make(chan interface{}, 16) c.Notifications = make(chan Notification, 16) c.responses = make(map[uint32]*chan *rpcResponse) go c.reader() go c.writer() rchan, _ := c.Send(Request{Method: `JSONRPC.Version`}, true) if err != nil { log.WithField(`error`, err).Error(`Connection closed`) return err } res, err := rchan.Read(c.timeout) if err != nil { log.WithField(`error`, err).Error(`Kodi responded`) return err } if version := res[`version`].(map[string]interface{}); version != nil { if version[`major`].(float64) < KODI_MIN_VERSION { return errors.New(`Kodi version too low, upgrade to Frodo or later`) } } return }
[ "func", "(", "c", "*", "Connection", ")", "init", "(", "address", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "err", "error", ")", "{", "if", "c", ".", "address", "==", "``", "{", "c", ".", "address", "=", "address", "\n", "}", "...
// init brings up an instance of the Kodi Connection
[ "init", "brings", "up", "an", "instance", "of", "the", "Kodi", "Connection" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L184-L223
154,445
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
connected
func (c *Connection) connected(status bool) { c.connectedLock.Lock() defer c.connectedLock.Unlock() c.Connected = status }
go
func (c *Connection) connected(status bool) { c.connectedLock.Lock() defer c.connectedLock.Unlock() c.Connected = status }
[ "func", "(", "c", "*", "Connection", ")", "connected", "(", "status", "bool", ")", "{", "c", ".", "connectedLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connectedLock", ".", "Unlock", "(", ")", "\n", "c", ".", "Connected", "=", "status", ...
// connected sets whether we're currently connected or not
[ "connected", "sets", "whether", "we", "re", "currently", "connected", "or", "not" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L261-L265
154,446
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
connect
func (c *Connection) connect() (err error) { c.connected(false) c.connectLock.Lock() defer c.connectLock.Unlock() // If we blocked on the lock, and another routine connected in the mean // time, return early if c.Connected { return } if c.conn != nil { _ = c.conn.Close() } c.conn, err = net.Dial(`tcp`, c.address) if err != nil { success := make(chan bool, 1) done := make(chan bool, 1) go func() { for err != nil { log.WithField(`error`, err).Error(`Connecting to Kodi`) log.Info(`Attempting reconnect...`) time.Sleep(time.Second) c.conn, err = net.Dial(`tcp`, c.address) select { case <-done: break default: } } success <- true }() if c.timeout > 0 { select { case <-success: case <-time.After(c.timeout * time.Second): done <- true log.Error(`Timeout connecting to Kodi`) return err } } else { <-success } } c.enc = json.NewEncoder(c.conn) c.dec = json.NewDecoder(c.conn) log.Info(`Connected to Kodi`) c.connected(true) return }
go
func (c *Connection) connect() (err error) { c.connected(false) c.connectLock.Lock() defer c.connectLock.Unlock() // If we blocked on the lock, and another routine connected in the mean // time, return early if c.Connected { return } if c.conn != nil { _ = c.conn.Close() } c.conn, err = net.Dial(`tcp`, c.address) if err != nil { success := make(chan bool, 1) done := make(chan bool, 1) go func() { for err != nil { log.WithField(`error`, err).Error(`Connecting to Kodi`) log.Info(`Attempting reconnect...`) time.Sleep(time.Second) c.conn, err = net.Dial(`tcp`, c.address) select { case <-done: break default: } } success <- true }() if c.timeout > 0 { select { case <-success: case <-time.After(c.timeout * time.Second): done <- true log.Error(`Timeout connecting to Kodi`) return err } } else { <-success } } c.enc = json.NewEncoder(c.conn) c.dec = json.NewDecoder(c.conn) log.Info(`Connected to Kodi`) c.connected(true) return }
[ "func", "(", "c", "*", "Connection", ")", "connect", "(", ")", "(", "err", "error", ")", "{", "c", ".", "connected", "(", "false", ")", "\n", "c", ".", "connectLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connectLock", ".", "Unlock", "...
// connect establishes a TCP connection
[ "connect", "establishes", "a", "TCP", "connection" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L268-L321
154,447
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
writer
func (c *Connection) writer() { for { var req interface{} req = <-c.write for err := c.enc.Encode(req); err != nil; { log.WithField(`error`, err).Warn(`Failed encoding request for Kodi`) if err = c.connect(); err != nil { continue } err = c.enc.Encode(req) } } }
go
func (c *Connection) writer() { for { var req interface{} req = <-c.write for err := c.enc.Encode(req); err != nil; { log.WithField(`error`, err).Warn(`Failed encoding request for Kodi`) if err = c.connect(); err != nil { continue } err = c.enc.Encode(req) } } }
[ "func", "(", "c", "*", "Connection", ")", "writer", "(", ")", "{", "for", "{", "var", "req", "interface", "{", "}", "\n", "req", "=", "<-", "c", ".", "write", "\n", "for", "err", ":=", "c", ".", "enc", ".", "Encode", "(", "req", ")", ";", "er...
// writer loop processes outbound requests
[ "writer", "loop", "processes", "outbound", "requests" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L324-L336
154,448
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
reader
func (c *Connection) reader() { for { res := new(rpcResponse) err := c.dec.Decode(res) if _, ok := err.(net.Error); err == io.EOF || ok { log.WithField(`error`, err).Error(`Reading from Kodi`) log.Error(`If this error persists, make sure you are using the JSON-RPC port, not the HTTP port!`) for err != nil { err = c.connect() } } else if err != nil { log.WithField(`error`, err).Error(`Decoding response from Kodi`) continue } if res.Id == nil && res.Method != nil { c.notificationWait.Add(1) // Process notifications in a separate routine so we don't delay the // processing of standard responses. This does mean losing ordering // guarantees for notifications. go func() { if res.Params != nil { log.WithFields(log.Fields{ `notification.Method`: *res.Method, `notification.Params`: *res.Params, }).Debug(`Received notification from Kodi`) } else { log.WithField(`notification.Method`, *res.Method).Debug(`Received notification from Kodi`) } n := Notification{} n.Method = *res.Method err := mapstructure.Decode(res.Params, &n.Params) if err != nil { log.WithField(`notification.Method`, *res.Method).Warn(`Decoding notifcation failed`) return } // Implement notification writes as a ring buffer. // In case the client is not processing notifications, we don't // want to block indefinitely here, instead drop the oldest // notification after 200ms, and log a warning select { case c.Notifications <- n: case <-time.After(200 * time.Millisecond): <-c.Notifications c.Notifications <- n log.Warn(`Dropped oldest notification, buffer full`) } c.notificationWait.Done() }() } else if res.Id != nil { if ch := c.responses[uint32(*res.Id)]; ch != nil { if res.Result != nil { log.WithField(`response.Result`, *res.Result).Debug(`Received response from Kodi`) } *ch <- res } else { log.WithField(`response.Id`, *res.Id).Warn(`Received Kodi response for unknown request`) log.WithField(`connection.responses`, c.responses).Debug(`Current response channels`) } } else { if res.Error != nil { log.WithField(`response.Error`, *res.Error).Warn(`Received unparseable Kodi response`) } else { log.WithField(`response`, res).Warn(`Received unparseable Kodi response`) } } } }
go
func (c *Connection) reader() { for { res := new(rpcResponse) err := c.dec.Decode(res) if _, ok := err.(net.Error); err == io.EOF || ok { log.WithField(`error`, err).Error(`Reading from Kodi`) log.Error(`If this error persists, make sure you are using the JSON-RPC port, not the HTTP port!`) for err != nil { err = c.connect() } } else if err != nil { log.WithField(`error`, err).Error(`Decoding response from Kodi`) continue } if res.Id == nil && res.Method != nil { c.notificationWait.Add(1) // Process notifications in a separate routine so we don't delay the // processing of standard responses. This does mean losing ordering // guarantees for notifications. go func() { if res.Params != nil { log.WithFields(log.Fields{ `notification.Method`: *res.Method, `notification.Params`: *res.Params, }).Debug(`Received notification from Kodi`) } else { log.WithField(`notification.Method`, *res.Method).Debug(`Received notification from Kodi`) } n := Notification{} n.Method = *res.Method err := mapstructure.Decode(res.Params, &n.Params) if err != nil { log.WithField(`notification.Method`, *res.Method).Warn(`Decoding notifcation failed`) return } // Implement notification writes as a ring buffer. // In case the client is not processing notifications, we don't // want to block indefinitely here, instead drop the oldest // notification after 200ms, and log a warning select { case c.Notifications <- n: case <-time.After(200 * time.Millisecond): <-c.Notifications c.Notifications <- n log.Warn(`Dropped oldest notification, buffer full`) } c.notificationWait.Done() }() } else if res.Id != nil { if ch := c.responses[uint32(*res.Id)]; ch != nil { if res.Result != nil { log.WithField(`response.Result`, *res.Result).Debug(`Received response from Kodi`) } *ch <- res } else { log.WithField(`response.Id`, *res.Id).Warn(`Received Kodi response for unknown request`) log.WithField(`connection.responses`, c.responses).Debug(`Current response channels`) } } else { if res.Error != nil { log.WithField(`response.Error`, *res.Error).Warn(`Received unparseable Kodi response`) } else { log.WithField(`response`, res).Warn(`Received unparseable Kodi response`) } } } }
[ "func", "(", "c", "*", "Connection", ")", "reader", "(", ")", "{", "for", "{", "res", ":=", "new", "(", "rpcResponse", ")", "\n", "err", ":=", "c", ".", "dec", ".", "Decode", "(", "res", ")", "\n", "if", "_", ",", "ok", ":=", "err", ".", "(",...
// reader loop processes inbound responses and notifications
[ "reader", "loop", "processes", "inbound", "responses", "and", "notifications" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L339-L405
154,449
StreamBoat/kodi_jsonrpc
kodi_jsonrpc.go
Close
func (c *Connection) Close() { if c.Closed { return } c.Closed = true if c.write != nil { c.writeWait.Wait() close(c.write) } if c.Notifications != nil { c.notificationWait.Wait() close(c.Notifications) } if c.conn != nil { _ = c.conn.Close() } log.Info(`Disconnected from Kodi`) }
go
func (c *Connection) Close() { if c.Closed { return } c.Closed = true if c.write != nil { c.writeWait.Wait() close(c.write) } if c.Notifications != nil { c.notificationWait.Wait() close(c.Notifications) } if c.conn != nil { _ = c.conn.Close() } log.Info(`Disconnected from Kodi`) }
[ "func", "(", "c", "*", "Connection", ")", "Close", "(", ")", "{", "if", "c", ".", "Closed", "{", "return", "\n", "}", "\n", "c", ".", "Closed", "=", "true", "\n\n", "if", "c", ".", "write", "!=", "nil", "{", "c", ".", "writeWait", ".", "Wait", ...
// Close closes the Kodi connection and associated channels // Subsequent Sends will return an error for closed connections
[ "Close", "closes", "the", "Kodi", "connection", "and", "associated", "channels", "Subsequent", "Sends", "will", "return", "an", "error", "for", "closed", "connections" ]
f460e79493dfc9b072ed715f3ae677db107a5d32
https://github.com/StreamBoat/kodi_jsonrpc/blob/f460e79493dfc9b072ed715f3ae677db107a5d32/kodi_jsonrpc.go#L409-L428
154,450
seven5/seven5
deploy.go
NewHerokuDeploy
func NewHerokuDeploy(herokuName string, appName string) *HerokuDeploy { result := &HerokuDeploy{ herokuName: herokuName, appName: appName, } return result }
go
func NewHerokuDeploy(herokuName string, appName string) *HerokuDeploy { result := &HerokuDeploy{ herokuName: herokuName, appName: appName, } return result }
[ "func", "NewHerokuDeploy", "(", "herokuName", "string", ",", "appName", "string", ")", "*", "HerokuDeploy", "{", "result", ":=", "&", "HerokuDeploy", "{", "herokuName", ":", "herokuName", ",", "appName", ":", "appName", ",", "}", "\n", "return", "result", "\...
//NewHerokuDeploy returns a new HerokuDeploy object that implements DeploymentEnvironment. //The first parameter is the _host_ name on heroku, typically like damp-sierra-7161. //The second parameter is the application's name locally, like myproject.
[ "NewHerokuDeploy", "returns", "a", "new", "HerokuDeploy", "object", "that", "implements", "DeploymentEnvironment", ".", "The", "first", "parameter", "is", "the", "_host_", "name", "on", "heroku", "typically", "like", "damp", "-", "sierra", "-", "7161", ".", "The...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/deploy.go#L25-L31
154,451
seven5/seven5
deploy.go
Port
func (self *HerokuDeploy) Port() int { p := os.Getenv("PORT") if p == "" { panic("PORT not defined") } i, err := strconv.Atoi(p) if err != nil { panic(err) } return i }
go
func (self *HerokuDeploy) Port() int { p := os.Getenv("PORT") if p == "" { panic("PORT not defined") } i, err := strconv.Atoi(p) if err != nil { panic(err) } return i }
[ "func", "(", "self", "*", "HerokuDeploy", ")", "Port", "(", ")", "int", "{", "p", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "p", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "i", ",", "err", ":="...
//Port reads the value of the environment variable PORT to get the value to return here. It //will panic if the environment variable is not set or it's not a number.
[ "Port", "reads", "the", "value", "of", "the", "environment", "variable", "PORT", "to", "get", "the", "value", "to", "return", "here", ".", "It", "will", "panic", "if", "the", "environment", "variable", "is", "not", "set", "or", "it", "s", "not", "a", "...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/deploy.go#L50-L60
154,452
seven5/seven5
deploy.go
RedirectHost
func (self *HerokuDeploy) RedirectHost() string { if self.IsTest() { return fmt.Sprintf(REDIRECT_HOST_TEST, self.Port()) } return fmt.Sprintf(HEROKU_HOST, self.herokuName) }
go
func (self *HerokuDeploy) RedirectHost() string { if self.IsTest() { return fmt.Sprintf(REDIRECT_HOST_TEST, self.Port()) } return fmt.Sprintf(HEROKU_HOST, self.herokuName) }
[ "func", "(", "self", "*", "HerokuDeploy", ")", "RedirectHost", "(", ")", "string", "{", "if", "self", ".", "IsTest", "(", ")", "{", "return", "fmt", ".", "Sprintf", "(", "REDIRECT_HOST_TEST", ",", "self", ".", "Port", "(", ")", ")", "\n", "}", "\n", ...
//RedirectHost is needed in cases where you are using oauth because this must sent to the //"other side" of the handshake without any extra knowlege.
[ "RedirectHost", "is", "needed", "in", "cases", "where", "you", "are", "using", "oauth", "because", "this", "must", "sent", "to", "the", "other", "side", "of", "the", "handshake", "without", "any", "extra", "knowlege", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/deploy.go#L64-L69
154,453
andrestc/docker-machine-driver-cloudstack
cloudstack.go
GetIP
func (d *Driver) GetIP() (string, error) { if d.UsePrivateIP { return d.PrivateIP, nil } return d.PublicIP, nil }
go
func (d *Driver) GetIP() (string, error) { if d.UsePrivateIP { return d.PrivateIP, nil } return d.PublicIP, nil }
[ "func", "(", "d", "*", "Driver", ")", "GetIP", "(", ")", "(", "string", ",", "error", ")", "{", "if", "d", ".", "UsePrivateIP", "{", "return", "d", ".", "PrivateIP", ",", "nil", "\n", "}", "\n", "return", "d", ".", "PublicIP", ",", "nil", "\n", ...
// GetIP returns the IP that this host is available at
[ "GetIP", "returns", "the", "IP", "that", "this", "host", "is", "available", "at" ]
563f3c06f14033aec0a80225e63615aa531ff88f
https://github.com/andrestc/docker-machine-driver-cloudstack/blob/563f3c06f14033aec0a80225e63615aa531ff88f/cloudstack.go#L307-L312
154,454
andrestc/docker-machine-driver-cloudstack
cloudstack.go
PreCreateCheck
func (d *Driver) PreCreateCheck() error { if err := d.checkKeyPair(); err != nil { return err } if err := d.checkInstance(); err != nil { return err } return nil }
go
func (d *Driver) PreCreateCheck() error { if err := d.checkKeyPair(); err != nil { return err } if err := d.checkInstance(); err != nil { return err } return nil }
[ "func", "(", "d", "*", "Driver", ")", "PreCreateCheck", "(", ")", "error", "{", "if", "err", ":=", "d", ".", "checkKeyPair", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "d", ".", "checkInstance", ...
// PreCreate allows for pre-create operations to make sure a driver is ready for creation
[ "PreCreate", "allows", "for", "pre", "-", "create", "operations", "to", "make", "sure", "a", "driver", "is", "ready", "for", "creation" ]
563f3c06f14033aec0a80225e63615aa531ff88f
https://github.com/andrestc/docker-machine-driver-cloudstack/blob/563f3c06f14033aec0a80225e63615aa531ff88f/cloudstack.go#L353-L364
154,455
andrestc/docker-machine-driver-cloudstack
cloudstack.go
Restart
func (d *Driver) Restart() error { vmstate, err := d.GetState() if err != nil { return err } if vmstate == state.Stopped { return fmt.Errorf("Machine is stopped, use start command to start it") } cs := d.getClient() p := cs.VirtualMachine.NewRebootVirtualMachineParams(d.Id) if _, err = cs.VirtualMachine.RebootVirtualMachine(p); err != nil { return err } return nil }
go
func (d *Driver) Restart() error { vmstate, err := d.GetState() if err != nil { return err } if vmstate == state.Stopped { return fmt.Errorf("Machine is stopped, use start command to start it") } cs := d.getClient() p := cs.VirtualMachine.NewRebootVirtualMachineParams(d.Id) if _, err = cs.VirtualMachine.RebootVirtualMachine(p); err != nil { return err } return nil }
[ "func", "(", "d", "*", "Driver", ")", "Restart", "(", ")", "error", "{", "vmstate", ",", "err", ":=", "d", ".", "GetState", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "vmstate", "==", "state", ".", ...
// Restart a host.
[ "Restart", "a", "host", "." ]
563f3c06f14033aec0a80225e63615aa531ff88f
https://github.com/andrestc/docker-machine-driver-cloudstack/blob/563f3c06f14033aec0a80225e63615aa531ff88f/cloudstack.go#L516-L534
154,456
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
postAssignedReviewRequest
func postAssignedReviewRequest( config *moduleConfig, owner string, repo string, story common.Story, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Search for an existing review issue for the given story. task := fmt.Sprintf("Search for an existing review issue for story %v", story.ReadableId()) log.Run(task) client := ghutil.NewClient(config.Token) issue, err := ghissues.FindReviewIssueForStory(client, owner, repo, story.ReadableId()) if err != nil { return nil, nil, errs.NewError(task, err) } // Decide what to do next based on the search results. if issue == nil { // No review issue found for the given story, create a new issue. issue, err := createAssignedReviewRequest(config, owner, repo, story, commits, opts) if err != nil { return nil, nil, err } return issue, commits, nil } // An existing review issue found, extend it. return extendReviewRequest(config, owner, repo, issue, commits, opts) }
go
func postAssignedReviewRequest( config *moduleConfig, owner string, repo string, story common.Story, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Search for an existing review issue for the given story. task := fmt.Sprintf("Search for an existing review issue for story %v", story.ReadableId()) log.Run(task) client := ghutil.NewClient(config.Token) issue, err := ghissues.FindReviewIssueForStory(client, owner, repo, story.ReadableId()) if err != nil { return nil, nil, errs.NewError(task, err) } // Decide what to do next based on the search results. if issue == nil { // No review issue found for the given story, create a new issue. issue, err := createAssignedReviewRequest(config, owner, repo, story, commits, opts) if err != nil { return nil, nil, err } return issue, commits, nil } // An existing review issue found, extend it. return extendReviewRequest(config, owner, repo, issue, commits, opts) }
[ "func", "postAssignedReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "story", "common", ".", "Story", ",", "commits", "[", "]", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "in...
// postAssignedReviewRequest can be used to post // the commits associated with the given story for review.
[ "postAssignedReviewRequest", "can", "be", "used", "to", "post", "the", "commits", "associated", "with", "the", "given", "story", "for", "review", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L171-L202
154,457
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
createAssignedReviewRequest
func createAssignedReviewRequest( config *moduleConfig, owner string, repo string, story common.Story, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, error) { task := fmt.Sprintf("Create review issue for story %v", story.ReadableId()) // Prepare the issue object. reviewIssue := ghissues.NewStoryReviewIssue( story.ReadableId(), story.URL(), story.Title(), story.IssueTracker().ServiceName(), story.Tag()) for _, commit := range commits { reviewIssue.AddCommit(false, commit.SHA, commit.MessageTitle) } // Get the right review milestone to add the issue into. milestone, err := getOrCreateMilestoneForCommit( config, owner, repo, commits[len(commits)-1].SHA) if err != nil { return nil, errs.NewError(task, err) } // Create a new review issue. var implemented bool implementedOpt, ok := opts["implemented"] if ok { implemented = implementedOpt.(bool) } issue, err := createIssue( task, config, owner, repo, reviewIssue.FormatTitle(), reviewIssue.FormatBody(), optValueString(opts["reviewer"]), milestone, implemented) if err != nil { return nil, errs.NewError(task, err) } return issue, nil }
go
func createAssignedReviewRequest( config *moduleConfig, owner string, repo string, story common.Story, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, error) { task := fmt.Sprintf("Create review issue for story %v", story.ReadableId()) // Prepare the issue object. reviewIssue := ghissues.NewStoryReviewIssue( story.ReadableId(), story.URL(), story.Title(), story.IssueTracker().ServiceName(), story.Tag()) for _, commit := range commits { reviewIssue.AddCommit(false, commit.SHA, commit.MessageTitle) } // Get the right review milestone to add the issue into. milestone, err := getOrCreateMilestoneForCommit( config, owner, repo, commits[len(commits)-1].SHA) if err != nil { return nil, errs.NewError(task, err) } // Create a new review issue. var implemented bool implementedOpt, ok := opts["implemented"] if ok { implemented = implementedOpt.(bool) } issue, err := createIssue( task, config, owner, repo, reviewIssue.FormatTitle(), reviewIssue.FormatBody(), optValueString(opts["reviewer"]), milestone, implemented) if err != nil { return nil, errs.NewError(task, err) } return issue, nil }
[ "func", "createAssignedReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "story", "common", ".", "Story", ",", "commits", "[", "]", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "...
// createAssignedReviewRequest can be used to create a new review issue // for the given commits that is associated with the story passed in.
[ "createAssignedReviewRequest", "can", "be", "used", "to", "create", "a", "new", "review", "issue", "for", "the", "given", "commits", "that", "is", "associated", "with", "the", "story", "passed", "in", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L206-L251
154,458
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
postUnassignedReviewRequest
func postUnassignedReviewRequest( config *moduleConfig, owner string, repo string, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Search for an existing issue. task := fmt.Sprintf("Search for an existing review issue for commit %v", commit.SHA) log.Run(task) client := ghutil.NewClient(config.Token) issue, err := ghissues.FindReviewIssueForCommit(client, owner, repo, commit.SHA) if err != nil { return nil, nil, errs.NewError(task, err) } // Return an error in case the issue for the given commit already exists. if issue != nil { issueNum := *issue.Number err = fmt.Errorf("existing review issue found for commit %v: %v", commit.SHA, issueNum) return nil, nil, errs.NewError("Make sure the review issue can be created", err) } // Create a new unassigned review request. issue, err = createUnassignedReviewRequest(config, owner, repo, commit, opts) if err != nil { return nil, nil, err } return issue, []*git.Commit{commit}, nil }
go
func postUnassignedReviewRequest( config *moduleConfig, owner string, repo string, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Search for an existing issue. task := fmt.Sprintf("Search for an existing review issue for commit %v", commit.SHA) log.Run(task) client := ghutil.NewClient(config.Token) issue, err := ghissues.FindReviewIssueForCommit(client, owner, repo, commit.SHA) if err != nil { return nil, nil, errs.NewError(task, err) } // Return an error in case the issue for the given commit already exists. if issue != nil { issueNum := *issue.Number err = fmt.Errorf("existing review issue found for commit %v: %v", commit.SHA, issueNum) return nil, nil, errs.NewError("Make sure the review issue can be created", err) } // Create a new unassigned review request. issue, err = createUnassignedReviewRequest(config, owner, repo, commit, opts) if err != nil { return nil, nil, err } return issue, []*git.Commit{commit}, nil }
[ "func", "postUnassignedReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "commit", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "interface", "{", "}", ",", ")", "(", "*", "github...
// postUnassignedReviewRequest can be used to post the given commit for review. // This function is to be used to post commits that are not associated with any story.
[ "postUnassignedReviewRequest", "can", "be", "used", "to", "post", "the", "given", "commit", "for", "review", ".", "This", "function", "is", "to", "be", "used", "to", "post", "commits", "that", "are", "not", "associated", "with", "any", "story", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L255-L286
154,459
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
createUnassignedReviewRequest
func createUnassignedReviewRequest( config *moduleConfig, owner string, repo string, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, error) { task := fmt.Sprintf("Create review issue for commit %v", commit.SHA) // Prepare the issue object. reviewIssue := ghissues.NewCommitReviewIssue(commit.SHA, commit.MessageTitle) // Get the right review milestone to add the issue into. milestone, err := getOrCreateMilestoneForCommit(config, owner, repo, commit.SHA) if err != nil { return nil, errs.NewError(task, err) } // Create a new review issue. issue, err := createIssue( task, config, owner, repo, reviewIssue.FormatTitle(), reviewIssue.FormatBody(), optValueString(opts["reviewer"]), milestone, true) if err != nil { return nil, errs.NewError(task, err) } return issue, nil }
go
func createUnassignedReviewRequest( config *moduleConfig, owner string, repo string, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, error) { task := fmt.Sprintf("Create review issue for commit %v", commit.SHA) // Prepare the issue object. reviewIssue := ghissues.NewCommitReviewIssue(commit.SHA, commit.MessageTitle) // Get the right review milestone to add the issue into. milestone, err := getOrCreateMilestoneForCommit(config, owner, repo, commit.SHA) if err != nil { return nil, errs.NewError(task, err) } // Create a new review issue. issue, err := createIssue( task, config, owner, repo, reviewIssue.FormatTitle(), reviewIssue.FormatBody(), optValueString(opts["reviewer"]), milestone, true) if err != nil { return nil, errs.NewError(task, err) } return issue, nil }
[ "func", "createUnassignedReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "commit", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "interface", "{", "}", ",", ")", "(", "*", "gith...
// createUnassignedReviewRequest created a new review issue // for the given commit that is not associated with any story.
[ "createUnassignedReviewRequest", "created", "a", "new", "review", "issue", "for", "the", "given", "commit", "that", "is", "not", "associated", "with", "any", "story", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L290-L318
154,460
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
extendUnassignedReviewRequest
func extendUnassignedReviewRequest( config *moduleConfig, owner string, repo string, issueNum int, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Fetch the issue. task := fmt.Sprintf("Fetch GitHub issue #%v", issueNum) log.Run(task) client := ghutil.NewClient(config.Token) issue, _, err := client.Issues.Get(owner, repo, issueNum) if err != nil { return nil, nil, errs.NewError(task, err) } // Extend the given review issue. return extendReviewRequest(config, owner, repo, issue, []*git.Commit{commit}, opts) }
go
func extendUnassignedReviewRequest( config *moduleConfig, owner string, repo string, issueNum int, commit *git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { // Fetch the issue. task := fmt.Sprintf("Fetch GitHub issue #%v", issueNum) log.Run(task) client := ghutil.NewClient(config.Token) issue, _, err := client.Issues.Get(owner, repo, issueNum) if err != nil { return nil, nil, errs.NewError(task, err) } // Extend the given review issue. return extendReviewRequest(config, owner, repo, issue, []*git.Commit{commit}, opts) }
[ "func", "extendUnassignedReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "issueNum", "int", ",", "commit", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "interface", "{", "}", ","...
// extendUnassignedReviewRequest can be used to upload fixes for // the specified unassigned review issue.
[ "extendUnassignedReviewRequest", "can", "be", "used", "to", "upload", "fixes", "for", "the", "specified", "unassigned", "review", "issue", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L322-L342
154,461
salsaflow/salsaflow
modules/code_review/github/code_review_tool.go
extendReviewRequest
func extendReviewRequest( config *moduleConfig, owner string, repo string, issue *github.Issue, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { issueNum := *issue.Number // Parse the issue. task := fmt.Sprintf("Parse review issue #%v", issueNum) reviewIssue, err := ghissues.ParseReviewIssue(issue) if err != nil { return nil, nil, errs.NewError(task, err) } // Add the commits. newCommits := make([]*git.Commit, 0, len(commits)) for _, commit := range commits { if reviewIssue.AddCommit(false, commit.SHA, commit.MessageTitle) { newCommits = append(newCommits, commit) } } if len(newCommits) == 0 { log.Log(fmt.Sprintf("All commits already listed in issue #%v", issueNum)) return issue, nil, nil } // Add the implemented label if necessary. var ( implemented bool implementedLabel = config.StoryImplementedLabel labelsPtr *[]string ) implementedOpt, ok := opts["implemented"] if ok { implemented = implementedOpt.(bool) } if implemented { labels := make([]string, 0, len(issue.Labels)+1) labelsPtr = &labels for _, label := range issue.Labels { if *label.Name == implementedLabel { // The label is already there, for some reason. // Set the pointer to nil so that we don't update labels. labelsPtr = nil break } labels = append(labels, *label.Name) } if labelsPtr != nil { labels = append(labels, implementedLabel) } } // Edit the issue. task = fmt.Sprintf("Update GitHub issue #%v", issueNum) log.Run(task) client := ghutil.NewClient(config.Token) updatedIssue, _, err := client.Issues.Edit(owner, repo, issueNum, &github.IssueRequest{ Body: github.String(reviewIssue.FormatBody()), State: github.String("open"), Labels: labelsPtr, }) if err != nil { return nil, nil, errs.NewError(task, err) } // Add the review comment. if err := addReviewComment(config, owner, repo, issueNum, newCommits); err != nil { return nil, nil, err } return updatedIssue, newCommits, nil }
go
func extendReviewRequest( config *moduleConfig, owner string, repo string, issue *github.Issue, commits []*git.Commit, opts map[string]interface{}, ) (*github.Issue, []*git.Commit, error) { issueNum := *issue.Number // Parse the issue. task := fmt.Sprintf("Parse review issue #%v", issueNum) reviewIssue, err := ghissues.ParseReviewIssue(issue) if err != nil { return nil, nil, errs.NewError(task, err) } // Add the commits. newCommits := make([]*git.Commit, 0, len(commits)) for _, commit := range commits { if reviewIssue.AddCommit(false, commit.SHA, commit.MessageTitle) { newCommits = append(newCommits, commit) } } if len(newCommits) == 0 { log.Log(fmt.Sprintf("All commits already listed in issue #%v", issueNum)) return issue, nil, nil } // Add the implemented label if necessary. var ( implemented bool implementedLabel = config.StoryImplementedLabel labelsPtr *[]string ) implementedOpt, ok := opts["implemented"] if ok { implemented = implementedOpt.(bool) } if implemented { labels := make([]string, 0, len(issue.Labels)+1) labelsPtr = &labels for _, label := range issue.Labels { if *label.Name == implementedLabel { // The label is already there, for some reason. // Set the pointer to nil so that we don't update labels. labelsPtr = nil break } labels = append(labels, *label.Name) } if labelsPtr != nil { labels = append(labels, implementedLabel) } } // Edit the issue. task = fmt.Sprintf("Update GitHub issue #%v", issueNum) log.Run(task) client := ghutil.NewClient(config.Token) updatedIssue, _, err := client.Issues.Edit(owner, repo, issueNum, &github.IssueRequest{ Body: github.String(reviewIssue.FormatBody()), State: github.String("open"), Labels: labelsPtr, }) if err != nil { return nil, nil, errs.NewError(task, err) } // Add the review comment. if err := addReviewComment(config, owner, repo, issueNum, newCommits); err != nil { return nil, nil, err } return updatedIssue, newCommits, nil }
[ "func", "extendReviewRequest", "(", "config", "*", "moduleConfig", ",", "owner", "string", ",", "repo", "string", ",", "issue", "*", "github", ".", "Issue", ",", "commits", "[", "]", "*", "git", ".", "Commit", ",", "opts", "map", "[", "string", "]", "i...
// extendReviewRequest is a general function that can be used to extend // the given review issue with the given list of commits.
[ "extendReviewRequest", "is", "a", "general", "function", "that", "can", "be", "used", "to", "extend", "the", "given", "review", "issue", "with", "the", "given", "list", "of", "commits", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/modules/code_review/github/code_review_tool.go#L346-L424
154,462
seven5/seven5
todomvc/main.go
Equal
func (self *todo) Equal(e s5.Equaler) bool { if e == nil { return false } other := e.(*todo) return self.Id() == other.Id() }
go
func (self *todo) Equal(e s5.Equaler) bool { if e == nil { return false } other := e.(*todo) return self.Id() == other.Id() }
[ "func", "(", "self", "*", "todo", ")", "Equal", "(", "e", "s5", ".", "Equaler", ")", "bool", "{", "if", "e", "==", "nil", "{", "return", "false", "\n", "}", "\n", "other", ":=", "e", ".", "(", "*", "todo", ")", "\n", "return", "self", ".", "I...
//Equal is used to compare two todo items. They are the same if they //have the same Id.
[ "Equal", "is", "used", "to", "compare", "two", "todo", "items", ".", "They", "are", "the", "same", "if", "they", "have", "the", "same", "Id", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L62-L68
154,463
seven5/seven5
todomvc/main.go
newTodo
func newTodo(raw string) *todo { result := &todo{ name: s5.NewStringSimple(raw), done: s5.NewBooleanSimple(false), editing: s5.NewBooleanSimple(false), } result.modName = s5.NewModelName(result) return result }
go
func newTodo(raw string) *todo { result := &todo{ name: s5.NewStringSimple(raw), done: s5.NewBooleanSimple(false), editing: s5.NewBooleanSimple(false), } result.modName = s5.NewModelName(result) return result }
[ "func", "newTodo", "(", "raw", "string", ")", "*", "todo", "{", "result", ":=", "&", "todo", "{", "name", ":", "s5", ".", "NewStringSimple", "(", "raw", ")", ",", "done", ":", "s5", ".", "NewBooleanSimple", "(", "false", ")", ",", "editing", ":", "...
//newTodo creates a new todo list item for a given string. Note that the //three primary elements are Attributes so the constraint system can operate //on them. The value provided is used to initialize the displayed text.
[ "newTodo", "creates", "a", "new", "todo", "list", "item", "for", "a", "given", "string", ".", "Note", "that", "the", "three", "primary", "elements", "are", "Attributes", "so", "the", "constraint", "system", "can", "operate", "on", "them", ".", "The", "valu...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L73-L81
154,464
seven5/seven5
todomvc/main.go
Start
func (self *todoApp) Start() { //Setup an event handler for the primary input field. The called func //creates model instance and puts in the list of todos. // JQUERY: Any use of jquery is suspect as it allows many non type-safe operations. primaryInput.Dom().On(s5.CHANGE, func(event jquery.Event) { if !self.createTodo(primaryInput.Dom().Val()) { event.PreventDefault() } }) //We need to attach the self.numNotDone string to the proper place //in the DOM. Note that we use the lower-level jquery selector //(Select().Children())) plus NewTextAttr() we needed the string //child of span#todo-count (so we can't use HtmlId) and because //that object is directly in the HTML file. // JQUERY: Any use of jquery is suspect as it allows many non type-safe operations. selector := jquery.NewJQuery(todoCount.TagName() + "#" + todoCount.Id()) todoCountSelect := selector.Children("strong") s5.Equality(s5.NewTextAttr(s5.WrapJQuery(todoCountSelect)), self.numNotDone) //We need to attach the self.plural string to the proper place //in the dom. s5.Equality(pluralSpan.TextAttribute(), self.plural) //These two calls attach the inverse of the empty attribute derived //from the model collection the display property (turning them on //when the list is not empty). Note that we can't use the simpler //"Equality()" because we want to invert the value. The BooleanInverter //is a built in constraint function. sectionMain.DisplayAttribute().Attach( s5.NewBooleanInverter(self.todos.EmptyAttribute())) footer.DisplayAttribute().Attach( s5.NewBooleanInverter(self.todos.EmptyAttribute())) //This connects the display property of the clearCompleted to the boolean //that is true if some of the elements are done. This effectively //turns on the button when there are some elements in the list and //some of those elements are done. s5.Equality(clearCompleted.DisplayAttribute(), self.someDone) //This connects the display in the button to the number of done //elements. Note that this wont be visible if there are no //done elements. s5.Equality(numCompleted.TextAttribute(), self.numDone) //This is the event handler for click on the clearCompleted //dom element. We just walk the list of objects building a kill list, //then we destroy all the items in the kill list //JQUERY: Neither of the jquery params are used. clearCompleted.Dom().On(s5.CLICK, func(jquery.Event) { all := self.todos.All() if len(all) == 0 { return } dead := make([]s5.Model, len(all)) ct := 0 for _, model := range all { if model.(*todo).done.Value() { dead[ct] = model ct++ } } for _, d := range dead { self.todos.Remove(d) } }) //toggleAll's behavior is to toggle any items that are not already //marked done, unless they are all marked done in which they should all //be umarked //JQUERY: Neither of the jquery params are used. toggleAll.Dom().On(s5.CLICK, func(jquery.Event) { desired := true //Compare the output of the constraints to see if all are done if self.todos.LengthAttribute().Value() == self.numDone.Value() { desired = false } for _, m := range self.todos.All() { m.(*todo).done.Set(desired) } }) //These are discussed below. These are constraints that depend //on *all* the values in the list. self.dependsOnAll() }
go
func (self *todoApp) Start() { //Setup an event handler for the primary input field. The called func //creates model instance and puts in the list of todos. // JQUERY: Any use of jquery is suspect as it allows many non type-safe operations. primaryInput.Dom().On(s5.CHANGE, func(event jquery.Event) { if !self.createTodo(primaryInput.Dom().Val()) { event.PreventDefault() } }) //We need to attach the self.numNotDone string to the proper place //in the DOM. Note that we use the lower-level jquery selector //(Select().Children())) plus NewTextAttr() we needed the string //child of span#todo-count (so we can't use HtmlId) and because //that object is directly in the HTML file. // JQUERY: Any use of jquery is suspect as it allows many non type-safe operations. selector := jquery.NewJQuery(todoCount.TagName() + "#" + todoCount.Id()) todoCountSelect := selector.Children("strong") s5.Equality(s5.NewTextAttr(s5.WrapJQuery(todoCountSelect)), self.numNotDone) //We need to attach the self.plural string to the proper place //in the dom. s5.Equality(pluralSpan.TextAttribute(), self.plural) //These two calls attach the inverse of the empty attribute derived //from the model collection the display property (turning them on //when the list is not empty). Note that we can't use the simpler //"Equality()" because we want to invert the value. The BooleanInverter //is a built in constraint function. sectionMain.DisplayAttribute().Attach( s5.NewBooleanInverter(self.todos.EmptyAttribute())) footer.DisplayAttribute().Attach( s5.NewBooleanInverter(self.todos.EmptyAttribute())) //This connects the display property of the clearCompleted to the boolean //that is true if some of the elements are done. This effectively //turns on the button when there are some elements in the list and //some of those elements are done. s5.Equality(clearCompleted.DisplayAttribute(), self.someDone) //This connects the display in the button to the number of done //elements. Note that this wont be visible if there are no //done elements. s5.Equality(numCompleted.TextAttribute(), self.numDone) //This is the event handler for click on the clearCompleted //dom element. We just walk the list of objects building a kill list, //then we destroy all the items in the kill list //JQUERY: Neither of the jquery params are used. clearCompleted.Dom().On(s5.CLICK, func(jquery.Event) { all := self.todos.All() if len(all) == 0 { return } dead := make([]s5.Model, len(all)) ct := 0 for _, model := range all { if model.(*todo).done.Value() { dead[ct] = model ct++ } } for _, d := range dead { self.todos.Remove(d) } }) //toggleAll's behavior is to toggle any items that are not already //marked done, unless they are all marked done in which they should all //be umarked //JQUERY: Neither of the jquery params are used. toggleAll.Dom().On(s5.CLICK, func(jquery.Event) { desired := true //Compare the output of the constraints to see if all are done if self.todos.LengthAttribute().Value() == self.numDone.Value() { desired = false } for _, m := range self.todos.All() { m.(*todo).done.Set(desired) } }) //These are discussed below. These are constraints that depend //on *all* the values in the list. self.dependsOnAll() }
[ "func", "(", "self", "*", "todoApp", ")", "Start", "(", ")", "{", "//Setup an event handler for the primary input field. The called func", "//creates model instance and puts in the list of todos.", "// JQUERY: Any use of jquery is suspect as it allows many non type-safe operations.", "prim...
//Start is called by concorde once the DOM is fully loaded. Most of the //application intialization code should be put in here.
[ "Start", "is", "called", "by", "concorde", "once", "the", "DOM", "is", "fully", "loaded", ".", "Most", "of", "the", "application", "intialization", "code", "should", "be", "put", "in", "here", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L112-L198
154,465
seven5/seven5
todomvc/main.go
createTodo
func (self *todoApp) createTodo(v string) bool { result := strings.Trim(v, CUTSET) if result == "" { return false } primaryInput.Dom().SetVal("") //note: we just push it into the list and let the constraint system //note: take over in terms of updating the display todo := newTodo(result) self.todos.PushRaw(todo) return true }
go
func (self *todoApp) createTodo(v string) bool { result := strings.Trim(v, CUTSET) if result == "" { return false } primaryInput.Dom().SetVal("") //note: we just push it into the list and let the constraint system //note: take over in terms of updating the display todo := newTodo(result) self.todos.PushRaw(todo) return true }
[ "func", "(", "self", "*", "todoApp", ")", "createTodo", "(", "v", "string", ")", "bool", "{", "result", ":=", "strings", ".", "Trim", "(", "v", ",", "CUTSET", ")", "\n", "if", "result", "==", "\"", "\"", "{", "return", "false", "\n", "}", "\n", "...
//called from the UI when the user hits return in the primary type-in //field. We return false if we want the input to be ignored.
[ "called", "from", "the", "UI", "when", "the", "user", "hits", "return", "in", "the", "primary", "type", "-", "in", "field", ".", "We", "return", "false", "if", "we", "want", "the", "input", "to", "be", "ignored", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L202-L213
154,466
seven5/seven5
todomvc/main.go
newApp
func newApp() *todoApp { result := &todoApp{} //init the list, setting our own object as the joiner (we meet //the interface Joiner) result.todos = s5.NewList(result) //create initial values of attributes result.numNotDone = s5.NewIntegerSimple(0) result.plural = s5.NewStringSimple("") result.someDone = s5.NewBooleanSimple(false) result.numDone = s5.NewIntegerSimple(0) //done create app object return result }
go
func newApp() *todoApp { result := &todoApp{} //init the list, setting our own object as the joiner (we meet //the interface Joiner) result.todos = s5.NewList(result) //create initial values of attributes result.numNotDone = s5.NewIntegerSimple(0) result.plural = s5.NewStringSimple("") result.someDone = s5.NewBooleanSimple(false) result.numDone = s5.NewIntegerSimple(0) //done create app object return result }
[ "func", "newApp", "(", ")", "*", "todoApp", "{", "result", ":=", "&", "todoApp", "{", "}", "\n", "//init the list, setting our own object as the joiner (we meet", "//the interface Joiner)", "result", ".", "todos", "=", "s5", ".", "NewList", "(", "result", ")", "\n...
//newApp creates a new instance of the application object, properly //initialized
[ "newApp", "creates", "a", "new", "instance", "of", "the", "application", "object", "properly", "initialized" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L217-L231
154,467
seven5/seven5
todomvc/main.go
pullDone
func (self *todoApp) pullDone(m s5.Model) s5.Attribute { return m.(*todo).done }
go
func (self *todoApp) pullDone(m s5.Model) s5.Attribute { return m.(*todo).done }
[ "func", "(", "self", "*", "todoApp", ")", "pullDone", "(", "m", "s5", ".", "Model", ")", "s5", ".", "Attribute", "{", "return", "m", ".", "(", "*", "todo", ")", ".", "done", "\n", "}" ]
//helper function for getting the done attribute out of our model
[ "helper", "function", "for", "getting", "the", "done", "attribute", "out", "of", "our", "model" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/todomvc/main.go#L234-L236
154,468
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
Init
func (i *Iter) Init(f Form, src []byte) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.init(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIBytes i.info = i.rb.f.info(i.rb.src, i.p) }
go
func (i *Iter) Init(f Form, src []byte) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.init(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIBytes i.info = i.rb.f.info(i.rb.src, i.p) }
[ "func", "(", "i", "*", "Iter", ")", "Init", "(", "f", "Form", ",", "src", "[", "]", "byte", ")", "{", "i", ".", "p", "=", "0", "\n", "if", "len", "(", "src", ")", "==", "0", "{", "i", ".", "setDone", "(", ")", "\n", "i", ".", "rb", ".",...
// Init initializes i to iterate over src after normalizing it to Form f.
[ "Init", "initializes", "i", "to", "iterate", "over", "src", "after", "normalizing", "it", "to", "Form", "f", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L32-L44
154,469
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
InitString
func (i *Iter) InitString(f Form, src string) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.initString(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIString i.info = i.rb.f.info(i.rb.src, i.p) }
go
func (i *Iter) InitString(f Form, src string) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.initString(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIString i.info = i.rb.f.info(i.rb.src, i.p) }
[ "func", "(", "i", "*", "Iter", ")", "InitString", "(", "f", "Form", ",", "src", "string", ")", "{", "i", ".", "p", "=", "0", "\n", "if", "len", "(", "src", ")", "==", "0", "{", "i", ".", "setDone", "(", ")", "\n", "i", ".", "rb", ".", "ns...
// InitString initializes i to iterate over src after normalizing it to Form f.
[ "InitString", "initializes", "i", "to", "iterate", "over", "src", "after", "normalizing", "it", "to", "Form", "f", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L47-L59
154,470
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
Seek
func (i *Iter) Seek(offset int64, whence int) (int64, error) { var abs int64 switch whence { case 0: abs = offset case 1: abs = int64(i.p) + offset case 2: abs = int64(i.rb.nsrc) + offset default: return 0, fmt.Errorf("norm: invalid whence") } if abs < 0 { return 0, fmt.Errorf("norm: negative position") } if int(abs) >= i.rb.nsrc { i.setDone() return int64(i.p), nil } i.p = int(abs) i.multiSeg = nil i.next = i.rb.f.nextMain i.info = i.rb.f.info(i.rb.src, i.p) return abs, nil }
go
func (i *Iter) Seek(offset int64, whence int) (int64, error) { var abs int64 switch whence { case 0: abs = offset case 1: abs = int64(i.p) + offset case 2: abs = int64(i.rb.nsrc) + offset default: return 0, fmt.Errorf("norm: invalid whence") } if abs < 0 { return 0, fmt.Errorf("norm: negative position") } if int(abs) >= i.rb.nsrc { i.setDone() return int64(i.p), nil } i.p = int(abs) i.multiSeg = nil i.next = i.rb.f.nextMain i.info = i.rb.f.info(i.rb.src, i.p) return abs, nil }
[ "func", "(", "i", "*", "Iter", ")", "Seek", "(", "offset", "int64", ",", "whence", "int", ")", "(", "int64", ",", "error", ")", "{", "var", "abs", "int64", "\n", "switch", "whence", "{", "case", "0", ":", "abs", "=", "offset", "\n", "case", "1", ...
// Seek sets the segment to be returned by the next call to Next to start // at position p. It is the responsibility of the caller to set p to the // start of a UTF8 rune.
[ "Seek", "sets", "the", "segment", "to", "be", "returned", "by", "the", "next", "call", "to", "Next", "to", "start", "at", "position", "p", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "set", "p", "to", "the", "start", "of", ...
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L64-L88
154,471
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
nextMulti
func nextMulti(i *Iter) []byte { j := 0 d := i.multiSeg // skip first rune for j = 1; j < len(d) && !utf8.RuneStart(d[j]); j++ { } for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.multiSeg = d[j:] return d[:j] } j += int(info.size) } // treat last segment as normal decomposition i.next = i.rb.f.nextMain return i.next(i) }
go
func nextMulti(i *Iter) []byte { j := 0 d := i.multiSeg // skip first rune for j = 1; j < len(d) && !utf8.RuneStart(d[j]); j++ { } for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.multiSeg = d[j:] return d[:j] } j += int(info.size) } // treat last segment as normal decomposition i.next = i.rb.f.nextMain return i.next(i) }
[ "func", "nextMulti", "(", "i", "*", "Iter", ")", "[", "]", "byte", "{", "j", ":=", "0", "\n", "d", ":=", "i", ".", "multiSeg", "\n", "// skip first rune", "for", "j", "=", "1", ";", "j", "<", "len", "(", "d", ")", "&&", "!", "utf8", ".", "Run...
// nextMulti is used for iterating over multi-segment decompositions // for decomposing normal forms.
[ "nextMulti", "is", "used", "for", "iterating", "over", "multi", "-", "segment", "decompositions", "for", "decomposing", "normal", "forms", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L178-L195
154,472
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
nextMultiNorm
func nextMultiNorm(i *Iter) []byte { j := 0 d := i.multiSeg for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.rb.compose() seg := i.buf[:i.rb.flushCopy(i.buf[:])] i.rb.ss.first(info) i.rb.insertUnsafe(input{bytes: d}, j, info) i.multiSeg = d[j+int(info.size):] return seg } i.rb.ss.next(info) i.rb.insertUnsafe(input{bytes: d}, j, info) j += int(info.size) } i.multiSeg = nil i.next = nextComposed return doNormComposed(i) }
go
func nextMultiNorm(i *Iter) []byte { j := 0 d := i.multiSeg for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.rb.compose() seg := i.buf[:i.rb.flushCopy(i.buf[:])] i.rb.ss.first(info) i.rb.insertUnsafe(input{bytes: d}, j, info) i.multiSeg = d[j+int(info.size):] return seg } i.rb.ss.next(info) i.rb.insertUnsafe(input{bytes: d}, j, info) j += int(info.size) } i.multiSeg = nil i.next = nextComposed return doNormComposed(i) }
[ "func", "nextMultiNorm", "(", "i", "*", "Iter", ")", "[", "]", "byte", "{", "j", ":=", "0", "\n", "d", ":=", "i", ".", "multiSeg", "\n", "for", "j", "<", "len", "(", "d", ")", "{", "info", ":=", "i", ".", "rb", ".", "f", ".", "info", "(", ...
// nextMultiNorm is used for iterating over multi-segment decompositions // for composing normal forms.
[ "nextMultiNorm", "is", "used", "for", "iterating", "over", "multi", "-", "segment", "decompositions", "for", "composing", "normal", "forms", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L199-L219
154,473
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go
nextComposed
func nextComposed(i *Iter) []byte { outp, startp := 0, i.p var prevCC uint8 ss := mkStreamSafe(i.info) for { if !i.info.isYesC() { goto doNorm } prevCC = i.info.tccc sz := int(i.info.size) if sz == 0 { sz = 1 // illegal rune: copy byte-by-byte } p := outp + sz if p > len(i.buf) { break } outp = p i.p += sz if i.p >= i.rb.nsrc { i.setDone() break } else if i.rb.src._byte(i.p) < utf8.RuneSelf { i.next = i.asciiF break } i.info = i.rb.f.info(i.rb.src, i.p) if v := ss.next(i.info); v == ssStarter { break } else if v == ssOverflow { i.next = nextCGJCompose break } if i.info.ccc < prevCC { goto doNorm } } return i.returnSlice(startp, i.p) doNorm: i.p = startp i.info = i.rb.f.info(i.rb.src, i.p) if i.info.multiSegment() { d := i.info.Decomposition() info := i.rb.f.info(input{bytes: d}, 0) i.rb.insertUnsafe(input{bytes: d}, 0, info) i.multiSeg = d[int(info.size):] i.next = nextMultiNorm return nextMultiNorm(i) } i.rb.ss.first(i.info) i.rb.insertUnsafe(i.rb.src, i.p, i.info) return doNormComposed(i) }
go
func nextComposed(i *Iter) []byte { outp, startp := 0, i.p var prevCC uint8 ss := mkStreamSafe(i.info) for { if !i.info.isYesC() { goto doNorm } prevCC = i.info.tccc sz := int(i.info.size) if sz == 0 { sz = 1 // illegal rune: copy byte-by-byte } p := outp + sz if p > len(i.buf) { break } outp = p i.p += sz if i.p >= i.rb.nsrc { i.setDone() break } else if i.rb.src._byte(i.p) < utf8.RuneSelf { i.next = i.asciiF break } i.info = i.rb.f.info(i.rb.src, i.p) if v := ss.next(i.info); v == ssStarter { break } else if v == ssOverflow { i.next = nextCGJCompose break } if i.info.ccc < prevCC { goto doNorm } } return i.returnSlice(startp, i.p) doNorm: i.p = startp i.info = i.rb.f.info(i.rb.src, i.p) if i.info.multiSegment() { d := i.info.Decomposition() info := i.rb.f.info(input{bytes: d}, 0) i.rb.insertUnsafe(input{bytes: d}, 0, info) i.multiSeg = d[int(info.size):] i.next = nextMultiNorm return nextMultiNorm(i) } i.rb.ss.first(i.info) i.rb.insertUnsafe(i.rb.src, i.p, i.info) return doNormComposed(i) }
[ "func", "nextComposed", "(", "i", "*", "Iter", ")", "[", "]", "byte", "{", "outp", ",", "startp", ":=", "0", ",", "i", ".", "p", "\n", "var", "prevCC", "uint8", "\n", "ss", ":=", "mkStreamSafe", "(", "i", ".", "info", ")", "\n", "for", "{", "if...
// nextComposed is the implementation of Next for forms NFC and NFKC.
[ "nextComposed", "is", "the", "implementation", "of", "Next", "for", "forms", "NFC", "and", "NFKC", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/iter.go#L365-L417
154,474
salsaflow/salsaflow
version/version.go
Set
func (v *Version) Set(versionString string) error { ver, err := Parse(versionString) if err != nil { return err } v.Version = ver.Version return nil }
go
func (v *Version) Set(versionString string) error { ver, err := Parse(versionString) if err != nil { return err } v.Version = ver.Version return nil }
[ "func", "(", "v", "*", "Version", ")", "Set", "(", "versionString", "string", ")", "error", "{", "ver", ",", "err", ":=", "Parse", "(", "versionString", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "v", ".", "Version"...
// Set implements flag.Value interface.
[ "Set", "implements", "flag", ".", "Value", "interface", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/version/version.go#L110-L117
154,475
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/transform.go
Transform
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { n := 0 // Cap the maximum number of src bytes to check. b := src eof := atEOF if ns := len(dst); ns < len(b) { err = transform.ErrShortDst eof = false b = b[:ns] } i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof) n += copy(dst[n:], b[n:i]) if !ok { nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) return nDst + n, nSrc + n, err } if n < len(src) && !atEOF { err = transform.ErrShortSrc } return n, n, err }
go
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { n := 0 // Cap the maximum number of src bytes to check. b := src eof := atEOF if ns := len(dst); ns < len(b) { err = transform.ErrShortDst eof = false b = b[:ns] } i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof) n += copy(dst[n:], b[n:i]) if !ok { nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) return nDst + n, nSrc + n, err } if n < len(src) && !atEOF { err = transform.ErrShortSrc } return n, n, err }
[ "func", "(", "f", "Form", ")", "Transform", "(", "dst", ",", "src", "[", "]", "byte", ",", "atEOF", "bool", ")", "(", "nDst", ",", "nSrc", "int", ",", "err", "error", ")", "{", "n", ":=", "0", "\n", "// Cap the maximum number of src bytes to check.", "...
// Transform implements the Transform method of the transform.Transformer // interface. It may need to write segments of up to MaxSegmentSize at once. // Users should either catch ErrShortDst and allow dst to grow or have dst be at // least of size MaxTransformChunkSize to be guaranteed of progress.
[ "Transform", "implements", "the", "Transform", "method", "of", "the", "transform", ".", "Transformer", "interface", ".", "It", "may", "need", "to", "write", "segments", "of", "up", "to", "MaxSegmentSize", "at", "once", ".", "Users", "should", "either", "catch"...
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/transform.go#L20-L40
154,476
salsaflow/salsaflow
Godeps/_workspace/src/golang.org/x/text/unicode/norm/transform.go
transform
func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // TODO: get rid of reorderBuffer. See CL 23460044. rb := reorderBuffer{} rb.init(f, src) for { // Load segment into reorder buffer. rb.setFlusher(dst[nDst:], flushTransform) end := decomposeSegment(&rb, nSrc, atEOF) if end < 0 { return nDst, nSrc, errs[-end] } nDst = len(dst) - len(rb.out) nSrc = end // Next quickSpan. end = rb.nsrc eof := atEOF if n := nSrc + len(dst) - nDst; n < end { err = transform.ErrShortDst end = n eof = false } end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof) n := copy(dst[nDst:], rb.src.bytes[nSrc:end]) nSrc += n nDst += n if ok { if n < rb.nsrc && !atEOF { err = transform.ErrShortSrc } return nDst, nSrc, err } } }
go
func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // TODO: get rid of reorderBuffer. See CL 23460044. rb := reorderBuffer{} rb.init(f, src) for { // Load segment into reorder buffer. rb.setFlusher(dst[nDst:], flushTransform) end := decomposeSegment(&rb, nSrc, atEOF) if end < 0 { return nDst, nSrc, errs[-end] } nDst = len(dst) - len(rb.out) nSrc = end // Next quickSpan. end = rb.nsrc eof := atEOF if n := nSrc + len(dst) - nDst; n < end { err = transform.ErrShortDst end = n eof = false } end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof) n := copy(dst[nDst:], rb.src.bytes[nSrc:end]) nSrc += n nDst += n if ok { if n < rb.nsrc && !atEOF { err = transform.ErrShortSrc } return nDst, nSrc, err } } }
[ "func", "(", "f", "Form", ")", "transform", "(", "dst", ",", "src", "[", "]", "byte", ",", "atEOF", "bool", ")", "(", "nDst", ",", "nSrc", "int", ",", "err", "error", ")", "{", "// TODO: get rid of reorderBuffer. See CL 23460044.", "rb", ":=", "reorderBuff...
// transform implements the transform.Transformer interface. It is only called // when quickSpan does not pass for a given string.
[ "transform", "implements", "the", "transform", ".", "Transformer", "interface", ".", "It", "is", "only", "called", "when", "quickSpan", "does", "not", "pass", "for", "a", "given", "string", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/Godeps/_workspace/src/golang.org/x/text/unicode/norm/transform.go#L55-L88
154,477
seven5/seven5
client/eval_vite.go
newEdge
func newEdge(src node, dest node) *edgeImpl { e := &edgeImpl{ s: src, d: dest, notMarked: false, } src.addOut(e) dest.addIn(e) return e }
go
func newEdge(src node, dest node) *edgeImpl { e := &edgeImpl{ s: src, d: dest, notMarked: false, } src.addOut(e) dest.addIn(e) return e }
[ "func", "newEdge", "(", "src", "node", ",", "dest", "node", ")", "*", "edgeImpl", "{", "e", ":=", "&", "edgeImpl", "{", "s", ":", "src", ",", "d", ":", "dest", ",", "notMarked", ":", "false", ",", "}", "\n", "src", ".", "addOut", "(", "e", ")",...
//newEdge returns a new edge between two given nodes. The newly //created edge is marked. The source and destination attribute //have this edge added to their respective lists, so the returned //value is probably not that useful.
[ "newEdge", "returns", "a", "new", "edge", "between", "two", "given", "nodes", ".", "The", "newly", "created", "edge", "is", "marked", ".", "The", "source", "and", "destination", "attribute", "have", "this", "edge", "added", "to", "their", "respective", "list...
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L39-L48
154,478
seven5/seven5
client/eval_vite.go
dropEdge
func dropEdge(src node, dest node) { if DEBUG_MESSAGES { print("dropping edge from ", src.id(), "->", dest.id()) } src.removeOut(dest.id()) dest.removeIn(src.id()) dest.markDirty() }
go
func dropEdge(src node, dest node) { if DEBUG_MESSAGES { print("dropping edge from ", src.id(), "->", dest.id()) } src.removeOut(dest.id()) dest.removeIn(src.id()) dest.markDirty() }
[ "func", "dropEdge", "(", "src", "node", ",", "dest", "node", ")", "{", "if", "DEBUG_MESSAGES", "{", "print", "(", "\"", "\"", ",", "src", ".", "id", "(", ")", ",", "\"", "\"", ",", "dest", ".", "id", "(", ")", ")", "\n", "}", "\n", "src", "."...
//drop edge removes the edge between two nodes. It walks the //edges in the outgoing list of the source node.
[ "drop", "edge", "removes", "the", "edge", "between", "two", "nodes", ".", "It", "walks", "the", "edges", "in", "the", "outgoing", "list", "of", "the", "source", "node", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L52-L59
154,479
seven5/seven5
client/eval_vite.go
Detach
func (self *AttributeImpl) Detach() { dead := []*edgeImpl{} self.walkIncoming(func(e *edgeImpl) { e.src().removeOut(self.id()) dead = append(dead, e) }) for _, e := range dead { self.removeIn(e.src().id()) } DrainEagerQueue() }
go
func (self *AttributeImpl) Detach() { dead := []*edgeImpl{} self.walkIncoming(func(e *edgeImpl) { e.src().removeOut(self.id()) dead = append(dead, e) }) for _, e := range dead { self.removeIn(e.src().id()) } DrainEagerQueue() }
[ "func", "(", "self", "*", "AttributeImpl", ")", "Detach", "(", ")", "{", "dead", ":=", "[", "]", "*", "edgeImpl", "{", "}", "\n", "self", ".", "walkIncoming", "(", "func", "(", "e", "*", "edgeImpl", ")", "{", "e", ".", "src", "(", ")", ".", "re...
//Detach removes any existing constraint dependency edges from this //node. This method has no effect if the object has no constraint.
[ "Detach", "removes", "any", "existing", "constraint", "dependency", "edges", "from", "this", "node", ".", "This", "method", "has", "no", "effect", "if", "the", "object", "has", "no", "constraint", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L171-L181
154,480
seven5/seven5
client/eval_vite.go
removeIn
func (self *AttributeImpl) removeIn(id int) { for i, e := range self.edge { if e.dest().id() == self.id() && e.src().id() == id { self.dropIthEdge(i) //MUST break here because the content of self.edge changed break } } }
go
func (self *AttributeImpl) removeIn(id int) { for i, e := range self.edge { if e.dest().id() == self.id() && e.src().id() == id { self.dropIthEdge(i) //MUST break here because the content of self.edge changed break } } }
[ "func", "(", "self", "*", "AttributeImpl", ")", "removeIn", "(", "id", "int", ")", "{", "for", "i", ",", "e", ":=", "range", "self", ".", "edge", "{", "if", "e", ".", "dest", "(", ")", ".", "id", "(", ")", "==", "self", ".", "id", "(", ")", ...
//removeIn drops the pointer in the edge list to the node that has //the id given and the receiving object as the destination of the edge.
[ "removeIn", "drops", "the", "pointer", "in", "the", "edge", "list", "to", "the", "node", "that", "has", "the", "id", "given", "and", "the", "receiving", "object", "as", "the", "destination", "of", "the", "edge", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L196-L204
154,481
seven5/seven5
client/eval_vite.go
walkOutgoing
func (self *AttributeImpl) walkOutgoing(fn func(*edgeImpl)) { for _, e := range self.edge { if e.src().id() != self.id() { continue } fn(e) } }
go
func (self *AttributeImpl) walkOutgoing(fn func(*edgeImpl)) { for _, e := range self.edge { if e.src().id() != self.id() { continue } fn(e) } }
[ "func", "(", "self", "*", "AttributeImpl", ")", "walkOutgoing", "(", "fn", "func", "(", "*", "edgeImpl", ")", ")", "{", "for", "_", ",", "e", ":=", "range", "self", ".", "edge", "{", "if", "e", ".", "src", "(", ")", ".", "id", "(", ")", "!=", ...
//walkOutgoing takes all the edges related to this node //and selects those that start at this node and passes them //to fn.
[ "walkOutgoing", "takes", "all", "the", "edges", "related", "to", "this", "node", "and", "selects", "those", "that", "start", "at", "this", "node", "and", "passes", "them", "to", "fn", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L226-L233
154,482
seven5/seven5
client/eval_vite.go
walkIncoming
func (self *AttributeImpl) walkIncoming(fn func(*edgeImpl)) { for _, e := range self.edge { if e.dest().id() != self.id() { continue } fn(e) } }
go
func (self *AttributeImpl) walkIncoming(fn func(*edgeImpl)) { for _, e := range self.edge { if e.dest().id() != self.id() { continue } fn(e) } }
[ "func", "(", "self", "*", "AttributeImpl", ")", "walkIncoming", "(", "fn", "func", "(", "*", "edgeImpl", ")", ")", "{", "for", "_", ",", "e", ":=", "range", "self", ".", "edge", "{", "if", "e", ".", "dest", "(", ")", ".", "id", "(", ")", "!=", ...
//walkIncoming takes all the edges related to this node //and selects those that end at this node and passes them //to fn.
[ "walkIncoming", "takes", "all", "the", "edges", "related", "to", "this", "node", "and", "selects", "those", "that", "end", "at", "this", "node", "and", "passes", "them", "to", "fn", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L238-L245
154,483
seven5/seven5
client/eval_vite.go
addOut
func (self *AttributeImpl) addOut(e *edgeImpl) { if !e.marked() { panic("badly constructed edge, not marked (OUT)") } self.edge = append(self.edge, e) }
go
func (self *AttributeImpl) addOut(e *edgeImpl) { if !e.marked() { panic("badly constructed edge, not marked (OUT)") } self.edge = append(self.edge, e) }
[ "func", "(", "self", "*", "AttributeImpl", ")", "addOut", "(", "e", "*", "edgeImpl", ")", "{", "if", "!", "e", ".", "marked", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "self", ".", "edge", "=", "append", "(", "self", ".", ...
//addOut adds an edge with this node as the source.
[ "addOut", "adds", "an", "edge", "with", "this", "node", "as", "the", "source", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L292-L297
154,484
seven5/seven5
client/eval_vite.go
inDegree
func (self *AttributeImpl) inDegree() int { inDegree := 0 self.walkIncoming(func(e *edgeImpl) { inDegree++ }) return inDegree }
go
func (self *AttributeImpl) inDegree() int { inDegree := 0 self.walkIncoming(func(e *edgeImpl) { inDegree++ }) return inDegree }
[ "func", "(", "self", "*", "AttributeImpl", ")", "inDegree", "(", ")", "int", "{", "inDegree", ":=", "0", "\n", "self", ".", "walkIncoming", "(", "func", "(", "e", "*", "edgeImpl", ")", "{", "inDegree", "++", "\n", "}", ")", "\n", "return", "inDegree"...
//inDegree returns the number of incoming edges on the receiver.
[ "inDegree", "returns", "the", "number", "of", "incoming", "edges", "on", "the", "receiver", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L314-L320
154,485
seven5/seven5
client/eval_vite.go
Demand
func (self *AttributeImpl) Demand() Equaler { self.demandCount++ if DEBUG_MESSAGES { print("Demand called ", self.id(), " (", self.name, ") with dirty ", self.dirty(), "\n") } //first if we are not dirty, return our stored value if !self.dirty() { return self.curr } //when we exit, we are not dirty self.clean = true //second, we are dirty so we have to pull everybody //we depend on up to date params := make([]Equaler, self.inDegree()) pcount := 0 self.walkIncoming(func(e *edgeImpl) { params[pcount] = e.src().Demand() pcount++ }) //we now know if anybody we depend on changed anyMarks := false self.walkIncoming(func(e *edgeImpl) { if e.marked() { anyMarks = true } }) if DEBUG_MESSAGES { print("inside demand ", self.id(), " (", self.name, ") anyMarks = ", anyMarks, "\n") } //if nobody actually returned a different value, then we //don't need to reevaluate if !anyMarks && self.valueFn == nil { return self.curr } //we have to calculate the new value self.evalCount++ var newval Equaler if DEBUG_MESSAGES { print("inside demand ", self.id(), " (", self.name, ") self.valueFn = ", self.valueFn, ",", self.constraint, "\n") } if self.valueFn != nil && self.constraint == nil { newval = self.valueFn() } else { newval = self.constraint.Fn(params) } //did it change? if self.curr != nil && self.curr.Equal(newval) { return self.curr } //it did change, so we need to mark our outgoing edges self.walkOutgoing(func(e *edgeImpl) { e.mark() }) return self.assign(newval, true) }
go
func (self *AttributeImpl) Demand() Equaler { self.demandCount++ if DEBUG_MESSAGES { print("Demand called ", self.id(), " (", self.name, ") with dirty ", self.dirty(), "\n") } //first if we are not dirty, return our stored value if !self.dirty() { return self.curr } //when we exit, we are not dirty self.clean = true //second, we are dirty so we have to pull everybody //we depend on up to date params := make([]Equaler, self.inDegree()) pcount := 0 self.walkIncoming(func(e *edgeImpl) { params[pcount] = e.src().Demand() pcount++ }) //we now know if anybody we depend on changed anyMarks := false self.walkIncoming(func(e *edgeImpl) { if e.marked() { anyMarks = true } }) if DEBUG_MESSAGES { print("inside demand ", self.id(), " (", self.name, ") anyMarks = ", anyMarks, "\n") } //if nobody actually returned a different value, then we //don't need to reevaluate if !anyMarks && self.valueFn == nil { return self.curr } //we have to calculate the new value self.evalCount++ var newval Equaler if DEBUG_MESSAGES { print("inside demand ", self.id(), " (", self.name, ") self.valueFn = ", self.valueFn, ",", self.constraint, "\n") } if self.valueFn != nil && self.constraint == nil { newval = self.valueFn() } else { newval = self.constraint.Fn(params) } //did it change? if self.curr != nil && self.curr.Equal(newval) { return self.curr } //it did change, so we need to mark our outgoing edges self.walkOutgoing(func(e *edgeImpl) { e.mark() }) return self.assign(newval, true) }
[ "func", "(", "self", "*", "AttributeImpl", ")", "Demand", "(", ")", "Equaler", "{", "self", ".", "demandCount", "++", "\n\n", "if", "DEBUG_MESSAGES", "{", "print", "(", "\"", "\"", ",", "self", ".", "id", "(", ")", ",", "\"", "\"", ",", "self", "."...
//Demand forces all the dependencies up to date and then //calls the function to get the new value.
[ "Demand", "forces", "all", "the", "dependencies", "up", "to", "date", "and", "then", "calls", "the", "function", "to", "get", "the", "new", "value", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/client/eval_vite.go#L346-L412
154,486
salsaflow/salsaflow
errs/errs.go
LogWith
func LogWith(err error, logger log.Logger) error { logger.Lock() defer logger.Unlock() return unsafeLogWith(err, logger) }
go
func LogWith(err error, logger log.Logger) error { logger.Lock() defer logger.Unlock() return unsafeLogWith(err, logger) }
[ "func", "LogWith", "(", "err", "error", ",", "logger", "log", ".", "Logger", ")", "error", "{", "logger", ".", "Lock", "(", ")", "\n", "defer", "logger", ".", "Unlock", "(", ")", "\n", "return", "unsafeLogWith", "(", "err", ",", "logger", ")", "\n", ...
// LogWith logs the given error using the given logger.
[ "LogWith", "logs", "the", "given", "error", "using", "the", "given", "logger", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/errs/errs.go#L76-L80
154,487
salsaflow/salsaflow
errs/errs.go
RootCause
func RootCause(err error) error { if ex, ok := err.(Err); ok { return RootCause(ex.Err()) } return err }
go
func RootCause(err error) error { if ex, ok := err.(Err); ok { return RootCause(ex.Err()) } return err }
[ "func", "RootCause", "(", "err", "error", ")", "error", "{", "if", "ex", ",", "ok", ":=", "err", ".", "(", "Err", ")", ";", "ok", "{", "return", "RootCause", "(", "ex", ".", "Err", "(", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// RootCause returns the error deepest in the error chain.
[ "RootCause", "returns", "the", "error", "deepest", "in", "the", "error", "chain", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/errs/errs.go#L135-L140
154,488
salsaflow/salsaflow
github/issues/review_blocker_list.go
AddReviewBlocker
func (list *ReviewBlockerList) AddReviewBlocker( fixed bool, commentURL string, commitSHA string, blockerSummary string, ) bool { for _, item := range list.items { if item.CommentURL == commentURL { return false } } list.items = append(list.items, &ReviewBlockerItem{ Fixed: fixed, CommentURL: commentURL, CommitSHA: commitSHA, BlockerNumber: len(list.items) + 1, BlockerSummary: blockerSummary, }) return true }
go
func (list *ReviewBlockerList) AddReviewBlocker( fixed bool, commentURL string, commitSHA string, blockerSummary string, ) bool { for _, item := range list.items { if item.CommentURL == commentURL { return false } } list.items = append(list.items, &ReviewBlockerItem{ Fixed: fixed, CommentURL: commentURL, CommitSHA: commitSHA, BlockerNumber: len(list.items) + 1, BlockerSummary: blockerSummary, }) return true }
[ "func", "(", "list", "*", "ReviewBlockerList", ")", "AddReviewBlocker", "(", "fixed", "bool", ",", "commentURL", "string", ",", "commitSHA", "string", ",", "blockerSummary", "string", ",", ")", "bool", "{", "for", "_", ",", "item", ":=", "range", "list", "...
// AddReviewBlocker adds the blocker to the list unless the blocker is already there. // The field that is check and must be unique is the comment URL.
[ "AddReviewBlocker", "adds", "the", "blocker", "to", "the", "list", "unless", "the", "blocker", "is", "already", "there", ".", "The", "field", "that", "is", "check", "and", "must", "be", "unique", "is", "the", "comment", "URL", "." ]
1bc3d9415e3e35b5aad7b724c2955b1f53ccd145
https://github.com/salsaflow/salsaflow/blob/1bc3d9415e3e35b5aad7b724c2955b1f53ccd145/github/issues/review_blocker_list.go#L27-L48
154,489
seven5/seven5
qbs_rest.go
Index
func (self *qbsWrapped) Index(pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.index.IndexQbs(pb, tx) }) }
go
func (self *qbsWrapped) Index(pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.index.IndexQbs(pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "Index", "(", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", "qbs", ".", "Qbs", ")", "(", "inter...
//Index meets the interface RestIndex but calls the wrapped QBSRestIndex
[ "Index", "meets", "the", "interface", "RestIndex", "but", "calls", "the", "wrapped", "QBSRestIndex" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L110-L114
154,490
seven5/seven5
qbs_rest.go
Find
func (self *qbsWrapped) Find(id int64, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.find.FindQbs(id, pb, tx) }) }
go
func (self *qbsWrapped) Find(id int64, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.find.FindQbs(id, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "Find", "(", "id", "int64", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", "qbs", ".", "Qbs...
//Find meets the interface RestFind but calls the wrapped QBSRestFind
[ "Find", "meets", "the", "interface", "RestFind", "but", "calls", "the", "wrapped", "QBSRestFind" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L117-L121
154,491
seven5/seven5
qbs_rest.go
Delete
func (self *qbsWrapped) Delete(id int64, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.del.DeleteQbs(id, pb, tx) }) }
go
func (self *qbsWrapped) Delete(id int64, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.del.DeleteQbs(id, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "Delete", "(", "id", "int64", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", "qbs", ".", "Q...
//Delete meets the interface RestDelete but calls the wrapped QBSRestDelete
[ "Delete", "meets", "the", "interface", "RestDelete", "but", "calls", "the", "wrapped", "QBSRestDelete" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L124-L128
154,492
seven5/seven5
qbs_rest.go
Put
func (self *qbsWrapped) Put(id int64, value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.put.PutQbs(id, value, pb, tx) }) }
go
func (self *qbsWrapped) Put(id int64, value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.put.PutQbs(id, value, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "Put", "(", "id", "int64", ",", "value", "interface", "{", "}", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func"...
//Put meets the interface RestPut but calls the wrapped QBSRestPut
[ "Put", "meets", "the", "interface", "RestPut", "but", "calls", "the", "wrapped", "QBSRestPut" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L131-L135
154,493
seven5/seven5
qbs_rest.go
Post
func (self *qbsWrapped) Post(value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.post.PostQbs(value, pb, tx) }) }
go
func (self *qbsWrapped) Post(value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.post.PostQbs(value, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "Post", "(", "value", "interface", "{", "}", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", ...
//Post meets the interface RestPost but calls the wrapped QBSRestPost
[ "Post", "meets", "the", "interface", "RestPost", "but", "calls", "the", "wrapped", "QBSRestPost" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L138-L142
154,494
seven5/seven5
qbs_rest.go
AllowWrite
func (self *qbsWrapped) AllowWrite(pb PBundle) bool { allow, ok := self.post.(AllowWriter) if !ok { return true } return allow.AllowWrite(pb) }
go
func (self *qbsWrapped) AllowWrite(pb PBundle) bool { allow, ok := self.post.(AllowWriter) if !ok { return true } return allow.AllowWrite(pb) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "AllowWrite", "(", "pb", "PBundle", ")", "bool", "{", "allow", ",", "ok", ":=", "self", ".", "post", ".", "(", "AllowWriter", ")", "\n", "if", "!", "ok", "{", "return", "true", "\n", "}", "\n", "return",...
//AllowWrite is a pass-through the wrapped object's AllowWrite, if present.
[ "AllowWrite", "is", "a", "pass", "-", "through", "the", "wrapped", "object", "s", "AllowWrite", "if", "present", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L145-L151
154,495
seven5/seven5
qbs_rest.go
AllowRead
func (self *qbsWrapped) AllowRead(pb PBundle) bool { allow, ok := self.index.(AllowReader) if !ok { return true } return allow.AllowRead(pb) }
go
func (self *qbsWrapped) AllowRead(pb PBundle) bool { allow, ok := self.index.(AllowReader) if !ok { return true } return allow.AllowRead(pb) }
[ "func", "(", "self", "*", "qbsWrapped", ")", "AllowRead", "(", "pb", "PBundle", ")", "bool", "{", "allow", ",", "ok", ":=", "self", ".", "index", ".", "(", "AllowReader", ")", "\n", "if", "!", "ok", "{", "return", "true", "\n", "}", "\n", "return",...
//AllowRead is a pass-through the wrapped object's AllowRead, if present.
[ "AllowRead", "is", "a", "pass", "-", "through", "the", "wrapped", "object", "s", "AllowRead", "if", "present", "." ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L154-L160
154,496
seven5/seven5
qbs_rest.go
Find
func (self *qbsWrappedUdid) Find(id string, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.find.FindQbs(id, pb, tx) }) }
go
func (self *qbsWrappedUdid) Find(id string, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.find.FindQbs(id, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrappedUdid", ")", "Find", "(", "id", "string", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", "qbs", ".", ...
//FindUdid meets the interface RestFindUdid but calls the wrapped QBSRestFindUdid
[ "FindUdid", "meets", "the", "interface", "RestFindUdid", "but", "calls", "the", "wrapped", "QBSRestFindUdid" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L209-L213
154,497
seven5/seven5
qbs_rest.go
Delete
func (self *qbsWrappedUdid) Delete(id string, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.del.DeleteQbs(id, pb, tx) }) }
go
func (self *qbsWrappedUdid) Delete(id string, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.del.DeleteQbs(id, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrappedUdid", ")", "Delete", "(", "id", "string", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "func", "(", "tx", "*", "qbs", ".",...
//DeleteUdid meets the interface RestDeleteUdid but calls the wrapped QBSRestDeleteUdid
[ "DeleteUdid", "meets", "the", "interface", "RestDeleteUdid", "but", "calls", "the", "wrapped", "QBSRestDeleteUdid" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L216-L220
154,498
seven5/seven5
qbs_rest.go
Put
func (self *qbsWrappedUdid) Put(id string, value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.put.PutQbs(id, value, pb, tx) }) }
go
func (self *qbsWrappedUdid) Put(id string, value interface{}, pb PBundle) (interface{}, error) { return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) { return self.put.PutQbs(id, value, pb, tx) }) }
[ "func", "(", "self", "*", "qbsWrappedUdid", ")", "Put", "(", "id", "string", ",", "value", "interface", "{", "}", ",", "pb", "PBundle", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "self", ".", "applyPolicy", "(", "pb", ",", "...
//PutUdid meets the interface RestPutUdid but calls the wrapped QBSRestPutUdid
[ "PutUdid", "meets", "the", "interface", "RestPutUdid", "but", "calls", "the", "wrapped", "QBSRestPutUdid" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L230-L234
154,499
seven5/seven5
qbs_rest.go
QbsWrapAll
func QbsWrapAll(a QbsRestAll, s *QbsStore) RestAll { return &qbsWrapped{store: s, index: a, find: a, del: a, put: a, post: a} }
go
func QbsWrapAll(a QbsRestAll, s *QbsStore) RestAll { return &qbsWrapped{store: s, index: a, find: a, del: a, put: a, post: a} }
[ "func", "QbsWrapAll", "(", "a", "QbsRestAll", ",", "s", "*", "QbsStore", ")", "RestAll", "{", "return", "&", "qbsWrapped", "{", "store", ":", "s", ",", "index", ":", "a", ",", "find", ":", "a", ",", "del", ":", "a", ",", "put", ":", "a", ",", "...
// // WRAPPING FUNCITONS // //Given a QbsRestAll return a RestAll
[ "WRAPPING", "FUNCITONS", "Given", "a", "QbsRestAll", "return", "a", "RestAll" ]
19fef7e1f781b14fc25f545e580cb13f6f11634b
https://github.com/seven5/seven5/blob/19fef7e1f781b14fc25f545e580cb13f6f11634b/qbs_rest.go#L278-L280