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
This function separates features and their corresponding labels for each PMU to make more events
def separatePMUs(X,y): num_case=X.shape[0] num_pmu=X.shape[1] num_sample=X.shape[2] X=X.reshape(num_case*num_pmu,num_sample) y2=[] for i in range(len(y)): if y[i]==0: for j in range(num_pmu): y2.append(0) elif y[i]==1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_label(features):\n f=[]\n l=[]\n for item in features:\n f.append(item[0])\n l.append(item[1])\n return f,l", "def create_features(energy_data, label=None):\n energy_data['date'] = energy_data.index\n energy_data['hour'] = energy_data['Datetime'].dt.hour\n energy_da...
[ "0.62411875", "0.5955089", "0.5826313", "0.56419265", "0.5625406", "0.56080455", "0.55885506", "0.55627906", "0.55348414", "0.54979986", "0.5487126", "0.5486808", "0.54865414", "0.5469624", "0.5466418", "0.5460846", "0.5440191", "0.53921473", "0.53465825", "0.5327736", "0.531...
0.0
-1
Takes the improved heuristic from class one level deeper by calculating number of possible moves next turn for each possible move
def custom_deeper(game, player): if game.is_loser(player): return float("-inf") if game.is_winner(player): return float("inf") own_moves = game.get_legal_moves(player) own_score = 0 for move in own_moves: newgame = game.forecast_move(move) newmoves = newgame.get_le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(self, state: ODState) -> int:\n h = 0\n if self.assigned_goals is None:\n for agent in state.new_agents:\n h += self.grid.get_heuristic(agent.coords, agent.color)\n for j in range(len(state.new_agents), len(state.agents)):\n h += self....
[ "0.69521713", "0.67710125", "0.6615086", "0.6491309", "0.64138347", "0.63917", "0.6388829", "0.63586897", "0.6260268", "0.6230227", "0.6229315", "0.6207105", "0.6206425", "0.614881", "0.6136826", "0.6109114", "0.6107538", "0.61038816", "0.609334", "0.60888714", "0.60774225", ...
0.0
-1
Determines whether there is a continuous partition of at least two squares, and if so, whether the player is on the right side of the barrier
def partition(game, player): height = game.height width = game.width blanks = game.get_blank_spaces() has_partition = False partition_col = int(game.width/2) partition_row = int(game.height/2) moves = game.get_legal_moves(player) if moves: player_location = game.get_player_locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bornoff(self, board):\n res = False\n if (self.player):\n if (reduce(lambda x, y: x+y, board.p1vec) < reduce(lambda x, y: x+y, self.board.p1vec)):\n res = True\n else:\n if (reduce(lambda x, y: x+y, board.p2vec) < reduce(lambda x, y: x+y, self.board.p2v...
[ "0.6902577", "0.67138726", "0.66304785", "0.66215175", "0.6600621", "0.6472556", "0.643553", "0.6338302", "0.632063", "0.61761856", "0.6143342", "0.6139926", "0.6075053", "0.60525346", "0.6041322", "0.60189456", "0.60154474", "0.6007123", "0.6003575", "0.59951377", "0.5994406...
0.64387727
6
Search for the best move from the available legal moves and return a result before the time limit expires. This function must perform iterative deepening if self.iterative=True, and it must use the search method (minimax or alphabeta) corresponding to the self.method value.
def get_move(self, game, legal_moves, time_left): self.time_left = time_left # TODO: finish this function! # Perform any required initializations, including selecting an initial # move from the game board (i.e., an opening book), or returning # immediately if there are no lega...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_move(self, game, legal_moves, time_left):\n\n self.time_left = time_left\n move = (-1, -1) #Default\n\n # Perform any required initializations, including selecting an initial\n # move from the game board (i.e., an opening book), or returning\n # immediately if there are n...
[ "0.7615938", "0.7580609", "0.75804436", "0.7556078", "0.7551935", "0.7549352", "0.7547239", "0.7546612", "0.749754", "0.74660885", "0.74633837", "0.74536973", "0.74295133", "0.74123883", "0.73986655", "0.7377251", "0.7368126", "0.73495144", "0.73442507", "0.73434174", "0.7336...
0.77402973
0
Implement the minimax search algorithm as described in the lectures. (())
def minimax(self, game, depth, maximizing_player=True): if self.time_left() < self.TIMER_THRESHOLD: raise Timeout() if game.get_legal_moves(): scores = [(self.minvalue(game.forecast_move(move), depth), move) for move in game.get_legal_moves()] else: return (s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aStarSearch(problem, heuristic=nullHeuristic):\r\n\t\"*** YOUR CODE HERE ***\"\r\n\r\n\tfrontera=util.PriorityQueue()\r\n\testadoInicial= problem.getStartState()\r\n\tvisitados=[]\r\n\tnodo = []\r\n\tnodo.append(estadoInicial)\r\n\tnodo.append(0)\r\n\tnodo.append(heuristic(estadoInicial,problem))\r\n\tnodo.app...
[ "0.6886883", "0.68331116", "0.68030995", "0.67912656", "0.67798316", "0.6769039", "0.6715872", "0.6711444", "0.6681598", "0.6645004", "0.66299355", "0.6596381", "0.6581008", "0.6575264", "0.6546142", "0.653921", "0.653921", "0.65163356", "0.65159863", "0.65128225", "0.6511745...
0.0
-1
Implement minimax search with alphabeta pruning as described in the lectures.
def alphabeta(self, game, depth, alpha=float("-inf"), beta=float("inf"), maximizing_player=True): if self.time_left() < self.TIMER_THRESHOLD: raise Timeout() # if depth == 0: # return(self.score(game,self), (-1,-1)) if game.get_legal_moves(): return self.ab_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alphabeta_search(state):\r\n \r\n '''\r\n Terminates when game.actions is empty\r\n Class Game needs the following functions:\r\n - game.result(state, a) -- successor\r\n - game.actions(state) -- possible moves\r\n - game.utility -- returns the state of the game (win/lose or ti...
[ "0.7216275", "0.6970839", "0.6799403", "0.67672324", "0.6670666", "0.6608765", "0.6483431", "0.64301497", "0.64079326", "0.63896084", "0.63590366", "0.6347302", "0.6269195", "0.6225856", "0.6206144", "0.62007076", "0.61828464", "0.614959", "0.61449", "0.61436117", "0.61001754...
0.5592482
73
DO NOT DO THIS. It shows a lack of understanding of set().
def remove_duplicates_badSolution( li ): newli=[] seen = set() for item in li: if item not in seen: seen.add( item ) newli.append(item) return newli
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set():", "def set():\n pass", "def test_set(self):\n a = set()\n a.add('b')\n a.add('c')\n a.add('a')\n b = list(a)\n b.sort()\n self.assertEqual(b, ['a', 'b', 'c'])\n a.remove('b')\n b = list(a)\n b.sort()\n self.assertEqual(b...
[ "0.8495859", "0.7840319", "0.7707229", "0.768068", "0.7160374", "0.71357864", "0.71222466", "0.6949142", "0.6856452", "0.6813004", "0.6811096", "0.6811096", "0.6756013", "0.6670584", "0.6515988", "0.6429255", "0.6416853", "0.64092004", "0.6387745", "0.636566", "0.63526124", ...
0.55986446
86
project cartesian to spherical surface, resulted in the surface cartesian coordinates
def project_to_sphere(points): # for uv, the sphere: r=1, azimuth(phi): 2*pi*u, elevation(theta): 2*pi*v # theta is elevation, phi is azimuth r, theta, phi = cs.cart2sp(x=points[:, 0], y=points[:, 1], z=points[:, 2]) # logger.info(f"number of zero points in r: {np.sum(r==0)}") as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesianToSpherical(x=0, y=0, z=0):\n\n hxy = np.hypot(x, y)\n radius = np.hypot(hxy, z)\n altitude = np.arctan2(z, hxy)\n azimuth = np.arctan2(y, x)\n return altitude, azimuth, radius", "def CartesianToSpherical(Cartesian):\n\n # x,y,z -> r,theta,phi\n x = Cartesian[:,0]\n y ...
[ "0.7355277", "0.72828305", "0.71637535", "0.7123989", "0.7075414", "0.7019445", "0.69850504", "0.69818425", "0.6980626", "0.6977134", "0.6959282", "0.6947505", "0.6928519", "0.6924944", "0.6924534", "0.6891793", "0.6881375", "0.6867867", "0.68466485", "0.6824763", "0.6783693"...
0.7004698
6
project model points onto a unit cylinder, r=1, h=1.
def project_to_cylinder(points): r, phi, z = cs.cart2cyl(points[:, 0], points[:, 1], points[:, 2]) # NOTE: z is unchanged # print(np.array_equal(z, points[:, 2])) # project onto unit cylinder x_cyl = points[:, 0] / r y_cyl = points[:, 1] / r z_cyl = (z - z.min()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makecylinder(model=[0,0,0,1,0,0,1],height = 1,density=10):\n # extract info from cylinder model\n radius = model[6]\n X,Y,Z = model[:3]\n # get 3d points to make an upright cylinder centered to the origin\n n = np.arange(0,360,int(360/density))\n height = np.arange(0,height,height/density)\n ...
[ "0.64186925", "0.6152617", "0.6123609", "0.59477514", "0.5873414", "0.5837798", "0.57903296", "0.57313627", "0.57169354", "0.5623152", "0.5608285", "0.5554857", "0.5532812", "0.5519945", "0.5469074", "0.5449008", "0.54360414", "0.54175097", "0.538803", "0.53823644", "0.534602...
0.7416266
0
This method takes already downloaded snapshots of a webpage, and extracts the fire data using parse(), and saves it to the datastore, but only if it's not already present.
def run_parsing(archive_directory, data_store, parse): files = os.listdir(archive_directory) counter = 0 count_nr = 0 for filename in files: if not filename.endswith(".html"): continue parts = filename[:-len(".html")].split('_') assert len(parts) == 4 year = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_and_save(url=URL,even_if_old = False):\n \n soup = gather_current(url=url)\n \n try:\n date = get_date(soup)\n except RuntimeError as e:\n now = datetime.now()\n date = datetime(now.year,now.month,now.day,now.hour,now.minute,now.second)\n print('unable to read ...
[ "0.5918881", "0.5396978", "0.53650486", "0.53435403", "0.5257623", "0.52304137", "0.52221036", "0.5166211", "0.51637036", "0.5119081", "0.50640327", "0.5053177", "0.5037533", "0.5020268", "0.4983511", "0.4936361", "0.49201882", "0.49062547", "0.49061346", "0.48950598", "0.488...
0.51060694
10
Fetch all the snapshots for the website.
def fetch_all_snapshots(archive_dir, wayback_filename, target_url): # Read the list of snapshots. with open(wayback_filename) as f: data = f.read() url_template = "http://web.archive.org/web/{timestamp}/{target_url}" snapshots = data.split("\n") pages_downloaded = 0 pages_failed = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_snapshots(self):\n _url = f\"{self.connector.base_url}/projects/{self.project_id}/snapshots\"\n\n response = self.connector.http_call(\"get\", _url)\n self.snapshots = response.json()", "def getSnapshots(self):\n snapshots = []\n for x in self.root.goto('CommonDataObjec...
[ "0.7107948", "0.6342461", "0.63190186", "0.6062705", "0.6008981", "0.60044056", "0.59348845", "0.5923568", "0.5910609", "0.58923537", "0.58885777", "0.5885084", "0.58506715", "0.5839381", "0.5786904", "0.5775894", "0.57698756", "0.5746789", "0.5741458", "0.5722078", "0.570577...
0.6720883
1
Parameters for the experiment.
def experiment_params(): exp = { 'lr': [1e-3], 'loss_function': ['cce'], 'optimizer': ['nadam'], 'dataset': [ # 'curv_contour_length_9', 'cluttered_nist_ix1', # 'curv_baseline', ] } exp['data_augmentations'] = [ [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):\n pass", "def parameters(self):", "def params(self):\n return {'cfg': self.cfg,\n 'momentum': self.momentum,\n 'center': self.center,\n 'scale': self.scale,\n 'epsilon': self.epsilon,\n 'act_fn': self.act_fn}", "def doPara...
[ "0.7732593", "0.75349516", "0.75191796", "0.7332194", "0.7250805", "0.7187534", "0.7182224", "0.71789974", "0.7178298", "0.71517766", "0.7124579", "0.70784044", "0.7071804", "0.6968503", "0.6960151", "0.6955326", "0.6918996", "0.68984336", "0.68870795", "0.68810993", "0.68550...
0.6977438
13
Create the hgru from Learning longrange...
def build_model(data_tensor, reuse, training): data_format = 'channels_last' conv_kernel = [ [3, 3], [3, 3], [3, 3], ] up_kernel = [2, 2] filters = [28, 36, 48, 64, 80] with tf.variable_scope('cnn', reuse=reuse): # Unclear if we should include l0 in the down/upsam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_l_n_u_ramping(ppc, lower_bound, upper_bound, Nhrs=2):\n \"\"\"lower_bound must be neagtiva, upper_bound must be positive\"\"\"\n gens_hrs = ppc['gen'][:, 0]\n gens_hrs = np.sort(gens_hrs)\n \n n_buses = set_n_buses(ppc, Nhrs)\n n_gens = len(gens_hrs) // 2\n l = np.zeros(n_buses)\n ...
[ "0.61773634", "0.5845611", "0.5567021", "0.55259305", "0.54361016", "0.543387", "0.5337504", "0.53193784", "0.5304474", "0.52276886", "0.52250886", "0.5166828", "0.51488", "0.51272446", "0.5125924", "0.5113933", "0.51110214", "0.5092735", "0.50910956", "0.5075847", "0.5075351...
0.0
-1
Run an experiment with hGRUs.
def main(gpu_device='/gpu:0', cpu_device='/cpu:0'): config = Config() params = experiment_params() model_tools.model_builder( params=params, config=config, model_spec=build_model, gpu_device=gpu_device, cpu_device=cpu_device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(_):\n description = xm.ExperimentDescription(\n 'HIS - trial=%d' % FLAGS.trial, tags=['his'])\n experiment = build_experiment()\n xm.launch_experiment(description, experiment)", "def run_experiment(hparams):\n\n data_file_name = build_data_file_name(hparams.pair, hparams.time_interval, hparam...
[ "0.62144756", "0.6207639", "0.6056002", "0.58943385", "0.5853564", "0.57410383", "0.56689966", "0.5646404", "0.5642825", "0.55434114", "0.55428135", "0.55404645", "0.5536264", "0.5517089", "0.5515994", "0.54892755", "0.5484224", "0.5480752", "0.547767", "0.54754966", "0.54754...
0.0
-1
constructor for the class
def __init__(self, c_in, c_out, k_size, stride=1, pad=0, bias=True): super(EqualizedConv2d, self).__init__() # define the weight and bias if to be used self.weight = torch.nn.Parameter(torch.nn.init.normal_( torch.empty(c_out, c_in, *_pair(k_size)) )) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__ (self):\n pass", "def __init__ (self) :", "def __init__(self, **kwds):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n...
[ "0.8734275", "0.850767", "0.8463304", "0.8435188", "0.83920276", "0.83920276", "0.83920276", "0.83920276", "0.82765424", "0.8235263", "0.8235263", "0.8235263", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727",...
0.0
-1
forward pass of the network
def forward(self, x): return torch.conv2d(input=x, weight=self.weight * self.scale, # scale the weight on runtime bias=self.bias if self.use_bias else None, stride=self.stride, padding=self.pad)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_pass(self):", "def forward(self, x):\n return self.net(x)", "def _forward(self, z):\n raise NotImplementedError(\"Forward shouldn't be called!\")", "def forward(self):\n pass", "def forward(self):\n pass", "def forward(self, input):\n\n return self.network(input...
[ "0.73186237", "0.71834505", "0.7120856", "0.7108922", "0.7108922", "0.7095405", "0.7095405", "0.7095405", "0.70948553", "0.7050654", "0.69926625", "0.6936527", "0.68624467", "0.6837398", "0.6822475", "0.67939997", "0.67933697", "0.67824763", "0.67761517", "0.67700446", "0.675...
0.0
-1
constructor for the class
def __init__(self, c_in, c_out, k_size, stride=1, pad=0, bias=True): super(EqualizedDeconv2d, self).__init__() # define the weight and bias if to be used self.weight = torch.nn.Parameter(torch.nn.init.normal_( torch.empty(c_in, c_out, *_pair(k_size)) )) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__ (self):\n pass", "def __init__ (self) :", "def __init__(self, **kwds):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n...
[ "0.8734275", "0.850767", "0.8463304", "0.8435188", "0.83920276", "0.83920276", "0.83920276", "0.83920276", "0.82765424", "0.8235263", "0.8235263", "0.8235263", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727", "0.8217727",...
0.0
-1
forward pass of the layer
def forward(self, x): return torch.conv_transpose2d(input=x, weight=self.weight * self.scale, # scale the weight on runtime bias=self.bias if self.use_bias else None, stride=self.stride, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, input):\n return self.layers(input)", "def forward(self, x):\n return self.layers(x)", "def __feed_forward(self, X):\n # go over all layers\n for layer in self.__layers:\n X = layer.compute_act(X)\n\n return X", "def _forward(self):\n\n t...
[ "0.7367367", "0.73399484", "0.7315237", "0.72809756", "0.7266685", "0.72531646", "0.72451967", "0.7235675", "0.72132516", "0.7186353", "0.7180268", "0.7173166", "0.71502644", "0.7145505", "0.7143514", "0.71366554", "0.7135957", "0.7118842", "0.70899886", "0.70655066", "0.7061...
0.0
-1
forward pass of the module
def forward(self, x, alpha=1e-8): y = x.pow(2.).mean(dim=1, keepdim=True).add(alpha).sqrt() # [N1HW] y = x / y # normalize the input x volume return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_pass(self):", "def forward(self):\n pass", "def forward(self):\n pass", "def forward(self)->None:", "def forward(self,input):\n\t\traise RuntimeError(\"All subclasses of Module must implement a forward method\")", "def forward(self, *args, **kwargs):\n pass", "def forwa...
[ "0.85779595", "0.8085728", "0.8085728", "0.80816996", "0.76255274", "0.7576623", "0.7449357", "0.7449357", "0.7302465", "0.7278256", "0.7218454", "0.7218454", "0.7218454", "0.72112536", "0.71955615", "0.71460116", "0.7123813", "0.70815426", "0.7080172", "0.7046183", "0.699500...
0.0
-1
forward pass of the layer
def forward(self, x, alpha=1e-8): batch_size, _, height, width = x.shape # [B x C x H x W] Subtract mean over batch. y = x - x.mean(dim=0, keepdim=True) # [1 x C x H x W] Calc standard deviation over batch y = torch.sqrt(y.pow(2.).mean(dim=0, keepdim=False) + alpha) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, input):\n return self.layers(input)", "def forward(self, x):\n return self.layers(x)", "def __feed_forward(self, X):\n # go over all layers\n for layer in self.__layers:\n X = layer.compute_act(X)\n\n return X", "def _forward(self):\n\n t...
[ "0.7367367", "0.73399484", "0.7315237", "0.72809756", "0.7266685", "0.72531646", "0.72451967", "0.7235675", "0.72132516", "0.7186353", "0.7180268", "0.7173166", "0.71502644", "0.7145505", "0.7143514", "0.71366554", "0.7135957", "0.7118842", "0.70899886", "0.70655066", "0.7061...
0.0
-1
Evaluate modules in stack, starting at module start. When stack is fitting (valmode is False), simply calls mod.evaluate() for each module in the stack. However, when the stack is testing (valmode is True), evaluate first calls an est/val function to create a list of validation datasets ("nest"). It then extracts the f...
def evaluate(self, start=0): if self.valmode and self.meta['nests'] > 0: # new nested eval, doesn't require special evaluation procedure # by modules. instead, all the remapping and collecting of val # data from each nest handled inside this evaluation function. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_old(self, start=0):\n\n if self.valmode and self.nests > 0:\n # evaluate using the old nesting scheme devised by Noah\n # this section is deprecated and should be deleted\n\n log.info('Evaluating nested validation data')\n mse_idx = ut.utils.find_modu...
[ "0.68430686", "0.6166602", "0.55665743", "0.5501617", "0.54066515", "0.54039", "0.53980684", "0.53958213", "0.53774875", "0.5376684", "0.537446", "0.53603584", "0.52973723", "0.52973723", "0.52973723", "0.52870274", "0.5280845", "0.52624315", "0.52150756", "0.5192127", "0.516...
0.77966243
0
DEPRECATED new evaluate remove old nested code
def evaluate_old(self, start=0): if self.valmode and self.nests > 0: # evaluate using the old nesting scheme devised by Noah # this section is deprecated and should be deleted log.info('Evaluating nested validation data') mse_idx = ut.utils.find_modules(self, 'm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, tree):\n\t\tpass", "def evaluate(self):\n pass", "def evaluate(self):\n pass", "def evaluate(compiled_expression):", "def evaluate(self) :\n pass", "def eval(self):\n pass", "def eval(self):\n pass", "def eval(self):\n pass", "def evaluat...
[ "0.69647765", "0.6759526", "0.6759526", "0.67196566", "0.66116154", "0.65223426", "0.65223426", "0.65223426", "0.62965846", "0.6202219", "0.6188042", "0.61476445", "0.6125099", "0.6103021", "0.60791487", "0.60703933", "0.6064442", "0.6027227", "0.599475", "0.5913179", "0.5901...
0.0
-1
Creates an instance of a module and appends it to the stack. Evaluates module in doing so.
def append(self, mod=None, **xargs): if mod is None: raise ValueError('stack.append: module not specified') else: m = mod(self, **xargs) self.append_instance(m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_instance(self, mod=None):\n if not mod:\n raise ValueError('stack.append: module not specified')\n # mod=nm.nems_module(self)\n self.modules.append(mod)\n self.data.append(mod.d_out)\n self.mod_names.append(mod.name)\n self.mod_ids.append(mod.idm)...
[ "0.6760236", "0.6550509", "0.6345163", "0.6314663", "0.61647755", "0.61131513", "0.6065246", "0.6036257", "0.60330945", "0.59615767", "0.59563684", "0.5880003", "0.58381915", "0.58381915", "0.5812597", "0.58002234", "0.5770744", "0.5749715", "0.5648677", "0.5580021", "0.55725...
0.5783253
16
Same as append but takes an instance of a module instead of the class to preserve existing xargs. For use with insert/remove. Could maybe merge these with an added boolean arg? Wasn't sure if that would interfere with the xargs.
def append_instance(self, mod=None): if not mod: raise ValueError('stack.append: module not specified') # mod=nm.nems_module(self) self.modules.append(mod) self.data.append(mod.d_out) self.mod_names.append(mod.name) self.mod_ids.append(mod.idm) mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, mod=None, **xargs):\n if mod is None:\n raise ValueError('stack.append: module not specified')\n else:\n m = mod(self, **xargs)\n self.append_instance(m)", "def append(self, *args):\n self.add(*args)", "def append(self, *__args): # real signature u...
[ "0.6353173", "0.6127798", "0.6106511", "0.60686415", "0.60615456", "0.60283005", "0.60082567", "0.58047557", "0.57165617", "0.55905485", "0.5451006", "0.5382351", "0.53696674", "0.53086245", "0.5297358", "0.52906054", "0.52289265", "0.5198917", "0.51974815", "0.5194997", "0.5...
0.49777904
39
Creates an instance of a module and appends it to the stack. Evaluates module in doing so. APPEARS TO BE A BUG. Is input a module instance? Or a pointer to the function?
def append_no_eval(self, mod=None, **xargs): if mod is None: raise ValueError('stack.append: module not specified') else: m = mod(self, **xargs) self.modules.append(mod) self.data.append(mod.d_out) self.mod_names.append(mod.name) self.mod_ids.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_instance(self, mod=None):\n if not mod:\n raise ValueError('stack.append: module not specified')\n # mod=nm.nems_module(self)\n self.modules.append(mod)\n self.data.append(mod.d_out)\n self.mod_names.append(mod.name)\n self.mod_ids.append(mod.idm)...
[ "0.6311251", "0.59774005", "0.5882799", "0.5829053", "0.5824564", "0.5824564", "0.57864547", "0.57864547", "0.5691889", "0.5545914", "0.5527849", "0.5524098", "0.5428343", "0.5415356", "0.5396696", "0.5330759", "0.53257704", "0.52975297", "0.5272698", "0.5255934", "0.52240497...
0.56974465
8
Insert a module at index in stack, then evaluate the inserted module and reappend all the modules that were in the stack previously, starting with the insertion index.
def insert(self, mod=None, idx=None, **xargs): # if no index is given or index is out of bounds, # just append mod to the end of the stack if (not idx) or (idx > len(self.modules) - 1)\ or (idx < -1 * len(self.modules) - 1): self.append(mod, **xargs) idx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, index: int, tree: 'Tree') -> None:\n ...", "def insert(self, indexes: Tuple[int, ...], tree: 'Tree') -> None:\n ...", "def insert(self, *a):\r\n return self.stack.insert(*a)", "def insert_index(self):\n pass", "def remove(self, idx=None, mod=None, all_idx=False)...
[ "0.5868107", "0.5672296", "0.54033864", "0.5368524", "0.5336604", "0.5311128", "0.5281682", "0.526412", "0.5255213", "0.5232728", "0.51956016", "0.5193696", "0.51654994", "0.5146614", "0.51329195", "0.5129675", "0.51240057", "0.509366", "0.5091687", "0.5084046", "0.50813216",...
0.7795618
0
Remove the module at the given index in stack, then reappend all modules that came after the removed module.
def remove(self, idx=None, mod=None, all_idx=False): if mod and not idx: idx = ut.utils.find_modules(self, mod.name) if not idx: log.warn("Module does not exist in stack.") return if not all_idx: # Only remove the instance with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_at(self, index):\n if len(self.stacks[index]) < 1:\n return\n popped = self.stacks[index].pop()\n if index == len(self.stacks)-1:\n return popped\n for i in range(index, len(self.stacks)-1):\n # append to last operation\n self.stacks[i...
[ "0.62720364", "0.6165815", "0.6154364", "0.6141485", "0.58771044", "0.580344", "0.57758456", "0.56776845", "0.5672032", "0.56380874", "0.56142616", "0.5602583", "0.5561665", "0.5540167", "0.5531981", "0.5488315", "0.5434079", "0.54173774", "0.5400926", "0.5400379", "0.5378563...
0.70490533
0
For remove and insert wasn't sure if the original popmodule method had a specific usecase, so I didn't want to modify it. Can merge the two if these changes won't cause issues. Removes the last module from stack lists, along with its corresponding data and name (and id?).
def popmodule_2(self): m = self.modules.pop(-1) self.data.pop(-1) self.mod_names.pop(-1) # Doesn't look like this one is being used yet? # self.mod_ids.pop(-1) return m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self):\n return self.stack_list.pop()", "def pop():", "def delete_stack(Name=None):\n pass", "def delModule(name):", "def pop(self):", "def pop(self):", "def pop(self):\n del self.args[self.type_stack.pop()]\n self.id_stack.pop()", "def popleft(self):\n return...
[ "0.6424905", "0.60469043", "0.6003137", "0.59415084", "0.5937875", "0.5937875", "0.59241915", "0.5911617", "0.5885596", "0.581243", "0.5812425", "0.5803043", "0.5738069", "0.5673044", "0.5652739", "0.5649205", "0.56475323", "0.5647359", "0.5626168", "0.56206787", "0.56127673"...
0.78367704
0
Copy of quick_plot for easy save or embed.
def quick_plot_save(self, mode='png'): batch = self.meta['batch'] cellid = self.meta['cellid'] modelname = self.meta['modelname'] fig = plt.figure(figsize=(8, 9)) plot_set = [] for idx, m in enumerate(self.modules): if m.auto_plot: plot_set.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_plot(self, ):\n pass", "def showPlot1(): \n raise NotImplementedError", "def showPlot2():\n raise NotImplementedError", "def defineQuickplot(self, file, var):\n if self.quickplotItem is None:\n self.quickplotItem = QDefinedVariableItem(file, var, 'quickplot')\n ...
[ "0.6487135", "0.636231", "0.6337448", "0.6284134", "0.62655956", "0.6180178", "0.61296946", "0.6100648", "0.5995507", "0.598488", "0.58660775", "0.58647877", "0.58567715", "0.5847191", "0.58060396", "0.5795975", "0.5787422", "0.5727069", "0.5726445", "0.57166964", "0.5672869"...
0.6503567
0
Return the creation time of the script
def get_source_ctime(self): return self.source_file_ctime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creation_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"creation_time\")", "def creation_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"creation_time\")", "def creation_timestamp(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"creation_timestamp\"...
[ "0.79180104", "0.79180104", "0.77224886", "0.764707", "0.75584537", "0.75584537", "0.75584537", "0.7465545", "0.7465545", "0.7465545", "0.73698586", "0.73372173", "0.7325024", "0.7325024", "0.7325024", "0.7325024", "0.7325024", "0.7325024", "0.7325024", "0.7325024", "0.732502...
0.65311104
81
Set the source path
def set_source_path(self, folder): self.source_path = folder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSourcePath(self, sourcePath):\n self.__sourcePath = sourcePath", "def set_source_file(self, source_file):\n self.set_attribute(\"source_file\", source_file)", "def set_source(self, source):\n self.data['source'] = source", "def set_source(self, source_name):\n self.source =...
[ "0.83226603", "0.74998415", "0.71865904", "0.7161414", "0.70848644", "0.707815", "0.7022367", "0.7016785", "0.6977186", "0.6977186", "0.6977186", "0.6977186", "0.6977186", "0.6977186", "0.6977186", "0.6824116", "0.6796334", "0.67032343", "0.6652705", "0.65941703", "0.65592533...
0.8053338
1
Get the source path
def get_source_path(self): return self.source_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_file_path(self) -> str:\n return self._source_file_path", "def GetSrc():\n return os.path.abspath(os.path.join(_THIS_DIR, os.pardir, os.pardir,\n os.pardir))", "def path(self) -> str:\n return self.src + \"/\"", "def get_source_file(self):\n ...
[ "0.8576688", "0.8262134", "0.79809034", "0.7795228", "0.77610385", "0.7651921", "0.76108766", "0.7521036", "0.75103116", "0.75041884", "0.7452256", "0.7439682", "0.7434683", "0.73519576", "0.73273706", "0.7324913", "0.7315504", "0.72917026", "0.72893727", "0.72733146", "0.727...
0.8933967
0
Merge another object into this
def merge_object(self, obj): for key, value in obj.lines.items(): if key not in self.lines: self.lines[key] = value self.lines[key] = self.lines[key] + value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(self, obj):\n pass", "def __add__(self, other):\n self.__dict__.update(other)\n return self", "def _merge(self, other: dict):\n self._storage = dict_merge(self._storage, other)", "def update(self, other):\n _merge_dicts(self, other)", "def merge_from(self, other...
[ "0.7956597", "0.732633", "0.7240118", "0.71760553", "0.71563464", "0.7126134", "0.7017946", "0.7015831", "0.69688225", "0.6816199", "0.6761192", "0.67535526", "0.67506856", "0.67034584", "0.66704005", "0.66545653", "0.65906477", "0.6574199", "0.65532863", "0.6475579", "0.6474...
0.6341723
27
Read content of a file
def read_file(name): with open(name, 'r') as my_file: return my_file.read().encode('utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __read_file(self, filename):\n with open(filename) as f:\n content = f.readlines()\n \n return content", "def readContent(file):\n \n with open(file, \"r\", encoding = \"utf-8\") as f:\n return f.read()", "def read_file():\n with open(FILE_NAME) as f:\n ...
[ "0.78922", "0.7823199", "0.7789081", "0.7772455", "0.77680683", "0.776779", "0.7736673", "0.7735722", "0.7685032", "0.76653844", "0.76480156", "0.7647617", "0.76447254", "0.7622267", "0.7586751", "0.7577363", "0.7576444", "0.7574166", "0.7567519", "0.75650775", "0.7549918", ...
0.0
-1
Retrieves the base MAC address for the module
def get_base_mac(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac", "def _get_mac_address():\n if not sys.platform.startswith('linux'):\n raise RuntimeError(\n 'Cannot get the MAC address on non-Linux platforms'\n )...
[ "0.7351595", "0.73193", "0.7172374", "0.7152699", "0.7143644", "0.69826794", "0.6948817", "0.6934663", "0.6881184", "0.68360406", "0.6744061", "0.6730958", "0.6698504", "0.66975266", "0.66299105", "0.6609018", "0.6609018", "0.65955216", "0.65718997", "0.6496191", "0.6475652",...
0.80171996
0
Retrieves the hardware serial number for the module
def get_serial_number(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serial_number(self):\n serial = create_string_buffer(64)\n self._dll.ShamrockGetSerialNumber(self._device, serial)\n return serial.value", "def _usb_serial_number(self):\n return self.device.serial_number", "async def get_serial_number(self):\n\n # Display info messag...
[ "0.78120714", "0.7797088", "0.7707035", "0.7703776", "0.7686934", "0.7686934", "0.7664357", "0.7615573", "0.75634897", "0.7562538", "0.75479317", "0.7481692", "0.74116325", "0.73116183", "0.7303067", "0.72941494", "0.7286045", "0.7273102", "0.7243157", "0.72151095", "0.719303...
0.72601914
18
Retrieves a list of the names of components available on the module (e.g., BIOS, CPLD, FPGA, etc.)
def get_component_name_list(self): return self._component_name_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chipset_driver_modules(self):\n\t\treturn self.__info_dict['info']['chipset_driver_modules']['value']", "def list_components(self) -> Dict[str, Any]:\n return self._manager.list_components()", "def getModuleNames():\n import setup\n names = [e.name[1:] for e in setup.wxpExtensions]\n return...
[ "0.675362", "0.6675968", "0.6539068", "0.6341745", "0.63289636", "0.62775135", "0.6247974", "0.62147105", "0.6186656", "0.6176592", "0.6158209", "0.6141283", "0.6056836", "0.605391", "0.60498637", "0.6042864", "0.6035058", "0.602026", "0.59946656", "0.59918433", "0.59878767",...
0.6718576
1
Retrieves platformspecific hardware/firmware versions for chassis componenets such as BIOS, CPLD, FPGA, etc.
def get_firmware_version(self, component_name): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_system_hardware(self):\n return self._get_system_status()[\"hardware\"]", "def fusion_api_get_server_hardware_firmware_compliance(self, body, api=None, headers=None):\n return self.sh.post(body=body, param='/firmware-compliance', api=api, headers=headers)", "def get_hardware_revision():\...
[ "0.69610465", "0.68509316", "0.6848931", "0.6831852", "0.66676843", "0.66630316", "0.6598765", "0.6556715", "0.6542124", "0.6444984", "0.63885117", "0.6317167", "0.6309591", "0.63018423", "0.6282868", "0.62512887", "0.6211539", "0.61840796", "0.6073738", "0.60699904", "0.6069...
0.580876
35
Install firmware to component
def install_component_firmware(self, component_name, image_path): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_firmware(self, firmware_file_path: str) -> None:\n raise NotImplementedError()", "def install_firmware(self, image_path):\n \"\"\"Not Implement\"\"\"\n return False", "def install_firmware(self, pbz_path, recovery=False):\n\n\t\tresources = None\n\t\twith zipfile.ZipFile(pb...
[ "0.7489954", "0.73957425", "0.70389396", "0.68635696", "0.6861828", "0.67708874", "0.67589694", "0.67289037", "0.6711583", "0.66553813", "0.64939946", "0.6420946", "0.63295645", "0.6287184", "0.62524647", "0.61841255", "0.61578", "0.60796416", "0.6072762", "0.6050385", "0.604...
0.7738532
0
Retrieves the number of fan modules available on this module
def get_num_fans(self): return len(self._fan_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_count(self):\n return self._module_count", "def get_count():\n _check_init()\n return _pypm.CountDevices()", "def get_number_of_devices(self):\n return self.drt_manager.get_number_of_devices()", "def get_binmodule_total_count(self):\n count = 0\n for binmodule in self.bin...
[ "0.73260516", "0.7013798", "0.6597507", "0.6501957", "0.6473484", "0.62529796", "0.6124135", "0.60928494", "0.60834587", "0.6067455", "0.6065879", "0.60154957", "0.59416884", "0.5927844", "0.5919875", "0.5899991", "0.5868542", "0.58482015", "0.58237135", "0.58183867", "0.5790...
0.68157643
2
Retrieves all fan modules available on this module
def get_all_fans(self): return self._fan_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modules(self):\n return self._modules", "def modules(self):\n return self.rpc.call(MsfRpcMethod.SessionCompatibleModules, [self.sid])['modules']", "def modules_registered(self) -> list[Module]:\n return [cmds[0].module for cmds in self._registry[\"by_module\"].values()]", "def module...
[ "0.67131376", "0.6539543", "0.6491338", "0.64531904", "0.64291096", "0.64291096", "0.64112544", "0.6351758", "0.63013667", "0.627619", "0.6173613", "0.6157963", "0.6102885", "0.6081959", "0.60808706", "0.60690796", "0.6047247", "0.6045077", "0.6019263", "0.59584165", "0.59384...
0.6414935
6
Retrieves fan module represented by (0based) index
def get_fan(self, index): fan = None try: fan = self._fan_list[index] except IndexError: sys.stderr.write("Fan index {} out of range (0-{})\n".format( index, len(self._fan_list)-1)) return fan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(self):\n\t\treturn call_sdk_function('PrlBootDev_GetIndex', self.handle)", "def index(self):\n return self._data.get('index')", "def get(self, index):\n raise NotImplementedError() # pragma: no cover", "def index(self):\n return self.container['index']", "def index(self) ...
[ "0.6386185", "0.58992296", "0.5883011", "0.58483106", "0.5820761", "0.5784802", "0.56571335", "0.56555796", "0.5613986", "0.55979806", "0.5572192", "0.5569636", "0.55565727", "0.5548922", "0.5546313", "0.55427456", "0.554139", "0.554139", "0.5529777", "0.55279493", "0.5519806...
0.6381616
1
Retrieves the number of power supply units available on this module
def get_num_psus(self): return len(self._psu_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power_management() -> int:", "def get_power(self):\r\n return self._api.get_power()", "def list_power_supply_units(self):\n\n doc = self.client.enumerate(uris.CIM_PowerSupply)\n\n psus = doc.find('.//s:Body/wsen:EnumerateResponse/wsman:Items',\n wsman.NS_MAP)\n\n ...
[ "0.72453", "0.67439634", "0.67290133", "0.66231495", "0.65658104", "0.6514196", "0.6482216", "0.64284277", "0.63828456", "0.6366741", "0.6366741", "0.63495904", "0.6284794", "0.62792134", "0.6273291", "0.6269788", "0.6268552", "0.62483686", "0.6207047", "0.62027615", "0.62027...
0.0
-1
Retrieves all power supply units available on this module
def get_all_psus(self): return self._psu_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_power_supply_units(self):\n\n doc = self.client.enumerate(uris.CIM_PowerSupply)\n\n psus = doc.find('.//s:Body/wsen:EnumerateResponse/wsman:Items',\n wsman.NS_MAP)\n\n return [self._parse_psus(psu) for psu in psus]", "def get_list_powers(self):\r\n return self....
[ "0.77775484", "0.6766033", "0.66853946", "0.6468107", "0.6416482", "0.6375057", "0.6272041", "0.62313294", "0.62313294", "0.62275606", "0.6223866", "0.6195295", "0.61867726", "0.61856294", "0.6168957", "0.61667556", "0.6141389", "0.60405266", "0.6037811", "0.5994922", "0.5977...
0.0
-1
Retrieves power supply unit represented by (0based) index
def get_psu(self, index): psu = None try: psu = self._psu_list[index] except IndexError: sys.stderr.write("PSU index {} out of range (0-{})\n".format( index, len(self._psu_list)-1)) return psu
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPowerIndex(self):\n return self.powerIndex_", "def unit_at(self, index):\n return self.child_at(index)", "def list_power_supply_units(self):\n\n doc = self.client.enumerate(uris.CIM_PowerSupply)\n\n psus = doc.find('.//s:Body/wsen:EnumerateResponse/wsman:Items',\n ...
[ "0.6429405", "0.6376049", "0.59130216", "0.5875807", "0.5830402", "0.57752043", "0.574414", "0.5738909", "0.5710213", "0.56981695", "0.55573934", "0.5550405", "0.5523114", "0.5516067", "0.5491979", "0.5477296", "0.5443224", "0.5437538", "0.54343176", "0.5416655", "0.54004264"...
0.5485817
15
Retrieves the number of thermals available on this module
def get_num_thermals(self): return len(self._thermal_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_herbs(self):\n return self._num_herbs", "def n_thres(self):\n return np.size(self.thres)", "def module_count(self):\n return self._module_count", "def thres(self):\n return self._thres", "def num_tanks(self):\n return len(self._node_reg.tank_names)", "def get_num_cl...
[ "0.65417665", "0.64836925", "0.6480519", "0.6358993", "0.61816263", "0.6166796", "0.61326504", "0.6097328", "0.6085249", "0.60553885", "0.60377574", "0.6029889", "0.6029889", "0.60067743", "0.6000151", "0.5981292", "0.59744334", "0.59277475", "0.59189385", "0.58891124", "0.58...
0.70140344
0
Retrieves all thermals available on this module
def get_all_thermals(self): return self._thermal_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thres(self):\n return self._thres", "def listOfTTHalfModules():\n hm = TTModulesMap_instance.dictOfHalfModules\n listOfHalfModules = []\n for ul in hm.keys():\n for reg in hm[ul].keys():\n for module in hm[ul][reg]:\n for halfmod in hm[ul][reg][module]:\n ...
[ "0.62711614", "0.59908235", "0.59710574", "0.5953332", "0.56614625", "0.56347954", "0.5541476", "0.5494775", "0.5479787", "0.5398086", "0.5393271", "0.5389046", "0.53820115", "0.5353621", "0.5340566", "0.53130895", "0.52500635", "0.5216711", "0.51958674", "0.5191442", "0.5184...
0.6584657
0
Retrieves thermal unit represented by (0based) index
def get_thermal(self, index): thermal = None try: thermal = self._thermal_list[index] except IndexError: sys.stderr.write("THERMAL index {} out of range (0-{})\n".format( index, len(self._thermal_list)-1)) return thermal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_at(self, index):\n return self.child_at(index)", "def unit_of_measurement(self):\n return 'index'", "def get_wave_unit(tag, hdulist, idx=None):\n from astropy.units import Unit\n if idx is None:\n idx = 1\n # Use Table\n if isinstance(hdulist[idx],BinTableHDU):\n ...
[ "0.6782312", "0.6672872", "0.6465281", "0.62784415", "0.61447746", "0.6080922", "0.6078993", "0.60755485", "0.60755485", "0.60755485", "0.5995953", "0.59833705", "0.5874957", "0.5864363", "0.5839025", "0.5820442", "0.5817567", "0.5805475", "0.5805475", "0.57990026", "0.579775...
0.7130597
0
Retrieves the number of sfps available on this module
def get_num_sfps(self): return len(self._sfp_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_count():\n _check_init()\n return _pypm.CountDevices()", "def get_num_psus(self):\n return len(self._psu_list)", "def module_count(self):\n return self._module_count", "def get_spitfp_error_count(self):\n return GetSPITFPErrorCount(*self.ipcon.send_request(self, BrickletBaromet...
[ "0.68690604", "0.6832386", "0.6471102", "0.63796633", "0.6281832", "0.6270548", "0.62695867", "0.6203247", "0.6201169", "0.6189551", "0.61816835", "0.6102134", "0.60676277", "0.6062961", "0.6058272", "0.6052856", "0.6033939", "0.60258675", "0.60258675", "0.6015374", "0.601395...
0.8088208
0
Retrieves all sfps available on this module
def get_all_sfps(self): return self._sfp_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sp_policys(self, context):\n # handling policys method in RPC\n response = self.dns_manager.get_sp_policys(context)\n return response", "def get_services(self):\r\n return get_service_list()", "def get_num_sfps(self):\n return len(self._sfp_list)", "def available_se...
[ "0.58436906", "0.5787607", "0.57075214", "0.5639271", "0.5581612", "0.55547", "0.5551602", "0.55474824", "0.5540281", "0.551357", "0.5476573", "0.54620093", "0.54596883", "0.54454136", "0.54394895", "0.5405636", "0.54031163", "0.5376224", "0.5344542", "0.5316873", "0.53115666...
0.8060464
0
Retrieves sfp represented by (0based) index
def get_sfp(self, index): sfp = None try: sfp = self._sfp_list[index] except IndexError: sys.stderr.write("SFP index {} out of range (0-{})\n".format( index, len(self._sfp_list)-1)) return sfp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, index):\n raise NotImplementedError() # pragma: no cover", "def GetSashPosition(self, idx):\n assert idx < len(self._sashes)\n return self._sashes[idx]", "def refFromIndex(index):\n fileno = math.floor(index // 100000)\n frame = index % 100000\n return fileno, frame", "...
[ "0.60268134", "0.59960663", "0.5991602", "0.5973616", "0.59693825", "0.59281826", "0.5861673", "0.58611625", "0.5817246", "0.58011967", "0.57925785", "0.5776426", "0.57741547", "0.57703364", "0.57695585", "0.5764657", "0.5751148", "0.5742006", "0.5740557", "0.5737907", "0.571...
0.8008134
0
Returns a nested dictionary containing all devices which have experienced a change in this module
def get_change_event(self, timeout=0): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devices_dict(self):\n return self.devices.dict", "def check_device_changes(self):\n\n #---------------------------------------------------------------------------\n # USB ports\n current_serial_devices = self.enumerate_serial_devices()\n\n for device in self.old_serial_devi...
[ "0.6735557", "0.6673611", "0.6584133", "0.6313082", "0.6209342", "0.61707854", "0.61589", "0.6036916", "0.59878635", "0.59700155", "0.5880778", "0.5876064", "0.5835587", "0.58135825", "0.5783256", "0.5775957", "0.5771707", "0.57595575", "0.57500005", "0.57388914", "0.573417",...
0.0
-1
create u_{x} matrix operator using the upwind method.
def create_Ux_mat(x): dx = x[1] - x[0] ## upwind method based on left cells moving right ## and right cells moving left (similar to a scratch assay) '''x_int = np.arange(1,len(x)-1,dtype=int) Ux_mat_row = np.hstack((x_int, x_int)) Ux_mat_col = np.hstack((x_int, x_int[:len(x_int)/2]-1,x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Uxx_mat(x):\n \n\n dx = x[1] - x[0]\n \n x_int = np.arange(1,len(x)-1,dtype=int)\n #create u_{xx} matrix operator\n Uxx_mat_row = np.hstack((x_int,x_int,x_int))\n Uxx_mat_col = np.hstack((x_int-1,x_int,x_int+1))\n Uxx_entry = (1/(dx**2))*np.hstack((np.ones(len(x)-2),-2*np.ones(le...
[ "0.6904973", "0.67573005", "0.618727", "0.58783466", "0.5850389", "0.57314026", "0.5695365", "0.5695365", "0.56091934", "0.55918", "0.5560309", "0.5517079", "0.54789305", "0.547467", "0.5455033", "0.5443935", "0.5443935", "0.5387152", "0.537313", "0.5366446", "0.53465855", ...
0.77150667
0
create u_{xx} matrix operator using central differences. No flux boundaries assumed.
def create_Uxx_mat(x): dx = x[1] - x[0] x_int = np.arange(1,len(x)-1,dtype=int) #create u_{xx} matrix operator Uxx_mat_row = np.hstack((x_int,x_int,x_int)) Uxx_mat_col = np.hstack((x_int-1,x_int,x_int+1)) Uxx_entry = (1/(dx**2))*np.hstack((np.ones(len(x)-2),-2*np.ones(len(x)-2),(np.on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Ux_mat(x):\n \n dx = x[1] - x[0]\n \n ## upwind method based on left cells moving right\n ## and right cells moving left (similar to a scratch assay)\n '''x_int = np.arange(1,len(x)-1,dtype=int)\n Ux_mat_row = np.hstack((x_int, x_int))\n Ux_mat_col = np.hstack((x_int, x_int[:len(...
[ "0.62446815", "0.62316376", "0.6046306", "0.6005687", "0.59617823", "0.5938628", "0.59300697", "0.58108884", "0.5771789", "0.5753315", "0.5722855", "0.5706403", "0.56890017", "0.5678955", "0.5677416", "0.5673115", "0.5672235", "0.56281036", "0.5621129", "0.56142914", "0.55678...
0.69822335
0
baseline proliferation function (logistic growth)
def f(y): k = 1.0 return y*(1-y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logbasechange(a,b):\n return np.log(b)/np.log(a)", "def log_prob(self):", "def compute_log_prior(self,params: ndarray) -> float:\n ln_tE = params[0]\n ln_A0 = params[1]\n ln_deltaT = params[2]\n fbl = params[3]\n mb = params[4]\n\n # Equation (16,15,17) (note th...
[ "0.6772403", "0.6745147", "0.6478086", "0.6426432", "0.6398961", "0.6266852", "0.6225034", "0.61189485", "0.6056354", "0.6019989", "0.5986453", "0.5985676", "0.5963943", "0.5930226", "0.5919842", "0.5898813", "0.58632284", "0.5845263", "0.5842644", "0.5838407", "0.5826968", ...
0.0
-1
RHS for the FisherKPP Equation
def PDE_RHS_FKPP(t,y,q,x,description=None): D_mat = create_Uxx_mat(x) return (q[0]*D_mat.dot(y) + q[1]*y*(1-y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fv(self):\n return self.beta * (self.x ** self.c)", "def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn", "def _correct_p(self, f0, f1):\n return self.p * np.exp(self.dbeta * (f0 + f1) / 2)", "def feller(self):\n return 2 * self.k...
[ "0.6517256", "0.6162716", "0.6148991", "0.61416847", "0.6108718", "0.6099961", "0.6089068", "0.6084212", "0.60690767", "0.60681206", "0.606658", "0.6007005", "0.5999013", "0.59550226", "0.5952696", "0.5930681", "0.5928076", "0.5914689", "0.5897699", "0.5894985", "0.5892337", ...
0.59141266
18
RHS for an inferred Equation
def learned_RHS(t,y,q,x,desc): Ux_mat = create_Ux_mat(x) Uxx_mat = create_Uxx_mat(x) return (q[desc.index('u_{x}')]*Ux_mat.dot(y) + q[desc.index('u_{xx}')]*Uxx_mat.dot(y) + q[desc.index('u^2')]*y**2 + q[desc.index('u')]*y + q[desc.index('u^2u_{x}'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRHS(self, freq):\n\n # Get sources for the frequncy(polarizations)\n Src = self.survey.getSrcByFreq(freq)[0]\n S_e = Src.S_e(self)\n return -1j * omega(freq) * S_e", "def _as_rhs(self):\n raise NotImplementedError", "def sqrtx():\n return Operator([[(1.+1.j)/2,(1.-1...
[ "0.6772902", "0.6343115", "0.6216663", "0.6203044", "0.619155", "0.61267227", "0.61176705", "0.61176705", "0.6101135", "0.6050898", "0.6046716", "0.6016773", "0.6016773", "0.6011438", "0.6001926", "0.5971846", "0.59680283", "0.596132", "0.59369314", "0.5900158", "0.5892403", ...
0.62597275
2
Generalized least squares error || (yf)/(f^gamma) ||_2^2 . where f is model , y is data Because of singularity at f=0 , we use MSE for |f| < 1e4
def RSS_GLS(model,target,gamma): GLS_domain = np.where(np.abs(model)>1e-4) OLS_domain = np.where(np.abs(model)<=1e-4) GLS_res = (model[GLS_domain]-target[GLS_domain])/(np.abs(model[GLS_domain])**gamma) OLS_res = model[OLS_domain]-target[OLS_domain] GLS_RSS = np.linalg.norm(GLS_res)**2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitGammaErrFun(self, params, x, y, minLum, maxLum):\n if self.eq == 4:\n gamma, a, k = params\n _m = gammaFun(x, minLum, maxLum, gamma, eq=self.eq, a=a, k=k)\n model = numpy.asarray(_m)\n else:\n gamma = params[0]\n _m = gammaFun(x, minLum, m...
[ "0.65444165", "0.6524985", "0.6521384", "0.65144217", "0.6448623", "0.6415206", "0.63830924", "0.6343939", "0.63054323", "0.62762034", "0.6265394", "0.62134725", "0.62062895", "0.6161292", "0.6149282", "0.61463815", "0.6141959", "0.61390245", "0.6115465", "0.6110745", "0.6088...
0.5814023
61
Simulate 1d inferred PDE models using the method of lines approach
def PDE_sim(q,RHS,x,t,IC,f=f,g=g,description=None): #grids for numerical integration t_sim = np.linspace(t[0],t[-1],10000) x_sim = np.linspace(x[0],x[-1],200) #interpolate initial condition to new grid f_interpolate = interpolate.interp1d(x,IC) y0 = f_interpolate(x_sim) #indi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tes1():\n m=DynModel()\n m.state('S1',1.0)\n m.state('S2',0.0)\n m.state('S3',0.0)\n m.connect('S1','S2',0.1)\n m.connect('S2','S3',0.1)\n #import pudb; pu.db\n assert len(m.v)==3\n assert len(m.e)==2\n\n m.prepare()\n m.simulate()\n\n #print m.storage.S\n #print m.storag...
[ "0.64934886", "0.5998914", "0.59710944", "0.58593524", "0.5664626", "0.5661857", "0.56392485", "0.56255305", "0.55981743", "0.5583399", "0.5563944", "0.5562818", "0.55403817", "0.55263066", "0.55070424", "0.5461943", "0.5424968", "0.5410878", "0.5400796", "0.53888154", "0.537...
0.0
-1
Create a multi node optimizer from a Chainer optimizer.
def create_multi_node_optimizer(actual_optimizer, communicator): return _MultiNodeOptimizer(actual_optimizer, communicator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_optimizer(self, context, optimizer, host):\n pass", "def create_model_optimizer(net,alpha):\n optimizer = chainer.optimizers.Adam(alpha=alpha)\n optimizer.setup(net)\n return optimizer", "def __init__(self, optimizer):\n super(ShardedOptimizer, self).__init__(optimizer, name=\"Sha...
[ "0.6300642", "0.58528394", "0.56481653", "0.5557845", "0.55032265", "0.5481432", "0.53838235", "0.5361062", "0.5269666", "0.526538", "0.52570444", "0.5236038", "0.5212935", "0.5211382", "0.5195422", "0.51763874", "0.51666194", "0.51596004", "0.51368475", "0.5104291", "0.50813...
0.77730924
0
App is in testing config (test_basics.AppTest)
def test_app_is_testing(self): self.assertTrue(current_app.config['TESTING'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config(app):\n assert app.testing", "def test_config():\n assert not create_app().testing\n assert create_app(TestConfig).testing", "def test_config():\n assert not sample.create_app().testing\n assert sample.create_app({\"TESTING\": True}).testing", "def test_app_is_testing(self):\n ...
[ "0.8668405", "0.85153544", "0.8505037", "0.8208351", "0.8200938", "0.81275815", "0.76655614", "0.7630378", "0.75359917", "0.74892235", "0.745675", "0.745582", "0.74472284", "0.7415486", "0.73453236", "0.72559136", "0.72388124", "0.72212666", "0.7210432", "0.7203444", "0.71951...
0.86457294
2
NAME pmag_results_extract.py DESCRIPTION make a tab delimited output file from pmag_results table SYNTAX pmag_results_extract.py [command line options] OPTIONS h prints help message and quits f RFILE, specify pmag_results table; default is pmag_results.txt fa AFILE, specify er_ages table; default is NONE fsp SFILE, spe...
def main(): dir_path='.' res_file='pmag_results.txt' crit_file='' spec_file='' age_file="" latex=0 grade=0 if '-h' in sys.argv: print main.__doc__ sys.exit() if '-WD' in sys.argv: ind = sys.argv.index('-WD') dir_path=sys.argv[ind+1] if '-f' in sys....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(argv=None):\n\n if argv is None:\n argv = sys.argv\n\n parser = E.ArgumentParser(description=__doc__)\n\n parser.add_argument(\"--version\", action='version', version=\"1.0\")\n\n parser.add_argument(\n \"-t\", \"--no-titles\", dest=\"titles\", action=\"store_false\",\n he...
[ "0.63927835", "0.5856338", "0.5830859", "0.57654816", "0.57296544", "0.56147784", "0.5584971", "0.5574084", "0.5554739", "0.5493086", "0.5442651", "0.543576", "0.5435534", "0.53784925", "0.5375411", "0.53516924", "0.5349065", "0.5295951", "0.52822334", "0.5280381", "0.5262662...
0.57526374
4
Set up YoLink Sensor from a config entry.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: coordinator = hass.data[DOMAIN][config_entry.entry_id][ATTR_COORDINATOR] devices = [ device for device in coordinator.yl_devices if device.device_type in DEVICE_TY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, config, sensor=None):\n if sensor is None:\n from monitor.sensor import SensorDriver\n self.sensor = SensorDriver(config.getint(CONFIG_SECTION, \"trigger_pin\"),\n config.getint(CONFIG_SECTION, \"echo_pin\"))\n else:\n ...
[ "0.6584195", "0.6203388", "0.584935", "0.57472384", "0.5724688", "0.5683883", "0.5639066", "0.5629664", "0.55922896", "0.5591893", "0.55794686", "0.55689585", "0.556001", "0.5545611", "0.5505439", "0.55008173", "0.54948884", "0.5484322", "0.5481953", "0.5474745", "0.5471682",...
0.0
-1
Update HA Entity State.
def update_entity_state(self, state: dict) -> None: self._attr_is_on = self.entity_description.value( state[self.entity_description.key] ) self.async_write_ha_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def refresh_entity_state(self):", "def em_update_h(self):\n with self.elbo_check('h'):\n self.update_h()", "def update_states(self) -> None:\n self.set_states()\n self.async_write_ha_state()", "def _sun_chaged(hass, entity_id=None, old_state=None, new_state=None):\n P...
[ "0.7127321", "0.64405394", "0.6430438", "0.63795185", "0.6246587", "0.6200929", "0.6177765", "0.6141028", "0.60287523", "0.6006195", "0.6003928", "0.6003928", "0.5998483", "0.5997044", "0.5992333", "0.5991804", "0.5985489", "0.59831786", "0.59779197", "0.5945326", "0.5934481"...
0.74860173
0
Call setState api to change outlet state.
async def call_state_change(self, state: str) -> None: try: # call_device_http_api will check result, fail by raise YoLinkClientError await self.device.call_device_http_api("setState", {"state": state}) except YoLinkAuthFailError as yl_auth_err: self.config_entry.asyn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setState(self, state):\n self.state = state", "def set_state( self ):", "def set_state(self,state):\n self.__state = state", "def set_state(self, state: int):", "def __change_state(self, state):\n self.state = state", "def set_state(self, state):\n self.state = state", "...
[ "0.68303823", "0.6802729", "0.6502658", "0.64432067", "0.63839674", "0.63461715", "0.6259322", "0.623325", "0.6202478", "0.6195493", "0.6195493", "0.6194235", "0.6173578", "0.6173578", "0.6173578", "0.6173578", "0.6173578", "0.6173578", "0.6173578", "0.6173578", "0.6173578", ...
0.5445529
94
Turn the entity on.
async def async_turn_on(self, **kwargs: Any) -> None: await self.call_state_change("open")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_on(self, **kwargs):\n self._is_on = True", "async def async_turn_on(self, **kwargs: Any) -> None:\n await self.entity_description.set_command(self, True)", "def turn_on(self, **kwargs) -> None:\n self.heater.turn_on()", "def turn_on(self, **kwargs):\n self._send_command(\...
[ "0.7749855", "0.76333284", "0.740764", "0.7400453", "0.7380775", "0.7380276", "0.73142236", "0.73142236", "0.7311529", "0.72834134", "0.72247684", "0.72237045", "0.7206476", "0.71866083", "0.7169044", "0.71320957", "0.70755565", "0.7069967", "0.69911647", "0.6968239", "0.6960...
0.6187756
75
Turn the entity off.
async def async_turn_off(self, **kwargs: Any) -> None: await self.call_state_change("close")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self, **kwargs):\n self._is_on = False", "def turn_off(self, **kwargs):\n setattr(self.resource, self.variable, False)", "def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self._state = False", "def turn_off(self):\n self.handleCommand(1)\...
[ "0.7907074", "0.78206724", "0.7738741", "0.7726449", "0.7717234", "0.7699036", "0.7569424", "0.7569424", "0.75541544", "0.75168324", "0.75146556", "0.7475353", "0.7410971", "0.74089587", "0.7397875", "0.73854035", "0.737846", "0.7305533", "0.72589344", "0.72304344", "0.723010...
0.0
-1
Create a new Backend instance wrapping a Gremlin endpoint.
def __init__(self, graph: GraphTraversalSource, directed: bool = True): self._g = graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_backend():\n return Connection()", "def _backend(self) -> Backend:\n return self.__backend", "def instance():\n from weighted_graph import Graph\n inst = Graph()\n for edge in EDGES:\n inst.add_edge(*edge)\n return inst", "def __init__(self, backend: Optional[str] = None,...
[ "0.5719169", "0.5420105", "0.5374659", "0.52709556", "0.52351063", "0.5146255", "0.5034128", "0.49495858", "0.4898199", "0.4897327", "0.4890248", "0.48857987", "0.4862044", "0.48537752", "0.4850925", "0.48215622", "0.48113135", "0.47861797", "0.47710606", "0.4755076", "0.4748...
0.0
-1
Return True if the backend graph is directed. The Gremlinbacked datastore is always directed.
def is_directed(self) -> bool: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_directed(self):\n return self.G.is_directed()", "def is_directed(self):\n return self.graph_properties.directed", "def is_directed(self) -> bool:\n return self._directed", "def is_directed(G):\n return G.is_directed()", "def is_directed(self):\n return True", "def is...
[ "0.79627573", "0.78262556", "0.7661164", "0.75749224", "0.7518689", "0.746787", "0.746787", "0.7348088", "0.7265645", "0.7102285", "0.70416903", "0.61883163", "0.61317015", "0.5777387", "0.5670721", "0.5663669", "0.56486577", "0.5641953", "0.563757", "0.5622453", "0.5592876",...
0.7716199
2
Add a new node to the graph.
def add_node(self, node_name: Hashable, metadata: dict): if self.has_node(node_name): # Retrieve the existing node; we will update the props. v = self._g.V().has(ID, node_name) else: v = self._g.addV().property(ID, node_name) for key, val in metadata.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(self, new_node: 'GraphNode'):\n self.operator.add_node(new_node)", "def add_node(self, node):\n self.nodes.add(node)", "def add_node (self, node):\n self.network.add_node(node.id)\n self.network.node[node.id] = node", "def add_node(self, node):\n self.nodes.append(node...
[ "0.86811894", "0.83628523", "0.83541214", "0.8308053", "0.82507634", "0.82507634", "0.8226748", "0.8140644", "0.80386716", "0.8038011", "0.80355847", "0.8014513", "0.79429203", "0.78899926", "0.7874701", "0.7873998", "0.78708744", "0.78346735", "0.7834242", "0.7813201", "0.77...
0.6966002
65
Return the data associated with a node.
def get_node_by_id(self, node_name: Hashable): try: return _node_to_metadata( self._g.V().has(ID, node_name).valueMap(True).toList()[0] ) except IndexError as e: raise KeyError() from e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(node):\n return node['data']", "def node_data(self):\n return self.node_data_", "def getNodeRRDData(self,node):\n data = self.connect('get','nodes/%s/rrddata' % (node),None)\n return data", "def data(self):\n return self.first_node.data", "def get_data(self, node...
[ "0.8943385", "0.84129703", "0.7539316", "0.74589276", "0.70167655", "0.6666658", "0.6666658", "0.6666658", "0.6645689", "0.6542723", "0.6523832", "0.6523254", "0.6523254", "0.6506541", "0.6503061", "0.64450777", "0.64450777", "0.64450777", "0.64450777", "0.6428722", "0.642135...
0.0
-1
Return the data associated with a node.
def has_node(self, u: Hashable) -> bool: try: self.get_node_by_id(u) return True except KeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(node):\n return node['data']", "def node_data(self):\n return self.node_data_", "def getNodeRRDData(self,node):\n data = self.connect('get','nodes/%s/rrddata' % (node),None)\n return data", "def data(self):\n return self.first_node.data", "def get_data(self, node...
[ "0.8942996", "0.8413421", "0.7539084", "0.74590695", "0.70172197", "0.6667136", "0.6667136", "0.6667136", "0.66465026", "0.654292", "0.6525485", "0.6523447", "0.6523447", "0.65070415", "0.65024346", "0.6445389", "0.6445389", "0.6445389", "0.6445389", "0.64296985", "0.64215285...
0.0
-1
Get a generator of all of the nodes in this graph.
def all_nodes_as_iterable(self, include_metadata: bool = False) -> Generator: if include_metadata: return iter( [ {n[ID][0]: _node_to_metadata(n)} for n in self._g.V().valueMap(True).toList() ] ) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes_iter(self) -> Generator:\n for n in self.graph.nodes(data=True):\n yield n", "def all_nodes_as_iterable(self, include_metadata: bool = False) -> Generator:\n if include_metadata:\n return [\n (self._names.get_name(i), self._meta.get_node(self._names.ge...
[ "0.81258786", "0.7627982", "0.76152724", "0.7595835", "0.7333707", "0.71609825", "0.7120504", "0.70782614", "0.70782614", "0.707579", "0.70283145", "0.702749", "0.70215607", "0.70172447", "0.69621", "0.69600874", "0.69326246", "0.69045335", "0.6896022", "0.68157387", "0.68079...
0.7104925
7
Add a new edge to the graph between two nodes. If the graph is directed, this edge will start (source) at the `u` node and end (target) at the `v` node.
def add_edge(self, u: Hashable, v: Hashable, metadata: dict): try: self.get_edge_by_id(u, v) e = self._g.V().has(ID, u).outE().as_("e").inV().has(ID, v).select("e") except IndexError: if not self.has_node(u): self.add_node(u, {}) if not sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, u, v):\n self.graph[u].append(v)", "def addEdge(self,u,v):\r\n self.graph[u].append(v)", "def add_edge(self, u, v):\r\n keys = self.d.keys()\r\n #if nodes are not in graph, add them\r\n if u not in keys:\r\n self.add_node(u)\r\n if v not i...
[ "0.80492437", "0.7997173", "0.79762274", "0.7938743", "0.7901465", "0.7901465", "0.78556806", "0.78218895", "0.7706609", "0.7676834", "0.7642282", "0.75621843", "0.75312984", "0.75273705", "0.75252885", "0.75252885", "0.7497718", "0.7461967", "0.74471945", "0.7438834", "0.743...
0.7544242
12
Get a list of all edges in this graph, arbitrary sort.
def all_edges_as_iterable(self, include_metadata: bool = False) -> Generator: if include_metadata: return iter( [ (e["source"], e["target"], _node_to_metadata(e["properties"])) for e in ( self._g.V() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_list(self) -> List[Edge]:\r\n return [edge for edge in sorted(self._edges.values(), key=attrgetter(\"key\"))]", "def edges_list(self):\n return self._edges_list", "def edges(self):\n es = []\n for vertex1 in self.vertices():\n for vertex2 in self.out_vertices(ver...
[ "0.81581634", "0.7960234", "0.78925526", "0.78804266", "0.787858", "0.7846798", "0.7843813", "0.7840766", "0.78385776", "0.78341746", "0.78333783", "0.78333783", "0.78333783", "0.78252286", "0.77562666", "0.7710486", "0.77076787", "0.76781815", "0.7555799", "0.7550012", "0.75...
0.635042
86
Get an edge by its source and target IDs.
def get_edge_by_id(self, u: Hashable, v: Hashable): return ( self._g.V() .has(ID, u) .outE() .as_("e") .inV() .has(ID, v) .select("e") .properties() .toList() )[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edge(self, source: Node, target: Node) -> Optional[Edge]:\r\n return self.get_edge_by_index(source.index, target.index)", "def getEdge(source: LNode, target: LNode) -> LEdge:\n for edge in source.getConnectedEdges():\n # [TODO] or is suspicious\n if (edge.dstNode is target) or (ed...
[ "0.7360286", "0.7078714", "0.7069812", "0.6709626", "0.67029667", "0.65718555", "0.6423493", "0.63100886", "0.63019335", "0.6168574", "0.613733", "0.6136123", "0.6105854", "0.6103135", "0.60391325", "0.5967155", "0.5952662", "0.59199786", "0.5867793", "0.58538455", "0.5817035...
0.6502458
6
Get a generator of all downstream nodes from this node.
def get_node_neighbors( self, u: Hashable, include_metadata: bool = False ) -> Generator: if include_metadata: return { e["target"]: _node_to_metadata(e["properties"]) for e in ( self._g.V() .has(ID, u) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_gen(self):\n for n in self.child_list:\n yield from n.node_gen\n yield self", "def dfs_edges_generator(graph, source, reverse=...):\n ...", "def edges(self):\n for e in self._edges:\n yield e", "def iteredges(self):\n for source, targets in self.s...
[ "0.6858257", "0.6851446", "0.66736126", "0.6523919", "0.64740294", "0.6465135", "0.6309898", "0.62987435", "0.62812954", "0.61818963", "0.61600417", "0.6127758", "0.6095174", "0.609357", "0.609357", "0.6080855", "0.6064536", "0.6004518", "0.59982306", "0.5996935", "0.5993784"...
0.0
-1
Get a generator of all downstream nodes from this node.
def get_node_predecessors( self, u: Hashable, include_metadata: bool = False ) -> Generator: if include_metadata: return { e["source"]: e for e in ( self._g.V() .has(ID, u) .inE() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_gen(self):\n for n in self.child_list:\n yield from n.node_gen\n yield self", "def dfs_edges_generator(graph, source, reverse=...):\n ...", "def edges(self):\n for e in self._edges:\n yield e", "def iteredges(self):\n for source, targets in self.s...
[ "0.68572813", "0.6851634", "0.66723347", "0.6522355", "0.64741963", "0.6464804", "0.6309863", "0.62989444", "0.6280763", "0.61826336", "0.61584425", "0.6127064", "0.60939986", "0.60926896", "0.60926896", "0.60814744", "0.6065003", "0.6003312", "0.59978014", "0.5995585", "0.59...
0.0
-1
Get an integer count of the number of nodes in this graph.
def get_node_count(self) -> Iterable: return self._g.V().count().toList()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_count(self):\n return self._node_count", "def number_of_nodes(self) -> int:\n return self.graph.number_of_nodes()", "def node_count(self) -> int:\n return pulumi.get(self, \"node_count\")", "def node_count(self):\n return self._root.count()", "def node_count(self) -> pu...
[ "0.88012767", "0.8800309", "0.8764814", "0.8713053", "0.8655607", "0.8655607", "0.8641036", "0.8519778", "0.8519778", "0.84884375", "0.8467727", "0.8456823", "0.8451724", "0.8451724", "0.84216154", "0.83909976", "0.8298621", "0.8297793", "0.82299125", "0.81929344", "0.8178524...
0.7848861
30
Fetching a protected resource using an OAuth 1 token.
def profile(): import hashlib import binascii import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.type.ttypes as Types from evernote.api.client import EvernoteClient auth_token = session['oauth_token'] client = EvernoteClient(token=auth_token, sand...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorized_fetch(self, url, auth_token, **kwargs):\n if isinstance(auth_token, bytes):\n auth_token = auth_token.decode()\n login_header = HTTPHeaders({\n \"Authorization\": \"CustomJWT {}\".format(auth_token)})\n request = HTTPRequest(\n url, headers=login...
[ "0.69519764", "0.6282885", "0.61803466", "0.6128816", "0.61275697", "0.6112998", "0.6103108", "0.6008591", "0.59770566", "0.5919546", "0.58596146", "0.584992", "0.58140063", "0.5813354", "0.5797826", "0.57910305", "0.5786092", "0.5781067", "0.57774854", "0.5774434", "0.575760...
0.0
-1
Class method to decode v1 Tx from a legacy v0 Tx.
def legacy_from_json(cls, obj): tv = obj.get("version", -1) if TransactionVersion.LEGACY != tv: raise Exception( "legacy v0 transaction is expected to be of version {}, not version {}".format( TransactionVersion.LEGACY, tv ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(code: bytes):# -> Transaction:\n vals: list[str] = str(bytes).split(' ')\n result: Transaction = Transaction()\n result.id = int(vals[0])\n result.time = int(vals[1])\n result.action = string_to_action(vals[2])\n result.acting_username = vals[3]\n result....
[ "0.59203297", "0.56318444", "0.5603222", "0.5576017", "0.54629105", "0.5462759", "0.53999794", "0.5362942", "0.5338377", "0.5328852", "0.5315829", "0.5315829", "0.5300996", "0.5256362", "0.5195768", "0.5135178", "0.5074066", "0.498903", "0.4982154", "0.49720398", "0.49720398"...
0.59679365
0
Coin inputs of this Transaction, used as funding for coin outputs, fees and any other kind of coin output.
def coin_inputs(self): return self._coin_inputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_coins(self):\n print(\"Please insert coins.\")\n for coin in self.COIN_VALUES:\n self.money_received += int(input(f\"How many {coin}?: \")) * self.COIN_VALUES[coin]\n return self.money_received", "def coin_outputs(self):\n return self._coin_outputs", "def process_coins():\r\n ...
[ "0.6123173", "0.5966245", "0.5634441", "0.5558912", "0.55467415", "0.55467415", "0.5481745", "0.54760975", "0.54194975", "0.54084605", "0.5364558", "0.5345652", "0.5327607", "0.53122216", "0.5287343", "0.5282469", "0.52809083", "0.5277097", "0.52711916", "0.5259964", "0.52548...
0.75000954
0
Coin outputs of this Transaction, funded by the Transaction's coin inputs.
def coin_outputs(self): return self._coin_outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coin_inputs(self):\n return self._coin_inputs", "def outputs(self, inputs):\n return inputs", "def getCoins(self):\n return self.coins", "def outputs(self):\n return super().outputs", "def outputs(self):\n return super().outputs", "def outputs(self):\n return...
[ "0.6787281", "0.6559575", "0.6514078", "0.59406906", "0.59406906", "0.59406906", "0.59406906", "0.5934072", "0.59194964", "0.5907574", "0.5898513", "0.58806205", "0.5828155", "0.5714257", "0.56731254", "0.56292564", "0.56242514", "0.5590234", "0.55890447", "0.5565225", "0.555...
0.79076797
0
Blockstake inputs of this Transaction.
def blockstake_inputs(self): return self._blockstake_inputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blockstake_outputs(self):\n return self._blockstake_outputs", "def inputs(self):\n pass", "def inputs(self):\n return super().inputs", "def inputs(self):\n return super().inputs", "def inputs(self):\n return super().inputs", "def inputs(self):\n return super(...
[ "0.6437797", "0.6227412", "0.61687285", "0.61687285", "0.61687285", "0.61687285", "0.61643004", "0.60167396", "0.5892044", "0.5803583", "0.5784823", "0.567815", "0.5671604", "0.564129", "0.564129", "0.564129", "0.55738175", "0.55738175", "0.55738175", "0.5549223", "0.5533055"...
0.7803568
0
Blockstake outputs of this Transaction.
def blockstake_outputs(self): return self._blockstake_outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self):\n return super().outputs", "def outputs(self):\n return super().outputs", "def outputs(self):\n return super().outputs", "def outputs(self):\n return super().outputs", "def outputs(self):\n pass", "def coin_outputs(self):\n return self._coin_ou...
[ "0.6245822", "0.6245822", "0.6245822", "0.6245822", "0.62456393", "0.6083549", "0.59201723", "0.58614194", "0.5824727", "0.58095473", "0.5804078", "0.5786087", "0.5749186", "0.5740939", "0.5719438", "0.570687", "0.570687", "0.5694341", "0.5688758", "0.5688758", "0.5594648", ...
0.7414077
0
Miner fees, paid to the block creator of this Transaction, funded by this Transaction's coin inputs.
def miner_fees(self): return self._miner_fees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_funding(self):\n entity_miner = self.entities[0]\n\n entity_miner.send_bitcoins(entity_miner.address)\n entity_miner.purchase_mastercoins(500.0)\n\n self.generate_block()\n self.check_balance(entity_miner.address, MSC, '50000.00000000', '0.00000000')\n self.ch...
[ "0.66922605", "0.58207643", "0.581066", "0.57854795", "0.57327056", "0.5670109", "0.5667312", "0.56460047", "0.5637521", "0.56239104", "0.56096333", "0.5599002", "0.5562422", "0.5553269", "0.55527157", "0.5529413", "0.55228823", "0.55146056", "0.55044276", "0.5483918", "0.548...
0.508458
61
Optional binary data attached to this Transaction, with a max length of 83 bytes.
def data(self): if self._data is None: return BinaryData(strencoding="base64") return self._data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data(self, data):\n if len(data) > 41:\n self._data = b\"\"\n else:\n self._data = data\n return self._data", "def as_bytes(self) -> bytes:\n if isinstance(self.data, bytes):\n return self.data\n elif isinstance(self.data, str):\n ...
[ "0.65607315", "0.61228114", "0.6119616", "0.61050373", "0.5891042", "0.5891042", "0.5800566", "0.5734391", "0.5688271", "0.56584054", "0.5628926", "0.56091785", "0.5567403", "0.5566596", "0.55665", "0.55652833", "0.5525507", "0.5522612", "0.5522612", "0.5522612", "0.55147225"...
0.6219342
1
Binary encoding of a Transaction, overriden to specify the version correctly
def binary_encode(self): if self._legacy: return bytearray([TransactionVersion.LEGACY]) + self._binary_encode_data() encoder = j.data.rivine.encoder_sia_get() encoder.add_array(bytearray([TransactionVersion.STANDARD])) encoder.add_slice(self._binary_encode_data()) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bytes__(self) -> bytes:\n from hathor.merged_mining.bitcoin import encode_bytearray, encode_list\n struct_bytes = self.header_head\n struct_bytes += encode_bytearray(self.coinbase_head)\n struct_bytes += encode_bytearray(self.coinbase_tail)\n struct_bytes += encode_list(sel...
[ "0.6348444", "0.62601185", "0.6169922", "0.61575854", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", "0.61489797", ...
0.73798925
0
Convierte el numero en un string en formato moneda SetMoneda(45924.457, 'RD$', 2) > 'RD$ 45,924.46'
def SetMoneda(num, simbolo="$", n_decimales=2): #con abs, nos aseguramos que los dec. sea un positivo. n_decimales = abs(n_decimales) #se redondea a los decimales idicados. num = round(num, n_decimales) #se divide el entero del decimal y obtenemos los string num, dec = str(num).split(".") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(s):\r\n return 'digit ' + str(s)", "def transform(s):\n return 'digit ' + str(s)", "def text_transform(val):\n if CURRENCY == \"USD\":\n return \"$%d\" % val\n if CURRENCY == \"EUR\":\n return \"‎€%d\" % val\n if CURRENCY == \"GBP\":\n return \"£%d\" % val\n ...
[ "0.6369034", "0.6291154", "0.61577356", "0.61298066", "0.6096125", "0.6077178", "0.59460807", "0.5917721", "0.5841402", "0.58112806", "0.5718429", "0.57112324", "0.5696326", "0.566329", "0.5642763", "0.5630994", "0.56287545", "0.56125355", "0.5596081", "0.5594857", "0.5593213...
0.6246501
2
Callback function for the intent "adaptVolume", gets called when intent is detected
def start_adaptVolume(hermes, intent_message): #log the input and the received intent start_logging() log_asr_input(intent_message.input) log_received_intent(intent_message) #extract the desired volume value from the intent message and adapt the volume volume_value = get_required_volum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slotVolume(self, a0):\n self.sampleGroup.action('volume', value=a0)", "def setVolume(intent, session):\n\tif 'volume' in intent['slots']:\n\t\tvolume = intent['slots']['Volume']['value']\n\n\tspeech_output = \"Chromecast Volume set to \" + volume\n\tcard_title = \"ChromeCast - Volume Set to \" + volu...
[ "0.6542319", "0.6332836", "0.6268154", "0.6231558", "0.62264824", "0.6061285", "0.6000607", "0.59331447", "0.5866246", "0.5794333", "0.5783454", "0.5674449", "0.56732404", "0.5658846", "0.5651501", "0.56294245", "0.5600345", "0.5582338", "0.5578721", "0.5578557", "0.5527833",...
0.7289963
0
Writes geometry and load database items to a file.
def cdwrite(self, option="", fname="", ext="", fnamei="", exti="", fmat="", **kwargs): command = f"CDWRITE,{option},'{fname}',{ext},,{fnamei},{exti},{fmat}" return self.run(command, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_mat_file(self):\n mat_dict = {}\n mat_dict['Lx_p'] = self.Lx_p\n mat_dict['Ly_p'] = self.Ly_p\n mat_dict['Lz_p'] = self.Lz_p\n mat_dict['Lo'] = self.obst.get_Lo()\n mat_dict['Ny_divs'] = self.N_divs\n mat_dict['rho_p'] = self.rho_p\n mat_dict['nu_p'...
[ "0.6128178", "0.6012342", "0.59800637", "0.5937306", "0.59276754", "0.5845964", "0.5839604", "0.5822085", "0.5814595", "0.5770231", "0.5736637", "0.57171774", "0.57083464", "0.56898177", "0.56540304", "0.5653079", "0.56423223", "0.56169623", "0.5611881", "0.56063175", "0.5591...
0.0
-1
An App with 100 tasks already in the queue. Tasks will randomly fail when executed.
def app(): app = App( name="testapp", processes=1, concurrency=4, prefetch_count=1, retry_backoff=lambda retries: 0.01, maintenance_interval=0.1, schedule_interval=0.1, heartbeat_interval=0.1, heartbeat_timeout=1, grace_period=1, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_more_tasks(self):\r\n self.create()\r\n app = App(short_name='egil', name='egil',\r\n description='egil')\r\n owner = db.session.query(User).get(1)\r\n app.owner_id = owner.id\r\n db.session.add(app)\r\n db.session.commit()\r\n\r\n app_i...
[ "0.7139638", "0.6872016", "0.6820473", "0.64749575", "0.6203939", "0.6192355", "0.61694515", "0.6168766", "0.61448485", "0.6123286", "0.61067617", "0.6095766", "0.6092713", "0.60915005", "0.60242605", "0.60211843", "0.6011442", "0.6004388", "0.5986613", "0.5975115", "0.594326...
0.7122439
1
Ensure that jobs which sometimes randomly fail will be rescheduled and eventually succeed. Job failures should not crash the worker.
def test_job_failure(app): with worker(app): state = wait_for_results(app, length=100, sleep=0.2, maxwait=4) # Tasks have been delivered and executed. assert set(r.return_value for r in all_results(app)) == set(range(100)) assert len(state.queue.messages) == 0 # Consumer groups behaved pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retry_errors_sooner(self):\n config_manager, json_file = self._setup_config_manager(\n 'socorro.unittest.cron.test_crontabber.BarBackfillJob|1d\\n'\n 'socorro.unittest.cron.test_crontabber.FooBackfillJob|1d\\n'\n 'socorro.unittest.cron.test_crontabber.FooBarBackfill...
[ "0.70238954", "0.7021493", "0.6980119", "0.67947364", "0.67771506", "0.6720906", "0.66957974", "0.6615476", "0.6472577", "0.6455228", "0.6385922", "0.63313305", "0.6242333", "0.6215919", "0.62111884", "0.62082505", "0.6191246", "0.61907566", "0.61778253", "0.61403835", "0.612...
0.6697551
6
This test is designed to crash the worker during processing and ensure that when we bring up a new worker, the system fully recovers. To achieve this, we're using a 'sentinel' job which triggers an exception when we try to deserialise it.
def test_worker_failure(app): sentinel = 50 def mocked_deserialise(fields): job = Job.deserialise(fields) if job.args == [sentinel]: raise Chaos("Found sentinel job") return job with mock.patch("fennel.worker.broker.Job", wraps=Job) as mocked_job: mocked_job.des...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_launch_400():\n work_queue = asyncio.Queue()\n await work_queue.put(TestData.JOB_TEMPLATE_LAUNCH_PAYLOAD)\n worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue)\n with aioresponses() as mocked:\n mocked.post(\n TestData.JOB_TEMPLATE_POST_URL, stat...
[ "0.6359065", "0.6358153", "0.6343971", "0.62961966", "0.62398404", "0.62254554", "0.6220339", "0.6151781", "0.6128433", "0.61171836", "0.61096936", "0.61035645", "0.6060205", "0.6046334", "0.60378677", "0.60087585", "0.6002686", "0.5972724", "0.5961226", "0.5950227", "0.59496...
0.74951327
0
Initialize local storage of active agents, connect to the database
def __init__(self, datastore_root: str): self.session_storage: Dict[str, ProlificClient] = {} self.agent_data: Dict[str, Dict[str, Any]] = {} self.table_access_condition = threading.Condition() self.conn: Dict[int, sqlite3.Connection] = {} self.db_path = os.path.join(datastore_ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_database():\n # TODO: Refactor the funtime library\n this.db = Store(this.host).create_lib(this.store_name).get_store()", "def init_database():\n exists = Agent.query.all()\n if exists is None or len(exists) == 0:\n # Setting up agent\n agent = Agent(name='OpenCampus',\n ...
[ "0.6617449", "0.61237335", "0.5979491", "0.5936732", "0.59310615", "0.5922503", "0.58505607", "0.5802189", "0.57936794", "0.5789929", "0.5780297", "0.5701071", "0.56965166", "0.56882364", "0.56478816", "0.5633063", "0.56197894", "0.5587522", "0.558614", "0.55832756", "0.55672...
0.558001
20
Returns a singular database connection to be shared amongst all calls for a given thread.
def _get_connection(self) -> sqlite3.Connection: curr_thread = threading.get_ident() if curr_thread not in self.conn or self.conn[curr_thread] is None: conn = sqlite3.connect(self.db_path, check_same_thread=False) conn.row_factory = sqlite3.Row self.conn[curr_thread] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_connection(self) -> Connection:\n # TODO(101) is there a problem with having just one db connection?\n # Will this cause bugs with failed commits?\n curr_thread = threading.get_ident()\n if curr_thread not in self.conn or self.conn[curr_thread] is None:\n try:\n ...
[ "0.79301536", "0.74529684", "0.7043397", "0.7013358", "0.6935523", "0.6571063", "0.65294355", "0.6474125", "0.64452714", "0.64002967", "0.6362195", "0.63587844", "0.6348218", "0.634644", "0.63254464", "0.6292941", "0.62925506", "0.62602526", "0.6254633", "0.6221707", "0.62125...
0.8007835
0
Update the last Study mapping time to mark a change to the Study mappings table and allow dependents to invalidate caches
def _mark_study_mapping_update(self, unit_id: str) -> None: self._last_study_mapping_update_times[unit_id] = time.monotonic()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapper_updated(self):\n self.invalidate()\n return", "def memoryMapChanged(self, mem: ghidra.program.database.mem.MemoryMapDB) -> None:\n ...", "def is_study_mapping_in_sync(self, unit_id: str, compare_time: float):\n return compare_time > self._last_study_mapping_update_times[u...
[ "0.6335052", "0.58112735", "0.56721526", "0.54929096", "0.5459769", "0.5457291", "0.5452044", "0.54163307", "0.54032046", "0.5332193", "0.52810687", "0.52514476", "0.52494526", "0.52186", "0.520193", "0.51904476", "0.5174565", "0.5160427", "0.51492006", "0.5144736", "0.513647...
0.77558404
0
Run all the table creation SQL queries to ensure the expected tables exist
def init_tables(self) -> None: with self.table_access_condition: conn = self._get_connection() conn.execute("PRAGMA foreign_keys = 1") c = conn.cursor() c.execute(tables.CREATE_STUDIES_TABLE) c.execute(tables.CREATE_SUBMISSIONS_TABLE) c.exe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables(self):\n for query in table_create_sql:\n self.cursor.execute(query)\n\n self.commit()", "def create_tables():\n db.create_all()", "def create_tables():\n db.create_all()", "def createTables():\n conn = getConnection()\n try:\n cur = conn.cursor()...
[ "0.8495893", "0.7980632", "0.7980632", "0.7966904", "0.79503256", "0.7923164", "0.7920233", "0.7841086", "0.78342694", "0.7815559", "0.77894527", "0.77793336", "0.77781737", "0.7769905", "0.77690786", "0.77588534", "0.77438813", "0.77397835", "0.77397835", "0.77397835", "0.77...
0.7529499
34
Determine if a cached value from the given compare time is still valid
def is_study_mapping_in_sync(self, unit_id: str, compare_time: float): return compare_time > self._last_study_mapping_update_times[unit_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid(t):\n return float(t) > time.time()", "def is_cache_valid(self):\n if os.path.isfile(self.cache_filename):\n mod_time = os.path.getmtime(self.cache_filename)\n current_time = time()\n if (mod_time + self.cache_max_age) > current_time:\n return T...
[ "0.6786222", "0.6448674", "0.64324737", "0.63750684", "0.630569", "0.63012683", "0.6299927", "0.6272141", "0.6211941", "0.6175154", "0.61743593", "0.61084133", "0.6042745", "0.6010127", "0.6009563", "0.60086095", "0.6004558", "0.59777814", "0.5974766", "0.5972415", "0.5965831...
0.0
-1
Register a new Study mapping in the table
def new_study( self, prolific_study_id: str, study_link: str, duration_in_seconds: int, task_run_id: str, status: str = StudyStatus.UNPUBLISHED, ) -> None: with self.table_access_condition, self._get_connection() as conn: c = conn.cursor() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, table_name, **fields):\n if table_name == 'groups':\n self.register_group(**fields)\n elif table_name == 'homework':\n self.register_homework(**fields)\n elif table_name == 'parents':\n self.register_parent(**fields)\n elif table_name ...
[ "0.5860516", "0.5694577", "0.56291115", "0.5563596", "0.5524145", "0.54332376", "0.5419561", "0.5383397", "0.5380749", "0.5315402", "0.52709424", "0.5228869", "0.5204167", "0.5195095", "0.5187756", "0.5159983", "0.51177984", "0.5053667", "0.5052416", "0.50509524", "0.50397503...
0.47300953
73