text stringlengths 3.08k 10.4k |
|---|
package main
import (
"bytes"
"encoding/json"
"errors"
"io"
"log"
"net/http"
"net/url"
"os/exec"
"strconv"
"strings"
)
// flushWriter holds a flusher and writer.
// http://stackoverflow.com/questions/19292113/not-buffered-http-responsewritter-in-golang
// http://play.golang.org/p/PpbPyXbtEs
type flushWriter... |
// Copyright (c) 2016 Uber Technologies, Inc.
//
// 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, modify, merge... |
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// Modified by Prysmatic Labs 2018
//
// 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 Found... |
package presto
import (
"context"
"github.com/flyteorg/flyteplugins/go/tasks/plugins/presto/client"
"github.com/flyteorg/flytestdlib/cache"
"github.com/flyteorg/flyteplugins/go/tasks/errors"
pluginMachinery "github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery"
"github.com/flyteorg/flyteplugins/go/tasks/... |
package dhcpv6
import (
"errors"
"fmt"
"net"
"github.com/u-root/u-root/pkg/uio"
)
const RelayHeaderSize = 34
type DHCPv6Relay struct {
messageType MessageType
hopCount uint8
linkAddr net.IP
peerAddr net.IP
options Options
}
func (r *DHCPv6Relay) Type() MessageType {
return r.messageType
}
f... |
package controllers
import (
// beego "github.com/beego/beego/v2/adapter"
"github.com/beego/beego/v2/core/logs"
"github.com/beego/beego/v2/server/web"
"github.com/gorilla/websocket"
"github.com/holys/initials-avatar"
// "io"
"encoding/json"
"log"
"net/http"
"net/url"
)
var chat_clients = make(map[*websocket... |
// Copyright © <NAME> – This file is part of GoatCounter and published
// under the terms of a slightly modified EUPL v1.2 license, which can be found
// in the LICENSE file or at https://license.goatcounter.com
package handlers
import (
"fmt"
"net/http"
"sync"
"time"
"github.com/gorilla/websocket"
"zgo.at/jso... |
package parameter
/*
* 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
... |
package iavl
import (
"bytes"
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNode_aminoSize(t *testing.T) {
node := &Node{
key: randBytes(10),
value: randBytes(10),
version: 1,
height: 0,
size: 100,
hash: randByte... |
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"time"
"github.com/elastos/Elastos.ELA.SideChain.ID/params"
"github.com/elastos/Elastos.ELA.Utility/common"
"github.com/elastos/Elastos.ELA.Utility/elalog"
)
const (
ConfigFilename = "./config.json"
defaultLogLevel = "info... |
package gatewaySlack
import (
"encoding/json"
"errors"
"io/ioutil"
"log"
"time"
"github.com/1egoman/slick/gateway"
"golang.org/x/net/websocket"
)
const pingFrequency = 30 // In seconds
// Connect to the slack persistent socket.
func (c *SlackConnection) Connect() error {
c.connectionStatus = gateway.CONNECT... |
/* Copyright 2020 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
package main
import (
"context"
"crypto/rsa"
_ "expvar" // Register the expvar handlers
"fmt"
"io/ioutil"
"log"
"net/http"
_ "net/http/pprof" // Register the pprof handlers
"os"
"os/signal"
"syscall"
"time"
"contrib.go.opencensus.io/exporter/zipkin"
"github.com/ardanlabs/garagesale/cmd/sales-api/interna... |
// Package easing provides all the implemented easing functions.
// The type easing is implemented in package dsp. You need to call Init
package easing
import (
"math"
)
// must map [0.0, 1.0] to [0.0, 1.0]
type EasingFun func(float64) float64
type Easing struct {
In, Out EasingFun
}
var (
Linear = Easing{
In: ... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
package dogstatsd
import (
"time"
"github.com/DataDog/datadog-agent/p... |
package provisioner
import (
"context"
"fmt"
"strings"
"time"
"github.com/coreos/go-semver/semver"
"github.com/milvus-io/milvus-operator/pkg/config"
"github.com/milvus-io/milvus-operator/pkg/util"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/con... |
package main
import (
"fmt"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"log"
"os"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"
"github.com/birdayz/kaf"
"github.com/birdayz/kaf/avro"
"github.com/birdayz/kaf/pkg/proto"
)
var cfgFile string
func getConfig() (saramaConfig *sarama.Config) {
saramaConfi... |
package testhelpers
import (
"context"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"net/http"
"os"
"testing"
"time"
"github.com/ory/x/tlsx"
"github.com/avast/retry-go/v3"
"github.com/phayes/freeport"
"github.com/spf13/cobra"
"github.com/stretchr/testify/require"
"gith... |
package utp
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 compile-time assertion to ensure that this generated file
// is compatible with the p... |
package keeper
import (
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
"github.com/tharsis/evmos/v3/x/claims/types"
)
// EndBlocker checks if the airdrop claiming period has ended in or... |
// Copyright 2019 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 policy
import (
"errors"
"fmt"
"sync"
"time"
"github.com/vmware/harbor/src/common/scheduler/task"
"github.com/vmware/harbor/src/common/utils/log"
)
const (
oneDay = 24 * 3600
)
//AlternatePolicyConfiguration store the related configurations for alternate policy.
type AlternatePolicyConfiguration stru... |
// Copyright 2018 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 tvm
import (
"fmt"
"io/ioutil"
"log"
"strings"
)
// Package tvm is the core package implement the tiny virtual machine.
/* core struct tvm */
type Ctx struct {
Prog *Prog
Mem *Mem
}
func NewCtx() *Ctx {
ctx := new(Ctx)
ctx.Prog = NewProg()
ctx.Mem = NewMem(MIN_MEMORY_SIZE)
ctx.Mem.StackCreate(M... |
package joi
import (
"encoding/base64"
"encoding/hex"
"reflect"
"regexp"
"strings"
"github.com/badoux/checkmail"
)
// StringSchema Error definitions
var (
ErrStringMin = NewError("string", "Value is smaller")
ErrStringMax = NewError("string", "Value is bigger")
ErrStringLength = NewE... |
package database
import (
"context"
"time"
"github.com/cockroachdb/errors"
"github.com/sourcegraph/sourcegraph/cmd/frontend/globals"
"github.com/sourcegraph/sourcegraph/internal/authz"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
"git... |
package v2
import (
"fmt"
"log"
"strings"
validation "github.com/go-ozzo/ozzo-validation"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
type serviceYAML struct {
// Protocol specifies the service connector by protocol. It is an internal
// detail.
//
// Deprecated: Protocol exists for historical compatibili... |
package packet
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"errors"
"fmt"
"github.com/iotaledger/hive.go/protocol/message"
"github.com/iotaledger/hive.go/protocol/tlv"
)
var (
// ErrInvalidHeartbeat is returned for invalid heartbeats.
ErrInvalidHeartbeat = errors.New("invalid heartbeat")
)
const (
... |
package reports
import (
"database/sql"
"errors"
"html/template"
"log"
"math"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/dude333/rapina/fetch"
"github.com/dude333/rapina/parsers"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
type Server struct {
db *sql.DB
fe... |
package main
/*
* 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
* "L... |
// Copyright 2017 Google Inc. 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... |
package main
/*
Copyright 2017 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
/*
* This file is part of easyKV.
* © 2016 The easyKV Authors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package file
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"sync"
"testing"
"time"
... |
package localbuilder
import (
"context"
"fmt"
"math/rand"
"net"
"strconv"
"strings"
"sync"
"time"
"github.com/rancher/rio/cli/pkg/localbuilder/runc"
riov1 "github.com/rancher/rio/pkg/apis/rio.cattle.io/v1"
"github.com/rancher/rio/pkg/constants"
"github.com/rancher/rio/pkg/stack"
"github.com/rancher/wrang... |
/*
Copyright 2020 The Kruise 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 2016 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package pvl
import (
"net"
"net/url"
"regexp"
"strings"
"github.com/PuerkitoBio/goquery"
libkb "github.com/keybase/client/go/libkb"
keybase1 "github.com/keybase/client/go/protocol/keybase1"... |
/*
* Copyright (c) 2018 - 2019. The Inn4Science Team
*
* 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 tcp
import (
"context"
"errors"
"net"
"sync"
"time"
)
// connext keys
var (
ClientContextKey = &contextKey{"tcp-client"}
)
type cliConn struct {
conn
client *Client
}
func (c *cliConn) onSetStateHook(state ConnState) {
s := c.client
switch state {
case StateNew:
s.trackConn(c, true)
case State... |
package keeper
import (
"encoding/json"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/cosmwasm/wasmd/x/wasm/internal/types"
)
const (
... |
package apid
import (
"context"
"encoding/json"
"fmt"
"net/http"
"sync"
"sync/atomic"
"time"
"github.com/coreos/etcd/clientv3"
"github.com/gorilla/mux"
"github.com/sensu/sensu-go/backend/apid/actions"
"github.com/sensu/sensu-go/backend/apid/middlewares"
"github.com/sensu/sensu-go/backend/apid/routers"
"g... |
package sqlparser
import (
"fmt"
"strings"
"github.com/alpacahq/marketstore/v4/catalog"
"github.com/alpacahq/marketstore/v4/contrib/candler/candlecandler"
"github.com/alpacahq/marketstore/v4/contrib/candler/tickcandler"
"github.com/alpacahq/marketstore/v4/uda"
"github.com/alpacahq/marketstore/v4/uda/adjust"
"... |
package typescript
import (
"errors"
"fmt"
"os"
"reflect"
"strings"
"github.com/TwiN/go-color"
)
func indirect(t reflect.Type) reflect.Type {
k := t.Kind()
for k == reflect.Ptr {
t = t.Elem()
k = t.Kind()
}
return t
}
func indent(text string) string {
temp := strings.Split(text,... |
// Copyright 2020 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package dogen
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
"go/format"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime/debug"
"strings"
"sync"
"text/template"
"github.com/joho/godotenv"
"github.com/rakyll/statik/fs"
_ "github.com/sivchari/dogen/statik"
"golang.org/x/sync/errgroup"
)
// Ve... |
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"strconv"
"github.com/Masterminds/semver"
"github.com/subtlepseudonym/go-prompt"
)
// *semver.Version objects can't be const, which is lame (but understandable)
var defaultVersion *semver.Version = semver.MustParse("v0.1.0")
const versionFileName string... |
package cwl
import (
"bytes"
"fmt"
"regexp"
"time"
"github.com/elastic/beats/libbeat/logp"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)
type Stream struct {
Name string
Group *Group
Params *Params
queryParams *cloudwatchlogs.GetLogEventsInput
// This is used ... |
package form
import (
"image"
"image/color"
"log"
"strings"
"github.com/cs3238-tsuzu/prasoba/text"
textsoba "github.com/cs3238-tsuzu/prasoba/text"
"github.com/cs3238-tsuzu/prasoba/transformer"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
"github.com/hajimehoshi/ebiten/v2/... |
// Copyright 2012 The KidStuff 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 mongostore
import (
"context"
"errors"
"net/http"
"time"
"github.com/globalsign/mgo/bson"
"github.com/gorilla/securecookie"
"github.com/g... |
//
// DISCLAIMER
//
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
//
// 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 re... |
/*
Copyright 2018 Gravitational, 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 in writing, soft... |
package orientation
import (
"errors"
"fmt"
"image"
"image/gif"
"image/jpeg"
"image/png"
"strings"
"github.com/disintegration/imaging" // go get -u github.com/disintegration/imaging
"github.com/rwcarlsen/goexif/exif" // go get -u github.com/rwcarlsen/goexif/exif
"github.com/sirupsen/logrus" // go ge... |
package sql
import (
"context"
"fmt"
"strconv"
"sync"
"time"
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
uuid "github.com/satori/go.uuid"
"github.com/vgough/sequin/job"
)
var chLock sync.Mutex
var channels = map[string]chan *WorkItem{}
var pollInterval = 1 * time.Second
var... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package schemas
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 ListSchemasInput struct {
_ struct{} `type:"structure"`
Limit *int6... |
package safe
import (
"errors"
"fmt"
"io"
"os"
)
type lockingFileWriterState int
const (
lockingFileWriterStateOpen = lockingFileWriterState(iota)
lockingFileWriterStateLocked
lockingFileWriterStateClosed
)
// ErrFileAlreadyLocked is returned when trying to lock a file which has already been locked by
// ano... |
/*
* @Descripttion:
* @version:
* @Author: cm.d
* @Date: 2021-11-20 11:50:21
* @LastEditors: cm.d
* @LastEditTime: 2021-11-29 01:00:16
*/
package main
import (
"fmt"
"log"
"net/http"
"strconv"
"sync"
"time"
alfheimdbwal "github.com/dj456119/AlfheimDB-WAL"
"github.com/sirupsen/logrus"
)
var index int6... |
// Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by entc, DO NOT EDIT.
package surveyquestion
import (
"time"
"github.com/facebook/ent"
)
const (
// Label holds the string label d... |
// Package router provides a lightning fast HTTP router.
package router
import (
"context"
"fmt"
"net/http"
"regexp"
"strings"
)
type contextKey int
// Context keys
const (
contextKeyParamsIdx contextKey = iota
contextKeyParams
)
// The Router is the main structure of this package.
type Router struct {
NotF... |
package service
import (
"fmt"
"net/url"
pbAS "github.com/go-ocf/cloud/authorization/pb"
"github.com/go-ocf/cloud/coap-gateway/coapconv"
pbCQRS "github.com/go-ocf/cloud/resource-aggregate/pb"
gocoap "github.com/go-ocf/go-coap"
coapCodes "github.com/go-ocf/go-coap/codes"
"github.com/go-ocf/kit/codec/cbor"
"gi... |
package processor
import (
"time"
"github.com/Jeffail/benthos/v3/lib/bloblang/x/mapping"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/message"
"github.com/Jeffail/benthos/v3/lib/message/tracing"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/respons... |
package proxy
import (
"encoding/base64"
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestPicture_Extract(t *testing.T) {
tbl := []struct {
inp string
res []string
}{
{
`<p> blah <img src="http://radio-t.com/img.pn... |
// Copyright 2021, OpenTelemetry 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 ag... |
package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
)
func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] != ' ' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}
func readNu... |
package constants
import (
"errors"
"fmt"
"strings"
)
// Layout represents keyboard layout
type Layout struct {
// Locales is a list of locales which could be used in pair with this layout
Locales []string
// Layout code
Layout string
// Description is a human readable description
Description string
}
var l... |
package integration
import (
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"testing"
"time"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
func init() {
Suite(&QemuSuite{
runCommand: "../scripts/run",
sshCommand: "../scripts/ssh",
qemuCmd: nil,
})
}
var (
BusyboxImage = map[string]s... |
package convert
import (
"encoding/base64"
"errors"
"io"
"path/filepath"
"strconv"
"time"
"github.com/nikandfor/loc"
"github.com/nikandfor/tlog"
"github.com/nikandfor/tlog/low"
"github.com/nikandfor/tlog/wire"
)
type (
JSON struct {
io.Writer
AppendNewLine bool
AppendSafe bool
TimeFormat st... |
// Copyright 2017 Google LLC. 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... |
/*
Copyright Xilinx Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package bcm
import (
"context"
"fmt"
"net"
"sync"
"time"
"golang.org/x/net/ipv4"
)
// BcmTransportConn keeps end to end transport connection
type BcmDCNLightUDPConn struct {
sync.RWMutex
localAddr string
remoteAddr st... |
package kvpearl
import (
"encoding/base64"
"encoding/json"
"sort"
"time"
"neckless.adviser.com/key"
"neckless.adviser.com/pearl"
)
// JSONKVPearl the JSON resprestion of a KVPearl
type JSONKVPearl struct {
// Tags []string
Keys []JSONKey // sorted by keys
FingerPrint string `json:"FingerPrint,omit... |
package main
import (
"fmt"
"k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/record"
"k8s.io/kubernetes/pkg/controller/deployment/util"
"time"
)
const (
deploymentGenerator... |
// Command sqlplay is a playground for SQLite databases. It's based on
// https://gist.github.com/bradfitz/a7db110a6bd7d9c9bd02352adaea389b.
package main
import (
"bytes"
"context"
"database/sql"
_ "embed"
"encoding/json"
"flag"
"fmt"
"html"
"html/template"
"io"
"log"
"net/http"
"net/url"
"os"
"os/signa... |
package filter
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"time"
"github.com/ONSdigital/dp-filter/observation"
"github.com/ONSdigital/go-ns/log"
)
//go:generate moq -out filtertest/http_client.go -pkg filtertest . HTTPClient
// Store provides access to stored dimension dat... |
package types
import (
"encoding/json"
"fmt"
"sort"
"strings"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/modules/incubator/nft/exported"
)
// Collection of non fungible tokens
type Collection struct {
Denom string `json:"denom,omitempty" yaml:"denom"` // name of the collection; not exported t... |
// Copyright for portions of this fork are held by [<NAME>, 2016]
// as part of the original go-datastore project. All other copyright for this
// fork are held by [DAOT Labs, 2020]. All rights reserved. Use of this source
// code is governed by MIT license that can be found in the LICENSE file.
// Package key provide... |
/*
This tutorial is inspired on this two go-libp2p example:
- https://github.com/libp2p/go-libp2p-examples/blob/master/chat/chat.go
- https://github.com/libp2p/go-libp2p-examples/tree/master/pubsub/chat
This tutorial builds a chat using smart-records instead of direct communication or PubSub to broadcast messages... |
/*
* Copyright 2020 <NAME>
*
* 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 wr... |
package api
import (
"fmt"
"net/http"
"code.cloudfoundry.org/lager"
"encoding/json"
"github.com/cloudfoundry-incubator/galera-healthcheck/api/middleware"
"github.com/cloudfoundry-incubator/galera-healthcheck/config"
"github.com/cloudfoundry-incubator/galera-healthcheck/domain"
"github.com/tedsuo/rata"
)
//... |
package manager
import (
"database/sql"
"fmt"
"math"
"strings"
"time"
"github.com/lbryio/transcoder/pkg/mfr"
"github.com/lbryio/transcoder/storage"
"github.com/lbryio/transcoder/video"
"github.com/karlseguin/ccache/v2"
)
const (
videoPlaylistPath = "."
channelURIPrefix = "lbry://"
level5Suppo... |
package json_diff
import (
"fmt"
"github.com/520MianXiangDuiXiang520/json-diff/decode"
"io/ioutil"
"log"
"testing"
)
func ExampleAsDiffs() {
json1 := `{
"A": 1,
"B": [1, 2, 3, {"1": 2}],
"C": {
"CA": 1
}
}`
json2 := `{
"A": 2,
"B": [{"1": 2}, 1, {... |
package main
import (
"encoding/json"
"fmt"
"sort"
"strings"
sysl "github.com/anz-bank/sysl/src/proto"
"github.com/anz-bank/sysl/sysl2/sysl/syslutil"
"github.com/sirupsen/logrus"
)
type sequenceDiagParam struct {
AppLabeler
EndpointLabeler
endpoints []string
title string
blackboxes map[string]*Upto... |
package emd
import (
"fmt"
"regexp"
"strconv"
"strings"
)
const dotTemplate string = `
digraph G {
graph [ bgcolor=transparent style=filled ] {
subgraph commands {
node [shape=box pos=1 fontname="Helvetica bold" style=filled fillcolor="#75a6f1"]
{ rank=same;
%s
}
}
... |
package main
import "container/heap"
import "math/rand"
import "errors"
import "log"
type Position struct {
x int
y int
sizex int
sizey int
}
type CarveState struct {
backtracks *PriorityQueue
current Position
maze *Maze
}
const GO_LEFT = 0
const GO_RIGHT = 1
const GO_UP = 2
const GO_DOWN = 3
const GO_UNKNOW... |
package datastruct
import (
"fmt"
"github.com/cheekybits/genny/generic"
"strconv"
"sync"
)
/*
单向线性链表
Append(t) // 将元素 t 追加到链表尾部
Insert(i, t) // 在位置 i 处插入元素 t
RemoveAt(i) // 移除位置 i 的元素
IndexOf(t) // 返回元素 t 的位置
IsEmpty(l) // l 是空链表则返回 true
Size() // 返回链表的长度
String() // 返回链表的字符串表示
Head() // 返回链表的首结点,以便迭... |
// Copyright © 2020, 2021 Attestant Limited.
// 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 a... |
/*
* Copyright (c) 2017-2020 The qitmeer developers
*/
package synch
import (
"context"
"errors"
"fmt"
"github.com/Qitmeer/qitmeer/core/blockdag"
"github.com/Qitmeer/qitmeer/p2p/common"
"github.com/Qitmeer/qitmeer/p2p/peers"
pb "github.com/Qitmeer/qitmeer/p2p/proto/v1"
libp2pcore "github.com/libp2p/go-libp2... |
/*
Copyright 2020 The Flux 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, softwar... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt... |
package orm_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"pgregory.net/rapid"
"github.com/regen-network/regen-ledger/orm"
"github.com/regen-network/regen-ledger/orm/testda... |
package metric
import (
"context"
"encoding/hex"
"os"
"strconv"
"sync"
"time"
"contrib.go.opencensus.io/exporter/prometheus"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
"github.com/icon-project/goloop/common/log"
"github.com/icon-project/goloop/module"
)
//metric common... |
package main
import (
"fmt"
"github.com/cmcoffee/go-nfo"
"strings"
)
type Config struct {
Admin string `json:"admin_account"`
Server string `json:"server"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Signature string `json:"signature"`
Tested bool ... |
/*
* Copyright (c) 2019 InterDigital Communications, 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 ap... |
// Copyright (C) The Arvados Authors. All rights reserved.
//
// SPDX-License-Identifier: AGPL-3.0
package worker
import (
"bytes"
"encoding/json"
"fmt"
"net"
"strings"
"syscall"
"time"
"git.arvados.org/arvados.git/lib/crunchrun"
"github.com/sirupsen/logrus"
)
// remoteRunner handles the starting and stopp... |
package exp
import "strings"
type (
identifier struct {
schema string
table string
col interface{}
}
)
func ParseIdentifier(ident string) IdentifierExpression {
parts := strings.Split(ident, ".")
switch len(parts) {
case 2:
return NewIdentifierExpression("", parts[0], parts[1])
case 3:
return New... |
package main
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"github.com/alecthomas/chroma/formatters/html"
"github.com/alecthomas/chroma/lexers"
"github.com/alecthomas/chroma/styles"
"github.com/mewkiz/pkg/jsonutil"
"github.com/mewkiz/pkg/pathutil"
"github.com/mewmew/ln... |
package golog
import (
"strings"
"github.com/kataras/pio"
)
// Level is a number which defines the log level.
type Level uint32
// The available built'n log levels, users can add or modify a level via `Levels` field.
const (
// DisableLevel will disable the printer.
DisableLevel Level = iota
// FatalLevel will... |
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package winapi
import (
"unsafe"
"github.com/Gipcomp/win32/gdi32"
"github.com/Gipcomp/win32/handle"
"github.com/Gipcomp/win32/user32"... |
package connectionquality
import (
"sync"
"time"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/pion/rtcp"
"github.com/pion/webrtc/v3"
)
type Snapshot struct {
Initialized bool
TotalPacketsLost uint32
HighestSeqNum uint32
}... |
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the pack... |
// Package local implements local Hollow Nodes.
// ref. https://github.com/kubernetes/kubernetes/blob/master/pkg/kubemark/hollow_kubelet.go
//
// The purpose is to make it easy to run on EKS.
// ref. https://github.com/kubernetes/kubernetes/blob/master/test/kubemark/start-kubemark.sh
//
package local
import (
"contex... |
/*
Copyright 2016 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, ... |
//
// Copyright 2018-present Sonatype 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.