text string | label_name string | labels int64 |
|---|---|---|
f(it.key(), it.value())?;
if !r || !it.next() {
break;
}
}
it.status().map_err(From::from)
}
pub struct StdIterator<'a, I: Iterator>(&'a mut I);
pub type Kv = (Vec<u8>, Vec<u8>);
impl<'a, I: Iterator> std::iter::Iterator for StdIterator<'a, I> {
type Item = Kv;
fn next(... | Rust | 0 |
class ErrorBlinkStyle(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies constants indicating when the error icon,supplied by an System.Windows.Forms.ErrorProvider,should blink to alert the user that an error has occurred.
enum ErrorBlinkStyle,values: AlwaysBlink (1),BlinkIfDifferentError (0),NeverBlink ... | Python | 1 |
region
let mut region = Region::new();
region.mut_peers().push(Peer::new());
let store = new_peer_storage(engine.clone(), ®ion);
let snap = RegionSnapshot::new(&store);
let mut iter = Cursor::new(snap.iter(None, true), ScanMode::Mixed);
assert!(!iter.reverse_seek(&Key:... | Rust | 0 |
def test_consumer_registry():
from apitally.client.consumers import Consumer, ConsumerRegistry
consumer_registry = ConsumerRegistry()
consumer_registry.add_or_update_consumer(None)
assert len(consumer_registry.consumers) == 0
consumer_registry.add_or_update_consumer(Consumer("test"))
assert le... | Python | 1 |
eq!(r1x4.shrink([1, 0]), r1x4);
assert_eq!(r1x4.shrink([10, 0]), r1x4);
assert_eq!(r4x4.shrink([1, 1]), f(1, 1, 2, 2));
assert_eq!(r4x4.shrink([2, 2]), f(1, 1, 1, 1));
assert_eq!(r4x4.shrink([3, 3]), f(1, 1, 1, 1));
assert_eq!(r4x4.shrink([1, 0]), f(1, 0, 2, 3));
assert... | Rust | 0 |
import base64
import io
import numpy as np
import PIL.ExifTags
import PIL.Image
import PIL.ImageOps
def img_b64_to_arr(img_b64):
f = io.BytesIO()
f.write(base64.b64decode(img_b64))
img_arr = np.array(PIL.Image.open(f))
return img_arr
def img_arr_to_b64(img_arr):
img_pil = PIL.Image.fromarray(im... | Python | 1 |
request = match request.json(&self.fields) {
Ok(request) => request,
Err(source) => return ResponseFuture::error(source),
};
if let Some(reason) = &self.reason {
let header = match request::audit_header(reason) {
Ok(header) => header,
... | Rust | 0 |
ut_alignment]
run_command(muscle_cmd)
print(f"Alineamiento guardado en '{output_alignment}'\n")
def build_and_visualize_tree(aligned_fasta: str):
print(f"--- PASO 4: Construyendo y visualizando el árbol ---")
try:
if os.path.getsize(aligned_fasta) > 0:
aln = AlignIO.read(aligned_fas... | Python | 1 |
}
#[doc = "Bit 27"]
#[inline]
pub fn wbo(&mut self) -> _WBOW {
_WBOW { w: self }
}
#[doc = "Bits 28:29"]
#[inline]
pub fn byto(&mut self) -> _BYTOW {
_BYTOW { w: self }
}
}
<gh_stars>0
use crate::prelude::*;
use azure_core::prelude::*;
use azure_core::{Request as Ht... | Rust | 0 |
'''
Small explanation of how APIs work:
Communication happens between two hosts, a server and a client.
The client sends a request to the server, which then responds to it.
It is kind of like ordering food in a restaurant where you (client) place an order (request) and the waiter (server) brings you food (response.... | Python | 1 |
item: ITEM) {
unsafe {
let name = super::ll::item_name(item) as *mut i8;
if name.is_null() == false {
let _ = CString::from_raw(name);
}
let desc = super::ll::item_description(item) as *mut i8;
if desc.is_null() == false {
let _ = CString::from_raw(des... | Rust | 0 |
language governing permissions and
limitations under the License.
*/
use crate::proc_refactoring::abstract_proc::AbstractPrioritiesConf;
pub struct CanonizationPriorities {
pub simpl : i32,
pub flush : i32,
pub invert : i32,
pub deduplicate : i32,
pub factorize : i32,
pub defactorize : i32
}... | Rust | 0 |
save_string_HKCU(prefix + name + "\\DefaultIcon", "", icon_path + ", 0")
sub_key = prefix + name + "\\shell\\open\\command"
save_string_HKCU(sub_key, "", "\"" + executable_path + "\" \"%1\"")
save_string_HKCU(prefix + name, "Content Type", content_type)
if is_protocol:
save_string_HKCU(prefi... | Python | 1 |
#! /usr/bin/env python
# See README.txt for information and build instructions.
import addressbook_pb2
import sys
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
# This function fills in a Person message based on user input.
def PromptForAddress(person):
person.id = int(raw... | Python | 1 |
# Copyright (c) 2021 PaddlePaddle Authors. 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 appli... | Python | 1 |
}
}
fn parse_buffer(&mut self) {
let mut buf_slice: &[u8] = &self.buf;
while !buf_slice.is_empty() {
// Special treatment for 127 (backspace, 0x1B) and 13 ('\r', 0xD)
let fst = buf_slice[0];
let parse_fn = if (fst < 32 && fst != 13) || fst == 127 {
... | Rust | 0 |
Err(e) => {
eprintln!(
"SC> mprotect({:#?}, {}, {}, …) = EINVAL ({:#?})",
addr, len, prot, e
);
return Err(EINVAL);
}
}
}
flush_all();
eprintln!("SC> mpro... | Rust | 0 |
Blend,
pub blend_op: BlendOp,
pub src_blend_alpha: Blend,
pub dest_blend_alpha: Blend,
pub blend_op_alpha: BlendOp,
pub logic_op: LogicOp,
pub render_target_write_mask: ColorWriteEnable,
}
impl RenderTargetBlendDesc {
#[inline]
pub fn builder() -> RenderTargetBlendDescBuilder {
... | Rust | 0 |
import pytest
from traitlets import HasTraits, TraitError
from traitlets.utils.importstring import import_item
from notebook.traittypes import (
InstanceFromClasses,
TypeFromClasses
)
from notebook.services.contents.largefilemanager import LargeFileManager
class DummyClass:
"""Dummy class for testing Ins... | Python | 1 |
=
"SELECT name FROM string_types;";
pub const GET_NUMBER_TYPES: &'static str =
"SELECT name FROM number_types;";
pub const GET_VOCAB_TYPES: &'static str =
"SELECT name FROM vocab_types;";
pub const GET_STRUCT_TYPES: &'static str =
"SELECT name FROM struct_types;";
... | Rust | 0 |
nch (str, optional): The git branch to check out before running this job
schema_override (str, optional): Override the destination schema in the configured
target for this job.
dbt_version_override (str, optional): Override the version of dbt used to run this job
thre... | Python | 1 |
if is_nonzero {
Some((i, k, total))
} else {
None
}
})
.collect::<Vec<_>>()
});
let mut counts = vec![0usize; rows];
let mut indices = Vec::with_capacity(nnz);
let ... | Rust | 0 |
CTION: u32 = 0;
pub const _GLIBCXX_CPU_DEFINES: u32 = 1;
pub const _GLIBCXX_FAST_MATH: u32 = 0;
pub const _GLIBCXX_USE_FLOAT128: u32 = 1;
pub const _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP: u32 = 1;
pub const _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE: u32 = 1;
pub const _GLIBCXX_HAVE_BUILTIN_LAUNDER: u32 = 1;
pub const _GLIBCXX... | Rust | 0 |
SECURE_BOOT_KEY_REVOKE2_ERR_R::new(((self.bits >> 23) & 0x01) != 0)
}
#[doc = "Bit 22"]
#[inline(always)]
pub fn secure_boot_key_revoke1_err(&self) -> SECURE_BOOT_KEY_REVOKE1_ERR_R {
SECURE_BOOT_KEY_REVOKE1_ERR_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 21"]
#[in... | Rust | 0 |
(rename = "rp_icon", skip_serializing_if = "Option::is_none")]
pub rp_icon: Option<String>,
/// This must be the hostname of the login page.
#[serde(rename = "rp_id", skip_serializing_if = "Option::is_none")]
pub rp_id: Option<String>,
/// This must be the scheme://hostname of the login page.
#[... | Rust | 0 |
(quote!{}, quote!{})
}
})
.unzip();
(
cond_eval,
if_stmt,
else_stmt,
somes
)
}
fn possible_if_let(field_attrs: &[FieldLevelAttrs], idents: &[Ident]) -> (Vec<TokenStream>, Vec<TokenStream>) {
field_attrs
.ite... | Rust | 0 |
# with col1:
# if st.button('Overall Band Score Calculator'):
# print("user switched to overall band score page")
# st.switch_page('pages/overall.py')
... | Python | 1 |
verEntry) -> JsValue;
#[wasm_bindgen(method, getter, js_name = "contentRect")]
pub fn content_rect(this: &ResizeObserverEntry) -> DomRectReadOnly;
// ------ ResizeObserverSize ------
pub type ResizeObserverSize;
#[wasm_bindgen(method, getter, js_name = "blockSize")]
p... | Rust | 0 |
"""Plot a comparison of the speed of ADMET websites."""
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
FIGSIZE = (14, 10)
matplotlib.rcParams["font.size"] = 28
plt.rcParams["font.weight"] = "bold"
plt.rcParams["axes.labelweight"] = "bold"
def plo... | Python | 1 |
aths {
contents: contents.to_owned(),
});
Ok((other, maths_obj))
}
/// Parses as a bold, italic or raw string
fn any_text_modifier(input: &str) -> IResult<&str, Box<dyn KnotsObject>> {
alt((
link,
bold1,
bold2,
italic1,
italic2,
inline_maths,
... | Rust | 0 |
?;
object_333.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_in_app_message_content(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::InAppMessageContent,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
if let Some(var_334) = &i... | Rust | 0 |
er) fn new(
handler_reg: (OpCodeHandlerDecodeFn, &'static OpCodeHandler), handler_mem: (OpCodeHandlerDecodeFn, &'static OpCodeHandler),
handler66_reg: (OpCodeHandlerDecodeFn, &'static OpCodeHandler), handler66_mem: (OpCodeHandlerDecodeFn, &'static OpCodeHandler),
handlerf3_reg: (OpCodeHandlerDecodeFn, &'static Op... | Rust | 0 |
}
#[test]
fn parsing_invalid_sensor_reading_yields_error() {
let response = "";
assert!(SensorReading::parse(response).is_err());
let response = "-x";
assert!(SensorReading::parse(response).is_err());
let response = "-0.5";
assert!(SensorReading::parse(res... | Rust | 0 |
dians*
* `JD_old` : Julian (Ephemeris) day corresponding to the old epoch
* `JD_new` : Julian (Ephemeris) day corresponding to the new epoch
**/
pub fn precess_ecl_coords(old_long: f64,
old_lat: f64,
JD_old: f64,
JD_new: f64) -> (f64, f64)
... | Rust | 0 |
from .common import InfoExtractor
from ..utils import (
clean_html,
format_field,
int_or_none,
strip_or_none,
traverse_obj,
unified_timestamp,
)
class TruthIE(InfoExtractor):
_VALID_URL = r'https?://truthsocial\.com/@[^/]+/posts/(?P<id>\d+)'
_TESTS = [
{
'url': 'htt... | Python | 1 |
_base_ = [
'./_base_/default_runtime.py', './_base_/schedule_3x.py',
'./_base_/dota_rr_ms.py'
]
checkpoint = 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-l_8xb256-rsb-a1-600e_in1k-6a760974.pth' # noqa
angle_version = 'le90'
model = dict(
type='mmdet.RTMDet',
dat... | Python | 1 |
point == "latest_model":
self.log("[INFO] Loading latest checkpoint (model only)...")
self.load_checkpoint(model_only=True)
elif self.use_checkpoint == "best":
if os.path.exists(self.best_path):
self.log("[INFO] Loading best checkpoint ..."... | Python | 1 |
MM_FROUND_TO_ZERO |_MM_FROUND_NO_EXC) // truncate, and suppress exceptions
/// _MM_FROUND_CUR_DIRECTION // use MXCSR.RC; see _MM_SET_ROUNDING_MODE
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=512_mask_fmadd_round_ps&expand=2566)
#[inline]
#[target_feature(... | Rust | 0 |
names[args.s][0].upper()+names[args.t][0].upper())
args.name = names[args.s][0].upper() + names[args.t][0].upper()
label, output_srconly = test_target_srconly(args)
score_srconly += output_srconly
_, output = test_target(args)
score += output
_, predict = torch.max(score_... | Python | 1 |
ame:
extra_files_path_name = primary_data.dataset.extra_files_path_name_from(object_store)
assert extra_files_path_name
persist_extra_files_for_dataset(object_store, src_extra_files_path, primary_data.dataset, extra_files_path_name)
def persist_extra_files_for_dataset(
object_store: Ob... | Python | 1 |
turn {
"appointment_id": getattr(a, "appointment_id", None),
"patient_id": getattr(a, "patient_id", None),
"doctor_id": getattr(a, "doctor_id", None),
"scheduled_at": getattr(a, "appointment_date", None),
"status": getattr(a, "status", None... | Python | 1 |
lateral(vault.vault_id.clone()).await {
let actual_collateral = raw_value_as_currency(actual_collateral, vault.vault_id.collateral_currency());
vault.metrics.locked_collateral.set(actual_collateral);
}
}
pub async fn publish_required_collateral<B: BitcoinCoreApi + Clone + Send + Sync, P: VaultRegis... | Rust | 0 |
1,
Destination {
target: blk_ret0.hdr.clone(),
args: vec![],
},
),
(
2,
Destination {
target: blk_ret1.hdr.clone(),
... | Rust | 0 |
import subprocess
from .log import LOG
def reduce_playback_volume():
LOG.info("REDUCING SPOTIFY VOLUME")
subprocess.run(
[
"osascript",
"-e",
(
'tell application "Spotify" to set sound volume to'
'(sound volume of application "Spotify... | Python | 1 |
from llmebench.datasets import SpamDataset
from llmebench.models import OpenAIModel
from llmebench.tasks import SpamTask
def metadata():
return {
"author": "Mohamed Bayan Kmainasi, Rakif Khan, Ali Ezzat Shahroor, Boushra Bendou, Maram Hasanain, and Firoj Alam",
"affiliation": "Arabic Language Tech... | Python | 1 |
from .. import Provider as BaseProvider
class Provider(BaseProvider):
"""
A Faker provider for the Danish VAT IDs
"""
vat_id_formats = ("DK########",)
def vat_id(self) -> str:
"""
Returns a random generated Danish Tax ID
"""
return self.bothify(self.random_elemen... | Python | 1 |
cessor: an alias for `Reg<HAINTMSK_SPEC>`"]
pub type HAINTMSK = crate::Reg<haintmsk::HAINTMSK_SPEC>;
#[doc = "OTG_HS host all channels interrupt mask register"]
pub mod haintmsk;
#[doc = "HPRT register accessor: an alias for `Reg<HPRT_SPEC>`"]
pub type HPRT = crate::Reg<hprt::HPRT_SPEC>;
#[doc = "OTG_HS host port contr... | Rust | 0 |
:
"""Get file extension for format"""
extensions = {
ExportFormat.CSV: ".csv",
ExportFormat.EXCEL: ".xlsx",
ExportFormat.JSON: ".json",
ExportFormat.XML: ".xml",
ExportFormat.PDF: ".pdf",
}
return extensions.get(self, ".txt")
... | Python | 1 |
env_logger;
extern crate indexmap;
extern crate libc;
#[macro_use]
extern crate json;
#[macro_use]
extern crate log;
extern crate regex;
extern crate rustc;
extern crate rustc_codegen_utils;
extern crate rustc_data_structures;
extern crate rustc_driver;
extern crate rustc_errors;
extern crate rustc_incremental;
extern ... | Rust | 0 |
use rdkafka::consumer::{BaseConsumer, Consumer};
use rdkafka::error::KafkaError;
use rdkafka::producer::FutureProducer;
use rdkafka::ClientConfig;
use snafu::{ResultExt, Snafu};
use tower::limit::ConcurrencyLimit;
use super::config::{KafkaRole, KafkaSinkConfig, QUEUE_MIN_MESSAGES};
use super::request_builder::KafkaReq... | Rust | 0 |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
from allauth.socialaccount.providers.slack.views import SlackOAuth2Adapter
class SlackAccount(ProviderAccount):
def get_avatar_url(self):
return self.account.extra_da... | Python | 1 |
import streamlit as st
import pandas as pd
import time
container=st.container(border=True)
container.write("You can generate tablular data from your text. for these please ensure that you separate each row by a delimeter in your text. The delimeters can be ( . , | ) etc.")
# options for delimeter
row_delimeter=st.sel... | Python | 1 |
okens: Vec<Token>) -> Result<Vec<Stmt>, Vec<ParsingError>> {
let mut parser = Parser {
tokens,
current_index: 0,
};
let mut statements: Vec<Stmt> = Vec::<Stmt>::new();
let mut errors: Vec<ParsingError> = Vec::<ParsingError>::new();
// On each loop, we sc... | Rust | 0 |
_eq!(minfd, 3);
}
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
#[test]
fn test_apply_range() {
macro_rules! check_ok {
($minfd:expr, [$($keep_fds:expr),* $(,)?], [$($calls:expr),* $(,)?] $(,)?) => {{
let mut ranges = [(0, 0); 100];
let mut ... | Rust | 0 |
],
"timestamp[us, Asia/Kathmandu][pyarrow]",
"timestamp[us, tz=Asia/Kathmandu]",
),
],
)
def test_pandas_nullable_without_missing_values(
data: list, dtype: str, expected_dtype: str
) -> None:
# https://github.com/pandas-dev/pandas/issues/57643
pa = pytest.importorskip("... | Python | 1 |
"""BlackRoad API package."""
| Python | 1 |
import numpy as np
# Define the matrix map of the city
city_map = [
['x', 16, 5, 13, 'x', 'x', 2, 'x', 6, 'x', 'x'],
['x', 'x', 17, 'x', 15, 'x', 10, 'x', 5, 17, 'x'],
['x', 'x', 'x', 'x', 15, 3, 10, 2, 4, 13, 14],
['x', 'x', 'x', 'x', 17, 2, 4, 'x', 1, 4, 5],
[2, 'x', 'x', 2, 6, 17, 'x', 'x', 'x'... | Python | 1 |
extractall(arr, pat, flags: int = 0) -> DataFrame:
regex = re.compile(pat, flags=flags)
# the regex must contain capture groups.
if regex.groups == 0:
raise ValueError("pattern contains no capture groups")
if isinstance(arr, ABCIndex):
arr = arr.to_series().reset_index(drop=True).astype... | Python | 1 |
tion::min_moves(vec![1]));
assert_eq!(0, Solution::min_moves(Vec::<i32>::new()));
assert_eq!(0, Solution::min_moves(vec![1, 1]));
assert_eq!(2, Solution::min_moves(vec![1, 2, 2]));
assert_eq!(1, Solution::min_moves(vec![1, 1, 2]));
}extern crate polish;
use polish::test_case::{TestRunner, TestCase, Tes... | Rust | 0 |
Auto Power Down Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SAPD_A {
#[doc = "0: Auto power down disabled (default)"]
SAPD_0,
#[doc = "1: Auto power down enabled"]
SAPD_1,
}
impl From<SAPD_A> for bool {
#[inline(always)]
fn from(variant: SAPD_A) -> Self {
match varian... | Rust | 0 |
Using the h_template.txt, write the .h file for the new test case
fn write_h_file(filename: &str) {
let template = fs::read_to_string("third_party/ABY_templates/h_template.txt")
.expect("Unable to read file");
let path = format!(
"third_party/ABY/src/examples/{}/common/{}.h",
filename, ... | Rust | 0 |
ted = rescale(fprs_selected) # rescale fpr [0,0.3] -> [0, 1]
pros_mean_selected = pros_mean[idx]
seg_pro_auc = auc(fprs_selected, pros_mean_selected)
_ = seg_pro_obs.update(100.0*seg_pro_auc, epoch)
#
save_results(det_roc_obs, seg_roc_obs, seg_pro_obs, c.model, c.class_n... | Python | 1 |
= []
without_paren_to_target = {}
# Regex to extract multiple choice options from the question
multiple_choices_regex = re.compile(r"\b([A-Z])\.\s+([^\n]*)")
matches = multiple_choices_regex.findall(doc["question"])
# Build regex patterns and mappings for e... | Python | 1 |
F: for<'a, 'b> FnMut<(&'a P::Output, &'b P::Output), Output = Ordering>
+ Clone
+ Send
+ 'static,
P::Output: Send + 'static,
{
combiner_par_sink!(combine::MinBy<P::Output,F>, self, combine::MinBy::new(self.f));
}
}
#[derive(new)]
#[must_use]
pub struct MinByKey<P, F> {
pipe: P,
f: F,
}
impl_par_dis... | Rust | 0 |
+0x2], r3
stxb [r1+0x2], r3
stxdw [r1+0x2], r3");
}
// Test all supported JumpConditional mnemonics.
#[test]
fn test_jump_conditional() {
disasm!("jeq r1, r2, +0x3
jgt r1, r2, +0x3
jge r1, r2, +0x3
jlt r1, r2, +0x3
jle r1, r2, +0x3
jset r1, r2, +0x3
jne r1, r2, +0x3
jsgt r1, r2, +0x3
jsge r1, r2, +0x3
jslt r1, r2,... | Rust | 0 |
ypes::FileDescriptorSet;
use std::path::Path;
pub trait Render {
/// Load any necessary files from the `input_root` directory.
fn load(&mut self, input_root: &Path) -> Result<()>;
/// Reset is called between runs with different input/outputs.
fn reset(&mut self);
/// Do the actual rendering to the ... | Rust | 0 |
as u16)),
}
}
}
}
pub(crate) unsafe fn fd_sync<S: Storage>(fs: &mut FileSystem<S>, fd: UserFd) -> Result<(), Error> {
let fd = fs.get_backing_fd(fd)?;
match fd {
BackingFd::Virtual(vfd) => todo!(),
BackingFd::Wasi(fd) => {
let ret = wasi::wasi_snapshot_previ... | Rust | 0 |
thread_rng();
let mut source = iter::repeat(())
.map(|_| rng.sample(distributions::Standard))
.filter(|w| *w != 0)
.take(200 * 8)
.collect::<Vec<u8>>();
let source2 = iter::repeat(())
.map(|_| rng.sample(distributions::Standard))
.filter(|w| *w != 0)
.take(200 * 8)
... | Rust | 0 |
nt, monkeypatch):
# Monkeypatch add_appointment so it raises a ConnectionRejectedError (gRPC UNAVAILABLE)
e_code = grpc.StatusCode.UNAVAILABLE
monkeypatch.setattr(api.stub, "add_appointment", raise_grpc_error)
monkeypatch.setattr(rpc_error, "code", lambda: e_code)
monkeypatch.setattr(rpc_error, "det... | Python | 1 |
def clear_weight(self):
assert self.agg_type == "w_avg"
self.agg_weight = None
def output_shape(self, input_shape):
"""
Function to compute output shape from inputs to this module.
Args:
input_shape (iterable of int): shape of input. Does not include batc... | Python | 1 |
ve(0, 21, 4) |x| {
assert!(x <= 21);
if x == 21 { saw21 = true; }
true
};
assert!(!saw21);
// range_step_inclusive will never pass stop element, but may visit it.
let mut saw21 = false;
do uint::range_step_inclusive(0, 21, 3) |x| {
assert!(x <= 21);
printfln!... | Rust | 0 |
Command::DO_STDIN { switches } => {
let stdin = io::stdin();
let lines: Vec<String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
(lines, switches, String::from("stdin"))
},
com::Command::DO_FILE { switches, file: path } => {
let file = File::open(... | Rust | 0 |
data_sequence_train,
labels_sequence_train,
n_states=self.n_states,
n_gmm_components=self.n_gmm_components,
architecture=self.architecture,
name=self.name + "-untrained",
)
# make copy from untrained model, as pomegranate will just update... | Python | 1 |
# Copyright 2018 Akretion (http://www.akretion.com).
# Copyright 2018 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2020 Camptocamp SA (http://www.camptocamp.com)
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Simone Orsi <simahawk@gmail.com>
# @author Iván Todorovich <ivan.todorovich@gmail.com>
# Lic... | Python | 1 |
_id = *world.read_resource::<AssetId>();
let (mut asset_loading_resources, mut sprites_definition_loading_resources) =
world.system_data::<AssetPartLoaderSystemData<'_>>();
AssetSpritesDefinitionLoader::process(
&mut asset_loading_resources,
... | Rust | 0 |
mut game = Game::new_from_table(Box::new(mock_table));
let mut field_info = game.get_field_info(row_1, col_1).unwrap();
assert_eq!(expected_field_info_1, field_info);
let _ = game.open(row_1, col_1);
field_info = game.get_field_info(row_2, col_2).unwrap();
assert_eq!(expected... | Rust | 0 |
CK = 1,
DIAMOND = 2,
DIAMOND_SWORD = 3,
CREEPER = 4,
PIG = 5,
TNT = 6,
COOKIE = 7,
HEART = 8,
BED = 9,
CAKE = 10,
SIGN = 11,
RAIL = 12,
CRAFTING_BENCH = 13,
REDSTONE = 14,
FIRE = 15,
COBWEB = 16,
CHEST = 17,
FURNACE = 18,
BOOK = 19,
STONE_BLOCK... | Rust | 0 |
}
)
}
check_types_match!(
"deadpool_postgres",
deadpool_postgres,
deadpool_postgres::Pool,
deadpool_postgres::ClientWrapper,
);
check_types_match!(
"deadpool_redis",
deadpool_redis,
deadpool_redis::Pool,
deadpool_redis::Connection,
);
check_types_match!(
"sqlx_postgres",
s... | Rust | 0 |
from dotenv import load_dotenv
import base64
import streamlit as st
import os
import io
from PIL import Image
import pdf2image
import google.generativeai as genai
# Load environment variables
load_dotenv()
genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) # Ensure your API key is properly configured
# Function to... | Python | 1 |
n(out_question_filename, "w") as g:
for line in sentence_lines:
f.write(line)
for line in question_lines:
g.write(line)
if __name__ == "__main__":
squad_train_filename = "train-v2.0.json"
squad_dev_filename = "dev-v2.0.json"
newsqa_filename = "combined-newsqa-data-v... | Python | 1 |
mediary item: append to chorus (in reverse - e.g. prepend)
if index % 2 == 0 {
// even items get a new line at the end
chorus.push_str(&format!("{} {},\n", counts[index], gifts[index]));
}
else {
// odd items are... | Rust | 0 |
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'nuscenes_infos_train_4d_interval3_max60.pkl',
pipeline=train_pipeline,
classes=class_names,
test_mode=False,
use_valid_flag=True,
modality=input_modality,
... | Python | 1 |
#!/usr/bin/env python
from skidl.pyspice import (
Part,
generate_netlist,
gnd,
node,
no_files,
)
import numpy as np
no_files()
ref_impedance = 50
num_nodes = int(1e3)
delay_t = 1e-11
end_t = 17 * delay_t
step_time = 1e-12
vpos_val = 5
pulse_vals = []
sine_per = delay_t * 4
sine_freq = 2 * np.pi... | Python | 1 |
from collections import deque
def bfs(matrix, start, end):
rows, cols = len(matrix), len(matrix[0])
visited = [[False]*cols for _ in range(rows)]
queue = deque([(start, [start])])
while queue:
(x, y), path = queue.popleft()
if (x, y) == end:
return path
for dx, dy i... | Python | 1 |
ll::new(None));
// Make USB Driver globally available
static USBDEV: Mutex<
RefCell<Option<usb::Usb<USB, (gpioa::PA11<Alternate<AF0>>, gpioa::PA12<Alternate<AF0>>)>>>,
> = Mutex::new(RefCell::new(None));
const DEV_DESC: Device = Device::new()
.iManufacturer(1)
.iProduct(2)
.iSerialNumber(3)
.bNumC... | Rust | 0 |
ntext.rs
use alloc::vec::Vec;
use move_core_types::language_storage::StructTag;
pub const TIMESTAMP_MODULE: &str = "DiemTimestamp";
pub const CURRENT_TIME_MICROSECONDS: &str = "CurrentTimeMicroseconds";
pub const BLOCK_MODULE: &str = "DiemBlock";
pub const BLOCK_METADATA: &str = "BlockMetadata";
#[derive(Debug)]
pub... | Rust | 0 |
fn count(self) -> usize {
self.sharedvec.len() - self.value_idx
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
pub fn test_many() {
let sharedvec = SharedVec::<usize>::new();
let values = (0..1_000)
.map(|value| sharedvec.push(value))
.collect::<Vec<... | Rust | 0 |
# coding: utf-8
"""
WhatsApp Business API
See https://developers.facebook.com/docs/whatsapp
The version of the OpenAPI document: 1.0
Generated by: https://konfigthis.com
"""
from datetime import date, datetime # noqa: F401
import decimal # noqa: F401
import functools # noqa: F401
import io # noq... | Python | 1 |
if path not in docs.relevant:
continue
for rel in docs.relevant[path]:
if rel not in ranking:
self.nobucket += 1
continue
bucket = ranking[rel]
while bucket >= len(self.buckets):
sel... | Python | 1 |
|j t
S )NpbpasterTr r@ r rD r rE decoderG rI r r s r paste_osx_pbcopyz3init_osx_pbcopy_clipboard.<locals>.paste_osx_pbcopy{ sA i-$.OOt
E}}X&&r r )rJ rR s r init_osx_pbcopy_clipboardrS s s ... | Python | 1 |
Folling/exprust<gh_stars>1-10
extern crate nom;
use super::hierarchy::*;
named!(pub comp<&[u8]>,
alt_complete!(
tag!("==") |
tag!("<=") |
tag!(">=") |
tag!("!=") |
tag!("<") |
tag!(">") |
tag!("=")
)
);
named!(pub eval<bool>, map!(
ws!(tuple!(expr... | Rust | 0 |
> c_int {
libc::syscall(libc::SYS_memfd_create, name, flags) as c_int
}
#[cfg(test)]
mod tests {
use std::ffi::CString;
#[test]
fn test_create_shmem() {
super::create_shmem(CString::new("/helloworld").unwrap(), 1024);
}
}
<reponame>Very1Fake/cw_1_app<filename>core/src/views/warehouse_beaut... | Rust | 0 |
fo']['app']
row = self.zoomeye_tab.rowCount() # 获取所有列
self.zoomeye_tab.insertRow(row) # 插入row
item = QTableWidgetItem()
item.setText(ip)
item1 = QTableWidgetItem()
item1.setText(str(port))
... | Python | 1 |
(value, ctx),
);
Ok(op)
}
/// remove a value if ther is one, otherwise add a value so we have an op
fn remove_value(
actor_id: usize,
friend_map: &friends::FriendMap,
) -> crdts::map::Op<String, Orswot<String, usize>, usize> {
let mut rng = thread_rng();
let read_ctx = friend_map.len();
le... | Rust | 0 |
functions; element wasn't known"]
#[doc = " @G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE: error should be set by #GMarkupParser"]
#[doc = " functions; attribute wasn't known"]
#[doc = " @G_MARKUP_ERROR_INVALID_CONTENT: error should be set by #GMarkupParser"]
#[doc = " functions; content was invalid"]
#[doc = " @G_MARKUP_E... | Rust | 0 |
madetected.size()[0]:
j=0
while j < final_madetected.size()[1]:
if final_madetected[i,j][0] != 0:
white=white + 1
#print(final_madetected[i,j][k],i,j,k)
else:
black=black+1
... | Python | 1 |
lightthickness=0)
# Password:
password_label = Label(text='Password', font=(FONT_NAME, 10, 'bold'))
password_label.grid(column=0, row=3)
password_label.config(bg='white', highlightthickness=0)
password_input = Entry(width=24)
password_input.grid(column=1, row=3)
password_input.config(bg='white', highlightthickness=0... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright 2025 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... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 10.13 from Kane 1985."""
from __future__ import division
from sympy import solve, symbols, trigsimp
from sympy.physics.mechanics import Point, ReferenceFrame, RigidBody
from sympy.physics.mechanics import dot, dynamicsymbols, inertia, msprint
from util import i... | Python | 1 |
::StackError> {
self.unary_fn_in_place(|x: &mut <Self as InPlaceFnApplication>::Elem| {
*x = -x.clone();
})
}
/// # Example
///
/// ```
/// use smsflib::prelude::*;
///
/// let mut stack = ClassicStack::<i32>::new(-1, -2, -3, -4);
/// stack.absolute_value();
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.