text
string
label_name
string
labels
int64
_block.number - 1 } else { assert!(block.header.raw.previous_header_hash.is_zero()); 0 } }; trace!(target: "db", "decanonize, new best: {:?}", new_best_block); let mut update = DBTransaction::new(); update.delete(Key::BlockHash(block_number)); update.delete(Key::BlockNumber(block_hash.clone())...
Rust
0
is nonnegative or nonpositive, //! // the output range is limited to 0. //! let x: Ranged<0, 9> = r!([0 100] 15) % r!(10); //! let x: Ranged<-9, 0> = r!([-100 0] -15) % r!(10); //! //! // The limit can't exceed the dividend's MIN(if negative) or MAX(if positive): //! let x: Ranged<-10, 10> = r!([-10 10] 4) % r!([1 100...
Rust
0
n(c) == len(tri.triangles): point_colors = None facecolors = c else: raise ValueError('The length of c must match either the number ' 'of points or the number of triangles') # Handling of linewidths, shading, edgecolors and antialiased as ...
Python
1
url::Url; #[test] fn oak_6_3_1_application() { run( "https://deno.land/x/oak@v6.3.1/application.ts", &[ "ApplicationErrorEvent", "ApplicationListenEvent", "Application", ], ); } #[test] fn oak_6_3_1_mod() { run( "https://deno.land/x/oak@...
Rust
0
#!/usr/bin/env python3 """ Sets up Adam optimization for a Keras model with categorical crossentropy loss and accuracy metrics """ import tensorflow.keras as K def optimize_model(network, alpha, beta1, beta2): """ Sets up Adam optimization for a keras model with categorical crossentropy loss and accuracy...
Python
1
_star_data if not (entry['Scénario'] == 'Infiltration' and entry['Level'] in [f'mission0{i}' for i in range(1, 9)]) ] print("player_star_data", player_star_data) df_player_stars = pd.DataFrame(player_star_data) # New DataFrame for Nombre d\'étoiles du joueur par scénario #print("blueblue",star_...
Python
1
() -> Vec<T::AuthorityAres> { let authority_list = T::AuthorityAres::all(); // T::AuthorityAres::all(); authority_list } /// Check whether the authority of the current block author has a private key on the local node. pub fn check_block_author_and_sotre_key_the_same(block_author: &T::Author...
Rust
0
ypes) -> Commands { let source_module = &ctx.module; let mut commands: Vec<Command> = Vec::new(); let (transparent, opaque): (Vec<_>, Vec<_>) = datatypes.iter().partition(|datatype| is_datatype_transparent(source_module, *datatype)); // Encode transparent types as air datatypes let transpar...
Rust
0
{:.5}, in_reserve: {:.5}", self.in_active, self.in_reserve ) } } <gh_stars>1-10 use std::iter::FromIterator; fn get_sign(a: i32) -> i32 { if a > 0 { 1 } else if a < 0 { -1 } else { 0 } } #[derive(Copy, Clone)] pub enum RoundType { Cut, Inc, Round, } fn round(a: &Vec<i32>, size...
Rust
0
base(&'a self) -> u64 { self.text_offset - self.image_base } } #[derive(Debug)] pub struct ExeProperties { architecture: Architecture, endianess: Endianness, image_base: u64, } impl ExeProperties { pub fn from_object<'a: 'b, 'b, O: Object<'a, 'b>>(obj: &'b O) -> Self { Self { ...
Rust
0
::reflect::MessageDescriptor::new_pb_name::<XAttrProto>( "XAttrProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static XAttrProto { static instance: ::protobuf::rt::LazyV2<XAttrProto> = ::protobuf::rt::LazyV2::...
Rust
0
#Question 1: Create a variable called break and assign it a value 5. See what happens and find out the reason behind the behavior that you see. #break=5 #Answer: The reason break isn't working because its a reserved keyword for another functionality. So python doesn't let use that keyword. #Question 2: Create two vari...
Python
1
it really does or not. We cannot tell the compiler that `wrapper` does not access the `data` field using this normal `Drop` syntax. It is where the `may_dangle` attribute comes in. By rewriting the declaration for drop as `unsafe impl<#[may_dangle] 'a> Drop for Wrapper<'a>`, we can tell the compiler that `wrapper` will...
Rust
0
0 } }, Err(e) => { log::warn!("Failed to read meow counter from file: {}", e); 0 } } }; Self { path, counter: AtomicU64::new(init_counter), ...
Rust
0
import pandas as pd import argparse from datetime import datetime from pathlib import Path STEP6_DIR = Path("data/5th/step6") ENTRY_DIR = Path("data/5th/tmp") OUTPUT_DIR = Path("data/5th/step7") def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--date", required=True, help="日付 (YYYY-MM...
Python
1
, } impl ServiceMockBuilder { pub fn new(exec: MainExecutor) -> Self { let builder = unwrap_jni(exec.with_attached(|env| { let value = env.call_static_method( NATIVE_FACADE_CLASS, "createServiceFakeBuilder", format!("()L{};", SERVICE_MOCK_BUILDER_...
Rust
0
if port: self.port = int(port.group(1)) self.zsocket.__enter__() self.num_sent = 0 return self def __exit__(self, *args): self.zsocket.__exit__(*args) del self.zsocket def __iter__(self): """ Iterate on the socket and yield the receiv...
Python
1
isitor, Sqlite}}; /// let query = Select::from_table("users").so_that("foo".begins_with("bar")); /// let (sql, params) = Sqlite::build(query); /// /// assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` LIKE ?", sql); /// /// assert_eq!( /// vec![ /// ParameterizedValue::fr...
Rust
0
os::raw::c_char, event: rte_dev_event_type, ); } extern "C" { pub fn rte_dev_event_monitor_start() -> ::std::os::raw::c_int; } extern "C" { pub fn rte_dev_event_monitor_stop() -> ::std::os::raw::c_int; } extern "C" { pub fn rte_dev_hotplug_handle_enable() -> ::std::os::raw::c_int; } extern "C" {...
Rust
0
_eq!(emu.reg.eax(), 0xFFFF_0001); assert_eq!(emu.reg.rax(), 0xFFFF_FFFF_FFFF_0001); // 0: b0 01 mov al,0x1 let mut emu = emu_from_shellcode64(&b"\xB0\x01"[..]); emu.reg.rax = 0xFFFF_FFFF_FFFF_FFFF; emu.step()?; assert_eq!(emu.reg.al(), 1); a...
Rust
0
from os import environ, remove from os.path import dirname, join, isfile import kivy if environ.get('KIVENT_USE_SETUPTOOLS'): from setuptools import setup, Extension print('Using setuptools') else: from distutils.core import setup from distutils.extension import Extension print('Using distutils') ...
Python
1
4),(4,4),(4,4),(4,4), // 5 1100 (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), (4,5),(4,5),(4,5),(4,5), // 1101 // 14 1101_00 (6,14), (6,14), (6,14...
Rust
0
Alias for --color always --heading --line-number."; const LONG: &str = long!( "\ This is a convenience alias for '--color always --heading --line-number'. This flag is useful when you still want pretty output even if you're piping ripgrep to another program or file. For example: 'rg -p foo | less -R'. " ...
Rust
0
ssage(ai_response, websocket) except WebSocketDisconnect: print(f"Websocket client disconnected: {websocket.client}") await manager.disconnect(websocket) except NotAvailableProviderException: print("Provider type error!") await manager.disconnect(websock...
Python
1
Database { pub database: String, pub user: String, pub password: String, pub host: String, pub port: Option<u16>, } // allow use of '?' to quick return error //type MyResult<T> = Result<T, Box<Error>>; pub fn read(filename: &str, debug: bool) -> Result<Database> { if debug { println!(...
Rust
0
f}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u{ffff}', '\u...
Rust
0
::hyper; const SECRET: [u8; 32] = *b"secrets must be >= 32 bytes long"; #[fn_handler] async fn get_index(depot: &mut Depot) -> String { depot.csrf_token().unwrap_or_default().to_owned() } #[fn_handler] async fn post_index() -> &'static str { "POST" } #[tokio::test] ...
Rust
0
line1 = ' ~.~ ' line2 = '` `' line3 = ' \./ ' for _ in range(5): N = int(input()) print(line1 * N) print(line2 * N) print(line3 * N)
Python
1
Win32_Graphics_Direct3D10\"`*"] pub const D3D10_BLEND_INV_DEST_ALPHA: D3D10_BLEND = 8i32; #[doc = "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_BLEND_DEST_COLOR: D3D10_BLEND = 9i32; #[doc = "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_BLEND_INV_DEST_COLOR: D3D10_BLEN...
Rust
0
; } let line_num = (y / self.font_height) as u64; let index = if let Some(line) = self.line_cache.get_line(line_num) { let pango_ctx = self.da.get_pango_context().expect("failed to get pango ctx"); let layout = self.create_layout_for_line(&pango_ctx, &main_state, line); ...
Rust
0
USD: { code: "USD", exponent: 2, locale: EnUs, minor_units: 100, name: "USD", symbol: "$", symbol_first: true, }, GBP : { code: "GBP", exponent:...
Rust
0
: PhysicalMemory + ?Sized, FO: Extend<(Error, Address, B)>, V: Vector<vector_trees::btree::BVecTreeNode<Address, ()>>, B: SplitAtIndex, { //TODO: use self.pt_leaf_size(step) (need to handle LittleEndian::read_u64) let pte_size = 8; let page_size = self.pt_leaf_size(st...
Rust
0
// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. /// `allServices` is a special value that covers all services. pub service: Option<String>, } impl client::Part for AuditConfig {} /// Provides the configuration for logging a type of permissions. /// Example: /// /// ````text /// { /// ...
Rust
0
(f"Processing {mail} Done") except Exception as e: with open('error_log.txt', 'a') as f: f.write('Exception occurred: \n') traceback.print_exc(file=f) print("Error occurred. Retrying...") while attempt <= 5: try: outlook = ...
Python
1
mod poseidon; pub mod vanchor; <reponame>vitorenesduarte/threshold-rs<filename>src/tests/mod.rs<gh_stars>1-10 mod arbitrary; mod prop_aeclock; mod prop_arclock; mod prop_beclock; mod prop_eventset; mod prop_multiset; mod prop_tclock; mod prop_vclock; use super::prelude::*; #[derive(PartialEq, Eq, Debug)] pub struct m...
Rust
0
.ping_backend().await { Ok(Some(new_crt)) => { crt = new_crt; server.respawn_with_new_cert(&crt).await.unwrap(); } Err(e) => log::error!("error pinging backend: {}", e), _ => {} // pass-over ...
Rust
0
() { NumberContentKind::I64 } else if self.is_f64() { NumberContentKind::F64 } else { unreachable!() } } } // Generate a snake case version of NumberContent variant // name via `serde`. We use this hack because `serde` case // conversion functions are int...
Rust
0
+ 3.0 * r)) / 2.0; deriv[15][1] = (27.0 * r * s) / 2.0 + (9.0 * r * (-1.0 + 3.0 * s)) / 2.0; deriv[16][1] = -27.0 * s * t + 27.0 * t * u; deriv[17][1] = -27.0 * r * t; deriv[18][1] = -27.0 * r * s + 27.0 * r * u; deriv[19][1] = 27.0 * r * t; // with respect to t ...
Rust
0
{ let value = match register { Register8::A => self.data[0] >> 8, Register8::F => self.data[0] & 0xff, Register8::B => self.data[1] >> 8, Register8::C => self.data[1] & 0xff, Register8::D => self.data[2] >> 8, Register8::E => self.data[2] ...
Rust
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 增强的多因子模型系统 解决数据缺失和模型训练问题的完整解决方案 主要功能: 1. 批量计算历史因子数据 2. 修复数据匹配问题 3. 提供完整的机器学习训练流程 4. 包含数据验证和错误处理 """ import pandas as pd import numpy as np from datetime import datetime, timedelta import warnings warnings.filterwarnings('ignore') # 机器学习库 from sklearn.ensemble import...
Python
1
(linearly). "feature_net_config": { "fcnet_hiddens": [], "fcnet_activation": "relu", }, "sub_exploration": { "type": "StochasticSampling", }, "forward_net_activation": "relu", "inverse_net_activation...
Python
1
arate task. For example, the rpc requests /// return Futures that encapsulate the whole flow, from sending the request to /// remote, to finally receiving the response and deserializing. It therefore /// makes the most sense to make the rpc call on a separate async task, which /// requires the `DiscoveryNetworkSender` ...
Rust
0
Handle: FT_HANDLE, usFlowControl: USHORT, uXonChar: UCHAR, uXoffChar: UCHAR, ) -> FT_STATUS; } extern "C" { #[doc = " @noop FT_SetDtr"] #[doc = " @par Supported Operating Systems"] #[doc = " Linux"] #[doc = " Mac OS X (10.4 and later)"] #[doc = " Windows (2000 and later)"...
Rust
0
ed_address), &[], &fake_ep, ) .await .expect("failed to write DAD message"); let target_address = expect_ns_message_in(&fake_ep, DAD_IDGEN_DELAY + ASYNC_EVENT_POSITIVE_CHECK_TIMEOUT).await; // We expect two addresses for the SLAAC prefixes to be assigned to the NIC as the ...
Rust
0
(); hasher.finish() }; let cmp = TT::sort_compare(sa, sb).unwrap(); let ha = eval_hash(sa); let hb = eval_hash(sb); (cmp, ha, hb) ...
Rust
0
cept (playwright.sync_api.Error, MarkingError) as e: err_msg = str(e) # try to add robustness to async events (detached / deleted frames) if retries_left > 0 and ( "Frame was detached" in err_msg or "Frame with the given frameId is ...
Python
1
allel method always crashes on travis, and sometimes crashes on my laptop //// TODO need some sensible threshold to trigger the multi-threaded path //if ncpus > 1 && nresamples > a.as_slice().len() + b.as_slice().len() { //let granularity = nresamples / ncpus + 1; //let granulari...
Rust
0
oglify Majów', 'pt': 'hieróglifos maias', 'rm': 'ieroglifas maya', 'ro': 'hieroglife maya', 'ru': 'майя', 'sk': 'mayské hieroglyfy', 'sl': 'majevska slikovna pisava', 'sr': 'мајански хијероглифи', 'sr-Cyrl': 'мајански хијероглифи', 'sr-Latn': 'majanski hijeroglifi', 'sv': 'mayahieroglyfer', 'ta': 'மயான் ஹைரோகிளிப்', 't...
Python
1
ange_basis_first); } /// Add one constraint, but first multiply it by a filter such that it will only apply to the /// last row of the trace. pub fn constraint_last_row(&mut self, constraint: P) { self.constraint(constraint * self.lagrange_basis_last); } } pub struct RecursiveConstraintCon...
Rust
0
3_leaf_trie, create_4_leaf_trie, create_5_leaf_trie, create_6_leaf_trie, ]; fn hash_test_tries(tries: &[TestTrie]) -> Result<Vec<HashedTestTrie>, bytesrepr::Error> { tries .iter() .map(|trie| HashedTestTrie::new(trie.to_owned())) .collect() } fn create_0_leaf_trie() -> Result<(...
Rust
0
, 0x2e0f, 0x4aad, 0xa8, 0xd7, 0xe0, 0x6b, 0xaf, 0xeb, 0xcd, 0xfe} DEFINE_GUID!{CLSID_WICJpegDecoder, 0x9456a480, 0xe88b, 0x43ea, 0x9e, 0x73, 0x0b, 0x2d, 0x9b, 0x71, 0xb1, 0xca} DEFINE_GUID!{CLSID_WICGifDecoder, 0x381dda3c, 0x9ce9, 0x4834, 0xa2, 0x3e, 0x1f, 0x98, 0xf8, 0xfc, 0x52, 0xbe} DEFINE_GUID!{CLSID_WICTif...
Rust
0
if operation == 'equip_item' and 'item' not in kwargs: return EquipmentOperationResult( success=False, error_type='missing_item', message="装備するアイテムが指定されていません" ) return EquipmentOperationResult(success=True) def _execute...
Python
1
hen` and `after-else` continuations both target the same `Block` /// (both continuations point to the same `target` but have different `origin`) AfterElse, /// For `default` continuations. Used mainly when there is a conditional-jump in the code. /// In that case, there is a `Block` created for execu...
Rust
0
doctree = match doctree.push_data( TreeNodeType::Attribution { raw_text: attribution_string, } ) { Ok(tree) => tree, Err(tree) => { return TransitionResult::Failure { message: ...
Rust
0
# import the necessary packages from imutils.video import VideoStream from imutils.video import FPS import numpy as np import imutils import time import cv2 CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat", "pen", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse",...
Python
1
et an iterator going over all edges from this node to the target layer. /// Usually there is only one and [`get_neighbor`][Self::get_neighbor] can be used instead. #[inline] pub fn get_all_neighbors<'r, 'l, Target>( &'r self, layer: &'r LayerView<'l, Target>, ) -> EdgeIter<'r, 'l, Target...
Rust
0
from pathlib import Path from django.core.management import call_command from django.core.management.base import BaseCommand from django.db.models.signals import post_delete from django.db.models.signals import post_save from django.db.models.signals import pre_delete from django.db.models.signals import pre_save cl...
Python
1
.87, "latency_ms": 40.0} } # Create projection dimension plot visualizer.create_projection_dimension_plot(dimension_data) # Create example data for dataset size effect size_data = { 1000: {"precision@1": 0.55, "mrr": 0.62, "latency_ms": 15.0}, 10000: {"precision@1": 0.65, "...
Python
1
downloader_tab_items }] }] }, { 'component': 'VRow', 'content': [{ 'component': 'VCol', 'props': { 'cols': 12, 'style': { '...
Python
1
import datetime import math from bugsink.utils import nc_rnd # a way to generate some bursty streams of points-in-time. # I'm sure there's a 100 things wrong with this, but at least it's # # * not simply distributed at random # * has some form of periodic pattern in it as real data surely has # * has bursts (errors ...
Python
1
from .page_digitalhuman import digitalhuman
Python
1
Average Time per Move: {p1_times.mean():.2f}ms ± {p1_times.std():.2f}ms") print(f" Player 2 Average Time per Move: {p2_times.mean():.2f}ms ± {p2_times.std():.2f}ms") p1_conf = moves_df[moves_df['player'] == 1]['confidence'] p2_conf = moves_df[moves_df['player'] == 2]['confidence'] ...
Python
1
R = np.tile(GX.T, (T, 1)) dists = Q + R - 2 * X * X.T dists = dists - np.tril(dists) dists = np.reshape(dists, (T**2, 1)) widthX = np.sqrt(0.5 * np.median(dists[np.where(dists > 0)])) widthX = widthX * 2.5 # kernel width theta = 1 / (widthX**2) H = np.eye(T) - np.ones((T, T)) / T K...
Python
1
enum_bits::EnumBits; #[repr(u128)] #[derive(Debug, EnumBits, PartialEq)] #[allow(non_camel_case_types)] enum TestEnum { Foo_451 = 451, Bar_1235 = 1235, Baz_1224 = 1224, Baz_1225, Baz_119644343981971758317424540861054977901 = 119644343981971758317424540861054977901, Biz_44 = 88 / 2, Zero = 0...
Rust
0
ng[(self.mypos + 2) % 4], 27, 1) # 对家剩余的牌数 # print(teammate_num_cards_left) teammate_num_cards_left_batch = np.repeat(teammate_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) up_num_cards_left = _get_one_hot_array(self.remaining[(self.mypos + 3) % 4], 27, 1) # 上家剩余的牌数 ...
Python
1
or, Error}; use handles::map; use utils; // rgb -> rgba(81%,89%,12%,1),rgb(81,89,12),rgba(81%,89%,12%,0.3) etc.. // return -> [0.81,0.89,0.12,1],[0.81,0.89,0.12],[0.81,0.89,0.12,0.3] etc... pub fn handle_rgb(color: &Color) -> Result<Vec<f32>, Error> { let re = Regex::new(r"(?i)rgba?\(\s*(?P<r>\d{1,3}\.?\d*%?)\s*,\s*(...
Rust
0
l_path", type=str, required=True, help="Path to the source model" ) parser.add_argument( "--target_config_path", type=str, required=True, help="Path to the target model config", ) parser.add_argument( "--output_path", type=str, required=True, help="Path to save th...
Python
1
, 'ISpeechMemoryStream', 'DISPID_SVEStreamEnd', 'DISPID_SPRulesItem', 'DISPID_SRRDiscardResultInfo', 'IInternetSecurityMgrSite', 'DISPID_SOTDataKey', 'SSFMCreateForWrite', 'STCRemoteServer', 'DISPID_SAStatus', 'SPAR_Unknown', 'DISPID_SpeechObjectTokens', 'SPWT_DISPLAY', 'eLEXTYPE_RESERVED7', 'SPVPRI...
Python
1
Map; use serde_json; use serde_json::Value; use serde_json::value::Map; use error; use pair::Pair; use pair::Pair::*; lazy_static! { static ref PAIRS_STRING: BidirMap<Pair, &'static str> = { let mut m = BidirMap::new(); m.insert(BTC_ETH, "BTC_ETH"); m.insert(BTC_ZEC, "BTC_ZEC"); m ...
Rust
0
-[0-9A-F]{4}-[0-9A-F]{12}"), ("Generic Secret", "[s|S][e|E][c|C][r|R][e|E][t|T].{0,30}['\"\\s][0-9a-zA-Z]{32,45}['\"\\s]"), ("Generic API Key", "[a|A][p|P][i|I][_]?[k|K][e|E][y|Y].{0,30}['\"\\s][0-9a-zA-Z]{32,45}['\"\\s]"), ("Slack Webhook", "https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a...
Rust
0
[2, 0, 1, 0], output_name_to_node, ) if path3 is None: path3 = self.model.match_parent_path( concat_node, ["Unsqueeze", "Mul", "Squeeze", "Slice", "Shape"], [2, 0, 1, 0, 0], output_na...
Python
1
to_css<W>(&self, dest: &mut W) -> core::fmt::Result where W: std::fmt::Write, { match self { KeyframesName::Ident(ident) => ident.to_css(dest), KeyframesName::QuotedString(value) => dest.write_fmt(format_args!("\"{}\"", value)), } } } <gh_stars>1-10 //! Struct that extract part of file (called block) an...
Rust
0
1]}, params_ranges = {'power' : (1, 1)}, params_equality_ranges = None) trig_tokens = TrigonometricTokens(dimensionality = dimensionality) ''' Method epde_search.fit() is used to initiate the equation search. ''' ...
Python
1
ub const PROC_SUPER_MAGIC: u32 = 40864; pub const QNX4_SUPER_MAGIC: u32 = 47; pub const REISERFS_SUPER_MAGIC: u32 = 1382369651; pub const REISERFS_SUPER_MAGIC_STRING: &'static [u8; 9usize] = b"ReIsErFs\0"; pub const REISER2FS_SUPER_MAGIC_STRING: &'static [u8; 10usize] = b"ReIsEr2Fs\0"; pub const REISER2FS_JR_SUPER_MAGI...
Rust
0
alert response. Returns: str: String representation """ return ( f"<AlertResponse(id={self.id}, type={self.alert_type}, model={self.alert_model}, " f"pod={self.pod_id}, node={self.node_id}, " f"created_at={self.created_at})>" ) def __...
Python
1
f: for line in f: if "download" in line: return line.split()[-1] return "" # def upload_blob(bucket_name, source_file_name, destination_blob_name): # # Uploads a file to a bucket # # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python # ...
Python
1
ones = sin_c1.new_ones(sin_c1.shape) c1_rots = sin_c1.new_zeros((*sin_c1.shape, 3, 3)) c1_rots[..., 0, 0] = cos_c1 c1_rots[..., 0, 1] = -1 * sin_c1 c1_rots[..., 1, 0] = sin_c1 c1_rots[..., 1, 1] = cos_c1 c1_rots[..., 2, 2] = 1 norm = torch.sqrt(eps + c_x ** 2 ...
Python
1
from itertools import combinations data = open('8').read().split('\n') antennas = {} antinodes = {} for r,line in enumerate(data): for c,val in enumerate(line): if val != '.' and val in antennas: antennas[val].append((r,c)) elif val != '.' and val not in antennas: antennas[...
Python
1
} #[cfg(feature = "std")] fn log2(self) -> Self { self.map_assert(Real::log2) } #[cfg(feature = "std")] fn log10(self) -> Self { self.map_assert(Real::log10) } #[cfg(feature = "std")] fn ln_1p(self) -> Self { self.map_assert(Real::ln_1p) } #[cfg(fe...
Rust
0
rator"), Operator::Until => write!(f, "until operator"), Operator::Release => write!(f, "release operator"), Operator::WeakUntil => write!(f, "weak until operator"), Operator::StrongRelease => write!(f, "strong release operator"), } } } /// A Lexer over an it...
Rust
0
nsafe extern "C" fn notify_async_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA<BaseSink> { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) } unsafe extern...
Rust
0
ult_artifact_id"], ["id"], ondelete="SET NULL", use_alter=True, ) with op.batch_alter_table("task_run_state", schema=None) as batch_op: batch_op.add_column( sa.Column( "result_artifact_id", prefect.server.utilities.data...
Python
1
from django.urls import path from .views import list_books, LibraryDetailView, register, LoginView, LogoutView from .views import * from . import views url_patterns = [ path('booklist/',list_books), path('librarydetail/', LibraryDetailView.as_view()), path('register/', views.register), path('admin/', a...
Python
1
} } Target::Buffer(_) => Ok(()), Target::Gif(target) => { target .flush_frame(self.buffer.borrow_buffer()) .map_err(DrawingErrorKind::DrawingError)?; self.saved = true; Ok(()) ...
Rust
0
cy, 'total_questions': len(gt_answers), 'total_predictions': len(results), 'all_answers': all_answers } with open(dst, 'w') as f: json.dump(eval_results, f) print(f'Evaluation results saved to {dst}') regnerated_results = { 'total_questions': len(regenerate...
Python
1
_extendedprice * (1 - l_discount) * (1 + l_tax))"; assert_parse!(c, func_call_expr); assert_parse!( "d_month_seq between (select distinct d_month_seq+1 from date_dim where d_year = 1998 and d_moy = 1) and (select dis...
Rust
0
atch self.addr { IpAddr::V4(addr) => u32::from(addr) as u128, IpAddr::V6(addr) => u128::from(addr), }; match self.port { Some(p) => write!( f, "address: {}, port: {}, hex: {:x} (IPv{})", self.addr, p, hex, ipv ...
Rust
0
ON TABLES TO {pg_username}; ALTER DEFAULT PRIVILEGES IN SCHEMA {schema} GRANT SELECT ON SEQUENCES TO {pg_username}; """) cur.execute(f"GRANT CONNECT ON DATABASE {pg_db_name} TO {pg_username};") conn.commit() lo...
Python
1
= old_items.count() old_items.delete() db.commit() db.close() logger.info("Old data cleanup completed", deleted_items=deleted_count) return { "status": "completed", "deleted_items": deleted_count, "timestamp": dateti...
Python
1
way_xdns_record.gateway_abi.hasher, ) { log::trace!( target: "circuit-runtime", "Step confirmation check failed: inclusion root mismatch. Expected: {}, computed: {}", expected_root, computed_root, ...
Rust
0
try: strength_service.create_strength(StrengthEntity(name=name)) except Exception as e: logging.debug("强度 %s 已存在或创建失败: %s", name, e) except Exception as e: logging.warning("⚠️ 强度初始化失败: %s", e) # 创建默认提示词 try: pr...
Python
1
is_some()); let _ = dead_chans; } #[test] fn select_one() { do run_in_newsched_task { select_helper(1, [0]) } } #[test] fn select_two() { // NB. I would like to have a test that tests the first one that is // ready is the one that's returned, but that can't be r...
Rust
0
from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional from .base import TelegramObject class StarAmount(TelegramObject): """ Describes an amount of Telegram Stars. Source: https://core.telegram.org/bots/api#staramount """ amount: int """Integer amount of Telegr...
Python
1
, 0x00, 0x00]) // int 0x80 .instr([0xcd, 0x80]) // // Close memory file. // // mov eax, 6 .instr([0xb8, 0x06, 0x00, 0x00, 0x00]) // int 0x80 .instr([0xcd, 0x80]) // // Make a new call frame. // // push ebp .i...
Rust
0
s: HashMap<String, AuditDependency> = HashMap::new(); // let start = Instant::now(); // for res in responses { // let version = res.version; // let packages = &res.versions.get(&version).unwrap().packages; // for package in packages { // let flatte...
Rust
0
"""Support for the demo for speech-to-text service.""" from __future__ import annotations from collections.abc import AsyncIterable from homeassistant.components.stt import ( AudioBitRates, AudioChannels, AudioCodecs, AudioFormats, AudioSampleRates, SpeechMetadata, SpeechResult, Speech...
Python
1
""" An example demonstrating tool-based generative UI. """ from crewai.flow.flow import Flow, start from copilotkit.crewai import copilotkit_stream, CopilotKitState from litellm import completion # This tool generates a haiku on the server. # The tool call will be streamed to the frontend as it is being generated. G...
Python
1
_USE_SELF_COLLISION`](`Self::URDF_USE_SELF_COLLISION`). const URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS = 32; const URDF_RESERVED = 64; /// will use a smooth implicit cylinder. By default, Bullet will tesselate the cylinder /// into a convex hull. const URDF_USE_IMPLICIT_CYLIND...
Rust
0
\r:message-type\x07\0\x05event{}\xac\xaek}"; let event_msg = EventStreamMessage::parse(&mut &data[..]); assert_eq!(event_msg, Err(EventStreamParseError::InvalidCrc)); } #[test] fn invalid_message_crc() { let data = b"\0\0\0r\0\0\0`\xab\x82\r\x9e\x0b:event-type\x07\0\x10initial-...
Rust
0
g=#b7af9f guibg=#202020 def Decompose(hexval): return float(int(hexval[0:2], 16)), float(int(hexval[2:4], 16)), float(int(hexval[4:6], 16)) def Normalize(r, g, b): magsqr = r*r + g*g + b*b if magsqr < 0.0001: return 0.0, 0.0, 0.0 n = 1.0 / math.sqrt(magsqr) return r*n, g*n, b*n def ColorD...
Python
1