text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func UserInGame(PlayerID string) bool {
for _, player := range Players {
// If a match is found return true
if player.PlayerID == PlayerID {
return true
}
}
// Otherwise return false.
return false
} | [
-1.0850082635879517,
-0.10963239520788193,
0.7798452377319336,
0.32521411776542664,
0.029088949784636497,
-0.02782825566828251,
-0.14478273689746857,
0.17213454842567444,
-0.03530982881784439,
1.5644853115081787,
-0.20367558300495148,
-0.7734894752502441,
-0.6725988984107971,
-0.0645640864... |
func GetUserName(ID string, s *discordgo.Session) string {
// Create a user object based on the ID
user, err := s.User(ID)
// if no user is found just return the ID.
if err != nil {
return ID
}
// Otherwise return the user's username.
return user.Username
} | [
-0.06441622227430344,
-0.03949985280632973,
0.3254169225692749,
0.6902239918708801,
0.02983573079109192,
-1.0425857305526733,
-0.07675064355134964,
-0.31675323843955994,
0.5317488312721252,
0.671389102935791,
-0.22466132044792175,
0.043350815773010254,
-0.15295788645744324,
-0.045920688658... |
func ReleaseCard(CardID int) {
// tmpcard is a temporary element which will allow us to update the
// card's taken bool.
tmpcard := WhiteCards[CardID]
// Set taken to false.
tmpcard.taken = false
// Update the map entry with the new data.
WhiteCards[CardID] = tmpcard
} | [
-1.2336974143981934,
-0.23030555248260498,
0.3757536709308624,
-1.7854008674621582,
-0.30411407351493835,
-0.4043580889701843,
-0.3439671993255615,
0.9239187836647034,
0.8771052956581116,
1.0067137479782104,
-0.6356463432312012,
0.6918826699256897,
-0.43832242488861084,
1.0429365634918213,... |
func GenerateHand(PlayerID string) {
// tmpCards is a temporary slice used to hold the cards to be added
// to a player's hand.
tmpCards := []WhiteCard{}
// tmpPlayer is a temporary copy of a player in the Players map and
// is used to update the player's information with the new cards.
tmpPlayer := Players[Playe... | [
-1.3540501594543457,
0.3827003836631775,
0.6896413564682007,
-1.072267770767212,
0.6395963430404663,
0.6919591426849365,
0.15979669988155365,
0.1210218295454979,
0.6265035271644592,
0.3864477872848511,
-0.877207338809967,
-0.3887317180633545,
-0.5578807592391968,
0.39491352438926697,
0.1... |
func PrepareGame() {
// Let's generate the player's hands
for _, player := range Players {
// Generate the player's hand.
GenerateHand(player.PlayerID)
// Add the player to the Zars slice.
Zars = append(Zars, player.PlayerID)
}
// Set round to 1
Round = 1
} | [
-1.0989187955856323,
0.13248051702976227,
0.5432403683662415,
0.13727299869060516,
1.0469303131103516,
0.3646630346775055,
0.22677317261695862,
0.4864051043987274,
-0.056455738842487335,
0.8663293719291687,
0.5680527687072754,
-0.8288235068321228,
-0.7036427855491638,
0.7672280669212341,
... |
func NextZar() {
// Remove current Zar
tmpPlayer := Players[Zars[Zar]]
tmpPlayer.Zar = false
Players[tmpPlayer.PlayerID] = tmpPlayer
// If length of the Zars list minus 1 is equal to the current Zar
// then we set Zar to 0
if len(Zars)-1 == Zar {
Zar = 0
return
}
// If not, then just add one to Zar
Zar++... | [
-0.8115156888961792,
-0.48332372307777405,
0.6821721196174622,
0.4738314747810364,
-0.6583749055862427,
-0.15553998947143555,
1.4313251972198486,
0.17364931106567383,
1.1991639137268066,
0.4203031659126282,
-0.23434320092201233,
0.26115164160728455,
-1.2586637735366821,
1.04091477394104,
... |
func EndGame(s *discordgo.Session) {
// Loop through all players
for _, player := range Players {
// if a player's score is higher than the current one, then
// update the high score with the player's score.
if player.Score > HighScore {
HighScore = player.Score
HighScoreID = player.PlayerID
}
}
// Er... | [
-0.14924359321594238,
-0.3159641623497009,
0.6385893821716309,
0.36447855830192566,
1.0672343969345093,
-0.11694774031639099,
-0.6894565224647522,
0.07063370198011398,
-0.6281350255012512,
0.8343215584754944,
-0.0331893265247345,
0.7121924161911011,
-0.49230027198791504,
0.9814652800559998... |
func SwapCard() {
// oldCards is a slice that holds the used cards.
oldCards := []WhiteCard{}
// Loop through the player list.
for _, player := range Players {
// Loop through the player's played cards
for _, card := range player.PlayedCards {
oldCards = append(oldCards, card)
}
// Loop through the p... | [
-1.186903476715088,
-0.5965038537979126,
0.7616848349571228,
-1.3086755275726318,
0.7790478467941284,
-0.7436692118644714,
-0.09756520390510559,
0.632576048374176,
0.36567214131355286,
0.45658376812934875,
-0.27071529626846313,
1.4365119934082031,
0.2106395661830902,
0.1380605846643448,
... |
func DrawCard(index int) WhiteCard {
for {
randomCard := WhiteCards[rand.Intn(len(WhiteCards))]
// If the random card isn't already taken
if !randomCard.taken {
// Set it as taken
randomCard.taken = true
randomCard.Index = index
fmt.Printf("Card text: %s\n", randomCard.Text)
// Update it in the m... | [
-1.8346985578536987,
-0.01445523090660572,
0.4612877666950226,
-1.7704060077667236,
0.08629882335662842,
0.28343451023101807,
-0.28608185052871704,
-0.5479545593261719,
1.1743921041488647,
0.47951212525367737,
-0.3309727609157562,
0.5977498888969421,
-1.0053914785385132,
-0.072253905236721... |
func ready(s *discordgo.Session, event *discordgo.Ready) {
s.UpdateStatus(0, "with themselves")
} | [
0.10792014002799988,
-0.4659990072250366,
0.39260169863700867,
-0.21687349677085876,
-0.17594239115715027,
0.24120721220970154,
-0.5186026692390442,
0.819472074508667,
0.4471569061279297,
0.7850112318992615,
-1.5180305242538452,
1.4243122339248657,
0.7494263648986816,
0.7224439382553101,
... |
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
// Ignore all messages created by the bot itself
// This isn't required in this specific example but it's a good practice.
if m.Author.ID == s.State.User.ID {
return
}
if strings.HasPrefix(m.Content, "!primify") {
c, err := s.State.Channe... | [
0.3837706446647644,
0.30986446142196655,
0.5010494589805603,
-0.1700383871793747,
1.0663750171661377,
-0.4648987054824829,
-0.8912625312805176,
-0.49277371168136597,
-0.2741169035434723,
-0.5012183785438538,
0.3571735918521881,
0.23544420301914215,
0.36690327525138855,
0.697451114654541,
... |
func guildCreate(s *discordgo.Session, event *discordgo.GuildCreate) {
if event.Guild.Unavailable {
return
}
for _, channel := range event.Guild.Channels {
if channel.ID == event.Guild.ID {
_, _ = s.ChannelMessageSend(channel.ID, "primitive-gobot is ready!")
return
}
}
} | [
0.6466675996780396,
0.36542102694511414,
0.4712044298648834,
-0.35468965768814087,
0.9415634870529175,
-0.3335334360599518,
-1.255329966545105,
-0.26792001724243164,
-0.5300228595733643,
0.6589828729629517,
-0.7195608019828796,
1.3557864427566528,
0.3158211410045624,
0.985984206199646,
-... |
func RemoveTask(path string, ids []int) error {
var old []Task
var new []Task
// Read from file
tasks, err := ReadTasks(path)
if err != nil {
return err
}
// Create remove map
removeMap := make(map[int]bool)
for _, id := range ids {
id = id - 1 // index 0
removeMap[id] = true
}
// Update status
for... | [
-0.8267615437507629,
-1.0558980703353882,
0.6063663363456726,
0.12963666021823883,
0.05110080912709236,
0.28313520550727844,
0.6115872859954834,
1.2236175537109375,
-0.17129532992839813,
0.6146316528320312,
-0.8294747471809387,
-0.044918883591890335,
0.38176602125167847,
0.0755358338356018... |
func login(cmd *cobra.Command, args []string) {
var username, password string
flags := cmd.Flags()
srvalias, _ := flags.GetString("server")
conf := config.Read()
if srvalias == "" {
srvalias = conf.DefaultServer
}
fmt.Printf("Logging into %s\n", srvalias)
if len(args) == 0 {
// prompt for login
fmt.Pri... | [
-0.02037225104868412,
0.1476472169160843,
1.0557705163955688,
0.36484494805336,
0.6865012049674988,
0.4379635751247406,
0.5757936835289001,
0.19852690398693085,
-0.6031838059425354,
-0.2969138026237488,
-0.3672125041484833,
1.281575083732605,
-0.6199484467506409,
-0.053391676396131516,
0... |
func LoginCmd() *cobra.Command {
description := "Login to the GIN services.\n\nIf no username is specified on the command line, you will be prompted for it. The login command always prompts for a password."
var cmd = &cobra.Command{
Use: "login [<username>]",
Short: "Login to the... | [
-0.12062905728816986,
-0.34726712107658386,
0.6987491250038147,
-0.3346676528453827,
0.012477874755859375,
0.6190440654754639,
0.273592084646225,
0.49884241819381714,
-0.2701260447502136,
-1.1432722806930542,
0.0781378224492073,
0.9933082461357117,
-0.1738997995853424,
0.06579699367284775,... |
func SetOutput(w io.Writer) {
plog.SetOutput(w)
} | [
0.4279792308807373,
0.05854242667555809,
0.17734435200691223,
0.24007081985473633,
-0.7512896656990051,
0.36642202734947205,
1.2211906909942627,
-0.03528442233800888,
-0.4140920341014862,
-0.1068754643201828,
-0.649427056312561,
-0.17531663179397583,
0.27245479822158813,
0.2176696956157684... |
func SetDebug(isDebug bool) {
plog.isDebug = isDebug
} | [
0.7345701456069946,
0.37383678555488586,
0.49388641119003296,
1.1875038146972656,
0.4981445074081421,
1.0882995128631592,
-0.19170257449150085,
0.5351415872573853,
0.7436521649360657,
-0.050629474222660065,
-0.4609270989894867,
0.40120938420295715,
-0.06912027299404144,
0.5443381667137146,... |
func Infof(f string, args ...interface{}) {
plog.Infof(f, args...)
} | [
1.0769768953323364,
0.35503116250038147,
0.6132804155349731,
0.3034649193286896,
0.36787232756614685,
0.6989099383354187,
0.5100630521774292,
0.261909157037735,
-0.9456676244735718,
-0.33442938327789307,
-0.30830511450767517,
0.8508279323577881,
1.0107249021530151,
0.20782612264156342,
0... |
func Debugf(f string, args ...interface{}) {
plog.Debugf(f, args...)
} | [
0.45909446477890015,
0.9393810033798218,
0.6396124958992004,
0.3787258267402649,
-0.15151987969875336,
0.334005743265152,
-0.11536680161952972,
0.17427875101566315,
-1.1808041334152222,
-0.8512204885482788,
-0.8064088821411133,
0.17193251848220825,
0.5781177878379822,
0.533470094203949,
... |
func SetPrinter(p Printer) {
plog.printer = p
} | [
-0.029199782758951187,
-0.7968965172767639,
0.4444120526313782,
0.1440342515707016,
-0.7937239408493042,
1.248967170715332,
-0.024463331326842308,
0.634332001209259,
0.32899007201194763,
-0.6892014741897583,
-0.4926898181438446,
0.5028082728385925,
-0.7013426423072815,
0.9933011531829834,
... |
func New(w io.Writer) *PLog {
p := &PLog{
writer: w,
}
dp := &defaultPrinter{now: time.Now}
dp.setOutput(w)
p.printer = dp
return p
} | [
-0.12040360271930695,
-0.7695409655570984,
0.36480391025543213,
0.08646240830421448,
-1.2476341724395752,
0.37207499146461487,
-0.021515846252441406,
-0.30139297246932983,
-0.46909236907958984,
0.07218371331691742,
-0.6089782118797302,
-0.5090833902359009,
0.1957847625017166,
0.27840045094... |
func (p *PLog) SetOutput(w io.Writer) {
p.writer = w
} | [
0.22842669486999512,
0.08659879863262177,
0.10584598034620285,
0.008076608180999756,
-0.3069078326225281,
0.4730544090270996,
1.081740140914917,
0.1054912805557251,
-0.5799295902252197,
0.11825738847255707,
-0.5349677205085754,
-0.3716202974319458,
-0.3925912380218506,
0.13108330965042114,... |
func (p *PLog) SetDebug(isDebug bool) {
p.isDebug = isDebug
} | [
0.33942273259162903,
0.3611741065979004,
0.524547815322876,
1.0788013935089111,
0.5016363859176636,
1.2079253196716309,
-0.1921854019165039,
0.5077534317970276,
0.5462689399719238,
0.1106906309723854,
-0.3825930058956146,
0.1490938365459442,
-0.4874727129936218,
0.43298980593681335,
-0.9... |
func (p *PLog) Infof(f string, args ...interface{}) {
p.mu.Lock()
defer p.mu.Unlock()
p.printer.Printf(p.writer, LogLevelInfo, f, args...)
} | [
0.4688342213630676,
-0.5566388368606567,
0.44206446409225464,
0.15126609802246094,
0.7061414122581482,
0.4543847441673279,
0.43479204177856445,
0.30909308791160583,
-1.31386399269104,
-0.4292409420013428,
0.11222440004348755,
0.8014187216758728,
-0.01024154108017683,
-0.08219738304615021,
... |
func (p *PLog) Debugf(f string, args ...interface{}) {
if p.isDebug {
p.mu.Lock()
defer p.mu.Unlock()
p.printer.Printf(p.writer, LogLevelDebug, f, args...)
}
} | [
0.06693080812692642,
0.5715845227241516,
0.5979375839233398,
0.37376052141189575,
0.47972819209098816,
0.07618146389722824,
-0.20384323596954346,
0.2842692732810974,
-0.971824049949646,
-0.5012380480766296,
0.13746874034404755,
0.3670271933078766,
-0.6627834439277649,
0.5420371294021606,
... |
func (p *PLog) SetPrinter(pr Printer) {
p.printer = pr
} | [
-0.2765505909919739,
-0.7873196601867676,
0.4141788184642792,
-0.08992587774991989,
-0.5885158181190491,
1.357421875,
-0.10943154245615005,
0.4054469168186188,
0.20444244146347046,
-0.7072501182556152,
-0.493461012840271,
0.49086225032806396,
-1.1048078536987305,
1.0503857135772705,
0.47... |
func FetchTestData() {
f, err := os.Create(testPlaylistResponseDataFile)
exitOnError(err)
requestURL := fmt.Sprintf(playlistFetchURL, testPlaylistID)
resp, err := http.Get(requestURL)
exitOnError(err)
defer resp.Body.Close()
n, err := io.Copy(f, resp.Body)
exitOnError(err)
fmt.Printf("Successfully fetched play... | [
0.6842365860939026,
-0.6890548467636108,
0.34844550490379333,
-0.5677329301834106,
0.43274176120758057,
1.0791178941726685,
0.2605433464050293,
-0.9582933187484741,
0.38768237829208374,
0.2574140429496765,
-0.79345703125,
0.8008337020874023,
-0.9003421068191528,
-0.357955664396286,
-0.40... |
func pathIsChild(parent, child string) bool {
if !strings.HasPrefix(child, parent) {
return false
}
rel := child[len(parent):]
rel = strings.Trim(rel, "/")
return !strings.Contains(rel, "/")
} | [
1.206566333770752,
-0.513200581073761,
0.4151257872581482,
-0.19017066061496735,
-0.5848316550254822,
0.7406938672065735,
-0.20401491224765778,
-0.62302166223526,
0.02746739238500595,
0.5035122036933899,
-0.422073096036911,
-0.08270037174224854,
-0.7401872873306274,
-0.6566770672798157,
... |
func GetProperty(xu *xgbutil.XUtil, win xproto.Window, atom string) (
*xproto.GetPropertyReply, error) {
atomId, err := Atm(xu, atom)
if err != nil {
return nil, err
}
reply, err := xproto.GetProperty(xu.Conn(), false, win, atomId,
xproto.GetPropertyTypeAny, 0, (1<<32)-1).Reply()
if err != nil {
return n... | [
0.35174885392189026,
-0.25174853205680847,
0.937300980091095,
0.2753285765647888,
0.09050917625427246,
-0.360385537147522,
-0.0017698777373880148,
-0.9505857825279236,
0.20718353986740112,
0.3634117841720581,
0.3642336130142212,
1.1884205341339111,
-1.1845483779907227,
-0.42687419056892395... |
func ChangeProp(xu *xgbutil.XUtil, win xproto.Window, format byte, prop string,
typ string, data []byte) error {
propAtom, err := Atm(xu, prop)
if err != nil {
return err
}
typAtom, err := Atm(xu, typ)
if err != nil {
return err
}
return xproto.ChangePropertyChecked(xu.Conn(), xproto.PropModeReplace, win... | [
0.1394347846508026,
-0.16138434410095215,
0.7326645851135254,
0.2810952961444855,
0.16331824660301208,
0.85246741771698,
-0.3579285740852356,
-0.6511802673339844,
-0.029106710106134415,
0.7913070321083069,
0.4661126434803009,
1.2810497283935547,
-0.7197475433349609,
-0.31842246651649475,
... |
func ChangeProp32(xu *xgbutil.XUtil, win xproto.Window, prop string, typ string,
data ...uint) error {
buf := make([]byte, len(data)*4)
for i, datum := range data {
xgb.Put32(buf[(i*4):], uint32(datum))
}
return ChangeProp(xu, win, 32, prop, typ, buf)
} | [
-0.18567948043346405,
0.31830891966819763,
0.6685516238212585,
-0.2778417766094208,
-0.05849025771021843,
0.9737359881401062,
-0.8148638606071472,
-0.9314491152763367,
-0.7934319376945496,
0.8795111179351807,
-0.4335829019546509,
0.9345741868019104,
-0.35653406381607056,
-0.193158462643623... |
func WindowToInt(ids []xproto.Window) []uint {
ids32 := make([]uint, len(ids))
for i, v := range ids {
ids32[i] = uint(v)
}
return ids32
} | [
-0.9768922328948975,
-0.8661696910858154,
0.5438730716705322,
-0.5885438919067383,
0.027821647003293037,
0.13943171501159668,
0.3196972906589508,
-0.7489252686500549,
0.621193528175354,
1.1383912563323975,
-1.20111882686615,
0.7208935022354126,
-0.7619037628173828,
0.42897388339042664,
-... |
func AtomToUint(ids []xproto.Atom) []uint {
ids32 := make([]uint, len(ids))
for i, v := range ids {
ids32[i] = uint(v)
}
return ids32
} | [
-1.1043795347213745,
-0.28539204597473145,
0.5339341759681702,
-1.5842307806015015,
0.607417643070221,
0.21691910922527313,
-0.882854163646698,
0.019306324422359467,
-0.06659518927335739,
0.6211233139038086,
-0.9486516118049622,
0.2129908949136734,
0.03493876755237579,
-0.8733354210853577,... |
func StrToAtoms(xu *xgbutil.XUtil, atomNames []string) ([]uint, error) {
var err error
atoms := make([]uint, len(atomNames))
for i, atomName := range atomNames {
a, err := Atom(xu, atomName, false)
if err != nil {
return nil, err
}
atoms[i] = uint(a)
}
return atoms, err
} | [
-1.0431115627288818,
-0.1117967888712883,
0.7216753959655762,
-0.9974477291107178,
0.20950555801391602,
-0.04383622482419014,
-0.3806321620941162,
-0.5602127909660339,
-0.4840434491634369,
0.5694051384925842,
-0.8985885977745056,
-0.027410492300987244,
-0.07235252857208252,
-0.320895671844... |
func PropValAtom(xu *xgbutil.XUtil, reply *xproto.GetPropertyReply,
err error) (string, error) {
if err != nil {
return "", err
}
if reply.Format != 32 {
return "", fmt.Errorf("PropValAtom: Expected format 32 but got %d",
reply.Format)
}
return AtomName(xu, xproto.Atom(xgb.Get32(reply.Value)))
} | [
0.5646949410438538,
-0.04249158874154091,
0.5142871141433716,
0.07029193639755249,
-0.28547802567481995,
0.6177372932434082,
-0.5936597585678101,
-1.0122514963150024,
0.3365510106086731,
-0.03395363315939903,
0.6383842825889587,
0.9623798727989197,
0.17786478996276855,
-1.1406548023223877,... |
func PropValAtoms(xu *xgbutil.XUtil, reply *xproto.GetPropertyReply,
err error) ([]string, error) {
if err != nil {
return nil, err
}
if reply.Format != 32 {
return nil, fmt.Errorf("PropValAtoms: Expected format 32 but got %d",
reply.Format)
}
ids := make([]string, reply.ValueLen)
vals := reply.Value
f... | [
-0.015562700107693672,
0.38184332847595215,
0.47553375363349915,
0.04604261368513107,
0.0897522121667862,
0.5930184125900269,
-1.106541395187378,
-1.1934999227523804,
0.0018125545466318727,
0.4105246365070343,
-0.048273127526044846,
0.4903582036495209,
-0.7473069429397583,
-0.6473510861396... |
func PropValWindow(reply *xproto.GetPropertyReply,
err error) (xproto.Window, error) {
if err != nil {
return 0, err
}
if reply.Format != 32 {
return 0, fmt.Errorf("PropValId: Expected format 32 but got %d",
reply.Format)
}
return xproto.Window(xgb.Get32(reply.Value)), nil
} | [
0.4560350477695465,
0.3884231746196747,
0.6368221044540405,
0.5052523612976074,
-0.4876358211040497,
0.7032591700553894,
-0.13259737193584442,
-0.971631646156311,
0.27780845761299133,
-0.4938293993473053,
0.9055421948432922,
1.430140495300293,
-0.6336206197738647,
0.1373549997806549,
-0.... |
func PropValWindows(reply *xproto.GetPropertyReply,
err error) ([]xproto.Window, error) {
if err != nil {
return nil, err
}
if reply.Format != 32 {
return nil, fmt.Errorf("PropValIds: Expected format 32 but got %d",
reply.Format)
}
ids := make([]xproto.Window, reply.ValueLen)
vals := reply.Value
for i ... | [
0.04020282253623009,
-0.053084760904312134,
0.6013488173484802,
0.2769050896167755,
-0.09608878940343857,
0.43507927656173706,
-0.7420960068702698,
-0.7005548477172852,
0.4005610942840576,
0.8147497177124023,
-0.013044304214417934,
1.2338104248046875,
-1.3524489402770996,
0.354760348796844... |
func PropValNum(reply *xproto.GetPropertyReply, err error) (uint, error) {
if err != nil {
return 0, err
}
if reply.Format != 32 {
return 0, fmt.Errorf("PropValNum: Expected format 32 but got %d",
reply.Format)
}
return uint(xgb.Get32(reply.Value)), nil
} | [
0.010001190938055515,
0.17095041275024414,
0.7484935522079468,
0.2502613663673401,
0.5421468019485474,
-0.08099755644798279,
0.14643698930740356,
-0.6765990853309631,
0.7478032112121582,
-0.9031202793121338,
0.3696524500846863,
0.7166703343391418,
0.17575401067733765,
-0.733465850353241,
... |
func PropValNums(reply *xproto.GetPropertyReply, err error) ([]uint, error) {
if err != nil {
return nil, err
}
if reply.Format != 32 {
return nil, fmt.Errorf("PropValIds: Expected format 32 but got %d",
reply.Format)
}
nums := make([]uint, reply.ValueLen)
vals := reply.Value
for i := 0; len(vals) >= 4; ... | [
0.057959988713264465,
0.17673726379871368,
0.6546934247016907,
-0.35901105403900146,
0.23944920301437378,
0.24284441769123077,
-0.6654112339019775,
-0.49632593989372253,
0.6797147989273071,
-0.343051552772522,
-0.14447037875652313,
0.8346301913261414,
0.008172369562089443,
-0.3606019914150... |
func PropValNum64(reply *xproto.GetPropertyReply, err error) (int64, error) {
if err != nil {
return 0, err
}
if reply.Format != 32 {
return 0, fmt.Errorf("PropValNum: Expected format 32 but got %d",
reply.Format)
}
return int64(xgb.Get32(reply.Value)), nil
} | [
-0.3467986583709717,
0.24748195707798004,
0.5143438577651978,
1.1301738023757935,
0.3626765310764313,
-0.32999053597450256,
-0.11101480573415756,
-0.7459190487861633,
0.4099804162979126,
-0.6152595281600952,
0.4881996810436249,
0.18683405220508575,
0.05721591040492058,
0.016197020187973976... |
func PropValStr(reply *xproto.GetPropertyReply, err error) (string, error) {
if err != nil {
return "", err
}
if reply.Format != 8 {
return "", fmt.Errorf("PropValStr: Expected format 8 but got %d",
reply.Format)
}
return string(reply.Value), nil
} | [
0.1637723296880722,
-0.6228110790252686,
0.4502297043800354,
0.5110827088356018,
-0.29077887535095215,
0.5225458145141602,
-0.9074817299842834,
-0.9990134239196777,
0.9084908962249756,
0.12021976709365845,
1.5579848289489746,
0.5302335619926453,
-0.07536286115646362,
-0.6017745733261108,
... |
func PropValStrs(reply *xproto.GetPropertyReply, err error) ([]string, error) {
if err != nil {
return nil, err
}
if reply.Format != 8 {
return nil, fmt.Errorf("PropValStrs: Expected format 8 but got %d",
reply.Format)
}
var strs []string
sstart := 0
for i, c := range reply.Value {
if c == 0 {
strs ... | [
-0.08298353105783463,
-0.7860323786735535,
0.5430917143821716,
-0.09323012083768845,
0.11870294064283371,
0.44311490654945374,
-0.9883406162261963,
-1.0544073581695557,
0.7401323318481445,
0.32862699031829834,
1.2094154357910156,
1.1097866296768188,
-0.5486185550689697,
0.09890274703502655... |
func Open(filename string, inictl string) (port Port, err error) {
var file *os.File
// NONBLOCK prevents Open from blocking
// until DCD is asserted from modem
if file, err = os.OpenFile(filename, os.O_RDWR|unix.O_NOCTTY|unix.O_NONBLOCK, 0); err != nil {
return
}
d := new(dev)
d.File = file
d.name = filenam... | [
0.08846462517976761,
0.08365914970636368,
0.9377188682556152,
-0.45598095655441284,
-0.8619226813316345,
0.5896356701850891,
0.7569659948348999,
0.23298802971839905,
-0.5488893985748291,
-0.06203753873705864,
0.23892277479171753,
0.2920130491256714,
-0.10474912822246552,
-0.344923377037048... |
func (this *Report) Generate(templateFile string) (latex_file *os.File, err error) {
dash,err := this.gClient.GetDashboard(this.dashName)
if err != nil {
return
}
err = this.renderPNGsParallel(dash)
if err != nil {
return
}
err = this.generateTeXFile(dash, templateFile)
if err != nil {
return
}
latex_fi... | [
0.8771488666534424,
0.6965225338935852,
0.6960548758506775,
-0.00901886448264122,
0.02278103306889534,
0.5710355639457703,
0.44657155871391296,
1.1933913230895996,
-1.5628983974456787,
-1.0975077152252197,
-0.1903752237558365,
-0.944113552570343,
0.3927398920059204,
0.28261810541152954,
... |
func TestLogger(t *testing.T) {
SetLevel(DEBUG)
lg := GetLogger("debug")
// lg.SetConsole()
// lg.SetFileRoller("./logs", 3, 1)
// lg.SetDayRoller("./logs", 2)
// lg.SetHourRoller("./logs", 2)
bs := make([]byte, 1024)
longmsg := string(bs)
for i := 0; i < 10; i++ {
lg.Debug("debugxxxxxxxxxxxxxxxxxxxxxxxxxxx"... | [
0.20247520506381989,
0.49570539593696594,
0.8632025122642517,
-0.3198581635951996,
0.5873320698738098,
0.014166666194796562,
0.290311723947525,
-0.5934081077575684,
-0.2025948464870453,
-0.8742059469223022,
-0.046573273837566376,
0.08921840041875839,
-0.07323696464300156,
1.804103612899780... |
func TestGetLogList(t *testing.T) {
w := NewDateWriter("./logs", "abc", HOUR, 0)
w.cleanOldLogs()
} | [
0.11853589117527008,
0.315534770488739,
0.4739014506340027,
0.26918354630470276,
0.8951019048690796,
0.21387958526611328,
-0.38162073493003845,
-0.10021668672561646,
0.42000144720077515,
-0.12922514975070953,
-1.2159444093704224,
0.27894821763038635,
0.3917158544063568,
0.35000866651535034... |
func BenchmarkRogger(b *testing.B) {
SetLevel(DEBUG)
bs := make([]byte, 1024)
longmsg := string(bs)
lg := GetLogger("rogger")
lg.SetFileRoller("./logs", 10, 100)
for i := 0; i < b.N; i++ {
lg.Debug("debugxxxxxxxxxxxxxxxxxxxxxxxxxxx")
lg.Info(longmsg)
lg.Warn("warn")
lg.Error("ERROR")
}
FlushLogger()
} | [
0.6218968629837036,
1.00055730342865,
0.7531712055206299,
-0.5120541453361511,
0.9810857176780701,
-0.7698883414268494,
0.27566471695899963,
0.42740190029144287,
-0.8456445336341858,
0.09217557311058044,
-0.4452808201313019,
1.044487714767456,
-0.41203540563583374,
1.1105588674545288,
0.... |
func TestColoredLogger(t *testing.T) {
SetLevel(DEBUG)
Colored()
lg := GetLogger("debug")
bs := make([]byte, 1024)
longmsg := string(bs)
for i := 0; i < 10; i++ {
lg.Debug("debugxxxxxxxxxxxxxxxxxxxxxxxxxxx")
lg.Info(longmsg)
lg.Warn("warn")
lg.Error("ERROR")
func() {
lg.Info("closure func log")
}(... | [
0.2276449054479599,
0.5013782978057861,
1.0045192241668701,
-0.6766033172607422,
0.6427052617073059,
0.04819240793585777,
0.016425758600234985,
-0.5583440661430359,
-0.05982985347509384,
-0.9697873592376709,
-0.12511715292930603,
1.4734206199645996,
-0.23883506655693054,
1.398803949356079,... |
func maxInts(ints ...int) int {
max := -1
for _, value := range ints {
if value > max {
max = value
}
}
return max
} | [
-0.4154203534126282,
0.03112480789422989,
0.36110973358154297,
0.18193039298057556,
-0.07420311868190765,
-0.2243906855583191,
-0.8283649682998657,
-0.10751301795244217,
-0.47109541296958923,
-0.33967721462249756,
0.4686688184738159,
0.04618410766124725,
-0.39513397216796875,
0.17584668099... |
func GetPopulars(proNum, exNum int) (error, []*PkgExam, []*PkgInfo, []*PkgInfo, []*PkgInfo, []*PkgInfo) {
q := connDb()
defer q.Close()
var ruExs []*PkgExam
err := q.OmitFields("examples", "created").
Limit(exNum).OrderByDesc("created").FindAll(&ruExs)
if err != nil {
return err, nil, nil, nil, nil, nil
}
... | [
-0.052536334842443466,
0.7207922339439392,
0.997645378112793,
-0.11905630677938461,
-0.17732104659080505,
-0.1200898215174675,
0.05520420894026756,
-0.39921388030052185,
0.3648645579814911,
0.4265567660331726,
0.39233726263046265,
1.1279442310333252,
0.046312738209962845,
0.446748942136764... |
func SaveProject(pinfo *PkgInfo, pdecl *PkgDecl, pfuncs []*PkgFunc, imports []string) error {
q := connDb()
defer q.Close()
// Load package information(save after checked import information).
info := new(PkgInfo)
err := q.WhereEqual("path", pinfo.Path).Find(info)
if err == nil {
pinfo.Id = info.Id
}
// ----... | [
-0.6106052994728088,
-0.18252113461494446,
0.6127402186393738,
0.36362555623054504,
0.36486291885375977,
0.34654712677001953,
0.7149973511695862,
-0.3252585232257843,
-0.807198703289032,
0.42902716994285583,
-0.9879264831542969,
-0.9462376236915588,
-0.7671811580657959,
-0.0912675634026527... |
func checkImport(q *qbs.Qbs, path string, id int64) bool {
pinfo := &PkgInfo{
Id: id,
}
err := q.Find(pinfo)
if err != nil {
return false
}
decl := new(PkgDecl)
cond := qbs.NewCondition("pid = ?", pinfo.Id).And("tag = ?", "")
err = q.Condition(cond).Find(decl)
if err != nil {
return false
}
if string... | [
0.18910080194473267,
-0.3812979459762573,
0.7730846405029297,
0.42103180289268494,
0.2333003729581833,
0.5629516243934631,
-0.6874702572822571,
-0.19440659880638123,
-0.6054154634475708,
-0.01736273616552353,
-0.4045814275741577,
-0.13485923409461975,
-1.101000189781189,
0.8512430787086487... |
func LoadProject(pid int64, tag string) (*PkgDecl, error) {
// Check path length to reduce connect times.
if pid == 0 {
return nil, errors.New("models.LoadProject -> Zero id.")
}
q := connDb()
defer q.Close()
pdecl := new(PkgDecl)
cond := qbs.NewCondition("pid = ?", pid).And("tag = ?", tag)
err := q.Conditi... | [
0.46654078364372253,
0.13445982336997986,
0.3928670883178711,
0.4430694282054901,
-0.37607595324516296,
-0.4028128385543823,
-1.11465585231781,
-0.18391849100589752,
-0.8259984254837036,
0.21929548680782318,
0.2066567838191986,
-0.3089578449726105,
-1.0828611850738525,
-0.01886245049536228... |
func DeleteProject(path string) {
// Check path length to reduce connect times(except launchpad.net).
if path[0] != 'l' && len(strings.Split(path, "/")) <= 2 {
beego.Error("models.DeleteProject(", path, ") -> Short path as not needed")
return
}
q := connDb()
defer q.Close()
var i1, i2, i3, i4, i5 int64
// ... | [
-0.38553667068481445,
0.2687854468822479,
0.7605912089347839,
0.3383261263370514,
0.2901666760444641,
0.004996516741812229,
0.9750459790229797,
-0.33210673928260803,
-0.5246448516845703,
0.024554871022701263,
-0.18915987014770508,
-0.9719563126564026,
-0.1909877210855484,
0.212029144167900... |
func FlushCacheProjects(pinfos []*PkgInfo, procks []*PkgRock) {
q := connDb()
defer q.Close()
// Update project data.
for _, p := range pinfos {
info := new(PkgInfo)
err := q.WhereEqual("path", p.Path).Find(info)
if err == nil {
// Shoule always be nil, just in case not exist.
p.Id = info.Id
// Limi... | [
-1.1190614700317383,
0.5469881296157837,
0.7446577548980713,
0.09653399139642715,
0.7486669421195984,
0.6752153038978577,
0.684323251247406,
-0.09318314492702484,
-0.3778764605522156,
0.3537052273750305,
0.05486312136054039,
0.07700003683567047,
-0.490266352891922,
0.051340434700250626,
... |
func main() {
http.HandleFunc("/", handlers.Home)
http.HandleFunc("/about", handlers.About)
fmt.Printf("Staring application on port %s", portNumber)
_ = http.ListenAndServe(portNumber, nil)
} | [
0.1776837259531021,
-0.5794952511787415,
0.5428801774978638,
0.8718397617340088,
0.3751560151576996,
0.9432305097579956,
0.845928430557251,
0.5080511569976807,
-0.7097673416137695,
-0.8331968784332275,
-0.028528474271297455,
0.2169327586889267,
0.5897684693336487,
0.7674030661582947,
0.8... |
func EncodeInt(text, code []byte) []byte { // text -> code
if len(text) == 0 { // empty input
return code
}
if code, ok := isZero(text, code); ok {
return code
}
switch text[0] {
case PLUS: // positive int
code = encodePosInt(text[1:], code)
case MINUS: // negative int
code = encodeNegInt(text[1:], code... | [
0.22780771553516388,
0.12490668892860413,
0.45474639534950256,
-0.04307456314563751,
-0.8957757353782654,
0.4349108934402466,
-1.2001991271972656,
-0.5491414666175842,
-0.21876130998134613,
0.302774578332901,
-0.16966545581817627,
0.07739640027284622,
-1.2538118362426758,
0.444733053445816... |
func encodePosInt(text []byte, code []byte) []byte {
code = append(code, posPrefix)
if len(text) > 1 {
// TODO: replace Itoa with more efficient function.
c := encodePosInt([]byte(strconv.Itoa(len(text))), code[1:])
code = code[:1+len(c)]
}
code = append(code, text...)
return code
} | [
-0.11263411492109299,
-0.01975356414914131,
0.4767323434352875,
-0.6922007203102112,
-0.6808315515518188,
-0.20538873970508575,
-1.0917176008224487,
-0.0073232934810221195,
0.18995773792266846,
0.9827827215194702,
-0.48656076192855835,
0.17725594341754913,
-1.0826501846313477,
0.0913324281... |
func encodeNegInt(text []byte, code []byte) []byte {
code = append(code, negPrefix)
if len(text) > 1 {
// TODO: replace Itoa with more efficient function.
c := encodeNegInt([]byte(strconv.Itoa(len(text))), code[1:])
code = code[:1+len(c)]
}
for _, x := range text {
code = append(code, negIntLookup[x])
}
r... | [
-1.0284019708633423,
-0.09586109966039658,
0.5911800265312195,
-0.4718223512172699,
-0.36265912652015686,
-0.22848694026470184,
-1.1006474494934082,
-0.6473400592803955,
0.18462532758712769,
1.2074261903762817,
-0.39546069502830505,
0.27873414754867554,
-1.324942708015442,
0.70377898216247... |
func isZero(text, code []byte) ([]byte, bool) {
// Handle different forms of zero.
if (len(text) == 1) && (text[0] == ZERO) {
code = append(code, ZERO)
return code, true
} else if (len(text) == 2) && ((text[0] == PLUS) || (text[0] == MINUS)) &&
(text[1] == ZERO) {
code = append(code, ZERO)
return code, t... | [
-0.41570043563842773,
-0.04420211911201477,
0.8772584199905396,
0.9667493104934692,
-0.49854904413223267,
-0.7558628916740417,
-0.4398755729198456,
0.7277026176452637,
0.7257552146911621,
-0.1833781898021698,
-1.0211553573608398,
-0.0034464860800653696,
-0.8734562397003174,
0.8093434572219... |
func DecodeInt(code, text []byte) (int, []byte) { // code -> text
if len(code) == 0 { // empty input
return 0, text
}
if code[0] == ZERO {
text = append(text, ZERO)
return 1, text
}
var skip int
var final []byte
switch code[0] {
case posPrefix:
text = append(text, PLUS)
skip, final = doDecodeInt(cod... | [
-0.956261157989502,
0.20206321775913239,
0.6184401512145996,
-0.7377530932426453,
-0.5509269833564758,
-0.4210241436958313,
-0.4587499797344208,
0.3522646427154541,
-0.06548323482275009,
0.512624204158783,
-0.5143647789955139,
-0.11819589883089066,
-0.726934015750885,
0.9040837287902832,
... |
func doDecodeInt(code, text []byte) (int, []byte) {
var skip int
if code[0] == posPrefix {
skip, text = doDecodeInt(code[1:], text)
s := skip + len(text) + 1
l, _ := strconv.Atoi(string(text))
text = append(text[:0], code[s:s+l]...)
return s, text
} else if code[0] == negPrefix {
skip, text = doDecodeI... | [
-0.8316228985786438,
0.06080858036875725,
0.7008833289146423,
-0.9575120210647583,
-0.5450631976127625,
-0.5245364904403687,
-0.7343205213546753,
0.44026270508766174,
0.2222452312707901,
0.41315799951553345,
-0.4528793394565582,
0.20735420286655426,
-0.6028610467910767,
0.9487079381942749,... |
func DecodeFloat(code, text []byte) []byte {
if len(code) == 0 { // empty input
return text
} else if len(code) == 1 && code[0] == ZERO {
text = append(text, ZERO)
return text
}
msign := code[0]
var skip int
var final, exponent []byte
x := [128]byte{}
switch code[1] {
case negPrefix, posPrefix:
skip... | [
-0.5972317457199097,
0.4535796046257019,
0.6312238574028015,
-0.04457657039165497,
-0.2451527714729309,
-0.4868635833263397,
-0.19348382949829102,
0.8429337739944458,
0.015286617912352085,
-0.49012506008148193,
-0.21753200888633728,
-0.45654743909835815,
-0.6420373320579529,
1.269977331161... |
func EncodeSD(text, code []byte) []byte {
if len(text) == 0 { // empty input
return code
}
var prefix byte
prefix, text = signPrefix(text)
code = append(code, prefix)
// Remove decimal point and all zeros before that.
for i, x := range text {
if x == '.' {
text = text[i+1:]
break
}
}
if prefix ==... | [
0.09146847575902939,
-0.5063179731369019,
0.7846648097038269,
0.2441854029893875,
-0.5371902585029602,
0.6504365801811218,
-0.33096998929977417,
0.7339858412742615,
0.7397544980049133,
0.05761739984154701,
0.2722465991973877,
0.8207967877388,
-0.33980387449264526,
0.1996111273765564,
0.9... |
func DecodeSD(code, text []byte) []byte {
if len(code) == 0 {
return text
}
prefix, sign := code[0], prefixSign(code)
text = append(text, []byte{sign, ZERO, DOT}...)
// If negative number invert the digits.
if prefix == negPrefix {
for _, x := range code[1 : len(code)-1] {
text = append(text, negIntLooku... | [
-0.408287912607193,
0.28651121258735657,
0.8639969229698181,
0.350786417722702,
-0.9446732401847839,
0.004552406258881092,
-0.6604868173599243,
0.4902404248714447,
0.5307391285896301,
-0.5028560757637024,
0.06520543247461319,
0.6003861427307129,
-0.11703638732433319,
0.20074011385440826,
... |
func EncodeLD(text, code []byte) []byte {
if len(text) == 0 { // empty input
return code
}
prefix, _ := signPrefix(text)
// Encode integer and decimal part.
texts := bytes.Split(text, []byte{DOT})
if len(texts[0]) == 1 && texts[0][0] == ZERO {
code = append(code, prefix, ZERO)
} else if len(texts[0]) == 2 ... | [
0.5945762395858765,
0.15792924165725708,
0.8242834806442261,
-0.07527148723602295,
-1.0017966032028198,
-0.08504824340343475,
-0.5671274065971375,
0.07527223229408264,
0.831856369972229,
-0.130784273147583,
0.32309889793395996,
0.3872913122177124,
-0.3086806833744049,
0.7519295811653137,
... |
func DecodeLD(code, text []byte) []byte {
if len(code) == 0 { // empty input
return text
}
prefix, sign := code[0], prefixSign(code)
text = append(text, sign)
skip, textint := doDecodeInt(code[1:], text[1:])
l := len(textint) + 1
text = text[:l]
// If negative number invert the digits.
if sign == MINUS {
... | [
-0.39724528789520264,
0.02958887815475464,
0.8654826879501343,
-0.013524426147341728,
-1.3215347528457642,
0.6747978925704956,
-0.5688118934631348,
0.7943072319030762,
0.4915250539779663,
-0.2032417356967926,
0.2095639556646347,
0.7186015844345093,
-0.6850295066833496,
0.34521621465682983,... |
func signPrefix(text []byte) (byte, []byte) {
switch text[0] {
case PLUS:
return posPrefix, text[1:]
case MINUS:
return negPrefix, text[1:]
default:
return posPrefix, text
}
} | [
-0.8542765378952026,
-0.8877386450767517,
0.7985947132110596,
-0.3218669295310974,
-0.5893557071685791,
-0.3338894248008728,
-0.9560138583183289,
0.2921493649482727,
0.1958722621202469,
0.7155132293701172,
-1.331774115562439,
-0.48706963658332825,
-0.4204341769218445,
0.6238680481910706,
... |
func prefixSign(code []byte) byte {
var sign byte
switch code[0] {
case posPrefix:
sign = PLUS
case negPrefix:
sign = MINUS
}
return sign
} | [
-0.3116896450519562,
-0.34042811393737793,
0.5736749768257141,
-0.3890692889690399,
-0.2589167356491089,
0.05731521174311638,
-0.626655101776123,
0.27204686403274536,
0.7125264406204224,
-0.006060478743165731,
-0.8300605416297913,
-0.08654650300741196,
-0.33408692479133606,
0.7947999238967... |
func joinBytes(args ...[]byte) []byte {
return bytes.Join(args, []byte{})
} | [
0.4805852770805359,
0.6025227308273315,
0.4788801074028015,
0.46564292907714844,
0.6228709816932678,
0.4996248185634613,
-1.1286695003509521,
-0.007411970756947994,
-0.33513906598091125,
-0.20496349036693573,
-0.3512671887874603,
0.2584216892719269,
-1.060211181640625,
0.5175232291221619,
... |
func (ip *IssueProcessor) ActToIssueOpened(issue *github.Issue) error {
ip.attachLabels(issue)
ip.attachComments(issue)
return nil
} | [
-0.9003182053565979,
-1.321041464805603,
0.17553600668907166,
-0.9455051422119141,
0.11453419178724289,
0.41537925601005554,
1.2085511684417725,
0.3083883225917816,
0.8485454320907593,
0.24319618940353394,
0.5222033262252808,
0.8762710690498352,
0.19301219284534454,
0.05231636390089989,
... |
func addBlockToBlockchain(t *testing.T, bc *Blockchain) (coin.Block, coin.UxOut) {
// Split the genesis block into two transactions
assert.Equal(t, len(bc.GetUnspent().Array()), 1)
ux := bc.GetUnspent().Array()[0]
assert.Equal(t, ux.Body.Address, genAddress)
pub := cipher.PubKeyFromSecKey(genSecret)
assert.Equal(... | [
-0.014152455143630505,
0.49976420402526855,
1.0268820524215698,
-0.18783411383628845,
0.5206248760223389,
0.17561765015125275,
0.25769561529159546,
-0.29636311531066895,
0.09309829026460648,
0.020609023049473763,
-0.7258833050727844,
0.16439945995807648,
-0.39715465903282166,
0.22110940515... |
func init() {
parser.SharedParser().RegisterFabric(UpdateFabric{})
} | [
0.4695819020271301,
-0.4251294732093811,
0.2594076693058014,
-0.18702790141105652,
0.9981628656387329,
0.10008163750171661,
0.3165827989578247,
0.6611540913581848,
-0.7698036432266235,
-1.0383007526397705,
-1.0599720478057861,
0.5991960167884827,
-0.3431982696056366,
0.5393909811973572,
... |
func (c UpdateFabric) CommandName() string {
return command_list.CommandUpdate
} | [
-0.6845511794090271,
-0.9690250158309937,
0.3179461658000946,
0.8001079559326172,
0.3219216763973236,
-0.15796256065368652,
-0.14836782217025757,
0.4689943194389343,
0.3413127660751343,
-0.06891220062971115,
-0.06128045171499252,
0.25747233629226685,
0.03790777549147606,
0.3407375514507293... |
func (c UpdateFabric) RequireAdmin() bool {
return false
} | [
-0.4990975856781006,
0.13007883727550507,
0.34683868288993835,
0.5387338399887085,
-0.43011918663978577,
0.8223876357078552,
-0.30197951197624207,
-0.7316736578941345,
0.12823323905467987,
0.047586094588041306,
-0.3145800530910492,
-0.23931148648262024,
-1.2067466974258423,
0.8965663909912... |
func (c UpdateFabric) Require() []string {
return []string{command_list.CommandUpdate}
} | [
-1.100117564201355,
-0.6735126972198486,
0.36581161618232727,
0.5243690609931946,
0.5348398089408875,
0.29808682203292847,
-0.24069666862487793,
-0.3034699261188507,
-0.10729053616523743,
-0.20555686950683594,
-0.5860674977302551,
-0.031922005116939545,
-0.3717264235019684,
1.1122986078262... |
func (c UpdateFabric) TryParse(req iface.RequesterResponder) (iface.Command, error) {
var (
command UpdateCommand
err error
)
if command.findParams, command.updParams, _, err = service.CompareParseCommand(req.Request(), "/"+command_list.CommandUpdate); err != nil {
if err == service.UnknownCommandError {
... | [
-0.5156616568565369,
-0.10136348754167557,
0.6161308884620667,
0.30172625184059143,
1.1587984561920166,
-0.6221274733543396,
-0.5456991791725159,
-1.1246674060821533,
0.012893815524876118,
-0.9828405976295471,
0.5257819294929504,
-0.1830243617296219,
-0.9550856351852417,
0.6687110066413879... |
func NewPosition(line, column int, file string) *Position {
return &Position{
Line: line,
Column: column,
file: &file,
}
} | [
0.9200628995895386,
-1.557549238204956,
0.17053405940532684,
-0.02707885019481182,
-0.22136704623699188,
-0.02513028308749199,
-0.06681734323501587,
-0.2960880398750305,
-1.1015766859054565,
-0.08546679466962814,
0.265342652797699,
-1.014672040939331,
-0.08560281246900558,
-0.6766646504402... |
func (pos *Position) File() string {
return *pos.file
} | [
-0.7524328231811523,
-1.2430499792099,
0.06410270929336548,
-0.022852489724755287,
-0.5040310025215149,
1.021905779838562,
-0.14757931232452393,
-0.17019818723201752,
-0.5498030781745911,
-0.4176502227783203,
0.15358367562294006,
-0.9338455200195312,
0.7487726211547852,
0.1389203816652298,... |
func (pos *Position) Copy() *Position {
return &Position{
Line: pos.Line,
Column: pos.Column,
file: pos.file,
}
} | [
0.028271004557609558,
-1.8386268615722656,
0.43870896100997925,
-0.21576890349388123,
-1.157091736793518,
1.061476469039917,
-0.30468106269836426,
-0.2993258833885193,
-0.1127592921257019,
0.27490121126174927,
0.0011278920574113727,
-0.42471861839294434,
0.17190222442150116,
-0.69508361816... |
func (pos *Position) String() string {
if *pos.file == "" {
return fmt.Sprintf("L:%v|C:%v", pos.Line, pos.Column)
}
return fmt.Sprintf("%v|L:%v|C:%v", *pos.file, pos.Line, pos.Column)
} | [
0.1900181919336319,
-1.4219180345535278,
0.2259746640920639,
-0.8659282326698303,
0.12985828518867493,
0.5881450772285461,
-0.148854598402977,
-0.3464395999908447,
-0.9583984017372131,
0.2695186138153076,
0.06104808673262596,
-0.7391660809516907,
0.1935279667377472,
-0.07225683331489563,
... |
func (b *Book) Get(s StoryArc) (*Story, error) {
if v, ok := b.Contents[s]; ok {
return &v, nil
}
return nil, errors.New("story not found")
} | [
0.26312971115112305,
-0.8665909767150879,
0.16099737584590912,
0.8552055358886719,
0.7886320948600769,
-0.6043121218681335,
-0.41013145446777344,
-0.8630405068397522,
-0.9620448350906372,
-0.5084827542304993,
0.792306661605835,
0.3518470227718353,
0.743691623210907,
-0.5592263340950012,
... |
func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) {
if options == nil {
options = &arm.ClientOptions{}
}
ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint
if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {
ep = c.End... | [
1.3927820920944214,
-0.4001167118549347,
0.5297026038169861,
-0.3259865641593933,
0.009067218750715256,
0.1914442777633667,
-0.489860475063324,
-0.23067441582679749,
-0.1264103800058365,
-0.14780263602733612,
0.41850993037223816,
1.223183512687683,
-0.019004173576831818,
-0.656849324703216... |
func (client *Client) sapAvailabilityZoneDetailsCreateRequest(ctx context.Context, location string, options *ClientSAPAvailabilityZoneDetailsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabil... | [
0.04146914184093475,
0.29972290992736816,
0.3938606083393097,
-0.5438963770866394,
-0.33525344729423523,
0.6595295071601868,
0.3877253234386444,
0.012170766480267048,
1.0281774997711182,
0.12399396300315857,
0.16368794441223145,
0.368997722864151,
0.0597841776907444,
0.25476405024528503,
... |
func (client *Client) sapAvailabilityZoneDetailsHandleResponse(resp *http.Response) (ClientSAPAvailabilityZoneDetailsResponse, error) {
result := ClientSAPAvailabilityZoneDetailsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.SAPAvailabilityZoneDetailsResult); err != nil {
return ClientSAPAvailabilityZon... | [
0.39658021926879883,
-0.5240087509155273,
0.22460401058197021,
-0.37136900424957275,
-0.9110398292541504,
0.7600374817848206,
0.9569523930549622,
0.37989580631256104,
1.586318850517273,
0.03077254630625248,
-0.5372304320335388,
-1.5179102420806885,
-0.2408326119184494,
-0.24084904789924622... |
func (client *Client) sapDiskConfigurationsCreateRequest(ctx context.Context, location string, options *ClientSAPDiskConfigurationsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations"... | [
-0.6748440861701965,
0.9385417699813843,
0.6841217875480652,
0.022083111107349396,
0.009321593679487705,
-0.19920675456523895,
-0.054002054035663605,
-0.5723580718040466,
0.06439889222383499,
-0.12758076190948486,
0.5451224446296692,
0.09008095413446426,
0.2396547794342041,
0.6411015391349... |
func (client *Client) sapDiskConfigurationsHandleResponse(resp *http.Response) (ClientSAPDiskConfigurationsResponse, error) {
result := ClientSAPDiskConfigurationsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil {
return ClientSAPDiskConfigurationsResponse{}, err
... | [
-0.5096132159233093,
0.6353083848953247,
0.4912733733654022,
0.014268342405557632,
-0.6177096366882324,
-0.26640263199806213,
0.6843472123146057,
-0.4538176357746124,
0.6180601716041565,
-0.24467507004737854,
-0.2915838658809662,
-1.8441370725631714,
0.06816554069519043,
0.1796279102563858... |
func (client *Client) sapSizingRecommendationsCreateRequest(ctx context.Context, location string, options *ClientSAPSizingRecommendationsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecomme... | [
-0.4537419378757477,
0.880071222782135,
0.7506475448608398,
-0.942980945110321,
-0.5814276933670044,
0.43948787450790405,
-0.37885773181915283,
-0.3745656907558441,
0.12386096268892288,
0.5697370767593384,
0.6677785515785217,
1.120076298713684,
0.11450855433940887,
0.287029892206192,
0.0... |
func (client *Client) sapSizingRecommendationsHandleResponse(resp *http.Response) (ClientSAPSizingRecommendationsResponse, error) {
result := ClientSAPSizingRecommendationsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result); err != nil {
return ClientSAPSizingRecommendationsResponse{}, err
}
return result... | [
0.023715520277619362,
0.4309491515159607,
0.23060232400894165,
-0.83431077003479,
-1.1612187623977661,
0.43255841732025146,
0.4160636365413666,
-0.36870211362838745,
0.5602157711982727,
0.1622595191001892,
-0.5392708778381348,
-0.5328279137611389,
-0.25748443603515625,
-0.16946294903755188... |
func (client *Client) sapSupportedSKUCreateRequest(ctx context.Context, location string, options *ClientSAPSupportedSKUOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku"
if client.sub... | [
-0.4184826612472534,
0.8811530470848083,
0.8783723711967468,
-0.23331280052661896,
-1.0593328475952148,
0.16577987372875214,
-0.5020906925201416,
0.16919293999671936,
0.1738540530204773,
0.5153566598892212,
0.4849545955657959,
0.7106281518936157,
0.2854264974594116,
0.17418555915355682,
... |
func (client *Client) sapSupportedSKUHandleResponse(resp *http.Response) (ClientSAPSupportedSKUResponse, error) {
result := ClientSAPSupportedSKUResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.SAPSupportedResourceSKUsResult); err != nil {
return ClientSAPSupportedSKUResponse{}, err
}
return result, nil... | [
-0.09710004180669785,
0.2764330804347992,
0.39008575677871704,
-0.16941659152507782,
-1.6169307231903076,
0.11611822992563248,
0.2979746162891388,
0.5441428422927856,
1.1232435703277588,
-0.05186815187335014,
-0.497504323720932,
-1.125733494758606,
-0.2350621521472931,
-0.11364959180355072... |
func (this *BaseRouter) Prepare() {
//if conf.EnforceRedirect {
// // if the host not matching app settings then redirect to AppUrl
// if this.Ctx.Request.Host != conf.AppHost {
// this.Redirect(conf.AppUrl, 302)
// return
// }
//}
//// page start time
this.Data["PageStartTime"] = time.Now()
//// start se... | [
-0.211278036236763,
-0.6270148754119873,
1.03193998336792,
1.2759448289871216,
-0.2476329654455185,
0.005726919509470463,
0.10536716878414154,
0.07077503949403763,
0.20247367024421692,
0.09940844774246216,
-0.35831332206726074,
-0.5182116031646729,
0.20560680329799652,
0.32914474606513977,... |
func (this *BaseRouter) CheckActiveRedirect(args ...interface{}) bool {
fmt.Println("CheckActiveRedirect() function")
var redirect_to string
code := 302
needActive := true
for _, arg := range args {
switch v := arg.(type) {
case bool:
needActive = v
case string:
// custom redirect url
redirect_to = ... | [
-1.1502054929733276,
-0.8583657741546631,
0.9548578262329102,
0.09450779855251312,
0.32762420177459717,
0.2702804505825043,
0.5141072869300842,
-0.4046742618083954,
-0.37605565786361694,
-0.07050330936908722,
-0.16065311431884766,
-0.3170808255672455,
-0.32478582859039307,
0.10298199206590... |
func (this *BaseRouter) CheckLoginRedirect(args ...interface{}) bool {
fmt.Println("CheckLoginRedirect() function")
var redirect_to string
code := 302
needLogin := true
for _, arg := range args {
switch v := arg.(type) {
case bool:
needLogin = v
case string:
// custom redirect url
redirect_to = v
... | [
-1.9287916421890259,
-0.46146735548973083,
1.0607484579086304,
-0.42963680624961853,
0.2891520857810974,
0.41678687930107117,
-0.13642631471157074,
-0.04555286839604378,
0.1698271930217743,
-0.11480103433132172,
0.2502477765083313,
0.514797568321228,
-0.4229939877986908,
0.5633578896522522... |
func (this *BaseRouter) FlashRead(key string) (string, bool) {
fmt.Println("FlashRead() function")
if data, ok := this.Data["flash"].(map[string]string); ok {
value, ok := data[key]
return value, ok
}
return "", false
} | [
-0.6097851991653442,
-0.22040346264839172,
0.7690202593803406,
0.03569312021136284,
-0.8863455057144165,
0.3654390871524811,
-0.21268680691719055,
0.05067358538508415,
-0.04353027790784836,
0.022200213745236397,
-0.5199025869369507,
-0.20991942286491394,
-0.5443402528762817,
-0.09967259317... |
func (this *BaseRouter) FlashWrite(key string, value string) {
fmt.Println("FlashWrite() function")
flash := beego.NewFlash()
flash.Data[key] = value
flash.Store(&this.Controller)
} | [
-0.035696353763341904,
-0.12035422772169113,
0.4841732382774353,
0.42729565501213074,
0.7784885168075562,
-0.1021319106221199,
-0.2527066767215729,
1.1661009788513184,
-0.39906272292137146,
-0.2994931936264038,
-1.6472268104553223,
-0.102193683385849,
-0.007873696275055408,
0.5073698759078... |
func (this *BaseRouter) CheckFlashRedirect(value string) (match bool, redirect bool) {
fmt.Println("CheckFlashRedirect() function")
v := this.GetSession("on_redirect")
if params, ok := v.([]interface{}); ok {
if len(params) != 5 {
this.EndFlashRedirect()
goto end
}
uri := utils.ToStr(params[0])
code :=... | [
-0.40144941210746765,
-0.04769830405712128,
0.9591361880302429,
0.7131215333938599,
-0.807997465133667,
-0.023550892248749733,
0.3089287281036377,
0.17409025132656097,
0.44420701265335083,
-0.49762576818466187,
-0.5509949922561646,
-0.26539742946624756,
-0.5245800614356995,
0.3634207248687... |
func (this *BaseRouter) ValidForm(form interface{}, names ...string) bool {
fmt.Println("ValidForm() function")
valid, _ := this.validForm(form, names...)
return valid
} | [
-1.0966074466705322,
-0.17615261673927307,
0.7117284536361694,
0.5689969062805176,
-0.16849152743816376,
0.14561304450035095,
-0.07688422501087189,
0.683618426322937,
-0.5757257342338562,
-1.479527473449707,
-0.6835018992424011,
-0.9921987056732178,
-0.49118444323539734,
0.1613405197858810... |
func (this *BaseRouter) CheckXsrfCookie() bool {
fmt.Println("CheckXsrfCookie() function")
return this.Controller.CheckXsrfCookie()
} | [
-0.7592437267303467,
0.42045509815216064,
0.6559355854988098,
0.7643672823905945,
-0.33407095074653625,
-0.6202885508537292,
-0.22118350863456726,
-0.00011766645184252411,
-0.8332421779632568,
0.11791493743658066,
-0.45302942395210266,
-0.02437441423535347,
-1.2184659242630005,
0.598620414... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.