query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
create_json Create a JSON file in the caseroot/archive_files dir.
def create_json(case_dict): # --------------------------------------------------------------------- logger.debug("create_json") if not os.path.exists("{0}/archive_files".format(case_dict["workdir"])): os.makedirs("{0}/archive_files".format(case_dict["workdir"])) filename = "{0}/archive_files/j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_json(response, file):\n\n output_file = open(file, \"w\")\n dest_file = os.path.join(export_path, file)\n json.dump(response, output_file, indent=2)\n\n if os.path.exists(dest_file):\n os.remove(dest_file)\n\n shutil.move(file, export_path)\n\n return", "def write_as_json(file...
[ "0.70621973", "0.70217425", "0.67948973", "0.66781574", "0.66593534", "0.6554852", "0.65367025", "0.64606947", "0.64516634", "0.6432371", "0.6330401", "0.63226044", "0.63197553", "0.62762696", "0.6244357", "0.624096", "0.62043643", "0.6194948", "0.6186841", "0.6161703", "0.61...
0.80264103
0
Creates a logger configured for the deployment.
def get_logger(verbose, debug): if debug: level = logging.DEBUG elif verbose: level = logging.INFO else: level = logging.WARNING # hahahahaha class UtcFormatter(logging.Formatter): converter = time.gmtime formatter = UtcFormatter("%(message)s" if not verbose els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_logger():\r\n global logger\r\n logger = logging.getLogger(logger_name)\r\n\r\n formatter = logging.Formatter(fmt='%(asctime)s %(levelname)s %(message)s')\r\n \r\n handler = logging.StreamHandler()\r\n handler.setFormatter(formatter)\r\n logger.addHandler(handler)\r\n \r\n ret...
[ "0.69873834", "0.68858325", "0.68393445", "0.6821994", "0.6782228", "0.66820717", "0.66775626", "0.66308576", "0.6569458", "0.656567", "0.6560405", "0.6558055", "0.65440124", "0.65426606", "0.6535848", "0.65341854", "0.65255386", "0.64971876", "0.64966553", "0.6486317", "0.64...
0.62145394
44
Sets the id of this Account.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.__id = id", "def set_id(self, id):\n self.data['id'] = id", "def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)", "def se...
[ "0.78804284", "0.78273153", "0.7802268", "0.76025635", "0.75378895", "0.74650985", "0.7364734", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.7347087", "0.73106915", "0.73063844", "0.73063844", "0.73063...
0.7189864
77
Sets the name of this Account.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self._name = name", "def SetName(self, name):\n self.name = name", "def set_name(self, name: str):\n self._name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name)...
[ "0.8236947", "0.8215996", "0.8215285", "0.81812996", "0.81812996", "0.81812996", "0.81812996", "0.81812996", "0.80379516", "0.80379516", "0.801991", "0.80177635", "0.7988183", "0.7988183", "0.79646486", "0.79646486", "0.7953044", "0.7898931", "0.7836976", "0.77726907", "0.776...
0.74660784
72
Sets the plan of this Account.
def plan(self, plan): self._plan = plan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan_allowance(self, plan_allowance):\n\n self._plan_allowance = plan_allowance", "def scheduled_plan(self, scheduled_plan):\n\n self._scheduled_plan = scheduled_plan", "def plans(self, plans):\n\n self._plans = plans", "def plan_type(self, plan_type):\n allowed_values = [\"PP...
[ "0.7542697", "0.7077511", "0.6855029", "0.6753003", "0.64951277", "0.6454428", "0.6422307", "0.6293969", "0.61795104", "0.6034294", "0.5763966", "0.57452613", "0.565897", "0.5650166", "0.5644116", "0.5593205", "0.5585687", "0.5560431", "0.553524", "0.55081296", "0.5463914", ...
0.8418048
0
Sets the extra_seats of this Account.
def extra_seats(self, extra_seats): self._extra_seats = extra_seats
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_seats(self, total_seats):\n\n self._total_seats = total_seats", "def number_of_seats(self, number_of_seats):\n\n self._number_of_seats = number_of_seats", "def extra_slots(self, extra_slots):\n\n self._extra_slots = extra_slots", "def extras(self, extras: object):\n\n se...
[ "0.6328532", "0.57763034", "0.5270624", "0.5216433", "0.5003281", "0.48947576", "0.4824879", "0.4816107", "0.48016316", "0.4771494", "0.47645882", "0.46880087", "0.46880087", "0.4673872", "0.46133706", "0.4548795", "0.45430687", "0.4532384", "0.44706085", "0.4462113", "0.4462...
0.8815205
0
Sets the total_seats of this Account.
def total_seats(self, total_seats): self._total_seats = total_seats
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_seats(self, number_of_seats):\n\n self._number_of_seats = number_of_seats", "def extra_seats(self, extra_seats):\n\n self._extra_seats = extra_seats", "def number_of_seats(self):\n return self._number_of_seats", "def seats_count(self) -> int:\n return self.__seats_co...
[ "0.64727205", "0.59696853", "0.58145624", "0.5811223", "0.5685503", "0.5685503", "0.5685503", "0.5685503", "0.5685503", "0.5685503", "0.5685503", "0.5685503", "0.5648055", "0.5648055", "0.5624844", "0.5500269", "0.5500269", "0.5500269", "0.5444001", "0.5418039", "0.5377309", ...
0.8670678
0
Sets the updated_at of this Account.
def updated_at(self, updated_at): self._updated_at = updated_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updat...
[ "0.7683454", "0.7683454", "0.7683454", "0.66035295", "0.6292621", "0.62873346", "0.62873346", "0.62873346", "0.6189512", "0.600574", "0.600574", "0.600574", "0.5926123", "0.5907053", "0.5903288", "0.5903288", "0.58805555", "0.58803254", "0.58803254", "0.5701238", "0.5701238",...
0.7407279
7
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Account): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Test if array from slice on and off end of EDF has correct shape.
def test_read_EOF2(demo_data): openeeg = openEDF(demo_data) #read 200 samples starting from 100 samples before EOF start = max(openeeg.header.samples) - 100 arr = openeeg.read(start, start + 200) assert arr.shape[-1] == 100 openeeg.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(placeholder_shape, data_shape):\n\n return True", "def is_full_axis_mask(index, axis_length):\n if isinstance(index, slice):\n return index == slice(None) or (\n isinstance(axis_length, int)\n and compute_sliced_len(index, axis_l...
[ "0.64855814", "0.63873553", "0.63613474", "0.63212436", "0.62574565", "0.6178012", "0.6173166", "0.61406946", "0.6124155", "0.6080693", "0.60246474", "0.5994808", "0.5956988", "0.58989185", "0.5883734", "0.5878962", "0.5875156", "0.58692354", "0.5865003", "0.58623666", "0.584...
0.0
-1
Reinitializes the networks parameters
def reset_parameters(self): # for item in self.layer_dict.children(): self.encoder.reset_parameters() self.vq.reset_parameters() self.generator.reset_parameters() self.speaker_dict.reset_parameters() self.speaker_dense.reset_parameters()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_params(self):\n self.clear()\n self._init_load_data()\n self._init_net_delay_data()", "def reset_parameters(self):\n init_method = getattr(init, self.initialization)\n for layer in range(self.num_layers):\n fc = self.get_fc(layer)\n init_method(fc...
[ "0.7595011", "0.730041", "0.72578984", "0.7236807", "0.7206229", "0.7137021", "0.7114146", "0.7114146", "0.7114146", "0.7113234", "0.7061227", "0.7038162", "0.69569284", "0.6934159", "0.6923444", "0.6899826", "0.68897796", "0.68812203", "0.6865411", "0.68445563", "0.6715736",...
0.71097744
10
Reinitializes the networks parameters
def reset_parameters(self): self.embedding.reset_parameters() self.init_embedding()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_params(self):\n self.clear()\n self._init_load_data()\n self._init_net_delay_data()", "def reset_parameters(self):\n init_method = getattr(init, self.initialization)\n for layer in range(self.num_layers):\n fc = self.get_fc(layer)\n init_method(fc...
[ "0.7595011", "0.730041", "0.72578984", "0.7236807", "0.7206229", "0.7137021", "0.7114146", "0.7114146", "0.7114146", "0.7113234", "0.71097744", "0.7061227", "0.7038162", "0.69569284", "0.6934159", "0.6923444", "0.68897796", "0.68812203", "0.6865411", "0.68445563", "0.6715736"...
0.6899826
16
Returns a JSON string with the selected columns, generating gzipped JSON files from the loom file if necesary. (never truncates, may clear outdated cache)
def selected_columns(self, column_numbers: List[int]) -> Tuple[str, str]: if not self._closed: col_dir = "%s.cols" % (self.file_path) logging.debug("Expanding selected column numbers, if not previously expanded: (stored in %s.cols subfolder)" % self.filename) logging.debug(",".join(str(column_nr) for column_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def df_to_json(complete_dataset, output_path, static_columns):\n megajson = {}\n\n static_columns = [\"continent\", \"location\"] + list(static_columns)\n\n complete_dataset = complete_dataset.dropna(axis=\"rows\", subset=[\"iso_code\"])\n\n for _, row in complete_dataset.iterrows():\n\n row_iso...
[ "0.6108212", "0.58270687", "0.57472366", "0.5745893", "0.5738712", "0.5721022", "0.56839126", "0.5623883", "0.55553496", "0.5496048", "0.5490951", "0.54665023", "0.5431308", "0.5398665", "0.53284484", "0.5206253", "0.5205561", "0.5202739", "0.5202721", "0.51933587", "0.518278...
0.5295656
15
Initializes a tracker using initial bounding box
def __init__(self, bbox, frame, min_hits, max_age): print("DETECTION") # bounding box self.csrt = cv2.TrackerCSRT_create() # convert the bbox to csrt bbox format # print(bbox[:4]) self.csrt.init(frame, convert_bbox_to_wh(bbox[:4])) self.bbox = bbox self.ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, ini_image, object_bound_rect = (0,0,0,0)):\r\n \r\n self.ini_image = ini_image\r\n \r\n # if the bounding rectangle of the object is not set, than chose it manually\r\n if (object_bound_rect == (0,0,0,0)):\r\n print('Select object to track on the ima...
[ "0.6629888", "0.6625998", "0.64932245", "0.6274649", "0.6227729", "0.61107934", "0.6100719", "0.6059979", "0.6020599", "0.59936583", "0.5981279", "0.59694874", "0.5949425", "0.59366906", "0.5922834", "0.59004873", "0.59004873", "0.58969647", "0.5871865", "0.5861493", "0.58563...
0.6503299
2
Create a schedule with a learning rate that decreases as 1/sqrt(current_step) after being constant during a warmup period.
def get_inverse_sqrt_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1): def lr_lambda(current_step): return max( 0.0, 1.0 / np.sqrt(float(max(current_step, float(max(1, num_warmup_steps))))) ) return LambdaLR(optimizer, lr_lambda, last_epoch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate_schedule(total_steps):\n learning_rate = learning_schedules.cosine_decay_with_warmup(global_step=tf.train.get_or_create_global_step(),\n learning_rate_base=0.04,\n tota...
[ "0.75072473", "0.74333084", "0.7222664", "0.72080445", "0.71616274", "0.71366465", "0.70818824", "0.7025081", "0.6999885", "0.6954678", "0.68744284", "0.6851452", "0.68383193", "0.6829724", "0.68247694", "0.68155587", "0.68109614", "0.6806046", "0.6795329", "0.6777281", "0.67...
0.0
-1
Returns the device of the tensor.
def get_device_of(tensor: torch.Tensor) -> int: if not tensor.is_cuda: return -1 else: return tensor.get_device()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device(self):\n return self._tensor.device", "def get_device_of(self, tensor):\n if not tensor.is_cuda:\n return -1\n else:\n return tensor.get_device()", "def device(self):\n return torch.cuda.current_device()", "def device(self) -> torch.device:\n ...
[ "0.902195", "0.8598235", "0.792734", "0.78525966", "0.78283507", "0.77786773", "0.76893765", "0.75009483", "0.75009483", "0.75009483", "0.75009483", "0.75009483", "0.74803114", "0.7369775", "0.7183632", "0.71794677", "0.71409166", "0.7034797", "0.7021606", "0.70176464", "0.69...
0.82616115
2
This is a subroutine for [`batched_index_select`](./util.mdbatched_index_select). The given `indices` of size `(batch_size, d_1, ..., d_n)` indexes into dimension 2 of a target tensor, which has size `(batch_size, sequence_length, embedding_size)`. This function returns a vector that correctly indexes into the flattene...
def flatten_and_batch_shift_indices(indices: torch.Tensor, sequence_length: int) -> torch.Tensor: # Shape: (batch_size) if torch.max(indices) >= sequence_length or torch.min(indices) < 0: print(f"All elements in indices should be in range (0, {sequence_length - 1})") offsets = get_range_vector(indi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batched_index_select(\n target: torch.Tensor,\n indices: torch.LongTensor,\n flattened_indices: Optional[torch.LongTensor] = None,\n) -> torch.Tensor:\n if flattened_indices is None:\n # Shape: (batch_size * d_1 * ... * d_n)\n flattened_indices = flatten_and_batch_shift_indices(indice...
[ "0.78376806", "0.6336301", "0.6232105", "0.6216943", "0.61986506", "0.6185342", "0.6152568", "0.5991655", "0.593095", "0.58987254", "0.58274555", "0.568347", "0.5676012", "0.5645251", "0.5645251", "0.56086487", "0.55983186", "0.55834347", "0.55649966", "0.5552992", "0.5516439...
0.7959597
0
The given `indices` of size `(batch_size, d_1, ..., d_n)` indexes into the sequence dimension (dimension 2) of the target, which has size `(batch_size, sequence_length, embedding_size)`. This function returns selected values in the target with respect to the provided indices, which have size `(batch_size, d_1, ..., d_n...
def batched_index_select( target: torch.Tensor, indices: torch.LongTensor, flattened_indices: Optional[torch.LongTensor] = None, ) -> torch.Tensor: if flattened_indices is None: # Shape: (batch_size * d_1 * ... * d_n) flattened_indices = flatten_and_batch_shift_indices(indices, target.si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subset_from_indices(self, indices):\n return self.extract_inds(indices)", "def select_at_indexes(indexes, tensor):\n dim = len(indexes.shape)\n assert indexes.shape == tensor.shape[:dim]\n num = indexes.numel()\n t_flat = tensor.view((num,) + tensor.shape[dim:])\n s_flat = t_flat[torch....
[ "0.6976982", "0.6566852", "0.6372289", "0.61864173", "0.61358744", "0.6127566", "0.60097724", "0.5911337", "0.5892173", "0.5872331", "0.58289593", "0.58107966", "0.57951206", "0.57410014", "0.573691", "0.5720299", "0.5714204", "0.5708252", "0.57068545", "0.5700757", "0.566720...
0.7784862
0
Creates a flattened array holding the coordinates x, y, and z, of all vertices
def createVertexData(self, fv_indices_flattened, points): mesh_points = points[fv_indices_flattened] data_mesh_points = mesh_points.flatten() return data_mesh_points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xyz(self) -> np.ndarray:\n return np.vstack((self.x, self.y, self.z)).transpose()", "def cvt2array(tuples):\n rc = []\n for t in tuples:\n rc.append(point3d(np.float32(t[X]), np.float32(t[Y]), np.float32(t[Z])))\n return rc", "def flatten(self):\n xv, yv = np.m...
[ "0.69550425", "0.688272", "0.67674917", "0.66965115", "0.66958445", "0.6649483", "0.6589492", "0.6513276", "0.6488316", "0.64800847", "0.6423191", "0.6416133", "0.6386126", "0.6355537", "0.6341121", "0.63375956", "0.6315153", "0.6272637", "0.625389", "0.62195367", "0.6201536"...
0.6476511
10
Creates a flattened array holding the rgba color of each vertex
def createConstantColorData(self, c, n_faces): mesh_colors = np.tile(c, 3 * n_faces) data_mesh_colors = mesh_colors.flatten() return data_mesh_colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createVertexColorData(self, vertex_colors, fv_indices_flattened):\n return vertex_colors[fv_indices_flattened]", "def rgba(self):\n return (self.red, self.green, self.blue, self.alpha)", "def _update_color(self):\n self._vertex_list.colors[:] = self._rgba * self._num_verts", "def rea...
[ "0.6586899", "0.6272892", "0.61669934", "0.61311024", "0.60938096", "0.5889777", "0.58538353", "0.5844228", "0.579763", "0.5754717", "0.5751571", "0.5748499", "0.57412666", "0.57203853", "0.5699331", "0.5690743", "0.56706613", "0.566669", "0.5666653", "0.565372", "0.56442446"...
0.5473598
36
Create a flattened array holding the rgba color of each vertex
def createFaceColorData(self, face_colors): mesh_colors = np.repeat(face_colors, 3, axis=0) data_mesh_colors = mesh_colors.flatten() return data_mesh_colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createVertexColorData(self, vertex_colors, fv_indices_flattened):\n return vertex_colors[fv_indices_flattened]", "def rgba(self):\n return (self.red, self.green, self.blue, self.alpha)", "def _colored_img_to_arr(image, verbose=False):\n height, width = image.size\n arr = np.array(image....
[ "0.65862244", "0.6216234", "0.61602384", "0.61470324", "0.6100542", "0.5896714", "0.5856137", "0.57918745", "0.57621837", "0.57565236", "0.57390034", "0.5734843", "0.57283175", "0.5726447", "0.5720755", "0.571381", "0.57135564", "0.57046616", "0.5659403", "0.5657276", "0.5629...
0.5824562
7
Creates a flattened array holding the rgba color of each vertex
def createVertexColorData(self, vertex_colors, fv_indices_flattened): return vertex_colors[fv_indices_flattened]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgba(self):\n return (self.red, self.green, self.blue, self.alpha)", "def _update_color(self):\n self._vertex_list.colors[:] = self._rgba * self._num_verts", "def read_mesh_vertices_rgb(filename):\n assert os.path.isfile(filename)\n with open(filename, 'rb') as f:\n d...
[ "0.6272594", "0.61673564", "0.613142", "0.60945845", "0.5890221", "0.5853281", "0.5845161", "0.57989854", "0.575349", "0.5752784", "0.57482624", "0.57420397", "0.5720816", "0.57002634", "0.56904745", "0.5669631", "0.56675595", "0.5666997", "0.5653718", "0.56444293", "0.563168...
0.65861654
0
Given a string x, returns True if all the letters in x are contained in word in the same order as they appear in x. >>> x_ian('eric', 'meritocracy') True >>> x_ian('eric', 'cerium') False >>> x_ian('john', 'mahjong') False
def x_ian(x, word): if x == "": return True else: letWordLoc = word.find(x[0]) if (letWordLoc != -1): return x_ian(x[1:], word[(letWordLoc + 1):]) else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_ian(x, word):\n ###TODO\n# if len(x) < 2:\n# return x in word\n# elif len(x) >=2 and x[0] in word: \n# j = word.index(x[0])\n# return x_ian(x[1:], word[j+1:])\n# else:\n# return False\n #BASE CASE: x is of length 0 or 1, return true/false according to if x is in wor...
[ "0.7424557", "0.7412953", "0.7284414", "0.6603238", "0.65497684", "0.63647985", "0.63354445", "0.62471163", "0.6219456", "0.6199789", "0.61992246", "0.6180952", "0.6136662", "0.6136304", "0.6129028", "0.612633", "0.60882455", "0.6085545", "0.6009503", "0.600862", "0.6002599",...
0.72221583
3
Returns the user's documents folder if they are using a Windows system, or their home folder if they are using another operating system.
def getUserDir() -> str: if os.name == "nt": # Windows system, try to return documents directory try: import ctypes.wintypes CSIDL_PERSONAL = 5 # Documents SHGFP_TYPE_CURRENT = 0 # Current value buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_documents_path():\n system_name = platform.platform().upper()\n if \"XP\" in system_name:\n documents_path = os.path.join(os.path.expanduser(\"~\"), \"My Documents\")\n else:\n documents_path = os.path.join(os.path.expanduser('~'), 'Documents')\n return documents_path", "def _wi...
[ "0.7971269", "0.78128153", "0.66790694", "0.6632859", "0.6613792", "0.65620774", "0.6496035", "0.64517057", "0.64388555", "0.6433509", "0.6433338", "0.6418341", "0.64159393", "0.6414965", "0.6413566", "0.64091617", "0.62989384", "0.62668633", "0.62668633", "0.6235536", "0.623...
0.77908283
2
onehot encodes a tensor
def to_onehot(x, num_classes): return np.eye(num_classes, dtype='float32')[x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\...
[ "0.83593357", "0.8193007", "0.8131412", "0.8129122", "0.81189585", "0.8076569", "0.8005237", "0.79668266", "0.79449713", "0.7891294", "0.7879333", "0.78743565", "0.78743565", "0.78343487", "0.7818978", "0.78033394", "0.7800972", "0.7799135", "0.77862453", "0.7782531", "0.7773...
0.774522
24
Efficient version of torch.cat that avoids a copy if there is only a single element in a list
def cat(tensors, dim=0): assert isinstance(tensors, (list, tuple)) if len(tensors) == 1: return tensors[0] return torch.cat(tensors, dim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_cat(args, dim=-1):\n return [torch.cat(x, dim=dim) for x in zip(*args)]", "def concat(a, b):\n return torch.cat((a, b), 1)", "def dim_zero_cat(x: Union[Tensor, List[Tensor]]) ->Tensor:\n x = x if isinstance(x, (list, tuple)) else [x]\n x = [(y.unsqueeze(0) if y.numel() == 1 and y.ndim == 0...
[ "0.6818866", "0.66469294", "0.6485948", "0.64735633", "0.6202958", "0.6057834", "0.60193926", "0.5965054", "0.59245676", "0.5908297", "0.5903084", "0.5875396", "0.58373785", "0.5834093", "0.5821803", "0.5820784", "0.5819366", "0.58161765", "0.5786931", "0.57823515", "0.574925...
0.6805267
1
Sets the results_csi_rs_indexes of this RsIndexResults.
def results_csi_rs_indexes(self, results_csi_rs_indexes): if results_csi_rs_indexes is None: raise ValueError("Invalid value for `results_csi_rs_indexes`, must not be `None`") # noqa: E501 self._results_csi_rs_indexes = results_csi_rs_indexes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, results_csi_rs_indexes=None, results_ssb_indexes=None): # noqa: E501 # noqa: E501\n self._results_csi_rs_indexes = None\n self._results_ssb_indexes = None\n self.discriminator = None\n self.results_csi_rs_indexes = results_csi_rs_indexes\n self.results_ssb_in...
[ "0.73929346", "0.60910875", "0.56786823", "0.5667849", "0.5667849", "0.5667849", "0.5667849", "0.5667849", "0.5602585", "0.5602585", "0.5505471", "0.5359451", "0.53184396", "0.51736265", "0.51504016", "0.5091535", "0.50898844", "0.48768032", "0.4838283", "0.4835834", "0.48193...
0.8509705
0
Sets the results_ssb_indexes of this RsIndexResults.
def results_ssb_indexes(self, results_ssb_indexes): if results_ssb_indexes is None: raise ValueError("Invalid value for `results_ssb_indexes`, must not be `None`") # noqa: E501 self._results_ssb_indexes = results_ssb_indexes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, results_csi_rs_indexes=None, results_ssb_indexes=None): # noqa: E501 # noqa: E501\n self._results_csi_rs_indexes = None\n self._results_ssb_indexes = None\n self.discriminator = None\n self.results_csi_rs_indexes = results_csi_rs_indexes\n self.results_ssb_in...
[ "0.6902514", "0.60780376", "0.5935669", "0.57723105", "0.56884885", "0.56884885", "0.56884885", "0.56884885", "0.56884885", "0.56513965", "0.56513965", "0.5394514", "0.5317599", "0.5251563", "0.5145898", "0.50938267", "0.5081067", "0.5079542", "0.50108874", "0.493981", "0.487...
0.8311483
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, RsIndexResults): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8455985", "0.83913255", "0.81440157", "0.8140831", "0.8132328", "0.80937284", "0.809181", "0.809181", "0.809181", "0.808509", "0.808509", "0.8076134", "0.8076134", "0.8065528" ]
0.0
-1
Return a string subfigure environment for this `~texfigure.Figure`
def repr_subfigure(self): default_kwargs = {'placement': self.subfig_placement, 'width': self.subfig_width, 'caption': self.caption, 'label': self.label} myfig = self.extension_mapping[self.extension]() return self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def figure():\n global fig\n return fig", "def repr_figure(self):\n\n default_kwargs = {'placement': self.placement,\n 'caption': self.caption,\n 'label': self.label,\n 'figure_env_name': self.figure_env_name}\n\n myfi...
[ "0.62783146", "0.60736525", "0.5512044", "0.5428232", "0.5390784", "0.5305049", "0.5216414", "0.5129938", "0.5113568", "0.5046949", "0.5033359", "0.5020397", "0.50167376", "0.49530792", "0.49008033", "0.4889535", "0.48832294", "0.48480082", "0.48315102", "0.4827996", "0.48089...
0.707976
0
Get the `~texfigure.Figure` object corresponding to the given reference.
def get_figure(self, ref): return self._figure_registry[ref]['Figure']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_figure(self):\n import mayavi.mlab as mlab\n if self.new_figure or self.figure_id is not None:\n self.figure = mlab.figure(self.figure_id)\n else:\n self.figure = mlab.gcf()\n\n self.figure_id = self.figure.name\n\n return self.figure", "def get_fi...
[ "0.5996391", "0.5949062", "0.57120365", "0.5609385", "0.557746", "0.5550668", "0.5441683", "0.5420175", "0.53473043", "0.5295021", "0.52928764", "0.52856797", "0.5233301", "0.5195583", "0.51714236", "0.5169126", "0.516906", "0.51089406", "0.50869346", "0.50760007", "0.5068195...
0.7850464
0
The set of arguments for constructing a ResourceDefaultVersion resource.
def __init__(__self__, *, type_name: Optional[pulumi.Input[str]] = None, type_version_arn: Optional[pulumi.Input[str]] = None, version_id: Optional[pulumi.Input[str]] = None): if type_name is not None: pulumi.set(__self__, "type_name", type_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: Optional[ResourceDefaultVersionArgs] = None,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(self, version=None, title=\"Version\", advanced=True, **kwargs):\n if \"default\"...
[ "0.7270384", "0.6517042", "0.6135927", "0.5792372", "0.576849", "0.57106906", "0.56765115", "0.564294", "0.5608153", "0.5605121", "0.55645317", "0.55369645", "0.55171007", "0.55042714", "0.5500955", "0.5471891", "0.5471891", "0.5471023", "0.5460294", "0.545302", "0.54204416",...
0.0
-1
Verify if user has a valid password.
def has_valid_password(self, password): return bcrypt.check_password_hash(self.password, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n user = self.get()\n if user:\n return bcrypt.verify(password, user['password'])\n return False", "def test_valid_password(self):\n user = User(email=\"test@email.com\", password=\"testpassword\")\n\n self.assertTrue(user.is_vali...
[ "0.7940168", "0.7929934", "0.7868782", "0.78487474", "0.7833738", "0.78283745", "0.78193027", "0.7793591", "0.7730563", "0.7721223", "0.76564145", "0.7654309", "0.76532197", "0.76426697", "0.762424", "0.7624134", "0.7621477", "0.76190054", "0.7609329", "0.759378", "0.75930965...
0.7668257
10
Load a TSV file u sing pandas
def load_tsv(path: str, ncols: int, nonames: bool) -> DataFrame: cols = range(ncols) if ncols else None return pandas.read_csv(path, usecols=cols, sep='\t', skipinitialspace=True, header='infer' if not nonames else None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_tsv(path):\n return pd.read_csv(path, sep=\"\\t\", index_col=0)", "def read_tsv(filename):\n df = pd.read_csv(filename, delim_whitespace=True, index_col=0)\n df = df.apply(pd.to_numeric, errors='coerce')\n return df", "def _read_tab(pth):\n if not os.path.exists(pth):\n ...
[ "0.79711896", "0.73769647", "0.69390786", "0.69116086", "0.6893305", "0.68049663", "0.6664647", "0.65980965", "0.6529488", "0.65200025", "0.6507729", "0.64751726", "0.6457839", "0.6429782", "0.6395322", "0.63474363", "0.63474363", "0.63474363", "0.63398993", "0.6332809", "0.6...
0.7644097
1
Transform the dictionary with event data by replacing '' with '_' in key names, converting all int values to string except for the 'total' field and parsing datetime columns for a valid datetime.
def transform_events(event): if isinstance(event, (str, int, float)): return event if isinstance(event, dict): new = event.__class__() for k, v in event.items(): if isinstance(v, int) and k != "total": v = str(v) if k in ["timestamp", "occurred_at"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data(self, data):\n for i, v in data.items():\n field_type = self.get_field_type(i)\n #log.info('i = %s, type = %s', i, field_type)\n if field_type == 'datetime' and isinstance(v, (str, unicode)):\n data[i] = datetime_from_string(v)\n return...
[ "0.6200808", "0.61188394", "0.5884566", "0.5821484", "0.5729959", "0.56744164", "0.55782557", "0.5561974", "0.5447546", "0.5437086", "0.54289067", "0.54042435", "0.5401153", "0.53768057", "0.53729653", "0.53534395", "0.5348543", "0.53289264", "0.532612", "0.52986217", "0.5231...
0.7415578
0
Create a single PolyData circle defined by radius in the XY plane.
def Circle(radius=0.5, resolution=100): points = np.zeros((resolution, 3)) theta = np.linspace(0.0, 2.0 * np.pi, resolution, endpoint=False) points[:, 0] = radius * np.cos(theta) points[:, 1] = radius * np.sin(theta) cells = np.array([np.append(np.array([resolution]), np.arange(resolution))]) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circle(radius = 10, angle_resolution = 2.5, layer = 0):\n D = Device(name = 'circle')\n t = np.linspace(0, 360, int(np.ceil(360/angle_resolution) + 1)) * pi/180\n xpts = (radius*cos(t)).tolist()\n ypts = (radius*sin(t)).tolist()\n D.add_polygon(points = (xpts, ypts), layer = layer)\n return D...
[ "0.7496994", "0.73851115", "0.73365486", "0.72486854", "0.7002833", "0.6994027", "0.6826198", "0.6726988", "0.66819924", "0.66433734", "0.66133183", "0.66049355", "0.65956837", "0.6576743", "0.65744984", "0.65148747", "0.6504231", "0.64959633", "0.6460597", "0.6448325", "0.64...
0.7733564
0
Given a dict, return a copy of it, excluding keys with None values. Does not recursively clear nested dicts.
def clear_dict(d: dict) -> dict: # TODO delete if not used return {k: v for k, v in d.items() if v is not None}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compact_dict(source_dict):\n return {k: v for k, v in source_dict.items() if v is not None}", "def purge_none_values(dictionary):\n\n dict_copy = copy.deepcopy(dictionary)\n for key, value in dictionary.iteritems():\n if dictionary[key] is None:\n del dict_copy[key]\n return dic...
[ "0.7628386", "0.75814974", "0.74640125", "0.7459847", "0.7443156", "0.7385451", "0.7365609", "0.7272543", "0.71913683", "0.71317685", "0.70368594", "0.68952477", "0.6858057", "0.6845555", "0.6836348", "0.6806428", "0.6771262", "0.6676578", "0.6636412", "0.66268855", "0.658636...
0.75365114
2
Given a dict, return a copy of it, excluding keys that might hold sensitive information
def safe_dict(d: dict) -> dict: return {k: v for k, v in d.items() if not any(chunk in k for chunk in ["token"])}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanse_dict(original):\n return {k: v for k, v in original.items() if \"_pass\" not in k}", "def _cleanse_dict(original):\n return dict((k, v) for k, v in original.items() if \"_pass\" not in k)", "def clean_dict(dictionary):\n return {k: v for k, v in dictionary.items() if v}", "def shallow(d...
[ "0.75246584", "0.73510236", "0.722893", "0.7213456", "0.6962171", "0.6903963", "0.68453515", "0.68413895", "0.68359196", "0.67517895", "0.672259", "0.66582173", "0.664779", "0.6613026", "0.6572578", "0.65639895", "0.6555985", "0.648151", "0.6462428", "0.6434055", "0.641859", ...
0.7063957
4
Finds the shortest distance from this site to the other
def diff(self, other): Δx = self.x - other.x Δy = self.y - other.y return (Δx, Δy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, first, second):\r\n if not((0 <= first < self.size) and (0 <= second < self.size)):\r\n raise ValueError(\"Cannot find distances for nodes not in the graph\")\r\n if first == second:\r\n return 0\r\n dist_tracker = self._perform_dijkstra(first, second)...
[ "0.754155", "0.75292915", "0.73257303", "0.70983326", "0.6987594", "0.6855266", "0.6806558", "0.6805068", "0.68008614", "0.67949504", "0.6786716", "0.67866313", "0.6740456", "0.673381", "0.672072", "0.6720456", "0.6717596", "0.67046404", "0.6703694", "0.6698944", "0.66904265"...
0.0
-1
load_config loads a config using !from_yaml
def test_load_config_image_from_yaml(self): with open(".gitlab.yml", "w") as f: f.write("image: dummian:8.2\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml image\n") config = scuba.config.load_config(".scuba.yml") assert config.imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(config: str) -> dict:\n with open(config, 'r') as file:\n config = yaml.load(file, Loader=yaml.SafeLoader)\n\n return config", "def load_yaml(config):\n try:\n return yaml.safe_load(config)\n except yaml.YAMLError as e:\n raise Exception('Error occurred while parsin...
[ "0.7662517", "0.76569915", "0.7614622", "0.74782324", "0.74631006", "0.73996955", "0.7390231", "0.7357479", "0.73530567", "0.73440576", "0.7330048", "0.7329885", "0.7322526", "0.72588974", "0.72367024", "0.7208276", "0.72014207", "0.71350396", "0.7133662", "0.7131183", "0.707...
0.6694121
47
load_config loads a config using !from_yaml with nested keys
def test_load_config_image_from_yaml_nested_keys(self): with open(".gitlab.yml", "w") as f: f.write("somewhere:\n") f.write(" down:\n") f.write(" here: dummian:8.2\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml somewhere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(config_file): \n with open(config_file) as in_handle: \n config = yaml.load(in_handle) \n # for field, setting in config.items(): \n # if isinstance(config[field], dict): \n # for sub_field, sub_setting in config[field].items(): \n # config[...
[ "0.74967885", "0.7101293", "0.7000626", "0.6918879", "0.69031525", "0.68586016", "0.68076664", "0.67671186", "0.673936", "0.6735072", "0.67174804", "0.6694522", "0.66731805", "0.6650581", "0.6649014", "0.66254085", "0.6618602", "0.6605472", "0.65867007", "0.65815943", "0.6579...
0.71996784
1
load_config loads a config using !from_yaml with nested keys containing escaped '.' characters
def test_load_config_image_from_yaml_nested_keys_with_escaped_characters(self): with open(".gitlab.yml", "w") as f: f.write(".its:\n") f.write(" somewhere.down:\n") f.write(" here: dummian:8.2\n") with open(".scuba.yml", "w") as f: f.write('image: !fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(config: str):\n\n def join(loader, node):\n seq = loader.construct_sequence(node)\n return \"/\".join([str(i) for i in seq])\n\n yaml.add_constructor(\"!join\", join)\n with open(config, \"r\") as config_file:\n config = yaml.load(config_file, yaml.FullLoader)\n\n r...
[ "0.7397329", "0.7327725", "0.7039406", "0.69337434", "0.66334534", "0.66035765", "0.65535223", "0.65473443", "0.65364087", "0.6518882", "0.65025216", "0.6487534", "0.643998", "0.6433053", "0.6430287", "0.6380453", "0.63797176", "0.63779736", "0.63753897", "0.6320193", "0.6317...
0.7293237
2
load_config loads a config using !from_yaml from cached version
def test_load_config_from_yaml_cached_file(self): with open(".gitlab.yml", "w") as f: f.write("one: dummian:8.2\n") f.write("two: dummian:9.3\n") f.write("three: dummian:10.1\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n if (self.last_updated != os.stat(self.config_file).st_mtime):\n with open(self.config_file, 'r') as stream:\n self.config = yaml.load(stream, Loader=yaml.FullLoader)\n self.last_updated = os.stat(self.config_file).st_mtime\n return sel...
[ "0.74605465", "0.73516935", "0.725029", "0.7149449", "0.7149237", "0.7147591", "0.7123556", "0.70381683", "0.7008084", "0.69820476", "0.6980895", "0.69355094", "0.68981", "0.6865641", "0.6857859", "0.6835356", "0.6824107", "0.6824058", "0.6801342", "0.67977077", "0.6772564", ...
0.71346694
6
load_config raises ConfigError when !from_yaml references nonexistant key
def test_load_config_image_from_yaml_nested_key_missing(self): with open(".gitlab.yml", "w") as f: f.write("somewhere:\n") f.write(" down:\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml somewhere.NONEXISTANT\n") self._invalid_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cfg_from_yaml(self):\n try:\n with open(self.parsed_cfg_path, 'r') as cfg_yaml:\n self.from_yaml_cfg_dict = yaml.load(cfg_yaml)\n except Exception as exc:\n print(exc)\n traceback.print_exc()\n self.from_yaml_cfg_dict = {}", "def _l...
[ "0.7246519", "0.7176153", "0.7101333", "0.70849425", "0.7051615", "0.70417285", "0.7019878", "0.6885675", "0.68779504", "0.68071926", "0.68046737", "0.679213", "0.67779464", "0.6739041", "0.67110574", "0.6682858", "0.66789955", "0.66719526", "0.6670889", "0.6665214", "0.66367...
0.7148916
2
load_config !from_yaml works with unicode args
def test_load_config_image_from_yaml_unicode_args(self): with open(".gitlab.yml", "w") as f: f.write("𝕦𝕟𝕚𝕔𝕠𝕕𝕖: 𝕨𝕠𝕣𝕜𝕤:𝕠𝕜\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml 𝕦𝕟𝕚𝕔𝕠𝕕𝕖\n") config = scuba.config.load_config(".scu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(yaml_config: Union[Dict, str]) -> Dict:\n\n if isinstance(yaml_config, str):\n with open(yaml_config) as f:\n return yaml.full_load(f)\n\n return yaml_config", "def load_yaml(config):\n try:\n return yaml.safe_load(config)\n except yaml.YAMLError as e:\n ...
[ "0.67083406", "0.67006403", "0.66885567", "0.66283286", "0.66102433", "0.65191805", "0.64347154", "0.6357714", "0.63516724", "0.6310863", "0.6291753", "0.627328", "0.62704396", "0.626285", "0.62551314", "0.62243545", "0.62227863", "0.6215984", "0.61968285", "0.61824435", "0.6...
0.7151937
0
load_config raises ConfigError when !from_yaml has missing args
def test_load_config_image_from_yaml_missing_arg(self): with open(".gitlab.yml", "w") as f: f.write("image: dummian:8.2\n") with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .gitlab.yml\n") self._invalid_config()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(config):\n try:\n return yaml.safe_load(config)\n except yaml.YAMLError as e:\n raise Exception('Error occurred while parsing YAML: {}'.format(e))", "def _load_yaml_config(config_file):\n if type(config_file) is file:\n Config.CONFIG.update(yaml.load(config_fil...
[ "0.7173345", "0.7074417", "0.70231366", "0.69667155", "0.6937838", "0.6925353", "0.6866027", "0.68544793", "0.6818331", "0.68133855", "0.67801815", "0.6750318", "0.67498356", "0.6739422", "0.6712157", "0.66963464", "0.6694093", "0.6644718", "0.663313", "0.661109", "0.6601818"...
0.6787904
10
load_config safely loads yaml
def test_load_config_safe(self): self.__test_load_config_safe(".scuba.yml")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(config):\n try:\n return yaml.safe_load(config)\n except yaml.YAMLError as e:\n raise Exception('Error occurred while parsing YAML: {}'.format(e))", "def load_yaml(config: str) -> dict:\n with open(config, 'r') as file:\n config = yaml.load(file, Loader=yaml.SafeLoader...
[ "0.7922564", "0.76383233", "0.74380124", "0.72929865", "0.7275548", "0.72713375", "0.725051", "0.71944785", "0.7180544", "0.7176743", "0.71489006", "0.7084309", "0.7077633", "0.702928", "0.6990274", "0.6952991", "0.6947313", "0.6944481", "0.6943561", "0.69368", "0.68977624", ...
0.73522353
3
load_config safely loads yaml from external files
def test_load_config_safe_external(self): with open(".scuba.yml", "w") as f: f.write("image: !from_yaml .external.yml danger\n") self.__test_load_config_safe(".external.yml")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(filename):\n with open(filename, \"r\") as stream:\n try:\n global CONFIG\n CONFIG = yaml.load(stream)\n except yaml.YAMLError as ex:\n print(ex)", "def load_yaml(config):\n try:\n return yaml.safe_load(config)\n except yaml.YAMLError...
[ "0.7767353", "0.7750427", "0.766841", "0.7621169", "0.7610444", "0.7501892", "0.7489479", "0.7482247", "0.74770707", "0.74225044", "0.7404773", "0.7386058", "0.7369059", "0.73674613", "0.73594975", "0.72513354", "0.72486204", "0.7246027", "0.71897256", "0.7180182", "0.7146027...
0.7298079
15
Toplevel environment can be loaded (dict)
def test_env_top_dict(self, monkeypatch): with open(".scuba.yml", "w") as f: f.write( r""" image: na environment: FOO: This is foo FOO_WITH_QUOTES: "\"Quoted foo\"" # Quotes included in value BAR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_environment():\n return dict(_VARS)", "def load_evironment():\n environment = Utility.load_yaml(os.getenv(\"system_file\", \"./system.yaml\"))\n for key in environment:\n if key in os.environ:\n environment[key] = os.getenv(key)\n Utility.environment ...
[ "0.6648555", "0.6597005", "0.6487911", "0.63255835", "0.63044184", "0.62796676", "0.62698793", "0.6264479", "0.6199909", "0.6194534", "0.61686325", "0.61536723", "0.60669166", "0.60420144", "0.6040058", "0.6039429", "0.6032976", "0.6018155", "0.6018155", "0.6018155", "0.60181...
0.58126545
36
Character data node init
def __init__(self): super(CharacterDataNode, self).__init__() self.character_name = 'Unknown' # Name of the character self.root_node = None # Root node associated to the character self.skeletal_meshes = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, char):\n import collections\n self.char = char\n self.size = 0\n self.children = dict()", "def __init__(self, data, node):\n self.data = data\n self.node = node", "def init_data_item(self, data):\n construct_str = 'nodeitem.NodeItem('\n ...
[ "0.6773166", "0.6669601", "0.66346604", "0.66345835", "0.65721804", "0.6520413", "0.6346962", "0.6336634", "0.6329162", "0.63037205", "0.6276409", "0.62497646", "0.62471926", "0.6170438", "0.6134129", "0.61222816", "0.6108371", "0.60643643", "0.60591877", "0.598203", "0.59737...
0.77320343
0
Setup a root node for this character. Must be a joint
def set_root_node(self, new_root): # TODO - Improve validation if pymel.general.nodeType(new_root) != 'joint': log.warning("Can't set root joint if this is not a joint type node ({0})".format(new_root)) return False self.root_node = new_root return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.root = Node('')", "def __init__(self):\n self.root = Node(\"\")", "def __init__(self):\n self.root = Node(\"\")", "def set_root(self):\n try:\n _check_call(_LIB.TreeliteTreeBuilderSetRootNode(\n self.tree.handle,\n ctypes.c_int...
[ "0.67632425", "0.67045146", "0.67045146", "0.6692492", "0.6635769", "0.65280676", "0.65280676", "0.65280676", "0.6489649", "0.64599687", "0.64131874", "0.6401257", "0.6383394", "0.6361656", "0.62845606", "0.6249673", "0.6230391", "0.6230391", "0.61666733", "0.61581814", "0.61...
0.6502299
8
Return the apf location
def __apf_cmd(cmd): apf_cmd = "{} {}".format(salt.utils.path.which("apf"), cmd) out = __salt__["cmd.run_all"](apf_cmd) if out["retcode"] != 0: if not out["stderr"]: msg = out["stdout"] else: msg = out["stderr"] raise CommandExecutionError("apf failed: {}".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getapxs_location():\n return getconfigure_option(\"APXS\")", "def cal_location(self):\n return self.setup_location.name", "def get_location(self):\r\n return None", "def get_location(self):\n\t\treturn self.location", "def location(self) -> str:\n return pulumi.get(self, \"locat...
[ "0.6971869", "0.6777589", "0.6734329", "0.6646589", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.66165495", "0.6546898", "0.6477437", "0.64720845", "0...
0.0
-1
Sets the fast_web_view of this ImageSaveAsPDFParameters.
def fast_web_view(self, fast_web_view): self._fast_web_view = fast_web_view
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_view_false(self) -> None:\n\n self.view = False\n pass", "def high_res_pdf(self, high_res_pdf):\n\n self._high_res_pdf = high_res_pdf", "def _set_foscam_mjpeg(self, **kwargs):\n self.foscam_mjpeg = kwargs.get(\"value\")\n self.parent.logger.info(\"CameraServer: Foscam...
[ "0.46952015", "0.45904446", "0.455817", "0.44861633", "0.4451605", "0.44381818", "0.44155088", "0.4385569", "0.4349118", "0.43160173", "0.43160042", "0.4308238", "0.429454", "0.42652494", "0.42652494", "0.4247766", "0.42318526", "0.4222948", "0.42052647", "0.41956872", "0.419...
0.7444347
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ImageSaveAsPDFParameters): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, ImageSaveAsPDFParameters): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8455985", "0.83913255", "0.81440157", "0.8140831", "0.8132328", "0.80937284", "0.809181", "0.809181", "0.809181", "0.808509", "0.808509", "0.8076134", "0.8076134", "0.8065528", "0.80422795", "0.80422795", "0.80422795", "0.80422795", "0.80422795", "0.80422795", "0.80422795"...
0.0
-1
Initialize components distribution and velocity in the domain
def initializeDomainCondition(self): print('Initialize the condition.') self.fluidPDF = np.zeros([self.typesFluids, self.ny, self.nx, 9]) self.fluidsDensity = np.zeros([self.typesFluids, self.ny, self.nx]) self.physicalVX = np.zeros([self.ny, self.nx]) self.physicalVY = np.zeros...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, timestep=1.0 * simtk.unit.femtoseconds):\n\n super(VelocityVerletIntegrator, self).__init__(timestep)\n\n self.addPerDofVariable(\"x1\", 0)\n\n self.addUpdateContextState()\n self.addComputePerDof(\"v\", \"v+0.5*dt*f/m\")\n self.addComputePerDof(\"x\", \"x+dt*v...
[ "0.6884739", "0.6825542", "0.6709287", "0.6703078", "0.66942406", "0.6651032", "0.660602", "0.65717", "0.65647984", "0.6543567", "0.6480192", "0.6465426", "0.6458107", "0.6416977", "0.6411956", "0.64095217", "0.63981825", "0.6369439", "0.6342171", "0.6328485", "0.63275486", ...
0.6523691
10
Subtracts two `Number` instances.
def __call__(self, a, b): # STUDENT CODE HERE raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtraction(self, a, b):\n if not check_arguments(a, b): # check if arguments are numbers\n self.last_result = a - b", "def subtract(num1, num2):\n return num1 - num2", "def subtract(num1, num2):\n return num1 - num2", "def subtract(num1, num2):\n return num1 - num2", "def sub...
[ "0.75077295", "0.74652606", "0.74652606", "0.74326175", "0.734516", "0.73340017", "0.7297689", "0.72322905", "0.7125775", "0.7006888", "0.7004714", "0.6992147", "0.6950884", "0.68937534", "0.68277246", "0.68277246", "0.6754556", "0.6707812", "0.6693575", "0.66838354", "0.6662...
0.0
-1
This function gives suggestions if 'more than just topk' oversight is detected in the results generated by the topk. This function gives suggestions to increasse k if some of the rows after the kth row are very similar to the kth row. Parameter used to decide if a row is similar to the kth row. absolute value of (row k...
def more_than_just_topk(result_table, k, metric): num_rows = result_table.shape[0] # No suggestion if all rows already in the result if k >= num_rows or k == -1: return # standard deviation of top k rows standard_deviation_topk = None if k == 1: standard_deviation_topk = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prob_in_top_k(\n clean_values, noisy_values, noise_stddev, noisy_top_values, k):\n batch = tf.shape(clean_values)[0]\n m = tf.shape(noisy_top_values)[1]\n top_values_flat = tf.reshape(noisy_top_values, [-1])\n # we want to compute the threshold that a particular value would have to\n # e...
[ "0.65554506", "0.64468807", "0.6255513", "0.6182242", "0.61621714", "0.6062773", "0.5963779", "0.5955465", "0.59196246", "0.59175235", "0.5868671", "0.5854577", "0.5845027", "0.5843049", "0.5834553", "0.5827921", "0.5827921", "0.5819064", "0.5816499", "0.5784286", "0.5770346"...
0.83396065
0
return the mean model response to each exemplar (first dim), collapsing all others.
def meanresponse(resp): return tf.reduce_mean(tf.convert_to_tensor(resp), axis=[1, 2, 3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean(self):\r\n for i in range(1,len(self.data[0])):\r\n self.prom.append(np.mean(self.data[:,i]))", "def _get_mean(self):\n return [layer._get_mean() for layer in self.layers]", "def _ave(self):\n\n return np.asarray(np.mean(self.model_estim.x, axis=0)).flatten(...
[ "0.6498413", "0.629923", "0.6207554", "0.619732", "0.61925894", "0.59959745", "0.5861261", "0.5738691", "0.572767", "0.5724939", "0.57123107", "0.5694546", "0.56849164", "0.568482", "0.56847805", "0.5663453", "0.56371814", "0.5628797", "0.5620261", "0.5618196", "0.5565602", ...
0.585646
7
convert square distance matrix in rdm to vector form (n by 1).
def square2vec(mat): with tf.name_scope("rsa-square2vec"): mat = tf.convert_to_tensor(mat) return tf.expand_dims(tf.boolean_mask(mat, triuind(mat)), axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrixToVector(self,mx):\n return FreeCAD.Base.Vector(mx[0]/1000,mx[1]/1000,mx[2]/1000)", "def matrix_to_vector(input):\n input_h, input_w = input.shape\n output_vector = np.zeros(input_h*input_w, dtype=input.dtype)\n # flip the input matrix up-down because last row should go first\n input...
[ "0.65430945", "0.65075755", "0.64591515", "0.6274696", "0.6137485", "0.6123296", "0.6120119", "0.60777897", "0.6064118", "0.6000758", "0.59729254", "0.5941047", "0.5917265", "0.5914564", "0.5837208", "0.582516", "0.5798215", "0.57957697", "0.5763154", "0.57584983", "0.5756308...
0.6012566
9
Return a generator, which generates raw (no preprocessing such as tokenization) batches
def gen_batches(self, batch_size: int, data_type: str = 'train', shuffle: bool = None, reset: bool = None) -> Generator: if shuffle is None: shuffle = self.shuffle data = self.data[data_type] cursors = self._cursors[data_type] last_batches = self._last_ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_batch(self):\n batch_size = self.batch_size\n shuffle = self.shuffle\n data = np.array(self.sentences)\n\n data_size = len(data)\n num_batches_per_epoch = int((len(data) - 1) / batch_size) + 1\n while True:\n # shuffle the data at starting of each epoch\...
[ "0.6927465", "0.6899223", "0.662698", "0.6561282", "0.6541137", "0.65196735", "0.6505837", "0.6502941", "0.6488995", "0.6482705", "0.646137", "0.64584655", "0.6456909", "0.6442572", "0.6435494", "0.63486934", "0.63311666", "0.63164526", "0.6310376", "0.6307752", "0.63041866",...
0.0
-1
Create and configure an instance of the Flask application.
def create_app(config_filename=None, additional_config=None, hooks=None): from flask.logging import default_handler log.addHandler(default_handler) log.setLevel(logging.INFO) # first handle the configuration file before the flask app will be created if not config_filename: config_filename ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app...
[ "0.8524696", "0.8517006", "0.85037076", "0.83318627", "0.8239789", "0.82314533", "0.8200278", "0.81295806", "0.80290186", "0.802702", "0.8019662", "0.799871", "0.7985015", "0.79785866", "0.7973067", "0.79704666", "0.7960042", "0.79545814", "0.79525906", "0.7946485", "0.793727...
0.0
-1
Creates byte plot from byte array. Returns image array
def bytePlot(f): dimensions = getDims(f) data = np.array(f) data = np.pad( data, (0, dimensions[0]-(len(data)%dimensions[0])), 'constant') data = np.reshape(data, (-1, dimensions[0])) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def muestraPokemon(bytes):\n image = Image.open(io.BytesIO(bytes))\n data = np.array(image)\n plt.imshow(data)\n plt.axis('off')\n plt.show()", "def bytes_to_img(bytes_array):\n stream = BytesIO(bytes_array)\n image = Image.open(stream).convert(\"RGBA\")\n\n return image", "def image_de...
[ "0.7213027", "0.68780875", "0.6631396", "0.6403796", "0.6296109", "0.6274681", "0.6257964", "0.6176403", "0.6117121", "0.6113355", "0.606968", "0.60337746", "0.6025268", "0.60005194", "0.5996956", "0.59891593", "0.59498394", "0.59484744", "0.5934177", "0.5928917", "0.5924777"...
0.6494793
3
Retrieve a single client by name The key must contain ``@`` and a trailing ``/`` name. Calling ``self.GetClient().GetFullName()`` from an ``On`` hook doesn't guarantee the latter. See ``OnClientDisconnect``
def get_client(self, name): return self.get_clients(as_dict=True).get(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client(self, clientname):\n client = self.dbsession.query(Client).filter_by(clientname=clientname).all()\n if not client:\n return self.create_client({'clientname': clientname})\n else:\n return client[0]", "def get_client(self, user_id: int, client_name: str) -...
[ "0.66806144", "0.6642104", "0.6550581", "0.64839524", "0.6437076", "0.61272925", "0.6059884", "0.6059884", "0.5999295", "0.5990409", "0.5942269", "0.58982915", "0.58647853", "0.5819262", "0.58134097", "0.5786437", "0.57821876", "0.5654998", "0.56339943", "0.5531835", "0.55317...
0.7064498
0
Return all clients as a tuple (of names or objs) or a dict
def get_clients(self, just_names=False, as_dict=False): # Should be mod-type agnostic; GetAllClients() replaces # # flatten_set(net.GetClients() for net in networks) # clients = self.GetUser().GetAllClients() if just_names: return tuple(c.GetFullName() for c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()", "def get_clients(self):\n\n return (self._clients['pps'], self._clients['pfs'])", "def get_clients():\n clients = Client.query.all()\n ...
[ "0.7252485", "0.7005796", "0.69259083", "0.68608856", "0.6695402", "0.6692282", "0.6663961", "0.6626883", "0.6621288", "0.66076595", "0.65787727", "0.65708333", "0.6536851", "0.65243685", "0.65226275", "0.64949316", "0.64949316", "0.64037514", "0.6400282", "0.63723004", "0.63...
0.82112503
0
Returns the UNIX timestamp of the last ISS measurement
def getIssTime(issRequest): rawTime = issRequest['timestamp'] formattedTime = time.strftime('%A, %d %b %Y %H:%M:%S', time.localtime(rawTime)) return formattedTime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_last_meas_time(self):\n\n #if flag for whole data regeneration is set\n if self._process_type == 'full_gen':\n return datetime.datetime(1900, 1, 1, 0, 0, 0)\n \n \n res = self._db.Query(\"\"\"SELECT last_measurement_time\n FROM last...
[ "0.69655097", "0.6666252", "0.6634982", "0.65988964", "0.65825355", "0.6574659", "0.6571286", "0.6546085", "0.65168715", "0.6499062", "0.6462474", "0.64609724", "0.6456404", "0.64449596", "0.6437566", "0.6434248", "0.64249194", "0.6423696", "0.6415865", "0.6405024", "0.639359...
0.589137
87
Adds a bounding box to an image. Bounding box coordinates can be specified in either absolute (pixel) or normalized coordinates by setting the use_normalized_coordinates argument. Each string in display_str_list is displayed on a separate line above the bounding box in black text on a rectangle filled with the input 'c...
def draw_bounding_box_on_image(image, ymin, xmin, ymax, xmax, color='red', thickness=4, use_normalized_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_box_on_image(image, ymin, xmin, ymax, xmax, color, font, thickness=2, display_str_list=()):\n draw = ImageDraw.Draw(image)\n im_width, im_height = image.size\n (left, right, top, bottom) = (xmin * im_width, xmax * im_width,\n ymin * im_height, ymax * im_h...
[ "0.6854044", "0.684725", "0.6781824", "0.600905", "0.5976442", "0.5970373", "0.59271926", "0.58666396", "0.58666396", "0.58504224", "0.5824249", "0.58179194", "0.58142525", "0.5771489", "0.57477534", "0.57123476", "0.5711239", "0.57072484", "0.5706082", "0.56783766", "0.56748...
0.6202023
3
Just like Theano function. Take a bunch of tensorflow placeholders and expressions computed based on those placeholders and produces f(inputs) > outputs. Function f takes values to be fed to the input's placeholders and produces the values of the expressions in outputs. Input values can be passed in the same order as i...
def func(inputs, outputs, updates=None, givens=None): if isinstance(outputs, list): return _Function(inputs, outputs, updates, givens=givens) elif isinstance(outputs, (dict, collections.OrderedDict)): f = _Function(inputs, outputs.values(), updates, givens=givens) return lambda *args, **...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tffunc(*argtypes):\n placeholders = list(map(tf.placeholder, argtypes))\n\n def wrap(f):\n out = f(*placeholders)\n\n def wrapper(*args, **kw):\n return out.eval(dict(zip(placeholders, args)), session=kw.get('session'))\n\n return wrapper\n\n return wrap", "def tffunc...
[ "0.6410023", "0.63773185", "0.5803251", "0.579169", "0.5772363", "0.5771065", "0.5765222", "0.56945056", "0.5623059", "0.5603433", "0.5523509", "0.5519039", "0.5519024", "0.55158305", "0.54767543", "0.54767454", "0.5471793", "0.5465251", "0.5461584", "0.5430087", "0.5427629",...
0.52574664
34
Simplify the given object.
def simplify(self, obj): result = self.process_object(obj, False) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify(self, **kwargs):\n from sympy.simplify.simplify import simplify\n return simplify(self, **kwargs)", "def simplify(self, **kwargs):\n return self", "def process_object(self, obj, skip_reccursive_call=True):\n\n should_skip = self.already_processed(obj) or skip_reccursive...
[ "0.6332809", "0.63156456", "0.62875587", "0.6247278", "0.6085383", "0.58600575", "0.5754054", "0.5734639", "0.56420505", "0.55816114", "0.5576584", "0.555476", "0.5488203", "0.54677874", "0.54513794", "0.53992957", "0.538749", "0.53140986", "0.53129834", "0.530045", "0.529253...
0.8506023
0
Compute softmax values for each sets of scores in x.
def softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7797319", "0.7761927", "0.7760702", "0.7757607", "0.76584643", "0.76584643", "0.76584643", "0.76584643", "0.7585805", "0.7431572", "0.74072486", "0.7393695", "0.73585564", "0.7317323", "0.726931", "0.72627705", "0.72616196", "0.72570264", "0.7230177", "0.7214726", "0.72018...
0.7095703
39
This function returns a string with 3 decimal places, given the input x
def form2(x, pos): return '%.2f' % x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_frac_format(x):\n\n x = x % 1\n fraction = Fraction(x).limit_denominator(8)\n if np.allclose(x, 1):\n x_str = \"0\"\n elif not np.allclose(x, float(fraction)):\n x = np.around(x, decimals=2)\n x_str = f\"{x:.3g}\"\n else:\n x_str = str(fraction)\n return x_s...
[ "0.74330246", "0.73222816", "0.71347195", "0.7102952", "0.6881343", "0.68126106", "0.67914736", "0.67914736", "0.67914736", "0.67691386", "0.6757339", "0.67184985", "0.66327757", "0.65773183", "0.65640175", "0.6532045", "0.65211034", "0.6498337", "0.6473129", "0.6463838", "0....
0.65131015
18
This function returns a string with 3 decimal places, given the input x
def form5(x, pos): return '%.5f' % x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_frac_format(x):\n\n x = x % 1\n fraction = Fraction(x).limit_denominator(8)\n if np.allclose(x, 1):\n x_str = \"0\"\n elif not np.allclose(x, float(fraction)):\n x = np.around(x, decimals=2)\n x_str = f\"{x:.3g}\"\n else:\n x_str = str(fraction)\n return x_s...
[ "0.7432038", "0.7322023", "0.7134828", "0.7102866", "0.6880853", "0.68135667", "0.67921656", "0.67921656", "0.67921656", "0.6768177", "0.67575896", "0.6718341", "0.66334116", "0.65642065", "0.653218", "0.6521565", "0.6514023", "0.6514023", "0.6514023", "0.6514023", "0.6498645...
0.657788
13
Get the paper that created this data set.
def from_paper(self) -> str: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getData(self):\r\n symp = self.symposiumBox.getData()\r\n boxData = self.authorBox.getData()\r\n authorID = self.authorLookup[boxData[0]]\r\n correspondID = self.authorLookup[self.authorList[self.correspond.getIndex()]]\r\n authorList=[self.authorLookup[auth] for auth in boxD...
[ "0.61027205", "0.57192576", "0.5655478", "0.5640668", "0.5612028", "0.55154246", "0.53642476", "0.534515", "0.5334662", "0.5290058", "0.52809685", "0.52597904", "0.5216122", "0.521094", "0.5210836", "0.52064246", "0.51987547", "0.51937944", "0.5171325", "0.51551026", "0.51347...
0.59716743
1
Get the image prefix based on the commit hash. If a tag is specified use the "envoyproxy/envoy" prefix. Otherwise assume that it is a development image and use "envoyproxy/envoydev"
def get_envoy_image_prefix(image_hash: str) -> str: return "envoyproxy/envoy" if source_tree.is_tag(image_hash) else "envoyproxy/envoy-dev"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_image_name(self, tag):\n return self.repository_name + ':' + tag", "def generate_envoy_image_name_from_tag(image_tag: str) -> str:\n image_prefix = get_envoy_image_prefix(image_tag)\n envoy_image = \"{prefix}:{hash}\".format(prefix=image_prefix, hash=image_tag)\n return envoy_image", "def g...
[ "0.6694382", "0.6651909", "0.65922475", "0.64686424", "0.6140387", "0.5984834", "0.5845405", "0.57618654", "0.55199635", "0.54886866", "0.5474003", "0.54211706", "0.52821624", "0.5279971", "0.5278085", "0.5271005", "0.52489614", "0.52199537", "0.5207013", "0.51914144", "0.516...
0.8254447
0
Mock up DELETE request to ADAMS.
def api_delete(mocker): mock = mocker.patch('indico_cern_access.plugin.send_adams_delete_request', autospec=True) mocker.patch('indico_cern_access.util.send_adams_delete_request', new=mock) return mock
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_offers_delete(self, mock_delete):\n form_data = {'_method': 'DELETE'}\n result = self.client.post(f'/offers/{sample_offer_id}/delete',\n data=form_data)\n self.assertEqual(result.status, '302 FOUND')\n mock_delete.assert_called_with({'_id': samp...
[ "0.6943934", "0.6930634", "0.68638957", "0.685229", "0.6846297", "0.68315125", "0.681513", "0.6760945", "0.6724272", "0.6662868", "0.6659014", "0.6657721", "0.66219395", "0.6582937", "0.6580207", "0.6547793", "0.6546771", "0.65401024", "0.6521016", "0.64665455", "0.64419776",...
0.76439506
1
Mock up POST request to ADAMS.
def api_post(mocker): def _mock_post(event, registrations, **kwargs): return CERNAccessRequestState.active, {reg.id: {'$rc': 'test'} for reg in registrations} mock = mocker.patch('indico_cern_access.plugin.send_adams_post_request', side_effect=_mock_post, autospec=True) mocker.patch('indico_cern_ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n return self.doRequest(self.url, method=\"POST\", body=self.input)", "def test_post_adventure(self):\n body = Adventure()\n headers = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n }\n response = sel...
[ "0.6998679", "0.6801106", "0.6720042", "0.6554731", "0.654047", "0.64656997", "0.6437391", "0.637033", "0.63000625", "0.62789404", "0.6200229", "0.61531365", "0.6146407", "0.6139641", "0.61114055", "0.6096282", "0.60944784", "0.60856426", "0.60825217", "0.6076312", "0.6060605...
0.6921636
2
Return string representation of HSP object.
def __repr__(self): return "%s(hit_id=%r, query_id=%r, %r fragments)" % ( self.__class__.__name__, self.hit_id, self.query_id, len(self), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) :\n if not self.parsed :\n return \"\"\n mybuffer = []\n mybuffer.append(\"IPP version : %s.%s\" % self.version)\n mybuffer.append(\"IPP operation Id : 0x%04x\" % self.operation_id)\n mybuffer.append(\"IPP request Id : 0x%08x\" % self.request_id)\n ...
[ "0.6975338", "0.68853915", "0.6824031", "0.6814603", "0.6814603", "0.67952603", "0.67655027", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", "0.67612684", ...
0.0
-1
Return True if it has HSPs.
def __bool__(self): return bool(self._items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def species_has_sp(species_output_dict: dict) -> bool:\n if species_output_dict['paths']['sp'] or species_output_dict['paths']['composite']:\n return True\n return False", "def has_heating_system(bpr):\n\n if bpr.hvac['type_hs'] in {'T1', 'T2', 'T3', 'T4'}:\n return True\n elif bpr.hvac...
[ "0.6777625", "0.651838", "0.64645237", "0.62753725", "0.6225046", "0.611615", "0.611615", "0.60592943", "0.6042399", "0.60121685", "0.59839153", "0.59638685", "0.5960229", "0.5941421", "0.5938746", "0.59112996", "0.59109706", "0.5905075", "0.5905075", "0.5904117", "0.58907527...
0.0
-1
Attempt to load the data_file as a pandas dataframe (df). Return a tuple of whether it was successful, and either the df if it's successful, or an error message if it's not.
def safely_load_data(data_file, data_description, filter_value=None, filter_column=constants.COUNTRY_COL, has_metadata=False, na_values=None): success = False result = None metadata = None file_path = None try: file_path = os.path.join(constants.EXAMPLE_DERIVED_DATA_PATH, data_file) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_df_load(df):\n if isinstance(df, str):\n if df.lower().endswith('json'):\n return _check_gdf_load(df)\n else:\n return pd.read_csv(df)\n elif isinstance(df, pd.DataFrame):\n return df\n else:\n raise ValueError(f\"{df} is not an accepted DataFra...
[ "0.74282837", "0.68274", "0.67002404", "0.6680536", "0.6621154", "0.6587871", "0.65402323", "0.64849114", "0.6378213", "0.637339", "0.63703966", "0.6333754", "0.6296225", "0.62761235", "0.62587833", "0.6245388", "0.62398374", "0.6197478", "0.6181067", "0.617949", "0.6140678",...
0.55845517
79
Get Block from Blockchain hash Hash of Block to get Block The Block in question, or None
def getBlock(self, hash): if hash in self.chain: return self.chain[hash] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getblock(self, hash):\n return self.proxy.getblock(hash)", "def get_block(self, blockhash):\n\n return self._blocks.get(blockhash)", "def get_block(blockhash):\n return requests.get(BASE+f'/api/block/{blockhash}').json()", "def get_block_by_hash(self, block_hash):\n if block_hash ...
[ "0.8088745", "0.7932006", "0.76888233", "0.75275105", "0.7469679", "0.73244554", "0.72164536", "0.71229374", "0.70958316", "0.70637375", "0.7042186", "0.6995765", "0.68818045", "0.68095315", "0.67958313", "0.6741615", "0.6729747", "0.67022264", "0.66468984", "0.6636298", "0.6...
0.8311079
0
Get Transaction from Blockchain hash Hash of Transaction to get Block The Transaction in question, or None
def getTransaction(self, hash): currBlock = self.getBlock(self.tailBlockHash) while currBlock != self.genesisBlock: for o_hash in currBlock.transactions: if hash == o_hash: return currBlock.transactions[hash] currBlock = self.getBlock(currBlock...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBlock(self, hash):\n if hash in self.chain:\n return self.chain[hash]\n return None", "def getblock(self, hash):\n return self.proxy.getblock(hash)", "def get_transaction_block(self, transaction):\n\n return self._blocks._get(transaction._blockid)", "def get_tran...
[ "0.7652921", "0.7391768", "0.71680474", "0.70416385", "0.69978744", "0.6937333", "0.69328654", "0.6911225", "0.6807401", "0.6713435", "0.671008", "0.6666986", "0.6589838", "0.658385", "0.65772635", "0.64845645", "0.6482343", "0.6450124", "0.63796204", "0.63253295", "0.6296616...
0.8123465
0
Return true if it is on.
def is_on(self) -> bool: return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self) -> bool:\n return self._is_on", "def is_on(self):\n return False", "def is_on(self):\n pass", "def is_on(self) -> bool:\n return bool(self._state)", "def is_on(self) -> bool:\n return self._state == STATE_ON", "def is_on(self) -> bool:\n return se...
[ "0.87182", "0.8667624", "0.8604212", "0.8576569", "0.8562623", "0.85221756", "0.85005885", "0.84693134", "0.84693134", "0.84693134", "0.84693134", "0.84693134", "0.8450924", "0.8450924", "0.8450924", "0.8450924", "0.8450924", "0.8450924", "0.8450924", "0.8450924", "0.8450924"...
0.85503066
5
Turn the switch off.
def turn_off(self, **kwargs) -> None: self._device.writeCharacteristic(self._handle, b'\x01', True) self._state = False self.schedule_update_ha_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self, **kwargs):\n self.smartplug.turn_off()", "def off_switch(self):\n self._switch_callback = None", "def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF", "def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self....
[ "0.870139", "0.867637", "0.85906535", "0.8523712", "0.84588856", "0.84180963", "0.8404447", "0.8398465", "0.8375364", "0.83491224", "0.83192796", "0.82949907", "0.8277566", "0.81680954", "0.8155346", "0.8112255", "0.8091075", "0.8072859", "0.8058921", "0.8058517", "0.8041678"...
0.7711405
37
Calculates the flux emitted at a specific angular point on the surface of an asteroid of size unity as a function of angular position, wavelength and the subsolar temperature. Returns flux in units of W m^3.
def calcFluxLambdaEmitted(self, theta, phi, lambd, T_ss): return np.pi * calcPlanckLambda(lambd, self.calcT(theta, phi, T_ss))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux(self, u):\n flu = np.zeros((3,2), dtype=np.float64)\n flu[0,0] = u[1]\n flu[1,0] = u[0] * (u[1]/u[0])**2 + 0.5 * 9.81*u[0]**2\n flu[2,0] = u[1] * u[2]/u[0] #FIXME attenzione che c'è il punto controllare se sono scalari o vettori'\n flu[0,1] = u[2]\n flu[1,1] = u[2...
[ "0.654664", "0.6537078", "0.63214236", "0.6317551", "0.62715125", "0.6098401", "0.60671973", "0.60139096", "0.60008985", "0.59766716", "0.59333634", "0.5929393", "0.59172815", "0.58888257", "0.5882684", "0.58603424", "0.5847912", "0.57674515", "0.5729339", "0.5726251", "0.570...
0.0
-1
Calculates the total flux emitted at the surface of an asteroid of size unity as a function of wavelength and the subsolar temperature. Returns flux in units of W m^3.
def calcTotalFluxLambdaEmitted(self, lambd, T_ss): return integrate.dblquad(lambda theta, phi, lambd, T_ss: (self.calcFluxLambdaEmitted(theta, phi, lambd, T_ss) * self.surfaceElement(theta, phi)), -np.pi/2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.67537916", "0.6419417", "0.6317836", "0.6203594", "0.6197799", "0.6197799", "0.6128091", "0.6090457", "0.60308135", "0.5995237", "0.5968444", "0.5923862", "0.59069866", "0.58935314", "0.5855992", "0.5851437", "0.58371145", "0.5831009", "0.5816396", "0.57614344", "0.5759768...
0.5449956
45
Calculates the flux emitted at a specific angular point on the surface of an asteroid of size unity towards an observer at phase angle alpha as a function of angular position, wavelength, subsolar temperature and phase angle. Returns flux in units of W m^3.
def calcFluxLambdaEmittedToObs(self, theta, phi, lambd, T_ss, alpha): return (calcPlanckLambda(lambd, self.calcT(theta, phi, T_ss)) * self.calcDirectionCosine(theta, phi, alpha))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.60799587", "0.599194", "0.5821909", "0.57912034", "0.57188547", "0.56879926", "0.5686059", "0.565528", "0.56465507", "0.5643009", "0.5635565", "0.5583359", "0.5550661", "0.5526461", "0.5470371", "0.54440033", "0.5439285", "0.5430321", "0.5422019", "0.54203486", "0.54062486...
0.56039226
11
Calculates the total flux emitted at the surface of an asteroid of size unity towards an observer at phase angle alpha as a function of wavelength, subsolar temperature and phase angle. Returns flux in units of W m^3.
def calcTotalFluxLambdaEmittedToObs(self, lambd, T_ss, alpha): return integrate.dblquad(lambda theta, phi, lambd, T_ss, alpha: (self.calcFluxLambdaEmittedToObs(theta, phi, lambd, T_ss, alpha) * self.surfaceElement(theta, phi)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.63297653", "0.6066303", "0.6066303", "0.5937539", "0.59217477", "0.5778781", "0.57011205", "0.5680815", "0.5678868", "0.5619193", "0.56155646", "0.55317485", "0.5530499", "0.55142736", "0.5504296", "0.5490229", "0.54889876", "0.545974", "0.54399985", "0.5422193", "0.539087...
0.5895724
5
This method checks if the articlle an user is accesing is available article__slug specidies that the slug is from the articles object if a no article with such slug exists then it throws an error
def get(self, request, slug): try: user_stat = ReadStats.objects.get(article__slug=slug) except ReadStats.DoesNotExist: return Response({ "message": read_stats_message['read_error']}, status=status.HTTP_404_NOT_FOUND) if user_stat.article_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_article(self, slug):\n try:\n return Article.objects.get(slug=slug)\n except User.DoesNotExist:\n raise Http404", "def article_exists(self, article_id):\n try:\n Article.objects.get(pk=article_id)\n return True\n except Article.DoesN...
[ "0.7114968", "0.63458896", "0.6269295", "0.6162883", "0.6128596", "0.6100415", "0.6093363", "0.60327286", "0.5908312", "0.5873344", "0.5796244", "0.5774993", "0.57501006", "0.57396865", "0.57303363", "0.5721708", "0.57026935", "0.5699692", "0.5638566", "0.5620751", "0.5611091...
0.0
-1
Condense a list and return only its unique entries
def unique(my_list): return [x for x in my_list if x not in locals()['_[1]']]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(input_list):\n output = []\n for item in input_list:\n if item not in output:\n output.append(item)\n return output", "def unique(li):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in li if not (x in seen or seen_add(x))]", "def remove_duplicates(my...
[ "0.76211244", "0.7597022", "0.7535768", "0.74949723", "0.7471992", "0.74687004", "0.7447879", "0.7437954", "0.73535585", "0.7342071", "0.7333456", "0.7293195", "0.72789097", "0.7230809", "0.72256464", "0.7219409", "0.72115535", "0.7194329", "0.7178471", "0.7161638", "0.712335...
0.6963289
35
calculate the distance between two gps coordinates, using haversine function
def haversine(lat1, lon1, lat2, lon2, radius=6371): from math import radians, sin, cos, sqrt, asin dLat = radians(lat2 - lat1) dLon = radians(lon2 - lon1) lat1 = radians(lat1) lat2 = radians(lat2) c = 2 * asin(sqrt(sin(dLat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dLon / 2) ** 2)) return radi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(gps1, gps2):\n return haversine(gps1.lng, gps1.lat, gps2.lng, gps2.lat)", "def haversine(gps1, gps2):\n (lon1, lat1) = gps1\n (lon2, lat2) = gps2\n\n # convert decimal degrees to radians\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])\n\n # haversine formula\n ...
[ "0.8710055", "0.8085694", "0.79954207", "0.7809557", "0.7765757", "0.77369064", "0.7698035", "0.76567465", "0.7645268", "0.7631084", "0.7597548", "0.75961053", "0.7592954", "0.7559397", "0.7551006", "0.75454026", "0.7521209", "0.75154114", "0.75055367", "0.7500601", "0.747829...
0.741362
40
convert a string of a list to just a list
def str_list(x): #import ast #x = ast.literal_eval(x) x = x.strip('][').split(', ') x1 = [n.strip('\'') for n in x] return (x1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_list_works(x):\n import ast\n x = ast.literal_eval(x)\n x = [n.strip() for n in x]\n return (x)", "def parse_string_list(data):\n txt = data.decode()\n x = ast.literal_eval(txt)\n return x", "def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\...
[ "0.7691507", "0.7500651", "0.7414709", "0.7373086", "0.7300588", "0.7138528", "0.71338546", "0.70992327", "0.70885664", "0.70525575", "0.6994265", "0.69736457", "0.69473493", "0.69306576", "0.6923236", "0.69043314", "0.68619287", "0.6850749", "0.68315774", "0.6785007", "0.678...
0.75897926
1
convert a string of a list to just a list
def str_list_works(x): import ast x = ast.literal_eval(x) x = [n.strip() for n in x] return (x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_list(x):\n #import ast\n #x = ast.literal_eval(x)\n x = x.strip('][').split(', ')\n x1 = [n.strip('\\'') for n in x]\n return (x1)", "def parse_string_list(data):\n txt = data.decode()\n x = ast.literal_eval(txt)\n return x", "def str2list(input):\n if isinstance(input, str):...
[ "0.7589705", "0.7500546", "0.7416066", "0.73733807", "0.7300967", "0.71391946", "0.7133623", "0.710074", "0.7087459", "0.705484", "0.6993619", "0.6974645", "0.69477093", "0.6931237", "0.692489", "0.6905707", "0.68628925", "0.68514395", "0.68317235", "0.6785904", "0.6783862", ...
0.7691735
0
Return a queryset of all the owners and admins of this unit for convenience.
def get_organizers(self): return self.members.filter( Q(unitmembership__role=UnitMembershipRole.OWNER) | Q(unitmembership__role=UnitMembershipRole.ADMIN) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_for_admin(self, admin):\n if admin.is_superuser:\n return self.get_query_set()\n return self.get_query_set().filter(owners__user=admin)", "def get_for_admin(self, admin):\n if admin.is_superuser:\n return self.get_queryset()\n return self.get_queryset().f...
[ "0.7516039", "0.7322285", "0.70293033", "0.66553307", "0.6590936", "0.6590936", "0.6475138", "0.64215475", "0.64073217", "0.63022625", "0.61598337", "0.61504847", "0.6134809", "0.60740745", "0.60409486", "0.599006", "0.599006", "0.599006", "0.5986613", "0.5980217", "0.5971873...
0.66669214
3
Get the human readable, localized label for the current role granted by the membership.
def get_human_role(self): return UnitMembershipRole(self.role).label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_label(self):\n\n auth = self.authorizations[0]\n return auth.label", "def role(self) -> str:\n\n assert self.data is not None\n return self.data[\"role\"][\"name\"]", "def _get_label ( self ):\n if self._label is not None:\n return self._label\n retu...
[ "0.70926446", "0.68487775", "0.66320896", "0.660817", "0.656927", "0.64569217", "0.6394352", "0.6394352", "0.6394352", "0.6371444", "0.63599294", "0.6355715", "0.6305506", "0.6271895", "0.62491965", "0.62491965", "0.62491965", "0.62491965", "0.62491965", "0.62491965", "0.6249...
0.7758129
0
The time when the instance was created.
def create_time(self) -> str: return pulumi.get(self, "create_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def time_created(self):\n return self._time_created", "def time_created(self):\n return self._time_created", "d...
[ "0.8855377", "0.8855377", "0.8855377", "0.86619467", "0.86619467", "0.86619467", "0.86619467", "0.8652076", "0.8652076", "0.8617308", "0.85446507", "0.85446507", "0.85446507", "0.8512451", "0.8350305", "0.8350305", "0.8350305", "0.82841694", "0.82841694", "0.82841694", "0.824...
0.8402384
20
The max number of shares allowed.
def max_share_count(self) -> str: return pulumi.get(self, "max_share_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_shares(self) -> Optional[int]:\n return pulumi.get(self, \"max_shares\")", "def social_shares_count_reddit_max(self, social_shares_count_reddit_max):\n\n self._social_shares_count_reddit_max = social_shares_count_reddit_max", "def get_max_readings( self ):\n return 2500", "def ge...
[ "0.8410931", "0.70168024", "0.689584", "0.6800945", "0.6778464", "0.6716524", "0.66333145", "0.6540025", "0.6524961", "0.6496415", "0.6492387", "0.64637446", "0.6454069", "0.64477944", "0.6445869", "0.6382679", "0.6281193", "0.62456375", "0.6228579", "0.62242526", "0.62152076...
0.80759317
1
The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._client.project_name + '/instances/' + self.instance_id", "def get_instance_name ( base_name, instance_type ) :\n return base_name.upper( ) + '-' + instance_type.upper( )", "def url(self) -> str:\n return (\n f\"{self.service_subscription.url}/service-in...
[ "0.8476812", "0.6776807", "0.66590345", "0.6631138", "0.65660524", "0.65229183", "0.6508392", "0.65008974", "0.65008974", "0.6383052", "0.6381309", "0.6381309", "0.6381309", "0.6381309", "0.6381309", "0.6381309", "0.6358876", "0.6358876", "0.63461745", "0.6343731", "0.6335279...
0.0
-1
Return True if user is in the group, False otherwise.
def is_user_in_group(user: str, group: Group) -> bool: if group is None or user is None or user is "": return False if user in group.get_users(): return True for sub_group in group.get_groups(): user_exists = is_user_in_group(user, sub_group) if user_exists: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def is_in_group(user, group_name):\n return is_in_group_user_id(user.id, group_name)", "def is_user_in_group(user, group):\n\n if user == group.get_name():\n return Tr...
[ "0.8791304", "0.84474826", "0.8253319", "0.81782854", "0.8154014", "0.80775934", "0.8077066", "0.7991211", "0.79046553", "0.78879106", "0.7874985", "0.78737533", "0.7837497", "0.7784908", "0.7714273", "0.7684502", "0.76652265", "0.7655611", "0.7571193", "0.7561973", "0.737242...
0.7917411
8