query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
r"""Ensures that the targets are in a onehot format rather than an index format.
def ensure_targets_one_hot(input: torch.Tensor, targets: torch.Tensor, num_classes: Optional[int] = None) -> torch.Tensor: if infer_target_type(input, targets) == 'indices': # If the number of classes isn't specified, attempt to infer it from the input ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_one_hot(targets, num_classes):\n ret = np.zeros((num_classes, targets.shape[0]))\n ret[targets, np.arange(targets.size)] = 1\n return ret", "def infer_target_type(input: torch.Tensor, targets: torch.Tensor) -> str:\n if input.shape == targets.shape:\n return 'one_hot'\n ...
[ "0.70892847", "0.70067805", "0.6761015", "0.6672298", "0.652522", "0.64999425", "0.6430373", "0.62493813", "0.62427723", "0.6210333", "0.6210333", "0.6210333", "0.6210333", "0.616038", "0.6130909", "0.609137", "0.6088862", "0.60704434", "0.6039818", "0.60286826", "0.6021816",...
0.75631934
0
Checks if a given set of targets are indices by looking at the type.
def check_for_index_targets(targets: torch.Tensor) -> bool: index_dtypes = [torch.uint8, torch.int8, torch.int16, torch.int32, torch.int64] return targets.dtype in index_dtypes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _idxs_are_present(self, *args):\n return set(args).issubset(set(range(self.n_atoms)))", "def test_where_targets():\n num_multi_targets = 0\n for where_targets_day in where_targets:\n # All inputs have a label\n assert np.all(where_targets_day.sum(axis=3).sum(axis=3).sum(axis=1).sum...
[ "0.60485214", "0.5889833", "0.5874883", "0.5825459", "0.5714331", "0.5704013", "0.56712264", "0.5618384", "0.55533653", "0.5513131", "0.5502767", "0.54754364", "0.54153454", "0.53931", "0.5359128", "0.53402877", "0.5328796", "0.5318108", "0.53159976", "0.52739215", "0.5260177...
0.8416542
0
Converts a tensor of index class labels to a tensor of onehot class labels.
def _one_hot(tensor: torch.Tensor, num_classes: int = -1, dim: int = -1) -> torch.Tensor: if not check_for_index_targets(tensor): raise ValueError(f'tensor must be integer type, current type: {tensor.dtype}') max_index = tensor.max() + 1 if num_classes == -1: num_classes = int(max_index) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_one_hot(labels, num_classes):\n shape = labels.size()\n shape = shape + (num_classes,)\n one_hot = torch.FloatTensor(shape)\n one_hot.zero_()\n dim = 1 if len(shape) == 2 else 2\n one_hot.scatter_(dim, labels.unsqueeze(-1), 1)\n return one_hot", "def to_onehot(labels: torch.Tensor, nu...
[ "0.84751815", "0.8467954", "0.8271096", "0.8237347", "0.82299304", "0.81946796", "0.81946796", "0.81946796", "0.81946796", "0.8180447", "0.8169154", "0.8150191", "0.8135966", "0.8088832", "0.808789", "0.8087213", "0.80652124", "0.8063023", "0.8018135", "0.8018135", "0.7935499...
0.81189996
13
read out content of console nondestructive
def read(self): return ''.join(self.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readlines():\n while 1:\n line = nb_server.stdout.readline().decode(\"utf-8\").strip()\n if line:\n print(line)", "def read():\n print(command(\"R\"))", "def console():\r\n while True:\r\n interpret_command(input(\"POM> \"))", "def readOutput(self)...
[ "0.6714941", "0.65332526", "0.6337211", "0.63157356", "0.6290675", "0.62303823", "0.6185881", "0.61685926", "0.61524415", "0.61488354", "0.61348", "0.6057315", "0.6021494", "0.6005213", "0.595756", "0.5953287", "0.5947921", "0.59435844", "0.5930646", "0.5894437", "0.5890957",...
0.0
-1
Show the content of the command console on the screen.
def show(self): self.set_text(self.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showConsole(self):\n self.console.show()", "def console(self):\n fricas_console()", "def _display_command(self):\n idx = self.current_idx # Local copy to avoid race condition updates\n output = self.outputs[idx]\n if output is None:\n self.screen.addstr('Waiti...
[ "0.7871232", "0.73963773", "0.71685517", "0.7015381", "0.6897797", "0.68918306", "0.6850967", "0.6628928", "0.6608375", "0.65925175", "0.65554076", "0.65428865", "0.6478846", "0.6471501", "0.6461188", "0.645867", "0.6422905", "0.63885444", "0.634886", "0.63315326", "0.6322423...
0.6261664
24
Split the command, and the arguments. Returns a tuple of the command, and another for args.
def parse(self): # if empty, return False, instead of crashing if not self.content: return False command = ''.join(self.content).split(' ') # return first element, then the rest return [command[0], (command[1:])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _command_and_args(tokens: List[str]) -> Tuple[str, str]:\n command = ''\n args = ''\n\n if tokens:\n command = tokens[0]\n\n if len(tokens) > 1:\n args = ' '.join(tokens[1:])\n\n return command, args", "def split_command_input(command):\n args = com...
[ "0.7808273", "0.7583199", "0.73445207", "0.7174779", "0.71467346", "0.71250147", "0.712263", "0.71033084", "0.7046168", "0.66356814", "0.6511596", "0.6393975", "0.6374057", "0.63612664", "0.6310978", "0.628176", "0.6180036", "0.6168099", "0.60368687", "0.5932526", "0.5896223"...
0.0
-1
Convert a job string (dba, svg, dxf, or gcode).
def convert(job, optimize=True, tolerance=conf['tolerance'], matrix=None): type_ = get_type(job) if type_ == 'dba': if type(job) is bytes: job = job.decode('utf-8') if type(job) is str: job = json.loads(job) if optimize: if 'defs' in job: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(job):\n # figure out type\n if type(job) is dict:\n type_ = 'dba'\n elif type(job) in [str, bytes]:\n if type(job) is bytes:\n job = job.decode('utf-8')\n jobheader = job[:1024].lstrip()\n if jobheader and jobheader[0] == '{':\n type_ = 'dba'\...
[ "0.584424", "0.5817721", "0.577906", "0.56308305", "0.53230834", "0.52930534", "0.51798236", "0.5088676", "0.5066885", "0.5064404", "0.5053654", "0.50107867", "0.49824375", "0.49557483", "0.49440598", "0.49340597", "0.48770815", "0.48703986", "0.48525834", "0.48219013", "0.48...
0.62155473
0
Transform the coordinates in the job with the supplied matrix.
def apply_alignment_matrix(job, matrix): # Get the SVG-style 6-element vector from the 3x3 matrix mat = [matrix[0][0], matrix[1][0], matrix[0][1], matrix[1][1], matrix[0][2], matrix[1][2]] # Only the 'defs' list contains coordinates that need to be transformed defs = job['defs'] for one_def in def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform(self, matrix):\n for x in list(self.keys()):\n ar = self[x]\n if len(ar.shape) == 2 and ar.shape[1] == 3:\n self[x] = np.dot(matrix, ar.transpose()).transpose()", "def rotate(self, matrix):\n newCoord = np.zeros(self.coord.shape)\n newCoord...
[ "0.6915339", "0.6722252", "0.6568061", "0.6561562", "0.6331745", "0.6174493", "0.60698354", "0.60259205", "0.60166734", "0.59876084", "0.59857154", "0.5972357", "0.58933765", "0.5886011", "0.5846207", "0.58090484", "0.57578796", "0.5745067", "0.5734967", "0.5705985", "0.56998...
0.6591964
2
Read a svg file string and convert to dba job.
def read_svg(svg_string, workspace, tolerance, forced_dpi=None, optimize=True): svgReader = SVGReader(tolerance, workspace) res = svgReader.parse(svg_string, forced_dpi) # {'boundarys':b, 'dpi':d, 'lasertags':l, 'rasters':r} # create an dba job from res # TODO: reader should generate an dba job to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename, imageprops):\n with gzip.open(filename, 'rb') as f:\n file_content = f.read()\n return parse_svg.parse_svg_string(file_content, imageprops, \"en\")", "def convert(filename,\nRenderer: \"\"\"By default, the schematic is converted to an SVG file,\n written to the standard out...
[ "0.583088", "0.5518693", "0.52893054", "0.5273715", "0.521292", "0.5151042", "0.50893706", "0.5085327", "0.5066948", "0.5044671", "0.50433487", "0.4998983", "0.49872452", "0.4840981", "0.48366708", "0.47892964", "0.47813255", "0.4772477", "0.47670302", "0.47522056", "0.474910...
0.65959406
0
Read a dxf file string and optimize returned value.
def read_dxf(dxf_string, tolerance, optimize=True): dxfParser = DXFParser(tolerance) # second argument is the forced unit, TBI in Driverboard job = dxfParser.parse(dxf_string, None) if 'vector' in job: if optimize: vec = job['vector'] pathoptimizer.dxf_optimize(vec['paths...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readstring(self, fstring):\n return self.parse(fstring)", "def readfile(filename, encoding=None, legacy_mode=False):\n if not is_dxf_file(filename):\n raise IOError(\"File '{}' is not a DXF file.\".format(filename))\n\n info = dxf_file_info(filename)\n with io.open(filename, mode='rt',...
[ "0.6891667", "0.61871874", "0.61306417", "0.6099318", "0.6006468", "0.59101367", "0.5892573", "0.58453", "0.57657695", "0.57569593", "0.57072806", "0.56301016", "0.5602342", "0.5579656", "0.55789405", "0.557593", "0.55731946", "0.5565903", "0.5554117", "0.55455285", "0.554523...
0.67127746
1
Read a gcode file string and convert to dba job.
def read_gcode(gcode_string, tolerance, optimize=False): reader = GcodeReader() job = reader.parse(gcode_string) if optimize: pass return job
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_gcode(filename):\n\t##TODO: parse/read file line by line for memory considerations\n\twith open(filename, 'r') as fh_in:\n\t\tgcode_raw = fh_in.readlines()\n\t\tgcode_raw = [gcode.rstrip(';\\n') for gcode in gcode_raw] # stripping off trailing semicolon and newlines\n\treturn gcode_raw", "def read_code(...
[ "0.605922", "0.56325203", "0.5597015", "0.55194545", "0.5511298", "0.5441651", "0.53879595", "0.536156", "0.5337163", "0.52230054", "0.51988596", "0.5162434", "0.51498", "0.51092756", "0.5086217", "0.5081328", "0.50811666", "0.5080986", "0.50737935", "0.50295", "0.501998", ...
0.6651488
0
Figure out file type from job string.
def get_type(job): # figure out type if type(job) is dict: type_ = 'dba' elif type(job) in [str, bytes]: if type(job) is bytes: job = job.decode('utf-8') jobheader = job[:1024].lstrip() if jobheader and jobheader[0] == '{': type_ = 'dba' elif '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_type(file_str):\n process_list = [\"file\", \"--mime-type\", file_str]\n p = subprocess.Popen(process_list, stdout=subprocess.PIPE)\n file_type, err = p.communicate()\n\n return file_type.decode(\"utf-8\")", "def find_file_type(file_str):\n try:\n #p = subprocess.Popen(\n ...
[ "0.70865875", "0.6961908", "0.6805858", "0.66984457", "0.66983753", "0.66839826", "0.65622485", "0.6553481", "0.6537292", "0.65352625", "0.6480396", "0.6473575", "0.6473575", "0.6421381", "0.6342401", "0.631688", "0.63012516", "0.62735415", "0.6210128", "0.6163858", "0.615030...
0.77883315
0
Return nodes in tree with value of term
def find_matches(term, tree): if not isinstance(tree, KTree): raise TypeError('argument must be of type <KTree>') matches = [] tree.pre_order(lambda n: matches.append(n) if n.val == term else False) return matches
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_by_term(nodes, term):\n return nodes[sum([ord(c) for c in term]) % len(nodes)]", "def visit_term(self, node, children):\n if self.debug:\n print(\"Term {}\".format(children))\n term = children[0]\n for i in range(2, len(children), 2):\n if children[i-1] ...
[ "0.6986421", "0.61513734", "0.5921448", "0.58736944", "0.5862751", "0.5831741", "0.58146954", "0.56619805", "0.56611484", "0.5639314", "0.55790526", "0.5555535", "0.5530433", "0.5506146", "0.54981244", "0.54642147", "0.546144", "0.5453978", "0.5403352", "0.540323", "0.5325055...
0.61939466
1
Initialize XYZ data from file or existing geometry.
def __init__(self, **kwargs): # Two situations. One should have 'path' and, optionally, 'bohrs' # specified (default here is Angstroms). The other needs an N x 1 # 'atom_syms' vector and a 3N x 1 'coords' vector. if 'path' in kwargs: # All set for load from file. 'bohrs' d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_xyz(self, fname):\n self.ftype = 'xyz'\n with open(fname) as f:\n lines = f.readlines()\n self.n_atom = int(lines[0].split()[0])\n\n # reading lines to build up class data\n self.sym = []\n self.at_num = []\n self.xyz = np.zeros((self.n_atom, 3...
[ "0.70301515", "0.68537307", "0.67111796", "0.6321048", "0.6296491", "0.62578446", "0.6226162", "0.61775225", "0.61718357", "0.61685383", "0.6164377", "0.6135892", "0.60901254", "0.6089644", "0.6037583", "0.59291166", "0.59206396", "0.5904395", "0.58817655", "0.58618826", "0.5...
0.6050923
14
Internal function for making XYZ object from explicit geom data.
def _load_data(self, atom_syms, coords, bohrs=True): # Imports import numpy as np from .const import atom_num, PHYS from .error import XYZError # Gripe if already initialized if 'geoms' in dir(self): raise XYZError(XYZError.OVERWRITE, "Ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_xyz(cls, x, y, z):\n obj = cls()\n obj._x = x\n obj._y = y\n obj._z = z\n return obj", "def copyGeom(geom):\n geomJson = geom.ExportToJson()\n newGeom = ogr.CreateGeometryFromJson(geomJson)\n return newGeom", "def test_xyz_from_data(self):\n symbols =...
[ "0.6421648", "0.6170814", "0.61640143", "0.6124948", "0.60862577", "0.6039361", "0.60279477", "0.5917643", "0.58914214", "0.5849024", "0.58337766", "0.58336794", "0.58046174", "0.57761025", "0.5751537", "0.5707456", "0.5699832", "0.56906056", "0.56258446", "0.56246954", "0.56...
0.0
-1
Initialize OpanXYZ geometry object from OpenBabel file Import of an arbitrary number of multiple geometries from an OpenBabel file. All geometries must have the same number and type of atoms, and the ordering of atom types must be retained throughout.
def _load_file(self, XYZ_path, bohrs=False): # Imports import numpy as np from .const import CIC, PHYS, atom_num, atom_sym from .error import XYZError from .utils import safe_cast as scast # Complain if already initialized if 'geoms' in dir(self): ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n line: List[str],\n args: Namespace = None,\n features: np.ndarray = None,\n use_compound_names: bool = False):\n if args is not None:\n self.features_generator = args.features_generator\n self.args = a...
[ "0.56026757", "0.5540906", "0.5528329", "0.5364663", "0.53284216", "0.53252584", "0.5266082", "0.52634025", "0.52541685", "0.5250091", "0.5241198", "0.514692", "0.5138467", "0.51343966", "0.51267344", "0.5109389", "0.5102671", "0.5095474", "0.50853413", "0.506901", "0.5065143...
0.5555224
1
Retrieve a single geometry. The atom coordinates are returned with each atom's
def geom_single(self, g_num): # Just return the appropriate geometry vector geom = self.geoms[g_num] return geom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometry(self):\n return self[0].geometry", "def geometry(self, objectId):\n\n objectId = GeometryReference(objectId, self)\n req = urllib2.Request(self.baseUri + 'geometry/%d' % objectId.id)\n r = urllib2.urlopen(req)\n\n data = json.load(r)\n r.close()\n return data", "def geomet...
[ "0.71468383", "0.68853307", "0.6881374", "0.68368924", "0.66227245", "0.66227245", "0.6584365", "0.65074337", "0.65074337", "0.6476539", "0.6457532", "0.643852", "0.63991445", "0.6398878", "0.63909924", "0.63620174", "0.63473", "0.62437195", "0.62106025", "0.6011841", "0.5790...
0.6181021
19
Iterator over a subset of geometries. The indices of the geometries to be returned are indicated by an iterable of |int|\\ s passed as `g_nums`.
def geom_iter(self, g_nums): # Using the custom coded pack_tups to not have to care whether the # input is iterable from .utils import pack_tups vals = pack_tups(g_nums) for val in vals: yield self.geom_single(val[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_iterator((x_min, x_max, y_min, y_max)):\n for row in xrange(y_min, y_max):\n for col in xrange(x_min, x_max):\n yield (row, col)", "def _iterCoordsets(self):\n\n for i in range(self._n_csets):\n yield self._coords[i]", "def vertex_iterator(self):\n for X ...
[ "0.5779938", "0.57045865", "0.56929266", "0.55291986", "0.5527328", "0.5402063", "0.53830856", "0.53448653", "0.52876896", "0.52826023", "0.52761483", "0.5234629", "0.5232288", "0.52209127", "0.51792836", "0.51745635", "0.51471794", "0.5135813", "0.51231736", "0.5116178", "0....
0.7158514
0
Distance between two atoms.
def dist_single(self, g_num, at_1, at_2): # Import used math library function(s) import numpy as np from scipy import linalg as spla from .utils import safe_cast as scast # The below errors are explicitly thrown since values are multiplied by # three when they are used...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(cls, atom_1, atom_2):\n\t\t\n\t\treturn np.linalg.norm((atom_1-atom_2).atom_loc)", "def calculate_distance(atom1,atom2): #dot string to show when you go into the help doc of this function\n x_distance = atom1[0]-atom2[0]\n y_distance = atom1[1]-atom2[1]\n z_distance = atom1[2]-atom2[2]\n ...
[ "0.836802", "0.7753284", "0.76746625", "0.75178355", "0.74930346", "0.74093235", "0.73726875", "0.7370857", "0.7370857", "0.7344016", "0.7344016", "0.73347074", "0.7324276", "0.7320211", "0.7310314", "0.7278829", "0.7278765", "0.7270829", "0.7265909", "0.72642666", "0.7259381...
0.0
-1
Iterator over selected interatomic distances.
def dist_iter(self, g_nums, ats_1, ats_2, invalid_error=False): # Imports import numpy as np from .utils import pack_tups # Print the function inputs if debug mode is on if _DEBUG: # pragma: no cover print("g_nums = {0}".format(g_nums)) print("ats_1 = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_dist(self):\n self.makeTree()\n coords = self.coords\n sd = selfdistance\n for i in self.loopindices:\n dists, inds = self.nntree.query(coords[i], self.nnmaxcount,\n distance_upper_bound=self.nncutoff)\n yield coords[i], dists.compress((...
[ "0.74860764", "0.65093106", "0.6299574", "0.6196469", "0.6128919", "0.60511947", "0.6046373", "0.6036537", "0.60105455", "0.59743416", "0.5921528", "0.58894616", "0.58710784", "0.58668053", "0.58579624", "0.5804176", "0.5793591", "0.5787932", "0.5768053", "0.57170635", "0.568...
0.54510146
41
Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`.
def angle_single(self, g_num, at_1, at_2, at_3): # Imports import numpy as np from .utils import safe_cast as scast from .utils.vector import vec_angle # The below errors are explicitly thrown since they are multiplied by # three when they are used as an index and thus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle( nt1, nt2, nt3 ):\n if vector(nt1, nt2) == [0,0]:\n print(\"nt1\", nt1.seqpos, \" at \", nt1.x, nt1.y, \" is at the same position as nt2\", nt2.seqpos)\n if vector(nt2, nt3) == [0,0]:\n print(\"nt2\", nt2.seqpos, \" at \", nt2.x, nt2.y, \" is at the same position as nt3\", nt3.seqpos)...
[ "0.6621639", "0.62787753", "0.62721163", "0.6219383", "0.616731", "0.61254215", "0.61223984", "0.60984504", "0.6068697", "0.60079587", "0.5870599", "0.5851276", "0.5847751", "0.5736352", "0.5641874", "0.5633563", "0.5566232", "0.5555014", "0.5548194", "0.55439526", "0.5532424...
0.7929128
0
Iterator over selected atomic angles.
def angle_iter(self, g_nums, ats_1, ats_2, ats_3, invalid_error=False): # Suitability of ats_n indices will be checked within the # self.angle_single() calls and thus no check is needed here. # Import the tuple-generating function from .utils import pack_tups # Print the funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angles(self, num: int) -> Iterable[float]:\n if num < 2:\n raise ValueError(\"num >= 2\")\n start = self.dxf.start_angle % 360\n stop = self.dxf.end_angle % 360\n if stop <= start:\n stop += 360\n for angle in linspace(start, stop, num=num, endpoint=True...
[ "0.6916783", "0.62805206", "0.62411296", "0.60993385", "0.60627055", "0.59732306", "0.59469336", "0.58281696", "0.5812086", "0.5724647", "0.570284", "0.5701734", "0.56863636", "0.56828517", "0.56687546", "0.56573206", "0.5652911", "0.5652911", "0.56264985", "0.56264985", "0.5...
0.61551696
3
Dihedral/outofplane angle among four atoms. Returns the outofplane angle among four atoms from geometry `g_num`, in degrees. The reference plane is spanned by `at_1`, `at_2` and `at_3`. The outofplane angle is defined such that a positive angle represents a counterclockwise
def dihed_single(self, g_num, at_1, at_2, at_3, at_4): # library imports import numpy as np from scipy import linalg as spla from .utils.vector import ortho_basis, rej, vec_angle from .utils import safe_cast as scast from .error import XYZError from .const import ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_single(self, g_num, at_1, at_2, at_3):\n\n # Imports\n import numpy as np\n from .utils import safe_cast as scast\n from .utils.vector import vec_angle\n\n # The below errors are explicitly thrown since they are multiplied by\n # three when they are used as an i...
[ "0.62320507", "0.5513286", "0.5477218", "0.5460022", "0.5291179", "0.5227382", "0.5224077", "0.5219758", "0.5208271", "0.51954705", "0.51799554", "0.5173653", "0.51502854", "0.5115369", "0.51109487", "0.5099053", "0.50951463", "0.5083831", "0.505489", "0.5045638", "0.50434184...
0.60114694
1
Iterator over selected dihedral angles.
def dihed_iter(self, g_nums, ats_1, ats_2, ats_3, ats_4, \ invalid_error=False): # Suitability of ats_n indices will be checked within the # self.dihed_single() calls and thus no check is needed here. # Import the tuple-generating function ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dihedral_angles(self):\n mol = self.m\n c1 = mol.GetConformer(-1)\n torsma = '[!$(*#*)&!D1]~[!$(*#*)&!D1]'\n q = Chem.MolFromSmarts(torsma)\n matches = mol.GetSubstructMatches(q)\n nmat = len(matches)\n dic = {}\n for match in matches:\n j ...
[ "0.67937744", "0.650433", "0.64618915", "0.6319725", "0.6179052", "0.6091076", "0.60566366", "0.58289546", "0.55485225", "0.5516834", "0.55101126", "0.5483505", "0.53694785", "0.5359022", "0.5292239", "0.52902305", "0.5284748", "0.5282234", "0.5261645", "0.5239609", "0.522895...
0.491631
41
Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohrs.
def displ_single(self, g_num, at_1, at_2): # Library imports import numpy as np from .utils import safe_cast as scast # The below errors are explicitly thrown since they are multiplied by # three when they are used as an index and thus give non-intuitive # errors. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist_single(self, g_num, at_1, at_2):\n\n # Import used math library function(s)\n import numpy as np\n from scipy import linalg as spla\n from .utils import safe_cast as scast\n\n # The below errors are explicitly thrown since values are multiplied by\n # three when ...
[ "0.6828026", "0.63209164", "0.62243074", "0.5588467", "0.54166085", "0.54103637", "0.53110236", "0.53094816", "0.52225846", "0.5219", "0.52034783", "0.5185372", "0.51553935", "0.5150667", "0.51422375", "0.511167", "0.50929797", "0.50642675", "0.5045502", "0.5032917", "0.50302...
0.73728895
0
Iterator over indicated displacement vectors.
def displ_iter(self, g_nums, ats_1, ats_2, invalid_error=False): # Import the tuple-generating function from .utils import pack_tups # Print the function inputs if debug mode is on if _DEBUG: # pragma: no cover print("g_nums = {0}".format(g_nums)) print("ats_1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for y in range(self.origin.y, self.origin.y + self.size.y):\n for x in range(self.origin.x, self.origin.x + self.size.x):\n yield Vec2(x, y)", "def __iter__(self):\n\t\tfor nt in SeqVector.rev_mapping:\n\t\t\tyield nt", "def __iter__(self):\n fo...
[ "0.6948717", "0.6499379", "0.6452133", "0.6443525", "0.6356332", "0.6341788", "0.63147575", "0.6292186", "0.6255947", "0.6230458", "0.60472536", "0.6030765", "0.60095453", "0.59889174", "0.59873176", "0.5953884", "0.5943568", "0.58993924", "0.5886447", "0.5862476", "0.5844592...
0.0
-1
Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after errorchecking the arguments for a max of one |None| value, and ensuring that if a |None| is present, no other non|str| i...
def _none_subst(self, *args): # Imports import numpy as np # Initialize argument list return value, and as None not found arglist = [a for a in args] none_found = False # Check for None values none_vals = list(map(lambda e: isinstance(e, type(None)), arglist)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __dynamic_range_process(info):\n if 'range' in info:\n for i in range(len(info['range'])):\n if info['range'][i][1] == -1:\n info['range'][i][1] = None\n return info", "def restrict_once(self):\n l = list(self)\n for i, arg in enumerate(self.sig):\n ...
[ "0.6032078", "0.5548745", "0.54662424", "0.5449462", "0.5438166", "0.5367288", "0.5254939", "0.5251298", "0.52095854", "0.5154835", "0.51438975", "0.5128024", "0.5127296", "0.50919783", "0.50894165", "0.5048798", "0.50049394", "0.49737692", "0.4965266", "0.49602643", "0.49274...
0.6425502
0
Wrapper for exception/|None| output handling of X_iter methods. Attempts to pass `tup` as arguments to `fxn`. If the call is successful, returns the value produced. If
def _iter_return(tup, fxn, invalid_error): try: val = fxn(*tup) except (IndexError, ValueError): if invalid_error: # Raise the exception if invalid_error indicates raise else: # Otherwise, just return a 'None' value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_func_tuple(f_args):\n return f_args[0](*f_args[1:])", "def wrapit(fn):\n def inside(dummy, *args):\n try:\n return fn(*args)\n except Exception as e:\n print(\"Error in XSLT extension: %s\" % e)\n raise\n return inside", "def __call__ ( self , *x...
[ "0.54071575", "0.506021", "0.50338674", "0.5007572", "0.4873577", "0.48561063", "0.48419422", "0.48373547", "0.4821068", "0.48024175", "0.47795138", "0.47174263", "0.47157645", "0.4645071", "0.46301335", "0.45946258", "0.4569231", "0.4554146", "0.45464298", "0.45464298", "0.4...
0.7071328
0
Compares speed of functions across input conditions. 'funcs' should be a list of functions expressed as strings. String substitution is done on each function while iterating over ranges of values in 'inputs' to compare speed. 'inputs' should be an iterable range of values over which 'funcs' should be tested. 'setups' c...
def timeit_compare(funcs, inputs, setups='pass', **kwargs): number = kwargs.get('number', 100000) print_conditions = kwargs.get('print_conditions', False) performance = defaultdict(list) if isinstance(setups, list): # user specifies their own list of setups corresponding to funcs pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_timings_perinput(funcs, input_=None):\n\n global _TIMEOUT\n global _NUM_REPEATS\n\n timings_l = []\n\n from IPython import get_ipython\n if get_ipython() is None:\n iter_funcs = trange(len(funcs), desc='Loop functions', leave=False)\n else:\n iter_funcs = range(len(funcs))\...
[ "0.6532997", "0.6067574", "0.5981965", "0.58139783", "0.5802524", "0.5739622", "0.5668803", "0.56225157", "0.54053986", "0.5306131", "0.5264208", "0.52628356", "0.5256946", "0.5210447", "0.51905584", "0.5185012", "0.5178295", "0.51312095", "0.51214105", "0.51147574", "0.51056...
0.8455328
0
Converts conditions for individual variables into an exhaustive list of combinations for timeit_compare().
def get_conditions(inputs): # itertools.product summarizes all combinations of ordered conditions # at len = 1 it wraps values in tuples (0,) that confuse the timer below if hasattr(inputs[0], '__iter__'): return list(product(*inputs)) else: return [[n] if not isinstance(n,(list,tuple)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_different(variables) :\n constraints = []\n for i in xrange(len(variables)):\n var1 = variables[i]\n for j in xrange(i+1,len(variables)):\n var2 = variables[j]\n if var1!=var2:\n constraints.append(Constraint(var1,var2,constraint_different))\n ret...
[ "0.6311022", "0.61849254", "0.60068643", "0.58457434", "0.5723604", "0.5540094", "0.5520736", "0.54754466", "0.5429853", "0.54289407", "0.5408784", "0.5364044", "0.53570276", "0.53367054", "0.5330969", "0.5319483", "0.53005606", "0.5298023", "0.52649146", "0.5194227", "0.5183...
0.683482
0
Plots the results from a defaultdict returned by timeit_compare. Each function will be plotted as a different series. timeit_compare may test many conditions, and the order of the conditions in the results data can be understood from the string substitutions noted in the keys of the defaultdict. By default series=0 mea...
def timeit_plot2D(data, xlabel='xlabel', title='title', **kwargs): series = kwargs.get('series', 0) style = kwargs.get('style', 'line') size = kwargs.get('size', 500) ylabel = kwargs.get('ylabel', 'time') cmap = kwargs.get('cmap', 'rainbow') lloc = kwargs.get('lloc', 2) dataT = {} # set ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotResultsComparison(monthlyData1, monthlyData2, indices, arg):\n \n energyType = arg[0] \n \n dummyRange = np.asarray(range(len(indices['E_tot1'])))\n \n fig = plt.figure(figsize=(16, 8))\n \n# plt.suptitle('Heating Demand (COP=' + str(usedEfficiencies['H_COP']) + ')')\n if ener...
[ "0.6654563", "0.6607514", "0.643974", "0.6420746", "0.6370238", "0.632196", "0.62992644", "0.62709874", "0.6246181", "0.6242282", "0.6240868", "0.61306024", "0.61226565", "0.6117729", "0.60903037", "0.6040406", "0.6036093", "0.6007648", "0.5978382", "0.5933804", "0.5926469", ...
0.0
-1
3D plot of timeit data, one chart per function.
def timeit_plot3D(data, xlabel='xlabel', ylabel='ylabel', **kwargs): dataT = {} figs = [] series = kwargs.get('series', (0,1)) cmap = kwargs.get('cmap', cm.coolwarm) for k, v in data.items(): dataT[k] = zip(*v) fig = plt.figure() ax = fig.gca(projection='3d') X, Y, Z ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_results_traj_3d(p_x, p_y, p_z, xmin, xmax, ymin, ymax, zmin, zmax):\n fig, ax = plt.subplots(2 , 2, figsize = (10, 10))\n \n for p in np.arange(0, p_x.shape[0], step = 1): \n for t in np.arange(0, p_x.shape[1], step = 1): \n ax[0,0].plot(t, p_x[p, t], 'rx') \n ax[0...
[ "0.6823655", "0.64680564", "0.6386386", "0.63781416", "0.6293766", "0.6287212", "0.62837124", "0.61736697", "0.61295396", "0.6103058", "0.60559446", "0.602441", "0.6017617", "0.5986467", "0.59750056", "0.5937993", "0.5929257", "0.5915024", "0.5913098", "0.58936155", "0.589318...
0.70203567
0
Heatmap plot of timeit data, one chart per function.
def timeit_heatmap(data, xlabel='xlabel', ylabel='ylabel', **kwargs): dataT = {} figs = [] series = kwargs.get('series', (0,1)) cmap = kwargs.get('cmap', cm.coolwarm) for k, v in data.items(): dataT[k] = zip(*v) X, Y, Z = dataT[k][series[0]], dataT[k][series[1]], dataT[k][-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matplotlib_heatmap_chart() -> Tuple:\n df = read_dataset(Path('..', '..', 'iris.csv'))\n df.drop(\"species\", axis=1, inplace=True)\n # Default is pearson's correlation coefficient\n corr_df = df.corr()\n\n fig, ax = a_libraries.matplotlib_heatmap_chart(corr_df.values)\n\n return fig, ax", ...
[ "0.61510575", "0.61060256", "0.6084988", "0.6076633", "0.6073375", "0.6024223", "0.60044134", "0.59975386", "0.5975684", "0.5969831", "0.596719", "0.5944489", "0.594429", "0.59286827", "0.5918338", "0.5899142", "0.5887171", "0.5877043", "0.58721083", "0.5865014", "0.58345026"...
0.6993276
0
returns mahalanobis distance of each input for each gaussian parameterized by mu[i], cov[i]. mu = (k, d) numpy array where k is number of mixtures and d is the dimension of the data. cov = (k, d, d) numpy array with the same setup as mu in terms of k and d.
def mahalanobis(data, mu, cov, k=2): mhd = np.zeros((data.shape[0], mu.shape[0])) for i in range(mu.shape[0]): _mu = mu[i, :] _cov = cov[i, :, :] mhd[:, i] = np.sum( (data - _mu) @ np.linalg.inv(_cov) * (data - _mu), axis=1 ) return np.sqrt(mhd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mahalanobis_dist_factory(X):\n\t# compute the average vector location\n\tavg = class_average(X)\n\t# compute the variance-covariance matrix of the input matrix\n\tvarcovar = np.cov(X, rowvar=False)\n\t# compute the inverse of the variance-covariance matrix\n\tinv_varcovar = np.linalg.pinv(varcovar)\n\n\t# func...
[ "0.66977125", "0.65298855", "0.64811194", "0.6442887", "0.64422977", "0.61270535", "0.60174", "0.60146606", "0.6008952", "0.59352744", "0.5921679", "0.587831", "0.579491", "0.57288444", "0.5714017", "0.5707229", "0.55162406", "0.55084175", "0.5483291", "0.54774976", "0.546596...
0.7921236
0
This function should compute all relevant metrics to the task,
def evaluate(self, prediction_fn): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_metrics(self):\n pass", "def compute_statistics(self):", "def compute_metrics(self, results: list) -> dict:", "def calculate_batch_metrics(self):\n pass", "def compute(self) -> Any:\n # ddp hotfix, could be done better\n # but metric must handle DDP on it's own\n ...
[ "0.79128826", "0.74192625", "0.71593416", "0.69144243", "0.6824682", "0.6824682", "0.66879547", "0.65933985", "0.6584952", "0.64729804", "0.64716756", "0.6453491", "0.64283794", "0.6394721", "0.63812053", "0.63713115", "0.6338445", "0.62557447", "0.62270904", "0.6222773", "0....
0.0
-1
Saves the entire object ready to be loaded.
def save(self, path): torch.save(self, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():", "def save(self):\n # TODO (Pierre): code", "def save():\n pass", "def save (self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def ...
[ "0.79704905", "0.78950554", "0.7893142", "0.7855574", "0.7837163", "0.7837163", "0.7837163", "0.7837163", "0.7837163", "0.7778858", "0.76986545", "0.7668331", "0.7668331", "0.7668331", "0.76182026", "0.76182026", "0.76182026", "0.76011497", "0.7543548", "0.75262547", "0.74322...
0.0
-1
STATIC METHOD accessed through class, loads a preexisting experiment.
def load(path): return torch.load(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_experiment(self):\n exp = Experiment(self.epath,\n normalization='ch0',\n auto_alignment=False)\n self.assertTrue(isinstance(exp, Experiment))", "def _load_experiment(\n experiment_name: str, decoder: Decoder, reduced_state: bool = Fa...
[ "0.71485525", "0.6747559", "0.6703121", "0.66636235", "0.63238764", "0.62490994", "0.61740875", "0.61601645", "0.61585844", "0.61475116", "0.61034805", "0.6007125", "0.5924276", "0.59056836", "0.5895276", "0.589245", "0.5891917", "0.58782053", "0.5876589", "0.58482295", "0.58...
0.0
-1
Produces evaluation scores and saves the results to a file. The tokenisation is done through string_split_v1. So any non spaced text will be considered as one token.
def evaluate(self, prediction_fn, save_dir=None, save_name="translation_eval.txt", batched=None): if batched: src_sents = [src for (src, tgt) in self.task_data] chunked_sents = list(chunks(src_sents, batched)) predictions = [prediction_fn(sents) for sents in tqdm.tqdm(chunked...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(predictions, gold_file, out_prediction_file):\n # Save the evaluations to a file\n with codecs.open(out_prediction_file, 'w', 'utf-8') as f_out:\n for (w1, w2), curr_paraphrases in predictions.items():\n for paraphrase, score in curr_paraphrases:\n f_out.write('\...
[ "0.6306145", "0.60364264", "0.59628004", "0.5864951", "0.5815738", "0.5814478", "0.5805036", "0.57701683", "0.5697664", "0.56726915", "0.566613", "0.56314296", "0.56056726", "0.55848986", "0.5569064", "0.55628127", "0.55419517", "0.5523052", "0.5494854", "0.5468465", "0.54481...
0.0
-1
The tokenizer that we use for code submissions, from Wang Ling et al., Latent Predictor Networks for Code Generation (2016)
def tokenize_for_bleu_eval(self, code): code = re.sub(r'([^A-Za-z0-9_])', r' \1 ', code) code = re.sub(r'([a-z])([A-Z])', r'\1 \2', code) code = re.sub(r'\s+', ' ', code) code = code.replace('"', '`') code = code.replace('\'', '`') tokens = [t for t in code.split(' ') if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_tokenizer(text):\n return text", "def create_tokenizer(dataset):\n lang_tokenizer = tf.keras.preprocessing.text.Tokenizer(char_level=True)\n lang_tokenizer.fit_on_texts([x['input'] for x in dataset])\n return lang_tokenizer", "def tokenizer(self):\n tokenizer = RegexpTokenizer(r...
[ "0.72402114", "0.71198505", "0.7113689", "0.6879249", "0.6853371", "0.68101704", "0.67637116", "0.6736855", "0.6725367", "0.672405", "0.6677276", "0.6579792", "0.64370555", "0.641335", "0.6398385", "0.63931334", "0.6389405", "0.6388391", "0.63303375", "0.6324457", "0.631961",...
0.6563193
12
Function whose loops update global counter
def mystery1(input_val): global counter for index in range(input_val): for dummy_index in range(5): counter += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_counter(self) -> None:", "def tick():\n global counter\n counter += 1", "def count_inside(self):\n time.sleep(2) #1\n self.count += 1", "def inc( self ):\n self.count += 1", "def inc(self):\n \n self.count += 1", "...
[ "0.7691904", "0.7540666", "0.69851613", "0.6968179", "0.6947265", "0.68366146", "0.68366146", "0.6761236", "0.67449236", "0.6723789", "0.6677334", "0.66553146", "0.6622162", "0.6585975", "0.65666616", "0.65422696", "0.6508996", "0.64917785", "0.6483024", "0.647665", "0.647665...
0.65744907
14
Function whose loops update global counter
def mystery2(input_val): global counter for index in range(input_val): for dummy_index in range(index / 2, index): counter += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_counter(self) -> None:", "def tick():\n global counter\n counter += 1", "def count_inside(self):\n time.sleep(2) #1\n self.count += 1", "def inc( self ):\n self.count += 1", "def inc(self):\n \n self.count += 1", "...
[ "0.7691904", "0.7540666", "0.69851613", "0.6968179", "0.6947265", "0.68366146", "0.68366146", "0.6761236", "0.67449236", "0.6723789", "0.6677334", "0.66553146", "0.6622162", "0.6585975", "0.65744907", "0.65666616", "0.65422696", "0.6508996", "0.64917785", "0.6483024", "0.6476...
0.58076495
77
Function whose loops update global counter
def mystery3(input_val): global counter for index in range(input_val): for dummy_index in range(int(1.1 ** index)): counter += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_counter(self) -> None:", "def tick():\n global counter\n counter += 1", "def count_inside(self):\n time.sleep(2) #1\n self.count += 1", "def inc( self ):\n self.count += 1", "def inc(self):\n \n self.count += 1", "...
[ "0.7691904", "0.7540666", "0.69851613", "0.6968179", "0.6947265", "0.68366146", "0.68366146", "0.6761236", "0.67449236", "0.6723789", "0.6677334", "0.66553146", "0.6622162", "0.6585975", "0.65744907", "0.65666616", "0.65422696", "0.6508996", "0.64917785", "0.6483024", "0.6476...
0.0
-1
Build plot of the number of increments in mystery function
def build_plot(plot_size, plot_function, plot_type = STANDARD): global counter plot = [] for input_val in range(2, plot_size): counter = 0 plot_function(input_val) if plot_type == STANDARD: plot.append([input_val, counter]) else: plot.append([math.log(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metaplot_powersum_test():\n all_psums = []\n for i in range(1,4+1):\n print \"starting on\",i\n plt.subplot(2,2,i)\n all_psums.append(plot_powersum_test(G=1000*int(10**(i-1)),trials=10000/int(10**(i-1))))\n plt.show()\n return all_psums", "def make_plot(x,y):", "def plot_nu...
[ "0.6076957", "0.6037471", "0.59856474", "0.59724694", "0.5934096", "0.5903188", "0.5862792", "0.582949", "0.58223224", "0.58133066", "0.58117056", "0.57742274", "0.57369816", "0.57341695", "0.57190216", "0.5707884", "0.56981534", "0.5692261", "0.56549776", "0.5654222", "0.564...
0.58810604
6
Return a list of train label
def get_labels(train_f_path): results = [] with open(train_f_path, 'r') as f: for line in f: n_line = line.strip() if n_line: results.append(n_line.split()[0]) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_labels(self):\n return self._train_labels", "def get_train_labels(self):\n raise NotImplementedError", "def list_labels(self):\n # Create empty list\n label_names = []\n \n # For every name in training directory\n for name in os.listdir(self.train_data):\n...
[ "0.8100301", "0.80514497", "0.78156173", "0.78015554", "0.77894163", "0.77820337", "0.77497905", "0.77037364", "0.7539584", "0.74781585", "0.74781585", "0.74382025", "0.7404343", "0.7404343", "0.73986834", "0.73861414", "0.73713386", "0.7343278", "0.7337383", "0.7332904", "0....
0.7200101
27
Lists All the buckets for a user.
def get_buckets_for_user(self): s3 = self.credentials.session.resource('s3') bucket_list = [bucket.name for bucket in s3.buckets.all()] return bucket_list;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(user_id):\n return Bucketlist.query.filter_by(created_by=user_id)", "def buckets(self, user=None):\n raise NotImplementedError('TODO')", "def list_buckets():\n for bucket in BUCKET_MANAGER.all_buckets():\n print(bucket)", "def get(self, user):\n search = True if sel...
[ "0.8044228", "0.79636157", "0.7384061", "0.7377639", "0.7241345", "0.72163045", "0.71235573", "0.7091773", "0.7084208", "0.6977282", "0.69236207", "0.6885807", "0.6873885", "0.67799014", "0.6779265", "0.6777968", "0.66890603", "0.66793346", "0.6543409", "0.65332437", "0.64783...
0.77902347
2
Fetches the bucket information
def get_bucket_statistics(self, bucket_name): bucket_info = BucketInfo() bucket_info.bucket_name = bucket_name s3 = self.credentials.session.resource('s3') current_bucket = s3.Bucket(bucket_name) bucket_info.creation_date = current_bucket.creation_date for bucket_object ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bucket(self, bucket):\n msg = \"get_bucket not implemented\"\n raise NotImplementedError(msg)", "def list_bucket(self, bucket):\n self.response.write('Listbucket result:\\n')\n\n page_size = 1\n stats = gcs.listbucket(bucket + '/foo', max_keys=page_size)\n while True:\n cou...
[ "0.7036937", "0.69635886", "0.687991", "0.68652654", "0.67475414", "0.672836", "0.6714441", "0.66897327", "0.66428053", "0.6610461", "0.66102755", "0.6609213", "0.6571597", "0.65627116", "0.65627116", "0.65256745", "0.64774877", "0.64530367", "0.6452506", "0.6443259", "0.6360...
0.6373156
20
Fetches the bucket information
def get_bucket_statistics_v2(self, bucket_name, storageTypeFilter=None): bucket_info = BucketInfo() bucket_info.bucket_name = bucket_name s3 = self.credentials.session.resource('s3') current_bucket = s3.Bucket(bucket_name) bucket_info.creation_date = current_bucket.creation_date ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bucket(self, bucket):\n msg = \"get_bucket not implemented\"\n raise NotImplementedError(msg)", "def list_bucket(self, bucket):\n self.response.write('Listbucket result:\\n')\n\n page_size = 1\n stats = gcs.listbucket(bucket + '/foo', max_keys=page_size)\n while True:\n cou...
[ "0.7036937", "0.69635886", "0.687991", "0.68652654", "0.67475414", "0.672836", "0.6714441", "0.66897327", "0.66428053", "0.6610461", "0.66102755", "0.6609213", "0.6571597", "0.65627116", "0.65627116", "0.65256745", "0.64774877", "0.64530367", "0.6452506", "0.6443259", "0.6373...
0.6360135
21
Generator that iterates over all objects in a given s3 bucket
def iterate_bucket_objects(self, bucket): client = self.credentials.session.client('s3') page_iterator = client.list_objects_v2(Bucket=bucket) if 'Contents' not in page_iterator: return [] for item in page_iterator['Contents']: yield item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_s3_keys_as_generator(s3_client,bucket, prefix):\n kwargs = {'Bucket': bucket, 'Prefix' : prefix}\n while True:\n resp = s3_client.list_objects_v2(**kwargs)\n for obj in resp['Contents']:\n yield obj\n\n try:\n kwargs['ContinuationToken'] = resp['NextContinua...
[ "0.8061774", "0.78454584", "0.7636215", "0.75269794", "0.7432275", "0.7339902", "0.7302619", "0.72996944", "0.7233975", "0.7216875", "0.7203796", "0.71446174", "0.7140059", "0.71253085", "0.7119356", "0.7085106", "0.7067508", "0.6997889", "0.6971213", "0.69600886", "0.6849436...
0.83988297
0
Returns he list of objects within a bucket.
def get_files_in_bucket(self, bucket_name): s3 = self.credentials.session.resource('s3') this_bucket = s3.Bucket(bucket_name) list_of_files = [s3file.key for s3file in this_bucket.objects.all()]; return list_of_files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_bucket_objects(bucket):\n for obj in BUCKET_MANAGER.all_objects(bucket).all():\n print(obj)", "def list_buckets():\n for bucket in s3.buckets.all():\n print(bucket)", "def get_objects(self):\r\n bucket = self._get_bucket()\r\n objs = []\r\n for key in bucket:\r...
[ "0.85396767", "0.8097353", "0.8041987", "0.79386073", "0.7933704", "0.7909349", "0.78530836", "0.78313494", "0.7781213", "0.7725446", "0.7662691", "0.7624103", "0.76148516", "0.7570716", "0.7539435", "0.7533726", "0.75263417", "0.7512228", "0.75029016", "0.7476436", "0.746556...
0.68705314
48
Set up variables for the GrandCanonicalMonteCarloSampler
def setup_BaseGrandCanonicalMonteCarloSampler(): # Make variables global so that they can be used global base_gcmc_sampler global base_gcmc_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_setup(self):\n self.DNN = SganMLP(self.settings.number_of_bins)\n self.D = SganMLP(self.settings.number_of_bins)\n self.G = Generator()", "def initialize(self):\n self.gc1.reset_parameters()\n self.gc2.reset_parameters()\n\n for s in self.scores:\n s...
[ "0.65247303", "0.64355326", "0.6290882", "0.62845963", "0.6265411", "0.6215736", "0.6098296", "0.60891455", "0.60858494", "0.6080878", "0.60772467", "0.6068644", "0.60400265", "0.603621", "0.60180527", "0.6005577", "0.59941375", "0.5993957", "0.59704316", "0.59679365", "0.595...
0.72094464
0
Set up variables for the GCMCSphereSampler
def setup_GCMCSphereSampler(): # Make variables global so that they can be used global gcmc_sphere_sampler global gcmc_sphere_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ff.createSystem(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_StandardGCMCSphereSampler():\n # Make variables global so that they can be used\n global std_gcmc_sphere_sampler\n global std_gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n ...
[ "0.70422375", "0.62401485", "0.6174525", "0.60479116", "0.59983546", "0.5985195", "0.59568286", "0.5914662", "0.58969736", "0.58124846", "0.58091885", "0.57982147", "0.575604", "0.5727869", "0.57278335", "0.56950855", "0.56897867", "0.5652037", "0.56375766", "0.5635338", "0.5...
0.71677244
0
Set up variables for the StandardGCMCSphereSampler
def setup_StandardGCMCSphereSampler(): # Make variables global so that they can be used global std_gcmc_sphere_sampler global std_gcmc_sphere_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSphereSampler():\n # Make variables global so that they can be used\n global gcmc_sphere_sampler\n global gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n system = ff.c...
[ "0.7230866", "0.64710623", "0.63545537", "0.6177041", "0.6059987", "0.6001161", "0.59810454", "0.59458554", "0.59250724", "0.5810696", "0.5796983", "0.57875997", "0.5764037", "0.57382625", "0.5712826", "0.5710626", "0.56650996", "0.5653145", "0.56498593", "0.5624879", "0.5621...
0.74774736
0
Set up variables for the GrandCanonicalMonteCarloSampler
def setup_NonequilibriumGCMCSphereSampler(): # Make variables global so that they can be used global neq_gcmc_sphere_sampler global neq_gcmc_sphere_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') sys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_BaseGrandCanonicalMonteCarloSampler():\n # Make variables global so that they can be used\n global base_gcmc_sampler\n global base_gcmc_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n ...
[ "0.7211087", "0.6525977", "0.6435302", "0.62915516", "0.6284481", "0.6267818", "0.62182075", "0.6098433", "0.60890055", "0.6088116", "0.60806596", "0.6079379", "0.60685253", "0.6040332", "0.603551", "0.6017087", "0.60072273", "0.599423", "0.5993949", "0.59701514", "0.59502614...
0.59698236
20
Set up variables for the GCMCSystemSampler
def setup_GCMCSystemSampler(): # Make variables global so that they can be used global gcmc_system_sampler global gcmc_system_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb'))) ff = ForceField('tip3p.xml') system = ff.createSystem(pdb.topology, nonbondedMet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_StandardGCMCSystemSampler():\n # Make variables global so that they can be used\n global std_gcmc_system_sampler\n global std_gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSyste...
[ "0.73459214", "0.6634865", "0.6564363", "0.65134656", "0.6442558", "0.64188296", "0.63949424", "0.6207153", "0.6156057", "0.6122879", "0.6117317", "0.611441", "0.601784", "0.59655565", "0.5935689", "0.5922263", "0.58999264", "0.58888024", "0.5882525", "0.5874189", "0.58622843...
0.7534252
0
Set up variables for the StandardGCMCSystemSampler
def setup_StandardGCMCSystemSampler(): # Make variables global so that they can be used global std_gcmc_system_sampler global std_gcmc_system_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb'))) ff = ForceField('tip3p.xml') system = ff.createSystem(pdb.topolo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSystemSampler():\n # Make variables global so that they can be used\n global gcmc_system_sampler\n global gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSystem(pdb.topology, ...
[ "0.7308907", "0.6762758", "0.6539486", "0.6444159", "0.6409054", "0.6210909", "0.6188153", "0.6183125", "0.60796523", "0.6073801", "0.6063694", "0.60533386", "0.5910438", "0.59057194", "0.5897044", "0.58700055", "0.583869", "0.58104205", "0.57944477", "0.5793852", "0.57618254...
0.75966007
0
Set up variables for the StandardGCMCSystemSampler
def setup_NonequilibriumGCMCSystemSampler(): # Make variables global so that they can be used global neq_gcmc_system_sampler global neq_gcmc_system_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb'))) ff = ForceField('tip3p.xml') system = ff.createSystem(pdb....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_StandardGCMCSystemSampler():\n # Make variables global so that they can be used\n global std_gcmc_system_sampler\n global std_gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSyste...
[ "0.75958276", "0.73061603", "0.67612386", "0.6536989", "0.64055324", "0.62102795", "0.6185804", "0.6184276", "0.6078398", "0.6073744", "0.6061834", "0.60537785", "0.5909346", "0.590625", "0.5896071", "0.5869167", "0.5839259", "0.58082545", "0.57943165", "0.5792727", "0.576159...
0.64428854
4
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the GrandCanonicalMonteCarloSampler.move() method works correctly
def test_move(self): # Shouldn't be able to run a move with this sampler self.assertRaises(NotImplementedError, lambda: base_gcmc_sampler.move(base_gcmc_simulation.context)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.6885951", "0.68591535", "0.68517685", "0.6720708", "0.6701315", "0.65315986", "0.6527951", "0.6363933", "0.62256527", "0.61666775", "0.6062729", "0.6047407", "0.60417", "0.6026306", "0.60233027", "0.5932626", "0.59017557", "0.59000623", "0.5898178", "0.5897844", "0.5895698...
0.68518084
2
Make sure the BaseGrandCanonicalMonteCarloSampler.report() method works correctly
def test_report(self): # Delete some ghost waters so they can be written out ghosts = [3054, 3055, 3056, 3057, 3058] base_gcmc_sampler.deleteGhostWaters(ghostResids=ghosts) # Report base_gcmc_sampler.report(base_gcmc_simulation) # Check the output to the ghost file ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_BaseGrandCanonicalMonteCarloSampler():\n # Make variables global so that they can be used\n global base_gcmc_sampler\n global base_gcmc_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n ...
[ "0.60594994", "0.59317505", "0.5849876", "0.5799352", "0.5692029", "0.5680979", "0.5674313", "0.565859", "0.5623557", "0.56207806", "0.5571885", "0.5550829", "0.55436575", "0.5542487", "0.5538711", "0.5514227", "0.5509748", "0.5472215", "0.5460395", "0.54585546", "0.5419002",...
0.5809674
3
Make sure the BaseGrandCanonicalMonteCarloSampler.reset() method works correctly
def test_reset(self): # Set tracked variables to some non-zero values base_gcmc_sampler.n_accepted = 1 base_gcmc_sampler.n_moves = 1 base_gcmc_sampler.Ns = [1] # Reset base_gcmc_sampler base_gcmc_sampler.reset() # Check that the values have been reset as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.st = segment_tree.SegmentTreeSampler(self.n, np.ones(self.n) * self.reg, self.random_state)", "def setup_BaseGrandCanonicalMonteCarloSampler():\n # Make variables global so that they can be used\n global base_gcmc_sampler\n global base_gcmc_simulation\n\n pdb = PDBFile(...
[ "0.7006503", "0.6610244", "0.6507081", "0.64523005", "0.6371905", "0.6332127", "0.6324144", "0.63123316", "0.6293652", "0.624985", "0.624754", "0.62317836", "0.62037873", "0.62037873", "0.62037873", "0.61578816", "0.6154015", "0.6154015", "0.61478823", "0.6144965", "0.6130272...
0.69381005
1
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the GCMCSphereSampler.initialise() method works correctly
def test_initialise(self): # Make sure the variables are all updated assert isinstance(gcmc_sphere_sampler.context, Context) assert isinstance(gcmc_sphere_sampler.positions, Quantity) assert isinstance(gcmc_sphere_sampler.sphere_centre, Quantity) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSphereSampler():\n # Make variables global so that they can be used\n global gcmc_sphere_sampler\n global gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n system = ff.c...
[ "0.7482102", "0.7452458", "0.6748668", "0.66379297", "0.6630921", "0.6568337", "0.64469874", "0.6387264", "0.635185", "0.6235221", "0.61284995", "0.6078793", "0.6022753", "0.59546596", "0.59303445", "0.5924565", "0.59102744", "0.5876836", "0.5857518", "0.5837153", "0.5790307"...
0.72542685
2
Make sure the GCMCSphereSampler.deleteWatersInGCMCSphere() method works correctly
def test_deleteWatersInGCMCSphere(self): # Now delete the waters in the sphere gcmc_sphere_sampler.deleteWatersInGCMCSphere() new_ghosts = gcmc_sphere_sampler.getWaterStatusResids(0) # Check that the list of ghosts is correct assert new_ghosts == [70, 71, 3054, 3055, 3056, 3057, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_updateGCMCSphere(self):\n # Get initial gcmc_resids and status\n gcmc_waters = deepcopy(gcmc_sphere_sampler.getWaterStatusResids(1))\n sphere_centre = deepcopy(gcmc_sphere_sampler.sphere_centre)\n N = gcmc_sphere_sampler.N\n\n # Update the GCMC sphere (shouldn't change a...
[ "0.63944376", "0.62567043", "0.59877086", "0.5870835", "0.5841204", "0.5656549", "0.55353993", "0.5513171", "0.5488697", "0.5458763", "0.5458092", "0.5409319", "0.53839445", "0.537687", "0.53426343", "0.5312269", "0.5309804", "0.5300502", "0.5300502", "0.5294281", "0.52817607...
0.81623113
0
Make sure the GCMCSphereSampler.updateGCMCSphere() method works correctly
def test_updateGCMCSphere(self): # Get initial gcmc_resids and status gcmc_waters = deepcopy(gcmc_sphere_sampler.getWaterStatusResids(1)) sphere_centre = deepcopy(gcmc_sphere_sampler.sphere_centre) N = gcmc_sphere_sampler.N # Update the GCMC sphere (shouldn't change as the syste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSphereSampler():\n # Make variables global so that they can be used\n global gcmc_sphere_sampler\n global gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n system = ff.c...
[ "0.6867336", "0.6694733", "0.6372616", "0.6199202", "0.54769635", "0.537066", "0.5282511", "0.52227336", "0.5180439", "0.5173947", "0.51617426", "0.51477826", "0.5090878", "0.5084552", "0.50375485", "0.50262225", "0.49550423", "0.49523485", "0.4936377", "0.49238035", "0.48899...
0.79535794
0
Make sure the GCMCSphereSampler.move() method works correctly
def test_move(self): # Shouldn't be able to run a move with this sampler self.assertRaises(NotImplementedError, lambda: gcmc_sphere_sampler.move(gcmc_sphere_simulation.context)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.7312604", "0.6786061", "0.66649306", "0.65060794", "0.64089835", "0.62293303", "0.6205869", "0.61197466", "0.58118314", "0.5800113", "0.5773424", "0.5737712", "0.5735148", "0.5719306", "0.57125866", "0.56983864", "0.567811", "0.56488407", "0.56414455", "0.5633706", "0.5608...
0.71798897
1
Make sure the GCMCSphereSampler.insertRandomWater() method works correctly
def test_insertRandomWater(self): # Insert a random water new_positions, wat_id, atom_ids = gcmc_sphere_sampler.insertRandomWater() # Check that the indices returned are integers - may not be type int assert wat_id == int(wat_id) assert all([i == int(i) for i in atom_ids]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertRandomWater(self):\n # Insert a random water\n new_positions, wat_id, atom_ids = gcmc_system_sampler.insertRandomWater()\n\n # Check that the indices returned are integers - may not be type int\n assert wat_id == int(wat_id)\n assert all([i == int(i) for i in atom_...
[ "0.72090286", "0.6620027", "0.63753724", "0.63195544", "0.5973471", "0.5952739", "0.5840426", "0.5759416", "0.5701698", "0.5691748", "0.567196", "0.5536785", "0.5514029", "0.5480719", "0.5478959", "0.54229546", "0.53605586", "0.5359001", "0.53506374", "0.53441834", "0.5324880...
0.73840714
0
Make sure the GCMCSphereSampler.deleteRandomWater() method works correctly
def test_deleteRandomWater(self): # Insert a random water delete_water, atom_indices = gcmc_sphere_sampler.deleteRandomWater() # Check that the indices returned are integers assert delete_water == int(delete_water) assert all([i == int(i) for i in atom_indices]) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleteRandomWater(self):\n # Insert a random water\n delete_water, atom_ids = gcmc_system_sampler.deleteRandomWater()\n\n # Check that the indices returned are integers\n assert delete_water == int(delete_water)\n assert all([i == int(i) for i in atom_ids])\n\n re...
[ "0.76301825", "0.7191139", "0.59051096", "0.57779187", "0.5739509", "0.56568503", "0.5618967", "0.5591656", "0.5591656", "0.5516601", "0.5448119", "0.5411559", "0.5407415", "0.53482056", "0.53217196", "0.5315446", "0.530809", "0.5303515", "0.5301117", "0.5250197", "0.5238719"...
0.78150624
0
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.7422651", "0.7287236", "0.70962775", "0.70318127", "0.70313793", "0.7012452", "0.7001971", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.6994604", "0.69789433", "0.6920525",...
0.0
-1
Make sure the StandardGCMCSphereSampler.move() method works correctly
def test_move(self): # Run a handful of GCMC moves n_moves = 10 std_gcmc_sphere_sampler.move(std_gcmc_sphere_simulation.context, n_moves) # Check that all of the appropriate variables seem to have been updated # Hard to test individual moves as they are rarely accepted - just ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.72049004", "0.7142516", "0.66742307", "0.64757967", "0.63471234", "0.62169033", "0.6189794", "0.6142323", "0.5829866", "0.5796106", "0.57257146", "0.5686311", "0.5682403", "0.56603277", "0.5642538", "0.5639076", "0.56338567", "0.560922", "0.5587057", "0.55868924", "0.55843...
0.67660964
2
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the NonequilibriumGCMCSphereSampler.move() method works correctly
def test_move(self): neq_gcmc_sphere_sampler.reset() # Just run one move, as they are a bit more expensive neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1) # Check some of the variables have been updated as appropriate assert neq_gcmc_sphere_sampler.n_moves =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_sphere_sampler.move(gcmc_sphere_simulation.context))\n\n return None", "def test_move(self):\n # Run a handful of GCMC moves\n n_moves = 10\n ...
[ "0.74134445", "0.71293914", "0.69717276", "0.6844426", "0.6774158", "0.65357774", "0.6450368", "0.63212657", "0.61129725", "0.59394455", "0.59110534", "0.58613527", "0.57763714", "0.5770376", "0.5766818", "0.5765549", "0.5754707", "0.5747235", "0.56879604", "0.5626373", "0.55...
0.7558569
0
Make sure the NonequilibriumGCMCSphereSampler.insertionMove() method works correctly
def test_insertionMove(self): # Prep for a move # Read in positions neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_sphere_sampler.positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.7209169", "0.71998745", "0.7198035", "0.69792235", "0.68337613", "0.6774714", "0.6697102", "0.6559923", "0.6445582", "0.6215921", "0.6078141", "0.5641775", "0.5602461", "0.55762756", "0.5568384", "0.5548173", "0.5492333", "0.5485724", "0.5446329", "0.54125756", "0.53864336...
0.7701173
0
Make sure the NonequilibriumGCMCSphereSampler.deletionMove() method works correctly
def test_deletionMove(self): # Prep for a move # Read in positions neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_sphere_sampler.positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deletionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context\n state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_system_sampl...
[ "0.7485762", "0.6438369", "0.6428132", "0.62262905", "0.6145327", "0.6085681", "0.6073769", "0.60079294", "0.60004663", "0.5970122", "0.5940385", "0.5844463", "0.57683086", "0.5733593", "0.57244855", "0.5646963", "0.56085235", "0.5596272", "0.55913806", "0.5586423", "0.558213...
0.7886815
0
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the GCMCSystemSampler.initialise() method works correctly
def test_initialise(self): # Make sure the variables are all updated assert isinstance(gcmc_system_sampler.context, Context) assert isinstance(gcmc_system_sampler.positions, Quantity) assert isinstance(gcmc_system_sampler.simulation_box, Quantity) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSystemSampler():\n # Make variables global so that they can be used\n global gcmc_system_sampler\n global gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSystem(pdb.topology, ...
[ "0.7476611", "0.7406292", "0.6950565", "0.67265517", "0.66819036", "0.65851617", "0.6512759", "0.63053226", "0.62894577", "0.6267865", "0.6263761", "0.6206305", "0.61907214", "0.61907214", "0.61907214", "0.61799055", "0.6173661", "0.6127892", "0.6094525", "0.6079967", "0.6033...
0.70493156
2
Make sure the GCMCSystemSampler.move() method works correctly
def test_move(self): # Shouldn't be able to run a move with this sampler self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_system_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_system_sampler.move(neq_gcmc_system_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_system_sampl...
[ "0.69886005", "0.6938794", "0.6935821", "0.6869701", "0.67401326", "0.67089957", "0.6217315", "0.6078865", "0.6038649", "0.5992114", "0.5985543", "0.59831053", "0.5977594", "0.5931836", "0.5905786", "0.5886545", "0.5886054", "0.5833608", "0.57884306", "0.5736834", "0.57317823...
0.7292309
0
Make sure the GCMCSystemSampler.insertRandomWater() method works correctly
def test_insertRandomWater(self): # Insert a random water new_positions, wat_id, atom_ids = gcmc_system_sampler.insertRandomWater() # Check that the indices returned are integers - may not be type int assert wat_id == int(wat_id) assert all([i == int(i) for i in atom_ids]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertRandomWater(self):\n # Insert a random water\n new_positions, wat_id, atom_ids = gcmc_sphere_sampler.insertRandomWater()\n\n # Check that the indices returned are integers - may not be type int\n assert wat_id == int(wat_id)\n assert all([i == int(i) for i in atom_...
[ "0.6928528", "0.6385021", "0.61273587", "0.60822636", "0.60734993", "0.60668766", "0.57946825", "0.5652783", "0.54904884", "0.5488012", "0.54828304", "0.54828304", "0.5407029", "0.5398256", "0.5383638", "0.5353736", "0.5327705", "0.53053445", "0.52523714", "0.5250405", "0.524...
0.72111976
0
Make sure the GCMCSystemSampler.deleteRandomWater() method works correctly
def test_deleteRandomWater(self): # Insert a random water delete_water, atom_ids = gcmc_system_sampler.deleteRandomWater() # Check that the indices returned are integers assert delete_water == int(delete_water) assert all([i == int(i) for i in atom_ids]) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleteRandomWater(self):\n # Insert a random water\n delete_water, atom_indices = gcmc_sphere_sampler.deleteRandomWater()\n\n # Check that the indices returned are integers\n assert delete_water == int(delete_water)\n assert all([i == int(i) for i in atom_indices])\n\n ...
[ "0.7379795", "0.6214693", "0.5664468", "0.56013966", "0.5546722", "0.5495053", "0.5435395", "0.53826165", "0.53622735", "0.532345", "0.52940685", "0.52940685", "0.52836555", "0.5280242", "0.5273561", "0.5255017", "0.5244421", "0.5212148", "0.5208511", "0.52065897", "0.5205397...
0.7646268
0
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the StandardGCMCSystemSampler.move() method works correctly
def test_move(self): # Run a handful of GCMC moves n_moves = 10 std_gcmc_system_sampler.move(std_gcmc_system_simulation.context, n_moves) # Check that all of the appropriate variables seem to have been updated # Hard to test individual moves as they are rarely accepted - just ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context))\n\n return None", "def test_move(self):\n neq_gcmc_system_sampler.reset()\n\n # Just run one mov...
[ "0.7181574", "0.6826627", "0.6822562", "0.6745499", "0.6640983", "0.65411764", "0.6038776", "0.59790057", "0.5942716", "0.5918189", "0.5876411", "0.5870334", "0.58546937", "0.58221716", "0.572842", "0.5687787", "0.56451154", "0.5627452", "0.55952823", "0.5567614", "0.55563265...
0.6848373
1
Get things ready to run these tests
def setUpClass(cls): # Make the output directory if needed if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'output')): os.mkdir(os.path.join(os.path.dirname(__file__), 'output')) # Create a new directory if needed if not os.path.isdir(outdir): os.mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # Have to wait for a server connection before we\n # can run the test\n self.wait_for_server_connections(10)", "def tests():", "def test_generate_all_testing(self):\n pass", "def setup( self ):", "def setUp(self):\n self.setup_beets()", "def test_01_I...
[ "0.74245423", "0.7288928", "0.709723", "0.703299", "0.7032221", "0.7013128", "0.7003242", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6995902", "0.6980169", "0.6921708", "0...
0.0
-1
Make sure the NonequilibriumGCMCSystemSampler.move() method works correctly
def test_move(self): neq_gcmc_system_sampler.reset() # Just run one move, as they are a bit more expensive neq_gcmc_system_sampler.move(neq_gcmc_system_simulation.context, 1) # Check some of the variables have been updated as appropriate assert neq_gcmc_system_sampler.n_moves =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context))\n\n return None", "def test_move(self):\n # Run a handful of GCMC moves\n n_moves = 10\n ...
[ "0.769783", "0.74639684", "0.7438356", "0.7360609", "0.73240685", "0.72791535", "0.6381922", "0.6381247", "0.63642156", "0.635932", "0.6350762", "0.6348595", "0.63146937", "0.6295221", "0.62767977", "0.6261591", "0.6196394", "0.61194867", "0.61188483", "0.6117917", "0.6047609...
0.7515609
1
Make sure the NonequilibriumGCMCSystemSampler.insertionMove() method works correctly
def test_insertionMove(self): # Prep for a move # Read in positions neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_system_sampler.positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context\n state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_sphere_samp...
[ "0.77547926", "0.72145873", "0.7090594", "0.70797455", "0.6963121", "0.6911819", "0.6842811", "0.66163623", "0.64768654", "0.63967305", "0.62777495", "0.6137192", "0.5995998", "0.59360576", "0.59151226", "0.5828478", "0.5789905", "0.5759315", "0.5706526", "0.567753", "0.56455...
0.7858803
0
Make sure the NonequilibriumGCMCSystemSampler.deletionMove() method works correctly
def test_deletionMove(self): # Prep for a move # Read in positions neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_system_sampler.positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deletionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context\n state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_sphere_sampl...
[ "0.7867403", "0.6501173", "0.6406832", "0.63714015", "0.62150633", "0.6205262", "0.61711025", "0.6090827", "0.60874534", "0.6077852", "0.60104895", "0.59488875", "0.5947629", "0.5926822", "0.59081423", "0.590085", "0.58612853", "0.58450735", "0.5831866", "0.5831866", "0.57898...
0.7957777
0
Init method that creates connection and iterates data folder.
def __init__(self): self.connection = self.get_connection()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dir_path, window_size,\n user_map_path, computer_map_path, auth_type_map_path, logon_type_map_path):\n logging.info(f\"Initiating Dataset instance for directory {dir_path}\")\n self.directory = dir_path\n self.filenames = [filename for filename in os.listdir(...
[ "0.65322316", "0.637263", "0.6249433", "0.62027884", "0.6196576", "0.6175284", "0.6166833", "0.61262244", "0.6097434", "0.6095836", "0.6089378", "0.6080158", "0.60653484", "0.6035975", "0.60190237", "0.60178757", "0.59992707", "0.597802", "0.5973767", "0.59712183", "0.5955256...
0.56437683
55
(obj) > (obj) Method that will return connection to the database using given credentials.
def get_connection(self): return dbapi.connect(credentials.SERVER,\ credentials.PORT,\ credentials.USER,\ credentials.PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(db, username=None, password=None, **kwargs):\n global _connection_settings, _db_name, _db_username, _db_password, _db\n _connection_settings = dict(_connection_defaults, **kwargs)\n _db_name = db\n _db_username = username\n _db_password = password\n return _get_db(reconnect=True)", ...
[ "0.7528545", "0.7352598", "0.7319592", "0.7257597", "0.7221091", "0.7190557", "0.7125156", "0.7116309", "0.70870197", "0.7086611", "0.7075302", "0.70648813", "0.7061649", "0.7060165", "0.7057439", "0.7055212", "0.7048197", "0.70444536", "0.70107573", "0.69982386", "0.69969594...
0.8073522
0
(obj) > (str) Building query for execution
def _build_test_query01(self): query = 'select "GLOBALEVENTID", "SQLDATE", "MonthYear", "Year" ' + \ 'from "DEMOUSER00"."uni.vlba.gdelt.data::gdelt_dailyupdates"' return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_query(self):", "def generate_query(self):\n return", "def query(self, query):", "def _build_query(self, **query):\n\n available_fields = list(self.model._available_fields.keys())\n\n q_str = ''\n for key, val in list(query.items()):\n # Get the field and th...
[ "0.74506533", "0.72618586", "0.68690604", "0.6727901", "0.6704122", "0.66704446", "0.66589046", "0.65477747", "0.6473235", "0.64644617", "0.6462342", "0.6396681", "0.6358946", "0.6354206", "0.6349587", "0.6325434", "0.63069355", "0.6219109", "0.6207746", "0.6207217", "0.62033...
0.0
-1
(list) > (str) Fetching values from the given row(tuple) that are presented in form of list.
def fetch_row_into_str(self, row): str_row = "" for value in row: str_row = str_row + str(value) + ' | \t\t' return str_row[:-5]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRow(self, row):\n returnvalue = list()\n for item in self._value[row]:\n returnvalue.append(item)\n return returnvalue", "def _get_xls_row_vals(self, row):\n return [v.value for v in row]", "def values(table, row, columns):\n\n values = []\n for x, column in ...
[ "0.69217086", "0.67158365", "0.65856916", "0.6451743", "0.6403767", "0.6316137", "0.6300533", "0.6300533", "0.62184757", "0.6168762", "0.6135526", "0.6112956", "0.6109464", "0.60993624", "0.6089436", "0.60525525", "0.5972258", "0.5962208", "0.59575963", "0.5947596", "0.592676...
0.5326618
100
(obj, str) > NoneType Running given query and using given connection. Fetching result rows and printing them to standard output.
def execute_query(self, query, fetch=False): cursor = self.connection.cursor() executed_cur = cursor.execute(query) if executed_cur: if fetch: result_cur = cursor.fetchall() for row in result_cur: print fetch_row_into_str(row) else: print "[e] Something wrong with execution."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query(cur, query, show_results=False):\n num_rows = cur.execute(query)\n print('the query returned {} rows'.format(num_rows))\n if show_results:\n for row in cur.fetchall():\n print(row)", "def answer_query(query, conn, curs):\r\n results = conn.execute(query)\r\n results...
[ "0.76009005", "0.73438525", "0.72629637", "0.71196103", "0.7087542", "0.6934488", "0.685337", "0.68415636", "0.6833352", "0.677931", "0.67263293", "0.6667802", "0.6640822", "0.663478", "0.6630659", "0.6616692", "0.6614022", "0.66114473", "0.6609693", "0.6557219", "0.65535396"...
0.7054042
5
(obj, str) > list() Converting input line that suppose to be an csv to the separated list.
def line_to_list(self, _line): result = list() _line_splited = _line.split('\t') for value in _line_splited: value_stripped = value.strip().rstrip() result.append(value_stripped) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_csv_line(line):\r\n return line.strip().split(',')", "def csv_line(value_parser):\n def convert(string):\n return list(map(value_parser, string.split(',')))\n return convert", "def lineToList(self, line):\n l = [item for item in next(csv.reader(StringIO.StringIO(line), self.CSVD...
[ "0.75949764", "0.7164469", "0.68289167", "0.6725227", "0.6720052", "0.6612868", "0.6583956", "0.64902407", "0.641971", "0.63536537", "0.63398874", "0.6332436", "0.63174677", "0.6312271", "0.628587", "0.6243127", "0.6242734", "0.6242734", "0.6237079", "0.6194998", "0.617001", ...
0.6869202
2
(obj, str) > str Escape symbols to be used in sql statements.
def escapeinput_data_for_sql(self, value, sql_type): # print value value = value.replace('\'', '"') value = value.replace(',', '_') if len(value) == 0: if sql_type in ('BIGINT', 'INTEGER', 'FLOAT', 'DOUBLE'): return '0' if sql_type == 'NVARCHAR': return '\'\'' else: if sql_type in ('BIGINT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(self, expr):\n return mysql.connector.conversion.MySQLConverter().escape(expr)", "def quote(self, expr):\n return \"'\" + self.escape(str(expr)) + \"'\"", "def escape(self):\n pass", "def mysql_quote(x):\n if not x:\n return \"NULL\"\n x = x.replace(\"\\\\\", \"\\...
[ "0.6458438", "0.62238497", "0.621781", "0.6184704", "0.6025963", "0.5946433", "0.5932929", "0.5927912", "0.58921474", "0.58584756", "0.5854378", "0.5850931", "0.5849089", "0.581277", "0.5790382", "0.576162", "0.575403", "0.5749239", "0.5723439", "0.57120687", "0.5693903", "...
0.0
-1
(obj, list, list, list, boolean) > (str) Building part of the query, according to the value passed with 'query_part' parameter (should be 1 or 2).
def build_query_part(self, input_data, table_fields_types, query_part): result_query = '(' for index in xrange(len(input_data)): if query_part == 1: proper_value = '"' + input_data[index] + '"' if query_part == 2: if "nextval" not in input_data[index]: proper_value = self.escapeinput_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generateQuery(self, query):\n if query == None:\n return [\"1=1\"]\n elif type(query) is not list:\n return [query]\n else:\n return query", "def make_complex_query_set(self):\n\n query = self.request.GET.get(\"q\")\n program_id = self.req...
[ "0.6225745", "0.60901934", "0.60255617", "0.5791044", "0.5705478", "0.56317335", "0.5615809", "0.55866855", "0.5552422", "0.5450757", "0.5444924", "0.54353344", "0.53419", "0.5271756", "0.5258663", "0.5253045", "0.5239043", "0.5230882", "0.52274454", "0.52210087", "0.52185774...
0.70095813
0
(obj, str, list, list) > (str) Returning "insert" SQL statement with values.
def form_insert_query(self, table_name, input_data, table_fields_names=None, table_fields_types=None): # creating first part of the query -> section with columns' names query_table_structure = self.build_query_part(table_fields_names, table_fields_types, query_part=1) # creating second part of the query -> sect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_sql(self, table, insert_values):\n if isinstance(insert_values, dict):\n keys = []\n values = []\n for k, v in insert_values.items():\n keys.append(k)\n if v is None:\n values.append('')\n elif isins...
[ "0.7786701", "0.7468949", "0.7432973", "0.74259865", "0.72058713", "0.7184613", "0.7164827", "0.71338683", "0.71334565", "0.7122251", "0.7071047", "0.7063761", "0.7004349", "0.6975342", "0.694661", "0.6939397", "0.6924211", "0.6909788", "0.6890641", "0.6878951", "0.6845659", ...
0.0
-1
(obj, str) > (list(), list()) Extracting table identifiers from the ".txt" mask file. 'Table Definitions' are taken by simple "Copy>Paste" from 'Open Definition' visual interface of table in SAP HANA Studio.
def identify_table_mask(self, maskdata_file_name='daily_update_table-mask.txt', delim=';'): table_fields_names, table_fields_types = list(), list() mask_f = open(META_INFO_DIRECTORY + '/' + maskdata_file_name, "r") # skipping line with descriptions of attributes line = mask_f.readline() # first line wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetDefinitions(filename,obj):\n file=open(filename)\n content=file.read().replace(\"\\t\",\" \")\n file.close\n pat=re.compile(obj +' \\{([\\S\\s]*?)\\}',re.DOTALL)\n finds=pat.findall(content)\n return finds", "def find_table_command(input_file):\n contents = open(input_file, 'r')\n ...
[ "0.6227015", "0.56853586", "0.5597648", "0.5541076", "0.54774153", "0.5453966", "0.53986174", "0.5364839", "0.53526664", "0.5321016", "0.5305525", "0.5287184", "0.5245256", "0.5241831", "0.5231992", "0.5211202", "0.5209902", "0.52098477", "0.51902837", "0.51770276", "0.517508...
0.5998301
1
(obj,) > boolean Checking if data is already loaded into db's table.
def check_if_row_already_loaded(self, row, file_name): query = "SELECT count(*) FROM " + TABLE_NAME + " WHERE GLOBALEVENTID = " + "'" + row[0] + "'" try: # print query cursor = self.connection.cursor() executed_cur = cursor.execute(query) if executed_cur: result_cur = cursor.fetchall() f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_loaded_check(self):\n return True", "def db_has_object(rep_cursor, sql, query_args):\n rep_cursor.execute(sql, query_args)\n if rep_cursor.rowcount == 0:\n return False\n return True", "def _exists (self):\n cursor = self._exec (self.select)\n return bool (cursor.f...
[ "0.6943474", "0.68638754", "0.6641932", "0.6614292", "0.66038424", "0.64612883", "0.6376495", "0.6328476", "0.6302793", "0.62997705", "0.62929714", "0.629125", "0.62693715", "0.62334293", "0.62234014", "0.6199559", "0.6187284", "0.6176301", "0.6151032", "0.6147922", "0.613803...
0.63383526
7
(obj, list) > boolean Checking if row is to be valid to inserrted.
def is_valid_row_to_insert(self, row): if row[5] == COUNTRY or row[15] == COUNTRY: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_row(self):\r\n return self.valid_row", "def validate(self, row):\n raise NotImplementedError", "def _validate_row(self, row):\n\n # assume value.\n is_valid = True\n\n # test if each field in @row has the correct data type.\n tests = []\n for fi...
[ "0.7949116", "0.7407488", "0.7403638", "0.73143804", "0.72224575", "0.71624714", "0.7001095", "0.68070215", "0.6799853", "0.6750885", "0.6745441", "0.6681107", "0.668088", "0.6449475", "0.6376525", "0.6330244", "0.6321344", "0.6238823", "0.6232478", "0.6229483", "0.6198405", ...
0.6529725
13
(obj, list, list, list) > NoneType Inserting one single row to table.
def insert_data(self, row, table_fields_names, table_fields_types): query = '' try: query = self.form_insert_query(TABLE_NAME, row, table_fields_names, table_fields_types) # print query self.execute_query(query) except Exception, e: print '[e] Exeption: %s' % (str(e)) print '\t[q] Quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_table_row(self, db: str, table: str, row: Dict[str, Any]):\n pass", "def info_insert(tbl_mgr, table_str, row_arr):\n val_str = \"(\"\n\n for col in range(len(row_arr)):\n if col > 0:\n val_str += \", \"\n if row_arr[col] is None:\n val_str += \"NULL\"\...
[ "0.73631203", "0.6934004", "0.69239914", "0.6890251", "0.66995037", "0.66891676", "0.65547365", "0.6468297", "0.6453737", "0.6453333", "0.6392642", "0.63380957", "0.6335886", "0.6317819", "0.6305761", "0.6293148", "0.6282897", "0.626277", "0.6242966", "0.62419975", "0.6236205...
0.6683566
6
(obj) > NoneType Fetching data from CSV with GDELT data and loading to database (with insert statements).
def load_twitter_data_to_db(self, truncate_table=False, skip_loaded_files=False): table_fields_names, table_fields_types = self.identify_table_mask('twitter_stream_table-mask.txt') # Truncating table if truncate_table: query = 'TRUNCATE TABLE ' + TABLE_NAME; try: self.execute_query(query) except E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_glucose_from_csv(user, csv_file):\n csv_data = []\n reader = csv.reader(csv_file.read().splitlines(), delimiter=',',\n quotechar='\"')\n for row in reader:\n csv_data.append([item.strip() for item in row])\n\n glucose_objects = []\n\n # Check if headers exist...
[ "0.6225475", "0.61713827", "0.6018862", "0.5890352", "0.5874249", "0.5863172", "0.5847302", "0.5836998", "0.58211", "0.5770075", "0.5767906", "0.57509094", "0.57297736", "0.57212746", "0.57081926", "0.5701854", "0.5697785", "0.5686698", "0.5680296", "0.5675238", "0.5667102", ...
0.0
-1
(NoneType) > NoneType Main method that creates objects and start processing.
def main(): gdl = TwitterDataLoader() gdl.load_twitter_data_to_db(truncate_table=False, skip_loaded_files=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, objects: typing.Any) -> None:\n pass", "def make_objects(self):\n pass", "def main(self) -> None:\n pass", "def main(self):\r\n pass", "def _initialise_run(self) -> None:", "def main(self):\n\n self._setup_task_manager()\n self._setup_source_and_des...
[ "0.6855316", "0.6721951", "0.6673009", "0.6668939", "0.6596901", "0.6416985", "0.64162403", "0.63482755", "0.6343455", "0.62667793", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", "0.6263516", ...
0.0
-1
convert netcdf variable to string for rfm input
def ncvar_to_str(data, variable_name, unit_factor=1., separator=','): return np.array2string(unit_factor*data[variable_name][:], separator=separator, precision=3, max_line_width=80)[1:-1] + '\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.identity(default=self.nc_get_variable(\"\"))", "def to_netcdf(self, outfile):", "def read_netcdf(self,filename):", "def read_nc(input_file_path_str,var_name=None):\r\n\r\n if not exists(dirname(input_file_path_str)):\r\n print('*** ERROR, input file path does...
[ "0.56684077", "0.56515074", "0.5517042", "0.5477448", "0.533655", "0.5274521", "0.5267746", "0.52513975", "0.5239401", "0.5221346", "0.52030563", "0.51221067", "0.5119322", "0.51039076", "0.5095084", "0.509416", "0.5086682", "0.5085247", "0.50754094", "0.506929", "0.5048053",...
0.6453824
0