id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c9100
*TrackAttributes { ta.intAttributes["max_duration_ms"] = duration return ta }
c9101
*TrackAttributes { ta.intAttributes["min_duration_ms"] = duration return ta }
c9102
*TrackAttributes { ta.intAttributes["target_duration_ms"] = duration return ta }
c9103
*TrackAttributes { ta.floatAttributes["max_energy"] = energy return ta }
c9104
*TrackAttributes { ta.floatAttributes["min_energy"] = energy return ta }
c9105
*TrackAttributes { ta.floatAttributes["target_energy"] = energy return ta }
c9106
*TrackAttributes { ta.floatAttributes["max_instrumentalness"] = instrumentalness return ta }
c9107
*TrackAttributes { ta.floatAttributes["min_instrumentalness"] = instrumentalness return ta }
c9108
*TrackAttributes { ta.floatAttributes["target_instrumentalness"] = instrumentalness return ta }
c9109
*TrackAttributes { ta.floatAttributes["max_liveness"] = liveness return ta }
c9110
*TrackAttributes { ta.floatAttributes["min_liveness"] = liveness return ta }
c9111
*TrackAttributes { ta.floatAttributes["target_liveness"] = liveness return ta }
c9112
*TrackAttributes { ta.floatAttributes["max_speechiness"] = speechiness return ta }
c9113
*TrackAttributes { ta.floatAttributes["min_speechiness"] = speechiness return ta }
c9114
*TrackAttributes { ta.floatAttributes["target_speechiness"] = speechiness return ta }
c9115
err := c.get(url, &temp) if err != nil { return nil, err } return &temp, nil }
c9116
return ErrNoMorePages } return c.get(s.Artists.Next, s) }
c9117
return ErrNoMorePages } return c.get(s.Artists.Previous, s) }
c9118
return ErrNoMorePages } return c.get(s.Albums.Next, s) }
c9119
return ErrNoMorePages } return c.get(s.Albums.Previous, s) }
c9120
return ErrNoMorePages } return c.get(s.Playlists.Next, s) }
c9121
return ErrNoMorePages } return c.get(s.Playlists.Previous, s) }
c9122
return ErrNoMorePages } return c.get(s.Tracks.Previous, s) }
c9123
return ErrNoMorePages } return c.get(s.Tracks.Next, s) }
c9124
{ return time.Duration(t.Duration) * time.Millisecond }
c9125
err := c.get(spotifyURL, &t) if err != nil { return nil, err } return &t, nil }
c9126
[]*FullTrack `json:"tracks"` } err := c.get(spotifyURL, &t) if err != nil { return nil, err } return t.Tracks, nil }
c9127
F []*AudioFeatures `json:"audio_features"` }{} err := c.get(url, &temp) if err != nil { return nil, err } return temp.F, nil }
c9128
len(s.Tracks) + len(s.Genres) }
c9129
v.Set("seed_tracks", strings.Join(toStringSlice(seeds.Tracks), ",")) } if len(seeds.Genres) != 0 { v.Set("seed_genres", strings.Join(seeds.Genres, ",")) } }
c9130
range trackAttributes.intAttributes { values.Set(attr, strconv.Itoa(val)) } for attr, val := range trackAttributes.floatAttributes { values.Set(attr, strconv.FormatFloat(val, 'f', -1, 64)) } }
c9131
if opt.Country != nil { v.Set("market", *opt.Country) } } spotifyURL := c.baseURL + "recommendations?" + v.Encode() var recommendations Recommendations err := c.get(spotifyURL, &recommendations) if err != nil { return nil, err } return &recommendations, err }
c9132
c.get(spotifyURL, &genreSeeds) if err != nil { return nil, err } return genreSeeds["genres"], nil }
c9133
{ return errors.New("Couldn't download image - HTTP" + strconv.Itoa(resp.StatusCode)) } _, err = io.Copy(dst, resp.Body) return err }
c9134
a useful status-code but an // empty message, which will confuse the user (who only has access to // the message and not the code). An example of this is when we send // some of the arguments directly in the HTTP query and the URL ends-up // being too long. e.E.Message = fmt.Sprintf("spotify: unexpected HTT...
c9135
== http.StatusAccepted || status == http.StatusTooManyRequests }
c9136
== code { return false } } return true }
c9137
&& isFailure(resp.StatusCode, needsStatus) { return c.decodeError(resp) } if result != nil { if err := json.NewDecoder(resp.Body).Decode(result); err != nil { return err } } break } return nil }
c9138
} } var objmap map[string]*json.RawMessage err = c.get(spotifyURL, &objmap) if err != nil { return nil, err } var result SimpleAlbumPage err = json.Unmarshal(*objmap["albums"], &result) if err != nil { return nil, err } return &result, nil }
c9139
return c.NewReleasesOpt(nil) }
c9140
multigraph. stats.Size++ return } if edges[edge{v, w}] { stats.Multi++ } else { stats.Size++ } edges[edge{v, w}] = true return }) } for _, deg := range degree { if deg == 0 { stats.Isolated++ } } return stats }
c9141
} edges[edge{v, w, c}]-- return }) { return false } for _, n := range edges { if n > 0 { return false } } } return true }
c9142
:= s.get(v) s0 := s.And(Range(s.get(a), n)) for _, in := range s0.set { if more := false; g.visit(v0, in.a, func(w0 int, c int64) (skip bool) { switch { case w0 >= in.b: more, skip = true, true return case do(s.rank(w0), c): return true default: return } }) && !more { ...
c9143
if !s.visited[v] { components = s.append(components, v) } } return components }
c9144
s.lowLink[v] = s.lowLink[w] newComponent = false } return }) if !newComponent { return components } var comp []int for { n := len(s.stack) - 1 w := s.stack[n] s.stack = s.stack[:n] s.lowLink[w] = int(^uint(0) >> 1) // maxint comp = append(comp, w) if v == w { return append(components, co...
c9145
1 prev = w0 return case w0 - 1: n += 1 prev = w0 return } return true }) return }
c9146
&Mutable{edges: make([]map[int]int64, n)} }
c9147
n; v++ { g.Visit(v, func(w int, c int64) (skip bool) { h.AddCost(v, w, c) return }) } return h }
c9148
if do(w, c) { return true } } return false }
c9149
g.AddCost(v, w, 0) }
c9150
panic("vertex out of range: " + strconv.Itoa(w)) } if g.edges[v] == nil { g.edges[v] = make(map[int]int64, initialMapSize) } g.edges[v][w] = c }
c9151
g.AddCost(v, w, 0) if v != w { g.AddCost(w, v, 0) } }
c9152
{ g.AddCost(v, w, c) if v != w { g.AddCost(w, v, c) } }
c9153
delete(g.edges[v], w) }
c9154
{ g.Delete(v, w) if v != w { g.Delete(w, v) } }
c9155
ok bool) { order, ok = topsort(g, true) return }
c9156
false) return acyclic }
c9157
{ if degree == 0 { queue = append(queue, v) } } order = []int{} vertexCount := 0 for len(queue) > 0 { v := queue[0] queue = queue[1:] if output { order = append(order, v) } vertexCount++ g.Visit(v, func(w int, _ int64) (skip bool) { indegree[w]-- if indegree[w] == 0 { queue = appen...
c9158
if start == -1 { for v, neighbors := range h { if len(neighbors) > 0 { start = v break } } } for stack := []int{start}; len(stack) > 0; { n := len(stack) v := stack[n-1] stack = stack[:n-1] for len(h[v]) > 0 { stack = append(stack, v) v, h[v] = h[v][0], h[v][1:] edgeCount-- } ...
c9159
} } } h := Copy(g) for stack := []int{start}; len(stack) > 0; { n := len(stack) v := stack[n-1] stack = stack[:n-1] for h.Degree(v) > 0 { stack = append(stack, v) var w int h.Visit(v, func(u int, _ int64) (skip bool) { w = u return true }) h.DeleteBoth(v, w) edgeCount-- if v ...
c9160
{ return g.union(newEdges(g.Order(), e), true) }
c9161
int) bool { return !e.Contains(v, w) }) }
c9162
return g } return build(g, false) }
c9163
zero, degree: degreeZero, visit: noNeighbors, } }
c9164
return }) return } g.visit = func(v int, a int, do func(w int, c int64) bool) (aborted bool) { for w := a; w < n; w++ { if g.edge(v, w) && do(w, cost(v, w)) { return true } } return } return g }
c9165
res.cost = func(v, w int) (cost int64) { if !h.Edge(v, w) { return 0 } h.VisitFrom(v, w, func(w int, c int64) (skip bool) { cost = c return true }) return } return res }
c9166
edge: neverEdge, cost: zero, degree: degreeZero, visit: noNeighbors, } }
c9167
cost: zero, degree: func(v int) int { return n - 1 }, } g.visit = func(v int, a int, do func(w int, c int64) bool) (aborted bool) { for w := a; w < g.order; w++ { if v != w && do(w, 0) { return true } } return } return g }
c9168
for w := prev; w < w0; w++ { if v != w && do(w, 0) { return true } } prev = w0 + 1 return }) { return true } for w := prev; w < n; w++ { if v != w && do(w, 0) { return true } } return } return res }
c9169
bool) { return g.visit(v, a, func(w int, _ int64) bool { return do(w, c) }) } return &res }
c9170
return g.visit(v, a, func(w int, _ int64) bool { return do(w, c(v, w)) }) } return &res }
c9171
black default: colors[w] = white whiteCount++ } queue = append(queue, w) return }) { return []int{}, false } } } part = make([]int, 0, whiteCount) for v, color := range colors { if color == white { part = append(part, v) } } return part, true }
c9172
in := range s.set { s.set[i].index = prev prev += in.b - in.a } }
c9173
-1 case len(s.set) == 0: return 0 } in := s.set[len(s.set)-1] return in.index + in.b - in.a }
c9174
n < set[i].a i := sort.Search(len(s.set), func(i int) bool { return n < s.set[i].a }) in := s.set[i-1] if n >= in.b { return -1 } return in.index + n - in.a }
c9175
func(i int) bool { return v < s.set[i].a }) if v >= s.set[i-1].b { return false } return true }
c9176
s1.And(s2.complement()) }
c9177
t.set = append(t.set, interval{prev, in.a, 0}) } prev = in.b } if prev < maxInt { t.set = append(t.set, interval{prev, maxInt, 0}) } t.update() return t }
c9178
points[i].x == points[j].x { return !points[i].a } return points[i].x < points[j].x }) s := empty() start, count := 0, 0 for _, p := range points { switch count { case 0: count++ case 1: if p.a { start = p.x count++ } else { count-- } case 2: s.set = append(s.set, interva...
c9179
data := ServiceDecl(svc, chars) t := template.New("Test Template") t, err = t.Parse(ServiceStructTemplate) t.Execute(&buf, data) return buf.Bytes(), err }
c9180
New(info, TypeBridge) return &acc }
c9181
client: client, session: session, database: database, } return &controller }
c9182
out.SetByte(TagSequence, PairStepStartRequest.Byte()) return out.BytesBuffer() }
c9183
acc.TempSensor.CurrentTemperature.SetMaxValue(max) acc.TempSensor.CurrentTemperature.SetStepValue(steps) acc.AddService(acc.TempSensor.Service) return &acc }
c9184
[keySize]byte rand.Read(b[:]) return b }
c9185
[keySize]byte curve25519.ScalarBaseMult(&k, &privateKey) return k }
c9186
[keySize]byte curve25519.ScalarMult(&k, &privateKey, &otherPublicKey) return k }
c9187
timeout, context: context, } return &k }
c9188
case <-time.After(k.timeout): k.sendKeepAlive() } } }
c9189
client, database: database, session: NewVerifySession(), } return &controller }
c9190
switch seq { case VerifyStepStartResponse: out, err = verify.handlePairStepVerifyResponse(in) case VerifyStepFinishResponse: out, err = verify.handlePairVerifyStepFinishResponse(in) default: return nil, errInvalidVerifyStep(seq) } return out, err }
c9191
VerifyStepStartRequest.Byte()) out.SetBytes(TagPublicKey, verify.session.PublicKey[:]) fmt.Println("<- A:", hex.EncodeToString(out.GetBytes(TagPublicKey))) return out.BytesBuffer() }
c9192
&sync.Mutex{}, } ctx.SetSecuredDevice(b) return &ctx }
c9193
{ connections = append(connections, s.Connection()) } } return connections }
c9194
PermWrite { return false } } return true }
c9195
&& len(c.Perms) == len(characteristic.Perms) && c.Description == characteristic.Description && c.Format == characteristic.Format && c.Unit == characteristic.Unit && c.MaxLen == characteristic.MaxLen && c.MaxValue == characteristic.MaxValue && c.MinValue == characteristic.MinValue && c.StepValue == characteristic.StepV...
c9196
Characteristics: []*characteristic.Characteristic{}, Linked: []int64{}, } return &s }
c9197
[]*characteristic.Characteristic for _, c := range s.Characteristics { result = append(result, c) } return result }
c9198
range s.Characteristics { other := service.Characteristics[i] if c.Equal(other) == false { return false } } return s.ID == service.ID && s.Type == service.Type } return false }
c9199
s.encryptCount = 0 if err != nil { return nil, err } s.decryptKey, err = hkdf.Sha512(sharedKey[:], salt, in) s.decryptCount = 0 return s, err }