text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (set *StringSet) Remove(val string) {
delete(set.m, val)
} | [
0.17495903372764587,
-0.10236170142889023,
-0.04274686425924301,
-1.2912086248397827,
-1.8736793994903564,
-0.48330140113830566,
-0.7446710467338562,
-0.44618749618530273,
0.08459329605102539,
0.2417151778936386,
0.5063635110855103,
0.3967379927635193,
-1.0443427562713623,
0.47918820381164... |
func (set *StringSet) Contains(val string) (found bool) {
_, found = set.m[val]
return
} | [
-0.504443883895874,
-0.22494308650493622,
-0.02307942695915699,
-1.3530325889587402,
-1.1797319650650024,
-0.06022199988365173,
-0.4519459903240204,
-1.631787657737732,
-0.3935311734676361,
-0.49455752968788147,
0.3592401146888733,
0.8157727718353271,
-0.04523027315735817,
0.46081700921058... |
func NewAllocation(hostname string) *Allocation {
return &Allocation{
ID: uuid.New(),
Hostname: hostname,
State: Unbound,
}
} | [
-0.7148589491844177,
-0.5252379179000854,
0.12789860367774963,
0.20339369773864746,
-1.1754753589630127,
0.2998180389404297,
0.8042134642601013,
0.5703006982803345,
0.47831764817237854,
0.1862686574459076,
-0.08278749138116837,
0.10567909479141235,
0.01973789557814598,
-0.11302828043699265... |
func NewStateManager(etcdEndpoints []string, dialTimeout, requestTimeout time.Duration) (StateManager, error) {
sm := stateManager{
stopChan: make([]chan interface{}, 0),
requestTimeout: requestTimeout,
}
if cli, err := clientv3.New(clientv3.Config{
DialTimeout: dialTimeout,
Endpoints: etcdEndpoint... | [
-0.8030471205711365,
0.015201644971966743,
0.4963548183441162,
0.14599311351776123,
-0.9369601011276245,
0.12754972279071808,
-1.2157880067825317,
-0.00760685047134757,
0.6623445749282837,
0.23430751264095306,
-0.22287452220916748,
-0.1753445416688919,
-0.30718761682510376,
0.8873302936553... |
func (s *stateManager) MaintainIndices() {
updateIndex := func(a *Allocation) {
// Update IP->Allocation.ID lookup table
if a.Lease != nil {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
key := fmt.Sprintf("%s/lookup/%s", etcdPrefix, a.Lease.FixedAddress)
_,... | [
-0.8641616702079773,
-0.4658471941947937,
0.7523943185806274,
-0.5667566657066345,
-0.3065856993198395,
-0.1687106192111969,
0.2434743046760559,
0.25880444049835205,
0.9675022959709167,
0.04945170506834984,
0.7989346385002136,
-0.4600115716457367,
-0.011932996101677418,
-0.0597886033356189... |
func (s *stateManager) Stop() {
for _, c := range s.stopChan {
c <- true
}
s.cli.Close()
} | [
-1.7681589126586914,
-0.17583273351192474,
0.3711315393447876,
-0.36815202236175537,
-0.04421120509505272,
0.5672993659973145,
0.4914969503879547,
-0.4819505214691162,
-0.9699891209602356,
-0.26746031641960144,
-0.2637135684490204,
-0.06919015944004059,
0.3131410777568817,
0.77972638607025... |
func (s *stateManager) WatchAllocation(allocationID uuid.UUID, watcher *AllocationWatcher) func() {
stopChan := make(chan interface{})
s.stopChan = append(s.stopChan, stopChan)
ctx := context.Background()
key := fmt.Sprintf("%s/allocations/%s", etcdPrefix, allocationID)
watchChan := s.cli.Watch(ctx, key, clientv3... | [
0.055335890501737595,
-0.9552992582321167,
0.37707746028900146,
-1.0404767990112305,
-1.2848399877548218,
-0.11329548060894012,
0.43027231097221375,
0.2989521622657776,
0.38930851221084595,
0.6849214434623718,
0.8289499282836914,
0.46735334396362305,
1.1559520959854126,
-0.513306736946106,... |
func (s *stateManager) Watch(watcher *AllocationWatcher) func() {
stopChan := make(chan interface{})
s.stopChan = append(s.stopChan, stopChan)
ctx := context.Background()
key := fmt.Sprintf("%s/allocations", etcdPrefix)
watchChan := s.cli.Watch(ctx, key, clientv3.WithPrefix(), clientv3.WithPrevKV())
stopFunc :=... | [
0.26140961050987244,
-0.6302868723869324,
0.5866519212722778,
-0.9618508815765381,
-0.790942370891571,
0.289246141910553,
0.2390514612197876,
-0.04928646236658096,
0.01368612889200449,
-0.335171639919281,
0.8761273622512817,
0.4181651473045349,
1.4056655168533325,
-0.5104460716247559,
-0... |
func (s *stateManager) Put(allocation *Allocation) error {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
// Encode
var b []byte
var err error
if b, err = encode(allocation); err != nil {
log.Printf("State: error econding lease [%s]", err.Error())
return err
}
i... | [
0.2393278330564499,
-0.05282512679696083,
0.8700498938560486,
-1.2867851257324219,
-0.5999782681465149,
0.6673392057418823,
0.045008476823568344,
1.3732576370239258,
0.8993273377418518,
0.7359811067581177,
0.6653138995170593,
0.33134907484054565,
-0.026519907638430595,
-0.04965436458587646... |
func (s *stateManager) Remove(allocation *Allocation) error {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
_, err := s.kv.Delete(ctx,
fmt.Sprintf("%s/allocations/%s", etcdPrefix, allocation.ID))
if err != nil {
log.Printf("State: error removing IP %s", err.Error())
... | [
-0.8425612449645996,
-0.18041615188121796,
0.5631834864616394,
-0.5207549929618835,
-1.3934170007705688,
-0.06509441882371902,
-0.41060060262680054,
1.3572715520858765,
1.0973221063613892,
0.585636556148529,
0.8170037865638733,
-0.7790173888206482,
0.06713437288999557,
-0.1626187264919281,... |
func (s *stateManager) Allocations() ([]*Allocation, error) {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
opts := []clientv3.OpOption{
clientv3.WithPrefix(),
}
key := fmt.Sprintf("%s/allocations", etcdPrefix)
gr, err := s.kv.Get(ctx, key, opts...)
if err != nil ... | [
-1.0987024307250977,
0.5035862922668457,
0.6212354898452759,
0.1912805587053299,
-0.7679850459098816,
-0.23961655795574188,
-0.4765418469905853,
-0.1530543863773346,
0.4845285713672638,
0.5075710415840149,
1.165305495262146,
-0.078555166721344,
0.07105490565299988,
-0.30761510133743286,
... |
func (s *stateManager) Get(id uuid.UUID) (*Allocation, error) {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
gr, err := s.kv.Get(ctx, fmt.Sprintf("%s/allocations/%s", etcdPrefix, id))
if err != nil {
return nil, err
}
if gr.Count == 0 {
return nil, fmt.Errorf("N... | [
-1.4101675748825073,
0.3368832468986511,
0.6543270349502563,
-0.8261760473251343,
-0.8126540780067444,
-0.5638050436973572,
-0.607720673084259,
-0.22902673482894897,
0.25708553194999695,
0.649061381816864,
1.1115528345108032,
0.24255986511707306,
0.24188989400863647,
-0.6642214059829712,
... |
func (s *stateManager) GetByIP(ip *net.IP) (*Allocation, error) {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
gr, err := s.kv.Get(ctx, fmt.Sprintf("%s/lookup/%s", etcdPrefix, ip.String()))
if err != nil {
return nil, err
}
if gr.Count == 0 {
return nil, fmt.Err... | [
-0.5263251662254333,
0.4568842351436615,
0.8403827548027039,
-0.15373720228672028,
-0.6803122758865356,
-0.3504791855812073,
0.28418874740600586,
-0.4764137268066406,
0.4535030722618103,
0.2635177969932556,
1.027772307395935,
-0.21155798435211182,
-0.06579365581274033,
-1.4698712825775146,... |
func (s *stateManager) MACPool() ([]string, error) {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
key := fmt.Sprintf("%s/macs", etcdPrefix)
gr, err := s.kv.Get(ctx, key, clientv3.WithPrefix())
if err != nil {
return nil, err
}
macs := make([]string, gr.Count)
for... | [
-0.8801811933517456,
0.2904515266418457,
0.3177582919597626,
-0.3968624174594879,
-0.7340915203094482,
0.4812581241130829,
-1.1023900508880615,
-0.0729716345667839,
-0.5146247744560242,
0.5613229274749756,
0.3824664354324341,
0.7229479551315308,
-0.10712258517742157,
0.36010244488716125,
... |
func (s *stateManager) PutMAC(mac net.HardwareAddr) error {
if len(mac) == 0 {
return fmt.Errorf("Empty MAC")
}
amac := strings.ToLower(mac.String())
if amac == "" {
return fmt.Errorf("Invalid MAC format [%s]", mac.String())
}
// Check if MAC is already in use
allocations, err := s.Allocations()
if err !... | [
-0.958954930305481,
0.7044486999511719,
0.8669120073318481,
-0.2529471218585968,
-0.2665841579437256,
0.2923133075237274,
0.3315581977367401,
-0.31615251302719116,
0.6761805415153503,
-0.003965948708355427,
0.6183550953865051,
0.027357423678040504,
-0.40754416584968567,
0.5233200788497925,... |
func (s *stateManager) RemoveMAC(mac net.HardwareAddr) error {
amac := strings.ToLower(mac.String())
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
key := fmt.Sprintf("%s/macs/%s", etcdPrefix, amac)
_, err := s.kv.Delete(ctx, key)
return err
} | [
-1.1650725603103638,
0.4762708246707916,
0.3013592064380646,
-0.3741828203201294,
-1.0580101013183594,
-0.15504519641399384,
0.01638432778418064,
0.17786294221878052,
0.26624414324760437,
0.06274671852588654,
0.40537571907043457,
-0.49072974920272827,
-0.26435816287994385,
0.25672850012779... |
func (s *stateManager) PopMAC() (net.HardwareAddr, error) {
ctx, cancel := context.WithTimeout(context.Background(), s.requestTimeout)
defer cancel()
key := fmt.Sprintf("%s/macs", etcdPrefix)
gr, err := s.kv.Get(ctx, key, clientv3.WithPrefix(), clientv3.WithLimit(1))
if err != nil {
return nil, err
}
if gr.Co... | [
-0.562588632106781,
0.5706254243850708,
0.8436042666435242,
-0.33115383982658386,
-0.6631393432617188,
-0.3213520348072052,
-0.41865670680999756,
-0.2007150650024414,
-0.4983474612236023,
0.7275486588478088,
0.9684674739837646,
0.02405717596411705,
-0.4500516355037689,
-0.10171602666378021... |
func registerItemFlags(cmdPrefix string, cmd *cobra.Command) error {
completedCmdStr := fmt.Sprintf("%v.completed", cmdPrefix)
var completedCmdStrDefault bool
_ = cmd.PersistentFlags().Bool(completedCmdStr, completedCmdStrDefault, "")
descriptionCmdStr := fmt.Sprintf("%v.description", cmdPrefix)
var descriptio... | [
-0.269400030374527,
0.09554220736026764,
0.4341900646686554,
-0.2977846562862396,
1.1723110675811768,
-0.1629377156496048,
0.06520341336727142,
0.07800599932670593,
-0.3450064957141876,
-0.5828803777694702,
-0.9352777600288391,
0.42974406480789185,
-0.9266789555549622,
0.9038255214691162,
... |
func retrieveItemFlags(m *models.Item, cmdPrefix string, cmd *cobra.Command) (error, bool) {
retAdded := false
completedCmdStr := fmt.Sprintf("%v.completed", cmdPrefix)
if cmd.Flags().Changed(completedCmdStr) {
completedValue, err := cmd.Flags().GetBool(completedCmdStr)
if err != nil {
return err, false
}
... | [
0.20107975602149963,
-0.49143606424331665,
0.5817494988441467,
-0.5711161494255066,
0.7271957993507385,
-0.11904457956552505,
0.01595301367342472,
-0.38107484579086304,
-0.019406037405133247,
-0.3724632263183594,
-0.9461113810539246,
0.38044166564941406,
-1.2017822265625,
0.573216497898101... |
func TestAppOfApps(t *testing.T) {
t.SkipNow()
Given(t).
Path("app-of-apps").
When().
Create().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
// we are missing the child apps, as we do not auto-sync them
Expect(HealthIs(HealthStatusMissing)... | [
0.6727447509765625,
0.20350416004657745,
0.7172238230705261,
0.9739701747894287,
0.6339226961135864,
1.1032259464263916,
0.13139708340168,
-0.1111222505569458,
0.6471454501152039,
0.32605668902397156,
-0.4565942585468292,
-0.8395416736602783,
0.7773221135139465,
0.07079534232616425,
-0.0... |
func Unmount(path string, force, lazy bool) error {
return mount.Unmount(path, force, lazy)
} | [
0.1209830567240715,
0.8372333645820618,
0.35900747776031494,
-0.2834104597568512,
-0.5765396356582642,
-0.5182393789291382,
-0.1626366525888443,
0.09305118769407272,
-0.18455031514167786,
-0.08381889015436172,
-0.42346757650375366,
0.6950531005859375,
0.3189781904220581,
-0.315378129482269... |
func PossibleBillingTypeValues() []BillingType {
return []BillingType{BillingTypeCluster, BillingTypeWorkspaces}
} | [
-0.3799585998058319,
0.51859050989151,
0.07978778332471848,
1.5351992845535278,
-0.1707502007484436,
0.7524065375328064,
-0.3679778277873993,
-0.08436661958694458,
0.07069218903779984,
-0.6702783107757568,
-0.5569313168525696,
-0.26911064982414246,
0.01340564526617527,
2.414008140563965,
... |
func PossibleClusterEntityStatusValues() []ClusterEntityStatus {
return []ClusterEntityStatus{Canceled, Creating, Deleting, Failed, ProvisioningAccount, Succeeded, Updating}
} | [
-0.48618510365486145,
-0.6166431903839111,
0.026424162089824677,
0.38997501134872437,
0.3704501688480377,
0.44433414936065674,
-0.336922287940979,
0.5658320188522339,
-0.12290683388710022,
0.09283199161291122,
-0.5818643569946289,
-0.16058863699436188,
0.053894128650426865,
0.8910161852836... |
func PossibleClusterSkuNameEnumValues() []ClusterSkuNameEnum {
return []ClusterSkuNameEnum{CapacityReservation}
} | [
-1.4396268129348755,
-0.5884972810745239,
0.19584722816944122,
0.5523117780685425,
-0.3624304234981537,
-0.09432107210159302,
-0.2864857614040375,
0.4673274755477905,
0.2436060607433319,
0.15228602290153503,
-0.1910453587770462,
-0.1349530965089798,
-0.16181762516498566,
-0.278073042631149... |
func PossibleDataIngestionStatusValues() []DataIngestionStatus {
return []DataIngestionStatus{ApproachingQuota, ForceOff, ForceOn, OverQuota, RespectQuota, SubscriptionSuspended}
} | [
-0.5474671721458435,
-0.10714320838451385,
0.2525809705257416,
-0.1379602551460266,
-0.2950547933578491,
0.25709784030914307,
-0.560084342956543,
0.04516704007983208,
0.35850873589515686,
-0.14102070033550262,
-1.0225648880004883,
0.25729718804359436,
0.7552793622016907,
-0.005558401811867... |
func PossibleIdentityTypeValues() []IdentityType {
return []IdentityType{None, SystemAssigned, UserAssigned}
} | [
-0.6955787539482117,
-0.7452120184898376,
0.16792520880699158,
0.9302152395248413,
0.2271319031715393,
0.07234446704387665,
-0.27719616889953613,
-0.302237868309021,
0.4149183928966522,
-0.5216212868690491,
-0.9452695846557617,
-0.2940133810043335,
-0.4794135093688965,
1.1794707775115967,
... |
func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType {
return []PublicNetworkAccessType{Disabled, Enabled}
} | [
-0.13956212997436523,
-0.49563416838645935,
-0.03153735771775246,
0.8810625076293945,
-0.5937795042991638,
0.778401792049408,
-0.4943413734436035,
0.1655278354883194,
-0.35601022839546204,
-0.5261579751968384,
-0.514758825302124,
-0.2963389456272125,
-0.16181792318820953,
1.130129218101501... |
func PossibleWorkspaceEntityStatusValues() []WorkspaceEntityStatus {
return []WorkspaceEntityStatus{WorkspaceEntityStatusCanceled, WorkspaceEntityStatusCreating, WorkspaceEntityStatusDeleting, WorkspaceEntityStatusFailed, WorkspaceEntityStatusProvisioningAccount, WorkspaceEntityStatusSucceeded, WorkspaceEntityStatusUp... | [
-0.3213369846343994,
-0.9263530373573303,
0.23833373188972473,
-0.04699504375457764,
0.030751561746001244,
0.7829868197441101,
-0.5897799134254456,
0.09265181422233582,
0.4895889163017273,
-0.25238993763923645,
-0.6190788745880127,
-0.05673913657665253,
0.07099508494138718,
1.3404828310012... |
func PossibleWorkspaceSkuNameEnumValues() []WorkspaceSkuNameEnum {
return []WorkspaceSkuNameEnum{WorkspaceSkuNameEnumCapacityReservation, WorkspaceSkuNameEnumFree, WorkspaceSkuNameEnumLACluster, WorkspaceSkuNameEnumPerGB2018, WorkspaceSkuNameEnumPerNode, WorkspaceSkuNameEnumPremium, WorkspaceSkuNameEnumStandalone, Wor... | [
-1.0568803548812866,
-0.19119681417942047,
0.555847704410553,
0.16202901303768158,
-0.6210018396377563,
0.20066028833389282,
0.07914455235004425,
0.6460053324699402,
0.8666432499885559,
0.121833935379982,
-0.7530770897865295,
1.0367070436477661,
-0.513313889503479,
0.7151763439178467,
-0... |
func WithButtonStatus(status ButtonStatus) ButtonOption {
return func(button *Button) {
button.Config.Status = status
}
} | [
0.45025399327278137,
-1.0756922960281372,
0.14896947145462036,
-0.052809882909059525,
0.17815782129764557,
0.5502937436103821,
-0.7888141870498657,
0.3961067199707031,
0.5199363827705383,
0.2668560743331909,
-1.28752601146698,
0.08697216957807541,
1.3964403867721558,
0.39601370692253113,
... |
func WithButtonSize(size ButtonSize) ButtonOption {
return func(button *Button) {
button.Config.Size = size
}
} | [
0.9032976627349854,
-0.028886908665299416,
0.3240300714969635,
0.01802525296807289,
-0.07788024842739105,
-0.22981691360473633,
-0.11462455242872238,
-0.3638938367366791,
1.1636308431625366,
-0.2658006250858307,
-1.1422119140625,
-0.17037685215473175,
0.5843135118484497,
0.5969582796096802... |
func WithButtonStyle(style ButtonStyle) ButtonOption {
return func(button *Button) {
button.Config.Style = style
}
} | [
0.8371418714523315,
-0.3485560417175293,
0.2250857949256897,
0.4563780426979065,
0.0954861044883728,
-0.18248160183429718,
-0.9906940460205078,
0.0005094541702419519,
0.2703753113746643,
0.2325444519519806,
-0.578035295009613,
-0.05886508524417877,
0.05944870784878731,
0.5771835446357727,
... |
func WithButtonConfirmation(title, body string) ButtonOption {
return func(button *Button) {
button.Config.Confirmation = &Confirmation{
Title: title,
Body: body,
}
}
} | [
0.6304687261581421,
-0.5779552459716797,
0.2259007692337036,
0.3691340684890747,
0.09474541991949081,
0.40692251920700073,
-0.8661665320396423,
-0.4040484130382538,
-0.07793303579092026,
0.2050577849149704,
-1.00812828540802,
0.158537819981575,
1.2807196378707886,
0.991732656955719,
-0.3... |
func WithModal(modal *Modal) ButtonOption {
return func(button *Button) {
button.Config.Modal = modal
}
} | [
-0.04919487610459328,
-0.5836819410324097,
0.5215943455696106,
0.18160808086395264,
-0.13336090743541718,
0.3971872925758362,
-0.18460401892662048,
0.1575583815574646,
1.256875991821289,
0.02813609689474106,
-0.28018152713775635,
0.024880047887563705,
0.8269028663635254,
-0.030544651672244... |
func NewButton(name string, payload action.Payload, options ...ButtonOption) *Button {
button := Button{
Base: newBase(TypeButton, nil),
Config: ButtonConfig{
Name: name,
Payload: payload,
},
}
for _, option := range options {
option(&button)
}
return &button
} | [
0.661891520023346,
-0.5511101484298706,
0.5167102813720703,
0.23116445541381836,
-0.020938148722052574,
0.44460466504096985,
-0.785014808177948,
-0.45951715111732483,
0.18839073181152344,
0.4640945494174957,
-0.5293388366699219,
0.6373805403709412,
-0.1695631742477417,
-0.16502982378005981... |
func main() {
circle := Circle{10.0}
areaOfShape(circle)
} | [
0.5797297954559326,
-0.1349974274635315,
0.3733506500720978,
-0.5301579236984253,
0.7598896026611328,
-0.40287142992019653,
1.7514610290527344,
-0.3756932020187378,
0.09989512711763382,
0.3921036720275879,
-0.6652071475982666,
0.3466254472732544,
0.8887889981269836,
0.33559367060661316,
... |
func (m *ResourceVMInfoItem) Validate(formats strfmt.Registry) error {
return nil
} | [
0.5869726538658142,
-0.22043076157569885,
-0.19501516222953796,
0.22104445099830627,
0.7821415662765503,
0.5619584918022156,
-0.4390784800052643,
-0.3148204982280731,
-0.43703731894493103,
0.13150426745414734,
0.4255417585372925,
-0.5071818232536316,
-1.049567461013794,
0.19395901262760162... |
func realPath(file string) string {
if string(file[0]) == "/" {
return file
}
if string(file[0]) != "/" {
file = "/" + file
}
_, filename, _, _ := runtime.Caller(3)
dir := path.Join(path.Dir(filename), file)
if _, err := os.Stat(dir); err == nil && strings.HasSuffix(dir, file) {
return dir
}
current,... | [
0.5033384561538696,
0.1611218899488449,
0.8971344828605652,
0.7740462422370911,
-0.30791983008384705,
0.4869913160800934,
1.496055006980896,
-0.11206942051649094,
0.002761684125289321,
-0.0027856563683599234,
0.874427855014801,
-0.5723228454589844,
-0.9048109650611877,
0.8101305365562439,
... |
func Copy(src, dest string) error {
srcFile, err := os.Open(realPath(src))
if err != nil {
return err
}
defer srcFile.Close()
sfi, err := srcFile.Stat()
if err != nil {
return err
}
if !sfi.Mode().IsRegular() {
return fmt.Errorf("%s is not a regular file", src)
}
destFile, err := os.Create(realPat... | [
0.13412891328334808,
0.10710874199867249,
0.6609423160552979,
0.5916624069213867,
-0.9018768072128296,
0.9904154539108276,
0.5057194232940674,
-0.027473071590065956,
-0.44165337085723877,
-0.00775354215875268,
0.2945411503314972,
-0.07891445606946945,
0.45041853189468384,
0.620717585086822... |
func CreateDir(dir string, args ...interface{}) error {
permission := uint32(0644)
if len(args) > 0 {
permission = args[0].(uint32)
}
dir = realPath(dir)
if _, err := os.Stat(dir); os.IsNotExist(err) {
return nil
}
return os.Mkdir(dir, os.FileMode(permission))
} | [
0.42885616421699524,
0.19313262403011322,
0.7452347278594971,
0.7531691193580627,
0.04842090606689453,
0.5339158177375793,
0.5802140831947327,
-0.2036425769329071,
-0.20611156523227692,
-0.730779767036438,
0.7905964851379395,
-0.21405431628227234,
-0.21892915666103363,
0.292520135641098,
... |
func Delete(path string) error {
return os.Remove(realPath(path))
} | [
1.1275629997253418,
0.1053776741027832,
0.2990594506263733,
0.6469954252243042,
-0.27893733978271484,
0.9766941070556641,
0.821426272392273,
0.499062716960907,
0.05019490793347359,
0.33562570810317993,
-0.21822679042816162,
-0.4747962951660156,
0.14145402610301971,
-0.4102254807949066,
0... |
func GetFileExtension(file string) string {
ext := filepath.Ext(realPath(file))
if ext == "" {
return ""
}
return ext[1:]
} | [
0.8148158192634583,
0.22320185601711273,
0.5422348380088806,
0.6385109424591064,
-0.11614425480365753,
0.1803809255361557,
-0.014036976732313633,
0.7127572298049927,
0.14602497220039368,
0.8036729097366333,
-0.12784449756145477,
0.13779683411121368,
-0.22005826234817505,
-0.042181476950645... |
func GetSize(file string) (int64, error) {
stat, err := os.Stat(realPath(file))
if err != nil {
return 0, err
}
return stat.Size(), nil
} | [
-0.2410607635974884,
0.7588133215904236,
0.7511223554611206,
0.3322090804576874,
0.041677847504615784,
-0.3111680746078491,
1.1287879943847656,
0.4447893500328064,
-0.46385622024536133,
-0.1086740717291832,
-0.07080257683992386,
-0.3727583587169647,
-0.2043415755033493,
0.800986111164093,
... |
func Exists(path string) error {
_, err := os.Stat(realPath(path))
if err == nil {
return nil
}
if os.IsNotExist(err) {
return err
}
return nil
} | [
-0.022879742085933685,
-0.4109055995941162,
0.6733825206756592,
-0.34492406249046326,
0.2752193510532379,
0.744253933429718,
-0.17042990028858185,
-0.06739424169063568,
0.2456377148628235,
-0.3775356113910675,
-0.6329711079597473,
-0.3578502833843231,
0.7429183125495911,
0.0749243721365928... |
func ListContents(args ...interface{}) []ContentItem {
dir := "./*"
path := "/"
recursive := false
files := []string{}
if string(dir[0]) != "." {
path = path + dir
}
if len(args) > 0 {
if len(args[0].(string)) > 0 {
dir = realPath(args[0].(string)) + "/*"
}
recursive = len(args) > 1 && args[1] != n... | [
-0.5283963084220886,
-1.0413792133331299,
0.9823234677314758,
0.6152303814888,
-0.34996914863586426,
-0.17213773727416992,
0.7817474603652954,
-0.567736804485321,
-0.38717764616012573,
-0.1513061672449112,
0.3161943554878235,
-0.09932703524827957,
-0.3436867892742157,
0.623750627040863,
... |
func Read(file string) (string, error) {
err := Exists(file)
if err != nil {
return "", err
}
content, err := ioutil.ReadFile(realPath(file))
if err != nil {
return "", err
}
return string(content), nil
} | [
0.1427222639322281,
-0.09833719581365585,
0.6071308255195618,
-0.02621084451675415,
-0.6013622283935547,
0.8997640609741211,
-0.00919803511351347,
-0.26813217997550964,
-0.3380390405654907,
0.38494572043418884,
0.7321496605873108,
-0.07101818174123764,
0.07350651174783707,
-0.1166461482644... |
func Update(file, content string, args ...interface{}) error {
permission := uint32(0644)
if len(args) > 0 {
permission = args[0].(uint32)
}
f, err := os.OpenFile(file, os.O_APPEND|os.O_WRONLY, os.FileMode(permission))
if err != nil {
return err
}
if _, err := f.WriteString(content); err != nil {
retur... | [
0.15032927691936493,
-0.45998963713645935,
0.8011155724525452,
-0.16434834897518158,
-0.2908584773540497,
0.7439548969268799,
0.27682894468307495,
0.25240063667297363,
-0.9431707859039307,
0.4016248881816864,
0.7494004368782043,
-0.2889842092990875,
-1.1077914237976074,
-0.0348416566848754... |
func Write(file, content string, args ...interface{}) error {
permission := uint32(0644)
if len(args) > 0 {
permission = args[0].(uint32)
}
err := ioutil.WriteFile(realPath(file), []byte(content), os.FileMode(permission))
if err != nil {
return err
}
return nil
} | [
-0.08191950619220734,
0.509959876537323,
0.400614857673645,
0.6308673620223999,
0.8944867253303528,
0.7078942060470581,
0.4985029101371765,
0.7356176376342773,
-1.1925265789031982,
0.1307380050420761,
0.2937178909778595,
-0.6191739439964294,
-0.7823064923286438,
0.21755509078502655,
-0.1... |
func WriteJSON(file string, content interface{}, args ...interface{}) error {
body, err := json.Marshal(content)
if err != nil {
return err
}
return Write(file, string(body), args...)
} | [
-0.2035778909921646,
-0.8010444045066833,
0.4547601342201233,
-0.5161421895027161,
0.5308617949485779,
0.09373296052217484,
0.156070277094841,
0.5577701330184937,
-1.0320078134536743,
0.1612052172422409,
0.1067604273557663,
0.5509976148605347,
-0.12732161581516266,
0.7448545694351196,
0.... |
func NewSetemergency(producer eos.AccountName,Emergency bool) *eos.Action {
return &eos.Action{
Account: AN("eosio"),
Name: ActN("setemergency"),
Authorization: []eos.PermissionLevel{
{Actor: producer, Permission: PN("active")},
},
ActionData: eos.NewActionData(Setemergency{
Producer: producer,
... | [
-0.5543630123138428,
-0.5303933620452881,
0.34901362657546997,
0.7512045502662659,
0.41528183221817017,
-1.0870201587677002,
-0.06708847731351852,
-0.07834900170564651,
0.22224251925945282,
1.5909171104431152,
-0.26946425437927246,
0.9112251400947571,
-0.007136166095733643,
0.2647768557071... |
func outputFlagValues() {
fmt.Println("---------------------------------------------")
fmt.Printf("\nRepo URL\t\t: %s\n", *repoURL)
fmt.Printf("Commits Num\t\t: %d\n", *numCommits)
fmt.Printf("Repo Branch Name\t: %s\n", *branchName)
fmt.Printf("Timeout \t\t: %d\n", *timeout)
fmt.Printf("Path for Commmits\t: %s\n"... | [
0.6623629927635193,
-0.2172563672065735,
0.6957291960716248,
-0.7927099466323853,
0.18928690254688263,
0.6509820222854614,
0.13406319916248322,
0.37117230892181396,
-1.9040558338165283,
-0.4733562469482422,
-0.49858012795448303,
0.8144719004631042,
-0.07117487490177155,
0.7361903190612793,... |
func getPath(path string) (string, error) {
dirinfo, err := os.Stat(path)
if err != nil || !dirinfo.IsDir() {
log.Println(err)
os.MkdirAll(path, 0755)
fmt.Printf("\nDirectory %s is created\n", path)
}
return path, nil
} | [
0.4987056255340576,
0.6006554961204529,
0.6129382848739624,
0.6024636030197144,
0.34105291962623596,
0.8114261627197266,
1.3432679176330566,
-1.1272892951965332,
0.6037707924842834,
-0.6696418523788452,
0.47397375106811523,
-0.18787021934986115,
-0.2624465823173523,
0.41427260637283325,
... |
func commitizerMain(timeout time.Duration, commitsPath string, numAuthorCreated map[string]int) error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
// Use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
devt := devtool.New("http://127.0.0.1:9222")
pt, er... | [
-0.27239975333213806,
0.4275248050689697,
0.895780086517334,
0.0320567712187767,
0.5054856538772583,
-0.22008080780506134,
0.47472384572029114,
-0.5847617983818054,
-1.18083918094635,
0.002117353957146406,
0.1833828240633011,
-0.034362368285655975,
-0.43754974007606506,
0.14325888454914093... |
func navigateToBranch(ctx context.Context, c *cdp.Client, info DocumentInfo, branchName string, domLoadTimeout time.Duration) error {
url, err := helpers.GetBranchURL(ctx, c, branchName)
if err != nil {
return err
}
info.BranchURL = url
// Navigate to main branch
err = helpers.Navigate(ctx, c.Page, info.Branch... | [
0.15440185368061066,
0.3567078709602356,
0.7255059480667114,
0.099723219871521,
0.3092331290245056,
0.14376159012317657,
0.3982539474964142,
-0.4745904505252838,
-0.2778469920158386,
0.06559164822101593,
-0.009725564159452915,
0.3455960154533386,
-0.031100962311029434,
0.245464026927948,
... |
func getCommitAndMakeFile(ctx context.Context, c *cdp.Client, info DocumentInfo, commitIndex int, numAuthorCreated map[string]int, commitsPath string, domLoadTimeout time.Duration) error {
commitMessage, details, err := helpers.CommitIterator(ctx, c, numAuthorCreated)
if err != nil {
return err
}
err = helpers.... | [
0.18399007618427277,
0.006161888595670462,
0.640504777431488,
-0.12402495741844177,
0.5711196064949036,
0.3293910622596741,
0.8370257616043091,
-0.31451448798179626,
-0.7662205100059509,
0.2363586127758026,
0.7699588537216187,
-0.38734176754951477,
-0.26817020773887634,
-0.1327035576105117... |
func (*CPU) Descriptor() ([]byte, []int) {
return file_proto_processor_message_proto_rawDescGZIP(), []int{0}
} | [
-0.6551347374916077,
1.043560266494751,
0.47166451811790466,
0.00478430837392807,
-0.7583311796188354,
0.008326854556798935,
0.4727424085140228,
0.7085332274436951,
-0.5157073736190796,
-0.3455159366130829,
-0.21793296933174133,
0.5556365251541138,
-0.5417052507400513,
0.6183528900146484,
... |
func (*GPU) Descriptor() ([]byte, []int) {
return file_proto_processor_message_proto_rawDescGZIP(), []int{1}
} | [
-0.4983631670475006,
0.9114251732826233,
0.47436612844467163,
0.02097811922430992,
0.04703330993652344,
-0.29322999715805054,
0.4707569181919098,
0.4915047287940979,
-0.43451541662216187,
-0.6601890325546265,
0.2752188742160797,
0.8336362242698669,
-0.29917651414871216,
0.7185442447662354,... |
func _for(p population, f consumer, withRandom bool, start, end int) {
N := end - start
n := runtime.GOMAXPROCS(0)
if p.NThread > 0 {
n = p.NThread
}
if N < n {
sem := make(Semaphore, N)
sem.P(N)
for ; start < end; start++ {
go func(i int) {
var r *rand.Rand
if withRandom {
r = rand.New(ran... | [
-0.09961684793233871,
0.7046475410461426,
0.7009676694869995,
0.2472219318151474,
-0.41574394702911377,
-0.5024821162223816,
0.19908808171749115,
0.2379874587059021,
-0.5009636282920837,
0.39467841386795044,
0.07300819456577301,
-0.26787683367729187,
0.2065659910440445,
0.15528149902820587... |
func NewProductFromDownloader(dl downloader.Downloader, url string) (*Product, error) {
// Fetch the URL
content, err := dl.Download(url)
if err != nil {
return nil, err
}
// Parse the product
parser := new(parser.ProductParser)
results := parser.Parse(content.Data)
// Convert price to float
unit_price := ... | [
0.07843159139156342,
-0.999644935131073,
0.25492000579833984,
0.35760676860809326,
-1.1685762405395508,
0.42768555879592896,
-0.6508605480194092,
-0.7878411412239075,
0.06957387179136276,
-0.14743688702583313,
-0.04899096488952637,
-0.14148780703544617,
-0.2758776843547821,
0.2327682673931... |
func NewFhirStoreIamPolicy(ctx *pulumi.Context,
name string, args *FhirStoreIamPolicyArgs, opts ...pulumi.ResourceOption) (*FhirStoreIamPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.FhirStoreId == nil {
return nil, errors.New("invalid value for req... | [
0.032691407948732376,
0.23209881782531738,
0.5839673280715942,
-0.28394925594329834,
1.10270357131958,
0.34989622235298157,
0.054732345044612885,
0.3844202756881714,
0.5989428162574768,
0.2610169053077698,
-0.10275986045598984,
-0.38017919659614563,
0.19851189851760864,
-0.2467464059591293... |
func GetFhirStoreIamPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FhirStoreIamPolicyState, opts ...pulumi.ResourceOption) (*FhirStoreIamPolicy, error) {
var resource FhirStoreIamPolicy
err := ctx.ReadResource("gcp:healthcare/fhirStoreIamPolicy:FhirStoreIamPolicy", name, id, state, &resource, opt... | [
0.3416580259799957,
-0.133253276348114,
0.3049209415912628,
-0.3351210951805115,
0.7848647236824036,
-0.27536800503730774,
-0.038662511855363846,
0.018553011119365692,
1.6110972166061401,
0.10643282532691956,
0.5467281341552734,
0.33131998777389526,
0.3524952828884125,
-1.2107871770858765,... |
func (o FhirStoreIamPolicyOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v *FhirStoreIamPolicy) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)
} | [
0.8147466778755188,
0.1401246041059494,
0.428291380405426,
-0.7397206425666809,
1.1781067848205566,
0.7959360480308533,
0.04674213007092476,
0.8837408423423767,
0.8537552952766418,
0.6854241490364075,
0.4542087912559509,
0.05884190648794174,
0.9078887104988098,
-0.5431488752365112,
0.126... |
func (o FhirStoreIamPolicyOutput) PolicyData() pulumi.StringOutput {
return o.ApplyT(func(v *FhirStoreIamPolicy) pulumi.StringOutput { return v.PolicyData }).(pulumi.StringOutput)
} | [
0.7563042044639587,
-0.14253747463226318,
0.4090343117713928,
-0.7489012479782104,
0.7630822062492371,
1.705008864402771,
-0.47104519605636597,
0.6646132469177246,
1.6872575283050537,
-0.213597372174263,
0.4042259752750397,
0.5606014132499695,
0.729461133480072,
-1.1336755752563477,
-0.1... |
func GetTopicNameByResourceName(topicTalosResourceName string) (string, error) {
itemList := strings.Split(topicTalosResourceName, "#")
len := len(itemList)
if len < 3 {
err := fmt.Errorf("%s is not a valid topicTalosResourceName",
topicTalosResourceName)
return "", err
}
return itemList[len-2], nil
} | [
0.68999844789505,
-0.5838659405708313,
0.36628755927085876,
0.09451258182525635,
-0.3997179865837097,
0.5013676881790161,
0.07562775909900665,
-0.7253096103668213,
-0.2446666657924652,
0.47587475180625916,
1.1282930374145508,
-1.0985952615737915,
0.9184311628341675,
-0.645514965057373,
1... |
func NewWidgetsExpandItem2(a WidgetsExpandBarInterface, b int, c int) (*WidgetsExpandItem) {
conv_a := javabind.NewGoToJavaCallable()
if err := conv_a.Convert(a); err != nil {
panic(err)
}
obj, err := javabind.GetEnv().NewObject("org/eclipse/swt/widgets/ExpandItem", conv_a.Value().Cast("org/eclipse/swt/widgets/E... | [
-0.571417510509491,
-0.2329915314912796,
0.4438042640686035,
0.7636579275131226,
-0.6942625641822815,
0.43649372458457947,
-0.08766923099756241,
0.2816043198108673,
-0.6506060361862183,
0.2458295375108719,
0.009685263969004154,
-0.10505660623311996,
-0.930317759513855,
0.8300023674964905,
... |
func UnmarshalMSDTV(b []byte) ([]*MSDTV, error) {
if glog.V(6) {
glog.Infof("UnmarshalMSDTV Raw: %s", tools.MessageHex(b))
}
tvs := make([]*MSDTV, 0)
for p := 0; p < len(b); {
tv := &MSDTV{}
tv.Type = b[p]
p++
tv.Value = b[p]
p++
tvs = append(tvs, tv)
}
return tvs, nil
} | [
-0.39067694544792175,
0.24113602936267853,
0.7175607681274414,
-0.5183635950088501,
-1.4435029029846191,
-0.19818776845932007,
-0.5929266810417175,
0.6307716965675354,
0.6103129386901855,
0.014973897486925125,
0.01954471506178379,
0.413176566362381,
0.11204147338867188,
0.6837152242660522,... |
func (a Args) ApplyTo(i interface{}) (err error) {
if len(a) > 0 {
var b []byte
b, err = json.Marshal(a)
if err == nil {
err = json.Unmarshal(b, i)
}
}
return
} | [
-1.225815773010254,
0.6088783144950867,
0.7666376829147339,
-1.2240146398544312,
0.44242075085639954,
-0.5705791115760803,
-0.08952433615922928,
0.3520413339138031,
0.11078902333974838,
-0.18490812182426453,
-0.05517519265413284,
0.12914852797985077,
0.16466514766216278,
0.5814066529273987... |
func (s Media) String() string {
return awsutil.Prettify(s)
} | [
0.4907587468624115,
-0.8082231283187866,
0.006682939827442169,
-0.5220732688903809,
-0.6445194482803345,
0.3597871661186218,
0.28882020711898804,
-0.924257755279541,
-0.00392515491694212,
-0.22510401904582977,
0.3131842315196991,
1.1250056028366089,
0.3913501501083374,
0.3541354537010193,
... |
func (s *Media) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "Media"}
if s.MediaFileUri != nil && len(*s.MediaFileUri) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("MediaFileUri", 1))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
} | [
-0.18448592722415924,
0.12486477196216583,
0.490888386964798,
0.6163686513900757,
0.39980608224868774,
-0.28679776191711426,
-0.14132854342460632,
0.060590919107198715,
-0.2869955003261566,
-0.1801261305809021,
1.2061959505081177,
-0.05423494800925255,
-1.1893640756607056,
1.59138214588165... |
func (s Settings) String() string {
return awsutil.Prettify(s)
} | [
-0.0032734002452343702,
0.5495328903198242,
0.15681281685829163,
-0.6309782266616821,
-0.49525731801986694,
0.10623221099376678,
0.5097797513008118,
-1.529013991355896,
-0.2988702654838562,
0.46779865026474,
0.0197637677192688,
0.5635968446731567,
0.5742875933647156,
-0.2642170786857605,
... |
func (s *Settings) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "Settings"}
if s.MaxSpeakerLabels != nil && *s.MaxSpeakerLabels < 2 {
invalidParams.Add(aws.NewErrParamMinValue("MaxSpeakerLabels", 2))
}
if s.VocabularyName != nil && len(*s.VocabularyName) < 1 {
invalidParams.Add(aws.NewErrPa... | [
-0.8934458494186401,
0.446046382188797,
0.5127604603767395,
0.018647460266947746,
0.017264459282159805,
-0.37272971868515015,
-0.5050537586212158,
-1.0007323026657104,
-0.525619387626648,
0.7837452292442322,
0.5286981463432312,
-0.42711418867111206,
-0.5084619522094727,
1.2354098558425903,... |
func (s Transcript) String() string {
return awsutil.Prettify(s)
} | [
0.7474288940429688,
-1.0187582969665527,
0.14771203696727753,
-0.8852691650390625,
-1.635499358177185,
0.021066447719931602,
-0.3182121813297272,
-0.6454514265060425,
0.1404135525226593,
0.10928025096654892,
-0.23880259692668915,
1.3661086559295654,
0.6757721900939941,
-0.7015693187713623,... |
func (s TranscriptionJob) String() string {
return awsutil.Prettify(s)
} | [
0.6112292408943176,
-0.15145502984523773,
0.08570761233568192,
-0.5046412348747253,
-1.5665662288665771,
0.6095718741416931,
0.05472736060619354,
-0.35258617997169495,
-0.382379412651062,
0.013050122186541557,
-0.06150946393609047,
0.7153900265693665,
0.29280412197113037,
-0.40443488955497... |
func (s TranscriptionJobSummary) String() string {
return awsutil.Prettify(s)
} | [
0.10062135010957718,
0.07098086178302765,
0.266698956489563,
-0.8002974390983582,
-1.5487465858459473,
0.5651648044586182,
0.4339263141155243,
-0.4693775177001953,
0.1248277872800827,
0.1729581505060196,
0.328673392534256,
0.6589160561561584,
0.6561344861984253,
-0.7577536106109619,
0.31... |
func (s VocabularyInfo) String() string {
return awsutil.Prettify(s)
} | [
1.1069698333740234,
-0.7076252102851868,
0.05404862388968468,
-0.9272239804267883,
-0.49059420824050903,
0.4045020043849945,
-0.01890125684440136,
-1.0986964702606201,
-0.10054720193147659,
-0.057262152433395386,
0.22653144598007202,
0.48165103793144226,
-0.027826854959130287,
-0.160011917... |
func NewGeospatial(baseURL string) Geospatial {
return &geospatialService{baseURL}
} | [
-0.3150884807109833,
-0.5738043785095215,
-0.005725204944610596,
0.4749937355518341,
-1.4188110828399658,
0.4390532374382019,
-1.5201252698898315,
-0.2979080379009247,
-0.44807687401771545,
0.2182384878396988,
-0.4038017988204956,
0.8663820624351501,
-0.5802461504936218,
0.2220629602670669... |
func NewPacket(opcode byte, payload []byte) *Packet {
return &Packet{opcode, payload, false, 0, 0, 0}
} | [
0.09799198061227798,
0.18021737039089203,
0.2567371428012848,
0.4744204580783844,
-0.5218437910079956,
-0.327226847410202,
-0.28185373544692993,
0.010221749544143677,
0.1181521937251091,
-0.38537725806236267,
0.5493175983428955,
1.0170880556106567,
-0.14269039034843445,
-0.1201552525162696... |
func NewOutgoingPacket(opcode byte) *Packet {
return &Packet{opcode, []byte{opcode}, false, 0, 0, 0}
} | [
-0.6241014003753662,
0.5371929407119751,
0.24300704896450043,
-0.1664831042289734,
-1.303023338317871,
-0.10999362915754318,
-0.11686287075281143,
0.04776109382510185,
-0.38466277718544006,
0.3500926196575165,
-0.12472394853830338,
1.0784658193588257,
-0.8476539254188538,
0.369789361953735... |
func NewBarePacket(src []byte) *Packet {
return &Packet{0, src, true, 0, 0, 0}
} | [
-0.4573795795440674,
0.46212321519851685,
0.40239769220352173,
0.08746745437383652,
-1.0632745027542114,
-0.38812491297721863,
-0.12294116616249084,
0.2666902542114258,
0.03468511998653412,
-0.7826789021492004,
-0.5040256977081299,
0.9844979643821716,
-0.48338279128074646,
0.56334173679351... |
func (p *Packet) ReadLong() uint64 {
return p.readVarLengthInt(8)
} | [
-0.0015261919470503926,
0.6659051179885864,
0.5649516582489014,
0.25260040163993835,
0.1912796050310135,
-0.08529934287071228,
-1.097124457359314,
0.017439642921090126,
0.39044708013534546,
0.005420976784080267,
-0.5151517391204834,
0.6107301115989685,
-0.5655630826950073,
-0.2387893348932... |
func (p *Packet) ReadInt() int {
return int(p.readVarLengthInt(4))
} | [
0.2874406576156616,
0.28774794936180115,
0.3723512887954712,
-0.7621456384658813,
-0.04527057334780693,
0.09220549464225769,
-0.5577471256256104,
-1.041115641593933,
-1.0165560245513916,
-0.23982061445713043,
-0.2700800597667694,
-0.18142001330852509,
-1.0566169023513794,
-0.63966703414916... |
func (p *Packet) ReadShort() int {
return int(p.readVarLengthInt(2))
} | [
0.4327622652053833,
-0.00030804399284534156,
0.5470017194747925,
0.06677393615245819,
-1.1462661027908325,
-0.009956001304090023,
-0.06860020011663437,
-0.4939676523208618,
-0.21607136726379395,
-0.5231455564498901,
-0.5008711218833923,
1.1411455869674683,
-0.3419211506843567,
-1.095446109... |
func (p *Packet) ReadBool() bool {
return p.ReadByte() == 1
} | [
-0.5226777195930481,
0.5216980576515198,
0.5896029472351074,
0.6568694114685059,
0.4071365296840668,
0.8386340737342834,
-0.8071867227554321,
0.3756924271583557,
-0.20571516454219818,
0.08190527558326721,
-0.20551848411560059,
0.17357781529426575,
-0.83961021900177,
-0.8323935866355896,
... |
func (p *Packet) ReadByte() byte {
if p.readIndex+1 > len(p.Payload) {
log.Warning.Println("Error parsing packet arguments: { opcode=" + strconv.Itoa(int(p.Opcode)) + "; offset=" + strconv.Itoa(p.readIndex) + " };")
return byte(0)
}
defer func() {
p.readIndex++
}()
return p.Payload[p.readIndex] & 0xFF
} | [
-0.5080241560935974,
1.1340742111206055,
0.7615428566932678,
-0.34181684255599976,
0.06821904331445694,
0.06851017475128174,
-0.15552781522274017,
-0.38810333609580994,
-0.10289056599140167,
-0.7633081078529358,
1.2111350297927856,
0.439706027507782,
-1.0847375392913818,
-0.564821422100067... |
func (p *Packet) ReadSByte() int8 {
if p.readIndex+1 > len(p.Payload) {
log.Warning.Println("Error parsing packet arguments: { opcode=" + strconv.Itoa(int(p.Opcode)) + "; offset=" + strconv.Itoa(p.readIndex) + " };")
return int8(0)
}
defer func() {
p.readIndex++
}()
return int8(p.Payload[p.readIndex])
} | [
-0.567899227142334,
0.8755242228507996,
0.7350667715072632,
-0.26643484830856323,
0.010078980587422848,
-0.343449205160141,
-0.14723992347717285,
-0.2398124784231186,
0.07613737881183624,
-0.8050878643989563,
1.0968540906906128,
0.49354010820388794,
-1.4377779960632324,
-0.4788761734962463... |
func (p *Packet) ReadString(n int) (val string) {
for i := 0; i < n; i++ {
val += string(p.ReadByte())
}
return
} | [
-0.9672445058822632,
0.6651303172111511,
0.49855783581733704,
-0.5722615718841553,
-0.3596348464488983,
0.3997168242931366,
-0.9913608431816101,
-1.3779902458190918,
-0.5109729766845703,
-0.16756032407283783,
0.06653916090726852,
-0.38039615750312805,
-0.23995184898376465,
-0.1952045708894... |
func (p *Packet) AddInt(i uint32) *Packet {
p.Payload = append(p.Payload, byte(i>>24), byte(i>>16), byte(i>>8), byte(i))
return p
} | [
-0.5304688215255737,
0.8107708692550659,
0.7269278764724731,
-1.221094012260437,
-0.6273185014724731,
1.0313493013381958,
-1.3595352172851562,
-1.1426501274108887,
0.0863099917769432,
-0.6350001692771912,
-0.7765398621559143,
-0.9982687830924988,
-0.9454721808433533,
-0.6526963114738464,
... |
func (p *Packet) AddInt2(i uint32) *Packet {
if i < 128 {
p.Payload = append(p.Payload, uint8(i))
return p
}
p.Payload = append(p.Payload, byte((i>>24)+128), byte(i>>16), byte(i>>8), byte(i))
return p
} | [
-0.5817654132843018,
0.06313279271125793,
0.8606640696525574,
-0.6804963946342468,
-1.021952748298645,
0.84145587682724,
-1.3474241495132446,
-1.2221577167510986,
-0.15807712078094482,
-0.31984367966651917,
-0.3495289385318756,
-0.3566668927669525,
-0.9704283475875854,
0.10005664080381393,... |
func (p *Packet) AddShort(s uint16) *Packet {
p.Payload = append(p.Payload, byte(s>>8), byte(s))
return p
} | [
0.24799354374408722,
0.8021013140678406,
0.5274866223335266,
-0.27673211693763733,
-1.107640266418457,
0.7675108313560486,
-1.1246219873428345,
-0.7003203630447388,
1.4535191059112549,
-1.0332629680633545,
-0.5339343547821045,
0.8027759194374084,
0.10600679367780685,
-0.8658657670021057,
... |
func (p *Packet) AddBool(b bool) *Packet {
if b {
p.Payload = append(p.Payload, 1)
return p
}
p.Payload = append(p.Payload, 0)
return p
} | [
-0.2392873913049698,
0.8773593902587891,
0.7178210020065308,
0.4827456772327423,
0.03596487641334534,
1.0451990365982056,
-1.3547155857086182,
0.5060849785804749,
0.9711353778839111,
-0.07110362499952316,
-0.0783337727189064,
-0.07181979715824127,
-0.5606192350387573,
-0.23373156785964966,... |
func (p *Packet) AddByte(b uint8) *Packet {
p.Payload = append(p.Payload, b)
return p
} | [
-0.25500091910362244,
1.140224575996399,
0.5617895722389221,
0.05468883737921715,
0.09555238485336304,
0.9971433281898499,
-1.519360899925232,
-0.08146902173757553,
1.312744140625,
-1.0366429090499878,
0.3690377175807953,
0.12734505534172058,
-1.559415340423584,
-0.19045118987560272,
0.2... |
func (p *Packet) AddBytes(b []byte) *Packet {
p.Payload = append(p.Payload, b...)
return p
} | [
-0.4525124430656433,
1.367120623588562,
0.3171684443950653,
-0.5954486727714539,
0.22832860052585602,
0.48574572801589966,
-1.459761142730713,
0.13735957443714142,
0.6925547122955322,
-0.9924517273902893,
0.2332647293806076,
0.08925289660692215,
-0.9979733824729919,
0.21545372903347015,
... |
func (p *Packet) AddBits(value int, numBits int) *Packet {
bitmasks := []int32{0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff,
0x3fff, 0x7fff, 0xffff, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff,
0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1ffffff... | [
-0.3573336601257324,
0.13858965039253235,
0.9516479969024658,
-1.3235414028167725,
-0.5845128297805786,
0.4857134222984314,
-0.14925116300582886,
-1.1702220439910889,
0.4545416831970215,
-0.3035244643688202,
-0.31562358140945435,
0.21379275619983673,
-0.5052799582481384,
0.2576246857643127... |
func (c *Compiler) Compile(ctx context.Context, files ...string) (linker.Files, error) {
if len(files) == 0 {
return nil, nil
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()
par := c.MaxParallelism
if par <= 0 {
par = runtime.GOMAXPROCS(-1)
cpus := runtime.NumCPU()
if par > cpus {
par = cpus
... | [
-0.23587468266487122,
-0.10144905000925064,
0.8174436092376709,
0.8542827367782593,
0.5911632776260376,
-0.9551705121994019,
0.19096581637859344,
0.27384012937545776,
-0.9024882316589355,
-0.33266681432724,
0.14737612009048462,
-0.5375128388404846,
-0.2776023745536804,
0.9626337885856628,
... |
func TestBasicFunctionality(t *T) {
client := newClient()
queue := clients.RandQueueName()
events := []struct{ eventID, event string }{
{"0", "foo"},
{"1", "bar"},
{"2", "baz"},
{"3", "redo"},
}
for i := range events {
Dispatch(client, "qlpush", []string{queue, events[i].eventID, events[i].event})
rea... | [
0.268909215927124,
-0.15826484560966492,
0.8866226077079773,
-0.5332045555114746,
0.33868610858917236,
0.08201570063829422,
0.08377246558666229,
-0.44947460293769836,
0.7384089231491089,
-0.5459775328636169,
-0.16793173551559448,
0.09995917975902557,
0.025276079773902893,
-0.16167911887168... |
func TestQInfo(t *T) {
client := newClient()
// We register a queue to make sure at least one queue shows up in the
// results when doing a QINFO with no arguments
emptyQueue := clients.RandQueueName()
Dispatch(client, "qregister", []string{emptyQueue})
readAndAssertStr(t, client, "OK")
Dispatch(client, "qinfo"... | [
0.45240435004234314,
-0.4605351388454437,
0.6652466058731079,
-1.3496376276016235,
0.7823626399040222,
0.28721514344215393,
-0.40547943115234375,
-0.019178356975317,
0.12027084827423096,
-0.9121199250221252,
-0.2076479196548462,
0.262516051530838,
0.1909489929676056,
0.2844805419445038,
... |
func ReverseBytes(data []byte) {
for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 {
data[i], data[j] = data[j], data[i]
}
} | [
-0.7123865485191345,
0.6891011595726013,
0.3571570813655853,
-1.2570669651031494,
0.15735980868339539,
-0.38813745975494385,
0.16476066410541534,
1.0481992959976196,
-0.37453094124794006,
0.47263240814208984,
-0.5235399007797241,
0.779080331325531,
-1.5729997158050537,
-0.19085043668746948... |
func NewCliente(nombreDueno, telefono, correo string) *Cliente {
cliente := &Cliente{
NombreDueno: nombreDueno,
Telefono: telefono,
Correo: correo,
}
return cliente
} | [
1.0285056829452515,
-0.6630785465240479,
0.4178833067417145,
-0.8154269456863403,
-0.2405587136745453,
0.2692110240459442,
-1.2360010147094727,
-0.7560707926750183,
-1.0769093036651611,
-0.43424275517463684,
0.8732324838638306,
0.4541769027709961,
-0.6816090941429138,
-0.9714435935020447,
... |
func (c *Cliente) Save() error {
if c.IDDueno == 0 {
return c.create()
}
return c.update()
} | [
0.26126790046691895,
0.3455562889575958,
0.45389434695243835,
-0.23108263313770294,
0.9830068945884705,
0.1156468316912651,
0.7011008858680725,
0.08337070047855377,
-1.2608349323272705,
-0.07762912660837173,
-0.6949598789215088,
-0.8057102560997009,
-0.7617312669754028,
0.457134872674942,
... |
func (h *MaxHeap) Insert(key int) {
h.array = append(h.array, key)
h.heapifyUp()
} | [
-1.0969253778457642,
0.7980301976203918,
0.43590208888053894,
-0.21022793650627136,
-0.10021872073411942,
0.5898351073265076,
-0.47762855887413025,
0.5507012605667114,
-0.24723049998283386,
0.31865194439888,
-0.9184519648551941,
-0.6518073081970215,
-1.4209444522857666,
0.7092757225036621,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.