text stringlengths 3.08k 10.4k |
|---|
package policyGen
import (
"fmt"
"strings"
utils "github.com/openshift-kni/cnf-features-deploy/ztp/policygenerator/utils"
)
func CreatePlacementBinding(name string, namespace string, ruleName string, subjects []utils.Subject) utils.PlacementBinding {
placementBinding := utils.PlacementBinding{}
placementBinding... |
package marshal
import (
"bytes"
"reflect"
"testing"
"github.com/nitrogen-lang/nitrogen/src/compiler"
"github.com/nitrogen-lang/nitrogen/src/lexer"
"github.com/nitrogen-lang/nitrogen/src/parser"
"github.com/nitrogen-lang/nitrogen/src/object"
)
func TestIntegerMarshal(t *testing.T) {
i1 := object.MakeIntObj(... |
package server
import (
"errors"
"fmt"
"net"
"strings"
"time"
"github.com/hashicorp/go-sockaddr/template"
"github.com/segmentio/ksuid"
flag "github.com/spf13/pflag"
)
const (
DefaultListenClientUrls = "127.0.0.1:9527"
DefaultAdvertiseClientUrls = "127.0.0.1:9527"
DefaultListenPeerUrls = "127.0.0.1... |
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package systemd
import (
"encoding/base64"
"fmt"
db "github.com/guelfey/go.dbus"
"github.com/smarterclayton/geard/config"
"github.com/smarterclayton/go-systemd/dbus"
"io"
"log"
"os"
"os/exec"
"path/filepath"
"reflect"
"strings"
"text/template"
"time"
)
type SystemdFileType string
const (
TargetType Sy... |
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
package signsrv
import (
"github.com/btcsuite/btcutil"
"github.com/pkg/errors"
"go.uber.org/zap"
"github.com/hiromaily/go-crypto-wallet/pkg/account"
"github.com/hiromaily/go-crypto-wallet/pkg/address"
"github.com/hiromaily/go-crypto-wallet/pkg/repository/coldrepo"
"github.com/hiromaily/go-crypto-wallet/pkg/wal... |
package main
import (
"context"
"fmt"
"os"
"regexp"
"sort"
"strconv"
"strings"
"github.com/google/go-github/v34/github"
"golang.org/x/oauth2"
)
func main() {
ctx := context.Background()
// load given base and head `go test` cover profiles from disk
base, err := LoadCoverProfile(os.Args[1])
if err != ni... |
package station_type
import (
// Core packages
"context"
"database/sql"
"time"
// Internal packages
"github.com/deezone/HydroBytes-BaseStation/internal/platform/auth"
// Third-party packages
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
"go.opencensus.io/trace"
)
// Predefine... |
package swarm
import (
"context"
"sync"
"time"
"golang.org/x/sync/semaphore"
"redwood.dev/log"
"redwood.dev/process"
"redwood.dev/utils"
)
type PeerPool interface {
process.Interface
GetPeer(ctx context.Context) (_ PeerConn, err error)
ReturnPeer(peer PeerConn, strike bool)
}
type peerPool struct {
proc... |
// MIT License
//
// Copyright (c) 2021 <NAME> and EASE lab
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy,... |
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
//
// Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
//
/****************************************************************************
* File responsible to create and configure veth interfaces
*****************************************************... |
// Copyright [2020] [thinkgos]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
// Copyright (C) MongoDB, Inc. 2017-present.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
package mongo
import (
"context"
"testing"
"f... |
package dmi
import (
"fmt"
)
type ChassisType byte
const (
ChssisTypeOther ChassisType = 1 + iota
ChssisTypeUnknown
ChssisTypeDesktop
ChssisTypeLowProfileDesktop
ChssisTypePizzaBox
ChssisTypeMiniTower
ChssisTypeTower
ChssisTypePortable
ChssisTypeLaptop
ChssisTypeNotebook
ChssisTypeHandHeld
ChssisTypeDoc... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package docdb
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Represents the input to CreateDBInstance.
type CreateDBInstanceInput struct {
_ struct{} `type:"structure"`
// Indicates... |
package bkp
import (
"github.com/timaebi/go-zfs"
"github.com/timaebi/go-zfs/zfsiface"
"strings"
"regexp"
"time"
"strconv"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
type backupType int
const (
full backupType = iota
incremental
none
)
// BackupEnabled zfs attribute. True means filesy... |
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by... |
package main
import (
"flag"
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
"k8s.io/utils/mount"
sharev1clientset "github.com/openshift/client-go/sharedresource/clientset/versioned"
"github.com/openshift/csi-drive... |
package str
import (
"strconv"
"strings"
"time"
"unicode"
)
// ParseFloat32E ...
func ParseFloat32E(s string) (float32, error) {
f, e := strconv.ParseFloat(s, 32)
return float32(f), e
}
// ParseFloat64E ...
func ParseFloat64E(s string) (float64, error) { return strconv.ParseFloat(s, 64) }
// ParseIntE ...
fun... |
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package crash
import (
"context"
"io/ioutil"
"path"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/golang/protobuf/ptypes/empty"
"ch... |
// Copyright 2018 The QOS Authors
package buyad
import (
"errors"
"github.com/QOSGroup/qbase/context"
"github.com/QOSGroup/qbase/txs"
qbasetypes "github.com/QOSGroup/qbase/types"
qostxs "github.com/QOSGroup/qos/txs/transfer"
"github.com/QOSGroup/qstars/config"
"github.com/QOSGroup/qstars/types"
"github.com/QO... |
package main
import (
"context"
"flag"
"fmt"
"os"
"path/filepath"
"time"
"strings"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/spf13/viper"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/clie... |
package cookieauth
import (
"crypto/subtle"
"encoding/base64"
"errors"
"log"
"net/http"
"sync"
"time"
scrypt "github.com/elithrar/simple-scrypt"
lru "github.com/hashicorp/golang-lru"
)
const (
cacheSize = 1024
fortnight = 14 * 24 * time.Hour
)
var params = scrypt.Params{N: 16384, R: 8, P: 1, SaltLen: 16,... |
/*
* MinIO Client (C) 2019-2020 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... |
package internal
import (
"bytes"
"strings"
"sync"
"time"
"github.com/wavesplatform/gowaves/pkg/proto"
"go.uber.org/zap"
)
const (
blockReceiveTimeout = time.Minute
batchSize = 50
)
type loader struct {
wg *sync.WaitGroup
drawer *drawer
requestCh chan idsEvent
block... |
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
package apl
import (
"encoding/json"
"io/ioutil"
"os"
)
// Note: This won't work as the standard file also includes a sibling DataSources object
func ReadAplDocumentFromJsonFile(fileName string, out APLDocument) error {
jsonFile, err := os.Open(fileName)
if err != nil {
return err
}
defer jsonFile.Close()
... |
package messengerdb
import (
"database/sql"
"testing"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
"berty.tech/berty/v2/go/internal/testutil"
)
type modelAccountV1 struct {
PublicKey string `gorm:"primaryKey"`
DisplayName string
Link ... |
package main
import (
"encoding/csv"
"fmt"
"index/suffixarray"
"log"
"os"
"strconv"
"time"
)
// https://coderwall.com/p/cp5fya/measuring-execution-time-in-go
func timeTrack(start time.Time, name string) {
elapsed := time.Since(start)
log.Printf("%s took %s", name, elapsed)
}
// Returns: Sum of elements in `... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package codeartifact
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type DisassociateExternalConnectionInput struct {
_ struct{} `type:"s... |
package installconfig
import (
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/ipnet"
"github.com/openshift/installer/pkg/types"
)
type testAsset struct {
name string
}
func (a *tes... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: change_name.proto
package model
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a comp... |
// Copyright 2020 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
// Copyright 2013 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package geom
import "math"
// A Vec3 represents a vector with coordinates X, Y and Z in 3-dimensional
// euclidean space.
type Vec3 struct {
X, Y, Z float32
}
var (... |
package model
import (
"errors"
"net/http"
"time"
"github.com/zltgo/api"
"github.com/zltgo/api/jwt"
"github.com/zltgo/api/session"
"golang.org/x/crypto/bcrypt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// collection: managers
type ManagerDb struct {
Id bson.ObjectId `bson:"_id"`
OpenId string ... |
// This code is transcompiled by LuneScript.
package lnsc
import . "github.com/ifritJP/LuneScript/src/lune/base/runtime_go"
var init_Log bool
var Log__mod__ string
// decl enum -- Level
type Log_Level = LnsInt
const Log_Level__Debug = 5
const Log_Level__Err = 1
const Log_Level__Fatal = 0
const Log_Level__Info = 4
cons... |
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github... |
/*
Copyright 2021 Loggie Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
package main
import (
"bytes"
"crypto/sha256"
"fmt"
"io"
"log"
"os"
"path/filepath"
"sort"
"sync"
"time"
)
const workers = 32
type filepair struct {
cardfile FileHash
diridx int
}
type stringpair struct {
filename string
reason string
}
var (
htmllog os.File
htmllock sync.Mutex
treelock sync.... |
/*
fileName: bstore
author: <EMAIL>
date: 2019/7/9
*/
package bstore
import (
"errors"
"github.com/dgraph-io/badger"
"time"
)
var (
// ErrKeyNotFound is an error indicating a given key does not exist
ErrKeyNotFound = errors.New("not found")
)
type BadgerStore struct {
// conn is the underlying han... |
package user
import (
"time"
"github.com/DanielKrawisz/bmagent/powmgr"
"github.com/DanielKrawisz/bmagent/user/email"
"github.com/DanielKrawisz/bmutil/pow"
"github.com/DanielKrawisz/bmutil/wire"
"github.com/DanielKrawisz/bmutil/wire/obj"
)
// sendPow takes a message in wire format with all required information
... |
package main
import (
"flag"
"fmt"
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"log"
"os"
"strings"
"github.com/anthonynsimon/bild/blur"
"github.com/anthonynsimon/bild/effect"
"github.com/anthonynsimon/bild/segment"
"github.com/nfnt/resize"
"github.com/ramirezalbert3/zplgfa"
)
func specialCmds(... |
package gaia
import (
"math"
"math/rand"
"os"
"strconv"
"testing"
)
//------------------------------------------------------------------------------
// helper to create random strngs
//------------------------------------------------------------------------------
var letterRunes = []rune("abcdefghijklmnopqr... |
/*
Copyright the Sonobuoy contributors 2019
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
/*******************************************************************************
* Copyright 1995-2018 <NAME> Corporation. All rights reserved.
* Copyright 2019 Dell Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You ma... |
package main
import (
"flag"
"log"
"net/http"
"reflect"
"strconv"
"strings"
"crypto/tls"
"encoding/json"
"github.com/oliveagle/jsonpath"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"io/ioutil"
)
var addr = flag.String("listen-address", ":9116... |
package perforator
import (
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"acln.ro/perf"
"github.com/zyedidia/perforator/bininfo"
"github.com/zyedidia/perforator/utrace"
)
// Events is a specification for which perf events should be tracked. A Base
// set of events is tracked using standard perf, and sets of gro... |
package eval
// TODO:
// Need to review these tests. At a glance some of them seem a bit odd
// or incorect.
import (
"dito/src/object"
"dito/src/parser"
"dito/src/scanner"
"testing"
)
// TestIntExpr :
func TestIntExpr(t *testing.T) {
tests := []struct {
input string
expected int
}{
{"0", 0}, {"-0", 0... |
package main
//
// Copyright (c) 2021 <NAME> <<EMAIL>>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND TH... |
package metadata
import (
"time"
"github.com/romberli/go-util/common"
"github.com/romberli/go-util/constant"
"github.com/romberli/das/internal/dependency/metadata"
)
const (
userUserNameStruct = "UserName"
userDepartmentNameStruct = "DepartmentName"
userEmployeeIDStruct = "EmployeeID"
userAccountN... |
package persist
import (
"bytes"
"context"
"encoding/gob"
"errors"
"strings"
"sync"
"time"
"github.com/dgraph-io/badger/v3"
"github.com/sirupsen/logrus"
)
const (
TokenPrefixJoin = "-"
)
var (
ErrMissingTickDuration = errors.New("Missing tick duration for GC cleanup")
ErrMissingHandle = errors.New... |
package cluster
import (
"fmt"
"os"
"path"
"strconv"
"strings"
"github.com/bmatcuk/doublestar/v4"
validation "github.com/go-ozzo/ozzo-validation/v4"
log "github.com/sirupsen/logrus"
)
type LocalFile struct {
Path string
PermMode string
}
// UploadFile describes a file to be uploaded for the host
type ... |
//go:build e2e
// +build e2e
/*
Copyright 2020 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law... |
package gomovie
import (
"bytes"
"encoding/binary"
"io"
"sort"
"sync"
)
const (
DefaultParallel = 5
)
type sortedFrames []*Frame
func (s sortedFrames) Len() int {
return len(s)
}
func (s sortedFrames) Less(i int, j int) bool {
return s[i].Index < s[j].Index
}
func (s sortedFrames) Swap(i int, j int) {
s[... |
package firecracker
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"time"
firecrackersdk "github.com/firecracker-microvm/firecracker-go-sdk"
"github.com/emc-advanced-dev/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/solo-io/unik/pkg/providers/common"
"github.com/solo-io/unik/pkg/types"
)
... |
package authorize
import (
"context"
"errors"
"sync"
"time"
"github.com/cenkalti/backoff/v4"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/internal/sessions"
"github.com/pomerium/p... |
package macro
import (
"errors"
"fmt"
"go/ast"
"go/build"
"go/format"
"go/token"
"go/types"
"io/ioutil"
"strings"
"golang.org/x/tools/go/loader"
)
// FuncCallInspector FuncCallInspector
type FuncCallInspector func(expr *ast.CallExpr, caller *types.Func, args []types.TypeAndValue)
// Package Package
type P... |
/*
Copyright 2021 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
package lexer
import (
"fmt"
"github.com/sscaling/monkey/token"
)
type Lexer struct {
input string
position int // need to track both position and currPosition for slicing the input data
line int
column int
readPosition int
ch byte
}
func New(program string) *Lexer {
l :=... |
package dbServices
import (
"crypto/tls"
"database/sql"
"fmt"
"log"
"net"
"os"
"path"
"time"
"sync"
"github.com/DanielRenne/GoCore/core/serverSettings"
"github.com/asdine/storm"
"github.com/fatih/color"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
)
var DBMutex *sync.RWMutex
var DB *sq... |
// Copyright (c) 2014-2014 PPCD developers.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package btcjson
import (
"encoding/json"
"fmt"
"strconv"
)
func init() {
// No special flags for commands in this file.
flags := UsageFlag(0)
MustRegisterCmd("getkerne... |
/*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2019 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... |
package mariadbplugin
import (
"database/sql"
"errors"
"go-image-board/logging"
"golang.org/x/crypto/bcrypt"
)
//SetSecurityQuestions changes a user's security questions (nil if success)
func (DBConnection *MariaDBPlugin) SetSecurityQuestions(userName string, questionOne string, questionTwo string, questionThree... |
// Copyright 2019 - See NOTICE file for copyright holders.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... |
package neighbors
import (
"fmt"
"runtime"
"sort"
"github.com/pa-m/sklearn/base"
"github.com/pa-m/sklearn/metrics"
"gonum.org/v1/gonum/mat"
)
// KNeighborsClassifier is a Regression based on k-nearest neighbors.
// The target is predicted by local interpolation of the targets
// associated of the nearest neig... |
package opendsd
import (
"encoding/json"
"fmt"
"io"
)
type Project struct {
Customers []struct {
ProjectID int `json:"ProjectId"`
CustomerID int `json:"CustomerId"`
Role string `json:"Role"`
FirmName string `json:"FirmName"`
Name string `json:"Name"`
} `json:"Customers"`
ReviewCyc... |
package cmd
import (
"context"
"fmt"
"strings"
"github.com/golang/protobuf/ptypes"
"github.com/linkerd/linkerd2/cli/flag"
pb "github.com/linkerd/linkerd2/controller/gen/config"
charts "github.com/linkerd/linkerd2/pkg/charts/linkerd2"
"github.com/linkerd/linkerd2/pkg/healthcheck"
"github.com/linkerd/linkerd2/... |
package listenbrainz
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"src.userspace.com.au/felix/mstatus"
)
const defaultURL = "https://api.listenbrainz.org/1/submit-listens"
type Client struct {
token string
apiURL string
httpClient *http.Client
log mstatus.Log... |
package xmpp
import (
"crypto/tls"
"encoding/xml"
"errors"
"fmt"
"io"
"net"
)
const xmppStreamOpen = "<?xml version='1.0'?><stream:stream to='%s' xmlns='%s' xmlns:stream='%s' version='1.0'>"
type Session struct {
// Session info
BindJid string // Jabber ID as provided by XMPP server
StreamId string... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: session/selection.proto
package session
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This i... |
package qrcode
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMatrix(t *testing.T) {
m := newMatrix(3, 3)
m.print()
err := m.set(2, 4, QRValue_DATA_V1)
assert.Error(t, err)
err = m.set(2, 2, QRValue_DATA_V1)
assert.NoError(t, err)
v, err2 := m.at(2, 2)
assert.NoError(t, err2)
assert... |
package services
import (
"bbs/datamodels"
"bbs/initialize"
"bbs/libs"
"bbs/mqueue"
"bbs/repositories"
"errors"
"math"
"time"
)
/*
提供关于API服务
作者名称:leixiaotian 创建时间:20210529
*/
type ApiInterfaceService interface {
PushVisitLog(id int64) (interface{},error) //推送浏览日志MQ
GetPost(id int64) (interface{},error) /... |
package main
import (
"container/heap"
"encoding/json"
"io"
"log"
"os"
"sort"
"github.com/dgryski/go-spooky"
"github.com/kiteco/kiteco/kite-go/clustering"
"github.com/kiteco/kiteco/kite-go/lang/python/pythoncode"
"github.com/kiteco/kiteco/kite-golib/awsutil"
)
const (
numClusters = 5
minClusterSize ... |
package consul
import (
"fmt"
"github.com/hashicorp/consul/agent/consul/authmethod"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/go-bexpr"
// register this as a builtin auth method
_ "github.com/hashicorp/consul/agent/consul/authmethod/kubeauth"
)
type authMethodValidatorEntry struct {
V... |
package sql2struct
import (
"database/sql"
"errors"
"fmt"
//导入驱动
_ "github.com/go-sql-driver/mysql"
)
// 数据库连接的核心对象
type DBModel struct {
DBEngine *sql.DB
DBInfo *DBInfo
}
// 结构体DBInfo:用于存储连接 MySQL 的基本信息
type DBInfo struct {
DBType string
Host string
UserName string
Password string
Charset strin... |
// Copyright 2017 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
package runner
import (
"io"
"log"
"math"
"sync"
"github.com/kuangyh/saw"
"github.com/kuangyh/saw/storage"
"github.com/kuangyh/saw/table"
"golang.org/x/net/context"
)
// Speicify one data source of batch computation.
type BatchSpec struct {
// Reads data from here
Input storage.ResourceSpec
// Optional, d... |
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"strconv"
"time"
"github.com/soldiermoth/hlsq/hlsqlib"
"golang.org/x/text/unicode/norm"
)
func main() {
var (
colors = hlsqlib.ColorSettings{
Tag: hlsqlib.LightBlue,
Attr: hlsqlib.Cyan,
}
tagSpecific []hlsqlib.SpecificTagColors
q... |
// Copyright 2020 the go-etl Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
package instrumental
import (
"bufio"
"net"
"net/textproto"
"sync"
"testing"
"time"
"github.com/MadDogTechnology/telegraf"
"github.com/MadDogTechnology/telegraf/metric"
"github.com/stretchr/testify/assert"
)
func TestWrite(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
TCPServer(t, &wg)
i := Instrumen... |
package kitelocal
import (
"encoding/json"
"log"
"net/http"
"path/filepath"
"time"
"github.com/kiteco/kiteco/kite-go/client/component"
"github.com/kiteco/kiteco/kite-go/event"
"github.com/kiteco/kiteco/kite-go/localcode"
"github.com/kiteco/kiteco/kite-go/response"
"github.com/kiteco/kiteco/kite-golib/kitect... |
// Copyright Splunk, Inc. 2014
//
// Author: <NAME> <<EMAIL>>
package iniconf
import (
"bufio"
"fmt"
"io"
"strings"
"testing"
)
var singleEntryTests = []struct {
name string
input string
expectedType int
expectedLineCount int
expectedLineLengths []int
}{
{"blank", "\n... |
package main
import (
"flag"
"fmt"
"cmdb_agent/config"
"io/ioutil"
"os"
"os/exec"
"os/signal"
"sync"
"syscall"
"net/http"
"bytes"
"encoding/json"
"io"
"time"
)
var wg sync.WaitGroup
var one bool
// 发送GET请求
// url: 请求地址
// response: 请求返回的内容
func Get(url string) string {
// 超时时间:5秒
... |
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
package archive
import (
"archive/tar"
"os"
"path/filepath"
"strings"
"syscall"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/system"
"golang.org/x/sys/unix"
)
func getWhiteoutConverter(format WhiteoutFormat, data interface{}) tarWhiteoutConverter {
if format == OverlayWhite... |
// Copyright © 2019 Banzai Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
package swap
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strconv"
"github.com/NadiaSama/ccexgo/exchange"
"github.com/NadiaSama/ccexgo/exchange/okex"
"github.com/NadiaSama/ccexgo/internal/rpc"
"github.com/pkg/errors"
"github.com/shopspring/decimal"
)
type (
Fill struct {
TradeID string ... |
package generate
import (
"fmt"
"github.com/HamzaZo/helm-adopt/internal/discovery"
"github.com/HamzaZo/helm-adopt/internal/utils"
log "github.com/sirupsen/logrus"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage"
"helm.sh/helm/v3/pkg/storag... |
package account
import (
"time"
"github.com/almighty/almighty-core/app"
"github.com/almighty/almighty-core/gormsupport"
"github.com/goadesign/goa"
"github.com/jinzhu/gorm"
uuid "github.com/satori/go.uuid"
"golang.org/x/net/context"
)
// Identity ddenDescribes a unique Person with the ALM
type Identity struct ... |
/*
Copyright 2020 The OpenEBS Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
package tablook
import (
"errors"
"github.com/gizak/termui" // for events
"github.com/mattn/go-runewidth"
"github.com/nsf/termbox-go"
)
var ErrTermboxAlreadyInitialized = errors.New("tablook: termbox (or termui) already initialized")
var (
FgColor = termbox.ColorWhite
BgColor = termbox.ColorBlac... |
//
// (C) Copyright 2022 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
package ucx
import (
"context"
"strings"
"github.com/daos-stack/daos/src/control/common"
"github.com/daos-stack/daos/src/control/lib/dlopen"
"github.com/daos-stack/daos/src/control/lib/hardware"
"github.com/daos-s... |
package snowpack
import (
"log"
"math"
)
// ref: DeWalle, D.R. and <NAME>, 2008. Principles of Snow Hydrology. Cambridge University Press, Cambridge. 410pp.
const (
// physical constants
pw = 999.84 // [kg/m³] Density of liquid water at 0°C
pi = 917. // [kg/m³] Density of ice at 0°C = 917 (pg. 54)
lf = ... |
/*
Copyright 2019 Cloudical Deutschland GmbH. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... |
// Copyright 2016 <NAME>. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package system
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/atelierdisko/hoi/project"
"github.com/atelierdisko/hoi/server"
"github.c... |
package run
import (
"fmt"
"strings"
"go.pedge.io/protolog"
"github.com/pachyderm/pachyderm/src/pkg/graph"
"github.com/pachyderm/pachyderm/src/pkg/timing"
"github.com/pachyderm/pachyderm/src/pps"
"github.com/pachyderm/pachyderm/src/pps/container"
"github.com/pachyderm/pachyderm/src/pps/source"
"github.com/p... |
/*
Copyright © 2020 The PES Open Source Team <EMAIL>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
package handler
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/http/httputil"
"testing"
"github.com/hailo-platform/H2O/protobuf/proto"
api "github.com/hailo-platform/H2O/api-proxy/proto/api"
"github.com/hailo-platform/H2O/platform/client"
platformtesting "github.com/hailo-platform/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.