text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (h *HUOBI) QueryWithdrawQuotas(ctx context.Context, cryptocurrency string) (WithdrawQuota, error) {
resp := struct {
WithdrawQuota WithdrawQuota `json:"data"`
}{}
vals := url.Values{}
vals.Set("currency", cryptocurrency)
err := h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, huobiAc... | [
-0.5808732509613037,
0.09557344764471054,
0.4907476305961609,
-0.41318756341934204,
-0.1846698522567749,
-0.7081479430198669,
-1.0849353075027466,
-0.7503448128700256,
0.20043392479419708,
0.27091288566589355,
0.12362933903932571,
-0.027782225981354713,
-0.5910031795501709,
-0.680983304977... |
func (h *HUOBI) SearchForExistedWithdrawsAndDeposits(ctx context.Context, c currency.Code, transferType, direction string, fromID, limit int64) (WithdrawalHistory, error) {
var resp WithdrawalHistory
vals := url.Values{}
vals.Set("type", transferType)
if !c.IsEmpty() {
vals.Set("currency", c.Lower().String())
}
... | [
-0.39741337299346924,
0.6443593502044678,
0.5243985652923584,
-0.8790154457092285,
-0.20001080632209778,
0.21159088611602783,
-0.4844988286495209,
-0.11606995016336441,
0.6155667901039124,
-0.3667157292366028,
0.018479958176612854,
0.1369231641292572,
-0.0930485799908638,
0.277530759572982... |
func (h *HUOBI) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error {
endpoint, err := h.API.Endpoints.GetURL(ep)
if err != nil {
return err
}
var tempResp json.RawMessage
item := &request.Item{
Method: http.MethodGet,
Path: endpoint + path,
Result:... | [
-1.3275073766708374,
-0.21111850440502167,
1.0163962841033936,
0.07354775816202164,
0.02172773703932762,
-0.12390632927417755,
-0.22228948771953583,
-0.7540174126625061,
-0.03272885084152222,
0.9600235819816589,
-0.07912912964820862,
0.00007748083589831367,
-0.3237227201461792,
-0.14882588... |
func (h *HUOBI) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint string, values url.Values, data, result interface{}, isVersion2API bool) error {
var err error
creds, err := h.GetCredentials(ctx)
if err != nil {
return err
}
ePoint, err := h.API.Endpoints.GetURL(ep)
if err != ... | [
-1.2449314594268799,
-0.24590885639190674,
0.9241496920585632,
0.4627252519130707,
0.33858412504196167,
-0.023433879017829895,
-0.39980700612068176,
-0.709616482257843,
-0.33873412013053894,
1.0537210702896118,
-0.841911256313324,
-0.03132500499486923,
-0.006493056658655405,
0.133448407053... |
func (h *HUOBI) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error) {
var fee float64
if feeBuilder.FeeType == exchange.OfflineTradeFee || feeBuilder.FeeType == exchange.CryptocurrencyTradeFee {
fee = calculateTradingFee(feeBuilder.Pair, feeBuilder.PurchasePrice, feeBuilder.Amount)
}
if fee < 0 {
fee = 0
... | [
-0.15541234612464905,
1.258605718612671,
0.4593554437160492,
1.274685025215149,
0.6289018988609314,
-0.42648550868034363,
0.08361151814460754,
0.4885130524635315,
-0.1539449840784073,
-0.25245895981788635,
0.7543996572494507,
0.0034534421283751726,
-0.9844485521316528,
0.6216001510620117,
... |
func SetGaugeMetric(name string, help string, env string, envValue string, version string, versionValue string) (prometheusGauge prometheus.Gauge) {
var (
gaugeMetric = prometheus.NewGauge(prometheus.GaugeOpts{
Name: name,
Help: help,
ConstLabels: prometheus.Labels{env: envValue, version: vers... | [
-0.28070399165153503,
0.2439417988061905,
0.46345967054367065,
-0.19016021490097046,
-0.6643087267875671,
0.7174175977706909,
-0.7575380206108093,
-0.25972050428390503,
-1.761538028717041,
1.2303028106689453,
-0.3273622691631317,
0.3373558521270752,
-1.1151641607284546,
0.5819158554077148,... |
func AlphaCount(str string) int {
counter := 0
list := []byte(str)
for _, letter := range list {
if letter >= 65 && letter <= 90 || letter <= 122 && letter >= 97 {
counter++
}
}
return counter
} | [
0.26600658893585205,
-0.7857730388641357,
0.6667394638061523,
-0.6468932628631592,
-1.2807540893554688,
0.9689701795578003,
0.41312795877456665,
0.5246719121932983,
0.2756926417350769,
0.31465938687324524,
-0.4867967963218689,
0.4470103681087494,
-0.28027650713920593,
-0.15947185456752777,... |
func foo(c chan<- int) {
// high := 100
// for i := 0; i < high; i++ {
// c <- i
// }
c <- 10
} | [
-0.03253432735800743,
0.19195778667926788,
0.5594173073768616,
-0.6241442561149597,
0.9203965663909912,
0.045393284410238266,
0.7568865418434143,
-0.2791639566421509,
-1.1266447305679321,
-0.15540596842765808,
-1.3422677516937256,
0.747791051864624,
0.1543869823217392,
0.6050309538841248,
... |
func (l AdaptiveNetworkHardeningsEnforcePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AdaptiveNetworkHardeningsEnforceResponse, error) {
respType := AdaptiveNetworkHardeningsEnforceResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
r... | [
-0.26446038484573364,
0.5003687143325806,
0.36843883991241455,
0.23344263434410095,
0.375308096408844,
0.6839340329170227,
-0.33002862334251404,
-1.4182548522949219,
0.676925003528595,
0.38840052485466003,
-0.07675763219594955,
-1.2732313871383667,
-0.8704137802124023,
0.6642063856124878,
... |
func (l *AdaptiveNetworkHardeningsEnforcePollerResponse) Resume(ctx context.Context, client *AdaptiveNetworkHardeningsClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("AdaptiveNetworkHardeningsClient.Enforce", token, client.pl, client.enforceHandleError)
if err != nil {
return err
}
po... | [
0.9513298273086548,
0.3050467371940613,
0.5064669847488403,
-0.6280805468559265,
0.313690185546875,
0.23333007097244263,
-0.4573959708213806,
-1.0796427726745605,
0.3241724669933319,
-0.013787536881864071,
-0.3770407438278198,
-0.344497948884964,
-1.2441961765289307,
-0.5150087475776672,
... |
func (l AlertsSimulatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AlertsSimulateResponse, error) {
respType := AlertsSimulateResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, err
}
respType.RawResponse = resp
return respType, nil
} | [
-0.5157915949821472,
0.5559526085853577,
0.48758453130722046,
0.29457277059555054,
0.08481806516647339,
0.8116393089294434,
0.09726342558860779,
-0.8256876468658447,
0.5582501888275146,
0.5850467085838318,
-0.013815316371619701,
-0.5016379952430725,
-0.7320085167884827,
0.3946777880191803,... |
func (l *AlertsSimulatePollerResponse) Resume(ctx context.Context, client *AlertsClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("AlertsClient.Simulate", token, client.pl, client.simulateHandleError)
if err != nil {
return err
}
poller := &AlertsSimulatePoller{
pt: pt,
}
resp, err... | [
0.848236083984375,
0.18245914578437805,
0.5654287338256836,
-0.4502306878566742,
-0.041124988347291946,
0.1631116420030594,
-0.1227937564253807,
-0.5041231513023376,
0.3950762450695038,
0.16500158607959747,
-0.1509784311056137,
0.5978087782859802,
-0.9639551639556885,
-1.2725012302398682,
... |
func (l ServerVulnerabilityAssessmentDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerVulnerabilityAssessmentDeleteResponse, error) {
respType := ServerVulnerabilityAssessmentDeleteResponse{}
resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)
if err != nil {
return respType, ... | [
-0.7768965363502502,
0.129935622215271,
0.5103800892829895,
-0.11356470733880997,
0.2011691778898239,
0.8582519888877869,
0.27763667702674866,
-0.9585392475128174,
1.105837106704712,
0.5481981039047241,
0.5146207213401794,
-0.4175178110599518,
-0.980331301689148,
0.4238991141319275,
0.50... |
func (l *ServerVulnerabilityAssessmentDeletePollerResponse) Resume(ctx context.Context, client *ServerVulnerabilityAssessmentClient, token string) error {
pt, err := armruntime.NewPollerFromResumeToken("ServerVulnerabilityAssessmentClient.Delete", token, client.pl, client.deleteHandleError)
if err != nil {
return e... | [
0.26716408133506775,
-0.6199677586555481,
0.4279772937297821,
-0.5539554357528687,
-0.0472080335021019,
0.24043680727481842,
0.14645817875862122,
-0.382494181394577,
0.8098539113998413,
0.2698245346546173,
0.2884885370731354,
0.4619542062282562,
-1.1807769536972046,
-0.7796544432640076,
... |
func (s *SettingsGetResult) UnmarshalJSON(data []byte) error {
res, err := unmarshalSettingClassification(data)
if err != nil {
return err
}
s.SettingClassification = res
return nil
} | [
-1.064408779144287,
1.02665376663208,
0.07446786761283875,
-0.5734353065490723,
0.142425075173378,
-0.8261463642120361,
0.5859965085983276,
-0.426641047000885,
-0.3239729404449463,
0.6936541795730591,
-0.6033475399017334,
-0.22248972952365875,
-0.30325204133987427,
0.16180410981178284,
0... |
func (s *SettingsUpdateResult) UnmarshalJSON(data []byte) error {
res, err := unmarshalSettingClassification(data)
if err != nil {
return err
}
s.SettingClassification = res
return nil
} | [
-1.564141035079956,
0.7073360085487366,
0.060267094522714615,
-0.3239203691482544,
-0.904155433177948,
-0.4923410415649414,
0.45256778597831726,
-0.30590108036994934,
-0.13045470416545868,
1.1418942213058472,
-0.7285672426223755,
-0.6161669492721558,
-0.21331819891929626,
0.032891780138015... |
func TestActivation(t *testing.T) {
mockclock := clock.NewMock()
setClock(mockclock) // replace clock with mock for speedy testing
now := mockclock.Now()
reset()
p, _ := New("Promo1", now.Add(1*time.Hour), now.Add(24*time.Hour))
runtime.Gosched()
if res := p.AllowDisplay(ip); res != false {
t.Errorf("Bad Pr... | [
-0.11620727181434631,
0.45255520939826965,
0.5895094275474548,
0.6145035624504089,
-0.2512514293193817,
0.8757568597793579,
1.2582067251205444,
0.5807957649230957,
-0.04243619367480278,
0.1791679561138153,
0.27129802107810974,
0.9340861439704895,
-0.5124087929725647,
-0.15239207446575165,
... |
func TestExpiration(t *testing.T) {
mockclock := clock.NewMock()
setClock(mockclock) // replace clock with mock for speedy testing
now := mockclock.Now()
reset()
p, _ := New("Promo1", now, now.Add(1*time.Hour))
runtime.Gosched()
if res := p.AllowDisplay(ip); res != true {
t.Errorf("Bad Promo status, got: %v... | [
0.4358471632003784,
0.773658275604248,
0.6468634009361267,
0.46531686186790466,
-0.4267188310623169,
1.0711051225662231,
0.6102727651596069,
0.18373645842075348,
0.14717286825180054,
0.46244001388549805,
0.31187403202056885,
0.3436918258666992,
-0.39362800121307373,
0.525335967540741,
0.... |
func TestPreExpired(t *testing.T) {
var tm time.Time // initial value is in the past
reset()
p, _ := New("Promo1", tm, tm)
if res := p.AllowDisplay(ip); res != false {
t.Errorf("Bad Promo status, got: %v want %v", res, false)
}
} | [
0.5172628164291382,
0.7975241541862488,
0.6361807584762573,
0.7434619665145874,
-0.4250800311565399,
1.0624157190322876,
-0.08567441999912262,
-0.15155689418315887,
0.12879827618598938,
-0.03078000433743,
-0.05796577036380768,
0.3893313407897949,
-0.4095197021961212,
0.006455141585320234,
... |
func Callback(cbReq *CallbackRequest, opts *CallbackOptions) error {
client := opts.Client
if client == nil {
client = http.DefaultClient
}
buf := bytes.NewBuffer(nil)
err := json.NewEncoder(buf).Encode(cbReq)
if err != nil {
return err
}
signature, err := opts.Signer.Sign(buf.Bytes())
if err != nil {
re... | [
-0.3689378798007965,
0.6726491451263428,
0.7597562670707703,
-0.3243214786052704,
-0.1696477085351944,
0.48697108030319214,
0.06444413214921951,
-0.1576487272977829,
0.37751683592796326,
0.6451809406280518,
0.592219889163971,
0.2335338443517685,
-0.9244124889373779,
-0.12085585296154022,
... |
func addIndexes() {
var err error
ufIndex1 := mgo.Index{
Key: []string{"codigo"},
Unique: true,
Background: true,
Sparse: true,
}
municipioIndex1 := mgo.Index{
Key: []string{"codigo"},
Unique: true,
Background: true,
Sparse: true,
}
// Add indexes into MongoDB
sessi... | [
-0.24462206661701202,
0.6955175399780273,
0.7326361536979675,
0.2584078311920166,
0.5750495195388794,
1.257485032081604,
0.5447232127189636,
1.086749792098999,
-0.37944552302360535,
-0.16300353407859802,
-0.3026871383190155,
0.2183907926082611,
0.027834434062242508,
0.17404921352863312,
... |
func (ds *DataStore) Close() {
ds.MongoSession.Close()
} | [
0.12366180866956711,
0.17971551418304443,
0.060114458203315735,
-0.7520348429679871,
-0.28157734870910645,
0.2230076640844345,
-0.25830644369125366,
-0.4118209779262543,
0.6422439813613892,
-0.2688538134098053,
0.16841992735862732,
0.6278975009918213,
-0.020686298608779907,
0.9170317649841... |
func (ds *DataStore) Collection(name string) *mgo.Collection {
return ds.MongoSession.DB(commons.AppConfig.Database).C(name)
} | [
-0.14703617990016937,
-0.2342528998851776,
0.3490508794784546,
-0.5542347431182861,
-0.6409503817558289,
-0.20961861312389374,
-0.47353312373161316,
-0.46955618262290955,
0.020567018538713455,
0.7345253229141235,
-0.6027682423591614,
0.1465110331773758,
0.7831049561500549,
0.58355808258056... |
func NewDataStore() *DataStore {
session := Session.Copy()
dataStore := &DataStore{
MongoSession: session,
}
return dataStore
} | [
0.5950717926025391,
-0.9948139190673828,
-0.07975351065397263,
-0.360727459192276,
-1.2804374694824219,
-0.15983374416828156,
-1.2608104944229126,
-0.32855480909347534,
1.4682081937789917,
-0.49886807799339294,
-0.5664387941360474,
0.7487437725067139,
-0.07135597616434097,
0.23368300497531... |
func InitDB(pgConf *config.PostgresConf) (Datastore, error) {
dbDSN := fmt.Sprintf("postgres://%s@%s:%d/%s?sslmode=disable", pgConf.DBUser, pgConf.DBServer, pgConf.DBPort, pgConf.DBName)
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dbDSN}), &gorm.Config{NamingStrategy: schema.NamingStrategy{SingularTable:... | [
0.27030864357948303,
0.8209707140922546,
0.546177327632904,
0.49375906586647034,
-0.5547080636024475,
0.7569678425788879,
0.008333064615726471,
0.7430244088172913,
-0.27842625975608826,
0.025166602805256844,
0.6612647175788879,
0.8567125797271729,
-0.7047093510627747,
0.5238217115402222,
... |
func (db *Database) CreateDBTable() error {
if err := db.DbConn.AutoMigrate(&models.Holiday{}); err != nil {
return err
}
if err := db.DbConn.AutoMigrate(&models.BSE_BHAV{}); err != nil {
return err
}
if err := db.DbConn.AutoMigrate(&models.Order{}); err != nil {
return err
}
return nil
} | [
0.5147956609725952,
0.585334062576294,
0.9264651536941528,
1.4067949056625366,
1.1786750555038452,
0.8981480002403259,
0.4477953314781189,
-0.6937599182128906,
-0.919301450252533,
-0.3132414221763611,
-0.9577485918998718,
-0.4540169835090637,
0.15274740755558014,
1.3573081493377686,
0.26... |
func NewAccessTokenHandlerFactory(userIDFactory UserIDFactory) middleware.AccessTokenHandlerFactory {
return &accessTokenHandlerFactory{
userIDFactory: userIDFactory,
}
} | [
0.389072984457016,
-0.8718464374542236,
0.06267242878675461,
-0.12566900253295898,
-1.52666437625885,
0.4990084767341614,
0.14835014939308167,
0.6482653021812439,
-0.16408437490463257,
-0.5971782803535461,
0.27038466930389404,
0.9006953835487366,
0.7324231266975403,
-0.2657383680343628,
... |
func setStyle(style string, c *clif.Cli) {
switch style {
case "sunburn":
if c != nil {
c.Output().SetFormatter(clif.NewDefaultFormatter(clif.SunburnStyles))
}
clif.DefaultStyles = clif.SunburnStyles
case "winter":
if c != nil {
c.Output().SetFormatter(clif.NewDefaultFormatter(clif.WinterStyles))
}
... | [
-0.06532922387123108,
-0.0961526408791542,
0.38382211327552795,
1.0107221603393555,
0.48532184958457947,
-0.295500785112381,
-0.43747246265411377,
0.06498730927705765,
-0.5511062145233154,
0.020885394886136055,
0.36039507389068604,
0.2774507999420166,
-0.8004422783851624,
0.859634816646575... |
func TestMockValidity(t *testing.T) {
nr := 50
_, hlp := agreement.WireAgreement(nr)
hash, _ := crypto.RandEntropy(32)
handler := agreement.NewHandler(hlp.Keys[0], *hlp.P)
for i := 0; i < nr; i++ {
a := message.MockAgreement(hash, 1, 3, hlp.Keys, hlp.P, i)
if !assert.NoError(t, handler.Verify(a)) {
t.FailN... | [
-0.334288090467453,
0.5510889887809753,
0.6290289759635925,
0.7905712127685547,
1.405449390411377,
1.2044678926467896,
0.12110939621925354,
0.6954355835914612,
-0.6628881096839905,
0.07100550085306168,
-0.12491343915462494,
-0.9852437376976013,
-1.6145830154418945,
0.6089670062065125,
0.... |
func TestAgreement(t *testing.T) {
nr := 50
_, hlp := agreement.WireAgreement(nr)
hash, _ := crypto.RandEntropy(32)
for i := 0; i < nr; i++ {
a := message.MockAgreement(hash, 1, 3, hlp.Keys, hlp.P, i)
msg := message.New(topics.Agreement, a)
hlp.Bus.Publish(topics.Agreement, msg)
}
res := <-hlp.CertificateC... | [
0.2753876745700836,
0.12948831915855408,
0.4861758053302765,
0.1985815018415451,
0.5229448080062866,
0.6265156865119934,
0.22197666764259338,
0.205961212515831,
-0.7501671314239502,
0.7118149995803833,
-0.36808839440345764,
-0.5818228125572205,
-1.5307022333145142,
0.8612360954284668,
0.... |
func TestFinalize(t *testing.T) {
numGRBefore := runtime.NumGoroutine()
// Create a set of 100 agreement components, and finalize them immediately
for i := 0; i < 100; i++ {
c, _ := agreement.WireAgreement(50)
c.FinalizeRound()
}
// Ensure we have freed up all of the resources associated with these components... | [
-0.21294046938419342,
0.7554903626441956,
0.5405882596969604,
-0.7216277718544006,
0.7548924684524536,
0.0009569948306307197,
0.302128404378891,
-0.23344603180885315,
-0.1389722228050232,
0.1823054403066635,
-0.12285096198320389,
-0.2596842348575592,
-1.1760480403900146,
0.8722115755081177... |
func (v Repository) GitCommonDir() string {
return v.gitCommonDir
} | [
0.4777659773826599,
-0.41322657465934753,
0.26960092782974243,
-0.931722104549408,
-0.016305338591337204,
1.1661295890808105,
0.8367569446563721,
-0.6020697355270386,
0.12165521085262299,
0.26944220066070557,
0.8278998136520386,
0.23788902163505554,
-0.5040328502655029,
0.6293423771858215,... |
func (v Repository) IsBare() bool {
return v.workDir == ""
} | [
-0.28347617387771606,
0.5747743844985962,
0.28142058849334717,
0.26122966408729553,
1.080438256263733,
-0.13297590613365173,
-0.08037563413381577,
-0.1621457189321518,
-0.02874332293868065,
-0.3691648840904236,
0.05517314746975899,
0.629776656627655,
-1.7550143003463745,
0.8577597737312317... |
func (v Repository) Config() GitConfig {
return v.gitConfig
} | [
0.7778509855270386,
0.080928735435009,
0.04045816883444786,
-0.5126439332962036,
0.029110770672559738,
0.3612324893474579,
0.10751917213201523,
0.9873617887496948,
-0.1268148124217987,
0.24536152184009552,
-0.23172014951705933,
0.5014882683753967,
0.14222702383995056,
0.6258330941200256,
... |
func FindRepository(dir string) (*Repository, error) {
var (
gitDir string
commonDir string
workDir string
gitConfig GitConfig
err error
)
gitDir, err = findGitDir(dir)
if err != nil {
return nil, err
}
commonDir, err = getGitCommonDir(gitDir)
if err != nil {
return nil, err
}
gitConf... | [
0.038368258625268936,
-0.05086628720164299,
0.4636033773422241,
-0.526780903339386,
-0.1220974326133728,
-0.3811441957950592,
0.8311697244644165,
-0.5071925520896912,
0.1262454241514206,
0.156538724899292,
0.22215494513511658,
-0.5405402183532715,
-1.0507926940917969,
1.450494408607483,
... |
func CheckSemanticTitle(pr *gogh.PullRequest, config PluginConfiguration, logger log.Logger) string {
change := ghservice.NewRepositoryChangeForPR(pr)
prefixes := GetValidTitlePrefixes(config)
isTitleWithValidType := HasTitleWithValidType(prefixes, *pr.Title)
if !isTitleWithValidType {
if prefix, ok := wip.GetWo... | [
-0.6730344295501709,
-0.5318624377250671,
0.6471642255783081,
0.11151611804962158,
-0.33976122736930847,
-0.017509229481220245,
-1.1004666090011597,
-0.799376904964447,
0.49434494972229004,
1.1210538148880005,
0.5014792680740356,
0.018444880843162537,
-0.9568037390708923,
0.865781009197235... |
func CheckDescriptionLength(pr *gogh.PullRequest, config PluginConfiguration, logger log.Logger) string {
actualLength := len(strings.TrimSpace(issueLinkRegexp.ReplaceAllString(pr.GetBody(), "")))
if actualLength < config.DescriptionContentLength {
return fmt.Sprintf(DescriptionLengthShortMessage, config.Descriptio... | [
1.0325345993041992,
0.12348541617393494,
0.32328009605407715,
-0.8160406351089478,
0.5524146556854248,
0.5678550004959106,
-0.30889981985092163,
0.09931561350822449,
0.3920842707157135,
0.346468985080719,
0.7979893684387207,
0.35687902569770813,
-0.8287239074707031,
0.9549757242202759,
0... |
func CheckIssueLinkPresence(pr *gogh.PullRequest, config PluginConfiguration, logger log.Logger) string {
if !issueLinkRegexp.MatchString(pr.GetBody()) {
return IssueLinkMissingMessage
}
return ""
} | [
-0.821928858757019,
-0.7158767580986023,
0.4082963168621063,
-0.36493828892707825,
0.6290454268455505,
0.6601325869560242,
-0.0014719963073730469,
0.8864008784294128,
0.4842624068260193,
0.4264586269855499,
0.5619825124740601,
-0.405065655708313,
-0.8046586513519287,
0.5943637490272522,
... |
func GetValidTitlePrefixes(config PluginConfiguration) []string {
prefixes := defaultTypes
if len(config.TypePrefix) != 0 {
if config.Combine {
prefixes = append(prefixes, config.TypePrefix...)
} else {
prefixes = config.TypePrefix
}
}
return prefixes
} | [
-0.783357560634613,
-0.7055255770683289,
0.5963051319122314,
0.48136553168296814,
0.4710924029350281,
0.2724872827529907,
-1.268286943435669,
-0.16390278935432434,
0.5136721134185791,
1.0121674537658691,
-0.6399165391921997,
0.3990890383720398,
-1.0078165531158447,
0.441253662109375,
0.8... |
func HasTitleWithValidType(prefixes []string, title string) bool {
pureTitle := strings.TrimSpace(title)
for _, prefix := range prefixes {
prefixRegexp := regexp.MustCompile(`(?i)^` + prefix + `(:| |\()+`)
if prefixRegexp.MatchString(pureTitle) {
return true
}
}
return false
} | [
-0.14504361152648926,
-0.6620477437973022,
0.7851961851119995,
0.5360478162765503,
-0.5165587067604065,
0.07946974784135818,
-1.4604216814041138,
0.4692937731742859,
0.012856217101216316,
0.09838531911373138,
-0.025382936000823975,
-0.11135931313037872,
-0.5323364734649658,
0.4204831719398... |
func CountCSVRowsGo(source string) (int, error) {
defer un(trace("CountCSVRowsGo"))
err := assertValidFilename(source)
if err != nil {
return 0, err
}
f, _ := os.Open(source)
r := csv.NewReader(bufio.NewReader(f))
rowCount := 0
for {
_, err := r.Re... | [
0.2342282235622406,
0.43136608600616455,
0.8040366768836975,
-0.25295403599739075,
-0.6923923492431641,
0.07561348378658295,
0.6177040338516235,
0.9692577123641968,
-0.6661543846130371,
0.6050950288772583,
-0.5339834690093994,
0.1820705533027649,
0.43506696820259094,
1.182090163230896,
0... |
func TestService(t *testing.T) {
// Create service to test
s := res.NewService("foo")
s.Handle("bar.$id",
res.Access(res.AccessGranted),
res.GetModel(func(r res.ModelRequest) {
r.Model(struct {
Message string `json:"msg"`
}{r.PathParam("id")})
}),
)
// Create test session
c := restest.NewSession(... | [
0.15922307968139648,
-0.4866762161254883,
0.49622079730033875,
-0.17081202566623688,
1.1529510021209717,
0.5527244806289673,
0.2752990424633026,
-1.3642741441726685,
0.1728370487689972,
-1.4920365810394287,
-0.40217575430870056,
0.07544657588005066,
-0.6418355703353882,
-0.2667163610458374... |
func TestServiceProtocolVersion(t *testing.T) {
s := res.NewService("test")
restest.AssertEqualJSON(t, "ProtocolVersion()", s.ProtocolVersion(), "1.2.2")
} | [
-0.06234196573495865,
-0.7514484524726868,
0.23434710502624512,
0.3964245617389679,
-0.07116416096687317,
0.7618854641914368,
0.009104038588702679,
-0.8821438550949097,
0.07920143753290176,
-0.09918368607759476,
-1.4106266498565674,
0.19038709998130798,
-1.2999242544174194,
-0.112137064337... |
func TestServiceStart(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, nil)
} | [
0.006948857102543116,
-0.44709306955337524,
0.3594363033771515,
-0.5549024343490601,
0.8020444512367249,
0.767874002456665,
0.1917455941438675,
-0.6107053756713867,
-0.0049159228801727295,
-0.8865059614181519,
-0.47113820910453796,
-0.020460305735468864,
-0.30507412552833557,
0.04986239597... |
func TestServiceWithoutLogger(t *testing.T) {
s := res.NewService("test")
s.SetLogger(nil)
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
session := restest.NewSession(t, s, restest.WithKeepLogger)
defer session.Close()
} | [
-0.17143313586711884,
-0.6699411869049072,
0.5832776427268982,
-0.33026158809661865,
-0.06554172188043594,
-0.05207443982362747,
0.2938958406448364,
-1.5051182508468628,
0.7016123533248901,
-0.9088453650474548,
-0.7037795186042786,
0.02153286710381508,
-0.06251797080039978,
0.5799685120582... |
func TestServiceSetLogger(t *testing.T) {
s := res.NewService("test")
l := logger.NewMemLogger()
s.SetLogger(l)
if s.Logger() != l {
t.Errorf("expected Logger to return the logger passed to SetLogger, but it didn't")
}
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
session := rest... | [
0.07234553247690201,
-0.1546020358800888,
0.4619216024875641,
-0.653313934803009,
-0.19020569324493408,
-0.33449816703796387,
0.14345526695251465,
-1.0679752826690674,
0.8780568242073059,
-0.6376012563705444,
-0.7294034361839294,
0.0282547939568758,
-0.5846879482269287,
0.8439913392066956,... |
func TestServiceWith_WithoutMatchingPattern(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("collection", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
err := s.Service().With("test.model", func(r res.Resource) {})
if err == nil {
t.Errorf("expected With t... | [
-0.04459608346223831,
-0.6691703796386719,
0.6289002299308777,
-0.3592936098575592,
0.06189420819282532,
0.9482313990592957,
0.3369312286376953,
-1.020547866821289,
0.5573347806930542,
-0.8040642738342285,
-0.6975628733634949,
-0.19311796128749847,
-0.41697824001312256,
0.21422968804836273... |
func TestServiceSetOwnedResources(t *testing.T) {
resources := []string{"test.foo.>", "test.bar.>"}
access := []string{"test.zoo.>", "test.baz.>"}
runTest(t, func(s *res.Service) {
s.SetOwnedResources(resources, access)
}, nil, restest.WithReset(resources, access))
} | [
0.2623600363731384,
-0.34249478578567505,
0.37657520174980164,
-0.3352682888507843,
0.1625584214925766,
-0.6604937314987183,
0.9090782403945923,
-0.7207826375961304,
0.363547146320343,
-0.5497555136680603,
-0.2960430085659027,
0.4234309494495392,
-0.3516758978366852,
-0.042573973536491394,... |
func TestServiceTokenEvent_WithObjectToken_SendsToken(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
s.Service().TokenEvent(mock.CID, mock.Token)
s.GetMsg().AssertTokenEvent(mock.CID, mock.Token)
})
} | [
0.24675963819026947,
-0.6264541149139404,
0.6533868908882141,
-0.06256720423698425,
0.3783145546913147,
0.08384521305561066,
-0.051076408475637436,
-0.7109253406524658,
0.15348994731903076,
-0.4644654095172882,
-1.488181233406067,
0.45980900526046753,
0.47886574268341064,
-0.01439116802066... |
func TestServiceTokenEvent_WithNilToken_SendsNilToken(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
s.Service().TokenEvent(mock.CID, nil)
s.GetMsg().AssertTokenEvent(mock.CID, nil)
})
} | [
1.0649957656860352,
-0.45953652262687683,
0.5275788903236389,
-0.2481701374053955,
0.10514871031045914,
-0.2325456738471985,
-0.1525277942419052,
-0.8704068660736084,
0.13102899491786957,
-0.8080446720123291,
-1.2076064348220825,
0.5181096196174622,
0.3187466561794281,
0.5048913359642029,
... |
func TestServiceTokenEventWithID_WithInvalidCID_CausesPanic(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
restest.AssertPanic(t, func() {
s.Service().TokenEventWithID("invalid.*.cid", "foo", nil)
})
... | [
1.4151785373687744,
-0.7412011623382568,
0.3772953152656555,
-0.032403893768787384,
-0.7180742025375366,
0.3531738817691803,
-0.6268985867500305,
-0.848187267780304,
-0.03917832300066948,
-0.7023674845695496,
-0.8083148002624512,
0.3532930016517639,
-0.6741301417350769,
-0.1428931802511215... |
func TestServiceTokenEventWithID_WithObjectToken_SendsToken(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
s.Service().TokenEventWithID(mock.CID, "foo", mock.Token)
s.GetMsg().AssertTokenEventWithID(mock... | [
0.2927912473678589,
-0.7999197840690613,
0.6112907528877258,
-0.06764350831508636,
0.2273213118314743,
-0.017820818349719048,
-0.3084165155887604,
-0.9367724657058716,
0.11567667126655579,
-0.4767179787158966,
-1.580078125,
0.2874584496021271,
0.3958931267261505,
0.03299934044480324,
0.2... |
func TestServiceTokenEventWithID_WithNilToken_SendsNilToken(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
s.Service().TokenEventWithID(mock.CID, "foo", nil)
s.GetMsg().AssertTokenEventWithID(mock.CID, "... | [
1.1115195751190186,
-0.6714092493057251,
0.5127049684524536,
-0.18953701853752136,
-0.0755053162574768,
-0.32339733839035034,
-0.3930363059043884,
-1.083781361579895,
0.1617148220539093,
-0.6647435426712036,
-1.3182777166366577,
0.3899230360984802,
0.24625654518604279,
0.5236092805862427,
... |
func TestServiceTokenEvent_WithInvalidCID_CausesPanic(t *testing.T) {
runTest(t, func(s *res.Service) {
s.Handle("model", res.GetResource(func(r res.GetRequest) { r.NotFound() }))
}, func(s *restest.Session) {
restest.AssertPanic(t, func() {
s.Service().TokenEvent("invalid.*.cid", nil)
})
})
} | [
1.3822885751724243,
-0.6768325567245483,
0.37857264280319214,
-0.0811951532959938,
-0.5406448245048523,
0.41114044189453125,
-0.4729665517807007,
-0.509505033493042,
0.06598705798387527,
-0.8867217302322388,
-0.7205213904380798,
0.3712829649448395,
-0.5854509472846985,
-0.14792096614837646... |
func TestServiceReset(t *testing.T) {
tbl := []struct {
Resources []string
Access []string
Expected interface{}
}{
{nil, nil, nil},
{[]string{}, nil, nil},
{nil, []string{}, nil},
{[]string{}, []string{}, nil},
{[]string{"test.foo.>"}, nil, json.RawMessage(`{"resources":["test.foo.>"]}`)},
{nil... | [
-0.010162247344851494,
0.35881075263023376,
0.8476427793502808,
-0.8211565017700195,
0.8257617950439453,
-0.37947362661361694,
0.4121869206428528,
-1.1209523677825928,
-0.5383674502372742,
0.01607785001397133,
-0.3739737868309021,
0.33252885937690735,
-0.29201433062553406,
0.40193513035774... |
func TestServiceTokenReset(t *testing.T) {
tbl := []struct {
Subject string
TIDs []string
Expected interface{}
}{
{"auth", nil, nil},
{"auth", []string{}, nil},
{"auth", []string{"foo"}, json.RawMessage(`{"tids":["foo"],"subject":"auth"}`)},
{"auth", []string{"foo", "bar"}, json.RawMessage(`{"tids"... | [
-0.06878378242254257,
0.22846606373786926,
0.44716766476631165,
-0.7440188527107239,
0.35514622926712036,
-0.4454426169395447,
0.1067749410867691,
-1.1417109966278076,
-0.45821359753608704,
-0.05593171343207359,
-0.5965259075164795,
1.1506617069244385,
-0.24144883453845978,
0.0746331512928... |
func FFT(in []int, phases int) []int {
b := make([]int, len(in))
for n := range in {
b[n] = FFTdigit(in, n, phases)
}
return b
} | [
-0.6856396198272705,
0.34665364027023315,
0.3703252375125885,
-0.44040119647979736,
-0.10540202260017395,
-0.306197851896286,
0.1202743723988533,
-0.38836660981178284,
0.41688066720962524,
0.16924698650836945,
-0.9793086647987366,
-0.605442464351654,
-0.4721657335758209,
0.5895277857780457... |
func IsAMPCustomElement(n *html.Node) bool {
return n.Type == html.ElementNode && strings.HasPrefix(n.Data, "amp-")
} | [
-0.0633438229560852,
-0.3804008364677429,
0.3381221294403076,
-0.12193002551794052,
-0.7108123302459717,
0.20404848456382751,
-0.060311459004879,
-0.600462794303894,
1.5107109546661377,
0.3470984101295471,
0.06690769642591476,
1.9840412139892578,
0.6193134784698486,
0.8891279101371765,
-... |
func AMPExtensionScriptDefinition(n *html.Node) (string, bool) {
if n.DataAtom != atom.Script {
return "", false
}
src, hasSrc := htmlnode.GetAttributeVal(n, "", "src")
if hasSrc {
m := srcURLRE.FindStringSubmatch(src)
if len(m) < 2 {
return src, true
}
return m[1], true
}
return "", false
} | [
-0.16833007335662842,
0.2729298770427704,
0.5879838466644287,
-0.8021578192710876,
-0.9724056720733643,
-1.1679023504257202,
-0.03593682497739792,
-0.41136646270751953,
0.4529232084751129,
0.883167564868927,
-0.3443067967891693,
0.6041707992553711,
0.48288556933403015,
0.6880173087120056,
... |
func AMPExtensionName(n *html.Node) (string, bool) {
if n.DataAtom != atom.Script {
return "", false
}
for _, attr := range n.Attr {
for _, k := range []string{AMPCustomElement, AMPCustomTemplate, AMPHostService} {
if attr.Key == k {
return attr.Val, true
}
}
}
return "", false
} | [
-0.4638688266277313,
0.02360118180513382,
0.6184269785881042,
0.11949194222688675,
-1.8477338552474976,
-0.9256777167320251,
-0.6697620153427124,
-0.26542893052101135,
0.2899668216705322,
1.2648346424102783,
-0.45898914337158203,
0.45832282304763794,
0.16158469021320343,
0.5261646509170532... |
func IsScriptAMPExtension(n *html.Node) bool {
_, ok := AMPExtensionName(n)
return ok
} | [
-0.6203062534332275,
-0.012508204206824303,
0.48934972286224365,
0.5243450403213501,
-1.3201936483383179,
-1.0022366046905518,
-0.3022667467594147,
-0.6052907705307007,
2.0497119426727295,
1.3864861726760864,
-1.199069619178772,
0.887302577495575,
0.2871324121952057,
0.6817837953567505,
... |
func IsScriptAMPRuntime(n *html.Node) bool {
if n.DataAtom != atom.Script {
return false
}
if v, ok := htmlnode.GetAttributeVal(n, "", "src"); ok {
return htmlnode.HasAttribute(n, "", "async") &&
!IsScriptAMPExtension(n) &&
strings.HasPrefix(v, AMPCacheRootURL) &&
(strings.HasSuffix(v, "/v0.js") ||
... | [
-0.8773647546768188,
-0.47285640239715576,
0.6243360638618469,
-0.0005867262370884418,
-0.8446525931358337,
-0.8850899338722229,
-0.195038840174675,
-0.4560953378677368,
0.9298181533813477,
0.8536054491996765,
0.13555249571800232,
0.9287180304527283,
-0.25374653935432434,
1.386120200157165... |
func IsScriptAMPViewer(n *html.Node) bool {
if n.DataAtom != atom.Script {
return false
}
a, ok := htmlnode.FindAttribute(n, "", "src")
return ok &&
!IsScriptAMPExtension(n) &&
strings.HasPrefix(a.Val,
AMPCacheSchemeAndHost+"/v0/amp-viewer-integration-") &&
strings.HasSuffix(a.Val, ".js") &&
htmlnode.H... | [
-0.8613089919090271,
0.29053807258605957,
0.5112242102622986,
0.06582381576299667,
-1.1305392980575562,
-1.1627898216247559,
0.23562324047088623,
-0.7536294460296631,
0.9338254332542419,
0.4547519385814667,
0.1636582612991333,
0.9618304967880249,
0.3014713525772095,
1.653964877128601,
0.... |
func IsScriptRenderDelaying(n *html.Node) bool {
if n.DataAtom != atom.Script {
return false
}
if IsScriptAMPViewer(n) {
return true
}
if v, ok := htmlnode.GetAttributeVal(n, "", AMPCustomElement); ok {
// TODO(b/77581738): Remove amp-story from this list.
return (v == AMPDynamicCSSClasses ||
v == AMPEx... | [
-0.5409446954727173,
0.10104351490736008,
0.5108650326728821,
-0.3421272933483124,
-0.7433235049247742,
-0.856249988079071,
0.19145028293132782,
-0.34964242577552795,
0.6030599474906921,
-0.4214814007282257,
-0.0012054399121552706,
0.6242625117301941,
0.2759714722633362,
0.8593743443489075... |
func NewDOM(n *html.Node) (*DOM, error) {
var ok bool
d := &DOM{RootNode: n}
if d.HTMLNode, ok = htmlnode.FindNode(n, atom.Html); !ok {
return d, errors.New("missing <html> node")
}
if d.HeadNode, ok = htmlnode.FindNode(d.HTMLNode, atom.Head); !ok {
return d, errors.New("missing <head> node")
}
if d.BodyNode... | [
-0.3169257938861847,
0.6988497972488403,
0.8406109809875488,
0.18308201432228088,
-0.8109544515609741,
-0.05652661621570587,
-0.30761969089508057,
-0.6010953187942505,
0.03212951123714447,
-0.6568354368209839,
0.23431892693042755,
0.788202166557312,
0.607519268989563,
0.7187167406082153,
... |
func InitStudentsSubscriptionsHandler(r *atreugo.Router, s *service.Service) {
r.GET("/", getAllStudentsSubscriptions(s))
} | [
0.15974345803260803,
-0.45867085456848145,
0.3626469373703003,
0.5131626129150391,
-0.6939775347709656,
-0.3322650194168091,
0.07831021398305893,
0.39794284105300903,
-0.3448818027973175,
0.12560103833675385,
-0.693733811378479,
0.6347644925117493,
0.38190004229545593,
0.25048473477363586,... |
func getLocaleUpdate(localeId string) (map[string]interface{}, error) {
resp := map[string]interface{}{}
entities, err := model.GetEntitiesAtLocale(localeId)
if err != nil {
return resp, fmt.Errorf("error retrieving entities to broadcast for locale %v: %v", localeId, err)
}
resp["entities"] = entities
if err ... | [
-0.43789228796958923,
-0.5725213885307312,
0.7391855120658875,
-1.1227768659591675,
-0.0010446870001032948,
-0.4644460678100586,
-0.6093298196792603,
0.3746272325515747,
0.1354084014892578,
0.3352045714855194,
-0.08766860514879227,
-0.018796855583786964,
-0.7428903579711914,
0.966875910758... |
func broadcastLocale(localeId string, stop chan bool) error {
ticker := time.NewTicker(BroadcastInterval * time.Second)
for {
select {
case <-ticker.C:
// todo ensure the query never takes more than BroadcastInterval time
resp, _ := getLocaleUpdate(localeId)
err := BroadcastToLocale(localeId, resp)
if... | [
0.05904068052768707,
-0.2626124620437622,
0.4966409504413605,
-0.19812330603599548,
0.1732778400182724,
0.07506243884563446,
0.18779954314231873,
-0.15270282328128815,
-0.3244294822216034,
0.6110357046127319,
0.6207383275032043,
0.6147609949111938,
-0.5921269059181213,
0.5550850629806519,
... |
func parseLocale(data interface{}) (model.Locale, error) {
var locale model.Locale
mData, err := json.Marshal(data)
if err != nil {
return locale, fmt.Errorf("failed to parse locale from data: %v", err)
}
err = json.Unmarshal(mData, &locale)
if err != nil {
return locale, fmt.Errorf("failed to un parse loca... | [
0.6763783097267151,
-0.20046870410442352,
0.557948648929596,
-0.690855860710144,
-1.2130720615386963,
-0.572863757610321,
-0.24945732951164246,
0.027125569060444832,
0.11656085401773453,
-0.015203673392534256,
-0.008866007439792156,
0.2919706106185913,
-0.4395461976528168,
-0.3947399854660... |
func (cptool *CPTool) Compile(ctx context.Context, solution Solution, debug bool) (CompilationResult, error) {
language := solution.Language
if debug && !language.Debuggable {
return CompilationResult{}, ErrLanguageNotDebuggable
}
targetDir := cptool.getCompiledDirectory(solution, debug)
cptool.fs.MkdirAll(targ... | [
-0.01893223635852337,
-0.711043119430542,
0.9563060402870178,
0.3831319510936737,
-0.20791839063167572,
-0.6810557842254639,
0.4420720040798187,
-0.8874825835227966,
-0.33503738045692444,
0.04073617607355118,
0.25506269931793213,
-0.0826287567615509,
0.1308281421661377,
0.6078824400901794,... |
func (cptool *CPTool) CompileByName(ctx context.Context, languageName string, solutionName string, debug bool) (CompilationResult, error) {
start := time.Now()
language, err := cptool.GetLanguageByName(languageName)
if err != nil {
return CompilationResult{}, err
}
if cptool.logger != nil {
cptool.logger.Prin... | [
0.17692093551158905,
-0.6209954619407654,
0.6934057474136353,
-0.017256207764148712,
-0.6857588291168213,
-0.8697725534439087,
-0.02542225830256939,
-1.1302233934402466,
-0.6233477592468262,
0.9139546751976013,
-0.9810566306114197,
-0.4506697952747345,
-0.6184974312782288,
0.72210574150085... |
func (cptool *CPTool) GetCompilationRootDir() string {
return path.Join(cptool.workingDirectory, ".cptool/solutions")
} | [
0.5868769884109497,
0.05245756730437279,
0.5216199159622192,
0.6119256019592285,
-0.6221060156822205,
1.034095287322998,
1.2582423686981201,
-0.22736164927482605,
-0.1261073350906372,
-1.0019686222076416,
0.04391060024499893,
1.0793192386627197,
-0.026408126577734947,
1.055957317352295,
... |
func (dg *dependencyGraph) makeQueryTerm(t sparql.Triple) *queryTerm {
qt := &queryTerm{
t,
[]*queryTerm{},
[]string{},
}
if qt.Subject.IsVariable() {
dg.variables[qt.Subject.String()] = false
qt.variables = append(qt.variables, qt.Subject.String())
}
if qt.Predicates[0].Predicate.IsVariable() {
dg.var... | [
-0.2860350012779236,
-0.3315337896347046,
0.5357863306999207,
-1.119776725769043,
-0.9418920874595642,
1.2801226377487183,
-0.09259055554866791,
0.14087294042110443,
0.1428120881319046,
0.0931658148765564,
-0.30975213646888733,
0.27022483944892883,
-0.03352737054228783,
-0.9740095734596252... |
func (qt *queryTerm) equals(qt2 *queryTerm) bool {
return qt.Subject == qt2.Subject &&
qt.Object == qt2.Object &&
reflect.DeepEqual(qt.Predicates, qt2.Predicates)
} | [
-0.45971086621284485,
-1.4144340753555298,
0.2862943708896637,
-0.4921940267086029,
-0.2156211882829666,
0.8792093992233276,
-0.975684404373169,
-0.4692681133747101,
-0.4462692439556122,
-0.22359344363212585,
-0.9740363359451294,
1.381805658340454,
-0.03643754497170448,
0.30304062366485596... |
func NewGitHubClient(owner, repo, token string) (GitHub, error) {
var client *github.Client
if token != "" {
ts := oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: token,
})
tc := oauth2.NewClient(context.TODO(), ts)
client = github.NewClient(tc)
} else {
client = github.NewClient(nil)
}
return &C... | [
0.013854029588401318,
-0.4095340967178345,
0.42134296894073486,
0.2780049443244934,
-0.49006301164627075,
-0.09564351290464401,
-0.5664643049240112,
0.31324005126953125,
-0.3470689356327057,
0.002240394242107868,
-0.3022012710571289,
1.2110264301300049,
0.10867790132761002,
-0.801621556282... |
func (c *Client) GetRepository(ctx context.Context) (*github.Repository, error) {
repo, res, err := c.Repositories.Get(context.TODO(), c.Owner, c.Repo)
if err != nil {
if res.StatusCode == http.StatusNotFound {
return nil, nil
}
panic(err)
}
return repo, nil
} | [
-0.011977785266935825,
0.3304930329322815,
0.4390089809894562,
0.6047890186309814,
1.3802809715270996,
-0.47589993476867676,
-0.14062285423278809,
-0.34567296504974365,
0.5765545964241028,
-0.40345823764801025,
0.12256461381912231,
0.8633898496627808,
-0.1420939713716507,
-0.14327807724475... |
func (c *Client) CreateRelease(ctx context.Context, req *github.RepositoryRelease) (*github.RepositoryRelease, error) {
release, res, err := c.Repositories.CreateRelease(context.TODO(), c.Owner, c.Repo, req)
if err != nil {
return nil, errors.Wrap(err, "failed to create a release")
}
if res.StatusCode != http.S... | [
-0.971615195274353,
-0.007131519727408886,
0.18578490614891052,
0.23800870776176453,
0.6300451159477234,
-0.0928952693939209,
-1.1289350986480713,
-0.8913990259170532,
0.4097856283187866,
0.0300190057605505,
0.25496095418930054,
-0.5283483862876892,
-1.1980441808700562,
0.5162029266357422,... |
func (c *Client) GetRelease(ctx context.Context, tag string) (*github.RepositoryRelease, error) {
// Check Release whether already exists or not
release, res, err := c.Repositories.GetReleaseByTag(context.TODO(), c.Owner, c.Repo, tag)
if err != nil {
if res == nil {
return nil, errors.Wrapf(err, "failed to get ... | [
-0.49518996477127075,
0.2055920511484146,
0.3002551794052124,
0.4174184799194336,
0.735884964466095,
-1.1555092334747314,
-0.6232637763023376,
-1.2322468757629395,
0.19597227871418,
0.2763367295265198,
0.049031373113393784,
-0.04751287400722504,
-0.8214411735534668,
0.8616777062416077,
0... |
func (c *Client) EditRelease(ctx context.Context, releaseID int64, req *github.RepositoryRelease) (*github.RepositoryRelease, error) {
var release *github.RepositoryRelease
err := retry.Retry(3, 3*time.Second, func() error {
var (
res *github.Response
err error
)
release, res, err = c.Repositories.EditRe... | [
-1.415045976638794,
-0.2662135064601898,
0.3457905650138855,
0.12018539011478424,
0.5332484245300293,
-0.5369282960891724,
-0.5381045341491699,
-0.2705353796482086,
0.518123984336853,
0.5303165912628174,
0.26139992475509644,
0.14281390607357025,
-1.0900440216064453,
0.21494238078594208,
... |
func (c *Client) ListReleases(ctx context.Context) ([]*github.RepositoryRelease, error) {
result := []*github.RepositoryRelease{}
page := 1
for {
assets, res, err := c.Repositories.ListReleases(context.TODO(), c.Owner, c.Repo, &github.ListOptions{Page: page})
if err != nil {
return nil, errors.Wrap(err, "fail... | [
-0.6570423245429993,
0.14773918688297272,
0.07769767940044403,
-0.5010982155799866,
0.7868999242782593,
-0.42375242710113525,
-1.1574864387512207,
-0.523410439491272,
0.4840119183063507,
0.3330015540122986,
-0.07505667209625244,
0.44187653064727783,
-0.5368918180465698,
0.8634161353111267,... |
func (c *Client) UploadAsset(ctx context.Context, releaseID int64, filename string) (*github.ReleaseAsset, error) {
filename, err := filepath.Abs(filename)
if err != nil {
return nil, errors.Wrap(err, "failed to get abs path")
}
f, err := os.Open(filename)
if err != nil {
return nil, errors.Wrap(err, "failed... | [
-0.32890403270721436,
-0.5593953132629395,
0.7129153609275818,
-0.7651025652885437,
-0.22110949456691742,
-0.1343086063861847,
-0.5392546653747559,
-0.87416672706604,
-0.3538741171360016,
0.4161766767501831,
0.1981525421142578,
0.4178614616394043,
-0.6269088387489319,
-0.3339684307575226,
... |
func (c *Client) ListAssets(ctx context.Context, releaseID int64) ([]*github.ReleaseAsset, error) {
result := []*github.ReleaseAsset{}
page := 1
for {
assets, res, err := c.Repositories.ListReleaseAssets(context.TODO(), c.Owner, c.Repo, releaseID, &github.ListOptions{Page: page})
if err != nil {
return nil, ... | [
-0.800080418586731,
-0.2928314805030823,
0.23015351593494415,
-0.4571676254272461,
0.07266011834144592,
-0.4699770212173462,
-1.0384308099746704,
-0.4700390696525574,
0.7658281922340393,
0.3728742301464081,
0.2537347972393036,
0.6980976462364197,
-0.6021450757980347,
0.1298937350511551,
... |
func init() {
//load in environment variables from .env
//will print error message when running from docker image
//because env file is passed into docker run command
envErr := godotenv.Load("/home/ubuntu/go/src/github.com/200106-uta-go/BAM-P2/.env")
if envErr != nil {
if !strings.Contains(envErr.Error(), "no s... | [
-0.2550239562988281,
-0.3449278473854065,
1.1933612823486328,
0.8161510229110718,
0.7575045228004456,
1.1675963401794434,
0.6194044351577759,
-0.4590821862220764,
-0.6451455950737,
0.5608179569244385,
-0.07988488674163818,
0.8409379124641418,
0.06587032228708267,
0.4479152262210846,
0.49... |
func logRequest(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Println(r.RequestURI)
next.ServeHTTP(w, r)
})
} | [
-0.5426734685897827,
0.309343159198761,
0.5173858404159546,
-0.11678314208984375,
-0.11510547995567322,
0.09743504226207733,
-0.4103911221027374,
0.4898163974285126,
-0.12574264407157898,
-1.0905070304870605,
0.6159988641738892,
0.8226407766342163,
0.42416343092918396,
0.04109293594956398,... |
func TrustAnchorString(t []*TrustAnchor) string {
xta := new(XMLTrustAnchor)
xta.KeyDigest = make([]*XMLKeyDigest, 0)
for _, ta := range t {
xta.Id = ta.Id // Sets the everytime, but that is OK.
xta.Source = ta.Source
xta.Zone = ta.Anchor.Hdr.Name
xkd := new(XMLKeyDigest)
xkd.Id = ta.AnchorId
xkd.ValidFr... | [
0.5198929309844971,
-1.473460078239441,
0.5554364919662476,
-1.2574055194854736,
-0.22167067229747772,
0.649318277835846,
-0.22247736155986786,
-1.144554853439331,
0.21073411405086517,
0.4957878887653351,
0.3935200572013855,
-0.11557918041944504,
0.9239029288291931,
-0.31650111079216003,
... |
func ReadTrustAnchor(q io.Reader) ([]*TrustAnchor, error) {
d := xml.NewDecoder(q)
t := new(XMLTrustAnchor)
if e := d.Decode(t); e != nil {
return nil, e
}
ta := make([]*TrustAnchor, 0)
var err error
for _, digest := range t.KeyDigest {
t1 := new(TrustAnchor)
t1.Id = t.Id
t1.Source = t.Source
t1.Anchor... | [
-0.6111882925033569,
-1.0882681608200073,
0.8096947073936462,
-0.7218455076217651,
-0.46363580226898193,
0.37437552213668823,
0.3976595401763916,
-0.6726343631744385,
-0.018620632588863373,
0.35352623462677,
-0.6041629910469055,
0.2261025458574295,
-0.019811879843473434,
0.2162647396326065... |
func NewStreamToSubStream(wf *scipipe.Workflow, name string) *StreamToSubStream {
stss := &StreamToSubStream{
name: name,
In: scipipe.NewInPort("in"),
OutSubStream: scipipe.NewOutPort("out_substream"),
}
wf.AddProc(stss)
return stss
} | [
0.710236132144928,
-0.139100581407547,
0.20494221150875092,
-0.14716008305549622,
-0.5531498789787292,
-0.5102040767669678,
0.18423159420490265,
-0.09463924169540405,
0.004022293724119663,
0.07144969701766968,
-0.7188221216201782,
1.269416093826294,
-0.08619341254234314,
0.3363134860992431... |
func (p *StreamToSubStream) Name() string {
return p.name
} | [
-0.06546687334775925,
-0.2926715910434723,
0.42243891954421997,
0.16682644188404083,
-0.6564019322395325,
0.49951863288879395,
0.30078113079071045,
-0.3655765652656555,
-0.14838185906410217,
0.49176332354545593,
-1.0948317050933838,
0.5979893803596497,
-0.23970185220241547,
-0.028439069166... |
func (p *StreamToSubStream) Connected() bool {
return p.In.Connected() && p.OutSubStream.Connected()
} | [
-0.28112295269966125,
-0.8830673694610596,
0.5043968558311462,
0.7417371869087219,
-0.0864812508225441,
0.669409990310669,
-0.5756474733352661,
-0.0770423412322998,
-0.16088615357875824,
0.3267616927623749,
-0.819810152053833,
0.23379728198051453,
-0.007021261844784021,
0.14424879848957062... |
func (p *StreamToSubStream) InPorts() map[string]*scipipe.InPort {
return map[string]*scipipe.InPort{
p.In.Name(): p.In,
}
} | [
0.37198635935783386,
-0.7559077143669128,
0.5411477088928223,
-0.7227947115898132,
-0.5796981453895569,
0.4288046061992645,
0.1450892835855484,
0.05309516564011574,
0.4677455425262451,
-0.13529905676841736,
-0.8434855341911316,
0.6511767506599426,
-0.8584371209144592,
-0.1836509257555008,
... |
func (p *StreamToSubStream) OutPorts() map[string]*scipipe.OutPort {
return map[string]*scipipe.OutPort{
p.OutSubStream.Name(): p.OutSubStream,
}
} | [
0.3414008617401123,
-0.45659130811691284,
0.4082303047180176,
-0.7491840720176697,
-0.3487977981567383,
-0.03444378077983856,
0.16094128787517548,
-0.17436422407627106,
0.20337939262390137,
0.0817774161696434,
-0.9572222232818604,
0.6269614100456238,
-0.39728572964668274,
-0.39793872833251... |
func (p *StreamToSubStream) Run() {
defer p.OutSubStream.Close()
scipipe.Debug.Println("Creating new information packet for the substream...")
subStreamIP := scipipe.NewIP("")
scipipe.Debug.Printf("Setting in-port of process %s to IP substream field\n", p.Name())
subStreamIP.SubStream = p.In
scipipe.Debug.Print... | [
-0.21646027266979218,
-0.41978204250335693,
0.5540081858634949,
-0.6155616044998169,
0.026057859882712364,
0.5555436015129089,
0.2802589237689972,
0.026121512055397034,
-0.8795003890991211,
-0.155943363904953,
-0.5523560643196106,
1.4884716272354126,
-0.7875442504882812,
-0.065664663910865... |
func (r *ReconcileArgoCDExport) reconcileStorage(cr *argoprojv1a1.ArgoCDExport) error {
if cr.Spec.Storage == nil {
cr.Spec.Storage = &argoprojv1a1.ArgoCDExportStorageSpec{
Backend: common.ArgoCDExportStorageBackendLocal,
}
return r.Client.Update(context.TODO(), cr)
}
// Local storage
if err := r.reconcil... | [
-0.29711276292800903,
0.1245494857430458,
0.5167009234428406,
0.737472653388977,
0.9377638697624207,
-0.2987182140350342,
0.9163323640823364,
0.6332803964614868,
0.30503764748573303,
0.15102052688598633,
0.6007235050201416,
-0.19711408019065857,
-0.1955147087574005,
0.5296339392662048,
0... |
func (in Labels) Equals(other Labels) bool {
return reflect.DeepEqual(in, other)
} | [
-1.790485143661499,
-0.6970695853233337,
0.4544036388397217,
-0.5548966526985168,
0.14262822270393372,
0.6186992526054382,
-1.0568739175796509,
-0.757032573223114,
-0.22209720313549042,
-0.01569928228855133,
-0.7083869576454163,
0.2890959680080414,
-0.7357227802276611,
0.16822472214698792,... |
func (in Labels) HasOwned(cluster string) bool {
value, ok := in[ClusterTagKey(cluster)]
return ok && ResourceLifecycle(value) == ResourceLifecycleOwned
} | [
0.5686321258544922,
-0.5790116190910339,
0.4962812662124634,
0.04132178798317909,
0.7687239646911621,
0.13567225635051727,
0.687287449836731,
-0.28676217794418335,
-0.3071581721305847,
-0.5732402801513672,
0.07658171653747559,
-0.2245725393295288,
-0.1306229829788208,
0.22956642508506775,
... |
func (in Labels) ToComputeFilter() string {
var builder strings.Builder
for k, v := range in {
builder.WriteString(fmt.Sprintf("(labels.%s = %q) ", k, v))
}
return builder.String()
} | [
-1.5273798704147339,
0.2731565833091736,
0.3384057581424713,
-1.3159397840499878,
0.349852591753006,
-0.2331770956516266,
-0.3827989399433136,
-0.04274478927254677,
-0.8631137013435364,
1.012050986289978,
-0.22639812529087067,
0.6402668952941895,
-0.028369413688778877,
0.5605786442756653,
... |
func (in Labels) Difference(other Labels) Labels {
res := make(Labels, len(in))
for key, value := range in {
if otherValue, ok := other[key]; ok && value == otherValue {
continue
}
res[key] = value
}
return res
} | [
-1.5789129734039307,
-0.5121582746505737,
0.5375213027000427,
0.10520666092634201,
-0.2301139533519745,
0.6807556748390198,
-0.7226247787475586,
-0.44849932193756104,
0.04671331122517586,
0.453946977853775,
-0.488026887178421,
-0.5099988579750061,
-0.2607106864452362,
0.2402169108390808,
... |
func (in Labels) AddLabels(other Labels) Labels {
for key, value := range other {
if in == nil {
in = make(map[string]string, len(other))
}
in[key] = value
}
return in
} | [
-1.0786415338516235,
-0.11536241322755814,
0.6704983115196228,
-0.6833338141441345,
0.24718359112739563,
0.03730315342545509,
-1.6284078359603882,
-0.253980427980423,
0.1618937849998474,
0.06904977560043335,
0.4567600190639496,
-1.1050750017166138,
-0.5500760674476624,
0.5484135746955872,
... |
func ClusterTagKey(name string) string {
return fmt.Sprintf("%s%s", NameGCPProviderOwned, name)
} | [
-0.1323351114988327,
0.5779139995574951,
0.3863217830657959,
-0.41996026039123535,
0.6485934257507324,
-0.2702852785587311,
-0.09276578575372696,
-0.718977153301239,
-0.3814118206501007,
1.9499520063400269,
-0.272990345954895,
0.7171916961669922,
-0.1976553052663803,
-0.1173681989312172,
... |
func Build(params BuildParams) Labels {
tags := make(Labels)
for k, v := range params.Additional {
tags[strings.ToLower(k)] = strings.ToLower(v)
}
tags[ClusterTagKey(params.ClusterName)] = string(params.Lifecycle)
if params.Role != nil {
tags[NameGCPClusterAPIRole] = strings.ToLower(*params.Role)
}
return ... | [
-0.5367960333824158,
-1.4668318033218384,
0.2752116918563843,
-0.6335495710372925,
0.4441893696784973,
0.4067175090312958,
-0.5290691256523132,
-0.3369804322719574,
-0.8023530840873718,
0.8101462721824646,
0.09933073818683624,
0.37853214144706726,
-0.41068753600120544,
0.40546247363090515,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.