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
Function to create a dataframe of all the upstream catchments from specific locations. Input should be the output from ArcGIS script (2 columns of catchments and sites).
def catch_net(catch_sites_csv, catch_sites_col=['GRIDCODE', 'SITE']): ## Read in data catch_sites_names=['catch', 'site'] catch_sites = read_csv(catch_sites_csv)[catch_sites_col] catch_sites.columns = catch_sites_names ## Reorganize and select intial catchments catch_sites1 = catch_sites[catch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg_catch(catch_del_shp, catch_sites_csv, catch_sites_col=['GRIDCODE', 'SITE'], catch_col='GRIDCODE'):\n\n ## Catchment areas shp\n catch = read_file(catch_del_shp)[[catch_col, 'geometry']]\n\n ## dissolve the polygon\n catch3 = catch.dissolve(catch_col)\n\n ## Determine upstream catchments\n ...
[ "0.6559877", "0.5908647", "0.55847895", "0.5509037", "0.53329223", "0.52562225", "0.5231378", "0.5186255", "0.5075003", "0.50579935", "0.5006199", "0.49805748", "0.49723944", "0.4970214", "0.4946404", "0.49155456", "0.49110398", "0.4893645", "0.48922464", "0.4881623", "0.4866...
0.52581215
5
Function to take the output of the ArcGIS catchment delineation polygon shapefile and cathcment sites csv and return a shapefile with appropriately delineated polygons.
def agg_catch(catch_del_shp, catch_sites_csv, catch_sites_col=['GRIDCODE', 'SITE'], catch_col='GRIDCODE'): ## Catchment areas shp catch = read_file(catch_del_shp)[[catch_col, 'geometry']] ## dissolve the polygon catch3 = catch.dissolve(catch_col) ## Determine upstream catchments catch_df, sin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_catchments(catchmentfile, flowfile, elevationfile, comid, \n output = None, overwrite = False, verbose = True):\n\n t0 = time.time()\n numpy.seterr(all = 'raise')\n\n if output is None: output = os.getcwd() + r'\\combined'\n\n if os.path.isfile(output + '.shp') and not...
[ "0.5526519", "0.55115604", "0.5385016", "0.53638154", "0.5314633", "0.53080976", "0.5173656", "0.50681376", "0.50139534", "0.49680954", "0.495339", "0.49488038", "0.49403173", "0.49082854", "0.49027666", "0.48932567", "0.48877347", "0.4870424", "0.48680896", "0.48623064", "0....
0.5947495
0
Catchment delineation using the REC streams and catchments. sites_shp Points shapfile of the sites along the streams.\n sites_col The column name of the site numbers in the sites_shp.\n catch_output The output polygon shapefile path of the catchment delineation.
def rec_catch_del(sites_shp, sites_col='site', catch_output=None): ### Parameters server = 'SQL2012PROD05' db = 'GIS' streams_table = 'MFE_NZTM_REC' streams_cols = ['NZREACH', 'NZFNODE', 'NZTNODE'] catch_table = 'MFE_NZTM_RECWATERSHEDCANTERBURY' catch_cols = ['NZREACH'] ### Modificatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg_catch(catch_del_shp, catch_sites_csv, catch_sites_col=['GRIDCODE', 'SITE'], catch_col='GRIDCODE'):\n\n ## Catchment areas shp\n catch = read_file(catch_del_shp)[[catch_col, 'geometry']]\n\n ## dissolve the polygon\n catch3 = catch.dissolve(catch_col)\n\n ## Determine upstream catchments\n ...
[ "0.62439525", "0.57997125", "0.48219526", "0.46345586", "0.4631852", "0.46315864", "0.4526034", "0.45056954", "0.44907907", "0.44516155", "0.44467697", "0.44328094", "0.44328094", "0.43942088", "0.43738577", "0.43644437", "0.43510073", "0.42912412", "0.428687", "0.4282901", "...
0.776218
0
Return prob(chisq >= chi, with df degrees of freedom). df must be even.
def chi2P(chi, df): assert df & 1 == 0 # If chi is very large, exp(-m) will underflow to 0. m = chi / 2.0 sum = term = exp(-m) for i in range(1, df//2): term *= m / i sum += term # With small chi and large df, accumulated # roundoff error, plus error in # the platform exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def achisqprob(chisq,df):\r\n BIG = 200.0\r\n def ex(x):\r\n BIG = 200.0\r\n exponents = N.where(N.less(x,-BIG),-BIG,x)\r\n return N.exp(exponents)\r\n\r\n if type(chisq) == N.ndarray:\r\n arrayflag = 1\r\n else:\r\n arrayflag = 0\r\n chisq = N.array([chisq])\r...
[ "0.74559987", "0.724271", "0.69441646", "0.6661619", "0.6657019", "0.60960495", "0.6026556", "0.59603435", "0.5947283", "0.5885562", "0.5863677", "0.5858906", "0.5848407", "0.58128613", "0.581115", "0.580568", "0.57811344", "0.57709396", "0.572794", "0.5714124", "0.56916016",...
0.7435911
1
Read a C1.CSV file using csv.DictReader
def loadC1(filename): data = [] with open(filename) as f_obj: reader = csv.DictReader(f_obj, delimiter=';') for line in reader: dTetta = float(line['dTetta']) Q = float(line['Q']) U = float(line['U']) V = float(line['V']) item = itemC1(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_dict_reader(file_obj):\n #import re\n #file = open(file_obj)\n\n # reader = csv.DictReader(file_obj)\n # for line in reader:\n # print(line[\"Name\"])", "def csv_dict_reader(file_path):\r\n with open(file_path, 'r') as file_obj:\r\n\r\n reader = csv.DictReader(file_obj, delim...
[ "0.76946783", "0.7543261", "0.7435131", "0.69613403", "0.6928663", "0.6915481", "0.68936694", "0.6893386", "0.6850034", "0.68068963", "0.67897266", "0.6773187", "0.67644227", "0.6734396", "0.672309", "0.67230624", "0.6668023", "0.6667102", "0.66442615", "0.66364485", "0.66364...
0.0
-1
Read a C2.CSV file using csv.DictReader
def loadC2(filename): data = [] with open(filename) as f_obj: reader = csv.DictReader(f_obj, delimiter=';') for line in reader: # dGamma, Q, U, V dGamma = float(line['dGamma']) Q = float(line['Q']) U = float(line['U']) V = float(line['V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_dict_reader(file_obj):\n #import re\n #file = open(file_obj)\n\n # reader = csv.DictReader(file_obj)\n # for line in reader:\n # print(line[\"Name\"])", "def CSVReader(self, input_file):\n f = open(input_file, 'r')\n reader = csv.reader(f)\n headers = reader.next()\n reader...
[ "0.7612505", "0.7385898", "0.7355741", "0.7106169", "0.69446945", "0.6906966", "0.68946433", "0.68873245", "0.687486", "0.6859886", "0.6836637", "0.6813016", "0.67940485", "0.6778344", "0.67435807", "0.67227536", "0.67118466", "0.66973794", "0.6679642", "0.66714406", "0.66629...
0.0
-1
Read a C3.CSV file using csv.DictReader
def loadC3(filename): data = [] with open(filename) as f_obj: reader = csv.DictReader(f_obj, delimiter=';') for line in reader: # dGamma, Alfa, Beta dGamma = float(line['dGamma']) Alfa = float(line['Alfa']) Beta = float(line['Beta']) it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_dict_reader(file_obj):\n #import re\n #file = open(file_obj)\n\n # reader = csv.DictReader(file_obj)\n # for line in reader:\n # print(line[\"Name\"])", "def csv_dict_reader(file_path):\r\n with open(file_path, 'r') as file_obj:\r\n\r\n reader = csv.DictReader(file_obj, delim...
[ "0.7582805", "0.74330664", "0.73564386", "0.6933669", "0.691283", "0.6908902", "0.6887531", "0.68846565", "0.686481", "0.68575877", "0.6850132", "0.6821035", "0.6745821", "0.6673853", "0.66631335", "0.6646696", "0.66155756", "0.66056746", "0.6605367", "0.6605286", "0.6596739"...
0.5735032
92
Read a MaterialRefraction.CSV file using csv.DictReader
def loadMaterial(filename): data = [] with open(filename, encoding="utf-8") as f_obj: reader = csv.DictReader(f_obj, delimiter=';') for line in reader: name = line['MaterialName'] re_min = float(line['ReValueMin']) re_max = float(line['ReValueMax']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_dict_reader(file_obj):\n #import re\n #file = open(file_obj)\n\n # reader = csv.DictReader(file_obj)\n # for line in reader:\n # print(line[\"Name\"])", "def csv_dict_reader(file_path):\r\n with open(file_path, 'r') as file_obj:\r\n\r\n reader = csv.DictReader(file_obj, delim...
[ "0.7296654", "0.72312284", "0.6741361", "0.6668469", "0.6529582", "0.6523582", "0.64916676", "0.62862843", "0.6276672", "0.62392443", "0.62238324", "0.6223094", "0.6220048", "0.6196683", "0.6186961", "0.6156472", "0.6146962", "0.6143966", "0.6129653", "0.61118865", "0.6110114...
0.5697329
59
Read a samples file for plane type calculation
def loadSamples(filename): data = [] with open(filename, encoding="utf-8") as f_obj: reader = csv.DictReader(f_obj, delimiter=';') for line in reader: Tetta = float(line['dTetta']) Lambda = float(line['Lambda']) item = TSample(Tetta, Lambda) data.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_from_file(self, filename):\n ff = fits.open(filename)\n # Load the normalized intensity\n self.norm_int = ff[0].data\n # Load the other parameters\n self.lam = ff[1].data['lam']\n self.lam_unit = ff[1].columns['lam'].unit\n self.theta = ff[2].data['theta']...
[ "0.63230526", "0.62693244", "0.62324", "0.62110573", "0.6139132", "0.613021", "0.6109676", "0.6094271", "0.6090338", "0.60887986", "0.60725564", "0.60611904", "0.60423905", "0.6030552", "0.5997111", "0.5997111", "0.59914887", "0.59912354", "0.59882784", "0.5980029", "0.596220...
0.6207575
4
safe to call on floats and arrays get_shape(1) > None, get_shape(ones(2)) > (2,)
def get_shape(x): return None if jnp.isscalar(x) else x.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(placeholder_shape, data_shape):\n\n return True", "def validate_common(ndarray, name):\n\tvalidate_ndarray(ndarray,(np.float, np.int), (2,) , name)", "def _is_scalar(shape):\n return F.shape_mul(shape) == 1", "def _is_scalar_from_shape(shape):\n return _logical_equal(_ndims_from_shape...
[ "0.72709566", "0.67900205", "0.67742664", "0.67406166", "0.6730081", "0.6688898", "0.664606", "0.6638844", "0.66229963", "0.65788215", "0.6564183", "0.65422463", "0.6526019", "0.65226525", "0.65096045", "0.64582187", "0.6442337", "0.64415085", "0.6415565", "0.63730866", "0.63...
0.586161
76
assume x is scalar if shape is None
def reshape(x, shape): return float(x) if shape is None else jnp.reshape(x, shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_scalar(x):\n return x.ndim == 0", "def is_scalar(x: Any) -> bool:\r\n return np.isscalar(x) or (isinstance(x, np.ndarray) and x.ndim == 0)", "def _is_scalar(shape):\n return F.shape_mul(shape) == 1", "def standardize_single_array(x):\n if x is None:\n return None\n if tensor_util...
[ "0.75711805", "0.69461375", "0.69240475", "0.6782489", "0.6748175", "0.66977507", "0.66780156", "0.6534423", "0.64858645", "0.640593", "0.64018637", "0.629402", "0.62908137", "0.62318295", "0.6230541", "0.61999226", "0.6194809", "0.61947954", "0.6124859", "0.60925704", "0.606...
0.6028252
24
floats (indicated by None) have 1 element
def num_elements(shape): return 1 if shape is None else int(np.prod(shape))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_float():\n x = float()\n return x", "def get_none1(self):\n pass", "def _preprocess_float(values: Sequence) -> Tuple[Union[float, NullValue]]:\n\n processed = [float(x)\n if isinstance(x, numbers.Number)\n else x\n for x ...
[ "0.6339963", "0.6163803", "0.5955822", "0.59350157", "0.5902223", "0.58178884", "0.5803332", "0.5800464", "0.57801056", "0.56740105", "0.56332743", "0.5626155", "0.56216", "0.560248", "0.5596908", "0.5581029", "0.5577356", "0.5514214", "0.5481083", "0.5474649", "0.5474362", ...
0.0
-1
Make a pair of functions flatten(tree) > x, unflatten(x) > tree
def flatten_and_unflatten(input_tree) -> Tuple[Callable, Callable]: tree_structure = tree_util.tree_structure(input_tree) leaf_shapes = [get_shape(leaf) for leaf in tree_util.tree_leaves(input_tree)] def flatten(tree): leaves = tree_util.tree_leaves(tree) flattened_leaves = [reshape(leaf,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten():", "def flatten(node: ir.Node) -> ir.Node:\n\n def visitor(node: ir.Node, args=None) -> ir.Node:\n if isinstance(node, ir.BinaryOp):\n\n # Flatten singleton BinaryOp\n if len(node.operand) == 1:\n return flatten(node.operand[0])\n\n # Flatten BinaryOp with reduction operat...
[ "0.7424356", "0.7009518", "0.673188", "0.6717321", "0.6695242", "0.6640111", "0.66385573", "0.6636192", "0.6581992", "0.6532039", "0.6504157", "0.65039814", "0.6488403", "0.6451589", "0.643888", "0.6405306", "0.6398433", "0.63705224", "0.6344484", "0.62895566", "0.6286946", ...
0.7750934
0
load all training data into a dictionary stored in order of X, u, L, W, k
def load_all(): training_data = dict() for i in range(7): training_data[i+1] = load_data(i+1) return training_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_training_data(self):\n self._save_training_data()", "def training_data(self):\n if self._training_data is None:\n self._load_training_data()\n if self._swapped_training_data is None:\n self._swapped_training_data = {}\n for key, value in self._train...
[ "0.72685313", "0.6999833", "0.6843773", "0.6823378", "0.6724388", "0.6672758", "0.6670386", "0.6663503", "0.6590046", "0.65890056", "0.6577699", "0.6511327", "0.6481927", "0.6450511", "0.64183396", "0.6417053", "0.6415652", "0.6405644", "0.63804287", "0.6376085", "0.6344903",...
0.8075104
0
compile the training set corresponding to experiments listed in ind_list
def make_training_set(ind_list, training_data): exp = training_data[ind_list[0]] X_train = exp[0] u_train = exp[1] for i in ind_list[1:]: exp = training_data[i] X_train = np.append(X_train, exp[0], axis=0) u_train = np.append(u_train, exp[1], axis=0) return X_train...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, input_vects):\n \n #Training iterations\n for iter_no in range(self._n_iterations):\n #Train with each vector one by one\n if iter_no % 20 == 0:\n print(iter_no)\n for input_vect in input_vects:\n self._sess.run(self._trai...
[ "0.5979961", "0.58931327", "0.5842986", "0.5816581", "0.5816086", "0.5768412", "0.575343", "0.5698102", "0.5657766", "0.5611364", "0.55773675", "0.5553645", "0.5535842", "0.55307597", "0.5524448", "0.5512024", "0.5494072", "0.5475803", "0.54679567", "0.5410617", "0.5362356", ...
0.64535296
0
Verteld of de tree leeg is of niet
def isEmpty(self): if self.size == 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree():\n nobv.visual_tree()", "def drawtree(self):\r\n\r\n Phylo.draw(self.tree)", "def visit(self):\n self.tree = self.recursive_visit(self.tree)\n # assert self.current_line == self.tree.absolute_bounding_box.bottom_right.line", "def visualise_binary_tree(self):\n tree_e...
[ "0.742669", "0.6817363", "0.6572952", "0.6495102", "0.644491", "0.64102066", "0.6300795", "0.6276956", "0.6271785", "0.6242756", "0.61643314", "0.614813", "0.6090898", "0.60891956", "0.60890216", "0.608826", "0.6072502", "0.60488236", "0.60438526", "0.6036604", "0.60356086", ...
0.0
-1
Voegt item toe aan tree
def insert(self, key, content, root=None): if root is None: root = self.root if self.size == 0: self.root = Node(content, key) self.allNodes.append(self.root) self.size += 1 return elif key >= root.key: if root.right is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self, i: int, o: 'Tree') -> None:\n ...", "def add(self, item):\r\n self.root = self.recurse_add(self.root, item)", "def add(tree, item):\n # This is a non recursive add method. A recursive method would be cleaner.\n if tree.root == None: # ... Empty tree ...\n tree....
[ "0.6387445", "0.63075423", "0.62571263", "0.62491727", "0.6172571", "0.6109202", "0.60886395", "0.60559595", "0.6052861", "0.60287714", "0.6014096", "0.59769017", "0.59751266", "0.59655714", "0.59653354", "0.595593", "0.5940784", "0.5928278", "0.58982855", "0.5893961", "0.589...
0.0
-1
Verwijdert item uit tree
def delete(self, key): root = self.find(key, True) if root is False: return False parent = root.parent # root deleten if self.root == root: found = False current = root if root.left is not None: current = root.lef...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(self):\n\n\t\tdb.session.delete(self)\n\t\tdb.session.commit()", "def delete(self):\n self.parent.delete_node(self)", "def __delitem__(self, key):\n if self._size > 1:\n node_to_delete = self._getItemHelper(key, self._root)\n if node_to_delete:\n ...
[ "0.65211713", "0.64184713", "0.6387559", "0.63569087", "0.634312", "0.6334422", "0.63276106", "0.63249993", "0.62840253", "0.6268403", "0.62670267", "0.6182453", "0.6156681", "0.6122682", "0.61049175", "0.6080987", "0.60439867", "0.6016591", "0.60058963", "0.6005304", "0.5999...
0.57628065
40
Zoekt in de tree naar het item dat bij het gegeven key hoort
def find(self, key, forDel=False): found = False root = self.root while not found: if key > root.key: if root.right is None: print("Key not found") return False root = root.right elif key < root.key: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n if self.child_keys is None:\n self.child_keys = sorted(self.children.keys(), key=str.lower)\n return self.children[self.child_keys[item]]", "def __getitem__(self, item: int) -> int:\n return self.root[item].key", "def _insert(self, key: int) -> Tre...
[ "0.6803085", "0.65903795", "0.6250117", "0.61360836", "0.6082913", "0.6021574", "0.5987229", "0.5981191", "0.5947651", "0.5926669", "0.5909166", "0.5901913", "0.5853368", "0.584072", "0.579246", "0.5786548", "0.57726324", "0.5757052", "0.5740202", "0.572945", "0.5721693", "...
0.5882669
12
zet tree om naar dot en png
def print(self): dot = "digraph G {\nrankdir = UD\n" for i in range(len(self.allNodes)): if self.allNodes[i].left is not None: dot += str(self.allNodes[i].key) + " -> " + str(self.allNodes[i].left.key) + "\n" if self.allNodes[i].right is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawtree(self):\r\n\r\n Phylo.draw(self.tree)", "def _repr_png_(self):\n return self.tree._repr_png_()", "def tree():\n nobv.visual_tree()", "def debug_dot (tree, fn):\n\n if __debug__ and DEBUG_DOT:\n dot = tree.to_dot ()\n debug (\"writing dot: %s\", fn)\n with ...
[ "0.7049467", "0.6888196", "0.6836354", "0.67927814", "0.6758332", "0.66430676", "0.6581356", "0.65705216", "0.6519011", "0.6504541", "0.6384689", "0.6383924", "0.6375139", "0.6375139", "0.63687086", "0.63460416", "0.63119423", "0.62603015", "0.6194407", "0.61821556", "0.61777...
0.6703262
5
Trains the network using back propagation, use the logistic activation function and the square loss, along with bias inputs
def fit(self, X, y, alpha, t): m = X.shape[0] # number of examples n = X.shape[1] # number of features normalized_X = normalize(X) # normalize X for accuracy K = len(np.unique(y)) # number of units in the output layer = number of classes if K == 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backprop(self, x, y):\n \n #Building an empty networks filled with empty 0 \n updated_bias = []\n for b in self.biases:\n updated_bias.append(np.zeros(b.shape)) \n \n updated_weight = []\n for w in self.weights:\n updated_weight.appe...
[ "0.70576835", "0.6613435", "0.6567604", "0.6545431", "0.65237206", "0.65193415", "0.64829934", "0.6418162", "0.64143413", "0.64051306", "0.6401433", "0.6364397", "0.6361401", "0.6345978", "0.6330163", "0.63294196", "0.6279485", "0.6272271", "0.6270294", "0.6262799", "0.625279...
0.0
-1
Returns the class probabilities for a (q, n)shaped numpy array T of test examples. Assume T has the same columns as X used in training. Return value should be an (q, k)shaped numpy array, P, in which k is the number of distinct classes in y during training P[i, j] is the model's probability of example i belonging to cl...
def predict(self, T): # a is a list of size (h+2), each element is the array of the activation values for each layer a = [None] * (self.h+2) # z is a list of size (h+2), each element is the array of the input values for each layer # z[0] should be None and never be accessed z = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimatePosterior(trainX, trainC, testX):\n P = [] # Classification computed by the algorithm\n (p, q, r) = estimateProbabilities(trainX, trainC)\n n = len(testX)\n c = 2 # Number of classes\n for i in range(n):\n P.append([])\n for j in range(c):\n res = bayes(j, testX[...
[ "0.65724635", "0.6323323", "0.6309152", "0.62347585", "0.61794364", "0.6172974", "0.61581737", "0.61085993", "0.60545534", "0.60510653", "0.60303223", "0.6023098", "0.598686", "0.5980664", "0.5979464", "0.5968876", "0.5946437", "0.593831", "0.591688", "0.5899787", "0.58854496...
0.56429154
42
Prints the current weights from the input layer to the output layer
def print(self): for l in range(self.h+1): print("Weight matrix between layer " + str(l) + " and layer " + str(l+1)) print(self.W[l])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_weights(self, round=False):\n\n print \"[\",\n for l in range(1, self.num_layers()):\n for n in range(self.get_layer(l).num_nodes):\n weights = self.get_node_with_layer(l, n).weights\n for w in range(len(weights)):\n if round:\n ...
[ "0.6859355", "0.68313724", "0.66972566", "0.6644771", "0.64783883", "0.6384424", "0.63238245", "0.6312617", "0.62208253", "0.6220219", "0.62092155", "0.61812043", "0.61801636", "0.6177608", "0.6095806", "0.60859853", "0.6069307", "0.6046852", "0.5931208", "0.5914785", "0.5906...
0.68034106
2
The derivative of the sigmoid function
def g_prime(z): return np.multiply(g(z), 1-g(z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def sigmoid_der...
[ "0.8931355", "0.88970494", "0.88970494", "0.88566244", "0.8723297", "0.8572503", "0.83397293", "0.82558525", "0.81656826", "0.7952699", "0.7922646", "0.7874329", "0.7820545", "0.77842283", "0.77320105", "0.7693423", "0.7673917", "0.767192", "0.764811", "0.760601", "0.7604099"...
0.0
-1
Returns a plugin instance.
def getInstance(config): return Plugin(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_instance(self):\n return self.__plugin_instance", "def create_plugin(self, **kwargs):\n return self.plugin_class(**kwargs)", "def getPlugin(self, *args):\n return _libsbml.SBase_getPlugin(self, *args)", "def new(self, plugin, *args, **kwargs):\n if plugin in self.module...
[ "0.84703135", "0.7754983", "0.73671436", "0.70479256", "0.7027809", "0.6509363", "0.6499314", "0.6483052", "0.63523436", "0.6320262", "0.6309016", "0.6308648", "0.62907016", "0.6254284", "0.6235442", "0.62242097", "0.62042576", "0.61898714", "0.61353517", "0.61204034", "0.611...
0.82682073
2
Prepare for target .
def process(self, node, format): if format.endswith("latex"): result = self.LaTeX_ProcessMath(node) else: result = self.XHTML_ProcessMath(node) #end if return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_gen(self, targets):\r\n pass", "def prepare(self):", "def _prepare(self):", "def _prepare(self):", "def actionPrepare():\n \n #Do preparation that is common for all platforms. Pass true if ortc is one of targets\n result = Preparation.setUp('ortc' in Settings.targets)\n if result != NO_E...
[ "0.7460234", "0.69315946", "0.66796947", "0.66796947", "0.66599566", "0.6525683", "0.6525683", "0.6525683", "0.64102614", "0.6305251", "0.6096762", "0.6053131", "0.6021104", "0.5947197", "0.594579", "0.594579", "0.5922696", "0.5914593", "0.5904647", "0.58516353", "0.58514154"...
0.0
-1
If target format is XHTML, generate GIFs from formulae.
def flush(self): # generate bitmaps of formulae if self.out.tell() > 0: self.out.write("\\end{document}\n") self.__LaTeX2Dvi2Gif() self.out.close() self.out = io.StringIO() #end if #reset counter self.counter = 1 self.node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_gif(frames, reward, path, number=None, evaluation=False):\n for i, frame in enumerate(frames):\n frames[i] = resize(frame, (420, 320, 3),\n order=0, preserve_range=True).astype(np.uint8)\n if evaluation:\n path += '/atari-step-{}-reward-{}.gif'.format(numb...
[ "0.58204705", "0.57823205", "0.57576567", "0.5614984", "0.5570564", "0.5538513", "0.55213165", "0.5484985", "0.5448945", "0.5419624", "0.53846264", "0.5338472", "0.53065234", "0.5276483", "0.5274553", "0.5256931", "0.52548414", "0.5248981", "0.52419114", "0.5239205", "0.52383...
0.0
-1
Call LaTeX and ImageMagick to produce a GIF.
def XHTML_ProcessMath(self, node): if self.out.tell() == 0: self.out.write("""\ \\documentclass[12pt]{scrartcl}\\usepackage{courier} \\usepackage{courier} \\usepackage{helvet} \\usepackage{mathpazo} \\usepackage{amsmath} \\usepackage[active,displaymath,textmath]{preview} \\frenchspacing{} \\usepack...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gif(self, delay=20, savefile=None, iterations=0, show_path=False,\n use_ffmpeg=False):\n from sage.misc.sage_ostools import have_program\n have_convert = have_program('convert')\n have_ffmpeg = self._have_ffmpeg()\n if use_ffmpeg or not have_convert:\n if have_...
[ "0.6888435", "0.6775817", "0.6772993", "0.66560054", "0.6630138", "0.6614447", "0.6607935", "0.6585795", "0.6558889", "0.64578474", "0.6438855", "0.6422275", "0.6338262", "0.6297525", "0.61565846", "0.60966945", "0.60572386", "0.605021", "0.60144264", "0.59625584", "0.5935778...
0.0
-1
Write formulae to LaTeX file, compile and extract images.
def __LaTeX2Dvi2Gif(self): # open a temporary file for TeX output tmpfp, tmpname = tempfile.mkstemp(suffix=".tex", dir=self.tmp_dir) try: with os.fdopen(tmpfp, "w", encoding="utf-8") as texfile: texfile.write(self.out.getvalue()) except IOError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertImages(self):\r\n parent = Element('div')\r\n base = FilePath(self.mktemp())\r\n base.makedirs()\r\n\r\n macros = Element('span')\r\n macros.setAttribute('class', 'latexmacros')\r\n text = Text()\r\n text.data = 'foo'\r\n macros.appendChild(tex...
[ "0.62115526", "0.6149558", "0.6059989", "0.6026761", "0.6008063", "0.59548503", "0.59547037", "0.59331125", "0.58783996", "0.58253497", "0.5790371", "0.5730374", "0.568745", "0.5668162", "0.56146497", "0.5612511", "0.5592571", "0.5578856", "0.5540914", "0.5473427", "0.5442843...
0.51824105
36
Lowers a list of TealBlocks into a list of TealComponents.
def flattenBlocks(blocks: List[TealBlock]) -> List[TealComponent]: codeblocks = [] references: DefaultDict[int, int] = defaultdict(int) indexToLabel = lambda index: "l{}".format(index) for i, block in enumerate(blocks): code = list(block.ops) codeblocks.append(code) if block.is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block(self, block: tuple) -> list:\n b = []\n for j in range(3):\n index = block * 3 + j * 9 + 18 * (block // 3)\n for val in self.grid[index:index+3]:\n b.append(val)\n return b", "def get_blocks(self) -> list:\n self.clingo = ClingoBridge() ...
[ "0.57208264", "0.56381387", "0.5355571", "0.5295688", "0.5244981", "0.52368444", "0.5234634", "0.51819783", "0.5135695", "0.50644815", "0.5015755", "0.4994735", "0.49924207", "0.4943743", "0.49335623", "0.49311888", "0.49311888", "0.4920625", "0.4920625", "0.4903881", "0.4891...
0.68299204
0
If the object_id is found in the db for the last 5 minutes, it retrieves this job's information and skips processing. If the object_id cannot be found in the db for the last 5 minutes, it saves it and sends it to a queue to be processed.
def process(object_id: str) -> Job: jobs = db.Jobs().get_by_object_id(object_id) job_processed_in_last_five_minutes = list( filter( lambda x: ( datetime.datetime.utcnow() - x.timestamp < datetime.timedelta(minutes=5) ), jobs, ) ) if job...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_tick(self):\n if ((len(self._queue) >= self.config.batchsize) or\n (time.time() - self._last_get > self.config.batchtime and self._queue)):\n self._get()", "def run(self):\n assert self.queue is not None, \"Must specify queue or override run()\"\n\n while not sel...
[ "0.55987585", "0.54896456", "0.54685956", "0.54629576", "0.54253185", "0.54224366", "0.53269327", "0.52808934", "0.52751964", "0.527179", "0.52460194", "0.5220358", "0.52187735", "0.52122515", "0.5173813", "0.51726663", "0.51726663", "0.5172634", "0.51683325", "0.51590395", "...
0.7468584
0
It retrieves the job's information that finds in the db or None if the job was not found.
def retrieve(received_job_id: str) -> Union[Job, None]: # todo: add error handling found_job = db.Jobs().get_by_id(received_job_id) if not found_job: return return found_job
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getJob(self, name=None):\n if name == None: \n name = self.jobstable.get_selectedRecordNames()[0]\n if name == None:\n return None, name\n jobid = self.DB.meta.peatsa_jobs[name]\n try:\n job = PEATSA.WebApp.Data.Job(jo...
[ "0.76924163", "0.7398963", "0.73788226", "0.7289772", "0.7167101", "0.71370995", "0.7100012", "0.70188844", "0.695432", "0.6841215", "0.6807646", "0.6797778", "0.67940956", "0.6781903", "0.6744986", "0.67234474", "0.6719189", "0.6660137", "0.66556096", "0.66002905", "0.657437...
0.72142863
4
It retrieves the job from the job_id received in the 'body' parameter. Looks for it in the db and updates its status to 'done'. If no job was found, it returns None.
def finish(ch, method, properties, body) -> Union[Job, None]: del ch, method, properties # todo: add error handling found_job = db.Jobs().get_by_id(body) if not found_job: return found_job.status = "done" return db.Jobs().update(found_job)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(received_job_id: str) -> Union[Job, None]:\n # todo: add error handling\n found_job = db.Jobs().get_by_id(received_job_id)\n if not found_job:\n return\n return found_job", "def get_a_job(job_id):\n job = JobModel.get_one_job(job_id)\n if not job:\n return custom_resp...
[ "0.73908395", "0.67515594", "0.6725238", "0.6640862", "0.6567949", "0.6564976", "0.65523577", "0.6539249", "0.645343", "0.6404884", "0.6329182", "0.63278353", "0.6320748", "0.6312006", "0.6310086", "0.62760997", "0.6257062", "0.62490344", "0.6210643", "0.6202674", "0.6179973"...
0.67114484
3
Persists the model to the disk. Returns
def save(self): try: joblib.dump(self._clf, self._modelFile) except: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persist(self) -> None:\n if self.model is None:\n logger.debug(\n \"Method `persist(...)` was called without a trained model present. \"\n \"Nothing to persist then!\"\n )\n return\n\n with self._model_storage.write_to(self._resource)...
[ "0.75183755", "0.7461746", "0.7306015", "0.72938365", "0.72782624", "0.7239542", "0.72115964", "0.7096571", "0.7087327", "0.7077688", "0.7059958", "0.7047942", "0.7047942", "0.7047942", "0.70443946", "0.7019755", "0.7019061", "0.7017741", "0.7017741", "0.7017741", "0.7009537"...
0.0
-1
Restores the model from the disk. Returns
def load(self): try: clf = joblib.load(self._modelFile) except: return False self._clf = clf return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_model(self, path):\n # if cuda is not available load everything to cpu\n if not self.use_cuda:\n state = torch.load(path, map_location=lambda storage, loc: storage)\n else:\n state = torch.load(path)\n self.net.load_state_dict(state['state_dict'])\n ...
[ "0.73742014", "0.73594147", "0.7124561", "0.7120268", "0.70914626", "0.70485914", "0.7038069", "0.70330733", "0.6970493", "0.69665897", "0.6962411", "0.6935343", "0.6898966", "0.68929976", "0.6836925", "0.66743976", "0.66743976", "0.667007", "0.6655594", "0.663932", "0.663613...
0.0
-1
Detects the immersion level based on the given features.
def detect(self, features): pass # TODO
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect(self, detect_img):\n features = self.classifier.detectMultiScale(detect_img,1.3,5)\n self.features = features\n self.features_detected = True", "def get_basic_feature(image, featurelist=['entropy']):\n features = {'min': image.min(), 'max': image.max(), 'variance': 0, 'mean': 0...
[ "0.56744266", "0.5453125", "0.54530686", "0.5328636", "0.53202724", "0.5282828", "0.5223401", "0.5216018", "0.5200532", "0.51810616", "0.5085944", "0.50755256", "0.50647336", "0.50630873", "0.50608903", "0.5057752", "0.5049103", "0.5029467", "0.5027702", "0.49991143", "0.4995...
0.6558402
0
Reads the data used for training or crossvalidating the model.
def readData(self, annotationPath): ################################## # Read the data ################################## print('Reading the data...') scaler = MinMaxScaler(feature_range=(0, 1)) subjects = [1, 2, 6, 7, 14, 15, 17, 18, 20, 21, 23, 25, 26, 30, 31, 34, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_training_data(self):\n self._save_training_data()", "def model_data():\n x_train, y_train, x_val, y_val, x_test, y_test = read_data(\"src/tests/dataclassificationmodel/ferPlus_processed.pbz2\", False)\n return x_train, y_train, x_val, y_val, x_test, y_test", "def read_model(self):\n ...
[ "0.7283673", "0.71832824", "0.7180556", "0.7124762", "0.6943364", "0.6842195", "0.682788", "0.6827234", "0.68214357", "0.6777717", "0.67765874", "0.66363525", "0.6634755", "0.6543852", "0.65244555", "0.65077186", "0.6503315", "0.6501531", "0.64838386", "0.63968337", "0.638111...
0.0
-1
Performs a crossvalidation on the EmotionsDetector model.
def crossValidate(self, args): ################################## # Read the training data ################################## if not os.path.isdir(args.annotationPath): print('annotation path does not exist: {}' \ .format(args.annotationPath)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_validation(exp_name):\n click.echo(\"Mode: Cross-validation.\")\n # defaults = get_defaults()\n\n # fitted_model_filename = add_extension(fitted_model_filename)\n\n # derive final path for fitted model as base output path for fitted models + model filename\n # fitted_model_path = os.path.j...
[ "0.6481566", "0.6469234", "0.6464313", "0.63635683", "0.62649405", "0.60989666", "0.5989488", "0.59890103", "0.5985422", "0.59439325", "0.58854234", "0.58310795", "0.57946634", "0.57931525", "0.5780316", "0.5777693", "0.5720764", "0.56935006", "0.56931883", "0.5672364", "0.56...
0.64009774
3
Trains the EmotionsDetector model.
def train(self, args): ################################## # Read the training data ################################## if not os.path.isdir(args.annotationPath): print('annotation path does not exist: {}' \ .format(args.annotationPath)) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n # self.recognizer.train()\n self.detector.train()\n self.shared_conv.train()", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n ...
[ "0.5869736", "0.5637332", "0.5600479", "0.5600479", "0.5600479", "0.5600479", "0.5600479", "0.5562379", "0.55589205", "0.5527747", "0.55013394", "0.5439256", "0.5433788", "0.5421395", "0.5412488", "0.5401844", "0.5383513", "0.538006", "0.5360298", "0.5336405", "0.5336392", ...
0.5195484
36
Optimizes the EmotionsDetector model, trying to find the SVM parameters that would yield better results.
def optimize(self, args): ############################ # Get the data ############################ # Read the CSV file ignoring the header and the first column (which # contains the file name of the image used for extracting the data in # a row) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svm():", "def optimize(self):\n self.vbe_step()\n self.compute_responsibilities()\n self.compute_sufficient_stats()\n self.vbmstep()", "def svm_clf_training(max_features, data):\r\n X_train, y_train, X_test, y_test = data\r\n clf = Pipeline([('feature_selection', SelectKBe...
[ "0.6111361", "0.5912575", "0.5642402", "0.5623126", "0.5623126", "0.5623126", "0.55785716", "0.5568076", "0.5529505", "0.55088013", "0.54948574", "0.5481435", "0.5458506", "0.5439299", "0.5435268", "0.54325897", "0.5422759", "0.5416318", "0.5403779", "0.5397329", "0.53708524"...
0.6573799
0
Compile and install the fake library used for testing
def fake(ctx, clean=False): work_dir = join(PROJ_ROOT, "func", "dynlink") build_dir = join(PROJ_ROOT, "build", "libfake") clean_dir(build_dir, clean) build_cmd = [ "cmake", "-GNinja", "-DFAASM_BUILD_SHARED=ON", "-DFAASM_BUILD_TYPE=wasm", "-DCMAKE_TOOLCHAIN_FILE=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_project_with_dependencies(self):\n self.make_project()\n # 'test_library.zip' is not currently compiled for diorite.\n self.project.app_platforms = \"aplite,basalt,chalk\"\n self.project.save()\n tempdir = tempfile.mkdtemp()\n try:\n # Extract a premade...
[ "0.6840887", "0.62958485", "0.61345935", "0.60900086", "0.60620475", "0.60337037", "0.6018115", "0.60040337", "0.60032463", "0.59797657", "0.5962672", "0.5853615", "0.5829548", "0.5787476", "0.5776545", "0.5772395", "0.577139", "0.5742527", "0.5735555", "0.5723381", "0.572238...
0.6825305
1
Get job status from the job queue provider.
def wait_for_job(self, value): logger.info('Waiting for job %s' % self.job_name) if self.provider_options.dry_run == True: logger.info('Dry run: continuing') else: logger.info('Checking job status...') provider = provider_base.get_provider(self.provider_options) while True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_job_status_from_queue__(self):\n\n return (lambda job: (int(job[-1]['JobStatus']),\n job[-1]))(self.schedd.query(\"ClusterId =?= {0}\".format(self.id)))", "def get_status(self):\n\t\treturn call_sdk_function('PrlJob_GetStatus', self.handle)", "def get_job_status(self):\n if self.worker...
[ "0.7685984", "0.7638158", "0.7302522", "0.7206052", "0.717944", "0.71723753", "0.7002564", "0.6996343", "0.69698", "0.69682205", "0.69247717", "0.69158053", "0.68639976", "0.6845352", "0.68310195", "0.67442805", "0.6669167", "0.66362804", "0.6592583", "0.6538537", "0.6525278"...
0.5733461
97
Create branches in the DAG.
def create_branches(branches, pcoll, provider_options): logger.info('Branch count: %i' % len(branches)) pcoll_tuple = () for branch in branches: logger.info('Adding branch') output = create_graph(branch, pcoll, provider_options) pcoll_tuple = pcoll_tuple + (output,) logger.info('Transform: MergeB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_branch(self):\n os.chdir(str(self.repository_path))\n sh.git.checkout('master')\n sh.git.checkout('-b', self.branch)\n logger.debug('Branch {} created', self.branch)", "def main(github_token, branch_name, repository, sha):\n create_branch(github_token, branch_name, repos...
[ "0.71373373", "0.6745019", "0.6531341", "0.64341766", "0.62213826", "0.6209696", "0.6113299", "0.60638833", "0.6030111", "0.60283864", "0.60153705", "0.59939706", "0.59934443", "0.5881487", "0.5877085", "0.5869261", "0.5821324", "0.58131206", "0.579358", "0.5737575", "0.56994...
0.6769689
1
Recursively construct the Beam graph.
def create_graph(graph_item, pcoll, provider_options): output = None if isinstance(graph_item, basestring): logger.info('Adding job %s' % graph_item) job_name = graph_item logger.info("Transform: WaitForJob") output = pcoll | job_name >> WaitForJob(provider_options, job_name) elif isinstance(g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def _construct_graph(self):\n raise NotImplementedError", "def build_graph(self):\n raise NotImplementedError", "def build_graph(self):\n self.import_tree(ZOO_PATH, self.import_zoo, self.verify_zoos)\n ...
[ "0.7039644", "0.68590266", "0.67472506", "0.6589838", "0.65440136", "0.6482974", "0.6370373", "0.6276264", "0.6258234", "0.6218308", "0.6155739", "0.5972295", "0.59721893", "0.59721893", "0.5941389", "0.5937874", "0.58516246", "0.58126825", "0.5786413", "0.57589984", "0.57532...
0.55035263
41
Call dview with an array of commandline flags. This is the recommended way to use dview as a Python library.
def call(argv): known_args, beam_options = parse_args(argv) yaml_string = known_args.dag.decode('string_escape') dag = yaml.load(yaml_string) pipeline_options = PipelineOptions(beam_options) pipeline_options.view_as(SetupOptions).save_main_session = True p = beam.Pipeline(options=pipeline_options) pcol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(args): # noqa; pylint: disable=unused-argument", "def do_view_data(self, *args):\n with suppress(SystemExit):\n if str(*args).split(' ')[0] == '':\n command = self.cli.view_parser.parse_args(*args)\n else:\n command = self.cli.view_parser.parse_...
[ "0.6036357", "0.6024427", "0.60039175", "0.5983105", "0.59002405", "0.57954013", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", "0.5790334", ...
0.0
-1
Represent the topics features of original features
def topic(df, num_topics=5): # X, y = df[df.columns[:-1]], df[df.columns[-1]] lda = LatentDirichletAllocation(n_topics=num_topics, max_iter=5, learning_method='online', learning_offset=50., ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_topics2(model, feature_names, n_top_words=25):\n word_dict = {};\n for topic_idx, topic in enumerate(model.components_):\n word_dict[\"Topic%d\" % (topic_idx)] = [feature_names[i]\n for i in topic.argsort()[:-n_top_words - 1:-1]]\n return pd.DataFrame(word_dict).T...
[ "0.652589", "0.63945407", "0.62877035", "0.62470025", "0.6179667", "0.6089571", "0.6085861", "0.6072998", "0.60302705", "0.60291487", "0.6021849", "0.6014187", "0.59974027", "0.5994276", "0.59592044", "0.5955263", "0.59346074", "0.5914524", "0.5907316", "0.58988845", "0.58709...
0.56479675
66
given pymongo databaseand a regex object (or string) for geo_id return (pubmed_id, geo_id)
def getPubmedIds(db, geo_id, limit=0): pm_tups = [] for ds in db.datasets.find({ '$or' : [{'reference_series':geo_id} , {"geo_id" :geo_id }]}).limit(limit): if 'pubmed_id' in ds: pm_tups.append((ds['pubmed_id'], ds['geo_id'])) pm_tups.append((ds['pubmed_id'], ds['reference_series...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geonameid_from_location(text):\n if 'HASCORE_SERVER' in app.config:\n url = urljoin(app.config['HASCORE_SERVER'], '/1/geo/parse_locations')\n response = requests.get(url, params={'q': text}).json()\n geonameids = [field['geoname']['geonameid'] for field in response['result'] if 'geoname...
[ "0.55480814", "0.53312546", "0.53300273", "0.5205659", "0.511528", "0.5103334", "0.50721294", "0.50375956", "0.50349665", "0.49944767", "0.4975143", "0.49461344", "0.49347347", "0.49083653", "0.48941147", "0.48785365", "0.48737317", "0.48682904", "0.4865054", "0.48643872", "0...
0.6269434
0
given a pubmed id, return a list of words from the given fields
def getWords(pubmed_id, fields=["MeshHeading" , "AbstractText", "ArticleTitle"]): def findText(anode): if anode.nodeType == anode.TEXT_NODE: return anode.data elif anode.hasChildNodes(): return ' '.join(map(findText, anode.childNodes)) else: return '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words(self, fields, normalizer_class):\n return sorted(set(itertools.chain.from_iterable(\n bib.raw_data(fields, normalizer_class)\n for bib in self.documents\n )))", "def get_words(data):\n return data[\"words\"]", "def get_page_words(parsed_hocr_page, pageid):\n...
[ "0.6270164", "0.62465376", "0.62347436", "0.6110164", "0.5964306", "0.58644086", "0.5819131", "0.58036935", "0.5776748", "0.57580763", "0.57580763", "0.5744212", "0.57393175", "0.56931", "0.5689465", "0.5641902", "0.5632844", "0.5622878", "0.5604147", "0.5599055", "0.55986273...
0.78243196
0
given mongo db, geo_id and a list of words insert into word2geo collection
def insertWords(db, geo_id, words): def f( word): return {'geo_id' : geo_id, 'word': word} try: db.word2geo.insert(map( f, words)) except: print "error in " + geo_id print map( f, words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _insert_words(self, dict_words: List[DictWordModel]) -> NoReturn:\n docs = [word.dict() for word in dict_words]\n is_inserted = await self._db_client.try_insert_many(self._db_name, self._db_collection_name, docs)\n if not is_inserted:\n raise DBError('Failed to save many w...
[ "0.671187", "0.66561407", "0.64611846", "0.6321505", "0.61196697", "0.60452765", "0.6039269", "0.6009112", "0.5792243", "0.5741951", "0.57339126", "0.57302725", "0.56968504", "0.5630612", "0.55702686", "0.55599356", "0.55106515", "0.55084234", "0.5503626", "0.5496883", "0.546...
0.8156848
0
Build a dictionary recording the min and max indices (indicating the position in a list) of documents for each review;
def build_indices(review_ids): review_indices = {} # Load qrel_abs_train txt file clef_data = pd.read_csv(config.TRAIN_QREL_LOCATION, sep="\s+", names=['review_id', 'q0', 'pmid', 'included']) # Get index of documents for each review for review_id in review_ids: index = clef_data.index[clef_data['review...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_dict(self):\n dict = defaultdict(list)\n for i in range(self.no_of_docs-1):\n doc_txt = self.doc_to_df(i)\n #assign key to index in dictionary and its locations as tuples(docid,line,wordpos) as the values\n for j in range(len(doc_txt)):\n f...
[ "0.6648486", "0.6142995", "0.5936477", "0.5701389", "0.56871146", "0.5630566", "0.5610905", "0.5560928", "0.55124485", "0.54871017", "0.54758066", "0.546961", "0.54175454", "0.5414213", "0.53981483", "0.5375703", "0.5374007", "0.5359983", "0.53506577", "0.53481126", "0.534723...
0.70010144
0
This function split one dataset into the training set and the test set with different standardization;
def run_train_test_split(): # Load all documents conn = sq.connect(config.DB_FILE) documents = pd.read_sql_query('select pubmed_id, review_id, included, title, abstract from article ', conn) # Identify unique review IDs review_ids = documents['review_id'].unique() # Set seed for random sampling np.rando...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.7990251", "0.7974505", "0.7581833", "0.7565025", "0.7559627", "0.7552167", "0.75416225", "0.75179213", "0.74247026", "0.7367997", "0.73663753", "0.7344645", "0.730346", "0.7287729", "0.7281219", "0.72798365", "0.72691244", "0.7258459", "0.7252591", "0.7251626", "0.71612626...
0.6987368
50
Redirect index to students page
def index() -> str: return redirect('/students')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return redirect(url_for('second_page'))", "def home_page():\n return redirect('/users')", "def idx(_request):\n return HttpResponseRedirect('/home')", "def second_page():\n return redirect(url_for('index'))", "def index_file():\n return redirect(\"/\")", "def index(reque...
[ "0.6889249", "0.685594", "0.68496305", "0.6730005", "0.6604118", "0.651976", "0.6506114", "0.6469121", "0.6458482", "0.64317304", "0.640421", "0.6387237", "0.63767403", "0.6375142", "0.6348239", "0.6342875", "0.6328945", "0.6312688", "0.630708", "0.63059723", "0.6292399", "...
0.8471828
0
Query for Students Grades
def student_summary() -> str: db_path: str = "810_startup.db" try: db: sqlite3.Connection = sqlite3.connect(db_path) except sqlite3.OperationalError: return f'Error: Unable to open database at path {db_path}' else: query: str = "select students.Name, students.CWID, grades.Course...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grade_by_student(first_name):\n\n QUERY = \"\"\"\n SELECT g.project_title, g.grade \n FROM Students AS s JOIN Grades AS g \n ON s.github = g.student_github\n WHERE s.first_name = ?\n \"\"\"\n\n db_cursor.execute(QUERY, (first_name,))\n row = db_cursor.fetchall()\n ...
[ "0.7164799", "0.69506854", "0.68604916", "0.68100643", "0.6796675", "0.666562", "0.6567092", "0.65628946", "0.6529846", "0.6339504", "0.6262113", "0.6254564", "0.6247507", "0.62131083", "0.62120914", "0.6165898", "0.616138", "0.61275333", "0.6107583", "0.60531247", "0.6040625...
0.0
-1
Gets a card chosen at random
def get_random_card() -> "Card": last = Card.objects.count() - 1 index = random.randint(0, last) return Card.objects.all()[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_card(self):\n\n card = random.randint(1,13)\n return card", "def card_output():\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]\n return random.choice(cards)", "def deal_card():\r\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]\r\n return (random.choice(c...
[ "0.82879335", "0.7804626", "0.7780696", "0.776896", "0.7735164", "0.7631362", "0.7494053", "0.7380841", "0.7303759", "0.725385", "0.7194026", "0.7147254", "0.70656097", "0.69215983", "0.6893707", "0.686891", "0.6754502", "0.6732325", "0.67218757", "0.66885597", "0.6679748", ...
0.7639505
5
Returns the total number of cards that given user owns of this card
def get_user_ownership_count( self, user: get_user_model(), prefetched: bool = False ) -> int: if prefetched: return sum( ownership.count for card_printing in self.printings.all() for localisation in card_printing.localisations.all() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_ownership_count(\n self, user: get_user_model(), prefetched: bool = False\n ) -> int:\n if prefetched:\n return sum(\n ownership.count\n for localisation in self.localisations.all()\n for ownership in localisation.ownerships.all(...
[ "0.7715831", "0.69351727", "0.67096174", "0.6708182", "0.6541524", "0.64215946", "0.63916093", "0.6306432", "0.6229252", "0.6144589", "0.6107996", "0.6098523", "0.60861856", "0.6067441", "0.6061621", "0.60230386", "0.60217756", "0.6010899", "0.6005462", "0.5943102", "0.589071...
0.7711362
1
Returns whether or not this is an oversized card
def is_wide(self) -> bool: return self.layout == "planar"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cardDiscardable(self, card):\n if self.cardDead(card):\n return True\n\n cardAttr = \"\"\n if Suit.toString(card.getSuit()) == \"white\":\n cardAttr = \"w\"\n elif Suit.toString(card.getSuit()) == \"blue\":\n cardAttr = \"b\"\n elif Suit.toStr...
[ "0.6903517", "0.6678937", "0.66666347", "0.6406128", "0.6370988", "0.6358832", "0.63576776", "0.61906356", "0.60390383", "0.6031032", "0.6008816", "0.60084003", "0.5983178", "0.5980432", "0.59701866", "0.5922477", "0.589019", "0.58800906", "0.58325684", "0.5811311", "0.580227...
0.0
-1
Gets whether this card has another card on the back
def is_double_faced(self) -> bool: return self.layout in ("transform", "meld", "modal_dfc")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_go_back(self):\n return self._pointer >= 1", "def still_in_hand(self):\n return len(self.hand.cards)!=0", "def __gt__(self, other: Card) -> bool:\n return not self.__le__(other)", "def hasBlackjack(self):\n return len(self.cards) == 2 and self.getPoints() == 21", "def is_car...
[ "0.66254383", "0.65699077", "0.63486546", "0.6297219", "0.61691415", "0.60999364", "0.60874003", "0.6041563", "0.5999124", "0.5998032", "0.59420705", "0.59275377", "0.5925401", "0.5924849", "0.5910813", "0.58968544", "0.589199", "0.58911973", "0.58838475", "0.5872889", "0.585...
0.0
-1
Gets whether this card has another half (flip, split, transform etc)
def has_other_half(self) -> bool: return self.layout in ( "flip", "split", "transform", "meld", "aftermath", "adventure", "modal_dfc", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_split(self) -> bool:\n if len(self.cards) == 2 and self.cards[0].value == self.cards[1].value:\n return True\n else:\n return False", "def is_pair(hand):\n\tis_a_pair = False\n\ti = 0\n\twhile i < 13:\n\t\tif hand[i] == 2:\n\t\t\tis_a_pair = True\n\t\ti += 1 \n\thigh_c...
[ "0.6733933", "0.618208", "0.61451954", "0.61021394", "0.60967654", "0.6092608", "0.60442275", "0.60439914", "0.6035215", "0.59942883", "0.5980618", "0.5967132", "0.5947805", "0.58967525", "0.5893755", "0.5892925", "0.5842676", "0.5830995", "0.5810103", "0.5801732", "0.5799426...
0.7691357
0
Returns whether or not this is a land card
def is_land(self, only_land: bool = False) -> bool: generator = ( any(_type.name == "Land" for _type in face.types.all()) for face in self.faces.all() ) if only_land: return all(generator) return any(generator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_facing_north(): #py:is_facing_north\n return RUR._is_facing_north_()", "def has_cards(self):\n return self.hand.len() > 0", "def is_facing_north(self): #py:UR.is_facing_north\n return RUR._UR.is_facing_north_(self.body)", "def is_red_car(self):\n return self.identifier == 18"...
[ "0.6574346", "0.6381043", "0.6235261", "0.6200675", "0.6090455", "0.60712475", "0.6066724", "0.60589635", "0.594777", "0.5855346", "0.57903135", "0.56646883", "0.5646702", "0.56021655", "0.55966115", "0.5596539", "0.5566923", "0.5530669", "0.5515748", "0.5515474", "0.5508919"...
0.6243277
2
Gets the keyrune code that should be used for this printing In 99% of all cases, this will return the same value as printing.set.keyrune_code But for Guild Kit printings, the guild symbol should be used instead
def get_set_keyrune_code(self) -> str: if self.set.code in ("GK1", "GK2") and len(self.face_printings.all()) == 1: first_face = self.face_printings.all()[0] if first_face.watermark: return first_face.watermark return self.set.keyrune_code.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_code_to_printings_key(printing):\n return (\n printing.set_integer or 0,\n str(printing.set_variant),\n printing.multiverseid or 0,\n printing.card_name,\n )", "def getCode1Letter(self):\n dataDict = self.__dict__\n # NB must be done by direct access\n result = ...
[ "0.5882872", "0.5875788", "0.57938766", "0.5729844", "0.57142025", "0.5691378", "0.5621861", "0.5621861", "0.55469465", "0.5541225", "0.55250955", "0.55160975", "0.55054325", "0.5503266", "0.54999036", "0.54993963", "0.549464", "0.5456612", "0.5454372", "0.5450911", "0.539756...
0.7367078
0
Returns the total number of cards that given user owns of this printing
def get_user_ownership_count( self, user: get_user_model(), prefetched: bool = False ) -> int: if prefetched: return sum( ownership.count for localisation in self.localisations.all() for ownership in localisation.ownerships.all() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_ownership_count(\n self, user: get_user_model(), prefetched: bool = False\n ) -> int:\n if prefetched:\n return sum(\n ownership.count\n for card_printing in self.printings.all()\n for localisation in card_printing.localisations....
[ "0.7798705", "0.6641717", "0.6554687", "0.65397143", "0.65318733", "0.62367505", "0.62067574", "0.6073335", "0.59826356", "0.5970287", "0.59580576", "0.5957845", "0.5957355", "0.5945392", "0.5938073", "0.5932106", "0.5879058", "0.57467246", "0.5720436", "0.56724894", "0.56695...
0.7298613
1
Applies a change of the number of cards a user owns (can add or subtract cards)
def apply_user_change(self, change_count: int, user: get_user_model()) -> bool: if user is None or change_count == 0: return False try: existing_card = UserOwnedCard.objects.get( card_localisation=self, owner=user ) if change_count < 0 and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_cards(cards):\n if 11 in cards and sum(cards) > 21:\n cards.remove(11)\n cards.append(1)\n print('Changing 11 --> 1')\n print(f'Your hand is now {cards} and your total is {sum(cards)}')\n elif sum(cards) > 21:\n print('Sorry. Looks like you busted!')\n ...
[ "0.6545522", "0.63200855", "0.6267624", "0.61299944", "0.60999966", "0.5987832", "0.59660965", "0.5964261", "0.5903642", "0.58689475", "0.5830519", "0.58236086", "0.58002126", "0.5779088", "0.5747298", "0.5740831", "0.57314503", "0.57169497", "0.57010615", "0.56986016", "0.56...
0.71913886
0
Gets most fitting image path for this localisation (the first face if there are multiple
def get_image_path(self) -> Optional[str]: try: return self.localised_faces.all()[0].get_image_path() except IndexError: logging.exception("Failed to find an image for %s", self) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_face(self, image):\n\t\ttry:\n\t\t\treturn max(self.get_faces(image),\n\t\t\t key = (lambda f: f[1]))\n\t\texcept ValueError:\n\t\t\treturn None", "def getFirst(self):\n if self.use_dic:\n data = sorted(self.dic.keys())[0]\n activity = sorted(self.dic[data].key...
[ "0.61643314", "0.60766", "0.602109", "0.5965046", "0.592761", "0.57702565", "0.57653356", "0.57164794", "0.57031834", "0.55963093", "0.546135", "0.5455214", "0.5410387", "0.5387471", "0.5364005", "0.53553", "0.53441226", "0.5299835", "0.529249", "0.5285781", "0.52561975", "...
0.71636146
0
Gets the path of the image for this localisation
def get_image_path(self) -> Optional[str]: if not self.image or not self.image.file_path: return None return self.image.file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imagePath(self):\n return self.path", "def imagePath(self):\n if self.use_dic:\n if self.imlist:\n paths = []\n for img in self.allimgs:\n paths.append(join(self.home, 'data'+str(self.data), self.activity, self.imsize, str(img)+'.jpg')...
[ "0.77722317", "0.7762283", "0.75915486", "0.7475588", "0.72751784", "0.72202283", "0.7217706", "0.71703494", "0.7101081", "0.7060908", "0.70575166", "0.7046028", "0.70416915", "0.6934585", "0.6831975", "0.68238866", "0.6806959", "0.68018746", "0.68018746", "0.68018746", "0.68...
0.6939893
13
Parses the date and meal for a menu, both from CLI and function calls. This method will only return a nonNone value if that's what the user specified, since more information then available at this point is necessary to make an automatic decision (namely, the menu date), in which case it returns None so that whichever f...
def _parse_args(input_date, input_meal): parser = ArgumentParser() parser.add_argument('-d', '--date', type=str) parser.add_argument('-m', '--meal', type=str) args = parser.parse_args() # Allows getting the args from either CLI or as the function parameters query_date = args.date or input_date ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseMenu(self):\n soup = BeautifulSoup(self.sourceText,\n markupMassage = Parser.SOURCE_FIXES,\n convertEntities = BeautifulStoneSoup.HTML_ENTITIES)\n\n keyTranslations = {'prato principal': 'principal',\n 'salada': 'salada',\n ...
[ "0.63029546", "0.62325466", "0.6204037", "0.5833007", "0.57940876", "0.5668976", "0.5628858", "0.55757457", "0.5570373", "0.5545508", "0.5543758", "0.55230284", "0.5504087", "0.5475572", "0.5453246", "0.5448193", "0.54172593", "0.5367389", "0.5333646", "0.53286713", "0.531885...
0.6623508
0
Fetches the menu, menu date and available dates for a date and returns them as a string.
def run(input_date=None, input_meal=None): query_date, query_meal = _parse_args(input_date, input_meal) # Get the data and instantiate the required classes html = scrapper.fetch_data(query_date) meal_date = scrapper.get_meal_date(html) available_dates = scrapper.get_available_dates(html) meals =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_menu() -> str:\n date = datetime.date.today()\n urls = generate_urls(date)\n menu_json = fetch_menu(urls)\n menu = extract_menu(menu_json, date)\n\n return menu", "def extract_menu(menu_json: dict, date: datetime.date) -> str:\n\n inner_menu = menu_json[-1]\n acf = inner_menu.get(\"a...
[ "0.6648928", "0.6201048", "0.6086085", "0.5976661", "0.58711296", "0.5790145", "0.57648087", "0.5746348", "0.5727172", "0.5688281", "0.5654021", "0.5632435", "0.56074226", "0.5510806", "0.54997593", "0.5482736", "0.5477754", "0.5470137", "0.5470137", "0.5449332", "0.54168594"...
0.5486585
15
Fetches the menu, menu date and available dates for a date and prints them to the stdout.
def run_and_print(dt=None): write_plain(run(dt))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_date(self):\n # Using set comprehension to eliminate duplicates,\n # but converting to list for sorting\n dates = list({entry.date for entry in self.entries})\n dates.sort()\n print(\"*** Lookup by Date ***\\n\")\n print(\"Select a date the view all entries...
[ "0.63600284", "0.6308452", "0.6301404", "0.6149177", "0.5963567", "0.5958459", "0.5943125", "0.58782434", "0.5859757", "0.5806425", "0.5799375", "0.57832366", "0.5746213", "0.5720881", "0.56968534", "0.5650051", "0.56274515", "0.56261396", "0.55827737", "0.5580598", "0.548507...
0.0
-1
p is for print if length is 0 print the p tuple otherwise iterate.
def permute(p,l,length): assert length >= 0 if length == 0: print p return for i in range(0,length): n = p + (l[i],) permute(n,l[0:i]+l[i+1:],length-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rec_print(p):\n if len(p) == 0:\n return\n t = p.pop(0)\n print t\n rec_print(p)", "def print_PQ(q):\n for item in q:\n print(str(item), end=' ')\n print()", "def trace(self,p):\n n = self\n c=0 \n while n!=None :\n print (n)\n n...
[ "0.7379953", "0.6051226", "0.5867241", "0.58340585", "0.5805494", "0.57953507", "0.5735741", "0.5687979", "0.5644167", "0.5516746", "0.5510768", "0.5509927", "0.55093926", "0.5386433", "0.535035", "0.5301946", "0.525214", "0.5249476", "0.5226239", "0.52225846", "0.51804423", ...
0.0
-1
Builds a network from config file
def build_network(config): network_cfg = config['network'] network_name = network_cfg['name'] network_params = list(inspect.signature(eval(network_name).__init__).parameters)[1:] args = [f'{param}={network_cfg[param]}' for param in network_params if network_cfg.get(param)] try: model = e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_network(self):\n pass", "def create_net(args):\n\n # Load config file for this experiment\n xinfo = yaml.load(open(args.exp)) # experiment info\n\n # copy config to run directory\n assert osp.isdir(args.cache_dir), 'Working directory not found: ' + args.cache_dir\n # output confi...
[ "0.71432847", "0.6280527", "0.6222136", "0.62148905", "0.62123084", "0.6184715", "0.61805207", "0.60832465", "0.60693824", "0.6053631", "0.6041396", "0.6024714", "0.6021795", "0.6015814", "0.5989596", "0.597385", "0.596626", "0.583157", "0.58275205", "0.5820853", "0.5814393",...
0.7545299
0
For the given installer conditions, verify the dependencies for every single one of the conditions that are in some way referenced in specs or source.
def test_verify_all_dependencies(self): for condition in self.all_references(): result = self.verify_dependencies(condition) if result: self.ill_defined[condition] = result else: self.well_defined.add(condition) return self.ill_defin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_dependencies(self, cond_id, conditions):\n\n if not cond_id in conditions.get_keys():\n return 1\n else:\n result = self.verify_dependencies(cond_id)\n return result", "def check_all(self, exe_paths=False):\n self.status_msg = \"\"\n for de...
[ "0.68579435", "0.6556382", "0.6347779", "0.63326347", "0.62767583", "0.62427205", "0.61748946", "0.6174221", "0.6137063", "0.60748786", "0.6053641", "0.5956393", "0.588417", "0.5882532", "0.58643204", "0.5854203", "0.5835256", "0.58289266", "0.5825942", "0.57865596", "0.57855...
0.6852399
1
Verifies that the given condition id is defined, and that its' dependencies and their transitive dependencies are all defined and valid.
def test_verify_dependencies(self, cond_id, conditions): if not cond_id in conditions.get_keys(): return 1 else: result = self.verify_dependencies(cond_id) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verify_dependencies(self, cond_id, undefined_paths, current_path):\n\n # Exception for izpack conditions:\n if cond_id in self.conditions.properties[WHITE_LIST]:\n return True\n\n # Short-circuit on well-defined conditions:\n if cond_id in self.well_defined:\n ...
[ "0.7233518", "0.71392715", "0.60746115", "0.5732978", "0.5654439", "0.5454553", "0.5448558", "0.5441111", "0.52943414", "0.52780235", "0.5251414", "0.5139405", "0.51285505", "0.51267743", "0.51252174", "0.5048138", "0.50332785", "0.5028958", "0.49913806", "0.4958716", "0.4956...
0.78313273
0
Performs a depthfirst search of a condition's dependencies in order to verify that all dependencies and transitive dependencies are defined and valid.
def verify_dependencies(self, cond_id): undefined_paths = set() self._verify_dependencies(cond_id, undefined_paths, tuple()) return undefined_paths
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_dependencies(self, cond_id, conditions):\n\n if not cond_id in conditions.get_keys():\n return 1\n else:\n result = self.verify_dependencies(cond_id)\n return result", "def _verify_dependencies(self, cond_id, undefined_paths, current_path):\n\n # ...
[ "0.6695402", "0.6293103", "0.60720724", "0.60228133", "0.5990557", "0.5964589", "0.59326696", "0.5578468", "0.5578364", "0.53697", "0.5355786", "0.53459734", "0.53228617", "0.53076524", "0.5307568", "0.5283302", "0.5280135", "0.527394", "0.5268686", "0.5262103", "0.52600974",...
0.5844651
7
Given the soup for a condition, test that its dependencies are validly defined.
def _verify_dependencies(self, cond_id, undefined_paths, current_path): # Exception for izpack conditions: if cond_id in self.conditions.properties[WHITE_LIST]: return True # Short-circuit on well-defined conditions: if cond_id in self.well_defined: return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConditionChecking(self):\n\n state = State.from_problem(self.prob)\n \n drive = self.dom.get_action(\"drive\")\n with drive.instantiate([\"agent\", \"tru1\", \"apt1\"], self.prob):\n self.assert_(state.is_satisfied(drive.precondition))\n\n with drive.instantiat...
[ "0.6394948", "0.6064821", "0.6038692", "0.60127705", "0.5969924", "0.5887158", "0.5801091", "0.5776576", "0.57205003", "0.56385154", "0.5614725", "0.56072754", "0.5539833", "0.5475634", "0.54365665", "0.54158586", "0.54152584", "0.53983265", "0.5347427", "0.5322336", "0.53194...
0.63148606
1
Tests if a 'variable' type condition is correctly defined.
def test_variable(self, condition, undefined_paths, current_path): var = str(condition.find('name').text) if not var in self.variables.get_keys() and self.fail_on_undefined_vars: current_path += ((var, 'undefined variable'),) undefined_paths.add(current_path) return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_variable(self, variable):\n if variable is not None:\n # test type\n if not self.validate_type(variable):\n return False\n\n return True", "def isvar(var):\n return _coconut_tail_call(isinstance, var, (Const, Var))", "def _check_variable_defin...
[ "0.71227634", "0.6907246", "0.6733456", "0.65082616", "0.64736354", "0.645199", "0.64293915", "0.63758117", "0.6359905", "0.63548344", "0.63531965", "0.63153076", "0.6288625", "0.62509894", "0.62427473", "0.62259036", "0.6190489", "0.6148015", "0.6144128", "0.6127952", "0.612...
0.71669835
0
Tests if an 'exists' type condition is welldefined.
def test_exists(self, condition, undefined_paths, current_path): var = str(condition.find('variable').text) if not var in self.variables.get_keys() and self.fail_on_undefined_vars: current_path += ((var, 'undefined variable'),) undefined_paths.add(current_path) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist(x):\n return x is not None", "def exists(self):\n return True", "def exists(self):\n return True", "def definition_exists(name: str) -> bool:\n try:\n return bool(lookup_definition(name))\n except:\n return False", "def exists(self):\n return self.obj i...
[ "0.6585829", "0.6297913", "0.6297913", "0.6214394", "0.6142705", "0.60860187", "0.604842", "0.59506786", "0.5899629", "0.58844423", "0.5882149", "0.58796376", "0.5875572", "0.58542025", "0.5844161", "0.5812089", "0.5798914", "0.5771523", "0.57615334", "0.57554024", "0.5733867...
0.62473893
3
Tests if a 'java' type condition is welldefined. ie, if the class that the java var is a field of exists. my.package.MyClass myStaticField true
def test_java(self, condition, undefined_paths, current_path): cond_id = str(condition.get('id')) try: cid = str(condition.find('class').text) except AttributeError: current_path += ((cond_id, 'ill-defined java condition'),) undefined_paths.add(current_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_field_type(field_class):\n if field_class == 'TextField':\n field_type = 'Text field'\n elif field_class == 'NumericField':\n field_type = 'Numeric field'\n elif field_class == 'DateField':\n field_type = 'Date field'\n elif field_class == 'DateTimeField':\n field_...
[ "0.5906985", "0.5887892", "0.5847857", "0.58403444", "0.58391064", "0.58101076", "0.57811445", "0.5773369", "0.5730297", "0.567376", "0.56302613", "0.55703485", "0.55521667", "0.5544753", "0.5519627", "0.5511953", "0.54748327", "0.54581445", "0.5455314", "0.5455117", "0.54478...
0.5669835
10
Unzips a list of tuples, x.
def unzip(self, x): if (len(x)>0): return list(zip(*x)) else: return x, list()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unzip(pairs):\n return tuple(zip(*pairs))", "def unzip(zipped):\n return zip(*zipped)", "def unzip(seq):\n return zip(*seq)", "def unzip(seq: Iterable) -> tuple:\n seq = iter(seq)\n # check how many iterators we need\n try:\n first = tuple(next(seq))\n except StopIteration:\n ...
[ "0.75591034", "0.6889838", "0.68766", "0.6743751", "0.6709593", "0.6456803", "0.63671273", "0.62731713", "0.6267873", "0.6260321", "0.6234096", "0.6152076", "0.60384727", "0.60337454", "0.5970998", "0.5970998", "0.5949191", "0.5846596", "0.5812543", "0.5775136", "0.57129973",...
0.79986495
0
returns teh version of the passed object
def get_revision_of_object(obj): return getattr(obj, get_version_fieldname(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object ( self, object ):\n return object", "def get(self, obj):", "def obj(self) -> object:\n pass", "def object(self):", "def __invert__(self):\n return self.obj", "def get(self, obj):\n raise NotImplementedError", "def serialize(self, obj):\n return obj", ...
[ "0.70676875", "0.7010541", "0.6859093", "0.68377954", "0.6828108", "0.66855097", "0.662894", "0.6485851", "0.63837457", "0.6309126", "0.6275122", "0.62676996", "0.62326336", "0.6201213", "0.61918557", "0.6187754", "0.61847454", "0.6175625", "0.61751205", "0.61347693", "0.6134...
0.63562226
9
returns True if `obj` is changed or deleted on the database
def is_changed(obj): revision_field = get_version_fieldname(obj) version = get_revision_of_object(obj) return not obj.__class__.objects.filter(**{obj._meta.pk.name: obj.pk, revision_field: version}).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_live(self, obj):\n most_appropriate_object = get_appropriate_object_from_model(self.model)\n if most_appropriate_object == obj:\n return True\n return False", "def has_change_permission(self, request, obj=None):\n if obj is not None:\n return False\n ...
[ "0.6930333", "0.6525286", "0.64501333", "0.64336836", "0.6431397", "0.64131296", "0.64131296", "0.6349598", "0.63452303", "0.63142246", "0.63139683", "0.6300048", "0.62984204", "0.62824523", "0.6207841", "0.616058", "0.61573696", "0.6101484", "0.60884404", "0.60836864", "0.60...
0.80351144
0
try go load from the database one object with specific version
def get_version(model_instance, version): version_field = get_version_fieldname(model_instance) kwargs = {'pk': model_instance.pk, version_field: version} return model_instance.__class__.objects.get(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_version(cls, unpickler, version):\n model = unpickler.load()\n if version == 0:\n feature = model._state['features']\n model._state['output_column_name'] = 'extracted.' + feature\n return model", "def _load_version():\n version = session.get('version')\n\n ...
[ "0.61055326", "0.60126936", "0.59640944", "0.58599895", "0.5854756", "0.58120066", "0.5810105", "0.5798865", "0.5735602", "0.57199824", "0.57042235", "0.56773525", "0.56663936", "0.55917364", "0.55864733", "0.55482763", "0.552244", "0.55130196", "0.54902387", "0.54607445", "0...
0.5590578
14
A loop to test movement showing in the terminal
def test_movement(self): running = True self.refresh_tile_maps() self.data = self.board.data self.board_objects = self.board.board_objects self.weapons = self.board.weapons self.rooms = self.board.rooms self.players = self.board.players self.player_cards...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_loop(self):\n center_point = self.mot.center_point\n\n screen_width = center_point[0] * 2\n screen_height = center_point[1] * 2\n\n time.sleep(1)\n pretty_progress_bar(\n 3,\n )\n\n # while int(time.time()) - start <= 10:\n while not self....
[ "0.67542243", "0.6601597", "0.6516112", "0.6261025", "0.62314874", "0.62044203", "0.61881465", "0.6146819", "0.61307657", "0.60168695", "0.5986854", "0.5973035", "0.5970921", "0.59660184", "0.5957132", "0.59444493", "0.5920678", "0.59130436", "0.5904488", "0.59033316", "0.590...
0.5588828
64
Initialize relation as a set of nodes and edges. Edges are added onebyone as to assure the integrity of a structure. root_graphs is a subgraph of universe that does not have "dead ends"
def __init__(self, nodes: Set[Node], edges: Set[Edge]): super().__init__() self.nodes = nodes for edge in edges: self.add_edge(edge) self.leaves = {node for node in self.nodes if self.degree_out(node) == 0} root_nodes = self.nodes - self.leaves root_edges = {e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_graph(compound_relations, relation_types):\n graph = nx.DiGraph()\n for compound, targets in compound_relations.items():\n for target, relation in targets.items():\n if relation in relation_types:\n graph.add_edge(compound, target)\n return graph", "def po...
[ "0.6473229", "0.61222476", "0.6110643", "0.6073983", "0.5881061", "0.5881061", "0.57006747", "0.5691904", "0.5682234", "0.5674344", "0.5652", "0.5635029", "0.5594031", "0.55848473", "0.557185", "0.55271906", "0.5522342", "0.5512572", "0.54549974", "0.54519945", "0.54198855", ...
0.58929604
4
Redefine the root graph for universe. It omits edges whose labels are in omit_edge_labels and also does not store references for nodes they point at. This is used mostly to get rid of uniquely identifying nodes.
def re_root(self, omit_edge_label: List[str]): self.leaves = {node for node in self.nodes if any([edge.label in omit_edge_label for edge in self.edges_to(node)])} root_nodes = self.nodes - self.leaves root_edges = {edge for edge in self.edges if edge.node_to in root_nodes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_graph(self):\n self.nodes = {}\n self.add_node(self.initial_state)\n self.add_node(self.final_state)", "def reset_graph(self):\n raise NotImplementedError", "def reset_graph(self):\n self.graph = OrderedDict()", "def _restoreGraph(self):\n\n # self.tempG = ...
[ "0.66198105", "0.6407392", "0.61415255", "0.61093223", "0.6048665", "0.60347766", "0.60298306", "0.5988843", "0.5949874", "0.5943684", "0.5910985", "0.5874265", "0.58275336", "0.57994217", "0.5747671", "0.57045126", "0.57044613", "0.565234", "0.56324726", "0.5624728", "0.5622...
0.7510522
0
Create a mask, that is a graphlike structure which can be thought of as a subgraph of universe. It holds only the references for known nodes and edges. This method create subgraph induced by its nodes.
def get_random_full_mask(self, size: int, breadth_first_preference: float = 0.5, from_root: bool = True) -> Mask: if from_root: g = self.root_graph else: g = self nodes = set(random.sample(g.nodes, 1)) while len(nodes) < size: to_extend = {edge.node_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subgraph_mask(self, size):\n init_matrix = np.random.randn(size,size)\n Tcs = csgraph.minimum_spanning_tree(init_matrix)\n mask_matrix = Tcs.toarray()\n return mask_matrix", "def __init__(self, nodes: Set[Node], edges: Set[Edge]):\n super().__init__()\n self.nodes = ...
[ "0.69909257", "0.6730791", "0.6133464", "0.60049623", "0.5896379", "0.5863855", "0.5832731", "0.57625717", "0.5693712", "0.5613123", "0.55460924", "0.553991", "0.5532406", "0.54798096", "0.53914773", "0.53446835", "0.53339267", "0.5312013", "0.5276624", "0.52759224", "0.52489...
0.5328217
17
return a cursor to a query
def query_to_cur(dbh, qry, args): if args.debug: print(datetime.datetime.strftime(datetime.datetime.now(), "%D %H:%m:%S"), qry, file=sys.stderr) t0 = time.time() cur = dbh.cursor() cur.execute(qry) print("query took", time.time() - t0, "seconds") return cur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cursor(self):\r\n cursor = self.connection.cursor()\r\n return cursor", "def cursor():\n dbh = handle()\n return dbh.cursor()", "def get_cursor(self, *args, **kwargs):", "def _cursor(self):\n cursor = self.conn.cursor()\n\n return cursor", "def cursor(self):\n ...
[ "0.77592504", "0.7748701", "0.7519825", "0.7482258", "0.7413113", "0.7369768", "0.7340349", "0.731754", "0.731754", "0.7271211", "0.7255303", "0.7223003", "0.71825427", "0.7179095", "0.7167863", "0.71537787", "0.70854706", "0.7069509", "0.7030988", "0.7016853", "0.69801897", ...
0.6644475
35
print data returned from a query in nice aligned columns
def printPrettyFromCursor(cur, args): rows = [] #get column headers -- not very ergonomic # exit if function does nto return things if not cur.description: return if args.header: rows.append([item[0] for item in cur.description]) rows = rows + cur.fetchall() zipped = zip(*ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_bash(self,query_results):\n data=query_results.data\n \n name=\"ddb\"\n\n print (\"{0}_row_length={1}\".format(name,len(data)))\n print (\"{0}_column_length={1}\".format(name,len(query_results.columns)))\n print (\"\")\n\n column_index=0\n for colu...
[ "0.7219429", "0.7074841", "0.6891936", "0.6827231", "0.6793333", "0.67474353", "0.67346114", "0.67292243", "0.6686646", "0.6618329", "0.65630335", "0.65622455", "0.65239674", "0.65194356", "0.6492314", "0.6478941", "0.64734554", "0.64621496", "0.6452394", "0.6452233", "0.6450...
0.6469105
17
output the query results as a CSV
def printCSVFromCursor(cur, args): import csv if not cur.description: return #nothing to print. writer = csv.writer(sys.stdout, delimiter=args.delimiter, quotechar='|', lineterminator='\n', quoting=csv.QUOTE_MINIMAL) if args.header: hdr = [col[0] for col in cur....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_query_csv(self):\n\n self.query_df.to_csv(self.query_output_file)", "def process_results(result, title=\"\", doWrite=True, query=\"\"):\n\n\tif not result or not result.returns_rows:\n\t\tprint \"-> 0 records returned\"\n\t\tprint result\n\t\treturn\n\n\tdoPrint = True\n\n\t# get column names\n...
[ "0.7392405", "0.70663726", "0.7028599", "0.69381297", "0.690984", "0.6848239", "0.679453", "0.67345744", "0.6721", "0.667645", "0.6661048", "0.6578225", "0.6552651", "0.65504265", "0.6536412", "0.6536164", "0.6484346", "0.6483709", "0.64407593", "0.6437607", "0.64326495", "...
0.0
-1
Send the query to the database and render the results as requested
def query(args): dbh = despydb.DesDbi(args.service, args.section) if args.query not in "-+": do1Query(dbh, args.query, args) elif args.query == "-": line = sys.stdin.readline() while line: line = line.strip() if not line or line.startswith("#"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_query(self):\n try:\n # get query and templates\n query = self.request.data.get(\"query\", None)\n templates = self.request.data.get(\"templates\", \"[]\")\n registries = self.get_registries()\n order_by_field = self.request.data.get(\"order...
[ "0.6671056", "0.6531192", "0.64979106", "0.63335913", "0.6329612", "0.6328952", "0.6239457", "0.6226256", "0.6211864", "0.6154065", "0.61292285", "0.611252", "0.60824287", "0.6070119", "0.60307413", "0.6025734", "0.5974545", "0.5968892", "0.59402233", "0.5872386", "0.5866393"...
0.0
-1
Parse command line arguments and pass them to the query engine
def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('--service', default=os.path.join(os.getenv("HOME"), ".desservices.ini")) parser.add_argument('--section', '-s', default='db-desoper', help='sec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def arg_parse():\n p = ap.ArgumentParser()\n p.add_argument('column_name',\n type=str,\n help='column_name to search')\n p.add_argument('operation',\n choices=['gt', 'lt', 'eq'])\n p.add_argument('limit',\n ...
[ "0.7214492", "0.67600626", "0.6744214", "0.6540915", "0.65117174", "0.64484125", "0.6437705", "0.63874245", "0.63734406", "0.63580865", "0.63525504", "0.63441116", "0.6306649", "0.62947834", "0.6288351", "0.6278856", "0.6265019", "0.6261954", "0.6249996", "0.6239955", "0.6234...
0.6177763
30
Initializes the VNIStatsTableEntrySchema object attributes.
def __init__(self, py_dict=None): super(VNIStatsTableEntrySchema, self).__init__() self.update_arp = None self.query_arp = None if py_dict is not None: self.get_object_from_py_dict(py_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InitStats(ss):\n\n ss.SumSSE = 0\n ss.SumAvgSSE = 0\n ss.SumCosDiff = 0\n ss.SumErr = 0\n ss.FirstZero = -1\n ss.NZero = 0\n\n ss.TrlErr = 0\n ss.TrlSSE = 0\n ss.TrlAvgSSE = 0\n ss.EpcSSE = 0\n ss.EpcAvgSSE = 0\n ss.EpcPctErr =...
[ "0.6132577", "0.61266005", "0.582939", "0.56516737", "0.56412935", "0.5606859", "0.5601135", "0.55859405", "0.5571048", "0.555038", "0.5544171", "0.54862404", "0.54842335", "0.54761785", "0.5465003", "0.5443442", "0.5419218", "0.5413731", "0.54091996", "0.539648", "0.5395933"...
0.70146513
0
Search through a table and return the first [row, column] pair who's value is None.
def find_unassigned_table_cell(table): for row in range(len(table)): for column in range(len(table[row])): if table[row][column] is None: return row, column return row, column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_first_element(cls, d):\n\n t = np.where(d[:, 2] > 0)[0]\n if len(t):\n return d[t[0], 0], d[t[0], 1], t[0]\n return None, None, None", "def firstEmptyCell(board):\r\n for i in range(9):\r\n for j in range(9):\r\n if board[i][j] == 0:\r\n ...
[ "0.64960337", "0.634782", "0.633694", "0.6331864", "0.6245917", "0.6233299", "0.60606706", "0.60600805", "0.5962007", "0.5913134", "0.5856047", "0.5801559", "0.57643837", "0.57631135", "0.5742628", "0.5713552", "0.56185967", "0.5603105", "0.559049", "0.55511755", "0.54848987"...
0.7773614
0
Creates a parser and parses arguments. View help for valid flags and inputs. Make sure that subjects are aligned on the same line for all text files. For instance, if a subject's path to epi data is found on line 10 of the file containing paths to epi data, the subject's anatomical, output directory, and, optionally, s...
def parse_args(args): parser = argparse.ArgumentParser( description="""Generates and runs an afni_proc.py script to preprocess resting state fMRI data""", formatter_class=argparse.RawDescriptionHelpFormatter) # Optional Flags parser.add_argument("-t", "--trs_remove", action="store", defaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser():\n \n \n parser = ap.ArgumentParser(description='Parsing some file names in various forms')\n group = parser.add_mutually_exclusive_group()\n group.add_argument('-f','--filepaths',dest='filepaths',metavar='PATH1,PATH2,...',type=str,\n help='Input a string or list ...
[ "0.6712574", "0.6688427", "0.66874635", "0.66772443", "0.66594255", "0.6603691", "0.6600838", "0.6586496", "0.6582369", "0.6565811", "0.65460694", "0.65405774", "0.65191436", "0.6493583", "0.6438784", "0.64371055", "0.6433585", "0.6426523", "0.6417857", "0.6408057", "0.640757...
0.0
-1
Trigger the recompute of the taxes if the pricelist is changed on the invoice.
def _compute_tax_id(self): for inv in self: for line in inv.invoice_line_ids: line.tax_ids = line._get_computed_taxes() inv._recompute_dynamic_lines(recompute_all_taxes=True, recompute_tax_base_amount=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_taxed_lst_price2(self):\n company_id = self._context.get(\n 'company_id', self.env.user.company_id.id)\n for product in self:\n product.taxed_lst_price = product.taxes_id.filtered(\n lambda x: x.company_id.id == company_id).compute_all(\n ...
[ "0.653335", "0.6431408", "0.6352757", "0.6336871", "0.6145967", "0.59902364", "0.5716785", "0.56393623", "0.56122774", "0.55956626", "0.5582768", "0.553678", "0.5504171", "0.54466707", "0.5415386", "0.5409386", "0.5396369", "0.53878236", "0.53794277", "0.5378179", "0.5345203"...
0.59978676
5
Delete old files from FS, nullify path value in DB
def remove_files(max_age_sec): with session_transaction() as session: nb_deleted = File.remove_old_files(max_age_sec, session) log.debug("Max_age_sec: %s Nb_deleted: %s", max_age_sec, nb_deleted) return nb_deleted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_path():\n #TODO delete path from database\n pass", "def clear_outdated_files():\n for f in os.listdir(MEDIA_ROOT):\n file_path = os.path.join(MEDIA_ROOT, f)\n if os.path.isfile(file_path) and os.stat(file_path).st_mtime < time.time() - STORE_PDF_DAYS * 86400:\n os.rem...
[ "0.71850747", "0.6885767", "0.6821727", "0.68192995", "0.6756899", "0.6753063", "0.67357886", "0.6704431", "0.6660613", "0.65907323", "0.6541612", "0.6512646", "0.6490424", "0.64857215", "0.64697266", "0.6452348", "0.64341843", "0.64337134", "0.6421972", "0.64179254", "0.6413...
0.0
-1
Delete old files from FS, nullify path value in DB
def remove_files_size(max_size): with session_transaction() as session: nb_deleted = File.remove_files_max_size(max_size, session) log.debug("Max_size: %s Nb_deleted: %s", max_size, nb_deleted) return nb_deleted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_path():\n #TODO delete path from database\n pass", "def clear_outdated_files():\n for f in os.listdir(MEDIA_ROOT):\n file_path = os.path.join(MEDIA_ROOT, f)\n if os.path.isfile(file_path) and os.stat(file_path).st_mtime < time.time() - STORE_PDF_DAYS * 86400:\n os.rem...
[ "0.7185494", "0.68854076", "0.682105", "0.6820686", "0.6756345", "0.6754087", "0.67368037", "0.67044604", "0.6659871", "0.65905446", "0.654088", "0.6512677", "0.64891416", "0.6486032", "0.646998", "0.64524764", "0.64349043", "0.6433434", "0.64230174", "0.64174724", "0.6413873...
0.0
-1
Create mock input block.
def fixture_input_block(): return Mock()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockRawInput(mock):\n original_raw_input = __builtin__.raw_input\n __builtin__.raw_input = lambda _: mock\n yield\n __builtin__.raw_input = original_raw_input", "def get_input_mock(inputs=None): # Use this mock if a contest requires interactive input.\n stdin_mock = MagicMock()\n s...
[ "0.6843587", "0.66973007", "0.6653255", "0.63940287", "0.6144296", "0.6105641", "0.5916343", "0.58348626", "0.57676345", "0.56919837", "0.55923426", "0.55832005", "0.55725527", "0.5560723", "0.5554768", "0.55407476", "0.5519871", "0.5497402", "0.54970086", "0.5474238", "0.545...
0.8625998
0
Create mock output block.
def fixture_output_block(): return Mock()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_input_block():\n return Mock()", "def test_03_out(self, mock_stdout):\n msg = udocker.Msg(udocker.Msg.MSG)\n msg.out(\"111\", \"222\", \"333\", 444, ('555'))\n self.assertEqual(\"111 222 333 444 555\\n\", mock_stdout.getvalue())\n sys.stdout = STDOUT\n sys.stderr...
[ "0.64789915", "0.6219317", "0.6141315", "0.61250573", "0.5885682", "0.58214647", "0.5781268", "0.5775005", "0.5772843", "0.57672167", "0.57131493", "0.5694267", "0.5624239", "0.56047845", "0.5593248", "0.55418766", "0.5537944", "0.5513371", "0.5504529", "0.5503281", "0.549821...
0.85911703
0
Signal objects are connected as expected.
def test_signals_connected(input_block, output_block, kwargs): input_signal = input_block() output_cb = output_block() with patch('rabbithole.cli.Batcher') as batcher_cls: create_flow(**kwargs) input_signal.connect.assert_called_once_with( batcher_cls().message_received_cb, wea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n if self.models:\n for m in self.models:\n self._connect(m)\n else:\n self._connect()\n return super(SignalChecker, self).__enter__()", "def connected(self):\n pass", "def connected(self):\n pass", "def connected(se...
[ "0.68499154", "0.68350697", "0.68350697", "0.68059605", "0.68059605", "0.66427344", "0.660732", "0.6563658", "0.64170116", "0.63776684", "0.63700235", "0.634242", "0.6340475", "0.6244015", "0.6181083", "0.6158528", "0.61514074", "0.61073714", "0.61058384", "0.61058384", "0.60...
0.0
-1
Exit on error trying to get the input signal.
def test_exit_on_input_signal_error(input_block, kwargs): input_block.side_effect = Exception() with pytest.raises(SystemExit) as exc_info: create_flow(**kwargs) assert exc_info.value.code == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_error():\r\n print(\"Error in input format.\")\r\n sys.exit()", "def signal_handler(sig, frame):\n raise ExitException()", "def handle_sigterm(signum, frame):\n raise TermException", "def signal_handler(signum, frame):\n sys.exit(0)", "def _signal_handler(signum, frame):\n re...
[ "0.6209089", "0.6186397", "0.61726344", "0.6003437", "0.59561807", "0.5893812", "0.5862972", "0.57583606", "0.57415015", "0.57415015", "0.57415015", "0.5725218", "0.57188", "0.5668054", "0.566546", "0.56114185", "0.5606983", "0.5574848", "0.5552682", "0.5544291", "0.5509935",...
0.5870097
6
Exit on error trying to get the output callback.
def test_exit_on_output_cb_error(output_block, kwargs): output_block.side_effect = Exception() with pytest.raises(SystemExit) as exc_info: create_flow(**kwargs) assert exc_info.value.code == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize_error():\n print('')\n exit(-1)", "def call_error():\r\n print(\"Error in input format.\")\r\n sys.exit()", "def error_handler(self):\n if self.ctx.exit_code is not None:\n return self.ctx.exit_code", "def failure_callback(self):\n error_filename = self.run_d...
[ "0.66235447", "0.6495243", "0.6490984", "0.64486736", "0.628487", "0.6235582", "0.6078088", "0.6077453", "0.60774106", "0.6030557", "0.6004493", "0.5937128", "0.5927308", "0.5906779", "0.58894056", "0.5872576", "0.5862885", "0.58574635", "0.58571845", "0.58409643", "0.5838021...
0.6417455
4