query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Assumes numSteps an int >= 0, numTrials an int > 0, dClass a subclass of Drunk Simulates numTrials walk of numSteps steps each. Returns a list of the final distances for each trial. | def simWalks(numSteps, numTrials, dClass, name):
Homer = dClass(name)
origin = Location(0, 0)
distances = []
for t in range(numTrials):
f = Field()
f.addDrunk(Homer, origin)
# print(walk(f, Homer, 0))
# print(walk(f, Homer, 1))
# assert False
distances.append(round(walk(f, Homer, numSteps), 1))
return ... | [
"def simWalks(numSteps, numTrials, dClass):\n Homer = dClass(\"\")\n origin = Location(0, 0)\n distances = []\n for t in range(numTrials):\n f = Field()\n f.addDrunk(Homer, origin)\n distances.append(round(walk(f, Homer, numSteps), 1))\n return distances",
"def sim_walks(num_st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assumes walkLengths a sequence of ints >= 0 numTrials an int > 0 dClass a subclass of Drunk For each number of steps in walkLengths, runs simWalks with numTrials walks and prints results | def drunkTest(walkLengths, numTrials, dClass, name):
for numStep in walkLengths:
distances = simWalks(numStep, numTrials, dClass, name)
print(dClass.__name__, ' random walk of ', numStep, ' steps')
print('Mean =', round(sum(distances)/len(distances), 4))
print('Max =', max(distances), ' Min =', min(distances)) | [
"def drunkTest(walkLengths, numTrials, dClass):\n \n for numSteps in walkLengths:\n distances = simWalks(numSteps, numTrials, dClass)\n \n print(dClass.__name__, 'random walk of ', numSteps, 'steps')\n print (' Mean = ', round(sum(distances)/len(distances), 4))\n print (' Ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a trace of a MCTS forward run, use the final value estimates and the actual rewards to backup the tree node values | def backup_mcts_trace(self, sars: BackupTrace, final_value_estimate: float = 0.0) -> float:
value_discounted = final_value_estimate
prev_tree_values = [None] * len(self.tree_backups)
for state, action, reward, next_state, aut_state in reversed(sars):
self.visit_count[state][action]... | [
"def search(self, n_mcts):\n max_depth, mean_depth = 0, 0\n\n for _ in range(n_mcts):\n mcts_state: MCTSAgent.MCTSState = self.root # reset to root for new trace\n # input(str(self.root.n_value) + \" \" + str(self.root.q_value)) # To Debug the tree\n depth = 0\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run a batch of MCTS | def mcts_batch(self, env: AutShapingWrapper, state: Any, count: int, batch_size: int, lp_gen=False) -> None:
for _ in range(count):
self.mcts_mini_batch(env, state, batch_size, lp_gen=lp_gen) | [
"def test_mmtl_multitask(self):\n N = 600\n T = 2\n\n tasks = create_tasks(T)\n model = MetalModel(tasks, verbose=False)\n payloads = create_payloads(N, T, batch_size=2)\n metrics_dict = self.trainer.train_model(model, payloads, verbose=False)\n # For 3 payloads, eac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Only search till the current item is less or equal to the item we are searching for | def search(self, item):
found = False
stop = False
current = self.head
while current is not None and not found and not stop:
if current.get_data() == item:
found = True
elif current.get_data() > item:
stop = True
else:
... | [
"def search(self, item):\n current = self.head\n while current:\n if current.value == item:\n return True\n elif current.value < item:\n current = current.next\n else:\n break\n return False",
"def seqsearch(data, i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply a wavelet transform using a prespecified set of filters. Calculates the center frequencies and bandwidths for the wavelets and applies them along with | def wavelet_transform(X, rate, filters='rat', hg_only=True, X_fft_h=None, npad='fast', to_removes=None,
precision='single'):
if X_fft_h is None:
X_dtype = dtype(X, precision)
X = X.astype(X_dtype, copy=False)
npads, to_removes, _ = _npads(X, npad)
X = _smart_pad... | [
"def cwave_filters(filters):\n\n\tf = h5py.File(dir_file+'filters_w.hdf5', 'r')\n\tnbands = len(filters)\n\n\tif nbands>1:\n\t\tcwaves = np.zeros(nbands)\n\t\tfor bb in range(0,nbands):\n\t\t\tstr_temp = 'cw_%s' % filters[bb]\n\t\t\tcwaves[bb] = f[filters[bb]].attrs[str_temp]\n\telse:\n\t\tstr_temp = 'cw_%s' % filt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the relevant .npy files in a folder and returns them in a list | def load_npy(filepath, filenames_list):
if not os.path.exists(filepath):
raise InvalidPathError("{} does not exist!".format(filepath))
data = []
for i in range(len(filenames_list)):
data.append(np.load(filepath + '/' + filenames_list[i]))
return data | [
"def _load_array(self, path_list):\n array_list = []\n for path in path_list:\n array = np.load(path)\n for f in array.files:\n array_list.append(array[f])\n array = np.concatenate(array_list, axis=0)\n\n return array",
"def parse_data_folder(images... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads all data saved in a given folder. Searches through all subfolders and finds every folder that contains the file names listed in 'filenames'. Returns them in the list 'loaded_data'. Also searches for the vectorisation settings file according to 'analysis_type' and returns a dict with the settings. | def load_from_dir_root(rootdir):
# Find json file to get the analysis type
for file in os.listdir(rootdir):
if '_settings.json' in file:
analysis_type = file[:-14]
assert analysis_type in filenames_list_dict.keys()
with open(rootdir + '/{}_settings.json'.format(analysis_type)) as js... | [
"def _load_folder(self, folder):\n for f in os.listdir(folder):\n self._load_file(os.path.join(folder, f))",
"def loadFiles(self, filenames):\n loadFiles(filenames, self.cache)",
"def load_folder(folder, size):\n\n # create a 4D array with first dimension the number of files\n num... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a line, solve for x when y is specified | def find_x_given_y(line, y):
dx = line[0][2] - line[0][0]
dy = line[0][3] - line[0][1]
return np.round(np.array([line[0][0] + (y - line[0][1])*dx/dy, y]))#.astype(np.uint16) | [
"def _solve_line(cls, line, hints):\n line_try = list(line)\n occupied_cnt = sum(1 for tile in line if tile == cls.TILE_OCCUPIED)\n hints_cnt = sum(hints)\n if hints_cnt == occupied_cnt:\n return None\n tries = {\n idx: (cls.TILE_EMPTY, cls.TILE_OCCUPIED)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extend ``line`` to the bottom of the masked image | def extend_to_bottom(line, y_bottom):
# find the points on the bottom and top
xy_bottom = find_x_given_y(line, y_bottom)
if line[0][1] > line[0][3]:
return np.array([[xy_bottom[0], xy_bottom[1], line[0][2], line[0][3]]])
else:
return np.array([[xy_bottom[0], xy_bottom[1], line[0][0]... | [
"def extend_line(line,shape=[640,480],plot=False):\n start=line[0]\n end=line[1]\n dxs,dys=shape[0]-start[0],shape[1]-start[1] #offsets from origin\n deltax=np.float(end[0])-np.float(start[0])\n deltay=np.float(end[1])-np.float(start[1])\n if deltax == 0.0:\n slope = 90.\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new molecule to the molecule database | def __add__(self, molecule):
if not isinstance(molecule, Molecule):
raise ValueError('The passed molecule is not a Molecule object')
self.__list.append(molecule) | [
"def add_calculation(self, molecule, method, basis, cp, tag, optimized):\n\n # check if this model is not already in Models table\n if not self.cursor.execute(\"SELECT EXISTS(SELECT * FROM Models WHERE method=? AND basis=? AND cp=?)\", (method, basis, cp)).fetchone()[0]:\n\n # create entry ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read in all the mol2 or SDF files Returns | def read_molecule_files(self):
# This list is used as container to handle all the molecules read in by using RdKit.
# All the molecules are instances of Molecule class
molid_list = []
# List of molecule that failed to load in
mol_error_list_fn = []
logging.info(30 * '... | [
"def readin(self):\n \n if self.filename.endswith('.fits'):\n # Assumes Science Verification data\n self.read_SV_fits()\n elif self.filename.endswith('.npz'): \n # Assumes DES Y3 Gold data\n self.read_Y3_2_2_npz()\n else: \n print('Unrecognized file type: ' + self.filename)",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function coordinates the calculation of the similarity score matrices by distributing chunks of the matrices between the allocated processes | def build_matrices(self):
logging.info('\nMatrix scoring in progress....\n')
# The similarity score matrices are defined instances of the class SMatrix
# which implements a basic class for symmetric matrices
self.strict_mtx = SMatrix(shape=(self.nums(),))
self.loose_mtx = SMatr... | [
"def compute_similarity_matrix(db_iter, sparse_mode=True, **sim_func_args):\n igs = list(db_iter)\n n = len(igs)\n\n set_defaults_sim_func(sim_func_args, igs)\n logging.info(\"Similarity function parameters: %s\", sim_func_args)\n similarity_function = partial(sim_function, **sim_func_args)\n\n # ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the size of the square similarity score matrix Returns | def mat_size(self):
# Length of the linear array
l = self.size
# Total number of elements in the corresponding bi-dimensional symmetric matrix
n = int((1 + math.sqrt(1 + 8 * l)) / 2)
return n | [
"def size(self, matrix):\r\n return matrix.shape",
"def create_similarity_matrix(tested_embeddings):\n return 1-scipy.spatial.distance.squareform(scipy.spatial.distance.pdist(tested_embeddings, 'cosine'))",
"def get_similarity_score(differences):\n\n sum_of_squares = 0\n for diff in differences:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the proper dict item by referencing the index and model information. Since all models could be optimized by PTQ or NNCF, we need to check that there are proper values in the data. For example, if model A could be optimized by both PTQ and NNCF and model B couldn't be supported by PTQ and NNCF. In this case, we have... | def get_metric_dict(dict_data: Union[List[Dict[str, Any]], None], idx: int, model: str):
if dict_data and len(dict_data) > idx:
if dict_data[idx].get(model) is None:
return "-"
return dict_data[idx][model]
else:
return "-" | [
"def get_result(self, index):\n\t\tif not Util.dic_is_empty(self.case_json['results']):\n\t\t\treturn self.case_json[index]",
"def __getitem__(self, index):\n\n # index is a single number\n if isinstance(index, Number):\n model = self._models[index]\n model_index = self._model_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns True if task is anomaly. | def is_anomaly_task(task: str) -> bool:
return "anomaly" in task | [
"def byass_time_point_status(self):\n return False",
"def is_time_critical(task):\n return task.task.start_after == task.task.end_before",
"def successful(self):\n return not np.isnan(self.time_points.interaction)",
"def high_storm_peaks(self):\n\n if (self.postprocessor.sim_storm_peak... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize weights to small random numbers | def _initialize_weights(self, size: int) -> 'None':
self.w_ = self.random_generator.normal(loc=0.0, scale=0.01,
size=1 + size)
self.w_initialized = True | [
"def default_weight_initializer(self):\n self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]]\n self.weights = [np.random.randn(y, x)/np.sqrt(x)\n for x, y in zip(self.sizes[:-1], self.sizes[1:])]",
"def random_weight():\n # We found that random.randrange(-1,2) to work well em... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Numerically stable version on log(cosh(x)). Used to avoid `inf` for even moderately large differences. | def _log_cosh(cls, x: Tensor) -> Tensor: # pylint: disable=invalid-name
return x + softplus(-2.0 * x) - np.log(2.0) | [
"def centered_half_cauchy_logp(x, S):\n x = np.atleast_1d(x)\n if sum(x < 0):\n return -np.inf\n return pm.flib.cauchy(x, 0, S) + len(x) * np.log(2)",
"def squasher(x):\n x = np.asarray(x)\n ax = np.abs(x)\n y = 1 + np.log(ax)\n y[ax < 1] = ax[ax < 1]\n return np.sign(x) * y",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate $log C_{m}(k)$ term in von MisesFisher loss. Since `log_cmk_exact` is diverges for `kappa` >~ 700 (using float64 precision), and since `log_cmk_approx` is unaccurate for small `kappa`, this method automatically switches between the two at `kappa_switch`, ensuring continuity at this point. | def log_cmk(
cls, m: int, kappa: Tensor, kappa_switch: float = 100.0
) -> Tensor: # pylint: disable=invalid-name
kappa_switch = torch.tensor([kappa_switch]).to(kappa.device)
mask_exact = kappa < kappa_switch
# Ensure continuity at `kappa_switch`
offset = cls.log_cmk_approx(... | [
"def logpow(x, m):\n return torch.where(\n torch.eq(x, torch.tensor(0)),\n torch.where(torch.eq(m, torch.tensor(0)), torch.tensor(0.0), torch.tensor(-np.inf)),\n m * torch.log(x),\n )",
"def posdef_logdet(m: np.ndarray) -> float:\n L = np.linalg.cholesky(m)\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate 3D Euclidean distance between predicted and target. | def _forward(self, prediction: Tensor, target: Tensor) -> Tensor:
return torch.sqrt(
(prediction[:, 0] - target[:, 0]) ** 2
+ (prediction[:, 1] - target[:, 1]) ** 2
+ (prediction[:, 2] - target[:, 2]) ** 2
) | [
"def get_distance(self, points_3d):\n return np.linalg.norm(points_3d - self.location, axis=-1)",
"def test_y3(self):\n self.assertEqual(sd.e_distance((0, 0), (3, 0)), 3)",
"def nose_to_target_dist(self):\n return np.linalg.norm(self.nose_to_target())",
"def test_x3(self):\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
used to generate a question for a given category. this function returns the PK of a random question object that fits the question category. | def get_possible_questions_id(q_category):
q_ids = Question.objects.filter(category=q_category).values_list("pk", flat=True)
q_ids = list(q_ids)
if q_ids:
maxi_id = max(q_ids)
else:
return 1
ran = None
while not ran in q_ids:
ran = random.randint(1, maxi_id)
return ra... | [
"def get_random_question():\n rand = random.randrange(0, db.session.query(Question).count())\n return db.session.query(Question)[rand]",
"def next_question(): \n return random.choice(models.Question.objects(valid=True))",
"def random_exemption_category():\n return EXEMPTION_CATEGORY[randint(0, len(E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes a target data frame and replaces the tags with their cleanedup, spaceless versions. | def clean_tags_dataframe(df_targets):
# Make a copy of the dataframe so we don't overwrite the original.
df_targets_cleaned = copy.deepcopy(df_targets)
# Loop through all the cleaned versions of the tags and replace the
# original versions, which have extra whitespace pre-pended to them, with... | [
"def clean_description(df):\n df.description = df.description.apply(lambda x: re.sub('<[^<]+?>', '', x))\n return df",
"def remove_semantic_tags(self, semantic_tags):\n _check_semantic_tags(self._dataframe, semantic_tags)\n dt = self._update_cols_and_get_new_dt('remove_semantic_tags', semantic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces 'AcclimaSpike' with 'spike' and noiserelated Acclima tags with 'noise'. Returns a dataframe with renamed tags. | def rename_tags_in_df(df_targets):
df_targets_renamed = copy.deepcopy(df_targets)
# Rename SPIKES.
df_targets_renamed.replace(
to_replace="Acclima-Spike",
value="spike",
inplace=True,
)
# Rename NOISE.
noise_tag_list = [
"Acclima-Noise",
"Acclima-Diur... | [
"def simplify_tcga_names(data):\n out = data.copy()\n cols = out.columns.str.replace('-', '.')\n cols = cols.str.replace(r'\\.[0-9A-Z]{3}\\.[0-9]{2}$', '')\n out.columns = cols\n\n # following this renaming, we have duplicates in the columns\n # I've checked these and they appear to have been sequ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiates the ElementTree based on the xml_file | def __init__(self, xml_file):
self.the_etree = ElementTree.parse(xml_file)
self.xml_file = xml_file | [
"def __init__(self, xmlfile):\n\t\tctx = _new_xml(xmlfile)\n\t\tsuper(XMLContext, self).__init__(ctx)",
"def open_xml(self, file_name):\r\n tree = ET.parse(file_name)\r\n root = tree.getroot()\r\n return root",
"def from_file(cls, xml_path):\n try:\n parsed_xml = cls._parse(xml_path... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find parameters in the _init.xml OM input file that match the keys in change_dict and change them to the value in change_dict. | def change_parameter(self, change_dict):
log = logging.getLogger()
changed = False
# Make a set copy so that any parameters not found can be reported
change_set = set(change_dict)
if not change_set:
return changed
# Make a dictionary to store any ... | [
"def change_event_params(self, changes_dict):\r\n # print changes_dict\r\n for key, sub_dict in list(changes_dict.items()): # loop through events (key)\r\n for sub_key, val in list(sub_dict.items()): # loop through parameters being changed (sub_key)\r\n if isinstance(sub_ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change an attribute and return True only if new value differs from old. Otherwise don't change and return False. | def change_attrib(elem, name, value):
log = logging.getLogger()
value_type = type(value)
if value_type(elem.attrib[name]) == value:
log.warning('{0} in {1} already equal to {2}'.format(name, str(elem), value))
return False
else:
log.info('Changed {0} in {1} from {2} to... | [
"def is_attribute_overridden(obj: model.Attribute, new_value: Optional[ast.expr]) -> bool:\n return obj.value is not None and new_value is not None",
"def _set_attr_sub_(self, attr):\n if attr.lower() in self.attributes:\n self.attr_sub = self.attributes.index(attr.lower())\n\n # i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for and return either a Real, Integer, Boolean or String etree element based on the Python type that is intended to be assigned (float, int, bool or str). Returns None if nothing is found that matches. | def get_value_elem(elem, var_type):
if var_type is float or var_type is np.float64:
val_elem = elem.find('Real')
elif var_type is int:
val_elem = elem.find('Integer')
# Allow for assigning an int to a Real
if val_elem is None:
val_elem = elem.find('Real')
... | [
"def __decode_result(element):\n type = element.get('{http://www.w3.org/1999/XMLSchema-instance}type')\n if type is not None:\n try:\n prefix, local = type.split(\":\")\n if prefix == 'xsd':\n type = local\n except ValueError:\n pass\n\n if type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Se encarga de procesar una solicitud POST al registrar una cancionPersonal de un usuario | def post(self, usuario_actual):
cancion_a_registrar = CancionPersonal(nombre=self.argumentos['nombre'], artistas=self.argumentos['artistas'],
album=self.argumentos['album'], id_usuario=usuario_actual.id_usuario)
errores_validacion_registro = ValidacionCancio... | [
"def post(self,Utilisateur,mdp):\r\n return createUser(login,Utilisateur,mdp,\"\")",
"def test_registration_view_can_save_post_request(self):\n\t\trequest = HttpRequest()\n\t\trequest.method = 'POST'\n\t\trequest.POST['user'] = User.objects.create_user(username='fisherman-bob', password='BoBfish23')\n\t\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Se encarga de procesar una solicitud GET al devolver las canciones del usuario | def get(self, usuario_actual):
cantidad = request.args.get('cantidad')
pagina = request.args.get('pagina')
try:
if cantidad is not None and pagina is not None:
cantidad = int(cantidad)
pagina = int(pagina)
else:
cantidad = 1... | [
"def usuarios_conectados():\n\n global my_user\n print(\"Actualizando clientes conectados.\")\n usuarios = api.get_AllUser()\n lista_usarios = []\n\n for user in usuarios:\n if user['Estado'] == '1':\n # Anadimos todos los users menos el propio.\n if user['Nombre'] != my_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve the newest object in the target s3 bucket | def get_latest_s3_object(
bucket=os.environ["ARTIFACTS_BUCKET"], prefix="slack-response"
):
response = s3.list_objects_v2(Bucket=bucket, Prefix=prefix)
all = response["Contents"]
return max(all, key=lambda x: x["LastModified"]) | [
"def get_latest(self, bucket, prefix):\n none = datetime.datetime(1,1,1) # always be expired\n \n def p(name, prefix):\n \"\"\"\n A new parser function because the sorted() function can't compare \n datetime objects with None, so instead of None, return a really... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs a controller that copies 'owner' labels to pods owned by deployments. | def main():
def handle_item(item):
"""
Updates the given item by copying its 'owner' label to its pod template.
This requires that the item have a nonempty 'owner' label.
Args:
item: A Kubernetes object with a metadata field and a spec.template.metadata field.
... | [
"def create_dc_pods(request):\n class_instance = request.node.cls\n\n def finalizer():\n \"\"\"\n Delete multiple dc pods\n \"\"\"\n if hasattr(class_instance, \"dc_pod_objs\"):\n for pod in class_instance.dc_pod_objs:\n delete_deploymentconfig_pods(pod_ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the given item by copying its 'owner' label to its pod template. This requires that the item have a nonempty 'owner' label. | def handle_item(item):
owner = item.metadata.labels.get('owner')
if not owner:
raise Rejection("Label 'owner' missing from {}:{}".format(
item.metadata.namespace, item.metadata.name), 'MissingOwner')
# Update the item's template. All deployments should have a templat... | [
"def main():\n\n def handle_item(item):\n \"\"\"\n Updates the given item by copying its 'owner' label to its pod template.\n\n This requires that the item have a nonempty 'owner' label.\n\n Args:\n item: A Kubernetes object with a metadata field and a spec.template.metadat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens the REACTORS.ratdb in the /ReacDB/db directory and grabs the relevant reactor information from the ratdb file. Information includes the reactor's licensed MWt, latitude and longitude, and reactor type (if available). Longitude and latitude are rounded to two decimal places for more conservative distance accuracy. | def parseRATDB(reacname):
MWt = 'none'
longlat = ['none', 'none']
f=open(ratdbpath, 'r')
beginparse = False
parsing = False
while beginparse == False:
stuff = str(f.readline())
if stuff.find(reacname) != -1:
beginparse = True
parsing = True
while parsi... | [
"def R_ob(filename):\n \n data = apr3read(filename)\n time_d = data['timedates']\n lon_gate = data['lon_gate']\n lat_gate = data['lat_gate']\n alt_gate = data['alt_gate']\n Z_Ku = data['Ku']\n Z_Ka = data['Ka']\n Z_W = data['W']\n Z_DFR1 = data['DFR_1']\n Z_DFR2 = data['DFR_2']\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test threshold at which is needed based on truncation_quantile | def test_truncate(self, truncation_quantile, space, monkeypatch):
# Test that trial within threshold is not replaced
lineages = build_lineages_for_exploit(space, monkeypatch)
trials = self.get_trials(lineages, TrialStub(objective=50))
trials = sorted(trials, key=lambda trial: trial.objec... | [
"def threshold_percentile(validation_loss, percentile):\n thres = np.percentile(validation_loss, percentile)\n return thres",
"def test_find_percentile():\n array = np.arange(10) + 1\n perc = backgrounds.find_percentile(array, 0.6)\n assert perc == 6\n\n perc = backgrounds.find_percentile(array,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt for simple encryption and decryption | def test_encrypt_decrypt(self):
s = scrypt.encrypt(self.input, self.password, 0.1)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_encryption():\n expected=\"Ymnx nx 956 u~ymts htzwxj\"\n actual=encrypt(\"This is 401 python course\",5)\n assert expected==actual",
"def test03(self):\n\t\tengine = SecretEngine(key=self.key)\n\t\tencrypted = engine.encrypt(self.short_message)\n\t\tself.assertEqual(engine.decrypt(encrypted),se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt for input and password accepted as keywords | def test_encrypt_input_and_password_as_keywords(self):
s = scrypt.encrypt(password=self.password, input=self.input)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_encrypt_missing_input_keyword_argument(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(password=self.password))",
"def test_encrypt_raises_error_on_invalid_keyword(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input,\n self.password, nonsense=\"R... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt raises TypeError if keyword argument missing input | def test_encrypt_missing_input_keyword_argument(self):
self.assertRaises(TypeError, lambda: scrypt.encrypt(password=self.password)) | [
"def test_encrypt_missing_password_positional_argument(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input))",
"def test_encrypt_raises_error_on_invalid_keyword(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input,\n self.password, nonsense=\"Raise e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt raises TypeError if second positional argument missing (password) | def test_encrypt_missing_password_positional_argument(self):
self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input)) | [
"def test_encrypt_missing_input_keyword_argument(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(password=self.password))",
"def encrypt(self, password, assoc=None):",
"def test_encrypt_raises_error_on_invalid_keyword(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(self.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt maxtime accepts maxtime as keyword argument | def test_encrypt_maxtime_key(self):
s = scrypt.encrypt(self.input, self.password, maxtime=0.01)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_decrypt_maxtime_keyword_argument(self):\n m = scrypt.decrypt(maxtime=1.0, input=self.ciphertext, password=self.password)\n self.assertEqual(m, self.input)",
"def test_encrypt_maxmemfrac_keyword_argument(self):\n s = scrypt.encrypt(self.input, self.password, maxmemfrac=0.0625,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt maxmem accepts (< 1 megabyte) of storage to use for V array | def test_encrypt_maxmem_undersized(self):
s = scrypt.encrypt(self.input, self.password, 0.01, self.one_byte)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_encrypt_maxmem_in_normal_range(self):\n s = scrypt.encrypt(self.input,\n self.password,\n 0.01,\n self.ten_megabytes)\n m = scrypt.decrypt(s, self.password)\n self.assertEqual(m, self.input)",
"def test_de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt maxmem accepts (> 1 megabyte) of storage to use for V array | def test_encrypt_maxmem_in_normal_range(self):
s = scrypt.encrypt(self.input,
self.password,
0.01,
self.ten_megabytes)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_encrypt_maxmem_undersized(self):\n s = scrypt.encrypt(self.input, self.password, 0.01, self.one_byte)\n m = scrypt.decrypt(s, self.password)\n self.assertEqual(m, self.input)",
"def test_decrypt_maxmem_keyword_argument(self):\n m = scrypt.decrypt(maxmem=self.ten_megabytes, in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt maxmemfrac accepts keyword argument of 1/16 total memory for V array | def test_encrypt_maxmemfrac_keyword_argument(self):
s = scrypt.encrypt(self.input, self.password, maxmemfrac=0.0625,
maxtime=0.01)
m = scrypt.decrypt(s, self.password)
self.assertEqual(m, self.input) | [
"def test_encrypt_maxmem_in_normal_range(self):\n s = scrypt.encrypt(self.input,\n self.password,\n 0.01,\n self.ten_megabytes)\n m = scrypt.decrypt(s, self.password)\n self.assertEqual(m, self.input)",
"def test_en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt accepts long input for encryption | def test_encrypt_long_input(self):
s = scrypt.encrypt(self.longinput, self.password, 0.1)
self.assertEqual(len(s), 128 + len(self.longinput)) | [
"def test_encrypt_maxtime_key(self):\n s = scrypt.encrypt(self.input, self.password, maxtime=0.01)\n m = scrypt.decrypt(s, self.password)\n self.assertEqual(m, self.input)",
"def test_encrypt_maxmem_undersized(self):\n s = scrypt.encrypt(self.input, self.password, 0.01, self.one_byte)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test encrypt raises TypeError if invalid keyword used in argument | def test_encrypt_raises_error_on_invalid_keyword(self):
self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input,
self.password, nonsense="Raise error")) | [
"def test_encrypt_missing_input_keyword_argument(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(password=self.password))",
"def test_encrypt_missing_password_positional_argument(self):\n self.assertRaises(TypeError, lambda: scrypt.encrypt(self.input))",
"def test_encrypt_input_and_pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test decrypt function accepts maxtime keyword argument | def test_decrypt_maxtime_keyword_argument(self):
m = scrypt.decrypt(maxtime=1.0, input=self.ciphertext, password=self.password)
self.assertEqual(m, self.input) | [
"def test_encrypt_maxtime_key(self):\n s = scrypt.encrypt(self.input, self.password, maxtime=0.01)\n m = scrypt.decrypt(s, self.password)\n self.assertEqual(m, self.input)",
"def test_decrypt_maxmem_keyword_argument(self):\n m = scrypt.decrypt(maxmem=self.ten_megabytes, input=self.ciph... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test decrypt function accepts maxmem keyword argument | def test_decrypt_maxmem_keyword_argument(self):
m = scrypt.decrypt(maxmem=self.ten_megabytes, input=self.ciphertext, password=self.password)
self.assertEqual(m, self.input) | [
"def test_decrypt_maxtime_keyword_argument(self):\n m = scrypt.decrypt(maxtime=1.0, input=self.ciphertext, password=self.password)\n self.assertEqual(m, self.input)",
"def test_encrypt_maxmem_undersized(self):\n s = scrypt.encrypt(self.input, self.password, 0.01, self.one_byte)\n m = s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test decrypt function raises scrypt.error raised if insufficient time allowed for ciphertext decryption | def test_decrypt_raises_error_on_too_little_time(self):
s = scrypt.encrypt(self.input, self.password, 0.1)
self.assertRaises(scrypt.error,
lambda: scrypt.decrypt(s, self.password, .01)) | [
"def test_decrypt_maxtime_keyword_argument(self):\n m = scrypt.decrypt(maxtime=1.0, input=self.ciphertext, password=self.password)\n self.assertEqual(m, self.input)",
"def test_encrypt_maxtime_key(self):\n s = scrypt.encrypt(self.input, self.password, maxtime=0.01)\n m = scrypt.decrypt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash takes keyword valid buflen | def test_hash_buflen_keyword(self):
h64 = scrypt.hash(self.input, self.salt, buflen=64)
h128 = scrypt.hash(self.input, self.salt, buflen=128)
self.assertEqual(len(h64), 64)
self.assertEqual(len(h128), 128) | [
"def test_hash_n_keyword(self):\n h = scrypt.hash(N=256, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_r_keyword(self):\n h = scrypt.hash(r=16, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_p_keyword(self):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash accepts valid N in position 3 | def test_hash_n_positional(self):
h = scrypt.hash(self.input, self.salt, 256)
self.assertEqual(len(h), 64) | [
"def test_hash_n_keyword(self):\n h = scrypt.hash(N=256, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_raises_error_n_not_power_of_two(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, N=3))",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash takes keyword valid N | def test_hash_n_keyword(self):
h = scrypt.hash(N=256, password=self.input, salt=self.salt)
self.assertEqual(len(h), 64) | [
"def test_hash_n_positional(self):\n h = scrypt.hash(self.input, self.salt, 256)\n self.assertEqual(len(h), 64)",
"def test_hash_p_keyword(self):\n h = scrypt.hash(p=4, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_r_keyword(self):\n h = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash takes keyword valid r | def test_hash_r_keyword(self):
h = scrypt.hash(r=16, password=self.input, salt=self.salt)
self.assertEqual(len(h), 64) | [
"def test_hash_p_keyword(self):\n h = scrypt.hash(p=4, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_n_keyword(self):\n h = scrypt.hash(N=256, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_buflen_keyword(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash accepts valid p in position 5 | def test_hash_p_positional(self):
h = scrypt.hash(self.input, self.salt, 256, 8, 2)
self.assertEqual(len(h), 64) | [
"def test_hash_p_keyword(self):\n h = scrypt.hash(p=4, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_n_positional(self):\n h = scrypt.hash(self.input, self.salt, 256)\n self.assertEqual(len(h), 64)",
"def test_hash_raises_error_on_p_equals_zero(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash takes keyword valid p | def test_hash_p_keyword(self):
h = scrypt.hash(p=4, password=self.input, salt=self.salt)
self.assertEqual(len(h), 64) | [
"def test_hash_n_keyword(self):\n h = scrypt.hash(N=256, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_r_keyword(self):\n h = scrypt.hash(r=16, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_p_positional(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error on illegal parameter value (p = 0) | def test_hash_raises_error_on_p_equals_zero(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, p=0)) | [
"def test_hash_raises_error_on_negative_p(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, p=-1))",
"def test_hash_p_keyword(self):\n h = scrypt.hash(p=4, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error on illegal parameter value (p < 0) | def test_hash_raises_error_on_negative_p(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, p=-1)) | [
"def test_hash_raises_error_on_p_equals_zero(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, p=0))",
"def test_hash_raises_error_r_p_over_limit(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error on illegal parameter value (r = 0) | def test_hash_raises_error_on_r_equals_zero(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, r=0)) | [
"def test_hash_raises_error_on_negative_r(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, r=-1))",
"def test_hash_raises_error_r_p_over_limit(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error on illegal parameter value (r < 1) | def test_hash_raises_error_on_negative_r(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, r=-1)) | [
"def test_hash_raises_error_r_p_over_limit(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, r=2, p=2 ** 29))",
"def test_hash_raises_error_on_r_equals_zero(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error when parameters r multiplied by p over limit 230 | def test_hash_raises_error_r_p_over_limit(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, r=2, p=2 ** 29)) | [
"def test_hash_p_keyword(self):\n h = scrypt.hash(p=4, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_r_keyword(self):\n h = scrypt.hash(r=16, password=self.input, salt=self.salt)\n self.assertEqual(len(h), 64)",
"def test_hash_p_positional(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error when parameter N is not a power of two {2, 4, 8, 16, etc} | def test_hash_raises_error_n_not_power_of_two(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, N=3)) | [
"def test_hash_raises_error_n_under_limit(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, N=1))\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, N=-1))",
"def test_hash_n_positional(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test hash raises scrypt error when parameter N under limit of 1 | def test_hash_raises_error_n_under_limit(self):
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, N=1))
self.assertRaises(scrypt.error,
lambda: scrypt.hash(self.input, self.salt, N=-1)) | [
"def test_hash_raises_error_n_not_power_of_two(self):\n self.assertRaises(scrypt.error,\n lambda: scrypt.hash(self.input, self.salt, N=3))",
"def test_hash_n_positional(self):\n h = scrypt.hash(self.input, self.salt, 256)\n self.assertEqual(len(h), 64)",
"def test_h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the list of nodes (dict of attributes) for the given object attributes from the csv file, and the parent node's attributes | def getNodes(object_attributes, parent_node_attributes):
query = object_attributes[objects_config['query_field']]
parameter_info = object_attributes[objects_config['parameter_1']]
# TODO: need a better way to encode parameter in the csv
parameter_name = unicode(string.split(parameter_info, ':')[0])
... | [
"def _process_csv(filename):\n import csv\n\n node_dict, neighbor_dict = {}, {}\n\n with open(filename, \"r\") as csv_file:\n for row in csv.DictReader(csv_file):\n node = EuclideanNode(\n node_type=row['NodeType'],\n name=row['Na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the ses class for the given element node. Create a new ses node if not exist, link the element node to it. | def linkToSES(node, attributes, graph_db):
ses_class = attributes[elements_config['ses_class']]
if ses_class is None or ses_class == '':
print 'Error: node ' + attributes + ' doesn\'t have ses class'
sys.exit(0)
ses_node = graph_db.get_or_create_indexed_node(
'SES', # index name
... | [
"def add_class_to_node(node, classname):\n\n if 'class' in node.attrib:\n node.attrib['class'] += ' ' + classname\n else:\n node.attrib['class'] = classname",
"def assign_class(otsession_id):\r\n return 200",
"def EnterClassType(self, node):\n nodes = [node]\n seen = set()\n whil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create in Neo4j the object node and its standalone element nodes Returns the object node reference in Neo4j | def createNode(node_attributes, object_id, objects, elements, graph_db):
index_field = objects[object_id][objects_config['index_field']]
if index_field in node_attributes:
object_node = graph_db.get_or_create_indexed_node(
'ID',
'index_field',
node_attributes[index_fi... | [
"def get_node_by_object(self, object: object):\n data = self.database.select(self.TABLE_NAME,\n {'target_id' : object.id,\n 'parent_type': object.object_type.value})\n\n return self.get_node(data[0]['id'])",
"def generateSibling... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create in Neo4j the root node and its all descendants (recursively) Returns the root node reference in Neo4j | def createTree(root_node_attributes, root_object_id, objects, elements, graph_db):
root_node = createNode(
root_node_attributes,
root_object_id,
objects,
elements,
graph_db
)
if 'child_id_field' in objects[root_object_id]:
child_ids = objects[root_o... | [
"def insert_root(cls):\n if cls.objects.exists():\n return False, None\n\n root = cls(root=None, parent=None, height=0,)\n try:\n with transaction.atomic():\n root.save()\n root.root = root\n root.save()\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the indexes listed in this dataset's image set file. | def _load_image_set_index(self):
image_set_file = os.path.join(self._data_path,self._image_set + '.txt')
assert os.path.exists(image_set_file), \
'Path does not exist: {}'.format(image_set_file)
with open(image_set_file) as f:
image_index = [x.strip() for x in f.readl... | [
"def _load_image_set_index(self):\r\n # Example path to image set file:\r\n # self._devkit_path + /VOCdevkit2007/VOC2007/ImageSets/Main/val.txt\r\n image_set_file = os.path.join(self._data_path, 'ImageSets', 'Main','train.txt')\r\n assert os.path.exists(self._data_path), \\\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the default path where PASCAL VOC is expected to be installed. | def _get_default_path(self):
return os.path.join(datasets.ROOT_DIR, 'data', 'VOCdevkit' + self._year) | [
"def _get_default_path(self):\n return os.path.join('/mnt/saturn/datasets/MSCOCO');",
"def _get_default_path(self):\n return os.path.join(cfg.DATA_DIR, 'ftdata')",
"def default_catalog_path(self) -> Path:\n\n try:\n return self._default_catalog_path\n except AttributeError:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates the next states of the system. | def generate_states(self, current_state, no=10):
future_states = []
emitted_states=[]
x=[]
for i in range(no):
next_state = self.next_state(current_state)
#print("Next state is",next_state)
emitted_states.append(self.next_emitted_state(next_state))
... | [
"def calculate_next_state(self):\n self.current_step = self.current_step + 1\n self.current_state = self.game.next_state(current_state=self.current_state, actions=self.next_action)",
"def next_state(self, state, move):\n\n pass",
"def next_states(self,state,args={}):\n res = self.pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creating a closure around the provider with the custom formatting to be applied on the provider output. | def formatter(provider: typing.Callable[..., payload.ColumnMajor]) -> typing.Callable[..., typing.Any]:
@functools.wraps(provider)
def wrapper(*args, **kwargs) -> typing.Any:
"""Wrapped provider with custom formatting.
Args:
*args: Original a... | [
"def wrapper(*args, **kwargs) -> typing.Any:\n return self.format(provider(*args, **kwargs))",
"def create_print_wrapper(f):\n def new_func(*args, **kwargs):\n response_format = kwargs.pop('format')\n response = f(*args, **kwargs)\n echo(format_output(response, response_form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapped provider with custom formatting. | def wrapper(*args, **kwargs) -> typing.Any:
return self.format(provider(*args, **kwargs)) | [
"def formatter(provider: typing.Callable[..., payload.ColumnMajor]) -> typing.Callable[..., typing.Any]:\n\n @functools.wraps(provider)\n def wrapper(*args, **kwargs) -> typing.Any:\n \"\"\"Wrapped provider with custom formatting.\n\n Args:\n *a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper for creating the reader actor spec for given query. | def actor(handler: typing.Callable[..., typing.Any], spec: 'frame.Query') -> task.Spec:
return extract.Reader.Actor.spec(
handler, extract.Statement.prepare(spec, source.extract.ordinal, lower, upper)
) | [
"def _from_spec(self, spec):",
"def _make_query(self):\n return RtuOverTcpQuery()",
"def _construct_input_spec(self):",
"def create(question: str) -> Asker:\n if question.startswith(\"/imagine\"):\n return ImagineAsker()\n return TextAsker()",
"def newActor(actor_name):\n actor={'name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the slicer instance of this feed, that is able to split the loaded dataset columnwise. This default slicer is plain positional sequence slicer. | def slicer(
cls, schema: typing.Sequence['series.Column'], columns: typing.Mapping['series.Column', parser.Column]
) -> typing.Callable[[payload.ColumnMajor, typing.Union[slice, int]], payload.ColumnMajor]:
return extract.Slicer(schema, columns) | [
"def slicing(self, name, slicer, axis='y'):\n if self._is_array(name):\n raise NotImplementedError('Cannot slice codes from arrays!')\n if 'rules' not in self._meta['columns'][name]:\n self._meta['columns'][name]['rules'] = {'x': {}, 'y': {}}\n if not isinstance(slicer, li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The explicit columns mapping implemented by this feed to be used by the query parser. | def columns(self) -> typing.Mapping['series.Column', parser.Column]:
return {} | [
"def _get_column_mapping(cls) -> Dict[str, str]:\n pass",
"def column_reflection_fallback(self):\n sql = sa.select([sa.text(\"*\")]).select_from(self._table)\n col_names = self.engine.execute(sql).keys()\n col_dict = [{'name': col_name} for col_name in col_names]\n return col_di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select a feed that can provide for (be used to construct) the given source. | def match(self, source: 'frame.Source') -> Provider:
for feed in self:
matcher = self.Matcher(feed.sources)
source.accept(matcher)
if matcher:
break
else:
raise error.Missing(f'None of the {len(self._feeds)} available feeds provide all of t... | [
"def select_sources(self, selection):\n\n # store selection\n self.selection = selection\n\n # make selection\n self.unit_vector = [self.unit_vector[i] for i in selection]\n self.distance = [self.distance[i] for i in selection]\n\n self.N = len(self.distance)\n\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Device firmware version. When unavailable, 'unknown' is returned | def firmware_version(self) -> str:
return "unknown" if self._fwversion is None else self._fwversion | [
"def firmware_version(self) -> str:\n self._logger.info(\"Retrieving current firmware version\")\n return self._device_info().get(\"firmware\")",
"def get_firmware_version(self):\n return self._word_or_none(self._send_command(COMMAND_GET_FIRMWARE_VERSION))",
"def firmware_update_version(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter a dataframe on the specified number of attributes | def filter_df_on_activities(df, activity_key="concept:name", max_no_activities=25):
activity_values_dict = dict(df[activity_key].value_counts())
activity_values_ordered_list = []
for act in activity_values_dict:
activity_values_ordered_list.append([act, activity_values_dict[act]])
activity_value... | [
"def filter(self, df):\n pass",
"def _apply_attr_filters(self, df):\n mask = pd.Series([True] * len(df))\n for degree_substr in self.attr_filters['final_major']:\n mask = mask & ~df['final_major'].str.contains(f'{degree_substr}')\n return df[mask]",
"def df_filter(self, df... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter a dataframe keeping only the specified maximum number of cases | def filter_df_on_ncases(df, case_id_glue="case:concept:name", max_no_cases=1000):
cases_values_dict = dict(df[case_id_glue].value_counts())
cases_to_keep = []
for case in cases_values_dict:
cases_to_keep.append(case)
cases_to_keep = cases_to_keep[0:min(len(cases_to_keep),max_no_cases)]
df = ... | [
"def filter_df_on_case_length(df, case_id_glue=\"case:concept:name\", min_trace_length=3, max_trace_length=50):\n df = df.groupby(case_id_glue).filter(lambda x: (len(x)>= min_trace_length and len(x)<=max_trace_length))\n return df",
"def filter_df_on_activities(df, activity_key=\"concept:name\", max_no_acti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter a dataframe keeping only the cases that have the specified number of events | def filter_df_on_case_length(df, case_id_glue="case:concept:name", min_trace_length=3, max_trace_length=50):
df = df.groupby(case_id_glue).filter(lambda x: (len(x)>= min_trace_length and len(x)<=max_trace_length))
return df | [
"def filter_df_on_ncases(df, case_id_glue=\"case:concept:name\", max_no_cases=1000):\n cases_values_dict = dict(df[case_id_glue].value_counts())\n cases_to_keep = []\n for case in cases_values_dict:\n cases_to_keep.append(case)\n cases_to_keep = cases_to_keep[0:min(len(cases_to_keep),max_no_cases... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the average per_domain auc and auprc for the test set | def compute_per_domain_auc(y_test, pred_probs, pred_idx, classifier):
y_test_copy = y_test.copy(deep=True)
y_test_copy["pred_probs"] = pred_probs
domain_auc_list = []
domain_auprc_list = []
domain_auprc_ratio_list = []
domain_name_list = []
domain_pos_num_list = []
domain_neg_n... | [
"def calculate_AUROC(y_true, y_pred):\n return roc_auc_score(y_true, y_pred)",
"def compute_auprc(pred, label):\n #label = np.array(label)\n #pred = np.array(pred)\n precision, recall, thresholds = precision_recall_curve(label, pred)\n auprc = auc(recall, precision)\n return auprc",
"def compu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
line name is composed by column1~columndata_start_col value and current column name | def _generate_series_name(self, row, current_col_index):
name = " ".join([row[col] for col in range(1, self.data_start_col)])
if len(self.theader_list)-self.data_start_col >= 2:
# if there is many data columns, append current data column name
name = u"%s-%s" % (name, self.theade... | [
"def get_line_identifier(self):",
"def dataline(self, line):\n return super(scandata, self).data[:, line - 1]",
"def read_column_names(file_obj): #How does this one know to start at line 5? with next()? \n\tcolumn_names = [cn.strip() for cn in next(file_obj).split(',')[1:]] #start at 1 as we don't need ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run tasks asynchronously using asyncio and return results If max_concurrent_tasks are set to 0, no limit is applied. | def run_asyncio_commands(tasks, max_concurrent_tasks=0):
all_results = []
if max_concurrent_tasks == 0:
chunks = [tasks]
else:
chunks = make_chunks(l=tasks, n=max_concurrent_tasks)
for tasks_in_chunk in chunks:
if platform.system() == 'Windows':
loop = asyncio.Proa... | [
"def run_asyncio_commands(tasks, max_concurrent_tasks=0):\r\n\r\n all_results = []\r\n\r\n if max_concurrent_tasks == 0:\r\n chunks = [tasks]\r\n else:\r\n chunks = make_chunks(l=tasks, n=max_concurrent_tasks)\r\n\r\n for tasks_in_chunk in chunks:\r\n loop = asyncio.get_event_loop()\r\n commands = a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do basic widget setup. For Base, this is just changing the label text. | def setup(self, name=None, **kwargs):
if None not in (self.label, name):
self.label.setText(name) | [
"def set_label(self, label):",
"def create(self, parent):\n self.widget = QtGui.QLabel(parent)",
"def setup(self, parent):\n self.__init_widget(parent)\n self.init_grid()\n self.set_init()",
"def __init__(self, **kwargs):\n super(MyLabel, self).__init__(**kwargs)\n se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hide all widgets in group. | def hide(self):
for widget in self.widgets:
widget.hide()
if self.label is not None:
self.label.hide() | [
"def hide_all_but(self, widget=None):\n for i in reversed(range(1, self.layout.count())):\n item = self.layout.itemAt(i)\n\n if isinstance(item, QWidgetItem):\n item.widget().hide() \n # or\n # item.widget().setParent(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show all widgets in group. | def show(self):
for widget in self.widgets:
widget.show()
if self.label is not None:
self.label.show() | [
"def add_widgets(self):\n widgets = self.get_widgets()\n self._widgets = [] # stores widgets which may need to be shut down when done\n for group in widgets:\n # Check for group label\n if isinstance(group[0], str):\n grouplabel, v = group\n b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swap active pv names and manage connections | def change_pvs(self, pvnames, name=None, **kwargs):
self.preserve_connections()
self.clear_connections()
self.setup(pvnames=pvnames, name=name, **kwargs)
self.create_connections() | [
"def __nameChanged(self,ippool_obj,old_name):\n self.unloadIPpoolByName(old_name)\n self.__keepObj(ippool_obj)",
"def update_pv(self, **kws):\n for k in ('readback', 'readset', 'setpoint'):\n v = kws.get(k, None)\n if v is not None:\n setattr(self, k, v)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an object, return the pvnames based on self.attrs | def get_pvnames(self, obj):
if obj is None:
return None
pvnames = []
for attr in self.attrs:
sig = self.nested_getattr(obj, attr)
try:
pvnames.append(sig.pvname)
except AttributeError:
pvnames.append(None)
re... | [
"def get_pv_list(self):\n return [name for name in self.pv_dict.iterkeys()]",
"def __get_pv_names(k8s_conf):\n out_names = list()\n core_client = k8s_core_client(k8s_conf)\n pv_list = core_client.list_persistent_volume()\n for pv in pv_list.items:\n out_names.append(pv.metadata.name)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do a getattr more than one level deep, splitting on '.' | def nested_getattr(self, obj, attr):
steps = attr.split('.')
for step in steps:
obj = getattr(obj, step)
return obj | [
"def get_attribute(s, ob):\n spart = s.partition('.')\n\n f = ob\n for part in spart:\n if part == '.':\n continue\n \n f = f.__getattribute__(part)\n \n return f",
"def _dotted_itemgetter(field_name):\n\n if '.' not in field_name:\n return operator.ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a script This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_script(self, script_id, **kwargs):
all_params = ['script_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argum... | [
"async def get_script(self) -> str:\n response = await self.communicator.send_command(\n Message.command(\"get_script\", \"\")\n )\n if response.response_status == ResponseStatus.ERROR:\n raise RuntimeError(\"Response status error while fetching script.\")\n\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the published scripts. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_scripts_published(self, **kwargs):
all_params = ['page_size', 'page_number', 'expand', 'name', 'feature', 'flow_id', 'script_data_version']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
... | [
"def list_scripts() -> dict:\n endpoint_url = '/real-time-response/entities/scripts/v1'\n response = http_request('GET', endpoint_url)\n return response",
"def list(self):\n return self.connection.get(self.service + \"/AllScripts\")",
"def scripts(self):\n scripts_yml = os.path.join(os.pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the published script. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_scripts_published_script_id(self, script_id, **kwargs):
all_params = ['script_id', 'script_data_version']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | [
"def get_scripts_published(self, **kwargs):\n\n all_params = ['page_size', 'page_number', 'expand', 'name', 'feature', 'flow_id', 'script_data_version']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the published variables This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_scripts_published_script_id_variables(self, script_id, **kwargs):
all_params = ['script_id', 'input', 'output', 'type', 'script_data_version']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
... | [
"def list_variables(self, refresh=False):\n if self._variables is None or refresh:\n request = self.workspaces_service.variables().list(parent=self.path)\n\n response = request.execute()\n self._variables = [\n gtm_manager.variable.GTMVariable(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the upload status of an imported script This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_scripts_upload_status(self, upload_id, **kwargs):
all_params = ['upload_id', 'long_poll']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got... | [
"def get_upload_status(uploadId=None):\n pass",
"def import_status(self):\n result = self.__get_object('imports', None, None)\n if not 'status' in result:\n self.log.error(\"Unable to find 'status' key in result: %s\" % (result))\n return None \n elif not result['status'] in ['ready', 'queue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invalidate the cache for this Model, if the key_instance or model_instance are passed only that model will be deleted, otherwise the whole content should be dropped. | def invalidate(self, key_instance=None, model_instance=None):
raise NotImplementedError("invalidate should be implemented in any subclass!") | [
"def clear_cache(sender, instance, *args, **kwargs): # pylint: disable=unused-argument\n delete_instance(sender, instance)",
"def invalidate_model(model):\n model = non_proxy(model)\n conjs_keys = redis_client.keys('conj:%s:*' % get_model_name(model))\n if conjs_keys:\n cache_keys = redis_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a cache key given a key_instance, that can be a complete key, or only a part of it | def _get_cache_key(self, key_instance):
assert isinstance(key_instance, tuple), "The key_instance is wrong: %s" % key_instance
# at: a key_instance is a touple containing as a fisrt element
# the primary key of a PersistentObject, and as additional
# elements unique constraint for that m... | [
"def get_cache_key(instance, extra=None):\n return '%s.%s.%s' % (instance.__class__.__name__, instance.short_url, extra) if extra else '%s.%s' % (instance.__class__.__name__, instance.short_url)",
"def _build_cache_key(self, *args):\n return self.key if not self.key_mod else self.key % tuple(args)",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the cache key corresponding to the given model instance, if cached, otherwise return None | def _get_cache_key_from_model(self, model_instance):
if model_instance:
for cache_key, value in self._cache.items():
# object identity should suffice, the goal of the cache is to
# keep it unique
if value == model_instance:
return c... | [
"def _get_cache_key(cls, args, kwargs):\r\n result = None\r\n # Quick hack for my composites work for now.\r\n if hasattr(cls._meta, 'pks'):\r\n pk = cls._meta.pks[0]\r\n else:\r\n pk = cls._meta.pk\r\n # get the index of the pk in the class fields. this shou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load MNIST data from `path`. | def load_mnist(path, kind="train"):
labels_path = os.path.join(path, "{:s}-labels-idx1-ubyte".format(kind))
images_path = os.path.join(path, "{:s}-images-idx3-ubyte".format(kind))
with open(labels_path, "rb") as lbpath:
_, _ = struct.unpack(">II", lbpath.read(8))
labels = np.fromfile(lbpath... | [
"def load_mnist(path, is_train=True):\n\n\n if is_train:\n prefix = 'train'\n else:\n prefix = 't10k'\n\n\n labels_path = os.path.join(path,'{}-labels-idx1-ubyte.gz'.format(prefix))\n images_path = os.path.join(path,'{}-images-idx3-ubyte.gz'.format(prefix))\n\n with gzip.open(labels_pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To craft the attack it is easiest if the prepended bytes are an integer multiple of the block_size, this function figures out how many bytes need to be padded to mae that happen. Than the next block can be used in the attack, the index of this block is also returned | def get_prepend_padding_length_and_block_index(block_size, encryptor):
def block_getter(byte_str: bytes, block: int) -> bytes:
return byte_str[block * block_size:(1 + block) * block_size]
def get_num_of_identical_blocks(cipher1, cipher2):
for cipher_block_index in range(int(len(cipher2) / bloc... | [
"def find_byte(self, index, target_block, crafted_block):\n valid = []\n\n self.logger.info(\"\\tattacking byte [{}/{}]...\".format(index+1, len(target_block)))\n\n for c in range(256):\n crafted_block[index] = c\n\n self.logger.debug('\\ttrying byte {} .. in {} '.format(h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get source id and type from sessions according to the group id | def get_src_id_and_type_from_sessions(self, gid):
session_storage = SessionStorage(settings.Session_Storage_File)
sessions = session_storage.read()
logger.debug('sessions: ' + str(len(sessions)))
for session in sessions:
logger.debug(json.dumps(session))
if session.get('gid') == gid:
return session.g... | [
"def _tunnel_source_id(source):\n return tuple(sorted(source.items()))",
"def test_data_source_postgre_sqls_id_get(self):\n pass",
"def get_study_sessions(dicom_dir_template, files_opt, heuristic, outdir,\n session, sids, grouping='studyUID'):\n study_sessions = {}\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct an array of random samples, normally distributed about n with the given standard deviation. | def samples(n, dev=0.1, count=10000):
return np.random.normal(n, dev, count) | [
"def d_normal_distribution(mu, covMat, n):\n import numpy as np\n # Use multivariate normal distribution of numpy package\n return np.random.multivariate_normal(mean=mu, cov=covMat, size=n, check_valid='ignore').tolist()",
"def _randomSamples(self, n):\n # we want to return points in unit sphere, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gracefully stop working on things | def _gracefully_stop(self):
pass | [
"def at_stop(self):\r\n pass",
"def try_stop(self):\n try:\n self.stop()\n except:\n e = sys.exc_info()[0]\n self.get_logger().warning(e)",
"def container_forcestop(self):\n raise ex.excError",
"def halt(self):\n self.running = False\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset plans being solved so they are solved again. Use this only when the solver service is not running concurrently. | def _reset_solving_status(self):
plans = self.Plan.query.get_plan_by_col("status", self.Plan.SOLVING)
for the_plan in plans:
the_plan.status = self.Plan.TRANSLATED
# Use only in active-passive mode, so don't have to be atomic
the_plan.update() | [
"def change_plan(self, plan):\n\n # First, sort the new plan by event start times.\n plan.sort(key=lambda task: task['start'])\n\n # Queue will be modified, plan will stay as it is.\n queue = list(plan)\n\n # Establish a common time base.\n now = reactor.seconds()\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |