query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Resample coarse segmentation tensor to the given bounding box and derive labels for each pixel of the bounding box | def resample_coarse_segm_tensor_to_bbox(coarse_segm: torch.Tensor, box_xywh_abs: IntTupleBox):
x, y, w, h = box_xywh_abs
w = max(int(w), 1)
h = max(int(h), 1)
labels = F.interpolate(coarse_segm, (h, w), mode="bilinear", align_corners=False).argmax(dim=1)
return labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample_fine_and_coarse_segm_tensors_to_bbox(\n fine_segm: torch.Tensor, coarse_segm: torch.Tensor, box_xywh_abs: IntTupleBox\n):\n x, y, w, h = box_xywh_abs\n w = max(int(w), 1)\n h = max(int(h), 1)\n # coarse segmentation\n coarse_segm_bbox = F.interpolate(\n coarse_segm, (h, w), mo... | [
"0.6478101",
"0.6458288",
"0.5927219",
"0.58900374",
"0.55786675",
"0.55571175",
"0.55210066",
"0.55083823",
"0.5440751",
"0.54380363",
"0.54371274",
"0.54321146",
"0.5426156",
"0.54251885",
"0.5415475",
"0.5403779",
"0.540325",
"0.5401663",
"0.5368239",
"0.5363603",
"0.53531... | 0.68045133 | 1 |
Resample fine and coarse segmentation tensors to the given bounding box and derive labels for each pixel of the bounding box | def resample_fine_and_coarse_segm_tensors_to_bbox(
fine_segm: torch.Tensor, coarse_segm: torch.Tensor, box_xywh_abs: IntTupleBox
):
x, y, w, h = box_xywh_abs
w = max(int(w), 1)
h = max(int(h), 1)
# coarse segmentation
coarse_segm_bbox = F.interpolate(
coarse_segm, (h, w), mode="bilinear"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample_fine_and_coarse_segm_tensors_to_bbox(\n fine_segm: torch.Tensor, coarse_segm: torch.Tensor, box_xywh_abs: IntTupleBox\n):\n x, y, w, h = box_xywh_abs\n w = max(int(w), 1)\n h = max(int(h), 1)\n # coarse segmentation\n coarse_segm_bbox = F.interpolate(\n coarse_segm,\n (... | [
"0.68596137",
"0.6554217",
"0.6554217",
"0.5882985",
"0.585619",
"0.5846074",
"0.5843255",
"0.58028907",
"0.58009887",
"0.57961977",
"0.5764685",
"0.57554805",
"0.5748522",
"0.57372177",
"0.572652",
"0.568638",
"0.5678612",
"0.56781596",
"0.5647182",
"0.5632262",
"0.56277126"... | 0.6877821 | 0 |
Convert predictor output with coarse and fine segmentation to a mask. | def predictor_output_with_fine_and_coarse_segm_to_mask(
predictor_output: Any, boxes: Boxes, image_size_hw: ImageSizeType
) -> BitMasks:
H, W = image_size_hw
boxes_xyxy_abs = boxes.tensor.clone()
boxes_xywh_abs = BoxMode.convert(boxes_xyxy_abs, BoxMode.XYXY_ABS, BoxMode.XYWH_ABS)
N = len(boxes_xywh_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predictor_output_with_coarse_segm_to_mask(\n predictor_output: Any, boxes: Boxes, image_size_hw: ImageSizeType\n) -> BitMasks:\n H, W = image_size_hw\n boxes_xyxy_abs = boxes.tensor.clone()\n boxes_xywh_abs = BoxMode.convert(boxes_xyxy_abs, BoxMode.XYXY_ABS, BoxMode.XYWH_ABS)\n N = len(boxes_xyw... | [
"0.64958364",
"0.64958364",
"0.6187619",
"0.6150233",
"0.60465384",
"0.592084",
"0.59030396",
"0.58995676",
"0.5862994",
"0.5852873",
"0.5835467",
"0.5810776",
"0.5743541",
"0.5702469",
"0.56725556",
"0.56671077",
"0.56321526",
"0.56278396",
"0.5619452",
"0.5614545",
"0.56050... | 0.6891425 | 1 |
method is playing morse code sounds depending on the input | def play_morse(tr_marks: list):
play_morse_code = silence
for mark in tr_marks:
if mark == DOT:
play_morse_code += sound
play_morse_code += silence
elif mark == COMMA:
play_morse_code += sound
play_morse_code += sound
play_morse_code +=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_morse_code_audio(self, text):\n # The Morse-sender-dictionary letter keys are lower-case letters.\n lctext = text.lower()\n # Replace any newline characters with a space character.\n lctext = lctext.replace('\\n', ' ')\n # Loop and convert characters to Morse code aud... | [
"0.7356725",
"0.6545013",
"0.65217036",
"0.64552045",
"0.6409863",
"0.6388827",
"0.63310593",
"0.62088245",
"0.61421",
"0.60523164",
"0.604278",
"0.6028385",
"0.6028272",
"0.6024971",
"0.5971374",
"0.59319043",
"0.5907226",
"0.5903722",
"0.5879051",
"0.5868905",
"0.5835449",
... | 0.73421204 | 1 |
Call a tf_hub.Module using the standard blundell signature. This expects that `module` has a signature named `signature` which conforms to ('sequence', 'sequence_length') > output To use an existing SavedModel file you may want to create a module_spec with `tensorflow_hub.saved_model_module.create_module_spec_from_save... | def call_module(module, one_hots, row_lengths, signature):
if signature not in module.get_signature_names():
raise ValueError('signature not in ' +
six.ensure_str(str(module.get_signature_names())) +
'. Was ' + six.ensure_str(signature) + '.')
inputs = module.get_input_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_modules_in_function_signature_unwrapped(dependency_testing_model) -> None:\n func: Callable = dependency_testing_model.unwrapped_predict\n expected_modules = {\n 'json',\n 'collections',\n 'sklearn',\n 'cloudpickle',\n 'requests',\n }\n extracted_modules: Set... | [
"0.5419747",
"0.5326547",
"0.5326547",
"0.52860445",
"0.527043",
"0.5221019",
"0.5221019",
"0.5221019",
"0.5197618",
"0.5174877",
"0.5174877",
"0.51694185",
"0.51559496",
"0.49624866",
"0.4918613",
"0.4902309",
"0.48774195",
"0.48640463",
"0.48298866",
"0.48239872",
"0.480812... | 0.6811007 | 0 |
Alternative constructor for Inferrer that is memoized. | def memoized_inferrer(
savedmodel_dir_path,
activation_type=tf.saved_model.signature_constants
.DEFAULT_SERVING_SIGNATURE_DEF_KEY,
batch_size=16,
use_tqdm=False,
session_config=None,
memoize_inference_results=False,
use_latest_savedmodel=False,
):
return Inferrer(
savedmodel_dir_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, f):\n self.f = f\n self.memo = {}\n print('Calling __init__()')",
"def get_inferrer_for(__call__, self, fn):\n tracking = getattr(fn, 'tracking_id', None)\n if tracking is None:\n return __call__(self, fn)\n if fn not in self.constructors:\n ... | [
"0.57097083",
"0.565469",
"0.54636115",
"0.5359008",
"0.53518945",
"0.52622575",
"0.5254688",
"0.5254688",
"0.5246884",
"0.52231497",
"0.52179325",
"0.52097183",
"0.52092415",
"0.52090156",
"0.51751125",
"0.5166283",
"0.5138301",
"0.5130604",
"0.51206917",
"0.51206917",
"0.51... | 0.6149901 | 0 |
Gets the value of a variable from the graph. | def get_variable(self, variable_name):
with self._graph.as_default():
return self._sess.run(self._get_tensor_by_name(variable_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_Variable(self, node):\n var_name = node.value\n val = self.VARIABLES.get(var_name)\n if val is None:\n raise NameError(repr(var_name))\n else:\n return val",
"def get_value(self, var_name, tf_session):\n\n if var_name in self.learning_parameters:... | [
"0.6932",
"0.68510634",
"0.684766",
"0.6606306",
"0.6586858",
"0.64930975",
"0.6473543",
"0.6453199",
"0.64312464",
"0.6427162",
"0.64167476",
"0.6407993",
"0.6407993",
"0.6407993",
"0.64065707",
"0.6314743",
"0.63059956",
"0.63046336",
"0.62994",
"0.62777895",
"0.6276041",
... | 0.7520454 | 0 |
Get the most recent savedmodel from a base directory path. | def latest_savedmodel_path_from_base_path(base_path):
protein_export_base_path = os.path.join(base_path, 'export/protein_exporter')
suffixes = [
x for x in tf.io.gfile.listdir(protein_export_base_path)
if 'temp-' not in x
]
if not suffixes:
raise ValueError('No SavedModels found in %s' % prot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_saved_model(model_dir):\n saved_models = os.path.join(model_dir, 'best_models')\n saved_chkp = sorted([int(mdl) for mdl in os.listdir(saved_models)])\n latest = saved_chkp[-1]\n path = os.path.join(saved_models, '%d' % latest)\n\n # Next, find the full path to the saved model\n mdl... | [
"0.80567336",
"0.7754427",
"0.76267993",
"0.71230805",
"0.6797189",
"0.67275167",
"0.6658544",
"0.65875036",
"0.6571269",
"0.65707",
"0.6433725",
"0.63868684",
"0.63734627",
"0.6345704",
"0.6340036",
"0.6317695",
"0.62807816",
"0.62697744",
"0.6192471",
"0.61862606",
"0.61432... | 0.7921742 | 1 |
Serializes an inference result. This function is the opposite of deserialize_inference_result. The full format returned is a | def serialize_inference_result(sequence_name,
activations):
with io.BytesIO() as bytes_io:
np.savez_compressed(bytes_io, **{sequence_name: activations})
return base64.b64encode(bytes_io.getvalue()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_result(result: Any) -> Union[str, bytes]:\n if isinstance(result, Node):\n return result.serialize(how='default' if RESULT_FILE_EXTENSION != '.xml' else 'xml')\n else:\n return repr(result)",
"def deserialize_inference_result(results_b64):\n bytes_io = io.BytesIO(base64.b64deco... | [
"0.68274057",
"0.59581023",
"0.5844812",
"0.57521456",
"0.56516314",
"0.56136394",
"0.558927",
"0.5458501",
"0.54018223",
"0.5302885",
"0.5245653",
"0.52354074",
"0.52354074",
"0.52112603",
"0.5208084",
"0.5108439",
"0.5067872",
"0.50613916",
"0.5043716",
"0.5019683",
"0.5019... | 0.6606261 | 1 |
Deserializes an inference result. This function is the opposite of serialize_inference_result. The full format expected is a | def deserialize_inference_result(results_b64):
bytes_io = io.BytesIO(base64.b64decode(results_b64))
single_pred_dict = dict(np.load(bytes_io))
if len(single_pred_dict) != 1:
raise ValueError('Expected exactly one object in the structured np array. '
f'Saw {len(single_pred_dict)}')
seque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode_result(self, result):\n if isinstance(result, list):\n return [self._decode_result(r) for r in result]\n elif isinstance(result, SimpleString):\n return result.value\n elif isinstance(result, SimpleError):\n return self._decode_error(result)\n ... | [
"0.5954675",
"0.5719973",
"0.5659938",
"0.56532973",
"0.56231964",
"0.55732983",
"0.55553776",
"0.5442849",
"0.54132456",
"0.537006",
"0.53153294",
"0.52145404",
"0.5211858",
"0.51910484",
"0.51749104",
"0.51612943",
"0.51597965",
"0.51500016",
"0.508528",
"0.50621617",
"0.50... | 0.71581525 | 0 |
Parses file of gzipped, newlineseparated inference results. The contents of each line are expected to be serialized as in `serialize_inference_result` above. | def parse_shard(shard_path):
with tf.io.gfile.GFile(shard_path, 'rb') as f:
with gzip.GzipFile(fileobj=f, mode='rb') as f_gz:
for line in f_gz: # Line-by-line.
yield deserialize_inference_result(line) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(path):\n data = gzip.open(path, 'rb')\n for byte_line in data:\n yield eval(byte_line) # return generator instance to save memory",
"def parse_external_result(self, file):\n raise NotImplementedError",
"def parse(fcontents, utf16=False): # TODO where does this conversion take pl... | [
"0.61069715",
"0.5438141",
"0.54298097",
"0.5386857",
"0.53416765",
"0.52968967",
"0.5296664",
"0.525452",
"0.51831484",
"0.51509607",
"0.51455534",
"0.51425",
"0.513542",
"0.5126798",
"0.51113844",
"0.51109505",
"0.50837934",
"0.508252",
"0.50731415",
"0.5058527",
"0.5057472... | 0.6268908 | 0 |
Returns whether connected and ACKed | def is_connected(self):
if self.connected and self.connack_rec:
return 1
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isConnected():",
"def isconnected(self) -> bool:",
"def is_connected(self):\n if self._socket:\n return True\n else:\n return False",
"def is_connected(self) -> bool:",
"def connected(self):\n return self.port.is_open",
"def isconnected(self) -> bool:\n ... | [
"0.7547859",
"0.7478661",
"0.7429876",
"0.7380853",
"0.73499054",
"0.730056",
"0.728276",
"0.7265231",
"0.72598755",
"0.7242413",
"0.7239942",
"0.72248036",
"0.7222459",
"0.721962",
"0.72177106",
"0.7213608",
"0.7208526",
"0.72019684",
"0.71913517",
"0.71713716",
"0.717108",
... | 0.8259857 | 0 |
Renders a list of historic batches | def view_batches(request):
template = 'batch_list.html'
context = {
'invalid_due_date': request.GET.get('invalid_due_date')
}
try:
get_batches(request, context)
except Exception as e:
context['error'] = '{} {}'.format(e, traceback.format_exc())
# TODO: GO PAF - Start
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_batches() -> str:\r\n tank_possibilities = [\"Albert\", \"Brigadier\", \"Camilla\", \"Dylon\", \"Emily\",\r\n \"Florence\", \"Gertrude\", \"Harry\", \"R2D2\",\r\n \"No Tank Needed\"]\r\n return render_template(\"view_batches.html\",\r\n ... | [
"0.66533065",
"0.62283266",
"0.60942686",
"0.60652864",
"0.59861034",
"0.5948222",
"0.58719194",
"0.5858274",
"0.5838414",
"0.58291125",
"0.5793077",
"0.57760614",
"0.5725792",
"0.5713223",
"0.5686191",
"0.56724244",
"0.56462044",
"0.5618192",
"0.56146944",
"0.5612472",
"0.55... | 0.6571801 | 1 |
Computes the number of timesteps needed to get the simulation past tmax | def num_sim_steps(self, dt, tmax):
return int(np.ceil(tmax / dt)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_time_steps (self):\n return self.degreedays.thawing.num_timesteps",
"def n_timesteps(self) -> int:\n return len(self.time)",
"def num_timesteps(self):\n return self._num_timesteps",
"def runtime(self):\n return self.tmax_epochs - self.tmin_epochs",
"def max_steps(sel... | [
"0.7784215",
"0.75834614",
"0.7177998",
"0.7147208",
"0.70487255",
"0.68899256",
"0.68801206",
"0.6862652",
"0.68206733",
"0.6729553",
"0.6663248",
"0.6663248",
"0.6661061",
"0.6585944",
"0.65505177",
"0.65240073",
"0.65111583",
"0.65044254",
"0.6500881",
"0.6465097",
"0.6460... | 0.8402275 | 0 |
Wrapper around fast_pad_shift() in fastshift.c Works out the optimum number of indicies by which y2 needs to be shifted to have the minimum least squares error between the two | def fast_pad_shift(self, y1, y2):
if len(y1) != len(y2):
raise ValueError("Input sizes must be the same")
y1_contig = np.ascontiguousarray(y1, dtype=np.float64)
y2_contig = np.ascontiguousarray(y2, dtype=np.float64)
y1_ptr = y1_contig.ctypes.data_as(ctypes.POINTER(ctypes.c_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perfect_shift(y):\n return np.append([y[-1]],y[0:-1])",
"def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n",
"def find_best_shift(l_x_as, l_y_as, l_yp_as, r_x_orig_as, r_y_as, r_yp_as, x_stride):\n logg = logging.getLogger(f\"c.{__name__}.find_best_shift\")\n # logg.debug(f\"Star... | [
"0.6466211",
"0.60334533",
"0.5912409",
"0.58153456",
"0.5814866",
"0.5708873",
"0.56890917",
"0.56569624",
"0.56388104",
"0.56388104",
"0.55942255",
"0.55764323",
"0.5565782",
"0.55486435",
"0.5502997",
"0.5485006",
"0.5467454",
"0.54600763",
"0.5451744",
"0.54203475",
"0.54... | 0.714775 | 0 |
Counts the number of times a pattern is in text. | def pattern_count(text, pattern):
return len([i
for i in range(0, len(text) - len(pattern) + 1)
if text[i:i + len(pattern)] == pattern]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PatternCount(text, pattern):\n\n count = 0\n for i in range(0, len(text)-len(pattern)+1):\n if text[i:i+len(pattern)] == pattern:\n count += 1\n return count",
"def pattern_count(text, pattern):\n\n count = 0\n len_text = len(text)\n len_pattern = len(pattern)\n for i i... | [
"0.85784805",
"0.8479635",
"0.80442816",
"0.76850486",
"0.75937515",
"0.756862",
"0.75528634",
"0.73120034",
"0.7220975",
"0.70781434",
"0.70781434",
"0.6994858",
"0.6943327",
"0.691691",
"0.6849857",
"0.6743599",
"0.6734056",
"0.6717872",
"0.66522515",
"0.66400516",
"0.66149... | 0.8523106 | 1 |
Returns the patterns(kmers) whose frequency of occurrence (count) is greater than t. | def frequent_words_t(text, k, t):
frequent_patterns = []
count = {}
for i in range(0, len(text)-k+1):
pattern = text[i:i+k]
count[i] = pattern_count(text, pattern)
if count[i] >= t and pattern not in frequent_patterns:
frequent_patterns.append(text[i:i+k])
return freq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_clumps(text, k, len_win, t):\n\n patterns = []\n len_text = len(text)\n for i in range(len_text - len_win + 1):\n window = text[i:i + len_win]\n freq_map = frequency_table(window, k)\n for key in freq_map.keys():\n if freq_map[key] >= t and key not in patterns:\n ... | [
"0.6151683",
"0.6078879",
"0.58491397",
"0.57430816",
"0.5682803",
"0.5476455",
"0.54654175",
"0.5314422",
"0.52966666",
"0.5261653",
"0.51758975",
"0.5156601",
"0.5104174",
"0.50993943",
"0.5099003",
"0.50974345",
"0.50800914",
"0.5068089",
"0.5063559",
"0.50433385",
"0.5015... | 0.67880565 | 0 |
Returns and array with all positions where the pattern is found within the text. | def find_position(pattern, text):
positions = []
i = 0
while text[i:] and text[i:].find(pattern) != -1:
position = text[i:].find(pattern) + i
positions.append(position)
i = position + 1
return positions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __naive_matching(pattern, text):\n matched_positions = []\n n = len(text)\n m = len(pattern)\n # Last possible pattern starting position in the text is n - m\n for pos in range((n - m) + 1):\n if pattern == text[pos:(pos+m)]:\n matched_positions.appe... | [
"0.82084525",
"0.7794501",
"0.77193886",
"0.7659554",
"0.72130907",
"0.7196132",
"0.7073557",
"0.70187694",
"0.6968592",
"0.69200224",
"0.6911996",
"0.68648756",
"0.6805044",
"0.6797464",
"0.6721601",
"0.6673448",
"0.659498",
"0.6563846",
"0.6534992",
"0.65285796",
"0.6457771... | 0.8557723 | 0 |
A kmer can be arranged in a 4^k ordered array. This function returns an array of the frequency of each of the kmers in the text. The position of the array can be matched with the pattern using pattern_to_number and number_to_pattern. | def compute_freq(text, k):
freq_array = [0 for i in range(0, 4**k)]
for i in range(0, len(text) - k + 1):
pattern = text[i:i + k]
j = pattern_to_number(pattern)
freq_array[j] += 1
# return ' '.join([str(i) for i in freq_array])
return freq_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frequency_array(text, k):\r\n freq_list=[]\r\n p_list=pattern_list(k)\r\n for i in p_list:\r\n freq_list.append(PatternCount(i,text))\r\n return freq_list",
"def count_kmers(seq, k=3):\n # Start with an empty dictionary\n counts = {}\n # Calculate how many kmers of length k there ... | [
"0.75466734",
"0.67215174",
"0.67213583",
"0.6492698",
"0.64837915",
"0.6456329",
"0.64193577",
"0.64173275",
"0.63039887",
"0.62665516",
"0.62640476",
"0.6240153",
"0.61800927",
"0.6087899",
"0.60426986",
"0.6032585",
"0.60165304",
"0.5976605",
"0.5971062",
"0.5964768",
"0.5... | 0.79192466 | 0 |
Same that find_clumps but using the improved functions to find frequent patterns | def clumps_finding(text, k, t, L):
frequent_patterns = []
clumps = [0 for i in range(0, 4**k)]
for i in range(0, len(text) - L + 1):
subtext = text[i:i + L]
freq_array = compute_freq(subtext, k)
for index, freq in enumerate(freq_array):
if freq >= t:
clump... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def better_clumps_finding(text, k, t, L):\n frequent_patterns = []\n clumps = [0 for i in range(0, 4**k)]\n first_subtext = text[:L]\n freq_array = compute_freq(first_subtext, k)\n for index, freq in enumerate(freq_array):\n if freq >= t:\n clumps[index] = 1\n for i in range(1, ... | [
"0.7552866",
"0.677585",
"0.67337894",
"0.6654941",
"0.6105251",
"0.6030954",
"0.60170376",
"0.5999396",
"0.59586275",
"0.5862602",
"0.5852816",
"0.5745339",
"0.56893045",
"0.5677121",
"0.56442255",
"0.56434375",
"0.56361",
"0.5556229",
"0.54699785",
"0.5458053",
"0.54559916"... | 0.7205846 | 1 |
Function turns off agent learning. | def turn_off_learning(self):
self.epsilon = 0
self.alpha = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self._lj.deactivate_load(self._index)",
"def turn_off(self):\n self.robot.stop_simulation()",
"def lightning_turnoff(self):\n self.turnOff()",
"def stopThinking(self):\n self._brain.setState(\"controlled\")",
"def turn_off(self, **kwargs) -> None:... | [
"0.6700129",
"0.66529197",
"0.66521186",
"0.64668",
"0.63781226",
"0.6372063",
"0.633508",
"0.62015146",
"0.61315125",
"0.6131017",
"0.6021157",
"0.60110766",
"0.59882134",
"0.5959574",
"0.5944202",
"0.59188724",
"0.5908109",
"0.58830976",
"0.5879937",
"0.5866597",
"0.5862716... | 0.7653259 | 0 |
Transforms a course run into our normalized data structure | def _transform_run(course_run):
return {
"run_id": course_run["courseware_id"],
"title": course_run["title"],
"start_date": _parse_datetime(course_run["start_date"]),
"end_date": _parse_datetime(course_run["end_date"]),
"enrollment_start": _parse_datetime(course_run["enrollme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reformat_course(courses):\n\n if isinstance(courses, Courses): # if it's just one course object\n reformatted_data = {\n 'startDate': reformat_date(courses.startDate),\n 'organizingMeetingDate': reformat_date(courses.organizingMeetingDate),\n 'startTime': reformat_ti... | [
"0.6545898",
"0.65071106",
"0.6343304",
"0.6102301",
"0.5970706",
"0.5895119",
"0.5769776",
"0.5554748",
"0.5535331",
"0.5529821",
"0.5447787",
"0.5391927",
"0.535386",
"0.5326052",
"0.52869093",
"0.5249625",
"0.5244551",
"0.5226693",
"0.5220069",
"0.5220069",
"0.5208763",
... | 0.6969037 | 0 |
Transforms a list of courses into our normalized data structure | def transform_courses(courses):
return [_transform_learning_resource_course(course) for course in courses] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reformat_course(courses):\n\n if isinstance(courses, Courses): # if it's just one course object\n reformatted_data = {\n 'startDate': reformat_date(courses.startDate),\n 'organizingMeetingDate': reformat_date(courses.organizingMeetingDate),\n 'startTime': reformat_ti... | [
"0.7081613",
"0.6395153",
"0.6332284",
"0.62050134",
"0.6196131",
"0.60946196",
"0.60392576",
"0.6026868",
"0.5937411",
"0.59108996",
"0.57097995",
"0.56979233",
"0.56891394",
"0.5687594",
"0.5673657",
"0.56333023",
"0.561568",
"0.5600831",
"0.5598359",
"0.5592875",
"0.557165... | 0.786374 | 0 |
Read through the text file to retrieve each word and its embedding. If a word starts with an alphabetic character, create a WordEmbedding object for that word and its embedding and insert it in its proper place in the BTree. | def buildBTree(T, file):
for line in file:
word_line = line.split(' ')
word = word_line[0]
embedding = word_line[1:]
embedding = [float(i) for i in embedding]
if word[0].isalpha():
word_emb_object = WordEmbedding.WordEmbedding(word, embedding)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_from_text(self, file_name):\n with open(file_name, 'r') as reader:\n words_list = []\n for line in reader:\n words_list.extend(line.split())\n\n for word in set(words_list):\n if word.isalpha():\n self.insert_word(... | [
"0.6896994",
"0.6556667",
"0.6526634",
"0.6506346",
"0.65016085",
"0.6407096",
"0.6287741",
"0.62576973",
"0.62347907",
"0.62207425",
"0.62117535",
"0.6209658",
"0.6187981",
"0.6147249",
"0.61393017",
"0.61357147",
"0.61202615",
"0.607361",
"0.6070773",
"0.6067271",
"0.606658... | 0.79228294 | 0 |
If k, a word string, is in the BTree, determine the value of c, such that k must be in the subtree T.child[c]. This function helps search a word in the BTree by comparing it to the word in each WordEmbedding object in the node. | def findChildB(T,k):
for i in range(len(T.data)):
if k < T.data[i].word:
return i
return len(T.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(T,k):\r\n for t in T.data:\r\n if k == t.word:\r\n return t\r\n if T.isLeaf:\r\n return None\r\n return search(T.child[findChildB(T,k)],k)",
"def search(self, word):\n node = self.root\n for i in word:\n if i not in node.children:\n ... | [
"0.7309766",
"0.6948749",
"0.6895554",
"0.6835559",
"0.6707002",
"0.664024",
"0.6602095",
"0.6581776",
"0.64997524",
"0.6494112",
"0.6449155",
"0.64359915",
"0.6392801",
"0.6356252",
"0.6351559",
"0.63251305",
"0.6320364",
"0.62917066",
"0.62825304",
"0.62693983",
"0.6267385"... | 0.70231426 | 1 |
Return the WordEmbedding object from the node where k, a word string, is found in the BTree. If k is not in the tree, return None. | def search(T,k):
for t in T.data:
if k == t.word:
return t
if T.isLeaf:
return None
return search(T.child[findChildB(T,k)],k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, word):\n node = self.root\n for i in word:\n if i not in node.children:\n return False\n node = node.children[i]\n return node.word",
"def search(self, word):\n node = self.root\n for letter in word:\n if letter n... | [
"0.6154507",
"0.6151499",
"0.61069804",
"0.6043727",
"0.59671444",
"0.5961432",
"0.59472084",
"0.5831675",
"0.5821121",
"0.5751776",
"0.57412803",
"0.5738347",
"0.5738347",
"0.57238066",
"0.5716013",
"0.568632",
"0.564064",
"0.56310326",
"0.56223166",
"0.55864",
"0.55842125",... | 0.6870404 | 0 |
Traverse through the entire BTree to calculate the number of nodes it has. | def numNodes(T):
n = 1
if T.isLeaf:
return n
for i in range(len(T.child)):
n += numNodes(T.child[i])
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_nodes(self):\n if self.children is None:\n return 0\n\n total_count = 0\n for child in self.children:\n if child is None:\n return 0\n child_count = child.count_nodes()\n total_count = total_count + child_count\n\n ret... | [
"0.8126878",
"0.78849125",
"0.7833212",
"0.78316116",
"0.7772799",
"0.77459306",
"0.77308065",
"0.7716238",
"0.7689622",
"0.7682001",
"0.767653",
"0.76338",
"0.74925274",
"0.7490429",
"0.7453843",
"0.73934203",
"0.7377626",
"0.7375549",
"0.73751295",
"0.73481226",
"0.7330711"... | 0.8063285 | 1 |
Traverse through a single path of the BTree (from the root to a single leaf) to calculate its height. | def height(T):
if T.isLeaf:
return 0
return 1 + height(T.child[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self) -> int:\n # binary search tree == empty\n if self.root is None:\n return -1\n\n #count number\n return self.height_helper(self.root)",
"def get_height(self):\n def _get_height(node, height=None):\n if not height:\n height = ... | [
"0.74219936",
"0.7287904",
"0.7255695",
"0.72408116",
"0.7225057",
"0.7186698",
"0.71231264",
"0.71046185",
"0.7073362",
"0.7036825",
"0.70221025",
"0.7013034",
"0.6988873",
"0.69887346",
"0.69838744",
"0.6982113",
"0.6974794",
"0.69711584",
"0.6967295",
"0.6943627",
"0.69403... | 0.74674815 | 0 |
Function that responsible for the iteration over the events returned from github api | def _iter_events(self) -> Generator:
response = self.client.call()
events: list = response.json()
if not events:
return []
while True:
yield events
last = events.pop()
self.client.set_next_run_filter(last['@timestamp'])
respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def events(self) -> Iterable[Event]:",
"def get_events(self):\n\n url = '/v2.4/'+self.page_id+'/events'\n data = self.graph.request(url)\n\n while 'next' in data['paging'].keys():\n print data['paging']['next']\n data = self.graph.request(url, args={\n ... | [
"0.6768615",
"0.65579355",
"0.6553018",
"0.65295124",
"0.6510908",
"0.64643663",
"0.6447313",
"0.644498",
"0.6408641",
"0.63940495",
"0.6309841",
"0.6309484",
"0.62193006",
"0.61751413",
"0.6155901",
"0.61337835",
"0.6118683",
"0.6114953",
"0.6112544",
"0.6086963",
"0.6077831... | 0.7243678 | 0 |
take a string and change all "a" in string to 1, "e" in to 2, "i" into 3, "o" into 4, "u" into 5 str > str | def modify(str1):
str2 = ""
for char in str1.lower():
if char == "a":
str2 += "1"
elif char == "e":
str2 += "2"
elif char == "i":
str2 += "3"
elif char == "o":
str2 += "4"
elif char == "u":
str2 += "5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task18_letter_replacement(text):\n if text and isinstance(text, str):\n new_text = []\n for char in text:\n new_char_index = ascii_lowercase.index(char) + 1\n new_char = ascii_lowercase[new_char_index]\n if new_char in 'aeiou':\n new_char = new_c... | [
"0.6553749",
"0.64673",
"0.6436828",
"0.64264154",
"0.64101595",
"0.6340406",
"0.6326642",
"0.6203122",
"0.60958964",
"0.6075187",
"0.6053977",
"0.6053486",
"0.60463107",
"0.5976479",
"0.5946494",
"0.58518916",
"0.5837796",
"0.5811565",
"0.58044684",
"0.5779137",
"0.57752246"... | 0.79044306 | 0 |
Test case for create_response_descriptor_subscriptions_subscription_subscription_resource | def test_create_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource(sel... | [
"0.87412554",
"0.8588088",
"0.83379585",
"0.82308966",
"0.7775794",
"0.7608592",
"0.7605677",
"0.75500727",
"0.7347543",
"0.7300998",
"0.7060672",
"0.70161843",
"0.69488347",
"0.69302607",
"0.6744745",
"0.6676874",
"0.66014934",
"0.65724623",
"0.64912724",
"0.6457783",
"0.640... | 0.94596004 | 0 |
Test case for create_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_create_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_index_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resour... | [
"0.87898076",
"0.84957993",
"0.84469354",
"0.8135916",
"0.8024415",
"0.75330555",
"0.74872947",
"0.72072065",
"0.7170737",
"0.7123899",
"0.7024082",
"0.6879563",
"0.68744624",
"0.66875726",
"0.6547886",
"0.6496468",
"0.6405576",
"0.62375563",
"0.62205213",
"0.62015754",
"0.61... | 0.94430006 | 0 |
Test case for delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource | def test_delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_delete_subscription(self):\n pass",
"def test_issue_delete_subscription(self):\n pass",
"def test_delete_subscription_template(self):\n pass",
"def... | [
"0.88532954",
"0.7841728",
"0.7416214",
"0.73064417",
"0.71716964",
"0.6985787",
"0.69727606",
"0.6864229",
"0.66472006",
"0.6516905",
"0.647116",
"0.64189106",
"0.63475853",
"0.6346618",
"0.6203117",
"0.6197093",
"0.61706185",
"0.6137428",
"0.6111354",
"0.60975397",
"0.60881... | 0.9524074 | 0 |
Test case for delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_on_background_response_descriptor_projects_release_release_resource_spaces(self):\n pass",
"def test_delete_on_background_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_delete_on_background_response_descriptor_variables_library_varia... | [
"0.8165313",
"0.8090574",
"0.7151934",
"0.7094335",
"0.7016619",
"0.677698",
"0.6688813",
"0.6620941",
"0.66099346",
"0.6475584",
"0.6383104",
"0.6330714",
"0.62470895",
"0.6236102",
"0.61197543",
"0.61036897",
"0.59046084",
"0.58654064",
"0.58646995",
"0.5852549",
"0.5819268... | 0.9390268 | 0 |
Test case for index_response_descriptor_subscriptions_subscription_subscription_resource | def test_index_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource(self):\n ... | [
"0.89304525",
"0.88660175",
"0.863393",
"0.83659315",
"0.82808524",
"0.79980975",
"0.78439623",
"0.767982",
"0.7596332",
"0.73273385",
"0.72785175",
"0.72358495",
"0.71355075",
"0.708252",
"0.70700455",
"0.699588",
"0.6935531",
"0.6835491",
"0.68049234",
"0.6770686",
"0.67343... | 0.94264156 | 0 |
Test case for index_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_index_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resou... | [
"0.87763214",
"0.87645346",
"0.86041075",
"0.8510752",
"0.7778567",
"0.73008937",
"0.726181",
"0.724671",
"0.7137913",
"0.7121906",
"0.696909",
"0.69145846",
"0.68500614",
"0.6792931",
"0.6701232",
"0.66211265",
"0.64530164",
"0.6076274",
"0.6062893",
"0.60609174",
"0.6055377... | 0.9353701 | 0 |
Test case for list_all_response_descriptor_subscriptions_subscription_subscription_resource | def test_list_all_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_all_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource(s... | [
"0.8672392",
"0.80634016",
"0.7963346",
"0.79525554",
"0.7950173",
"0.762874",
"0.75751597",
"0.75354266",
"0.75185573",
"0.7085981",
"0.7015135",
"0.6927433",
"0.6609123",
"0.6608625",
"0.65717506",
"0.64721626",
"0.6449704",
"0.6410992",
"0.6408065",
"0.63710225",
"0.632791... | 0.94718015 | 0 |
Test case for list_all_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_list_all_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resour... | [
"0.84293175",
"0.8371931",
"0.82569367",
"0.8224417",
"0.7847217",
"0.7219924",
"0.6882947",
"0.6615695",
"0.65908223",
"0.6537668",
"0.65073764",
"0.6463803",
"0.6305704",
"0.62535024",
"0.61962706",
"0.61595654",
"0.6100827",
"0.60608906",
"0.5947366",
"0.5946404",
"0.58986... | 0.9376608 | 0 |
Test case for load_response_descriptor_subscriptions_subscription_subscription_resource | def test_load_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource(sel... | [
"0.8565985",
"0.8484611",
"0.841637",
"0.80878854",
"0.7847351",
"0.77231085",
"0.7458851",
"0.7193779",
"0.70314056",
"0.69356346",
"0.6887608",
"0.67824644",
"0.65065",
"0.63490146",
"0.6303993",
"0.6292917",
"0.6265991",
"0.6260562",
"0.62523186",
"0.6239016",
"0.61835974"... | 0.94681466 | 0 |
Test case for load_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_load_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_index_response_descriptor_subscriptions_subscription_subscription_reso... | [
"0.8682473",
"0.85453385",
"0.84766823",
"0.83558804",
"0.81268406",
"0.7312639",
"0.7308806",
"0.7230002",
"0.71687704",
"0.7120318",
"0.70175415",
"0.69992745",
"0.6867542",
"0.6661521",
"0.6638656",
"0.6579834",
"0.6508864",
"0.6475547",
"0.64672554",
"0.6386832",
"0.63598... | 0.94706297 | 0 |
Test case for modify_response_descriptor_subscriptions_subscription_subscription_resource | def test_modify_response_descriptor_subscriptions_subscription_subscription_resource(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resource(sel... | [
"0.8563571",
"0.84658855",
"0.8058546",
"0.80224764",
"0.7713785",
"0.75516945",
"0.7453322",
"0.7192042",
"0.71334755",
"0.71012443",
"0.70175844",
"0.7000383",
"0.6748506",
"0.6710934",
"0.6697179",
"0.66575694",
"0.66456854",
"0.6641054",
"0.6612385",
"0.6570631",
"0.65649... | 0.9448674 | 0 |
Test case for modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces | def test_modify_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_index_response_descriptor_subscriptions_subscription_subscription_resource_spaces(self):\n pass",
"def test_load_response_descriptor_subscriptions_subscription_subscription_resour... | [
"0.87181616",
"0.8456382",
"0.83001345",
"0.8015579",
"0.7987088",
"0.76178694",
"0.7296327",
"0.72865313",
"0.71541685",
"0.69881696",
"0.69022465",
"0.69001484",
"0.6717512",
"0.6682169",
"0.6617533",
"0.66076016",
"0.6596086",
"0.6362363",
"0.63535696",
"0.629757",
"0.6274... | 0.9437597 | 0 |
Returns country by location name. May raise LocationNotFound and LocationReplacement | def country(name):
return location_db().find(name=name)["country"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_country_name(df, location):\n d = df[df.location == location]\n return d.country.values[0]",
"def get_country_code(country_name):\n # worldmap_chart = pygal.maps.world.World()\n # for code, name in worldmap_chart:\n\n for code, name in i18n.COUNTRIES:\n\n # for code, name in COUNTRIES.i... | [
"0.6946081",
"0.6925547",
"0.689955",
"0.6889994",
"0.68031585",
"0.67772377",
"0.6711055",
"0.66826653",
"0.6602543",
"0.65752983",
"0.6561224",
"0.6550494",
"0.6543176",
"0.65219474",
"0.6404109",
"0.63928",
"0.6388106",
"0.63348466",
"0.63323516",
"0.6282033",
"0.62559354"... | 0.8324526 | 0 |
Returns continent by either location name or country. May raise LocationNotFound and LocationReplacement | def continent(name=None):
ldb = location_db()
try:
return ldb.find_continent(country=name)
except LocationNotFound:
return ldb.find_continent(country=ldb.find(name=name)["country"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_continent(country_code):\r\n for c in continents:\r\n if c.contains(country_code):\r\n return c\r\n plog(\"INFO\", country_code + \" is not on any continent\")\r\n return None",
"def country(name):\n return location_db().find(name=name)[\"country\"]",
"def continent(self) -> Optional[str]... | [
"0.7018489",
"0.6839589",
"0.64475894",
"0.64172214",
"0.6319791",
"0.6041361",
"0.6034119",
"0.6031853",
"0.5983774",
"0.59171104",
"0.58586824",
"0.5858009",
"0.583927",
"0.58281827",
"0.57834524",
"0.5782462",
"0.571797",
"0.5714907",
"0.57142687",
"0.5703324",
"0.56661636... | 0.8362245 | 0 |
Check if every "locations" entry has corresponding "names" entry | def check(self):
missing = []
for name in self.data["locations"]:
try:
n = self.data["names"][name]
except KeyError:
missing.append(name)
if missing:
raise RuntimeError("\"names\" list lacks:\n " + "\n ".join(missing)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_names(sections):\n return _check_nentries(sections, \"NAMES\", \"NAMES\")",
"def check_glyph_name_in_glyph_set(self, *names):\n if self.glyphNames_:\n for name in names:\n if name in self.glyphNames_:\n continue\n if name not in self... | [
"0.6193882",
"0.6053967",
"0.5882687",
"0.56852156",
"0.5643407",
"0.5642069",
"0.56396973",
"0.56266916",
"0.5610263",
"0.55818754",
"0.55551094",
"0.5553078",
"0.55146766",
"0.54917747",
"0.54744285",
"0.5434682",
"0.54326814",
"0.54243636",
"0.54195035",
"0.5419454",
"0.53... | 0.68714684 | 0 |
Forwards data migration. Remove all the externalaccounts for GitHub, GTalk, Verbatim and Locamotion. | def forwards(apps, schema_editor):
ExternalAccount = apps.get_model('users', 'ExternalAccount')
ExternalAccount.objects.filter(type='GITHUB').delete()
ExternalAccount.objects.filter(type='GTALK').delete()
ExternalAccount.objects.filter(type='MOZILLALOCAMOTION').delete()
ExternalAccount.objects.filte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backwards(apps, schema_editor):\n Referral = apps.get_model(\"core\", \"Referral\")\n\n for referral in Referral.objects.all():\n referral.users.clear()\n referral.save()",
"def remove_accounts(self):\n current_creds = self._accounts.copy()\n for creds in current_creds:\n ... | [
"0.5843353",
"0.5682453",
"0.56551605",
"0.56420624",
"0.56205434",
"0.56109786",
"0.5578443",
"0.55584943",
"0.5549693",
"0.5548861",
"0.5527124",
"0.55008894",
"0.5484804",
"0.544788",
"0.54415023",
"0.5434805",
"0.54217434",
"0.5392795",
"0.53572905",
"0.5342952",
"0.53320... | 0.70499516 | 0 |
Copy the static resources. | def copy_static_resources(self):
if not hasattr(settings, 'STATIC_ROOT'):
raise MissingStaticRoot()
destination = os.path.join(STORAGE_PATH, 'static')
if os.path.exists(destination):
shutil.rmtree(destination)
shutil.copytree(settings.STATIC_ROOT, destination) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_static(self, outdir):\n pass",
"def copy_static(root_directory, dist_directory, sdk_directory):\n\n for static in configuration.STATICS:\n context = {\n \"root\": root_directory,\n \"sdk\": sdk_directory,\n \"dist\": dist_directory\n }\n\n ... | [
"0.7872584",
"0.7281044",
"0.69176215",
"0.63669395",
"0.6302897",
"0.62768185",
"0.6248703",
"0.6242949",
"0.62096953",
"0.6190306",
"0.6170092",
"0.6154144",
"0.61512166",
"0.61467654",
"0.6134342",
"0.60023135",
"0.5979792",
"0.59327734",
"0.5929581",
"0.59114957",
"0.5895... | 0.8223046 | 0 |
Test for privacy policy view | def test_1_privacy(self):
response = self.client.get(reverse('privacy-policy'), follow=True)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_viewPrivacyPolicyPage(self):\r\n print('========================================================================')\r\n print('Test for check redirect on PrivacyPolicy page after link PrivacyPolicy click')\r\n #Load Registrtion page\r\n self.reg_page.open_registration_page()\r\n... | [
"0.65826833",
"0.65698117",
"0.64647794",
"0.6331653",
"0.6287771",
"0.623985",
"0.6236848",
"0.61535543",
"0.61415833",
"0.61177397",
"0.61074257",
"0.61072975",
"0.60979134",
"0.6084352",
"0.6076933",
"0.6038657",
"0.60216844",
"0.60195696",
"0.60150224",
"0.6006013",
"0.59... | 0.7331623 | 0 |
Test case for group required decorator | def test_5_group_required(self):
user = User.objects.get(email=data_user['email'])
self.factory = RequestFactory()
@group_required('default')
def test(request):
return 200
request = self.factory.get('/foo')
request.user = user
response = test(request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_required(*groups):\n\n def decorator(func):\n @wraps(func)\n def check_auth(*args, **kwargs):\n check_user_group(*groups)\n return func (*args, **kwargs)\n return check_auth\n return decorator",
"def test_2_group_required(self):\n func = base_view... | [
"0.6848307",
"0.6808511",
"0.67380023",
"0.67380023",
"0.66136533",
"0.6525565",
"0.64716965",
"0.64529186",
"0.642777",
"0.63977575",
"0.63896275",
"0.6355148",
"0.6331094",
"0.62882537",
"0.62863505",
"0.625996",
"0.62579274",
"0.6232457",
"0.6173068",
"0.6173068",
"0.61695... | 0.683177 | 1 |
metaDataInputAvailable(inputType, inputKey) Return true if inputType with inputKey is available. | def metaDataInputAvailable(inputType, inputKey):
# Check if it is on metadata:
# FIXME How can I do that using objKeyStore??
flag = False
from RecExConfig.InputFilePeeker import inputFileSummary
metaItemList=inputFileSummary.get('metadata_itemsList')
if ( '%s#%s' % (inputType, inputKey) ) in metaItemList:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_key_input(self, name: str) -> bool:\n return (\n self.allow_dynamic\n and self.dynamic_inputs\n and bool(self.dynamic_inputs.get(name, False))\n )",
"def has_input(self, input_ref):\n inputs = self.get_recipe_inputs()\n for (input_role_name, inp... | [
"0.60552776",
"0.5587217",
"0.55770856",
"0.54691964",
"0.5453386",
"0.54281676",
"0.53389907",
"0.5317259",
"0.5309723",
"0.5181332",
"0.5121032",
"0.51012117",
"0.50994945",
"0.5076581",
"0.5036891",
"0.50252545",
"0.49921212",
"0.49809375",
"0.4978585",
"0.49596685",
"0.49... | 0.8558229 | 0 |
Test creation and deletion of tables. | def test_create(self):
cursor = connection.cursor()
# It needs to take at least 2 args
self.assertRaises(TypeError, db.create_table)
self.assertRaises(TypeError, db.create_table, "test1")
# Empty tables (i.e. no columns) are not fine, so make at least 1
db.create_table("t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_tables(self):\n conn_object = ParentConnection()\n conn_object.create_tables()\n conn = psycopg2.connect(**{\"host\": \"localhost\",\n \"database\": \"test\",\n \"user\": \"test\",\n ... | [
"0.79065996",
"0.76564527",
"0.76478964",
"0.7574287",
"0.75223595",
"0.7512179",
"0.750431",
"0.7431251",
"0.73941386",
"0.73464495",
"0.72949237",
"0.7286949",
"0.7275599",
"0.71517336",
"0.70496744",
"0.7047443",
"0.7015091",
"0.7015091",
"0.70136803",
"0.6993084",
"0.6986... | 0.802963 | 0 |
Span/RBW ratio {1, 10000} | def span_rbw_ratio(self):
res = self._visa.query(f"SENSE{self._screen()}:BANDWIDTH:RESOLUTION:RATIO?")
return 1 / float(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adv_ratio(self): # XXX\r\n bw = StatsRouter.global_bw_mean\r\n if bw == 0.0: return 0\r\n else: return self.bw/bw",
"def golden_ratio():\n return 1.61803398875",
"def rbw_vbw_ratio(self):\r\n res = self._visa.query(f\"SENSE{self._screen()}:BANDWIDTH:VIDEO:RATIO?\")\r\n return 1 / ... | [
"0.67297596",
"0.65892833",
"0.6565979",
"0.64761853",
"0.64374167",
"0.62121385",
"0.61042845",
"0.6101944",
"0.60885817",
"0.6046705",
"0.595288",
"0.58912903",
"0.5881694",
"0.5870998",
"0.5861205",
"0.5819621",
"0.58036536",
"0.57961994",
"0.57926303",
"0.5792179",
"0.578... | 0.7564076 | 0 |
RBW/Video BW ratio {0.001, 100} | def rbw_vbw_ratio(self):
res = self._visa.query(f"SENSE{self._screen()}:BANDWIDTH:VIDEO:RATIO?")
return 1 / float(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def span_rbw_ratio(self):\r\n res = self._visa.query(f\"SENSE{self._screen()}:BANDWIDTH:RESOLUTION:RATIO?\")\r\n return 1 / float(res)",
"def bw_ratio(self):\r\n bw = self.bwstats.mean\r\n if bw == 0.0: return 0\r\n else: return self.bw/(1024.*bw)",
"def strm_bw_ratio(self):\r\n bw = ... | [
"0.78411186",
"0.74527633",
"0.7150638",
"0.7007005",
"0.6494074",
"0.6219985",
"0.6060733",
"0.6012118",
"0.59977496",
"0.5925012",
"0.58851236",
"0.57970375",
"0.5781342",
"0.57797515",
"0.5775451",
"0.57096577",
"0.56438977",
"0.56283444",
"0.56279147",
"0.5622818",
"0.561... | 0.825476 | 0 |
Test if create_knxipframe of base class raises an exception. | async def test_create_knxipframe_err(self):
xknx = XKNX()
udp_client = UDPClient(xknx, ("192.168.1.1", 0), ("192.168.1.2", 1234))
request_response = RequestResponse(xknx, udp_client, DisconnectResponse)
request_response.timeout_in_seconds = 0
with self.assertRaises(NotImplemente... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wrong_init(self):\n xknx = XKNX()\n knxipframe = KNXIPFrame(xknx)\n with pytest.raises(AttributeError):\n knxipframe.init(23)\n\n with pytest.raises(CouldNotParseKNXIP):\n # this is not yet implemented in xknx\n knxipframe.init(KNXIPServiceType.... | [
"0.7100994",
"0.7027083",
"0.62036103",
"0.5987994",
"0.592371",
"0.58385265",
"0.58301014",
"0.5805744",
"0.5727015",
"0.57116526",
"0.5697945",
"0.567965",
"0.56382775",
"0.563067",
"0.55982566",
"0.5557917",
"0.5549329",
"0.55488443",
"0.5522948",
"0.552107",
"0.5519002",
... | 0.71374136 | 0 |
Create an event on the given group. | def create_event(self, event):
body = event['body']
body = json.loads(body)
# Check all required fields are here
required_fields = ['group_id', 'event_timestamp', 'location']
for f in required_fields:
if f not in body:
return get_bad_request('POST bod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_group(self, group):\n for obj in self.event_json['events']:\n event_id = obj['id']\n event = self.world.events[event_id]\n group.add(event)",
"def create_new_event(self):\n pass",
"async def createEvent(self, event: Event) -> None:",
"def create_group(... | [
"0.6895084",
"0.66228145",
"0.6554237",
"0.6434908",
"0.6398888",
"0.63672704",
"0.6261991",
"0.6242804",
"0.61714673",
"0.6137939",
"0.6128037",
"0.6087527",
"0.6084018",
"0.60555893",
"0.6049443",
"0.6049443",
"0.6021393",
"0.602137",
"0.60209566",
"0.6020377",
"0.6008337",... | 0.67467535 | 1 |
Get the email addresses collected between startdate and enddate. | def get_email_addresses(survey, startdatetime, enddatetime):
token = settings.SURVEYGIZMO_API_TOKEN
secret = settings.SURVEYGIZMO_API_TOKEN_SECRET
emails = []
page = 1
more_pages = True
survey_id = SURVEYS[survey]["email_collection_survey_id"]
dtfmt = "%Y-%m-%d+%H:%M:%S"
# Can't do anyt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_email_addresses(startdate, enddate, user, password):\n emails = []\n page = 1\n more_pages = True\n\n while more_pages:\n response = requests.get(\n 'https://restapi.surveygizmo.com/v2/survey/{survey}'\n '/surveyresponse?'\n 'filter[field][0]=datesubmitte... | [
"0.77688205",
"0.63319296",
"0.6218386",
"0.6051792",
"0.6028005",
"0.59827083",
"0.59140414",
"0.5900727",
"0.58886105",
"0.5846171",
"0.5838072",
"0.5797754",
"0.57617724",
"0.57513386",
"0.5745859",
"0.5739336",
"0.5732516",
"0.5727422",
"0.5705582",
"0.5703198",
"0.568806... | 0.73141956 | 1 |
Add email to the exit survey campaign. | def add_email_to_campaign(survey, email):
token = settings.SURVEYGIZMO_API_TOKEN
secret = settings.SURVEYGIZMO_API_TOKEN_SECRET
if token is None or secret is None:
return
survey_id = SURVEYS[survey]["exit_survey_id"]
campaign_id = SURVEYS[survey]["exit_survey_campaign_id"]
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reminder_emails_opt_out(self, reminder_emails_opt_out):\n\n self._reminder_emails_opt_out = reminder_emails_opt_out",
"def email(args):\n if args.name:\n add_user(name=args.name, email_address=args.email)\n\n if args.add_term:\n Feed(Config.database).add_search_term(email_address=a... | [
"0.5716118",
"0.5541047",
"0.5525604",
"0.5408878",
"0.540882",
"0.53971654",
"0.53807753",
"0.5330207",
"0.525575",
"0.525575",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5244311",
"0.5234358",
"0... | 0.65830237 | 0 |
Collect and aggregate the exit survey results for the date. | def get_exit_survey_results(survey, date):
token = settings.SURVEYGIZMO_API_TOKEN
secret = settings.SURVEYGIZMO_API_TOKEN_SECRET
answers = []
page = 1
more_pages = True
survey_id = SURVEYS[survey]["exit_survey_id"]
# Aggregate results.
summary = {
"yes": 0,
"no": 0,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate_results(self):\n\n raise NotImplementedError",
"def clean_cases(data):\n newdata=[]\n #Add up Bucks Data\n bucks=defaultdict(list)\n for i in data:\n if i['areaName'] in ['Chiltern','Aylesbury Vale','South Bucks','Wycombe']:\n bucks[i['date']].append(i)\n ... | [
"0.5402203",
"0.5367766",
"0.5359192",
"0.524809",
"0.5185131",
"0.51527995",
"0.51476175",
"0.5144919",
"0.51337653",
"0.5064276",
"0.50609916",
"0.5050773",
"0.49764916",
"0.496732",
"0.493797",
"0.49316752",
"0.49218276",
"0.48943838",
"0.48835677",
"0.48830566",
"0.486850... | 0.753436 | 0 |
1. Check each peer's genesis block 2. Generate new blocks on each peer 2.1. 2 blocks on peer 1 2.2. 4 blocks on peer 2 2.3. 2 blocks on peer 3 3. Connect peers 3.1. peer 1 with 2 (1>2) 3.2. peer 1 with 3 (1>(2 and 3)) 4. Generate new blocks 4.1. 3 blocks on peer 1 4.2. 5 blocks on peer 3 5. Stop all peers | def scenario():
LOCAL_HOST = "http://127.0.0.1"
# import functions
from . import genesis_block
from . import create_block
from . import connect_peer
from . import stop_server
from . import block_crosscheck
total_cnt = 0
pass_cnt = 0
# 1. Check each peer's genesis block
try... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_single_chain(self):\n self.assertEqual(len(self.genesis_blocks), 1)\n manager = self.create_peer('testnet', tx_storage=self.tx_storage)\n\n # The initial score is the sum of the genesis\n score = self.genesis_blocks[0].weight\n for tx in self.genesis_txs:\n sc... | [
"0.6776859",
"0.6663315",
"0.6528965",
"0.62487274",
"0.61456776",
"0.6103467",
"0.6063264",
"0.59577507",
"0.5954555",
"0.59345937",
"0.587696",
"0.57966447",
"0.5755227",
"0.56951505",
"0.5683918",
"0.5678262",
"0.5678262",
"0.5674126",
"0.5667841",
"0.5650196",
"0.56408125... | 0.7098296 | 0 |
It's common to forget to initialize your variables to the same values, or (less commonly) if you update them in some other way than adam, to get them out of sync. This function checks that variables on all MPI workers are the same, and raises an AssertionError otherwise | def check_synced(localval, comm=None):
comm = comm or MPI.COMM_WORLD
vals = comm.gather(localval)
if comm.rank == 0:
assert all(val==vals[0] for val in vals[1:]),\
'MpiAdamOptimizer detected that different workers have different weights: {}'.format(vals) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multiple_rng(self):\r\n rng1 = RandomStreams(1234)\r\n rng2 = RandomStreams(2392)\r\n assert rng1.random_state_variables is not rng2.random_state_variables",
"def init_consistent_qa_variables(self):\n return tuple()",
"def test_global():\n global_assumptions.add(x > 0)\n... | [
"0.59343547",
"0.59310293",
"0.5616036",
"0.5610274",
"0.55715793",
"0.55436534",
"0.55064803",
"0.5479019",
"0.5468771",
"0.5462085",
"0.5445539",
"0.54302627",
"0.54081",
"0.5398708",
"0.53432184",
"0.5342977",
"0.5330605",
"0.53292537",
"0.5326701",
"0.5321385",
"0.5313813... | 0.6958268 | 0 |
This function is used for create the nested dict. | def nested_dict():
try:
num_list = [1, 2, 3, 4]
new_dict = current = {}
for name in num_list:
current[name] = {}
current = current[name]
print(new_dict)
except ValueError as e:
logger.error("Not find the dictnary"+str(e)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dict(self, item, external_id=True, no_html=False, depth=1, optimize=False):\n if external_id:\n key_type = \"external_id\"\n else:\n key_type = \"field_id\"\n\n dictionary = dict([(field[key_type], {\"label\":field[\"label\"], \"type\": field[\"type\"], \"value\"... | [
"0.650134",
"0.64788336",
"0.62718195",
"0.62711304",
"0.62704086",
"0.6265792",
"0.6252099",
"0.6152929",
"0.60821116",
"0.606705",
"0.60655373",
"0.60154074",
"0.5973867",
"0.596138",
"0.5956204",
"0.59232026",
"0.59190255",
"0.58948386",
"0.58891314",
"0.58726054",
"0.5869... | 0.7117791 | 0 |
Parses attributes for given hosts, then checks if hosts are up and then calls path_check function with working hosts. | def ip_check():
hosts = []
valid_hosts = []
for item in sys.argv:
if '@' in item:
hosts.append(item)
for i in hosts:
host = i.split('@')[1].split(':')[0]
command = os.system('ping -c 1 '+host+' > /dev/null')
if command == 0:
valid_hosts.append(i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_check(hosts):\n local_files = []\n local_path = ''\n for item in sys.argv:\n if '–pass' in item:\n secret = item.split('=')[1].strip(\"'\")\n break\n else:\n secret = ''\n for item in sys.argv:\n if '/' in item and '@' not in item:\n ... | [
"0.5663521",
"0.5292894",
"0.52131265",
"0.51896125",
"0.51140106",
"0.51105917",
"0.5073687",
"0.5060623",
"0.50083005",
"0.499502",
"0.48528996",
"0.48389998",
"0.48383403",
"0.48131078",
"0.4779494",
"0.4760623",
"0.47501546",
"0.47221673",
"0.46816412",
"0.46804914",
"0.4... | 0.5357099 | 1 |
Finds all files or directories on remote machine, according to given attributes. | def find_remote_files(remote_path, type, ssh):
(ssh_in, ssh_out, ssh_err) = ssh.exec_command("find %s -name \"*\" -type %s" % (remote_path, type))
files = []
for file in ssh_out.readlines():
files.append(file.rstrip())
return files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_local_files(local_path, type):\n local_out = commands.getoutput(\"find %s -name \\\"*\\\" -type %s\" % (local_path, type))\n files = []\n for file in local_out.split(\"\\n\"):\n files.append(file)\n return files",
"def find_remote_files(product, date, channel, fs, mesoregion=None):\n ... | [
"0.57766545",
"0.55919",
"0.54436123",
"0.5392925",
"0.53435534",
"0.53391916",
"0.5281884",
"0.5257585",
"0.5255809",
"0.5195542",
"0.5191573",
"0.51889825",
"0.51854223",
"0.51667845",
"0.5155281",
"0.5135752",
"0.511923",
"0.5106351",
"0.5089739",
"0.50852174",
"0.5084342"... | 0.6770828 | 0 |
Finds all files or directories on local machine, according to given attributes. | def find_local_files(local_path, type):
local_out = commands.getoutput("find %s -name \"*\" -type %s" % (local_path, type))
files = []
for file in local_out.split("\n"):
files.append(file)
return files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(regex, paths, args, ignore_case=False, verbose=False):\n printer = MultiLinePrinter()\n for path in paths:\n if os.path.isdir(path):\n for dirname, subdirs, files in os.walk(path):\n for filename in files:\n if not KNOWN_TYPES or any([filename.en... | [
"0.6211064",
"0.6019969",
"0.5998675",
"0.5906028",
"0.57402915",
"0.5688038",
"0.5669542",
"0.5578637",
"0.5574477",
"0.55228025",
"0.5517279",
"0.54891247",
"0.5458164",
"0.5458164",
"0.54517686",
"0.5449568",
"0.54423726",
"0.54343617",
"0.5415774",
"0.54102737",
"0.537871... | 0.6285848 | 0 |
Show list of movies. | def movie_list():
movies = Movie.query.order_by(Movie.title).all()
return render_template("movie_list.html", movies=movies) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movie_list():\n\n movies = Movie.query.order_by(\"title asc\").all()\n return render_template(\"/movie_list.html\", movies=movies)",
"def movie_list():\n\n movies = Movie.query.order_by(Movie.movie_title).all()\n return render_template(\"movie_list.html\", movies=movies)",
"def list_movie():\n ... | [
"0.77884346",
"0.7738609",
"0.7738429",
"0.7603819",
"0.7459214",
"0.7193967",
"0.7042107",
"0.69520515",
"0.68291026",
"0.6809898",
"0.6801339",
"0.6761189",
"0.6752064",
"0.6726022",
"0.66703576",
"0.6598783",
"0.65832853",
"0.6565718",
"0.6530468",
"0.6495098",
"0.64667565... | 0.77881587 | 1 |
Show profile for given user. | def show_user_profile(user_id):
user = User.query.filter_by(user_id=user_id).first()
return render_template("user_profile.html", user=user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_user(user_id):\n\n user = User.query.get_or_404(user_id)\n return render_template('users/profile.html', user=user)",
"def show_user(user_id):\n\n user = crud.get_user_by_id(user_id)\n\n return render_template('user_profile.html', user = user)",
"def show_user():\n\n return render_templa... | [
"0.86739427",
"0.863889",
"0.837819",
"0.81853336",
"0.80494875",
"0.8038482",
"0.7862828",
"0.78580785",
"0.7854763",
"0.78532773",
"0.78529036",
"0.7844797",
"0.780445",
"0.777881",
"0.77440566",
"0.77238154",
"0.76296026",
"0.7587681",
"0.7576835",
"0.7576826",
"0.7546787"... | 0.86867446 | 0 |
Show profile for given movie. | def show_movie_profile(movie_id):
# movie object given a movie_id
movie = Movie.query.filter_by(movie_id=movie_id).first()
# list of all rating objects for a given movie_id ordered by user_id
sorted_ratings = Rating.query.filter_by(movie_id=movie_id).order_by('user_id').all()
return render_templa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_me_movie(movie_id):\n\n movie = crud.get_movie_by_id(movie_id)\n\n return render_template('movie_details.html', movie=movie)",
"def show_movie(movie_id):\n\n movie = crud.get_movie_by_id(movie_id)\n\n return render_template('movie_details.html', movie = movie)",
"def show_movie(movie_id):\... | [
"0.7126585",
"0.68741995",
"0.6854062",
"0.67303324",
"0.6346566",
"0.6204759",
"0.609547",
"0.5925734",
"0.58227336",
"0.5796495",
"0.57389706",
"0.5738439",
"0.57043684",
"0.57000756",
"0.5661391",
"0.5624544",
"0.56051505",
"0.5586314",
"0.5582274",
"0.5544493",
"0.5541237... | 0.7592274 | 0 |
Add or update movie rating | def add_movie_rating(movie_id):
rating = request.form.get("rating")
# Rating object from logged in user for movie on page
user_rating_query = Rating.query.filter(Rating.user_id == session["user_id"], Rating.movie_id == movie_id).first()
# Check to see if rating exists from logged in user
if user_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_movie_rating_record(movie_id, rating_number, operation):\n movie = models.Movie.objects.get(mid=movie_id)\n if operation == 'new':\n # Update the average_rating and votecount for the movie.\n movie.average_rating = (float(movie.average_rating) * float(movie.votecount) + rating_number... | [
"0.785876",
"0.73302704",
"0.7036317",
"0.6898909",
"0.6847553",
"0.6840464",
"0.68197745",
"0.68010294",
"0.6775351",
"0.6662615",
"0.6642418",
"0.6628332",
"0.64915556",
"0.648122",
"0.64792055",
"0.6477873",
"0.64777255",
"0.6424817",
"0.6379951",
"0.6375289",
"0.6370936",... | 0.7663322 | 1 |
Given a binary tree print the elements in a zig zag order | def zig_zag_traversal(root):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zigzak_using_bfs(root):\n current_level = [root]\n next_level = []\n while current_level:\n node = current_level.pop()\n print(node.data, end=\" \")\n if node.right:\n next_level.append(node.right)\n if node.left:\n next_level.append(node.left)\n ... | [
"0.72299",
"0.6941187",
"0.69075686",
"0.68050545",
"0.6722692",
"0.65757614",
"0.6556757",
"0.65556186",
"0.65556186",
"0.65482455",
"0.6534519",
"0.6528175",
"0.65199995",
"0.64702153",
"0.6451519",
"0.643972",
"0.64164495",
"0.6406407",
"0.63993025",
"0.63982576",
"0.63932... | 0.7660401 | 0 |
returns the plotting paramters like legend size, text font size, etc See the return object | def global_plotting_parameters():
dpi = 10
plotting_param_dict = {'dpi':dpi, 'axis_font':{'size': str(int(15*dpi))}, 'title_font':{'size': str(18*dpi)},
'legend_size':{'size': str(12*dpi)}, 'tick_size': 12*dpi, 'marker_size':100*3.5*dpi}
return plotting_param_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plot_params(self, ax=None):\n linewidth = 2\n size = 12\n\n # grid and ticks settings\n ax.minorticks_on()\n ax.grid(b=True, which='major', linestyle='--',\n linewidth=linewidth - 0.5)\n ax.grid(b=True, which='minor', axis='both',\n lines... | [
"0.68739355",
"0.6408702",
"0.63112503",
"0.62113756",
"0.60894156",
"0.6065956",
"0.60561585",
"0.5976915",
"0.5962896",
"0.59489775",
"0.5924714",
"0.5917014",
"0.5901491",
"0.5853274",
"0.5849428",
"0.5835417",
"0.5820773",
"0.57584924",
"0.5756284",
"0.5722286",
"0.571782... | 0.7657647 | 0 |
assuming centerline cells have two layers, this method returns the arrays of each layers and their global id corresponding to cell_cent | def separate_centrline_lyers_by_y_coordinates(cell_cent, centerline_cells):
cc4 = centerline_cells
y_uniq_coord = np.unique(cc4[:,1])
idx_lst = []
cent_Y_lyrs = []
for yy in y_uniq_coord:
cent_Y_lyrs_temp = centerline_cells[np.where(cc4[:,1] == yy)]
idx = np.where((cell_cent==cent_Y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getChipCoreAndCxId(layer):\n core_ids = []\n cx_ids = []\n chip_ids = []\n for id in layer.nodeIds:\n _, chip_id, core_id, cx_id, _, _ = layer.net.resourceMap.compartment(id)\n chip_ids.append(chip_id)\n core_ids.append(core_id)\n cx_ids.append(cx_id)\n return np.arra... | [
"0.61257327",
"0.59683406",
"0.58903646",
"0.57042927",
"0.5662886",
"0.5600567",
"0.5526157",
"0.5503083",
"0.5494525",
"0.54930544",
"0.5453292",
"0.54367805",
"0.54050046",
"0.53910154",
"0.53798836",
"0.5362105",
"0.53463304",
"0.5340941",
"0.5336969",
"0.532595",
"0.5325... | 0.61829495 | 0 |
Converts conditions file to dictionary | def read_conditions(filepath: str):
with open(filepath, 'r') as conditions_file:
conditions = {}
current_condition_name = line = conditions_file.readline().strip(
).lower()
current_condition_description = []
while line:
if line.startswith('"'):
cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_dictionary():\n\n return;",
"def __analyze_config(self):\n result = {}\n with open(self.file) as f:\n data = f.readlines()\n temp_key = ''\n for line in data:\n if line[0] == '\t' or line[0] == ';':\n result[temp_key].append(line.str... | [
"0.6218148",
"0.6155669",
"0.61423445",
"0.60241485",
"0.5845813",
"0.5743224",
"0.5733421",
"0.57185966",
"0.56938577",
"0.56828797",
"0.5660647",
"0.5644317",
"0.5610162",
"0.5609556",
"0.5590061",
"0.55852425",
"0.55422974",
"0.55337137",
"0.553299",
"0.550761",
"0.549093"... | 0.74447215 | 0 |
Determine if game is over | def is_game_over(cls):
cls.record_winner()
cls.record_tie() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isGameOver(self):\n pass",
"def game_over(self):\n self.over = True",
"def game_over(self) -> bool:\n return self.rstate.game_over()",
"def is_game_over(self):\r\n\r\n if self.winner != 0:\r\n return True\r\n\r\n return False",
"def is_game_over(self) -> bool:\n r... | [
"0.86978006",
"0.8201276",
"0.81808716",
"0.8180014",
"0.81176275",
"0.80931705",
"0.80865484",
"0.8077599",
"0.8070335",
"0.80282694",
"0.795851",
"0.792699",
"0.7911095",
"0.7853995",
"0.78158563",
"0.78106606",
"0.77769727",
"0.7745965",
"0.7730437",
"0.77171916",
"0.77127... | 0.8234252 | 1 |
Flip player from X to O and back | def flip_player(cls):
cls.current_player = 'X' if cls.current_player == 'O' else 'O'
cls.display_board()
cls.prompt_player() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_player():\n global current_player\n # If current player is 'X', then set current player to 'O'.\n if current_player == 'X':\n current_player = 'O'\n # If current player is 'O', then set current player to 'X'.\n elif current_player == 'O':\n current_player = 'X'",
"def flip(s... | [
"0.81298226",
"0.7432394",
"0.6961494",
"0.6864068",
"0.68307495",
"0.67842346",
"0.6708159",
"0.6708159",
"0.66889834",
"0.6668064",
"0.65996915",
"0.6585072",
"0.6548481",
"0.6457186",
"0.6447207",
"0.6433932",
"0.63997906",
"0.6399247",
"0.6390208",
"0.6349105",
"0.6340933... | 0.8289133 | 0 |
Store current column width to the class variable | def __store_column_width(self):
self.header_width = []
for i in range(0, self.view.header().count()):
self.header_width.append(self.view.columnWidth(i)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width(self):\n return self.col",
"def width(self, width):\n self.col += width",
"def width(self):\n\t\tpass",
"def set_column_width(self, index, width):\n self.colwid[index] = width",
"def get_column_width(self, index):\n return self.colwid[index]",
"def __set_column_width... | [
"0.7448393",
"0.7195969",
"0.6882216",
"0.6862825",
"0.68365276",
"0.67640996",
"0.6689337",
"0.6625792",
"0.66146314",
"0.65848327",
"0.6570916",
"0.6541092",
"0.6492291",
"0.6492291",
"0.6472699",
"0.6472699",
"0.64391994",
"0.64391994",
"0.6408329",
"0.6369815",
"0.6369815... | 0.73608655 | 1 |
The name of the world | def world_name(self) -> str:
return os.path.basename(self.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_world_name(self):\n dt = datetime.now()\n return f'onboarding_world_{dt.strftime(\"%H-%M-%S\")}'",
"def _getName(self):\n return 'HERE'",
"def name():\n pass",
"def name():\n pass",
"def getName():",
"def getName():",
"def getName():",
"def getName():",
"... | [
"0.7873946",
"0.71849513",
"0.716453",
"0.716453",
"0.69763964",
"0.69763964",
"0.69763964",
"0.69763964",
"0.69763964",
"0.69763964",
"0.697512",
"0.68596095",
"0.6833829",
"0.68063414",
"0.67995363",
"0.67995363",
"0.67995363",
"0.67995363",
"0.6779754",
"0.6778933",
"0.677... | 0.7815104 | 1 |
Get the options for a specific plugin. This will be the list of options that is registered and loaded by the specified plugin. | def get_plugin_options(name):
return get_plugin_loader(name).get_options() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options() -> List:\n return list(c.value for c in Plugin)",
"def list_plugin_options(request):\n options = {}\n options.update(plugin.get_plugin_options(request.matchdict['plugin']))\n options.update(plugin.get_plugin_vizoptions(request.matchdict['plugin']))\n return options",
"def get_o... | [
"0.79400194",
"0.7497427",
"0.7103521",
"0.70529085",
"0.70166826",
"0.6732522",
"0.6621489",
"0.6575808",
"0.6427052",
"0.64174426",
"0.6388949",
"0.6343626",
"0.6336009",
"0.6335064",
"0.6332171",
"0.6314137",
"0.6260486",
"0.62462914",
"0.6233066",
"0.6188137",
"0.6175025"... | 0.7943178 | 0 |
Create a plugin from the options available for the loader. Given the options that were specified by the loader create an appropriate plugin. You can override this function in your loader. This used to be specified by providing the plugin_class property and this is still supported, however specifying a property didn't l... | def create_plugin(self, **kwargs):
return self.plugin_class(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_options(self, **kwargs):\n missing_required = [o for o in self.get_options()\n if o.required and kwargs.get(o.dest) is None]\n\n if missing_required:\n raise exceptions.MissingRequiredOptions(missing_required)\n\n return self.create_plugin(**... | [
"0.71200705",
"0.6517006",
"0.5809091",
"0.5786941",
"0.5762168",
"0.5752947",
"0.5752947",
"0.573117",
"0.5687062",
"0.5669033",
"0.56606823",
"0.56198794",
"0.5616531",
"0.5590346",
"0.5573315",
"0.5566388",
"0.5536888",
"0.5531279",
"0.55006045",
"0.54732233",
"0.54677445"... | 0.74608773 | 0 |
Create a plugin from the arguments retrieved from get_options. A client can override this function to do argument validation or to handle differences between the registered options and what is required to create the plugin. | def load_from_options(self, **kwargs):
missing_required = [o for o in self.get_options()
if o.required and kwargs.get(o.dest) is None]
if missing_required:
raise exceptions.MissingRequiredOptions(missing_required)
return self.create_plugin(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_plugin(self, **kwargs):\n return self.plugin_class(**kwargs)",
"def setup_arguments_parser():\n\tglobal parser\n\n\tparser.plugin_add_argument('-a', '--args', dest = 'plugin_args', \n\t\tdefault = \"\",\n\t\taction = 'store',\n\t\thelp = '''\n\t\t\tArguments to send to the plugin. For a list of... | [
"0.74358743",
"0.6696819",
"0.6409247",
"0.63467675",
"0.62808424",
"0.6185173",
"0.61584157",
"0.6040108",
"0.5839735",
"0.57951957",
"0.57931757",
"0.5768283",
"0.571611",
"0.57148373",
"0.55683666",
"0.5559388",
"0.5539888",
"0.5522889",
"0.5500167",
"0.5443058",
"0.541655... | 0.76158637 | 0 |
test Morlet agains T&C table 2 Psi_t(0) = pi^(1/4) Psi_f(0) = 0 | def test_Morlet():
morl = cw.MorletWave()
assert(np.isclose(morl(0), np.pi**(-1/4), atol=1.e-12))
assert(np.isclose(morl.freq(0), 0, atol=1.e-12)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_t0(self):\n sol = Mader(p_cj=3.0e11, d_cj=8.0e5, gamma=3.0, u_piston=0.0)\n # r must contain 2 elements, otherwise the density and pressure are nan\n r = np.array([0.7, 0.8])\n t = 0.0\n solrt = sol(r, t)\n for quant in ['velocity', 'pressure', 'sound_speed', 'den... | [
"0.6100648",
"0.6093936",
"0.60582364",
"0.603018",
"0.5922259",
"0.5845511",
"0.58271253",
"0.58002853",
"0.5758947",
"0.56838965",
"0.5676569",
"0.56403536",
"0.56302726",
"0.56251395",
"0.56142735",
"0.56073713",
"0.55909216",
"0.55874753",
"0.5558151",
"0.55471605",
"0.55... | 0.64026505 | 0 |
Compute and return the precession matrix for FK4 using Newcomb's method. Used inside some of the transformation functions. | def _precession_matrix(oldequinox, newequinox):
return earth._precession_matrix_besselian(oldequinox.byear, newequinox.byear) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMatrix(self) -> CMatrix4:\n ...",
"def prep(self):\n \n # create a dict with prior probabilities\n self.row_priors = [0.0]*len(self.rows)\n self.feature_priors = dict()\n \n # denominator is given by reference priors\n denominator = sum(self.... | [
"0.6055124",
"0.5924322",
"0.5643369",
"0.5636854",
"0.55979395",
"0.55794376",
"0.5578798",
"0.5540976",
"0.55308",
"0.55139494",
"0.54965854",
"0.5489014",
"0.546786",
"0.5440847",
"0.5426619",
"0.54196495",
"0.5367736",
"0.532335",
"0.5320548",
"0.5307548",
"0.5295726",
... | 0.66207457 | 0 |
Remove features with multicollinearity based on crosscorrelation coefficient. | def remove_multicollinearity_correlation(data: pd.DataFrame, threshold: Optional[float] = 0.8) -> pd.DataFrame:
corr_data = pd.DataFrame(np.triu(np.abs(data.corr())), columns=data.columns)
multicoll_columns = np.logical_and(corr_data >= threshold, corr_data < 1.0).any()
return data.loc[:, ~multicoll_column... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_correlated_features(x, threshold=0.9):\n x_copy = np.copy(x)\n \n corr_matrix = np.corrcoef(x_copy, rowvar=False)\n # Set to False highly correlated columns\n nb_col = len(corr_matrix)\n columns = np.full((nb_col,), True, dtype=bool)\n for i in range(nb_col):\n for j in range... | [
"0.6917892",
"0.61253226",
"0.5922287",
"0.5854584",
"0.5745143",
"0.5716787",
"0.5700009",
"0.5627028",
"0.5626299",
"0.5607187",
"0.5549474",
"0.5468665",
"0.5422611",
"0.537759",
"0.5374915",
"0.5370696",
"0.5360709",
"0.5357423",
"0.53232837",
"0.53192794",
"0.5300013",
... | 0.64739853 | 1 |
Test for picking the highest rating agent and picking the right agent when two agents are finish at the same time | def test_2_agents_done_at_once(self):
# Test highest rating agent
agent, wait_time = Agent.get(TEST_CUSTOMERS[0])
self.assertEqual(
(TEST_AGENTS[1], 0), (agent.agent, wait_time))
# Test 2 agents done at the same time
Agent.get(TEST_CUSTOMERS[1])
agent, wait_ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self):\n highest_offer = None\n\n if self.manager is None:\n highest_rep = 0\n\n else:\n highest_rep = self.manager.reputation\n\n for offer in self.offers:\n if offer.manager.reputation > highest_rep:\n highest_offer = offer\n\n ... | [
"0.6727426",
"0.63760585",
"0.6346558",
"0.62901396",
"0.62776285",
"0.6214636",
"0.6204978",
"0.6166298",
"0.60946786",
"0.6084147",
"0.60721874",
"0.6062389",
"0.6024519",
"0.6020219",
"0.60040855",
"0.59740645",
"0.5961315",
"0.5941096",
"0.59343535",
"0.5914328",
"0.59093... | 0.6629885 | 1 |
Given a dialect, returns the dialect type, which is defines the engine/system that is used to communicates with the database/database implementation. Currently checks for RedShift/BigQuery dialects | def _get_dialect_type_module(dialect):
if dialect is None:
logger.warning(
"No sqlalchemy dialect found; relying in top-level sqlalchemy types."
)
return sa
try:
# Redshift does not (yet) export types to top level; only recognize base SA types
if isinstance(di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> Text:\n\n return \"detect_dialect\"",
"def get_dialect(self):\n\t\tif self.is_single_col:\n\t\t\treturn None\n\n\t\tif self.delimiter and self.quotechar:\n\t\t\treturn Dialect(self.delimiter, self.quotechar,\n\t\t\t\t\t\tTrue if self.escapechar is None else False,\n\t\t\t\t\t\tself.escap... | [
"0.65882957",
"0.5873187",
"0.58714145",
"0.5629928",
"0.56089145",
"0.5572354",
"0.5559554",
"0.54928523",
"0.5472916",
"0.54684013",
"0.5411899",
"0.5407298",
"0.5407298",
"0.5366812",
"0.5335421",
"0.5184428",
"0.5175622",
"0.51554245",
"0.51459706",
"0.50762737",
"0.50750... | 0.7448258 | 0 |
Builds a SqlAlchemyExecutionEngine, using a provided connection string/url/engine/credentials to access the desired database. Also initializes the dialect to be used and configures usage statistics. | def __init__(
self,
name=None,
credentials=None,
data_context=None,
engine=None,
connection_string=None,
url=None,
batch_data_dict=None,
create_temp_table=True,
**kwargs, # These will be passed as optional parameters to the SQLAlchemy engi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_engine(self, credentials, **kwargs) -> \"sa.engine.Engine\":\n # Update credentials with anything passed during connection time\n drivername = credentials.pop(\"drivername\")\n schema_name = credentials.pop(\"schema_name\", None)\n if schema_name is not None:\n log... | [
"0.7402342",
"0.6850923",
"0.6795974",
"0.6642406",
"0.6592185",
"0.65612894",
"0.64122355",
"0.64055586",
"0.63875616",
"0.6348471",
"0.6341745",
"0.63360906",
"0.6322239",
"0.63080424",
"0.62338716",
"0.62057036",
"0.6178479",
"0.61481386",
"0.61264646",
"0.61171126",
"0.61... | 0.73738885 | 1 |
Using a set of given credentials, constructs an Execution Engine , connecting to a database using a URL or a private key path. | def _build_engine(self, credentials, **kwargs) -> "sa.engine.Engine":
# Update credentials with anything passed during connection time
drivername = credentials.pop("drivername")
schema_name = credentials.pop("schema_name", None)
if schema_name is not None:
logger.warning(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_engine(db_credentials):\n\n url = 'postgresql://{user}:{passwd}@{host}:{port}/{db}'.format(\n user=db_credentials['user'], passwd=db_credentials['pwd'], host=db_credentials['host'], \n port=db_credentials['port'], db=db_credentials['db'])\n engine = create_engine(url, pool_size = 50)\n ... | [
"0.70442784",
"0.6375183",
"0.6234762",
"0.61758363",
"0.60751504",
"0.6024599",
"0.599556",
"0.59493566",
"0.5944619",
"0.5925997",
"0.5916051",
"0.5916051",
"0.5916051",
"0.5916051",
"0.58947533",
"0.5882432",
"0.5831161",
"0.58047366",
"0.5755691",
"0.57500356",
"0.5732881... | 0.7142299 | 0 |
For every metric in a set of Metrics to resolve, obtains necessary metric keyword arguments and builds bundles of the metrics into one large query dictionary so that they are all executed simultaneously. Will fail if bundling the metrics together is not possible. | def resolve_metric_bundle(
self,
metric_fn_bundle: Iterable[Tuple[MetricConfiguration, Any, dict, dict]],
) -> dict:
resolved_metrics = dict()
# We need a different query for each domain (where clause).
queries: Dict[Tuple, dict] = dict()
for (
metric_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_metric_bundle(\n self,\n metric_fn_bundle: Iterable[MetricComputationConfiguration],\n ) -> Dict[Tuple[str, str, str], MetricValue]:\n resolved_metrics: Dict[Tuple[str, str, str], MetricValue] = {}\n\n res: List[pyspark.Row]\n\n aggregates: Dict[Tuple[str, str, str... | [
"0.5766406",
"0.53083754",
"0.5228133",
"0.520503",
"0.52048165",
"0.5184909",
"0.5151796",
"0.5131219",
"0.5057866",
"0.5052298",
"0.5040867",
"0.50277853",
"0.5003099",
"0.49977538",
"0.49886754",
"0.49603522",
"0.49507537",
"0.49436116",
"0.4934606",
"0.49135163",
"0.49083... | 0.6327868 | 0 |
Convert the values in the named column to the given date_format, and split on that | def _split_on_converted_datetime(
self,
table_name: str,
column_name: str,
batch_identifiers: dict,
date_format_string: str = "%Y-%m-%d",
):
return (
sa.func.strftime(
date_format_string,
sa.column(column_name),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_date(X, date_column):\r\n X.copy()\r\n X[date_column] = pd.to_datetime(X[date_column])\r\n X['Month'] = X[date_column].dt.month\r\n X['Day'] = X[date_column].dt.day\r\n X['Year'] = X[date_column].dt.year\r\n X = X.drop(columns=date_column)\r\n return X",
"def split_on_converted_dat... | [
"0.6063431",
"0.59881413",
"0.59291905",
"0.5892997",
"0.58773583",
"0.5724132",
"0.56537443",
"0.5642548",
"0.55780613",
"0.5577633",
"0.55532646",
"0.54812294",
"0.54616386",
"0.5457874",
"0.5456375",
"0.5441208",
"0.5415469",
"0.5410341",
"0.54027736",
"0.53965163",
"0.533... | 0.6002781 | 1 |
Divide the values in the named column by `divisor`, and split on that | def _split_on_divided_integer(
self, table_name: str, column_name: str, divisor: int, batch_identifiers: dict
):
return (
sa.cast(sa.column(column_name) / divisor, sa.Integer)
== batch_identifiers[column_name]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_on_divided_integer(\n df, column_name: str, divisor: int, batch_identifiers: dict\n ):\n matching_divisor = batch_identifiers[column_name]\n res = (\n df.withColumn(\n \"div_temp\",\n (F.col(column_name) / divisor).cast(pyspark.types.Intege... | [
"0.7624918",
"0.63281494",
"0.63281494",
"0.6198992",
"0.59379506",
"0.5877097",
"0.5860313",
"0.5730168",
"0.5702097",
"0.5687075",
"0.56626314",
"0.5631788",
"0.5629911",
"0.5626099",
"0.5592552",
"0.55592173",
"0.55007976",
"0.5481256",
"0.54458344",
"0.5437595",
"0.542030... | 0.7020373 | 1 |
Split on the hashed value of the named column | def _split_on_hashed_column(
self,
table_name: str,
column_name: str,
hash_digits: int,
batch_identifiers: dict,
):
return (
sa.func.right(sa.func.md5(sa.column(column_name)), hash_digits)
== batch_identifiers[column_name]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_on_hashed_column(\n df,\n column_name: str,\n hash_digits: int,\n batch_identifiers: dict,\n hash_function_name: str = \"sha256\",\n ):\n try:\n getattr(hashlib, hash_function_name)\n except (TypeError, AttributeError):\n raise (\n... | [
"0.65764296",
"0.5979117",
"0.58276886",
"0.576672",
"0.5747084",
"0.5704968",
"0.56568956",
"0.5436421",
"0.5386944",
"0.53809637",
"0.5376536",
"0.53194606",
"0.52639484",
"0.5231733",
"0.52234346",
"0.52208877",
"0.52128637",
"0.5200018",
"0.5196556",
"0.5189515",
"0.51760... | 0.70502675 | 0 |
Take the mod of named column, and only keep rows that match the given value | def _sample_using_mod(
self,
column_name,
mod: int,
value: int,
):
return sa.column(column_name) % mod == value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_column(col, row):\n return col == column",
"def split_on_mod_integer(df, column_name: str, mod: int, batch_identifiers: dict):\n matching_mod_value = batch_identifiers[column_name]\n res = (\n df.withColumn(\n \"mod_temp\", (F.col(column_name) % mod).cast... | [
"0.6376289",
"0.61524767",
"0.59794253",
"0.5769592",
"0.5636871",
"0.5633086",
"0.558487",
"0.5578941",
"0.55405074",
"0.5523299",
"0.54107213",
"0.5403629",
"0.5289054",
"0.52319825",
"0.5160314",
"0.5159226",
"0.51499134",
"0.51131636",
"0.507911",
"0.5066149",
"0.50261253... | 0.6648762 | 0 |
Match the values in the named column against value_list, and only keep the matches | def _sample_using_a_list(
self,
column_name: str,
value_list: list,
):
return sa.column(column_name).in_(value_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_search_values(key: str, values: list, collection: list):\n return_data = []\n for item in collection:\n if any(val in values for val in item[key]):\n return_data.append(item)\n return return_data",
"def value_in(table_rows, values=[], col_name=\"\", col_num=-1):\n key = ... | [
"0.6528692",
"0.6075162",
"0.6061627",
"0.59260726",
"0.59116757",
"0.5900305",
"0.5770534",
"0.57195044",
"0.5671975",
"0.5632688",
"0.55851847",
"0.55442405",
"0.55013937",
"0.55002934",
"0.54953384",
"0.549166",
"0.5421752",
"0.5407499",
"0.53741693",
"0.536061",
"0.533966... | 0.68063223 | 0 |
[0x58, 0x59, 0x01, 0x00, 0x00] => "0x58, 0x59, 0x01, 0x00, 0x00" | def bytes_arr_to_hex_str(bytes_arr: List[int]) -> str:
return ", ".join("0x%02x" % b for b in bytes_arr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upp_stringer(input_list): #input a characteristics list\r\n\toutput_list=[]\r\n\tfor item in input_list:\r\n\t\toutput_list.append(str(stellagama.pseudo_hex(item)))\r\n\treturn ''.join (output_list) #output a string\r",
"def colors_to_string(colors):\n return ''.join(['%02x%02x%02x' % (r,g,b) for r,g,b in... | [
"0.71455836",
"0.66164225",
"0.6604635",
"0.65370417",
"0.65258",
"0.65230733",
"0.6488749",
"0.6480381",
"0.64735025",
"0.6464688",
"0.6441291",
"0.6422277",
"0.639696",
"0.63435936",
"0.63080764",
"0.62981135",
"0.6286795",
"0.625519",
"0.6242381",
"0.6226093",
"0.6198905",... | 0.67328227 | 1 |
"0x58, 0x59, 0x01, 0x00, 0x00" => [0x58, 0x59, 0x01, 0x00, 0x00] | def hex_str_to_bytes_arr(bytes_str: str) -> List[int]:
return eval(f"[{bytes_str}]") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex_list(self):\r\n return [''.join(['{:02X}'.format(b) for b in data]) for data in self.buffers()]",
"def buf_to_list(buf):\r\n buf_stripped = buf.raw.decode().rstrip('\\x00')\r\n# for ch in buf_stripped:\r\n# if (ch == '0') or (ch == '\\t') or (ch == '\\n'):\r\n# name = name.... | [
"0.65582275",
"0.63307226",
"0.6290027",
"0.6262765",
"0.61640704",
"0.6160979",
"0.6156085",
"0.61130404",
"0.610784",
"0.60554963",
"0.6033458",
"0.5946255",
"0.5939836",
"0.58945185",
"0.5894092",
"0.5832303",
"0.5822892",
"0.58158875",
"0.58045244",
"0.580421",
"0.5776219... | 0.6725189 | 0 |
load csv into data frame | def load_data(csv_path):
df = pd.read_csv(csv_path)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_from_csv(self, filepath):\n self.dataframe = pd.load_csv(filepath, separator='')",
"def read_csv():",
"def load_from_csv(path, delimiter=','):\n return pd.read_csv(path,encoding = \"ISO-8859-1\",dtype=object)",
"def _parse_csv(csv_file: str) -> pd.DataFrame:\n return pd.read_csv(csv... | [
"0.8076421",
"0.7554986",
"0.7526359",
"0.74822295",
"0.7439858",
"0.74330825",
"0.7395306",
"0.73376906",
"0.7332784",
"0.7308946",
"0.7283677",
"0.7266445",
"0.7250622",
"0.72173434",
"0.7191797",
"0.71897143",
"0.71263695",
"0.71054494",
"0.71051294",
"0.70921",
"0.7068305... | 0.7674975 | 1 |
split survivals results out of df | def split_outcomes(df):
outcomes = df['Survived']
df = df.drop('Survived', axis=1)
return outcomes, df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_phases(df):\n return(\n tuple([df.groupby('Phase').get_group(p) for p in df.Phase.unique()])\n )",
"def show_diverse_recs(res, threshold):\n rec_ids = [] # result list\n while len(rec_ids) < threshold:\n for clust in res[\"CENTROID\"].unique():\n cluster_rec = res[... | [
"0.60274947",
"0.59297115",
"0.57942295",
"0.567151",
"0.56509566",
"0.56292737",
"0.5605837",
"0.5603",
"0.5589303",
"0.55613124",
"0.5553913",
"0.54861426",
"0.5476571",
"0.5466991",
"0.5439459",
"0.53859234",
"0.5374307",
"0.5348394",
"0.53154784",
"0.5299357",
"0.5229916"... | 0.62963355 | 0 |
Read schedule configuration from file and load the json. | def get_schedules():
path = config.get('schedule', 'paths', './schedule.json')
with open(path) as schedule_file:
return json.load(schedule_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(self):\n with open(self.TEMPERATURE_CONFIG_FILE_PATH, 'r') as file:\n self.config = json.load(file)",
"def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)",
"def load_irrigation_schedule():\n global irrigation_sche... | [
"0.7224128",
"0.7197243",
"0.7081696",
"0.7046951",
"0.70186424",
"0.6930678",
"0.69084924",
"0.68250173",
"0.68214375",
"0.67013276",
"0.66890836",
"0.66843784",
"0.66651",
"0.6656593",
"0.6648547",
"0.6635397",
"0.6628288",
"0.65703183",
"0.6557144",
"0.65432274",
"0.651695... | 0.7330782 | 0 |
Check all schedule configurations to start and stop instances | def schedule():
for profile in schedules['profiles']:
instances = _get_instances(profile['instance_tags'], profile['region'])
start_stop_instances(instances, profile['schedule'])
reregister_elb_instances(profile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_stop_instances(instances, schedule):\n for reservation in instances:\n for instance in reservation.instances:\n region = instance.placement\n if instance.state == 'running' and _get_desired_state(schedule) == 'stop':\n print \"Should stop \" + instance.id + \".\"\n instance.st... | [
"0.71326065",
"0.65044415",
"0.64524704",
"0.6353409",
"0.6326504",
"0.6221054",
"0.61959714",
"0.6026816",
"0.60222584",
"0.59739757",
"0.59491706",
"0.592607",
"0.5874639",
"0.5816534",
"0.57862383",
"0.5757011",
"0.573736",
"0.5729255",
"0.5709102",
"0.5708846",
"0.5707170... | 0.6757293 | 1 |
Get boto ec2 instance objects by provided tags | def _get_instances(instance_tags, region):
return ec2_conn[region].get_all_instances(filters={"tag:Name": instance_tags}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instances_by_tags(self, tags):\n return self.get_only_instances(filters={'tag:{}'.format(key): val for key, val in tags.items()})",
"def _aws_get_instance_by_tag(region, name, tag, raw):\n client = boto3.session.Session().client('ec2', region)\n matching_reservations = client.describe_instances(... | [
"0.7924737",
"0.7872538",
"0.76130366",
"0.70465094",
"0.6994373",
"0.6934099",
"0.692257",
"0.6913484",
"0.6890489",
"0.6859421",
"0.6760221",
"0.6676493",
"0.6670747",
"0.6642421",
"0.6551454",
"0.65225965",
"0.65085363",
"0.6453371",
"0.6426066",
"0.6425665",
"0.6411169",
... | 0.80162674 | 0 |
Start and stop the instances given a schedule | def start_stop_instances(instances, schedule):
for reservation in instances:
for instance in reservation.instances:
region = instance.placement
if instance.state == 'running' and _get_desired_state(schedule) == 'stop':
print "Should stop " + instance.id + "."
instance.stop()
elif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule():\n for profile in schedules['profiles']:\n instances = _get_instances(profile['instance_tags'], profile['region'])\n start_stop_instances(instances, profile['schedule'])\n reregister_elb_instances(profile)",
"def stopSchedule(self):\n DPxStopDinSched()",
"async def test_stop(sel... | [
"0.6934514",
"0.6739192",
"0.6622401",
"0.6519092",
"0.64685136",
"0.61098325",
"0.6099489",
"0.609771",
"0.60722625",
"0.6011122",
"0.5967029",
"0.5966578",
"0.5929629",
"0.5904095",
"0.58967966",
"0.57705957",
"0.57697916",
"0.57670844",
"0.57324207",
"0.57235146",
"0.57193... | 0.7838685 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.