text string | label_name string | labels int64 |
|---|---|---|
)
if dir.endswith(('.jpg', '.png')):
text = dir.split('__')[0] if '_' in dir else dir.split('.png')[0]
with open(os.path.join(path, text.replace(' ','_')+f'_{num}.gt.txt'), 'w') as file:
file.write(text)
os.rename(os.path.join(path, dir), os.path.join(path, te... | Python | 1 |
"""Slack bot chapters command."""
from apps.slack.commands.command import CommandBase
from apps.slack.common.constants import COMMAND_HELP, COMMAND_START
from apps.slack.common.handlers.chapters import get_blocks
from apps.slack.common.presentation import EntityPresentation
class Chapters(CommandBase):
"""Slack ... | Python | 1 |
import numpy as np
from pyscf import gto, scf
from pyxdh.Utilities import FormchkInterface
from pkg_resources import resource_filename
from pyxdh.DerivOnce import DipoleUSCF, DipoleUMP2
class TestDipoleU:
mol = gto.Mole(atom="C 0. 0. 0.; H 1. 0. 0.; H 0. 2. 0.; H 0. 0. 1.5", basis="6-31G", spin=1, verbose=0).bui... | Python | 1 |
};
bind_multicast(&socket, &addr)?;
Ok(socket.into_udp_socket())
}
fn main() {
let max_retries = 5;
let worker_id = Uuid::new_v4();
println!("Initialising worker {}", worker_id);
let mut retries = 1;
while establish_connection(worker_id).is_none() {
if retries >= max_retries {
... | Rust | 0 |
_output()
.expect_success();
// BigQuery to gs://.
testdir
.cmd()
.args(&[
"cp",
"--if-exists=overwrite",
&format!("--schema=postgres-sql:{}", schema.display()),
&bq_table,
&gs_dir_2,
])
.tee_output()
.e... | Rust | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | Python | 1 |
feature = "Win32_Foundation")]
pub union WIAS_CHANGED_VALUE_INFO_1 {
pub lVal: i32,
pub fltVal: f32,
pub bstrVal: super::super::Foundation::BSTR,
pub guidVal: ::windows_sys::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::marker::Copy for WIAS_CHANGED_VALUE_INFO_1 {}
#[cfg(feature = "Win... | Rust | 0 |
'# speech_blackboard_purges -> detail_plastic_gangways'
0
import tc2t8w2oe0i as mhdr9ya194a
from gsjyc6bjd93 import yz1zp20phyw as i_fyqvmqm78, l324um4ta0r, m4_27knifu7, mtcop83gatv as nqkgo3bni28, q7vka1tea8m, b0fumt3lo18 as ul3y45cfgqu, f62g1_4f9bo as buhaoei6gzr
assert r8p4blfhys0
nabe_oqcub... | Python | 1 |
if size > 0 {
array[size - 1] = 0;
}
array
}
// Push middle
pub fn helper_random_array_push_middle_i64(size: usize) -> Vec<i64> {
let mut array =
(0..size).into_par_iter().map(|i| i as i64).collect::<Vec<i64>>();
if size > 0 {
array[size - 1] = (size / 2) as i64;
}
... | Rust | 0 |
(&self.buffer, other.buffer(), blend_op, intensity))
}
pub fn drawing(&self, radius: u32, mode: DrawingMode) -> Image {
Self::new_from_buffer_with_meta(self, ops::drawing(&self.buffer, radius, mode))
}
pub fn interlace(&self, offset: u32) -> Image {
Self::new_from_buffer_with_meta(self... | Rust | 0 |
se None,
error_y=y_error[index] if y_error else None,
meta=get_meta(series_names, index, hover_data, y),
hovertemplate=get_hover_template(hover_data),
mode=get_mode(lines, markers),
marker_size=8,
con... | Python | 1 |
tant
self.scale_1x1.requires_grad_(False)
self.scale_conv.requires_grad_(False)
if use_se:
raise NotImplementedError("se block not supported yet")
else:
self.se = nn.Identity()
def forward(self, inputs):
out = self.scale_conv(self.conv(inputs)... | Python | 1 |
, "10 mins"),
BarSize::_15Mins => write!(f, "15 mins"),
BarSize::_20Mins => write!(f, "20 mins"),
BarSize::_30Mins => write!(f, "30 mins"),
BarSize::_1Hour => write!(f, "1 hour"),
BarSize::_4Hours => write!(f, "4 hours"),
BarSize::_1Day => write!(f... | Rust | 0 |
parent_message_weakref = weakref.proxy(parent_message)
# As an optimization, we also indicate directly on the listener whether
# or not the parent message is dirty. This way we can avoid traversing
# up the tree in the common case.
self.dirty = False
def Modified(self):
if self.dirty:
ret... | Python | 1 |
GamalPK) -> (ElGamalCT, ElGamalRand) {
ElGamal::encrypt(pk, self)
}
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
pub struct ElGamalPK(pub RistrettoPoint);
impl ElGamalPK {
pub fn encrypt(self, msg: GroupEncoding) -> (ElGamalCT, ElGamalRand) {
ElGamal::encrypt(self, msg... | Rust | 0 |
Some(info) => cb_sink
.send(Box::new(|s| update_time_from_properties(s, info)))
.map_err(|err| Error::CrossbeamSendError(err.to_string()))?,
None => (), // I guess we didn't get the data this time..
}
... | Rust | 0 |
olumns, keys):
# GH#43999
df = DataFrame({"a": [1, 1, 2, 3], "b": [4, 5, 6, 7]})
df[cat_columns] = df[cat_columns].astype("category")
msg = "The default of observed=False is deprecated"
klass = FutureWarning if set(cat_columns) & set(keys) else None
with tm.assert_produces_warning(klass, match=m... | Python | 1 |
_sets(&ALL[3..7], &|v: f64| libm::powd(*val, v), &|_| f64::NAN);
})
});
}
#[test]
fn normal_cases() {
assert_eq!(libm::powd(2.0, 20.0), (1 << 20) as f64);
assert_eq!(libm::powd(-1.0, 9.0), -1.0);
assert!(libm::powd(-1.0, 2.2).is_nan());
assert!(libm::powd(-1.0, -1.14).is_nan());
}
#[test]
... | Rust | 0 |
19-01-11T04:41:19Z in UTC
let utc_date = Utc.ymd(2019, 1, 11).and_hms(23, 41, 19);
let updated = Utc
.ymd(utc_date.year(), utc_date.month(), utc_date.day())
.and_hms(0, 0, 0);
assert_eq!(updated, Utc.ymd(2019, 1, 11).and_hms(0, 0, 0));
}
#[test]
fn calculate... | Rust | 0 |
{"role": "user", "content": f"故事提示:{prompt}\n主题:{themes}\n世界观:{setting}\n角色:{characters}"}
], complexity="complex")
self.current_story["outline"] = outline
logger.info("故事大纲创建完成")
# 5. 生成章节梗概(复杂任务)
logger.info("Step 5/6: 生成章节梗概...... | Python | 1 |
:{Duration, Instant},
};
use dashmap::DashMap;
use tokio::io::unix::AsyncFd;
use tokio::time::timeout;
use crate::error::{Error, Result};
use crate::packet::{icmpv4, icmpv6, IcmpPacket};
use crate::socket;
#[derive(Debug)]
pub struct AsyncSocket {
inner: AsyncFd<socket::Socket>,
}
impl AsyncSocket {
pub fn... | Rust | 0 |
led by adding feature flags to your
//! `Cargo.toml` file:
//!
//! - **std:** adds `std::error::Error` impls to any errors and switches to
//! `Vec` for the default backing buffers
//! - **serde-1:** allows serializing and deserializing most types with `serde`
#![deny(
bare_trait_objects,
elided_lifetimes_in_... | Rust | 0 |
);
impl_try_from_bitwise!(
Int128Impl,
i128,
113,
[114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,]
);
impl_try_from_bitwise!(
Int128Impl,
i128,
114,
[115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 1... | Rust | 0 |
import os
import sys
import requests
def download_page(num, page, output_dir="data/raw"):
"""
Download a single HTML page given the numeric part and page number.
The URL pattern is:
http://[base]/kent{num_formatted}.htm#P{page}
The downloaded file is saved as "kent{num_formatted}_P{page}.html... | Python | 1 |
de::Component(comp) => comp.reorder(parent, next),
VNode::None => Ok(())
}
}
fn remove(&self, parent: &Self::Node) -> Result<(), JsValue> {
match self {
VNode::Text(txt) => txt.remove(parent),
VNode::Element(el) => el.remove(parent),
VNode::List(l... | Rust | 0 |
if (mid as i64) * (mid as i64) <= x as i64 {
ans = mid;
left = mid + 1;
} else {
right = mid - 1;
}
}
ans
}
/// 力扣(69. x 的平方根)
/// 方法2:换底公式(自然数e为底)
pub fn my_sqrt_v2(x: i32) -> i32 {
if x == 0 {
return 0;
}
// x1/2=(elnx)1/2=e21lnx
/... | Rust | 0 |
aw * sin_pitch, cos_pitch, cos_yaw * sin_pitch];
let zaxis = [sin_yaw * cos_pitch, -sin_pitch, cos_pitch * cos_yaw];
let cam_arr = [cam.pos.0, cam.pos.1, cam.pos.2];
[
[xaxis[0], yaxis[0], zaxis[0], 0.0],
[xaxis[1], yaxis[1], zaxis[1], 0.0],
[xaxis[2], yaxis[2], zaxis[2], 0.0],
... | Rust | 0 |
exhaustive enums, i.e., no enum has the `#[non_exhaustive]` attribute
//! - `no_vex`: Disables all `VEX` instructions. See below for more info.
//! - `no_evex`: Disables all `EVEX` instructions. See below for more info.
//! - `no_xop`: Disables all `XOP` instructions. See below for more info.
//! - `no_d3now`: Disable... | Rust | 0 |
/// to reserve adding new trait implementations to it later. It can be
/// ignored for now.
pub fn spawn<F>(f: F) -> Spawn
where
F: Future<Item=(), Error=()> + Send + 'static,
{
tokio::spawn(f);
Spawn {
_inner: (),
}
}
/// Start the Tokio runtime using the supplied future to bootstrap executio... | Rust | 0 |
e = "CFBundleIdentifier")]
pub bundle_identifier: String,
/// The bundle ID of the watchOS app.
///
/// This key is automatically included in your WatchKit extension’s
/// information property list when you create a watchOS project from a template.
///
/// ## Availability
/// * watchOS 2... | Rust | 0 |