text stringlengths 3.08k 10.4k |
|---|
/*
* Copyright 2019 Google 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 or agree... |
package ready
import (
"bytes"
"io/ioutil"
"net/http"
"testing"
"github.com/cli/cli/api"
"github.com/cli/cli/internal/ghrepo"
"github.com/cli/cli/pkg/cmd/pr/shared"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/httpmock"
"github.com/cli/cli/pkg/iostreams"
"github.com/cli/cli/test"
"github.com/g... |
package internal
// This file contains helpers to convert from public-facing to internal structs.
import (
"golang.org/x/sys/windows"
"github.com/pkg/errors"
iscsidsc "github.com/wk8/go-win-iscsidsc"
)
// CheckAndConvertLoginOptions translates the user-facing `LoginOptions` struct
// into the internal `LoginOpti... |
package statedb
import (
"encoding/json"
"fmt"
"reflect"
"github.com/incognitochain/incognito-chain/common"
"github.com/incognitochain/incognito-chain/dataaccessobject/rawdbv2"
)
type Pdexv3OrderState struct {
poolPairID string
value rawdbv2.Pdexv3Order
}
func (s *Pdexv3OrderState) PoolP... |
package oled_i2c
// Modified from the original code at https://github.com/goiot/devices/tree/master/monochromeoled
// Works with 128x62 and 128x32
import (
"fmt"
"image"
"github.com/jdevelop/golang-rpi-extras/ssd1306"
"golang.org/x/exp/io/i2c"
"golang.org/x/exp/io/i2c/driver"
)
// OLED represents an SSD1306 OL... |
// Package netexplorer implements the exploration of block transactions for monitored addresses and
// adding/removing monitored addresses.
package netexplorer
import (
"errors"
"fmt"
"log"
"sync"
"github.com/tarancss/adp/lib/block/types"
"github.com/tarancss/adp/lib/store"
)
// Status possible values, control... |
package tmpl
import (
"crypto/md5"
"encoding/hex"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
"github.com/lavrahq/cli/packages/fs"
"github.com/lavrahq/cli/packages/prompt"
"github.com/lavrahq/cli/util"
"github.com/lavrahq/cli/util/cmdutil"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/storage/memor... |
package types
import (
"bufio"
"fmt"
"regexp"
"strings"
"time"
"wio/internal/config/meta"
"wio/internal/constants"
"wio/pkg/npm/semver"
"wio/pkg/util"
"wio/pkg/util/sys"
yaml "gopkg.in/yaml.v2"
)
var configCategoryTag = regexp.MustCompile(`^[\s\w]*[a-z]:\s*$`)
func resolveVariables(line string, projectPa... |
package test
import (
"context"
"testing"
"time"
wwr "github.com/qbeon/webwire-go"
wwrclt "github.com/qbeon/webwire-go-client"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type testClientSessionInfoStruct struct {
SampleString string `json:"struct_string"`
}
... |
package config
import (
"fmt"
"os"
"path"
"time"
"github.com/zalando-incubator/cluster-lifecycle-manager/pkg/updatestrategy"
"gopkg.in/alecthomas/kingpin.v2"
)
const (
defaultInterval = "10m"
defaultListener = ":9090"
defaultCredentialsDir = ... |
package keeper
import (
"testing"
"github.com/bandprotocol/bandchain/chain/x/oracle/types"
"github.com/stretchr/testify/require"
)
func TestGetRequestCount(t *testing.T) {
ctx, keeper := CreateTestInput(t, false)
// Initial request count must be 0
require.Equal(t, int64(0), keeper.GetRequestCount(ctx))
}
fun... |
package bep3
import (
"context"
"encoding/json"
"fmt"
"math/rand"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
sdksim "github.com/cosmos/co... |
package kafka
import (
"context"
"fmt"
"strings"
"time"
"github.com/Shopify/sarama"
uuid "github.com/satori/go.uuid"
utils "github.com/yunfeiyang1916/toolkit/utils"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
opentracinglog "github.com/opentracing/opentra... |
// SPDX-FileCopyrightText: 2021 The go-metafeed Authors
//
// SPDX-License-Identifier: MIT
package metafeed_test
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/zeebo/bencode"
refs "go.mindeco.de/ssb-refs"
"go.mindeco.de/ssb-refs/tfk"
me... |
package astutil
import (
"testing"
"go/token"
"go/parser"
"go/ast"
"github.com/stretchr/testify/assert"
"github.com/amyjzhu/mutation-framework"
"go/types"
"fmt"
)
var tryCatchDataPath = "../testdata/astutil/trycatch.go"
var messageSendDataPath = "../testdata/astutil/trycatch.go"
var timeoutDataPath = "../test... |
// Copyright 2019 shimingyah.
//
// 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 ... |
package inproc
import (
"context"
"errors"
"fmt"
"sync"
"github.com/dshulyak/rapid/network"
)
type Handler func(context.Context, interface{}) *Response
type Request struct {
context.Context
From, To uint64
Code uint64
Object interface{}
Response chan<- *Response
}
type Response struct {
Object int... |
// Copyright 2016 PingCAP, 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 or agreed to i... |
package natpmp
import (
"context"
"encoding/binary"
"errors"
"fmt"
"io"
"net"
"sync"
"time"
)
// Version is the expected protocol version for NAT-PMP.
const Version = 0
// ErrProtocol indicates that a NAT gateway returned a response that violates
// the NAT-PMP protocol.
var ErrProtocol = errors.New("natpmp:... |
package xiao
import "github.com/genshinsim/gcsim/pkg/core"
func (c *char) ActionFrames(a core.ActionType, p map[string]int) (int, int) {
switch a {
case core.ActionAttack:
f := 0
a := 0
switch c.NormalCounter {
//TODO: need to add atkspd mod
case 0:
f = 17
a = 25
case 1:
f = 15
a = 22
case... |
// Copyright 2017 Applatix, Inc.
package util
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/json"
"encoding/pem"
"fmt"
"log"
"math/big"
"net/http"
"os"
"os/signal"
"reflect"
"regexp"
"runtime"
"syscall"
"time"
"github.com/applatix/claudia/errors"
)
// Succe... |
package gitclient
import (
"context"
"crypto/sha256"
"encoding/base64"
"io"
"io/ioutil"
"sort"
"strings"
utils "github.com/devjoes/github-runner-autoscaler/apiserver/pkg/utils"
"github.com/google/go-github/v33/github"
"golang.org/x/oauth2"
"k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/klog/v2"
)
type IStat... |
package static
import (
"bytes"
"errors"
"fmt"
"path/filepath"
"strings"
"github.com/caos/orbos/internal/helpers"
secret2 "github.com/caos/orbos/pkg/secret"
"github.com/caos/orbos/internal/operator/orbiter/kinds/clusters/core/infra"
"github.com/caos/orbos/internal/operator/orbiter/kinds/providers/core"
"g... |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not... |
package v3
import (
"errors"
fmt "fmt"
corev2 "github.com/sensu/sensu-go/api/core/v2"
)
// interface assertions guarantee that EntityConfig and EntityState are valid
// Resources.
var (
_ Resource = new(EntityConfig)
_ Resource = new(EntityState)
)
type (
Deregistration = corev2.Deregistration
System ... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kms
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncryptRequest
type ReEncryptInput struct {
_ struc... |
/* Package suncal calculates the rise (sunrise) and the set (sunset)
of the sun with about minute accuracy.
The calculations are based on the ideas at
http://lexikon.astronomie.info/zeitgleichung/ (german).
Author: <NAME>
License: Apache License Version 2.0, January 2004
Repo: http://github.com/bwo... |
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"math/rand"
"net/url"
"os"
"strings"
"time"
"github.com/op/go-logging"
"github.com/soracom/endorse-client-go/endorse"
)
var log = logging.MustGetLogger("endorse-cli")
var formatNormal = logging.MustStringFormatter(
`%{color} ▶ %{level:.4s} %{id:... |
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package tdameritrade
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
... |
package logic
import (
"crypto/rand"
"encoding/json"
"errors"
"github.com/klovercloud-ci-cd/security/config"
v1 "github.com/klovercloud-ci-cd/security/core/v1"
"github.com/klovercloud-ci-cd/security/core/v1/repository"
"github.com/klovercloud-ci-cd/security/core/v1/service"
"github.com/klovercloud-ci-cd/securi... |
// Copyright 2019 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package main
import (
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"github.com/stephenhu/webtools"
)
const (
UPDATE_TOKEN = "UPDATE users " +
"SET token=? " +
"WHERE id=?"
DELETE_TOKEN = "UPDATE users " +
"SET token='' " +
"WHERE id=?"
)
func enc... |
package blademaster
import (
"regexp"
)
// IRouter http router framework interface.
type IRouter interface {
IRoutes
Group(string, ...HandlerFunc) *RouterGroup
}
// IRoutes http router interface.
type IRoutes interface {
UseFunc(...HandlerFunc) IRoutes
Use(...Handler) IRoutes
Handle(string, string, ...Handler... |
package ui
import (
"fmt"
"github.com/kanbara/lisniks/pkg/word"
"regexp"
)
type ansicolour int
// can't be assed
const light = 10
// TODO could use inverted too
const (
ansibold int = 1
ansiunder int = 4
ansiinvert int = 7
)
const (
Black, DarkGrey ansicolour = iota, iota + light
Red, LightRed
Green, L... |
/*
Copyright 2015 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 teleportation
import (
"fmt"
"io"
"net"
"sync"
"github.com/sirupsen/logrus"
"github.com/stretchr/objx"
"golang.org/x/sync/errgroup"
"github.com/PeerXu/meepo/pkg/transport"
mgroup "github.com/PeerXu/meepo/pkg/util/group"
)
type TeleportationSink struct {
opt objx.Map
logger logrus.FieldLogger
... |
// Package cmd creates a command line application for parsing scientific names.
package cmd
import (
"fmt"
"log"
"os"
"time"
"github.com/dustin/go-humanize"
"github.com/gnames/gnparser"
"github.com/gnames/gnparser/ent/parsed"
"github.com/gnames/gnparser/io/web"
"github.com/gnames/gnsys"
"github.com/spf13/co... |
package radix
import (
"crypto/rand"
"fmt"
"reflect"
"testing"
)
// generateUUID is used to generate a random UUID
func generateUUID() string {
buf := make([]byte, 16)
if _, err := rand.Read(buf); err != nil {
panic(fmt.Errorf("failed to read random bytes: %v", err))
}
return fmt.Sprintf("%08x-%04x-%04x-%0... |
package query
import (
"fmt"
"time"
"github.com/xichen2020/eventdb/calculation"
"github.com/xichen2020/eventdb/document/field"
"github.com/xichen2020/eventdb/x/hash"
)
// Type is the type of a query.
type Type int
// A list of supported query types.
const (
// RawQuery is a query that retrieves raw documents ... |
package server
import (
"fmt"
client "pkg-go/ds_client"
"time"
"model/pkg/metapb"
"model/pkg/taskpb"
"util/deepcopy"
"util/log"
)
const (
defaultAddPeerTaskTimeout = time.Second * time.Duration(300)
addPeerMaxCreateRetryTimes = 8 // 8 heartbeats = 8 * 10 seconds
)
// AddPeerTask add peer task
type AddPee... |
package odoo
import (
"fmt"
)
// TaxAdjustmentsWizard represents tax.adjustments.wizard model.
type TaxAdjustmentsWizard struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
AdjustmentType *Selection `xmlrpc:"adjustment_type,omptempty"`
Amount *Float `xmlrpc:"amount,omptempty... |
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/kelseyhightower/envconfig"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package admin
import (
"fmt"
"io/ioutil"
"os"
"time"
ca "github.com/hyperledger/fabric-sdk-go/api/apifabca"
fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
"github.com/hyperledger/fabric-sdk-go/ap... |
package producermagazine
import (
"regexp"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/rl404/go-malscraper/model"
"github.com/rl404/go-malscraper/pkg/utils"
)
type producer struct {
area *goquery.Selection
cleanImg bool
data []model.AnimeItem
}
// GetAnime to get producer anime list.
func... |
package main
import (
"encoding/json"
"flag"
"fmt"
ct "github.com/google/certificate-transparency-go"
"github.com/google/certificate-transparency-go/tls"
"github.com/google/certificate-transparency-go/x509"
"github.com/hdm/inetdata-parsers"
"golang.org/x/net/publicsuffix"
"os"
"runtime"
"strings"
"sync"
"... |
package goldcmd
import (
"math"
"testing"
)
func TestNewCommandParser(t *testing.T) {
cp := newCommandParser()
if len(cp.allLabels) != 0 {
t.Fatalf("new parser should not have labels")
}
if len(cp.intLabels) != 0 {
t.Fatalf("new parser should not have int labels declared")
}
if len(cp.intValues) != 0 {
... |
package cpu
import (
"github.com/klauspost/cpuid/v2"
)
type X86CPU uint64
type X86Feature uint64
func (c X86CPU) Has(f X86Feature) bool {
return (uint64(c) & uint64(f)) == uint64(f)
}
func (c *X86CPU) Set(f X86Feature, on bool) {
*c = X86CPU(set(uint64(*c), uint64(f), on))
}
type ARMCPU uint64
type ARMFeature u... |
// Copyright (c) 2020 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package memdb
import (
"context"
"fmt"
"sort"
"sync"
"decred.org/dcrros/backend/backenddb"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil/... |
package main
import (
"github.com/gotk3/gotk3/glib"
"github.com/gotk3/gotk3/gtk"
"github.com/pkg/browser"
)
func ui(win *gtk.Window) {
ls := getCatRows()
var treeApps []*gtk.TreeIter
header, _ := gtk.HeaderBarNew()
header.SetShowCloseButton(true)
header.SetTitle("LinuxPA")
header.SetSubtitle("PortableApps.co... |
// Copyright 2014 beego Author. 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 applica... |
package launch
import (
"spacex-go/common"
"spacex-go/payload"
)
//Launch .
type Launch struct {
FlightNumber int `json:"flight_number"`
MissionName string `json:"mission_name"`
MissionID []string `json:"mission_id"`
LaunchYear string ... |
// Copyright 2021 CloudJ Company Limited. All rights reserved.
package configs
import (
"cloudiac/portal/libs/db"
"cloudiac/utils/logs"
"fmt"
"github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/model"
gormadapter "github.com/casbin/gorm-adapter/v3"
"strings"
)
var RbacModel = `
[request_definition]
r =... |
package agent
import (
"context"
"io"
"log"
"math"
"net/url"
"sync"
"time"
"github.com/cncd/pipeline/pipeline"
"github.com/cncd/pipeline/pipeline/backend"
"github.com/cncd/pipeline/pipeline/backend/docker"
"github.com/cncd/pipeline/pipeline/interrupt"
"github.com/cncd/pipeline/pipeline/multipart"
"github... |
package main
import (
"fmt"
"image"
"image/color"
"log"
"math"
"math/rand"
"github.com/fogleman/gg"
"github.com/gitchander/neural"
"github.com/gitchander/neural/neutil/imut"
)
// https://www.youtube.com/watch?v=p_kckXJUxxg
// https://www.youtube.com/watch?v=PRSva4fIkXA
func main() {
err := doSpiral()
ch... |
package fileio
// .vab - Playstation 1 audio format
import (
"encoding/binary"
"io"
"log"
)
type VABHeader struct {
Magic [4]byte // "pBAV"
Version uint32 // format version
Id uint32 // vab id
Filesize uint32 // waveform size in bytes
Reserved0 uint16 // system rese... |
package chain
import (
"bytes"
"fmt"
"sort"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
proof3 "github.com/filecoin-project/specs-actors/v3/actors/runtime/proof"
... |
package scholar
import (
"encoding/json"
"fmt"
"github.com/PuerkitoBio/goquery"
"regexp"
"strings"
"time"
"strconv"
)
type Article struct {
Title string
Url string
PdfUrl string
Year string
Author []string
BookTitle string
Journal string
CitedBy []string
CitedNum int... |
package tparse
import (
"bytes"
"fmt"
"math"
"strconv"
"strings"
"time"
"unicode"
)
// Parse will return the time value corresponding to the specified layout and value. It also parses
// floating point and integer epoch values.
func Parse(layout, value string) (time.Time, error) {
return ParseWithMap(layout,... |
package api
import (
"bytes"
"fmt"
"strings"
"github.com/koltyakov/gosip"
)
//go:generate ggen -ent Site -conf -mods Select,Expand -helpers Data,Normalized
// Site represents SharePoint Site API queryable object struct
// Always use NewSite constructor instead of &Site{}
type Site struct {
client *gosip.SPC... |
package albconfigmanager
import (
"context"
"fmt"
"sort"
"k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper"
"k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations"
"k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store"
networking "k8s.io/api/networking... |
package rootd
import (
"bufio"
"log"
"net"
"net/rpc"
"os"
"strconv"
"sync"
"time"
)
type Child struct {
Address string
Alive bool
Assigned int
conn net.Conn
}
type Work struct {
Status int
Command string
Each bool
handler chan string
child *Child
Output string
}
type AddWorkArgs struct {
Command st... |
package exec
import (
"archive/tar"
"compress/gzip"
"context"
"io"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagerctx"
"github.com/concourse/atc"
"github.com/concourse/atc/creds"
"github.com/concourse/atc/db"
"github.com/concourse/atc/resource"
"github.com/concourse/atc/worker"
)
//go:gen... |
/*
Copyright 2020 The Tekton 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, so... |
package sempass
import (
"shanhu.io/smlvm/asm"
"shanhu.io/smlvm/pl/ast"
"shanhu.io/smlvm/pl/tast"
"shanhu.io/smlvm/pl/types"
"shanhu.io/smlvm/syms"
)
type pkgFunc struct {
sym *syms.Symbol
f *ast.Func
recv *pkgStruct
}
func declareFuncSym(b *builder, f *ast.Func, t types.T) *syms.Symbol {
name := f.Name.... |
package kernal
// Variables containing gas prices for different ethereum phases.
var (
// GasTableHomestead contain the gas prices for
// the homestead phase.
GasTableHomestead = GasTable{
ExtcodeSize: 20,
ExtcodeCopy: 20,
Balance: 20,
SLoad: 50,
Calls: 40,
Suicide: 0,
ExpByte: ... |
// SPDX-License-Identifier: MIT
package message
import (
"bytes"
"context"
"encoding/json"
"time"
"github.com/pkg/errors"
"go.cryptoscope.co/luigi"
"go.cryptoscope.co/margaret"
gabbygrove "go.mindeco.de/ssb-gabbygrove"
refs "go.mindeco.de/ssb-refs"
"go.cryptoscope.co/ssb/message/legacy"
)
// NewVerifySin... |
package api
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
"os/exec"
"strings"
"github.com/energieip/common-components-go/pkg/duser"
"github.com/energieip/srv200-coreservice-go/internal/core"
"github.com/romana/rlog"
)
func (api *API) uploadHandler(w http.ResponseWrite... |
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package kubernetes
import (
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/cl... |
// Copyright 2021 CYBERCRYPT
//
// 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 w... |
// Copyright 2016 <NAME>. All rights reserved.
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.
package bolthold
import (
"os"
"reflect"
"strings"
bolt "go.etcd.io/bbolt"
)
// Store is a bolthold wrapper around a bolt DB
type Store struct {
db *bolt.DB
}
// O... |
package render
import (
"fmt"
"image/color"
"math"
"github.com/vdobler/chart"
)
var (
StandardColors = []color.Color{}
)
func init() {
standardColors := []color.Color{
color.NRGBA{0x43, 0x85, 0xf4, 0xff},
color.NRGBA{0xea, 0x44, 0x35, 0xff},
color.NRGBA{0xa3, 0x7f, 0xe2, 0xff},
color.NRGBA{0xfb, 0xbc,... |
/*
*
* Copyright 2014 gRPC 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 2017 NDP Systèmes. All Rights Reserved.
// See LICENSE file for full licensing details.
package po
import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
"testing"
)
var (
testPoFile = "testdata/test_file.po"
)
func TestReadPOFile(t *testing.T) {
po, err := Load(testPoFile)
if err != nil {
t.Fat... |
/*
MIT License
Copyright (c) 2020-2021 YPSI SAS
Centctl is developped by : <NAME>
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 ... |
// Copyright 2022 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package instance
import (
"fmt"
"os"
"time"
"github.com/google/syzkaller/pkg/csource"
"github.com/google/syzkaller/pkg/mgrconfig"
"github.com/googl... |
//go:generate stringer -type=FeatureFlag
package features
import (
"fmt"
"strings"
"sync"
)
type FeatureFlag int
const (
unused FeatureFlag = iota // unused is used for testing
// Deprecated features, these can be removed once stripped from production configs
PrecertificateRevocation
StripDefaultSchemePort... |
// Package ais provides core functionality for the AIStore object storage.
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*/
package ais
import (
"fmt"
"net"
"net/url"
"os"
"strings"
"github.com/NVIDIA/aistore/3rdparty/glog"
)
//=============================================================... |
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT License was not distributed with this
// file, you can obtain one at https://opensource.org/licenses/MIT.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
package key
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"c... |
package main
import (
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"time"
"github.com/cloudfoundry/cli/cf/trace"
"github.com/pivotal-cf/pcfdev-cli/address"
"github.com/pivotal-cf/pcfdev-cli/config"
"github.com/pivotal-cf/pcfdev-cli/downloader"
"github.com/pivotal-cf/pcfdev-cli/exit"
"github.com/pivotal-c... |
/**
* Created by GoLand.
* Brief: apache ant path matcher implement
* User: vibrant
* Date: 2019/03/31
* Time: 13:51
*/
package antpath
import (
"regexp"
"strings"
)
/**
// QuoteMeta 将字符串 s 中的“特殊字符”转换为其“转义格式”
// 例如,QuoteMeta(`[foo]`)返回`\[foo\]`。
// 特殊字符有:\.+*?()|[]{}^$
// 这些字符用于实现正则语法,所以当作普通字符使用时需要转换
func Quo... |
/*
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 under the License i... |
package main
import "github.com/bwmarrin/dgvoice"
import "github.com/bwmarrin/discordgo"
import "github.com/joho/godotenv"
import "bufio"
import "bytes"
import "encoding/base64"
import "encoding/binary"
import "io/ioutil"
import "fmt"
import "os"
import "runtime"
import "strings"
const owner_id string = "11569100519... |
package dataloaders
import (
"sync"
"time"
)
func NewDataLoader(maxBatch int, wait time.Duration, fetch Fetcher) *DataLoader {
return &DataLoader{
maxBatch: maxBatch,
wait: wait,
fetch: fetch,
}
}
// Key concept by facebook's data loader https://github.com/facebook/dataloader.
// Golang implementati... |
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
package model
//GetRankSellerProductK returns a ranking of sold products by a seller (quantity)
func GetRankSellerProductK(k, seller string, in Date) ([]SellerProductRank, error) {
var products []SellerProductRank
err = dbmap.Raw("SELECT product.name, COUNT(sale_detail.product_id) AS "+
"cont FROM sale, sale_detai... |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/spoke-d/thermionic/internal/cluster/membership (interfaces: Gateway)
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
go_dqlite "github.com/CanonicalLtd/go-dqlite"
gomock "github.com/golang/mock/gomock"
cert "... |
package main
import (
"fmt"
"io/ioutil"
"log"
"strconv"
"strings"
)
// Opens file and returns string
func get_input(filename string) string {
f, err := ioutil.ReadFile(filename)
if err != nil {
log.Fatal(err)
}
return string(f)
}
// Holds information about a particular board, such as its numbers
type boar... |
package goscrape
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"sync"
"time"
)
//ResponseParseHandler is a defintion for the function to be called to parse data
type ResponseParseHandler func(response *Response) ParseResult
//ItemPipelineHandler is a definition for the function to be called to process... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"entgo.io/ent/dialect/sql"
"github.com/go-kratos/examples/blog/internal/data/ent/post"
)
// Post is the model entity for the Post schema.
type Post struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
/... |
package web
import (
"fmt"
"math"
"net/http"
"runtime"
"time"
"github.com/labstack/echo"
)
func (s *Server) stats(c echo.Context) error {
updateSystemStatus()
return c.JSON(http.StatusOK, sysStatus)
}
// https://github.com/gogits/gogs/blob/master/pkg/tool/file.go
var (
startTime = time.Now()
sysStatus str... |
// Copyright (c) <NAME>. (https://github.com/jeevatkm)
// aahframework.org/aah source code and usage is governed by a MIT style
// license that can be found in the LICENSE file.
package aah
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"path/filepath"
"strings"
"aahframework.org/ahttp.v0"
"aahframework.o... |
package main
import (
"container/heap"
"context"
"encoding/json"
"fmt"
"net/url"
"os"
"os/exec"
"sort"
"strconv"
"strings"
"time"
"github.com/netsampler/goflow2/format"
_ "github.com/netsampler/goflow2/format/json"
// flowpb "github.com/netsampler/goflow2/pb"
"github.com/olekukonko/tablewriter"
"git... |
package dom
import (
"fmt"
"math"
"github.com/dustismo/govaluate"
"github.com/dustismo/heavyfishdesign/dynmap"
"github.com/dustismo/heavyfishdesign/path"
)
// wrapper to implement the govaluate Parameters interface
type pllExpression struct {
p ParamLookerUpper
attr *Attr
recursion int
}
var ma... |
package main
import (
"crypto/md5"
"encoding/json"
"fmt"
"os"
"path"
"path/filepath"
"regexp"
"strings"
"sync"
"syscall"
"time"
"flag"
)
type PosixInfo struct {
FilePath string `json:"file_path"`
INode uint64 `json:"inode"`
Size int64 `json:"size"`
UID uint32 `json:"uid"`
GI... |
// SPDX-License-Identifier: MIT
//
// Copyright (C) 2021 <NAME>. All Rights Reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree or at
// https://spdx.org/licenses/MIT.html
package opaque
import (
"errors"
"fmt"
"github.com/bytem... |
// Code generated by go-swagger; DO NOT EDIT.
package ldap
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-... |
package recurscircus
import (
"math"
"regexp"
"strconv"
"strings"
"github.com/elgolfin/adventofcode-2017/sliceutil"
)
// GetRootProgramName returns the root program
func GetRootProgramName(content string) string {
rootProgram := ""
programsMap := constructMap(content)
// Clean-up the map by removing each p... |
package libs
import (
"github.com/gotranspile/cxgo/runtime/cnet"
"github.com/gotranspile/cxgo/runtime/stdio"
"github.com/gotranspile/cxgo/types"
)
const (
unistdH = "unistd.h"
)
func init() {
RegisterLibrary(unistdH, func(c *Env) *Library {
modeT := c.GetLibraryType(sysStatH, "mode_t")
uintptrT := c.Go().Ui... |
package check
import (
"log"
"strings"
"github.com/iancoleman/strcase"
"github.com/tableauio/loader/cmd/protoc-gen-go-tableau-loader/firstpass"
"github.com/tableauio/loader/cmd/protoc-gen-go-tableau-loader/helper"
"github.com/tableauio/tableau/proto/tableaupb"
"google.golang.org/protobuf/proto"
"google.golang... |
package encoder
import (
"github.com/quantosnetwork/Quantos/crypto"
"fmt"
"sort"
"sync"
"unsafe"
)
//go:linkname memmov runtime.memmove
func memmov(to unsafe.Pointer, from unsafe.Pointer, n uintptr)
type Encoder struct {
buffer []byte
length int
offset int
}
type sliceHeader struct {
data unsafe.Pointer
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.