Etherll/Mellum-4b-sft-rust-GGUF
Text Generation • 4B • Updated • 178 • 4
file_name large_stringlengths 4 69 | prefix large_stringlengths 0 26.7k | suffix large_stringlengths 0 24.8k | middle large_stringlengths 0 2.12k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
main.rs | use maplit::btreeset;
use reduce::Reduce;
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned};
use std::{
collections::{BTreeMap, BTreeSet},
ops::{BitAnd, BitOr},
};
/// a compact index
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Index {
/// the strings table
strin... | }
fn main() {
let strings = (0..5000).map(|i| {
let fizz = i % 3 == 0;
let buzz = i % 5 == 0;
if fizz && buzz {
btreeset!{"fizzbuzz".to_owned(), "com.somecompany.somenamespace.someapp.sometype".to_owned()}
} else if fizz {
btreeset!{"fizz".to_owned(), "org.sc... | Ok(serde_cbor::from_slice(&decompressed)?)
}
fn borrow_inner(elements: &[BTreeSet<String>]) -> Vec<BTreeSet<&str>> {
elements.iter().map(|x| x.iter().map(|e| e.as_ref()).collect()).collect() | random_line_split |
main.rs | use maplit::btreeset;
use reduce::Reduce;
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned};
use std::{
collections::{BTreeMap, BTreeSet},
ops::{BitAnd, BitOr},
};
/// a compact index
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Index {
/// the strings table
strin... |
fn and(e: Vec<Expression>) -> Self {
Self::And(
e.into_iter()
.flat_map(|c| match c {
Self::And(es) => es,
x => vec![x],
})
.collect(),
)
}
/// convert the expression into disjunctive normal ... | {
Self::Or(
e.into_iter()
.flat_map(|c| match c {
Self::Or(es) => es,
x => vec![x],
})
.collect(),
)
} | identifier_body |
main.rs | use maplit::btreeset;
use reduce::Reduce;
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned};
use std::{
collections::{BTreeMap, BTreeSet},
ops::{BitAnd, BitOr},
};
/// a compact index
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Index {
/// the strings table
strin... | (e: Vec<Expression>) -> Self {
Self::Or(
e.into_iter()
.flat_map(|c| match c {
Self::Or(es) => es,
x => vec![x],
})
.collect(),
)
}
fn and(e: Vec<Expression>) -> Self {
Self::And(
... | or | identifier_name |
main.rs | use maplit::btreeset;
use reduce::Reduce;
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned};
use std::{
collections::{BTreeMap, BTreeSet},
ops::{BitAnd, BitOr},
};
/// a compact index
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Index {
/// the strings table
strin... |
}
}
Ok(Index {
strings: strings.into_iter().collect(),
elements,
})
}
}
impl Index {
/// given a query expression in Dnf form, returns all matching indices
pub fn matching(&self, query: Dnf) -> Vec<usize> {
// lookup all strings and trans... | {
return Err(serde::de::Error::custom("invalid string index"));
} | conditional_block |
xterm.rs | use with [`OwoColorize::color`](OwoColorize::color)
/// or [`OwoColorize::on_color`](OwoColorize::on_color)
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum XtermColors {
$(
#[allow(missing_docs)]
$name,
)*
... | fn from(color: XtermColors) -> Self {
match color {
$(
XtermColors::$name => $xterm_num,
)*
}
}
}
}
$(
#[allow(missing_docs)]
... | impl From<XtermColors> for u8 { | random_line_split |
base.rs | use std::marker::PhantomData;
use std::rc::Rc;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use ::serial::SerialGen;
use ::traits::ReteIntrospection;
use ::builder::{AlphaTest, ConditionInfo, KnowledgeBuilder};
use ::network::ids::*;
use ::builders::ids::{StatementId, RuleId};
use runtime::memory... | t: PhantomData<T>
}
impl<T: ReteIntrospection> KnowledgeBase<T> {
pub fn compile(builder: KnowledgeBuilder<T>) -> KnowledgeBase<T> {
let (string_repo, rules, condition_map) = builder.explode();
let (hash_eq_nodes, alpha_network, statement_memories) = Self::compile_alpha_network(condition_map... | }
}
pub struct KnowledgeBase<T: ReteIntrospection> { | random_line_split |
base.rs | use std::marker::PhantomData;
use std::rc::Rc;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use ::serial::SerialGen;
use ::traits::ReteIntrospection;
use ::builder::{AlphaTest, ConditionInfo, KnowledgeBuilder};
use ::network::ids::*;
use ::builders::ids::{StatementId, RuleId};
use runtime::memory... | else {
unreachable!("Unexpected comparison. HashEq must be set");
}
});
let mut node_id_gen = LayoutIdGenerator::new();
let mut hash_eq_nodes = HashMap::new();
let mut statement_memories: HashMap<StatementId, MemoryId> = HashMap::new();
let mut al... | {
hash1.dependents.len().cmp(&hash2.dependents.len()).then(tests1.len().cmp(&tests2.len()))
} | conditional_block |
base.rs | use std::marker::PhantomData;
use std::rc::Rc;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use ::serial::SerialGen;
use ::traits::ReteIntrospection;
use ::builder::{AlphaTest, ConditionInfo, KnowledgeBuilder};
use ::network::ids::*;
use ::builders::ids::{StatementId, RuleId};
use runtime::memory... | <I: Into<MemoryId> + AlphaMemoryId>(&mut self, id: I, val: Rc<T>) {
let mem_id = id.into();
self.mem.entry(mem_id)
.or_insert_with(Default::default)
.insert(val);
}
}
pub struct AlphaNetwork<T: ReteIntrospection> {
hash_eq_node: HashMap<T::HashEq, HashEqNode>,
alpha_ne... | insert | identifier_name |
base.rs | use std::marker::PhantomData;
use std::rc::Rc;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use ::serial::SerialGen;
use ::traits::ReteIntrospection;
use ::builder::{AlphaTest, ConditionInfo, KnowledgeBuilder};
use ::network::ids::*;
use ::builders::ids::{StatementId, RuleId};
use runtime::memory... |
}
pub enum BetaNodeType {
And(MemoryId, MemoryId)
}
pub struct BetaNode {
id: BetaId,
b_type: BetaNodeType,
destinations: Vec<DestinationNode>
}
pub struct BetaNetwork {
b_network: Vec<BetaNode>
}
pub struct BetaMemory {
tripwire: Vec<bool>,
}
| {
let rc = Rc::new(val);
if !self.store.insert(rc.clone()) {
self.store.get(&rc).unwrap().clone()
} else {
rc
}
} | identifier_body |
lib.rs | #![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy_pedantic", warn(clippy_pedantic))]
// Clippy doesn't like this pattern, but I do. I may consider changing my mind
// on this in the future, just to make clippy happy.
#![cfg_attr(all(feature="cli... |
}
}
impl<'a> fmt::Debug for HashlifeCache<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<Hashlife instance>")
}
}
impl<'a> Node<'a> {
pub fn to_raw(&self) -> RawNode<'a> {
self.raw
}
pub fn hashlife_instance(&self) -> Hashlife<'a> {
self.hl
... | {
self.node_block(make_2x2(|_,_| self.random_block(rng, lg_size-1)))
} | conditional_block |
lib.rs | #![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy_pedantic", warn(clippy_pedantic))]
// Clippy doesn't like this pattern, but I do. I may consider changing my mind
// on this in the future, just to make clippy happy.
#![cfg_attr(all(feature="cli... | /// Hashlife algorithm.
///
/// This is the raw version of big stepping.
pub fn raw_evolve(&self, node: RawNode<'a>) -> RawBlock<'a> {
evolve::evolve(self, node, node.lg_size() - LG_LEAF_SIZE - 1)
}
/// Given 2^(n+1)x2^(n+1) node `node`, progress it 2^(n-1) generations and
/// retur... | /// Given 2^(n+1)x2^(n+1) node `node`, progress it 2^(n-1) generations and
/// return 2^nx2^n block in the center. This is the main component of the | random_line_split |
lib.rs | #![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy_pedantic", warn(clippy_pedantic))]
// Clippy doesn't like this pattern, but I do. I may consider changing my mind
// on this in the future, just to make clippy happy.
#![cfg_attr(all(feature="cli... |
pub fn unwrap_node(self) -> Node<'a> {
self.destruct().unwrap()
}
pub fn lg_size(&self) -> usize {
self.lg_size
}
pub fn lg_size_verified(&self) -> Result<usize, ()> {
Ok(self.lg_size())
}
pub fn is_blank(&self) -> bool {
self.raw.is_blank()
}
}
impl... | {
self.destruct().unwrap_err()
} | identifier_body |
lib.rs | #![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy_pedantic", warn(clippy_pedantic))]
// Clippy doesn't like this pattern, but I do. I may consider changing my mind
// on this in the future, just to make clippy happy.
#![cfg_attr(all(feature="cli... | (&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<Hashlife instance>")
}
}
impl<'a> Node<'a> {
pub fn to_raw(&self) -> RawNode<'a> {
self.raw
}
pub fn hashlife_instance(&self) -> Hashlife<'a> {
self.hl
}
pub fn evolve(&self) -> Block<'a> {
self.hl.bl... | fmt | identifier_name |
easy.rs | use super::*;
use crate::utils::over;
pub fn init<B: Backend>(
window: &crate::windowing::window::Window,
name: &str,
version: u32,
) -> Result<
(
B::Instance,
B::Surface,
Format,
Adapter<B>,
B::Device,
QueueGroup<B>,
B::CommandPool,
),
&... | .find(|format| format.base_format().1 == ChannelType::Srgb)
.unwrap_or(default_format)
};
let (device, queue_group) = {
let queue_family = adapter
.queue_families
.iter()
.find(|family| {
surface.supports_queue_family(family) && fam... | {
let instance = B::Instance::create(name, version).map_err(|_| "unsupported backend")?;
let surface = unsafe {
instance
.create_surface(window)
.map_err(|_| "create_surface failed")?
};
let adapter = instance.enumerate_adapters().remove(0);
let surface_color_format ... | identifier_body |