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
Return a bbox for each pair in coord_pairs
def make_bounding_box_vectors(coord_pairs): # indexing multi-d arrays by multi-d arrays is a bit tricky # need to be explicit # this was helpful: http://bit.ly/1BcSm5y coord_pair_grid = np.mgrid[[slice(x) for x in coord_pairs.shape]] i0 = coord_pair_grid[0] # order by the 2nd axis of the input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coords_to_bbox(coords):\n min_y, min_x, max_y, max_x = coords[0].min(), coords[1].min(), coords[0].max(), coords[1].max()\n return min_y, min_x, max_y - min_y, max_x - min_x", "def get_bb_from_points(coordinates):\n x_min = x_max = coordinates[0][0]\n y_min = y_max = coordinates[0][1]\n for x,...
[ "0.6610228", "0.65038174", "0.6494954", "0.6472593", "0.64644855", "0.64639866", "0.6434646", "0.6419604", "0.6413777", "0.6413693", "0.6372654", "0.6367275", "0.63102126", "0.63082886", "0.6268652", "0.6245873", "0.6241043", "0.62234145", "0.62005746", "0.6196367", "0.618513...
0.75545746
0
Return a bbox for entire coord_array
def make_bounding_box_array(coords): coord_array = np.array(coords) x_sort = np.argsort(coord_array[:, 0]) y_sort = np.argsort(coord_array[:, 1]) return coord_array[x_sort[0]][0], coord_array[y_sort[0]][1],\ coord_array[x_sort[-1]][0], coord_array[y_sort[-1]][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox(self):\n return np.array(\n [[self.position[0], self.position[1]], [self.position[0], self.position[1]]]\n )", "def bbox(self, image_coords=False):\n matrix = self.contours_to_matrix()\n bbox = np.c_[matrix.min(axis=0), matrix.max(axis=0)]\n return bbox if...
[ "0.7544773", "0.74187857", "0.73021215", "0.7196579", "0.7107193", "0.7099935", "0.70358676", "0.7033851", "0.7032771", "0.6926633", "0.6908776", "0.6861189", "0.68043333", "0.6798147", "0.6782157", "0.6770618", "0.6768892", "0.6714266", "0.67122656", "0.67038876", "0.6683610...
0.7124447
4
Return a bbox for the pair of coordinates
def make_bounding_box(coord1, coord2): bbox = make_bounding_box_vectors(np.array([[coord1, coord2]]))[0] return bbox[0][0], bbox[0][1], bbox[1][0], bbox[1][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bbox(x,y, buffer=0.):\n return dict(left=np.min(x), \n right=np.max(x), \n bottom=np.min(y), \n top=np.max(y))", "def bbox(self):\n lower = (self.x.min(), self.y.min())\n upper = (self.x.max(), self.y.max())\n return (lower, upper)", ...
[ "0.7737495", "0.76840264", "0.76470387", "0.748897", "0.74869347", "0.7464515", "0.74369895", "0.73815924", "0.73714703", "0.73126346", "0.729863", "0.7287079", "0.72860545", "0.7278009", "0.7229013", "0.7225827", "0.72152823", "0.72067904", "0.7198169", "0.7172595", "0.71585...
0.71476305
21
Writes an input DataFrame to a csv in its corresponding season's folder.
def export_csv(df, season_id, league_name, league_id): file_name = '{}_{}_{}.csv'.format(league_name,league_id,season_id) current_dir = os.path.dirname(__file__) path_name = os.path.join(current_dir, '../{}'.format(season_id)) if not os.path.exists(path_name): os.mkdir(path_name) exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(path: str, df_players: pd.DataFrame) -> None:\n df_players.to_csv(path, index=False, header=True)", "def to_csv(df: pd.DataFrame, name: str, time_series=False) -> None:\n abs_dir = os.path.dirname(__file__)\n if time_series:\n rel_dir = os.path.join(abs_dir, 'eikon_time_series_files...
[ "0.7013442", "0.70019364", "0.67136806", "0.66494226", "0.6569703", "0.6539161", "0.6489925", "0.6479926", "0.6432788", "0.6431767", "0.6412841", "0.63548", "0.63539547", "0.62832755", "0.6268798", "0.6267171", "0.62479794", "0.62423056", "0.62271893", "0.62205863", "0.621278...
0.7322975
0
Parameter set with L1 loss.
def rl_modelrl_l1_base(): hparams = rl_modelrl_base() hparams.generative_model_params = "basic_conv_l1" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l1(parameter, bias=None, reg=0.01, lr=0.1):\n Norm = reg*lr\n\n # Update W\n if parameter.is_cuda:\n Norms_w = Norm*torch.ones(parameter.size(), device=torch.device(\"cuda\"))\n else:\n Norms_w = Norm*torch.ones(parameter.size(), device=torch.device(\"cpu\"))\n pos = torch.min(Norm...
[ "0.6592166", "0.65307474", "0.6216705", "0.6205192", "0.61346364", "0.60929585", "0.60875463", "0.60816103", "0.60770446", "0.5938553", "0.5927623", "0.59099245", "0.5898319", "0.58610475", "0.5847619", "0.57999974", "0.57978815", "0.57609695", "0.57488996", "0.57402736", "0....
0.64424634
2
Medium parameter set with L1 loss.
def rl_modelrl_l1_medium(): hparams = rl_modelrl_medium() hparams.generative_model_params = "basic_conv_l1" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l1_loss(params):\n \"\"\" It is a vec for each branch\"\"\"\n loss_branches_vec = []\n # TODO This is hardcoded but all our cases rigth now uses four branches\n for i in range(len(params['branches']) -1):\n loss_branches_vec.append(torch.abs((params['branches'][i] - params['targets'])\n ...
[ "0.6220744", "0.606182", "0.5944655", "0.5907334", "0.57641155", "0.5750901", "0.5740755", "0.5725194", "0.56244254", "0.5601802", "0.5560083", "0.5554349", "0.5548094", "0.5548094", "0.5548094", "0.553078", "0.5523825", "0.55177987", "0.54996085", "0.54731286", "0.54686147",...
0.6974422
0
Short parameter set with L1 loss.
def rl_modelrl_l1_short(): hparams = rl_modelrl_short() hparams.generative_model_params = "basic_conv_l1" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rl_modelrl_l1_medium():\n hparams = rl_modelrl_medium()\n hparams.generative_model_params = \"basic_conv_l1\"\n return hparams", "def rl_modelrl_l1_tiny():\n hparams = rl_modelrl_tiny()\n hparams.generative_model_params = \"basic_conv_l1\"\n return hparams", "def l1_loss(params):\n \"\"\" It is a ...
[ "0.6447721", "0.6344167", "0.63017", "0.6035839", "0.59760284", "0.5842891", "0.58206224", "0.574846", "0.5720597", "0.5586515", "0.55821", "0.5571078", "0.55692905", "0.5470006", "0.5440213", "0.5435563", "0.54187965", "0.5398131", "0.53605235", "0.53557837", "0.5335223", ...
0.6937336
0
Medium parameter set with L2 loss.
def rl_modelrl_l2_medium(): hparams = rl_modelrl_medium() hparams.generative_model_params = "basic_conv_l2" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_l2_reg(self) -> torch.Tensor:\n loss = 0\n for param in self.model.parameters():\n loss += (param ** 2).sum()\n return loss", "def l2_loss(params):\n \"\"\" It is a vec for each branch\"\"\"\n loss_branches_vec = []\n # TODO This is hardcoded but all our cases ri...
[ "0.615139", "0.6115017", "0.6014755", "0.59842974", "0.59142256", "0.58418244", "0.5784992", "0.5760945", "0.5628914", "0.5608257", "0.5603828", "0.5553981", "0.54874724", "0.5483968", "0.54764545", "0.5458013", "0.5454736", "0.54390365", "0.54187405", "0.54048467", "0.539640...
0.6889128
0
Short parameter set with L2 loss.
def rl_modelrl_l2_short(): hparams = rl_modelrl_short() hparams.generative_model_params = "basic_conv_l2" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rl_modelrl_l2_medium():\n hparams = rl_modelrl_medium()\n hparams.generative_model_params = \"basic_conv_l2\"\n return hparams", "def rl_modelrl_l2_tiny():\n hparams = rl_modelrl_tiny()\n hparams.generative_model_params = \"basic_conv_l2\"\n return hparams", "def l2_loss(params):\n \"\"\" It is a ...
[ "0.6256355", "0.6216856", "0.60562897", "0.6033302", "0.5962272", "0.5899728", "0.5630774", "0.5549279", "0.55188566", "0.5511635", "0.55064476", "0.5470425", "0.53865075", "0.5372654", "0.5336246", "0.53260654", "0.5309821", "0.5305809", "0.52992755", "0.52923423", "0.529234...
0.6941897
0
Tiny parameter set with L2 loss.
def rl_modelrl_l2_tiny(): hparams = rl_modelrl_tiny() hparams.generative_model_params = "basic_conv_l2" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2(parameter, bias=None, reg=0.01, lr=0.1):\n \n if bias is not None:\n w_and_b = torch.cat((parameter, bias.unfold(0,1,1)),1)\n else:\n w_and_b = parameter\n L2 = reg # lambda: regularization strength\n Norm = (lr*L2/w_and_b.norm(2))\n if Norm.is_cuda:\n ones_w = torch.o...
[ "0.6441974", "0.62079555", "0.61448", "0.6076243", "0.5992877", "0.58702767", "0.5842867", "0.58357435", "0.58309567", "0.5675169", "0.5579831", "0.55616224", "0.55230975", "0.55203897", "0.55148447", "0.5476703", "0.5464855", "0.54532033", "0.54516715", "0.5428386", "0.54282...
0.65489787
0
Parameter set for autoencoders and L1 loss.
def rl_modelrl_ae_l1_base(): hparams = rl_modelrl_ae_base() hparams.generative_model_params = "basic_conv_l1" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n encoder: EncoderMnist,\n decoder: DecoderMnist,\n latent_dim: int,\n input_pert: callable,\n name: str = \"model\",\n loss_f: callable = nn.MSELoss(),\n ):\n super(AutoEncoderMnist, self).__init__()\n self.latent_dim = latent...
[ "0.65183574", "0.6376951", "0.63280976", "0.62669307", "0.6231751", "0.613176", "0.6077191", "0.6059705", "0.60578424", "0.6012543", "0.60020083", "0.59934044", "0.59575397", "0.5936907", "0.5772246", "0.57653826", "0.5738858", "0.57274723", "0.571422", "0.57104045", "0.56602...
0.54001135
62
Parameter set for autoencoders and L2 loss.
def rl_modelrl_ae_l2_base(): hparams = rl_modelrl_ae_base() hparams.generative_model_params = "basic_conv_l2" return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n var_defaults = {\n \"bias_init\" : 'zeros',\n \"weight_init\" : [0.0, 0.1],\n \"seed\" : None,\n \"num_hid_nodes\" : 32,\n \"activations\": 'sigmoid',\n \"lr\" : 0.1,\n \"decay\": 0,\n \"m...
[ "0.64173555", "0.6385631", "0.63145345", "0.6238848", "0.6230679", "0.6085871", "0.60597974", "0.6040841", "0.60389495", "0.60315436", "0.5986554", "0.58793706", "0.5829757", "0.58131576", "0.5800696", "0.57871765", "0.57610285", "0.5742513", "0.5731279", "0.57301426", "0.571...
0.0
-1
Medium parameter set for autoencoders.
def rl_modelrl_ae_medium(): hparams = rl_modelrl_ae_base() hparams.autoencoder_train_steps //= 2 hparams.true_env_generator_num_steps //= 2 hparams.model_train_steps //= 2 hparams.ppo_epochs_num //= 2 return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_encoder(self):\n self.encoder = nn.Sequential(View((-1, 64 * 64 * 3)),\n nn.Linear(64 * 64 * 3, 5120, bias=False), nn.SELU(),\n nn.BatchNorm1d(5120),\n nn.Linear(5120, 2560, bias=False), nn.SELU(),\n ...
[ "0.5935627", "0.57758933", "0.5581277", "0.5520619", "0.5484744", "0.5398908", "0.5386341", "0.5360525", "0.5350149", "0.5349649", "0.53464866", "0.53287226", "0.53287226", "0.5283147", "0.5242315", "0.51882625", "0.5161963", "0.5085536", "0.50812197", "0.5068589", "0.5059156...
0.5430145
5
Small parameter set for autoencoders.
def rl_modelrl_ae_short(): hparams = rl_modelrl_ae_base() hparams.autoencoder_train_steps //= 10 hparams.true_env_generator_num_steps //= 5 hparams.model_train_steps //= 10 hparams.ppo_epochs_num //= 10 return hparams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_encoder(self):\n self.encoder = nn.Sequential(View((-1, 64 * 64 * 3)),\n nn.Linear(64 * 64 * 3, 5120, bias=False), nn.SELU(),\n nn.BatchNorm1d(5120),\n nn.Linear(5120, 2560, bias=False), nn.SELU(),\n ...
[ "0.66084415", "0.6252414", "0.6083076", "0.6069567", "0.60330236", "0.5904987", "0.58881897", "0.5883007", "0.5866254", "0.5838186", "0.5820794", "0.5820794", "0.5820794", "0.58190215", "0.57703143", "0.574631", "0.57442683", "0.5686223", "0.5665697", "0.56652594", "0.5619439...
0.0
-1
Evolve a population of learning rates.
def evolve(pop_perf, breed_method): # Sort on the scores. pop = [x[1] for x in sorted(pop_perf, key=lambda x: x[0], reverse=True)] # keep the best 25% retain_length = 2 #int(np.ceil(len(pop)*.25)) # The parents are every network we want to keep. parents = pop[:retain_length] # Randomly mu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update(self, learning_rate):\n for layer in self.layers:\n layer.weights.set_value((layer.weights - learning_rate * layer.dW).eval())\n layer.biases.set_value((layer.biases - learning_rate * layer.db).eval())", "def evolve(self,noOfIterations=50):\n\t\tself.population = Populat...
[ "0.68087304", "0.6712478", "0.66506535", "0.6530455", "0.64474916", "0.6365246", "0.6151515", "0.59829056", "0.59495866", "0.59396493", "0.59396493", "0.5880695", "0.5840364", "0.57654476", "0.5756", "0.57530963", "0.5747763", "0.57459843", "0.5737338", "0.56801796", "0.56569...
0.5510671
51
Set input default value. Use related sdc_resource "set_input_default_value" method to set default value in SDC. We use that because different types of SDC resources has different urls to call SDC API.
def default_value(self, value: Any) -> None: self.sdc_resource.set_input_default_value(self, value) self._default_value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, default):\n\n self._set_field(\"value\", default)", "def default_value(self, default_value):\n\n self._default_value = default_value", "def default_value(self, default_value):\n\n self._default_value = default_value", "def default_value(self, default_value):\n\n ...
[ "0.6911997", "0.6791586", "0.6791586", "0.6791586", "0.67364067", "0.6662547", "0.6367624", "0.6289316", "0.627207", "0.62156427", "0.6179657", "0.6161988", "0.6132972", "0.61063355", "0.6100952", "0.6035093", "0.59822273", "0.59299743", "0.59285015", "0.59235674", "0.5849711...
0.81390387
0
Check if two Property object are equal.
def __eq__(self, obj: "Property") -> bool: return self.name == obj.name and self.property_type == obj.property_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self.properties == other.properties", "def __eq__(self, other):\n if not isinstance(other, PropertyContent):\n return False\n\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n if type(self) != type(other):\n ...
[ "0.80210567", "0.7444751", "0.73186475", "0.72179335", "0.72174853", "0.72049", "0.703429", "0.702629", "0.6983773", "0.69357216", "0.6732461", "0.66784036", "0.66681457", "0.6662124", "0.66601574", "0.66543645", "0.66181695", "0.6587431", "0.6571966", "0.65086603", "0.649873...
0.76387453
1
Property input. Returns property Input object. Returns None if property has no associated input.
def input(self) -> Input: if not self.sdc_resource: raise ParameterError("Property has no associated SdcResource") if not self.get_input_values: return None try: return next(filter(lambda x: x.unique_id == self.get_input_values[0].get("inputId"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input(prop_name: str):\n try:\n return Output.parse_name(conf[prop_name])\n except IndexError:\n return None", "def input(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"input\")", "def input(self) -> pulumi.Input[str]:\n ...
[ "0.68422896", "0.6674935", "0.6571163", "0.65463257", "0.65463257", "0.65085506", "0.65085506", "0.65085506", "0.65085506", "0.65085506", "0.65085506", "0.65085506", "0.64859897", "0.6435197", "0.6399915", "0.6399915", "0.6399915", "0.6371689", "0.61704004", "0.61652356", "0....
0.778322
0
Value property. Get property value.
def value(self) -> Any: return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_value(self):\n return self.__value", "def _get_value(self):\n \n return self._value", "def get_value(self):\n return self.value", "def get_value(self):\n return self.value", "def get_value(self):\n return self.value", "def GetValue(self):\n ret...
[ "0.8343385", "0.83010197", "0.82832867", "0.82832867", "0.82832867", "0.82762486", "0.82762486", "0.8276209", "0.8276209", "0.827611", "0.8249348", "0.8249348", "0.8249348", "0.815241", "0.81364805", "0.8109193", "0.80835295", "0.80813855", "0.80694926", "0.8057335", "0.80567...
0.77061665
67
Validate card link marker.
def card_linkmarker(linkmarker): if linkmarker not in constants.LINK_MARKERS: raise exceptions.LinkMarkerInvalid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_item_link(self, item):\n if len(item.link) > 255:\n raise ValueError(\"item.link length too long.\")\n\n return True", "def isLinkIdFormatValid(link_id):\n if linkable.LINK_ID_REGEX.match(link_id):\n return True\n return False", "def assert_has_valid_link(self, respo...
[ "0.6362555", "0.58152694", "0.5652707", "0.5639388", "0.56233376", "0.55828625", "0.5578746", "0.5521517", "0.5520554", "0.55111396", "0.550159", "0.5437233", "0.5329729", "0.53230035", "0.53023005", "0.52951074", "0.52600485", "0.5241977", "0.51969993", "0.5182885", "0.51711...
0.77729654
0
Get the selected schedule for a given home ID.
def _get_selected_schedule(self, home_id: str) -> Dict: for value in self.schedules.get(home_id, {}).values(): if "selected" in value.keys(): return value return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_home_schedule(self, home_id: str, schedule_id: str) -> Any:\n schedules = {\n self.schedules[home_id][s][\"name\"]: self.schedules[home_id][s][\"id\"]\n for s in self.schedules.get(home_id, {})\n }\n if schedule_id not in list(schedules.values()):\n ...
[ "0.65571666", "0.6430867", "0.625117", "0.6190169", "0.60796654", "0.595152", "0.58226764", "0.5696328", "0.566625", "0.56535727", "0.5652046", "0.5642955", "0.56323653", "0.56031936", "0.55301833", "0.5492162", "0.54750437", "0.5472974", "0.5412181", "0.53610736", "0.535886"...
0.8095054
0
Return the thermostat type of the room.
def get_thermostat_type(self, home_id: str, room_id: str) -> Optional[str]: for module in self.modules.get(home_id, {}).values(): if module.get("room_id") == room_id: return module.get("type") return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room_type(self):\n return self._room_type", "def room_type(self):\n return self._room_type", "def get_room_type(self):\n\t\troom_type = ''\n\t\tnum = randint(1,8)\n\n\t\tif num >= 1 and num <= 4:\n\t\t\troom_type = 'Empty'\n\t\telif num >= 5 and num <= 7:\n\t\t\troom_type = 'Monster'\n\t\teli...
[ "0.7385344", "0.7385344", "0.7004716", "0.64417994", "0.629211", "0.6240767", "0.6197271", "0.605394", "0.5987533", "0.5955203", "0.59331584", "0.591854", "0.5916305", "0.59146655", "0.58335257", "0.58114713", "0.5773709", "0.57586175", "0.57544017", "0.5752248", "0.57455444"...
0.75558335
0
Sort result objects by specified key
def sort_object_info(results, sortkey): if sortkey == "unsorted": return results elif sortkey == "name": return sorted(results, key=lambda r: r["name"]) elif sortkey == "ext": def _get_ext(n): # Get extension for sorting if n["type"] == "dataobject": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_by(self, results, key_, direction=\"ASC\"):\n\n return sorted(results, key=lambda x: x.get(key_), reverse=direction==\"DESC\")", "def sort(self, key: Callable):\n self.data.sort(key=key)", "def sort(self, key: Callable):\n self.data.sort(key=key)", "def sort_key(self):\n ...
[ "0.74323565", "0.7046986", "0.7046986", "0.70457155", "0.6991545", "0.69413483", "0.6776455", "0.67029136", "0.668059", "0.6606657", "0.6606657", "0.6552911", "0.6487611", "0.6394182", "0.63697267", "0.63419884", "0.63322693", "0.6319071", "0.6285761", "0.6254426", "0.6238997...
0.74473894
0
Indicates if CMake project is initialized.
def initialized(self): # verbose = CMAKE_BUILD_VERBOSE # if verbose: # self.diagnose_initialized_problems() return self.project_build_dir.exists() and self.has_stored_config_file()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialized(self) -> bool:\n return self._env.repo_is_initialized", "def workflow_initialized(self):\n return self._gdb_interface.initialized()", "def initialized(self):\n return self.workspace == find_enclosing_workspace(self.workspace)", "def is_initialized(self) -> bool:\n ...
[ "0.7241761", "0.62147397", "0.6210897", "0.6179092", "0.6147412", "0.60963196", "0.6045244", "0.5984644", "0.59340066", "0.5912184", "0.5907521", "0.5851068", "0.5826759", "0.57761383", "0.57751817", "0.57620674", "0.5745023", "0.5742885", "0.5716442", "0.5708749", "0.5700891...
0.78451335
0
Return true if email is not verifiable
def unverifiable(self, resp): return any(a in str(resp).lower() for a in UNVERIFIABLE_KEYWORDS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_validated_email(self):\n return self.user.email_user is not None", "def verify_mail(self):\n raise NotImplementedError", "def is_no_email(self):\n return self._tag == 'no_email'", "def is_email_valid(email):\n\n result = requests.get(\n f'https://api.hunter.io/v2/email-...
[ "0.74340487", "0.7377801", "0.73646355", "0.72020143", "0.70597106", "0.70597106", "0.7032266", "0.7008237", "0.6929107", "0.6869003", "0.68538034", "0.68031263", "0.6800004", "0.6800004", "0.67905235", "0.67905235", "0.6779732", "0.67405057", "0.6723582", "0.6653125", "0.663...
0.0
-1
Return true if email is not found
def nonexistent(self, resp): return any(a in str(resp).lower() for a in NOT_FOUND_KEYWORDS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_exists(self, email):\n user = [user for user in ALL_USERS if user['email'] == email]\n if user:\n return True\n return False", "def isEmailUsed(self, email):\n\n\t\ttestq = {\"email\": email};\n\t\ttest_result = self.db.request(\"getOne\", testq);\n\n\t\tif test_result:\...
[ "0.76888317", "0.76025695", "0.76004004", "0.71833014", "0.7144275", "0.71219975", "0.7099956", "0.70808166", "0.7062616", "0.7062616", "0.7027606", "0.7020983", "0.69966996", "0.69933206", "0.69854224", "0.6966478", "0.69333833", "0.69268703", "0.69199145", "0.69104767", "0....
0.0
-1
Verifies wether an email address exists
def verify( self, email, from_host='example.com', from_email='verify@example.com' ): if DEBUG: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if not EMAIL_RE.search(email): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_email(address):\n try:\n validate_email(address)\n return True\n except:\n return False", "def is_valid_email_address (email):\n return valid_email.search(email)", "def email_exists(self, email):\n user = [user for user in ALL_USERS if user['email'] == email]\n ...
[ "0.7717865", "0.76948863", "0.75796795", "0.75756574", "0.7571317", "0.7472426", "0.7403671", "0.7391811", "0.73566455", "0.7332858", "0.7315687", "0.7287168", "0.7278164", "0.7273907", "0.7261362", "0.7256341", "0.7230504", "0.7225937", "0.72225535", "0.7220897", "0.72143316...
0.0
-1
Return the unit vector of the points v = (a,b)
def unit_vector(v): h = ((v[0]**2)+(v[1]**2))**0.5 if h == 0: h = 0.000000000000001 ua = v[0] / h ub = v[1] / h return (ua, ub)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unit_vector(pt0, pt1):\n dis_0_to_1 = sqrt((pt0[0] - pt1[0])**2 + (pt0[1] - pt1[1])**2)\n return (pt1[0] - pt0[0]) / dis_0_to_1, \\\n (pt1[1] - pt0[1]) / dis_0_to_1", "def unit_vector(a, b):\n tmp = _np.zeros(b)\n tmp[a] = 1\n return tmp", "def vector_between_points(a, b):\n ve...
[ "0.75991285", "0.7525897", "0.73386735", "0.7177321", "0.70588034", "0.7048083", "0.7025266", "0.6985125", "0.6978819", "0.6960452", "0.6930264", "0.6930264", "0.6930264", "0.68971974", "0.6874071", "0.6874071", "0.6874071", "0.6874071", "0.6874071", "0.6874071", "0.6874071",...
0.79922855
0
Compute Histogram of Gradient (HOG) feature for an image
def hog_feature(im): # convert rgb to grayscale if needed if im.ndim == 3: image = rgb2gray(im) else: image = np.at_least_2d(im) sx, sy = image.shape # image size orientations = 9 # number of gradient bins cx, cy = (8, 8) # pixels per cell gx = np.zeros(image.shape) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hog_features(image):\n\n #convert rgb to grayscale if needed\n if image.ndim == 3:\n img = rgb2gray(image)\n else:\n img = np.atleast_2d(image)\n\n # image size\n sx, sy = img.shape\n orientations = 9 # number of gradient bins\n cx, cy = (8, 8) # pixels per call\n\n gx =...
[ "0.7878411", "0.7736435", "0.7178793", "0.67749435", "0.6713997", "0.665653", "0.66466415", "0.6617767", "0.66121894", "0.6533737", "0.6507808", "0.64820576", "0.63813424", "0.6369018", "0.6315983", "0.6300551", "0.62502855", "0.622106", "0.6218567", "0.62094796", "0.6191923"...
0.8056416
0
Compute color histogram for an image using hue.
def color_histogram_hsv(im, nbin=10, xmin=0, xmax=255, normalized=True): ndim = im.ndim bins = np.linspace(xmin, xmax, nbin + 1) hsv = matplotlib.colors.rgb_to_hsv(im / xmax) * xmax imhist, bin_edges = np.histogram(hsv[:, :, 0], bins=bins, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pil_hue_histogram(h):\n np_hist = np_hsv_hue_histogram(h)\n pil_hist = util.np_to_pil(np_hist)\n return pil_hist", "def get_hsv_hist(img):\n hsv = cv2.cvtColor(img.data, cv2.COLOR_BGR2HSV)\n\n hue_counts = {}\n hue_pixels = {}\n\n for rnum, row in enumerate(hsv):\n for cnum, pix in enum...
[ "0.7484491", "0.7467012", "0.72488993", "0.6948107", "0.69394785", "0.6935856", "0.69288856", "0.6773593", "0.67533165", "0.6740039", "0.66954315", "0.6634996", "0.6627116", "0.66192234", "0.6615944", "0.6600888", "0.65008163", "0.6500624", "0.6464065", "0.6446344", "0.643789...
0.70724773
3
View decorator that redirects anonymous users to the login page.
def login_required(view): @functools.wraps(view) def wrapped_view(**kwargs): if g.user is None: return redirect(url_for("auth.login")) return view(**kwargs) return wrapped_view
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_required(view):\n\n @functools.wraps(view)\n def wrapped_view(**kwargs):\n if g.user is None:\n return redirect(url_for(\"login\"))\n\n return view(**kwargs)\n\n return wrapped_view", "def login_required(view):\n\n @functools.wraps(view)\n def wrapped_view(**kwar...
[ "0.7701439", "0.76673865", "0.758813", "0.742035", "0.7351566", "0.7307617", "0.723159", "0.71720594", "0.71177274", "0.70479155", "0.70386076", "0.7037009", "0.70323974", "0.7022595", "0.70209605", "0.70107865", "0.7002442", "0.6985365", "0.69602716", "0.6958533", "0.6953379...
0.76936996
1
If a user id is stored in the session, load the user object from the database into ``g.user``.
def load_logged_in_user(): user_id = session.get("user_id") if user_id is None: g.user = None else: g.user = ( get_db().execute("SELECT * FROM user WHERE id = ?", (user_id,)).fetchone() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_logged_in_user():\n\n user_id = session.get('user_id')\n\n if user_id is not None:\n g.user = get_db().execute(\n 'SELECT * FROM user WHERE id = ?', [user_id]\n ).fetchone()\n else:\n g.user = None", "def load_user():\n if session.get(\"user_id\"):\n us...
[ "0.8650688", "0.86221147", "0.841415", "0.8294893", "0.82075083", "0.819322", "0.7895162", "0.7872945", "0.78312486", "0.78244", "0.7767039", "0.7766959", "0.7766959", "0.7766959", "0.7766959", "0.7761139", "0.7761139", "0.7761139", "0.7761139", "0.7761139", "0.7761139", "0...
0.86928934
0
Create and configure an instance of the Flask application.
def create_app(test_config=None): app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( # a default secret that should be overridden by instance config SECRET_KEY="dev", # store the database in the instance folder DATABASE=os.path.join(app.instance_path, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app...
[ "0.8524236", "0.8516853", "0.8504485", "0.83319825", "0.82396483", "0.82314265", "0.8200104", "0.81300336", "0.80288595", "0.8026753", "0.8019436", "0.79989535", "0.7984679", "0.7978355", "0.7973289", "0.7970172", "0.7959833", "0.79556865", "0.7952428", "0.7937137", "0.793208...
0.7946338
19
An example of a nontiminginvariant comparison function. Python's builtin string comparison function isn't quite this egregious, but it's close.
def compare_token(got, expected): if len(got) != len(expected): return False for i in range(len(got)): if not compare_character(got[i], expected[i]): return False # just to be extra sure, also compare the hashes (yes, we're cheating # here to make it easier to guess the last ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, p_str, p_str_1): # real signature unknown; restored from __doc__\n return 0", "def EXACT(string1, string2):\n return string1 == string2", "def test_strings_are_equal(self):\n string1 = 'this is the first string'\n string2 = 'this is the first string' # ==, !is\n s...
[ "0.7023322", "0.6853558", "0.67996204", "0.6607804", "0.659461", "0.6549474", "0.6515956", "0.64944565", "0.6494422", "0.64554703", "0.64533937", "0.64494646", "0.63995755", "0.6394303", "0.6325021", "0.63129634", "0.63089645", "0.62905204", "0.6225034", "0.6218854", "0.61996...
0.0
-1
Test retrieving recipes for user
def test_services_limited_to_user(self): user2 = get_user_model().objects.create_user( 'other@gmail.com', 'password123' ) sample_services(user=user2) sample_services(user=self.user) res = self.client.get(SERVICES_URL) services = Service.objects...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recipe_limited_to_user(self):\n user2 = get_user_model().objects.create_user(\n 'test@gmail.com',\n 'password3456',\n )\n sample_recipe(self.user)\n sample_recipe(user2)\n\n res = self.client.get(RECIPE_URL)\n\n recipes = Recipe.objects.filte...
[ "0.79962987", "0.78909904", "0.7819746", "0.7686372", "0.76844823", "0.766791", "0.7650961", "0.7636704", "0.7540283", "0.7539435", "0.749229", "0.74120104", "0.7214055", "0.71653247", "0.7129724", "0.7051907", "0.69681185", "0.68797475", "0.6866076", "0.67936826", "0.672394"...
0.0
-1
Test updating a service with patch
def test_partial_update_services(self): services = sample_services(user=self.user) services.tags.add(sample_tag(user=self.user)) new_tag = sample_tag(user=self.user, name='Transformer') payload = {'title' : 'sample service job' , 'tags' : [new_tag.id]} url = detail_url(services...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_modify_virtual_service(self):\n pass", "def test_update_vpnservice(self):\r\n resource = 'vpnservice'\r\n cmd = vpnservice.UpdateVPNService(test_cli20.MyApp(sys.stdout), None)\r\n self._test_update_resource(resource, cmd, 'myid',\r\n ['myid',...
[ "0.75976276", "0.7566918", "0.7565098", "0.75218433", "0.75218433", "0.75218433", "0.75146013", "0.74028045", "0.7393683", "0.7351839", "0.72984713", "0.7247264", "0.72357446", "0.71752995", "0.7132642", "0.70584434", "0.70153874", "0.69948953", "0.69911367", "0.69756424", "0...
0.76883554
0
Test updating the services
def test_full_update_services(self): services = sample_services(user=self.user) services.tags.add(sample_tag(user=self.user)) payload = { 'title' : 'Sample services', 'price' : 5.00 } url = detail_url(services.id) self.client.put(url, payload) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipam_services_update(self):\n pass", "def test_modify_virtual_service(self):\n pass", "def test_ipam_services_partial_update(self):\n pass", "def test_partial_update_services(self):\n\n services = sample_services(user=self.user)\n services.tags.add(sample_tag(user=...
[ "0.8641285", "0.79171133", "0.78424454", "0.7805933", "0.7704621", "0.7685419", "0.7685419", "0.7685419", "0.7494562", "0.7476287", "0.7453277", "0.7447656", "0.7413729", "0.73801726", "0.73763245", "0.7331401", "0.71285045", "0.7061502", "0.69806314", "0.6944376", "0.6906792...
0.83420056
1
Computes Mel Frequency Cepstrum Coefficients.
def mfcc(samples, winlen, winshift, nfft, nceps, samplingrate): enframes = enframe(samples, winlen, winshift) # preemp_signal = map(lambda x: preemp(x, 0.97), enframes) preemp_signal = preemp(enframes, p=0.97) hamWindow = hamming(winlen, False) ham_signal = helper.combineHam(preemp_signal, hamWindo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(weights):\r\n\treturn np.cumsum(weights) / sum(weights)", "def coefficient(self) -> float:\n ...", "def mfcc(signal,samplerate=16000,winlen=0.025,winstep=0.01,numcep=13,\n nfilt=23,nfft=512,lowfreq=20,highfreq=None,dither=1.0,remove_dc_offset=True,preemph=0.97,\n ceplifter=22,use...
[ "0.6330263", "0.62783974", "0.6062788", "0.6053646", "0.5983969", "0.5908421", "0.5901622", "0.5866994", "0.58658993", "0.586169", "0.5809648", "0.57851714", "0.5763895", "0.5751254", "0.5741814", "0.57247186", "0.5719294", "0.5687384", "0.56800824", "0.5679125", "0.56777674"...
0.529806
87
Convert XML derived dict to tf.Example proto. Notice that this function normalizes the bounding box coordinates provided by the raw data.
def dict_to_tf_example(data, dataset_directory, label_map_dict, ignore_difficult_instances=False, image_subdirectory='JPEGImages'): img_path = os.path.join(data['folder'], image_subdirectory, data['filename']) full_path = os.path.join(dataset_directory, img_path) with tf.gfile.GFile(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_raw_example(\n self,\n mode_dict: MutableMapping[str, Any],\n example: Mapping[str, Any]) -> ProcessedExample:\n img_path = example['image_path_or_name']\n base_name = os.path.basename(img_path)\n img_fobj = example.get('image_fobj', tf.io.gfile.GFile(img_path, 'rb'))\n img_...
[ "0.64866096", "0.62824327", "0.61591005", "0.61199856", "0.60637885", "0.59391075", "0.5880986", "0.58808607", "0.5863848", "0.585247", "0.5841952", "0.58214945", "0.5819851", "0.5790651", "0.5782622", "0.57493347", "0.5748642", "0.5721537", "0.57130617", "0.5695004", "0.5695...
0.59289086
6
Add an edge to the graph
def add_edge(self, node_from, node_to, weight=0): self.edges.append(Edge(node_from, node_to, weight, self.directed)) self.nodes.update([node_from, node_to]) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ...
[ "0.85257995", "0.8430186", "0.8325732", "0.8320579", "0.83051246", "0.8287008", "0.82487744", "0.82355785", "0.82245684", "0.81784904", "0.8145196", "0.81240904", "0.8120313", "0.8116953", "0.80664617", "0.80656576", "0.8034175", "0.80335504", "0.80297977", "0.802793", "0.792...
0.71763
90
Setter for the attribute num_layers. Note, that this setter will overwrite all layer sizes, that might have been already set. Here is how the default network is set up. The default network will have 100 neurons in its first fully connected layer and 1 output neuron in the last layer. In between, the layer sizes shrink ...
def num_layers(self, value): if self._is_build: raise CustomException('The num_layers attribute can only be ' + 'changed if the network has not been ' + 'build yet.') self._num_layers = value self._compute_network_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_layers(self, sizes, init='random'):\n\t\tself.init_weights(sizes, init, None, None)", "def set_layer_size(self, layer_size, layer_ind):\n assert(not self._is_build)\n assert(layer_ind < self.num_layers-1)\n self._layer_sizes[layer_ind] = layer_size", "def num_layers(self): # -> int...
[ "0.6671717", "0.6399705", "0.63833475", "0.6286877", "0.61727804", "0.60025555", "0.59897673", "0.59849983", "0.59806055", "0.5971747", "0.5953724", "0.58869493", "0.5877721", "0.58515775", "0.5849023", "0.58062124", "0.5791276", "0.57852566", "0.57836753", "0.57739776", "0.5...
0.6994632
0
Get the layer size.
def get_layer_size(self, layer_ind): assert(layer_ind < self.num_layers) return self._layer_sizes[layer_ind]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer_size(self, layer_id): # -> int:\n ...", "def get_size(self):\n return self._surf.get_size()", "def layers_compressed_size(self):\n # don't have this information at this point\n return None", "def layers_compressed_size(self):\n # don't have this information at thi...
[ "0.8345496", "0.8051717", "0.7842418", "0.7842418", "0.7648123", "0.76223737", "0.76000935", "0.75946385", "0.75855625", "0.75650513", "0.7528693", "0.7495227", "0.7465697", "0.7465697", "0.7462605", "0.7462605", "0.7462605", "0.742995", "0.7420902", "0.74028623", "0.73912793...
0.8443825
0
Set the size of a hidden layer. Note, this method can only be called for a network, that has not been build yet.
def set_layer_size(self, layer_size, layer_ind): assert(not self._is_build) assert(layer_ind < self.num_layers-1) self._layer_sizes[layer_ind] = layer_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden_size(self, hidden_size):\n if hidden_size < 1:\n raise ValueError('The `hidden_size` must be > 0.')\n self._internal.set_hidden_size(int(hidden_size))", "def get_hidden_layer_size(self):\r\n return self.hidden_layer_size", "def __init__(self, hidden_size):\n ...
[ "0.78095454", "0.7096843", "0.7065971", "0.66396236", "0.65171564", "0.635646", "0.6290112", "0.6250569", "0.615309", "0.61461616", "0.61457574", "0.6129701", "0.61273247", "0.6090629", "0.6090629", "0.6073986", "0.6068449", "0.6058564", "0.60583955", "0.6047143", "0.6028632"...
0.7191068
1
Tests the a page found returns 200
def test_make_successful_call(self): response = Helper.make_request(self.movies_url) self.assertEqual(response.status_code, 200) json_data = response.json() movie_keys: set[str] = {'id', 'title', 'description', 'director', 'producer', 'release_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_get_page(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 200)", "def test_get_page(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 200)", "de...
[ "0.7742063", "0.74440813", "0.74440813", "0.74397004", "0.7427024", "0.73815894", "0.73815894", "0.73815894", "0.73815894", "0.73815894", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", "0.73733926", ...
0.0
-1
Given a particular string, returns whether the string can be considered a safe username. This is a very liberal validation step, simply assuring forward slashes do not exist in the username.
def _is_valid_social_username(value): return '/' not in value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_username(self, username: str) -> bool:\n if '/' in username:\n # / is not allowed in usernames\n return False\n if not username:\n # empty usernames are not allowed\n return False\n if not self.username_regex:\n return True\n ...
[ "0.8151427", "0.779374", "0.7682491", "0.7672101", "0.75872445", "0.7571697", "0.75428975", "0.7537", "0.74773973", "0.743184", "0.7426727", "0.7410807", "0.74063635", "0.7360655", "0.73556215", "0.73168546", "0.72955453", "0.7251049", "0.72043675", "0.7195059", "0.7141087", ...
0.7860386
1
generate random string with specified length
def gen_random_string(str_len, has_chinese=False): char = CHINESE_CHARS if has_chinese else string.ascii_letters return "".join(random.choices(char, k=str_len))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))", "def make_random_stri...
[ "0.8822433", "0.86648166", "0.8586126", "0.85848784", "0.8533231", "0.85217685", "0.851171", "0.84942085", "0.8491492", "0.84530705", "0.8438214", "0.8438067", "0.84265554", "0.84177226", "0.84020114", "0.83530337", "0.8338118", "0.8323126", "0.8312837", "0.8307953", "0.82926...
0.0
-1
get timestamp string, length can only between 0 and 16
def get_timestamp(str_len=13): if isinstance(str_len, int) and 0 < str_len < 17: return str(time.time()).replace(".", "")[:str_len] raise Exception("timestamp length can only between 0 and 16.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_timestamp():\n return str(int(time.time()))", "def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))", "def _generate_timestamp():\n\t\treturn strftime(\"%Y%m%dT%H%M%S\")", "def timestamp():\n\tn = datetime.datetime.now()\n\treturn \"%04d-%02d-%02dT%02d...
[ "0.7294211", "0.7281439", "0.7261052", "0.7234298", "0.7185411", "0.7147215", "0.71452993", "0.70909226", "0.70597327", "0.7047586", "0.7024735", "0.7006772", "0.7005866", "0.70027244", "0.69324654", "0.69105417", "0.6908101", "0.6906292", "0.68975055", "0.68826646", "0.68646...
0.8256923
0
get current date, default format is %Y%m%d
def get_current_date(fmt="%Y-%m-%d"): return datetime.datetime.now().strftime(fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FORMAT)", "def get_date():\n now = datetime.now()\n date = now.strftime(\"%Y%m%d\")\n return date", "def get_date(format_of_date):\n current_date = datetime.datetime.today().strftime(format_of_date) # \"%d%m%...
[ "0.87407446", "0.84163916", "0.81837916", "0.81826067", "0.8032511", "0.8021543", "0.78703463", "0.77653486", "0.7762593", "0.7663112", "0.7637552", "0.7575093", "0.7537982", "0.75191456", "0.74612385", "0.74493015", "0.743819", "0.742762", "0.7399587", "0.73628557", "0.73551...
0.86133766
1
Takes as input a string sentence and removes leading and trailing whitespace, also coerces all multiple whitespaces into a single whitespace character.
def whitespace_sorter(sentence): sentence_copy = str(sentence) sentence_copy = sentence_copy.strip() #Remove leading and trailing whitespace (/s) sentence_copy = re.sub(" +", " ", sentence_copy) #Coerces all multiple /s characters into a single /s #It identifies a /s followed by any nonzero number o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_sentence(s):\n return re.sub(\"\\s+\", \" \", s.replace(\"\\t\", \"\").strip())", "def normalize_whitespace(text):\n return NORMALIZE_WHITESPACE_REGEX.sub(' ', text)", "def normalize_whitespace(text):\n text = str(text)\n return re.sub(white_space_regex, ' ', text).strip()", "def norm...
[ "0.82129616", "0.7992432", "0.78626645", "0.78465235", "0.7693718", "0.7679991", "0.7608585", "0.7561684", "0.75329727", "0.7494219", "0.74935544", "0.7441568", "0.7441568", "0.7405982", "0.7372812", "0.72611177", "0.72535473", "0.7241983", "0.722616", "0.71987885", "0.718967...
0.741311
13
Get indexes of the elements that should replace each other in one Move.
def get_move_indexes(i, j): return (i, j), (j, n - 1 - i), (n - 1 - i, n - 1 - j), (n - 1 - j, i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pair_indices(self):\n indices_src = []\n indices_dst = []\n for i in range(self.walk_len):\n for j in range(max(i - self.l, 0), i):\n indices_src.append(i)\n indices_dst.append(j)\n for j in range(i + 1, min(i + self.r + 1, self.walk_len)):\n indices_src.append(i)\n ...
[ "0.6768328", "0.65749544", "0.62072664", "0.6068191", "0.605678", "0.5995902", "0.5978445", "0.5946502", "0.5943825", "0.5859297", "0.5848402", "0.58417964", "0.5815818", "0.5813316", "0.5803902", "0.57999706", "0.57900643", "0.57683134", "0.5760233", "0.57494694", "0.5745722...
0.7664385
0
Get a EngineStore test subject.
def subject(decoy: Decoy, hardware_api: HardwareControlAPI) -> EngineStore: return EngineStore( hardware_api=hardware_api, # Arbitrary choice of robot and deck type. Tests where these matter should # construct their own EngineStore. robot_type="OT-2 Standard", deck_type=pe_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subject(self):\n return self._subject", "def get_subject(self, web_registry):\n return self.subject_builder.build_subject(web_registry=web_registry)", "def subject(self):\n return self._subject", "def subject(self):\n if \"subject\" in self._prop_dict:\n return ...
[ "0.645178", "0.6128086", "0.6058121", "0.6049678", "0.60093915", "0.59482825", "0.58117527", "0.58043426", "0.5789382", "0.57850325", "0.5693222", "0.5641245", "0.56279427", "0.55745184", "0.5563676", "0.5514609", "0.5507676", "0.5507676", "0.5467953", "0.5451382", "0.5451382...
0.6280837
1
return an iterator on stripped lines, starting from a given index if specified, else 0
def enumerate_stripped(self, start_at=0): idx = start_at if start_at: lines = self._stripped_lines[start_at:] else: lines = self._stripped_lines for line in lines: # if line: yield idx, line idx += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skiprows(fn):\n for i, line in enumerate(open(fn)):\n if line.startswith('#'):\n continue\n else:\n break\n return i", "def line_iter(s):\n\n i=0\n n=len(s)\n while i<n:\n j=s.find('\\n',i)\n if j<0:\n yield s[i:]\n j=n\n else:\n...
[ "0.61004066", "0.6083333", "0.5916007", "0.585804", "0.5694667", "0.56717813", "0.5662981", "0.560991", "0.5565703", "0.55640197", "0.5510409", "0.55085033", "0.5503855", "0.54400164", "0.5397028", "0.539238", "0.53243387", "0.5310437", "0.5307419", "0.52915657", "0.5282884",...
0.78394514
0
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
def resource_group_name(self) -> pulumi.Input[str]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")", "def get_resource_group_name(self):\n return self.instance_metadata.resource_group_name", "def get_resource_group_n...
[ "0.73604816", "0.72445804", "0.69969904", "0.68921393", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.6891529", "0.68304294", "0.68304294", "0.67739546", "0.67739546", "0.67739...
0.6951263
16
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
def resource_group_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")", "def get_resource_group_name(self):\n return self.instance_metadata.resource_group_name", "def resource_group_name(...
[ "0.73604816", "0.72445804", "0.69969904", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", "0.6951263", ...
0.67739546
67
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
def resource_group_name(self) -> pulumi.Output[str]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")", "def get_resource_group_name(self):\n return self.instance_metadata.resource_group_name", "def resource_group_name(...
[ "0.73598313", "0.7244252", "0.6996695", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", "0.69509375", ...
0.68909407
48
Reset amount_type and price_include to their default values, 'percent' and False respectively. Set type_use_tax to 'sale' if on_margin otherwise force user selecting the desired value (required). Unset include_base_amount for taxes comupted on margin.
def onchange_on_margin(self): for tax in self: tax.amount_type = 'margin' if tax.on_margin else 'percent' tax.price_include = tax.on_margin tax.type_tax_use = 'sale' if tax.on_margin else 'none' if tax.on_margin: tax.include_base_amount = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_amount(self, base_amount, price_unit, quantity=1.0, product=None, partner=None):\n\n self.ensure_one()\n\n if self.amount_type != 'margin':\n return super(AccountTax, self)._compute_amount(\n base_amount,\n price_unit,\n quantity=qu...
[ "0.528144", "0.52663195", "0.5158517", "0.51394933", "0.51089656", "0.5031483", "0.50146925", "0.49989864", "0.49802876", "0.49278638", "0.48968938", "0.48754337", "0.48705912", "0.4830438", "0.48030034", "0.47573337", "0.47467205", "0.47241253", "0.4718581", "0.46893904", "0...
0.6841609
0
Create `PSF3D` from `~astropy.table.Table`.
def from_table(cls, table): theta_lo = table["THETA_LO"].quantity[0] theta_hi = table["THETA_HI"].quantity[0] offset = (theta_hi + theta_lo) / 2 offset = Angle(offset, unit=table["THETA_LO"].unit) energy_lo = table["ENERG_LO"].quantity[0] energy_hi = table["ENERG_HI"].qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_table(table):\n n = len(table)\n for i, row in enumerate(table):\n assert len(row) == n, f\"len(row) = {len(row)} != {n} = n\"\n for j, _ in enumerate(row):\n if i == j:\n table[i][i] = 0.0\n elif i > j:\n table[i][j] = 1 - table[j...
[ "0.56197006", "0.54928666", "0.54034764", "0.5292542", "0.5242191", "0.51969886", "0.5167265", "0.51064163", "0.5070407", "0.5057993", "0.50374967", "0.49916157", "0.4981484", "0.49646845", "0.49422315", "0.491645", "0.49035293", "0.48877084", "0.48864383", "0.4877944", "0.48...
0.5602368
1
Convert PSF3D in EnergyDependentTablePSF.
def to_energy_dependent_table_psf(self, theta="0 deg", rad=None, exposure=None): theta = Angle(theta) energies = self._energy_logcenter() if rad is None: rad = self._rad_center() else: rad = Angle(rad) psf_value = self.evaluate(offset=theta, rad=rad).squ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d3transf_df3(self,f):\r\n raise NotImplementedError", "def Fsp3(row):\n m = Chem.MolFromSmiles(row.SMILES)\n FSP3 = Descriptors.FractionCSP3(m)\n return FSP3", "def itkMeshSourcePSF3_cast(obj: 'itkLightObject') -> \"itkMeshSourcePSF3 *\":\n return _itkMeshSourcePython.itkMeshSourcePSF3_c...
[ "0.6041852", "0.5741613", "0.5648858", "0.5395812", "0.53634834", "0.5329074", "0.529745", "0.5195794", "0.51910365", "0.5190161", "0.5182827", "0.5182827", "0.51519036", "0.51175934", "0.5092039", "0.5078067", "0.5038422", "0.499914", "0.4989218", "0.49761847", "0.49604914",...
0.0
-1
Plot containment image with energy and theta axes.
def plot_containment( self, fraction=0.68, ax=None, show_safe_energy=False, add_cbar=True, **kwargs ): import matplotlib.pyplot as plt ax = plt.gca() if ax is None else ax energy = self._energy_logcenter() offset = self.offset # Set up and compute data cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_potential(self):\n imshow(self.U, extent=(self.x[0], self.x[-1], self.y[0], self.y[-1]), aspect='auto', interpolation='None')\n xlabel('x')\n ylabel('y')", "def show(image):\n fig = pyplot.figure()\n axis = fig.add_subplot(1, 1, 1)\n imgplot = axis.imshow(image)\n imgplo...
[ "0.6686779", "0.6531409", "0.64715815", "0.6432542", "0.6418124", "0.63856936", "0.6252868", "0.6252598", "0.6252598", "0.6252598", "0.6251115", "0.62435055", "0.62385327", "0.6176896", "0.6173953", "0.6173083", "0.6159115", "0.6122775", "0.6049667", "0.6009157", "0.5924724",...
0.6083822
18
Return the error messages in one single string
def getMessage(self): m = self.messages l = len(m) if (l == 0): return "" elif (l == 1): return self.acronym + " | " + m[0] else: msg = self.acronym + " | " for i in range(0,l): msg += m[i] if (i < l-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_str(messages: Iterable[Error]) -> str:\n return '\\n\\n'.join(str(m) for m in messages if is_error(m.code))", "def make_error_string(controller, errors):\n return \"\\n\".join([controller.get_string(error) for error in errors])", "def collect_errors_and_warnings(self) -> str:\n # Complet...
[ "0.80595165", "0.76704895", "0.7382073", "0.73371583", "0.7294507", "0.727807", "0.727807", "0.7091642", "0.7038438", "0.70249325", "0.6986634", "0.69653535", "0.695869", "0.6897431", "0.6880935", "0.68663377", "0.68401515", "0.6832905", "0.68318504", "0.6817586", "0.68062776...
0.6905039
13
Performs low level quoting on a string (CTCPSPEC).
def low_quote(s): for c in M_QUOTE_TABLE: s = s.replace(c, M_QUOTE_TABLE[c]) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quote_str():\n assert pmisc.quote_str(5) == 5\n assert pmisc.quote_str(\"Hello!\") == '\"Hello!\"'\n assert pmisc.quote_str('He said \"hello!\"') == \"'He said \\\"hello!\\\"'\"", "def quot(string):\r\n return string.replace('\"', \"'\")", "def _quote(self, arg):\n arg = arg...
[ "0.6600744", "0.6355297", "0.6269482", "0.62506914", "0.6212328", "0.6116304", "0.6046553", "0.6044138", "0.60348", "0.60332483", "0.5978711", "0.59452266", "0.59296584", "0.59053105", "0.5905273", "0.5905273", "0.5846153", "0.58450526", "0.5837113", "0.58156466", "0.57741624...
0.0
-1
Performs low level dequoting on a string (CTCPSPEC).
def low_dequote(s): s = iter(s) d_s = '' for c in s: if c == M_QUOTE: n = s.next() c = M_DEQUOTE_TABLE.get(c+n, n) # maybe raise an error d_s += c return d_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ctcp_dequote(s):\n s = iter(s)\n d_s = ''\n for c in s:\n if c == X_QUOTE:\n n = s.next()\n c = X_DEQUOTE_TABLE.get(c+n, n) # maybe raise an error\n d_s += c\n return d_s", "def dequote(string):\r\n if ( ( string.startswith('\"') and string.endswith('\"'))\...
[ "0.614216", "0.6021989", "0.5691671", "0.5683238", "0.5550915", "0.5497451", "0.5480706", "0.54688746", "0.54660636", "0.54382235", "0.53224045", "0.5301998", "0.5272437", "0.52639085", "0.52446395", "0.5228149", "0.5224396", "0.5219268", "0.521071", "0.51290685", "0.51117283...
0.54239035
10
Performs ctcp quoting on a string (CTCPSPEC).
def ctcp_quote(s): for c in (X_QUOTE, X_DELIM): s = s.replace(c, X_QUOTE_TABLE[c]) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quote_str():\n assert pmisc.quote_str(5) == 5\n assert pmisc.quote_str(\"Hello!\") == '\"Hello!\"'\n assert pmisc.quote_str('He said \"hello!\"') == \"'He said \\\"hello!\\\"'\"", "def test_ctcpquoteSanity(self):\n for s in stringSubjects:\n self.assertEqual(s, irc.ctcpDequote...
[ "0.5987406", "0.5937717", "0.5680716", "0.56741387", "0.5649357", "0.5641219", "0.5581533", "0.5564057", "0.552736", "0.55191797", "0.5477836", "0.54730266", "0.54084486", "0.53550303", "0.53528106", "0.53484076", "0.53157395", "0.53157395", "0.52311456", "0.51930386", "0.519...
0.6648016
0
Add a new node with given value to the end (tail) of the queue.
def enqueue(self, value): self._container.append(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, value: Any) -> None:\n new_node = Node(value)\n try: # Assume queue is not empty\n new_node.next = self._tail\n self._tail.prev = new_node\n except AttributeError: # Queue is empty\n self._head = new_node\n...
[ "0.84267735", "0.8051281", "0.79747516", "0.79146117", "0.7790935", "0.77746046", "0.7724694", "0.7721839", "0.76911944", "0.76911944", "0.7662964", "0.76461005", "0.7642", "0.763236", "0.76189107", "0.76162356", "0.7611669", "0.7575276", "0.75108045", "0.7495692", "0.7423290...
0.6581254
75
Remove the node at the head of the queue and return the value.
def dequeue(self): try: return self._container.pop() except IndexError: raise IndexError("Cannot dequeue from empty queue.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n removed_node = self.top\n self.top = self.top._next\n self._size -= 1\n return removed_node.val", "def pop_front(self):\n if self.is_empty():\n return None\n val = self.head.value\n # Update head and size\n self.head = self.head....
[ "0.79584014", "0.781565", "0.77828515", "0.7780215", "0.7775491", "0.7674533", "0.7671761", "0.7638194", "0.75375354", "0.75166804", "0.7503742", "0.74862003", "0.74823016", "0.7424033", "0.7418019", "0.73412865", "0.7334118", "0.7327527", "0.73164546", "0.7302169", "0.729110...
0.0
-1
Return the value at the head of the queue. None if empty.
def peek(self): try: return self._container.head.value except AttributeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n if self.head is None:\n raise Exception(\"nothing in queue\")\n return self.head.value", "def first(self):\r\n if self.is_empty():\r\n raise Empty(\"Queue is empty\")\r\n return self._head._element", "def top(self): # O(...
[ "0.87103534", "0.7984892", "0.7984333", "0.7945365", "0.79327416", "0.79265296", "0.78780556", "0.78713334", "0.78124547", "0.78076744", "0.7784434", "0.77490103", "0.76952666", "0.76834", "0.7660964", "0.75774175", "0.7505923", "0.74792117", "0.7473486", "0.7454233", "0.7454...
0.72627664
31
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal.
def sort_012(input_list): i = 0 next_0 = 0 next_2 = len(input_list) - 1 while i <= next_2: if input_list[i] == 0: input_list[i] = input_list[next_0] input_list[next_0] = 0 next_0 += 1 i += 1 elif input_list[i] == 2: input_list[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(array):\n\n for i in range(0, len(array)):\n for j in range(len(array)-1, i, -1):\n if array[j] < array[j-1]:\n ## Move the lighter bubble up\n _temp = array[j]\n array[j] = array[j-1]\n array[j-1] = _temp\n \n ...
[ "0.67919695", "0.6757865", "0.6685288", "0.66707903", "0.66606873", "0.66433793", "0.6601348", "0.6589529", "0.65535486", "0.655136", "0.65012807", "0.64873356", "0.6464587", "0.64453906", "0.6430157", "0.6429678", "0.64227754", "0.642164", "0.64186907", "0.6404622", "0.63885...
0.0
-1
Returns the mean loss on the given test data and labels.
def score(self, x, y, **kwargs): kwargs = self.filter_sk_params(Sequential.evaluate, kwargs) loss = self.model.evaluate(x, y, **kwargs) if isinstance(loss, list): return loss[0] return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_mean_tst_loss(model, X_test, y_test):\n\ttest_losses = []\n\tfor j in range(len(X_test)):\n\t\tsingle_mol_as_array = np.array(X_test[j:j+1])\n\t\tsingle_y_as_array = np.reshape(y_test[j], (1, -1))\n\t\tsloss = model.test_on_batch(single_mol_as_array, single_y_as_array)\n\t\ttest_losses.append(sloss)\n...
[ "0.7294527", "0.7071308", "0.6758762", "0.66960585", "0.6669047", "0.66290927", "0.65641874", "0.65163195", "0.6478105", "0.6445184", "0.6426185", "0.6397483", "0.63807935", "0.6369102", "0.6364579", "0.6351233", "0.63380873", "0.6337095", "0.63097984", "0.6303651", "0.628579...
0.0
-1
Returns the status of the game.
def get_game_on_status(self) -> bool: return self._game_on.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_state(self):\n return self._game_status", "def status():\n aux = {\"Number games\": len(games), \"Path execution\": path_games}\n for j, game in enumerate(games.games_status):\n aux[\"Game \" + str(j)] = game\n return aux", "def getStatus(self, gameID):\n\n if gameID ...
[ "0.81505525", "0.7817576", "0.7543118", "0.7438914", "0.73928285", "0.73797435", "0.7366682", "0.7366682", "0.7366682", "0.72768205", "0.7273695", "0.72644264", "0.726212", "0.7232672", "0.7224582", "0.7208345", "0.72016704", "0.71966994", "0.7194503", "0.71693736", "0.715519...
0.75103426
3
Returns the treasury minimum value
def get_treasury_min(self) -> int: return self._treasury_min.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minyear():\n\n return datetime.MINYEAR", "def get_min(self):\r\n df = pd.read_csv(\"MonthlyRate.csv\")\r\n df = df[df.CurrencyCode == self.choice]\r\n minimum = df.min(axis=1).values[0]\r\n # Round the value to 4 d.p.\r\n minimum = round(float(minimum), 4)\r\n ret...
[ "0.67418486", "0.6604037", "0.6535757", "0.64632905", "0.6451948", "0.63768697", "0.63553894", "0.63527995", "0.6304219", "0.62797254", "0.62332237", "0.617421", "0.6163282", "0.61568815", "0.6155415", "0.6149815", "0.6144383", "0.6139986", "0.6139986", "0.61190444", "0.60878...
0.82874376
0
A function to return the owner of this score.
def get_score_owner(self) -> Address: return self.owner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner(self):\n if self.get_team():\n return self.get_team()\n return None", "def owner(self):\n answer = self._call('owner')\n return answer.owner", "def getOwner(self):\r\n return self.owner", "def get_owner(self):\n return self.__owner", "def getOw...
[ "0.75828725", "0.7544952", "0.7510299", "0.7368223", "0.73566806", "0.73566806", "0.7306206", "0.72997594", "0.72900814", "0.7221638", "0.7221638", "0.71441334", "0.712012", "0.70712644", "0.70712644", "0.70712644", "0.70712644", "0.70712644", "0.70633405", "0.7063301", "0.70...
0.8507817
0
Takes wager amount from approved games. The wager amounts are recorded in game authorization score. Checks if the day has been advanced. If the day has advanced the excess amount is transferred to distribution contract.
def take_wager(self, _amount: int) -> None: self._take_wager(self.msg.sender, _amount)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _take_wager(self, _game_address: Address, _amount: int) -> None:\n if _amount <= 0:\n revert(f\"Invalid bet amount {_amount}\")\n auth_score = self.create_interface_score(self._game_auth_score.get(), AuthInterface)\n if auth_score.get_game_status(_game_address) != \"gameApproved...
[ "0.7051029", "0.67199814", "0.59195966", "0.5896884", "0.5866254", "0.5838147", "0.5801701", "0.579932", "0.57933426", "0.57496166", "0.57467264", "0.5688947", "0.5662142", "0.56520903", "0.56515026", "0.563794", "0.5631062", "0.56294745", "0.5617113", "0.5614202", "0.5611022...
0.0
-1
Roll each table seperately, without yielding the same index from each. Return a random value from each table, while ensuring that they don't share the same index number from their respective table.
def roll_exclusive(table1, table2): t1 = roll(table1) for index1, entry in enumerate(table1): if entry[0] == t1: break while(True): t2 = roll(table2) for index2, entry in enumerate(table2): if entry[0] == t2: break if index1 != index2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totem_random():\n random_head()\n random_head()\n random_head()", "def table_simulation(self):\n\n # n=1 is the first customer\n for n in range(2, self._n):\n\n # Gen random number 0~1\n rand = random.random()\n\n p_total = 0\n ex...
[ "0.62813234", "0.62576866", "0.6118291", "0.6056727", "0.6048181", "0.59638095", "0.5955684", "0.59405833", "0.59405833", "0.5919087", "0.58985984", "0.58556235", "0.58556235", "0.58556235", "0.58556235", "0.5847604", "0.5823445", "0.5778741", "0.57781446", "0.5755231", "0.57...
0.0
-1
get a relative filename path in the path given
def get_filepath_filename(filepath, return_filenames): main_dir_path = '' names = [] for dirpath, dirnames, filenames in os.walk(filepath): main_dir_path = dirpath names = filenames for name in names: _ = os.path.join(main_dir_path, name) return_filenames.append(_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rel_filename(filename, relative_to=None):\n if relative_to is None:\n relative_to = os.getcwd()\n if not relative_to.endswith(os.path.sep):\n relative_to += os.path.sep\n filename = os.path.normpath(os.path.abspath(filename))\n if filename.startswith(relative_to):\n return file...
[ "0.77853984", "0.77153355", "0.76950055", "0.7644184", "0.76429003", "0.76015633", "0.75924456", "0.7502152", "0.7488266", "0.74801254", "0.74198025", "0.74197286", "0.7387726", "0.736771", "0.7359146", "0.73578924", "0.73092383", "0.7306205", "0.73000705", "0.72688603", "0.7...
0.0
-1
Reorder the decoder incremental state. See ``TorchGeneratorModel.reorder_decoder_incremental_state`` for a description. Here, incremental_state is a dict whose keys are layer indices and whose values are dicts containing the incremental state for that layer.
def reorder_decoder_incremental_state(self, incremental_state, inds): return { idx: layer.reorder_incremental_state(incremental_state[idx], inds) for idx, layer in enumerate(self.decoder.transformer.layers) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_incremental_state(\n self,\n incremental_state: Dict[str, Dict[str, Optional[Tensor]]],\n new_order: Tensor,\n ):\n pass", "def reorder_incremental_state_scripting(\n self,\n incremental_state: Dict[str, Dict[str, Optional[Tensor]]],\n new_order: Te...
[ "0.75625265", "0.714548", "0.6850011", "0.6598024", "0.5705592", "0.5514132", "0.5498032", "0.53328973", "0.524592", "0.524592", "0.5167797", "0.5125729", "0.5091006", "0.50799745", "0.50668526", "0.5047275", "0.50337005", "0.4993141", "0.49894536", "0.4963904", "0.4929823", ...
0.82180285
0
Splits text on a line_break character (unless preceeded by an escape character).
def readdocument(edi: Union[str, BinaryIO], filename: str = 'stream', encoding: str ='latin-1') -> Iterator[str]: if isinstance(edi, str): sep = detect(edi) edi = BytesIO(edi.encode(encoding)) else: edi = BufferedReader(edi) sep = detect(str(edi.peek(), encoding)) if not sep:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linebreaks(text):\n return smart_unicode(text).replace('\\n', '<br />')", "def split_lines(s):\n # rstrip is used here to workaround a difference between splineslines and\n # re.split:\n # >>> 'foo\\n'.splitlines()\n # ['foo']\n # >>> re.split(r'\\n', 'foo\\n')\n # ['foo', '']\n retur...
[ "0.67620003", "0.6689305", "0.6461108", "0.6371097", "0.63137174", "0.61952615", "0.6100843", "0.60314626", "0.601142", "0.59709865", "0.59156734", "0.5911628", "0.5903715", "0.5894876", "0.58931565", "0.58928216", "0.5871228", "0.5846904", "0.5838236", "0.58315545", "0.58315...
0.0
-1
Takes an EDI string and returns detected separators as a dictionary.
def detect(text: str) -> Dict[str, str]: sep = {} # EDI X12: begins with ISA (106 chars) followed by a GS segment if text.startswith('ISA'): if 'GS' in text[106:110] and len(set([text[pos] for pos in isa_element_sep])) == 1: sep = {'element': text[103], 'subelement': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeDict(self, s):\n out = {}\n entries = s.split(self.dataDelimiterEntry)\n for e in entries:\n if e == \"\":\n continue\n c = e.split(self.dataDelimiterKey)\n out[c[0]] = c[1]\n return out", "def extract_key_value_pairs(string, joi...
[ "0.66868436", "0.6185114", "0.5868856", "0.5830599", "0.582806", "0.559936", "0.5559287", "0.544728", "0.54368025", "0.5430284", "0.5308028", "0.529493", "0.52748185", "0.52629256", "0.5258382", "0.52507216", "0.5213265", "0.51883036", "0.5119031", "0.5113774", "0.511176", ...
0.5530469
7
Splits text into words.
def get_words(doc): splitter = re.compile('\\W*') # Split the words by non-alpha characters words = [s.lower() for s in splitter.split(doc) if len(s)>2 and len(s)<20] # Return the unique set of words only return dict([(w,1) for w in words])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_words(text : str) -> list:\n command_text = text.strip()\n commands = command_text.split(' ')\n return commands", "def txt_to_word_list(text):\r\n return [w for w in text.split()]", "def separate_words(text):\n splitter = re.compile('\\\\W*')\n return [s.lower() for s in splitter.sp...
[ "0.8043646", "0.7914032", "0.7864257", "0.7752801", "0.7744381", "0.7700877", "0.76231325", "0.7578384", "0.74875385", "0.7479356", "0.7456034", "0.7456034", "0.74316996", "0.7396044", "0.7394001", "0.7389773", "0.73632497", "0.73623234", "0.73262954", "0.73182255", "0.731822...
0.0
-1
Returns a list of categories.
def categories(self): cur = self.con.execute('select category from cc'); return [d[0] for d in cur]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllCategories(self):\n return self.categories", "def categories(self) -> List[str]:\n return self._categories", "def categories(self):\n game_categories = self.game_categories.all()\n return [ gc.category for gc in game_categories ]", "def list_categories(self):\n ra...
[ "0.8440817", "0.8315814", "0.8314017", "0.83058816", "0.82756895", "0.82337904", "0.8194744", "0.8162497", "0.81154656", "0.81095296", "0.80690354", "0.80144095", "0.79708874", "0.79260206", "0.7908823", "0.78879285", "0.78876674", "0.7869511", "0.7858786", "0.7851696", "0.78...
0.8310888
3
Returns the threshold value of a category.
def get_threshold(self, cat): t = self.con.execute('select threshold from ct where category="%s"' %(cat)).fetchone() if t is None: return 1.0 return self.thresholds[cat]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(self) -> float:\n return pulumi.get(self, \"threshold\")", "def threshold(self) -> pulumi.Input[float]:\n return pulumi.get(self, \"threshold\")", "def threshold(self) -> pulumi.Input[float]:\n return pulumi.get(self, \"threshold\")", "def threshold(self) -> pulumi.Input[fl...
[ "0.7050813", "0.69058216", "0.69058216", "0.69058216", "0.69058216", "0.69058216", "0.69057024", "0.69057024", "0.68449765", "0.67343384", "0.67027706", "0.6659641", "0.6659641", "0.6659641", "0.6583798", "0.6566067", "0.6502641", "0.6477193", "0.6473349", "0.646821", "0.6468...
0.8494913
0
return logging level to that set in options
def go_loud(options): my_logger = logging.getLogger(__name__) if options['panzer']['quiet']: verbosity_level = 'WARNING' else: verbosity_level = 'INFO' my_logger.setLevel(LEVELS[verbosity_level])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_level(self) -> int:\n logging.debug(self.args)\n return getattr(logging, self.args.loglevel.upper(), None)", "def log_level(self) -> str:\n return pulumi.get(self, \"log_level\")", "def get_logging_level(self):\n return self.logging_level", "def log_level(self) -> LogL...
[ "0.7521753", "0.7516409", "0.75040793", "0.7377837", "0.7355695", "0.72468966", "0.7181313", "0.71496034", "0.71461684", "0.7135066", "0.7080384", "0.69914126", "0.6908168", "0.6896545", "0.6893578", "0.6879409", "0.6831002", "0.6819158", "0.68083364", "0.6780559", "0.6728484...
0.6085661
71
return path string replacing '~' for home directory
def pretty_path(input_path): home_path = os.path.expanduser('~') cwd_path = os.getcwd() output_path = input_path.replace(home_path, '~').replace(cwd_path, './') return output_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homedir():\n return os.path.expanduser('~')", "def relativeToAbsoluteHomePath(path):\n if \"~\" in path:\n return path.replace(\"~\",expanduser(\"~\"))\n else:\n return path", "def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home", "def ...
[ "0.8021984", "0.7968578", "0.7964787", "0.7829711", "0.7706132", "0.7690569", "0.76241875", "0.7581241", "0.7464281", "0.74349767", "0.73477095", "0.7327567", "0.72986704", "0.72223455", "0.7178878", "0.7165649", "0.71655446", "0.7141305", "0.7137354", "0.7113035", "0.7107988...
0.6721384
32
Get list containing (token, token_start, token_end, NE_category) of a
def named_entity_list_stanford_nlp(self) -> List: stanza.download(self.lang, processors = 'tokenize,mwt,ner') #load file and convert input string nlp = stanza.Pipeline(self.lang, processors = 'tokenize,mwt,ner') doc = nlp(self.sent) #build the output list for sentence in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTokens(self):\n list = []\n for i in range(self.startIdx, self.endIdx + 1):\n token = self.sentence[i]\n list.append(token)\n return list", "def get_tokens(self):\n\t\treturn self.get_starttokens() + self.get_endtokens()", "def get_tokens(self, document):\n ...
[ "0.6416807", "0.608175", "0.6024927", "0.59655416", "0.5916123", "0.59109527", "0.58727705", "0.58642095", "0.58243245", "0.57959795", "0.5774105", "0.5757302", "0.5751593", "0.5745337", "0.57378715", "0.5689094", "0.5681456", "0.5668421", "0.56307656", "0.5614033", "0.560728...
0.0
-1
computes the sigmoid of z.
def sigmoid(z): g = (1 + np.exp(-z))**-1 return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(z):\r\n \r\n return vSigmoid(z);", "def sigmoid(self, z):\n return 1 / (1 + np.exp(-z))", "def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))", "def sigmoid(z): \n return 1/(1 + np.e**(-z))", "def sigmoid(self, z):\n\n s = 1 / (1 + np.exp(-z))\n\n retur...
[ "0.91508406", "0.902568", "0.90190953", "0.8987174", "0.89550376", "0.89488447", "0.89046794", "0.88975704", "0.88790375", "0.8870732", "0.8868561", "0.88548", "0.8850668", "0.88461405", "0.88412595", "0.88331264", "0.88112795", "0.8808111", "0.8804811", "0.8788765", "0.87868...
0.87683034
21
Returns the list of action templates.
def list_actions(self, query_params: Dict[str, object] = None) -> List[Action]: if query_params is None: query_params = {} path_params = { } path = Template("/action/v1beta2/actions").substitute(path_params) url = self.base_client.build_url(path) response = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_templates(self) -> List[ActionTemplate]:\n return self._action_templates", "def template_list(self):\n return self.ezx.get_template_list()", "def list_templates(self):\n raise NotImplementedError()", "def get_templates(self):\n return self.http_call(\"get\", url=f\"{sel...
[ "0.86085", "0.7290691", "0.72011065", "0.7017456", "0.7001664", "0.69727004", "0.68429345", "0.66886026", "0.66786546", "0.6665357", "0.6648036", "0.66336787", "0.6629453", "0.6608395", "0.65995073", "0.65629756", "0.65503234", "0.65478253", "0.6467991", "0.64483804", "0.6393...
0.0
-1
Performs one time step of Kalman filter estimation
def EstimateKFTimeStep(u1,y1,z0,Xxd,Xud,Yx,Yu,P0,Q,R): # estimate next step z1m = Xxd.dot(z0) + Xud.dot(u1) y1hat = Yx.dot(z1m) + Yu.dot(u1) P1m = (Xxd.dot(P0)).dot(Xxd.T) + Q # Calculate Kalman gain # same as Lk from [1] - And their Rtilde_k is G*P1m*G'+R Kk = np.dot(P1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KFilt(sample,fs=25):\n\t#kalman filter inputs\n \n # Dimensions of parameters:\n # 'transition_matrices': 2,\n # 'transition_offsets': 1,\n # 'observation_matrices': 2,\n # 'observation_offsets': 1,\n # 'transition_covariance': 2,\n # 'observation_covariance': 2,\n # 'initial_sta...
[ "0.74162793", "0.7349799", "0.6900503", "0.6889632", "0.68486834", "0.6833693", "0.6796087", "0.6733508", "0.6602304", "0.65619844", "0.65152407", "0.64656633", "0.6462521", "0.64611596", "0.64254737", "0.64052427", "0.63971543", "0.6376996", "0.6238056", "0.60865337", "0.605...
0.6088578
19
Returns state matrices with proper dimensions, filled with 0
def EmptyStateMat(nX,nU,nY): Xx = np.zeros((nX,nX)) # Ac Yx = np.zeros((nY,nX)) # Gc Xu = np.zeros((nX,nU)) # Xu Yu = np.zeros((nY,nU)) # Jc return Xx,Xu,Yx,Yu
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state():\r\n return [[EMPTY, EMPTY, EMPTY],\r\n [EMPTY, EMPTY, EMPTY],\r\n [EMPTY, EMPTY, EMPTY]]", "def initial_state():\r\n return [[EMPTY, EMPTY, EMPTY],\r\n [EMPTY, EMPTY, EMPTY],\r\n [EMPTY, EMPTY, EMPTY]]", "def initial_state():\n return [[...
[ "0.75240546", "0.75240546", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", "0.7497239", ...
0.77026874
0
This function will be mounted on "/" and display a link to the hello world page.
def index(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) return ['''Hello World Application, This is the Hello World application: continue 'hello/\'''']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hello():\n\n return render_template(\"index.html\")", "def hello():\n return render_template(\"hello.html\")", "def say_hello():\n\n return render_template(\"hello.html\")", "def say_hello():\n\n return render_template(\"hello.html\")", "def say_hello():\n\n return render_template(\"hell...
[ "0.7290606", "0.6947661", "0.6810758", "0.6810758", "0.6810758", "0.6810758", "0.6810758", "0.6798115", "0.6768918", "0.6668424", "0.6658271", "0.66356486", "0.6629223", "0.6614598", "0.6583571", "0.6577197", "0.6544257", "0.6541115", "0.6541068", "0.6535857", "0.65182245", ...
0.62497276
85
Check if a GeoDataFrame's CRS is in metric units.
def crs_is_metric(gdf): units = str(gdf_get_projection_unit(gdf)).strip().lower() if units in ['"meter"', '"metre"', "'meter'", "'meter'", 'meter', 'metre']: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_unitary(self):\n if self._coord_format != constants.MatrixCoordinateDefault:\n self._logger.error(\"invalid coordinate format\")\n raise NotImplementedError(\"invalid coordinate format\")\n\n round_precision = int(conf.get(\n self._sc, 'sparkquantum.math.roundP...
[ "0.5981849", "0.58694607", "0.58590096", "0.5813263", "0.5811719", "0.5771861", "0.5771485", "0.5762852", "0.5739014", "0.5737736", "0.5698595", "0.5652033", "0.56376785", "0.5591327", "0.54743767", "0.5450649", "0.543467", "0.5396761", "0.5393853", "0.53742874", "0.5334594",...
0.7648602
0
Returns the interval at the specified time. The time boundaries will rarely exactly match, so choose the minimum distance one. It is also possible to give a time frame and be returned a larger set of Interval objects.
def timedInterval(self, start, end=False): assert type(start) == float interval1 = min( enumerate(self.intervals), key=lambda x: abs(x[1].xmin - start)) if end: assert type(end) == float interval2 = self.timedInterval(end) else: interval2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interval(self, start_time):\n end_time = start_time + self.interval\n return start_time, end_time", "def get_interval(self, start_time):\n end_time = start_time + self.interval\n return start_time, end_time", "def find_nearest_time(self, time):\n\n idx = np.searchsort...
[ "0.59926915", "0.59926915", "0.575057", "0.5740888", "0.57338476", "0.53692067", "0.5289152", "0.5271354", "0.5224472", "0.5200468", "0.51999825", "0.5161145", "0.51391345", "0.51391345", "0.5107938", "0.5093859", "0.5092367", "0.5084862", "0.5049966", "0.5034688", "0.4960163...
0.53892046
5
Returns the annotation at of a tier at that time
def timedAnnotation(self, time): assert type(time) == float tgtInterval = min( enumerate(self.intervals), key=lambda x: abs(x[1].xmin - time)) return tgtInterval.text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(self, tier, tmin, tmax):\n try:\n activity = self.__activity.get_tier(tier, tmin, tmax)\n except Exception as e:\n self.logfile.print_message(\n MSG_EXTRA_TIER.format(\n tiername=\"Activity\", message=str(e)),\n in...
[ "0.58674085", "0.5562899", "0.5559977", "0.5559977", "0.5559977", "0.55436057", "0.55436057", "0.55436057", "0.55436057", "0.5533829", "0.55331033", "0.546274", "0.53679305", "0.5347768", "0.5335169", "0.5330432", "0.53206545", "0.52020615", "0.5174111", "0.5161843", "0.51182...
0.4947794
26
Returns True iff s is a glyph of a phoneme represented in this system
def isPhoneme(s): return consonants.isConsonant(s) or vowels.isVowel(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quick_and_dirty_glyph_is_empty(font, glyph_name):\n if 'glyf' in font:\n glyph = font['glyf'][glyph_name]\n if not glyph.isComposite():\n if glyph.numberOfContours == 0:\n return True\n return False\n elif 'CFF2' in font:\n top_dict = font['CFF2'].cf...
[ "0.606384", "0.60329956", "0.6004109", "0.59446853", "0.59337777", "0.59101826", "0.5829343", "0.5771297", "0.5745845", "0.5731325", "0.5730343", "0.5727013", "0.5721181", "0.5676695", "0.56724817", "0.5670844", "0.56621397", "0.5655802", "0.5634423", "0.5632631", "0.5627889"...
0.67058396
0
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): self.experience_count += 1 index = self.experience_count % self.buffer_size self.current_size += 1 if self.experience_count > self.buffer_size: temp = self.data[index] self.priorities_sum_alpha -= temp[0] ** ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "...
0.544941
69
Return the current size of internal memory.
def __len__(self): return self.current_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573326", "0.82171553", "0.81998456", "0.8086668", "0.80225253", "0.789064", "0.78213847", "0.7800847", "0.77896774", "0.77601296", "0.7756577", "0.7755086", "0.7755086", "0.7753792", "0.7733432", "0.77328944", "0.7719511", "0.7713675", "0.7708304", "0.77068293", "0.769700...
0.0
-1
Expand a count vector to a
def counts_to_vector(counts): return np.hstack([np.repeat(idx, count) for idx, count in enumerate(counts)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_counts(counts):\n result = []\n for i, c in enumerate(counts):\n result.append(zeros(c, int) + i)\n return concatenate(result)", "def test_expand_counts(self):\n c = array([2,0,1,2])\n self.assertEqual(expand_counts(c), array([0,0,2,3,3]))", "def popc(self, count, x):\n...
[ "0.7535366", "0.60593855", "0.5738571", "0.5701257", "0.56513715", "0.56371236", "0.5632318", "0.56078047", "0.5565444", "0.55327976", "0.54835093", "0.54613096", "0.5432958", "0.54224735", "0.53998274", "0.5389778", "0.53818", "0.5356422", "0.53512764", "0.5345853", "0.52994...
0.6972877
1
Returns (x + y + z) (a + b + c)
def f(x, y, z, a = 10, b = 20, c = 30): return((x + y + z) * (a + b + c))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_three(a, b, c):\n return a + b + c", "def func(x, a, b, c):\r\n return a + (b * x) + (c * x * x)", "def sum(a,b,c):\n return (a+b+c)", "def test(self, x, y, z):\n return self.a*x + self.b*y + self.c*z + self.d", "def returnSum(a,b,c):\n return(a+b+c)", "def add_three(v1, v2, v3...
[ "0.7603783", "0.74206", "0.7408711", "0.6924932", "0.69086313", "0.6902098", "0.6852683", "0.68414146", "0.66470605", "0.65238345", "0.65196234", "0.6495425", "0.64560527", "0.64377666", "0.63587", "0.6335642", "0.6318828", "0.62711763", "0.62701666", "0.62407994", "0.6236045...
0.73578054
3
Returns expirt options as defined in Export.EXPORT_OPTION_FIELDS from a list of provided options to be saved with each Export object.
def get_export_options(options): export_options = { key: value for (key, value) in iteritems(options) if key in Export.EXPORT_OPTION_FIELDS } return export_options
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export(self, options_list=None):\n # type: (tp.Optional[tp.List[str]])->tp.Dict[str, tp.Any]\n\n attrs = self._ifAttributes\n if options_list:\n attrs = {}\n for k in options_list:\n try:\n attrs[k] = self._ifAttributes[k]\n ...
[ "0.63221955", "0.5671953", "0.5603324", "0.5597501", "0.5409625", "0.5370441", "0.53594244", "0.53532636", "0.5352231", "0.522452", "0.52163064", "0.5181256", "0.5171268", "0.5089641", "0.50819016", "0.50785035", "0.50554425", "0.5034916", "0.50337946", "0.5031261", "0.501932...
0.7740563
0
Replaces the slashes found in a dataset keys with underscores
def clean_keys_of_slashes(record): for key in list(record): value = record[key] if "/" in key: # replace with _ record[key.replace("/", "_")] = record.pop(key) # Check if the value is a list containing nested dict and apply same if value: if isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _with_underscore(cls, key):\n try:\n return key.replace(\"-\", \"_\")\n except AttributeError:\n return key", "def unders_to_dashes_in_keys(self) -> None:\n for key_node, _ in self.yaml_node.value:\n key_node.value = key_node.value.replace('_', '-')", "...
[ "0.6655938", "0.65296423", "0.65111256", "0.6451741", "0.63575214", "0.6321956", "0.62953603", "0.6280105", "0.62530684", "0.620389", "0.61518854", "0.60695535", "0.6002459", "0.59338766", "0.592122", "0.5914296", "0.58485585", "0.580881", "0.57955664", "0.5764797", "0.576407...
0.6228179
9
Does user have permission to view user app content
def has_module_perms(self, users): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def can_retrieve(self, user):\n return user.has_perm('agenda.can_see')", "def can_view(self, user):\n if self.applicant == user:\n return True\n elif user.has_perm('funding.view_all_applications'):\n # Fundihg commit...
[ "0.82549834", "0.7891296", "0.77812135", "0.7776987", "0.7763085", "0.7659105", "0.7638981", "0.7536315", "0.7493316", "0.74830174", "0.7464136", "0.74166733", "0.7406108", "0.7355435", "0.7331815", "0.732381", "0.7288401", "0.7283987", "0.7281053", "0.72606814", "0.72606814"...
0.6611276
79
Is the user a staff/admin member
def is_staff(self): return self.is_admin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_staff(self):\n\t\treturn self.is_admin", "def is_staff(self):\n # Simplest possible answer: All admins are staff\n return self.is_admin", "def is_staff(self):\n # Simplest possible answer: All admins are staff\n return self.is_admin", "def is_staff(self):\n # Simples...
[ "0.79887366", "0.79568726", "0.79568726", "0.79568726", "0.78844035", "0.78844035", "0.7835049", "0.774796", "0.77264154", "0.7721917", "0.7651979", "0.7576823", "0.75491494", "0.752772", "0.7517199", "0.7459675", "0.7436206", "0.7419501", "0.7410282", "0.73931533", "0.738905...
0.8087661
0