text string | label_name string | labels int64 |
|---|---|---|
l[None, ...] + t_rel[None,...] @ n_ref.reshape(num_pts,1,3) / d))@torch.linalg.inv(K)
return mat_homography
def warp_patches(idx_patches_xy, homography):
'''Warp patches from reference image to source images
Args:
idx_patches: N*M*M*2, xy index coordinates (numpy array)
homography: N*3*3, f... | Python | 1 |
0x00000002;
pub const DOT11_STATUS_UNSUPPORTED_PRIORITY: NDIS_STATUS = 0x00000004;
pub const DOT11_STATUS_UNSUPPORTED_SERVICE_CLASS: NDIS_STATUS = 0x00000008;
pub const DOT11_STATUS_UNAVAILABLE_PRIORITY: NDIS_STATUS = 0x00000010;
pub const DOT11_STATUS_UNAVAILABLE_SERVICE_CLASS: NDIS_STATUS = 0x00000020;
pub const DOT... | Rust | 0 |
here we show how to use these weights with existing API
def block2symbol(block):
data = mx.sym.Variable("data")
sym = block(data)
args = {}
auxs = {}
for k, v in block.collect_params().items():
args[k] = mx.nd.array(v.data().asnumpy())
return sym, args, auxs
mx_sym, args, auxs = block2... | Python | 1 |
self.recover_stmt();
}
/// Parses `ident (COLON expr)?`.
fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
let attrs = self.parse_outer_attributes()?;
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
let lo = this.token.span;
... | Rust | 0 |
)?,
unexpected => {
return Err(Loc(Error::Unexpected(unexpected), self.pos.last()))
}
};
iri.push(c)
}
Some(c) => {
if matches!(
c,
'\u{00}'..='\u{20}' | '<' | '>' | '"' | '{' | '}' | '|' | '^' | '`' | '\\'
) {
return Err(Loc(Error::Unexpected(Some(c)), ... | Rust | 0 |
G: avifChannelIndex = 1;
pub const AVIF_CHAN_B: avifChannelIndex = 2;
pub const AVIF_CHAN_Y: avifChannelIndex = 0;
pub const AVIF_CHAN_U: avifChannelIndex = 1;
pub const AVIF_CHAN_V: avifChannelIndex = 2;
pub type avifChannelIndex = ::std::os::raw::c_uint;
extern "C" {
pub fn avifVersion() -> *const ::std::os::raw:... | Rust | 0 |
#[test]
fn coordinatesys() {
let conn = init_testing();
use self::coordinate_system_descriptions::columns::{
c1_label, c1_reversed, c1_unit, c2_label, c2_reversed, c2_unit, c3_label, c3_reversed,
c3_unit, id, name, srs_type,
};
use self::coordinate_system_descriptions::dsl::coordinate_... | Rust | 0 |
,
}
impl FancyKeypad {
fn up(&self) -> FancyKeypad {
use FancyKeypad::*;
match *self {
Three => One,
Six => Two,
Seven => Three,
Eight => Four,
A => Six,
B => Seven,
C => Eight,
D => B... | Rust | 0 |
ss, self.fs, a(b, 0), 0.0, BQFParam::Q(0.707));
self.rl2 = BiquadFilter::new(BQFType::LowPass, self.fs, a(b, 1), 0.0, BQFParam::Q(0.707));
self.rl3 = BiquadFilter::new(BQFType::LowPass, self.fs, a(b, 2), 0.0, BQFParam::Q(0.707));
self.rl4 = BiquadFilter::new(BQFType::LowPass, self.fs, a(b, 3), 0... | Rust | 0 |
}
/// Generates a DiskInfo for Windows and unix systems
///
/// Runs system_information/src/cpp/disk to get total,
/// free, and in use space for the C or / filesystems.
pub fn get_disk_info(fs: &str) -> DiskInfo {
let mut path = std::env::current_dir().unwrap();
path.push("src");
path.push("cpp");
pat... | Rust | 0 |
m_size1 is not None:
args.im_size1 = [int(s) for s in args.im_size1.split(',')]
if len(args.im_size1) == 1:
args.im_size1 = args.im_size1[0]
if args.im_size2 is not None:
args.im_size2 = [int(s) for s in args.im_size2.split(',')]
if len(args.im_size2) == 1:
ar... | Python | 1 |
}", n);
Ok(())
}
<reponame>jneem/scribl<filename>widget/src/toggle_button.rs<gh_stars>10-100
use druid::kurbo::Vec2;
use druid::widget::prelude::*;
use druid::widget::LabelText;
use druid::{theme, Data, Insets, Point, RenderContext, Size, WidgetExt, WidgetPod};
use crate::{Icon, Shadow, TooltipExt};
/// A [`Togg... | Rust | 0 |
],
ids=[
"lowercase-true",
"capital-True",
"numeric-1",
"text-yes",
"text-on",
"lowercase-false",
"capital-False",
"numeric-0",
"text-no",
"text-off",
],
)
def test_trace_include_sensitive_data_follows_env_value(env_value, expected,... | Python | 1 |
ch: int) -> None:
"""
Train the VAE for one epoch.
Args:
epoch (int): Current epoch number.
"""
global steps
model.train()
train_loss = 0
for batch_idx, (data, _) in enumerate(train_loader):
data = data.to(device)
optimizer.zero_grad()
recon_batch, q_z = ... | Python | 1 |
: 100.0,
currency: Currency::Euro,
},
),
(
"10 $",
Money {
amount: 10.0,
currency: Currency::Dollar,
},
),
(
"42.4 DOLLAR",
... | Rust | 0 |
{'name': 'F2', 'barcode': '1', 'company_id': company_a.id},
# Forbidden, collides with BC2
{'name': 'F3', 'barcode': '2', 'company_id': company_b.id},
# Forbidden, collides with A1
{'name': 'F4', 'barcode': '3', 'company_id': company_a.id},
# Forbidden, colli... | Python | 1 |
d) // 2, 0)
d_end = min(d_start + dd, d)
# Crop or pad the tensor
tensor = tensor[h_start:h_end, w_start:w_end, d_start:d_end]
pad_h_before = (dh - tensor.size(0)) // 2
pad_h_after = dh - tensor.size(0) - pad_h_before
pad_w_before = (dw - tensor.size(1)) // 2
p... | Python | 1 |
.takes_value(true)
.default_value("./config.yaml")
.help("The path to the configuration file."))
.subcommand(SubCommand::with_name("toot")
.about("Generate a toot and print it in the console.")
.arg(Arg::with_name("post")
... | Rust | 0 |
any(|b| b == '.') {
Err(anyhow!(
"{} does not contain decimal point",
context::string(name, term)
)
.into())
} else {
// Erlang does not track the d... | Rust | 0 |
import cv2
import numpy as np
# Load the dress with alpha channel
dress_path = r'C:\Users\rupin\Downloads\EY Hackathon\tshirt.png'
dress = cv2.imread(dress_path, cv2.IMREAD_UNCHANGED)
# Load Haar cascades for face and upper body
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_de... | Python | 1 |
if p == 0.0:
return tokens
num_tokens = len(tokens)
n = int(math.ceil(num_tokens * p))
noise_indices = torch.randperm(num_tokens + n - 2)[:n] + 1
noise_mask = torch.zeros(size=(num_tokens + n,), dtype=torch.bool)
noise_mask[noise_indices] = 1
result = torch.... | Python | 1 |
,
)
def finalize(self):
"""
Signals that this field's vocab can be built.
"""
super().finalize()
if self._num_of_classes is None:
self.fixed_length = self._num_of_classes = len(self.vocab)
if self.use_vocab and len(self.vocab) > self._num_of_clas... | Python | 1 |
}
Ok(Async::Ready(None))
}
}use crate::*;
/// A WinRT method parameter
pub enum Param<'a, T: RuntimeType> {
Borrowed(&'a T),
Owned(T),
}
impl<'a, T: RuntimeType> Param<'a, T> {
pub fn abi(&mut self) -> T::Abi {
match self {
Param::Borrowed(value) => value.abi(),
... | Rust | 0 |
RG_LOG_LEVEL, ARG_OUTPUT_TYPE};
use current::CurrentCmd;
use flush::FlushCmd;
use huber_common::model::config::Config;
use huber_common::result::Result;
use info::InfoCmd;
use install::InstallCmd;
use repo::RepoCmd;
use reset::ResetCmd;
use search::SearchCmd;
use self_update::SelfUpdateCmd;
use show::ShowCmd;
use simpl... | Rust | 0 |
<li> <p>"JP" - JAPAN</p> </li>
/// <li> <p>"KZ" - KAZAKHSTAN</p> </li>
/// <li> <p>"KR" - KOREA</p> </li>
/// <li> <p>"LV" - LATVIA</p> </li>
/// <li> <p>"LI" - LIECHTENSTEIN</p> </li>
/// <li> <p>"LT" - LITHUANIA</p> </li>
/// <li> <p>"LU" - LUXEMBOURG</p> </li>
/// <li> <p>"MK" - MACEDONI... | Rust | 0 |
0, 1080) # Set window size to 1920x1080 pixels
driver.get('https://www.moontok.io/listings/presales')
while True:
if GetTokenFromPage(driver):
pagination = WebDriverWait(driver, 10).until(
EC.presence_of_all_elements_located((By.CLASS_NAME, 'moontok-1sm... | Python | 1 |
# Use a generator expression to capitalize the strings in a list of strings whose length is at least 5. Use a single print invocation to print all the capitalized strings as a set.
strings = ["four", "score", "and", "seven", "years", "ago"]
capitalized = (string.capitalize() for string in strings if len(string) >= 5)... | Python | 1 |
https://www.zhaopin.com/sou/jt7000700010000?order=4",
"工程招投标": "https://www.zhaopin.com/sou/jt2000100030000?order=4",
"房产销售": "https://www.zhaopin.com/sou/jt19000200040000?order=4",
"房地产销售总监": "https://www.zhaopin.com/sou/jt7000800010000?order=4",
"地产招投标总监": "https://www.zhaopin.com/sou/jt7000800020000?... | Python | 1 |
from typing import List
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
return self.spiral_build(matrix, len(matrix), len(matrix[0]), 0, 0, 'lt')
def spiral_build(self, board: List[List[int]], m_row: int, n_col: int, beg_i, beg_j, corner_st: str = 'lt') \
-> L... | Python | 1 |
()));
}
if self.fit_to_width.has_value() {
attributes.push(("fitToWidth", self.fit_to_width.get_value_string()));
}
if self.horizontal_dpi.has_value() {
attributes.push(("horizontalDpi", self.horizontal_dpi.get_value_string()));
... | Rust | 0 |
param_value,
param_id_str,
param_ptr,
);
}
}
// Make sure everything starts out in sync
if let Some(sample_rate) = sample_rate {
param_ptr.update_smoother(sample_rate, true);
}
}
// The plugin can... | Rust | 0 |
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING:
from ..models.model_get_exchange_announcements_response_announcements_item import (
... | Python | 1 |
"""
This module is responsible for automatic processing of provider callback
data (asynchronous transaction updates).
"""
from django.db.transaction import atomic
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.urls import path
from django.urls import re_path
from django.views... | Python | 1 |
asurement outcome of qubit 0 : %i" % int(m0))
print("[>] measurement outcome of qubit 1 : %i" % int(m1))
# reinitialize the qubits to |00>
print("[+] reinitializing circuit to |00> ...")
qc.run_circuit("init")
# noisy execution of the circuits
print("[+] noisy execution of the circuits...")
for i in range(0,10):
... | Python | 1 |
import ply.lex as lex
tokens = (
'LAMBDA', # Token for the lambda symbol
'DOT', # Token for the dot symbol
'VAR', # Token for variables (a-z)
'NUMBER', # Token for numbers (0-9)
'LPAREN', # Token for left parenthesis
'RPAREN', # Token for right parenthesis
)
# Regular express... | Python | 1 |
# coding: utf-8
# =============================================================================
# Ural Is Homepage Unit Tests
# =============================================================================
from ural import is_homepage
DEFAULT_TESTS = [
("https://www.lemonde.fr/", True),
("https://www.lemonde.f... | Python | 1 |
"Landroid/icu/lang/UCharacter$UnicodeBlock;\0");
env.get_static_object_field(class, field)
}
}
/// public static final [AEGEAN_NUMBERS_ID](https://developer.android.com/reference/android/icu/lang/UCharacter.UnicodeBlock.html#AEGEAN_NUMBERS_ID)
pub const AEGEAN_NUMBE... | Rust | 0 |
epare_chatml_sample(row.to_dict(), tokenizer)
ret.append((input_tokens, label_tokens, audio_contents, speaker_id))
return ret
def prepare_chatml_dataframe(df, tokenizer, num_process=16):
if num_process is None:
return prepare_chatml_dataframe_single_process(df, tokenizer)
else:
num... | Python | 1 |
wheel.step_pin.set_high().unwrap();
}
let mut queue = WHEEL_EVENT_Q.split().0;
queue.enqueue(WheelEvent{ id: wheel.id, dir: wheel.is_dir_pin_high}).ok();
}
if wheel.timeout.0 > (500 * 1000).ns().0 {
... | Rust | 0 |
r=NotifyBlueSky.quote(user, safe=""),
password=self.pprint(
self.password, privacy, mode=PrivacyMode.Secret, safe=""
),
params=NotifyBlueSky.urlencode(params),
)
@staticmethod
def parse_url(url):
"""Parses the URL and returns enough arguments ... | Python | 1 |
after the quit event of the window is called.
fn quit_event(&mut self) {}
/// Gets the current mouse position.
fn mouse_position(&self) -> Point;
/// Is called if active state of the window is changed.
fn active(&mut self, active: bool);
/// Runs the inner logic of the shell adapter.
fn ... | Rust | 0 |
mouse_pos,
delta,
manager
}
}
}
pub struct RenderParams<'a> {
pub gl: &'a WebGlRenderingContext,
pub manager: &'a ContainerManager
}
impl<'a> RenderParams<'a> {
pub fn new(gl: &'a WebGlRenderingContext, manager: &'a ContainerManager) -> RenderParams<'a> {
Ren... | Rust | 0 |
]
//! to acquire an [`EventLoopProxy`][event_loop_proxy] and call its [`send_event`][send_event] method.
//!
//! See the root-level documentation for information on how to create and use an event loop to
//! handle events.
//!
//! [create_proxy]: crate::event_loop::EventLoop::create_proxy
//! [event_loop_proxy]: crate:... | Rust | 0 |
pace('_');
assert !is_whitespace('\u0000');
}
#[test]
fn test_to_digit() {
assert to_digit('0', 10u) == Some(0u);
assert to_digit('1', 2u) == Some(1u);
assert to_digit('2', 3u) == Some(2u);
assert to_digit('9', 10u) == Some(9u);
assert to_digit('a', 16u) == Some(10u);
assert to_digit('A', 1... | Rust | 0 |
import ekeko
from ekeko.backtrader.broker import (
Account,
BrokerBuilder,
Order,
OrderBuilder,
Position,
)
from ekeko.backtrader.engine import BaseStrategy, Engine
from ekeko.backtrader.optimizer import Optimizer
from ekeko.backtrader.screener import TrivialScreener
from ekeko.data_loader import Yf... | Python | 1 |
repo, username }, Some(secret)) => {
format!("https://{}:{}@{}", username, secret, repo)
}
(GitRepo::HttpsPrivate { .. }, None) => {
panic!("No PAT or password provided for private repository.")
}
}
}
}
///////////////////////////////////... | Rust | 0 |
o);
if common.len() >= 12 {
return Some((o, common));
}
}
None
}
fn manhatten_distance(p1: &Pos, p2: &Pos) -> i64 {
let (x, y, z) = sub_pos(p1, p2);
i64::abs(x) + i64::abs(y) + i64::abs(z)
}
fn solve(puzzle: &[Vec<Pos>]) -> (usize, i64) {
let mut fixed_scanners =
... | Rust | 0 |
ng code
draw = ImageDraw.Draw(image)
# draw boxes on the image
image_width, image_height = image.size
if normalized_to_pixel:
bboxes = [
(
int(y * image_height),
int(x * image_width),
int(h * image_height),
int(w * ima... | Python | 1 |