query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns now from datetime. This happens here so we don't need to include datetime in other classes. | def get_time_now():
# type: (none) -> str
now = str(datetime.now())
return now | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _now(self):\n return datetime.datetime.now(datetime.timezone.utc)",
"def _now(self):\n return datetime.datetime.now(datetime.timezone.utc)",
"def _now(self):\n return datetime.datetime.now(datetime.timezone.utc)",
"def _now(self):\n return datetime.datetime.now(datetime.timezo... | [
"0.8018182",
"0.8018182",
"0.8018182",
"0.8018182",
"0.8016096",
"0.7879826",
"0.78730476",
"0.7860593",
"0.78326315",
"0.77727103",
"0.77727103",
"0.7702856",
"0.76916915",
"0.7674791",
"0.76706886",
"0.7637318",
"0.76232517",
"0.7614057",
"0.76028574",
"0.7567811",
"0.75233... | 0.69382465 | 64 |
Return value of the default image path | def default_image_path(hass: Any, config_entry: Any) -> str:
updated_config = config_entry.data.copy()
# Set default image path (internal use)
if const.CONF_PATH not in config_entry.data.keys():
return "images/mail_and_packages/"
# Set default image path (external use if enabled)
elif con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_default_path(self):\n return os.path.join(cfg.DATA_DIR, 'ImageNet' + self._year)",
"def img_path(self):\n return 'images/door.png'",
"def img_path(self):\n return 'images/key.png'",
"def image_url(self):\n default = \"/static/images/default_profile.png\"\n if self.... | [
"0.77014554",
"0.73098105",
"0.72408205",
"0.7195866",
"0.70916474",
"0.7000217",
"0.6999563",
"0.6990981",
"0.69719946",
"0.69232464",
"0.69223994",
"0.6884695",
"0.68802",
"0.6866691",
"0.6859001",
"0.6848916",
"0.6834804",
"0.6812609",
"0.679909",
"0.6747251",
"0.67291373"... | 0.74457073 | 1 |
Returns today in specific format | def get_formatted_date() -> str:
today = datetime.datetime.today().strftime("%d-%b-%Y")
#
# for testing
# today = "11-Jan-2021"
#
return today | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def today_date():\n today = datetime.date.today()\n date_str = '%d-%d-%d'%(today.year, today.month, today.day)\n return date_str",
"def _today():\n return datetime.datetime.now().strftime(\"%Y-%m-%d\")",
"def get_today():\n return time.strftime('%Y%m%d', time.localtime())",
"def get_date(): \n... | [
"0.8072311",
"0.79156893",
"0.78443533",
"0.769223",
"0.7682533",
"0.7437891",
"0.7405089",
"0.73560697",
"0.7348091",
"0.7332363",
"0.7308105",
"0.7276399",
"0.7266107",
"0.72631824",
"0.7254109",
"0.71834433",
"0.71745",
"0.7132224",
"0.71298766",
"0.7118118",
"0.70895416",... | 0.75907063 | 5 |
Get temperature. Process preferred, otherwise internal. | async def get_temperature(self) -> float:
if process_t := await self.process_temperature():
return process_t
return await self.internal_temperature() # type: ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temperature(self, device):\n smart_data = self.get_smart_data(device)\n temperature = int(self.get_parameter_from_smart(smart_data, \\\n 'Temperature_Celsius', 10))\n dev_log(device, temperature)\n return temperature",
"def get_temper... | [
"0.7834135",
"0.7824017",
"0.7761735",
"0.77308357",
"0.7726234",
"0.76958185",
"0.76833",
"0.76652384",
"0.7662983",
"0.76300585",
"0.76248896",
"0.7623278",
"0.756857",
"0.7549799",
"0.7535831",
"0.752761",
"0.752761",
"0.75267166",
"0.75221956",
"0.7521571",
"0.7513055",
... | 0.83564353 | 0 |
Return internal temp (bath temperature). | async def internal_temperature(self) -> float | None:
reply = await self._send_command_and_read_reply("{M01****")
return PBCommand(reply).parse_temperature() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internalTemperature(self):\n return self.T_int",
"def temperature(self):\n self._perform_measurement()\n self._temp = ((self._buf[3] & 0xF) << 16) | (self._buf[4] << 8) | self._buf[5]\n self._temp = ((self._temp * 200.0) / 0x100000) - 50\n return self._temp",
"def tempera... | [
"0.8070371",
"0.7935924",
"0.784475",
"0.78122675",
"0.7786363",
"0.7745703",
"0.77201694",
"0.76956075",
"0.76576376",
"0.76375437",
"0.76215154",
"0.75873774",
"0.75645113",
"0.75645113",
"0.75546354",
"0.7526731",
"0.7520761",
"0.7520761",
"0.7520761",
"0.7518613",
"0.7508... | 0.74273944 | 23 |
Return the current process temperature. If not T probe, the temperature is None. | async def process_temperature(self) -> float | None:
reply = await self._send_command_and_read_reply("{M3A****")
return PBCommand(reply).parse_temperature() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_temperature(self) -> float:\n if process_t := await self.process_temperature():\n return process_t\n return await self.internal_temperature() # type: ignore",
"def current_temperature(self) -> Optional[float]:\n return (\n self._evo_device.temperatureStat... | [
"0.8079025",
"0.74966013",
"0.7492043",
"0.74498546",
"0.7413065",
"0.7406407",
"0.73970616",
"0.7388295",
"0.7385242",
"0.73243505",
"0.73233664",
"0.7311189",
"0.7285766",
"0.7279586",
"0.72712064",
"0.726532",
"0.7250897",
"0.7218087",
"0.7202547",
"0.71993625",
"0.7171778... | 0.6788918 | 80 |
Returns an array corresponding to a list of (x, y, 0) sensor positions in world coordinates. | def sensor_pos(self, state):
sensors, r = self.sensors, self.agent_radius
x, y, theta = state
n = len(sensors)
result = np.zeros((n, 3))
# copy robot x, y into sensors
result[:, 0:2] = state[0:2]
angles = theta + sensors
result[:, 0] = r * np.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loc_list_to_array(station_list):\n \n xy = [[l.x, l.y] for l in station_list]\n return np.array(xy)",
"def xy(self):\n m = self.__len__()\n x = array(\"d\")\n y = array(\"d\")\n for i in range(m):\n xy = self._coords[i].tolist()\n x.append(xy[0])\n ... | [
"0.70576847",
"0.70306635",
"0.68313134",
"0.6816292",
"0.68081784",
"0.67702305",
"0.67414224",
"0.6678634",
"0.6663902",
"0.6660704",
"0.6622681",
"0.6608321",
"0.65825075",
"0.6573143",
"0.6563148",
"0.6461211",
"0.643028",
"0.6414088",
"0.63808995",
"0.63767105",
"0.63743... | 0.6482909 | 15 |
Returns a vector of sensor reading values for a particular agent state (position and orientation). Noise is added to the raw luminance at the sensor's location and the result is rescaled to the (0, 1) interval. | def sense(self, state):
activation = self.sensor_input(state) + self.sensor_rv.sample()
# and rescale to (0, 1) interval
return self.sensor_transform(activation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sensor_input(self, state):\r\n # various relevant parameters\r\n r, K = self.agent_radius, self.luminance\r\n # light position\r\n l_pos = self.light_pos\r\n\r\n # unpack 3D position and heading from (x, y, theta) state\r\n pos, theta = np.array(tuple(state[0:2]) + (0,... | [
"0.654202",
"0.6202204",
"0.600128",
"0.58981025",
"0.5853717",
"0.5823103",
"0.58198225",
"0.57092774",
"0.56724435",
"0.55544066",
"0.5544854",
"0.5544317",
"0.55267155",
"0.5472252",
"0.546992",
"0.54253906",
"0.54179686",
"0.5400143",
"0.5362244",
"0.5356112",
"0.53501594... | 0.6087306 | 2 |
Returns a probability density value for the likelihood of a particular sensor reading vector given a particular agent state. | def p_sensation(self, state, sensation):
# invert rescaling operation to find the original activations
sensor_activation = self.sensor_inverse_transform(sensation)
# determine the actual luminance at the sensors
sensor_input = self.sensor_input(state)
# interrogate the RV ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_density(self, density):\n raise NotImplementedError",
"def density():\n\tpass",
"def state_likelihood(self,beta,alpha):\n\n _, _, _, Q = self._ss_matrices(beta)\n state_lik = 0\n for i in range(alpha.shape[0]):\n state_lik += np.sum(ss.norm.logpdf(alpha[i][1:]-alp... | [
"0.5882582",
"0.5801411",
"0.57795864",
"0.5648602",
"0.5647719",
"0.5606752",
"0.55829525",
"0.5574127",
"0.55618244",
"0.5554194",
"0.54826313",
"0.54551464",
"0.54507154",
"0.54452974",
"0.5442627",
"0.54237586",
"0.5422098",
"0.54186755",
"0.54119664",
"0.5374053",
"0.535... | 0.5854292 | 1 |
Compute the logarithm of a tensor. | def log(tensor: ITensor) -> ITensor:
return Tensor(data=tf.log(tensor.native), trainable=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(inputs):\n return torch.log(inputs)",
"def log(x):\n return LogOp(x)",
"def _logit(x):\n\treturn numpy.log(x / (1. - x)).astype(theano.config.floatX)",
"def log(x):\n return tf.log(tf.clip_by_value(x, 1e-10, 1.0))",
"def logsoftmax(input_tensor):\n return input_tensor - reduce_logsumexp(i... | [
"0.7722191",
"0.7397379",
"0.7389391",
"0.73530376",
"0.73231375",
"0.7287639",
"0.723609",
"0.7111559",
"0.70787054",
"0.7025907",
"0.7025907",
"0.69802177",
"0.695141",
"0.6935952",
"0.69226265",
"0.6917034",
"0.69110465",
"0.6875144",
"0.6824641",
"0.68138874",
"0.6805783"... | 0.78651285 | 0 |
Get number of rows. | def n_rows(self):
return self._n_rows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetNumberRows(self): \n\t\treturn self.numberOfRows",
"def num_rows(self):\n return self.get_info()['num_rows']",
"def get_rows_count(self) -> int:\r\n raise NotImplementedError",
"def count (self):\n return self._table.nrows",
"def get_row_count(self):\r\n try:\r\n ... | [
"0.87787104",
"0.86760056",
"0.8583201",
"0.85066056",
"0.8453202",
"0.839359",
"0.83839935",
"0.8383722",
"0.8297495",
"0.8283721",
"0.826208",
"0.82581544",
"0.82282734",
"0.8210394",
"0.8186855",
"0.8145535",
"0.81414247",
"0.81353563",
"0.8129066",
"0.805935",
"0.8028862"... | 0.8138807 | 17 |
Examples >>> import numpy as np >>> optima = [[0.0898, 0.7126], [0.0898, 0.7126]] >>> f_opt = 1.03162842 >>> np.allclose([camelback(optimum) for optimum in optima], f_opt) True | def camelback(x):
y = (4 - 2.1 * (x[0] ** 2) + ((x[0] ** 4) / 3)) * \
(x[0] ** 2) + x[0] * x[1] + (-4 + 4 * (x[1] ** 2)) * (x[1] ** 2)
return y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_optima_enlarged(self):\n for name in self.function_list:\n for dim in [1, 2, 5, 10, 20]:\n bb = tf.TestEnlargedBlackBox(name, dim)\n self.assertAlmostEqual(bb.evaluate(bb.optimum_point),\n bb.optimum_value,\n ... | [
"0.5162833",
"0.5023898",
"0.49298906",
"0.48371923",
"0.4735564",
"0.46617243",
"0.46610713",
"0.46400753",
"0.45855075",
"0.45667943",
"0.45665067",
"0.4559082",
"0.45588082",
"0.45494667",
"0.45487225",
"0.45190108",
"0.4518999",
"0.4518725",
"0.45152512",
"0.45149115",
"0... | 0.48416752 | 3 |
Create a scope class instance based on the configuration file path supplied as a parameter. return an instance of scass.scope.Scope or None. | def loadScope(config_path):
return scass.scope.fromConfig(config_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope(self, *args, **kwargs) -> Scope:\n return self._retrieve_singular(self.scopes, *args, **kwargs)",
"def make_config_instance(path):\n\n config = Config()\n\n config.load(path)\n\n config.validate()\n\n return config",
"def get(config_path):\n with open(config_path, \"r\") as conf... | [
"0.5694982",
"0.55522716",
"0.551194",
"0.53278923",
"0.525406",
"0.5210848",
"0.5183537",
"0.51416445",
"0.5093726",
"0.5070515",
"0.50414723",
"0.5035886",
"0.49904147",
"0.49535084",
"0.49422678",
"0.4925812",
"0.49225163",
"0.49209565",
"0.49053636",
"0.48843995",
"0.4883... | 0.7957007 | 0 |
Return the ArgumentParser object used to parse command line arguments to the CLI app. | def buildArgParser():
parser = argparse.ArgumentParser()
parser.set_defaults(func=commandCapture)
parser.add_argument("experiment", type=str,
help="Path to experiment directory containing a experiment_flow.py script")
parser.add_argument("device", type=str,
help="Path to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_argument_parser():\n parser = argparse.ArgumentParser(description='trimmomatic',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n\n add_arguments_to_parser(parser)\n return parser",
"def arg_parser():\n return argparse.ArgumentParser(\n fo... | [
"0.77629757",
"0.77160025",
"0.7706291",
"0.7689366",
"0.7633107",
"0.747035",
"0.7460409",
"0.74434096",
"0.7437816",
"0.7402864",
"0.7353033",
"0.7352779",
"0.7347157",
"0.73434985",
"0.73415846",
"0.733921",
"0.73202765",
"0.73165727",
"0.73161316",
"0.73023427",
"0.729754... | 0.0 | -1 |
Sets the input tensor. | def set_input_tensor(interpreter, image):
#log.warning(interpreter.get_input_details()[0]['index'])
tensor_index = interpreter.get_input_details()[0]['index']
input_tensor = interpreter.tensor(tensor_index)()[0]
input_tensor[:, :] = image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_input_tensor(self, input_tensor):\n self.input_tensor = input_tensor",
"def set_input_tensor(self, image):\n tensor_index = self._interpreter.get_input_details()[0]['index']\n input_tensor = self._interpreter.tensor(tensor_index)()[0]\n input_tensor[:, :] = image",
"def set_... | [
"0.86910105",
"0.78338546",
"0.7518752",
"0.7483206",
"0.7291172",
"0.7291172",
"0.6987059",
"0.6924514",
"0.67858684",
"0.67499197",
"0.67430186",
"0.67002153",
"0.6647317",
"0.6647317",
"0.6571415",
"0.6565527",
"0.65528315",
"0.6463629",
"0.64421576",
"0.63805175",
"0.6380... | 0.7532146 | 2 |
Returns the output tensor at the given index. | def get_output_tensor(interpreter, index):
output_details = interpreter.get_output_details()[index]
tensor = np.squeeze(interpreter.get_tensor(output_details['index']))
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_tensor(self, index) -> np.ndarray:\n output_details = self._interpreter.get_output_details()[index]\n tensor = np.squeeze(self._interpreter.get_tensor(output_details['index']))\n\n return tensor",
"def get_output_tensor(interpreter, index):\n output_details = interpreter.get_... | [
"0.8588016",
"0.8473132",
"0.8473132",
"0.8473132",
"0.84236956",
"0.73207355",
"0.7265836",
"0.6890047",
"0.6759862",
"0.66948026",
"0.6614312",
"0.6602761",
"0.653903",
"0.64080614",
"0.62412524",
"0.6142005",
"0.610645",
"0.60945153",
"0.6062034",
"0.60246843",
"0.6023404"... | 0.8460146 | 4 |
Return the distance between this location and another location. Distance is measured in blocks. | def distance(self, other):
dx = (self.x - other.x)**2
dy = (self.y - other.y)**2
dz = (self.z - other.z)**2
return sqrt(dx + dy + dz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distance(location, other_location):\n return location.distance(other_location)",
"def distance(self, b):\n return np.sqrt(np.sum((self.location-b.location)**2))",
"def calc_distance(self, other):\n longitude_diff = (self.__longitude - other.__longitude) * \\\n WayPoint.DIS... | [
"0.74312997",
"0.72048014",
"0.7172302",
"0.7108047",
"0.70682734",
"0.7017543",
"0.6971699",
"0.69646233",
"0.6961686",
"0.69074434",
"0.6892055",
"0.6892055",
"0.6892055",
"0.6892055",
"0.6871177",
"0.6868186",
"0.6835909",
"0.6794726",
"0.6782927",
"0.67820317",
"0.6776535... | 0.6600048 | 33 |
Generate a random symmetric positive matrix representing the adjacency matrix. I.e. a weighted undirected and fully connected graph. | def get_adjacency_matrix(cities: List[str], d_max: int) -> AdjacencyMatrixType:
N = len(cities)
adjacency_matrix = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(i + 1, N):
if random() > 0.8:
val = randrange(d_max // 3)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_graph():\n graph_size = 500\n p = 0.3\n\n A = sp.sparse.random(graph_size, graph_size, p, format='csr')\n nx_graph = nx.from_scipy_sparse_matrix(A, create_using=nx.DiGraph())\n\n iG = igraph.Graph(list(nx_graph.edges()), directed=True)\n iG.es['weight'] = A.data\n\n return A, nx... | [
"0.74730706",
"0.73445654",
"0.6500712",
"0.64731294",
"0.644085",
"0.642953",
"0.6418853",
"0.63976824",
"0.6296001",
"0.62932175",
"0.62828714",
"0.62086284",
"0.6199745",
"0.615935",
"0.6133901",
"0.6125394",
"0.6102024",
"0.6089546",
"0.6066514",
"0.60270524",
"0.6001434"... | 0.5743053 | 45 |
returns the int percentage of health remaining | def getHitPointPercent(self):
percent = self.getHitPoints() * 100 / self.getMaxHP()
return int(percent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent(self) -> int:\n return pulumi.get(self, \"percent\")",
"def percent_remaining(self):\n return self.remaining_demand / self.requested_energy",
"def percent(self):\n\t\treturn self.apm.percent()",
"def loss_percentage(self, return_on_div_by_zero='n/a'):\n if self.battle_count()... | [
"0.761897",
"0.73335373",
"0.7312741",
"0.71853817",
"0.7093201",
"0.70436907",
"0.6947394",
"0.69277084",
"0.6911639",
"0.6890629",
"0.6873363",
"0.6809581",
"0.68002796",
"0.6755292",
"0.6740206",
"0.67323583",
"0.67016244",
"0.6684251",
"0.6682787",
"0.66817963",
"0.666370... | 0.71488756 | 4 |
set the character's exp to the amount required for next level | def setExpForLevel(self):
self._expToNextLevel = 2 ** (9 + self.getLevel()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_up(self):\r\n assert self.check_level_up()\r\n self.level += 1\r\n self.exp = 0\r\n self.exp_cap **= constants.EXP_MULTIPLIER",
"def exp_level(self, exp_level):\n\n self._exp_level = exp_level",
"def gain_exp(player, monster):\n\n\texp = ((monster.actual_level * 10)... | [
"0.6905931",
"0.6780937",
"0.66611904",
"0.65852654",
"0.63394386",
"0.6311979",
"0.62769985",
"0.61450016",
"0.60992265",
"0.5975277",
"0.5966683",
"0.59512264",
"0.5886196",
"0.58738494",
"0.5817044",
"0.57448",
"0.57351214",
"0.56948304",
"0.56825507",
"0.56786454",
"0.567... | 0.76333755 | 0 |
returns equipped armor and/or shield, as a list | def getEquippedProtection(self):
armor = self.getEquippedArmor()
shield = self.getEquippedShield()
objList = []
if armor:
objList.append(armor)
if shield:
objList.append(shield)
return objList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_equipment_list(building, pymortar_client):\n\n #Get unique list of equipment\n v = pymortar.View(\n name=\"equipment\",\n definition=\"\"\"\n SELECT ?equipname ?equipclass ?point ?pointclass FROM %s WHERE {\n ?equipclass rdfs:subClassOf+ brick:Equipment .\n ... | [
"0.6460828",
"0.64499587",
"0.63050383",
"0.6268165",
"0.62605083",
"0.6030563",
"0.60188836",
"0.5969746",
"0.5926017",
"0.5850141",
"0.58166146",
"0.579289",
"0.5773134",
"0.5715656",
"0.57144606",
"0.5641594",
"0.5570835",
"0.5566761",
"0.5535897",
"0.55282027",
"0.5494349... | 0.75364554 | 0 |
equip fist, the default weapon fist is a special weapon that is not in any inventory | def equipFist(self):
obj = Weapon()
obj.setName("fist")
obj._article = "a"
obj._singledesc = "fist"
obj.setMaximumDamage(self.getFistDamage())
self.equip(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip_random_weapon(self, **kwargs):\n all_types = (\"rock\", \"paper\", \"scissors\", \"lizard\", \"spock\")\n weapon_types = all_types\n\n \"\"\"\n This is used to avoid draws\n \"\"\"\n if \"avoid_weapon_type\" in kwargs:\n avoid = kwargs[\"avoid_weapon_t... | [
"0.78642523",
"0.7572121",
"0.7183313",
"0.71526986",
"0.70851016",
"0.7002636",
"0.691775",
"0.68661016",
"0.6764495",
"0.6760254",
"0.6682745",
"0.66532564",
"0.66232795",
"0.66232795",
"0.66232795",
"0.64195055",
"0.63359797",
"0.6310329",
"0.6306007",
"0.62900317",
"0.627... | 0.7456791 | 2 |
Get the name of the running program | def get_program_name():
program_name = sys.argv[0]
if not program_name.startswith("./"):
program_name = os.path.basename(program_name)
return program_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_program_name():\n return __name__",
"def get_prog_name(self):\n return self.prog",
"def program_name(self):\n return \"./spooner.py\"",
"def program_name(self):\n return \"./rhymer.py\"",
"def getApplication():\n\n return os.path.splitext(os.path.split(getExecutable())[1... | [
"0.8595299",
"0.80492157",
"0.7827188",
"0.7559489",
"0.7279705",
"0.7092296",
"0.69482094",
"0.69467014",
"0.6937906",
"0.6918824",
"0.68695915",
"0.6866371",
"0.68623227",
"0.67986774",
"0.67378193",
"0.67378193",
"0.672664",
"0.6713624",
"0.66918117",
"0.6687046",
"0.66865... | 0.81634635 | 1 |
Write requirements (python modules) to file for reproducibility. Note that this only stores the modules that have been imported, and that have a `__version__`attribute (see PEP | def write_requirements():
# Find versions of imported modules (use list() for copy in case modules are imported when reading __version__)
reqs = {n: getattr(m, "__version__", None) for n, m in list(sys.modules.items())}
reqs["python"] = platform.python_version()
reqs_str = "\n".join(sorted("{}=={}".form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requirements_file():\n pip_freeze = _pip_requirements_utils.get_pip_freeze()\n pip_freeze = _pip_requirements_utils.clean_reqs_file_lines(pip_freeze)\n\n with tempfile.NamedTemporaryFile(\"w+\") as tempf:\n tempf.write(\"\\n\".join(pip_freeze))\n tempf.flush() # flush object buffer\n ... | [
"0.6682651",
"0.6549409",
"0.6500982",
"0.6126898",
"0.6120657",
"0.60325587",
"0.5963807",
"0.59502035",
"0.58939934",
"0.58839434",
"0.587519",
"0.58550745",
"0.5773158",
"0.57726717",
"0.57688093",
"0.5759056",
"0.5718179",
"0.5705003",
"0.56831723",
"0.56824374",
"0.56801... | 0.833945 | 0 |
Returns the admin dashboard defined in settings (or the default one). | def get_index_dashboard(context):
return _get_dashboard_cls(getattr(
settings,
'GRAPPELLI_INDEX_DASHBOARD',
'grappelli.dashboard.dashboards.DefaultIndexDashboard'
), context)() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dashboard(DashboardName=None):\n pass",
"def get_full_dashboard(self) -> Dashboard:\n response = self._http_client.make_request(f\"/api/config/v1/dashboards/{self.id}\").json()\n return Dashboard(self._http_client, None, response)",
"def dashboard(self) -> Dashboard:\n return se... | [
"0.74337924",
"0.6640093",
"0.65540415",
"0.65201664",
"0.6475574",
"0.6451028",
"0.62420017",
"0.61871415",
"0.6172611",
"0.6172611",
"0.6105626",
"0.60891634",
"0.6068121",
"0.6058385",
"0.605533",
"0.60302943",
"0.60267884",
"0.6024283",
"0.5978652",
"0.5933111",
"0.593069... | 0.56615436 | 48 |
Returns (model, perm,) for all models that match models/exclude patterns and are visible by current user. | def filter_models(request, models, exclude):
items = get_avail_models(request)
included = []
full_name = lambda model: '%s.%s' % (model.__module__, model.__name__)
# I beleive that that implemented
# O(len(patterns)*len(matched_patterns)*len(all_models))
# algorythm is fine for model lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_perms(self, request):\n return {}",
"def get_model_perms(self, request):\r\n return {}",
"def get_model_perms(self, request):\n return {}",
"def get_model_perms(self, request):\n return {}",
"def get_model_perms(self, request):\n return {}",
"def get_m... | [
"0.64932585",
"0.6483176",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.64587015",
"0.60897446",
"0.60897446",
"0.60897446",
"0.60897446",
"0.60846984",
"0.60436875",
"0.58314544",... | 0.5809251 | 20 |
Return the root of the Tree. Keep this value safe, and the integrity of the set is guaranteed. | def root(self):
return self.root_hash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root(self):\n # type: () -> tree_node.TreeNode\n return self._root",
"def getRoot(self):\n\t\treturn self.root;",
"def get_tree_root(self):\n root = self\n while root.up is not None:\n root = root.up\n return root",
"def get_root(self: object) -> BinaryTreeNo... | [
"0.7821935",
"0.77266353",
"0.7685936",
"0.7604717",
"0.75676",
"0.7548477",
"0.75319403",
"0.75095594",
"0.75095594",
"0.7494317",
"0.7490265",
"0.73576224",
"0.7169847",
"0.7169847",
"0.7169847",
"0.7169847",
"0.7169847",
"0.7106867",
"0.7087619",
"0.7048966",
"0.7048792",
... | 0.686873 | 30 |
Get or set the GPIB address for this context. To get the addresses of available devices, use the list_devices setting. | def address(self, c, addr=None):
if addr is not None:
c['addr'] = addr
return c['addr'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address(self):\n if self.dev is not None:\n return self.dev.address\n else:\n return None",
"def setAddr(self):#{{{\n self.serial.write('++addr '+str(self.gpibAddr)+'\\r')#}}}",
"def get_address(self):\n\n return self._control_addr",
"def pci_address(self... | [
"0.6537526",
"0.6065417",
"0.59938",
"0.58789426",
"0.58549184",
"0.58150256",
"0.5733233",
"0.5733233",
"0.57327515",
"0.5698613",
"0.5693872",
"0.56888044",
"0.56888044",
"0.5666347",
"0.5653815",
"0.56183636",
"0.5603234",
"0.5603234",
"0.5603234",
"0.5603234",
"0.5603234"... | 0.5030808 | 100 |
Instantiates a new binary tree node | def __init__(self, value):
self.value = value
self.left = None
self.right = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_simple_tree():\n node = TreeNode(1)\n node.left = TreeNode(2)\n node.right = TreeNode(3)\n node.right.left = TreeNode(4)\n node.right.right = TreeNode(5)\n return node",
"def __init__(self):\n self.root: TreeNode = TreeNode(None)",
"def __init__(self):\r\n self.root = ... | [
"0.7752595",
"0.74496216",
"0.7258401",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.7195324",
"0.71623564",
"0.71565515",
"0.7130455",
"0.71222734",
"0.71160924",
"0.710301",... | 0.6578389 | 44 |
Instantiates a new linked list | def __init__(self):
self.root = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,seq):\n self.head = None\n for item in seq:\n node = ListNode(item)\n node.next = self.head\n self.head = node",
"def __init__(self):\n self.head = ListNode()",
"def linkedlist():\n return sll.SLinkedList()",
"def __init__(self, pytho... | [
"0.7432292",
"0.7402296",
"0.7105103",
"0.707853",
"0.7040119",
"0.7026356",
"0.70038444",
"0.6927509",
"0.6926229",
"0.691046",
"0.6903229",
"0.6877521",
"0.6848232",
"0.6754164",
"0.6744906",
"0.6735196",
"0.67260766",
"0.6670267",
"0.666214",
"0.66573995",
"0.6645003",
"... | 0.0 | -1 |
Get the current bed temperature | def get_bed_temp(self):
r = self.s.get(self.base_address + '/api/printer/bed')
if r.status_code != 200:
raise Exception("Error: {code} - {content}".format(code=r.status_code, content=r.content.decode('utf-8')))
data = r.content.decode('utf-8').split('\n')
for line in data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_temperature(self):\n return self.device.temperature.value",
"def get_Temperature(self):\n return self.temperature",
"def getTemp(self):\n return self.sensor.get_temperature()",
"def current_temperature(self):\n return self._device_data[\"temperature\"]",
"def current... | [
"0.7881592",
"0.78423446",
"0.7832626",
"0.7825576",
"0.7802203",
"0.7790866",
"0.7790866",
"0.7790866",
"0.77857983",
"0.77400666",
"0.77400666",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.77224207",
"0.... | 0.8353969 | 0 |
Get the target extruder temperature in degrees celsius | def get_extruder_target_temp(self):
r = self.s.get(self.base_address + '/api/printer/tool')
if r.status_code != 200:
raise Exception("Error: {code} - {content}".format(code=r.status_code, content=r.content.decode('utf-8')))
data = r.content.decode('utf-8').split('\n')
for li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_temperature(self):\n heat_target = int(self._device.state.heat_target) / 10\n return int(heat_target - 273)",
"def target_temperature(self):\n return self.device.target_temperature.value",
"def target_temperature(self):\n return self._target_temp",
"def target_temperatu... | [
"0.8076788",
"0.8048411",
"0.8015457",
"0.8015457",
"0.79643005",
"0.79455376",
"0.7917508",
"0.79122233",
"0.78914833",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7866113",
"0.7814813",
"0.7776209",
"0.772029",
"0.77010566",... | 0.8308877 | 0 |
Get the current extruder temperature in degrees celsius | def get_extruder_current_temp(self):
r = self.s.get(self.base_address + '/api/printer/tool')
if r.status_code != 200:
raise Exception("Error: {code} - {content}".format(code=r.status_code, content=r.content.decode('utf-8')))
data = r.content.decode('utf-8').split('\n')
for l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temperature(self):\n\t\tt = self._i2c.readfrom_mem(self._addr, 0x0E, 2)\n\t\treturn (t[0] + t[1]*256) * 0.0625;",
"def temperature(self):\n temperature = self._read_dht11()[_TEMPERATURE_INDEX]\n return temperature",
"def getTemp(self):\n return self.sensor.get_temperature()",
"def te... | [
"0.8200518",
"0.811118",
"0.8100547",
"0.8100325",
"0.806719",
"0.80660313",
"0.80140454",
"0.8013737",
"0.79948145",
"0.79918593",
"0.79859823",
"0.79857075",
"0.79691017",
"0.7947089",
"0.7944222",
"0.7944222",
"0.79439914",
"0.793732",
"0.79318064",
"0.78965825",
"0.788654... | 0.73823225 | 74 |
tests Base's to_json_string method | def test_json_method(self):
r1 = Rectangle(4, 5, 6, 7, 8)
r2 = Rectangle(10, 11, 12, 13, 14)
d1 = r1.to_dictionary()
d2 = r2.to_dictionary()
json_dict = Base.to_json_string([d1, d2])
j_d = eval(json_dict)
self.assertEqual(j_d[0]['id'], 8)
self.assertEqual(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_json_string(self):\n a = Base.to_json_string([])\n self.assertEqual(a, \"[]\")\n a = Base.to_json_string([{'plushie': 'kingdom'}])\n self.assertEqual(a, '[{\"plushie\": \"kingdom\"}]')\n a = {'x': 0, 'y': 0, 'width': 2, 'height': 4, 'id': 999}\n b = Base.to_json_s... | [
"0.822264",
"0.79944104",
"0.7739698",
"0.7486256",
"0.7215612",
"0.71843064",
"0.7147753",
"0.7105154",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.70455927",
"0.... | 0.0 | -1 |
Tests from_json_string th an empty string | def test_fjs_None(self):
self.assertEqual([], Base.from_json_string(None)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_from_json_empty(self):\n d_list = Base.from_json_string(\"\")\n self.assertEqual(len(d_list), 0)\n d_list = Base.from_json_string(None)\n self.assertEqual(len(d_list), 0)",
"def verify_json_zero_ok(json_str):\n data = json.loads(json_str)\n assert data is not None",
"... | [
"0.80444825",
"0.7390149",
"0.72279674",
"0.7101597",
"0.69858277",
"0.69162315",
"0.69162315",
"0.6898188",
"0.6898188",
"0.68775034",
"0.6788824",
"0.6788824",
"0.6775318",
"0.6723148",
"0.6683994",
"0.6683994",
"0.6683994",
"0.6683994",
"0.66725487",
"0.6585595",
"0.656641... | 0.6503336 | 25 |
Creates a tf.Summary proto with the given name and value. | def MakeSummary(name, value):
summary = tf.Summary()
val = summary.value.add()
val.tag = str(name)
val.simple_value = float(value)
return summary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_summary(value, tag, summary_writer, global_step):\n summary = tf.Summary()\n summary.value.add(tag=tag, simple_value=value)\n summary_writer.add_summary(summary, global_step)",
"def write_summary(value, tag, summary_writer, global_step): #生成标量图\n summary = tf.Summary()\n summary.value.ad... | [
"0.72457606",
"0.7110388",
"0.7071901",
"0.7071901",
"0.7061095",
"0.7035876",
"0.7012273",
"0.69031906",
"0.68717283",
"0.68585616",
"0.6855575",
"0.67585295",
"0.67365074",
"0.67052245",
"0.65632945",
"0.6489194",
"0.6481564",
"0.6392166",
"0.639038",
"0.6373839",
"0.635717... | 0.87070477 | 0 |
Create a new VAE test problem instance on MNIST. | def __init__(self, batch_size, weight_decay=None):
super(mnist_vae, self).__init__(batch_size, weight_decay)
if weight_decay is not None:
print(
"WARNING: Weight decay is non-zero but no weight decay is used",
"for this model."
)
self.los... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_size, model_input_size, model):\n self._input_size = input_size\n self._model_input_size = model_input_size\n\n if model is None:\n disable_model = 1\n temporal_model = 0\n elif model == \"yuv\":\n disable_model = 0\n temporal_model = 0\n elif model == \"... | [
"0.61636597",
"0.59642905",
"0.58946836",
"0.5774996",
"0.57339567",
"0.57070786",
"0.56588304",
"0.5639221",
"0.56118083",
"0.5582575",
"0.5577658",
"0.5565091",
"0.55592155",
"0.55372983",
"0.5527288",
"0.5519959",
"0.55000424",
"0.54960847",
"0.5485539",
"0.5484618",
"0.54... | 0.0 | -1 |
Delete one or more messages from the currently selected folder. Returns the flags set for each modified message (see get_flags). | def delete_messages(self, messages):
return self.add_flags(messages, DELETED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_messages(self, messages: List[int], folder: str = 'INBOX', expunge: bool = True, **connect_args):\n self.add_flags(messages, ['Deleted'], folder=folder, **connect_args)\n if expunge:\n self.expunge_messages(folder=folder, messages=messages, **connect_args)",
"def undelete_mess... | [
"0.79619384",
"0.7681977",
"0.7261195",
"0.71876997",
"0.69545376",
"0.6216631",
"0.61658573",
"0.60859174",
"0.6034696",
"0.59718",
"0.59482825",
"0.58997035",
"0.5888983",
"0.5870065",
"0.58693105",
"0.5867098",
"0.58547086",
"0.58349866",
"0.58123416",
"0.5805294",
"0.5753... | 0.76912445 | 1 |
Append a message to folder. msg should be a string contains the full message including headers. flags should be a sequence of message flags to set. If not specified no flags will be set. msg_time is an optional datetime instance specifying the date and time to set on the message. The server will set a time if it isn't ... | def append(self, folder, msg, flags=(), msg_time=None):
if msg_time:
time_val = '"%s"' % datetime_to_imap(msg_time)
else:
time_val = None
return self._command_and_check('append',
self._encode_folder_name(folder),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, folder, msg, flags=(), msg_time=None):\r\n if msg_time:\r\n time_val = time.mktime(msg_time.timetuple())\r\n else:\r\n time_val = None\r\n\r\n flags_list = seq_to_parenlist(flags)\r\n\r\n typ, data = self._imap.append(self._encode_folder_name(folde... | [
"0.77928156",
"0.5901614",
"0.5865479",
"0.56079596",
"0.5607914",
"0.5533723",
"0.5487262",
"0.54416716",
"0.5363713",
"0.5337516",
"0.5318488",
"0.5312493",
"0.5289177",
"0.5287453",
"0.5232302",
"0.521686",
"0.5206699",
"0.51704234",
"0.50723326",
"0.50598216",
"0.50430197... | 0.82482463 | 0 |
Remove any messages from the currently selected folder that have the ``\\Deleted`` flag set. The return value is the server response message | def expunge(self):
tag = self._imap._command('EXPUNGE')
return self._consume_until_tagged_response(tag, 'EXPUNGE') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undelete_messages(self, messages: List[int], folder: str = 'INBOX', **connect_args):\n return self.remove_flags(messages, ['Deleted'], folder=folder, **connect_args)",
"def delete_message(self): # TODO: UX, make sure the user wants to delete the message\n conn = self.controller.controller.get_... | [
"0.73190045",
"0.72398573",
"0.7175764",
"0.7001723",
"0.666303",
"0.66520226",
"0.63461727",
"0.62383693",
"0.62254393",
"0.6121293",
"0.6106514",
"0.5977651",
"0.5972373",
"0.5969603",
"0.5954938",
"0.59496194",
"0.58767647",
"0.5839321",
"0.58109236",
"0.58103895",
"0.5799... | 0.0 | -1 |
Convert a datetime instance to a IMAP datetime string. If timezone information is missing the current system timezone is used. | def datetime_to_imap(dt):
if not dt.tzinfo:
dt = dt.replace(tzinfo=FixedOffset.for_system())
return dt.strftime("%d-%b-%Y %H:%M:%S %z") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_datetime(time_obj):\n timestamp = time_obj.isoformat('T')\n if time_obj.tzinfo == tzutc():\n timestamp = timestamp[:-6]\n return '%sZ' % timestamp\n return timestamp",
"def _get_iso8061_datetime_string(object, local_datetime_attr,\n utc_datetime_a... | [
"0.65333414",
"0.633351",
"0.6305908",
"0.6291628",
"0.6255292",
"0.62536913",
"0.6235215",
"0.6202184",
"0.6198857",
"0.6195759",
"0.6157124",
"0.6153929",
"0.6129822",
"0.61262476",
"0.61257905",
"0.6120281",
"0.6116315",
"0.61068505",
"0.6098072",
"0.60976326",
"0.6094739"... | 0.67361623 | 0 |
Performs crossover operator for two parents. Operator produces two children with genotype of both parents. | def _crossover(self, parent1, parent2):
return parent1.cross(parent2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _crossover_operation(self, parent_1, parent_2):\n\n if _Utility._flip_coin(self._crossover_rate):\n child_1, child_2 = [], []\n\n # The lengths of both the parent chromosomes are checked and the\n # chromosome whose length is smaller is taken as parent A.\n le... | [
"0.7873665",
"0.7583565",
"0.75496495",
"0.7539223",
"0.74354225",
"0.7378147",
"0.73016757",
"0.7201914",
"0.69720376",
"0.69523454",
"0.6884236",
"0.6775467",
"0.6756889",
"0.6731587",
"0.6723333",
"0.67047745",
"0.6618951",
"0.6586996",
"0.6544772",
"0.65430605",
"0.654003... | 0.7768183 | 1 |
Performs mutation operator for specified chromosome. | def _mutation(self, chromosome):
return chromosome.mutate() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mutate(chromosome):\n selection = np.random.randint(0, len(chromosome))\n gene = chromosome[selection]\n project = gene.get_project()\n mutated_gene = __generate_random_session(project)\n chromosome[selection] = mutated_gene",
"def _mutation(self, chromosome: np.ndarray) -> None:\r\n ... | [
"0.726974",
"0.70674455",
"0.68446267",
"0.6794802",
"0.63410175",
"0.6306487",
"0.6214402",
"0.6121952",
"0.60566664",
"0.600003",
"0.5989194",
"0.5980293",
"0.5975119",
"0.5963951",
"0.5960454",
"0.58526903",
"0.5740301",
"0.57211983",
"0.5682249",
"0.56814504",
"0.56804895... | 0.80618674 | 0 |
checks if a number is prime only need to check up to square root of n (inclusive) | def is_prime(n: int):
if n <= 1:
return False
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime(n):\r\n from math import sqrt\r\n from itertools import count, islice\r\n if n < 2:\r\n return False\r\n return all(n % number != 0 for number in islice(count(2), int(sqrt(n) - 1)))",
"def is_prime(n):\n if n < 2:\n return False\n if n == 2:\n return True\n if ... | [
"0.8187722",
"0.8165895",
"0.8165895",
"0.8141327",
"0.8133872",
"0.8106276",
"0.8083282",
"0.8074682",
"0.8065243",
"0.8054157",
"0.80465066",
"0.80228025",
"0.79911673",
"0.79789585",
"0.7977454",
"0.79733056",
"0.79635316",
"0.795361",
"0.7928476",
"0.7899092",
"0.78899765... | 0.79509896 | 18 |
Return a new AllSegment object with all Segment objects with a given type as attribute, such as Phrase or Link. | def getByTypeOf(self, typeof):
return _aux_getBy([seg for seg in self.segments if seg.typeof == typeof], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getType(self) -> 'SegmentType':\n ...",
"def getAllOfType(self, c_type: str) -> Query:\n\n logging.debug(\"\"\"Preparing query to extract instances of type {0}\"\"\"\n .format(c_type))\n\n return prepareQuery(\"\"\"\n SELECT DISTINCT ?s\n WHERE {{\n ... | [
"0.54902554",
"0.49617013",
"0.4812985",
"0.47723764",
"0.47653508",
"0.46340048",
"0.46276835",
"0.4613506",
"0.45559043",
"0.45295665",
"0.45160738",
"0.44780943",
"0.44282445",
"0.44002995",
"0.43997592",
"0.43878752",
"0.43804675",
"0.43773603",
"0.43694803",
"0.43105567",
... | 0.5989668 | 0 |
Return a new AllSegment object with all Segment objects with a given Contour Prime value as attribute. | def getByContourPrime(self, contour_prime):
return _aux_getBy([seg for seg in self.segments if seg.contour_prime == contour_prime], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raggi(self):\r\n R = []\r\n for punto in self.Vertici:\r\n r = Segmento(self.Centro, punto)\r\n R.append(r)\r\n return (R)",
"def _filterSCPoints(self, min_distance = 3, max_distance = 8):\n completeContour = self._respacePoints(self.mContour, min_distance, m... | [
"0.5101929",
"0.4822774",
"0.46512923",
"0.46258712",
"0.46120137",
"0.45890394",
"0.45812115",
"0.45625466",
"0.4484065",
"0.44638297",
"0.44383866",
"0.44164628",
"0.44088805",
"0.44047877",
"0.43744993",
"0.4364304",
"0.43505472",
"0.43468362",
"0.43372947",
"0.432886",
"0... | 0.59144807 | 0 |
Return a new AllSegment object with all Segment objects with pickup measure. | def getByPickup(self, pickup=True):
return _aux_getBy([seg for seg in self.segments if seg.pickup == pickup], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return Segment([p.copy() for p in self.endpoints])",
"def _build(self):\n self.segments = []\n for segment in self._segment(set([Coordinate(x.start, x.end) for x in self.features])):\n attributes = dict(ID=f\"SEG{self.counter:06d}\")\n self.segments.ap... | [
"0.5319556",
"0.51788116",
"0.5066045",
"0.47910878",
"0.47736746",
"0.47719058",
"0.47653857",
"0.47402605",
"0.46940807",
"0.46879983",
"0.4648114",
"0.46465018",
"0.45688298",
"0.45501107",
"0.45318165",
"0.45192382",
"0.44999224",
"0.44849837",
"0.44754907",
"0.4469213",
... | 0.5993787 | 0 |
Return a new AllSegment object with all Segment objects with a given _interval value as attribute. | def getByInterval(self, interval, without=False):
if without:
return _aux_getBy([seg for seg in self.segments if interval not in seg.intervals], self.save)
else:
return _aux_getBy([seg for seg in self.segments if interval in seg.intervals], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getByFirstInterval(self, first_interval):\n\n return _aux_getBy([seg for seg in self.segments if seg.first_interval == first_interval], self.save)",
"def getBySemitoneInterval(self, interval):\n\n return _aux_getBy([seg for seg in self.segments if interval in seg.intervals_with_direction_semito... | [
"0.59238404",
"0.5765603",
"0.57623285",
"0.5659477",
"0.561695",
"0.5606419",
"0.54898626",
"0.54413503",
"0.5422256",
"0.540603",
"0.53534883",
"0.53266704",
"0.52986515",
"0.51794213",
"0.5174107",
"0.5132573",
"0.5073398",
"0.5052426",
"0.50410247",
"0.5038021",
"0.500980... | 0.60655683 | 0 |
Return a new AllSegment object with all Segment objects with a given _interval value as attribute. | def getBySemitoneInterval(self, interval):
return _aux_getBy([seg for seg in self.segments if interval in seg.intervals_with_direction_semitones], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getByInterval(self, interval, without=False):\n\n if without:\n return _aux_getBy([seg for seg in self.segments if interval not in seg.intervals], self.save)\n else:\n return _aux_getBy([seg for seg in self.segments if interval in seg.intervals], self.save)",
"def getByFir... | [
"0.6066665",
"0.5925088",
"0.57625085",
"0.5660394",
"0.5617936",
"0.5610677",
"0.5490944",
"0.54436517",
"0.5421338",
"0.54065543",
"0.5354415",
"0.53268826",
"0.5297773",
"0.51810795",
"0.51765406",
"0.51338834",
"0.50746745",
"0.50544465",
"0.5042774",
"0.50396246",
"0.501... | 0.57663953 | 2 |
Return a new AllSegment object with all Segment objects with a given first_interval value as attribute. | def getByFirstInterval(self, first_interval):
return _aux_getBy([seg for seg in self.segments if seg.first_interval == first_interval], self.save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBySemitoneInterval(self, interval):\n\n return _aux_getBy([seg for seg in self.segments if interval in seg.intervals_with_direction_semitones], self.save)",
"def first_interval_starting(self, start):\n for i in self.intervals:\n if i.start == start:\n return i\n ... | [
"0.56269115",
"0.53989744",
"0.5281033",
"0.5065838",
"0.48655498",
"0.48383912",
"0.48112112",
"0.47078732",
"0.4705739",
"0.46944714",
"0.4682239",
"0.46765006",
"0.4661371",
"0.4655787",
"0.4581184",
"0.45617753",
"0.45609313",
"0.455661",
"0.4546711",
"0.4545177",
"0.4516... | 0.7986939 | 0 |
Do not return anything, modify board inplace instead. | def solve(self, board) -> None:
m = len(board)
n = len(board[0])
def DFS(row, col):
# base case if out boundary
if row < 0 or row >= m or col < 0 or col >= n:
return
# base case if meet X or tag Y
if board[row][col] == 'X' or board[row][col] == 'Y':
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_copy(board):\n return board.copy()",
"def move(board, row, col, char):\n board_copy = copy.deepcopy(board)\n board_copy[row][col] = char\n return board_copy",
"def _update_board(board, position, player):\n board = board.copy()\n board[position[0], position[1], player] = 1\n retur... | [
"0.71159256",
"0.7085941",
"0.6954577",
"0.68043697",
"0.67718863",
"0.6752613",
"0.67428917",
"0.6735564",
"0.6706817",
"0.6694613",
"0.6693218",
"0.6651022",
"0.66255426",
"0.6608803",
"0.6607113",
"0.6582967",
"0.6532868",
"0.6518662",
"0.6491719",
"0.6445777",
"0.64423895... | 0.0 | -1 |
This function computes the derivative for backpropagation | def transformation_function_derivative(num):
num *= (1-num)
return num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward_pass(self, delta):\n\n # This is dE/dw = delta received . dx/dw\n \n def harmadards_sum(X, Y):\n \"\"\"\n X is [n, dim_x] \n Y is [n, dim_y]\n Return the sum of all harmadard products between each vector x and y at index i to n\n \"\"\"\n ans = np.zeros((X.... | [
"0.7692626",
"0.75418687",
"0.751216",
"0.7393129",
"0.7326039",
"0.73009264",
"0.7299496",
"0.71555626",
"0.7128769",
"0.7078421",
"0.69872886",
"0.6987257",
"0.69823474",
"0.69799685",
"0.69786835",
"0.69568306",
"0.6904679",
"0.68948764",
"0.68781507",
"0.68588066",
"0.685... | 0.0 | -1 |
Haversine distance in meters for two (lat, lon) coordinates | def compute_distance(coord1, coord2):
lat1, lon1 = coord1
lat2, lon2 = coord2
radius = 6371000 # mean earth radius in meters (GRS 80-Ellipsoid)
dlat = math.radians(lat2 - lat1)
dlon = math.radians(lon2 - lon1)
a = math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.radians(lat1)) \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def haversine_distance(lon1, lat1, lon2, lat2):\n # convert decimal degrees to radians\n lon1, lat1, lon2, lat2 = map(np.deg2rad, [lon1, lat1, lon2, lat2])\n # haversine formula\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2\n ... | [
"0.8409358",
"0.8299831",
"0.82763916",
"0.82268614",
"0.82232785",
"0.81828666",
"0.8157145",
"0.8140637",
"0.81246895",
"0.8073868",
"0.8072676",
"0.8072676",
"0.8060366",
"0.7994511",
"0.79930305",
"0.7989167",
"0.7981001",
"0.797689",
"0.7976292",
"0.7975811",
"0.7961255"... | 0.0 | -1 |
Returns true if ``other.name == self.name``, because any value that other holds and is not in self yet could be added. | def satisfies(self, other):
# If names are different then `self` does not satisfy `other`
# (`foo=bar` will never satisfy `baz=bar`)
return other.name == self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, self.__class__):\n return False\n return self['name'] == other['name']",
"def equals(self, other):\n return self.name == other.name",
"def __eq__(self, other):\n return self.name == other.name",
"def __eq__(self, other... | [
"0.8430564",
"0.8342388",
"0.8103894",
"0.8103894",
"0.76368123",
"0.7553169",
"0.7528601",
"0.7524751",
"0.74196905",
"0.7308227",
"0.7300425",
"0.72841656",
"0.72713375",
"0.725782",
"0.7234167",
"0.7145624",
"0.71280515",
"0.70976335",
"0.70976335",
"0.7092371",
"0.7077129... | 0.70992804 | 17 |
Modify self to match all the constraints for other if both instances are multivalued. Returns True if self changed, False otherwise. | def constrain(self, other):
if self.name != other.name:
raise ValueError("variants must have the same name")
old_value = self.value
values = list(sorted(set(self.value + other.value)))
# If we constraint wildcard by another value, just take value
if "*" in values an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constrain(self, other):\n if other.spec is not None and other.spec._concrete:\n for k in self:\n if k not in other:\n raise UnsatisfiableVariantSpecError(self[k], \"<absent>\")\n\n changed = False\n for k in other:\n if k in self:\n ... | [
"0.70593977",
"0.69107383",
"0.6559909",
"0.64214087",
"0.6334709",
"0.63117087",
"0.6297906",
"0.62376946",
"0.62354815",
"0.6228202",
"0.6203356",
"0.62005067",
"0.6173473",
"0.6165725",
"0.616245",
"0.61595637",
"0.6149646",
"0.61457837",
"0.6126131",
"0.61246705",
"0.6122... | 0.70277506 | 1 |
Returns true if ``other.name == self.name`` and ``other.value`` is a strict subset of self. Does not try to validate. | def satisfies(self, other):
super_sat = super(MultiValuedVariant, self).satisfies(other)
if not super_sat:
return False
if "*" in other or "*" in self:
return True
# allow prefix find on patches
if self.name == "patches":
return all(any(w.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def satisfies(self, other):\n # If names are different then `self` does not satisfy `other`\n # (`foo=bar` will never satisfy `baz=bar`)\n return other.name == self.name",
"def __eq__(self, other):\n if other is None:\n self._equalityfailreason = 'Other is None'\n ... | [
"0.7607784",
"0.74379665",
"0.7119225",
"0.7100704",
"0.7073895",
"0.70694524",
"0.70038176",
"0.69709224",
"0.69394106",
"0.69141465",
"0.69112164",
"0.6909147",
"0.69074476",
"0.6906218",
"0.6898322",
"0.6830554",
"0.6815739",
"0.68099153",
"0.68099153",
"0.6798153",
"0.679... | 0.719052 | 2 |
Returns True if this VariantMap is more constrained than other, False otherwise. | def satisfies(self, other, strict=False):
to_be_checked = [k for k in other]
strict_or_concrete = strict
if self.spec is not None:
strict_or_concrete |= self.spec._concrete
if not strict_or_concrete:
to_be_checked = filter(lambda x: x in self, to_be_checked)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(cls, other):\n if not isinstance(other, RestrictionType):\n raise NotImplementedError\n if len(cls) > len(other):\n return True\n elif cls.size == len(other) and cls.__name__ >= other.__name__:\n return True\n else:\n return False",... | [
"0.7143326",
"0.70078087",
"0.6913789",
"0.6872185",
"0.686864",
"0.6716565",
"0.67153347",
"0.67153347",
"0.6680398",
"0.66750175",
"0.667418",
"0.6643752",
"0.6582988",
"0.6554968",
"0.6534308",
"0.6532075",
"0.6492072",
"0.6487012",
"0.64482343",
"0.6445272",
"0.64405817",... | 0.0 | -1 |
Add all variants in other that aren't in self to self. Also constrain all multivalued variants that are already present. Return True if self changed, False otherwise | def constrain(self, other):
if other.spec is not None and other.spec._concrete:
for k in self:
if k not in other:
raise UnsatisfiableVariantSpecError(self[k], "<absent>")
changed = False
for k in other:
if k in self:
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constrain(self, other):\n if self.name != other.name:\n raise ValueError(\"variants must have the same name\")\n\n old_value = self.value\n\n values = list(sorted(set(self.value + other.value)))\n # If we constraint wildcard by another value, just take value\n if \... | [
"0.6724885",
"0.62871826",
"0.60906667",
"0.6031174",
"0.588794",
"0.5875739",
"0.5860949",
"0.5814699",
"0.57825416",
"0.57119936",
"0.5702142",
"0.5681639",
"0.5680879",
"0.56723285",
"0.56630504",
"0.56203794",
"0.5620131",
"0.560055",
"0.5598438",
"0.5595317",
"0.5592587"... | 0.65279007 | 1 |
Initialises a new 'TariffProfile' instance. | def __init__(self, tariffCycle='', Tariffs=None, ConsumptionTariffIntervals=None, TimeTariffIntervals=None, *args, **kw_args):
#: The frequency at which the tariff charge schedule is repeated Examples are: once off on a specified date and time; hourly; daily; weekly; monthly; 3-monthly; 6-monthly; 12-monthly; e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeProfile(self, path, settings):\n pass",
"def __init__(self, ticker):\n super(Profile, self).__init__(ticker)",
"def test_profile_initialization(self):\n profileObj = profile.Profile()\n self.assertIsInstance(profileObj, profile.Profile)",
"def __init__(self, profile:... | [
"0.5970869",
"0.57230085",
"0.5676679",
"0.56611216",
"0.5599428",
"0.5599428",
"0.54938257",
"0.5386692",
"0.5348946",
"0.5306217",
"0.5216879",
"0.51844984",
"0.5171855",
"0.5128223",
"0.5114869",
"0.5102039",
"0.504857",
"0.50484335",
"0.5047696",
"0.50402033",
"0.5039865"... | 0.6706492 | 0 |
Gets value of {classname} time_profile property. Describes how often the coupling takes place. | def time_profile(self):
return self.__time_profile | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeprofile():\n\n return TimeProfiler()",
"def profile(self):\n return self._prof",
"def get_profile_info():\n cursor = db.system.profile.find({\"op\": 'query'}, {\"millis\": 1}).sort(\"ts\", pymongo.DESCENDING).limit(1)\n return cursor.next()['millis']",
"def time_profile(self, value):\... | [
"0.6515353",
"0.61757976",
"0.6057493",
"0.6017342",
"0.5988661",
"0.59459156",
"0.5879503",
"0.5848212",
"0.58320564",
"0.57996655",
"0.5798478",
"0.57965714",
"0.57356924",
"0.57083446",
"0.56638527",
"0.5639272",
"0.56313384",
"0.56297004",
"0.5627814",
"0.5627814",
"0.562... | 0.7721579 | 0 |
Gets dictionary representation of self used to create other representations such as json, xml ...etc. | def as_dict(self):
def append(d, key, value, is_iterative, is_primitive, is_enum):
if value is None:
if is_iterative:
value = []
elif is_primitive == False and is_enum == False:
if is_iterative:
value = map(lambda i ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(... | [
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.78653336",
"0.7852704",
"0.78101397",
"0.77937907",
"0.77402407",
"0.77379704",
"0.7712334",
"0.76978284",
... | 0.0 | -1 |
This function returns a Pyramid WSGI application. | def main(global_config, **settings):
config = Configurator(settings=settings)
config.include('pyramid_chameleon')
social_providers = config.registry.settings['allow_auth'].split(',')
if 'google' in social_providers:
config.include('velruse.providers.google_oauth2')
config.add_google_oaut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wsgi_app():\n return bottle.default_app()",
"def app():\n return create_app()",
"def app():\n app = server.app\n return app",
"def make_app():\n config = Configurator()\n config.add_renderer('.jinja2', pyramid_jinja2.Jinja2Renderer)\n config.add_route('root_view', '/')\n\n config.... | [
"0.7845448",
"0.77049613",
"0.7673193",
"0.7536037",
"0.7503258",
"0.73890936",
"0.7384288",
"0.73103803",
"0.72841936",
"0.7276823",
"0.7249291",
"0.7245736",
"0.7243444",
"0.7225791",
"0.7212354",
"0.7212105",
"0.7182324",
"0.71565676",
"0.71322274",
"0.7112378",
"0.7096177... | 0.0 | -1 |
Add a rule to the list of stored rules. | def add_rule(self, rule: SimplificationRule) -> None:
self._rules.append(rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(self, rule):\n self.__rules__.append(rule)",
"def add_rule(self, rule):\n self.rules.append(rule)",
"def append(self, rule):\n self.rules.append(rule)",
"def add_rule(self, rule: Rule):\n\n self._rules.append(rule)\n return self",
"def add_rule(self, rule):\n... | [
"0.88359284",
"0.88234746",
"0.8503014",
"0.8101158",
"0.8021523",
"0.7913276",
"0.784098",
"0.77078956",
"0.77078956",
"0.77078956",
"0.77078956",
"0.766441",
"0.7619561",
"0.75466",
"0.73928326",
"0.7271837",
"0.72664934",
"0.72087383",
"0.7115994",
"0.7108993",
"0.70602876... | 0.80753595 | 4 |
Check if `qcirc` is simplifiable according to the stored rules. | def is_simplifiable(self, qcirc: QuantumCircuit) -> bool:
for rule in self._rules:
if rule.is_simplifiable(qcirc):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cdcl_solver() -> bool:\n\n global original_formula\n # pre-processing\n # trivial: empty clause contained?\n for clause in original_formula:\n if len(clause) == 0:\n return False\n # UP\n if conflict := propagate():\n return False\n # did this already satisfy?\n ... | [
"0.64436764",
"0.62107533",
"0.6089197",
"0.58456576",
"0.5576125",
"0.5515057",
"0.54040784",
"0.5363386",
"0.53275055",
"0.532651",
"0.52899253",
"0.528176",
"0.52727985",
"0.52598304",
"0.52048147",
"0.51918614",
"0.5189263",
"0.5163833",
"0.5160092",
"0.5126525",
"0.51126... | 0.7171279 | 0 |
Check if the last inserted operation of `qcirc` made it simplifiable. This method only check if the last inserted operation in `qcirc` introduced a simplifiable sequence. | def is_simplifiable_from_last(self, qcirc: QuantumCircuit) -> bool:
for rule in self._rules:
if rule.is_simplifiable_from_last(qcirc):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\n for k in range(self.dimension,0,-1):\n for simpl in self.simplices[k]:\n for j in range(k+1):\n if seq_remove(j,simpl) not in self.simplices[k-1]:\n return False\n return True",
"def solve_last_possibility(self) ... | [
"0.64428985",
"0.6096615",
"0.6000916",
"0.58986837",
"0.5812676",
"0.5794601",
"0.5753958",
"0.56998116",
"0.56279784",
"0.5600812",
"0.55867654",
"0.55518556",
"0.5544588",
"0.5507035",
"0.54965216",
"0.5481629",
"0.5466032",
"0.5416304",
"0.54005444",
"0.53445035",
"0.5334... | 0.7103289 | 0 |
Instantiates the DeepFM Network architecture. | def DeepCrossing(dnn_feature_columns, dnn_hidden_units=(128, ), l2_reg_embedding=0.00001, l2_reg_dnn=0,
init_std=0.0001, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary'):
# 生成feature input 字典
features = build_input_features(dnn_feature_columns)
inputs_list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_deep_flow_model(self):\n if self.cfg.deep_flow.network == 'liteflow':\n flow_net = LiteFlow(self.cfg.image.height, self.cfg.image.width)\n enable_finetune = self.finetune_cfg.enable and self.finetune_cfg.flow.enable\n flow_net.initialize_network_model(\n ... | [
"0.6635534",
"0.65918875",
"0.6441854",
"0.6368074",
"0.63143456",
"0.62879544",
"0.6243995",
"0.62402445",
"0.6220073",
"0.6203414",
"0.61963654",
"0.6185358",
"0.6125405",
"0.6097238",
"0.6083231",
"0.6070965",
"0.60469925",
"0.60354203",
"0.6031565",
"0.6029598",
"0.602469... | 0.0 | -1 |
Return the configuration section with the specified name. | def __getitem__(self, name):
if name not in self.data:
raise ConfigurationError("No section " + name + " in data")
return self.data[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_section(self, name):\r\n if self.config.has_section(name):\r\n return self.config.items(name)\r\n return []",
"def get_config_section(self, name):\r\n if self.config.has_section(name):\r\n return self.config.items(name)\r\n return []",
"def __get... | [
"0.79975206",
"0.79975206",
"0.7913671",
"0.7797882",
"0.7532906",
"0.7359947",
"0.72467947",
"0.72359806",
"0.71708846",
"0.70884854",
"0.7071283",
"0.6928706",
"0.6871",
"0.6862127",
"0.6842551",
"0.68311125",
"0.67567426",
"0.6730455",
"0.671342",
"0.6710353",
"0.67048407"... | 0.74699914 | 5 |
Convenience method to get a copy of the structure, with options to add site properties. | def copy(self) -> "Interface": # type:ignore
return Interface.from_dict(self.as_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self, site_properties=None, sanitize=False):\n props = self.site_properties\n if site_properties:\n props.update(site_properties)\n if not sanitize:\n return Structure(self._lattice,\n [site.species_and_occu for site in self],\n ... | [
"0.6484736",
"0.62132883",
"0.6100383",
"0.60326105",
"0.587087",
"0.5863045",
"0.5843535",
"0.58071184",
"0.57881236",
"0.5777398",
"0.5776352",
"0.5776019",
"0.576743",
"0.5737698",
"0.57352793",
"0.5703266",
"0.57026917",
"0.5667003",
"0.56663394",
"0.5666189",
"0.566207",... | 0.0 | -1 |
Labels the slab surface termination | def label_termination(slab: Structure) -> str:
frac_coords = slab.frac_coords
n = len(frac_coords)
if n == 1:
# Clustering does not work when there is only one data point.
form = slab.composition.reduced_formula
sp_symbol = SpacegroupAnalyzer(slab, symprec=0.1).get_space_group_symbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def figlabel():\r\n s = labels.pop(0)\r\n pl.text(0.04, 0.85, s+')', transform=pl.gca().transAxes, fontsize=fnts)",
"def test_labels():\n from lizard.log import VerboseTimingLog\n log = VerboseTimingLog()\n import numpy as np\n parts = np.load('/mainvol/peter.creasey/bigdata/runs/test_const_pmk... | [
"0.60858816",
"0.6008651",
"0.58465284",
"0.5843988",
"0.5700966",
"0.56799763",
"0.56288165",
"0.55888",
"0.5553695",
"0.55191505",
"0.55110294",
"0.547754",
"0.5434607",
"0.54183364",
"0.539986",
"0.5391813",
"0.53691316",
"0.53552055",
"0.53334075",
"0.5318285",
"0.5315205... | 0.75560033 | 0 |
Get CEPH key for a certain pool. | def _configure_pool_key(self, pool_name):
response, body = ("", "")
caps_dict = {'mon': 'allow r',
'osd': 'allow rwx pool=%s' % pool_name}
entity = "client.%s" % pool_name
try:
response, body = ("", "")
response, body = self._ceph_api.auth_get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pool(self, key):\n return self._pools.get(key, None)",
"def instance_pool_id(self) -> str:\n return pulumi.get(self, \"instance_pool_id\")",
"def get_ceph_object_pool_name(self, context):\n return self._ceph.get_ceph_object_pool_name()",
"def cognito_identity_pool_id(self) -> Optiona... | [
"0.68801534",
"0.61425894",
"0.60895336",
"0.59903455",
"0.5781069",
"0.5727054",
"0.57037365",
"0.56517786",
"0.56427723",
"0.56377625",
"0.56102514",
"0.54827154",
"0.5451768",
"0.5450173",
"0.5418403",
"0.54062396",
"0.5397281",
"0.5397197",
"0.5393908",
"0.5359622",
"0.53... | 0.70853174 | 0 |
Test api endpoint to list leaders. | def test_api_leaders(admin_client):
response = admin_client.get("/api/leaders/")
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_game_get_leaders():\n a_game = Game()\n\n # Manually hack the scores for test\n a_game._scores = [\n {\"controlled\": 2},\n {\"controlled\": 15},\n {\"controlled\": 2},\n {\"controlled\": 4},\n ]\n\n leaders = a_game.get_leaders()\n assert len(leaders) == 1\n ... | [
"0.62238115",
"0.6153417",
"0.6112163",
"0.6100349",
"0.6088648",
"0.60738504",
"0.60526323",
"0.60130906",
"0.59646046",
"0.58892334",
"0.58444446",
"0.5784419",
"0.5769508",
"0.5761318",
"0.5760925",
"0.5760024",
"0.57422864",
"0.5727372",
"0.5722289",
"0.5704618",
"0.57004... | 0.76982087 | 0 |
Return the length of the media in seconds | def get_media_length(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_length(self):\n return self.metadata[\"media_info\"][\"technical\"][\"duration_s\"]",
"def media_duration(self):\n if self._properties.get(\"live\"):\n return None\n\n if (total_time := self._properties.get(\"totaltime\")) is None:\n return None\n\n ret... | [
"0.84307194",
"0.78967214",
"0.78788656",
"0.7807445",
"0.77340394",
"0.7691662",
"0.7538422",
"0.743162",
"0.73962855",
"0.7257292",
"0.7252612",
"0.72343844",
"0.7232256",
"0.7188581",
"0.71858585",
"0.71810246",
"0.71465594",
"0.7137154",
"0.7129042",
"0.71158385",
"0.7112... | 0.76365584 | 6 |
Return whether the media is playing | def is_playing(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPlaying(self): \n return mixer.music.get_busy()",
"def is_playing(self):\n return self._reference.IsPlaying()",
"def is_playing(self):\n return self.audio.is_playing()",
"def play(self) -> bool:\n return self.audio.start_playback().get()",
"def is_playing(self):\n ... | [
"0.8122781",
"0.80946374",
"0.8085312",
"0.7895722",
"0.7892695",
"0.784046",
"0.78310406",
"0.76927906",
"0.75586534",
"0.75286084",
"0.7500199",
"0.7375708",
"0.73625773",
"0.7260354",
"0.72385937",
"0.71953034",
"0.71508425",
"0.7066539",
"0.7034254",
"0.70036995",
"0.6970... | 0.7918916 | 3 |
Set the playback rate of the media new_rate the new playback rate (1.0 is normal speed) | def set_playback_rate(self, new_rate):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPlaybackRate(self, rate):\n clipRate = rate\n if not isStopped():\n setRate(rate)",
"def change_rate(self, new_rate: bool) -> None:\n self.rate = new_rate",
"def set_frame_rate(rate):\n\t\tself.frame_rate = rate",
"def change_rate(self, direction, display=None) -> None:... | [
"0.7751816",
"0.741831",
"0.71828526",
"0.70425844",
"0.70261174",
"0.6942096",
"0.68676215",
"0.6836159",
"0.6789219",
"0.6736059",
"0.67246133",
"0.66437227",
"0.6642062",
"0.663435",
"0.6631203",
"0.6564666",
"0.6481036",
"0.6481036",
"0.6441911",
"0.6437748",
"0.6417479",... | 0.8770267 | 0 |
Get the context vector by using either soft attention or attentionbased GRU. | def new_fact(self, memory):
fact_list = tf.unstack(self.facts, axis = 1)
mixed_fact = tf.zeros_like(fact_list[0])
with tf.variable_scope('attend'):
attentions = self.attend(memory)
if self.attention == 'gru':
with tf.variable_scope('attn_gate') as scope:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gelu(x):\n return tf.keras.activations.gelu(x)",
"def _compute_gate(self, context, question, memory):\n\n with tf.variable_scope(\"attention\"):\n\n # expand the dimensions so that broadcasting is correctly done\n question = tf.expand_dims(question, 1)\n memory = tf... | [
"0.5607272",
"0.5592544",
"0.5558644",
"0.5422467",
"0.53530085",
"0.5328872",
"0.5316936",
"0.53094935",
"0.52805585",
"0.5237726",
"0.5218868",
"0.52145815",
"0.5211204",
"0.5172113",
"0.5094854",
"0.50792307",
"0.50783926",
"0.505282",
"0.50518537",
"0.5041355",
"0.5021528... | 0.0 | -1 |
Get the attention weights. | def attend(self, memory):
c = self.facts
q = tf.tile(tf.expand_dims(self.question, 1), [1, self.num_facts, 1])
m = tf.tile(tf.expand_dims(memory, 1), [1, self.num_facts, 1])
z = tf.concat([c*q, c*m, tf.abs(c-q), tf.abs(c-m)], 2)
z = tf.reshape(z, [-1, 4*self.num_units])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):\n return self._weights",
"def get_weights(self):\n\n return self.weights",
"def get_weights(self):\n return self.weights",
"def get_weights(self):\n return self.weights",
"def get_weights(self) -> np.ndarray:\n if self.weights is None:\n ... | [
"0.79782414",
"0.7938886",
"0.793622",
"0.793622",
"0.791678",
"0.7870181",
"0.7832722",
"0.7832722",
"0.77922225",
"0.77922225",
"0.77922225",
"0.76957995",
"0.76834214",
"0.7678785",
"0.7615062",
"0.7588045",
"0.7588045",
"0.75712025",
"0.7565812",
"0.75205225",
"0.74610776... | 0.0 | -1 |
List all books. This endpoint should be used to get the IDs of all books. Then each ID can be used to query the `books/{id}` endpoint, in order to get the complete infomation. Pagination is supported via the `offset` and `limit` parameters. | def get(self): # noqa
args = req_parser.parse_args()
offset = args['offset'] if args['offset'] is not None else 0
limit = args['limit'] if args['limit'] is not None else 100
limit = offset + limit
return [
get_book_data(book.id, concise=True)
for book in B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_books():\n books = Book.query.all()\n json_books = []\n for book in books:\n json_books.append(book.to_json())\n return jsonify(json_books), 200",
"def all_books(self, date_format=DATE_FORMAT):\n return self.execute(queries.ALL_BOOKS, (date_format,)).fetchall()",
"def book_lis... | [
"0.71158624",
"0.68991673",
"0.66415924",
"0.6625763",
"0.65930885",
"0.6449018",
"0.63993096",
"0.63903123",
"0.6352857",
"0.6296036",
"0.6206825",
"0.6153444",
"0.6086798",
"0.60643077",
"0.60389394",
"0.5976396",
"0.59468925",
"0.592235",
"0.59194577",
"0.589127",
"0.58649... | 0.6913018 | 1 |
Get EZSP config value. | def command_handler_ezsp_get_config_value(*args, **kwargs):
from . import ezsp
importlib.reload(ezsp)
return ezsp.get_config_value(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_value(self, name): \n value = self.cf.get(\"config\", name)\n return value",
"def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]",
"def value(self):\n if self.value_fn is None:\n return self.confi... | [
"0.7353689",
"0.68514913",
"0.68367565",
"0.6582053",
"0.65611684",
"0.65132016",
"0.6460973",
"0.6404688",
"0.6400788",
"0.6328467",
"0.626062",
"0.62512845",
"0.61855",
"0.6105573",
"0.6103155",
"0.6073082",
"0.6073082",
"0.60726553",
"0.60415006",
"0.60297835",
"0.60283244... | 0.7743494 | 0 |
displays an index.html page | def hbnb_filters():
states = storage.all('State').values()
cities = storage.all('City').values()
amenities = storage.all('Amenity').values()
return render_template('10-hbnb_filters.html',
states=states, amenities=amenities, cities=cities) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_page():\n\n return render_template(\"index.html\")",
"def index():\n\treturn render_template(\"index.html\")",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template(\"index.htm... | [
"0.8579561",
"0.8555138",
"0.8536156",
"0.8516583",
"0.85021853",
"0.8490622",
"0.84553444",
"0.84408855",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8437075",
"0.8424996",
"0.841462",
"0.8411709",
"0.8411709",
... | 0.0 | -1 |
Helper function to generate random strings for testing. | def random_generator(size=32, chars=string.ascii_letters + string.digits):
return ''.join(random.choice(chars) for x in range(size)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_str(self):\n letters = string.ascii_letters + string.digits\n return ''.join(choice(letters) for i in range(32))",
"def test_rand_str_gen(self):\n str = rand_str_gen(20)\n self.assertEqual(len(str), 20)\n str = rand_str_gen(40)\n self.assertEqual(len(str), 40... | [
"0.80621064",
"0.8028895",
"0.80056125",
"0.8003797",
"0.7969178",
"0.7931652",
"0.7833512",
"0.77799934",
"0.7708401",
"0.76756483",
"0.7651578",
"0.76460105",
"0.76377416",
"0.76235884",
"0.75972223",
"0.75958127",
"0.75621754",
"0.75144494",
"0.7453669",
"0.74383414",
"0.7... | 0.695183 | 65 |
A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. | def method(self) -> str:
return pulumi.get(self, "method") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_method(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"http_method\")",
"def http_method(self) -> str:\n return self.random.choice(HTTP_METHODS)",
"def http_method(self):\n return self._http_method",
"def request_method(self) -> Optional[pulumi.Input['HttpCheckRequestMet... | [
"0.7578804",
"0.7412867",
"0.7199856",
"0.7062787",
"0.6821395",
"0.6788345",
"0.6661051",
"0.65105647",
"0.64968354",
"0.6383204",
"0.63813627",
"0.6357858",
"0.6292311",
"0.6275934",
"0.6269478",
"0.62423104",
"0.62263787",
"0.6215312",
"0.61357516",
"0.6131074",
"0.6103873... | 0.5660195 | 54 |
Array of Operation responses. | def responses(self) -> Optional[Sequence['outputs.ResponseContractResponse']]:
return pulumi.get(self, "responses") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def responses(self):\n return self._responses",
"def get_responses(self, response):\n responses = []\n if self._command_defn is not None and self._command_defn[\"response_type\"] == \"POSITIONAL\":\n # Have a POSITIONAL type response, so need to break it up...\n # examp... | [
"0.69305223",
"0.68342423",
"0.6750965",
"0.67402667",
"0.6723217",
"0.6659695",
"0.61116487",
"0.60874647",
"0.6020443",
"0.60184026",
"0.60184026",
"0.60184026",
"0.5994621",
"0.5990726",
"0.58643615",
"0.58643615",
"0.58643615",
"0.5857643",
"0.58047485",
"0.5783344",
"0.5... | 0.6173745 | 6 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self) -> str:\n if len(self._resource_types) != 1:\n raise TypeError('Type needs to be specified manually, use .set or .add')\n return self._resource_types[0]",
"def resource_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_... | [
"0.80910635",
"0.7966174",
"0.7903",
"0.78844446",
"0.78652173",
"0.78652173",
"0.78652173",
"0.78652173",
"0.77754897",
"0.76696736",
"0.76575",
"0.71887577",
"0.71671563",
"0.6749247",
"0.6641406"
] | 0.0 | -1 |
converts image with labels into the onehot encoded format (img[...,] > img[..., N_CLASSES]) | def make_ohe(self, labelIds, mode="catId"):
classes = self.categories
if mode == "trainId":
classes = self.classes
if len(classes) == 2:
classes = [0]
for unique in np.unique(labelIds):
labelIds[labelIds == unique] = self.cityscapes_labels_df[self.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels_to_one_hot(n_classes, labels):\n new_labels = np.zeros((labels.shape[0], n_classes), dtype=np.float32)\n new_labels[range(labels.shape[0]), labels] = np.ones(labels.shape)\n return new_labels",
"def one_hot(labels, n_classes):\n # n_classes = len(set(labels))\n label = np.ar... | [
"0.82840496",
"0.81682926",
"0.81674093",
"0.8124175",
"0.806376",
"0.8059674",
"0.8039263",
"0.8025716",
"0.8013069",
"0.783083",
"0.7807945",
"0.77741843",
"0.77587366",
"0.7750957",
"0.772446",
"0.77226055",
"0.7713166",
"0.76875705",
"0.7618489",
"0.7601278",
"0.7596831",... | 0.0 | -1 |
converts onehot encoded mask to the multiclass mask | def inverse_ohe(self, ohe_labels):
inverse_ohe_img = np.zeros(ohe_labels.shape[:2]+(1,))
for ch in range(ohe_labels.shape[-1]):
ys, xs = np.where(ohe_labels[..., ch])
inverse_ohe_img[ys, xs] = ch
inverse_ohe_img = np.repeat(inverse_ohe_img, 3, axis=2).astype(int)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toOneHot(mask, nb_class=10):\n categorical = torch.from_numpy(np.array(mask)).long()\n categorical = F.one_hot(categorical, nb_class)\n\n return categorical.permute(2,0,1).float()",
"def one_hot_label(classes, label):\n m = label.shape[0]\n new_label = np.zeros((classes, m))\n for i in rang... | [
"0.7811777",
"0.7203939",
"0.71990323",
"0.70600665",
"0.69852614",
"0.69612926",
"0.695197",
"0.6945684",
"0.69197434",
"0.6918872",
"0.6910088",
"0.6877178",
"0.687445",
"0.685539",
"0.6855374",
"0.6801385",
"0.6798253",
"0.6780942",
"0.6766208",
"0.67562795",
"0.67426115",... | 0.0 | -1 |
Determine given integer is prime or not, return True if it is a prime, return False otherwise | def is_prime(n: int) -> bool:
if n < 2:
# print(f"{n} is not a prime number")
return False
else:
for i in range(2, n):
if (n % i) == 0:
# print(f"{n} is not a prime number")
# print(f"{n} divides {i} = {n//i}")
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(num: int) -> bool:\n pass",
"def isprime(n):\n if prime(n):\n return True\n else:\n return False",
"def isprime(n):\n if prime(n):\n return True\n else:\n return False",
"def is_prime(number: int) -> bool:\n if number < 2:\n return False\n ... | [
"0.8757898",
"0.8269984",
"0.8269984",
"0.8265314",
"0.820396",
"0.8168777",
"0.81567866",
"0.8151551",
"0.815096",
"0.81287557",
"0.81066275",
"0.8103047",
"0.809655",
"0.8084601",
"0.8066643",
"0.80652595",
"0.8053878",
"0.8040347",
"0.8027451",
"0.80121505",
"0.7997614",
... | 0.7769779 | 52 |
Find primes less than given number n | def prime_num(n: int) -> list:
pl = []
for i in range(1, n):
if is_prime(i) is True:
pl.append(i)
return pl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188\n sieve = [True] * n\n for i in xrange(3,int(n**0.5)+1,2):\n if sieve[i]:\n sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)\n return [2] + [i for i in xrange(3,n,... | [
"0.7851014",
"0.77342385",
"0.77236867",
"0.76643974",
"0.76452875",
"0.7604201",
"0.7598455",
"0.7565475",
"0.75363326",
"0.75289744",
"0.7527637",
"0.7521727",
"0.75182146",
"0.75082695",
"0.747035",
"0.7464636",
"0.7415195",
"0.74122083",
"0.7399784",
"0.73708606",
"0.7366... | 0.7359438 | 22 |
Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
return self._device_class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return self.sensor.get('class')",
"def GetClassOfDevice(self):\n result = self.SerialSendReceive(self.CMD_GET_CLASS_OF_DEVICE,\n msg='getting class of device')\n return int(result, 16)",
"def device_class(self):\n return self._dcl... | [
"0.8486994",
"0.8360851",
"0.8309549",
"0.8289274",
"0.8289274",
"0.82153726",
"0.80988103",
"0.80614465",
"0.8013332",
"0.79548776",
"0.7951035",
"0.7946956",
"0.7926973",
"0.7906448",
"0.78829867",
"0.78497475",
"0.78259593",
"0.78257316",
"0.76096493",
"0.74813426",
"0.747... | 0.8241434 | 14 |
Validates the magnitude of reduced dimensionality or the method name. | def validate_feature_selection_size(feature_select_method, dim_in_data=None):
try:
# checking if its convertible to number
num_select = np.float(feature_select_method)
except:
# if it is a str, it must be recognized
if isinstance(feature_select_method, str):
if feat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __validate_dimensions(self, v):\n return \\\n is_positive_float(v) and self.__are_parameters_consistent()",
"def validateInput(self):\n self.validateNames()\n self.validateDemix()\n self.validatePointings()\n self.distanceToSun()",
"def _validate_mesh(self):\n ... | [
"0.59516865",
"0.5817776",
"0.5758444",
"0.5746533",
"0.5721455",
"0.5652288",
"0.56452787",
"0.553299",
"0.5532747",
"0.5525521",
"0.5520408",
"0.55198634",
"0.5476809",
"0.5431835",
"0.5387772",
"0.53512216",
"0.5337258",
"0.5320754",
"0.5302367",
"0.5279485",
"0.5277156",
... | 0.50407 | 58 |
Checks for null values of a give variable! | def not_unspecified(var):
return var not in ['None', 'none', None, ''] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_null(datum, **kwargs):\n return datum is None",
"def is_not_null(value):\n return value is not None and len(str(value)) > 0",
"def is_null(val):\n try:\n if val == \"\":\n return True\n else:\n return False\n except:\n return False",
"def t... | [
"0.7349863",
"0.71102893",
"0.69998765",
"0.681966",
"0.6689004",
"0.6606947",
"0.6603475",
"0.65922713",
"0.6570253",
"0.6515957",
"0.6461418",
"0.6432831",
"0.6432717",
"0.6410518",
"0.6387196",
"0.6381951",
"0.6347797",
"0.63387096",
"0.63374394",
"0.63323903",
"0.63091826... | 0.7370314 | 0 |
Convert temperature from Celsius to Fahrenheit or vice versa | def do_tempconv(self, s):
temp_main(self, s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Celsius2Fahrenheit(self,tempC):\n return 1.8*tempC + 32.0",
"def convertCelsiusToFahrenheit(celsius):\n fahrenheit = (celsius * 1.8) + 32\n return fahrenheit",
"def celsius_to_fahrenheit(tempc):\n return (tempc*(9/5))+32",
"def celsius_to_fahrenheit(temp):\n return (temp * 1.8) + 32.0"... | [
"0.8378811",
"0.8338792",
"0.82796586",
"0.82285416",
"0.817902",
"0.8151387",
"0.8150412",
"0.8141091",
"0.8131538",
"0.7927457",
"0.79148364",
"0.7904339",
"0.79014367",
"0.7861784",
"0.7854132",
"0.78496915",
"0.78365403",
"0.77900934",
"0.7754959",
"0.77509373",
"0.771284... | 0.0 | -1 |
Set an image in the QGraphicsView. Takes an image path or a pixmap object, option to not reset zoom, so you can switch between images without losing zoom level | def set_image(self, pix, image_path=None, reset=True):
if image_path:
pixmap = QtGui.QPixmap(image_path)
else:
pixmap = pix
if pixmap and not pixmap.isNull():
self._empty = False
# turn on dragging
self.setDragMode(QtWidgets.QGraphicsV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_image(self, image):\r\n raise NotImplementedError",
"def set_image(self, image):\n self.image = image",
"def setImage(self):\n item = self.Listbox.currentItem().text().split(\":\")[0]\n fname = f\"images/{item}.png\"\n if os.path.isfile(fname):\n pixmap = Q... | [
"0.7020699",
"0.6946583",
"0.6914127",
"0.6688668",
"0.6494981",
"0.6493928",
"0.64214104",
"0.63391",
"0.6333903",
"0.62383056",
"0.6235545",
"0.6212981",
"0.6184335",
"0.61449873",
"0.6110128",
"0.6099344",
"0.60622466",
"0.6043209",
"0.60365665",
"0.60364026",
"0.60350984"... | 0.7815489 | 0 |
Stop at the current slider position if playing, otherwise resume playing | def pause(self):
if self.__image_sequence:
if not self.__timer.isActive():
self.__timer.start(self.__fps)
else:
self.__timer.stop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n self.playing = False",
"def stop(self):\n self._player.pause()\n self._player.seek(0)",
"def stop(self):\n stopMovie()\n setLooping(False)",
"def stop(self):\n logging.info(\"Stopping the track.\")\n self.player.stop()\n self.time_bar.... | [
"0.7372103",
"0.70563984",
"0.6929178",
"0.6916952",
"0.69066745",
"0.6905187",
"0.68279403",
"0.6775931",
"0.67747986",
"0.6765057",
"0.67296743",
"0.6728118",
"0.6704109",
"0.6670292",
"0.66588265",
"0.65707606",
"0.65127134",
"0.64629436",
"0.64402556",
"0.6416428",
"0.640... | 0.0 | -1 |
Resets the player controller to default startup state. Clears the timeline/slider and frame info, deletes the pixmap sequence, sets current frame index to 0. | def reset(self):
if self.__image_sequence:
self.stop()
self.__image_sequence = []
self.__start_frame = None
self.__end_frame = None
self.start_frame_label.setText("")
self.end_frame_label.setText("")
self.__current_frame = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self) -> None:\n self.__set_up_game()\n self.display.board = self.board",
"def reset_game():\n clearscreen()\n initialize()",
"def resetController(self): \r\n\r\n self.controller.commandQ.put({\r\n 'type': 'reset'\r\n })\r\n self.distancePlot.clear(... | [
"0.66208446",
"0.6605206",
"0.6559284",
"0.6512075",
"0.63630027",
"0.6302789",
"0.6298538",
"0.62746334",
"0.6245984",
"0.6228406",
"0.6214329",
"0.6202998",
"0.61712444",
"0.6150516",
"0.61499393",
"0.61375844",
"0.6119234",
"0.6103074",
"0.61003923",
"0.6097659",
"0.609765... | 0.7014005 | 0 |
Zooms in on the image, calls viewer class to handle | def zoom_in(self):
if self.viewer.has_image():
factor = self.viewer.zoom_in()
self.viewer.scale_image(factor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zoomIntoImage(self):\r\n \"\"\"self.zoom_level -= 1\r\n if self.zoom_level > 6:\r\n self.canvas.setScale(2, 2)\r\n else:\r\n self.zoom_level = 6\r\n \"\"\"\r\n self.canvas.zoomIn()",
"def OnZoomIn(self, event):\n self.viewer.SetZoom(min(self.per... | [
"0.7242833",
"0.7240827",
"0.7178792",
"0.7028707",
"0.70107603",
"0.69316345",
"0.6925675",
"0.68457925",
"0.6752096",
"0.67309016",
"0.66797227",
"0.66793674",
"0.66732436",
"0.66633034",
"0.66459423",
"0.66421604",
"0.6638808",
"0.66128296",
"0.66039944",
"0.6592851",
"0.6... | 0.81004673 | 0 |
Zooms out on the image, calls viewer class to handle | def zoom_out(self):
if self.viewer.has_image():
factor = self.viewer.zoom_out()
self.viewer.scale_image(factor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zoomOutImage(self):\r\n \"\"\"\r\n self.zoom_level += 1\r\n if self.zoom_level < 12:\r\n self.canvas.setScale(0.5, 0.5)\r\n else:\r\n self.zoom_level = 12\r\n \"\"\"\r\n self.canvas.zoomOut()",
"def zoom_in(self):\n if self.viewer.has_ima... | [
"0.7567773",
"0.7491835",
"0.74643403",
"0.7414743",
"0.71452755",
"0.70813704",
"0.70101815",
"0.7004115",
"0.68873894",
"0.6804183",
"0.67795396",
"0.66484606",
"0.6606817",
"0.65945464",
"0.6548303",
"0.6542347",
"0.6526819",
"0.64618164",
"0.6420061",
"0.63922757",
"0.638... | 0.82390493 | 0 |
Round float to int if not NA | def round_str(number, decimals=0):
if number != 'NA':
if decimals != 0:
return "{0:.{1}f}".format(number, decimals)
else:
return int(number)
return 'NA' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_int(val: Optional[float]) -> int:\n if not val:\n return 0\n return int(float(str(val)))",
"def to_int(val: Optional[float]) -> int:\n if not val:\n return 0\n return int(float(str(val)))",
"def integerise(f):\n return int(f) if isinstance(f, float) and f.is_integer() else f",
"def _round... | [
"0.69461584",
"0.69461584",
"0.6746173",
"0.6599143",
"0.65117925",
"0.6375936",
"0.6356582",
"0.6261396",
"0.62446296",
"0.60988027",
"0.6057491",
"0.60029906",
"0.5975117",
"0.59655446",
"0.5943899",
"0.5926768",
"0.5922375",
"0.5914028",
"0.5909836",
"0.5883085",
"0.588308... | 0.0 | -1 |
Convert coeff from units of 2Ns to s | def coeff_s(coeff, Nref):
if coeff != 'NA':
return coeff/(2*Nref)
return 'NA' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coeff_2Ns(coeff, Nref):\n if coeff != 'NA':\n return 2*Nref*coeff\n return 'NA'",
"def get_coeff(self):\n\t\treturn self.coeff.round(6).transpose()[0]",
"def _convert_to_interpolation_coefficients(self, s, z, tol):\n sz = s.size()\n dim = len(sz) - 2\n if dim not in [1, 2,... | [
"0.61608535",
"0.6124297",
"0.60498047",
"0.5817357",
"0.5781765",
"0.5699708",
"0.56644654",
"0.5615248",
"0.5604282",
"0.55603296",
"0.55516744",
"0.5512656",
"0.55101424",
"0.54735976",
"0.54387194",
"0.54018396",
"0.5395466",
"0.5372778",
"0.53612995",
"0.5355804",
"0.535... | 0.66613746 | 0 |
Convert from rate per bp to units of theta or rho = 4Nx, where x is mu for mutrate, x is r for recrate | def rate_4Nx(rate, chrmlen, Nref):
if rate != 'NA':
return 1e6*4*Nref*rate*chrmlen
return 'NA' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omega(snr, r):\n return snr*r",
"def rate_bp(rate, chrmlen, Nref):\n if rate != 'NA':\n return rate/(1e6*4*Nref*chrmlen)\n return 'NA'",
"def rate(values):\n r_values = values[-5:]\n rate = ((1/4) * (one_diff(r_values[1], r_values[0]) + one_diff(r_values[2], r_values[1]) + one_diff(... | [
"0.5992029",
"0.59208876",
"0.57694215",
"0.5668802",
"0.5542415",
"0.55017745",
"0.54784906",
"0.5384242",
"0.5365445",
"0.53266513",
"0.5302805",
"0.53019506",
"0.5286773",
"0.5253352",
"0.5242738",
"0.52171993",
"0.5205809",
"0.5201271",
"0.5194227",
"0.5177485",
"0.517106... | 0.623476 | 0 |
Returns a list of value of length n | def my_arg_list(value, n):
return [copy(value) for i in range(n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list0toN(n):\n num = 0\n return_value = []\n for int in range(0, n + 1):\n return_value.append(num)\n num = num + 1\n return return_value",
"def list1ToN(n):\n num = 0\n return_value = []\n for int in range(1, n + 1):\n return_... | [
"0.76238805",
"0.7222813",
"0.72179925",
"0.7190366",
"0.6674235",
"0.6668142",
"0.65343225",
"0.65174186",
"0.65025204",
"0.6457215",
"0.6424837",
"0.6424837",
"0.6424837",
"0.6424837",
"0.6417881",
"0.63945127",
"0.6387631",
"0.62739056",
"0.6272755",
"0.6265589",
"0.626288... | 0.705283 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.