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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
139,400 | chewxy/lingo | treebank/treebank.go | ReadConllu | func ReadConllu(reader io.Reader) []SentenceTag {
s, st, sh, sdt := reset()
sentences := make([]SentenceTag, 0)
sentenceCount := 0
var usedTags lingo.TagSet
var usedDepTypes lingo.DependencyTypeSet
var unknownTags = make(map[string]struct{})
var unknownDepType = make(map[string]struct{})
colCount := 0
for bs... | go | func ReadConllu(reader io.Reader) []SentenceTag {
s, st, sh, sdt := reset()
sentences := make([]SentenceTag, 0)
sentenceCount := 0
var usedTags lingo.TagSet
var usedDepTypes lingo.DependencyTypeSet
var unknownTags = make(map[string]struct{})
var unknownDepType = make(map[string]struct{})
colCount := 0
for bs... | [
"func",
"ReadConllu",
"(",
"reader",
"io",
".",
"Reader",
")",
"[",
"]",
"SentenceTag",
"{",
"s",
",",
"st",
",",
"sh",
",",
"sdt",
":=",
"reset",
"(",
")",
"\n",
"sentences",
":=",
"make",
"(",
"[",
"]",
"SentenceTag",
",",
"0",
")",
"\n",
"sent... | // ReadConllu reads a file formatted in a CONLLU format | [
"ReadConllu",
"reads",
"a",
"file",
"formatted",
"in",
"a",
"CONLLU",
"format"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/treebank/treebank.go#L32-L103 |
139,401 | chewxy/lingo | dependencyType.go | InDepTypes | func InDepTypes(x DependencyType, set []DependencyType) bool {
for _, v := range set {
if v == x {
return true
}
}
return false
} | go | func InDepTypes(x DependencyType, set []DependencyType) bool {
for _, v := range set {
if v == x {
return true
}
}
return false
} | [
"func",
"InDepTypes",
"(",
"x",
"DependencyType",
",",
"set",
"[",
"]",
"DependencyType",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"set",
"{",
"if",
"v",
"==",
"x",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",... | // list of dependency type functions | [
"list",
"of",
"dependency",
"type",
"functions"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dependencyType.go#L35-L42 |
139,402 | chewxy/lingo | dep/nn2.go | train | func (nn *neuralnetwork2) train(examples []example) error {
size := len(examples)
batches := size / nn.BatchSize
var start, end int
if nn.BatchSize > size {
batches = 1
end = size
G.WithBatchSize(float64(size))(nn.solver) // set it such that the solver doesn't get confused
} else {
end = nn.BatchSize
}
... | go | func (nn *neuralnetwork2) train(examples []example) error {
size := len(examples)
batches := size / nn.BatchSize
var start, end int
if nn.BatchSize > size {
batches = 1
end = size
G.WithBatchSize(float64(size))(nn.solver) // set it such that the solver doesn't get confused
} else {
end = nn.BatchSize
}
... | [
"func",
"(",
"nn",
"*",
"neuralnetwork2",
")",
"train",
"(",
"examples",
"[",
"]",
"example",
")",
"error",
"{",
"size",
":=",
"len",
"(",
"examples",
")",
"\n",
"batches",
":=",
"size",
"/",
"nn",
".",
"BatchSize",
"\n\n",
"var",
"start",
",",
"end"... | // train does one epoch of training. The examples are batched. | [
"train",
"does",
"one",
"epoch",
"of",
"training",
".",
"The",
"examples",
"are",
"batched",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/nn2.go#L296-L344 |
139,403 | chewxy/lingo | dep/nn2.go | pred | func (nn *neuralnetwork2) pred(ind []int) (int, error) {
nn.feats2vec(ind)
// f, _ := os.OpenFile("LOOOOOG", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)
// logger := log.New(f, "", 0)
// logger := log.New(os.Stderr, "", 0)
// m := G.NewLispMachine(nn.sub, G.ExecuteFwdOnly(), G.WithLogger(logger), G.WithWatchlist(),... | go | func (nn *neuralnetwork2) pred(ind []int) (int, error) {
nn.feats2vec(ind)
// f, _ := os.OpenFile("LOOOOOG", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)
// logger := log.New(f, "", 0)
// logger := log.New(os.Stderr, "", 0)
// m := G.NewLispMachine(nn.sub, G.ExecuteFwdOnly(), G.WithLogger(logger), G.WithWatchlist(),... | [
"func",
"(",
"nn",
"*",
"neuralnetwork2",
")",
"pred",
"(",
"ind",
"[",
"]",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"nn",
".",
"feats2vec",
"(",
"ind",
")",
"\n\n",
"// f, _ := os.OpenFile(\"LOOOOOG\", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)",
"// logg... | // pred predicts the index of the transitions | [
"pred",
"predicts",
"the",
"index",
"of",
"the",
"transitions"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/nn2.go#L347-L368 |
139,404 | chewxy/lingo | corpus/functions.go | GenerateCorpus | func GenerateCorpus(sentenceTags []treebank.SentenceTag) *Corpus {
words := make([]string, 3)
frequencies := make([]int, 3)
words[0] = "" // aka NULL, for when no word can be found
frequencies[0] = 0 // no word is never found
words[1] = "-UNKNOWN-"
frequencies[1] = 0
words[2] = "-ROOT-"
frequencies[2] =... | go | func GenerateCorpus(sentenceTags []treebank.SentenceTag) *Corpus {
words := make([]string, 3)
frequencies := make([]int, 3)
words[0] = "" // aka NULL, for when no word can be found
frequencies[0] = 0 // no word is never found
words[1] = "-UNKNOWN-"
frequencies[1] = 0
words[2] = "-ROOT-"
frequencies[2] =... | [
"func",
"GenerateCorpus",
"(",
"sentenceTags",
"[",
"]",
"treebank",
".",
"SentenceTag",
")",
"*",
"Corpus",
"{",
"words",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"3",
")",
"\n",
"frequencies",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"3",
")",
... | // GenerateCorpus creates a Corpus given a set of SentenceTag from a training set. | [
"GenerateCorpus",
"creates",
"a",
"Corpus",
"given",
"a",
"set",
"of",
"SentenceTag",
"from",
"a",
"training",
"set",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/functions.go#L14-L58 |
139,405 | chewxy/lingo | corpus/functions.go | ViterbiSplit | func ViterbiSplit(input string, c *Corpus) []string {
s := strings.ToLower(input)
probabilities := []float64{1.0}
lasts := []int{0}
runes := []int{}
for i := range s {
runes = append(runes, i)
}
runes = append(runes, len(s)+1)
for i := range s {
probs := make([]float64, 0)
ls := make([]int, 0)
// m :... | go | func ViterbiSplit(input string, c *Corpus) []string {
s := strings.ToLower(input)
probabilities := []float64{1.0}
lasts := []int{0}
runes := []int{}
for i := range s {
runes = append(runes, i)
}
runes = append(runes, len(s)+1)
for i := range s {
probs := make([]float64, 0)
ls := make([]int, 0)
// m :... | [
"func",
"ViterbiSplit",
"(",
"input",
"string",
",",
"c",
"*",
"Corpus",
")",
"[",
"]",
"string",
"{",
"s",
":=",
"strings",
".",
"ToLower",
"(",
"input",
")",
"\n",
"probabilities",
":=",
"[",
"]",
"float64",
"{",
"1.0",
"}",
"\n",
"lasts",
":=",
... | // ViterbiSplit is a Viterbi algorithm for splitting words given a corpus | [
"ViterbiSplit",
"is",
"a",
"Viterbi",
"algorithm",
"for",
"splitting",
"words",
"given",
"a",
"corpus"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/functions.go#L61-L121 |
139,406 | chewxy/lingo | corpus/functions.go | CosineSimilarity | func CosineSimilarity(a, b []string) float64 {
countsA := make([]float64, 0)
countsB := make([]float64, 0)
uniques := make(map[string]int)
// index the strings first
for _, st := range a {
s := strings.ToLower(st)
id, ok := uniques[s]
if !ok {
uniques[s] = len(countsA)
countsA = append(countsA, 1)
... | go | func CosineSimilarity(a, b []string) float64 {
countsA := make([]float64, 0)
countsB := make([]float64, 0)
uniques := make(map[string]int)
// index the strings first
for _, st := range a {
s := strings.ToLower(st)
id, ok := uniques[s]
if !ok {
uniques[s] = len(countsA)
countsA = append(countsA, 1)
... | [
"func",
"CosineSimilarity",
"(",
"a",
",",
"b",
"[",
"]",
"string",
")",
"float64",
"{",
"countsA",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"0",
")",
"\n",
"countsB",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"0",
")",
"\n",
"uniques",
":... | // CosineSimilarity measures the cosine similarity of two strings. | [
"CosineSimilarity",
"measures",
"the",
"cosine",
"similarity",
"of",
"two",
"strings",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/functions.go#L124-L171 |
139,407 | chewxy/lingo | corpus/functions.go | LongestCommonPrefix | func LongestCommonPrefix(strs ...string) string {
switch len(strs) {
case 0:
return "" // idiots
case 1:
return strs[0]
}
min := strs[0]
max := strs[0]
for _, s := range strs[1:] {
switch {
case s < min:
min = s
case s > max:
max = s
}
}
for i := 0; i < len(min) && i < len(max); i++ {
if... | go | func LongestCommonPrefix(strs ...string) string {
switch len(strs) {
case 0:
return "" // idiots
case 1:
return strs[0]
}
min := strs[0]
max := strs[0]
for _, s := range strs[1:] {
switch {
case s < min:
min = s
case s > max:
max = s
}
}
for i := 0; i < len(min) && i < len(max); i++ {
if... | [
"func",
"LongestCommonPrefix",
"(",
"strs",
"...",
"string",
")",
"string",
"{",
"switch",
"len",
"(",
"strs",
")",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
"// idiots",
"\n",
"case",
"1",
":",
"return",
"strs",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
... | // LongestCommonPrefix takes a slice of strings, and finds the longest common prefix | [
"LongestCommonPrefix",
"takes",
"a",
"slice",
"of",
"strings",
"and",
"finds",
"the",
"longest",
"common",
"prefix"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/functions.go#L274-L303 |
139,408 | chewxy/lingo | dependency.go | FromAnnotatedSentence | func FromAnnotatedSentence(s AnnotatedSentence) depConsOpt {
fn := func(d *Dependency) {
wc := len(s)
d.AnnotatedSentence = s
d.wordCount = wc
d.n = wc - 1
}
return fn
} | go | func FromAnnotatedSentence(s AnnotatedSentence) depConsOpt {
fn := func(d *Dependency) {
wc := len(s)
d.AnnotatedSentence = s
d.wordCount = wc
d.n = wc - 1
}
return fn
} | [
"func",
"FromAnnotatedSentence",
"(",
"s",
"AnnotatedSentence",
")",
"depConsOpt",
"{",
"fn",
":=",
"func",
"(",
"d",
"*",
"Dependency",
")",
"{",
"wc",
":=",
"len",
"(",
"s",
")",
"\n",
"d",
".",
"AnnotatedSentence",
"=",
"s",
"\n",
"d",
".",
"wordCou... | // FromAnnotatedSentence creates a dependency from an AnnotatedSentence. | [
"FromAnnotatedSentence",
"creates",
"a",
"dependency",
"from",
"an",
"AnnotatedSentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dependency.go#L29-L37 |
139,409 | chewxy/lingo | lexer/lexer.go | nextUntilEOF | func (l *Lexer) nextUntilEOF(s string) bool {
for r := l.next(); r != eof && strings.IndexRune(s, r) < 0; r = l.next() {
// l.next()
l.accept()
}
if l.r == eof {
return true
}
return false
} | go | func (l *Lexer) nextUntilEOF(s string) bool {
for r := l.next(); r != eof && strings.IndexRune(s, r) < 0; r = l.next() {
// l.next()
l.accept()
}
if l.r == eof {
return true
}
return false
} | [
"func",
"(",
"l",
"*",
"Lexer",
")",
"nextUntilEOF",
"(",
"s",
"string",
")",
"bool",
"{",
"for",
"r",
":=",
"l",
".",
"next",
"(",
")",
";",
"r",
"!=",
"eof",
"&&",
"strings",
".",
"IndexRune",
"(",
"s",
",",
"r",
")",
"<",
"0",
";",
"r",
... | // nextUntilEOF will loop until it finds the matching string OR EOF | [
"nextUntilEOF",
"will",
"loop",
"until",
"it",
"finds",
"the",
"matching",
"string",
"OR",
"EOF"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/lexer/lexer.go#L72-L81 |
139,410 | chewxy/lingo | dep/transition.go | init | func init() {
lbls := make([]lingo.DependencyType, lingo.MAXDEPTYPE)
for i := 0; i < int(lingo.MAXDEPTYPE); i++ {
lbls[i] = lingo.DependencyType(i)
}
transitions = buildTransitions(lbls)
MAXTRANSITION = len(transitions)
} | go | func init() {
lbls := make([]lingo.DependencyType, lingo.MAXDEPTYPE)
for i := 0; i < int(lingo.MAXDEPTYPE); i++ {
lbls[i] = lingo.DependencyType(i)
}
transitions = buildTransitions(lbls)
MAXTRANSITION = len(transitions)
} | [
"func",
"init",
"(",
")",
"{",
"lbls",
":=",
"make",
"(",
"[",
"]",
"lingo",
".",
"DependencyType",
",",
"lingo",
".",
"MAXDEPTYPE",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"int",
"(",
"lingo",
".",
"MAXDEPTYPE",
")",
";",
"i",
"++",
... | // this builds the default transitions | [
"this",
"builds",
"the",
"default",
"transitions"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/transition.go#L65-L74 |
139,411 | chewxy/lingo | dep/fix.go | fix | func fix(d *lingo.Dependency) {
// NNP fix:
// If a sentence is [a, b, c, D, E, f, g]
// where D, E are NNPs, they should be compound words
// The head should be the one with higher headID
spans := properNounSpans(d)
for _, s := range spans {
// we don't care about single word proper nouns
if s.end-s.start <=... | go | func fix(d *lingo.Dependency) {
// NNP fix:
// If a sentence is [a, b, c, D, E, f, g]
// where D, E are NNPs, they should be compound words
// The head should be the one with higher headID
spans := properNounSpans(d)
for _, s := range spans {
// we don't care about single word proper nouns
if s.end-s.start <=... | [
"func",
"fix",
"(",
"d",
"*",
"lingo",
".",
"Dependency",
")",
"{",
"// NNP fix:",
"// If a sentence is [a, b, c, D, E, f, g]",
"// where D, E are NNPs, they should be compound words",
"// The head should be the one with higher headID",
"spans",
":=",
"properNounSpans",
"(",
"d",... | // applies common fixes | [
"applies",
"common",
"fixes"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/fix.go#L10-L96 |
139,412 | chewxy/lingo | corpus/inflection.go | Pluralize | func Pluralize(word string) string {
if lingo.InStringSlice(word, unconvertable) {
return word
}
for _, cp := range irregular {
if cp.pattern.MatchString(word) {
return cp.replacement
}
}
for _, cp := range plural {
if cp.pattern.MatchString(word) {
// log.Printf("\t%q Matches %q", word, cp.pattern... | go | func Pluralize(word string) string {
if lingo.InStringSlice(word, unconvertable) {
return word
}
for _, cp := range irregular {
if cp.pattern.MatchString(word) {
return cp.replacement
}
}
for _, cp := range plural {
if cp.pattern.MatchString(word) {
// log.Printf("\t%q Matches %q", word, cp.pattern... | [
"func",
"Pluralize",
"(",
"word",
"string",
")",
"string",
"{",
"if",
"lingo",
".",
"InStringSlice",
"(",
"word",
",",
"unconvertable",
")",
"{",
"return",
"word",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"cp",
":=",
"range",
"irregular",
"{",
"if",
"cp",
... | // Pluralize pluralizes words based on rules known | [
"Pluralize",
"pluralizes",
"words",
"based",
"on",
"rules",
"known"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/inflection.go#L94-L112 |
139,413 | chewxy/lingo | corpus/inflection.go | Singularize | func Singularize(word string) string {
if lingo.InStringSlice(word, unconvertable) {
return word
}
for _, cp := range singular {
if cp.pattern.MatchString(word) {
return cp.pattern.ReplaceAllString(word, cp.replacement)
}
}
return word
} | go | func Singularize(word string) string {
if lingo.InStringSlice(word, unconvertable) {
return word
}
for _, cp := range singular {
if cp.pattern.MatchString(word) {
return cp.pattern.ReplaceAllString(word, cp.replacement)
}
}
return word
} | [
"func",
"Singularize",
"(",
"word",
"string",
")",
"string",
"{",
"if",
"lingo",
".",
"InStringSlice",
"(",
"word",
",",
"unconvertable",
")",
"{",
"return",
"word",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"cp",
":=",
"range",
"singular",
"{",
"if",
"cp",
... | // Singularize singularizes words based on rules known | [
"Singularize",
"singularizes",
"words",
"based",
"on",
"rules",
"known"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/inflection.go#L115-L126 |
139,414 | chewxy/lingo | corpus/corpus.go | Construct | func Construct(opts ...ConsOpt) (*Corpus, error) {
c := new(Corpus)
// checks
if c.words == nil {
c.words = make([]string, 0)
}
if c.frequencies == nil {
c.frequencies = make([]int, 0)
}
if c.ids == nil {
c.ids = make(map[string]int)
}
for _, opt := range opts {
if err := opt(c); err != nil {
retu... | go | func Construct(opts ...ConsOpt) (*Corpus, error) {
c := new(Corpus)
// checks
if c.words == nil {
c.words = make([]string, 0)
}
if c.frequencies == nil {
c.frequencies = make([]int, 0)
}
if c.ids == nil {
c.ids = make(map[string]int)
}
for _, opt := range opts {
if err := opt(c); err != nil {
retu... | [
"func",
"Construct",
"(",
"opts",
"...",
"ConsOpt",
")",
"(",
"*",
"Corpus",
",",
"error",
")",
"{",
"c",
":=",
"new",
"(",
"Corpus",
")",
"\n\n",
"// checks",
"if",
"c",
".",
"words",
"==",
"nil",
"{",
"c",
".",
"words",
"=",
"make",
"(",
"[",
... | // Construct creates a Corpus given the construction options. This allows for more flexibility | [
"Construct",
"creates",
"a",
"Corpus",
"given",
"the",
"construction",
"options",
".",
"This",
"allows",
"for",
"more",
"flexibility"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L40-L61 |
139,415 | chewxy/lingo | corpus/corpus.go | Id | func (c *Corpus) Id(word string) (int, bool) {
id, ok := c.ids[word]
return id, ok
} | go | func (c *Corpus) Id(word string) (int, bool) {
id, ok := c.ids[word]
return id, ok
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"Id",
"(",
"word",
"string",
")",
"(",
"int",
",",
"bool",
")",
"{",
"id",
",",
"ok",
":=",
"c",
".",
"ids",
"[",
"word",
"]",
"\n",
"return",
"id",
",",
"ok",
"\n",
"}"
] | // ID returns the ID of a word and whether or not it was found in the corpus | [
"ID",
"returns",
"the",
"ID",
"of",
"a",
"word",
"and",
"whether",
"or",
"not",
"it",
"was",
"found",
"in",
"the",
"corpus"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L64-L67 |
139,416 | chewxy/lingo | corpus/corpus.go | Word | func (c *Corpus) Word(id int) (string, bool) {
size := atomic.LoadInt64(&c.maxid)
maxid := int(size)
if id >= maxid {
return "", false
}
return c.words[id], true
} | go | func (c *Corpus) Word(id int) (string, bool) {
size := atomic.LoadInt64(&c.maxid)
maxid := int(size)
if id >= maxid {
return "", false
}
return c.words[id], true
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"Word",
"(",
"id",
"int",
")",
"(",
"string",
",",
"bool",
")",
"{",
"size",
":=",
"atomic",
".",
"LoadInt64",
"(",
"&",
"c",
".",
"maxid",
")",
"\n",
"maxid",
":=",
"int",
"(",
"size",
")",
"\n\n",
"if",
... | // Word returns the word given the ID, and whether or not it was found in the corpus | [
"Word",
"returns",
"the",
"word",
"given",
"the",
"ID",
"and",
"whether",
"or",
"not",
"it",
"was",
"found",
"in",
"the",
"corpus"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L70-L78 |
139,417 | chewxy/lingo | corpus/corpus.go | Add | func (c *Corpus) Add(word string) int {
if id, ok := c.ids[word]; ok {
c.frequencies[id]++
c.totalFreq++
return id
}
id := atomic.AddInt64(&c.maxid, 1)
c.ids[word] = int(id - 1)
c.words = append(c.words, word)
c.frequencies = append(c.frequencies, 1)
c.totalFreq++
runeCount := utf8.RuneCountInString(wor... | go | func (c *Corpus) Add(word string) int {
if id, ok := c.ids[word]; ok {
c.frequencies[id]++
c.totalFreq++
return id
}
id := atomic.AddInt64(&c.maxid, 1)
c.ids[word] = int(id - 1)
c.words = append(c.words, word)
c.frequencies = append(c.frequencies, 1)
c.totalFreq++
runeCount := utf8.RuneCountInString(wor... | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"Add",
"(",
"word",
"string",
")",
"int",
"{",
"if",
"id",
",",
"ok",
":=",
"c",
".",
"ids",
"[",
"word",
"]",
";",
"ok",
"{",
"c",
".",
"frequencies",
"[",
"id",
"]",
"++",
"\n",
"c",
".",
"totalFreq",
... | // Add adds a word to the corpus and returns its ID. If a word was previously in the corpus, it merely updates the frequency count and returns the ID | [
"Add",
"adds",
"a",
"word",
"to",
"the",
"corpus",
"and",
"returns",
"its",
"ID",
".",
"If",
"a",
"word",
"was",
"previously",
"in",
"the",
"corpus",
"it",
"merely",
"updates",
"the",
"frequency",
"count",
"and",
"returns",
"the",
"ID"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L81-L100 |
139,418 | chewxy/lingo | corpus/corpus.go | Size | func (c *Corpus) Size() int {
size := atomic.LoadInt64(&c.maxid)
return int(size)
} | go | func (c *Corpus) Size() int {
size := atomic.LoadInt64(&c.maxid)
return int(size)
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"Size",
"(",
")",
"int",
"{",
"size",
":=",
"atomic",
".",
"LoadInt64",
"(",
"&",
"c",
".",
"maxid",
")",
"\n",
"return",
"int",
"(",
"size",
")",
"\n",
"}"
] | // Size returns the size of the corpus. | [
"Size",
"returns",
"the",
"size",
"of",
"the",
"corpus",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L103-L106 |
139,419 | chewxy/lingo | corpus/corpus.go | WordFreq | func (c *Corpus) WordFreq(word string) int {
id, ok := c.ids[word]
if !ok {
return 0
}
return c.frequencies[id]
} | go | func (c *Corpus) WordFreq(word string) int {
id, ok := c.ids[word]
if !ok {
return 0
}
return c.frequencies[id]
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"WordFreq",
"(",
"word",
"string",
")",
"int",
"{",
"id",
",",
"ok",
":=",
"c",
".",
"ids",
"[",
"word",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"frequencies",... | // WordFreq returns the frequency of the word. If the word wasn't in the corpus, it returns 0. | [
"WordFreq",
"returns",
"the",
"frequency",
"of",
"the",
"word",
".",
"If",
"the",
"word",
"wasn",
"t",
"in",
"the",
"corpus",
"it",
"returns",
"0",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L109-L116 |
139,420 | chewxy/lingo | corpus/corpus.go | IDFreq | func (c *Corpus) IDFreq(id int) int {
size := atomic.LoadInt64(&c.maxid)
maxid := int(size)
if id >= maxid {
return 0
}
return c.frequencies[id]
} | go | func (c *Corpus) IDFreq(id int) int {
size := atomic.LoadInt64(&c.maxid)
maxid := int(size)
if id >= maxid {
return 0
}
return c.frequencies[id]
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"IDFreq",
"(",
"id",
"int",
")",
"int",
"{",
"size",
":=",
"atomic",
".",
"LoadInt64",
"(",
"&",
"c",
".",
"maxid",
")",
"\n",
"maxid",
":=",
"int",
"(",
"size",
")",
"\n\n",
"if",
"id",
">=",
"maxid",
"{",... | // IDFreq returns the frequency of a word given an ID. If the word isn't in the corpus it returns 0. | [
"IDFreq",
"returns",
"the",
"frequency",
"of",
"a",
"word",
"given",
"an",
"ID",
".",
"If",
"the",
"word",
"isn",
"t",
"in",
"the",
"corpus",
"it",
"returns",
"0",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L119-L127 |
139,421 | chewxy/lingo | corpus/corpus.go | WordProb | func (c *Corpus) WordProb(word string) (float64, bool) {
id, ok := c.Id(word)
if !ok {
return 0, false
}
count := c.frequencies[id]
return float64(count) / float64(c.totalFreq), true
} | go | func (c *Corpus) WordProb(word string) (float64, bool) {
id, ok := c.Id(word)
if !ok {
return 0, false
}
count := c.frequencies[id]
return float64(count) / float64(c.totalFreq), true
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"WordProb",
"(",
"word",
"string",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"id",
",",
"ok",
":=",
"c",
".",
"Id",
"(",
"word",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
... | // WordProb returns the probability of a word appearing in the corpus. | [
"WordProb",
"returns",
"the",
"probability",
"of",
"a",
"word",
"appearing",
"in",
"the",
"corpus",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L140-L149 |
139,422 | chewxy/lingo | corpus/corpus.go | Merge | func (c *Corpus) Merge(other *Corpus) {
for i, word := range other.words {
freq := other.frequencies[i]
if id, ok := c.ids[word]; ok {
c.frequencies[id] += freq
c.totalFreq += freq
} else {
id := c.Add(word)
c.frequencies[id] += freq - 1
c.totalFreq += freq - 1
}
}
} | go | func (c *Corpus) Merge(other *Corpus) {
for i, word := range other.words {
freq := other.frequencies[i]
if id, ok := c.ids[word]; ok {
c.frequencies[id] += freq
c.totalFreq += freq
} else {
id := c.Add(word)
c.frequencies[id] += freq - 1
c.totalFreq += freq - 1
}
}
} | [
"func",
"(",
"c",
"*",
"Corpus",
")",
"Merge",
"(",
"other",
"*",
"Corpus",
")",
"{",
"for",
"i",
",",
"word",
":=",
"range",
"other",
".",
"words",
"{",
"freq",
":=",
"other",
".",
"frequencies",
"[",
"i",
"]",
"\n",
"if",
"id",
",",
"ok",
":=... | // Merge combines two corpuses. The receiver is the one that is mutated. | [
"Merge",
"combines",
"two",
"corpuses",
".",
"The",
"receiver",
"is",
"the",
"one",
"that",
"is",
"mutated",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L152-L164 |
139,423 | chewxy/lingo | dep/evaluation.go | Evaluate | func Evaluate(predictedTrees, goldTrees []*lingo.Dependency) Performance {
if len(predictedTrees) != len(goldTrees) {
panic(fmt.Sprintf("%d predicted trees; %d gold trees. Unable to compare", len(predictedTrees), len(goldTrees)))
}
var correctLabels, correctHeads, correctTrees, correctRoot, sumArcs float64
var c... | go | func Evaluate(predictedTrees, goldTrees []*lingo.Dependency) Performance {
if len(predictedTrees) != len(goldTrees) {
panic(fmt.Sprintf("%d predicted trees; %d gold trees. Unable to compare", len(predictedTrees), len(goldTrees)))
}
var correctLabels, correctHeads, correctTrees, correctRoot, sumArcs float64
var c... | [
"func",
"Evaluate",
"(",
"predictedTrees",
",",
"goldTrees",
"[",
"]",
"*",
"lingo",
".",
"Dependency",
")",
"Performance",
"{",
"if",
"len",
"(",
"predictedTrees",
")",
"!=",
"len",
"(",
"goldTrees",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
... | // performance evaluation related code goes here
// Evaluate compares predicted trees with the gold standard trees and returns a Performance. It panics if the number of predicted trees and the number of gold trees aren't the same | [
"performance",
"evaluation",
"related",
"code",
"goes",
"here",
"Evaluate",
"compares",
"predicted",
"trees",
"with",
"the",
"gold",
"standard",
"trees",
"and",
"returns",
"a",
"Performance",
".",
"It",
"panics",
"if",
"the",
"number",
"of",
"predicted",
"trees"... | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/evaluation.go#L33-L85 |
139,424 | chewxy/lingo | dep/arcStandard.go | apply | func (c *configuration) apply(t transition) {
logf("Applying %v", t)
w1 := int(c.stackValue(1))
w2 := int(c.stackValue(0))
if t.Move == Left {
c.AddArc(w2, w1, t.DependencyType)
c.removeSecondTopStack()
} else if t.Move == Right {
c.AddArc(w1, w2, t.DependencyType)
c.removeTopStack()
} else {
c.shift()... | go | func (c *configuration) apply(t transition) {
logf("Applying %v", t)
w1 := int(c.stackValue(1))
w2 := int(c.stackValue(0))
if t.Move == Left {
c.AddArc(w2, w1, t.DependencyType)
c.removeSecondTopStack()
} else if t.Move == Right {
c.AddArc(w1, w2, t.DependencyType)
c.removeTopStack()
} else {
c.shift()... | [
"func",
"(",
"c",
"*",
"configuration",
")",
"apply",
"(",
"t",
"transition",
")",
"{",
"logf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"w1",
":=",
"int",
"(",
"c",
".",
"stackValue",
"(",
"1",
")",
")",
"\n",
"w2",
":=",
"int",
"(",
"c",
".",
... | // apply applies the transition | [
"apply",
"applies",
"the",
"transition"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/arcStandard.go#L45-L59 |
139,425 | chewxy/lingo | dep/arcStandard.go | oracle | func (c *configuration) oracle(goldParse *lingo.Dependency) (t transition) {
w1 := int(c.stackValue(1))
w2 := int(c.stackValue(0))
if w1 > 0 && goldParse.Head(w1) == w2 {
t.Move = Left
t.DependencyType = goldParse.Label(w1)
return
} else if w1 >= 0 && goldParse.Head(w2) == w1 && !c.hasOtherChildren(w2, goldP... | go | func (c *configuration) oracle(goldParse *lingo.Dependency) (t transition) {
w1 := int(c.stackValue(1))
w2 := int(c.stackValue(0))
if w1 > 0 && goldParse.Head(w1) == w2 {
t.Move = Left
t.DependencyType = goldParse.Label(w1)
return
} else if w1 >= 0 && goldParse.Head(w2) == w1 && !c.hasOtherChildren(w2, goldP... | [
"func",
"(",
"c",
"*",
"configuration",
")",
"oracle",
"(",
"goldParse",
"*",
"lingo",
".",
"Dependency",
")",
"(",
"t",
"transition",
")",
"{",
"w1",
":=",
"int",
"(",
"c",
".",
"stackValue",
"(",
"1",
")",
")",
"\n",
"w2",
":=",
"int",
"(",
"c"... | // oracle gets the gold transition given the state | [
"oracle",
"gets",
"the",
"gold",
"transition",
"given",
"the",
"state"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/arcStandard.go#L62-L77 |
139,426 | chewxy/lingo | annotation.go | AnnotationFromLexTag | func AnnotationFromLexTag(l Lexeme, t POSTag, f AnnotationFixer) *Annotation {
a := &Annotation{
Lexeme: l,
POSTag: t,
DependencyType: NoDepType,
Lemma: "",
Lowered: strings.ToLower(l.Value),
}
// it's ok to panic - it will cause the tests to fail
if err := a.Process(f); e... | go | func AnnotationFromLexTag(l Lexeme, t POSTag, f AnnotationFixer) *Annotation {
a := &Annotation{
Lexeme: l,
POSTag: t,
DependencyType: NoDepType,
Lemma: "",
Lowered: strings.ToLower(l.Value),
}
// it's ok to panic - it will cause the tests to fail
if err := a.Process(f); e... | [
"func",
"AnnotationFromLexTag",
"(",
"l",
"Lexeme",
",",
"t",
"POSTag",
",",
"f",
"AnnotationFixer",
")",
"*",
"Annotation",
"{",
"a",
":=",
"&",
"Annotation",
"{",
"Lexeme",
":",
"l",
",",
"POSTag",
":",
"t",
",",
"DependencyType",
":",
"NoDepType",
","... | // AnnotationFromLexTag is only ever used in tests. Fixer is optional | [
"AnnotationFromLexTag",
"is",
"only",
"ever",
"used",
"in",
"tests",
".",
"Fixer",
"is",
"optional"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/annotation.go#L46-L61 |
139,427 | chewxy/lingo | browncluster.go | ReadCluster | func ReadCluster(r io.Reader) map[string]Cluster {
scanner := bufio.NewScanner(r)
clusters := make(map[string]Cluster)
for scanner.Scan() {
line := scanner.Text()
splits := strings.Split(line, "\t")
var word string
var cluster, freq int
word = splits[1]
var i64 int64
var err error
if i64, err = s... | go | func ReadCluster(r io.Reader) map[string]Cluster {
scanner := bufio.NewScanner(r)
clusters := make(map[string]Cluster)
for scanner.Scan() {
line := scanner.Text()
splits := strings.Split(line, "\t")
var word string
var cluster, freq int
word = splits[1]
var i64 int64
var err error
if i64, err = s... | [
"func",
"ReadCluster",
"(",
"r",
"io",
".",
"Reader",
")",
"map",
"[",
"string",
"]",
"Cluster",
"{",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"r",
")",
"\n",
"clusters",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"Cluster",
")",
"\n\n",
... | // ReadCluster reads PercyLiang's cluster file format and returns a map of strings to Cluster | [
"ReadCluster",
"reads",
"PercyLiang",
"s",
"cluster",
"file",
"format",
"and",
"returns",
"a",
"map",
"of",
"strings",
"to",
"Cluster"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/browncluster.go#L18-L69 |
139,428 | chewxy/lingo | sentence.go | IDs | func (as AnnotatedSentence) IDs() []int {
retVal := make([]int, len(as))
for i, a := range as {
retVal[i] = a.ID
}
return retVal
} | go | func (as AnnotatedSentence) IDs() []int {
retVal := make([]int, len(as))
for i, a := range as {
retVal[i] = a.ID
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"IDs",
"(",
")",
"[",
"]",
"int",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"retVal",
"[",
"i",
"]",
... | // IDs returns the list of IDs in the sentence. The return value has exactly the same length as the sentence. | [
"IDs",
"returns",
"the",
"list",
"of",
"IDs",
"in",
"the",
"sentence",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L107-L113 |
139,429 | chewxy/lingo | sentence.go | Tags | func (as AnnotatedSentence) Tags() []POSTag {
retVal := make([]POSTag, len(as))
for i, a := range as {
retVal[i] = a.POSTag
}
return retVal
} | go | func (as AnnotatedSentence) Tags() []POSTag {
retVal := make([]POSTag, len(as))
for i, a := range as {
retVal[i] = a.POSTag
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"Tags",
"(",
")",
"[",
"]",
"POSTag",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"POSTag",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"retVal",
"[",
"i",
... | // Tags returns the POSTags of the sentence. The return value has exactly the same length as the sentence. | [
"Tags",
"returns",
"the",
"POSTags",
"of",
"the",
"sentence",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L116-L122 |
139,430 | chewxy/lingo | sentence.go | Heads | func (as AnnotatedSentence) Heads() []int {
retVal := make([]int, len(as))
for i, a := range as {
retVal[i] = a.HeadID()
}
return retVal
} | go | func (as AnnotatedSentence) Heads() []int {
retVal := make([]int, len(as))
for i, a := range as {
retVal[i] = a.HeadID()
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"Heads",
"(",
")",
"[",
"]",
"int",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"retVal",
"[",
"i",
"]"... | // Heads returns the head IDs of the sentence. The return value has exactly the same length as the sentence. | [
"Heads",
"returns",
"the",
"head",
"IDs",
"of",
"the",
"sentence",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L125-L131 |
139,431 | chewxy/lingo | sentence.go | Labels | func (as AnnotatedSentence) Labels() []DependencyType {
retVal := make([]DependencyType, len(as))
for i, a := range as {
retVal[i] = a.DependencyType
}
return retVal
} | go | func (as AnnotatedSentence) Labels() []DependencyType {
retVal := make([]DependencyType, len(as))
for i, a := range as {
retVal[i] = a.DependencyType
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"Labels",
"(",
")",
"[",
"]",
"DependencyType",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"DependencyType",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"retVa... | // Labels returns the DependencyTypes of the sentence. The return value has exactly the same length as the sentence. | [
"Labels",
"returns",
"the",
"DependencyTypes",
"of",
"the",
"sentence",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L144-L150 |
139,432 | chewxy/lingo | sentence.go | StringSlice | func (as AnnotatedSentence) StringSlice() []string {
retVal := make([]string, len(as), len(as))
for i, a := range as {
retVal[i] = a.Value
}
return retVal
} | go | func (as AnnotatedSentence) StringSlice() []string {
retVal := make([]string, len(as), len(as))
for i, a := range as {
retVal[i] = a.Value
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"StringSlice",
"(",
")",
"[",
"]",
"string",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"as",
")",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"rang... | // StringSlice returns the original words as a slice of string. The return value has exactly the same length as the sentence. | [
"StringSlice",
"returns",
"the",
"original",
"words",
"as",
"a",
"slice",
"of",
"string",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L153-L159 |
139,433 | chewxy/lingo | sentence.go | LoweredStringSlice | func (as AnnotatedSentence) LoweredStringSlice() []string {
retVal := make([]string, len(as), len(as))
for i, a := range as {
retVal[i] = a.Lowered
}
return retVal
} | go | func (as AnnotatedSentence) LoweredStringSlice() []string {
retVal := make([]string, len(as), len(as))
for i, a := range as {
retVal[i] = a.Lowered
}
return retVal
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"LoweredStringSlice",
"(",
")",
"[",
"]",
"string",
"{",
"retVal",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"as",
")",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
... | // LoweredStringSlice returns the lowercased version of the words in the sentence as a slice of string. The return value has exactly the same length as the sentence. | [
"LoweredStringSlice",
"returns",
"the",
"lowercased",
"version",
"of",
"the",
"words",
"in",
"the",
"sentence",
"as",
"a",
"slice",
"of",
"string",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L162-L168 |
139,434 | chewxy/lingo | sentence.go | Lemmas | func (as AnnotatedSentence) Lemmas() []string {
lemmas := make([]string, len(as))
for i, a := range as {
lemmas[i] = a.Lemma
}
return lemmas
} | go | func (as AnnotatedSentence) Lemmas() []string {
lemmas := make([]string, len(as))
for i, a := range as {
lemmas[i] = a.Lemma
}
return lemmas
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"Lemmas",
"(",
")",
"[",
"]",
"string",
"{",
"lemmas",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"lemmas",
"[",
"i"... | // Lemmas returns the lemmas as as slice of string. The return value has exactly the same length as the sentence. | [
"Lemmas",
"returns",
"the",
"lemmas",
"as",
"as",
"slice",
"of",
"string",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L171-L177 |
139,435 | chewxy/lingo | sentence.go | Stems | func (as AnnotatedSentence) Stems() []string {
stems := make([]string, len(as))
for i, a := range as {
stems[i] = a.Stem
}
return stems
} | go | func (as AnnotatedSentence) Stems() []string {
stems := make([]string, len(as))
for i, a := range as {
stems[i] = a.Stem
}
return stems
} | [
"func",
"(",
"as",
"AnnotatedSentence",
")",
"Stems",
"(",
")",
"[",
"]",
"string",
"{",
"stems",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"as",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"as",
"{",
"stems",
"[",
"i",
... | // Stems returns the stems as a slice of string. The return value has exactly the same length as the sentence. | [
"Stems",
"returns",
"the",
"stems",
"as",
"a",
"slice",
"of",
"string",
".",
"The",
"return",
"value",
"has",
"exactly",
"the",
"same",
"length",
"as",
"the",
"sentence",
"."
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L180-L186 |
139,436 | chewxy/lingo | corpus/consopt.go | WithWords | func WithWords(a []string) ConsOpt {
f := func(c *Corpus) error {
s := set.Strings(a)
c.words = s
c.frequencies = make([]int, len(s))
for i := range c.frequencies {
c.frequencies[i] = 1
}
ids := make(map[string]int)
maxID := len(s)
totalFreq := len(s)
var maxWL int
for i, w := range a {
if l... | go | func WithWords(a []string) ConsOpt {
f := func(c *Corpus) error {
s := set.Strings(a)
c.words = s
c.frequencies = make([]int, len(s))
for i := range c.frequencies {
c.frequencies[i] = 1
}
ids := make(map[string]int)
maxID := len(s)
totalFreq := len(s)
var maxWL int
for i, w := range a {
if l... | [
"func",
"WithWords",
"(",
"a",
"[",
"]",
"string",
")",
"ConsOpt",
"{",
"f",
":=",
"func",
"(",
"c",
"*",
"Corpus",
")",
"error",
"{",
"s",
":=",
"set",
".",
"Strings",
"(",
"a",
")",
"\n",
"c",
".",
"words",
"=",
"s",
"\n",
"c",
".",
"freque... | // WithWords creates a corpus from a | [
"WithWords",
"creates",
"a",
"corpus",
"from",
"a"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/consopt.go#L13-L40 |
139,437 | chewxy/lingo | corpus/consopt.go | WithSize | func WithSize(size int) ConsOpt {
return func(c *Corpus) error {
c.words = make([]string, 0, size)
c.frequencies = make([]int, 0, size)
return nil
}
} | go | func WithSize(size int) ConsOpt {
return func(c *Corpus) error {
c.words = make([]string, 0, size)
c.frequencies = make([]int, 0, size)
return nil
}
} | [
"func",
"WithSize",
"(",
"size",
"int",
")",
"ConsOpt",
"{",
"return",
"func",
"(",
"c",
"*",
"Corpus",
")",
"error",
"{",
"c",
".",
"words",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"size",
")",
"\n",
"c",
".",
"frequencies",
"=",
... | // WithSize preallocates all the things in Corpus | [
"WithSize",
"preallocates",
"all",
"the",
"things",
"in",
"Corpus"
] | 238c8836f032c232f721977047cece06842fcdf2 | https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/consopt.go#L43-L49 |
139,438 | desertbit/glue | socket.go | newSocket | func newSocket(server *Server, bs backend.BackendSocket) *Socket {
// Create a new socket value.
s := &Socket{
server: server,
bs: bs,
id: utils.RandomString(socketIDLength),
channels: newChannels(),
writeChan: bs.WriteChan(),
readChan: bs.ReadChan(),
isClosedChan: bs.ClosedChan(),
... | go | func newSocket(server *Server, bs backend.BackendSocket) *Socket {
// Create a new socket value.
s := &Socket{
server: server,
bs: bs,
id: utils.RandomString(socketIDLength),
channels: newChannels(),
writeChan: bs.WriteChan(),
readChan: bs.ReadChan(),
isClosedChan: bs.ClosedChan(),
... | [
"func",
"newSocket",
"(",
"server",
"*",
"Server",
",",
"bs",
"backend",
".",
"BackendSocket",
")",
"*",
"Socket",
"{",
"// Create a new socket value.",
"s",
":=",
"&",
"Socket",
"{",
"server",
":",
"server",
",",
"bs",
":",
"bs",
",",
"id",
":",
"utils"... | // newSocket creates a new socket and initializes it. | [
"newSocket",
"creates",
"a",
"new",
"socket",
"and",
"initializes",
"it",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L147-L202 |
139,439 | desertbit/glue | socket.go | OnClose | func (s *Socket) OnClose(f OnCloseFunc) {
go func() {
// Recover panics and log the error.
defer func() {
if e := recover(); e != nil {
log.L.Errorf("glue: panic while calling onClose function: %v\n%s", e, debug.Stack())
}
}()
<-s.isClosedChan
f()
}()
} | go | func (s *Socket) OnClose(f OnCloseFunc) {
go func() {
// Recover panics and log the error.
defer func() {
if e := recover(); e != nil {
log.L.Errorf("glue: panic while calling onClose function: %v\n%s", e, debug.Stack())
}
}()
<-s.isClosedChan
f()
}()
} | [
"func",
"(",
"s",
"*",
"Socket",
")",
"OnClose",
"(",
"f",
"OnCloseFunc",
")",
"{",
"go",
"func",
"(",
")",
"{",
"// Recover panics and log the error.",
"defer",
"func",
"(",
")",
"{",
"if",
"e",
":=",
"recover",
"(",
")",
";",
"e",
"!=",
"nil",
"{",... | // OnClose sets the functions which is triggered if the socket connection is closed.
// This method can be called multiple times to bind multiple functions. | [
"OnClose",
"sets",
"the",
"functions",
"which",
"is",
"triggered",
"if",
"the",
"socket",
"connection",
"is",
"closed",
".",
"This",
"method",
"can",
"be",
"called",
"multiple",
"times",
"to",
"bind",
"multiple",
"functions",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L239-L251 |
139,440 | desertbit/glue | socket.go | Read | func (s *Socket) Read(timeout ...time.Duration) (string, error) {
return s.mainChannel.Read(timeout...)
} | go | func (s *Socket) Read(timeout ...time.Duration) (string, error) {
return s.mainChannel.Read(timeout...)
} | [
"func",
"(",
"s",
"*",
"Socket",
")",
"Read",
"(",
"timeout",
"...",
"time",
".",
"Duration",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"s",
".",
"mainChannel",
".",
"Read",
"(",
"timeout",
"...",
")",
"\n",
"}"
] | // Read the next message from the socket. This method is blocking.
// One variadic argument sets a timeout duration.
// If no timeout is specified, this method will block forever.
// ErrSocketClosed is returned, if the socket connection is closed.
// ErrReadTimeout is returned, if the timeout is reached. | [
"Read",
"the",
"next",
"message",
"from",
"the",
"socket",
".",
"This",
"method",
"is",
"blocking",
".",
"One",
"variadic",
"argument",
"sets",
"a",
"timeout",
"duration",
".",
"If",
"no",
"timeout",
"is",
"specified",
"this",
"method",
"will",
"block",
"f... | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L270-L272 |
139,441 | desertbit/glue | socket.go | sendPing | func (s *Socket) sendPing() {
// Lock the mutex.
s.sendPingMutex.Lock()
// Check if a ping request is already active.
if s.pingRequestActive {
// Unlock the mutex again.
s.sendPingMutex.Unlock()
return
}
// Update the flag and unlock the mutex again.
s.pingRequestActive = true
s.sendPingMutex.Unlock()
... | go | func (s *Socket) sendPing() {
// Lock the mutex.
s.sendPingMutex.Lock()
// Check if a ping request is already active.
if s.pingRequestActive {
// Unlock the mutex again.
s.sendPingMutex.Unlock()
return
}
// Update the flag and unlock the mutex again.
s.pingRequestActive = true
s.sendPingMutex.Unlock()
... | [
"func",
"(",
"s",
"*",
"Socket",
")",
"sendPing",
"(",
")",
"{",
"// Lock the mutex.",
"s",
".",
"sendPingMutex",
".",
"Lock",
"(",
")",
"\n\n",
"// Check if a ping request is already active.",
"if",
"s",
".",
"pingRequestActive",
"{",
"// Unlock the mutex again.",
... | // SendPing sends a ping to the client. If no pong response is
// received within the timeout, the socket will be closed.
// Multiple calls to this method won't send multiple ping requests,
// if a ping request is already active. | [
"SendPing",
"sends",
"a",
"ping",
"to",
"the",
"client",
".",
"If",
"no",
"pong",
"response",
"is",
"received",
"within",
"the",
"timeout",
"the",
"socket",
"will",
"be",
"closed",
".",
"Multiple",
"calls",
"to",
"this",
"method",
"won",
"t",
"send",
"mu... | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L355-L379 |
139,442 | desertbit/glue | socket.go | pingTimeoutHandler | func (s *Socket) pingTimeoutHandler() {
defer func() {
s.pingTimeout.Stop()
}()
select {
case <-s.pingTimeout.C:
// Close the socket due to the timeout.
s.bs.Close()
case <-s.isClosedChan:
// Just release this goroutine.
}
} | go | func (s *Socket) pingTimeoutHandler() {
defer func() {
s.pingTimeout.Stop()
}()
select {
case <-s.pingTimeout.C:
// Close the socket due to the timeout.
s.bs.Close()
case <-s.isClosedChan:
// Just release this goroutine.
}
} | [
"func",
"(",
"s",
"*",
"Socket",
")",
"pingTimeoutHandler",
"(",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"s",
".",
"pingTimeout",
".",
"Stop",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"s",
".",
"pingTimeout",
".",
"C"... | // Close the socket during a ping response timeout. | [
"Close",
"the",
"socket",
"during",
"a",
"ping",
"response",
"timeout",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L382-L394 |
139,443 | desertbit/glue | server.go | NewServer | func NewServer(o ...Options) *Server {
// Get or create the options.
var options *Options
if len(o) > 0 {
options = &o[0]
} else {
options = &Options{}
}
// Set the default option values for unset values.
options.SetDefaults()
// Create a new backend server.
bs := backend.NewServer(len(options.HTTPHandle... | go | func NewServer(o ...Options) *Server {
// Get or create the options.
var options *Options
if len(o) > 0 {
options = &o[0]
} else {
options = &Options{}
}
// Set the default option values for unset values.
options.SetDefaults()
// Create a new backend server.
bs := backend.NewServer(len(options.HTTPHandle... | [
"func",
"NewServer",
"(",
"o",
"...",
"Options",
")",
"*",
"Server",
"{",
"// Get or create the options.",
"var",
"options",
"*",
"Options",
"\n",
"if",
"len",
"(",
"o",
")",
">",
"0",
"{",
"options",
"=",
"&",
"o",
"[",
"0",
"]",
"\n",
"}",
"else",
... | // NewServer creates a new glue server instance.
// One variadic arguments specifies the server options. | [
"NewServer",
"creates",
"a",
"new",
"glue",
"server",
"instance",
".",
"One",
"variadic",
"arguments",
"specifies",
"the",
"server",
"options",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L59-L86 |
139,444 | desertbit/glue | server.go | Block | func (s *Server) Block(b bool) {
s.blockMutex.Lock()
defer s.blockMutex.Unlock()
s.block = b
} | go | func (s *Server) Block(b bool) {
s.blockMutex.Lock()
defer s.blockMutex.Unlock()
s.block = b
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Block",
"(",
"b",
"bool",
")",
"{",
"s",
".",
"blockMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"blockMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"block",
"=",
"b",
"\n",
"}"
] | // Block new incomming connections. | [
"Block",
"new",
"incomming",
"connections",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L89-L94 |
139,445 | desertbit/glue | server.go | IsBlocked | func (s *Server) IsBlocked() bool {
s.blockMutex.Lock()
defer s.blockMutex.Unlock()
return s.block
} | go | func (s *Server) IsBlocked() bool {
s.blockMutex.Lock()
defer s.blockMutex.Unlock()
return s.block
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"IsBlocked",
"(",
")",
"bool",
"{",
"s",
".",
"blockMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"blockMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"s",
".",
"block",
"\n",
"}"
] | // IsBlocked returns a boolean whenever new incoming connections should be blocked. | [
"IsBlocked",
"returns",
"a",
"boolean",
"whenever",
"new",
"incoming",
"connections",
"should",
"be",
"blocked",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L97-L102 |
139,446 | desertbit/glue | server.go | GetSocket | func (s *Server) GetSocket(id string) *Socket {
// Lock the mutex.
s.socketsMutex.Lock()
defer s.socketsMutex.Unlock()
// Obtain the socket.
socket, ok := s.sockets[id]
if !ok {
return nil
}
return socket
} | go | func (s *Server) GetSocket(id string) *Socket {
// Lock the mutex.
s.socketsMutex.Lock()
defer s.socketsMutex.Unlock()
// Obtain the socket.
socket, ok := s.sockets[id]
if !ok {
return nil
}
return socket
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetSocket",
"(",
"id",
"string",
")",
"*",
"Socket",
"{",
"// Lock the mutex.",
"s",
".",
"socketsMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"socketsMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Obtain... | // GetSocket obtains a socket by its ID.
// Returns nil if not found. | [
"GetSocket",
"obtains",
"a",
"socket",
"by",
"its",
"ID",
".",
"Returns",
"nil",
"if",
"not",
"found",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L114-L126 |
139,447 | desertbit/glue | server.go | Release | func (s *Server) Release() {
// Block all new incomming socket connections.
s.Block(true)
// Wait for a little moment, so new incomming sockets are added
// to the sockets active list.
time.Sleep(200 * time.Millisecond)
// Close all current connected sockets.
sockets := s.Sockets()
for _, s := range sockets {... | go | func (s *Server) Release() {
// Block all new incomming socket connections.
s.Block(true)
// Wait for a little moment, so new incomming sockets are added
// to the sockets active list.
time.Sleep(200 * time.Millisecond)
// Close all current connected sockets.
sockets := s.Sockets()
for _, s := range sockets {... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Release",
"(",
")",
"{",
"// Block all new incomming socket connections.",
"s",
".",
"Block",
"(",
"true",
")",
"\n\n",
"// Wait for a little moment, so new incomming sockets are added",
"// to the sockets active list.",
"time",
".",
... | // Release this package. This will block all new incomming socket connections
// and close all current connected sockets. | [
"Release",
"this",
"package",
".",
"This",
"will",
"block",
"all",
"new",
"incomming",
"socket",
"connections",
"and",
"close",
"all",
"current",
"connected",
"sockets",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L152-L165 |
139,448 | desertbit/glue | server.go | Run | func (s *Server) Run() error {
// Skip if set to none.
if s.options.HTTPSocketType != HTTPSocketTypeNone {
// Set the base glue HTTP handler.
http.Handle(s.options.HTTPHandleURL, s)
// Start the http server.
if s.options.HTTPSocketType == HTTPSocketTypeUnix {
// Listen on the unix socket.
l, err := net... | go | func (s *Server) Run() error {
// Skip if set to none.
if s.options.HTTPSocketType != HTTPSocketTypeNone {
// Set the base glue HTTP handler.
http.Handle(s.options.HTTPHandleURL, s)
// Start the http server.
if s.options.HTTPSocketType == HTTPSocketTypeUnix {
// Listen on the unix socket.
l, err := net... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Run",
"(",
")",
"error",
"{",
"// Skip if set to none.",
"if",
"s",
".",
"options",
".",
"HTTPSocketType",
"!=",
"HTTPSocketTypeNone",
"{",
"// Set the base glue HTTP handler.",
"http",
".",
"Handle",
"(",
"s",
".",
"opti... | // Run starts the server and listens for incoming socket connections.
// This is a blocking method. | [
"Run",
"starts",
"the",
"server",
"and",
"listens",
"for",
"incoming",
"socket",
"connections",
".",
"This",
"is",
"a",
"blocking",
"method",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L169-L204 |
139,449 | desertbit/glue | utils/utils.go | UnmarshalValues | func UnmarshalValues(data string) (first, second string, err error) {
// Find the delimiter.
pos := strings.Index(data, delimiter)
if pos < 0 {
err = fmt.Errorf("unmarshal values: no delimiter found: '%s'", data)
return
}
// Extract the value length integer of the first value.
l, err := strconv.Atoi(data[:po... | go | func UnmarshalValues(data string) (first, second string, err error) {
// Find the delimiter.
pos := strings.Index(data, delimiter)
if pos < 0 {
err = fmt.Errorf("unmarshal values: no delimiter found: '%s'", data)
return
}
// Extract the value length integer of the first value.
l, err := strconv.Atoi(data[:po... | [
"func",
"UnmarshalValues",
"(",
"data",
"string",
")",
"(",
"first",
",",
"second",
"string",
",",
"err",
"error",
")",
"{",
"// Find the delimiter.",
"pos",
":=",
"strings",
".",
"Index",
"(",
"data",
",",
"delimiter",
")",
"\n",
"if",
"pos",
"<",
"0",
... | // UnmarshalValues splits two values from a single string.
// This function is chainable to extract multiple values. | [
"UnmarshalValues",
"splits",
"two",
"values",
"from",
"a",
"single",
"string",
".",
"This",
"function",
"is",
"chainable",
"to",
"extract",
"multiple",
"values",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L55-L84 |
139,450 | desertbit/glue | utils/utils.go | MarshalValues | func MarshalValues(first, second string) string {
return strconv.Itoa(len(first)) + delimiter + first + second
} | go | func MarshalValues(first, second string) string {
return strconv.Itoa(len(first)) + delimiter + first + second
} | [
"func",
"MarshalValues",
"(",
"first",
",",
"second",
"string",
")",
"string",
"{",
"return",
"strconv",
".",
"Itoa",
"(",
"len",
"(",
"first",
")",
")",
"+",
"delimiter",
"+",
"first",
"+",
"second",
"\n",
"}"
] | // MarshalValues joins two values into a single string.
// They can be decoded by the UnmarshalValues function. | [
"MarshalValues",
"joins",
"two",
"values",
"into",
"a",
"single",
"string",
".",
"They",
"can",
"be",
"decoded",
"by",
"the",
"UnmarshalValues",
"function",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L88-L90 |
139,451 | desertbit/glue | utils/utils.go | RemovePortFromRemoteAddr | func RemovePortFromRemoteAddr(remoteAddr string) string {
pos := strings.LastIndex(remoteAddr, ":")
if pos < 0 {
return remoteAddr
}
return remoteAddr[:pos]
} | go | func RemovePortFromRemoteAddr(remoteAddr string) string {
pos := strings.LastIndex(remoteAddr, ":")
if pos < 0 {
return remoteAddr
}
return remoteAddr[:pos]
} | [
"func",
"RemovePortFromRemoteAddr",
"(",
"remoteAddr",
"string",
")",
"string",
"{",
"pos",
":=",
"strings",
".",
"LastIndex",
"(",
"remoteAddr",
",",
"\"",
"\"",
")",
"\n",
"if",
"pos",
"<",
"0",
"{",
"return",
"remoteAddr",
"\n",
"}",
"\n\n",
"return",
... | // RemovePortFromRemoteAddr removes the port if present from the remote address. | [
"RemovePortFromRemoteAddr",
"removes",
"the",
"port",
"if",
"present",
"from",
"the",
"remote",
"address",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L125-L132 |
139,452 | desertbit/glue | backend/sockets/ajaxsocket/socket.go | newSocket | func newSocket(s *Server) *Socket {
a := &Socket{
writeChan: make(chan string, global.WriteChanSize),
readChan: make(chan string, global.ReadChanSize),
}
// Set the closer function.
a.closer = closer.New(func() {
// Remove the ajax socket from the map.
if len(a.uid) > 0 {
func() {
s.socketsMutex.Lo... | go | func newSocket(s *Server) *Socket {
a := &Socket{
writeChan: make(chan string, global.WriteChanSize),
readChan: make(chan string, global.ReadChanSize),
}
// Set the closer function.
a.closer = closer.New(func() {
// Remove the ajax socket from the map.
if len(a.uid) > 0 {
func() {
s.socketsMutex.Lo... | [
"func",
"newSocket",
"(",
"s",
"*",
"Server",
")",
"*",
"Socket",
"{",
"a",
":=",
"&",
"Socket",
"{",
"writeChan",
":",
"make",
"(",
"chan",
"string",
",",
"global",
".",
"WriteChanSize",
")",
",",
"readChan",
":",
"make",
"(",
"chan",
"string",
",",... | // Create a new ajax socket. | [
"Create",
"a",
"new",
"ajax",
"socket",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/ajaxsocket/socket.go#L43-L63 |
139,453 | desertbit/glue | options.go | SetDefaults | func (o *Options) SetDefaults() {
// Set the socket type.
if o.HTTPSocketType != HTTPSocketTypeNone &&
o.HTTPSocketType != HTTPSocketTypeTCP &&
o.HTTPSocketType != HTTPSocketTypeUnix {
o.HTTPSocketType = HTTPSocketTypeTCP
}
// Set the listen address.
if len(o.HTTPListenAddress) == 0 {
o.HTTPListenAddress ... | go | func (o *Options) SetDefaults() {
// Set the socket type.
if o.HTTPSocketType != HTTPSocketTypeNone &&
o.HTTPSocketType != HTTPSocketTypeTCP &&
o.HTTPSocketType != HTTPSocketTypeUnix {
o.HTTPSocketType = HTTPSocketTypeTCP
}
// Set the listen address.
if len(o.HTTPListenAddress) == 0 {
o.HTTPListenAddress ... | [
"func",
"(",
"o",
"*",
"Options",
")",
"SetDefaults",
"(",
")",
"{",
"// Set the socket type.",
"if",
"o",
".",
"HTTPSocketType",
"!=",
"HTTPSocketTypeNone",
"&&",
"o",
".",
"HTTPSocketType",
"!=",
"HTTPSocketTypeTCP",
"&&",
"o",
".",
"HTTPSocketType",
"!=",
"... | // SetDefaults sets unset option values to its default value. | [
"SetDefaults",
"sets",
"unset",
"option",
"values",
"to",
"its",
"default",
"value",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/options.go#L78-L105 |
139,454 | desertbit/glue | backend/server.go | ServeHTTP | func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Get the URL path.
path := r.URL.Path
// Call this in an inline function to handle errors.
statusCode, err := func() (int, error) {
// Check the origin.
if !s.checkOriginFunc(r) {
return http.StatusForbidden, fmt.Errorf("origin not allow... | go | func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Get the URL path.
path := r.URL.Path
// Call this in an inline function to handle errors.
statusCode, err := func() (int, error) {
// Check the origin.
if !s.checkOriginFunc(r) {
return http.StatusForbidden, fmt.Errorf("origin not allow... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Get the URL path.",
"path",
":=",
"r",
".",
"URL",
".",
"Path",
"\n\n",
"// Call this in an inline function to ha... | // ServeHTTP implements the HTTP Handler interface of the http package. | [
"ServeHTTP",
"implements",
"the",
"HTTP",
"Handler",
"interface",
"of",
"the",
"http",
"package",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/server.go#L97-L156 |
139,455 | desertbit/glue | backend/sockets/websocket/socket.go | newSocket | func newSocket(ws *websocket.Conn) *Socket {
w := &Socket{
ws: ws,
writeChan: make(chan string, global.WriteChanSize),
readChan: make(chan string, global.ReadChanSize),
}
// Set the closer function.
w.closer = closer.New(func() {
// Send a close message to the client.
// Ignore errors.
w.write(... | go | func newSocket(ws *websocket.Conn) *Socket {
w := &Socket{
ws: ws,
writeChan: make(chan string, global.WriteChanSize),
readChan: make(chan string, global.ReadChanSize),
}
// Set the closer function.
w.closer = closer.New(func() {
// Send a close message to the client.
// Ignore errors.
w.write(... | [
"func",
"newSocket",
"(",
"ws",
"*",
"websocket",
".",
"Conn",
")",
"*",
"Socket",
"{",
"w",
":=",
"&",
"Socket",
"{",
"ws",
":",
"ws",
",",
"writeChan",
":",
"make",
"(",
"chan",
"string",
",",
"global",
".",
"WriteChanSize",
")",
",",
"readChan",
... | // Create a new websocket value. | [
"Create",
"a",
"new",
"websocket",
"value",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/websocket/socket.go#L67-L85 |
139,456 | desertbit/glue | backend/sockets/websocket/socket.go | write | func (w *Socket) write(mt int, payload []byte) error {
w.writeMutex.Lock()
defer w.writeMutex.Unlock()
w.ws.SetWriteDeadline(time.Now().Add(writeWait))
return w.ws.WriteMessage(mt, payload)
} | go | func (w *Socket) write(mt int, payload []byte) error {
w.writeMutex.Lock()
defer w.writeMutex.Unlock()
w.ws.SetWriteDeadline(time.Now().Add(writeWait))
return w.ws.WriteMessage(mt, payload)
} | [
"func",
"(",
"w",
"*",
"Socket",
")",
"write",
"(",
"mt",
"int",
",",
"payload",
"[",
"]",
"byte",
")",
"error",
"{",
"w",
".",
"writeMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"writeMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"w",
".... | // write writes a message with the given message type and payload.
// This method is thread-safe. | [
"write",
"writes",
"a",
"message",
"with",
"the",
"given",
"message",
"type",
"and",
"payload",
".",
"This",
"method",
"is",
"thread",
"-",
"safe",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/websocket/socket.go#L186-L192 |
139,457 | desertbit/glue | handler.go | New | func (h *handler) New() chan struct{} {
// Lock the mutex.
h.mutex.Lock()
defer h.mutex.Unlock()
// Signal the stop request by closing the channel if open.
if !h.stopChanClosed {
close(h.stopChan)
}
// Create a new stop channel.
h.stopChan = make(chan struct{})
// Update the flag.
h.stopChanClosed = fals... | go | func (h *handler) New() chan struct{} {
// Lock the mutex.
h.mutex.Lock()
defer h.mutex.Unlock()
// Signal the stop request by closing the channel if open.
if !h.stopChanClosed {
close(h.stopChan)
}
// Create a new stop channel.
h.stopChan = make(chan struct{})
// Update the flag.
h.stopChanClosed = fals... | [
"func",
"(",
"h",
"*",
"handler",
")",
"New",
"(",
")",
"chan",
"struct",
"{",
"}",
"{",
"// Lock the mutex.",
"h",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Signal the stop request by c... | // New creates a new handler and stopps the previous handler if present.
// A stop channel is returned, which is closed as soon as the handler is stopped. | [
"New",
"creates",
"a",
"new",
"handler",
"and",
"stopps",
"the",
"previous",
"handler",
"if",
"present",
".",
"A",
"stop",
"channel",
"is",
"returned",
"which",
"is",
"closed",
"as",
"soon",
"as",
"the",
"handler",
"is",
"stopped",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/handler.go#L42-L59 |
139,458 | desertbit/glue | handler.go | Stop | func (h *handler) Stop() {
// Lock the mutex.
h.mutex.Lock()
defer h.mutex.Unlock()
// Signal the stop request by closing the channel if open.
if !h.stopChanClosed {
close(h.stopChan)
h.stopChanClosed = true
}
} | go | func (h *handler) Stop() {
// Lock the mutex.
h.mutex.Lock()
defer h.mutex.Unlock()
// Signal the stop request by closing the channel if open.
if !h.stopChanClosed {
close(h.stopChan)
h.stopChanClosed = true
}
} | [
"func",
"(",
"h",
"*",
"handler",
")",
"Stop",
"(",
")",
"{",
"// Lock the mutex.",
"h",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Signal the stop request by closing the channel if open.",
"if... | // Stop the handler if present. | [
"Stop",
"the",
"handler",
"if",
"present",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/handler.go#L62-L72 |
139,459 | desertbit/glue | backend/closer/closer.go | Close | func (c *Closer) Close() {
// Lock the mutex
c.mutex.Lock()
defer c.mutex.Unlock()
// Just return if already closed.
if c.IsClosed() {
return
}
// Close the channel.
close(c.IsClosedChan)
// Emit the function.
c.f()
} | go | func (c *Closer) Close() {
// Lock the mutex
c.mutex.Lock()
defer c.mutex.Unlock()
// Just return if already closed.
if c.IsClosed() {
return
}
// Close the channel.
close(c.IsClosedChan)
// Emit the function.
c.f()
} | [
"func",
"(",
"c",
"*",
"Closer",
")",
"Close",
"(",
")",
"{",
"// Lock the mutex",
"c",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Just return if already closed.",
"if",
"c",
".",
"IsClos... | // Close calls the function and sets the IsClosed boolean. | [
"Close",
"calls",
"the",
"function",
"and",
"sets",
"the",
"IsClosed",
"boolean",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/closer/closer.go#L45-L60 |
139,460 | desertbit/glue | channel.go | Write | func (c *Channel) Write(data string) {
// Prepend the socket command and send the channel name and data.
c.s.write(cmdChannelData + utils.MarshalValues(c.name, data))
} | go | func (c *Channel) Write(data string) {
// Prepend the socket command and send the channel name and data.
c.s.write(cmdChannelData + utils.MarshalValues(c.name, data))
} | [
"func",
"(",
"c",
"*",
"Channel",
")",
"Write",
"(",
"data",
"string",
")",
"{",
"// Prepend the socket command and send the channel name and data.",
"c",
".",
"s",
".",
"write",
"(",
"cmdChannelData",
"+",
"utils",
".",
"MarshalValues",
"(",
"c",
".",
"name",
... | // Write data to the channel. | [
"Write",
"data",
"to",
"the",
"channel",
"."
] | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L68-L71 |
139,461 | desertbit/glue | channel.go | Read | func (c *Channel) Read(timeout ...time.Duration) (string, error) {
timeoutChan := make(chan (struct{}))
// Create a timeout timer if a timeout is specified.
if len(timeout) > 0 && timeout[0] > 0 {
timer := time.AfterFunc(timeout[0], func() {
// Trigger the timeout by closing the channel.
close(timeoutChan)
... | go | func (c *Channel) Read(timeout ...time.Duration) (string, error) {
timeoutChan := make(chan (struct{}))
// Create a timeout timer if a timeout is specified.
if len(timeout) > 0 && timeout[0] > 0 {
timer := time.AfterFunc(timeout[0], func() {
// Trigger the timeout by closing the channel.
close(timeoutChan)
... | [
"func",
"(",
"c",
"*",
"Channel",
")",
"Read",
"(",
"timeout",
"...",
"time",
".",
"Duration",
")",
"(",
"string",
",",
"error",
")",
"{",
"timeoutChan",
":=",
"make",
"(",
"chan",
"(",
"struct",
"{",
"}",
")",
")",
"\n\n",
"// Create a timeout timer i... | // Read the next message from the channel. This method is blocking.
// One variadic argument sets a timeout duration.
// If no timeout is specified, this method will block forever.
// ErrSocketClosed is returned, if the socket connection is closed.
// ErrReadTimeout is returned, if the timeout is reached. | [
"Read",
"the",
"next",
"message",
"from",
"the",
"channel",
".",
"This",
"method",
"is",
"blocking",
".",
"One",
"variadic",
"argument",
"sets",
"a",
"timeout",
"duration",
".",
"If",
"no",
"timeout",
"is",
"specified",
"this",
"method",
"will",
"block",
"... | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L78-L104 |
139,462 | desertbit/glue | channel.go | OnRead | func (c *Channel) OnRead(f OnReadFunc) {
// Create a new read handler for this channel.
// Previous handlers are stopped first.
handlerStopped := c.readHandler.New()
// Start the handler goroutine.
go func() {
for {
select {
case data := <-c.readChan:
// Call the callback in a new goroutine.
go fu... | go | func (c *Channel) OnRead(f OnReadFunc) {
// Create a new read handler for this channel.
// Previous handlers are stopped first.
handlerStopped := c.readHandler.New()
// Start the handler goroutine.
go func() {
for {
select {
case data := <-c.readChan:
// Call the callback in a new goroutine.
go fu... | [
"func",
"(",
"c",
"*",
"Channel",
")",
"OnRead",
"(",
"f",
"OnReadFunc",
")",
"{",
"// Create a new read handler for this channel.",
"// Previous handlers are stopped first.",
"handlerStopped",
":=",
"c",
".",
"readHandler",
".",
"New",
"(",
")",
"\n\n",
"// Start the... | // OnRead sets the function which is triggered if new data is received on the channel.
// If this event function based method of reading data from the socket is used,
// then don't use the socket Read method.
// Either use the OnRead or the Read approach. | [
"OnRead",
"sets",
"the",
"function",
"which",
"is",
"triggered",
"if",
"new",
"data",
"is",
"received",
"on",
"the",
"channel",
".",
"If",
"this",
"event",
"function",
"based",
"method",
"of",
"reading",
"data",
"from",
"the",
"socket",
"is",
"used",
"then... | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L110-L141 |
139,463 | desertbit/glue | channel.go | DiscardRead | func (c *Channel) DiscardRead() {
// Create a new read handler for this channel.
// Previous handlers are stopped first.
handlerStopped := c.readHandler.New()
// Start the handler goroutine.
go func() {
for {
select {
case <-c.readChan:
// Don't do anything.
// Just discard the data.
case <-c.s... | go | func (c *Channel) DiscardRead() {
// Create a new read handler for this channel.
// Previous handlers are stopped first.
handlerStopped := c.readHandler.New()
// Start the handler goroutine.
go func() {
for {
select {
case <-c.readChan:
// Don't do anything.
// Just discard the data.
case <-c.s... | [
"func",
"(",
"c",
"*",
"Channel",
")",
"DiscardRead",
"(",
")",
"{",
"// Create a new read handler for this channel.",
"// Previous handlers are stopped first.",
"handlerStopped",
":=",
"c",
".",
"readHandler",
".",
"New",
"(",
")",
"\n\n",
"// Start the handler goroutine... | // DiscardRead ignores and discars the data received from this channel.
// Call this method during initialization, if you don't read any data from
// this channel. If received data is not discarded, then the read buffer will block as soon
// as it is full, which will also block the keep-alive mechanism of the socket. T... | [
"DiscardRead",
"ignores",
"and",
"discars",
"the",
"data",
"received",
"from",
"this",
"channel",
".",
"Call",
"this",
"method",
"during",
"initialization",
"if",
"you",
"don",
"t",
"read",
"any",
"data",
"from",
"this",
"channel",
".",
"If",
"received",
"da... | 09c14070c2b18be76289ee6e7745772d39377776 | https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L148-L169 |
139,464 | scottdware/go-bigip | ltm.go | SnatPools | func (b *BigIP) SnatPools() (*SnatPools, error) {
var snatPools SnatPools
err, _ := b.getForEntity(&snatPools, uriLtm, uriSnatPool)
if err != nil {
return nil, err
}
return &snatPools, nil
} | go | func (b *BigIP) SnatPools() (*SnatPools, error) {
var snatPools SnatPools
err, _ := b.getForEntity(&snatPools, uriLtm, uriSnatPool)
if err != nil {
return nil, err
}
return &snatPools, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"SnatPools",
"(",
")",
"(",
"*",
"SnatPools",
",",
"error",
")",
"{",
"var",
"snatPools",
"SnatPools",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"snatPools",
",",
"uriLtm",
",",
"uriSnatPool... | // SnatPools returns a list of snatpools. | [
"SnatPools",
"returns",
"a",
"list",
"of",
"snatpools",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1042-L1050 |
139,465 | scottdware/go-bigip | ltm.go | CreateSnatPool | func (b *BigIP) CreateSnatPool(name string, members []string) error {
config := &SnatPool{
Name: name,
Members: members,
}
return b.post(config, uriLtm, uriSnatPool)
} | go | func (b *BigIP) CreateSnatPool(name string, members []string) error {
config := &SnatPool{
Name: name,
Members: members,
}
return b.post(config, uriLtm, uriSnatPool)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateSnatPool",
"(",
"name",
"string",
",",
"members",
"[",
"]",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"SnatPool",
"{",
"Name",
":",
"name",
",",
"Members",
":",
"members",
",",
"}",
"\n\n",
"return"... | // CreateSnatPool adds a new snatpool to the BIG-IP system. | [
"CreateSnatPool",
"adds",
"a",
"new",
"snatpool",
"to",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1053-L1060 |
139,466 | scottdware/go-bigip | ltm.go | AddSnatPool | func (b *BigIP) AddSnatPool(config *SnatPool) error {
return b.post(config, uriLtm, uriSnatPool)
} | go | func (b *BigIP) AddSnatPool(config *SnatPool) error {
return b.post(config, uriLtm, uriSnatPool)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"AddSnatPool",
"(",
"config",
"*",
"SnatPool",
")",
"error",
"{",
"return",
"b",
".",
"post",
"(",
"config",
",",
"uriLtm",
",",
"uriSnatPool",
")",
"\n",
"}"
] | // AddSnatPool adds a new snatpool by config to the BIG-IP system. | [
"AddSnatPool",
"adds",
"a",
"new",
"snatpool",
"by",
"config",
"to",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1063-L1066 |
139,467 | scottdware/go-bigip | ltm.go | GetSnatPool | func (b *BigIP) GetSnatPool(name string) (*SnatPool, error) {
var snatPool SnatPool
err, ok := b.getForEntity(&snatPool, uriLtm, uriSnatPool, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &snatPool, nil
} | go | func (b *BigIP) GetSnatPool(name string) (*SnatPool, error) {
var snatPool SnatPool
err, ok := b.getForEntity(&snatPool, uriLtm, uriSnatPool, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &snatPool, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"GetSnatPool",
"(",
"name",
"string",
")",
"(",
"*",
"SnatPool",
",",
"error",
")",
"{",
"var",
"snatPool",
"SnatPool",
"\n",
"err",
",",
"ok",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"snatPool",
",",
"uriLtm",
... | // GetSnatPool retrieves a SnatPool by name. Returns nil if the snatpool does not exist | [
"GetSnatPool",
"retrieves",
"a",
"SnatPool",
"by",
"name",
".",
"Returns",
"nil",
"if",
"the",
"snatpool",
"does",
"not",
"exist"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1069-L1080 |
139,468 | scottdware/go-bigip | ltm.go | DeleteSnatPool | func (b *BigIP) DeleteSnatPool(name string) error {
return b.delete(uriLtm, uriSnatPool, name)
} | go | func (b *BigIP) DeleteSnatPool(name string) error {
return b.delete(uriLtm, uriSnatPool, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteSnatPool",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriSnatPool",
",",
"name",
")",
"\n",
"}"
] | // DeleteSnatPool removes a snatpool. | [
"DeleteSnatPool",
"removes",
"a",
"snatpool",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1083-L1085 |
139,469 | scottdware/go-bigip | ltm.go | ModifySnatPool | func (b *BigIP) ModifySnatPool(name string, config *SnatPool) error {
return b.put(config, uriLtm, uriSnatPool, name)
} | go | func (b *BigIP) ModifySnatPool(name string, config *SnatPool) error {
return b.put(config, uriLtm, uriSnatPool, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifySnatPool",
"(",
"name",
"string",
",",
"config",
"*",
"SnatPool",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriSnatPool",
",",
"name",
")",
"\n",
"}"
] | // ModifySnatPool allows you to change any attribute of a snatpool. Fields that
// can be modified are referenced in the Snatpool struct. | [
"ModifySnatPool",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"snatpool",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"Snatpool",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1089-L1091 |
139,470 | scottdware/go-bigip | ltm.go | ServerSSLProfiles | func (b *BigIP) ServerSSLProfiles() (*ServerSSLProfiles, error) {
var serverSSLProfiles ServerSSLProfiles
err, _ := b.getForEntity(&serverSSLProfiles, uriLtm, uriProfile, uriServerSSL)
if err != nil {
return nil, err
}
return &serverSSLProfiles, nil
} | go | func (b *BigIP) ServerSSLProfiles() (*ServerSSLProfiles, error) {
var serverSSLProfiles ServerSSLProfiles
err, _ := b.getForEntity(&serverSSLProfiles, uriLtm, uriProfile, uriServerSSL)
if err != nil {
return nil, err
}
return &serverSSLProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ServerSSLProfiles",
"(",
")",
"(",
"*",
"ServerSSLProfiles",
",",
"error",
")",
"{",
"var",
"serverSSLProfiles",
"ServerSSLProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"serverSSLProfiles",
... | // ServerSSLProfiles returns a list of server-ssl profiles. | [
"ServerSSLProfiles",
"returns",
"a",
"list",
"of",
"server",
"-",
"ssl",
"profiles",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1094-L1102 |
139,471 | scottdware/go-bigip | ltm.go | GetServerSSLProfile | func (b *BigIP) GetServerSSLProfile(name string) (*ServerSSLProfile, error) {
var serverSSLProfile ServerSSLProfile
err, ok := b.getForEntity(&serverSSLProfile, uriLtm, uriProfile, uriServerSSL, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &serverSSLProfile, nil
} | go | func (b *BigIP) GetServerSSLProfile(name string) (*ServerSSLProfile, error) {
var serverSSLProfile ServerSSLProfile
err, ok := b.getForEntity(&serverSSLProfile, uriLtm, uriProfile, uriServerSSL, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &serverSSLProfile, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"GetServerSSLProfile",
"(",
"name",
"string",
")",
"(",
"*",
"ServerSSLProfile",
",",
"error",
")",
"{",
"var",
"serverSSLProfile",
"ServerSSLProfile",
"\n",
"err",
",",
"ok",
":=",
"b",
".",
"getForEntity",
"(",
"&",
... | // GetServerSSLProfile gets a server-ssl profile by name. Returns nil if the server-ssl profile does not exist | [
"GetServerSSLProfile",
"gets",
"a",
"server",
"-",
"ssl",
"profile",
"by",
"name",
".",
"Returns",
"nil",
"if",
"the",
"server",
"-",
"ssl",
"profile",
"does",
"not",
"exist"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1105-L1116 |
139,472 | scottdware/go-bigip | ltm.go | CreateServerSSLProfile | func (b *BigIP) CreateServerSSLProfile(name string, parent string) error {
config := &ServerSSLProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriServerSSL)
} | go | func (b *BigIP) CreateServerSSLProfile(name string, parent string) error {
config := &ServerSSLProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriServerSSL)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateServerSSLProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"ServerSSLProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"re... | // CreateServerSSLProfile creates a new server-ssl profile on the BIG-IP system. | [
"CreateServerSSLProfile",
"creates",
"a",
"new",
"server",
"-",
"ssl",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1119-L1126 |
139,473 | scottdware/go-bigip | ltm.go | AddServerSSLProfile | func (b *BigIP) AddServerSSLProfile(config *ServerSSLProfile) error {
return b.post(config, uriLtm, uriProfile, uriServerSSL)
} | go | func (b *BigIP) AddServerSSLProfile(config *ServerSSLProfile) error {
return b.post(config, uriLtm, uriProfile, uriServerSSL)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"AddServerSSLProfile",
"(",
"config",
"*",
"ServerSSLProfile",
")",
"error",
"{",
"return",
"b",
".",
"post",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriServerSSL",
")",
"\n",
"}"
] | // AddServerSSLProfile adds a new server-ssl profile on the BIG-IP system. | [
"AddServerSSLProfile",
"adds",
"a",
"new",
"server",
"-",
"ssl",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1129-L1131 |
139,474 | scottdware/go-bigip | ltm.go | DeleteServerSSLProfile | func (b *BigIP) DeleteServerSSLProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriServerSSL, name)
} | go | func (b *BigIP) DeleteServerSSLProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriServerSSL, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteServerSSLProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriServerSSL",
",",
"name",
")",
"\n",
"}"
] | // DeleteServerSSLProfile removes a server-ssl profile. | [
"DeleteServerSSLProfile",
"removes",
"a",
"server",
"-",
"ssl",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1134-L1136 |
139,475 | scottdware/go-bigip | ltm.go | ModifyServerSSLProfile | func (b *BigIP) ModifyServerSSLProfile(name string, config *ServerSSLProfile) error {
return b.put(config, uriLtm, uriProfile, uriServerSSL, name)
} | go | func (b *BigIP) ModifyServerSSLProfile(name string, config *ServerSSLProfile) error {
return b.put(config, uriLtm, uriProfile, uriServerSSL, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyServerSSLProfile",
"(",
"name",
"string",
",",
"config",
"*",
"ServerSSLProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriServerSSL",
",",
"name",
... | // ModifyServerSSLProfile allows you to change any attribute of a sever-ssl profile.
// Fields that can be modified are referenced in the VirtualServer struct. | [
"ModifyServerSSLProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"sever",
"-",
"ssl",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"VirtualServer",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1140-L1142 |
139,476 | scottdware/go-bigip | ltm.go | ClientSSLProfiles | func (b *BigIP) ClientSSLProfiles() (*ClientSSLProfiles, error) {
var clientSSLProfiles ClientSSLProfiles
err, _ := b.getForEntity(&clientSSLProfiles, uriLtm, uriProfile, uriClientSSL)
if err != nil {
return nil, err
}
return &clientSSLProfiles, nil
} | go | func (b *BigIP) ClientSSLProfiles() (*ClientSSLProfiles, error) {
var clientSSLProfiles ClientSSLProfiles
err, _ := b.getForEntity(&clientSSLProfiles, uriLtm, uriProfile, uriClientSSL)
if err != nil {
return nil, err
}
return &clientSSLProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ClientSSLProfiles",
"(",
")",
"(",
"*",
"ClientSSLProfiles",
",",
"error",
")",
"{",
"var",
"clientSSLProfiles",
"ClientSSLProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"clientSSLProfiles",
... | // ClientSSLProfiles returns a list of client-ssl profiles. | [
"ClientSSLProfiles",
"returns",
"a",
"list",
"of",
"client",
"-",
"ssl",
"profiles",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1145-L1153 |
139,477 | scottdware/go-bigip | ltm.go | GetClientSSLProfile | func (b *BigIP) GetClientSSLProfile(name string) (*ClientSSLProfile, error) {
var clientSSLProfile ClientSSLProfile
err, ok := b.getForEntity(&clientSSLProfile, uriLtm, uriProfile, uriClientSSL, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &clientSSLProfile, nil
} | go | func (b *BigIP) GetClientSSLProfile(name string) (*ClientSSLProfile, error) {
var clientSSLProfile ClientSSLProfile
err, ok := b.getForEntity(&clientSSLProfile, uriLtm, uriProfile, uriClientSSL, name)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return &clientSSLProfile, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"GetClientSSLProfile",
"(",
"name",
"string",
")",
"(",
"*",
"ClientSSLProfile",
",",
"error",
")",
"{",
"var",
"clientSSLProfile",
"ClientSSLProfile",
"\n",
"err",
",",
"ok",
":=",
"b",
".",
"getForEntity",
"(",
"&",
... | // GetClientSSLProfile gets a client-ssl profile by name. Returns nil if the client-ssl profile does not exist | [
"GetClientSSLProfile",
"gets",
"a",
"client",
"-",
"ssl",
"profile",
"by",
"name",
".",
"Returns",
"nil",
"if",
"the",
"client",
"-",
"ssl",
"profile",
"does",
"not",
"exist"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1156-L1167 |
139,478 | scottdware/go-bigip | ltm.go | CreateClientSSLProfile | func (b *BigIP) CreateClientSSLProfile(name string, parent string) error {
config := &ClientSSLProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriClientSSL)
} | go | func (b *BigIP) CreateClientSSLProfile(name string, parent string) error {
config := &ClientSSLProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriClientSSL)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateClientSSLProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"ClientSSLProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"re... | // CreateClientSSLProfile creates a new client-ssl profile on the BIG-IP system. | [
"CreateClientSSLProfile",
"creates",
"a",
"new",
"client",
"-",
"ssl",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1170-L1177 |
139,479 | scottdware/go-bigip | ltm.go | AddClientSSLProfile | func (b *BigIP) AddClientSSLProfile(config *ClientSSLProfile) error {
return b.post(config, uriLtm, uriProfile, uriClientSSL)
} | go | func (b *BigIP) AddClientSSLProfile(config *ClientSSLProfile) error {
return b.post(config, uriLtm, uriProfile, uriClientSSL)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"AddClientSSLProfile",
"(",
"config",
"*",
"ClientSSLProfile",
")",
"error",
"{",
"return",
"b",
".",
"post",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriClientSSL",
")",
"\n",
"}"
] | // AddClientSSLProfile adds a new client-ssl profile on the BIG-IP system. | [
"AddClientSSLProfile",
"adds",
"a",
"new",
"client",
"-",
"ssl",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1180-L1182 |
139,480 | scottdware/go-bigip | ltm.go | DeleteClientSSLProfile | func (b *BigIP) DeleteClientSSLProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriClientSSL, name)
} | go | func (b *BigIP) DeleteClientSSLProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriClientSSL, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteClientSSLProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriClientSSL",
",",
"name",
")",
"\n",
"}"
] | // DeleteClientSSLProfile removes a client-ssl profile. | [
"DeleteClientSSLProfile",
"removes",
"a",
"client",
"-",
"ssl",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1185-L1187 |
139,481 | scottdware/go-bigip | ltm.go | ModifyClientSSLProfile | func (b *BigIP) ModifyClientSSLProfile(name string, config *ClientSSLProfile) error {
return b.put(config, uriLtm, uriProfile, uriClientSSL, name)
} | go | func (b *BigIP) ModifyClientSSLProfile(name string, config *ClientSSLProfile) error {
return b.put(config, uriLtm, uriProfile, uriClientSSL, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyClientSSLProfile",
"(",
"name",
"string",
",",
"config",
"*",
"ClientSSLProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriClientSSL",
",",
"name",
... | // ModifyClientSSLProfile allows you to change any attribute of a client-ssl profile.
// Fields that can be modified are referenced in the ClientSSLProfile struct. | [
"ModifyClientSSLProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"client",
"-",
"ssl",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"ClientSSLProfile",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1191-L1193 |
139,482 | scottdware/go-bigip | ltm.go | TcpProfiles | func (b *BigIP) TcpProfiles() (*TcpProfiles, error) {
var tcpProfiles TcpProfiles
err, _ := b.getForEntity(&tcpProfiles, uriLtm, uriProfile, uriTcp)
if err != nil {
return nil, err
}
return &tcpProfiles, nil
} | go | func (b *BigIP) TcpProfiles() (*TcpProfiles, error) {
var tcpProfiles TcpProfiles
err, _ := b.getForEntity(&tcpProfiles, uriLtm, uriProfile, uriTcp)
if err != nil {
return nil, err
}
return &tcpProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"TcpProfiles",
"(",
")",
"(",
"*",
"TcpProfiles",
",",
"error",
")",
"{",
"var",
"tcpProfiles",
"TcpProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"tcpProfiles",
",",
"uriLtm",
",",
"u... | // TcpProfiles returns a list of Tcp profiles | [
"TcpProfiles",
"returns",
"a",
"list",
"of",
"Tcp",
"profiles"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1196-L1204 |
139,483 | scottdware/go-bigip | ltm.go | CreateTcpProfile | func (b *BigIP) CreateTcpProfile(name string, parent string) error {
config := &TcpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriTcp)
} | go | func (b *BigIP) CreateTcpProfile(name string, parent string) error {
config := &TcpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriTcp)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateTcpProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"TcpProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"return",
"b"... | // CreateTcpProfile creates a new tcp profile on the BIG-IP system. | [
"CreateTcpProfile",
"creates",
"a",
"new",
"tcp",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1221-L1228 |
139,484 | scottdware/go-bigip | ltm.go | DeleteTcpProfile | func (b *BigIP) DeleteTcpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriTcp, name)
} | go | func (b *BigIP) DeleteTcpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriTcp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteTcpProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriTcp",
",",
"name",
")",
"\n",
"}"
] | // DeleteTcpProfile removes a tcp profile. | [
"DeleteTcpProfile",
"removes",
"a",
"tcp",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1235-L1237 |
139,485 | scottdware/go-bigip | ltm.go | ModifyTcpProfile | func (b *BigIP) ModifyTcpProfile(name string, config *TcpProfile) error {
return b.put(config, uriLtm, uriProfile, uriTcp, name)
} | go | func (b *BigIP) ModifyTcpProfile(name string, config *TcpProfile) error {
return b.put(config, uriLtm, uriProfile, uriTcp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyTcpProfile",
"(",
"name",
"string",
",",
"config",
"*",
"TcpProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriTcp",
",",
"name",
")",
"\n",
"}... | // ModifyTcpProfile allows you to change any attribute of a tcp profile.
// Fields that can be modified are referenced in the TcpProfile struct. | [
"ModifyTcpProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"tcp",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"TcpProfile",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1241-L1243 |
139,486 | scottdware/go-bigip | ltm.go | UdpProfiles | func (b *BigIP) UdpProfiles() (*UdpProfiles, error) {
var udpProfiles UdpProfiles
err, _ := b.getForEntity(&udpProfiles, uriLtm, uriProfile, uriUdp)
if err != nil {
return nil, err
}
return &udpProfiles, nil
} | go | func (b *BigIP) UdpProfiles() (*UdpProfiles, error) {
var udpProfiles UdpProfiles
err, _ := b.getForEntity(&udpProfiles, uriLtm, uriProfile, uriUdp)
if err != nil {
return nil, err
}
return &udpProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"UdpProfiles",
"(",
")",
"(",
"*",
"UdpProfiles",
",",
"error",
")",
"{",
"var",
"udpProfiles",
"UdpProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"udpProfiles",
",",
"uriLtm",
",",
"u... | // UdpProfiles returns a list of Udp profiles | [
"UdpProfiles",
"returns",
"a",
"list",
"of",
"Udp",
"profiles"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1246-L1254 |
139,487 | scottdware/go-bigip | ltm.go | CreateUdpProfile | func (b *BigIP) CreateUdpProfile(name string, parent string) error {
config := &UdpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriUdp)
} | go | func (b *BigIP) CreateUdpProfile(name string, parent string) error {
config := &UdpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriUdp)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateUdpProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"UdpProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"return",
"b"... | // CreateUdpProfile creates a new udp profile on the BIG-IP system. | [
"CreateUdpProfile",
"creates",
"a",
"new",
"udp",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1271-L1278 |
139,488 | scottdware/go-bigip | ltm.go | DeleteUdpProfile | func (b *BigIP) DeleteUdpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriUdp, name)
} | go | func (b *BigIP) DeleteUdpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriUdp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteUdpProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriUdp",
",",
"name",
")",
"\n",
"}"
] | // DeleteUdpProfile removes a udp profile. | [
"DeleteUdpProfile",
"removes",
"a",
"udp",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1285-L1287 |
139,489 | scottdware/go-bigip | ltm.go | ModifyUdpProfile | func (b *BigIP) ModifyUdpProfile(name string, config *UdpProfile) error {
return b.put(config, uriLtm, uriProfile, uriUdp, name)
} | go | func (b *BigIP) ModifyUdpProfile(name string, config *UdpProfile) error {
return b.put(config, uriLtm, uriProfile, uriUdp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyUdpProfile",
"(",
"name",
"string",
",",
"config",
"*",
"UdpProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriUdp",
",",
"name",
")",
"\n",
"}... | // ModifyUdpProfile allows you to change any attribute of a udp profile.
// Fields that can be modified are referenced in the UdpProfile struct. | [
"ModifyUdpProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"udp",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"UdpProfile",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1291-L1293 |
139,490 | scottdware/go-bigip | ltm.go | HttpProfiles | func (b *BigIP) HttpProfiles() (*HttpProfiles, error) {
var httpProfiles HttpProfiles
err, _ := b.getForEntity(&httpProfiles, uriLtm, uriProfile, uriHttp)
if err != nil {
return nil, err
}
return &httpProfiles, nil
} | go | func (b *BigIP) HttpProfiles() (*HttpProfiles, error) {
var httpProfiles HttpProfiles
err, _ := b.getForEntity(&httpProfiles, uriLtm, uriProfile, uriHttp)
if err != nil {
return nil, err
}
return &httpProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"HttpProfiles",
"(",
")",
"(",
"*",
"HttpProfiles",
",",
"error",
")",
"{",
"var",
"httpProfiles",
"HttpProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"httpProfiles",
",",
"uriLtm",
",",... | // HttpProfiles returns a list of HTTP profiles | [
"HttpProfiles",
"returns",
"a",
"list",
"of",
"HTTP",
"profiles"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1296-L1304 |
139,491 | scottdware/go-bigip | ltm.go | CreateHttpProfile | func (b *BigIP) CreateHttpProfile(name string, parent string) error {
config := &HttpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriHttp)
} | go | func (b *BigIP) CreateHttpProfile(name string, parent string) error {
config := &HttpProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriHttp)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateHttpProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"HttpProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"return",
"... | // CreateHttpProfile creates a new http profile on the BIG-IP system. | [
"CreateHttpProfile",
"creates",
"a",
"new",
"http",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1321-L1328 |
139,492 | scottdware/go-bigip | ltm.go | DeleteHttpProfile | func (b *BigIP) DeleteHttpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriHttp, name)
} | go | func (b *BigIP) DeleteHttpProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriHttp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteHttpProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriHttp",
",",
"name",
")",
"\n",
"}"
] | // DeleteHttpProfile removes a http profile. | [
"DeleteHttpProfile",
"removes",
"a",
"http",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1335-L1337 |
139,493 | scottdware/go-bigip | ltm.go | ModifyHttpProfile | func (b *BigIP) ModifyHttpProfile(name string, config *HttpProfile) error {
return b.put(config, uriLtm, uriProfile, uriHttp, name)
} | go | func (b *BigIP) ModifyHttpProfile(name string, config *HttpProfile) error {
return b.put(config, uriLtm, uriProfile, uriHttp, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyHttpProfile",
"(",
"name",
"string",
",",
"config",
"*",
"HttpProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriHttp",
",",
"name",
")",
"\n",
... | // ModifyHttpProfile allows you to change any attribute of a http profile.
// Fields that can be modified are referenced in the HttpProfile struct. | [
"ModifyHttpProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"http",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"HttpProfile",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1341-L1343 |
139,494 | scottdware/go-bigip | ltm.go | OneconnectProfiles | func (b *BigIP) OneconnectProfiles() (*OneconnectProfiles, error) {
var oneconnectProfiles OneconnectProfiles
err, _ := b.getForEntity(&oneconnectProfiles, uriLtm, uriProfile, uriOneConnect)
if err != nil {
return nil, err
}
return &oneconnectProfiles, nil
} | go | func (b *BigIP) OneconnectProfiles() (*OneconnectProfiles, error) {
var oneconnectProfiles OneconnectProfiles
err, _ := b.getForEntity(&oneconnectProfiles, uriLtm, uriProfile, uriOneConnect)
if err != nil {
return nil, err
}
return &oneconnectProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"OneconnectProfiles",
"(",
")",
"(",
"*",
"OneconnectProfiles",
",",
"error",
")",
"{",
"var",
"oneconnectProfiles",
"OneconnectProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",
"oneconnectProfil... | // OneconnectProfiles returns a list of HTTP profiles | [
"OneconnectProfiles",
"returns",
"a",
"list",
"of",
"HTTP",
"profiles"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1346-L1354 |
139,495 | scottdware/go-bigip | ltm.go | CreateOneconnectProfile | func (b *BigIP) CreateOneconnectProfile(name string, parent string) error {
config := &OneconnectProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriOneConnect)
} | go | func (b *BigIP) CreateOneconnectProfile(name string, parent string) error {
config := &OneconnectProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriOneConnect)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateOneconnectProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"OneconnectProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"\n\n",
"... | // CreateOneconnectProfile creates a new http profile on the BIG-IP system. | [
"CreateOneconnectProfile",
"creates",
"a",
"new",
"http",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1371-L1378 |
139,496 | scottdware/go-bigip | ltm.go | DeleteOneconnectProfile | func (b *BigIP) DeleteOneconnectProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriOneConnect, name)
} | go | func (b *BigIP) DeleteOneconnectProfile(name string) error {
return b.delete(uriLtm, uriProfile, uriOneConnect, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"DeleteOneconnectProfile",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"b",
".",
"delete",
"(",
"uriLtm",
",",
"uriProfile",
",",
"uriOneConnect",
",",
"name",
")",
"\n",
"}"
] | // DeleteOneconnectProfile removes a http profile. | [
"DeleteOneconnectProfile",
"removes",
"a",
"http",
"profile",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1385-L1387 |
139,497 | scottdware/go-bigip | ltm.go | ModifyOneconnectProfile | func (b *BigIP) ModifyOneconnectProfile(name string, config *OneconnectProfile) error {
return b.put(config, uriLtm, uriProfile, uriOneConnect, name)
} | go | func (b *BigIP) ModifyOneconnectProfile(name string, config *OneconnectProfile) error {
return b.put(config, uriLtm, uriProfile, uriOneConnect, name)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"ModifyOneconnectProfile",
"(",
"name",
"string",
",",
"config",
"*",
"OneconnectProfile",
")",
"error",
"{",
"return",
"b",
".",
"put",
"(",
"config",
",",
"uriLtm",
",",
"uriProfile",
",",
"uriOneConnect",
",",
"name"... | // ModifyOneconnectProfile allows you to change any attribute of a http profile.
// Fields that can be modified are referenced in the OneconnectProfile struct. | [
"ModifyOneconnectProfile",
"allows",
"you",
"to",
"change",
"any",
"attribute",
"of",
"a",
"http",
"profile",
".",
"Fields",
"that",
"can",
"be",
"modified",
"are",
"referenced",
"in",
"the",
"OneconnectProfile",
"struct",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1391-L1393 |
139,498 | scottdware/go-bigip | ltm.go | HttpCompressionProfiles | func (b *BigIP) HttpCompressionProfiles() (*HttpCompressionProfiles, error) {
var httpCompressionProfiles HttpCompressionProfiles
err, _ := b.getForEntity(&httpCompressionProfiles, uriLtm, uriProfile, uriHttpCompression)
if err != nil {
return nil, err
}
return &httpCompressionProfiles, nil
} | go | func (b *BigIP) HttpCompressionProfiles() (*HttpCompressionProfiles, error) {
var httpCompressionProfiles HttpCompressionProfiles
err, _ := b.getForEntity(&httpCompressionProfiles, uriLtm, uriProfile, uriHttpCompression)
if err != nil {
return nil, err
}
return &httpCompressionProfiles, nil
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"HttpCompressionProfiles",
"(",
")",
"(",
"*",
"HttpCompressionProfiles",
",",
"error",
")",
"{",
"var",
"httpCompressionProfiles",
"HttpCompressionProfiles",
"\n",
"err",
",",
"_",
":=",
"b",
".",
"getForEntity",
"(",
"&",... | // HttpCompressionProfiles returns a list of HTTP profiles | [
"HttpCompressionProfiles",
"returns",
"a",
"list",
"of",
"HTTP",
"profiles"
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1396-L1404 |
139,499 | scottdware/go-bigip | ltm.go | CreateHttpCompressionProfile | func (b *BigIP) CreateHttpCompressionProfile(name string, parent string) error {
config := &HttpCompressionProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriHttpCompression)
} | go | func (b *BigIP) CreateHttpCompressionProfile(name string, parent string) error {
config := &HttpCompressionProfile{
Name: name,
DefaultsFrom: parent,
}
return b.post(config, uriLtm, uriProfile, uriHttpCompression)
} | [
"func",
"(",
"b",
"*",
"BigIP",
")",
"CreateHttpCompressionProfile",
"(",
"name",
"string",
",",
"parent",
"string",
")",
"error",
"{",
"config",
":=",
"&",
"HttpCompressionProfile",
"{",
"Name",
":",
"name",
",",
"DefaultsFrom",
":",
"parent",
",",
"}",
"... | // CreateHttpCompressionProfile creates a new http profile on the BIG-IP system. | [
"CreateHttpCompressionProfile",
"creates",
"a",
"new",
"http",
"profile",
"on",
"the",
"BIG",
"-",
"IP",
"system",
"."
] | 089ab35c13547ce4bcde55918adacdba00708753 | https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1421-L1428 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.