file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | 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 norma... | {
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 | macro_rules! xterm_colors {
($(
$xterm_num:literal $name:ident ($r:literal, $g:literal, $b:literal)
)*) => {
pub(crate) mod dynamic {
use core::fmt;
#[allow(unused_imports)]
use crate::OwoColorize;
/// Available Xterm colors for use with [`OwoCo... | fn from(color: XtermColors) -> Self {
match color {
$(
XtermColors::$name => $xterm_num,
)*
}
}
}
}
$(
#[allow(missing_docs)]
... | impl From<XtermColors> for u8 { | random_line_split |
gtmaps.py | import numpy as np
import math
import sys
import glob
import os
import json
import random
import copy
from skimage.measure import regionprops, label
def get_file(rn = 302, task_index = 1, trial_num = 0):
folders = sorted(glob.glob('/home/hom/alfred/data/json_2.1.0/train/*'+repr(rn))) #for home com... |
def surrounding_patch(agentloc, labeled_grid, R = 16, unreach_value = -1): #returns a visibility patch centered around the agent with radius R
#unreach_value = -1
mat = labeled_grid
position = agentloc
r=copy.copy(R)
init_shape = copy.copy(mat.shape)
p = copy.copy(position)
... | for j in range(mat.shape[1]):
d = repr(j)
if j<10:
d = '0'+d
print(d,end = '')
print(" ",end = '')
print(" ")
print(" ")
for i in range(mat.shape[0]):
for j in range(mat.shape[1]):
d = 0
if argmax:
d... | identifier_body |
gtmaps.py | import numpy as np
import math
import sys
import glob
import os
import json
import random
import copy
from skimage.measure import regionprops, label
def get_file(rn = 302, task_index = 1, trial_num = 0):
folders = sorted(glob.glob('/home/hom/alfred/data/json_2.1.0/train/*'+repr(rn))) #for home com... | print(" ",end = '')
print(" --",repr(i))
#print(" ")
def surrounding_patch(agentloc, labeled_grid, R = 16, unreach_value = -1): #returns a visibility patch centered around the agent with radius R
#unreach_value = -1
mat = labeled_grid
position = agentloc
r=copy... | if locator[2]==180:
d = '<' #"\u2190" #left arrow
print(d,end = '')
| random_line_split |
gtmaps.py | import numpy as np
import math
import sys
import glob
import os
import json
import random
import copy
from skimage.measure import regionprops, label
def get_file(rn = 302, task_index = 1, trial_num = 0):
folders = sorted(glob.glob('/home/hom/alfred/data/json_2.1.0/train/*'+repr(rn))) #for home com... |
else:
prettyprint(o_grids[obj+'|'])
save = input("Save data ? (y/n)")
if save=='y':
np.save(fname,o_grids) #overwrites the existing one
| prettyprint(o_grids[obj]) | conditional_block |
gtmaps.py | import numpy as np
import math
import sys
import glob
import os
import json
import random
import copy
from skimage.measure import regionprops, label
def get_file(rn = 302, task_index = 1, trial_num = 0):
folders = sorted(glob.glob('/home/hom/alfred/data/json_2.1.0/train/*'+repr(rn))) #for home com... | (env,event):
#sometimes in a room there are fixed objects which cannot be removed from scene using disable command
#so need to go near them to check distance and then map them
return
def gtmap(env,event):
objs = event.metadata['objects']
print("There are a total of ",len(objs)," objects ... | touchmap | identifier_name |
corpus_wikipedia.py | from __future__ import print_function
import csv
import os
from sys import maxsize
import pickle
import tensorflow as tf
import numpy as np
import spacy
import constants
import corpus
import preprocessing
import sequence_node_sequence_pb2
import tools
import random
from multiprocessing import Pool
import fnmatch
imp... |
if __name__ == '__main__':
sentence_processor = getattr(preprocessing, FLAGS.sentence_processor)
out_dir = os.path.abspath(os.path.join(FLAGS.corpus_data_output_dir, sentence_processor.func_name))
if not os.path.isdir(out_dir):
os.makedirs(out_dir)
out_path = os.path.join(out_dir, FLAGS.corp... | out_fn = ntpath.basename(out_path)
print('parse articles ...')
child_idx_offset = 0
for offset in range(0, max_articles, batch_size):
# all or none: otherwise the mapping lacks entries!
#if not careful or not os.path.isfile(out_path + '.data.batch' + str(offset)) \
# or not o... | identifier_body |
corpus_wikipedia.py | from __future__ import print_function
import csv
import os
from sys import maxsize
import pickle
import tensorflow as tf
import numpy as np
import spacy
import constants
import corpus
import preprocessing
import sequence_node_sequence_pb2
import tools
import random
from multiprocessing import Pool
import fnmatch
imp... |
return parser
def parse_articles(out_path, parent_dir, in_filename, parser, mapping, sentence_processor, max_depth, max_articles, batch_size, tree_mode):
out_fn = ntpath.basename(out_path)
print('parse articles ...')
child_idx_offset = 0
for offset in range(0, max_articles, batch_size):
... | if not os.path.isfile(out_filename + '.children.depth' + str(current_depth)):
preprocessing.merge_numpy_batch_files(out_base_name + '.children.depth' + str(current_depth), parent_dir) | conditional_block |
corpus_wikipedia.py | from __future__ import print_function
import csv
import os
from sys import maxsize
import pickle
import tensorflow as tf
import numpy as np
import spacy
import constants
import corpus
import preprocessing
import sequence_node_sequence_pb2
import tools
import random
from multiprocessing import Pool
import fnmatch
imp... | articles_from_csv_reader,
sentence_processor, parser, mapping,
args={
'filename': in_filename,
'max_articles': min(batch_size, max_articles),
'skip': offset
},
max_depth=max_depth,
batch_size=batch_si... | #if not careful or not os.path.isfile(out_path + '.data.batch' + str(offset)) \
# or not os.path.isfile(out_path + '.parent.batch' + str(offset)) \
# or not os.path.isfile(out_path + '.depth.batch' + str(offset)) \
# or not os.path.isfile(out_path + '.children.batch'... | random_line_split |
corpus_wikipedia.py | from __future__ import print_function
import csv
import os
from sys import maxsize
import pickle
import tensorflow as tf
import numpy as np
import spacy
import constants
import corpus
import preprocessing
import sequence_node_sequence_pb2
import tools
import random
from multiprocessing import Pool
import fnmatch
imp... | (out_path, parent_dir, in_filename, parser, mapping, sentence_processor, max_depth, max_articles, batch_size, tree_mode):
out_fn = ntpath.basename(out_path)
print('parse articles ...')
child_idx_offset = 0
for offset in range(0, max_articles, batch_size):
# all or none: otherwise the mapping la... | parse_articles | identifier_name |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 41