text string | label_name string | labels int64 |
|---|---|---|
_and_mesh: bool = True
vis_rgb: bool = False
# automatically populated if missing
exp_id: str = None
def main(opt: ExpSettings):
LF.seed_everything(42)
fabric = L.Fabric(accelerator="cuda", strategy="ddp", devices=[0])
fabric.launch()
# dataloaders
shape_ds = UnifiedObjects(
... | Python | 1 |
import argparse
import torch
import os
import shutil
from diffusers.models import UNet2DConditionModel
from diffusers.utils import SAFETENSORS_WEIGHTS_NAME
from safetensors.torch import save_file
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--lora_scale', type=float, default=1.0)
... | Python | 1 |
# Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
import torch
import torch.nn as nn
from mmaction.registry import MODELS
@MODELS.register_module()
class SubBatchNorm3D(nn.Module):
"""Sub BatchNorm3d splits the batch dimension into N splits, and run BN on
each of them separately (so ... | Python | 1 |
m_watch_price: Uint128::from(0u128),
owner: info.sender.clone(),
};
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
STATE.save(deps.storage, &state)?;
PepperContract::default().instantiate(deps, env, info, msg)
}
#[entry_point]
pub fn execute(
... | Rust | 0 |
s_apn_password2: String::default(),
gprs_apn_telecom2: String::default(),
gprs_apn3: String::default(),
gprs_apn_login3: String::default(),
gprs_apn_password3: String::default(),
gprs_apn_telecom3: String::default(),
gprs_apn4: String::default(),
... | Rust | 0 |
));
::protobuf::reflect::MessageDescriptor::new::<RpcResponseHeaderProto>(
"RpcResponseHeaderProto",
fields,
file_descriptor_proto()
)
})
}
}
}
impl ::protobuf::Clear for RpcResponseHeaderP... | Rust | 0 |
# Reset file reader cursor before parsing JSON
f.seek(0)
all_config = json.load(f)
print(f"[5] JSON parsed. Top-level keys found are: {list(all_config.keys())}")
if mode in all_config:
print(f"[6] SUCCESS: Mode '{mode}' was found in the keys.")... | Python | 1 |
he underlying connection to prevent from idling.
remote.disconnect().unwrap();
// Update the references in the remote's namespace to point to the right
// commits. This may be needed even if there was no packfile to download,
// which can happen e.g. when the branches have been changed but all the
... | Rust | 0 |
from __future__ import annotations
from .base import ProgressBar, ProgressBarCounter
from .formatters import (
Bar,
Formatter,
IterationsPerSecond,
Label,
Percentage,
Progress,
Rainbow,
SpinningWheel,
Text,
TimeElapsed,
TimeLeft,
)
__all__ = [
"ProgressBar",
"Progre... | Python | 1 |
### type error
def foo(f: Callable[[list[int]], int]) -> int:
return 1
foo(len)
| Python | 1 |
e_test_data(
subkey, test_config["N"], test_config["D"],
test_config["K"], test_config["C"]
)
# Test initialization methods
test_initialization_methods()
# Test JAX performance
start_time = time.time()
key, subkey = jax.random.sp... | Python | 1 |
-> Self
where
F: IntoServiceFactory<H>,
{
Self {
handshake: handshake.into_factory(),
handshake_timeout: Seconds(5),
disconnect_timeout: Seconds(3),
lw: 1024,
read_hw: 8 * 1024,
write_hw: 8 * 1024,
control: Defa... | Rust | 0 |
471e-08,
9.30080845407e-08,
9.38259651738e-08,
9.46472835298e-08,
9.54723502847e-08,
9.63014833769e-08,
9.71350089201e-08,
9.79732621669e-08,
9.88165885297e-08,
9.96653446693e-08,
1.00519899658e-07,
1.01380636230e-07,
1.02247952126e-07,
1.03122261554e-07,
1.040039... | Rust | 0 |
pture mode (Ctrl+1)
if key_combo_lower == "ctrl+1":
logger.debug("handle_input - Ctrl+1 capture mode activation detected")
# 1) Hide subtitle
if self.overlay.isVisible():
logger.debug("Hiding overlay before capture")
self.overlay.hide()
... | Python | 1 |
ut proto_response: ResultPingProto = Default::default();
proto_response.supported_version_maj = u32::from(result.supp_version_maj);
proto_response.supported_version_min = u32::from(result.supp_version_min);
Ok(proto_response)
}
}
impl TryFrom<ResultPingProto> for operations::ResultPing {
... | Rust | 0 |
# 1859. Sorting the Sentence
# A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.
# A sentence can be shuffled by appending the 1-indexed word position to each word then rearranging the words in the sent... | Python | 1 |
{FALSE, LPCVOID};
use winapi::um::winnt::PROCESS_ALL_ACCESS;
use winapi::um::processthreadsapi::OpenProcess; // You need to enable this as feature in Cargo.toml
use winapi::um::handleapi::CloseHandle; // You need to enable this as feature in Cargo.toml
fn main() {
use std::io;
use std::io::Writ... | Rust | 0 |
."]
#[doc = ""]
#[doc = " You must free all options structures allocated with this function using"]
#[doc = " hadoopRzOptionsFree."]
#[doc = ""]
#[doc = " @return A zero-copy options structure, or NULL if one could"]
#[doc = " not be allocated. If NULL is returned,... | Rust | 0 |
Fit object that contains the fitted Stan model.
- ``raw_data``: Pandas DataFrame containing the raw data used to fit the model,
as specified by the user.
- ``model_regressor``: Dict holding the extracted model-based regressors.
Examples
--------
.. code:: python
from hba... | Python | 1 |
put::R) reader structure"]
impl crate::Readable for XBAR1_IN07_SELECT_INPUT {}
#[doc = "`write(|w| ..)` method takes [xbar1_in07_select_input::W](xbar1_in07_select_input::W) writer structure"]
impl crate::Writable for XBAR1_IN07_SELECT_INPUT {}
#[doc = "XBAR1_IN07_SELECT_INPUT DAISY Register"]
pub mod xbar1_in07_select... | Rust | 0 |
).get_V(), true);
}
#[test]
// cmn r1, r2
fn cmn_r1_r2_with_overflow() {
setup();
let mut bus = MockBus::new();
&bus.set(0x0, 0xE171_0001);
let mut arm = ARMv4::new(Rc::new(RefCell::new(bus)));
arm.set_gpr(1, 0x7FFF_FFFF);
arm.set_gpr(2, 0x0000_0001);
... | Rust | 0 |
#
# 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 us... | Python | 1 |
from django.urls import path
from apps.document_processor import views
app_name = 'document_processor'
urlpatterns = [
# Resume routes
path('resumes/', views.ResumeListView.as_view(), name='resume_list'),
path('resumes/create/', views.ResumeCreateView.as_view(), name='resume_create'),
path('resumes/<u... | Python | 1 |
pub fn $name(bh: &mut Bencher) {
let key = Default::default();
let nonce = Default::default();
let mut cipher = <$cipher>::new(&key, &nonce);
let mut data = get_data($data_len);
bh.iter(|| {
cipher.apply_keystream(&mut data);
... | Rust | 0 |
# script for covering bug of tagger script
import pandas as pd
import argparse
import traceback, sys
import re
from pathlib import Path
from typing import List, Optional, Dict
import numpy as np
from huggingface_hub import hf_hub_download
from huggingface_hub.utils import HfHubHTTPError
TAGGER_VIT_MODEL_REPO: str =... | Python | 1 |
def process_request(self, req_type: RequestType, reqs: ReqList, **kwargs):
"""process reqs with given req type."""
# get callback
func = self.callbacks.get(req_type, None)
if func is not None:
func(reqs, **kwargs)
else:
# TODO: send error message
... | Python | 1 |
ClonedExt {
type Item;
fn cloned(&self) -> Vec<Self::Item>;
}
impl<T> SliceClonedExt for [&T]
where
T: Clone,
{
type Item = T;
fn cloned(&self) -> Vec<Self::Item> {
self.map(|x| (*x).clone())
}
}
/// Short hand analogous to `Iter::duped`, where items of `&T` are converted to `T` via ... | Rust | 0 |
d(
{
"name": module_name,
"path": subdir,
}
)
# Continue searching in subdirectories
new_relative_path = (
f"{re... | Python | 1 |
)
return streams
async def run_connector_migrate_to_inline_schemas_pipeline(context: ConnectorContext, semaphore: "Semaphore") -> Report:
restore_original_state = RestoreInlineState(context)
context.targeted_platforms = [LOCAL_BUILD_PLATFORM]
steps_to_run: STEP_TREE = []
steps_to_run.appe... | Python | 1 |
ear</li>
<li>• Remote positions offer 5-10% premium</li>
<li>• FAANG companies offer 20-40% above market average</li>
<li>• Equity compensation adds 10-30% to total comp</li>
<li>• AI/ML roles commanding highest premiums</li>
<li>• Cybersecurity... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.PayForPrivilegeRechargeCardUseLog import PayForPrivilegeRechargeCardUseLog
class AlipayMerchantPayforprivilegeUselogBatchqueryResponse(AlipayResponse):
def __ini... | Python | 1 |
import tkinter as tk
def add_task():
task = task_entry.get()
if task:
todo_list.append({"task": task, "completed": False})
task_entry.delete(0, tk.END)
view_tasks()
def view_tasks():
task_list.delete(0, tk.END)
if todo_list:
for index, task in enumerate(todo_list, start... | Python | 1 |
}
///
/// csr_map! {
/// pub CSR(0x0, 0xa) {
/// test1(RW):Test, 0x1;
/// test2(RW):Test, 0x7;
/// }
/// }
/// csr_map! {
/// CSR_p(0x0, 0xa) {
/// test1(WO):Test, 0x1;
/// test2(RO):Test, 0x7;
/// }
/// }
/// fn main(){
/// let csr = CSR::new(XLen::X64);
/// csr.write(1, 0xffffffff_ffffffff);
/... | Rust | 0 |
ui_root,
model,
are_you_sure: false,
})
}
}
impl EventHandler for MainState {
fn update(&mut self, ctx: &mut Context) -> GameResult<()> {
while let Some(event) = self.ui_root.event_sink().next() {
match event.as_str() {
"hello-pressed"... | Rust | 0 |
if 'pre' in cmd and len(cmd['pre']) > 0:
expect('ceph {0}'.format(cmd['pre']), 0)
expect('ceph -n {cn} -k {k} {c} {arg_val}'.format(
cn=cname,k=k,c=cmd_cmd,arg_val=cmd_args_val), expect_ret)
if 'post' in cmd and len(cmd['post']) > 0:
expect('ceph {0}'.format(cmd['... | Python | 1 |
,
"search_type": enhanced_strategy["search_type"],
"max_results": enhanced_strategy["max_results"],
# 검색 쿼리들
"primary_query": user_query,
"search_queries": [user_query], # 기본 쿼리
# 추가 검색 정보
"requires_additional... | Python | 1 |
ng> = from_variant(&s.parse::<Variant>().unwrap()).unwrap();
assert_eq!(value, None);
let s = "[1, 2, 3]";
let value: Vec<i32> = from_variant(&s.parse::<Variant>().unwrap()).unwrap();
assert_eq!(value, [1, 2, 3]);
let s = "{2: 'World'}";
let value: HashMap<i32, String> = from_variant(&s.parse:... | Rust | 0 |
num_gts = gt_bboxes.size(0)
gt_bboxes = gt_bboxes[None].expand(num_points, num_gts, 4)
xs, ys = points[:, 0], points[:, 1]
xs = xs[:, None]
ys = ys[:, None]
left = xs - gt_bboxes[..., 0]
right = gt_bboxes[..., 2] - xs
top = ys - gt_bboxes[..., 1]
bottom = ... | Python | 1 |
)
}
}
impl Clone for Smpp {
fn clone(&self) -> Self {
Smpp::new()
}
}
impl Smpp {
pub fn new() -> Self {
Smpp {
version: 0,
length_codec: LengthDelimitedCodec::builder()
.length_field_offset(0)
.length_field_length(4)
.length_adjustment(-4)
.new_codec(),
}
}
}
//! This crate automatic... | Rust | 0 |
fn prop_string(d in "\\PC*") {
let mut d1 = d.clone();
let mut d1 = unsafe{ d1.as_bytes_mut()};
let mut d2 = d.clone();
let mut d2 = unsafe{ d2.as_bytes_mut()};
let mut d3 = d.clone();
let mut d3 = unsafe{ d3.as_bytes_mut()};
le... | Rust | 0 |
tabase.
#[derive(Clone)]
pub struct UtxoStore {
/// Retain a reference to the Environment so the Database handles are valid.
_env: Arc<Environment>,
/// Mapping of SubaddressId -> [UtxoId].
/// This holds the list of UtxoIds associated with a (monitor id, subaddress
/// index tuple) and is used to ... | Rust | 0 |
ness", 0.1);
let bump_map = mp.get_float_texture_or_none("bumpmap");
let remap_roughness = mp.find_bool("remaproughness", true);
Arc::new(SubstrateMaterial {
kd,
ks,
nu: urough,
nv: vrough,
bump_map,
remap_roughness,
... | Rust | 0 |
mut rt as *mut sgx_status_t,
signed_blocks_encoded.as_ptr(),
signed_blocks_encoded.len() as u32,
)
};
ensure!(rt == sgx_status_t::SGX_SUCCESS, rt);
ensure!(res == sgx_status_t::SGX_SUCCESS, res);
Ok(())
}
fn fetch_sidechain_blocks_from_peer<SignedSidechainBlock: Decode>(
&self,
last_known_bl... | Rust | 0 |
# -*- coding: utf-8 -*- #
# 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 requir... | Python | 1 |
and::random::<u128>();
let config = argon2::Config::default();
let password_hash =
argon2::hash_encoded(user_spec.password.as_bytes(), &salt.to_be_bytes(), &config).unwrap();
let result = db.query(
"INSERT INTO identity VALUES (default, $1, $2) RETURNING id",
&[&user_spec.email, &p... | Rust | 0 |
#!/usr/bin/env python3
"""
Command-line tool to validate a JSON input against a JSON schema.
"""
import argparse
import json
import sys
from llm_structured_output.json_schema_acceptor import JsonSchemaAcceptorDriver
from llm_structured_output.util.output import debug
def main(): # pylint: disable=missing-function-... | Python | 1 |
e = F.expand_dims(e, axis=0) # 1,D,T
for conv_layer in self.layer_name:
e = self.act(getattr(self, conv_layer)(e))
e = F.transpose(e, axes=(0, 2, 1))[0] # return B, T, D, then [0] = T,D
e = F.dropout(e, self.dropout_ratio)
out_es.append(e)
... | Python | 1 |
winreg, EnumKey),
"EnumValue" => named_function!(ctx, winreg, EnumValue),
"CloseKey" => named_function!(ctx, winreg, CloseKey),
});
macro_rules! add_constants {
(hkey, $($name:ident),*$(,)?) => {
extend_module!(vm, module, {
$((stringify!($name)) => ctx.new_i... | Rust | 0 |
.execute(&connection)?;
/// let names = users.select(name).load::<String>(&connection)?;
/// let distinct_names = users.select(name).distinct().load::<String>(&connection)?;
///
/// assert_eq!(vec!["Sean"; 3], names);
/// assert_eq!(vec!["Sean"; 1], distinct_names);
/// # Ok(())
/// # }
... | Rust | 0 |
wrap();
#[cfg(target_arch = "x86_64")]
if let Some(ref path) = screenshot_path {
let pixels = Screen::read_color(&context, frame_input.viewport).unwrap();
Saver::save_pixels(path, &pixels, frame_input.viewport.width, frame_input.viewport.height).unwrap();
... | Rust | 0 |
407
| Self::Stm32F410
| Self::Stm32F411
| Self::Stm32F412
| Self::Stm32F413
| Self::Stm32F427
| Self::Stm32F429
| Self::Stm32F446
| Self::Stm32F469
| Self::Stm32L4X1
| Self::Stm32L4X2
| Se... | Rust | 0 |
'''
A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.
A sentence can be shuffled by appending the 1-indexed word position to each word then rearranging the words in the sentence.
For example, the senten... | Python | 1 |
ing,
error_message: Option<String>,
contacts_list_state: WindowedListState,
confirmation_dialog: Option<ConfirmationDialogType>,
}
impl ContactsTab {
pub fn new() -> Self {
Self {
edit_contact_mode: ContactInputMode::None,
show_edit_contact: false,
alias_fiel... | Rust | 0 |
from openai import Client as OpenAIClient
from selenium.webdriver.common.by import By
from seleniumbase import SB
def web_to_markdown(client: OpenAIClient, model: str, url: str):
with SB(uc=True, incognito=True) as sb:
sb.get(url)
elem = sb.find_element(By.TAG_NAME, "body")
text = elem.text
resp = clie... | Python | 1 |
from airflow import DAG
from airflow.sensors.python import PythonSensor
from datetime import datetime
import os
import boto3
import botocore
BUCKET = os.getenv("BRONZE_BUCKET", "bronze")
MARKER_KEY = os.getenv("GE_MARKER_KEY", "ge/checkpoints/last_success.marker")
S3_ENDPOINT = os.getenv("S3_ENDPOINT")
AWS_ACCESS_KEY_... | Python | 1 |
}
// Dump the machine's memory.
pub fn dump(&self) -> &[isize] { &self.mem }
pub fn get_bp(&self) -> isize { self.bp }
pub fn get_ip(&self) -> isize { self.ip }
pub fn read_mem(&self, address: isize) -> isize {
let address = usize::try_from(address).expect("Negtaive address");
... | Rust | 0 |
an owned vector to a Buf
pub fn vec_to_uv_buf(v: ~[u8]) -> Buf {
#[fixed_stack_segment]; #[inline(never)];
unsafe {
let data = malloc(v.len() as size_t) as *u8;
assert!(data.is_not_null());
do v.as_imm_buf |b, l| {
let data = data as *mut u8;
ptr::copy_memory(da... | Rust | 0 |
g) => {
assert!(!g.is_one());
h = g;
continue 'newh;
}
Ok(res) => res,
},
None => Some(id.clone()),
... | Rust | 0 |
W](def::W) writer structure"]
impl crate::Writable for DEF {}
#[doc = "Default character. Character clocked out in case of an ignored transaction."]
pub mod def;
#[doc = "Over-read character\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Re... | Rust | 0 |
}
/// 提取翻译内容。
pub fn dst_owned(self) -> Result<Vec<String>, ResponseError> {
match self.res {
ResponseInner::Ok { res, .. } => Ok(res.into_iter().map(|x| x.into()).collect()),
ResponseInner::Err { error, .. } => Err(error),
}
}
/// 翻译内容是否为 `str` 类型。无翻译内容或出错时... | Rust | 0 |
\[detail\]](https://developers.line.biz/en/reference/messaging-api/#get-room-member-user-ids)
/// ```
/// let res: Result<Response, Error> = bot.get_room_member_ids("Room ID");
/// ```
pub fn get_room_member_ids(&self, room_id: &str) -> Result<Response, Error> {
let endpoint = format!("/room/{ro... | Rust | 0 |
t b = self.b[index - 1];
coeff.multiply(&mut b);
self.pos_coeffs[y_index - 1].add_assign(&b);
},
Variable::C(index) => {
let mut c = self.c[index - 1];
coeff.multiply(&mut c);
self.pos_coeffs[y_index - 1].add_assig... | Rust | 0 |
see LICENSE).
#![deny(warnings)]
// Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to include inner attributes from a common source.
#![deny(
clippy::all,
clippy::default_trait_access,
clippy::expl_... | Rust | 0 |
return {"verification_report": result["verification_report"]}
def _decide_next_step(self, state: AgentState) -> str:
verification_report = state["verification_report"]
print(f"[DEBUG] _decide_next_step with verification_report='{verification_report}'")
if "Supported: NO" in verific... | Python | 1 |
Block, LocalSet>,
}
pub fn liveness_of_locals<'tcx>(mir: &Mir<'tcx>) -> LivenessResult {
let locals = mir.local_decls.len();
let def_use: IndexVec<_, _> = mir.basic_blocks().iter().map(|b| {
block(b, locals)
}).collect();
let copy = |from: &IndexVec<BasicBlock, LocalSet>, to: &mut IndexVec<Bas... | Rust | 0 |
self {
NTW_ADR3_SZR::_0 => 0,
NTW_ADR3_SZR::_1 => 1,
NTW_ADR3_SZR::_2 => 2,
NTW_ADR3_SZR::_3 => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> NTW_ADR3_SZR {
match value {
0 => NTW_ADR3_SZR... | Rust | 0 |
this early because otherwise run() will cause a mutex lock
std::mem::drop(e);
// get things going!
Executor::run();
}
fn run() {
// get our task from global state
let e = get_executor().lock().unwrap();
if let Some(task) = &e.task {
let mut future_slo... | Rust | 0 |
info = ARB_BASE_ASSET.load(deps.storage)?;
// Ensure the caller is the vault
if msg_info.sender != state.vault_address {
return Err(StableArbError::Unauthorized {});
}
// Set vars
let pool_address = POOLS.load(deps.storage, &details.pool_name)?;
let denom = deposit_info.get_denom()?;
... | Rust | 0 |
from datetime import datetime
from pathlib import Path
import re
from typing import Annotated, Any, Literal
from pydantic import (
BaseModel,
Field,
StringConstraints,
model_validator,
)
Percentage = Annotated[str, StringConstraints(pattern=r"^\d+%$")]
EMAIL_PATTERN = re.compile(r"^([^@]+)@([^.]+(?:\.... | Python | 1 |
}
Ok(())
}
fn draw(&mut self, ctx: &mut Context) -> GameResult {
graphics::clear(ctx, [0.1, 0.2, 0.3, 1.0].into());
// Draw an image.
let dst = glam::Vec2::new(20.0, 20.0);
graphics::draw(ctx, &self.image1, (dst,))?;
// Draw an image with some options,... | Rust | 0 |
8G8_SSCALED [(1, 1)] [Some(2)] [float=2] {[i8; 2]},
R8G8Uint => FORMAT_R8G8_UINT [(1, 1)] [Some(2)] [uint=2] {[u8; 2]},
R8G8Sint => FORMAT_R8G8_SINT [(1, 1)] [Some(2)] [sint=2] {[i8; 2]},
R8G8Srgb => FORMAT_R8G8_SRGB [(1, 1)] [Some(2)] [float=2] {[u8; 2]},
R8G8B8Unorm => FORMAT_R8G8B8_UNORM [(1, 1)] [So... | Rust | 0 |
anned! {span =>
mod queries {
use super::components::*;
use super::uniques::*;
use rl_ecs::stores::{StoreExBasic, StoreExBasicMut,
StoreExCreate,StoreExGetParent,StoreExSetParent,
StoreExGetChild, StoreExPurge};
#(#component_import... | Rust | 0 |
o:
# Simular ranking inicial
nuevo_ranking = {
"keyword": keyword_nueva,
"url": url_objetivo,
"posicion_actual": random.randint(15, 35),
"posicion_anterior": random.randint(20, 40),
... | Python | 1 |
send and receive buffer queues,
* handle on protocol and pointer to protocol
* private data and error information.
*/
/*-
* Locking key to struct socket:
* (a) constant after allocation, no locking required.
* (b) locked by SOCK_LOCK(so).
* (c) locked by SOCKBUF_LOCK(&so->so_rcv).
* (d) locked by SOCKBUF_LOCK(... | Rust | 0 |
so_locked: libc::c_int,
);
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2012, by <NAME>. All rights reserved.
* Copyright (c) 2008-2012, by <NAME>. All rights reserved.
*
* Redistribut... | Rust | 0 |
import pymoo.gradient.toolbox as anp
import numpy as np
from pymoo.core.problem import Problem
from pymoo.util.remote import Remote
class Carside(Problem):
def __init__(self):
super().__init__(n_var=7, n_obj=3, n_ieq_constr=10, vtype=float)
self.xl = np.array([0.5, 0.45, 0.5, 0.5, 0.875, 0.4, 0.4... | Python | 1 |
:WriteLocation>);
fn get_read_location_for_manifest(&self, ctx: ::grpcio::RpcContext, req: super::server::ManifestRef, sink: ::grpcio::UnarySink<super::server::ManifestReadLocation>);
fn verify_manifest(&self, ctx: ::grpcio::RpcContext, req: super::server::ManifestRef, sink: ::grpcio::UnarySink<super::server::V... | Rust | 0 |
import sys, pdb
import numpy as np
import theano
import theano.tensor as T
feat_n = 2
k = T.iscalar('k')
x = T.tensor4('x')
ind = T.argsort(x, axis = 3)
sorted_ind = T.sort(ind[:,:,:, -k:], axis = 3)
dim0, dim1, dim2, dim3 = sorted_ind.shape
indices_dim0 = T.arange(dim0).repeat(dim1 * dim2 * dim3)
indices_dim1 = ... | Python | 1 |
pub type StopVec = SmallVec<[Stop; 4]>;
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Extend {
Pad,
Repeat,
Reflect,
}
#[derive(Clone, Debug)]
pub struct LinearGradient {
pub start: Point,
pub end: Point,
pub stops: StopVec,
pub extend: Extend,
}
#[derive(Clone, Debug)]
pub struct Rad... | Rust | 0 |
:into_raw(Box::new(sk)) as *mut RelaySecretKey,
public_key: Box::into_raw(Box::new(pk)) as *mut RelayPublicKey,
})
}
}
ffi_fn! {
/// Randomly generates an relay id
unsafe fn relay_generate_relay_id() -> Result<RelayUuid> {
let relay_id = generate_relay_id();
Ok(RelayUuid... | Rust | 0 |
// `BAZ` is rather arbitrary here, maybe different name would be better
static BAZ : $prop_name = {
$prop_name {
$(
$field : $value ,
)*
}
};
& BAZ
}};
(
// A single *const* prop value
@Branch
mod(lazy) $prop_name:path {
$(
$field:ident : $value:expr
),* $(,)?
}
) => {{
... | Rust | 0 |
import unittest
from random import choice
from mounts.timetable import (
get_timetable_by_group_id,
get_courses_by_branch_id
)
from mounts.teachers import get_teachers_by_branch_id, get_teacher_week_by_id
from mounts.branches import get_all_branches
class TimetableITest(unittest.IsolatedAsyncioTestCase):
... | Python | 1 |
);
} else if data.pressed_key == Some(bl::VirtualKeyCode::Up) {
levels.cursor_decrement();
}
GameStateEvent::None
}
} else {
data.print(Pos::new(2, 2), "No levels loaded. Subscribe to levels on Steam workshop, and they w... | Rust | 0 |
"""
Factories for schedules tests
"""
import factory
import pytz
from openedx.core.djangoapps.schedules import models
from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory
class ScheduleExperienceFactory(fact... | Python | 1 |
F,// 31 = "rol"
0x06,// 0x6 = ShowNoMemSize_ForceSize, ShowMinMemSize_ForceSize
// Rol_rm32_imm8
0x00,// Previous
// Rol_rm64_imm8
0x00,// Previous
// Ror_rm16_imm8
0x02,// Normal_2
0x20,// 32 = "ror"
0x06,// 0x6 = ShowNoMemSize_ForceSize, ShowMinMemSize_ForceSize
// Ror_rm32_imm8
0x00,// Previous
// R... | Rust | 0 |
, and incorporates all the user-provided information appropriately.
"""
readme = self.model_client.get_answer(prompt)
self.console.print("[green]✔ README content generated.[/green]")
# Clean the generated content more carefully
readme = readme.strip()
# Rem... | Python | 1 |
butes_for_opsets = {
'opset1': [
('axes', lambda node: ','.join(map(str, node.axes))),
('antialias', lambda node: bool_to_str(node, 'antialias')),
('align_corners', lambda node: bool_to_str(node, 'align_corners')),
'mode', 'pads_begin', 'pads_e... | Python | 1 |
tructs
let mut flash = dp.FLASH.constrain();
let mut rcc = dp.RCC.constrain();
// Freeze the configuration of all the clocks in the system and store the frozen frequencies in
// `clocks`
let clocks = rcc.cfgr.freeze(&mut flash.acr);
// Acquire the GPIOB peripheral
let mut gpiob = dp.GPIOB.... | Rust | 0 |
alculates and returns the sum of mean average precisions (mAPs) for both box and mask metrics for `nc`
classes.
"""
return self.metric_box.get_maps(nc) + self.metric_mask.get_maps(nc)
@property
def ap_class_index(self):
"""Returns the class index for average precision, shared by... | Python | 1 |
# Copyright 2009-2011 Ram Rachum.
# This program is distributed under the LGPL2.1 license.
'''
Defines the `StepProfileContextMenu` class.
See its documentation for more details.
'''
import wx
from garlicsim_wx.general_misc import cute_menu
class StepProfileContextMenu(cute_menu.CuteMenu):
'''Context menu for ... | Python | 1 |
pub fn db(&self) -> Db {
Reaper::get()
.medium_reaper()
.slider2db(VolumeSliderValue::new(self.soft_normalized_value * 1000.0))
}
}
impl fmt::Display for Volume {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let vol_string = Reaper::get()
.medium_re... | Rust | 0 |
IO(e)
}
}
impl std::error::Error for Error {
fn cause(&self) -> Option<&dyn std::error::Error> {
match *self {
Error::IO(ref e) => Some(e),
_ => None,
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Err... | Rust | 0 |
#!/usr/bin/env python
import os
import subprocess
from time import sleep
import torch
import torch.distributed as dist
def _setup_dist_env_from_slurm(args):
while not os.environ.get("MASTER_ADDR", ""):
os.environ["MASTER_ADDR"] = (
subprocess.check_output(
"sinfo -Nh -n %s | ... | Python | 1 |
"""Tests for the PoolSense integration."""
| Python | 1 |
#!/usr/bin/env python3
"""
Workspace Manager CLI
Command-line interface for managing multi-repository workspaces and
intelligent repository configurations.
Usage Examples:
# Analyze a single repository
python workspace_manager.py analyze /path/to/repo
# Create a multi-repository workspace
python... | Python | 1 |
# Statements data are the slowest to come up. Thus this module us executed
# last.
import pytest
pytestmark = pytest.mark.slowstatements
def test_wait_for_data(browser, ensure_statements_data, ui_sudo):
tds = browser.select_all(".main table tr td.database")
databases = sorted([td.text for td in tds])
as... | Python | 1 |
from selenium.webdriver import Firefox
from ..config.typings import SEDDUboSettings
def ubo_set_user_settings(browser: Firefox, settings: SEDDUboSettings) -> None:
# using vAPI 'userSettings' message to set uBO's user settings
# see: https://github.com/gorhill/uBlock/blob/master/src/js/settings.js#L215
fo... | Python | 1 |
input_ptr: *const u8,
input_len: u32,
result_ptr: *mut u8,
result_len: u32,
) -> i32;
/// Delegate call.
/// Corresponds to "CALLCODE" opcode in EVM
pub fn dcall(
gas: i64,
address: *const u8,
input_ptr:... | Rust | 0 |
trait definition.
///
/// By default this is equal to the `module_path!` at the ink! trait definition site.
/// It can be customized by the ink! trait definition author using `#[ink(namespace = N)]`
/// ink! attribute.
namespace: Option<&'a syn::LitStr>,
/// The Rust identifier of the ink! trai... | Rust | 0 |
::from_secret_key(&SECP256K1_ENGINE, &secret_key.0) {
Ok(key) => Ok(PublicKey(key)),
Err(err) => Err(BitError::Secp256k1(err))
}
}
pub fn bytes_uncompressed(&self) -> Vec<u8>
{
Vec::from(self.0.serialize_vec(&SECP256K1_ENGINE, false).as_slice())
}
pub fn byt... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.