code stringlengths 6 1.05M |
|---|
// NewDefault returns a new Sketch with the eps = 0.01 and maxElements 1000
func NewDefault() *Sketch {
stream, _ := New(0.01, 1000)
return stream
} |
#pragma mark CommandObjectProcessLoad |
_, err = tx.Exec("insert into foo(id) values (1)")
if err != nil {
t.Fatalf("tx.Exec failed: %v", err)
} |
let parent_force_focus = match parent {
// childs of root window are always force_focused
Some(0) => true,
// childs of force_focused windows are always force_focused as well
Some(parent) => self
.windows
.get(&parent)
... |
sigBytes := append(bigIntTo32Bytes(signature.R), bigIntTo32Bytes(signature.S)...)
if len(sigBytes) != 64 {
return nil, fmt.Errorf("unexpected signature length: %d bytes, expected %d bytes", len(sigBytes), 64)
}
return sigBytes, nil
} |
pub fn season_stats(&self, show_id: impl Display, season_number: u32) -> Result<MediaStats> {
self.get(api_url!((
"shows",
show_id,
"seasons",
season_number,
"stats"
)))
} |
impl AccountCapabilitiesSofortPayments {
pub fn as_str(self) -> &'static str {
match self {
AccountCapabilitiesSofortPayments::Active => "active",
AccountCapabilitiesSofortPayments::Inactive => "inactive",
AccountCapabilitiesSofortPayments::Pending => "pending",
}... |
pub fn serve() {
tokio::spawn(setup_metrics());
} |
Value *const baseValue = CurrentBlockData()->FindValue(baseOpnd->m_sym);
if(!baseValue)
{
return;
}
ValueInfo *baseValueInfo = baseValue->GetValueInfo();
ValueType baseValueType(baseValueInfo->Type()); |
use unsafe_downcast_mut;
use cast_to_interface;
use std::mem::transmute; |
mock "github.com/stretchr/testify/mock"
) |
let lang =
optional_arg!(String, args.get("lang"), "`get_taxonomy`: `lang` must be a string")
.unwrap_or_else(|| self.default_lang.clone()); |
ZapImport * pImport = m_pImage->GetImportTable()->GetStringHandleImport(tokenScope, metaTok);
AppendConditionalImport(pImport); |
pub fn parse_fragment(
token_source: &mut dyn TokenSource,
tree_sink: &mut dyn TreeSink,
fragment_kind: FragmentKind,
) {
let parser: fn(&'_ mut parser::Parser) = match fragment_kind {
FragmentKind::Path => grammar::fragments::path,
FragmentKind::Expr => grammar::fragments::expr,
... |
if (digits == 0 && comma) { // There was a ',' which wasn't followed by digits, we should print it.
sRet += ',';
}
}
// CO controls codes
if (ch < 0x20 || ch == 0x7F)
continue;
sRet += ch;
}
if (colorCode && digits == 0 && comma) {
sRet += ',';
} |
import (
i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization"
) |
desc.graphics.depth_stencil_state.depth_enable = depth_stencil_state_info.depthTestEnable;
desc.graphics.depth_stencil_state.depth_write_mask = depth_stencil_state_info.depthWriteEnable;
desc.graphics.depth_stencil_state.depth_func = convert_compare_op(depth_stencil_state_info.depthCompareOp);
desc.graphics.dep... |
StackSym *stackSym = nullptr;
IR::SymOpnd *symOpnd = nullptr;
IR::RegOpnd *regOpnd = nullptr; |
h.mu.Lock()
if settingsCalls-prevSettingsCalls >= workingStatusThreshold {
h.workingStatus = modules.HostWorkingStatusWorking
}
// First check is quick, don't set to 'not working' if host has not been
// contacted enough times.
h.mu.Unlock() |
// Deleting a very large list of keys will cause the freelist to use overflow.
func TestBucket_Delete_FreelistOverflow(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
} |
// CommandObjectMultiwordProcess |
state_.iteration_state_ = IterationState::Ongoing;
resumeIteration();
} |
// Update SLM usage
slmUsed |= scheduler.slmTotalSize > 0; |
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} |
/// Include <glm/gtx/scalar_multiplication.hpp> to use the features of this extension. |
default:
llvm_unreachable("Unimplemented option");
}
return error;
} |
// SendCoinsFromAccountToModule transfers coins from an AccAddress to a ModuleAccount.
// It will panic if the module account does not exist.
func (k BaseKeeper) SendCoinsFromAccountToModule(
ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins,
) error { |
const opGetAuthorizers = "GetAuthorizers" |
91, 146, 153, 17, |
#include <qwt_thermo.h> |
// A battery of tests to ensure destructors of unboxed closure environments
// run at the right times. |
func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
fc := &graphql.FieldContext{
Object: "__Enum... |
fn write_vectored(&mut self, bufs: &[std::io::IoSlice<'_>]) -> std::io::Result<usize> {
match self.empty_slice_mut().write_vectored(bufs) {
Ok(w) => {
self.pos += w;
Ok(w)
}
Err(e) => Err(e),
}
} |
<gh_stars>1-10
// +build linux |
#[test]
fn connect_error() {
match TcpStream::connect("0.0.0.0:1") {
Ok(..) => panic!(),
Err(e) => assert!((e.kind == ConnectionRefused)
|| (e.kind == InvalidInput)),
}
} |
parse_punctuated_items(arg_list)
} |
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDeco... |
// ComposeId defines model for ComposeId.
type ComposeId struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference
// Embedded fields due to inline allOf schema
Id string `json:"id"`
} |
// LastKeyForTest must be the last one in this const group for testing purpose
LastKeyForTest
) |
impl From<semantics::TypeError> for EvalPrintError {
fn from(src: semantics::TypeError) -> EvalPrintError {
EvalPrintError::Type(src)
}
} |
while( !it.IsAtEnd() )
{
double value = it.Value(); |
f.activate();
EXPECT_EQ(1, count);
} |
// Soft-sleep to ratelimit the number of incoming connections.
select {
case <-h.tg.StopChan():
case <-time.After(rpcRatelimit):
}
}
} |
<gh_stars>100-1000
// Copyright 2021 Matrix Origin
//
// 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 applicabl... |
func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
rc := graphql.GetOperationContext(ctx)
ec := executionContext{rc, e}
first := true |
ctxt.Diag("cannot find elf name %s", name)
errorexit()
return nil
} |
import (
"fmt"
"io"
"time" |
pub struct BitBuffer<'a> {
_buf: &'a [u8],
_bi: usize,
} |
// Setpriority is an alias of golang.org/x/sys/unix.Setpriority, wrapped to automatically retry on EINTR.
func Setpriority(which int, who int, prio int) (err error) {
for {
err = unix.Setpriority(which, who, prio)
if err != syscall.EINTR {
break
}
}
return
} |
pub fn set_key_pressed(&mut self, vm: &mut Vm, keycode: Keycode) {
match keycode {
Keycode::Num1 => { vm.key_states[0x1] = true; }
Keycode::Num2 => { vm.key_states[0x2] = true; }
Keycode::Num3 => { vm.key_states[0x3] = true; }
Keycode::Q => { vm.key_states[0x4... |
#[test]
fn lock_parse_pipfile() {
let parser = PipFile::new(Path::new("tests/fixtures/Pipfile.lock")).unwrap(); |
// Represents the result of a single hyperparameter tuning trial from a
// training job. The TrainingOutput object that is returned on successful
// completion of a training job with hyperparameter tuning includes a list
// of HyperparameterOutput objects, one for each successful trial.
type HyperparameterOutput struct... |
if fee > self.amount + self.fee {
let reason = format!(
"Rejected the transfer because transaction fee ({}) exceeds received amount ({}).",
amount_to_hr_string(fee, false),
amount_to_hr_string(self.amount + self.fee, false)
);
info!("{}", reason);
return Err(ErrorKind::Fee(reason).into());
} |
ToVar(writeThroughSymbolsSet, this->currentBlock);
} |
<filename>examples/linux.rs<gh_stars>0
extern crate linux_embedded_hal as hal;
use isl29125::{Isl29125, OperatingMode}; |
connect(m_Controls.rawCtImageSingleNodeSelectionWidget,
&QmitkSingleNodeSelectionWidget::CurrentSelectionChanged,
this,
&NodeEditor::RawCtImageChanged);
connect(m_Controls.evaluationPointsSingleNodeSelectionWidget,
&QmitkSingleNodeSelectionWidget::CurrentSelectionChanged,
... |
use slog::{info, o, Logger}; |
assert_eq!(deleted_device.name(), "smart socket");
assert_eq!(deleted_device.description(), "Handmade socket");
assert!(matches!(deleted_device, Device::Socket(_)));
}
} |
TEST_F(LoginDatabaseTest, RemoveLoginsSyncedBetween) {
ScopedVector<autofill::PasswordForm> result; |
foundResource := &kubevirtv1.KubeVirt{}
Expect(
cl.Get(context.TODO(),
types.NamespacedName{Name: existingResource.Name, Namespace: existingResource.Namespace},
foundResource),
).To(BeNil()) |
enum Enum {
Struct {
x: i32,
y: i64,
z: i16,
},
Tuple(i32, i64, i16)
} |
pub struct WordGameState {
pub table: Table,
pub taken_words: Vec<String>,
pub guessers: HashMap<UserId, u32>,
pub message: Message,
} |
tester.check();
} |
if Linkmode == LinkExternal && *flagBuildid != "" {
addgonote(ctxt, ".note.go.buildid", ELF_NOTE_GOBUILDID_TAG, []byte(*flagBuildid))
}
} |
let memory_size = 65536; |
// To handle VS name which start with Number,
// we are prefixing with 'cfgmap_' to avoid errors with bigip.
func formatConfigMapVSName(cm *v1.ConfigMap) string {
VSprefix := "cfgmap"
if _, err := strconv.Atoi(cm.ObjectMeta.Namespace[0:1]); err == nil {
return fmt.Sprintf("%s_%s_%s", VSprefix, cm.ObjectMeta.Namespa... |
// with the channels established, let's do a transfer via sdk transfer
coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1))
timeoutHeight := clienttypes.NewHeight(1, 110)
msg := ibctransfertypes.NewMsgTransfer(channelA.PortID, channelA.ID, coinToSendToB, chainA.SenderAccount.GetAddress(), chainB.Sender... |
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
}, |
#include "game.hpp" |
if let Some(output) = take_field::<Option<RelativePathBuf>>(value, "output")? {
manifest.output = Some(output.to_path(base));
} |
void PlatformBridgeFilter::resumeEncoding() {
ENVOY_LOG(trace, "PlatformBridgeFilter({})::resumeEncoding", filter_name_); |
bar, err := b.CreateBucket([]byte("bar"))
if err != nil {
t.Fatal(err)
}
for i := 0; i < 10; i++ {
if err := bar.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i))); err != nil {
t.Fatal(err)
}
} |
impl RaftLogBatchTrait for RaftLogBatch {
fn append(&mut self, raft_group_id: u64, entries: Vec<Entry>) -> Result<()> {
self.0.add_entries(raft_group_id, entries);
Ok(())
} |
operator int() const {
return h;
} |
_, err = os.Stat(filepath.Join(s.folder, "files"))
c.Assert(err, NotNil)
c.Assert(os.IsNotExist(err), Equals, true)
} |
Variant::Variant(const RID &p_rid) {
godot::api->godot_variant_new_rid(&_godot_variant, (godot_rid *)&p_rid);
} |
// Collect arg and ret nodes from graph.
for (auto* node : GetOrderedNodes())
if (node->IsArg())
TF_RETURN_IF_ERROR(add_node(node, arg_nodes));
else if (node->IsRetval())
TF_RETURN_IF_ERROR(add_node(node, ret_nodes)); |
// Initialize the poll that checks for deleted jobs and removes them
// This is only necessary as a fallback in case the event doesn't fire for some reason
// It doesn't need to run very often
deletedPollTicker := time.NewTicker(checkForDeletedJobsPollInterval)
defer deletedPollTicker.Stop() |
if let Some(duration) = inst.duration_epochs {
if duration == 0 {
println!("Duration cannot be 0. Instruction: {:?}", &inst);
exit(1);
}
if let Some(current) = current_epoch {
in... |
//create the execution directory
func (o *InitOptions) createExecutionDirectory() error {
if o.EC.ExecutionDirectory == "" {
o.EC.ExecutionDirectory = o.InitDir
} else {
o.EC.ExecutionDirectory = filepath.Join(o.EC.ExecutionDirectory, o.InitDir)
} |
//-----------Below: add the datanode containing the DRR--------------
QString renameSuffix = "_new";
QString outputFilename = m_Controls.drrNameLineEdit->text();
auto node = GetDataStorage()->GetNamedNode(outputFilename.toLocal8Bit().data());
auto newnode = mitk::DataNode::New();
// in case the output name ... |
std::string ListJobStatusResult::getCode()const
{
return code_;
} |
impl IndexUid {
pub fn new_unchecked(s: impl AsRef<str>) -> Self {
Self(s.as_ref().to_string())
} |
func getInsecureURLViaPod(ns, execPodName, url string) (string, error) {
cmd := fmt.Sprintf("curl -s -k %q", url)
output, err := e2e.RunHostCmd(ns, execPodName, cmd)
if err != nil {
return "", fmt.Errorf("host command failed: %v\n%s", err, output)
}
return output, nil
} |
b->Normal = normal; |
<reponame>Slava-100/lab-05-stack
// Copyright 2021 Slava-100 <<EMAIL>> |
if lockRetryCount == lockMaxRetries {
return ErrTimeoutLockingStore
} |
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_vector.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester... |
func init() {
app.R.HandleFunc("/adminStats/roleInfo", app.AppHandler(adminStats_roleInfo, 1))
app.R.HandleFunc("/adminStats/roleInfoQuery", app.AppHandler(adminStats_roleInfoQuery, 1))
} |
// CreateRestApiRequest generates a "aws/request.Request" representing the
// client's request for the CreateRestApi operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to t... |
ctx, _ := context.WithTimeout(context.Background(), 50*time.Millisecond) |
if !data.Internal {
res := <-c.qs.Consume(tenant, resources...) |
namespace mu2e { |
/// Returns the factorial of a [`struct@d128`] up to `1000!` without doing any math
///
/// Factorials do not work with decimal numbers.
///
/// All return values of this function are hard-coded.
pub fn factorial(input: d128) -> d128 {
return lookup_factorial(input.into());
} |
// A description of the PVC request capacity.
// +optional
RequestStorage *resource.Quantity `json:"requestStorage,omitempty"` |
/**
* Represents a 2-dimensional Vector of ints.
*/
using Vector2F = Vector2<float>;
/**
* Represents a 3-dimensional Vector of floats.
*/
using Vector3F = Vector3<float>;
/**
* Represents a 4-dimensional Vector of floats.
*/
using Vector4F = Vector4<float>;
#endif |
suffix := path.RandString(5)
imageName := "e2e-test-image-import-os-" + suffix |
EXPECT_THAT(histogram_tester.GetAllSamples(
kPrefix + "FromHttpsRealm.OnHttpRealmWithSameHost"),
testing::ElementsAre(base::Bucket(1, 2), base::Bucket(2, 1)));
EXPECT_THAT(histogram_tester.GetAllSamples(
kPrefix + "FromHttpsRealm.OnHttpsRealmWithSameHost"),
... |
// We can re-assert an existing :db/ident.
assert_transact!(conn, "[[:db/add 100 :db/ident :name/Ivan]]");
assert_matches!(conn.last_transaction(),
"[[?tx :db/txInstant ?ms ?tx true]]");
assert_matches!(conn.datoms(),
"[[100 :db/ident :name... |
/// Retrieves a stream of updates from this viewmodel
fn get_updates(&self) -> BoxStream<'static, ViewModelChange>;
} |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 34