text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (s *Sub) Truth() starlark.Bool { return s == nil } | [
0.14999894797801971,
-0.16347183287143707,
0.327018141746521,
0.21164736151695251,
0.9571021795272827,
0.4727221429347992,
-0.6685236692428589,
0.08637978881597519,
0.28347381949424744,
-1.2482020854949951,
-1.7635695934295654,
0.7158011198043823,
-0.8773255348205566,
0.2592690587043762,
... |
func (s *Sub) Hash32(h hash.Hash32) {
h.Write([]byte(s.Format))
for _, sub := range s.Substitutions {
h.Write([]byte(sub.Key))
sub.Value.Hash32(h)
}
} | [
0.7738761305809021,
0.6101542711257935,
0.4772399365901947,
-0.2471778243780136,
0.10352052003145218,
1.2123931646347046,
-0.6555348038673401,
-0.06443312764167786,
-1.1587291955947876,
-0.9208253026008606,
-0.5738190412521362,
0.2956865429878235,
0.7429893612861633,
0.7598978281021118,
... |
func (s *Sub) Hash() (uint32, error) {
h := adler32.New()
s.Hash32(h)
return h.Sum32(), nil
} | [
1.0481796264648438,
1.1077234745025635,
0.6780794262886047,
0.6019852757453918,
-0.5912771821022034,
1.3098092079162598,
0.37802383303642273,
0.07626019418239594,
-0.2834688127040863,
-1.6801142692565918,
-0.8588164448738098,
1.4007618427276611,
-0.12427753210067749,
0.10768626630306244,
... |
func (s *Sub) Freeze() {} | [
-0.5406690835952759,
-0.05833990499377251,
0.3792397677898407,
1.1781082153320312,
0.19376730918884277,
0.44482025504112244,
0.7005232572555542,
-0.2806291878223419,
-0.2702135741710663,
-0.8613945245742798,
-0.85209721326828,
1.0536513328552246,
-0.5770671367645264,
0.3041457533836365,
... |
func starlarkSub(
args starlark.Tuple,
kwargs []starlark.Tuple,
) (starlark.Value, error) {
// Expect exactly one positional argument, which represents the format
// string.
if len(args) != 1 {
return nil, errors.Errorf(
"Expected 1 positional argument 'format'; found %d",
len(args),
)
}
// Validate t... | [
0.016924437135457993,
-0.36897242069244385,
0.7945018410682678,
-0.28235337138175964,
-1.202499508857727,
-0.35937339067459106,
-0.7194765210151672,
-0.14596028625965118,
-0.21395991742610931,
-0.6247917413711548,
0.35804712772369385,
1.051911473274231,
0.018242761492729187,
-0.68168580532... |
func (t *Target) Type() string { return "Target" } | [
-1.183731198310852,
-0.4191851317882538,
0.13272279500961304,
-0.3024449646472931,
0.7203682661056519,
0.8405871987342834,
0.12586753070354462,
-0.9810037016868591,
0.32584747672080994,
0.29700806736946106,
0.15421654284000397,
0.7739185690879822,
0.4012143015861511,
0.1567448526620865,
... |
func (t *Target) Freeze() {} | [
-1.8656471967697144,
-0.5702615976333618,
0.16397462785243988,
0.25394248962402344,
0.9614887237548828,
0.4304215610027313,
0.2518921494483948,
-0.2825224995613098,
-0.29429304599761963,
0.29232707619667053,
-0.2821511924266815,
0.44349783658981323,
-0.11435072869062424,
0.0332734398543834... |
func (t *Target) Truth() starlark.Bool { return starlark.Bool(t == nil) } | [
-0.557866096496582,
-0.14871954917907715,
0.38630688190460205,
-0.5872524976730347,
1.4179646968841553,
0.2895643711090088,
-1.0666630268096924,
0.34846097230911255,
0.08574830740690231,
-0.3025099039077759,
-1.2249057292938232,
0.5308908224105835,
-0.5456574559211731,
0.3067898452281952,
... |
func (t *Target) Hash32(h hash.Hash32) {
h.Write([]byte(t.Name))
h.Write([]byte(t.Builder))
for _, arg := range t.Args {
arg.Hash32(h)
}
for _, env := range t.Env {
h.Write([]byte(env))
}
} | [
0.2649960219860077,
0.668717086315155,
0.5894840955734253,
-0.40136346220970154,
1.1967318058013916,
1.2079548835754395,
-0.43523067235946655,
-0.35168540477752686,
-1.6061952114105225,
-0.24591313302516937,
-0.35616838932037354,
0.6215178370475769,
0.6651301980018616,
0.6930855512619019,
... |
func (t *Target) Hash() (uint32, error) {
h := adler32.New()
t.Hash32(h)
return h.Sum32(), nil
} | [
0.16029512882232666,
0.8292806148529053,
0.7635532021522522,
0.1370338648557663,
0.04723002389073372,
1.2504054307937622,
0.049399107694625854,
0.05260968208312988,
-0.19309912621974945,
-0.8090894222259521,
-0.22066068649291992,
1.2647157907485962,
0.22697581350803375,
0.19519610702991486... |
func starlarkTarget(
args starlark.Tuple,
kwargs []starlark.Tuple,
) (starlark.Value, error) {
// For the sake of simpler parsing, we'll simply require that all args are
// passed as kwargs (no positional args).
if len(args) != 0 {
return nil, errors.Errorf(
"Expected 0 positional args; found %d",
len(args... | [
-0.30140331387519836,
-0.16975973546504974,
0.8160919547080994,
-0.33194276690483093,
0.032930973917245865,
-0.820786714553833,
-0.9734870791435242,
-0.17471149563789368,
-0.8062447905540466,
0.04865134507417679,
0.3434288501739502,
1.0530492067337036,
-0.038646578788757324,
-0.08177509903... |
func starlarkValueToArg(v starlark.Value) (Arg, error) {
switch x := v.(type) {
case Arg:
return x, nil
case starlark.String:
return String(x), nil
default:
return nil, errors.Errorf(
"Cannot convert %s into a target argument",
v.Type(),
)
}
} | [
-0.30943354964256287,
-0.26405179500579834,
0.5213947296142578,
-0.7594160437583923,
-0.4666995108127594,
-0.37564656138420105,
-0.5786792039871216,
-0.19402575492858887,
0.10488942265510559,
0.719760537147522,
0.0811588317155838,
0.9478280544281006,
0.3524441421031952,
0.23025448620319366... |
func builtinWrapper(
name string,
f func(starlark.Tuple, []starlark.Tuple) (starlark.Value, error),
) *starlark.Builtin {
return starlark.NewBuiltin(
name,
func(
_ *starlark.Thread,
builtin *starlark.Builtin,
args starlark.Tuple,
kwargs []starlark.Tuple,
) (starlark.Value, error) {
v, err := f(a... | [
-0.39661046862602234,
-0.4154107868671417,
0.28525057435035706,
-0.042913295328617096,
-0.8296229839324951,
0.09120608866214752,
-0.5410038828849792,
0.500937819480896,
-1.326760172843933,
-0.29294490814208984,
-0.2585523724555969,
1.0143065452575684,
0.05294648930430412,
-0.01980397291481... |
func makeLoader(root string, packages map[string]string) loadFunc {
return makeLoaderHelper(
root,
packages,
map[string]*cacheEntry{},
starlark.StringDict{
"target": builtinWrapper("target", starlarkTarget),
"sub": builtinWrapper("sub", starlarkSub),
"path": builtinWrapper("path", starlarkPath),
... | [
0.446444034576416,
-0.2620529532432556,
0.40358370542526245,
-0.2232980877161026,
-1.4306175708770752,
-0.3566141426563263,
-0.2795713245868683,
0.2137121558189392,
-0.4487282633781433,
-0.6877801418304443,
-0.30092495679855347,
0.6182672381401062,
0.6330944895744324,
-0.13522377610206604,... |
func execModule(module string, load loadFunc) (starlark.StringDict, error) {
return load(&starlark.Thread{Name: module, Load: load}, module)
} | [
0.11546749621629715,
-0.08113019913434982,
0.3558591604232788,
-0.9922874569892883,
-0.32338109612464905,
-0.1295662224292755,
-0.8230382800102234,
-0.5260232090950012,
-0.38366901874542236,
0.34342318773269653,
-0.2584191560745239,
1.149022102355957,
-0.1587505042552948,
-0.13436439633369... |
func NewHelm(namespace, repoFile, repoCache string) (*Helm, error) {
configFlags := genericclioptions.NewConfigFlags(true)
configFlags.Namespace = commonutil.String(namespace)
kubeClient := kube.New(configFlags)
cfg := &action.Configuration{
KubeClient: kubeClient,
Log: func(s string, i ...interface{}) {
lo... | [
0.4144217073917389,
-0.12114977091550827,
0.7384803295135498,
0.3931460976600647,
-0.5167722702026367,
0.0073387352749705315,
-0.402315229177475,
-0.6012580394744873,
-0.026028906926512718,
0.5505304932594299,
0.313260942697525,
0.89698725938797,
-0.04471718147397041,
0.7684792876243591,
... |
func (h *Helm) Load(chart, version string) (string, error) {
return h.locateChart(chart, version)
} | [
-0.0725020095705986,
-0.9793058037757874,
0.44793736934661865,
-0.2966868281364441,
-0.760956883430481,
0.1451594978570938,
-0.4470880329608917,
-1.0780277252197266,
-0.02424481511116028,
0.7005714178085327,
-1.015075445175171,
0.3521818220615387,
-0.17734286189079285,
-1.2172143459320068,... |
func (c *ChartPathOptions) LocateChart(name, dest string, settings *cli.EnvSettings) (string, error) {
name = strings.TrimSpace(name)
version := strings.TrimSpace(c.Version)
if _, err := os.Stat(name); err == nil {
abs, err := filepath.Abs(name)
if err != nil {
return abs, err
}
if c.Verify {
if _, er... | [
0.26285287737846375,
-0.17114496231079102,
0.996880292892456,
-0.30527248978614807,
-0.2732524871826172,
0.2837393879890442,
0.5889508128166199,
-1.1549558639526367,
0.10926323384046555,
0.1987486034631729,
-0.07882621139287949,
-0.087160125374794,
0.30090877413749695,
-0.38867393136024475... |
func checkIfInstallable(ch *chart.Chart) error {
switch ch.Metadata.Type {
case "", "application":
return nil
}
return errors.Errorf("%s charts are not installable", ch.Metadata.Type)
} | [
0.7312280535697937,
0.11163366585969925,
0.3208989202976227,
0.700575590133667,
0.5068821907043457,
0.1412205845117569,
0.19847197830677032,
-1.0139074325561523,
-0.4319753050804138,
1.3219162225723267,
0.524266242980957,
0.24305929243564606,
-0.3671815097332001,
0.38040101528167725,
0.0... |
func (*ResponseListUnacceptedAgreements) Descriptor() ([]byte, []int) {
return file_response_list_unaccepted_agreements_proto_rawDescGZIP(), []int{0}
} | [
-0.36685454845428467,
0.7534103393554688,
0.21578608453273773,
-0.16803190112113953,
-1.055112361907959,
-0.27632957696914673,
1.1580150127410889,
-0.3903193771839142,
0.24614223837852478,
-0.4919707477092743,
-0.585462749004364,
-0.4467618763446808,
-0.35055190324783325,
0.546372890472412... |
func Parse(urlText string) (Vault, error) {
result, ok := factory.Load(urlText)
if ok {
return result.(Vault), nil
}
u, err := url.Parse(urlText)
if err != nil {
return nil, err
}
if u.Scheme == "" {
return nil, fmt.Errorf("url scheme is empty in secret.Parse(%q)", urlText)
}
switch u.Scheme {
case "e... | [
0.22254802286624908,
0.0816904753446579,
0.45400723814964294,
0.1904054880142212,
-0.5798234343528748,
-0.16581472754478455,
-0.4409627914428711,
-0.06753754615783691,
0.41686421632766724,
-0.6653643250465393,
-0.2757713794708252,
-0.00023786623205523938,
-0.4878520965576172,
0.16611336171... |
func (v nullVault) EncryptText(text string) (string, error) {
return text, nil
} | [
0.3351740539073944,
-0.2613673806190491,
0.1527540236711502,
0.2290937304496765,
-0.5715343952178955,
-0.07215452939271927,
-0.6591935157775879,
-1.310426115989685,
0.9903017282485962,
0.44960641860961914,
-0.7606594562530518,
-0.07237053662538528,
-0.9840981960296631,
-0.04778419807553291... |
func (v nullVault) DecryptText(text string) (string, error) {
return text, nil
} | [
0.46068698167800903,
-0.3606666624546051,
0.2781466245651245,
0.9086544513702393,
-0.542392373085022,
-0.6588788032531738,
-0.20770438015460968,
-0.39339080452919006,
1.079779028892517,
0.22540141642093658,
-0.38959237933158875,
-0.5418469309806824,
-1.298521637916565,
0.0941074788570404,
... |
func (v nullVault) String() string {
return "plain://text"
} | [
0.8193585276603699,
-1.276628851890564,
0.17179350554943085,
-0.036403290927410126,
-0.8087071776390076,
0.8704565763473511,
0.24827289581298828,
-1.386614203453064,
0.6247771382331848,
-0.20422619581222534,
-0.5097047090530396,
0.08944405615329742,
-0.30149945616722107,
-0.083153903484344... |
func (v envVault) EncryptText(text string) (string, error) {
return EncryptText(text, v.passPhrase)
} | [
-0.21748602390289307,
0.08233420550823212,
0.14074945449829102,
0.29428818821907043,
-0.33599111437797546,
0.7852732539176941,
-0.8776435852050781,
-0.740878164768219,
0.13457587361335754,
1.2635624408721924,
-0.8336028456687927,
-0.517071545124054,
-0.6333910822868347,
-0.1897732466459274... |
func (v envVault) DecryptText(text string) (string, error) {
return DecryptText(text, v.passPhrase)
} | [
-0.005589893087744713,
-0.04376605153083801,
0.3513675034046173,
0.9206975698471069,
-0.12690363824367523,
0.1950763314962387,
-0.5803377032279968,
-0.07013924419879913,
0.24691618978977203,
1.2175580263137817,
-0.35121843218803406,
-0.7092223763465881,
-0.8462132215499878,
-0.031161850318... |
func (v envVault) String() string {
return fmt.Sprintf("env://%s", v.envVarName)
} | [
0.18088331818580627,
-1.3982466459274292,
0.20855486392974854,
0.017922626808285713,
0.1326066255569458,
1.3668733835220337,
0.34163346886634827,
-1.0707461833953857,
-0.8829120993614197,
0.5593020915985107,
0.06329187005758286,
0.8274872899055481,
0.4139559864997864,
0.10246803611516953,
... |
func (v passPhraseVault) EncryptText(text string) (string, error) {
return EncryptText(text, v.passPhrase)
} | [
-0.12315023690462112,
0.1644422709941864,
0.08315125107765198,
0.2193460613489151,
-0.36592528223991394,
0.6637105941772461,
-0.8092842698097229,
-0.515415608882904,
0.7665274143218994,
0.8937246203422546,
-0.8559625744819641,
-0.6829733848571777,
-0.932277262210846,
-0.42835190892219543,
... |
func (v passPhraseVault) DecryptText(text string) (string, error) {
return DecryptText(text, v.passPhrase)
} | [
0.0801888108253479,
0.09916723519563675,
0.2513372600078583,
0.8404244780540466,
-0.2864309847354889,
0.05263828858733177,
-0.5616959929466248,
0.17345739901065826,
0.8660398721694946,
0.7684507369995117,
-0.40551620721817017,
-1.063046932220459,
-1.0819225311279297,
-0.3038126230239868,
... |
func (v passPhraseVault) String() string {
return fmt.Sprintf("passwd://%s", v.passPhrase)
} | [
0.3895769715309143,
-1.11530601978302,
0.06636930257081985,
-0.4539131224155426,
-0.1614089161157608,
1.6194988489151,
0.18429610133171082,
-0.32242101430892944,
0.18319305777549744,
0.514180600643158,
0.41352638602256775,
0.11634840071201324,
-0.2759287357330322,
-0.9388403296470642,
-0... |
func GetChanHistory(tdlibClient *client.Client, chatID int64, fromMessageID int64, toMessageID int64) (messages []*client.Message) {
var totalMessages int
messagesSet := make(map[int]*client.Message)
totalLimit := 99999999999
// Read first message (newest) separetely, because messageReading does not return exactl... | [
-0.03837279975414276,
0.024935143068432808,
0.9012709856033325,
-0.7894752621650696,
-0.35087719559669495,
-0.26985111832618713,
0.49716800451278687,
-1.0417290925979614,
-0.12468589842319489,
0.12391102313995361,
0.598845899105072,
1.2005624771118164,
-0.2956293523311615,
0.90801662206649... |
func NewBackend(ctx context.Context, configPath string, logger dex.Logger, network dex.Network) (*DCRBackend, error) {
// loadConfig will set fields if defaults are used and set the chainParams
// package variable.
cfg, err := loadConfig(configPath, network)
if err != nil {
return nil, err
}
dcr := unconnectedD... | [
0.48189234733581543,
0.15587352216243744,
0.819596529006958,
0.016580995172262192,
0.2948274314403534,
-0.379734605550766,
-0.2720373868942261,
-0.17644184827804565,
-0.0010814107954502106,
0.3307966887950897,
-0.19556140899658203,
0.3227774202823639,
-0.8377161622047424,
0.881179213523864... |
func (btc *DCRBackend) InitTxSize() uint32 {
return dexdcr.InitTxSize
} | [
0.4597029685974121,
1.0357717275619507,
0.5073976516723633,
-0.4329690933227539,
-0.15175773203372955,
-0.4995317757129669,
-0.23897573351860046,
0.19770869612693787,
0.08507730066776276,
-0.35933297872543335,
-1.4117608070373535,
0.37533068656921387,
-1.2837073802947998,
0.422128349542617... |
func (dcr *DCRBackend) BlockChannel(size int) chan uint32 {
c := make(chan uint32, size)
dcr.signalMtx.Lock()
defer dcr.signalMtx.Unlock()
dcr.blockChans = append(dcr.blockChans, c)
return c
} | [
-0.16299401223659515,
0.6641685366630554,
0.6348850131034851,
-0.5316770076751709,
-0.062406159937381744,
0.445963054895401,
0.3358718156814575,
-1.5666991472244263,
0.5203023552894592,
-0.6277148127555847,
-0.4919915795326233,
0.19430625438690186,
-1.0006245374679565,
0.4267595410346985,
... |
func (dcr *DCRBackend) Coin(coinID []byte, redeemScript []byte) (asset.Coin, error) {
txHash, vout, err := decodeCoinID(coinID)
if err != nil {
return nil, fmt.Errorf("error decoding coin ID %x: %v", coinID, err)
}
return dcr.utxo(txHash, vout, redeemScript)
} | [
-0.42118972539901733,
0.17457982897758484,
0.3334605097770691,
-0.11454825103282928,
-0.25974997878074646,
-0.545072078704834,
-0.5709226727485657,
-0.05300673097372055,
-0.19749696552753448,
0.1222744882106781,
0.23516720533370972,
0.9295029640197754,
-0.47488123178482056,
0.1771089285612... |
func (dcr *DCRBackend) CheckAddress(addr string) bool {
_, err := dcrutil.DecodeAddress(addr, chainParams)
return err == nil
} | [
-0.3904653787612915,
-0.5276865363121033,
0.5341511964797974,
0.2113005667924881,
0.5505576133728027,
-0.12647920846939087,
-0.29349473118782043,
0.7208251357078552,
0.6577528715133667,
0.1217038631439209,
-0.30072644352912903,
0.6643563508987427,
-0.9242998361587524,
0.9183269739151001,
... |
func (dcr *DCRBackend) UnspentDetails(txid string, vout uint32) (string, uint64, int64, error) {
txHash, err := chainhash.NewHashFromStr(txid)
if err != nil {
return "", 0, -1, fmt.Errorf("error decoding tx ID %s: %v", txid, err)
}
txOut, pkScript, err := dcr.getUnspentTxOut(txHash, vout)
if err != nil {
retur... | [
0.22080518305301666,
0.11313395947217941,
0.776833713054657,
-1.0182660818099976,
-0.3939746022224426,
-0.18972696363925934,
-0.08000826835632324,
-0.13116338849067688,
-0.5724385380744934,
0.19419953227043152,
-0.43191564083099365,
-0.019362466409802437,
0.2662838399410248,
0.476354807615... |
func (dcr *DCRBackend) transaction(txHash *chainhash.Hash, verboseTx *chainjson.TxRawResult) (*Tx, error) {
// Figure out if it's a stake transaction
msgTx, err := msgTxFromHex(verboseTx.Hex)
if err != nil {
return nil, fmt.Errorf("failed to decode MsgTx from hex for transaction %s: %v", txHash, err)
}
isStake :... | [
-0.18500900268554688,
0.3217848539352417,
0.7575792074203491,
0.13185720145702362,
0.2512210011482239,
-1.3407607078552246,
-0.14938920736312866,
-0.5699868202209473,
0.15979066491127014,
0.5376983284950256,
-0.05556051433086395,
-0.5762914419174194,
-0.38172197341918945,
0.067295208573341... |
func (dcr *DCRBackend) shutdown() {
if dcr.client != nil {
dcr.client.Shutdown()
dcr.client.WaitForShutdown()
}
} | [
0.16292177140712738,
0.4209105372428894,
0.38027307391166687,
-0.033621545881032944,
0.6840915679931641,
0.39993706345558167,
0.22746257483959198,
0.15172624588012695,
0.2254248559474945,
-0.573635458946228,
-0.12230236083269119,
0.11735314130783081,
-1.2215776443481445,
1.1977835893630981... |
func unconnectedDCR(ctx context.Context, logger dex.Logger) *DCRBackend {
dcr := &DCRBackend{
ctx: ctx,
blockChans: make([]chan uint32, 0),
blockCache: newBlockCache(logger),
anyQ: make(chan interface{}, 128), // way bigger than needed.
log: logger,
}
go dcr.superQueue()
return dcr
} | [
0.02532218210399151,
-0.045915983617305756,
0.49693676829338074,
-0.7913387417793274,
-0.07988081872463226,
-0.15480804443359375,
-0.42868977785110474,
-0.4102703928947449,
0.7305939793586731,
-1.1095582246780396,
-0.11830505728721619,
-0.05056903138756752,
0.029098857194185257,
1.36532652... |
func (dcr *DCRBackend) superQueue() {
out:
for {
select {
case rawMsg := <-dcr.anyQ:
switch msg := rawMsg.(type) {
case *chainhash.Hash:
// This is a new block notification.
blockHash := msg
dcr.log.Debugf("superQueue: Processing new block %s", blockHash)
blockVerbose, err := dcr.node.GetBloc... | [
0.6273099780082703,
0.12580566108226776,
0.7360323667526245,
0.5143802762031555,
0.48895061016082764,
-0.9492877721786499,
-0.15494835376739502,
-0.5131266117095947,
-0.334423303604126,
0.2885598838329315,
-0.2912278473377228,
0.33064788579940796,
-0.7099009156227112,
1.3104125261306763,
... |
func (dcr *DCRBackend) onBlockConnected(serializedHeader []byte, _ [][]byte) {
blockHeader := new(wire.BlockHeader)
err := blockHeader.FromBytes(serializedHeader)
if err != nil {
dcr.log.Errorf("error decoding serialized header: %v", err)
return
}
h := blockHeader.BlockHash()
dcr.anyQ <- &h
} | [
0.6647037863731384,
-0.7480923533439636,
0.8208804726600647,
0.18242095410823822,
-0.36104997992515564,
-0.9588639736175537,
-1.0513672828674316,
-0.7120777368545532,
-0.40841519832611084,
0.3950500190258026,
-0.7220809459686279,
-0.03242706134915352,
-0.3744577169418335,
0.218181535601615... |
func (dcr *DCRBackend) utxo(txHash *chainhash.Hash, vout uint32, redeemScript []byte) (*UTXO, error) {
txOut, verboseTx, pkScript, err := dcr.getTxOutInfo(txHash, vout)
if err != nil {
return nil, err
}
inputNfo, err := dexdcr.InputInfo(pkScript, redeemScript, chainParams)
if err != nil {
return nil, err
}
... | [
0.3936621844768524,
0.4150702953338623,
0.9796038866043091,
-0.1436660885810852,
-0.7201446294784546,
-0.9865131378173828,
-0.08769762516021729,
-0.24425636231899261,
-0.410875529050827,
0.9225606918334961,
0.2807852029800415,
0.06308464705944061,
0.21597802639007568,
-0.3609062731266022,
... |
func msgTxFromHex(txhex string) (*wire.MsgTx, error) {
msgTx := wire.NewMsgTx()
if err := msgTx.Deserialize(hex.NewDecoder(strings.NewReader(txhex))); err != nil {
return nil, err
}
return msgTx, nil
} | [
0.49895966053009033,
0.0159459188580513,
0.36987432837486267,
-0.6892485618591309,
-1.0807570219039917,
0.5830206274986267,
-1.2162959575653076,
-0.4541095495223999,
-0.4374302327632904,
-0.35974130034446716,
-0.4216762185096741,
-0.3430926203727722,
-0.3646487593650818,
0.5215521454811096... |
func (dcr *DCRBackend) getUnspentTxOut(txHash *chainhash.Hash, vout uint32) (*chainjson.GetTxOutResult, []byte, error) {
txOut, err := dcr.node.GetTxOut(txHash, vout, true)
if err != nil {
return nil, nil, fmt.Errorf("GetTxOut error for output %s:%d: %v", txHash, vout, err)
}
if txOut == nil {
return nil, nil, ... | [
0.6122884154319763,
-0.4846096634864807,
0.6189572215080261,
-1.0642355680465698,
-1.046451210975647,
-0.7251279950141907,
-0.5385553240776062,
0.24999937415122986,
-0.7670161128044128,
0.5160242319107056,
-0.4546932280063629,
0.2961398959159851,
-0.10009641945362091,
0.6896923184394836,
... |
func (dcr *DCRBackend) getTxOutInfo(txHash *chainhash.Hash, vout uint32) (*chainjson.GetTxOutResult, *chainjson.TxRawResult, []byte, error) {
txOut, pkScript, err := dcr.getUnspentTxOut(txHash, vout)
if err != nil {
return nil, nil, nil, err
}
verboseTx, err := dcr.node.GetRawTransactionVerbose(txHash)
if err !=... | [
0.4744798243045807,
0.07560844719409943,
0.6028730273246765,
-0.9198241829872131,
-0.670728325843811,
-1.1381638050079346,
-0.792815625667572,
-0.06063731387257576,
-0.7556440234184265,
0.5416678786277771,
-0.33693209290504456,
-0.16398097574710846,
0.07616589218378067,
0.7640281319618225,... |
func (dcr *DCRBackend) getBlockInfo(blockid string) (*dcrBlock, error) {
blockHash, err := chainhash.NewHashFromStr(blockid)
if err != nil {
return nil, fmt.Errorf("unable to decode block hash from %s", blockid)
}
return dcr.getDcrBlock(blockHash)
} | [
0.3652251362800598,
0.4739227592945099,
0.4004442095756531,
0.31539201736450195,
0.14288273453712463,
-1.0011992454528809,
-0.7242239117622375,
-1.0325055122375488,
-0.029653245583176613,
-0.48026326298713684,
-0.8461513519287109,
0.28428950905799866,
-0.6732683181762695,
0.689682483673095... |
func (dcr *DCRBackend) getDcrBlock(blockHash *chainhash.Hash) (*dcrBlock, error) {
cachedBlock, found := dcr.blockCache.block(blockHash)
if found {
return cachedBlock, nil
}
blockVerbose, err := dcr.node.GetBlockVerbose(blockHash, false)
if err != nil {
return nil, fmt.Errorf("error retrieving block %s: %v", b... | [
0.7195009589195251,
1.1106451749801636,
0.8484838008880615,
0.48731812834739685,
0.6245627999305725,
-0.3658941388130188,
-0.7041026949882507,
-0.8659415245056152,
0.3564318120479584,
-0.44609755277633667,
0.37411969900131226,
0.8921013474464417,
-0.8832589387893677,
1.4004931449890137,
... |
func (dcr *DCRBackend) getMainchainDcrBlock(height uint32) (*dcrBlock, error) {
cachedBlock, found := dcr.blockCache.atHeight(height)
if found {
return cachedBlock, nil
}
hash, err := dcr.node.GetBlockHash(int64(height))
if err != nil {
// Likely not mined yet. Not an error.
return nil, nil
}
return dcr.ge... | [
0.4356391727924347,
-0.2961815893650055,
0.8490438461303711,
0.2919204831123352,
-0.5569336414337158,
-0.28976356983184814,
-0.39329370856285095,
-0.9419218897819519,
-0.10760360956192017,
-0.6919785141944885,
0.5934932827949524,
0.4040791392326355,
-0.776168942451477,
1.0055073499679565,
... |
func connectNodeRPC(host, user, pass, cert string,
notifications *rpcclient.NotificationHandlers) (*rpcclient.Client, error) {
dcrdCerts, err := ioutil.ReadFile(cert)
if err != nil {
return nil, fmt.Errorf("TLS certificate read error: %v", err)
}
config := &rpcclient.ConnConfig{
Host: host,
Endpoin... | [
0.29445719718933105,
-0.42791518568992615,
0.6168094873428345,
-0.8362955451011658,
-0.50089031457901,
0.2552207410335541,
0.29340505599975586,
-1.1833325624465942,
-0.4089597761631012,
0.36092451214790344,
0.315304696559906,
0.34391891956329346,
-0.9454290866851807,
0.1826745718717575,
... |
func decodeCoinID(coinID []byte) (*chainhash.Hash, uint32, error) {
if len(coinID) != 36 {
return nil, 0, fmt.Errorf("coin ID wrong length. expected 36, got %d", len(coinID))
}
var txHash chainhash.Hash
copy(txHash[:], coinID[:32])
return &txHash, binary.BigEndian.Uint32(coinID[32:]), nil
} | [
0.1931125819683075,
-0.18017181754112244,
0.2711637616157532,
-0.5549556016921997,
-0.3435111939907074,
0.030323831364512444,
-0.6012965440750122,
-0.5802125334739685,
0.05641544610261917,
0.1776619702577591,
-1.196496844291687,
0.33258312940597534,
-1.2358506917953491,
-0.5607326626777649... |
func toCoinID(txHash *chainhash.Hash, vout uint32) []byte {
hashLen := len(txHash)
b := make([]byte, hashLen+4)
copy(b[:hashLen], txHash[:])
binary.BigEndian.PutUint32(b[hashLen:], vout)
return b
} | [
0.7094610333442688,
0.28572607040405273,
0.5035126209259033,
-1.117732286453247,
-0.0022779363207519054,
0.11799944937229156,
-0.794791579246521,
-0.6472575664520264,
-0.020250491797924042,
1.0316619873046875,
-0.5891234874725342,
0.9297211170196533,
-1.0870270729064941,
-0.103238716721534... |
func toAtoms(v float64) uint64 {
return uint64(math.Round(v * 1e8))
} | [
-0.10166173428297043,
0.11692608147859573,
0.49963659048080444,
-0.7572246193885803,
-0.4092757999897003,
-0.4226447641849518,
0.526038408279419,
-0.5247452855110168,
0.40956851840019226,
-0.17595629394054413,
-0.07207302749156952,
-0.12068770825862885,
0.10040219128131866,
-0.089662566781... |
func NewHuffmanEncoder(inp io.ReadSeeker, wc io.Writer) *HuffmanEncoder {
he := new(HuffmanEncoder)
freq := make(map[byte]int)
var b [1]byte
// using the reader, count the frequency of bytes
for {
_, err := inp.Read(b[:])
if err != nil {
if err == io.EOF {
break
}
panic(err)
}
_, ok := freq[... | [
-0.15299656987190247,
-0.7650941014289856,
0.45132753252983093,
0.22976844012737274,
-0.7119882106781006,
-0.5317793488502502,
0.49213945865631104,
0.5977757573127747,
-0.07800032198429108,
-0.3643844723701477,
0.22073067724704742,
-0.08491162210702896,
-0.3770611882209778,
1.3128187656402... |
func NewHuffmanEncoderWithDict(wc io.Writer, dict []byte) *HuffmanEncoder {
he := new(HuffmanEncoder)
pQ := make(PriorityQueue, len(dict))
MaxPri := len(dict)
for i, v := range dict {
pQ[i] = NewHNode(v, MaxPri - i) // prioritize in order of dict
}
heap.Init(&pQ)
for pQ.Len() > 1 {
zero := pQ.Pop()
l :=... | [
-0.13103152811527252,
-0.5050280690193176,
0.4950672388076782,
-0.029180774465203285,
-1.2397496700286865,
-0.08144630491733551,
-0.5791407227516174,
0.19800709187984467,
0.1103222519159317,
0.002066300716251135,
0.037380367517471313,
-0.7593082189559937,
-0.2016812115907669,
1.43999469280... |
func (enc *HuffmanEncoder) WriteHeader() error {
// for iterative tree walking use savedict
// for recursive, use rsavedict
// if err := savedict(enc.bw, enc.root); err != nil {
if err := rsavedict(enc.bw, enc.root); err != nil { // recursive version
return err
}
return enc.bw.WriteBit(bs.Zero) // end of dict... | [
-1.1251425743103027,
-0.8377037048339844,
0.7657482624053955,
0.27291837334632874,
0.26126188039779663,
0.11565487086772919,
0.9269622564315796,
0.3127041757106781,
-0.4819908142089844,
-0.03544536605477333,
-0.2893173098564148,
-0.06513099372386932,
-0.911314070224762,
1.4205559492111206,... |
func (enc *HuffmanEncoder) Write(p []byte) (n int, err error) {
for _, v := range p {
code, ok := enc.dict[v]
if !ok {
panic(errors.New("non-existant uncompressed code " + string(v)))
}
err = enc.bw.WriteBits(code.hcode, code.nbits)
if err != nil {
return 0, err
}
}
return len(p), nil
} | [
-1.4351030588150024,
0.8362174034118652,
0.6484078764915466,
0.5437501072883606,
0.8112169504165649,
-0.3174651861190796,
0.35616445541381836,
0.6317883729934692,
-0.5336059331893921,
0.8977976441383362,
-1.0604732036590576,
-0.5592148900032043,
-1.2994259595870972,
1.2074353694915771,
0... |
func (enc *HuffmanEncoder) Flush() error {
return enc.bw.Flush(bs.Zero)
} | [
0.5773171186447144,
0.11457749456167221,
0.14476466178894043,
0.2632894217967987,
0.921393096446991,
0.1551421880722046,
0.6567879915237427,
-0.6473712921142578,
-0.302629292011261,
-0.9339669346809387,
0.052190519869327545,
1.6646963357925415,
-0.8025022149085999,
1.850296974182129,
0.1... |
func (enc *HuffmanEncoder) ShowHuffTree() {
traverse(enc.root, "")
} | [
0.7503893971443176,
-0.03005172125995159,
0.1857304722070694,
-0.5295526385307312,
-0.3843550682067871,
-0.209267720580101,
0.6997623443603516,
0.1362179070711136,
0.1281534880399704,
-0.028968708589673042,
-0.030393781140446663,
1.1472874879837036,
-0.04902521148324013,
2.3419079780578613... |
func GenerateRequestToken(proxy, uid, checkid int) (string, error) {
claims := struct {
Proxy int `json:"proxy"`
ID int `json:"id"`
CheckID int `json:"checkid"`
jwt.StandardClaims
}{
proxy,
uid,
checkid,
jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * 10).Unix(),
Issuer: "S... | [
-1.2646980285644531,
0.013615608215332031,
0.8036823272705078,
-0.276311457157135,
-0.4015211760997772,
0.6570566296577454,
-0.6443991661071777,
0.17269164323806763,
0.17173060774803162,
-0.34312015771865845,
-0.7024243474006653,
0.6940717697143555,
-0.4302077293395996,
-0.2553282380104065... |
func DecodeRequestToken(ptoken string) (int, int, int, error) { // TODO: Return Values to Struct!
token, err := jwt.Parse(ptoken, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"])
}
... | [
-0.8718525171279907,
-0.4560054540634155,
0.8508798480033875,
-0.4575016498565674,
-0.3461173474788666,
-0.30505800247192383,
-0.5339294075965881,
-0.09906559437513351,
-0.785186231136322,
-0.5502829551696777,
-0.6289016008377075,
0.0047734822146594524,
-0.47300124168395996,
-0.03948006778... |
func (i *itemsService) GetItem(itemID string)(*domain.Item, *utils.ApplicationError){
return nil, &utils.ApplicationError {
Message: "not implemented",
StatusCode: http.StatusBadRequest,
Code: "bad_request",
}
} | [
-0.4235910177230835,
0.21502874791622162,
0.24343077838420868,
0.6939242482185364,
0.755286693572998,
0.4474807381629944,
0.24272161722183228,
-0.4422415792942047,
0.49490267038345337,
-0.1843397170305252,
0.4550478160381317,
1.2276344299316406,
0.14547061920166016,
-0.30971312522888184,
... |
func (driver) LoadOffset(
ctx context.Context,
db *sql.DB,
ak, sk string,
) (uint64, error) {
row := db.QueryRowContext(
ctx,
`SELECT
next_offset
FROM stream_offset
WHERE app_key = ?
AND source_app_key = ?`,
ak,
sk,
)
var o uint64
err := row.Scan(&o)
if err == sql.ErrNoRows {
err = nil
}
... | [
-0.33168065547943115,
0.6958428025245667,
0.5305478572845459,
-0.16926886141300201,
-1.7075775861740112,
-0.842218816280365,
-0.30000874400138855,
-0.5291545391082764,
0.2170865535736084,
0.745763897895813,
0.40583258867263794,
0.32780909538269043,
-0.6705618500709534,
0.44045490026474,
... |
func (driver) InsertOffset(
ctx context.Context,
tx *sql.Tx,
ak, sk string,
n uint64,
) (_ bool, err error) {
defer sqlx.Recover(&err)
return sqlx.TryExecRow(
ctx,
tx,
`INSERT INTO stream_offset SET
app_key = ?,
source_app_key = ?,
next_offset = ?
ON DUPLICATE KEY UPDATE
app_key = app_key`, /... | [
-0.7409115433692932,
0.8998863101005554,
0.6410408020019531,
-0.22833897173404694,
-0.5093156099319458,
0.6413861513137817,
0.1648513823747635,
-0.4954391121864319,
-0.28549179434776306,
0.6158643960952759,
-0.4130460321903229,
-0.5308129787445068,
-1.1657224893569946,
0.29109299182891846,... |
func (driver) UpdateOffset(
ctx context.Context,
tx *sql.Tx,
ak, sk string,
c, n uint64,
) (_ bool, err error) {
defer sqlx.Recover(&err)
return sqlx.TryExecRow(
ctx,
tx,
`UPDATE stream_offset SET
next_offset = ?
WHERE app_key = ?
AND source_app_key = ?
AND next_offset = ?`,
n,
ak,
sk,
c,
... | [
-0.6260765194892883,
0.04277398809790611,
0.6033627986907959,
-0.13886399567127228,
-1.5116726160049438,
0.2229066640138626,
-0.09248683601617813,
-0.764885663986206,
-0.39891400933265686,
1.0000433921813965,
0.06466575711965561,
0.3599749803543091,
-0.5186788439750671,
0.13316769897937775... |
func createOffsetSchema(ctx context.Context, db *sql.DB) {
sqlx.Exec(
ctx,
db,
`CREATE TABLE IF NOT EXISTS stream_offset (
app_key VARBINARY(255) NOT NULL,
source_app_key VARBINARY(255) NOT NULL,
next_offset BIGINT NOT NULL,
PRIMARY KEY (app_key, source_app_key)
) ENGINE=InnoDB`,
)
} | [
0.46023181080818176,
0.03077910840511322,
0.549277126789093,
0.13713450729846954,
-0.2060551941394806,
0.758245587348938,
0.26192352175712585,
0.13952310383319855,
-0.10722537338733673,
0.42879003286361694,
0.03516949713230133,
-0.1593688279390335,
-0.15699853003025055,
0.6561300158500671,... |
func dropOffsetSchema(ctx context.Context, db *sql.DB) {
sqlx.Exec(ctx, db, `DROP TABLE IF EXISTS stream_offset`)
} | [
0.11078915745019913,
-0.41321319341659546,
0.5236368179321289,
-0.10532213002443314,
-0.16695694625377655,
1.3056954145431519,
0.3384196162223816,
-0.08786501735448837,
-0.21900078654289246,
0.4846038222312927,
0.35970795154571533,
0.12516027688980103,
-0.1683097928762436,
0.28134962916374... |
func (*SumSaleValuesRequest) Descriptor() ([]byte, []int) {
return file_sale_proto_rawDescGZIP(), []int{0}
} | [
-0.977837085723877,
0.8132826685905457,
0.5073784589767456,
0.3115842044353485,
0.3185977041721344,
-0.39200013875961304,
0.20789076387882233,
0.2409178465604782,
0.10930145531892776,
-0.8830986022949219,
-0.47530609369277954,
-0.36020970344543457,
0.5713143944740295,
1.3132014274597168,
... |
func (*SumSaleValuesResponse) Descriptor() ([]byte, []int) {
return file_sale_proto_rawDescGZIP(), []int{1}
} | [
-0.1117924153804779,
0.38002797961235046,
0.05990315228700638,
0.18772472441196442,
0.3849036395549774,
-0.7569485306739807,
0.9322646856307983,
0.5382497310638428,
0.48605579137802124,
-0.5125067234039307,
-1.2607841491699219,
-1.1586343050003052,
-0.08820579200983047,
0.3774932026863098,... |
func RandInt(min int, max int) int {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
return r.Intn(max-min) + min
} | [
-0.04708539694547653,
0.0259888656437397,
0.3771000802516937,
-0.9596810340881348,
-0.35711315274238586,
0.7435758113861084,
-1.4234375953674316,
-0.6684401631355286,
-0.9034292697906494,
-0.15776950120925903,
-0.5012160539627075,
0.22077588737010956,
-0.1014721617102623,
-0.46846491098403... |
func (c *PushServiceClient) Send(subscription *pb.PushSubscription, request *pb.WebpushRequest) (*WebpushResponse, error) {
content, err := c.encrypt(subscription, request)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", subscription.Endpoint, bytes.NewReader(content))
if err != nil {
re... | [
-0.20810197293758392,
0.642440140247345,
0.7423450350761414,
0.431537389755249,
-0.3974055349826813,
-0.2619578540325165,
-1.162333607673645,
-1.1529252529144287,
-0.2854374945163727,
0.6924176812171936,
-0.5045598149299622,
1.0223278999328613,
-0.6131017804145813,
-0.06447022408246994,
... |
func endApp() {
fmt.Println("end app")
} | [
1.3100807666778564,
-0.7825689911842346,
0.48253822326660156,
0.5735198855400085,
-0.22052639722824097,
1.82160222530365,
0.007660362403839827,
0.4224073588848114,
-0.43841809034347534,
0.807010293006897,
0.3505895435810089,
1.0108287334442139,
-0.868011474609375,
0.4879462718963623,
-0.... |
func (action ReportAction) GetNon2StepVerifiedUsers() error {
report, err := action.report.Get2StepVerifiedStatusReport()
if err != nil {
return err
}
if len(report.UsageReports) == 0 {
return errors.New("No Report Available")
}
var paramIndex int
fmt.Println("Latest Report: " + report.UsageReports[0].Date... | [
0.13714085519313812,
-0.5291793942451477,
0.48143473267555237,
0.8157785534858704,
0.382572203874588,
0.1255413442850113,
0.24310219287872314,
0.2504211664199829,
-0.6160590052604675,
-0.04021733999252319,
0.1000349149107933,
1.8306177854537964,
-0.6521142721176147,
1.3259859085083008,
-... |
func (action ReportAction) GetIllegalLoginUsersAndIp(activities []*admin.Activity, officeIPs []string) error {
data := make(map[string]*LoginInformation)
for _, activity := range activities {
email := activity.Actor.Email
ip := activity.IpAddress
if value, ok := data[email]; ok {
if !value.OfficeLogin {
... | [
-0.5808064937591553,
-1.2381796836853027,
0.5346783995628357,
0.3620315194129944,
-0.14883610606193542,
0.052731119096279144,
0.26360413432121277,
0.6131567358970642,
1.0266629457473755,
0.6124016642570496,
0.5705317854881287,
0.38697364926338196,
0.0787709429860115,
-0.26032453775405884,
... |
func ConvertManifest(ctx context.Context, store content.Store, desc ocispec.Descriptor) (ocispec.Descriptor, error) {
if !(desc.MediaType == images.MediaTypeDockerSchema2Manifest ||
desc.MediaType == ocispec.MediaTypeImageManifest) {
log.G(ctx).Warnf("do nothing for media type: %s", desc.MediaType)
return desc,... | [
-0.18861408531665802,
-0.6861653923988342,
0.6678884625434875,
-1.0519344806671143,
-0.2202657163143158,
-0.158216193318367,
-0.7360859513282776,
-0.426900714635849,
0.2960783839225769,
0.7865427732467651,
0.243637353181839,
0.7307605147361755,
0.047775570303201675,
0.35678425431251526,
... |
func NewCloudManager(dataStore *store.DataStore) (CloudManager, error) {
if dataStore == nil {
return nil, fmt.Errorf("Fail to new cloud manager as data store is nil.")
}
return &cloudManager{dataStore}, nil
} | [
0.003443129826337099,
-0.023206261917948723,
0.32980582118034363,
-0.6582793593406677,
-1.1488170623779297,
-0.42644065618515015,
-1.1918766498565674,
-0.16055992245674133,
0.4286821186542511,
-0.5108469724655151,
-0.6034106016159058,
0.2280743420124054,
-0.06577719002962112,
1.83956813812... |
func (m *cloudManager) CreateCloud(c *api.Cloud) (*api.Cloud, error) {
cloudName := c.Name
if _, err := m.ds.FindCloudByName(cloudName); err == nil {
return nil, httperror.ErrorAlreadyExist.Format(cloudName)
}
// check auth info
cp, err := cloud.NewCloudProvider(c)
if err != nil {
return nil, httperror.Erro... | [
-0.8500109314918518,
0.8855919241905212,
0.8226065039634705,
0.12175435572862625,
0.2531852424144745,
0.7799884080886841,
0.12097775936126709,
-0.5221421718597412,
0.35699477791786194,
0.27461349964141846,
0.017457768321037292,
-0.5980327725410461,
-0.9077497720718384,
0.3671731948852539,
... |
func (m *cloudManager) ListClouds() ([]api.Cloud, error) {
return m.ds.FindAllClouds()
} | [
-0.2948739528656006,
0.2510656714439392,
0.24754557013511658,
0.24818812310695648,
0.07923931628465652,
-0.33974823355674744,
-0.6167830228805542,
-1.4682767391204834,
0.06554558128118515,
-0.3658074736595154,
0.2320244014263153,
0.6236243844032288,
-0.40380793809890747,
1.1858948469161987... |
func (m *cloudManager) DeleteCloud(name string) error {
return m.ds.DeleteCloudByName(name)
} | [
-0.050616756081581116,
0.9912024140357971,
0.4425695240497589,
0.46530601382255554,
-0.7011997103691101,
-0.23630759119987488,
0.1733192801475525,
-0.1618686020374298,
0.28815561532974243,
-1.05849027633667,
-0.503944456577301,
0.18445399403572083,
-0.11572038382291794,
1.3452666997909546,... |
func (m *cloudManager) PingCloud(name string) error {
c, err := m.ds.FindCloudByName(name)
if err != nil {
return httperror.ErrorContentNotFound.Format(name)
}
cp, err := cloud.NewCloudProvider(c)
if err != nil {
return err
}
return cp.Ping()
} | [
-0.6880473494529724,
0.8865121006965637,
0.6240522265434265,
0.1607874482870102,
-0.017573771998286247,
-0.29536715149879456,
0.07413435727357864,
-0.19298043847084045,
0.0069281719624996185,
0.9264237880706787,
-0.21727068722248077,
-0.017933299764990807,
-0.8195018768310547,
0.7936784029... |
func (m *cloudManager) ListWorkers(name string, extendInfo string) ([]api.WorkerInstance, error) {
c, err := m.ds.FindCloudByName(name)
if err != nil {
return nil, httperror.ErrorContentNotFound.Format(name)
}
if c.Type == api.CloudTypeKubernetes && extendInfo == "" {
err := fmt.Errorf("query parameter namespa... | [
-1.0277438163757324,
0.3570743501186371,
0.6790199279785156,
-0.6003703474998474,
-0.02282075770199299,
0.04936737194657326,
-1.121366024017334,
-0.6865940690040588,
0.043033111840486526,
0.3307085335254669,
-0.5011794567108154,
0.43374955654144287,
-1.1136502027511597,
0.7220872044563293,... |
func NewSummary() *Summary {
return &Summary{}
} | [
0.5162906050682068,
-0.2609509229660034,
-0.17176665365695953,
0.8808284401893616,
-1.0857324600219727,
-0.8910534977912903,
-0.8893176913261414,
-0.6600524187088013,
-0.10577482730150223,
-0.24018876254558563,
-0.1503683626651764,
0.7857688665390015,
0.13560083508491516,
-0.02848820760846... |
func (s *Summary) InputEvents() map[string][]NodeEvent {
m := map[string][]NodeEvent{}
s.inputEvents.Range(func(key, value any) bool {
m[key.(string)] = value.(*events).Extract()
return true
})
return m
} | [
-0.35408815741539,
-0.3797936737537384,
0.4218749701976776,
-0.5372121334075928,
-1.1578401327133179,
-0.09264008700847626,
0.5094630122184753,
0.031381599605083466,
0.4226851463317871,
0.30479997396469116,
-0.3070969879627228,
0.10983968526124954,
-0.6636662483215332,
-0.19685950875282288... |
func (s *Summary) ProcessorEvents() map[string][]NodeEvent {
m := map[string][]NodeEvent{}
s.processorEvents.Range(func(key, value any) bool {
m[key.(string)] = value.(*events).Extract()
return true
})
return m
} | [
-0.8411991596221924,
0.11888773739337921,
0.45636749267578125,
-0.5854039192199707,
-0.8660262227058411,
-0.5667757391929626,
0.3828977346420288,
0.5924249291419983,
0.027504442259669304,
1.3229554891586304,
0.3230818212032318,
0.4483843147754669,
-0.4331149756908417,
-0.06546830385923386,... |
func (s *Summary) OutputEvents() map[string][]NodeEvent {
m := map[string][]NodeEvent{}
s.outputEvents.Range(func(key, value any) bool {
m[key.(string)] = value.(*events).Extract()
return true
})
return m
} | [
-0.7220326066017151,
-0.43658211827278137,
0.5684344172477722,
-0.28467854857444763,
-1.079898476600647,
-0.8846484422683716,
0.3792218863964081,
-0.17557740211486816,
-0.040559928864240646,
0.9667217135429382,
0.10601472109556198,
-0.0355055145919323,
-0.2719549536705017,
-0.2557215690612... |
func preConfigureUI() {
term := os.Getenv("TERM")
fmtc.DisableColors = true
if term != "" {
switch {
case strings.Contains(term, "xterm"),
strings.Contains(term, "color"),
term == "screen":
fmtc.DisableColors = false
}
}
if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" {
... | [
-0.3346536457538605,
0.36128613352775574,
0.8769823908805847,
0.012632778845727444,
-0.2069329470396042,
-0.0313543938100338,
0.38770052790641785,
-0.06256479769945145,
-0.11231961846351624,
-0.12159587442874908,
-0.14342185854911804,
0.22694888710975647,
0.26621633768081665,
0.98390406370... |
func configureUI() {
terminal.Prompt = "› "
terminal.TitleColorTag = "{s}"
if options.GetB(OPT_NO_COLOR) {
fmtc.DisableColors = true
}
switch {
case fmtc.IsTrueColorSupported():
colorTagApp, colorTagVer = "{#CC1E2C}", "{#CC1E2C}"
case fmtc.Is256ColorsSupported():
colorTagApp, colorTagVer = "{#160}", "{#1... | [
-0.7106272578239441,
0.25120407342910767,
0.7597445845603943,
0.10089471191167831,
0.2746926546096802,
-0.35152512788772583,
-0.009639818221330643,
0.0022680882830172777,
-0.06671178340911865,
-0.4458242654800415,
-0.5532757639884949,
-0.42823049426078796,
0.522596538066864,
0.665541470050... |
func checkArguments(url, dir string) {
if !httputil.IsURL(url) {
printErrorAndExit("Url %s doesn't look like valid url", url)
}
if !fsutil.IsExist(dir) {
printErrorAndExit("Directory %s does not exist", dir)
}
if !fsutil.IsDir(dir) {
printErrorAndExit("Target %s is not a directory", dir)
}
if !fsutil.Is... | [
-1.6112549304962158,
-0.10040725767612457,
0.6155227422714233,
-0.19523125886917114,
0.5278365612030029,
0.7944236397743225,
-0.1250428557395935,
0.4185013771057129,
-0.15435634553432465,
0.1554524004459381,
0.7049828171730042,
1.2196402549743652,
-0.34371644258499146,
0.6956639289855957,
... |
func cloneRepository(url, dir string) {
fmtc.Printf("Fetching index from {*}%s{!}…\n", url)
i, err := fetchIndex(url)
if err != nil {
printErrorAndExit(err.Error())
}
if i.Meta.Items == 0 {
printErrorAndExit("Repository is empty")
}
printRepositoryInfo(i)
uuid := getCurrentIndexUUID(dir)
if uuid == i... | [
-0.7742237448692322,
-0.16603708267211914,
0.5738099217414856,
0.3804316818714142,
0.2990466058254242,
0.13940177857875824,
0.28412944078445435,
-0.21393273770809174,
0.33381953835487366,
-0.12053868174552917,
0.15612806379795074,
0.8265919089317322,
-0.1328982710838318,
-0.332908540964126... |
func printRepositoryInfo(i *index.Index) {
fmtutil.Separator(false, "REPOSITORY INFO")
updated := timeutil.Format(time.Unix(i.Meta.Created, 0), "%Y/%m/%d %H:%M:%S")
fmtc.Printf(" {*}UUID{!}: %s\n", i.UUID)
fmtc.Printf(" {*}Updated{!}: %s\n\n", updated)
for _, distName := range i.Data.Keys() {
size, items... | [
-0.2001829296350479,
-0.27738156914711,
0.8443573713302612,
-1.2050825357437134,
-0.03182926028966904,
-0.0707726702094078,
0.42332783341407776,
-0.16583050787448883,
-0.3399159908294678,
0.041075825691223145,
-0.503227174282074,
0.4489040672779083,
0.7319443225860596,
-0.4554448425769806,... |
func fetchIndex(url string) (*index.Index, error) {
resp, err := req.Request{URL: url + "/" + INDEX_NAME}.Get()
if err != nil {
return nil, fmtc.Errorf("Can't fetch repository index: %v", err)
}
if resp.StatusCode != 200 {
return nil, fmtc.Errorf("Can't fetch repository index: server return status code %d", r... | [
-0.7798917889595032,
-0.23136083781719208,
0.5061131715774536,
-0.4241259694099426,
-0.6479337215423584,
-0.2548663318157196,
-0.033783528953790665,
-0.004844736773520708,
0.3571934998035431,
-0.06279739737510681,
-0.6169208288192749,
0.5512599349021912,
-0.15685413777828217,
-0.3107667267... |
func downloadRepositoryData(i *index.Index, url, dir string) {
items := getItems(i, url)
pb := progress.New(int64(len(items)), "Starting…")
pbs := progress.DefaultSettings
pbs.IsSize = false
pbs.ShowSpeed = false
pbs.ShowRemaining = false
pbs.ShowName = false
pbs.NameColorTag = "{*}"
pbs.BarFgColorTag = colo... | [
-0.00917308870702982,
0.6201965808868408,
0.7838123440742493,
0.27581682801246643,
0.17135193943977356,
0.6360099911689758,
0.24676184356212616,
0.12274938821792603,
-0.3318113088607788,
-0.0004552753525786102,
-0.736091136932373,
0.41309449076652527,
-0.009718077257275581,
-0.024696014821... |
func getItems(repoIndex *index.Index, url string) []FileInfo {
var items []FileInfo
for _, os := range repoIndex.Data.Keys() {
for _, arch := range repoIndex.Data[os].Keys() {
for _, category := range repoIndex.Data[os][arch].Keys() {
for _, version := range repoIndex.Data[os][arch][category] {
items =... | [
-0.726606547832489,
-0.2299439162015915,
0.3139081597328186,
-0.6992334127426147,
0.40227198600769043,
0.1251322627067566,
-0.6129627823829651,
-0.007043663412332535,
-0.6304834485054016,
-0.06218576058745384,
-0.40349695086479187,
0.39540448784828186,
0.2659980356693268,
-0.47689619660377... |
func downloadFile(url, output string) error {
if fsutil.IsExist(output) {
os.Remove(output)
}
fd, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return fmtc.Errorf("Can't create file: %v", err)
}
defer fd.Close()
resp, err := req.Request{URL: url}.Get()
if err != nil {
retu... | [
0.25458696484565735,
-0.322800874710083,
0.66261887550354,
0.46167507767677307,
-0.2831915318965912,
-0.2137005776166916,
0.9447534084320068,
-0.10833421349525452,
-0.5555628538131714,
-0.5067000389099121,
0.0403287410736084,
-0.3550451993942261,
-0.3032103478908539,
0.20177718997001648,
... |
func saveIndex(repoIndex *index.Index, dir string) {
indexPath := path.Join(dir, INDEX_NAME)
fmtc.Printf("Saving index… ")
err := jsonutil.Write(indexPath, repoIndex)
if err != nil {
fmtc.Println("{r}ERROR{!}")
printErrorAndExit("Can't save index as %s: %v", indexPath, err)
}
fmtc.Println("{g}DONE{!}")
} | [
-1.162371277809143,
-0.862484335899353,
0.4936645030975342,
-0.45358970761299133,
0.6213127374649048,
0.4987337589263916,
0.5444746613502502,
0.27764299511909485,
-0.0023385873064398766,
0.4804947078227997,
-1.3540476560592651,
0.8462633490562439,
-0.08481880277395248,
-0.2775267958641052,... |
func getCurrentIndexUUID(dir string) string {
indexFile := path.Join(dir, INDEX_NAME)
if !fsutil.IsExist(indexFile) {
return ""
}
i := &index.Index{}
if jsonutil.Read(indexFile, i) != nil {
return ""
}
return i.UUID
} | [
-1.4016276597976685,
-0.6575605869293213,
0.7600080370903015,
-0.30314889550209045,
-0.3617361783981323,
0.12379910051822662,
0.7806075811386108,
0.5744439363479614,
-0.07808375358581543,
0.7551953792572021,
0.5968788862228394,
0.2312263697385788,
-0.22218306362628937,
-0.9713473320007324,... |
func printCompletion() int {
info := genUsage()
switch options.GetS(OPT_COMPLETION) {
case "bash":
fmt.Printf(bash.Generate(info, "rbinstall-clone"))
case "fish":
fmt.Printf(fish.Generate(info, "rbinstall-clone"))
case "zsh":
fmt.Printf(zsh.Generate(info, optMap, "rbinstall-clone"))
default:
return 1
}
... | [
-0.24284344911575317,
-0.34682726860046387,
0.8276217579841614,
0.13610577583312988,
0.3373519778251648,
0.0737934336066246,
0.716677725315094,
0.29583123326301575,
-0.2992953956127167,
1.2837313413619995,
-0.1593148410320282,
0.6155965924263,
-0.48032745718955994,
1.0320732593536377,
0.... |
func printMan() {
fmt.Println(
man.Generate(
genUsage(),
genAbout(""),
),
)
} | [
-0.42487838864326477,
-0.2734573185443878,
0.6428819894790649,
-0.08026599884033203,
-0.34841251373291016,
0.6773450970649719,
-0.8621267676353455,
0.0535050705075264,
-1.0956448316574097,
-0.6021643280982971,
0.0900551974773407,
1.0782984495162964,
0.4715155363082886,
2.083040475845337,
... |
func genUsage() *usage.Info {
info := usage.NewInfo("", "url", "path")
info.AppNameColorTag = "{*}" + colorTagApp
info.AddOption(OPT_YES, `Answer "yes" to all questions`)
info.AddOption(OPT_NO_COLOR, "Disable colors in output")
info.AddOption(OPT_HELP, "Show this help message")
info.AddOption(OPT_VER, "Show ver... | [
-0.5125187039375305,
-0.25782543420791626,
0.7405674457550049,
-0.23041845858097076,
-0.09230141341686249,
0.31219255924224854,
-0.2045067399740219,
-0.6758384704589844,
-0.7988132238388062,
0.6510530710220337,
0.3393439054489136,
-0.27614063024520874,
0.4636894464492798,
0.677174746990203... |
func genAbout(gitRev string) *usage.About {
about := &usage.About{
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
AppNameColorTag: "{*}" + colorTagApp,
VersionColorTag: colorTagV... | [
0.2614152729511261,
-0.29713174700737,
0.6358027458190918,
0.0825599879026413,
-0.3927161693572998,
0.3002043068408966,
-0.4673932194709778,
0.18352967500686646,
-0.6009939908981323,
0.5293629169464111,
-0.14144527912139893,
0.5268000364303589,
-0.05357501283288002,
0.7890011668205261,
0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.