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
Returns a list of paths of all label files.
def get_label_files(path, ext=".txt"): return get_files(path, ext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_file_paths_labels(data_root: str) -> list:\n\n speaker_dirs = os.listdir(data_root)\n all_files = []\n i = 0\n for d in speaker_dirs:\n files = glob.iglob(data_root + '/' + d + '/**/*.wav', recursive=True)\n files = [[f, i] for f in files]\n ...
[ "0.7681277", "0.74249905", "0.742166", "0.73119056", "0.72976214", "0.7211796", "0.7121309", "0.69645387", "0.68985945", "0.689014", "0.68764573", "0.67646277", "0.6759799", "0.671353", "0.6682471", "0.6668028", "0.665166", "0.66508526", "0.65965366", "0.65963733", "0.6588633...
0.7458727
1
Creates a label df with all labels concatenated.
def create_label_df(path): image_files = get_images(path) labels = [get_label(p) for p in image_files] label_df = pd.DataFrame(labels) label_df.fillna(" ", inplace=True) return label_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_labels(self, labels):\n self.labels = pd.DataFrame(labels, index=[\"label\"]).T", "def add_label_counts(labels_df):\n # ---------------------------------------------------------------------\n # label count: count total number of occurences of a label in all label sources\n projects = ['f...
[ "0.6601174", "0.64376587", "0.62578154", "0.6249624", "0.6200135", "0.6038482", "0.599989", "0.59783006", "0.59754735", "0.5972586", "0.5940923", "0.5933921", "0.5933152", "0.5904", "0.58979785", "0.5895999", "0.58786684", "0.58408", "0.5820154", "0.5800604", "0.5785483", "...
0.6924985
0
This function prints and plots the confusion matrix.
def plot_confusion_matrix(cm, classes, title, cmap=plt.cm.Greens): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=45) plt.yticks(tick_marks, classes) thresh = cm.max() / 2. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\"...
[ "0.80894613", "0.80770946", "0.79976976", "0.7946727", "0.7921785", "0.78448296", "0.7833224", "0.7781221", "0.7775631", "0.77574563", "0.77061635", "0.77016985", "0.7692213", "0.76785815", "0.76588994", "0.7641414", "0.7622791", "0.7611233", "0.7610989", "0.7598244", "0.7587...
0.0
-1
Returns the first_name plus the last_name, with a space in between.
def get_full_name(self): full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def get_full_name(se...
[ "0.8313338", "0.8201006", "0.8050338", "0.804109", "0.8017875", "0.8000626", "0.795519", "0.79429793", "0.79429793", "0.79429793", "0.79378104", "0.79291517", "0.792181", "0.79035896", "0.78928083", "0.7890544", "0.78789014", "0.7861626", "0.78531265", "0.7824299", "0.7814202...
0.7747137
40
Build Mask RCNN architecture.
def build(self, mode, config): assert mode in ['training', 'inference'] # Image size must be dividable by 2 multiple times h, w = config.IMAGE_SHAPE[:2] if h / 2**6 != int(h / 2**6) or w / 2**6 != int(w / 2**6): raise Exception("Image size must be dividable by 2 at least 6 t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_fpn_mask_graph(rois, feature_maps, image_meta,\n pool_size, num_classes, train_bn=True):\n # ROI Pooling\n # Shape: [batch, boxes, pool_height, pool_width, channels]\n x = PyramidROIAlign([pool_size, pool_size],\n name=\"roi_align_mask\")([rois, ima...
[ "0.6788", "0.6111088", "0.5963607", "0.59607625", "0.589328", "0.5793005", "0.5762044", "0.5752561", "0.5725694", "0.56989574", "0.5695215", "0.565996", "0.5644273", "0.56100494", "0.5593577", "0.55875045", "0.5573545", "0.55717057", "0.5562425", "0.5555228", "0.55455565", ...
0.0
-1
Rewrites the site homepage using the provided statistics in the homepage template (which is effectively a simple Python format string).
def write_homepage(self, status_info): self.logger.info('writing homepage') with tempfile.NamedTemporaryFile(mode='w', dir=str(self.output_path), encoding='utf-8', delete=False) as index: try: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n return (\n f\"Welcome to Hawaii - Climate Page<br/>\"\n f\"<br/>\"\n f\"This site has data from 01-01-2010 to 08-23-2017<br/>\"\n f\"<br/>\"\n f\"Available Pages:<br/>\"\n f\"<br/>\"\n f\"<br/>\"\n f\" Station Information<br/>\"\n ...
[ "0.6276908", "0.60976577", "0.60905856", "0.59342366", "0.59170914", "0.58998", "0.5886549", "0.5886549", "0.5881639", "0.58562386", "0.5841783", "0.5840922", "0.5840211", "0.5831051", "0.58165556", "0.5794241", "0.5763599", "0.5728043", "0.5684989", "0.5672568", "0.56685036"...
0.5735036
17
Reads the measurement locations to a dataframe
def get_locations(): dtype = {'id': str,\ 'lat': float, 'lon': float, 'address': str, } try: locations = pd.read_csv('Data/kulkijat-mittauspisteet.csv', sep=',', dtype=dtype) except FileNotFoundError: print('\nMittauspisteet sisäl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_wcfat_results(filename, locations=[\"LPH Weld\", \"HPH Weld\", \"BOP Connector\"]):\n\n df = pd.read_csv(filename, skiprows=8, header=None, sep=\"\\t\")\n\n # Drop the event length column and last column, which is just redundant \",\"\n df = df.drop([1, 5], axis=1)\n df.columns = [\"Timestamp\...
[ "0.6726717", "0.6192687", "0.6145748", "0.60519385", "0.6012947", "0.5958969", "0.594782", "0.5936126", "0.5886361", "0.58777523", "0.5847363", "0.583753", "0.5821804", "0.5809421", "0.57882774", "0.5786776", "0.5780281", "0.57786226", "0.5765295", "0.57543725", "0.5731396", ...
0.60247815
4
function to get the embedding value in numpy
def get_embed(self, h, r, t, sess=None): emb_h, emb_r, emb_t = self.embed(h, r, t) h, r, t = sess.run([emb_h, emb_r, emb_t]) return h, r, t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_embedding(self, data):\n # Tensor(n, c)\n cat = data['cat']\n return self.one_hot_embed(cat)", "def get_embed(input_data, vocab_size, embed_dim):\n embedding = tf.Variable(tf.random_uniform((vocab_size,embed_dim), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, input_data)...
[ "0.7076683", "0.68811095", "0.66642505", "0.6661482", "0.65877473", "0.6552888", "0.6498176", "0.64739525", "0.6433262", "0.64089894", "0.63937783", "0.6372262", "0.6363661", "0.6321952", "0.62922394", "0.6286107", "0.6285841", "0.6263035", "0.62367004", "0.6235139", "0.62350...
0.0
-1
Returns the class name.
def class_name(self) -> str: return self.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def className(self):\n namevalue = self.__class__.__name__\n return str(namevalue)", "def class_name(self) -> str:\n return pulumi.get(self, \"class_name\")", "def f_get_class_name(self):\n return self.__class__.__name__", "def class_name(cls):\n return cls.__name__", "def cl...
[ "0.8943811", "0.89224094", "0.8869568", "0.88322103", "0.88322103", "0.8779377", "0.87577206", "0.86535525", "0.86226416", "0.8245469", "0.8192517", "0.810976", "0.81028885", "0.8066916", "0.7961105", "0.7949436", "0.789627", "0.789627", "0.7877397", "0.78693837", "0.78693837...
0.87594235
6
Poll the loop handler thread to check it is running as expected.
def is_alive(self) -> bool: if self._loop_handler: return self._loop_handler.is_alive() else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def checkNewLoop(self):\n pass", "def poll(self):\n while self.running and reactor._started and not reactor._stopped:\n self.check_response_queue()\n sleep(0.5)", "def event_loop(self):\n fds = self.poller.poll(0)\n try:\n if not fds and self.i...
[ "0.74256736", "0.7106724", "0.69701016", "0.68152267", "0.6739361", "0.6738971", "0.6715542", "0.6678881", "0.6613715", "0.65850013", "0.6583121", "0.6553772", "0.6545907", "0.6545867", "0.6535871", "0.6535871", "0.6535871", "0.6535871", "0.6535871", "0.6535871", "0.6535871",...
0.6474665
30
Tests that accessing a following page without credentials is rejected.
def test_unauthorized_following(self): follow = Follows( user_being_followed_id = self.testuser2.id, user_following_id = self.testuser.id ) db.session.add(follow) db.session.commit() with self.client as c: response = c.get(f"/users/{self.tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_following_existing_user_not_authenticated(self):\n self.client.credentials()\n response = self.client.post(\n reverse(\n 'follow',\n kwargs={'username': self.followed['user'].get('username')}\n )\n )\n self.assertEqual(respons...
[ "0.7319878", "0.71709114", "0.7151044", "0.71304643", "0.70958227", "0.70355564", "0.7022304", "0.6899457", "0.68274623", "0.68251395", "0.6824948", "0.680066", "0.6796531", "0.67669344", "0.67561007", "0.6736968", "0.673141", "0.6721031", "0.6720389", "0.6694388", "0.6694388...
0.73165977
1
Tests that accessing a followers page without credentials is rejected.
def test_unauthorized_followers(self): follow = Follows( user_being_followed_id = self.testuser.id, user_following_id = self.testuser2.id ) db.session.add(follow) db.session.commit() with self.client as c: response = c.get(f"/users/{self.tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_list_of_followers_without_auth(self):\n with self.settings(\n EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend'):\n response = self.client.get(self.followers_url)\n self.assertEqual(response.data['detail'],\n \"Authentication ...
[ "0.80370384", "0.75863016", "0.7411454", "0.73758006", "0.7353231", "0.72279394", "0.7214382", "0.714913", "0.70005536", "0.69480914", "0.6931344", "0.68351185", "0.6685287", "0.663357", "0.658625", "0.6569212", "0.6565524", "0.6525673", "0.6496285", "0.6492629", "0.64847374"...
0.7781052
1
Calculates overlap score (|X&Y| / min(|X|,|Y|)) based on predicted and target segmentation mask Supports multiclass (semantic segmentation)
def overlap( pred: np.ndarray, target: np.ndarray, pixel_weight: Optional[Dict[int, np.ndarray]] = None, ) -> Dict: # extract info for the plot labels = np.unique(target) labels = labels[labels != 0] scores = {} for label in labels: mask_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _overlap(p, y, n_classes, bg_class, overlap):\n true_intervals = np.array(_segment_intervals(y))\n true_labels = _segment_labels(y)\n pred_intervals = np.array(_segment_intervals(p))\n pred_labels = _segment_labels(p)\n\n # Remove background labels\n if bg_class is not None:\n true_int...
[ "0.74073464", "0.67874897", "0.6575657", "0.6486074", "0.6339101", "0.6333457", "0.61635536", "0.6158881", "0.6109898", "0.6100126", "0.6083579", "0.603748", "0.6032839", "0.60156506", "0.6012368", "0.59816045", "0.5966908", "0.593614", "0.5920274", "0.5910497", "0.59097177",...
0.6301827
6
display the detail page for the product
def choosen_product(request): query = request.GET.get('product_name','') print(query) product = Product.objects.get(name=query) print(product) lst_cat= [] # cat = Product.category.all() for cat in product.category.all(): print(cat) lst_cat.append(cat) # cat = Category.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_detail(request, product_id):\n product = get_object_or_404(Product, pk=product_id)\n\n context = {\n 'product': product,\n }\n\n return render(request, 'products/product_detail.html', context)", "def product_detail(request, product_id):\n product = get_object_or_404(Product, pk=...
[ "0.8099974", "0.7997321", "0.79333365", "0.780806", "0.777677", "0.7750255", "0.77430534", "0.745343", "0.74094945", "0.7307966", "0.72289425", "0.7121437", "0.7098306", "0.7035987", "0.6972916", "0.696511", "0.6902114", "0.6891725", "0.68183625", "0.67057246", "0.66878283", ...
0.0
-1
Given an input vector of infinity1 magnitude, normalize its values so that the sum of the vector is 1
def normalizeVector(v): normalizer = 1.0 / sum(v) normalized = [i * normalizer for i in v] return normalized
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(my_vector):\n my_vector = np.array(my_vector)\n size = len(my_vector)\n\n sum_ = sum(my_vector)\n if sum_ != 0.0:\n for i in range(size):\n my_vector[i] = my_vector[i] / sum_\n return my_vector", "def normalize_vector (vector ):\r\n\r\n if (np.sum (vector ) == 0)...
[ "0.78790444", "0.7654999", "0.76380426", "0.7536272", "0.73019016", "0.7297697", "0.7286802", "0.7262711", "0.7200771", "0.71918523", "0.71868265", "0.718268", "0.71803904", "0.7168651", "0.713342", "0.7114773", "0.7105557", "0.70998186", "0.70908725", "0.70781374", "0.707438...
0.75347745
4
Return whether MNPuzzle self is equivalent to other.
def __eq__(self, other): return (type(self) == type(other) and (self.from_grid == other.from_grid) and (self.to_grid == other.to_grid))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n for i in range(len(self.puzzle)):\n for j in range(len(self.puzzle[0])):\n if(self.puzzle[i][j] != other.puzzle[i][j]):\n return False\n return True", "def equals(self, other: InputTransform) -> bool:\n return super().eq...
[ "0.7884084", "0.7809546", "0.7805344", "0.7694956", "0.75914407", "0.7474761", "0.7468896", "0.74044824", "0.7375316", "0.73414105", "0.73191506", "0.73190105", "0.7264524", "0.7263841", "0.7250105", "0.7250105", "0.7229176", "0.72085124", "0.71788704", "0.7175089", "0.717454...
0.70483804
34
Return a humanreadable string representation of MNPuzzle self.
def __str__(self): board = '' board_2 = '' for row in self.from_grid: for space in row: board += ' ' + space board += '\n' for row in self.to_grid: for space in row: board_2 += ' ' + space board_2 += '\n' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n puzzle_string = '—' * 13 + '\\n'\n for i in range(self.PUZZLE_NUM_ROWS):\n for j in range(self.PUZZLE_NUM_COLUMNS):\n puzzle_string += '│{0: >2}'.format(str(self.position[i][j]))\n if j == self.PUZZLE_NUM_COLUMNS - 1:\n ...
[ "0.7716857", "0.7612188", "0.75202674", "0.74172086", "0.72640145", "0.7240818", "0.7184408", "0.7157743", "0.7140373", "0.70347947", "0.7016801", "0.7016203", "0.701123", "0.6999637", "0.69924486", "0.69883347", "0.69793785", "0.6976149", "0.6973314", "0.69642156", "0.695069...
0.0
-1
Combine two SweepParam. The parameters are combined with another SweepParam instance to generate a new SweepParam. If the instance has a length M and the parameter has a length N , resulting SweepParam will have length MxN.
def combine(self,sweep2): sweep1=self if not isinstance(sweep2,SweepParam): raise ValueError("the parameter needs to be a SweepParam") init_names=sweep1.names new_names=sweep2.names init_values=[] for x in sweep1.values: if isinstance(x,np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other: 'ModelParameters') -> 'ModelParameters':\n return ModelParameters([self[idx] + other[idx] for idx in range(len(self))])", "def __radd__(self, other: 'ModelParameters') -> 'ModelParameters':\n return self.__add__(other)", "def extend(self, other):\n overlap = [key f...
[ "0.5873824", "0.56465286", "0.5540291", "0.5447841", "0.5389237", "0.5358258", "0.5308901", "0.52810967", "0.5273042", "0.5264155", "0.5264155", "0.51643217", "0.5134226", "0.5092758", "0.50632066", "0.50562054", "0.5029355", "0.4981182", "0.49767885", "0.49306467", "0.492022...
0.76385486
0
Export to csv file
def export2csv(filename, headers, data): click.secho('Do you really want to export file ([y]/n)? ', nl=False, fg='red') c = click.getchar() click.echo() if str.upper(c) != 'Y': sys.exit() today = datetime.now().strftime("%y%m%d%H%M%S") filename = f'{DOW...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_csv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".csv\",\n filetypes=((\"comma seperated values\", \"*.csv\"),\n (\"All Files\", \"*.*\")))\n if outputfile:\n tabledata = self.tabs.window.aistracker....
[ "0.8103572", "0.79266727", "0.78038657", "0.7777636", "0.77257437", "0.7599424", "0.75244427", "0.751852", "0.74882305", "0.7477943", "0.7477943", "0.74016345", "0.7398516", "0.73959523", "0.7373244", "0.73642856", "0.7354679", "0.7348496", "0.7345558", "0.7344115", "0.732573...
0.68728286
90
This is configured to work with an inmemory pandas DataFrame. This setup allows us to run validations before (perhaps unnecessarily) writing any data to disk, as well as at any other stage. Currently using local storage.
def _get_ge_context_local(expectations_path: str) -> BaseDataContext: data_context_config = DataContextConfig( datasources={ "pandas": DatasourceConfig( class_name="PandasDatasource", batch_kwargs_generators={}, # override the CSV default ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_data_frame(self):\n try:\n # Verify the data frame\n pandas.verify_data_frame(self.data_frame)\n except OnTaskDataFrameNoKey as exc:\n self.add_error(None, str(exc))\n return\n\n # Store the data frame in the DB.\n try:\n ...
[ "0.6337147", "0.58452135", "0.58148235", "0.57810354", "0.5771562", "0.5740091", "0.5690264", "0.56309456", "0.55957687", "0.5572796", "0.55216527", "0.54883355", "0.5469551", "0.53767616", "0.53560424", "0.53431785", "0.53026456", "0.5298318", "0.5286887", "0.5258409", "0.52...
0.0
-1
Helper Method. Converts the string s to ASCII using backslashreplace if UTF8 console mode is not supported.
def translateString(s): if HAS_UTF8: return s return str(s.encode(), encoding = "ASCII", errors="backslashreplace")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def console_encode(s):\n if self.encoding.lower() != \"utf-8\":\n return s.encode(self.encoding, \"replace\").decode(self.encoding)\n return s", "def ascii_convert_str(the_str: str):\n return ANSI_ESCAPE.sub(rb\"\", the_str)", "def py_encode_basestring_ascii(...
[ "0.7071936", "0.69075274", "0.64918107", "0.6478208", "0.64735883", "0.64651674", "0.64319843", "0.6339933", "0.6319086", "0.6317929", "0.6248114", "0.6209978", "0.61943907", "0.6049616", "0.59756106", "0.5938578", "0.5936584", "0.5930922", "0.5923326", "0.5912455", "0.589978...
0.60992974
13
Format the string s to be displayed as bold, underlined, negative or any combination of these. This function will automatically append a reset sequence after the text. Manually resetting the formatting is not necessary.
def formatText(s, bold=False, underlined=False, negative=False): if not FORMATTING_AVAILABLE: return s head = "" if bold: head += "\033[1m" if underlined: head += "\033[4m" if negative: head += "\033[7m" return head + s + "\033[0m"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bold(string):\n return BOLD + string + RESETFORMAT", "def bold(self, s):\n return '\\x02%s\\x02' % s", "def bold(string):\n return BOLD + string + END", "def bold(self, string):\n return self.wrap(bold(string))", "def bold(msg):\n return '\\033[1m%s\\033[0m' % msg", "def embold...
[ "0.74200016", "0.73931444", "0.65095335", "0.64862657", "0.62759024", "0.62598115", "0.6205859", "0.6177458", "0.61253005", "0.59057105", "0.5868853", "0.58566475", "0.5785357", "0.5782194", "0.5779407", "0.576035", "0.5745407", "0.57070243", "0.56860864", "0.5685168", "0.564...
0.7816094
0
Initialize this GameState, using is_p1_turn to find who the current player is.
def __init__(self, is_p1_turn: bool, side_length: int, current_board: str, current_ley_lines: list): super().__init__(is_p1_turn) self.current_board = current_board self.current_ley_lines = current_ley_lines self.side_length = side_length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, is_p1_turn, current_total):\n self.p1_turn = is_p1_turn\n self.current_total = current_total", "def __init__(self):\n self.__grid = create_grid(\n Settings.SIZE_X, Settings.SIZE_Y, MarkerType.NONE)\n\n self.__turn = 0\n self.__state = GameState.PLA...
[ "0.6840099", "0.65513474", "0.6454757", "0.638271", "0.6341723", "0.62913465", "0.6184316", "0.61779565", "0.61535907", "0.60984564", "0.60869056", "0.60859674", "0.6073093", "0.60614824", "0.60494417", "0.6037621", "0.60313463", "0.59820634", "0.5915136", "0.58649427", "0.58...
0.588618
19
Return a dash definition of an HTML table for a Pandas dataframe
def make_dash_table(df): table = [] for index, row in df.iterrows(): html_row = [] for i in range(len(row)): html_row.append(html.Td([row[i]])) table.append(html.Tr(html_row)) return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dash_table(selection, df):\n\n df_subset = df.loc[df[\"NAME\"].isin(selection)]\n table = []\n\n for index, row in df_subset.iterrows():\n rows = []\n rows.append(html.Td([row[\"NAME\"]]))\n rows.append(html.Td([html.Img(src=row[\"IMG_URL\"])]))\n rows.append(html.Td([...
[ "0.7303146", "0.7150178", "0.71465176", "0.7117627", "0.68682384", "0.6780832", "0.6762202", "0.67041314", "0.6699682", "0.6674215", "0.66341263", "0.6611604", "0.6597323", "0.64610684", "0.64565516", "0.64484704", "0.64449763", "0.64157796", "0.6381783", "0.63720167", "0.636...
0.76284516
0
Return the work attribute.
def read_work(self): # PROTECTED REGION ID(AsyncTabata.work_read) ENABLED START # return self._work # PROTECTED REGION END # // AsyncTabata.work_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCustomAttribute(self):\n\t\treturn self.Attribute", "def read(self):\n return self.get_attr().Value()", "def attribute(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"attribute\")", "def attribute(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"attribute\")", "de...
[ "0.6520733", "0.6297759", "0.6252592", "0.6252592", "0.6240157", "0.6221853", "0.6211131", "0.6211131", "0.6211131", "0.61921686", "0.61437225", "0.6110662", "0.6097535", "0.60930777", "0.6073989", "0.6067718", "0.60668445", "0.60544235", "0.60543686", "0.6026155", "0.6019510...
0.5692373
60
Return the running_state attribute.
async def read_running_state(self): # PROTECTED REGION ID(AsyncTabata.running_state_read) ENABLED START # return self._running_state # PROTECTED REGION END # // AsyncTabata.running_state_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_state(self) -> int | None:\n return self.cluster.get(\"running_state\")", "def state(self) -> RunState:\n return self._async_scheduler.state", "def running(self): # type: () -> bool\n return self.state['Running']", "def get_state(self):\n return self.state", "def ge...
[ "0.82891697", "0.762371", "0.7526244", "0.7523861", "0.7523861", "0.7504188", "0.75040936", "0.75001734", "0.75001734", "0.74893653", "0.74893653", "0.74893653", "0.74893653", "0.74893653", "0.74570817", "0.74570817", "0.74570817", "0.7450113", "0.7433477", "0.7433477", "0.74...
0.8102592
1
Compute a maximum likelihood tree.
def estimate_tree(self): logger.info('TreeCatTrainer.estimate_tree given %d rows', len(self._added_rows)) complete_grid = self._tree.complete_grid edge_logits = self.compute_edge_logits() edges = estimate_tree(complete_grid, edge_logits) return edges, edge_log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_maximum_value(self):\n if self.root: \n self.max_val = self.root.value\n else:\n return 'No tree found'\n def inner(root):\n if root.left:\n inner(root.left)\n\n if root.right:\n inner(root.right)\n\n if self.max_val < root.value:\n self.max_val = roo...
[ "0.6966076", "0.678775", "0.67694974", "0.6655972", "0.66000867", "0.6526583", "0.6501921", "0.64760333", "0.645983", "0.64407116", "0.6397723", "0.6333651", "0.6279779", "0.6278544", "0.6250795", "0.62198704", "0.6216133", "0.6203859", "0.6185988", "0.6165645", "0.604882", ...
0.0
-1
Prepare mock axis device.
def setup_mock_axis_device(mock_device): def mock_constructor(host, username, password, port, web_proto): """Fake the controller constructor.""" mock_device.host = host mock_device.username = username mock_device.password = password mock_device.port = port return moc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n serial_number = os.environ.get(\"ANDROID_SERIAL\", \"\")\n self.assertTrue(serial_number, \"$ANDROID_SERIAL is empty\")\n self._dut = utils.AndroidDevice(serial_number)\n self._temp_dir = tempfile.mkdtemp()", "def setUp(self):\n # Initialize runtime and MDK:\...
[ "0.6203854", "0.6130477", "0.61156213", "0.6057996", "0.60288376", "0.5934885", "0.5909151", "0.5903352", "0.5903352", "0.5896112", "0.5729406", "0.572272", "0.5654188", "0.56205124", "0.56069463", "0.55872035", "0.5541387", "0.55159056", "0.55146474", "0.5496942", "0.548481"...
0.7789957
0
Test that config flow fails on faulty credentials.
async def test_flow_fails_faulty_credentials(hass): result = await hass.config_entries.flow.async_init( AXIS_DOMAIN, context={"source": "user"} ) assert result["type"] == "form" assert result["step_id"] == "user" with patch( "homeassistant.components.axis.config_flow.get_device", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_wrong_credentials(hass: HomeAssistant, auth_error) -> None:\n\n result = await hass.config_entries.flow.async_init(\n DOMAIN, context={\"source\": config_entries.SOURCE_USER}\n )\n result = await hass.config_entries.flow.async_configure(\n result[\"flow_id\"], user_input=DEMO_...
[ "0.7291825", "0.7233659", "0.72253406", "0.713346", "0.698576", "0.69655895", "0.6949671", "0.6947241", "0.6866848", "0.68621117", "0.67381537", "0.6731365", "0.67082274", "0.67070335", "0.6667081", "0.66505986", "0.6649751", "0.66385955", "0.66336507", "0.6627732", "0.661768...
0.75161356
0
Returns True if there's a repeat in column n
def col_repeat(self, board, n): this_col = [] for i, x in enumerate(board): if i % 12 == n: this_col.append(x) # println("col "+str(n)) # println(this_col) for letter in 'abcdef': if this_col.count(letter) > 1: # pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_col(sudoku):\r\n for col in range(9):\r\n for row in range(8):\r\n test = sudoku[row][col]\r\n for i in range(row+1,9):\r\n if sudoku[i][col] == test:\r\n return True #returns True is there is more than two of the same numbers in a column\...
[ "0.7043869", "0.6976969", "0.6894629", "0.6694764", "0.661783", "0.6513339", "0.64967775", "0.64636016", "0.6400933", "0.6364203", "0.6359629", "0.6325058", "0.63167566", "0.6282769", "0.62749267", "0.62481886", "0.62461656", "0.624436", "0.619371", "0.618974", "0.6165413", ...
0.7761181
0
Get expiry date of cert's.
def ssl_expiry_datetime(hostname): context = ssl.create_default_context() conn = context.wrap_socket( socket.socket(socket.AF_INET), server_hostname=hostname, ) # 3 second timeout conn.settimeout(3.0) conn.connect((hostname, 443)) ssl_info = conn.getpeercert() ssl_date_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date", "def get_SSL_Expiry_Date(host, port) -> 'byte string':\n cert = ssl.get_server_certificate((host, port))\n x509 = ...
[ "0.785116", "0.7359476", "0.70797807", "0.70130366", "0.6901749", "0.68253714", "0.67450005", "0.6503662", "0.65000373", "0.6468981", "0.64047176", "0.6350301", "0.6306754", "0.6294877", "0.6293845", "0.62775904", "0.62717634", "0.62079686", "0.61577356", "0.6145899", "0.6119...
0.6083315
25
Get the number of days left in a cert's lifetime.
def ssl_valid_time_remaining(hostname): try: expires = ssl_expiry_datetime(hostname) except ssl.SSLError: return datetime.timedelta(0) return expires - datetime.datetime.utcnow()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl_days_left(self) -> t.Optional[int]:\n value = None\n if isinstance(self.HTTP, Http):\n cert: t.Optional[cert_human.Cert] = self.HTTP.get_cert()\n if isinstance(cert, cert_human.Cert):\n value = tools.dt_days_ago(cert.not_valid_after, from_now=False)\n ...
[ "0.7725074", "0.7177754", "0.7127073", "0.71167994", "0.7106693", "0.6944431", "0.68515974", "0.67246765", "0.6672358", "0.6657529", "0.6646197", "0.66379094", "0.66151935", "0.65916574", "0.65790206", "0.6529422", "0.65067434", "0.65067434", "0.6353208", "0.62879425", "0.626...
0.60378814
37
Test API can create a department (POST request)
def test_department_creation(self): res = self.client().post(service_url, json={"dep_name": "test dep 4", "description": "testing department 4"}) self.assertEqual(res.status_code, 201) self.assertIn('dep 4', str(res.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post():\n\n logger.debug('Catch POST request by URL /api/departments.')\n args = department_args.parse_args()\n try:\n id_ = ds.add(name=args['name'], email=args['email'])\n created_department = ds.get(id_)\n except IntegrityError:\n return {'message...
[ "0.801832", "0.7346861", "0.7263449", "0.7247853", "0.7096167", "0.70810187", "0.6990688", "0.68851185", "0.68181944", "0.6713173", "0.6675945", "0.6634122", "0.66043496", "0.65878016", "0.6573157", "0.6558932", "0.65565145", "0.6529389", "0.65058947", "0.6498868", "0.6477474...
0.8781946
0
Test API can edit an existing department (PUT request)
def test_department_can_be_edited(self): res = self.client().put(service_url, json={"id_dep": 1, "dep_name": "", "description": "this is a new description"}) self.assertEqual(res.status_code, 204) results = self.client().get(service_url+'/1') self.assertIn('is a new', str(results.data)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(id_=None):\n\n logger.debug('Catch PUT request by URL /api/departments/%i.', id_)\n try:\n args = department_args.parse_args()\n ds.update(id_, name=args['name'], email=args['email'])\n except Exception:\n return {'message': \"Can't update department.\"...
[ "0.7635879", "0.75541437", "0.7310086", "0.71458596", "0.7124142", "0.682343", "0.6818235", "0.6771202", "0.6658555", "0.66222185", "0.6613502", "0.6584068", "0.6572079", "0.65327775", "0.6495819", "0.6454379", "0.6428005", "0.64252895", "0.6404784", "0.639821", "0.63961864",...
0.86693555
0
Test API can get a single employee by it's id
def test_api_can_get_employee_by_id(self): res = self.client().get(service_url_emp+'/1') self.assertEqual(res.status_code, 200) self.assertIn('name1', str(res.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, id):\n resultado = EmployeeModel.query.filter_by(employee_id=id).first()\n if resultado:\n return resultado\n api.abort(404)", "def get(cls, employee_id):\n employee = EmployeeModel.find_by_id(employee_id)\n if not employee:\n return {'messag...
[ "0.77058524", "0.76768017", "0.7541592", "0.74530566", "0.73932606", "0.7201871", "0.71742916", "0.71203345", "0.7098658", "0.70788777", "0.6995682", "0.6907228", "0.6837458", "0.67132115", "0.6658866", "0.66381055", "0.6613429", "0.659436", "0.65936464", "0.657754", "0.65598...
0.8674464
0
Returns a list of the shape of tensor, preferring static dimensions.
def get_shape_list(tensor, expected_rank=None, name=None): if name is None: name = tensor.name if expected_rank is not None: assert_rank(tensor, expected_rank, name) shape = tensor.shape.as_list() non_static_indexes = [] for (index, dim) in enumerate(shape): if dim is None: non_static_ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shape_list(tensor):\n static_shape, dyn_shape = tensor.shape.as_list(), tf.shape(tensor)\n\n def shape_dim(ndx):\n return dyn_shape[ndx] if static_shape[ndx] is None else static_shape[ndx]\n\n shape = map(shape_dim, range(tensor.shape.ndims))\n return list(shape)", ...
[ "0.8490285", "0.82635957", "0.8169838", "0.8072698", "0.80558604", "0.8043119", "0.8012612", "0.8012612", "0.78251135", "0.7767483", "0.768979", "0.75439525", "0.7525484", "0.75191146", "0.74525064", "0.73151857", "0.73025537", "0.7296693", "0.7278734", "0.7276171", "0.72067"...
0.786002
9
Creates a `truncated_normal_initializer` with the given range.
def create_initializer(initializer_range=0.02): return tf.compat.v1.truncated_normal_initializer(stddev=initializer_range)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_initializer(initializer_range=0.02):\n return tf.truncated_normal_initializer(stddev=initializer_range)", "def create_initializer(initializer_range=0.02):\n return tf.truncated_normal_initializer(stddev=initializer_range)", "def create_initializer(initializer_range=0.02):\n return tf.truncate...
[ "0.81752145", "0.81752145", "0.8153977", "0.7396352", "0.6658898", "0.65713483", "0.6411789", "0.6391786", "0.63814235", "0.62771004", "0.62771004", "0.6252857", "0.621467", "0.62111574", "0.6149097", "0.6082527", "0.5928889", "0.58472204", "0.5730975", "0.5706199", "0.570041...
0.824168
0
Run layer normalization on the last dimension of the tensor.
def layer_norm(input_tensor, trainable=True, name=None): #return tf.keras.layers.LayerNormalization(name=name,trainable=trainable,axis=-1,epsilon=1e-14,dtype=tf.float32)(input_tensor) return tf.contrib.layers.layer_norm( inputs=input_tensor, begin_norm_axis=-1, begin_params_axis=-1, trainable=trainable, scope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_layer( x, training, name):\n top = tf.layers.batch_normalization( x, \n axis=3, # channels last \n training=training,\n name=name )\n return...
[ "0.7188471", "0.69629765", "0.69441414", "0.67868984", "0.6747918", "0.67468345", "0.6699458", "0.66058177", "0.6587076", "0.65642875", "0.6561795", "0.6557462", "0.6551223", "0.6541247", "0.65286005", "0.6526391", "0.65231514", "0.65183055", "0.6511796", "0.6501839", "0.6490...
0.67970544
3
The placeholder text that is shown before anything is entered, if any.
def placeholder(self) -> str | None: return self._underlying.placeholder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkPlaceholderText (self):\n # If the text entered is the placeholder text, simply remove it:\n if self._nameEntry.get() == NPKR_ENTRY_INITIAL_TEXT:\n self._nameEntry.set(\"\")", "def placeholder(self):\n return self._placeholder", "def _generatePlaceholderText(self, obj,...
[ "0.7425287", "0.707184", "0.68121725", "0.6706383", "0.6392648", "0.6323205", "0.6288933", "0.6110744", "0.60111684", "0.57568425", "0.56902826", "0.5655253", "0.5650846", "0.56181765", "0.5466139", "0.53937393", "0.5366282", "0.53648067", "0.5348308", "0.5334757", "0.5329665...
0.7067266
2
Test simple JDBC query consumer origin for network fault tolerance. We delay the pipeline using a Delay stage so as we get time to shut the SDC container network to test retry and resume logic of origin stage.
def test_query_consumer_network(sdc_builder, sdc_executor, database): number_of_rows = 10_000 table_name = get_random_string(string.ascii_lowercase, 20) pipeline_builder = sdc_builder.get_pipeline_builder() jdbc_query_consumer = pipeline_builder.add_stage('JDBC Query Consumer') jdbc_query_consumer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jdbc_query_executor(sdc_builder, sdc_executor, database):\n table_name = get_random_string(string.ascii_lowercase, 20)\n table = _create_table(table_name, database)\n\n DATA = ['id,name'] + [','.join(str(item) for item in rec.values()) for rec in ROWS_IN_DATABASE]\n pipeline_builder = sdc_buil...
[ "0.70550436", "0.7047451", "0.6958239", "0.69195366", "0.6885504", "0.68017673", "0.6705965", "0.653406", "0.64730465", "0.6431238", "0.63461107", "0.628354", "0.6265989", "0.6264696", "0.6191097", "0.6113087", "0.59760135", "0.5914398", "0.58425444", "0.57655364", "0.5700489...
0.79750395
0
Load pretrained VGG16 from keras applications
def build_vgg(self, weights="imagenet"): # Input image to extract features from img = Input(shape=(self.img_rows, self.img_cols, 3)) # Mean center and rescale by variance as in PyTorch processed = Lambda(lambda x: (x-self.mean) / self.std)(img) # If...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vgg16(pretrained=False, **kwargs):\n if pretrained:\n kwargs['init_weights'] = False\n model = VGG(make_layers(cfg['D']), **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['vgg16']), strict=False)\n return model", "def vgg16(pretrained=False, **kwargs)...
[ "0.7633337", "0.7611935", "0.7301489", "0.72444355", "0.7156165", "0.71135247", "0.70742786", "0.7074172", "0.70729405", "0.69346327", "0.6916913", "0.67665625", "0.67628694", "0.6726054", "0.67041343", "0.6629898", "0.6608626", "0.65997636", "0.6598695", "0.65966094", "0.658...
0.6385897
32
Return a nicely formatted HTML code string for the given dataframe. Arguments
def df_to_html(df, percentage_columns=None): # pragma: no cover big_dataframe_setup() try: res = "<br><h2> {} </h2>".format(df.name) except AttributeError: res = "" df.style.set_properties(**{"text-align": "center"}) res += df.to_html( formatters=_formatters_dict( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp(df):\n display(HTML(df.to_html(index=False)))", "def df_to_html(df, img_formatter=images_formatter):\n pd.set_option(\"display.max_colwidth\", -1)\n pd.set_option(\"display.max_columns\", -1)\n cond_formatter = lambda imgs: images_formatter(imgs, col=1)\n html_table = df.to_html(\n ...
[ "0.7709254", "0.73659784", "0.71026874", "0.69458956", "0.67958844", "0.676329", "0.67408717", "0.6718637", "0.66966647", "0.6656633", "0.6579785", "0.651067", "0.64621204", "0.64261204", "0.6367933", "0.6338818", "0.63245225", "0.62568015", "0.6219889", "0.6177059", "0.61611...
0.76079047
1
Turn on/off the joint lock so you can manipulate the WAM by hand.
def set_wam_joint_hold(hold): msg = HoldRequest() msg.hold = hold wam_hold_service = rospy.ServiceProxy('/wam/hold_joint_pos', Hold) try: resp1 = wam_hold_service(msg) except rospy.ServiceException as exc: print("Service did not process request: " + str(exc))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_on(self, **kwargs):\n self.set_graceful_lock(True)\n self.robot.start_cleaning()", "def ToggleLock(self, event):\n pass", "def turn_on(self):\n self._data.homestatus.setroomThermpoint(\n self._data.home_id, self._room_id, STATE_NETATMO_HOME\n )\n self...
[ "0.6700339", "0.6349209", "0.6309134", "0.6272996", "0.61883575", "0.6179182", "0.61776733", "0.61142284", "0.6089046", "0.6087645", "0.60502875", "0.603042", "0.60217047", "0.59520024", "0.59362584", "0.59181535", "0.58999264", "0.5894002", "0.5885579", "0.58486074", "0.5844...
0.63843507
1
Verify the expected sequence of calls when a pipeline definition is logged as an artifact to the pipeline's model version. Fetching the registered model version is patched instead of mocking a response to avoid having to pass the RM's id down through multiple pytest fixtures.
def test_log_pipeline_definition_artifact( model_version_name, mocked_responses, make_mock_pipeline_graph, make_mock_registered_model, make_mock_registered_model_version, ) -> None: rm = make_mock_registered_model(id=123, name="test_rm") rmv = make_mock_registered_model_version() # Fetch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_pipeline_definition_artifact(\n make_mock_registered_model_version,\n make_mock_simple_pipeline_definition,\n) -> None:\n rmv = make_mock_registered_model_version()\n pipeline_definition = RegisteredPipeline._get_pipeline_definition_artifact(\n registered_model_version=rmv,\n )\n...
[ "0.732434", "0.7297416", "0.69765425", "0.63282025", "0.62099767", "0.6095259", "0.6094727", "0.60649484", "0.58922017", "0.587223", "0.584923", "0.5840194", "0.5815585", "0.578171", "0.5772538", "0.57495606", "0.57491666", "0.5727522", "0.5712284", "0.5710002", "0.56978595",...
0.8264145
0
Test that a pipeline definition artifact can be fetched from the registered model version associated with a RegisteredPipeline object.
def test_get_pipeline_definition_artifact( make_mock_registered_model_version, make_mock_simple_pipeline_definition, ) -> None: rmv = make_mock_registered_model_version() pipeline_definition = RegisteredPipeline._get_pipeline_definition_artifact( registered_model_version=rmv, ) assert pi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_pipeline_definition(\n make_mock_registered_model_version,\n mocked_responses,\n) -> None:\n rmv = make_mock_registered_model_version()\n mocked_responses.get(\n f\"{rmv._conn.scheme}://{rmv._conn.socket}/api/v1/registry/model_versions/1\",\n json={},\n status=200,\n ...
[ "0.7688491", "0.72997695", "0.72265136", "0.69778377", "0.6683026", "0.6655028", "0.646409", "0.6193778", "0.61219335", "0.60657907", "0.60468465", "0.5986037", "0.59753895", "0.5972712", "0.59150094", "0.58124006", "0.5805494", "0.57608837", "0.56313217", "0.5624219", "0.560...
0.8222838
0
Test that the expected errors are raised when an invalid pipeline resources are provided.
def test_to_pipeline_configuration_invalid_resources( resources, make_mock_pipeline_graph, make_mock_registered_model_version, make_mock_registered_model, ) -> None: mocked_rm = make_mock_registered_model(id=123, name="test_rmv") with patch.object( verta.pipeline.PipelineStep, "_get_regi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creation_fail(self):\n\n # Assert that a RelaxError occurs when the pipe type is invalid.\n self.assertRaises(RelaxError, pipes.create, 'new', 'x')", "def test_execute_pipeline_two(self):\n task_list = [Test()]\n with self.assertRaises(AttributeError):\n execute_pi...
[ "0.69556063", "0.6845119", "0.6751194", "0.67011756", "0.66657954", "0.6635373", "0.6581409", "0.6536569", "0.6497356", "0.6491855", "0.6488647", "0.64853007", "0.64841676", "0.64522225", "0.6404109", "0.6401285", "0.6376981", "0.6353701", "0.6349466", "0.6321207", "0.6282897...
0.7442444
0
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
19
This function returns a string with 3 decimal places, given the input x
def form5(x, pos): return '%.7f' % 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.74327534", "0.732409", "0.7136653", "0.7104599", "0.6882025", "0.6814767", "0.67702717", "0.6758879", "0.6719734", "0.6631792", "0.6578579", "0.656527", "0.6533149", "0.65236706", "0.6515471", "0.6515471", "0.6515471", "0.6515471", "0.64998454", "0.6474226", "0.6465817", ...
0.6792799
7
Check whether the node is a instance of `class_or_string`. Unlinke the standard isinstance builtin, the method accepts either a class or a string. In the later case, the string is compared with self.__class__.__name__ (case insensitive).
def isinstance(self, class_or_string): if class_or_string is None: return False import inspect if inspect.isclass(class_or_string): return isinstance(self, class_or_string) else: return self.__class__.__name__.lower() == class_or_string.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_or_class_match(node_a, node_b):\n if isinstance(node_b['node'], type):\n return issubclass(type(node_a['node']), node_b['node'])\n elif isinstance(node_a['node'], type):\n return issubclass(type(node_b['node']), node_a['node'])\n elif isinstance(node_b['node'], xf.PatternNode):\n ...
[ "0.6436535", "0.5984461", "0.58243", "0.58243", "0.58243", "0.58243", "0.58243", "0.58243", "0.5785469", "0.5769264", "0.57563615", "0.57536185", "0.57536185", "0.57398254", "0.57315344", "0.5721359", "0.57201725", "0.5707082", "0.5687554", "0.5687518", "0.56612915", "0.564...
0.8296064
0
Return a relative version of the workdir
def relworkdir(self): if getattr(self, "workdir", None) is None: return None try: return os.path.relpath(self.workdir) except OSError: # current working directory may not be defined! return self.workdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rel_cwd():\n return os.path.relpath(os.getcwd(), git_toplevel())", "def build_relpath(self):\n return join_path(\"..\", self.build_dirname)", "def pathtofolder():\n return os.getcwd()", "def relDir(self, cwd=None, root=None):\n return os.path.dirname(self.relName(cwd, root)) or \".\"", ...
[ "0.7572184", "0.74179256", "0.71759975", "0.7152729", "0.7115556", "0.71097624", "0.7082853", "0.7065006", "0.70645964", "0.7047222", "0.70466393", "0.7030355", "0.70125103", "0.70114654", "0.70030177", "0.70021874", "0.6992148", "0.69542587", "0.69249356", "0.6917377", "0.68...
0.751337
1
Set the name of the Node.
def set_name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)", "def node_name(self, value: str):\n self._properties[\"nodeName\"] = value", "def setName(self, name):\n libxml2mod.xmlNodeSetName(self._o, name)", "def set_name(self, name):\n\t\tself.name_ = name", "def set_na...
[ "0.8939553", "0.825504", "0.80532664", "0.79710627", "0.795831", "0.79522514", "0.79522514", "0.79522514", "0.79522514", "0.79522514", "0.7939354", "0.7926672", "0.7926672", "0.7868177", "0.7862514", "0.7848844", "0.7817582", "0.7817582", "0.77914226", "0.77537787", "0.768944...
0.7910559
13
True if this node is a Flow
def is_flow(self): from .flows import Flow return isinstance(self, Flow)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isFlow(self) -> bool:\n ...", "def isNodeType(self, t):\n return isinstance(self, t)", "def _is_sink() -> bool:\n\n def _is_inplace(n: Node):\n \"\"\"Get the inplace argument from ``torch.fx.Node``\n \"\"\"\n inplace = False\n ...
[ "0.82888186", "0.6625373", "0.6044185", "0.5894704", "0.58589464", "0.5831481", "0.58194137", "0.58000535", "0.5776091", "0.57718563", "0.5769203", "0.5670171", "0.5609499", "0.56082875", "0.5608028", "0.55946344", "0.5508543", "0.5454714", "0.5452838", "0.5450906", "0.543212...
0.82321334
1
Return pandas DataFrame with the value of the variables specified in `varnames`. Can be used for task/works/flow. It's recursive!
def get_vars_dataframe(self, *varnames): import pandas as pd if self.is_task: df = pd.DataFrame([{v: self.input.get(v, None) for v in varnames}], index=[self.name], columns=varnames) df["class"] = self.__class__.__name__ return df elif self.is_work: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_df(raw_data, variables):\n vars = []\n for v in requirement_order(variables):\n vars.append(v(raw_data))\n return pd.concat(vars, axis=1)", "def convert_variables_to_dataframe(self, variables: Variables):\n records = []\n for (year, variable_name), variable in variables.ite...
[ "0.634334", "0.6127457", "0.54215074", "0.53402454", "0.5336286", "0.53129846", "0.52937585", "0.52844363", "0.5279209", "0.52531093", "0.52418345", "0.51818794", "0.5146553", "0.5134265", "0.50864273", "0.50787354", "0.5029223", "0.50172925", "0.5016772", "0.49703383", "0.49...
0.74703014
0
The list of handlers registered for this node. If the node is not a `Flow` and does not have its own list of `handlers` the handlers registered at the level of the flow are returned. This trick allows one to registered different handlers at the level of the Task for testing purposes. By default, we have a common list o...
def event_handlers(self): if self.is_flow: return self._event_handlers try: return self._event_handlers except AttributeError: return self.flow._event_handlers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handlers(self, handlers):\n return self._set_list_field(\"handlers\", handlers)", "def get_handlers(self):\n raise NotImplementedError()", "def get_handlers(self):\n return self._handlers", "def get_handlers(self):\n\n # Get handlers \n logger.debug(\"%s: Returned %d ha...
[ "0.7605991", "0.70131993", "0.6856217", "0.6685259", "0.6657609", "0.6339771", "0.6325021", "0.6300314", "0.6133258", "0.61161876", "0.6108609", "0.6086959", "0.60660213", "0.60341084", "0.60315263", "0.594375", "0.59400016", "0.58964455", "0.586689", "0.58513534", "0.5844645...
0.63725966
5
Basename of the file.
def basename(self): return os.path.basename(self.filepath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basename(self):\n return get_basename(self.filename)", "def basename(self):\n return self.name.basename", "def get_file_basename(self):\n return self._basename[:]", "def basename(self) -> str:\n return self._basename", "def basename(self):\n return self._basename", ...
[ "0.82301086", "0.798624", "0.79570544", "0.7948017", "0.7867619", "0.7821296", "0.77957064", "0.77522737", "0.7751202", "0.7596237", "0.7540688", "0.75255793", "0.750992", "0.74643725", "0.73821795", "0.7343527", "0.7268083", "0.7236085", "0.7234416", "0.7201531", "0.7180847"...
0.82075614
1
Check if the exception is raised for incorrect filename
def test_no_such_file(self): with self.assertRaises(IOError): analyse_text('foobar')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_filename(self, filename):\n if len(os.path.dirname(filename)) != 0:\n raise ValueError(f\"Expecting file name but got path {filename}\")", "def _is_valid_file(arg: str) -> str:\n if not os.path.exists(arg):\n raise FileNotFoundError(\"%s does not exist\" % arg)\n return ...
[ "0.73724973", "0.7285292", "0.72142965", "0.7199158", "0.7141459", "0.70635605", "0.7052076", "0.6981677", "0.69804996", "0.6978366", "0.6957008", "0.6953999", "0.6928917", "0.69170535", "0.69096094", "0.69096094", "0.6890656", "0.6882268", "0.68739504", "0.68669266", "0.6865...
0.6930312
12
split_at_nodes Split line features at nodes Arguments shp list or shapefile Chain features to be split at common nodes. Returns generator yields pysal.cg.Chain objects
def split_at_nodes(shp): nodes = find_nodes(shp) nodeIds = list(nodes) nodeIds.sort() nodeIds = dict([(node,i) for i,node in enumerate(nodeIds)]) for road in shp: vrts = road.vertices midVrts = set(road.vertices[1:-1]) #we know end points are nodes midNodes = midVrts.int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_split(cls, onnx_node, inputs, opset_version):\n axis = onnx_node.getattr(\"axis\", 0)\n split = onnx_node.getattr(\"split\", None)\n num_output = len(onnx_node.outputs)\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\n ...
[ "0.5709366", "0.5100523", "0.50354594", "0.5005691", "0.4956179", "0.4929372", "0.49258184", "0.49091634", "0.48914868", "0.48850974", "0.4871217", "0.48550192", "0.48419514", "0.47978392", "0.47974023", "0.47971427", "0.47869164", "0.47591326", "0.47351238", "0.4734362", "0....
0.71027136
0
Determine the preferredContactTypeId Use "email" if it does exist, else "mail" even if address/phone does not exist.
def determine_preferred_contact(user_data): try: user_data['personal']['email'] except KeyError: preferred_contact = 'mail' else: preferred_contact = 'email' return preferred_contact
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n types = dict(ADDRESS_TYPE_CHOICES)\n return types.get(self.address_type, \"N/A\")", "def scheme_type(self) -> Union[str, None]:\n if self.scheme is None:\n return None\n\n if \"contact_1\" in self.scheme and \"contact_2\" in self.scheme:\n r...
[ "0.5919622", "0.5790863", "0.54554784", "0.5440097", "0.5357837", "0.53405076", "0.5333537", "0.5288933", "0.5283198", "0.52559656", "0.52522856", "0.5250436", "0.52444154", "0.51999366", "0.51787084", "0.5124692", "0.5112101", "0.51028335", "0.5095454", "0.5068635", "0.50686...
0.7721516
0
Return ycomponent of the vector
def y(self): return self._coords[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yvec(self):\n return self._yvec", "def vec_y(self):\t\t\r\n if self.oy != 0:\r\n ov = self.oy\r\n lv = self.self.ly + self.oy\r\n else:\r\n ov = self.dy / 2\r\n lv = self.ly\r\n\r\n yv = \"\"\r\n for num in np.arange(ov, lv, self....
[ "0.7621594", "0.7529861", "0.75263304", "0.74132967", "0.721252", "0.721252", "0.7210281", "0.70582485", "0.70192266", "0.7001884", "0.6963363", "0.6934842", "0.69248945", "0.69216293", "0.68911827", "0.68720007", "0.6871163", "0.68415403", "0.68415403", "0.68415403", "0.6841...
0.67130566
46
Returns normalized (unit length) vector
def normalized(self): d = self.magnitude() if d: return type(self)(self.x / d, self.y / d) return self.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)", "def _get_unit_vector(self, v):\n return v / np.linalg.norm(v)", "def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\r\n return vector / np.linalg.no...
[ "0.82771486", "0.81070524", "0.80799645", "0.80799645", "0.80799645", "0.80530673", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.8032828", "0.79933864", "0.7983391", ...
0.0
-1
Calculate dot product with other vector.
def dot(self, other): return self.x * other.x + self.y * other.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)", "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (l...
[ "0.8403026", "0.83923644", "0.8360334", "0.8348048", "0.8347422", "0.833397", "0.83020794", "0.81964064", "0.8157349", "0.81490016", "0.81469476", "0.81312597", "0.8129006", "0.80854493", "0.8081152", "0.8074855", "0.80689585", "0.8068668", "0.80384195", "0.8026396", "0.80180...
0.7762448
41
Create unit length vector in xdirection
def unit_x(cls): return cls(1, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())", "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n xv = \"\"\r\n ...
[ "0.7152035", "0.6998333", "0.6691248", "0.66703343", "0.651143", "0.6494702", "0.64910406", "0.64522475", "0.6448591", "0.6432671", "0.6432671", "0.6432671", "0.6423991", "0.6400405", "0.63638616", "0.63638616", "0.63638616", "0.63638616", "0.63638616", "0.63638616", "0.63638...
0.66715944
3
Create unit length vector in ydirection
def unit_y(cls): return cls(0, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_y(self):\t\t\r\n if self.oy != 0:\r\n ov = self.oy\r\n lv = self.self.ly + self.oy\r\n else:\r\n ov = self.dy / 2\r\n lv = self.ly\r\n\r\n yv = \"\"\r\n for num in np.arange(ov, lv, self.dy):\r\n yv += str(num) + \" \"\r\n\r...
[ "0.74358547", "0.72560906", "0.7085213", "0.69026345", "0.6675509", "0.66686535", "0.6512634", "0.63942814", "0.62977207", "0.6233909", "0.6079261", "0.60260344", "0.59964687", "0.5951451", "0.59457856", "0.5933683", "0.59278893", "0.5899661", "0.58816063", "0.5877677", "0.58...
0.7077171
3
Return zcomponent of the vector
def z(self): return self._coords[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_z(self):\n return Vector((self.v.y, -self.v.x))", "def z(self) -> float:\n return self.A[3] if self.scalar_vector else self.A[2]", "def cross_z(self):\n return self.v.cross(Vector((0, 0, 1)))", "def vec_z(self):\t\t\t\r\n if self.oz != 0:\r\n ov = self.oz\r\n ...
[ "0.69621456", "0.6928084", "0.6812102", "0.67832416", "0.6751533", "0.6669104", "0.6623991", "0.65270525", "0.65077305", "0.6432692", "0.6393546", "0.63790315", "0.63499564", "0.6347123", "0.6277543", "0.62477154", "0.6231809", "0.6205121", "0.61840206", "0.61352754", "0.6110...
0.6343273
14
Returns normalized (unit length) vector
def normalized(self): d = self.magnitude() if d: return type(self)(self.x / d, self.y / d, self.z / d) return self.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)", "def _get_unit_vector(self, v):\n return v / np.linalg.norm(v)", "def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\r\n return vector / np.linalg.no...
[ "0.82771486", "0.81070524", "0.80799645", "0.80799645", "0.80799645", "0.80530673", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.80347985", "0.8032828", "0.79933864", "0.7983391", ...
0.0
-1
Calculate dot product with other vector.
def dot(self, other): return self.x * other.x + self.y * other.y + self.z * other.z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)", "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (l...
[ "0.8403026", "0.83923644", "0.8360334", "0.8348048", "0.8347422", "0.833397", "0.83020794", "0.81964064", "0.8157349", "0.81490016", "0.81469476", "0.81312597", "0.8129006", "0.80854493", "0.8081152", "0.8074855", "0.80689585", "0.8068668", "0.80384195", "0.8026396", "0.80180...
0.77480584
44
Change vector direction to point towards positive Z direction
def lower(self): if self.z < 0: return -self else: return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction(self):\n norm=math.sqrt(self.x**2 + self.y**2 + self.z**2)\n return Vector3(self.x/norm, self.y/norm, self.z/norm)", "def rotateZUp(self):\n MV = self.MV\n MV[:3, 1] = 0, 0, 1 # 2nd col is up vector, make it point along z axis\n # set bottom left and bottom right ...
[ "0.7228436", "0.67768824", "0.67768824", "0.65853876", "0.6474315", "0.6385444", "0.63829845", "0.6349363", "0.630364", "0.62983906", "0.62983567", "0.6229646", "0.6203446", "0.62005585", "0.6158946", "0.61585766", "0.61379325", "0.61265486", "0.61265486", "0.6071466", "0.604...
0.0
-1
Return True if vector points towards negative Z direction
def is_upper(self): return self.z < 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infront(self, xyz: np.ndarray, directions: bool = False) -> np.ndarray:\n dxyz = xyz if directions else xyz - self.xyz\n z = np.dot(dxyz, self.R.T[:, 2])\n return z > 0", "def hasMovementZ(self):\n return self.boolvel[0]", "def __check_direction(self, vector, coordinate):\n ...
[ "0.6701596", "0.64792484", "0.63780683", "0.6199289", "0.6081867", "0.6079946", "0.6035291", "0.5997941", "0.5980475", "0.5977434", "0.59386265", "0.5933424", "0.5915064", "0.58739233", "0.58404183", "0.58404183", "0.5837072", "0.5836382", "0.5833062", "0.58162224", "0.579274...
0.6130337
4
Create unit length vector in xdirection
def unit_x(cls): return cls(1, 0, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())", "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n xv = \"\"\r\n ...
[ "0.7154343", "0.69985074", "0.66732866", "0.6672585", "0.6512058", "0.6496637", "0.64900285", "0.6454891", "0.6449362", "0.6433315", "0.6433315", "0.6433315", "0.64245814", "0.6402887", "0.63644564", "0.63644564", "0.63644564", "0.63644564", "0.63644564", "0.63644564", "0.636...
0.66922694
2
Create unit length vector in ydirection
def unit_y(cls): return cls(0, 1, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_y(self):\t\t\r\n if self.oy != 0:\r\n ov = self.oy\r\n lv = self.self.ly + self.oy\r\n else:\r\n ov = self.dy / 2\r\n lv = self.ly\r\n\r\n yv = \"\"\r\n for num in np.arange(ov, lv, self.dy):\r\n yv += str(num) + \" \"\r\n\r...
[ "0.74348956", "0.72552025", "0.70760363", "0.6902938", "0.6674552", "0.66693884", "0.6511431", "0.6395704", "0.62988234", "0.62340987", "0.6076239", "0.6024164", "0.5994113", "0.59527993", "0.5943914", "0.5933091", "0.59268755", "0.5900797", "0.58806604", "0.5878772", "0.5875...
0.7084081
2
Returns placeholders for the given feature spec. Returns a dictionary of placeholders with the same type and shape as calling tf.parse_example with the given feature spec.
def feature_spec_as_batched_placeholders(feature_spec): result = {} for name, spec in six.iteritems(feature_spec): if spec.dtype not in (tf.int64, tf.float32, tf.string): raise ValueError('{} had invalid dtype'.format(spec)) if isinstance(spec, tf.FixedLenFeature): result[name] = tf.placeholder(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batched_placeholders_from_specs(specs):\n if not (all([_is_feature_spec(s) for s in six.itervalues(specs)]) or\n all([isinstance(s, tf.TypeSpec) for s in six.itervalues(specs)])):\n raise TypeError('Specs must be all tf.TypeSpecs or feature specs. '\n 'Mixing is not allowed. Got...
[ "0.68627125", "0.62956125", "0.61024445", "0.5971513", "0.5948509", "0.58165884", "0.558762", "0.5515218", "0.54961", "0.54718864", "0.54472584", "0.54222244", "0.5409661", "0.54093456", "0.54090065", "0.5377132", "0.53761154", "0.5354805", "0.5327928", "0.53272367", "0.53218...
0.8073673
0
Converts a list of instance indices to the corresponding batch indices. Given a list of iterables representing the indices of N sparse tensors, creates a single list of indices representing the result of concatenating the sparse tensors along the 0'th dimension into a batch of size N.
def make_batch_indices(instance_indices): batch_indices = list(itertools.chain.from_iterable([ [(row_number, index) for index in indices] for row_number, indices in enumerate(instance_indices) ])) # Indices must have shape (?, 2). Therefore if we encounter an empty # batch, we return an ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensor2indices(batch_sents):\n size_batch = tf.shape(batch_sents)[0]\n len_batch = tf.shape(batch_sents)[1]\n batch_i = tf.range(size_batch)\n len_i = tf.range(len_batch)\n\n # [0,0,0,1,1,1,2,2,2,...]\n batch_i = tf.tile(batch_i[:, None], [1, len_batch])\n # [0,...
[ "0.6757593", "0.668924", "0.6647247", "0.6525968", "0.63507", "0.6347478", "0.6330641", "0.6165496", "0.6137877", "0.6136195", "0.61189455", "0.6038336", "0.5884571", "0.58565253", "0.58565253", "0.5856108", "0.5844865", "0.58287096", "0.5819618", "0.5785525", "0.5750782", ...
0.73625505
0
Converts a list of sparse instances into a sparse batch. Takes lists representing the indices and values of N sparse instances and concatenates them along the 0'th dimension into a sparse batch of size N.
def make_sparse_batch(instance_indices, instance_values, max_index): batch_indices = make_batch_indices(instance_indices) batch_values = list(itertools.chain.from_iterable(instance_values)) batch_shape = (len(instance_indices), max_index) return tf.SparseTensorValue(batch_indices, batch_values, batch_sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_sparse(inputs):\n\n data = list(itertools.chain(*inputs))\n row = list(itertools.chain(\n *[itertools.repeat(i, len(x)) for i, x in enumerate(inputs)]))\n col = list(itertools.chain(*[range(len(x)) for x in inputs]))\n\n s = coo_matrix((data, (row, col)), shape=(\n len(inp...
[ "0.66795045", "0.66483355", "0.65239143", "0.6505503", "0.635059", "0.6299451", "0.6201308", "0.6102207", "0.60624063", "0.5984515", "0.59727436", "0.5967407", "0.59385884", "0.5926944", "0.5847603", "0.5769515", "0.5766314", "0.57244736", "0.5662259", "0.56046027", "0.557581...
0.7440366
0
Maps the values fetched by `tf.Session.run` to the internal batch format.
def to_instance_dicts(schema, fetches): def decompose_sparse_batch(sparse_value): """Decomposes a sparse batch into a list of sparse instances. Args: sparse_value: A `SparseTensorValue` representing a batch of N sparse instances. The indices of the SparseTensorValue are expected to be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processBatchFunc(inputBatch): #this is redefined automatically, no need to do any special code here\n with tf.Session(graph=graph, config=config) as sess:\n sess.run(init)\n \n (outValue, ) = sess.run([outputs], feed_dict={inputs: inputBatch})\n \n...
[ "0.62071764", "0.60855067", "0.6056817", "0.60462034", "0.6039602", "0.602206", "0.59450126", "0.5925546", "0.59202385", "0.5869729", "0.5856152", "0.5851241", "0.5822776", "0.58007425", "0.5791806", "0.57912403", "0.57577246", "0.5748846", "0.5748846", "0.57173896", "0.57112...
0.0
-1
Decomposes a sparse batch into a list of sparse instances.
def decompose_sparse_batch(sparse_value): batch_indices, batch_values, batch_shape = sparse_value # Preallocate lists of length batch_size, initialized to empty ndarrays, # representing the indices and values of instances. We can reuse the return # value of _get_empty_array here because it is immutable....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decompose_sparse_batch(\n sparse_value: _SparseTensorValueType\n) -> Tuple[List[_SparseComponentType], _SparseComponentType]:\n batch_indices, batch_values, batch_shape = _extract_sparse_components(\n sparse_value)\n batch_size = batch_shape[0]\n instance_rank = len(batch_shape) - 1\n\n # Prealloc...
[ "0.75086296", "0.7059808", "0.70122707", "0.62066376", "0.6091215", "0.59720814", "0.5895833", "0.57921684", "0.57378924", "0.5696345", "0.56844103", "0.56454796", "0.5540356", "0.5498296", "0.549795", "0.5489116", "0.54844165", "0.54786456", "0.5451528", "0.54457694", "0.542...
0.7623021
0
Makes deep copies of a dict of tensors. Makes deep copies (using tf.identity or its equivalent for `SparseTensor`s) of the values of `tensors`.
def copy_tensors(tensors): return {name: _copy_tensor_or_sparse_tensor(tensor) for name, tensor in six.iteritems(tensors)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_memory_shared(*tensors):\n for tensor_dict in tensors:\n for _, _, t in iterate_recursively(tensor_dict):\n assert t.is_shared()", "def batch_tensor_dicts(tensor_dicts: List[Dict[str, NDArray]],\n remove_trailing_dimension: bool = False) -> Dict[str, NDArray]...
[ "0.60108316", "0.584757", "0.561565", "0.55964327", "0.5397415", "0.5387706", "0.5362882", "0.53165406", "0.5307602", "0.5084689", "0.5029376", "0.49999312", "0.49846148", "0.49846148", "0.49414432", "0.49315056", "0.48956892", "0.4890911", "0.48315462", "0.47887108", "0.4771...
0.7972645
0
Return the User model Using this function instead of Django 1.5's get_user_model allows backwards compatibility with Django 1.4.
def get_user_model(): try: # Django 1.5+ from django.contrib.auth import get_user_model except ImportError: # Django <= 1.4 model = User else: model = get_user_model() # Test if user model has any custom fields and add attributes to the _meta # class core...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_model():\n try:\n from django.contrib.auth import get_user_model\n User = get_user_model()\n except ImportError:\n from django.contrib.auth.models import User\n return User", "def get_user_model():\n try:\n return django_apps.get_model(settings.AUTH_USER_MODEL...
[ "0.8470039", "0.82690346", "0.81835866", "0.736563", "0.73131126", "0.683245", "0.643788", "0.6297146", "0.62848747", "0.6134599", "0.6123457", "0.6027518", "0.5960891", "0.5959611", "0.59526217", "0.59245265", "0.5921109", "0.5890895", "0.5836954", "0.5811501", "0.5805662", ...
0.76207584
3
Node constructor data node data object
def __init__(self, data, parent): self.left = None self.right = None self.data = data self.parent = parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data, node):\n self.data = data\n self.node = node", "def __init__(self, data, node):\n self.data = data\n self.node = node # This is the data structure which holds the data for this node, e.g. lat, lon, etc.", "def __init__(self):\n self.node = None\n ...
[ "0.87177086", "0.83116955", "0.80850905", "0.7653254", "0.7577612", "0.7577612", "0.74682903", "0.74091077", "0.7353871", "0.73384655", "0.7251369", "0.72447777", "0.72036475", "0.71874565", "0.7157994", "0.7112182", "0.70858246", "0.7081332", "0.7041921", "0.70245886", "0.70...
0.6797891
36
Take file path as string; return text as string. Takes string that are file names, opens the files, and turns the files' contents into one string of text.
def open_and_read_file(statuses_1, statuses_2): # contents1 = open(file_path1).read() # contents2 = open(file_path2).read() # contents = contents1 + contents2 contents = [s.text for s in statuses_1] + [s.text for s in statuses_2] contents = ' '.join(contents) # contents = statuses_1 + statuse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_text(file_name):\n\tf = open(file_name, 'r')\n\ttext = f.read()\n\treturn text", "def openFile(filepath):\n assert checkExistenceFile(filepath), \"filepath does not exist\"\n with open(filepath, \"r\", encoding=\"utf-8\") as f:\n text = \" \".join(map(lambda x: x.rstrip(\"\\n\"), f.read...
[ "0.75471646", "0.7300862", "0.72534645", "0.7149119", "0.71418405", "0.71019256", "0.7068826", "0.705639", "0.7052132", "0.7033711", "0.69781834", "0.6785811", "0.6782545", "0.67641693", "0.6750364", "0.67245966", "0.66933036", "0.66781855", "0.66724396", "0.6648803", "0.6634...
0.0
-1
Return dict consisting of child threads.
def get_threads(pid: int) -> dict: threads_map = defaultdict(list) proc = psutil.Process(pid) for thread in proc.threads(): threads_map[psutil.Process(thread.id).name()].append(thread.id) return threads_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threads(self):\n return self.rpc.call(MsfRpcMethod.CoreThreadList)", "def message_threads(self):\r\n return resource.MessageThreads(self)", "def threads(self, **kwargs):\n return stats.threads(self._host, self._session, **kwargs)", "def Threads():\n for i in range(0, idc.get_threa...
[ "0.65268487", "0.63145936", "0.62256175", "0.59941864", "0.5970034", "0.59116906", "0.58653396", "0.58576524", "0.58159345", "0.5813073", "0.5806315", "0.57842577", "0.5783787", "0.5665454", "0.56502837", "0.56432664", "0.5621911", "0.5619956", "0.55661124", "0.5542665", "0.5...
0.73409736
0
Return the version of the firecracker crate, from Cargo.toml. Should be the same as the output of `./firecracker version`, if the code has not been released.
def get_firecracker_version_from_toml(): cmd = "cd ../src/firecracker && cargo pkgid | cut -d# -f2 | cut -d: -f2" rc, stdout, stderr = run_cmd(cmd) assert rc == 0, stderr return packaging.version.parse(stdout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n version_dict = {}\n exec(open(\"src/chimera/version.py\").read(), version_dict)\n return version_dict['version']", "def get_version():\n version_file = Path(__file__).resolve().parent / \"clinker\" / \"__init__.py\"\n version_match = re.search(\n r\"^__version__ = ['\\\...
[ "0.68947846", "0.667615", "0.66711193", "0.66711193", "0.66711193", "0.6663825", "0.663384", "0.6623015", "0.6570636", "0.65684336", "0.6553881", "0.6541643", "0.64697933", "0.64678293", "0.64664465", "0.643406", "0.6432498", "0.6410594", "0.6397125", "0.63920736", "0.6388049...
0.83061004
0
Return the current kernel version in format `major.minor.patch`.
def get_kernel_version(level=2): linux_version = platform.release() actual_level = 0 for idx, char in enumerate(linux_version): if char == ".": actual_level += 1 if actual_level > level or (not char.isdigit() and char != "."): linux_version = linux_version[0:idx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version(self):\n return \"%d.%d\" % (self._vmajor, self._vminor)", "def get_version():\n vers = [\"%(major)i.%(minor)i\" % __version_info__, ]\n\n if __version_info__['micro']:\n vers.append(\".%(micro)i\" % __version_info__)\n if __version_info__['releaselevel'] != 'final':\n v...
[ "0.74813837", "0.7429533", "0.7207032", "0.70442337", "0.7012106", "0.6989984", "0.69880795", "0.6941389", "0.69172025", "0.69160455", "0.6891446", "0.6880821", "0.6851468", "0.6804146", "0.67972594", "0.67843556", "0.67781156", "0.67781156", "0.67449284", "0.6743368", "0.672...
0.6926894
8
Return the maximum possible sum of a contiguous subarray of array.
def max_contiguous_subarray(array): if len(array) > 0: global_max = array[0] current_max = array[0] for item in array[1:]: current_max = max(current_max + item, item) global_max = max(global_max, current_max) return global_max else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_subarray(array):\n\tmax_sum = 0\n\n\tmax_local_sum = 0\n\tfor i, value in enumerate(array):\n\t\tmax_local_sum += value\n\t\tif max_local_sum < 0:\n\t\t\tmax_local_sum = 0\n\t\telse:\n\t\t\tmax_sum = max(max_sum, max_local_sum)\n\n\treturn max_sum", "def max_noncontiguous_subarray(array):\n if len(arr...
[ "0.8202246", "0.7916394", "0.77453434", "0.7333391", "0.7310374", "0.72519475", "0.7203545", "0.7059973", "0.68492466", "0.68402284", "0.6802621", "0.6792351", "0.67439", "0.66859096", "0.6684533", "0.661008", "0.65974057", "0.65576714", "0.64860016", "0.64567614", "0.6436624...
0.80561763
1
Return the maximum possible sum of a noncontiguous subarray of array.
def max_noncontiguous_subarray(array): if len(array) > 0: all_negative = True max_negative = None sum_items = 0 for item in array: if item >= 0: all_negative = False sum_items += item else: if max_negative is Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_subarray(array):\n\tmax_sum = 0\n\n\tmax_local_sum = 0\n\tfor i, value in enumerate(array):\n\t\tmax_local_sum += value\n\t\tif max_local_sum < 0:\n\t\t\tmax_local_sum = 0\n\t\telse:\n\t\t\tmax_sum = max(max_sum, max_local_sum)\n\n\treturn max_sum", "def max_contiguous_subarray(array):\n if len(array)...
[ "0.82961255", "0.77139294", "0.7596466", "0.7196577", "0.715294", "0.7006346", "0.70032346", "0.6886802", "0.68664634", "0.68311334", "0.6787063", "0.67563164", "0.66991204", "0.6661166", "0.64700055", "0.6466913", "0.6465258", "0.64573425", "0.6438339", "0.6273083", "0.62503...
0.7972583
1
This class configures and populates the toplevel window. top is the toplevel containing window.
def __init__(self, top=None): _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font10 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()", "def crea...
[ "0.69684154", "0.6948331", "0.6881875", "0.67809457", "0.66016567", "0.6597757", "0.65894055", "0.6543687", "0.646034", "0.63822114", "0.63368046", "0.6302012", "0.62644327", "0.6249239", "0.6243882", "0.6226478", "0.61828554", "0.6171163", "0.6134316", "0.61289936", "0.61002...
0.641363
9
Returns the latest y error.
def get_error(self): return self.e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yerr(self, i):\n return self.errors[1][i]", "def _error(self, Y, T):\n err = np.mean((Y - T)**2)\n return err", "def errors(self, y):\r\n\r\n # check if y has same dimension of y_pred\r\n if y.ndim != self.y_pred.ndim:\r\n raise TypeError('y should have the sam...
[ "0.787337", "0.66240335", "0.644667", "0.64363647", "0.638492", "0.63621473", "0.6342121", "0.6316461", "0.6316461", "0.63141537", "0.6303715", "0.6298908", "0.6250192", "0.62501776", "0.624954", "0.624954", "0.624954", "0.624954", "0.624954", "0.624954", "0.624954", "0.624...
0.0
-1
Pads an offset to a 32bit alignment
def offset_pad(self, offset): return (((offset + 3) / 4) * 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align(offset, data, align_to=64):\n rem = offset % align_to\n new_offset = offset if (rem == 0) else offset + (align_to - rem)\n\n if data is not None:\n new_data = np.pad(\n data.flatten(),\n (0, int((new_offset - offset) / data.dtype.itemsize)), mode=\"constant\")\n e...
[ "0.7046391", "0.6920788", "0.6510732", "0.62924397", "0.61966455", "0.60938233", "0.6054375", "0.6030071", "0.5973875", "0.591687", "0.5892253", "0.5872662", "0.5845702", "0.5837856", "0.5827937", "0.58149445", "0.57686186", "0.57458216", "0.57091147", "0.56830585", "0.567384...
0.68856955
2
Get queryset according to user.
def get_model_queryset(self, request): if request.user.is_superuser: result = Field.objects.all() elif hasattr(request.user, 'farmuser'): result = Field.objects.filter(farm_user=request.user.farmuser) elif hasattr(request.user, 'farmchilduser'): result = Field...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user)\n return qs", "def get_queryset(self):\n # queryset = Article.objects.all()\n user_id = self.kwargs['user_id']\n if user_id is not None:\n queryset = ...
[ "0.85153556", "0.83165884", "0.83139765", "0.83116496", "0.82986826", "0.80234045", "0.79281294", "0.7914957", "0.78750557", "0.781211", "0.7783515", "0.7783515", "0.7783515", "0.7762357", "0.77083135", "0.76685613", "0.7653902", "0.76424956", "0.7623306", "0.7609415", "0.756...
0.6838076
87
Assumes myList is sorted. Returns closest value to myNumber. If two numbers are equally close, return the smallest number.
def takeClosest(myList, myNumber): pos = bisect_left(myList, myNumber) if pos == 0: return myList[0] if pos == len(myList): return myList[-1] before = myList[pos - 1] after = myList[pos] if after - myNumber < myNumber - before: return after else: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takeClosest(myList, myNumber):\n pos = bisect_left(myList, myNumber)\n if pos == 0:\n return 0 #myList[0]\n if pos == len(myList):\n return len(myList)-1 #myList[-1]\n\n before = myList[pos - 1]\n after = myList[pos]\n\n if after - myNumber < myNumber - before:\n return po...
[ "0.8521541", "0.76922435", "0.7656438", "0.7287982", "0.7014501", "0.6732125", "0.6697386", "0.66785496", "0.66401225", "0.66105974", "0.656588", "0.6560782", "0.64787084", "0.64621955", "0.6439355", "0.6437316", "0.641067", "0.6385044", "0.6370557", "0.63562495", "0.63331723...
0.8773185
0
Check if the number is pandigital. O(n) timecomplexity O(1) spacecomplexity
def is_pandigital(n: int) -> bool: str_n = str(n) for i in range(1, len(str_n) + 1): if str(i) not in str_n: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pandigital(number):\n return sorted(list(str(number))) == PANDIGITAL", "def is_pandigital(n):\n # Accept both str and int\n if isinstance(n, int):\n n = str(n)\n\n digits = len(n)\n if digits >= 10:\n return False\n string_n = str(n)\n for i in range(1, digits + 1):\n ...
[ "0.80218375", "0.79757667", "0.77303886", "0.75718504", "0.7396257", "0.7373412", "0.7264921", "0.70575136", "0.7046955", "0.6998432", "0.6977124", "0.69690084", "0.6452441", "0.64523494", "0.6404345", "0.6368958", "0.6259775", "0.6228276", "0.6175983", "0.6169226", "0.613255...
0.7948517
2
Least Common Multiple. O(1) spacecomplexity
def lcm(a: int, b: int) -> int: return a * b // gcd(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_common_multiple(number1, number2):\n return number1 * number2 // math.gcd(number1, number2)", "def lcm(a, b):\n\treturn a * b // gcm(a, b)", "def lcm(\n numbers: List[int]\n) -> int:\n current_product = 1\n current_gcd = 1\n for num in numbers:\n current_gcd = gcd(current_gc...
[ "0.7600971", "0.73538345", "0.72458893", "0.72181207", "0.7183397", "0.7097609", "0.70965344", "0.7054535", "0.7047714", "0.7047714", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.70168495", "0.6993166", "0....
0.6807222
34
Sets the Group the Member is in. Needs to be set so tab order works properly.
def set_group(self, group): self._group = group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_group(self, group: str) -> None:\n self.group = group", "def group(self, group):\n self._group = group", "def set_group(self, address, group):\n self.groups[address] = group", "def setGroup(self, group):\n\t\tself.config.GROUP = group", "def group(self, val):\n self.set_...
[ "0.7711096", "0.7326087", "0.72447264", "0.71994495", "0.709708", "0.7083411", "0.7083411", "0.7083411", "0.6929075", "0.68464977", "0.68303144", "0.67630804", "0.6596073", "0.65727514", "0.65307826", "0.65190583", "0.65161115", "0.65015715", "0.6412089", "0.6363025", "0.6358...
0.76793545
1
Gets the Group this Member is in. The Group this Member is in.
def get_group(self): return self._group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGroup(self):\n\t\treturn self.Group", "def get_group(self, group_name):\n\n return self._group[group_name]", "def group(self):\n return self._group", "def group(self):\n return self._group", "def group(self):\n return self._group", "def get_group(self) -> Optional[str]:\n ...
[ "0.7794998", "0.7636299", "0.7622602", "0.7622602", "0.7622602", "0.75684416", "0.74724185", "0.73655677", "0.7326051", "0.71922463", "0.71530706", "0.7129704", "0.7088261", "0.70684534", "0.70625037", "0.70310026", "0.70310026", "0.70310026", "0.70285153", "0.7016255", "0.69...
0.8379241
0
Gets the current message of the Member
def get_message(self): return self.__mess
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n return self.msg", "def _get_message(self):\n return self.__message", "def get_message(self):\n return self.message", "def get_message(self):\n return self.message", "def get_message (self) :\n return self._message", "def message(self):\n retu...
[ "0.84011084", "0.8323107", "0.83111465", "0.83111465", "0.8269307", "0.7932", "0.78833985", "0.78833985", "0.78833985", "0.78833985", "0.78833985", "0.7832781", "0.7804182", "0.7804182", "0.77332044", "0.77332044", "0.77332044", "0.77332044", "0.77332044", "0.77332044", "0.77...
0.8189663
5
operator != (overloaded for sorting) True/False Whether or not the Members are not exactly equal
def __ne__(self, other): return not (self == other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unequality(self):\n self.assertFalse(Record(1, 2) != Record(1, 2))\n self.assertTrue(Record(1, 2) != Record(1, 3))\n self.assertTrue(Record(1, 2) != Record(2, 2))\n self.assertTrue(Record(1, 2) != Record(3, 4))", "def __ne__(self, other):\n return other != self._cmpkey...
[ "0.67210156", "0.6688783", "0.65829706", "0.6567436", "0.6526634", "0.65138435", "0.6488825", "0.6476624", "0.6474153", "0.64701813", "0.6456219", "0.6451939", "0.643845", "0.643845", "0.6431011", "0.64258516", "0.6415841", "0.6413753", "0.6408735", "0.64076555", "0.6401923",...
0.0
-1
Camera projection mode, 0 for perspective and 1 for orthogonal.
def projection_mode(self, mode): self.ptr.projection_mode(mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projection_matrix(self) -> TransformationMatrixType:\n if self._projection_matrix is None:\n if self.projection_mode == Projection.TOP_DOWN:\n self._projection_matrix = self.orthographic_matrix\n else:\n self._projection_matrix = self.perspective_matri...
[ "0.6761293", "0.644626", "0.6436744", "0.61794835", "0.6093503", "0.6069873", "0.60338855", "0.60327417", "0.59998", "0.5971919", "0.59537846", "0.593361", "0.59260374", "0.5902397", "0.5899235", "0.58973503", "0.58923215", "0.5890294", "0.5875006", "0.5875006", "0.5871123", ...
0.75059366
0
Set the camera fov angle (field of view) in degrees.
def fov(self, fov): self.ptr.fov(fov)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFov(self,fov):\n self.light.node().getLens().setFov(fov)", "def fov(self, fov: float):\n assert type(fov) in (int, float)\n self._fov[self.projection_mode.value] = fov\n self._reset_matrix()", "def fov(self) -> float:\n return self._fov[self.projection_mode.value]", "def...
[ "0.7567027", "0.7319465", "0.6792522", "0.66845787", "0.61759377", "0.6077563", "0.60315025", "0.5959298", "0.5885582", "0.58746094", "0.5867575", "0.58432317", "0.57839054", "0.5734896", "0.57213104", "0.57139874", "0.57000244", "0.5655506", "0.5636095", "0.5611419", "0.5539...
0.7024396
2
Set the offset of the left clipping plane in camera frustum.
def left(self, left): self.ptr.left(left)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_left_clipping_plane() -> None:\n fx_px = 10.0\n width_px = 30\n\n pinhole_camera = _create_pinhole_camera(\n fx_px=fx_px,\n fy_px=0,\n cx_px=0,\n cy_px=0,\n height_px=30,\n width_px=width_px,\n cam_name=\"ring_front_center\",\n )\n left_plane...
[ "0.63976765", "0.61144453", "0.6042371", "0.5972287", "0.5941582", "0.5823916", "0.5804848", "0.5759181", "0.5747012", "0.5713205", "0.56296635", "0.5571598", "0.551144", "0.54969925", "0.54727894", "0.5461203", "0.54549265", "0.543394", "0.5421748", "0.5346198", "0.5324647",...
0.49661118
67
Get the projection matrix(in row major) of the camera.
def get_projection_matrix(self, aspect): return self.ptr.get_projection_matrix(aspect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(scene_size[1])\n p = scene.camera.get_perspective_transform_matrix(\n aspect_ratio, -1, 1).to_array().astype(np.float32)\n retu...
[ "0.8152782", "0.7456816", "0.7072214", "0.70557433", "0.6905488", "0.68304014", "0.67384833", "0.67183703", "0.66910917", "0.6517197", "0.6477676", "0.6477676", "0.6446451", "0.6441514", "0.64023477", "0.6391881", "0.6354866", "0.63363457", "0.6304402", "0.630417", "0.6286435...
0.72434336
2
FuzzyDateWidget decompresses a date string to a [month, year] list.
def test_fuzzy_date_widget(self): fdw = FuzzyDateWidget(attrs={'required' : False}) tests = ( (None, [None, None]), ('', [None, None]), (FuzzyDate(9, 2013), [9, 2013]), ) for t in tests: decomp = fdw.decompress(t[0]) self.assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_parser(dates):\n return([item.split()[0] for item in dates])\n pass", "def clean_date(date_str):\n date_str = date_str.split(\"-\")\n return [int(x) for x in date_str]", "def date_parser(dates):\n # extract the date only from dates: Olwethu\n date_list = []\n for i in dates:\n i = ...
[ "0.62949896", "0.61875194", "0.59531766", "0.5945802", "0.58807206", "0.57977754", "0.57943034", "0.5681103", "0.5680398", "0.5676772", "0.55372304", "0.553184", "0.5491866", "0.5446447", "0.54344845", "0.54035056", "0.5397384", "0.5396375", "0.5377236", "0.53657484", "0.5332...
0.5774342
7