id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
148,900
scgolang/sc
operators.go
unaryOpCoin
func unaryOpCoin(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCoin, numOutputs, in) }
go
func unaryOpCoin(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCoin, numOutputs, in) }
[ "func", "unaryOpCoin", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCoin", ",", "numOutputs", ",", "in", ...
// unaryOpCoin returns one or zero with the probability given by the argument.
[ "unaryOpCoin", "returns", "one", "or", "zero", "with", "the", "probability", "given", "by", "the", "argument", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L348-L351
148,901
scgolang/sc
operators.go
unaryOpCos
func unaryOpCos(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCos, numOutputs, in) }
go
func unaryOpCos(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCos, numOutputs, in) }
[ "func", "unaryOpCos", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCos", ",", "numOutputs", ",", "in", "...
// unaryOpCos returns the cosine of an input.
[ "unaryOpCos", "returns", "the", "cosine", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L354-L357
148,902
scgolang/sc
operators.go
unaryOpCosh
func unaryOpCosh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCosh, numOutputs, in) }
go
func unaryOpCosh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCosh, numOutputs, in) }
[ "func", "unaryOpCosh", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCosh", ",", "numOutputs", ",", "in", ...
// unaryOpCosh returns the hyperbolic cosine of an input.
[ "unaryOpCosh", "returns", "the", "hyperbolic", "cosine", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L360-L363
148,903
scgolang/sc
operators.go
unaryOpCpsmidi
func unaryOpCpsmidi(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCpsmidi, numOutputs, in) }
go
func unaryOpCpsmidi(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCpsmidi, numOutputs, in) }
[ "func", "unaryOpCpsmidi", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCpsmidi", ",", "numOutputs", ",", "...
// unaryOpCpsmidi converts frequency in Hz to midi note values.
[ "unaryOpCpsmidi", "converts", "frequency", "in", "Hz", "to", "midi", "note", "values", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L366-L369
148,904
scgolang/sc
operators.go
unaryOpCpsoct
func unaryOpCpsoct(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCpsoct, numOutputs, in) }
go
func unaryOpCpsoct(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCpsoct, numOutputs, in) }
[ "func", "unaryOpCpsoct", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCpsoct", ",", "numOutputs", ",", "in...
// unaryOpCpsoct converts cycles per second to decimal octaves.
[ "unaryOpCpsoct", "converts", "cycles", "per", "second", "to", "decimal", "octaves", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L372-L375
148,905
scgolang/sc
operators.go
unaryOpCubed
func unaryOpCubed(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCubed, numOutputs, in) }
go
func unaryOpCubed(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpCubed, numOutputs, in) }
[ "func", "unaryOpCubed", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpCubed", ",", "numOutputs", ",", "in",...
// unaryOpCubed computes the cube of a signal.
[ "unaryOpCubed", "computes", "the", "cube", "of", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L378-L381
148,906
scgolang/sc
operators.go
unaryOpDbAmp
func unaryOpDbAmp(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpDbAmp, numOutputs, in) }
go
func unaryOpDbAmp(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpDbAmp, numOutputs, in) }
[ "func", "unaryOpDbAmp", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpDbAmp", ",", "numOutputs", ",", "in",...
// unaryOpDbAmp converts decibels to linear amplitude.
[ "unaryOpDbAmp", "converts", "decibels", "to", "linear", "amplitude", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L384-L387
148,907
scgolang/sc
operators.go
unaryOpDistort
func unaryOpDistort(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpDistort, numOutputs, in) }
go
func unaryOpDistort(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpDistort, numOutputs, in) }
[ "func", "unaryOpDistort", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpDistort", ",", "numOutputs", ",", "...
// unaryOpDistort performs non-linear distortion on a signal.
[ "unaryOpDistort", "performs", "non", "-", "linear", "distortion", "on", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L390-L393
148,908
scgolang/sc
operators.go
unaryOpExp
func unaryOpExp(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpExp, numOutputs, in) }
go
func unaryOpExp(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpExp, numOutputs, in) }
[ "func", "unaryOpExp", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpExp", ",", "numOutputs", ",", "in", "...
// unaryOpExp computes the exponential of a signal.
[ "unaryOpExp", "computes", "the", "exponential", "of", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L396-L399
148,909
scgolang/sc
operators.go
unaryOpFrac
func unaryOpFrac(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpFrac, numOutputs, in) }
go
func unaryOpFrac(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpFrac, numOutputs, in) }
[ "func", "unaryOpFrac", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpFrac", ",", "numOutputs", ",", "in", ...
// unaryOpFrac returns the fractional part of a signal.
[ "unaryOpFrac", "returns", "the", "fractional", "part", "of", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L408-L411
148,910
scgolang/sc
operators.go
unaryOpLinrand
func unaryOpLinrand(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLinrand, numOutputs, in) }
go
func unaryOpLinrand(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLinrand, numOutputs, in) }
[ "func", "unaryOpLinrand", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpLinrand", ",", "numOutputs", ",", "...
// unaryOpLinrand returns a linearly distributed random value between in and zero.
[ "unaryOpLinrand", "returns", "a", "linearly", "distributed", "random", "value", "between", "in", "and", "zero", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L414-L417
148,911
scgolang/sc
operators.go
unaryOpLog
func unaryOpLog(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog, numOutputs, in) }
go
func unaryOpLog(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog, numOutputs, in) }
[ "func", "unaryOpLog", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpLog", ",", "numOutputs", ",", "in", "...
// unaryOpLog computes a natural logarithm.
[ "unaryOpLog", "computes", "a", "natural", "logarithm", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L420-L423
148,912
scgolang/sc
operators.go
unaryOpLog10
func unaryOpLog10(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog10, numOutputs, in) }
go
func unaryOpLog10(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog10, numOutputs, in) }
[ "func", "unaryOpLog10", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpLog10", ",", "numOutputs", ",", "in",...
// unaryOpLog10 computes a base 10 logarithm.
[ "unaryOpLog10", "computes", "a", "base", "10", "logarithm", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L426-L429
148,913
scgolang/sc
operators.go
unaryOpLog2
func unaryOpLog2(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog2, numOutputs, in) }
go
func unaryOpLog2(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpLog2, numOutputs, in) }
[ "func", "unaryOpLog2", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpLog2", ",", "numOutputs", ",", "in", ...
// unaryOpLog2 computes a base 2 logarithm.
[ "unaryOpLog2", "computes", "a", "base", "2", "logarithm", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L432-L435
148,914
scgolang/sc
operators.go
unaryOpMidicps
func unaryOpMidicps(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpMidicps, numOutputs, in) }
go
func unaryOpMidicps(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpMidicps, numOutputs, in) }
[ "func", "unaryOpMidicps", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpMidicps", ",", "numOutputs", ",", "...
// unaryOpMidicps converts MIDI note numbers to cycles per second.
[ "unaryOpMidicps", "converts", "MIDI", "note", "numbers", "to", "cycles", "per", "second", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L438-L441
148,915
scgolang/sc
operators.go
unaryOpNeg
func unaryOpNeg(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpNeg, numOutputs, in) }
go
func unaryOpNeg(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpNeg, numOutputs, in) }
[ "func", "unaryOpNeg", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpNeg", ",", "numOutputs", ",", "in", "...
// unaryOpNeg multiplies a signal by -1.
[ "unaryOpNeg", "multiplies", "a", "signal", "by", "-", "1", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L450-L453
148,916
scgolang/sc
operators.go
unaryOpOctcps
func unaryOpOctcps(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpOctcps, numOutputs, in) }
go
func unaryOpOctcps(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpOctcps, numOutputs, in) }
[ "func", "unaryOpOctcps", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpOctcps", ",", "numOutputs", ",", "in...
// unaryOpOctcps converts decimal octaves to cycles per second.
[ "unaryOpOctcps", "converts", "decimal", "octaves", "to", "cycles", "per", "second", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L456-L459
148,917
scgolang/sc
operators.go
unaryOpRand
func unaryOpRand(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpRand, numOutputs, in) }
go
func unaryOpRand(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpRand, numOutputs, in) }
[ "func", "unaryOpRand", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpRand", ",", "numOutputs", ",", "in", ...
// unaryOpRand returns an evenly distributed random value between in and zero.
[ "unaryOpRand", "returns", "an", "evenly", "distributed", "random", "value", "between", "in", "and", "zero", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L462-L465
148,918
scgolang/sc
operators.go
unaryOpRatiomidi
func unaryOpRatiomidi(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpRatiomidi, numOutputs, in) }
go
func unaryOpRatiomidi(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpRatiomidi, numOutputs, in) }
[ "func", "unaryOpRatiomidi", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpRatiomidi", ",", "numOutputs", ",",...
// unaryOpRatiomidi converts a frequency ratio to an interval in MIDI notes.
[ "unaryOpRatiomidi", "converts", "a", "frequency", "ratio", "to", "an", "interval", "in", "MIDI", "notes", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L474-L477
148,919
scgolang/sc
operators.go
unaryOpReciprocal
func unaryOpReciprocal(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpReciprocal, numOutputs, in) }
go
func unaryOpReciprocal(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpReciprocal, numOutputs, in) }
[ "func", "unaryOpReciprocal", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpReciprocal", ",", "numOutputs", ",...
// unaryOpReciprocal returns the reciprocal of an input signal.
[ "unaryOpReciprocal", "returns", "the", "reciprocal", "of", "an", "input", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L480-L483
148,920
scgolang/sc
operators.go
unaryOpSin
func unaryOpSin(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSin, numOutputs, in) }
go
func unaryOpSin(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSin, numOutputs, in) }
[ "func", "unaryOpSin", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpSin", ",", "numOutputs", ",", "in", "...
// unaryOpSin returns the sine of an input.
[ "unaryOpSin", "returns", "the", "sine", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L493-L496
148,921
scgolang/sc
operators.go
unaryOpSinh
func unaryOpSinh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSinh, numOutputs, in) }
go
func unaryOpSinh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSinh, numOutputs, in) }
[ "func", "unaryOpSinh", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpSinh", ",", "numOutputs", ",", "in", ...
// unaryOpSinh returns the hyperbolic sine of an input.
[ "unaryOpSinh", "returns", "the", "hyperbolic", "sine", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L499-L502
148,922
scgolang/sc
operators.go
unaryOpSoftClip
func unaryOpSoftClip(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSoftClip, numOutputs, in) }
go
func unaryOpSoftClip(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSoftClip, numOutputs, in) }
[ "func", "unaryOpSoftClip", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpSoftClip", ",", "numOutputs", ",", ...
// unaryOpSoftClip adds distortion to a ugen.
[ "unaryOpSoftClip", "adds", "distortion", "to", "a", "ugen", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L505-L508
148,923
scgolang/sc
operators.go
unaryOpSqrt
func unaryOpSqrt(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSqrt, numOutputs, in) }
go
func unaryOpSqrt(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSqrt, numOutputs, in) }
[ "func", "unaryOpSqrt", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpSqrt", ",", "numOutputs", ",", "in", ...
// unaryOpSqrt computes the square root of a signal.
[ "unaryOpSqrt", "computes", "the", "square", "root", "of", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L511-L514
148,924
scgolang/sc
operators.go
unaryOpSquared
func unaryOpSquared(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSquared, numOutputs, in) }
go
func unaryOpSquared(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpSquared, numOutputs, in) }
[ "func", "unaryOpSquared", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpSquared", ",", "numOutputs", ",", "...
// unaryOpSquared computes the square of a signal.
[ "unaryOpSquared", "computes", "the", "square", "of", "a", "signal", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L517-L520
148,925
scgolang/sc
operators.go
unaryOpTan
func unaryOpTan(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpTan, numOutputs, in) }
go
func unaryOpTan(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpTan, numOutputs, in) }
[ "func", "unaryOpTan", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpTan", ",", "numOutputs", ",", "in", "...
// unaryOpTan returns the tangent of an input.
[ "unaryOpTan", "returns", "the", "tangent", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L529-L532
148,926
scgolang/sc
operators.go
unaryOpTanh
func unaryOpTanh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpTanh, numOutputs, in) }
go
func unaryOpTanh(rate int8, in Input, numOutputs int) Input { CheckRate(rate) return NewInput(UnaryOpUgenName, rate, UnaryOpTanh, numOutputs, in) }
[ "func", "unaryOpTanh", "(", "rate", "int8", ",", "in", "Input", ",", "numOutputs", "int", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "UnaryOpUgenName", ",", "rate", ",", "UnaryOpTanh", ",", "numOutputs", ",", "in", ...
// unaryOpTanh returns the hyperbolic tangent of an input.
[ "unaryOpTanh", "returns", "the", "hyperbolic", "tangent", "of", "an", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/operators.go#L535-L538
148,927
scgolang/sc
pstring.go
Equals
func (pstr *pstring) Equals(other pstring) bool { return pstr.string == other.string }
go
func (pstr *pstring) Equals(other pstring) bool { return pstr.string == other.string }
[ "func", "(", "pstr", "*", "pstring", ")", "Equals", "(", "other", "pstring", ")", "bool", "{", "return", "pstr", ".", "string", "==", "other", ".", "string", "\n", "}" ]
// Equal determines if one pstring equals another
[ "Equal", "determines", "if", "one", "pstring", "equals", "another" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/pstring.go#L22-L24
148,928
scgolang/sc
pstring.go
Write
func (pstr *pstring) Write(w io.Writer) error { e := binary.Write(w, byteOrder, pstr.length) if e != nil { return e } _, e = w.Write(bytes.NewBufferString(pstr.string).Bytes()) return e }
go
func (pstr *pstring) Write(w io.Writer) error { e := binary.Write(w, byteOrder, pstr.length) if e != nil { return e } _, e = w.Write(bytes.NewBufferString(pstr.string).Bytes()) return e }
[ "func", "(", "pstr", "*", "pstring", ")", "Write", "(", "w", "io", ".", "Writer", ")", "error", "{", "e", ":=", "binary", ".", "Write", "(", "w", ",", "byteOrder", ",", "pstr", ".", "length", ")", "\n", "if", "e", "!=", "nil", "{", "return", "e...
// Write writes a pstring to an io.Writer
[ "Write", "writes", "a", "pstring", "to", "an", "io", ".", "Writer" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/pstring.go#L27-L34
148,929
scgolang/sc
pstring.go
newPstring
func newPstring(s string) *pstring { length := len(s) p := pstring{int8(length), s} return &p }
go
func newPstring(s string) *pstring { length := len(s) p := pstring{int8(length), s} return &p }
[ "func", "newPstring", "(", "s", "string", ")", "*", "pstring", "{", "length", ":=", "len", "(", "s", ")", "\n", "p", ":=", "pstring", "{", "int8", "(", "length", ")", ",", "s", "}", "\n", "return", "&", "p", "\n", "}" ]
// newPstring create a new pstring
[ "newPstring", "create", "a", "new", "pstring" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/pstring.go#L37-L41
148,930
scgolang/sc
pstring.go
readPstring
func readPstring(r io.Reader) (*pstring, error) { var length int8 e := binary.Read(r, byteOrder, &length) if e != nil { return nil, e } s := make([]byte, length) read, e := r.Read(s) if e != nil { return nil, e } if read != int(length) { return nil, fmt.Errorf("could not read %d bytes", length) } ps :=...
go
func readPstring(r io.Reader) (*pstring, error) { var length int8 e := binary.Read(r, byteOrder, &length) if e != nil { return nil, e } s := make([]byte, length) read, e := r.Read(s) if e != nil { return nil, e } if read != int(length) { return nil, fmt.Errorf("could not read %d bytes", length) } ps :=...
[ "func", "readPstring", "(", "r", "io", ".", "Reader", ")", "(", "*", "pstring", ",", "error", ")", "{", "var", "length", "int8", "\n", "e", ":=", "binary", ".", "Read", "(", "r", ",", "byteOrder", ",", "&", "length", ")", "\n", "if", "e", "!=", ...
// readPstring reads a pstring from an io.Reader
[ "readPstring", "reads", "a", "pstring", "from", "an", "io", ".", "Reader" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/pstring.go#L44-L63
148,931
scgolang/sc
param.go
Add
func (ps *params) Add(name string, initialValue float32) Input { idx := len(ps.l) p := newParam(name, int32(idx), initialValue) ps.l = append(ps.l, p) return p }
go
func (ps *params) Add(name string, initialValue float32) Input { idx := len(ps.l) p := newParam(name, int32(idx), initialValue) ps.l = append(ps.l, p) return p }
[ "func", "(", "ps", "*", "params", ")", "Add", "(", "name", "string", ",", "initialValue", "float32", ")", "Input", "{", "idx", ":=", "len", "(", "ps", ".", "l", ")", "\n", "p", ":=", "newParam", "(", "name", ",", "int32", "(", "idx", ")", ",", ...
// Add param implementation
[ "Add", "param", "implementation" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/param.go#L30-L35
148,932
scgolang/sc
multiInput.go
Max
func (ins Inputs) Max(other Input) Input { im := make([]Input, len(ins)) for i, in := range ins { im[i] = in.Max(other) } return Inputs(im) }
go
func (ins Inputs) Max(other Input) Input { im := make([]Input, len(ins)) for i, in := range ins { im[i] = in.Max(other) } return Inputs(im) }
[ "func", "(", "ins", "Inputs", ")", "Max", "(", "other", "Input", ")", "Input", "{", "im", ":=", "make", "(", "[", "]", "Input", ",", "len", "(", "ins", ")", ")", "\n", "for", "i", ",", "in", ":=", "range", "ins", "{", "im", "[", "i", "]", "...
// Max returns Inputs that contain the max of all the inputs and the provided Input.
[ "Max", "returns", "Inputs", "that", "contain", "the", "max", "of", "all", "the", "inputs", "and", "the", "provided", "Input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/multiInput.go#L381-L387
148,933
scgolang/sc
multiInput.go
MulAdd
func (ins Inputs) MulAdd(mul, add Input) Input { ia := make([]Input, len(ins)) for i, in := range ins { ia[i] = in.MulAdd(mul, add) } return Inputs(ia) }
go
func (ins Inputs) MulAdd(mul, add Input) Input { ia := make([]Input, len(ins)) for i, in := range ins { ia[i] = in.MulAdd(mul, add) } return Inputs(ia) }
[ "func", "(", "ins", "Inputs", ")", "MulAdd", "(", "mul", ",", "add", "Input", ")", "Input", "{", "ia", ":=", "make", "(", "[", "]", "Input", ",", "len", "(", "ins", ")", ")", "\n", "for", "i", ",", "in", ":=", "range", "ins", "{", "ia", "[", ...
// MulAdd performs a multiplication and addition on all the inputs.
[ "MulAdd", "performs", "a", "multiplication", "and", "addition", "on", "all", "the", "inputs", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/multiInput.go#L444-L450
148,934
scgolang/sc
multiInput.go
SoftClip
func (ins Inputs) SoftClip() Input { clipped := make([]Input, len(ins)) for i, in := range ins { clipped[i] = in.SoftClip() } return Inputs(clipped) }
go
func (ins Inputs) SoftClip() Input { clipped := make([]Input, len(ins)) for i, in := range ins { clipped[i] = in.SoftClip() } return Inputs(clipped) }
[ "func", "(", "ins", "Inputs", ")", "SoftClip", "(", ")", "Input", "{", "clipped", ":=", "make", "(", "[", "]", "Input", ",", "len", "(", "ins", ")", ")", "\n", "for", "i", ",", "in", ":=", "range", "ins", "{", "clipped", "[", "i", "]", "=", "...
// SoftClip adds distortion to the inputs.
[ "SoftClip", "adds", "distortion", "to", "the", "inputs", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/multiInput.go#L597-L603
148,935
scgolang/sc
paramName.go
readParamName
func readParamName(r io.Reader) (*ParamName, error) { name, err := readPstring(r) if err != nil { return nil, err } var idx int32 if err := binary.Read(r, byteOrder, &idx); err != nil { return nil, err } pn := ParamName{name.String(), idx} return &pn, nil }
go
func readParamName(r io.Reader) (*ParamName, error) { name, err := readPstring(r) if err != nil { return nil, err } var idx int32 if err := binary.Read(r, byteOrder, &idx); err != nil { return nil, err } pn := ParamName{name.String(), idx} return &pn, nil }
[ "func", "readParamName", "(", "r", "io", ".", "Reader", ")", "(", "*", "ParamName", ",", "error", ")", "{", "name", ",", "err", ":=", "readPstring", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n",...
// readParamName reads a ParamName from an io.Reader
[ "readParamName", "reads", "a", "ParamName", "from", "an", "io", ".", "Reader" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/paramName.go#L22-L33
148,936
scgolang/sc
klang.go
Fill
func Fill(n int, input Input) []Input { a := make([]Input, n) for i := range a { a[i] = input } return a }
go
func Fill(n int, input Input) []Input { a := make([]Input, n) for i := range a { a[i] = input } return a }
[ "func", "Fill", "(", "n", "int", ",", "input", "Input", ")", "[", "]", "Input", "{", "a", ":=", "make", "(", "[", "]", "Input", ",", "n", ")", "\n", "for", "i", ":=", "range", "a", "{", "a", "[", "i", "]", "=", "input", "\n", "}", "\n", "...
// Fill returns a slice of inputs that has length n and every element is set to input.
[ "Fill", "returns", "a", "slice", "of", "inputs", "that", "has", "length", "n", "and", "every", "element", "is", "set", "to", "input", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/klang.go#L55-L61
148,937
scgolang/sc
klang.go
RandC
func RandC(min, max float64) Input { return C((rand.Float64() * (max - min)) + min) }
go
func RandC(min, max float64) Input { return C((rand.Float64() * (max - min)) + min) }
[ "func", "RandC", "(", "min", ",", "max", "float64", ")", "Input", "{", "return", "C", "(", "(", "rand", ".", "Float64", "(", ")", "*", "(", "max", "-", "min", ")", ")", "+", "min", ")", "\n", "}" ]
// RandC returns a random constant between min and max.
[ "RandC", "returns", "a", "random", "constant", "between", "min", "and", "max", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/klang.go#L64-L66
148,938
scgolang/sc
mix.go
Mix
func Mix(rate int8, inputs []Input) Input { CheckRate(rate) switch len(inputs) { case 0: panic("can not mix empty inputs slice") case 1: return inputs[0] case 2: return inputs[0].Add(inputs[1]) case 3: return Sum3(rate, inputs[0], inputs[1], inputs[2]) case 4: return Sum4(rate, inputs[0], inputs[1], in...
go
func Mix(rate int8, inputs []Input) Input { CheckRate(rate) switch len(inputs) { case 0: panic("can not mix empty inputs slice") case 1: return inputs[0] case 2: return inputs[0].Add(inputs[1]) case 3: return Sum3(rate, inputs[0], inputs[1], inputs[2]) case 4: return Sum4(rate, inputs[0], inputs[1], in...
[ "func", "Mix", "(", "rate", "int8", ",", "inputs", "[", "]", "Input", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "switch", "len", "(", "inputs", ")", "{", "case", "0", ":", "panic", "(", "\"", "\"", ")", "\n", "case", "1", ":", "re...
// Mix will mix an array of channels down to a single channel.
[ "Mix", "will", "mix", "an", "array", "of", "channels", "down", "to", "a", "single", "channel", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/mix.go#L4-L21
148,939
scgolang/sc
control.go
NewControl
func NewControl(numOutputs int) *Ugen { outputs := make([]Output, numOutputs) o := Output(1) for i := 0; i < numOutputs; i++ { outputs[i] = o } return &Ugen{ Name: "Control", Rate: KR, SpecialIndex: 0, Outputs: outputs, } }
go
func NewControl(numOutputs int) *Ugen { outputs := make([]Output, numOutputs) o := Output(1) for i := 0; i < numOutputs; i++ { outputs[i] = o } return &Ugen{ Name: "Control", Rate: KR, SpecialIndex: 0, Outputs: outputs, } }
[ "func", "NewControl", "(", "numOutputs", "int", ")", "*", "Ugen", "{", "outputs", ":=", "make", "(", "[", "]", "Output", ",", "numOutputs", ")", "\n", "o", ":=", "Output", "(", "1", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "numOutputs", "...
// NewControl creates a new Control.
[ "NewControl", "creates", "a", "new", "Control", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/control.go#L4-L16
148,940
scgolang/sc
sums.go
Sum3
func Sum3(rate int8, in1, in2, in3 Input) Input { CheckRate(rate) return NewInput("Sum3", rate, 0, 1, in1, in2, in3) }
go
func Sum3(rate int8, in1, in2, in3 Input) Input { CheckRate(rate) return NewInput("Sum3", rate, 0, 1, in1, in2, in3) }
[ "func", "Sum3", "(", "rate", "int8", ",", "in1", ",", "in2", ",", "in3", "Input", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "\"", "\"", ",", "rate", ",", "0", ",", "1", ",", "in1", ",", "in2", ",", "in3"...
// Sum3 sums three signals. Should be used via Mix.
[ "Sum3", "sums", "three", "signals", ".", "Should", "be", "used", "via", "Mix", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/sums.go#L4-L7
148,941
scgolang/sc
sums.go
Sum4
func Sum4(rate int8, in1, in2, in3, in4 Input) Input { CheckRate(rate) return NewInput("Sum4", rate, 0, 1, in1, in2, in3, in4) }
go
func Sum4(rate int8, in1, in2, in3, in4 Input) Input { CheckRate(rate) return NewInput("Sum4", rate, 0, 1, in1, in2, in3, in4) }
[ "func", "Sum4", "(", "rate", "int8", ",", "in1", ",", "in2", ",", "in3", ",", "in4", "Input", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "return", "NewInput", "(", "\"", "\"", ",", "rate", ",", "0", ",", "1", ",", "in1", ",", "in2"...
// Sum4 sums four signals. Should be used via Mix.
[ "Sum4", "sums", "four", "signals", ".", "Should", "be", "used", "via", "Mix", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/sums.go#L10-L13
148,942
scgolang/sc
server.go
getServerPath
func (s *Server) getServerPath() (string, error) { for _, file := range strings.Split(ServerPath, ":") { ok, err := isExecutable(file) if err != nil { return "", err } if ok { return file, nil } } path, hasPath := os.LookupEnv("PATH") if !hasPath { return "", ErrNoScsynth } for _, file := rang...
go
func (s *Server) getServerPath() (string, error) { for _, file := range strings.Split(ServerPath, ":") { ok, err := isExecutable(file) if err != nil { return "", err } if ok { return file, nil } } path, hasPath := os.LookupEnv("PATH") if !hasPath { return "", ErrNoScsynth } for _, file := rang...
[ "func", "(", "s", "*", "Server", ")", "getServerPath", "(", ")", "(", "string", ",", "error", ")", "{", "for", "_", ",", "file", ":=", "range", "strings", ".", "Split", "(", "ServerPath", ",", "\"", "\"", ")", "{", "ok", ",", "err", ":=", "isExec...
// getServerPath gets the path to the scsynth executable.
[ "getServerPath", "gets", "the", "path", "to", "the", "scsynth", "executable", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/server.go#L32-L58
148,943
scgolang/sc
server.go
isExecutable
func isExecutable(filename string) (bool, error) { info, err := os.Stat(filename) if err != nil { return false, err } mode := info.Mode() return ((mode & 0x01) | (mode & 0x08) | (mode & 0x40)) != 0, nil }
go
func isExecutable(filename string) (bool, error) { info, err := os.Stat(filename) if err != nil { return false, err } mode := info.Mode() return ((mode & 0x01) | (mode & 0x08) | (mode & 0x40)) != 0, nil }
[ "func", "isExecutable", "(", "filename", "string", ")", "(", "bool", ",", "error", ")", "{", "info", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "...
// isExecutable returns true if the provided file is executable, false otherwise. // It also returns any error that occurs while trying to read the file.
[ "isExecutable", "returns", "true", "if", "the", "provided", "file", "is", "executable", "false", "otherwise", ".", "It", "also", "returns", "any", "error", "that", "occurs", "while", "trying", "to", "read", "the", "file", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/server.go#L62-L69
148,944
scgolang/sc
server.go
args
func (s *Server) args() ([]string, error) { // Get the port. if s.Port <= 0 { s.Port = DefaultServerPort } portArg := strconv.FormatInt(int64(s.Port), 10) // Create the args slice. args := []string{} switch s.Network { default: return nil, fmt.Errorf("unrecognized network type: %s", s.Network) case "udp"...
go
func (s *Server) args() ([]string, error) { // Get the port. if s.Port <= 0 { s.Port = DefaultServerPort } portArg := strconv.FormatInt(int64(s.Port), 10) // Create the args slice. args := []string{} switch s.Network { default: return nil, fmt.Errorf("unrecognized network type: %s", s.Network) case "udp"...
[ "func", "(", "s", "*", "Server", ")", "args", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// Get the port.", "if", "s", ".", "Port", "<=", "0", "{", "s", ".", "Port", "=", "DefaultServerPort", "\n", "}", "\n", "portArg", ":=", "st...
// args gets the command line args to scsynth
[ "args", "gets", "the", "command", "line", "args", "to", "scsynth" ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/server.go#L72-L92
148,945
scgolang/sc
server.go
Start
func (s *Server) Start(timeout time.Duration) (io.ReadCloser, io.ReadCloser, error) { args, err := s.args() if err != nil { return nil, nil, err } serverPath, err := s.getServerPath() if err != nil { return nil, nil, err } s.Cmd = exec.Command(serverPath, args...) stdout, err := s.Cmd.StdoutPipe() if err...
go
func (s *Server) Start(timeout time.Duration) (io.ReadCloser, io.ReadCloser, error) { args, err := s.args() if err != nil { return nil, nil, err } serverPath, err := s.getServerPath() if err != nil { return nil, nil, err } s.Cmd = exec.Command(serverPath, args...) stdout, err := s.Cmd.StdoutPipe() if err...
[ "func", "(", "s", "*", "Server", ")", "Start", "(", "timeout", "time", ".", "Duration", ")", "(", "io", ".", "ReadCloser", ",", "io", ".", "ReadCloser", ",", "error", ")", "{", "args", ",", "err", ":=", "s", ".", "args", "(", ")", "\n", "if", "...
// Start starts a new instance of scsynth. // If the server doesn't print a line containing ServerReadyMessage // within the timeout then ErrTimeout is returned.
[ "Start", "starts", "a", "new", "instance", "of", "scsynth", ".", "If", "the", "server", "doesn", "t", "print", "a", "line", "containing", "ServerReadyMessage", "within", "the", "timeout", "then", "ErrTimeout", "is", "returned", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/server.go#L99-L139
148,946
scgolang/sc
psingrain.go
Rate
func (p PSinGrain) Rate(rate int8) Input { CheckRate(rate) (&p).defaults() return NewInput("PSinGrain", rate, 0, 1, p.Freq, p.Dur, p.Amp) }
go
func (p PSinGrain) Rate(rate int8) Input { CheckRate(rate) (&p).defaults() return NewInput("PSinGrain", rate, 0, 1, p.Freq, p.Dur, p.Amp) }
[ "func", "(", "p", "PSinGrain", ")", "Rate", "(", "rate", "int8", ")", "Input", "{", "CheckRate", "(", "rate", ")", "\n", "(", "&", "p", ")", ".", "defaults", "(", ")", "\n", "return", "NewInput", "(", "\"", "\"", ",", "rate", ",", "0", ",", "1"...
// Rate creates a new ugen at a specific rate. // If rate is a supported value this method will cause a runtime panic.
[ "Rate", "creates", "a", "new", "ugen", "at", "a", "specific", "rate", ".", "If", "rate", "is", "a", "supported", "value", "this", "method", "will", "cause", "a", "runtime", "panic", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/psingrain.go#L29-L33
148,947
scgolang/sc
env.go
curvesArray
func (env Env) curvesArray() []interface{} { switch val := env.Curve.(type) { case int, string, float64, Input: return arrayFromScalar(val, len(env.Times)) case []int: return intsToEmpties(val) case []float64: return floatsToEmpties(val) case []string: return stringsToEmpties(val) case []Input: return i...
go
func (env Env) curvesArray() []interface{} { switch val := env.Curve.(type) { case int, string, float64, Input: return arrayFromScalar(val, len(env.Times)) case []int: return intsToEmpties(val) case []float64: return floatsToEmpties(val) case []string: return stringsToEmpties(val) case []Input: return i...
[ "func", "(", "env", "Env", ")", "curvesArray", "(", ")", "[", "]", "interface", "{", "}", "{", "switch", "val", ":=", "env", ".", "Curve", ".", "(", "type", ")", "{", "case", "int", ",", "string", ",", "float64", ",", "Input", ":", "return", "arr...
// curvesArray returns the Curve as an array.
[ "curvesArray", "returns", "the", "Curve", "as", "an", "array", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L114-L131
148,948
scgolang/sc
env.go
intsToEmpties
func intsToEmpties(arr []int) []interface{} { ret := make([]interface{}, len(arr)) for i, ii := range arr { ret[i] = ii } return ret }
go
func intsToEmpties(arr []int) []interface{} { ret := make([]interface{}, len(arr)) for i, ii := range arr { ret[i] = ii } return ret }
[ "func", "intsToEmpties", "(", "arr", "[", "]", "int", ")", "[", "]", "interface", "{", "}", "{", "ret", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "arr", ")", ")", "\n", "for", "i", ",", "ii", ":=", "range", "arr", "...
// intsToEmpties converts a int slice to a slice of the empty interface.
[ "intsToEmpties", "converts", "a", "int", "slice", "to", "a", "slice", "of", "the", "empty", "interface", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L134-L140
148,949
scgolang/sc
env.go
floatsToEmpties
func floatsToEmpties(arr []float64) []interface{} { ret := make([]interface{}, len(arr)) for i, f := range arr { ret[i] = f } return ret }
go
func floatsToEmpties(arr []float64) []interface{} { ret := make([]interface{}, len(arr)) for i, f := range arr { ret[i] = f } return ret }
[ "func", "floatsToEmpties", "(", "arr", "[", "]", "float64", ")", "[", "]", "interface", "{", "}", "{", "ret", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "arr", ")", ")", "\n", "for", "i", ",", "f", ":=", "range", "arr"...
// floatsToEmpties converts a float slice to a slice of the empty interface.
[ "floatsToEmpties", "converts", "a", "float", "slice", "to", "a", "slice", "of", "the", "empty", "interface", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L143-L149
148,950
scgolang/sc
env.go
stringsToEmpties
func stringsToEmpties(arr []string) []interface{} { ret := make([]interface{}, len(arr)) for i, s := range arr { ret[i] = s } return ret }
go
func stringsToEmpties(arr []string) []interface{} { ret := make([]interface{}, len(arr)) for i, s := range arr { ret[i] = s } return ret }
[ "func", "stringsToEmpties", "(", "arr", "[", "]", "string", ")", "[", "]", "interface", "{", "}", "{", "ret", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "arr", ")", ")", "\n", "for", "i", ",", "s", ":=", "range", "arr"...
// stringsToEmpties converts a string slice to a slice of the empty interface.
[ "stringsToEmpties", "converts", "a", "string", "slice", "to", "a", "slice", "of", "the", "empty", "interface", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L152-L158
148,951
scgolang/sc
env.go
inputsToEmpties
func inputsToEmpties(arr []Input) []interface{} { ret := make([]interface{}, len(arr)) for i, in := range arr { ret[i] = in } return ret }
go
func inputsToEmpties(arr []Input) []interface{} { ret := make([]interface{}, len(arr)) for i, in := range arr { ret[i] = in } return ret }
[ "func", "inputsToEmpties", "(", "arr", "[", "]", "Input", ")", "[", "]", "interface", "{", "}", "{", "ret", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "arr", ")", ")", "\n", "for", "i", ",", "in", ":=", "range", "arr",...
// inputsToEmpties converts an Input slice to a slice of the empty interface.
[ "inputsToEmpties", "converts", "an", "Input", "slice", "to", "a", "slice", "of", "the", "empty", "interface", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L161-L167
148,952
scgolang/sc
env.go
arrayFromScalar
func arrayFromScalar(val interface{}, length int) []interface{} { ret := make([]interface{}, length) for i := range ret { ret[i] = val } return ret }
go
func arrayFromScalar(val interface{}, length int) []interface{} { ret := make([]interface{}, length) for i := range ret { ret[i] = val } return ret }
[ "func", "arrayFromScalar", "(", "val", "interface", "{", "}", ",", "length", "int", ")", "[", "]", "interface", "{", "}", "{", "ret", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "length", ")", "\n", "for", "i", ":=", "range", "ret", ...
// arrayFromScalar converts a scalar value to a slice of the empty interface.
[ "arrayFromScalar", "converts", "a", "scalar", "value", "to", "a", "slice", "of", "the", "empty", "interface", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L170-L176
148,953
scgolang/sc
env.go
isValidUgenInput
func isValidUgenInput(val interface{}) (Input, bool) { switch x := val.(type) { case int: return C(float32(x)), true case float64: return C(float32(x)), true case float32: return C(x), true case Input: return x, true default: return nil, false } }
go
func isValidUgenInput(val interface{}) (Input, bool) { switch x := val.(type) { case int: return C(float32(x)), true case float64: return C(float32(x)), true case float32: return C(x), true case Input: return x, true default: return nil, false } }
[ "func", "isValidUgenInput", "(", "val", "interface", "{", "}", ")", "(", "Input", ",", "bool", ")", "{", "switch", "x", ":=", "val", ".", "(", "type", ")", "{", "case", "int", ":", "return", "C", "(", "float32", "(", "x", ")", ")", ",", "true", ...
// isValidUgenInput returns false if val is not a valid ugen input and true otherwise.
[ "isValidUgenInput", "returns", "false", "if", "val", "is", "not", "a", "valid", "ugen", "input", "and", "true", "otherwise", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/env.go#L221-L234
148,954
scgolang/sc
jpverb.go
defJPverb
func defJPverb(params Params) Ugen { var ( in = params.Add("in", 0) out = params.Add("out", 0) t60 = params.Add("t60", 1) damp = params.Add("damp", 0) size = params.Add("size", 1) earlyDiff = params.Add("earlyDiff", 0.707) modDepth = params.Add("modDepth", 0.1) modFreq =...
go
func defJPverb(params Params) Ugen { var ( in = params.Add("in", 0) out = params.Add("out", 0) t60 = params.Add("t60", 1) damp = params.Add("damp", 0) size = params.Add("size", 1) earlyDiff = params.Add("earlyDiff", 0.707) modDepth = params.Add("modDepth", 0.1) modFreq =...
[ "func", "defJPverb", "(", "params", "Params", ")", "Ugen", "{", "var", "(", "in", "=", "params", ".", "Add", "(", "\"", "\"", ",", "0", ")", "\n", "out", "=", "params", ".", "Add", "(", "\"", "\"", ",", "0", ")", "\n", "t60", "=", "params", "...
// defJPverb is a synthdef that exposes the fields of the JPverb ugen.
[ "defJPverb", "is", "a", "synthdef", "that", "exposes", "the", "fields", "of", "the", "JPverb", "ugen", "." ]
2b87756659e2b72d97cec43b6896ed01c0365097
https://github.com/scgolang/sc/blob/2b87756659e2b72d97cec43b6896ed01c0365097/jpverb.go#L118-L154
148,955
knightso/base
utils/geo.go
Haversine
func Haversine(lat1, lng1, lat2, lng2 float64) float64 { phi1 := lat1 * (degreesToRadians) phi2 := lat2 * (degreesToRadians) deltaPhi := (lat2 - lat1) * (degreesToRadians) deltaLambda := (lng2 - lng1) * (degreesToRadians) v1 := math.Sin(deltaPhi / 2) v2 := math.Sin(deltaLambda / 2) a := v1*v1 + math.Cos(phi1)*m...
go
func Haversine(lat1, lng1, lat2, lng2 float64) float64 { phi1 := lat1 * (degreesToRadians) phi2 := lat2 * (degreesToRadians) deltaPhi := (lat2 - lat1) * (degreesToRadians) deltaLambda := (lng2 - lng1) * (degreesToRadians) v1 := math.Sin(deltaPhi / 2) v2 := math.Sin(deltaLambda / 2) a := v1*v1 + math.Cos(phi1)*m...
[ "func", "Haversine", "(", "lat1", ",", "lng1", ",", "lat2", ",", "lng2", "float64", ")", "float64", "{", "phi1", ":=", "lat1", "*", "(", "degreesToRadians", ")", "\n", "phi2", ":=", "lat2", "*", "(", "degreesToRadians", ")", "\n", "deltaPhi", ":=", "("...
// a unit of return value is kilometer.
[ "a", "unit", "of", "return", "value", "is", "kilometer", "." ]
576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0
https://github.com/knightso/base/blob/576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0/utils/geo.go#L13-L25
148,956
control-center/go-procfs
linux/diskstat.go
ReadDiskstat
func ReadDiskstat() ([]*DiskStatsProxy, error) { diskstatsproxies := []*DiskStatsProxy{} file, err := os.Open(diskStatFile) if err != nil { return nil, err } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { line := strings.Fields(scanner.Text()) if len(line) != 14 { err = fmt....
go
func ReadDiskstat() ([]*DiskStatsProxy, error) { diskstatsproxies := []*DiskStatsProxy{} file, err := os.Open(diskStatFile) if err != nil { return nil, err } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { line := strings.Fields(scanner.Text()) if len(line) != 14 { err = fmt....
[ "func", "ReadDiskstat", "(", ")", "(", "[", "]", "*", "DiskStatsProxy", ",", "error", ")", "{", "diskstatsproxies", ":=", "[", "]", "*", "DiskStatsProxy", "{", "}", "\n", "file", ",", "err", ":=", "os", ".", "Open", "(", "diskStatFile", ")", "\n", "i...
// ReadDiskStat does the actual collection of disk statistics
[ "ReadDiskStat", "does", "the", "actual", "collection", "of", "disk", "statistics" ]
16061683a44ffe6a86adbd508858d27fd4993c6d
https://github.com/control-center/go-procfs/blob/16061683a44ffe6a86adbd508858d27fd4993c6d/linux/diskstat.go#L43-L110
148,957
dmotylev/appconfig
reader.go
FromReader
func FromReader(reader io.Reader) Source { m := make(map[string]string) s := bufio.NewScanner(bufio.NewReader(reader)) for s.Scan() { l := s.Text() p := keyValueRE.FindStringSubmatch(l) if p == nil { continue } m[strings.ToLower(p[1])] = p[2] } if err := s.Err(); err != nil { return Err(err) } re...
go
func FromReader(reader io.Reader) Source { m := make(map[string]string) s := bufio.NewScanner(bufio.NewReader(reader)) for s.Scan() { l := s.Text() p := keyValueRE.FindStringSubmatch(l) if p == nil { continue } m[strings.ToLower(p[1])] = p[2] } if err := s.Err(); err != nil { return Err(err) } re...
[ "func", "FromReader", "(", "reader", "io", ".", "Reader", ")", "Source", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n\n", "s", ":=", "bufio", ".", "NewScanner", "(", "bufio", ".", "NewReader", "(", "reader", ")", ")", ...
// FromReader utilizes reader as a source for lookup. // For any line matched to 'key=value' pattern it creates an entry in the internal map. // Then map is used as the source for values.
[ "FromReader", "utilizes", "reader", "as", "a", "source", "for", "lookup", ".", "For", "any", "line", "matched", "to", "key", "=", "value", "pattern", "it", "creates", "an", "entry", "in", "the", "internal", "map", ".", "Then", "map", "is", "used", "as", ...
66072ec203f6059651aec8270de797de69d6ef50
https://github.com/dmotylev/appconfig/blob/66072ec203f6059651aec8270de797de69d6ef50/reader.go#L19-L35
148,958
knightso/base
gae/ds/datastore.go
PutKeyToIndex
func PutKeyToIndex(c context.Context, key *datastore.Key, id, oldId string) error { kind := key.Kind() getF := getGetFunc(kind) putF := getPutFunc(kind) deleteF := getDeleteFunc(kind) if id == oldId { // do nothing return nil } idxKey := datastore.NewKey(c, key.Kind()+INDEX_PREFIX, id, 0, nil) var index ...
go
func PutKeyToIndex(c context.Context, key *datastore.Key, id, oldId string) error { kind := key.Kind() getF := getGetFunc(kind) putF := getPutFunc(kind) deleteF := getDeleteFunc(kind) if id == oldId { // do nothing return nil } idxKey := datastore.NewKey(c, key.Kind()+INDEX_PREFIX, id, 0, nil) var index ...
[ "func", "PutKeyToIndex", "(", "c", "context", ".", "Context", ",", "key", "*", "datastore", ".", "Key", ",", "id", ",", "oldId", "string", ")", "error", "{", "kind", ":=", "key", ".", "Kind", "(", ")", "\n", "getF", ":=", "getGetFunc", "(", "kind", ...
// call in Tx
[ "call", "in", "Tx" ]
576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0
https://github.com/knightso/base/blob/576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0/gae/ds/datastore.go#L301-L344
148,959
knightso/base
gae/ds/datastore.go
RunInTransaction
func RunInTransaction(c context.Context, f func(tc context.Context) error, opts *datastore.TransactionOptions) error { return nds.RunInTransaction(c, f, opts) }
go
func RunInTransaction(c context.Context, f func(tc context.Context) error, opts *datastore.TransactionOptions) error { return nds.RunInTransaction(c, f, opts) }
[ "func", "RunInTransaction", "(", "c", "context", ".", "Context", ",", "f", "func", "(", "tc", "context", ".", "Context", ")", "error", ",", "opts", "*", "datastore", ".", "TransactionOptions", ")", "error", "{", "return", "nds", ".", "RunInTransaction", "(...
// RunInTransaction wraps nds's RunInTransaction
[ "RunInTransaction", "wraps", "nds", "s", "RunInTransaction" ]
576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0
https://github.com/knightso/base/blob/576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0/gae/ds/datastore.go#L440-L444
148,960
favclip/qbg
misc/fixture/a/model_query.go
GreaterThanOrEqual
func (p *SampleQueryProperty) GreaterThanOrEqual(value interface{}) *SampleQueryBuilder { p.bldr.q = p.bldr.q.Filter(p.name+" >=", value) if p.bldr.plugin != nil { p.bldr.plugin.Filter(p.name, ">=", value) } return p.bldr }
go
func (p *SampleQueryProperty) GreaterThanOrEqual(value interface{}) *SampleQueryBuilder { p.bldr.q = p.bldr.q.Filter(p.name+" >=", value) if p.bldr.plugin != nil { p.bldr.plugin.Filter(p.name, ">=", value) } return p.bldr }
[ "func", "(", "p", "*", "SampleQueryProperty", ")", "GreaterThanOrEqual", "(", "value", "interface", "{", "}", ")", "*", "SampleQueryBuilder", "{", "p", ".", "bldr", ".", "q", "=", "p", ".", "bldr", ".", "q", ".", "Filter", "(", "p", ".", "name", "+",...
// GreaterThanOrEqual filter with value.
[ "GreaterThanOrEqual", "filter", "with", "value", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/a/model_query.go#L127-L133
148,961
favclip/qbg
generator.go
Name
func (st *BuildStruct) Name() string { // FooBar -> fooBar // IIS -> iis // AEData -> aeData name := st.SimpleName() if !st.Private { return name } if len(name) <= 1 { return strings.ToLower(name) } if name == strings.ToUpper(name) { return strings.ToLower(name) } runeNames := []rune(name) if unico...
go
func (st *BuildStruct) Name() string { // FooBar -> fooBar // IIS -> iis // AEData -> aeData name := st.SimpleName() if !st.Private { return name } if len(name) <= 1 { return strings.ToLower(name) } if name == strings.ToUpper(name) { return strings.ToLower(name) } runeNames := []rune(name) if unico...
[ "func", "(", "st", "*", "BuildStruct", ")", "Name", "(", ")", "string", "{", "// FooBar -> fooBar", "// IIS -> iis", "// AEData -> aeData", "name", ":=", "st", ".", "SimpleName", "(", ")", "\n\n", "if", "!", "st", ".", "Private", "{", "return", "name", "\n...
// Name returns struct type name.
[ "Name", "returns", "struct", "type", "name", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/generator.go#L315-L348
148,962
favclip/qbg
generator.go
Kind
func (st *BuildStruct) Kind() string { for _, field := range st.Fields { if field.Tag.Kind != "" { return field.Tag.Kind } } return st.Name() }
go
func (st *BuildStruct) Kind() string { for _, field := range st.Fields { if field.Tag.Kind != "" { return field.Tag.Kind } } return st.Name() }
[ "func", "(", "st", "*", "BuildStruct", ")", "Kind", "(", ")", "string", "{", "for", "_", ",", "field", ":=", "range", "st", ".", "Fields", "{", "if", "field", ".", "Tag", ".", "Kind", "!=", "\"", "\"", "{", "return", "field", ".", "Tag", ".", "...
// Kind returns kind from struct.
[ "Kind", "returns", "kind", "from", "struct", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/generator.go#L356-L363
148,963
favclip/qbg
misc/fixture/g/model_query.go
newFooBarQueryBuilderWithKind
func newFooBarQueryBuilderWithKind(kind string) *fooBarQueryBuilder { q := datastore.NewQuery(kind) bldr := &fooBarQueryBuilder{q: q} bldr.Foo = &fooBarQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("Fo...
go
func newFooBarQueryBuilderWithKind(kind string) *fooBarQueryBuilder { q := datastore.NewQuery(kind) bldr := &fooBarQueryBuilder{q: q} bldr.Foo = &fooBarQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("Fo...
[ "func", "newFooBarQueryBuilderWithKind", "(", "kind", "string", ")", "*", "fooBarQueryBuilder", "{", "q", ":=", "datastore", ".", "NewQuery", "(", "kind", ")", "\n", "bldr", ":=", "&", "fooBarQueryBuilder", "{", "q", ":", "q", "}", "\n", "bldr", ".", "Foo"...
// newFooBarQueryBuilderWithKind create new FooBarQueryBuilder with specific kind.
[ "newFooBarQueryBuilderWithKind", "create", "new", "FooBarQueryBuilder", "with", "specific", "kind", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/g/model_query.go#L29-L43
148,964
favclip/qbg
misc/fixture/g/model_query.go
Start
func (bldr *fooBarQueryBuilder) Start(cur datastore.Cursor) *fooBarQueryBuilder { bldr.q = bldr.q.Start(cur) if bldr.plugin != nil { bldr.plugin.Start(cur) } return bldr }
go
func (bldr *fooBarQueryBuilder) Start(cur datastore.Cursor) *fooBarQueryBuilder { bldr.q = bldr.q.Start(cur) if bldr.plugin != nil { bldr.plugin.Start(cur) } return bldr }
[ "func", "(", "bldr", "*", "fooBarQueryBuilder", ")", "Start", "(", "cur", "datastore", ".", "Cursor", ")", "*", "fooBarQueryBuilder", "{", "bldr", ".", "q", "=", "bldr", ".", "q", ".", "Start", "(", "cur", ")", "\n", "if", "bldr", ".", "plugin", "!="...
// Start setup to query.
[ "Start", "setup", "to", "query", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/g/model_query.go#L64-L70
148,965
favclip/qbg
misc/fixture/g/model_query.go
newAEDataQueryBuilderWithKind
func newAEDataQueryBuilderWithKind(kind string) *aeDataQueryBuilder { q := datastore.NewQuery(kind) bldr := &aeDataQueryBuilder{q: q} bldr.Foo = &aeDataQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("AE...
go
func newAEDataQueryBuilderWithKind(kind string) *aeDataQueryBuilder { q := datastore.NewQuery(kind) bldr := &aeDataQueryBuilder{q: q} bldr.Foo = &aeDataQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("AE...
[ "func", "newAEDataQueryBuilderWithKind", "(", "kind", "string", ")", "*", "aeDataQueryBuilder", "{", "q", ":=", "datastore", ".", "NewQuery", "(", "kind", ")", "\n", "bldr", ":=", "&", "aeDataQueryBuilder", "{", "q", ":", "q", "}", "\n", "bldr", ".", "Foo"...
// newAEDataQueryBuilderWithKind create new AEDataQueryBuilder with specific kind.
[ "newAEDataQueryBuilderWithKind", "create", "new", "AEDataQueryBuilder", "with", "specific", "kind", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/g/model_query.go#L199-L213
148,966
favclip/qbg
misc/fixture/g/model_query.go
newIISQueryBuilderWithKind
func newIISQueryBuilderWithKind(kind string) *iisQueryBuilder { q := datastore.NewQuery(kind) bldr := &iisQueryBuilder{q: q} bldr.Foo = &iisQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("IIS") } ret...
go
func newIISQueryBuilderWithKind(kind string) *iisQueryBuilder { q := datastore.NewQuery(kind) bldr := &iisQueryBuilder{q: q} bldr.Foo = &iisQueryProperty{ bldr: bldr, name: "Foo", } if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok { bldr.plugin = plugger.Plugin() bldr.plugin.Init("IIS") } ret...
[ "func", "newIISQueryBuilderWithKind", "(", "kind", "string", ")", "*", "iisQueryBuilder", "{", "q", ":=", "datastore", ".", "NewQuery", "(", "kind", ")", "\n", "bldr", ":=", "&", "iisQueryBuilder", "{", "q", ":", "q", "}", "\n", "bldr", ".", "Foo", "=", ...
// newIISQueryBuilderWithKind create new IISQueryBuilder with specific kind.
[ "newIISQueryBuilderWithKind", "create", "new", "IISQueryBuilder", "with", "specific", "kind", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/g/model_query.go#L369-L383
148,967
favclip/qbg
misc/fixture/g/model_query.go
Ancestor
func (bldr *iisQueryBuilder) Ancestor(parentKey *datastore.Key) *iisQueryBuilder { bldr.q = bldr.q.Ancestor(parentKey) if bldr.plugin != nil { bldr.plugin.Ancestor(parentKey) } return bldr }
go
func (bldr *iisQueryBuilder) Ancestor(parentKey *datastore.Key) *iisQueryBuilder { bldr.q = bldr.q.Ancestor(parentKey) if bldr.plugin != nil { bldr.plugin.Ancestor(parentKey) } return bldr }
[ "func", "(", "bldr", "*", "iisQueryBuilder", ")", "Ancestor", "(", "parentKey", "*", "datastore", ".", "Key", ")", "*", "iisQueryBuilder", "{", "bldr", ".", "q", "=", "bldr", ".", "q", ".", "Ancestor", "(", "parentKey", ")", "\n", "if", "bldr", ".", ...
// Ancestor sets parent key to ancestor query.
[ "Ancestor", "sets", "parent", "key", "to", "ancestor", "query", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/g/model_query.go#L386-L392
148,968
tobi/airbrake-go
airbrake.go
stacktrace
func stacktrace(skip int) (lines []Line) { for i := skip; ; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { break } item := Line{string(function(pc)), string(file), line} // ignore panic method if item.Function != "panic" { lines = append(lines, item) } } return }
go
func stacktrace(skip int) (lines []Line) { for i := skip; ; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { break } item := Line{string(function(pc)), string(file), line} // ignore panic method if item.Function != "panic" { lines = append(lines, item) } } return }
[ "func", "stacktrace", "(", "skip", "int", ")", "(", "lines", "[", "]", "Line", ")", "{", "for", "i", ":=", "skip", ";", ";", "i", "++", "{", "pc", ",", "file", ",", "line", ",", "ok", ":=", "runtime", ".", "Caller", "(", "i", ")", "\n", "if",...
// stack implements Stack, skipping N frames
[ "stack", "implements", "Stack", "skipping", "N", "frames" ]
a3cdd910a3ffef88a20fbecc10363a520ad61a0a
https://github.com/tobi/airbrake-go/blob/a3cdd910a3ffef88a20fbecc10363a520ad61a0a/airbrake.go#L47-L62
148,969
tobi/airbrake-go
airbrake.go
function
func function(pc uintptr) []byte { fn := runtime.FuncForPC(pc) if fn == nil { return dunno } name := []byte(fn.Name()) // The name includes the path name to the package, which is unnecessary // since the file name is already included. Plus, it has center dots. // That is, we see // runtime/debug.*T·ptrmetho...
go
func function(pc uintptr) []byte { fn := runtime.FuncForPC(pc) if fn == nil { return dunno } name := []byte(fn.Name()) // The name includes the path name to the package, which is unnecessary // since the file name is already included. Plus, it has center dots. // That is, we see // runtime/debug.*T·ptrmetho...
[ "func", "function", "(", "pc", "uintptr", ")", "[", "]", "byte", "{", "fn", ":=", "runtime", ".", "FuncForPC", "(", "pc", ")", "\n", "if", "fn", "==", "nil", "{", "return", "dunno", "\n", "}", "\n", "name", ":=", "[", "]", "byte", "(", "fn", "....
// function returns, if possible, the name of the function containing the PC.
[ "function", "returns", "if", "possible", "the", "name", "of", "the", "function", "containing", "the", "PC", "." ]
a3cdd910a3ffef88a20fbecc10363a520ad61a0a
https://github.com/tobi/airbrake-go/blob/a3cdd910a3ffef88a20fbecc10363a520ad61a0a/airbrake.go#L68-L85
148,970
tobi/airbrake-go
airbrake.go
omit
func omit(key string, values []string) bool { return len(key) == 0 || len(values) == 0 || len(values[0]) == 0 || sensitive.FindString(key) != "" }
go
func omit(key string, values []string) bool { return len(key) == 0 || len(values) == 0 || len(values[0]) == 0 || sensitive.FindString(key) != "" }
[ "func", "omit", "(", "key", "string", ",", "values", "[", "]", "string", ")", "bool", "{", "return", "len", "(", "key", ")", "==", "0", "||", "len", "(", "values", ")", "==", "0", "||", "len", "(", "values", "[", "0", "]", ")", "==", "0", "||...
// omit checks the key, values for emptiness or sensitivity.
[ "omit", "checks", "the", "key", "values", "for", "emptiness", "or", "sensitivity", "." ]
a3cdd910a3ffef88a20fbecc10363a520ad61a0a
https://github.com/tobi/airbrake-go/blob/a3cdd910a3ffef88a20fbecc10363a520ad61a0a/airbrake.go#L232-L234
148,971
favclip/qbg
misc/fixture/i/model_query.go
NewUserQueryBuilderWithKind
func NewUserQueryBuilderWithKind(client datastore.Client, kind string) *UserQueryBuilder { q := client.NewQuery(kind) bldr := &UserQueryBuilder{q: q} bldr.ID = &UserQueryProperty{ bldr: bldr, name: "__key__", } bldr.Name = &UserQueryProperty{ bldr: bldr, name: "Name", } bldr.MentorID = &UserQueryProperty...
go
func NewUserQueryBuilderWithKind(client datastore.Client, kind string) *UserQueryBuilder { q := client.NewQuery(kind) bldr := &UserQueryBuilder{q: q} bldr.ID = &UserQueryProperty{ bldr: bldr, name: "__key__", } bldr.Name = &UserQueryProperty{ bldr: bldr, name: "Name", } bldr.MentorID = &UserQueryProperty...
[ "func", "NewUserQueryBuilderWithKind", "(", "client", "datastore", ".", "Client", ",", "kind", "string", ")", "*", "UserQueryBuilder", "{", "q", ":=", "client", ".", "NewQuery", "(", "kind", ")", "\n", "bldr", ":=", "&", "UserQueryBuilder", "{", "q", ":", ...
// NewUserQueryBuilderWithKind create new UserQueryBuilder with specific kind.
[ "NewUserQueryBuilderWithKind", "create", "new", "UserQueryBuilder", "with", "specific", "kind", "." ]
358fe2dae1c334bf825b618d423b8f36e8ec40e9
https://github.com/favclip/qbg/blob/358fe2dae1c334bf825b618d423b8f36e8ec40e9/misc/fixture/i/model_query.go#L48-L70
148,972
kataras/go-options
example/main.go
passDynamicOptions
func passDynamicOptions() { myApp := newApp(options.Options{"MaxRequests": 17, "DevMode": true}) fmt.Printf("passDynamicOptions: %#v\n", myApp.options) }
go
func passDynamicOptions() { myApp := newApp(options.Options{"MaxRequests": 17, "DevMode": true}) fmt.Printf("passDynamicOptions: %#v\n", myApp.options) }
[ "func", "passDynamicOptions", "(", ")", "{", "myApp", ":=", "newApp", "(", "options", ".", "Options", "{", "\"", "\"", ":", "17", ",", "\"", "\"", ":", "true", "}", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "myApp", ".", "op...
// and so on...
[ "and", "so", "on", "..." ]
23b556c1b935c594ec6d71ff81ead4dbeec3aa8d
https://github.com/kataras/go-options/blob/23b556c1b935c594ec6d71ff81ead4dbeec3aa8d/example/main.go#L42-L46
148,973
flimzy/diff
dir.go
DirChecksum
func DirChecksum(expected map[string]string, dir string) *Result { actual, err := checkDir(dir, false) if err != nil { return &Result{err: err.Error()} } return Interface(expected, actual) }
go
func DirChecksum(expected map[string]string, dir string) *Result { actual, err := checkDir(dir, false) if err != nil { return &Result{err: err.Error()} } return Interface(expected, actual) }
[ "func", "DirChecksum", "(", "expected", "map", "[", "string", "]", "string", ",", "dir", "string", ")", "*", "Result", "{", "actual", ",", "err", ":=", "checkDir", "(", "dir", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "...
// DirChecksum compares the checksum of the contents of dir against the checksums // in expected. Expected should be a map of all files expected in the directory, // with the full path and filename as key, and the md5 sum as the value.
[ "DirChecksum", "compares", "the", "checksum", "of", "the", "contents", "of", "dir", "against", "the", "checksums", "in", "expected", ".", "Expected", "should", "be", "a", "map", "of", "all", "files", "expected", "in", "the", "directory", "with", "the", "full...
81d0fcdc7bd3be583b843a0d92227237dc702632
https://github.com/flimzy/diff/blob/81d0fcdc7bd3be583b843a0d92227237dc702632/dir.go#L16-L22
148,974
flimzy/diff
dir.go
DirFullCheck
func DirFullCheck(expected map[string]string, dir string) *Result { actual, err := checkDir(dir, true) if err != nil { return &Result{err: err.Error()} } return Interface(expected, actual) }
go
func DirFullCheck(expected map[string]string, dir string) *Result { actual, err := checkDir(dir, true) if err != nil { return &Result{err: err.Error()} } return Interface(expected, actual) }
[ "func", "DirFullCheck", "(", "expected", "map", "[", "string", "]", "string", ",", "dir", "string", ")", "*", "Result", "{", "actual", ",", "err", ":=", "checkDir", "(", "dir", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "...
// DirFullCheck compares the checksum of the contents of dir against the checksums // in expected. Expected should be a map of all files expected in the directory, // with the full path and filename as key, and the md5 sum, mode, and ownership // as the value.
[ "DirFullCheck", "compares", "the", "checksum", "of", "the", "contents", "of", "dir", "against", "the", "checksums", "in", "expected", ".", "Expected", "should", "be", "a", "map", "of", "all", "files", "expected", "in", "the", "directory", "with", "the", "ful...
81d0fcdc7bd3be583b843a0d92227237dc702632
https://github.com/flimzy/diff/blob/81d0fcdc7bd3be583b843a0d92227237dc702632/dir.go#L28-L34
148,975
StackExchange/mof
lex.go
lineNumber
func (l *lexer) lineNumber() int { return 1 + strings.Count(string(l.input[:l.lastPos]), "\n") }
go
func (l *lexer) lineNumber() int { return 1 + strings.Count(string(l.input[:l.lastPos]), "\n") }
[ "func", "(", "l", "*", "lexer", ")", "lineNumber", "(", ")", "int", "{", "return", "1", "+", "strings", ".", "Count", "(", "string", "(", "l", ".", "input", "[", ":", "l", ".", "lastPos", "]", ")", ",", "\"", "\\n", "\"", ")", "\n", "}" ]
// lineNumber reports which line we're on, based on the position of // the previous item returned by nextItem. Doing it this way // means we don't have to worry about peek double counting.
[ "lineNumber", "reports", "which", "line", "we", "re", "on", "based", "on", "the", "position", "of", "the", "previous", "item", "returned", "by", "nextItem", ".", "Doing", "it", "this", "way", "means", "we", "don", "t", "have", "to", "worry", "about", "pe...
2bb66392c0273ed914c2b83442e8a61effa42678
https://github.com/StackExchange/mof/blob/2bb66392c0273ed914c2b83442e8a61effa42678/lex.go#L118-L120
148,976
StackExchange/mof
parse.go
parse
func parse(text []byte) (t *tree, err error) { t = &tree{ text: text, } err = t.Parse(text) return }
go
func parse(text []byte) (t *tree, err error) { t = &tree{ text: text, } err = t.Parse(text) return }
[ "func", "parse", "(", "text", "[", "]", "byte", ")", "(", "t", "*", "tree", ",", "err", "error", ")", "{", "t", "=", "&", "tree", "{", "text", ":", "text", ",", "}", "\n", "err", "=", "t", ".", "Parse", "(", "text", ")", "\n", "return", "\n...
// Parse returns a Tree, created by parsing the configuration described in the // argument string. If an error is encountered, parsing stops and an empty Tree // is returned with the error.
[ "Parse", "returns", "a", "Tree", "created", "by", "parsing", "the", "configuration", "described", "in", "the", "argument", "string", ".", "If", "an", "error", "is", "encountered", "parsing", "stops", "and", "an", "empty", "Tree", "is", "returned", "with", "t...
2bb66392c0273ed914c2b83442e8a61effa42678
https://github.com/StackExchange/mof/blob/2bb66392c0273ed914c2b83442e8a61effa42678/parse.go#L30-L36
148,977
StackExchange/mof
parse.go
until
func (t *tree) until(until itemType, context string) item { for { token := t.next() switch token.typ { case until: return token case itemEOF: t.errorf("did not find %s in %s", until, context) } } }
go
func (t *tree) until(until itemType, context string) item { for { token := t.next() switch token.typ { case until: return token case itemEOF: t.errorf("did not find %s in %s", until, context) } } }
[ "func", "(", "t", "*", "tree", ")", "until", "(", "until", "itemType", ",", "context", "string", ")", "item", "{", "for", "{", "token", ":=", "t", ".", "next", "(", ")", "\n", "switch", "token", ".", "typ", "{", "case", "until", ":", "return", "t...
// until ignores tokens until a specified type is found.
[ "until", "ignores", "tokens", "until", "a", "specified", "type", "is", "found", "." ]
2bb66392c0273ed914c2b83442e8a61effa42678
https://github.com/StackExchange/mof/blob/2bb66392c0273ed914c2b83442e8a61effa42678/parse.go#L96-L106
148,978
StackExchange/mof
parse.go
parse
func (t *tree) parse(n *classNode) { foundClass := false for { token := t.next() switch token.typ { case itemWord: if token.val == "class" { if foundClass { t.unexpected(token, "input") } foundClass = true t.parseClass(n) t.expect(itemSemi, "input") } case itemEOF: if foundCl...
go
func (t *tree) parse(n *classNode) { foundClass := false for { token := t.next() switch token.typ { case itemWord: if token.val == "class" { if foundClass { t.unexpected(token, "input") } foundClass = true t.parseClass(n) t.expect(itemSemi, "input") } case itemEOF: if foundCl...
[ "func", "(", "t", "*", "tree", ")", "parse", "(", "n", "*", "classNode", ")", "{", "foundClass", ":=", "false", "\n", "for", "{", "token", ":=", "t", ".", "next", "(", ")", "\n", "switch", "token", ".", "typ", "{", "case", "itemWord", ":", "if", ...
// parse is the top-level parser for a conf. // It runs to EOF.
[ "parse", "is", "the", "top", "-", "level", "parser", "for", "a", "conf", ".", "It", "runs", "to", "EOF", "." ]
2bb66392c0273ed914c2b83442e8a61effa42678
https://github.com/StackExchange/mof/blob/2bb66392c0273ed914c2b83442e8a61effa42678/parse.go#L199-L222
148,979
flimzy/diff
diff.go
sliceDiff
func sliceDiff(expected, actual []string) *Result { udiff := difflib.UnifiedDiff{ A: expected, FromFile: "expected", B: actual, ToFile: "actual", Context: 2, } diff, err := difflib.GetUnifiedDiffString(udiff) if err != nil { // This can only happen if a write to a byte buffer fails, so ...
go
func sliceDiff(expected, actual []string) *Result { udiff := difflib.UnifiedDiff{ A: expected, FromFile: "expected", B: actual, ToFile: "actual", Context: 2, } diff, err := difflib.GetUnifiedDiffString(udiff) if err != nil { // This can only happen if a write to a byte buffer fails, so ...
[ "func", "sliceDiff", "(", "expected", ",", "actual", "[", "]", "string", ")", "*", "Result", "{", "udiff", ":=", "difflib", ".", "UnifiedDiff", "{", "A", ":", "expected", ",", "FromFile", ":", "\"", "\"", ",", "B", ":", "actual", ",", "ToFile", ":", ...
// sliceDiff expects two slices of \n-terminated strings to compare.
[ "sliceDiff", "expects", "two", "slices", "of", "\\", "n", "-", "terminated", "strings", "to", "compare", "." ]
81d0fcdc7bd3be583b843a0d92227237dc702632
https://github.com/flimzy/diff/blob/81d0fcdc7bd3be583b843a0d92227237dc702632/diff.go#L39-L58
148,980
flimzy/diff
diff.go
TextSlices
func TextSlices(expected, actual []string) *Result { e := make([]string, len(expected)) a := make([]string, len(actual)) for i, str := range expected { e[i] = strings.TrimRight(str, "\n") + "\n" } for i, str := range actual { a[i] = strings.TrimRight(str, "\n") + "\n" } return sliceDiff(e, a) }
go
func TextSlices(expected, actual []string) *Result { e := make([]string, len(expected)) a := make([]string, len(actual)) for i, str := range expected { e[i] = strings.TrimRight(str, "\n") + "\n" } for i, str := range actual { a[i] = strings.TrimRight(str, "\n") + "\n" } return sliceDiff(e, a) }
[ "func", "TextSlices", "(", "expected", ",", "actual", "[", "]", "string", ")", "*", "Result", "{", "e", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "expected", ")", ")", "\n", "a", ":=", "make", "(", "[", "]", "string", ",", "len", ...
// TextSlices compares two slices of text, treating each element as a line of // text. Newlines are added to each element, if they are found to be missing.
[ "TextSlices", "compares", "two", "slices", "of", "text", "treating", "each", "element", "as", "a", "line", "of", "text", ".", "Newlines", "are", "added", "to", "each", "element", "if", "they", "are", "found", "to", "be", "missing", "." ]
81d0fcdc7bd3be583b843a0d92227237dc702632
https://github.com/flimzy/diff/blob/81d0fcdc7bd3be583b843a0d92227237dc702632/diff.go#L62-L72
148,981
flimzy/diff
diff.go
JSON
func JSON(expected, actual []byte) *Result { var expectedInterface, actualInterface interface{} if len(expected) > 0 { if err := json.Unmarshal(expected, &expectedInterface); err != nil { return &Result{err: fmt.Sprintf("failed to unmarshal expected value: %s", err)} } } if len(actual) > 0 { if err := json...
go
func JSON(expected, actual []byte) *Result { var expectedInterface, actualInterface interface{} if len(expected) > 0 { if err := json.Unmarshal(expected, &expectedInterface); err != nil { return &Result{err: fmt.Sprintf("failed to unmarshal expected value: %s", err)} } } if len(actual) > 0 { if err := json...
[ "func", "JSON", "(", "expected", ",", "actual", "[", "]", "byte", ")", "*", "Result", "{", "var", "expectedInterface", ",", "actualInterface", "interface", "{", "}", "\n", "if", "len", "(", "expected", ")", ">", "0", "{", "if", "err", ":=", "json", "...
// JSON unmarshals two JSON strings, then calls AsJSON on them. As a special // case, empty byte arrays are unmarshaled to nil.
[ "JSON", "unmarshals", "two", "JSON", "strings", "then", "calls", "AsJSON", "on", "them", ".", "As", "a", "special", "case", "empty", "byte", "arrays", "are", "unmarshaled", "to", "nil", "." ]
81d0fcdc7bd3be583b843a0d92227237dc702632
https://github.com/flimzy/diff/blob/81d0fcdc7bd3be583b843a0d92227237dc702632/diff.go#L180-L193
148,982
kataras/go-options
options.go
Set
func (temp Options) Set(main Options) { for k, v := range temp { main[k] = v } }
go
func (temp Options) Set(main Options) { for k, v := range temp { main[k] = v } }
[ "func", "(", "temp", "Options", ")", "Set", "(", "main", "Options", ")", "{", "for", "k", ",", "v", ":=", "range", "temp", "{", "main", "[", "k", "]", "=", "v", "\n", "}", "\n", "}" ]
// Set implements the OptionSetter // makes the Options an OptionSetter also
[ "Set", "implements", "the", "OptionSetter", "makes", "the", "Options", "an", "OptionSetter", "also" ]
23b556c1b935c594ec6d71ff81ead4dbeec3aa8d
https://github.com/kataras/go-options/blob/23b556c1b935c594ec6d71ff81ead4dbeec3aa8d/options.go#L32-L36
148,983
kataras/go-options
options.go
Default
func Default(opt ...OptionSetter) Options { optionsMap, _ := New(Options{}, opt...) return optionsMap }
go
func Default(opt ...OptionSetter) Options { optionsMap, _ := New(Options{}, opt...) return optionsMap }
[ "func", "Default", "(", "opt", "...", "OptionSetter", ")", "Options", "{", "optionsMap", ",", "_", ":=", "New", "(", "Options", "{", "}", ",", "opt", "...", ")", "\n", "return", "optionsMap", "\n", "}" ]
// Default accepts option setters and returns the new filled Options, you can pass multi Options as OptionSetter too
[ "Default", "accepts", "option", "setters", "and", "returns", "the", "new", "filled", "Options", "you", "can", "pass", "multi", "Options", "as", "OptionSetter", "too" ]
23b556c1b935c594ec6d71ff81ead4dbeec3aa8d
https://github.com/kataras/go-options/blob/23b556c1b935c594ec6d71ff81ead4dbeec3aa8d/options.go#L69-L72
148,984
knightso/base
errors/errors.go
Append
func (sm *SyncMultiError) Append(err error) { sm.Lock() defer sm.Unlock() sm.MultiError = append(sm.MultiError, err) }
go
func (sm *SyncMultiError) Append(err error) { sm.Lock() defer sm.Unlock() sm.MultiError = append(sm.MultiError, err) }
[ "func", "(", "sm", "*", "SyncMultiError", ")", "Append", "(", "err", "error", ")", "{", "sm", ".", "Lock", "(", ")", "\n", "defer", "sm", ".", "Unlock", "(", ")", "\n", "sm", ".", "MultiError", "=", "append", "(", "sm", ".", "MultiError", ",", "e...
// Append append an error.
[ "Append", "append", "an", "error", "." ]
576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0
https://github.com/knightso/base/blob/576c8c61deca12dc7b47d9ad8b9626c70ad7d0e0/errors/errors.go#L205-L209
148,985
dmotylev/appconfig
appconfig.go
Load
func Load(v interface{}, s ...Source) error { if reflect.Indirect(reflect.ValueOf(v)).Kind() != reflect.Struct { panic("scan for non-struct type") } if len(s) == 0 { return nil } scn := &scanner{s} return scn.scan(v) }
go
func Load(v interface{}, s ...Source) error { if reflect.Indirect(reflect.ValueOf(v)).Kind() != reflect.Struct { panic("scan for non-struct type") } if len(s) == 0 { return nil } scn := &scanner{s} return scn.scan(v) }
[ "func", "Load", "(", "v", "interface", "{", "}", ",", "s", "...", "Source", ")", "error", "{", "if", "reflect", ".", "Indirect", "(", "reflect", ".", "ValueOf", "(", "v", ")", ")", ".", "Kind", "(", ")", "!=", "reflect", ".", "Struct", "{", "pani...
// Load populates given struct from ordered list of sources. // First "positive" lookup will be used as a value for the field.
[ "Load", "populates", "given", "struct", "from", "ordered", "list", "of", "sources", ".", "First", "positive", "lookup", "will", "be", "used", "as", "a", "value", "for", "the", "field", "." ]
66072ec203f6059651aec8270de797de69d6ef50
https://github.com/dmotylev/appconfig/blob/66072ec203f6059651aec8270de797de69d6ef50/appconfig.go#L38-L47
148,986
dmotylev/appconfig
file.go
FromFile
func FromFile(s string) Source { f, err := os.Open(s) if err != nil { return FromMap(nil) } defer f.Close() return FromReader(f) }
go
func FromFile(s string) Source { f, err := os.Open(s) if err != nil { return FromMap(nil) } defer f.Close() return FromReader(f) }
[ "func", "FromFile", "(", "s", "string", ")", "Source", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "FromMap", "(", "nil", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ...
// FromFile uses Reader if the file exists, empty map is the source otherwise.
[ "FromFile", "uses", "Reader", "if", "the", "file", "exists", "empty", "map", "is", "the", "source", "otherwise", "." ]
66072ec203f6059651aec8270de797de69d6ef50
https://github.com/dmotylev/appconfig/blob/66072ec203f6059651aec8270de797de69d6ef50/file.go#L10-L17
148,987
dylanmei/winrmtest
remote.go
NewRemote
func NewRemote() *Remote { mux := http.NewServeMux() srv := httptest.NewServer(mux) host, port, _ := splitAddr(srv.URL) remote := Remote{ Host: host, Port: port, server: srv, service: &wsman{}, } mux.Handle("/wsman", remote.service) return &remote }
go
func NewRemote() *Remote { mux := http.NewServeMux() srv := httptest.NewServer(mux) host, port, _ := splitAddr(srv.URL) remote := Remote{ Host: host, Port: port, server: srv, service: &wsman{}, } mux.Handle("/wsman", remote.service) return &remote }
[ "func", "NewRemote", "(", ")", "*", "Remote", "{", "mux", ":=", "http", ".", "NewServeMux", "(", ")", "\n", "srv", ":=", "httptest", ".", "NewServer", "(", "mux", ")", "\n\n", "host", ",", "port", ",", "_", ":=", "splitAddr", "(", "srv", ".", "URL"...
// NewRemote returns a new initialized Remote
[ "NewRemote", "returns", "a", "new", "initialized", "Remote" ]
99b7fe2fddf13e83d546a045b094acb6a892a72e
https://github.com/dylanmei/winrmtest/blob/99b7fe2fddf13e83d546a045b094acb6a892a72e/remote.go#L22-L36
148,988
dylanmei/winrmtest
remote.go
MatchPattern
func MatchPattern(pattern string) MatcherFunc { r := regexp.MustCompile(pattern) return func(candidate string) bool { return r.MatchString(candidate) } }
go
func MatchPattern(pattern string) MatcherFunc { r := regexp.MustCompile(pattern) return func(candidate string) bool { return r.MatchString(candidate) } }
[ "func", "MatchPattern", "(", "pattern", "string", ")", "MatcherFunc", "{", "r", ":=", "regexp", ".", "MustCompile", "(", "pattern", ")", "\n", "return", "func", "(", "candidate", "string", ")", "bool", "{", "return", "r", ".", "MatchString", "(", "candidat...
// MatchPattern return a new MatcherFunc based on pattern matching
[ "MatchPattern", "return", "a", "new", "MatcherFunc", "based", "on", "pattern", "matching" ]
99b7fe2fddf13e83d546a045b094acb6a892a72e
https://github.com/dylanmei/winrmtest/blob/99b7fe2fddf13e83d546a045b094acb6a892a72e/remote.go#L54-L59
148,989
dylanmei/winrmtest
remote.go
CommandFunc
func (r *Remote) CommandFunc(m MatcherFunc, f CommandFunc) { r.service.HandleCommand(m, f) }
go
func (r *Remote) CommandFunc(m MatcherFunc, f CommandFunc) { r.service.HandleCommand(m, f) }
[ "func", "(", "r", "*", "Remote", ")", "CommandFunc", "(", "m", "MatcherFunc", ",", "f", "CommandFunc", ")", "{", "r", ".", "service", ".", "HandleCommand", "(", "m", ",", "f", ")", "\n", "}" ]
// CommandFunc adds a WinRM command mock function to the WinRM server
[ "CommandFunc", "adds", "a", "WinRM", "command", "mock", "function", "to", "the", "WinRM", "server" ]
99b7fe2fddf13e83d546a045b094acb6a892a72e
https://github.com/dylanmei/winrmtest/blob/99b7fe2fddf13e83d546a045b094acb6a892a72e/remote.go#L65-L67
148,990
getlantern/context
context.go
Fill
func (_m Map) Fill(m Map) { for key, value := range _m { m[key] = value } }
go
func (_m Map) Fill(m Map) { for key, value := range _m { m[key] = value } }
[ "func", "(", "_m", "Map", ")", "Fill", "(", "m", "Map", ")", "{", "for", "key", ",", "value", ":=", "range", "_m", "{", "m", "[", "key", "]", "=", "value", "\n", "}", "\n", "}" ]
// Fill implements the method from the Contextual interface.
[ "Fill", "implements", "the", "method", "from", "the", "Contextual", "interface", "." ]
c447772a6520c1a3ae6294a7df725ee08230f14e
https://github.com/getlantern/context/blob/c447772a6520c1a3ae6294a7df725ee08230f14e/context.go#L59-L63
148,991
emersion/go-textwrapper
wrapper.go
New
func New(w io.Writer, sep string, l int) io.Writer { return &writer{ Sep: sep, Len: l, w: w, } }
go
func New(w io.Writer, sep string, l int) io.Writer { return &writer{ Sep: sep, Len: l, w: w, } }
[ "func", "New", "(", "w", "io", ".", "Writer", ",", "sep", "string", ",", "l", "int", ")", "io", ".", "Writer", "{", "return", "&", "writer", "{", "Sep", ":", "sep", ",", "Len", ":", "l", ",", "w", ":", "w", ",", "}", "\n", "}" ]
// Returns a writer that splits its input into multiple parts that have the same // length and adds a separator between these parts.
[ "Returns", "a", "writer", "that", "splits", "its", "input", "into", "multiple", "parts", "that", "have", "the", "same", "length", "and", "adds", "a", "separator", "between", "these", "parts", "." ]
d0e65e56babe3f687ff94c1d764ca0e6aa7723ee
https://github.com/emersion/go-textwrapper/blob/d0e65e56babe3f687ff94c1d764ca0e6aa7723ee/wrapper.go#L50-L56
148,992
jjeffery/errors
context.go
safeSlice
func safeSlice(keyvals []interface{}) []interface{} { if len(keyvals) == 0 { return nil } return keyvals[0:len(keyvals):len(keyvals)] }
go
func safeSlice(keyvals []interface{}) []interface{} { if len(keyvals) == 0 { return nil } return keyvals[0:len(keyvals):len(keyvals)] }
[ "func", "safeSlice", "(", "keyvals", "[", "]", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "if", "len", "(", "keyvals", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "keyvals", "[", "0", ":", "len", "(", ...
// safeSlice returns a slice whose capacity is the same as its length. // This slice is safe for concurrent operations because any attempt to // append to the slice will result in a new underlying array being allocated.
[ "safeSlice", "returns", "a", "slice", "whose", "capacity", "is", "the", "same", "as", "its", "length", ".", "This", "slice", "is", "safe", "for", "concurrent", "operations", "because", "any", "attempt", "to", "append", "to", "the", "slice", "will", "result",...
c6467ce94fa07edd3d0355a4a4a17768531e448f
https://github.com/jjeffery/errors/blob/c6467ce94fa07edd3d0355a4a4a17768531e448f/context.go#L54-L59
148,993
jjeffery/errors
errors.go
Wrap
func Wrap(err error, message ...string) Error { var ctx context return ctx.Wrap(err, message...) }
go
func Wrap(err error, message ...string) Error { var ctx context return ctx.Wrap(err, message...) }
[ "func", "Wrap", "(", "err", "error", ",", "message", "...", "string", ")", "Error", "{", "var", "ctx", "context", "\n", "return", "ctx", ".", "Wrap", "(", "err", ",", "message", "...", ")", "\n", "}" ]
// Wrap creates an error that wraps an existing error. // If err is nil, Wrap returns nil.
[ "Wrap", "creates", "an", "error", "that", "wraps", "an", "existing", "error", ".", "If", "err", "is", "nil", "Wrap", "returns", "nil", "." ]
c6467ce94fa07edd3d0355a4a4a17768531e448f
https://github.com/jjeffery/errors/blob/c6467ce94fa07edd3d0355a4a4a17768531e448f/errors.go#L19-L22
148,994
gorgonia/vecf32
utils.go
Reduce
func Reduce(f func(a, b float32) float32, def float32, l ...float32) (retVal float32) { retVal = def if len(l) == 0 { return } for _, v := range l { retVal = f(retVal, v) } return }
go
func Reduce(f func(a, b float32) float32, def float32, l ...float32) (retVal float32) { retVal = def if len(l) == 0 { return } for _, v := range l { retVal = f(retVal, v) } return }
[ "func", "Reduce", "(", "f", "func", "(", "a", ",", "b", "float32", ")", "float32", ",", "def", "float32", ",", "l", "...", "float32", ")", "(", "retVal", "float32", ")", "{", "retVal", "=", "def", "\n", "if", "len", "(", "l", ")", "==", "0", "{...
// Reduce takes a function to reduce by, a defalut, and a splatted list of float32s
[ "Reduce", "takes", "a", "function", "to", "reduce", "by", "a", "defalut", "and", "a", "splatted", "list", "of", "float32s" ]
a06d791a4e66be4d2fcae4530bb67afa232a0dae
https://github.com/gorgonia/vecf32/blob/a06d791a4e66be4d2fcae4530bb67afa232a0dae/utils.go#L30-L40
148,995
golangplus/bytes
slice.go
Read
func (s *Slice) Read(p []byte) (n int, err error) { if len(p) == 0 { return 0, nil } if len(*s) == 0 { return 0, io.EOF } n = copy(p, *s) if n == len(*s) { *s = nil } else { *s = (*s)[n:] } return n, nil }
go
func (s *Slice) Read(p []byte) (n int, err error) { if len(p) == 0 { return 0, nil } if len(*s) == 0 { return 0, io.EOF } n = copy(p, *s) if n == len(*s) { *s = nil } else { *s = (*s)[n:] } return n, nil }
[ "func", "(", "s", "*", "Slice", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "len", "(", "p", ")", "==", "0", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "if", "len", "(", "*",...
// Read implements the io.Reader interface. // After some bytes are read, the slice shrinks.
[ "Read", "implements", "the", "io", ".", "Reader", "interface", ".", "After", "some", "bytes", "are", "read", "the", "slice", "shrinks", "." ]
45c989fe545070ef7c9003cf1998bb195c61731a
https://github.com/golangplus/bytes/blob/45c989fe545070ef7c9003cf1998bb195c61731a/slice.go#L41-L58
148,996
golangplus/bytes
slice.go
Skip
func (s *Slice) Skip(n int64) (int64, error) { if n == 0 { return 0, nil } if len(*s) == 0 { return 0, io.EOF } if n >= int64(len(*s)) { n = int64(len(*s)) *s = nil } else { *s = (*s)[int(n):] } return n, nil }
go
func (s *Slice) Skip(n int64) (int64, error) { if n == 0 { return 0, nil } if len(*s) == 0 { return 0, io.EOF } if n >= int64(len(*s)) { n = int64(len(*s)) *s = nil } else { *s = (*s)[int(n):] } return n, nil }
[ "func", "(", "s", "*", "Slice", ")", "Skip", "(", "n", "int64", ")", "(", "int64", ",", "error", ")", "{", "if", "n", "==", "0", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "if", "len", "(", "*", "s", ")", "==", "0", "{", "return", ...
// Skip skips n bytes.
[ "Skip", "skips", "n", "bytes", "." ]
45c989fe545070ef7c9003cf1998bb195c61731a
https://github.com/golangplus/bytes/blob/45c989fe545070ef7c9003cf1998bb195c61731a/slice.go#L66-L81
148,997
golangplus/bytes
slice.go
Write
func (s *Slice) Write(p []byte) (n int, err error) { *s = append(*s, p...) return len(p), nil }
go
func (s *Slice) Write(p []byte) (n int, err error) { *s = append(*s, p...) return len(p), nil }
[ "func", "(", "s", "*", "Slice", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "*", "s", "=", "append", "(", "*", "s", ",", "p", "...", ")", "\n", "return", "len", "(", "p", ")", ",", "nil",...
// Write implements the io.Writer interface. // Bytes are appended to the tail of the slice.
[ "Write", "implements", "the", "io", ".", "Writer", "interface", ".", "Bytes", "are", "appended", "to", "the", "tail", "of", "the", "slice", "." ]
45c989fe545070ef7c9003cf1998bb195c61731a
https://github.com/golangplus/bytes/blob/45c989fe545070ef7c9003cf1998bb195c61731a/slice.go#L85-L88
148,998
golangplus/bytes
slice.go
ReadByte
func (s *Slice) ReadByte() (c byte, err error) { if len(*s) < 1 { return 0, io.EOF } c = (*s)[0] if len(*s) > 1 { *s = (*s)[1:] } else { *s = nil } return c, nil }
go
func (s *Slice) ReadByte() (c byte, err error) { if len(*s) < 1 { return 0, io.EOF } c = (*s)[0] if len(*s) > 1 { *s = (*s)[1:] } else { *s = nil } return c, nil }
[ "func", "(", "s", "*", "Slice", ")", "ReadByte", "(", ")", "(", "c", "byte", ",", "err", "error", ")", "{", "if", "len", "(", "*", "s", ")", "<", "1", "{", "return", "0", ",", "io", ".", "EOF", "\n", "}", "\n\n", "c", "=", "(", "*", "s", ...
// ReadByte implements the io.ByteReader interface.
[ "ReadByte", "implements", "the", "io", ".", "ByteReader", "interface", "." ]
45c989fe545070ef7c9003cf1998bb195c61731a
https://github.com/golangplus/bytes/blob/45c989fe545070ef7c9003cf1998bb195c61731a/slice.go#L91-L103
148,999
golangplus/bytes
slice.go
WriteByte
func (s *Slice) WriteByte(c byte) error { *s = append(*s, c) return nil }
go
func (s *Slice) WriteByte(c byte) error { *s = append(*s, c) return nil }
[ "func", "(", "s", "*", "Slice", ")", "WriteByte", "(", "c", "byte", ")", "error", "{", "*", "s", "=", "append", "(", "*", "s", ",", "c", ")", "\n", "return", "nil", "\n", "}" ]
// WriteByte implements the io.ByteWriter interface.
[ "WriteByte", "implements", "the", "io", ".", "ByteWriter", "interface", "." ]
45c989fe545070ef7c9003cf1998bb195c61731a
https://github.com/golangplus/bytes/blob/45c989fe545070ef7c9003cf1998bb195c61731a/slice.go#L106-L109