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
Place window in the center
def center(self): qr = self.frameGeometry() central_p = QDesktopWidget().availableGeometry().center() qr.moveCenter(central_p) self.move(qr.topLeft())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(window):\n window.update_idletasks()\n\n # Find the screen resolution\n screen_width = window.winfo_screenwidth()\n screen_height = window.winfo_screenheight()\n\n # Find new (x, y) coordinates\n size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))\n x = screen_w...
[ "0.8567128", "0.85024303", "0.8464421", "0.84617096", "0.84302706", "0.8382075", "0.8266172", "0.8266172", "0.8252376", "0.824533", "0.82151645", "0.8206994", "0.8178875", "0.8173722", "0.81081045", "0.7824105", "0.77829343", "0.77399594", "0.7640785", "0.75704765", "0.755284...
0.75510895
22
Return true if the partner is a company of Venezuela and if the address is for billing.
def _check_partner_invoice_addr(self,cr,uid,ids,context={}): partner_obj = self.browse(cr,uid,ids[0]) if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id: res = partner_obj.type == 'invoice' if res: return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_13_company_1_address(self):\n with mock_api(company_1_address):\n import_record(self.session, 'magento.res.partner',\n self.backend_id, '9999256')\n cr, uid = self.cr, self.uid\n partner_ids = self.model.search(cr, uid,\n ...
[ "0.64225984", "0.5880995", "0.5770649", "0.54706657", "0.54565704", "0.5432842", "0.5421194", "0.5385996", "0.5361571", "0.53515327", "0.5336194", "0.53298014", "0.5324306", "0.5320534", "0.5290754", "0.5233072", "0.52117115", "0.5191587", "0.5189317", "0.51889455", "0.518126...
0.6763416
0
Add a scatter layer to the plot.
def add_scatter( self, name: str, data: Union[Dict, DataFrame], mapping: Dict = { "x": "x", "y": "y", "z": "z", "c": "c", "cs": "cs", "s": "s", "labels": "labels", "knn": "knn", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_scatter(self, data_x, data_y, data_text, colors, xlabel, ylabel):\n\n self._fig.add_trace(go.Scatter(\n x=data_x,\n y=data_y,\n customdata=list(zip(list(map(round,data_y)),list(map(round,data_x)))),\n hovertemplate = '<b>%{text}</b><br><br>'+\n ...
[ "0.7423165", "0.70377296", "0.70074224", "0.6882518", "0.68074137", "0.67303896", "0.66975695", "0.6628986", "0.66263103", "0.65437603", "0.6464539", "0.64587677", "0.64487344", "0.6414746", "0.6404708", "0.6380886", "0.6355635", "0.6289637", "0.6271495", "0.6247744", "0.6219...
0.6965788
3
Expands list to a given length by repeating the last element.
def expand_list( l: List, length: int, with_value: Any = None, with_none: bool = False ) -> List: if with_none: l.extend([None] * (length - len(l))) elif with_value is not None: l.extend([with_value] * (length - len(l))) else: l.extend([l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repeat_to_length(string_to_expand: str, length: int) -> str:\n return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length]", "def _maybe_repeat(x, n):\n if isinstance(x, list):\n assert len(x) == n\n return x\n else:\n return [x] * n", "def _maybe_repeat(s...
[ "0.6530027", "0.6479355", "0.6395996", "0.63587534", "0.63503283", "0.6309707", "0.60246617", "0.60153556", "0.60088956", "0.6005765", "0.59902346", "0.5989824", "0.5986422", "0.5936696", "0.5935092", "0.59313923", "0.58559996", "0.57862985", "0.5766684", "0.57540005", "0.571...
0.6572616
0
Create an Nbin discrete colormap from the specified input map.
def discrete_cmap(n_colors: int, base_cmap: str) -> Colormap: # https://gist.github.com/jakevdp/91077b0cae40f8f8244a base = plt.cm.get_cmap(base_cmap) color_list = base(np.linspace(0, 1, n_colors)) cmap_name = base.name + str(n_colors) return base.from_list(cmap_name, colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cmap(N, base_cmap=None):\n base = plt.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)", "def discrete_cmap(N, base_cmap=None):\n # see https://gist.github.com/jakevdp/91077b0cae40f8f8244a\...
[ "0.7159033", "0.70954204", "0.6879464", "0.68688786", "0.68688786", "0.68688786", "0.6841091", "0.6833796", "0.6833796", "0.6833796", "0.6833796", "0.68284047", "0.67690647", "0.64135927", "0.6409393", "0.63383853", "0.62679404", "0.61792123", "0.61204034", "0.60956866", "0.6...
0.6547902
13
Parses a file path for the filename without extension
def get_id(path): fid, ext, _ = path.strip().split('/')[-1].partition('.crf') if not fid or ext != '.crf': filetype = 'Co-Reference Input file' error = 'has incorrect file type' raise FilenameException("Error: %s %s" % (filetype, error)) return fid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_path(file_path: str) -> str:\n file_path.replace(\" \", \"\")\n if file_path.count('.') != 1:\n print(\"1: File path is incorrect. Must be only one dot.\")\n return ''\n head, tail = os.path.split(file_path)\n if len(tail) == 0:\n print(\"1: File name no exist\")\n ...
[ "0.79582274", "0.74939543", "0.745596", "0.7301274", "0.7280725", "0.72184706", "0.71821123", "0.71479803", "0.713628", "0.71271676", "0.70775926", "0.6985749", "0.6955249", "0.689269", "0.6864224", "0.6849331", "0.68431664", "0.6839789", "0.6823109", "0.6817119", "0.6753566"...
0.0
-1
Decorator made to modify httpresponse to make it no_cache
def no_cache(func): def disable_caching(request_handler, *args, **kwargs): request_handler.set_header('Cache-Control', 'no-cache, no-store, must-revalidate') request_handler.set_header('Pragma', 'no-cache') request_handler.set_header('Expires', 0) return func(request_handler, *args, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nocache(response):\n response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'\n return response", "def never_ever_cache(decorated_function):\n @wraps(decorated_function)\n def wrapper(*args, **kwargs):\n response = decorated_function(*args, **kwa...
[ "0.772778", "0.76854485", "0.76565826", "0.76418483", "0.76222116", "0.75058895", "0.74772286", "0.73034936", "0.7259936", "0.7172666", "0.7167789", "0.7120886", "0.7120886", "0.7116576", "0.7113894", "0.7081053", "0.7081053", "0.70741594", "0.7072083", "0.706583", "0.706583"...
0.759568
5
Tests partial household update (PATCH).
def test_patch_household(self): payload = { 'name': 'Test Household Changed' } res = self.client.patch(get_household_detail_url( self.user.household.id), payload) self.assertEqual(res.status_code, status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_partial_update(self):\n doctor = DoctorFactory.create(id=22)\n data = {'name': 'Joe'}\n self.assertNotEqual(doctor.name, data['name'])\n\n response = self.unath_client.patch(reverse('doctor-detail', args=[22]), data=data)\n self.assertEqual(response.status_code, status.H...
[ "0.7666297", "0.75013214", "0.74215907", "0.74196345", "0.7171165", "0.7092046", "0.70738345", "0.7062594", "0.70270765", "0.697513", "0.69419473", "0.69234407", "0.6922964", "0.6921961", "0.6884168", "0.68591523", "0.68510014", "0.68203735", "0.68069667", "0.67753834", "0.67...
0.8145228
0
Return the graph's output node.
def get_output_node(self) -> WillumpGraphNode: return self.output_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_node(self, port: int):\n return self._output_nodes_map[port]", "def output(self, name: str) -> bpy.types.NodeSocket:\n\t\treturn self.outputs[name]", "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def compute_output(self):...
[ "0.7194285", "0.70183927", "0.68669474", "0.68612355", "0.6664335", "0.662465", "0.6592259", "0.6579076", "0.6542078", "0.65351874", "0.64692736", "0.64676654", "0.64674354", "0.6466835", "0.6466835", "0.6458526", "0.64372426", "0.64298177", "0.64298177", "0.6406894", "0.6400...
0.8847338
0
Shorten a text by removing some words
def short(text): rep = { ' *health *center': '', ' *health *ceanter': '', ' +H[./]*C': '', ' *health *post': '', ' *heslth *post': '', ' *Haelth *Post': '', ' *Health *Poat': '', ' *hospital': '', ' +h[./...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_longer_words(text):\n return \" \".join([word for word in str(text).split() if len(word) <= 12])", "def clean_text(s,stem=False):\n\tret = s.lower()\n\tret = re.sub(r'[^a-z ]',' ',ret)\n\tret = re.sub(r' +',' ',ret).strip()\n\tret = re.sub(r'see more occupations related to this (activity|skill|ta...
[ "0.754411", "0.70054746", "0.69109786", "0.68561035", "0.6840428", "0.6837422", "0.6827039", "0.681135", "0.6794401", "0.6753814", "0.67442745", "0.67388463", "0.673773", "0.6735952", "0.67079693", "0.6705054", "0.6690209", "0.66851795", "0.6684263", "0.6684263", "0.6684263",...
0.6878296
3
Freeze layers in model that starts with keyworks in keys.
def freeze_named_layers(model, keys: Tuple = ()): for key in keys: for name, param in model.named_parameters(): if name.startswith(key): param.requires_grad = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfreeze_named_layers(model, keys: Tuple = ()):\n for key in keys:\n for name, param in model.named_parameters():\n if name.startswith(key):\n param.requires_grad = True", "def _set_freeze_layers(self):\n for layer in self.encoder.layers[:self.freeze_layers]:\n ...
[ "0.7178372", "0.6921216", "0.6415622", "0.62904936", "0.62353384", "0.6068036", "0.6021634", "0.6007621", "0.5946701", "0.5911531", "0.5711682", "0.56931865", "0.5566724", "0.554358", "0.5513546", "0.5485273", "0.5382348", "0.53695166", "0.5330946", "0.52211714", "0.5193284",...
0.7042381
1
Pad framewise_output to the same length as input frames. The pad value is the same as the value of the last frame.
def pad_framewise_output(framewise_output, frames_num): pad = framewise_output[:, -1:, :].repeat(1, frames_num - framewise_output.shape[1], 1) """tensor for padding""" output = torch.cat((framewise_output, pad), dim=1) """(batch_size, frames_num, classes_num)""" return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_framewise_output(framewise_output, frames_num):\n pad = framewise_output[:, -1 :, :].repeat(1, frames_num - framewise_output.shape[1], 1)\n \"\"\"tensor for padding\"\"\"\n\n output = torch.cat((framewise_output, pad), dim=1)\n \"\"\"(batch_size, frames_num, classes_num)\"\"\"\n\n return out...
[ "0.8212459", "0.79470396", "0.79470396", "0.6778081", "0.67006975", "0.65746564", "0.64275515", "0.63629305", "0.61833864", "0.60432905", "0.59761566", "0.59708476", "0.59547937", "0.59079987", "0.5904667", "0.57852376", "0.57253283", "0.57252175", "0.5716326", "0.5687589", "...
0.8229493
0
Initialize a Linear or Convolutional layer.
def init_layer(layer, method='xavier_uniform'): if method == 'xavier_uniform': ## default nn.init.xavier_uniform_(layer.weight) elif method == 'xavier_normal': nn.init.xavier_normal_(layer.weight) elif method == 'kaiming_uniform': ## to try nn.init.kaiming_uniform_(layer.weight) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_layer(layer):\n \n if layer.weight.ndimension() == 4:\n (n_out, n_in, height, width) = layer.weight.size()\n n = n_in * height * width\n \n elif layer.weight.ndimension() == 2:\n (n_out, n) = layer.weight.size()\n\n std = math.sqrt(2. / n)\n scale = std * math.sqrt...
[ "0.71585476", "0.6946555", "0.675435", "0.67083526", "0.6665737", "0.665054", "0.66405225", "0.66383994", "0.6587422", "0.6569476", "0.65386915", "0.6534945", "0.6534624", "0.65278125", "0.6458321", "0.6450799", "0.6441936", "0.64249116", "0.6423872", "0.6368915", "0.63685584...
0.6360222
22
Initialize a Batchnorm layer.
def init_bn(bn): bn.bias.data.fill_(0.) bn.weight.data.fill_(1.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batchnorm_init(m, kernelsize=3):\r\n n = kernelsize**2 * m.num_features\r\n m.weight.data.normal_(0, math.sqrt(2. / (n)))\r\n m.bias.data.zero_()", "def dncnn_batchnorm_init(m, kernelsize=3, b_min=0.025):\n n = kernelsize**2 * m.num_features\n m.weight.data.normal_(0, math.sqrt(2. / (n)))\n ...
[ "0.7382624", "0.71817577", "0.7181327", "0.6949718", "0.67419326", "0.6725722", "0.66990584", "0.66967344", "0.66012853", "0.65898055", "0.65177745", "0.64865506", "0.6468668", "0.64600116", "0.6428001", "0.64219517", "0.6387554", "0.63616383", "0.6357548", "0.635414", "0.632...
0.0
-1
Initialize a GRU layer.
def init_gru(rnn): def _concat_init(tensor, init_funcs): (length, fan_out) = tensor.shape fan_in = length // len(init_funcs) for (i, init_func) in enumerate(init_funcs): init_func(tensor[i * fan_in: (i + 1) * fan_in, :]) def _inner_uniform(tensor): fan_in = nn.init...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_gru_cell(self, num_units):\n return gru_cell.LayerNormGRUCell(\n num_units,\n w_initializer=self.uniform_initializer,\n u_initializer=random_orthonormal_initializer,\n b_initializer=tf.constant_initializer(0.0))", "def __init__(\n self,\n input_size,\n...
[ "0.7252236", "0.7059616", "0.6728527", "0.6430717", "0.618836", "0.6159024", "0.6158076", "0.60903364", "0.60604477", "0.60214305", "0.5960684", "0.58830017", "0.5880977", "0.58735985", "0.58609617", "0.584497", "0.5838443", "0.58121777", "0.57988244", "0.57898915", "0.578371...
0.67205757
3
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.70900273
59
Return a BugState that contains copies of all this BugState's columns, except for id.
def copy(self): # Unfortunately we can't just import copy because this comes with all kinds # of nasty SQLA internals kwargs = {} for col in self.__table__.columns: if col.name == 'id': continue kwargs[col.name] = getattr(self, col.name) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return State([r[:] for r in self.values], empty_loc=self.empty_loc)", "def __getstate__(self):\r\n\r\n d = copy.copy(self.__dict__)\r\n del d['_room_table_model'] # Do not save easily re-creatable table models\r\n del d['_socket_table_model'] # Do not save easily r...
[ "0.61550415", "0.5906562", "0.5851271", "0.58279526", "0.5817731", "0.57595706", "0.572862", "0.56799626", "0.5663411", "0.5656835", "0.5614034", "0.5604049", "0.56018364", "0.5596687", "0.5553168", "0.5540622", "0.5499134", "0.5487032", "0.5481828", "0.54746485", "0.5465456"...
0.8369509
0
Test default product price being 10.
def test_default_product_price(self): prod = Product('Test Product') self.assertEqual(prod.price, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_product_price(self):\r\n prod = Product('Test Product')\r\n self.assertEqual(prod.price, 10)", "def test_default_product_price(self):\n prod = product('Test Product')\n self.assertEqual(prod.price, 10)\n self.assertEqual(prod.weight, 20)", "def test_default_p...
[ "0.87333673", "0.8610413", "0.8580199", "0.7287374", "0.72686666", "0.72686666", "0.72686666", "0.72686666", "0.72686666", "0.72686666", "0.7263497", "0.717852", "0.6858057", "0.6813622", "0.67408824", "0.67408824", "0.6709257", "0.6688696", "0.66599596", "0.6654696", "0.6654...
0.8738257
10
INTERNAL USE ONLY Get the rule in the KB that is the same as the rule argument
def _get_rule(self, rule): for kbrule in self.rules: if rule == kbrule: return kbrule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRule(self, *args):\n return _libsbml.Model_getRule(self, *args)", "def get_rule(self):\n\n return self.__rule_", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def ru...
[ "0.7259204", "0.6979758", "0.69061136", "0.69061136", "0.69061136", "0.6762193", "0.6750241", "0.6723889", "0.6723889", "0.6723889", "0.6723889", "0.6723889", "0.6723889", "0.6723889", "0.6401456", "0.63561714", "0.632328", "0.6286141", "0.62767315", "0.6198468", "0.6169003",...
0.792611
1
Determine if messages relate to an interesting player event.
def player_event(self, msg): should_fire = False payload = msg["PlaySessionStateNotification"][0] session_id = payload["sessionKey"] state = payload["state"] media_key = payload["key"] position = payload["viewOffset"] if session_id not in self.players: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_for_me(event):\n # check if not my own event\n\n type = event.get('type')\n\n if type and type == 'message' and not(event.get('user') == VALET_SLACK_ID):\n\n if is_private(event):\n return True\n text = event.get('text')\n # channel = event.get('channel')\n if...
[ "0.6210864", "0.6153555", "0.60879445", "0.58971024", "0.5894941", "0.5893265", "0.58475083", "0.5827336", "0.58197004", "0.5745475", "0.56848234", "0.5638238", "0.56264895", "0.55878943", "0.5570386", "0.55053484", "0.5479546", "0.54735374", "0.54557586", "0.5410123", "0.540...
0.5536133
15
Close the listening websocket.
async def listen(self): self.failed_attempts = 0 while self.state != STATE_STOPPED: await self.running()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self) -> None:\n if self.websocket:\n self.websocket.stop()", "def close(self) -> None:\n _LOGGER.info('Shutting down connections to deCONZ.')\n if self.websocket:\n self.websocket.stop()", "def on_close(self):\n self._open = False\n self._stat...
[ "0.8121525", "0.7491793", "0.74682635", "0.72983366", "0.72825557", "0.7261847", "0.7117253", "0.7086678", "0.7083865", "0.70827514", "0.7042622", "0.70255095", "0.70202106", "0.69946456", "0.69773626", "0.6940371", "0.6940371", "0.6940371", "0.6940371", "0.6940371", "0.69403...
0.0
-1
Close the listening websocket.
def close(self): self.state = STATE_STOPPED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self) -> None:\n if self.websocket:\n self.websocket.stop()", "def close(self) -> None:\n _LOGGER.info('Shutting down connections to deCONZ.')\n if self.websocket:\n self.websocket.stop()", "def on_close(self):\n self._open = False\n self._stat...
[ "0.8121525", "0.7491793", "0.74682635", "0.72983366", "0.72825557", "0.7261847", "0.7117253", "0.7086678", "0.7083865", "0.70827514", "0.7042622", "0.70255095", "0.70202106", "0.69946456", "0.69773626", "0.6940371", "0.6940371", "0.6940371", "0.6940371", "0.6940371", "0.69403...
0.0
-1
Determines wether an atom is prochiral and determines the atom's side if necessary.
def _get_prochirality(self): for atom in self.invarioms: atom.get_prochirality() atom.invariom.get_prochirality()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_side(self, side):\n if side == \"U\":\n return self.z() == 1\n if side == \"D\":\n return self.z() == -1\n if side == \"F\":\n return self.y() == -1\n if side == \"B\":\n return self.y() == 1\n if side == \"R\":\n retu...
[ "0.5870851", "0.549886", "0.54745865", "0.54745865", "0.54745865", "0.5240374", "0.52023584", "0.51951754", "0.51806056", "0.5163453", "0.5118514", "0.5108549", "0.5107531", "0.5101734", "0.5089172", "0.50881255", "0.50782305", "0.5074325", "0.50729144", "0.50729144", "0.5033...
0.6024382
0
Links all atoms in 'exp' to their invarioms.
def _link(self): for exp_atom in self['exp'].atoms: if exp_atom.isTolerated(): continue for model_atom in self[exp_atom.model_compound.name].atoms: inv = exp_atom.get_active_invariom() if inv in model_atom.invarioms.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ins(self):\n for i in self.name:\n self.str_in.append(i.get())\n for i in self.comb:\n self.act.append(i.current())\n self.destroy()", "def _get_atoms(self):\n atoms = []\n invarioms = []\n\n for molecule in self.values():\n atoms += ...
[ "0.541973", "0.53397936", "0.5284878", "0.49863306", "0.49830613", "0.4794765", "0.47942436", "0.47504792", "0.46436095", "0.4643061", "0.4632869", "0.4616352", "0.46023867", "0.45933336", "0.45813257", "0.45780787", "0.45734018", "0.45569727", "0.45248002", "0.44818586", "0....
0.73596907
0
Add two dictionaries together, return new dictionary. if key in B already exists in A, do not override. None destructive.
def get_added_dicts(a, b): tmp = copy.deepcopy(a) for key, val in b.iteritems(): if key not in tmp: tmp[key] = val return tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dicts(a, b):\n new_dict = defaultdict(list)\n add_to_dict(a, new_dict)\n add_to_dict(b, new_dict)\n return new_dict", "def merge(a: dict, b: dict) -> dict:\n return __merge(a, b)", "def merge_two_dicts(self, x, y):\n z = x.copy()\n z.update(y)\n return z", "def a...
[ "0.7166191", "0.7126028", "0.7118499", "0.70914936", "0.70337975", "0.70064807", "0.69760185", "0.69561565", "0.6943505", "0.6943505", "0.6943505", "0.6943505", "0.6943505", "0.6943505", "0.6943505", "0.6943505", "0.6943324", "0.6938591", "0.6845912", "0.68164074", "0.6814673...
0.7173503
0
Convert dictionary into data frame and tokenize inputs given queries.
def prepare_inputs(data, queries, tokenizer): # Prepare inputs table = pd.DataFrame.from_dict(data) inputs = tokenizer(table=table, queries=queries,truncation=True, padding=True,return_tensors="pt").to(device) # Return things return table, inputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query2df(query):\n df = pd.DataFrame(data = list(itertools.product([0, 1], repeat=len(query.variables))), columns=query.variables)\n df['p'] = query.values.flatten()\n return df", "def _convert_tags_to_df(text_dict_tags):\n\n return DataFrame({u'tag' :[item[0] for item in text_dict_tags.items()]...
[ "0.61354715", "0.6041458", "0.5932817", "0.5880666", "0.58784735", "0.58620197", "0.57131207", "0.57031405", "0.56906503", "0.5584784", "0.5552426", "0.5551126", "0.54895955", "0.54824334", "0.5455758", "0.5451413", "0.5435663", "0.5399078", "0.5368841", "0.5356269", "0.53465...
0.70211875
0
Given a person's name, returns the person's initials (uppercase)
def get_initials(fullname): # TODO your code here #Ozzie Smith OS #Bonnie blair BB #George G #Daniel Day Lewis DDL #xs = (fullname) initial = "" split_name = fullname.split() print(split_name) for i in split_name: initial = initial + i[0].upper() return in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_initials(name, force_upper=True):\r\n if force_upper:\r\n return name[0:1].upper()\r\n return name[0:1]", "def initials(full_name):\r\n\r\n if full_name is not None and len(full_name) > 0:\r\n return ''.join([s[0] for s in full_name.split(' ')]).upper()\r\n else:\r\n retu...
[ "0.8512483", "0.83186287", "0.776669", "0.77114457", "0.75733525", "0.75212145", "0.7251313", "0.7233688", "0.7215348", "0.70606756", "0.701801", "0.6998534", "0.6986747", "0.69570524", "0.6946686", "0.6927703", "0.6927571", "0.6919062", "0.68892944", "0.6880017", "0.6832559"...
0.7597779
4
Derivative of the sigmoid function.
def sigmoid_prime(z): return sigmoid(z) * (1 - sigmoid(z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_der...
[ "0.84754366", "0.8450928", "0.8396931", "0.83485264", "0.83485264", "0.8298343", "0.80539966", "0.7753385", "0.77070266", "0.7498153", "0.7464916", "0.7454039", "0.7401582", "0.7385017", "0.73829913", "0.7346935", "0.7321687", "0.73094004", "0.7192053", "0.7113881", "0.709236...
0.0
-1
Adds the two variants together. Present this assumes mostly flat dictionaries.
def variant_add(v1: dict, v2: dict) -> Dict[str, Any]: left = set(v1.keys()).difference(v2.keys()) right = set(v2.keys()).difference(v1.keys()) joint = set(v1.keys()) & set(v2.keys()) # deal with __migrator: ordering if "__migrator" in v2: ordering = v2["__migrator"].get("ordering", {}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iadd__(self, other):\n if not isinstance(other, dict):\n msg = 'Can not concatenate Dict and {}'.format(type(other))\n raise TypeError(msg)\n for key, val in other.items():\n if key in self:\n self._append_key(key, val)\n else:\n ...
[ "0.71016604", "0.6687375", "0.6671997", "0.6645548", "0.65807945", "0.6534333", "0.6532504", "0.6514086", "0.642365", "0.63931966", "0.6333451", "0.632827", "0.631578", "0.63134897", "0.63060707", "0.6288282", "0.6281028", "0.624485", "0.6204847", "0.6193211", "0.6169858", ...
0.71381205
0
Return a json list of stations from the dataset.
def stations(): station_results = session.query(Stations.station, Stations.name).all() station_data = [] for row in station_results: station_dict = {} station_dict["station"] = row.station station_dict["name"] = row.name station_data.append(station_dict) return jsonify...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati...
[ "0.87404066", "0.8714156", "0.87127185", "0.8378763", "0.8345637", "0.8322411", "0.83219725", "0.830175", "0.82886815", "0.82878584", "0.8273292", "0.826582", "0.8256972", "0.82500017", "0.82434344", "0.82219756", "0.8208606", "0.8134151", "0.8126946", "0.8099855", "0.8089563...
0.83640033
4
Return a json list of Temperature Observations (tobs) for the previous year
def prior_year_temp(): tobs_data = session.query(Measurements.tobs).all() return jsonify (tobs_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tobsdata():\n # query for the dates and temperature observations from a year from the last data point.\n # * Return a JSON list of Temperature Observations (tobs) for the previous year.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = ses...
[ "0.7804016", "0.77074", "0.76585793", "0.7623904", "0.74057007", "0.73627263", "0.73342705", "0.7327496", "0.72380286", "0.71261024", "0.70932883", "0.705637", "0.7048202", "0.69966257", "0.6834264", "0.6800696", "0.6793342", "0.671503", "0.66767067", "0.665408", "0.6603448",...
0.8164726
0
The reference to the NetworkSecurityGroup resource.
def network_security_group(self) -> Optional['outputs.NetworkSecurityGroupResponse']: return pulumi.get(self, "network_security_group")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def security_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"security_group\")", "def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_id\")", "def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"secu...
[ "0.61486256", "0.5980633", "0.5980633", "0.5957386", "0.5957386", "0.58578396", "0.5758829", "0.5758829", "0.5742902", "0.5718561", "0.5653038", "0.56506914", "0.5594251", "0.55926985", "0.55347663", "0.55164385", "0.54995966", "0.54956484", "0.548954", "0.54870534", "0.54159...
0.7118084
0
The provisioning state of the subnet resource.
def provisioning_state(self) -> str: return pulumi.get(self, "provisioning_state")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")", "def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")", "def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"...
[ "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.67684704", "0.6683957", "0.66709733", "0.66709733", "0.66709733", "0.66709733", "0.66709733", "0.6391554", ...
0.7032925
22
The reference to the RouteTable resource.
def route_table(self) -> Optional['outputs.RouteTableResponse']: return pulumi.get(self, "route_table")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_table_id(self):\n return self._route_table_id", "def table_reference(self) -> 'outputs.TableReferenceResponse':\n return pulumi.get(self, \"table_reference\")", "def table_ref(self):\n return self._table_ref", "def table(self):\n return self.reference.table", "def get(...
[ "0.7157897", "0.7102249", "0.657457", "0.6428238", "0.61176395", "0.6112945", "0.60934347", "0.60783446", "0.604512", "0.58873767", "0.5856369", "0.576922", "0.576922", "0.5754943", "0.5753837", "0.57489276", "0.57415915", "0.57415915", "0.57292205", "0.5700971", "0.5676525",...
0.7583651
0
An array of references to services injecting into this subnet.
def service_association_links(self) -> Sequence['outputs.ServiceAssociationLinkResponse']: return pulumi.get(self, "service_association_links")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def services(self) -> List[Service]:\n return self._services", "def get_services(self):\n\n return list(self.services.values())", "def getServices(self):\n pass", "def exposed_services(self):\n return self._exposed_services", "def services(self):\r\n return services.Servi...
[ "0.69540715", "0.6888438", "0.6811714", "0.667893", "0.66445446", "0.6623339", "0.654235", "0.65156436", "0.6514715", "0.64905757", "0.6485338", "0.6464627", "0.6460175", "0.6454752", "0.6425197", "0.6400359", "0.6368166", "0.6368166", "0.6311541", "0.6169567", "0.61588264", ...
0.0
-1
Gets the specified subnet by virtual network and resource group.
def get_subnet(expand: Optional[str] = None, resource_group_name: Optional[str] = None, subnet_name: Optional[str] = None, virtual_network_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetSubnetResult: __args__ = dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")", "def subnet_get(auth=None, **kwargs):\n cloud = get_operator_cloud(auth)\n kwargs = _clean_kwargs(**kwargs)\n return cloud.get_subnet(**kwargs)", "def subnet(self) -> Optional[pulu...
[ "0.7312933", "0.7148066", "0.710691", "0.70535386", "0.70116264", "0.68666935", "0.68608004", "0.6636804", "0.65658665", "0.6514931", "0.6431516", "0.6405462", "0.6330611", "0.63169676", "0.63135105", "0.6246402", "0.6246402", "0.6231587", "0.6222032", "0.6215549", "0.6205137...
0.7260748
1
Gets the specified subnet by virtual network and resource group.
def get_subnet_output(expand: Optional[pulumi.Input[Optional[str]]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, subnet_name: Optional[pulumi.Input[str]] = None, virtual_network_name: Optional[pulumi.Input[str]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")", "def get_subnet(expand: Optional[str] = None,\n resource_group_name: Optional[str] = None,\n subnet_name: Optional[str] = None,\n virtual_network_nam...
[ "0.7312933", "0.7260748", "0.7148066", "0.710691", "0.70535386", "0.70116264", "0.68608004", "0.6636804", "0.65658665", "0.6514931", "0.6431516", "0.6405462", "0.6330611", "0.63169676", "0.63135105", "0.6246402", "0.6246402", "0.6231587", "0.6222032", "0.6215549", "0.6205137"...
0.68666935
6
x.__nonzero__() x != 0
def __nonzero__(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False", "def __nonzero__(self):\n return self.value.__nonzero__()", "def __nonzero__(self):\n return self.__nonzero", "def __nonzero__(self):\n return self.__nonzero", "def _...
[ "0.77507436", "0.76362675", "0.74977964", "0.74977964", "0.749715", "0.7277969", "0.71057385", "0.70980686", "0.7076215", "0.7038673", "0.7013006", "0.69773006", "0.6971467", "0.69356734", "0.6927782", "0.6920768", "0.690163", "0.6892301", "0.6864851", "0.6852248", "0.6836008...
0.61815006
80
Mask NaN values with zeros
def tf_nan_to_zeros_float32(tensor): return tf.select(tf.is_nan(tensor), tf.zeros(tf.shape(tensor), dtype=tf.float32), tensor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applymask(self,mask):\n self.spec[mask==0]=np.nan", "def set_nan(x):\n x[x == -999] = np.nan\n return x", "def getMask(self):\r\n mask = np.array(self.array, dtype=np.float32)\r\n mask[mask == 0] = np.nan\r\n return mask", "def fillna_nb(a, value):\n return set_by_mas...
[ "0.7398997", "0.70181227", "0.67289853", "0.67160285", "0.66584706", "0.663829", "0.6621543", "0.648719", "0.6482023", "0.6394199", "0.639174", "0.6380966", "0.6357234", "0.63541216", "0.6345087", "0.63363355", "0.6298042", "0.6294285", "0.62942195", "0.628689", "0.6263663", ...
0.5737042
82
determine whether any shells or missiles have left the world
def check_bounds(self): for i, missile in enumerate(self.missile_list): if missile.out_of_bounds(self.world): del self.missile_list[i] self.gameevents.add("bounds_remove", "missile") for i, shell in enumerate(self.shell_list): if shell.out_of_bound...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_fail(self):\n failed = False\n for obj in self.world_state.objects:\n failed = failed or obj.lost\n return failed", "def check_win(self):\n return UNEXPOSED not in self.get_game() and self.get_game().count(FLAG) == len(self.get_pokemon_location)", "def check_game_...
[ "0.65513104", "0.6476485", "0.6369261", "0.63377595", "0.6258784", "0.62471265", "0.6170603", "0.61283165", "0.6101203", "0.6066138", "0.60542715", "0.60477644", "0.60332453", "0.601886", "0.6017714", "0.59443873", "0.5941525", "0.5938948", "0.59236884", "0.59152216", "0.5913...
0.6539798
1
Join voice channel and force bypass restrictions.
async def joinForce(self, ctx): print("joining") channel = ctx.author.voice.channel await channel.connect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _join(self, ctx: commands.Context):\n\n destination = ctx.author.voice.channel\n if ctx.voice_state.voice:\n await ctx.voice_state.voice.move_to(destination)\n return\n ctx.voice_state.voice = await destination.connect()\n await ctx.message.add_reaction('...
[ "0.65273523", "0.64909756", "0.6384299", "0.63237643", "0.63054657", "0.629726", "0.6260496", "0.6193694", "0.6179695", "0.6000898", "0.59756815", "0.5892782", "0.5876597", "0.58530897", "0.58495593", "0.5795379", "0.5727061", "0.5699195", "0.5642094", "0.56312084", "0.562480...
0.7571166
0
Leave voice channel and force bypass restrictions.
async def leaveForce(self, ctx): await ctx.voice_client.disconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def leave(self, ctx):\n if ctx.guild.voice_client:\n await ctx.guild.voice_client.disconnect()\n await ctx.send(\"Left voice channel.\")\n else:\n await ctx.message.add_reaction('\\U0001F615');\n await ctx.send(\"Not in a voice channel.\")", "async ...
[ "0.6632035", "0.6447251", "0.6378872", "0.6358157", "0.633189", "0.62692326", "0.62692326", "0.62486273", "0.6211148", "0.62077534", "0.6200669", "0.61999506", "0.61754453", "0.6170025", "0.615867", "0.6107641", "0.6105342", "0.6103549", "0.60168636", "0.60027325", "0.5995111...
0.74256724
0
a test suite for various sqlalchemy engines.
def _test_engine(engine, service, vendor, expected_meta): tracer = Tracer() tracer.writer = DummyWriter() # create an engine and start tracing. trace_engine(engine, tracer, service=service) start = time.time() @contextlib.contextmanager def _connect(): try: conn = engin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_engine(self):\n config = {\n \"url\": 'sqlite://',\n \"connect_args\": {\n \"check_same_thread\": \"false\",\n \"poolclass\": \"pool.StaticPool\"\n }\n }\n engine = self.configurator.setup_engine(config)\n self.asse...
[ "0.7081772", "0.6789211", "0.66292816", "0.6622976", "0.65551203", "0.65252316", "0.64673615", "0.6427165", "0.6364955", "0.63483185", "0.63366", "0.6330665", "0.63108355", "0.62966716", "0.6260598", "0.62586844", "0.62571675", "0.62506086", "0.6246006", "0.62316394", "0.6223...
0.7062062
1
Set float precision and trim precision zeros.
def fmt_float(f, p=0): string = str( decimal.Decimal(f).quantize(decimal.Decimal('0.' + ('0' * p) if p > 0 else '0'), decimal.ROUND_HALF_UP) ) m = FLOAT_TRIM_RE.match(string) if m: string = m.group('keep') if m.group('keep2'): string += m.group('keep2') return s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_precision(self, precision) :\n self.__precision = self.parent().monoid().filter(precision)", "def _set_precision(self, precision) :\n self.__precision = self.parent().action().filter(precision)", "def change_precision(self, precision):\n if precision <= 0:\n print(\"Pre...
[ "0.70414263", "0.68680453", "0.67523", "0.65524995", "0.64943695", "0.6418701", "0.63790375", "0.63697594", "0.63184303", "0.6310227", "0.6310227", "0.62819654", "0.6269115", "0.6236121", "0.6229502", "0.6188425", "0.6167546", "0.6121999", "0.61019456", "0.609147", "0.609147"...
0.5861475
27
Returns starting state of the board.
def initial_state(): return [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)", "def start_state():\n return chess.Board()", "def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))...
[ "0.8081514", "0.7890486", "0.7534929", "0.72789717", "0.72789717", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", ...
0.0
-1
Returns player who has the next turn on a board.
def player(board): num_x = sum([list.count(X) for list in board]) num_o = sum([list.count(O) for list in board]) if num_x == num_o: return X else: return O
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None", "def next_player(self,board, prev_player):\r\n...
[ "0.7910981", "0.7522231", "0.74202156", "0.73700017", "0.7195211", "0.6975818", "0.6961524", "0.6925103", "0.6919324", "0.6899665", "0.6847661", "0.68389785", "0.6838656", "0.6825226", "0.6774813", "0.6774813", "0.6769727", "0.671182", "0.67078507", "0.6656021", "0.66138667",...
0.0
-1
Returns the optimal action for the current player on the board.
def minimax(board): if terminal(board): return None possible_actions = actions(board) if player(board) == X: max_utility = -math.inf for action in possible_actions: action_val = min_val(result(board, action)) if action_val > max_utility: max_ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction", "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min...
[ "0.7766856", "0.76323676", "0.75855315", "0.75175256", "0.74667144", "0.7460485", "0.74263537", "0.7416421", "0.73943585", "0.7375846", "0.7333894", "0.73147565", "0.7306611", "0.7284639", "0.72650313", "0.72650313", "0.7250975", "0.72331834", "0.7203267", "0.71732694", "0.71...
0.75285065
3
This approach is better than the previous one as it does not use extra space. We keep track of two variables as references, maxlevel and sum. maxLevel refers to the highest level reached so far. sum is the total sum of the right view uptil that level. We traverse right child first, so as we go down the level we obtain ...
def getSum2(root, level=0, maxLevel=None, sum=None): if root == None: return 0 if maxLevel == None: maxLevel = [-1] sum = [0] if maxLevel[0] < level: sum[0] += root.data maxLevel[0] = level getSum2(root.right, level+1, maxLevel, sum) getSum2(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_level_maxsum (self):\r\n level_queue = [self]\r\n next_level_queue = []\r\n curr_level = 0\r\n max_sum = -sys.maxsize\r\n while level_queue:\r\n curr_node = level_queue.pop(0)\r\n if curr_node.left:\r\n next_level_queue.append(curr_no...
[ "0.77163315", "0.7626254", "0.71954876", "0.71082497", "0.67971444", "0.6661522", "0.6630408", "0.6460394", "0.6457264", "0.6445148", "0.63855803", "0.6293592", "0.6274472", "0.6199291", "0.61836684", "0.6112749", "0.6057289", "0.6044596", "0.5873906", "0.5860754", "0.5838793...
0.78315043
0
Return value of top element without removing from stack
def top(self) -> object: return self._data[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n return stack.top.value", "def top(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Stack is empty')\n\t\treturn self._head._element", "def top(self):\n if self.stack == []:\n retu...
[ "0.83318007", "0.81100655", "0.80892026", "0.8075631", "0.80618685", "0.79362243", "0.7916097", "0.7908167", "0.78884083", "0.78880435", "0.7872301", "0.7866546", "0.7832417", "0.7830693", "0.77820283", "0.778126", "0.7778161", "0.77772", "0.7749871", "0.7746659", "0.77423126...
0.71825653
67
Initialize empty queue based on Python list
def __init__(self): self._data = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_empty_queue():\n return Queue(0, None, None)", "def __init__(self):\n self.queue = []\n self.queue.append(Queue())\n self.queue.append(Queue())\n self.tag = 0 # using to record which queue contain the data", "def __init__(self) -> None:\n self._queue = []", "def...
[ "0.76686674", "0.75461084", "0.74717855", "0.7373376", "0.7352881", "0.7327719", "0.7327719", "0.7323243", "0.7320393", "0.7320393", "0.7320393", "0.7320393", "0.7320393", "0.731801", "0.731801", "0.7256335", "0.7252858", "0.72324866", "0.7214158", "0.71929574", "0.71722823",...
0.0
-1
Return True if the queue is empty, return False otherwise
def is_empty(self): return len(self._data) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def empty(self) -> bool: \n if(self.queue is not None and len(self.queue) > 0):\n print(\"len > 0\" )\n return False\n else:\n print(\"len = 0\" )\n return True", "def empty(self) -> bool:\n ...
[ "0.9123533", "0.9076229", "0.90322787", "0.900755", "0.900755", "0.89948964", "0.8985214", "0.89755434", "0.890774", "0.8907057", "0.8879381", "0.8855857", "0.8773003", "0.8752333", "0.8752333", "0.8737812", "0.87300223", "0.8718975", "0.8668069", "0.8608854", "0.8599517", ...
0.0
-1
Returns value stored in root node. If tree is empty, method should return None.
def get_first(self) -> object: if self.root is None: # If tree is empty return None return self.root.value # Returning root value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_value(self):\n return self.__root.get_value()", "def get_first(self) -> object:\n #binary search tree == empty\n if self.root is None:\n return None\n\n # return\n return self.root.value", "def root(tree):\n\n return tree[0]", "def get_xml_node_value ...
[ "0.7818051", "0.76613665", "0.697164", "0.69265217", "0.6892464", "0.67330015", "0.67122906", "0.6711037", "0.66726214", "0.6565201", "0.65605605", "0.65474355", "0.65456116", "0.65299207", "0.65149134", "0.6508499", "0.6508499", "0.64951956", "0.6463805", "0.644734", "0.6443...
0.80032796
0
Counts and returns number of leaves that have no children
def count_leaves(self) -> int: if self.root is None: # If tree is empty return 0 return self.count_helper(self.root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaf_count(self) -> int:\n if self.children == []:\n return 1\n else:\n return sum([x.leaf_count() for x in self.children])", "def count_leaves(self) -> int:\n # binary search tree == empty\n if self.root is None:\n return 0\n\n #recursive h...
[ "0.8165063", "0.78673524", "0.7788163", "0.778297", "0.7632432", "0.7617847", "0.750201", "0.7460292", "0.74360925", "0.739089", "0.7314105", "0.73054016", "0.73023474", "0.7238135", "0.72338337", "0.72271705", "0.7028478", "0.69378364", "0.69237834", "0.68958", "0.68908614",...
0.80410475
1
Gets the mute status. Returns bool True if mute, False otherwise
def mute(self) -> bool: return bool(self.audio_mixer.getmute()[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mute(self):\n return on_off_bool(self.get(COMMAND_UIC, 'GetMute')['mute'])", "def is_volume_muted(self):\n return self._mute", "def is_volume_muted(self):\n return self._state.get(\"mute\", None)", "async def get_mute(self) -> bool:\n return await self._pytheos.api.player....
[ "0.8447197", "0.7853023", "0.7816177", "0.7786548", "0.7637117", "0.7604124", "0.7589401", "0.75716776", "0.75716776", "0.75716776", "0.7493464", "0.7490551", "0.74009085", "0.7386506", "0.7377441", "0.7263709", "0.70131826", "0.66592157", "0.65496236", "0.64843935", "0.64833...
0.82508844
1
Sets the mute status.
def mute(self, value: bool) -> None: self.audio_mixer.setmute(value) self.update_status()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute(self, status=None):\n if status is None:\n status = not self.status.volume_muted\n\n self._socket_client.receiver_controller.set_volume_muted(status)", "def mute(self, status=None):\n if status is not None:\n st = status\n else:\n ...
[ "0.8213331", "0.8133731", "0.7935711", "0.77839756", "0.7704363", "0.7645187", "0.7585236", "0.75776887", "0.7526588", "0.7472934", "0.7441385", "0.7388262", "0.72046673", "0.71678656", "0.71228534", "0.71199274", "0.71054775", "0.7046623", "0.69437826", "0.68207675", "0.6712...
0.8073841
2
Stops the MQTT client and disconnects from the broker.
def stop(self) -> None: self.mqttc.disconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n if self._connected:\n self._client.loop_stop()\n self._client.disconnect()\n self._connected = False\n logger.info(\"Connection with MQTT Broker closed.\")", "def stop_mqtt(self):\n if self.mqtt:\n logger.debug('Disconnecting ...
[ "0.8587642", "0.8142177", "0.75698906", "0.7143907", "0.7085005", "0.70632106", "0.70489585", "0.70416576", "0.70375", "0.7019846", "0.6991122", "0.6919724", "0.69057995", "0.6826272", "0.67882514", "0.6742181", "0.66949403", "0.6682151", "0.66718763", "0.6662771", "0.6651615...
0.84184134
1
This method generates possible antecedents per span which survived the pruning stage. This procedure is `generic across the batch`. The reason this is the case is that each span in a batch can be coreferent with any previous span, but here we are computing the possible `indices` of these spans. So, regardless of the ba...
def _generate_valid_antecedents(num_spans_to_keep: int, max_antecedents: int, device: int) -> Tuple[torch.IntTensor, torch.IntTensor, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_antecedent_gold_labels(top_span_labels: torch.IntTensor,\n antecedent_labels: torch.IntTensor):\n # Shape: (batch_size, num_spans_to_keep, max_antecedents)\n target_labels = top_span_labels.expand_as(antecedent_labels)\n same_cluster_indicato...
[ "0.5550315", "0.5550315", "0.5550315", "0.55373615", "0.54277706", "0.53765005", "0.5212551", "0.5188417", "0.50354105", "0.49841648", "0.48158422", "0.4804906", "0.4739883", "0.46752444", "0.4641308", "0.4580102", "0.45601207", "0.45601207", "0.45328763", "0.4526556", "0.449...
0.7365419
0
Computes scores for every pair of spans. Additionally, a dummy label is included, representing the decision that the span is not coreferent with anything. For the dummy label, the score is always zero. For the true antecedent spans, the score consists of the pairwise antecedent score and the unary mention scores for th...
def _compute_coreference_scores(self, pairwise_embeddings: torch.FloatTensor, top_span_mention_scores: torch.FloatTensor, antecedent_mention_scores: torch.FloatTensor, antecede...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score_hard_rationale_predictions(\n truth: List[Rationale], pred: List[Rationale]\n) -> InstanceScores:\n\n truth = set(truth)\n pred = set(pred)\n micro_prec = len(truth & pred) / len(pred)\n micro_rec = len(truth & pred) / len(truth)\n micro_f1 = _f1(micro_prec, micro_rec)\n instance_mic...
[ "0.5453524", "0.5400239", "0.5400239", "0.5400239", "0.52683854", "0.5257503", "0.52395684", "0.5198675", "0.5167986", "0.51665837", "0.50992566", "0.5077719", "0.50511426", "0.5045459", "0.49581084", "0.49569833", "0.4945379", "0.49450028", "0.49203286", "0.49163902", "0.490...
0.4830466
30
Generate a presigned URL to share an S3 object
def create_presigned_url(bucket_name, object_name, expiration=3600): # Generate a presigned URL for the S3 object s3_client = boto3.client('s3') try: response = s3_client.generate_presigned_url( 'get_object', Params={'Bucket': bucket_name, 'Key': object_name}, Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_presigned_url(bucket_name, object_name):\n\n logger = logging.getLogger(\"SimpleReplayLogger\")\n\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={'Bucket': bucket_name,\n ...
[ "0.781944", "0.78191537", "0.77588147", "0.765886", "0.7652143", "0.76489365", "0.7648256", "0.764653", "0.76100934", "0.7571346", "0.73623234", "0.73535985", "0.73304003", "0.7310247", "0.7161862", "0.71146256", "0.70968693", "0.7060428", "0.7051806", "0.7022448", "0.7007857...
0.76814914
3
Generate a list of atom/mass pairs from the simulated atoms
def print_masses(names, weights): unique = set(names) # all simulated atom types, e.g. C, H s = "%BLOCK SPECIES_MASS\n" s += "\n".join(["%s\t%f" % (atom, weights[atom]) for atom in unique]) s += "\n%ENDBLOCK SPECIES_MASS" return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mol_masses(mol):\n return np.array([a.GetMass() for a in mol.GetAtoms()])", "def atoms(self):\n print('processing [ atoms ]')\n x = \"\"\"[ atoms ]\n; nr type resnr residu atom cgnr charge mass\n\"\"\"\n qtot = 0.0\n fmt = '{nr:6d} {type} 1 {residu} {atom} 1 {ch...
[ "0.68541485", "0.65910625", "0.65002006", "0.61934286", "0.6192636", "0.6169197", "0.61452055", "0.6101165", "0.609247", "0.60858977", "0.60666937", "0.6063567", "0.605046", "0.6009178", "0.5998994", "0.59909105", "0.59579784", "0.593843", "0.5935961", "0.59214455", "0.592000...
0.0
-1
Reads file into list while stripping away whitespace characters.
def parse(filename): with open(filename) as file: lines = [line.strip() for line in file] return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_list(list_file):\r\n return [line.strip('\\n').strip('\\r') for line in open(list_file)]", "def read_list(fname):\n with open(fname) as handle:\n items = [line.strip() for line in handle]\n return items", "def process_file(file_name):\n f_in = open(file_name)\n return list(map(la...
[ "0.74934196", "0.7424236", "0.7420702", "0.74188954", "0.7405871", "0.73877203", "0.73588467", "0.7320326", "0.72669894", "0.7251389", "0.7246783", "0.7238401", "0.72242737", "0.7196502", "0.7049605", "0.7029878", "0.70210415", "0.6946796", "0.6941492", "0.6857922", "0.681489...
0.6392644
46
Return distance between two lat/lon points in km
def point_to_point_distance(p1:Point, p2: Point) -> float: return round(geopy.distance.distance((p1.y, p1.x), (p2.y, p2.x)).km,2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']", "def calc_distance_two_points(lat_from, long_from, lat_to, long_to):\n distance_in_km = haversine(\n (lat_from, long_from),\n (lat_to, long_to),\n unit='km')\n\n re...
[ "0.82663375", "0.8180022", "0.8157151", "0.81110376", "0.8090879", "0.80200475", "0.7986167", "0.7943484", "0.79287034", "0.7920262", "0.7909124", "0.7908051", "0.7874297", "0.78456", "0.7843081", "0.7830177", "0.7800571", "0.77906597", "0.7754079", "0.77297395", "0.7717442",...
0.7498413
35
returns the number of points/rows in the data set.
def get_num_points(self): dimensions = self.data.shape return dimensions[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNbRows(self):\n return self.data.shape[1]", "def n_points(self):\n\n if self.data_reduced:\n return len(self.data_reduced[0])\n else:\n return 0", "def data_count(self):\r\n\r\n shp = self.df.shape\r\n row_count = shp[0]\r\n return row_coun...
[ "0.80856127", "0.80212545", "0.8007088", "0.7975629", "0.79718477", "0.7858655", "0.7828387", "0.7727079", "0.7684411", "0.7568434", "0.75577956", "0.75539523", "0.75380296", "0.75021416", "0.749834", "0.74500316", "0.74453664", "0.74453664", "0.74282986", "0.7414466", "0.739...
0.8029127
1
create a readable data table for html page
def create_display_data_table(): for ccd in range(0, 10): for node in range(0, 4): file = 'ccd' + str(ccd) + '_' + str(node) infile = data_dir + file outfile = web_dir + 'Data/' + file f = open(infile, 'r') data = [line.strip() for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_html_layout(self):\n page = \"\"\"<!DOCTYPE html>\n <!doctype html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n </head>\n </html...
[ "0.6946965", "0.69299895", "0.6771338", "0.67320246", "0.6715655", "0.66717064", "0.6652968", "0.66163486", "0.6607926", "0.6547731", "0.6515936", "0.6514979", "0.6513547", "0.64986885", "0.643394", "0.64201856", "0.6418552", "0.64144164", "0.63896674", "0.6388682", "0.636090...
0.6723795
4
Calculates the number of days since 111900 (the Excel Epoch)
def get_current_days_excel_epoch(): f_date = datetime.date(1900, 1, 1) l_date = datetime.datetime.today().date() delta = l_date - f_date return delta.days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_days_since_epoch(day, month, year):\r\n d = datetime(int(year), int(month), int(day))\r\n epoch = datetime.utcfromtimestamp(0)\r\n return (d - epoch).days", "def calculate_days(time):\n return int(time / 86400)", "def epoch_seconds(date):\r\n td = date - epoch\r\n return td.days *...
[ "0.7083012", "0.70454645", "0.6994901", "0.6972299", "0.6954758", "0.6954758", "0.69342244", "0.6863395", "0.67731464", "0.670872", "0.6632939", "0.6544763", "0.6531819", "0.6528415", "0.65174526", "0.6493381", "0.64617276", "0.6439297", "0.63977396", "0.63881654", "0.635627"...
0.8354966
0
>>> string_chopped_to_float('hello75494758test', 'hello', 'test') 75494758.0 >>> string_chopped_to_float('hello1test', 'hello', 'test') 1.0
def string_chopped_to_float(input_string, chop_up, chop_low): input_string = str(input_string) return float(string_chop_up(string_chop_low(input_string, chop_up), chop_low))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ffloat(string):\n try:\n return float(string.strip())\n except:\n return 0", "def floatify(string):\n temporary_string = \"0.\" + string[:-1]\n return float(temporary_string)", "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s...
[ "0.76202214", "0.7513479", "0.73897016", "0.7269182", "0.7262404", "0.71777946", "0.715664", "0.7013713", "0.69565153", "0.6954011", "0.6907948", "0.68754464", "0.6867221", "0.6840515", "0.68281454", "0.6768567", "0.6767471", "0.6719723", "0.67103374", "0.6662983", "0.6615891...
0.8501997
0
Get connection of the script parameter's db. If there is no script parameter, default db is local.
def get_connection(engine_key=None): if engine_key is None: engine_key = _get_engine_key() if engine_key not in engine_pool.keys(): raise EnvironmentError("{} is not in engine_pool. Please check your script parameters.".format(engine_key)) return engine_pool[engine_key].connect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db():\n if not hasattr(g, \"sql_db\"):\n g.sql_db = connect_db()\n return g.sql_db", "def get_db():\n if \"db\" not in g:\n host = current_app.config[\"HOST\"]\n dbname = current_app.config[\"DATABASE\"]\n #params = \"host='{}' dbname='{}' user=root\".format(host, dbn...
[ "0.72661835", "0.7213039", "0.7167934", "0.71468794", "0.7121477", "0.69964993", "0.698836", "0.69833606", "0.6968781", "0.6957994", "0.6933347", "0.6916411", "0.6877128", "0.6862319", "0.68241996", "0.6813471", "0.6771486", "0.6760717", "0.67594606", "0.674768", "0.67476124"...
0.0
-1
Varialbe type that automatically choose cpu or cuda
def to_var(x, requires_grad=False): if isinstance(x, list): for k in x: if torch.cuda.is_available(): k = k.cuda() k = torch.tensor(k, requires_grad=requires_grad) else: if torch.cuda.is_available(): x = x.cuda() x = torch.tensor(x,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_device(in_arg): \n \n return torch.device(\"cuda\" if torch.cuda.is_available() and in_arg.gpu == 1 else \"cpu\")", "def setup_device(n_gpus: int) -> object:\n if n_gpus >= 1 and torch.cuda.is_available():\n LOG.info('\\n CUDA is available! using GPU...')\n return torch.devic...
[ "0.68364257", "0.67880046", "0.6779072", "0.67483586", "0.6691501", "0.66721827", "0.66627854", "0.6655084", "0.6613398", "0.655558", "0.6480205", "0.6446704", "0.6443538", "0.64345646", "0.6369032", "0.6369032", "0.6338733", "0.631449", "0.6293746", "0.62697166", "0.6269074"...
0.0
-1
Append list of n elements in list of n lists
def append_list(list_a, list_b): for i, a in enumerate(list_a): list_b[i].append(a) return list_b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lists_of_n(self, myList, n):\n if len(myList) <= 0:\n return []\n \n if len(myList) <= n:\n return [ myList ]\n\n ret = []\n currentList = []\n count = 0\n for item in myList:\n count = count + 1\n currentList.append(...
[ "0.6807706", "0.6706362", "0.66457474", "0.663961", "0.65851057", "0.65645623", "0.6520212", "0.64464223", "0.6407452", "0.6399652", "0.6395309", "0.63260823", "0.63258517", "0.630658", "0.6291918", "0.6277825", "0.6277825", "0.62566686", "0.6253813", "0.62466097", "0.6241607...
0.0
-1
Splits the given data by the given cluster assignments.
def split_data(df_data, clusters): if clusters is None: return {0: df_data} return { k: df_data.loc[clusters.index[clusters == k]] for k in clusters.unique() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partitionData(data, labels, partition):\n\treturn [s[partition] for s in data], labels[partition]", "def partition(self, data, labels):\n\t\treturn self.kfold.split(labels)", "def partition(self, data, labels):\n\t\traise Exception(\"Not implmented\")", "def dataset_splits(self):\n # 10% evaluatio...
[ "0.5998715", "0.58617157", "0.5804616", "0.5778629", "0.5770824", "0.57205516", "0.5692267", "0.5632453", "0.5593713", "0.5591811", "0.5513163", "0.5492773", "0.5449953", "0.54481894", "0.54481894", "0.541212", "0.53947717", "0.5391424", "0.53894734", "0.53755146", "0.5373107...
0.62756664
0
Copies the model parameters of one net to another.
def copy_model_parameters(sess, net1, net2): copy_scope_parameters(sess, net1.scope, net2.scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hard_update(source_net, target_net):\n for target_param, param in zip(target_net.parameters(), source_net.parameters()):\n target_param.data.copy_(param.data)", "def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n ...
[ "0.7798005", "0.71947426", "0.6970523", "0.6810422", "0.6723942", "0.6572565", "0.65657896", "0.652187", "0.6497664", "0.63801336", "0.63801336", "0.63792497", "0.63616174", "0.6232208", "0.6214631", "0.62068164", "0.61581165", "0.61567116", "0.61458546", "0.61458546", "0.614...
0.8102487
0
Given xmin and xmean, calculate xmax.
def _calc_xmax(self, xmin, xmean): self.xmin = xmin self.xmax = xmean+.01 for i in itertools.count(): self.norm = self._integrate(self.xmax)-self._integrate(self.xmin) newmean = self.mean() delta = xmean - newmean #print self.xmin, newmean, self.xm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_xmin(self, xmax, xmean):\n self.xmin = xmean-.01\n self.xmax = xmax\n for i in itertools.count():\n self.norm = self._integrate(self.xmax)-self._integrate(self.xmin)\n newmean = self.mean()\n delta = - newmean + xmean\n #print self.xmin, ne...
[ "0.7159941", "0.6644928", "0.6595465", "0.6282393", "0.6058324", "0.6008358", "0.598642", "0.5981668", "0.59622645", "0.59518296", "0.589675", "0.5775744", "0.5768364", "0.573387", "0.5666532", "0.56613404", "0.5658492", "0.55588865", "0.5554085", "0.5546216", "0.55198145", ...
0.7543527
0
Given xmax and xmean, calculate xmin.
def _calc_xmin(self, xmax, xmean): self.xmin = xmean-.01 self.xmax = xmax for i in itertools.count(): self.norm = self._integrate(self.xmax)-self._integrate(self.xmin) newmean = self.mean() delta = - newmean + xmean #print self.xmin, newmean, self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xmin(self):\n return self.__xmin", "def minimum ( self ,\n xmin = None , xmax = None ,\n ymin = None , ymax = None , x0 = () ) :\n \n if xmin is None : xmin = self.xminmax()[0]\n if xmax is None : xmax = self.xminmax()[1]\n if self.xmin...
[ "0.65930706", "0.6441789", "0.6427979", "0.6360444", "0.6352979", "0.634569", "0.6193621", "0.61772054", "0.6101645", "0.6027506", "0.60104257", "0.58738685", "0.5823002", "0.5815513", "0.57013637", "0.5684938", "0.56506073", "0.56309605", "0.5604591", "0.5601875", "0.5589556...
0.793842
0
Returns the path containing IO data files used in testing.
def io_pickle_file(): return join(_PACKAGE_PATH, 'database.p')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_data_path():\n return os.path.abspath(os.path.join(os.path.dirname(__file__), \"data\") + os.path.sep)", "def get_data_path():\n return os.getcwd() + \"/data/\"", "def test_data_dir(self):\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')", "def get_data_path...
[ "0.7840756", "0.76914006", "0.76356053", "0.76124007", "0.7558167", "0.7454095", "0.7225511", "0.7212256", "0.71260905", "0.71198773", "0.7093126", "0.7014291", "0.70042723", "0.69772965", "0.69591296", "0.6958929", "0.68563145", "0.68220174", "0.67919135", "0.678343", "0.672...
0.0
-1
Returns the URL for marking this task as completed.
def complete_url(self): return url_for('complete',id=self.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(self):\n endpoint = 'taskinfo?taskID=%d' % self.id\n return posixpath.join(self.connection.weburl, endpoint)", "def task_url(self, obj):\n request = self.context.get(\"request\")\n return reverse(\"task-detail\", args=[obj.id], request=request)", "def get_finished_url(self):...
[ "0.67253566", "0.6233988", "0.59180653", "0.5902739", "0.58974993", "0.5888213", "0.58599114", "0.58551264", "0.5851763", "0.58509356", "0.58509356", "0.5793037", "0.57874066", "0.57840174", "0.57840174", "0.5769833", "0.576545", "0.5763912", "0.57438934", "0.5731111", "0.573...
0.73656243
0
Deserialize a serialized value to a model instance. If the parent schema is transient, create a new (transient) instance. Otherwise, attempt to find an existing instance in the database.
def _deserialize(self, value, *args, **kwargs): if not isinstance(value, dict): if len(self.related_keys) != 1: keys = [prop.key for prop in self.related_keys] raise self.make_error("invalid", value=value, keys=keys) value = {self.related_keys[0].key: valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, value, **kwargs):\n kwargs.update({'trusted': kwargs.get('trusted', False)})\n if self.deserializer is not None:\n return self.deserializer(value, **kwargs)\n if value is None:\n return None\n if issubclass(self.instance_class, HasProperties):...
[ "0.66955453", "0.66205436", "0.6339031", "0.6127864", "0.5938254", "0.58837366", "0.58773464", "0.58529365", "0.57516885", "0.56784666", "0.5618999", "0.5596128", "0.55882066", "0.5542467", "0.5535758", "0.5521772", "0.5444111", "0.5418266", "0.54116184", "0.54016405", "0.539...
0.68193334
0
Find duplicate number in nums. Given a list of nums with, at most, one duplicate, return the duplicate. If there is no duplicate, return None >>> find_the_duplicate([1, 2, 1, 4, 3, 12]) 1 >>> find_the_duplicate([6, 1, 9, 5, 3, 4, 9]) 9 >>> find_the_duplicate([2, 1, 3, 4]) is None True
def find_the_duplicate(nums): # frequency = {} # for num in nums: # frequency[num] = frequency.get(num, 0) + 1 # for num in frequency: # if frequency[num] == 2: # return num ########## # nums_dict = list(enumerate(sorted(nums))) # for i, num in nums_dict: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_number(self, nums: List[int]) -> int:\n if not nums:\n return False\n if len(nums) == 1:\n return nums[0]\n\n visited = set()\n\n for i in nums:\n if i not in visited:\n visited.add(i)\n else:\n visited...
[ "0.72007155", "0.71849084", "0.7120184", "0.6819626", "0.67981535", "0.6700376", "0.6495514", "0.64611137", "0.6423958", "0.6412791", "0.64043427", "0.6378339", "0.6245624", "0.6185543", "0.60564303", "0.602177", "0.59826195", "0.5961004", "0.5892497", "0.5873059", "0.5866645...
0.8059625
0
Generate and return the top k sequences using beam search.
def beam_search_context(model, images, beam_size, max_caption_len=20, store_alphas=False, store_beam=False, print_beam=False, image_retrieval=None, target_lookup=None): # the max beam size is the dictionary size - 1, since we never select pad beam_size = min(beam_size, model.decoder.vocab_size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nucleus_sampling(model, images, beam_size, top_p, print_beam=False):\n \n current_beam_width = beam_size\n\n encoder_output = model.encoder(images)\n encoder_dim = encoder_output.size()[-1]\n\n # Flatten encoding\n encoder_output = encoder_output.view(1, -1, encoder_dim)\n\n # We'll treat ...
[ "0.65656865", "0.6552478", "0.6415597", "0.6274722", "0.623385", "0.6221493", "0.62093025", "0.6181028", "0.616216", "0.6150922", "0.61144024", "0.60654044", "0.6062551", "0.60465956", "0.60432655", "0.60311055", "0.5972269", "0.5971957", "0.59668124", "0.5930692", "0.5930684...
0.53288436
85
Generate and return the top k sequences using beam search.
def beam_search(model, images, beam_size, max_caption_len=20, store_alphas=False, store_beam=False, print_beam=False, image_retrieval=None, target_lookup=None): # the max beam size is the dictionary size - 1, since we never select pad beam_size = min(beam_size, model.decoder.vocab_size - 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nucleus_sampling(model, images, beam_size, top_p, print_beam=False):\n \n current_beam_width = beam_size\n\n encoder_output = model.encoder(images)\n encoder_dim = encoder_output.size()[-1]\n\n # Flatten encoding\n encoder_output = encoder_output.view(1, -1, encoder_dim)\n\n # We'll treat ...
[ "0.65656865", "0.6552478", "0.6415597", "0.6274722", "0.623385", "0.6221493", "0.62093025", "0.6181028", "0.616216", "0.6150922", "0.61144024", "0.60654044", "0.6062551", "0.60465956", "0.60432655", "0.60311055", "0.5972269", "0.5971957", "0.59668124", "0.5930692", "0.5930684...
0.57292604
33
Generate and return the top k sequences using beam search.
def beam_search_conv(model, images, beam_size, max_caption_len=20, store_alphas=False, store_beam=False, print_beam=False): # the max beam size is the dictionary size - 1, since we never select pad beam_size = min(beam_size, model.decoder.vocab_size - 1) current_beam_width = beam_size ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nucleus_sampling(model, images, beam_size, top_p, print_beam=False):\n \n current_beam_width = beam_size\n\n encoder_output = model.encoder(images)\n encoder_dim = encoder_output.size()[-1]\n\n # Flatten encoding\n encoder_output = encoder_output.view(1, -1, encoder_dim)\n\n # We'll treat ...
[ "0.65656865", "0.6552478", "0.6415597", "0.6274722", "0.623385", "0.6221493", "0.62093025", "0.6181028", "0.616216", "0.6150922", "0.61144024", "0.60654044", "0.6062551", "0.60465956", "0.60432655", "0.60311055", "0.5972269", "0.5971957", "0.59668124", "0.5930692", "0.5930684...
0.0
-1
Generate and return the top k sequences using beam search.
def beam_search_conv_large(model, images, beam_size, max_caption_len=20, store_alphas=False, store_beam=False, print_beam=False): # the max beam size is the dictionary size - 1, since we never select pad beam_size = min(beam_size, model.decoder.vocab_size - 1) current_beam_width ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nucleus_sampling(model, images, beam_size, top_p, print_beam=False):\n \n current_beam_width = beam_size\n\n encoder_output = model.encoder(images)\n encoder_dim = encoder_output.size()[-1]\n\n # Flatten encoding\n encoder_output = encoder_output.view(1, -1, encoder_dim)\n\n # We'll treat ...
[ "0.65654874", "0.6553514", "0.6415881", "0.6275166", "0.6232991", "0.62214494", "0.6210223", "0.6180671", "0.61631125", "0.61527216", "0.61141413", "0.6064397", "0.6064363", "0.60454917", "0.6043098", "0.6031024", "0.59727436", "0.5971462", "0.5966295", "0.59308416", "0.59297...
0.54398453
68
pads the string on the left side by adding the add string to the left as many times as necessary such that the output is "[add,]string"
def pad_str_left(string, length: int, add: str) -> str: out_string = string while len(out_string) < length: out_string = add + out_string return out_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padder(str_list, extra=0):\n length = max(len(str(s)) for s in str_list) + extra\n\n def pad(string):\n string = str(string)\n padding = max(0, length - len(string))\n return string + (padding * \" \")\n\n return pad", "def _pad_shorter(sequence: str) -> str:\n return seq...
[ "0.67100894", "0.6707976", "0.6621261", "0.6557144", "0.64166796", "0.6376291", "0.63675404", "0.63523495", "0.6338037", "0.6326726", "0.62968856", "0.62506044", "0.6153734", "0.6096829", "0.60582674", "0.6022688", "0.6016048", "0.6015064", "0.60114783", "0.5928853", "0.58942...
0.75408876
0
extract words from the text with the filters given above.
def extract_words_from_text_with_filters(text: str, char_filters: Union[str, List[str]]) -> List[str]: translate_dict = dict((c, " ") for c in char_filters) new_text = Str.get_string_from_translate_dict(text.lower(), translate_dict) return [word for word in new_text.split(" ") if len(word) > 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words(self, text):\n return re.findall(r'\\w+', text)", "def extract_words(self):\n str = self.text.lower()\n words = re.sub(r'[?|—|:|\"|,|\\.\\n|\\.|\\s|\\n|\\t|\\v|\\f|\\r]+', \"*\", str)\n self.word_list = words.split(\"*\")", "def process_text(self, text):\n\n flags =...
[ "0.71811485", "0.7146654", "0.7123673", "0.7050718", "0.7026393", "0.6935126", "0.68902266", "0.68653965", "0.68196225", "0.67737347", "0.6772545", "0.6758144", "0.66683286", "0.6657706", "0.66109127", "0.66083884", "0.65960807", "0.6518513", "0.6510654", "0.6507925", "0.6492...
0.7547689
0
returns the number of days in the given month
def get_days_in_month(month: str, year: str = "2018") -> int: month_int = int(month) if month_int in MONTHS_WITH_31_DAYS: return 31 if month_int in MONTHS_WITH_30_DAYS: return 30 if month_int == 2: if is_leap_year(year): return 29 return 28 raise ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month(year, month):\n num_days = monthrange(year, month)[1]\n return num_days", "def number_of_days_in_month(year=2019, month=1):\n return monthrange(year, month)[1]", "def days_in_month(month):\r\n if month==\"February\":\r\n return 28\r\n elif month==\"September\" or month==...
[ "0.88597596", "0.8626046", "0.8502665", "0.84765655", "0.83865124", "0.8349229", "0.8330723", "0.8287386", "0.81686455", "0.81686455", "0.81686455", "0.81276786", "0.8111175", "0.810017", "0.80028033", "0.8001812", "0.7972805", "0.79387033", "0.7853251", "0.7822184", "0.76781...
0.789016
18
Function to shoot bullets and to move them across the screen
def shootBullets(gunRects, bullets, mario): X, Y, VX, VY, DIR, STATE = 0, 1, 2, 3, 4, 5 GUNSTATE, GUNCOUNT, GUNTYPE = 4, 5, 6 BULLVX, BULLVY = 4, 5 for gun in gunRects: # Going through each gun if gun[GUNTYPE] == 1 and gun[GUNSTATE] == 1: # Checking if it's the gun or just cosmetic ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shoot_bullets(self):\n\t\tBullet(self.birb.rect.x + 75, self.birb.rect.y + 35, self)", "def shoot(self):\r\n bullet = Bullet(self.rect.centerx, self.rect.top)\r\n ammo.add(bullet)", "def shoot(self):\n if self.direction == 'left':\n self.__temp_bullet = Bullet(self.position,...
[ "0.84421605", "0.81402844", "0.7963889", "0.7887334", "0.76961386", "0.76789296", "0.7568323", "0.747291", "0.74393404", "0.7431883", "0.7305799", "0.7304005", "0.72682786", "0.7255767", "0.7225746", "0.72253543", "0.71468955", "0.7126322", "0.6979595", "0.688353", "0.688353"...
0.802486
2
Turns an array into a tuple.
def arr_to_tup(a): return tuple(a.reshape(1, -1)[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totuple(self, arr):\n\n\t\ttry:\n\t\t return tuple(self.totuple(i) for i in arr)\n\t\texcept TypeError:\n\t\t return arr", "def tuple_from_sequence(*args):\n return tuple(args)", "def from_val_array(val_array: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:\n values = np.zeros(val_array.shape)\n ...
[ "0.740222", "0.7205401", "0.7028237", "0.68840843", "0.6856533", "0.66772735", "0.6635185", "0.6635185", "0.6626691", "0.6501668", "0.6481281", "0.6428507", "0.6392776", "0.6385211", "0.6264097", "0.6256837", "0.6186616", "0.6184272", "0.61623657", "0.61484647", "0.61317927",...
0.8194976
0
Equalizes the provided data with the provided labels.
def equalize_data(class_labels, class_data): a1 = class_data[np.where(class_labels == 1)[0]] a2 = class_data[np.where(class_labels == 2)[0]] max_len = min(len(a1), len(a2)) a1 = a1[0:max_len] a2 = a2[0:max_len] arr = np.concatenate((a1, a2)) b1 = np.ones((max_len, 1)) * 0 b2 = np.ones((m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, data: np.array, labels: np.array):\n raise NotImplementedError", "def match_data(self, datasets):\n raise NotImplementedError", "def shuffle_data(data, labels):\n idx = np.arange(len(labels))\n np.random.shuffle(idx)\n return data[idx], labels[idx]", "def test_keep_labels...
[ "0.60097593", "0.5801564", "0.5799009", "0.57169294", "0.56686497", "0.56124026", "0.55428267", "0.5529858", "0.5524994", "0.5492298", "0.5490576", "0.5490576", "0.5490576", "0.54689044", "0.54631615", "0.5447162", "0.54461753", "0.54271036", "0.54227924", "0.541604", "0.5413...
0.73087734
0
Encode dict to JSON to a jwt
def jwt_encode(json_string, secret_string, headers_string): error_msg = None encoded_jwt = None json_object = ast.literal_eval(json_string) if secret_string: if headers_string: headers = ast.literal_eval(headers_string) try: """Encode with secret and heade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_payload(payload):\n jwt_secret = app.config['SECRET_KEY']\n # expiry = 60 * 60 * 24 * 100 # 100 days\n # payload['exp'] = datetime.datetime.utcnow() + datetime.timedelta(seconds=expiry)\n encoded_jwt = jwt.encode(payload, jwt_secret, algorithm='HS256')\n\n return (encoded_jwt).decode()", ...
[ "0.7072988", "0.694318", "0.689193", "0.6871679", "0.6630255", "0.6597355", "0.6589429", "0.6561992", "0.6384505", "0.63051885", "0.6285888", "0.6216534", "0.61586", "0.6154031", "0.61018187", "0.6074345", "0.604879", "0.6044337", "0.60385233", "0.60378087", "0.6029763", "0...
0.6842189
4
Returns the number density of galaxies in steradian
def gals_per_steradian(self): return self._gals_per_arcmin2 * steradian_to_arcmin2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density(x, kind=\"geopotential\"):\n\n rho = table(x, kind)[3]\n return rho", "def density(self):\r\n return self.count_ones() / float(self.xspan * self.yspan)", "def density(self):\n return self.get_density()", "def density(self):\n return (1e-3*self.molar_mass) * self.pressure / ...
[ "0.6724538", "0.66881645", "0.6492747", "0.640632", "0.63921267", "0.63454807", "0.6334077", "0.62923026", "0.62590057", "0.6251652", "0.6251652", "0.6251652", "0.62420094", "0.6223578", "0.6205007", "0.6187691", "0.61759925", "0.6175906", "0.6171758", "0.6164977", "0.6159223...
0.60808486
24
Differentiate CDF [From Wolfram] d/dx((d(x^(z) + y^(z) 1)^(1/z))/(dy)) = (1/z 1) z (x^(z 1)) y^(z 1) (x^(z) + y^(z) 1)^(1/z 2)
def pdf(self, X): assert X.shape[1] == 2 Z = X[:, 0]**(-self.theta) + X[:, 1]**(-self.theta) - 1. ret = torch.zeros_like(Z) ret[Z > 0] = (-1/self.theta-1.) * self.theta * -X[Z > 0, 0] ** (-self.theta-1) * X[Z > 0, 1] ** ( -self.theta-1) * (X[Z > 0, 0] ** (-self.theta) + X[Z ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g_d(self, z):\n a = self.g(z)\n return a * (1 - a)", "def c(\n dp: np.ndarray,\n ddp: np.ndarray,\n ) -> np.ndarray:\n\n return \\\n np.abs(ddp[0, :]*dp[1, :] - dp[0, :]*ddp[1, :]) / \\\n (dp[0, :]**2 + dp[1, :]**2)**1.5", "def dc(z,h=0.7,...
[ "0.6978494", "0.68921065", "0.68568516", "0.6839228", "0.6716509", "0.6667386", "0.6666124", "0.6645432", "0.66361296", "0.6630833", "0.6623895", "0.6620779", "0.65850985", "0.65729505", "0.65701413", "0.6551642", "0.6549312", "0.6545368", "0.6456673", "0.6442279", "0.6433359...
0.0
-1
Tests whether ``ApplicationCommandOptionMetadataNested.copy`` works as intended.
def test__ApplicationCommandOptionMetadataNested__copy(): options = [ ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string), ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer), ] option_metadata = ApplicationCommandOptionMetadataNested...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__ApplicationCommandOptionMetadataNested__copy_with__0():\n options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n option_metadata = ApplicationCommandO...
[ "0.82652885", "0.79703516", "0.780934", "0.75012493", "0.6400259", "0.5888461", "0.5698658", "0.5678107", "0.55697507", "0.548862", "0.5454601", "0.5418766", "0.541613", "0.53691906", "0.5353441", "0.5324269", "0.530283", "0.5283179", "0.52616227", "0.5254519", "0.5235558", ...
0.853201
0
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with_keyword_parameters`` works as intended.
def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__0(): options = [ ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string), ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer), ] option_metadata = Application...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__1():\n old_options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n new_options = ...
[ "0.84156406", "0.64966935", "0.64326566", "0.6406456", "0.6285689", "0.57689905", "0.5185993", "0.51273936", "0.5105928", "0.50947016", "0.49798912", "0.49645314", "0.49302363", "0.49265942", "0.49123338", "0.49068585", "0.49034593", "0.48958218", "0.48899037", "0.4866531", "...
0.8621432
0
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with_keyword_parameters`` works as intended.
def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__1(): old_options = [ ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string), ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer), ] new_options = [ A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__0():\n options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n option_metadata = ...
[ "0.8621432", "0.64966935", "0.64326566", "0.6406456", "0.6285689", "0.57689905", "0.5185993", "0.51273936", "0.5105928", "0.50947016", "0.49798912", "0.49645314", "0.49302363", "0.49265942", "0.49123338", "0.49068585", "0.49034593", "0.48958218", "0.48899037", "0.4866531", "0...
0.84156406
1
Convert a JSON representation into ListValue message.
def _ConvertListValueMessage(self, value, message, path): if not isinstance(value, list): raise ParseError('ListValue must be in [] which is {0} at {1}'.format( value, path)) message.ClearField('values') for index, item in enumerate(value): self._ConvertValueMessage(item, message.value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ListValueMessageToJsonObject(self, message):\n return [self._ValueMessageToJsonObject(value)\n for value in message.values]", "def to_python(self, value):\n if isinstance(value, (dict, list)):\n return value\n try:\n return json.loads(value)\n except ...
[ "0.6948909", "0.6379288", "0.63605946", "0.6299422", "0.60831195", "0.60798275", "0.6069047", "0.5996719", "0.59340507", "0.59220725", "0.5827064", "0.5789415", "0.5709988", "0.569617", "0.5695142", "0.5669852", "0.5651025", "0.56476074", "0.56385607", "0.5634746", "0.5622930...
0.66147846
1
Convert an floating point number.
def _ConvertFloat(value, field): if isinstance(value, float): if math.isnan(value): raise ParseError('Couldn\'t parse NaN, use quoted "NaN" instead') if math.isinf(value): if value > 0: raise ParseError('Couldn\'t parse Infinity or value too large, ' 'use quoted "I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertFloat(num):\n try:\n num = float(num)\n return num\n except (TypeError, ValueError, ArithmeticError):\n print(\"num cannot convert float\")", "def convert_to_float(number):\n try:\n return float(number)\n except:\n return None", "def convert_float(value)...
[ "0.73543054", "0.72737646", "0.69768596", "0.68857676", "0.6842184", "0.6825797", "0.6803527", "0.67960054", "0.67713785", "0.67083603", "0.6685174", "0.6672326", "0.6530435", "0.6522776", "0.6509801", "0.645332", "0.64362097", "0.63992417", "0.6383451", "0.6377443", "0.63508...
0.68836313
4
Returns the x,y coordinates. Convert_to may be set to 'deg' or 'rad' for convenience.
def coordsxy(self, convert_to=False): if convert_to == 'rad': return (self.x*3.14159/180., self.y*3.14159/180.) elif convert_to == 'deg': return (self.x/3.14159*180., self.y/3.14159*180.) else: return (self.x, self.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_coords(self, px, py):\n if px not in range(self.SIZE**2) or py not in range(self.SIZE**2):\n raise IndexError\n return (px // self.SIZE, py // self.SIZE,\n px % self.SIZE, py % self.SIZE)", "def cartesian_coordinates(self):\n # extract RA items\n ra_ho...
[ "0.64772433", "0.6372282", "0.6323273", "0.6280135", "0.622272", "0.6203903", "0.6132433", "0.61041605", "0.5989822", "0.59877276", "0.5943679", "0.59110785", "0.58790195", "0.58544147", "0.5844347", "0.58369446", "0.5829917", "0.5824859", "0.58105505", "0.58014715", "0.57902...
0.86445534
0
Return horizontal coordinate lists.
def get_coordinate_lists(self, crs=None): x, y = self.vertices.vectors()[:2] if crs is not None and (crs != self.crs): x, y = _reproject((x,y), self.crs, crs) return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pointListForHorizontal(x, y):\n\n\tpointList = []\n\n\tif x < 10:\n\t\txString = \"0%d\" % x\n\telse:\n\t\txString = \"%d\" % x\n\n\tif x < 11:\n\t\txMString = \"0%d\" % (x - 1)\n\telse:\n\t\txMString = \"%d\" % (x - 1)\n\n\tif x < 9:\n\t\txPString = \"0%d\" % (x + 1)\n\telse:\n\t\txPString = \"%d\" % (x + 1)\...
[ "0.69605684", "0.65772927", "0.6456706", "0.6360796", "0.63079804", "0.629713", "0.62905097", "0.6247557", "0.6173838", "0.61535394", "0.6132974", "0.61020243", "0.60734004", "0.6065855", "0.6031467", "0.60191536", "0.60091174", "0.6005235", "0.5970228", "0.5965719", "0.59499...
0.57894325
32
Return vertices as an array.
def get_vertices(self, crs=None): if (crs is None) or (crs is self.crs): return np.array(self.vertices) else: vertices = [_reproject(v[:2], self.crs, crs) for v in self.vertices] return np.array(vertices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(self):\n try:\n return self._vertices\n except:\n self._vertices = [list(x) for x in self.vertex_generator()]\n return self._vertices", "def vertices(self) -> list[Point]:\n a = Point(self.array[..., 0, :], copy=False)\n b = Point(self.arr...
[ "0.7801905", "0.7706065", "0.7648946", "0.7648946", "0.7616571", "0.75711554", "0.746684", "0.7422286", "0.73918563", "0.7391455", "0.73860365", "0.73344654", "0.7330475", "0.7306448", "0.72132766", "0.7119052", "0.70518327", "0.7031308", "0.70257485", "0.7008367", "0.6925559...
0.71639323
15
Return a subset defined by indices.
def _subset(self, idxs): vertices = [self.vertices[i] for i in idxs] if hasattr(self, "data"): data = Table(data=[self.data._data[i] for i in idxs], fields=self.data.fields) return type(self)(vertices, properties=self.properties, data=data, crs=self.crs) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subset_from_indices(self, indices):\n return self.extract_inds(indices)", "def subset(dataset, article_indices):\n indices = []\n for a_id in article_indices:\n indices += dataset.get_article_indices(a_id)\n return Subset(dataset, indices)", "def get_slice(x, indices):\n return x[...
[ "0.88829166", "0.77078664", "0.74076796", "0.6919496", "0.6835811", "0.6803598", "0.666489", "0.64892817", "0.6437027", "0.6402139", "0.63902104", "0.6389309", "0.6382078", "0.6334556", "0.63263947", "0.6319853", "0.62865925", "0.62761927", "0.62483144", "0.6241995", "0.62119...
0.6556756
7
Returns an generator of adjacent line segments as coordinate tuples.
def segment_tuples(self): return ((self.vertices[i], self.vertices[i+1]) for i in range(len(self.vertices)-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_tuples(self):\n return ((self.vertices[i-1], self.vertices[i])\n for i in range(len(self.vertices)))", "def lines(self):\n for pair in pairs(self.points):\n yield Line(pair, shape=self)", "def iter_coords():\n yield (0, 0)\n incr = 0\n x = 1\n y =...
[ "0.69940746", "0.6738684", "0.6601939", "0.6345121", "0.6317297", "0.623271", "0.6204825", "0.61664194", "0.6116063", "0.60578525", "0.60418737", "0.59932834", "0.59818065", "0.5974203", "0.5936784", "0.5908802", "0.5903839", "0.58623254", "0.58488476", "0.58351547", "0.58173...
0.7113118
0