text string | label_name string | labels int64 |
|---|---|---|
pdated_at: match document.get_datetime("updatedAt") {
Ok(updated_at) => Some(Timestamp::from(SystemTime::from(updated_at.to_owned()))),
_ => None,
},
})
}
}
use crate::core::AppCore;
use eframe::egui;
#[derive(Default)]
pub struct AboutPanel {}
impl AboutPanel {... | Rust | 0 |
),
css_class="form-group col-md-4 mb-0",
),
Column(
PrependedText("start_date", '<i class="fas fa-hourglass-start"></i>'),
css_class="for... | Python | 1 |
) -> Result<Option<Entity>> {
unimplemented!()
}
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub(super) struct AssertCollectionNotExists {
collection_name: String,
database_name: String,
}
#[async_trait]
impl TestOperation for AssertCollectionNotExi... | Rust | 0 |
print("github") | Python | 1 |
# Copyright 2023 RT Corporation
#
# 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 writin... | Python | 1 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.timeline import model as timeline_model
from telemetry.timeline import tab_id_importer
from telemetry.timeline import trace_d... | Python | 1 |
}
it "12้ป is not kanji" {
assert_eq!(is_kanji("12้ป"), false);
}
it "้ปใ is not kanji" {
assert_eq!(is_kanji("้ปใ"), false);
}
}
describe! is_japanese {
it "ๆณฃใ่ซ is japanese" {
assert_eq!... | Rust | 0 |
has_one $key:expr, $value:block
$($rest:tt)*
}) => {
expand_resource_impl!(@$scope $($args),+, {
$($rest)*
});
};
(@$scope:tt $($args:ident),+, {
link $key:expr, $value:block
$($rest:tt)*
}) => {
expand_resource_impl!(@$scope $($args),+, ... | Rust | 0 |
'''
Python Routines for COsmology and Data I/O
PyRCODIO Pandas Version
Edoardo Carlesi 2020
ecarlesi83@gmail.com
main_ics_density_plot.py: produce a large number of plots of density and velocities in the ICs
'''
import numpy as np
import read_files as rf
import plot_utils as pu
import config as cf... | Python | 1 |
\
\xbd\xfa\x0d\xeco\xb8\x0dj>)%6[PC\xe1\
\xf0\xfeC(/-o\x93\xc7\xcd\xc2\x9d\xb5\xca\xe8\xda\
\x19\x19];c\xda\xe5\x97`\xd5g\xff\xc1G\xef~\
\x88\x90\x09\xb3k\x1bWo\xc0\x8dw\xded\xb8\x1d\x8a\
NC\x5c=\x91\xa8\xd9\x90d\xd3Q\x15R\xb2\xcc\x99\
\x8d\xddo$c\xe8\x1d\x95\xc0\x19{\x004\x97}\x12\
.T\x1c(\xc2\x06\xbbz\xc0)Z\xdf\xdaU8... | Python | 1 |
allocate with careful consideration to make sure that the physical memory
/// allows the amount of allocation. We highly recommend not using this method. However, we support this to accomodate some VMs that require this
/// behavior. This call does not disable explicit GCs (through handle_user_collection_request()).
//... | Rust | 0 |
from __future__ import annotations
from virtualenv.discovery.py_info import PythonInfo
from virtualenv.discovery.py_spec import PythonSpec
from .pep514 import discover_pythons
# Map of well-known organizations (as per PEP 514 Company Windows Registry key part) versus Python implementation
_IMPLEMENTATION_BY_ORG = {
... | Python | 1 |
! {
/// This is used to manage variable definitions within scopes.
/// When a function is called, a scope is pushed on the scope stack,
/// and all new definitions are contained in the new scope.
/// When the function call finishes, the scope is popped and freed.
pub static ref SCOPE_STACK: Mutex<Ve... | Rust | 0 |
r_panic!(conn.transaction());
or_panic!(trans.execute("INSERT INTO foo (id) VALUES ($1)", &[&1i32]));
trans.set_commit();
assert!(trans.finish().is_ok());
let stmt = or_panic!(conn.prepare("SELECT * FROM foo"));
let result = or_panic!(stmt.query([]));
assert_eq!(vec![1i32], result.map(|row| ro... | Rust | 0 |
}
#[test]
fn insert_into_empty_map() {
let mut range_map: RangeMap<u32, bool> = RangeMap::new();
range_map.insert(0..50, false);
assert_eq!(range_map.to_vec(), vec![(0..50, false)]);
}
#[test]
fn new_same_value_immediately_following_stored() {
let mut range_map... | Rust | 0 |
h_count += 1;
Some(h)
};
(
h_fn(x1i, y1i),
h_fn(x1i, y2i),
h_fn(x2i, y1i),
h_fn(x2i, y2i),
)
};
if h_count == 0 {
return None;
}
let h_avg = h_... | Rust | 0 |
ap();
assert_abs_diff_eq!(
sums,
(array![[
-0.3894, -0.4608, -0.4127, -0.1656, -0.3927, -0.1952, -0.4998, -0.2477, -0.1676
]])
.into_dyn(),
epsilon = 1e-4
);
}
#[test]
fn squeeze_bert_encoder_attention_mask() {
... | Rust | 0 |
esis(0.01)
# act
stack.push(_Hypothesis(0.9)) # greatly superior hypothesis
stack.push(poor_hypothesis)
# assert
self.assertFalse(poor_hypothesis in stack)
def test_best_returns_the_best_hypothesis(self):
# arrange
stack = _Stack(3)
best_hypothesis... | Python | 1 |
::{update_clip, UpdateClip};
<filename>tests/headers/named/mod.rs
mod contact;
mod from;
mod in_reply_to;
mod reply_to;
mod to;
#[allow(dead_code)]
pub enum TestField<'a> {
All,
Field(&'a str),
TableField(&'a str, &'a str),
}
type Bits = Vec<bool>;
fn gen_data(bits: &mut Bits, size: usize) {
//println... | Rust | 0 |
0xF5, 0x16,// EVEX_Vpmovm2d_xmm_kr
0x24,// VK
0x6D,// YMM0
0xF6, 0x16,// EVEX_Vpmovm2d_ymm_kr
0x24,// VK
0x8D,// ZMM0
0xF7, 0x16,// EVEX_Vpmovm2d_zmm_kr
0x09,// VectorLength
0x24,// VK
0x4D,// XMM0
0xF8, 0x16,// EVEX_Vpmovm2q_xmm_kr
0x24,// VK
0x6D,// YMM0
0... | Rust | 0 |
")),
]),
)]);
let cases = [
(func1, res1),
(func2, res2),
(func3, res3),
(func4, res4),
(func5, res5),
(func6, res6),
(func7, res7),
];
for (key, expected_result) in cases {
let ... | Rust | 0 |
bounds(121, 288)
(120.0, 290.0)
>>> get_optimal_bounds(1210, 2880)
(1200.0, 2900.0)
>>> get_optimal_bounds(0.025, 0.11)
(0.0, 0.2)
>>> get_optimal_bounds(0.0025, 0.11)
(0.0, 0.2)
>>> get_optimal_bounds(0.00025, 0.11)
(0.0, 0.2)
"""
low_mag ... | Python | 1 |
art = span.range.col_start.0 as usize;
let col_end = span.range.col_end.0 as usize;
line.get(col_start..col_end).map(|line| line.to_string())
});
debug!("racer_def: name: {:?}", name);
let results = ::std::panic::catch_unwind(move || {
let cache = requests::racer_cache(... | Rust | 0 |
/// Retrieve the number of potential casts.
#[inline]
#[must_use]
pub const fn num_casts(&self) -> i32 {
match *self {
Self::Direction(..) | Self::Target(..) => 1,
Self::Soft(samples, ..) | Self::Radiant(samples) => samples,
}
}
}
impl Display for Caster {
#[... | Rust | 0 |
ionPointer, TrapCode, TrapSite};
use lucet_runtime_internals::module::Module;
use lucet_runtime_internals::vmctx::lucet_vmctx;
use std::sync::Arc;
pub fn mock_traps_module() -> Arc<dyn Module> {
extern "C" fn onetwothree(_vmctx: *mut lucet_vmctx) -> std::os::raw::c_int {
123
}
extern "C" fn hostca... | Rust | 0 |
message_type, &remote_addr).await
{
eprintln!("Could not send message to {}: {}", remote_addr, e);
}
}
}
}
use num::bigint::BigUint;
use num::Zero;
use rand::{thread_rng, Rng};
/// NIST Diffie-Hellman prime
pub const P: [u8; 192] = [
0xff, 0xff, 0xff, 0xff, 0xf... | Rust | 0 |
, match_type = '', factors=None):
files_needed = ['{}.bin'.format(f) for f in ['cameras', 'images', 'points3D']]
if os.path.exists(os.path.join(basedir, 'sparse/0')):
files_had = os.listdir(os.path.join(basedir, 'sparse/0'))
else:
return None, None
# if not all([f in files_had for f... | Python | 1 |
diff_local_body_rot_flat = torch_utils.quat_mul(torch_utils.quat_mul(heading_inv_rot_expand.view(-1, 4), diff_global_body_rot.view(-1, 4)), heading_rot_expand.view(-1, 4)) # Need to be change of basis
##### linear and angular Velocity differences
diff_global_vel = ref_body_vel.view(B, time_steps, J, 3) ... | Python | 1 |
BaseInitFromRawFn:
Fn(BaseInitFromRawArgs<RawData, Mode, Step>) -> BaseInitFromRawOutput + Clone + 'static,
BaseInitFromRawOutput:
Future<Output = BaseInit<Step, Base, Main, Sidebar, Header, Footer, Overlay>>,
{
// extract the things from init args that need to be shared
... | Rust | 0 |
let uri = Uri::from_str(&format!(
"https://{}.{}.amazonaws.com",
self.service,
region.as_ref(),
))?;
Ok(AwsEndpoint {
endpoint: Endpoint::mutable(uri),
signing_region: Some(region.clone().into()),
signing_service: None,
}... | Rust | 0 |
.
/// See its documentation for more details.
///
/// Typically you'll want to build a matrix of this information. However,
/// we keep separate scaling/translation/rotation values to make it
/// easier to process and optimize UV transformations internally.
#[derive(Debug, Clone, Copy)]
type... | Rust | 0 |
elf) -> client::Result<(hyper::Response<hyper::body::Body>, SiteSummaryResponse)> {
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::ToParts;
... | Rust | 0 |
s.fragment().parse::<u64>()
})(input)?;
Ok((i, Literal::IntLiteral(int)))
}
fn float(input: Span) -> nom::IResult<Span, Literal> {
let (i, float) = nom::combinator::map_res(
nom::combinator::recognize(nom::sequence::delimited(
nom::character::complete::digit1,
tag("."),
... | Rust | 0 |
{
let pl = load_plugin_lib("cuckaroo_cpu_avx2_29").unwrap();
let mut params = pl.get_default_params();
params.nthreads = 4;
run_solver(&pl, params);
}
#[ignore]
#[test]
fn sanity_cuckatoo_mean_compat_cpu_31() {
let pl = load_plugin_lib("cuckatoo_mean_cpu_compat_31").unwrap();
let mut params = pl.get_default_par... | Rust | 0 |
template = """
<contextMenu idMso="{group_name}">
<menu idMso="ObjectsGroupMenu">
<button
id="ObjectsAddToGroup_{group_name}"
insertAfterMso="ObjectsUngroup"
imageMso="ObjectsGroup"
label="Add to Group"
... | Python | 1 |
# -*- coding: utf-8 -*-
"""
PyTorch: nn
-----------
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
to :math:`\pi` by minimizing squared Euclidean distance.
This implementation uses the nn package from PyTorch to build the network.
PyTorch autograd makes it easy to define computationa... | Python | 1 |
InterfaceType::Unknown => "Unknown interface type",
};
write!(f, "{}", interface_type)
}
}
#[derive(Debug, Copy, Clone)]
pub enum ChannelWidth {
Width20NoHT,
Width20,
Width40,
Width80,
Width80P80,
Width160,
Width5,
Width10,
Width1,
Width2,
Widt... | Rust | 0 |
(status)
}
OutputFormat::Json => {
let table = json!({
"last_oui": txn.oui,
"update": update,
"hash": status_json(status),
"txn": envelope.to_b64()?,
});
print_json(&table)
}
}
}
pub fn revers... | Rust | 0 |
):
if state == END_0:
return -1
if state == END_1:
return 1
# other states
return 0
def reset(self):
self.state = START
self.end = False
self.states = []
def play(self, valueFunc, rounds=100):
for _ in range(rounds):
... | Python | 1 |
s.replace("[", "\\[")
.replace("*", "\\*")
.replace("_", "\\_")
.replace("`", "\\`")
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
env_logger::init();
let token = std::env::args()
.nth(1)
.ok_or(anyhow!("Need a Telegram bot token as argument"))?;
let ... | Rust | 0 |
.next_token = new_token.cloned();
is_empty
}
Err(_) => true,
};
if tx.send(resp).await.is_err() {
// receiving end was dropped
return;
}... | Rust | 0 |
N = int(input())
arr = list(map(int, input().split())) # ์ ๋ ฌ๋ ์ํ
left = 0
right = N-1
res = arr[left] + arr[right] # int(2e8)
while left < right:
temp = arr[left] + arr[right]
if temp == 0:
res = temp
break
if abs(temp) < abs(res):
res = temp
if temp < 0:
left += 1
... | Python | 1 |
{:?}, newdirfd={:?}, newpath={:?}, flags={:?}",
olddirfd, oldpath, newdirfd, newpath, flags
);
let proc = self.linux_process();
let (new_dir_path, new_file_name) = split_path(&newpath);
let inode = proc.lookup_inode_at(olddirfd, &oldpath, true)?;
let new_dir_inode = ... | Rust | 0 |
import os
import torch
from torchvision.utils import save_image
from models import VisionTransformer
from utils.data_utils import load_data
from skimage.metrics import peak_signal_noise_ratio as psnr
from skimage.metrics import structural_similarity as ssim
from sklearn.metrics import mean_squared_error
import numpy as... | Python | 1 |
values, index=index)
tm.assert_series_equal(result, expected)
def test_groupby_resample_interpolate():
# GH 35325
d = {"price": [10, 11, 9], "volume": [50, 60, 50]}
df = DataFrame(d)
df["week_starting"] = date_range("01/01/2018", periods=3, freq="W")
result = (
df.set_index("week_st... | Python | 1 |
_dv);
gbdt.get_feature_importances();
}
<reponame>MFEK/glifrenderer.rlib<filename>src/guidelines.rs
use crate::string::{self, UiString};
use crate::viewport::Viewport;
use super::constants::*;
use MFEKmath::rect::FlipIfRequired as _;
use flo_curves as flo;
use glifparser::{Guideline, GuidelinePoint, IntegerOrFlo... | Rust | 0 |
64, u64::MAX as f64),
TypeInfo::Sint8 => (i8::MIN as f64, i8::MAX as f64),
TypeInfo::Sint16 => (i16::MIN as f64, i16::MAX as f64),
TypeInfo::Sint32 => (i32::MIN as f64, i32::MAX as f64),
TypeInfo::Sint64 => (i64::MIN as f64, i64::MAX as f64),
TypeInfo::Enum {enumerators, ..} => {... | Rust | 0 |
ๅฐๅไธบlocalhost
### ้ช่ฏๆนๆณ
1. ๅทๆฐWeb็้ข
2. ๆฅ็MQTT่ฟๆฅ็ถๆๆฏๅฆๅไธบ"ๅทฒ่ฟๆฅ"
3. ๆฃๆฅ็ณป็ปๆฅๅฟไธญ็MQTT็ถๆไฟกๆฏ
### ้ข้ฒๆชๆฝ
1. ็กฎไฟ็ณป็ปๅฏๅจ้กบๅบๆญฃ็กฎ
2. ๅฎๆๆฃๆฅMQTT่ฟๆฅ็ถๆ
3. ็ๆง็ณป็ปๆฅๅฟไธญ็้่ฏฏไฟกๆฏ
"""
# ๅๅ
ฅไฟฎๅค่ฏดๆ
with open("MQTT็ถๆไฟฎๅค่ฏดๆ.md", "w", encoding="utf-8") as f:
f.write(fix_instructions)
print("[SUCCESS] MQTT็ถๆไฟฎๅค่ฏดๆๅทฒๅๅปบ: MQTT็ถๆไฟฎๅค่ฏดๆ.md")
def main():
... | Python | 1 |
ocations.into_iter().rev() {
owned.replace_range(loc..(loc + 1), "โฏ");
}
text = Cow::Owned(owned);
}
}
text
}
}
/// Rust implementation of Python's [`str.splitlines(keepends=True)`][ref].
///
/// [ref]: https://docs.python.org/3/libra... | Rust | 0 |
}
};
}
pub(crate) use pdc_rxtx;
<reponame>hbina/imagecli<gh_stars>100-1000
use imagecli::{documentation::generate_guide, process};
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
struct Opt {
/// Enable verbose logging.
#[structopt(short, long)]
verbose: bool,
/// Input files or glo... | Rust | 0 |
ess:
# Return a handle.
a = tf.constant(10)
b = tf.constant(5)
c = tf.mul(a, b)
h = tf.get_session_handle(c)
h = sess.run(h)
# Delete using a raw tensor handle.
raw_h = h.get_raw_handle()
f, x = tf.delete_session_tensor(raw_h)
sess.run(x, feed_dict={f: raw_h}... | Python | 1 |
::Create,
_ => {
tracing::info!(?action, "Unhandled container action.");
return None;
}
};
Some(ContainerEvent { event, name })
}
}
fn make_exposed_ports(port: u16) -> Option<HashMap<String, HashMap<(), ()>>> {
let dummy: HashMap<(), ()> ... | Rust | 0 |
self._Machine = Machine
@property
def SpecConfigInfos(self):
return self._SpecConfigInfos
@SpecConfigInfos.setter
def SpecConfigInfos(self, SpecConfigInfos):
self._SpecConfigInfos = SpecConfigInfos
def _deserialize(self, params):
self._Machine = params.get("Machine")
... | Python | 1 |
#!/usr/bin/env python
import sys
def il(n):
return n+1
def ol_den(n):
return n
# for decode
def ol_dec(n):
return n+1
def s(n):
return n
if __name__ == "__main__":
mode = sys.argv[1]
with open(sys.argv[2]) as f:
lines = f.readlines()
phone_count = 0
disambig_count = 0
for line in lines:
... | Python | 1 |
'Right-IntCapsule-Ant': 156,
'Left-IntCapsule-Pos': 157,
'Right-IntCapsule-Pos': 158,
'Left-Cerebral-WM-unmyelinated': 159,
'Right-Cerebral-WM-unmyelinated': 160,
'Left-Cerebral-WM-myelinated': 161,
'Right-Cere... | Python | 1 |
d_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
#[cfg(any(feature = "v3_24", feature = "dox"))]
fn connect_property_space_drawer_notify<F: Fn(&Self) + 'static>(&self, f: F)
-> SignalHandlerId;
fn connect_property_tab_width_notify<F: Fn(&Self) + 'static>(&se... | Rust | 0 |
da204481c10ebbbc49f78310126a0590111a4041a61657980061a6162d90001624145390103a101a4617481a862736374323032312d31302d30395431323a30333a31325a627474684c50363436342d3462746376416c686f736e204f6e6520446179205375726765727962636f624145626369782955524e3a555643493a56313a41453a384b5354305248303537484938584b57334d384b324e41443036626... | Rust | 0 |
ionTool.from_defaults(
fn=fn,
name=self.tool.name,
description=self.tool.description,
fn_schema=self.tool.args_schema,
)
return llama_index_tool
def to_autogen_tool(self) -> Callable:
"""Convert the MotleyTool to an AutoGen tool.
An A... | Python | 1 |
import asyncio
import unittest
from effectpy import Pipeline, stage
from effectpy.channel import Channel
from effectpy.context import Context
class TestPipelineIntegration(unittest.IsolatedAsyncioTestCase):
async def test_pipeline_via_stream_to_channel(self):
src: Channel[int] = Channel(maxsize=10)
... | Python | 1 |
acies))
if flag:
break
writer.close()
print("Train Time Usage:", get_time_dif(start_time))
test(config, model, test_iter)
plot_accuracy_loss(
config, train_accuracies, dev_accuracies, train_losses, dev_losses
)
def test(config, model, test_iter):
# test
model.l... | Python | 1 |
ress));
bytes.extend_from_slice(&encode_address(input.contract_address));
bytes.extend_from_slice(&input.value.to_bytes());
let methods = MethodAndTypes::parse(&method_def)?;
let method_sig = method_signature(&methods);
bytes.extend_from_slice(keccak(method_sig.as_bytes()).as_bytes());
let mut... | Rust | 0 |
# -*- 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 |
2rust/#read--modify--write-api).\n\nFor information about available fields see [sensitive_dma_apbperi_uchi0_pms_constrain_1](sensitive_dma_apbperi_uchi0_pms_constrain_1) module"]
pub type SENSITIVE_DMA_APBPERI_UCHI0_PMS_CONSTRAIN_1 =
crate::Reg<u32, _SENSITIVE_DMA_APBPERI_UCHI0_PMS_CONSTRAIN_1>;
#[allow(missing_doc... | Rust | 0 |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... | Python | 1 |
lass="sr-only" type="radio" name="theme" value="{{key}}" {% if loop.first %}checked{% endif %} @change="debouncedPreview">
<div class="border border-[var(--border)] rounded-lg overflow-hidden hover:shadow transition group-hover:translate-y-[-1px]">
<img src="{{ desc['preview'] }}" clas... | Python | 1 |
# -*- coding: utf-8 -*-
# @Author : Erm
# @Time : 2024/4/9 17:35
# @Desc : ๅพฎๅไฟๅญๅพ็็ฑป
import pathlib
from typing import Dict
import aiofiles
from base.base_crawler import AbstractStoreImage
from tools import utils
class WeiboStoreImage(AbstractStoreImage):
image_store_path: str = "data/weibo/images"
as... | Python | 1 |
# Generated by Django 5.1 on 2024-08-09 13:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("exchange", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="ExchangeRate",
fields=[
(
... | Python | 1 |
(),
}
glib::Continue(true)
});
}
/// Actually start the UI, blocking the main thread.
///
pub fn run(&mut self) {
self.connect_events();
self.window.show_all();
gtk::main();
self.assets.clean_up();
}
fn load_content(&mut self, c... | Rust | 0 |
import torch
import torch.nn as nn
from models.CropTypeMapping.modelling.util import initialize_weights
from models.CropTypeMapping.modelling.clstm import CLSTM
from models.CropTypeMapping.modelling.attention import ApplyAtt, attn_or_avg
class CLSTMSegmenter(nn.Module):
""" CLSTM followed by conv for segmentation ... | Python | 1 |
he mutability of a Vec is not necessary. Unfortunately,
// const generics are necessary to do this, and while they now exist, they do not allow
// inference (i.e., if you have a Pin that has a reference to a Device<const P: usize,
// const R: usize>, you can't have that reference just be a DeviceRef<_, _> e... | Rust | 0 |
):
metadata: Dict = self.metadata_list[index]
scene_name = metadata["scene_name"]
cache_file = osp.join(self.cache_dir, f"{scene_name}.pkl")
if osp.exists(cache_file):
batch_list, labels, inv_indices, raw_labels = load_pickle(cache_file)
else:
batch_list,... | Python | 1 |
models.BirdClasses.objects.all()]
class birdinfo_edit_form(forms.Form):
eng_species = forms.CharField()
chi_species = forms.CharField()
eng_description = forms.CharField(required=False)
chi_description = forms.CharField(required=False)
wiki_url = forms.CharField(required=False)
bird_class = fo... | Python | 1 |
_path)?;
return Ok(ra_path);
static TAG_FOR_EQ_1_47: &str = "2021-07-12";
static TAG_FOR_GEQ_1_48: &str = "2021-08-09";
fn curl(url: &str, cwd: &Path, shell: &mut Shell) -> anyhow::Result<Vec<u8>> {
let curl_exe = which::which("curl").map_err(|_| anyhow!("command not found: curl"))?;
P... | Rust | 0 |
#!/usr/bin/env python
#
# Copyright 2016 Cisco Systems, 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 applicab... | Python | 1 |
from datetime import datetime
import pandas as pd
TZ = datetime.now().astimezone().tzinfo
def normalize_news(df: pd.DataFrame) -> pd.DataFrame:
cols = ["date","time","headline","source","link","summary"]
df = df[cols].copy()
df["headline"] = df["headline"].fillna("").str.strip()
df["summary"] = df["su... | Python | 1 |
# security_api/core/domain/services.py
import logging
from typing import List, Dict, Optional
from .entities import GoogleDorkResult, DnsRecord, WhoisInfo, NmapHost
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class GoogleDorkService:
def __init__(self, scanner_adapt... | Python | 1 |
"""Init and utils."""
from zope.i18nmessageid import MessageFactory
import logging
__version__ = "1.1.1.dev0"
PACKAGE_NAME = "cs_flickrgallery"
_ = MessageFactory(PACKAGE_NAME)
logger = logging.getLogger(PACKAGE_NAME)
ANNOTATION_KEY = "cs_flickrgallery"
| Python | 1 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class VehicleService(Document):
pass
| Python | 1 |
r(self):
"""Measures the direct-to-reverberant ratio of the impulse
response.
Returns
-------
float
Direct-to-reverberant ratio
"""
early_response, late_field, _ = self.decompose_ir()
num = (early_response**2).sum(dim=-1)
den = (late_f... | Python | 1 |
ureCellContextImprint(self)
}
}
impl SecureCellWithPassphrase {
/// Switches this Secure Cell into the _Seal_ operation mode.
pub fn seal(self) -> SecureCellSealWithPassphrase {
SecureCellSealWithPassphrase(self)
}
}
/// Secure Cell in _Seal_ operation mode.
///
/// This is the most secure and... | Rust | 0 |
rsify(label_list, start=0, sentinel=''):
pivoted = lzip(*label_list)
k = len(label_list)
result = pivoted[:start + 1]
prev = pivoted[start]
for cur in pivoted[start + 1:]:
sparse_cur = []
for i, (p, t) in enumerate(zip(prev, cur)):
if i == k - 1:
sparse... | Python | 1 |
path=request.path,
query=request.query_string,
latency=spend_time
)
if response.status >= 400:
logger.error(msg)
elif response.status >= 300:
logger.warning(msg)
else:
logger.info... | Python | 1 |
("Running blur kernel");
blur_kernel
.launch(
&[
cu::Any(&input_pixels_buf),
cu::Any(&output_pixels_buf),
cu::Any(&image_info_buf),
cu::Any(&radius),
],
grid,
block,
)
.chain_err(|... | Rust | 0 |
ba7258fe473f1d8befff367bb793c786107[m
Author: <NAME> <<EMAIL>>
Date: Mon Dec 13 22:54:43 2021 -0500
753 Test file
[1mdiff --git a/file b/file[m
[1mindex 72943a1..f761ec1 100644[m
[1m--- a/file[m
[1m+++ b/file[m
[31m@@ -1 +1 @@[m
[31m-aaa[m
[32m+[m[32mbbb[m
"#;
const GIT_DIFF_COLOR_WORD... | Rust | 0 |
Error>> {
# let tdir = tempfile::Builder::new().prefix("fitsio-").tempdir().unwrap();
# let tdir_path = tdir.path();
# let filename = tdir_path.join("test.fits");
# let mut fptr = fitsio::FitsFile::create(filename).open()?;
# let table_description = &[
# ColumnDescription::new("bar")
# ... | Rust | 0 |
nt must be a power of two ({} isn't)", max_chunks);
}
if chunk_size.count_ones() != 1 {
panic!("Chunk size must be a power of two ({} isn't)", chunk_size);
}
Self {
store: vec![ChunkMap::with_capacity_and_hasher(
chunk_size as usize,
... | Rust | 0 |
log.debug("User canceled the download of the update.")
return
log.debug("The update bundle has been downloaded successfully.")
if generate_sha1hash(bundle_file) != upstream_version_info.update_sha1hash:
log.debug("Hashes do not match.")
progress_dlg.Dismiss()
bundle_file... | Python | 1 |
rows: 0, read_bytes: 0]",
error: "",
},
Test {
name: "database-passed",
sql: "select database()",
expect: "Projection: database([default]):Utf8\n Expression: database([default]):UInt8 (Before Projection)\n ReadDataSource: scan partitions: [1], scan schema: [dummy:UInt... | Rust | 0 |
import numpy as np
import torch
from datetime import datetime
import os
import random
from config import get_config, get_model_config, get_train_config
from skill_graph.algorithm import SkillGraph
def seed(seed_value: int) -> None:
"""Set seed for all RNGs to ensure reproducibility.
Args:
seed_val... | Python | 1 |
ting": tuple, "restricted_sorting":tuple,
"magic_square": tuple, "consecutive_grid": tuple,
"traffic":tuple, "city_directed_graph":tuple,
"trampoline_matrix":tuple}
problems = dataset.get_problem_types(all_problems... | Python | 1 |
9022,
4.22672716677,
1.81797461354,
2.7840457544,
0.7664167964,
1.8887930071,
4.15791319343,
1.83105030444,
3.92592140377,
3.99626115302,
1.50894993813,
1.99291271003,
1.15614639932,
0.94897593272,
1.85721204... | Rust | 0 |
op_position(self) -> tuple:
"""
่ทๅ็ชๅฃๅทฆไธ่งๅๆ
:return: (0, 0)
"""
try:
re_pattern = re.compile(r"Absolute.*:\s\s(-?\d+)")
app_window_info = self.window_info()
if config.IS_X11:
result = re.findall(re_pattern, app_window_info)
... | Python | 1 |
from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
num_index = {}
for index , num in enumerate(nums):
compliment = target - num
if compliment in num_index:
return [num_index[compliment] , index]
nu... | Python | 1 |
from llama_cpp import Llama, llama_types
from sys import stderr
MODEL_PATH = "/to_path_pou_evales_to_llama/llama-2-7b-chat.Q5_K_M.gguf"
model = Llama(
model_path=MODEL_PATH,
# n_gpu_layers=-1, # ฮฮฌฮฝฮต uncomment ฮณฮนฮฑ ฮฝฮฑ ฯฯฮทฯฮนฮผฮฟฯฮฟฮนฮฎฯฮตฮนฯ ฯฮทฮฝ GPU.
chat_format="llama-2",
# ฮคฮฟ context window. 0 = ฯฯฮทฯฮน... | Python | 1 |
w5j1
assert b''
@(yield kle8li813is)
@('' for r043fxt4t5m in wm306ybodv8 if m7towl30o1n if 0 for zjdsmng9kna in ekannr6295l if False if None if kvulp2e123j)
def jeoa0iexr0i(er87hrduk1j: zdt7z3cph0n, ejznjme8ekw, b57i3n_5li5: ku1c_pma8aw, udoarhdt6cz, m_z7kp8q3bs: n9lch_zh7_a, monos06gg9d, pmlpydze0pd: fqu0v75fzrv):... | Python | 1 |
i64, u32, i32, f64, f32 }
}
<filename>game2d/src/grid.rs
use std::{
collections::{HashMap, HashSet},
hash::Hash,
iter::FromIterator,
ops::Add,
};
/// Data that targets a square in the `Grid`
///
/// Note: You can convert a `(x, y)` tuple into a grid using `into()`
#[derive(Debug, Clone, Copy, PartialEq... | Rust | 0 |
import numpy as np
import cv2 as cv
import glob
import os
# termination criteria
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 24, 0.001)
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
objp = np.zeros((6*9,3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)
# Arrays t... | Python | 1 |
/// I/O and not store anything in `fh`, though that makes it impossible to implement standard
/// conforming directory stream operations in case the contents of the directory can change
/// between `opendir` and [`releasedir`][Filesystem::releasedir].
async fn opendir(&self, req: Request, inode: Inode, ... | Rust | 0 |
of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the spe... | Rust | 0 |
ne()
self._curr_correct_predictions_k = state["curr_correct_predictions_k"].clone()
self._curr_sample_count = state["curr_sample_count"].clone()
def update(self, model_output, target, **kwargs):
"""
args:
model_output: tensor of shape (B, C) where each value is
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.