query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a Tensor of the given shape and type, filled with ones. | def ones(shape, dtype=np.float32, constant=False):
return Tensor(np.ones(shape, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ones(shape, **kwargs):\n return Tensor(np.ones(shape), **kwargs)",
"def ones(shape, dtype=None):\r\n if not isinstance(shape, (list, tuple, TensorVariable)):\r\n shape = [shape]\r\n if dtype is None:\r\n dtype = config.floatX\r\n return alloc(numpy.array(1, dtype=dtype), *shape)... | [
"0.7804943",
"0.7683953",
"0.7536793",
"0.7465508",
"0.7340931",
"0.7100268",
"0.7096827",
"0.7033758",
"0.69178116",
"0.68752694",
"0.67989206",
"0.6781181",
"0.6754689",
"0.67434925",
"0.67434925",
"0.66576254",
"0.6623597",
"0.6616802",
"0.65935737",
"0.65891206",
"0.65774... | 0.79251647 | 0 |
Return a Tensor of the same shape and type as the given, filled with ones. | def ones_like(other, dtype=None, constant=False):
if isinstance(other, Tensor):
other = other.data
return Tensor(np.ones_like(other, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ones(shape, **kwargs):\n return Tensor(np.ones(shape), **kwargs)",
"def ones(shape, dtype=np.float32, constant=False):\n return Tensor(np.ones(shape, dtype), constant=constant)",
"def ones(shape, dtype=None):\n\n return full(shape, 1, dtype)",
"def full(shape, fill_value, dtype=None, constan... | [
"0.78448987",
"0.77963907",
"0.71618336",
"0.7152711",
"0.71166897",
"0.70891255",
"0.7035745",
"0.67614967",
"0.67397404",
"0.67322814",
"0.6696256",
"0.6639437",
"0.66216457",
"0.66216457",
"0.66163826",
"0.66123426",
"0.66075337",
"0.65954155",
"0.65787035",
"0.65599227",
... | 0.7385739 | 2 |
Return a Tensor of the given shape and type, filled with zeros. | def zeros(shape, dtype=np.float32, constant=False):
return Tensor(np.zeros(shape, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)",
"def zeros(shape, dtype=None):\r\n if not isinstance(shape, (list, tuple, TensorVariable)):\r\n shape = [shape]\r\n if dtype is None:\r\n dtype = config.floatX\r\n return alloc(numpy.array(0, dtype=dtype), *sh... | [
"0.8474824",
"0.81940085",
"0.7970283",
"0.7943256",
"0.78418344",
"0.77863413",
"0.7462789",
"0.74254084",
"0.74252814",
"0.7298925",
"0.726641",
"0.726641",
"0.72364914",
"0.72364914",
"0.7220324",
"0.71415716",
"0.7114201",
"0.7108971",
"0.7061564",
"0.70332193",
"0.702093... | 0.85140014 | 0 |
Return a Tensor of the same shape and type as the given, filled with zeros. | def zeros_like(other, dtype=None, constant=False):
if isinstance(other, Tensor):
other = other.data
return Tensor(np.zeros_like(other, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)",
"def zeros(shape, dtype=np.float32, constant=False):\n return Tensor(np.zeros(shape, dtype), constant=constant)",
"def zeros_like(tensor):\n raise NotImplementedError",
"def empty(*shape, **kwargs):\n return Ten... | [
"0.8515093",
"0.8359305",
"0.7773188",
"0.76649344",
"0.7576345",
"0.75676346",
"0.7439367",
"0.73258144",
"0.7300596",
"0.7258717",
"0.7258717",
"0.71819293",
"0.70903486",
"0.7053635",
"0.7027461",
"0.69850844",
"0.6981933",
"0.6979783",
"0.69700307",
"0.69608396",
"0.69373... | 0.7922002 | 2 |
Return a Tensor of the given shape and type, filled with `fill_value`. | def full(shape, fill_value, dtype=None, constant=False):
return Tensor(np.full(shape, fill_value, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty(shape, dtype=np.float32, constant=False):\n return Tensor(np.empty(shape, dtype), constant=constant)",
"def full(shape, fill_value, dtype=None):\n\n assert(type(shape) == int)\n if not dtype:\n val_type = type(fill_value)\n dtype = __get_default_dtype(val_type)\n if dtype not ... | [
"0.6689359",
"0.660918",
"0.6569155",
"0.654689",
"0.6518742",
"0.64880186",
"0.6142297",
"0.6142297",
"0.61383414",
"0.6131693",
"0.6130012",
"0.61225504",
"0.61165136",
"0.60562676",
"0.60001016",
"0.59717953",
"0.5890783",
"0.58272755",
"0.5811976",
"0.57418615",
"0.573173... | 0.7630279 | 0 |
Return a Tensor of the same shape and type as the given, filled with `fill_value`. | def full_like(other, fill_value, dtype=None, constant=False):
if isinstance(other, Tensor):
other = other.data
return Tensor(np.full_like(other, fill_value, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full(shape, fill_value, dtype=None, constant=False):\n return Tensor(np.full(shape, fill_value, dtype), constant=constant)",
"def fill_in_missing(x: Union[tf.Tensor, tf.SparseTensor]) -> tf.Tensor:\n if isinstance(x, tf.sparse.SparseTensor):\n default_value = '' if x.dtype == tf.string else 0\n ... | [
"0.76474345",
"0.6808617",
"0.67970055",
"0.67201334",
"0.67201334",
"0.66164523",
"0.6530264",
"0.6157487",
"0.6102892",
"0.60997534",
"0.6078351",
"0.6013173",
"0.59694153",
"0.59685063",
"0.59264225",
"0.5896007",
"0.58642215",
"0.57593703",
"0.5755813",
"0.5738871",
"0.57... | 0.73536515 | 1 |
Return a Tensor with evenlyspaced values in a geometric progression. Each output sample is a constant multiple of the previous output. | def geomspace(start, stop, num=50, include_endpoint=True, dtype=None, constant=False):
return Tensor(np.geomspace(start, stop, num, include_endpoint, dtype), constant=constant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generation(x, g):\n return int(x/g)",
"def GraphFn(self, inp):\n tensor = inp * 2.0\n tensor = array_ops.reshape(tensor, self.tensor_shapes[1])\n tensor = tensor + 3.0\n tensor = array_ops.reshape(tensor, self.tensor_shapes[2])\n tensor = tensor * 4.0\n tensor = array_ops.reshape(tensor,... | [
"0.583909",
"0.57641184",
"0.5602487",
"0.55698764",
"0.5515631",
"0.55117905",
"0.54322165",
"0.54314107",
"0.5425969",
"0.5401054",
"0.5385512",
"0.53814715",
"0.5372165",
"0.53698367",
"0.5338512",
"0.5333787",
"0.532375",
"0.532375",
"0.53124595",
"0.52903473",
"0.5287317... | 0.5364637 | 14 |
Return the path to the file that backs this database. | def path(self):
return self.path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(self):\n return self._dbfile",
"def backfile(self):\n return self._backfile",
"def file_loc(self):\n\t\treturn self.__dbfile",
"def get_file_save_path(self):\n return self.out",
"def currentDatabasePath(self):\n logger.debug(\"Func: currentDatabasePath/getter\")\n\n... | [
"0.7751675",
"0.7570945",
"0.72790986",
"0.7232315",
"0.722999",
"0.71084803",
"0.7037504",
"0.6897425",
"0.68014276",
"0.67831486",
"0.6769617",
"0.67393863",
"0.6738952",
"0.6677385",
"0.6669076",
"0.6661353",
"0.6640266",
"0.6627809",
"0.6627809",
"0.6623402",
"0.66060483"... | 0.6317509 | 46 |
Close the connection to the database. | def close(self):
self.connection.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def Close(self):\n l_... | [
"0.86928225",
"0.85013294",
"0.8321248",
"0.83073944",
"0.82714146",
"0.81702286",
"0.810319",
"0.8024514",
"0.8015012",
"0.7983862",
"0.7934018",
"0.79287755",
"0.7926348",
"0.79205245",
"0.7909155",
"0.78986186",
"0.7889494",
"0.7889456",
"0.7875847",
"0.77866817",
"0.77866... | 0.0 | -1 |
Returns a list of filenames for all jpg images in a directory. | def get_imlist_png(path):
return [os.path.join(path,f) for f in os.listdir(path) if f.endswith('.png')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_images(directory):\r\n allfiles = os.listdir(directory)\r\n image_list = [im for im in allfiles if '.jpg' in str(im)]\r\n image_list = [directory + im for im in image_list]\r\n return image_list",
"def list_images(img_dir) -> Iterable[str]:\n extensions = (\".png\", \".jpg\", \".jpeg\",... | [
"0.826809",
"0.820497",
"0.78100127",
"0.76965976",
"0.76412135",
"0.7619803",
"0.7599427",
"0.75671864",
"0.7563033",
"0.7471995",
"0.7467322",
"0.7416391",
"0.7407385",
"0.73941857",
"0.7390004",
"0.73765004",
"0.73607075",
"0.73303187",
"0.73159367",
"0.7313564",
"0.729209... | 0.6827584 | 45 |
Calculates the median of a set of angles on the circle and returns a value on the interval from (pi, pi]. Angles expected in radians. | def circ_mean(theta, weights=None):
if len(theta.shape) == 1:
theta = theta[:, np.newaxis]
if weights is None:
weights = np.ones(theta.shape)
medangle = np.arctan2(np.nansum(np.sin(2*theta) * weights),
np.nansum(np.cos(2*theta) * weights))
medangle /= 2.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(values):\n # Write the median() function\n midpoint = int(len(values) / 2)\n if len(values) % 2 == 0:\n median = (values[midpoint - 1] + values[midpoint]) / 2\n else:\n median = values[midpoint]\n\n return float(median)",
"def median(values):\n # Write the median() function\n midpoint... | [
"0.754432",
"0.7454993",
"0.7401808",
"0.7373265",
"0.7160456",
"0.6944919",
"0.6915022",
"0.6838976",
"0.6821556",
"0.6759076",
"0.6700466",
"0.6690233",
"0.66794187",
"0.6643126",
"0.6605087",
"0.6569565",
"0.656566",
"0.6559828",
"0.65353113",
"0.65265703",
"0.65009344",
... | 0.0 | -1 |
Clean up files from testing | def clean_tests(c, tox=False): # pylint: disable=unused-argument
_delete_file(COVERAGE_FILE)
if tox:
shutil.rmtree(TOX_DIR, ignore_errors=True)
shutil.rmtree(COVERAGE_DIR, ignore_errors=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean():\n clean_files()",
"def tearDown(self):\n testing_dir = os.path.split(os.path.realpath(__file__))[0]\n for f in glob.glob(os.path.join(testing_dir, \"*\")):\n if f.split(\".\")[-1] in [\"o\", \"out\", \"pyc\", \"log\"]:\n subprocess.call(['rm', f])",
"def ... | [
"0.80564684",
"0.7943962",
"0.7915168",
"0.78869337",
"0.7880611",
"0.7871559",
"0.7855698",
"0.7820389",
"0.7780667",
"0.7719279",
"0.7690265",
"0.7668686",
"0.76676536",
"0.7659665",
"0.7636486",
"0.7632629",
"0.76258093",
"0.76239574",
"0.76009125",
"0.7560718",
"0.7543386... | 0.7178765 | 73 |
Converts a datetime instance into a string representation. Subclasses can override this method to customise the date string produced by render(). | def format_datetime(self, datetime):
return datetime.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.date) + \" \" + str(self.time_of_day)",
"def render_date(dt):\n return dt.strftime('%Y-%m-%d')",
"def strftime(self, *args, **kwargs):\n return String(super(Datetime, self).strftime(*args, **kwargs))",
"def __str__(self):\n return '{y}-{m:0>2}-{d:0... | [
"0.7278549",
"0.7274628",
"0.72048783",
"0.69671804",
"0.69389516",
"0.6922743",
"0.69152164",
"0.6909397",
"0.6851818",
"0.680502",
"0.6782092",
"0.6782092",
"0.67690974",
"0.67690974",
"0.67690974",
"0.67167217",
"0.66965866",
"0.6653292",
"0.6639205",
"0.6630259",
"0.65986... | 0.68796605 | 8 |
Returns the number of nodes of this bus. | def bus_num_nodes(self) -> int:
return self.dss_obj.BUSI(0, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_nodes(self) -> int:\n return self.graph.number_of_nodes()",
"def number_of_nodes(self):\n return int(self._data['number_of_nodes'])",
"def get_num_nodes(self):\n return len(self._nodes)",
"def get_num_nodes(self):\n return len(self._nodes)",
"def node_count(self) -... | [
"0.85249573",
"0.84598935",
"0.8433336",
"0.8433336",
"0.8424279",
"0.8394951",
"0.8380122",
"0.83672",
"0.831919",
"0.8231919",
"0.8191363",
"0.81723994",
"0.81723994",
"0.8171193",
"0.8121502",
"0.8086145",
"0.8076172",
"0.8076172",
"0.803143",
"0.8004204",
"0.7834883",
"... | 0.87693805 | 0 |
Returns the integer ID of the feeder section in which this bus is located. | def bus_section_id(self) -> int:
return self.dss_obj.BUSI(5, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_id(self) -> str:\n\n return self[\"id\"]",
"def device_id(self):\n return self._id[0]",
"def device_id(self) -> str:\n return self._device_info[\"ID\"]",
"def id(self) -> str:\n return self._event.get('id')",
"def getID(self):\r\n return self._interface.UID",
... | [
"0.67233723",
"0.6070033",
"0.60244405",
"0.5987748",
"0.5978636",
"0.5961157",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.5956797",
"0.59089637",
... | 0.6904933 | 0 |
Returns the correct learning rate scheduler | def get_scheduler(optimizer, scheduler: str, warmup_steps: int, t_total: int):
scheduler = scheduler.lower()
if scheduler == 'constantlr':
return transformers.get_constant_schedule(optimizer)
elif scheduler == 'warmupconstant':
return transformers.get_constant_schedule_with_warmup(optimizer,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scheduler(optimizer, opt):\n \n epochs_no_decay = opt.epochs - opt.lr_linear\n lr_policy = opt.lr_policy\n \n if lr_policy == 'linear':\n def lr_lambda(epoch):\n return 1. - max(0, epoch - epochs_no_decay) / float(opt.lr_linear + 1)\n scheduler = lr_scheduler.LambdaL... | [
"0.782548",
"0.77747315",
"0.7723932",
"0.7681352",
"0.7582447",
"0.7574793",
"0.7552622",
"0.7357193",
"0.73486483",
"0.73431355",
"0.73361933",
"0.7326595",
"0.732221",
"0.73151577",
"0.73077166",
"0.73031414",
"0.7268577",
"0.7246669",
"0.7214503",
"0.7207158",
"0.717903",... | 0.0 | -1 |
Perform edge detection on the image. | def edge_detect(image):
smoothed = smooth(image)
g_mag, g_theta = gradient(smoothed)
nms_image = nms(g_mag, g_theta)
thresholded = hysteresis_threshold(nms_image, g_theta)
return smoothed, g_mag, nms_image, thresholded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_edge_detection(img):\n lower, upper = get_canny_thresholds(img)\n\n blur_img = cv.GaussianBlur(img, (7, 7), cv.BORDER_DEFAULT)\n\n edges_img = cv.Canny(blur_img, lower, upper)\n edges_img = cv.dilate(edges_img, KERNEL, iterations=1)\n\n return cv.copyTo(img, edges_img)",
"def edgeDetec... | [
"0.8284124",
"0.77547413",
"0.77119887",
"0.7500268",
"0.7252173",
"0.71369666",
"0.7048933",
"0.7028367",
"0.69112164",
"0.68677187",
"0.68217033",
"0.67988414",
"0.67923415",
"0.67799574",
"0.67167926",
"0.66592884",
"0.6643418",
"0.6633413",
"0.6598111",
"0.65859663",
"0.6... | 0.70425653 | 7 |
Two zones are equal if they have the same origin, class, and nodes. Returns a ``bool``. | def __eq__(self, other):
if not isinstance(other, Zone):
return False
if self.rdclass != other.rdclass or \
self.origin != other.origin or \
self.nodes != other.nodes:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compare_zone_equal(self):\n zoneA = Zone('zonea.example.com')\n zoneB = Zone('zonea.example.com')\n self.assertEqual(zoneA, zoneB)",
"def __eq__(self, other):\n\n # Attributes defining the instance\n ckeys = ['x0', 'y0', 'nx', 'ny', 'dx', 'dy', 'origin']\n\n a =... | [
"0.72915196",
"0.6925353",
"0.6878759",
"0.6768374",
"0.671669",
"0.66832733",
"0.6602036",
"0.6494872",
"0.64827675",
"0.6441968",
"0.64159906",
"0.6413742",
"0.64089656",
"0.6326719",
"0.6326719",
"0.63114667",
"0.6283745",
"0.6264447",
"0.62608594",
"0.6233672",
"0.6231823... | 0.80860627 | 0 |
Are two zones not equal? Returns a ``bool``. | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compare_zone_not_equal(self):\n zoneA = Zone('zonea.example.com')\n zoneB = Zone('zoneb.example.com')\n self.assertNotEqual(zoneA, zoneB)",
"def __eq__(self, other):\n\n if not isinstance(other, Zone):\n return False\n if self.rdclass != other.rdclass or \\\... | [
"0.809902",
"0.7158009",
"0.707283",
"0.68936497",
"0.6478616",
"0.63927853",
"0.63895494",
"0.63514566",
"0.6328615",
"0.6269593",
"0.62406695",
"0.6208461",
"0.61819726",
"0.61768997",
"0.6172744",
"0.6122527",
"0.6117556",
"0.61060274",
"0.610158",
"0.6084433",
"0.60718614... | 0.0 | -1 |
MAC Address of the EAGLE device | def network_interface(self):
return self._network_interface | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac",
"def mac_address(self) -> str:\n return self._device.mac",
"def mac_address(self):\n return self._mac_address",
"def _get_mac_address():\n if not sys.platform.startsw... | [
"0.7967206",
"0.79511315",
"0.77345484",
"0.7719846",
"0.7696588",
"0.760301",
"0.75890523",
"0.756276",
"0.7551958",
"0.75480914",
"0.7543726",
"0.7443597",
"0.73529553",
"0.7294472",
"0.7274368",
"0.7274368",
"0.7227118",
"0.71522784",
"0.7100935",
"0.7050069",
"0.69789135"... | 0.0 | -1 |
The start time of the current block tariff period | def block_period_start(self): # ISO8601 or timestamp
return self._safe_value(VAR_BLOCKPERIODSTART, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self) -> datetime:\n return self.root_hartree.start_time",
"def get_start_time(self):\n # Timezone and BST not accounted for. Always gives it as GMT.\n create_time = (os.path.getmtime(self.file_path))\n start_time = create_time - len(self.amplitude) / self.fs\n r... | [
"0.7645058",
"0.7568115",
"0.74151313",
"0.73752314",
"0.73532724",
"0.73457056",
"0.7278563",
"0.7263116",
"0.7263116",
"0.7263116",
"0.7263116",
"0.7263116",
"0.7263116",
"0.7263116",
"0.7263116",
"0.72586554",
"0.72586554",
"0.72340673",
"0.7209787",
"0.7104094",
"0.709045... | 0.73205614 | 6 |
The current block tariff period duration in minutes | def block_period_duration(self):
return self._safe_value(VAR_BLOCKPERIODDURATION, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\r\n\t\treturn (self.globEnd - self.globStart)",
"def duration(self) -> float:\n return self.endTime()-self.startTime()",
"def duration(self):\r\n return self.t2 - self.t1",
"def duration(self):\n return float('{0:.2f}'.format(self.end_time - self.start_time))",
"def _ge... | [
"0.72078276",
"0.71375793",
"0.7048773",
"0.702884",
"0.701353",
"0.6974584",
"0.6957038",
"0.69492245",
"0.69492245",
"0.69490904",
"0.69111174",
"0.69086605",
"0.69048446",
"0.6899444",
"0.6899444",
"0.6896477",
"0.68957704",
"0.6893715",
"0.68555015",
"0.6833176",
"0.68325... | 0.7787475 | 0 |
The start time of the current billing period | def billing_period_start(self): # ISO8601 or timestamp
return self._safe_value(VAR_BILLINGPERIODSTART, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self) -> str:\n return pulumi.get(self, \"start_time\")",
"def start_time(self) -> str:\n return pulumi.get(self, \"start_time\")",
"def cal_start(self):\n return self.datetime_start",
"def start_time(self):\n return self._meta['start_time']",
"def start_time(self... | [
"0.7512811",
"0.7512811",
"0.7393842",
"0.73159766",
"0.7266704",
"0.72393805",
"0.72393805",
"0.72393805",
"0.72393805",
"0.72393805",
"0.72393805",
"0.72393805",
"0.72393805",
"0.7200604",
"0.71850264",
"0.7164719",
"0.71324563",
"0.7124935",
"0.7091507",
"0.7070286",
"0.70... | 0.8077059 | 0 |
The current billing period duration in minutes (min) | def billing_period_duration(self):
return self._safe_value(VAR_BILLINGPERIODDURATION, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes(self):\n return int((self.end - self.start).total_seconds()) / 60",
"def duration(self):\n if hasattr(self, 'completed_on') and hasattr(self, 'started_on'):\n diff = (self.completed_on - self.started_on)\n minutes, seconds = divmod(diff.seconds, 60)\n re... | [
"0.6823375",
"0.678405",
"0.6726841",
"0.6696338",
"0.665704",
"0.66564304",
"0.6651182",
"0.66208875",
"0.6536712",
"0.65286434",
"0.65205956",
"0.6495227",
"0.64446056",
"0.6423636",
"0.64083457",
"0.6368984",
"0.6367671",
"0.63518095",
"0.6347099",
"0.63463885",
"0.6328866... | 0.8063688 | 0 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block1_price(self):
return self._safe_value(VAR_BLOCK1PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72418636",
"0.66816735",
"0.6673769",
"0.66259855",
"0.6526725",
"0.6526725",
"0.6526725",
"0.65166247",
"0.6476308",
"0.6475577",
"0.6444158",
"0.6423489",
"0.64117545",
"0.6306492",
"0.630191",
"0.62974197",
"0.62895745",
"0.6265204",
"0.62397766",
"0.62315136",
"0.62295... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block2_price(self):
return self._safe_value(VAR_BLOCK2PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72397214",
"0.66830206",
"0.6675519",
"0.6627908",
"0.65282124",
"0.65282124",
"0.65282124",
"0.6519089",
"0.64774185",
"0.6476989",
"0.6444673",
"0.6424553",
"0.6413431",
"0.6306466",
"0.6303392",
"0.6299077",
"0.62885004",
"0.62655497",
"0.6238459",
"0.62325156",
"0.6229... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block3_price(self):
return self._safe_value(VAR_BLOCK3PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72418636",
"0.66816735",
"0.6673769",
"0.66259855",
"0.6526725",
"0.6526725",
"0.6526725",
"0.65166247",
"0.6476308",
"0.6475577",
"0.6444158",
"0.6423489",
"0.64117545",
"0.6306492",
"0.630191",
"0.62974197",
"0.62895745",
"0.6265204",
"0.62397766",
"0.62315136",
"0.62295... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block4_price(self):
return self._safe_value(VAR_BLOCK4PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72397214",
"0.66830206",
"0.6675519",
"0.6627908",
"0.65282124",
"0.65282124",
"0.65282124",
"0.6519089",
"0.64774185",
"0.6476989",
"0.6444673",
"0.6424553",
"0.6413431",
"0.6306466",
"0.6303392",
"0.6299077",
"0.62885004",
"0.62655497",
"0.6238459",
"0.62325156",
"0.6229... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block5_price(self):
return self._safe_value(VAR_BLOCK5PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72418636",
"0.66816735",
"0.6673769",
"0.66259855",
"0.6526725",
"0.6526725",
"0.6526725",
"0.65166247",
"0.6476308",
"0.6475577",
"0.6444158",
"0.6423489",
"0.64117545",
"0.6306492",
"0.630191",
"0.62974197",
"0.62895745",
"0.6265204",
"0.62397766",
"0.62315136",
"0.62295... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block6_price(self):
return self._safe_value(VAR_BLOCK6PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72397214",
"0.66830206",
"0.6675519",
"0.6627908",
"0.65282124",
"0.65282124",
"0.65282124",
"0.6519089",
"0.64774185",
"0.6476989",
"0.6444673",
"0.6424553",
"0.6413431",
"0.6306466",
"0.6303392",
"0.6299077",
"0.62885004",
"0.62655497",
"0.6238459",
"0.62325156",
"0.6229... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block7_price(self):
return self._safe_value(VAR_BLOCK7PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72418636",
"0.66816735",
"0.6673769",
"0.66259855",
"0.6526725",
"0.6526725",
"0.6526725",
"0.65166247",
"0.6476308",
"0.6475577",
"0.6444158",
"0.6423489",
"0.64117545",
"0.6306492",
"0.630191",
"0.62974197",
"0.62895745",
"0.6265204",
"0.62397766",
"0.62315136",
"0.62295... | 0.0 | -1 |
The price of Energy, Gas, or Water delivered to the premises at a specific price tier | def block8_price(self):
return self._safe_value(VAR_BLOCK8PRICE, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_tier(self):\n return self._safe_value(VAR_PRICETIER, str)",
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\r\n return self.price",
"def compute_quotation_price(self):\n result = decimal.Decimal('0')\n if self.vehiculePrice:\n ... | [
"0.72397214",
"0.66830206",
"0.6675519",
"0.6627908",
"0.65282124",
"0.65282124",
"0.65282124",
"0.6519089",
"0.64774185",
"0.6476989",
"0.6444673",
"0.6424553",
"0.6413431",
"0.6306466",
"0.6303392",
"0.6299077",
"0.62885004",
"0.62655497",
"0.6238459",
"0.62325156",
"0.6229... | 0.0 | -1 |
Return the result of evaluating the perceptron for the specified point. The result is NOT normalized to 1 or 1. | def __evaluate(self, point):
assert len(point) == len(self.weight)-1
result = self.weight[0]
for i in range(0,len(point)):
result += self.weight[i+1] * point[i]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perceptron_output(weights, bias, x):\n return step_function(dot(weights, x) + bias)",
"def evaluate(self, point):\n result = self.__evaluate(point)\n return -1 if result < 0 else 1",
"def pred(self, x):\r\n\r\n y = self.alpha * x + self.beta * self.__Us__(x) + self.gamma * self.__Vs... | [
"0.6968045",
"0.64423186",
"0.64106333",
"0.6397378",
"0.6336047",
"0.6185162",
"0.6134708",
"0.6065578",
"0.60531807",
"0.60393006",
"0.60192436",
"0.5995875",
"0.59957916",
"0.59763473",
"0.5963962",
"0.5936369",
"0.593205",
"0.5886516",
"0.58769965",
"0.5805606",
"0.577770... | 0.6816272 | 1 |
Closes the open connection to the database | def close_connection(exception):
db = database()
if db is not None:
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def close(self):\n if... | [
"0.8597994",
"0.8555969",
"0.8446568",
"0.84407026",
"0.82747215",
"0.81953996",
"0.81918883",
"0.8164018",
"0.8153449",
"0.8108013",
"0.80921644",
"0.8024123",
"0.80070657",
"0.79534286",
"0.79456353",
"0.79090255",
"0.79090255",
"0.79090255",
"0.7891949",
"0.7826177",
"0.78... | 0.81157047 | 9 |
Setup the queue on RabbitMQ by invoking the Queue.Declare RPC command. When it is complete, the on_queue_declareok method will be invoked by pika. | def setup_queue(self, channel, queue_name):
logger.info('Declaring queue %s', queue_name)
channel.queue_declare(queue = queue_name,
durable = True,
auto_delete = False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_queue(self):\n self.logger.info('declaring queue %s', self.queue)\n if self.otq:\n self._channel.queue_declare(self.on_queue_declareok, self.queue, auto_delete=True)\n else:\n self._channel.queue_declare(self.on_queue_declareok, self.queue)",
"def declare_queu... | [
"0.8278995",
"0.8206087",
"0.81292164",
"0.76214963",
"0.7539734",
"0.73798233",
"0.7365958",
"0.72318727",
"0.7215227",
"0.7107283",
"0.6915534",
"0.69133604",
"0.68983746",
"0.6769809",
"0.67285573",
"0.6686681",
"0.668095",
"0.6675178",
"0.66603047",
"0.66062284",
"0.65085... | 0.78097844 | 3 |
A function returning tracks from a list of artist URIs as pandas DataFrame. | def get_all_tracks_from_artists(sp, artist_uri_list):
track_list = [["track_name", "track_uri", "track_release_date", "artist_name"]]
track_df = pd.DataFrame(columns=track_list[0])
print("Log: Pulling data from Spotify. This can take a while...")
for artist_uri in artist_uri_list:
# Get artis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_albums_from_artists(sp, artist_uri_list):\n\n # Create header for output df\n albums_list = [[\"name\", \"album_uri\", \"album_release_date\", \"artist_uri\"]]\n\n print(\"Log: Pulling data from Spotify. This can take a while...\")\n\n # Loop through list of artist uris\n for artist_uri in a... | [
"0.7871076",
"0.75397474",
"0.70453966",
"0.6915533",
"0.6542338",
"0.64134365",
"0.6241214",
"0.61474365",
"0.6142896",
"0.6121559",
"0.6069996",
"0.606546",
"0.6062707",
"0.6045035",
"0.5948782",
"0.5890532",
"0.5890283",
"0.5874613",
"0.5839457",
"0.58017147",
"0.57949966"... | 0.8216879 | 0 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.8081514",
"0.7890486",
"0.7534929",
"0.72789717",
"0.72789717",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
... | 0.0 | -1 |
Returns player who has the next turn on a board. | def player(board):
numbofO = sum(row.count("O") for row in board)
numbofX = sum(row.count("X") for row in board)
if numbofX > numbofO:
return O
else:
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None",
"def next_player(self,board, prev_player):\r\n... | [
"0.7911148",
"0.7521969",
"0.74204457",
"0.73687756",
"0.71954805",
"0.69775087",
"0.69621766",
"0.69253695",
"0.69208723",
"0.69010353",
"0.6845991",
"0.6841043",
"0.6838282",
"0.68265843",
"0.67751175",
"0.67751175",
"0.6769739",
"0.6713109",
"0.67060393",
"0.66561204",
"0.... | 0.0 | -1 |
Returns the optimal action for the current player on the board. | def minimax(board):
best_act = None
if terminal(board):
return best_act
if player(board) == X:
key = -999999
for action in actions(board):
if key < min_value(result(board, action)):
key = min_value(result(board, action))
best_act = action
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min... | [
"0.7766856",
"0.76323676",
"0.75855315",
"0.75285065",
"0.75175256",
"0.74667144",
"0.7460485",
"0.74263537",
"0.7416421",
"0.73943585",
"0.7375846",
"0.7333894",
"0.73147565",
"0.7306611",
"0.7284639",
"0.72650313",
"0.72650313",
"0.72331834",
"0.7203267",
"0.71732694",
"0.7... | 0.7250975 | 17 |
Mean and variance normalization | def normalize_audio_feature(audio_feature, per_feature=False):
axis = 0 if per_feature else None
mean = np.mean(audio_feature, axis=axis)
std_dev = np.std(audio_feature, axis=axis) + 1e-9
normalized = (audio_feature - mean) / std_dev
return normalized | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variance_normalize(self):\n self.img = self.img / np.sqrt(np.sum(self.img ** 2))",
"def normalize(dataset):\n return normalize_standard_deviation(normalize_mean(dataset))",
"def normalize(values):\n return (values - np.mean(values)) / np.std(values)",
"def normalize_data(x):\n mvec = x.mean... | [
"0.7804589",
"0.7488366",
"0.7324178",
"0.7320944",
"0.7320944",
"0.72563183",
"0.7207796",
"0.7174324",
"0.71698266",
"0.7155209",
"0.7152432",
"0.70854294",
"0.7069095",
"0.7053123",
"0.70428413",
"0.69971496",
"0.6985351",
"0.6974292",
"0.6960158",
"0.6944718",
"0.6944718"... | 0.0 | -1 |
Shift a list of the given value | def shift(left: str, right: str, n: int) -> Tuple[str, str]:
return left[n:] + left[:n], right[n:] + right[:n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_elements(self, shifts):\n for _ in range(shifts):\n # get the current tail of the list\n old_tail = self.get_tail()\n # delete the current tail\n self.remove_tail()\n # place the current tail in the beginning of the list, with that all elem... | [
"0.71379375",
"0.70234436",
"0.6785773",
"0.66196746",
"0.6435257",
"0.6424303",
"0.64157844",
"0.6369295",
"0.63276774",
"0.62408024",
"0.6222246",
"0.6220321",
"0.61955136",
"0.619435",
"0.6194123",
"0.6178145",
"0.6154588",
"0.6148846",
"0.61434335",
"0.6132557",
"0.610771... | 0.0 | -1 |
Get the value and size expected of a string and convert it to binary with padding '0' | def bin_value(val: str, bits_size: int) -> str:
bin_val = (bin(val) if isinstance(val, int) else bin(ord(val)))[2:]
if len(bin_val) > bits_size:
raise Exception("Binary value larger than the expected size")
while len(bin_val) < bits_size:
# Add as many 0 as needed to ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary(string):\r\n # Use special logic for NULL_STRING to avoid errors\r\n if string == NULL_STRING:\r\n return \"00000000\"\r\n # Otherwise, gives the binary representation of UTF-8 characters\r\n return \"\".join(\"{:08b}\".format(d) for d in bytearray(string, \"utf-8\"))",
"def rep... | [
"0.7195243",
"0.691914",
"0.68519115",
"0.67602664",
"0.6713395",
"0.6704916",
"0.66772336",
"0.6661767",
"0.6595604",
"0.64972264",
"0.6478161",
"0.6472867",
"0.6467612",
"0.6451272",
"0.64436585",
"0.6436257",
"0.6396952",
"0.6396323",
"0.63821626",
"0.6381596",
"0.6314219"... | 0.70003134 | 1 |
Split a list into sub lists of size n | def n_split(text1: Iterable, n: int) -> list:
return [text1[k:k + n] for k in range(0, len(text1), n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_list_into_sublists_of_size_n(lst, n):\n return [lst[i : i + n] for i in range(0, len(lst), n)]",
"def get_chunks(lst, n):\n size = int(len(lst) / n)\n output_list = []\n for i in range(0, n):\n sub_list = lst[i*size:i*size + size]\n output_list.append(sub_list)\n if len(lst... | [
"0.88465303",
"0.8401781",
"0.840168",
"0.8314209",
"0.8289345",
"0.8276537",
"0.82236266",
"0.8198643",
"0.8116591",
"0.8107605",
"0.8001299",
"0.7989753",
"0.79798406",
"0.7873167",
"0.7856985",
"0.78444165",
"0.7828117",
"0.77965206",
"0.7779771",
"0.7773871",
"0.77290714"... | 0.0 | -1 |
Turns an Klength list of words into a tensor. e.g. t = words_to_tensor(['BAD', 'GAB'], Vocab('ABCDEFG'), 3) t[0] is a matrix representations of 'BAD', where the jth column is a onehot vector for the jth letter print(t[0]) | def words_to_tensor(words, vocab, max_word_length):
tensor = torch.zeros(len(words), len(vocab), max_word_length)
for i, word in enumerate(words):
for li, letter in enumerate(word):
tensor[i][vocab(letter)][li] = 1
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def words_to_tensor(words, words_lookup_index, include_eos=True, numbers_replace=True, unknown_replace=True):\n if type(words) != list: raise Exception(\"Expected a list (not a string etc)\")\n tensor_length = len(words) + 1 if include_eos else len(words)\n # tensor = np.zeros((1, tensor_length, len(words... | [
"0.6709068",
"0.61834335",
"0.61017907",
"0.607897",
"0.6049018",
"0.60485023",
"0.60476816",
"0.60298413",
"0.59865266",
"0.5960889",
"0.5946785",
"0.59440196",
"0.59288937",
"0.59025127",
"0.58659756",
"0.5855923",
"0.5853739",
"0.5850779",
"0.58319956",
"0.5795229",
"0.576... | 0.7782583 | 0 |
Restore the previously trained parameters if there are any. | def _check_restore_parameters(sess, saver):
ckpt = tf.train.get_checkpoint_state(os.path.dirname( 'final_model/'))
if ckpt and ckpt.model_checkpoint_path:
print("Loading parameters for the Chatbot -> {}".format(ckpt.model_checkpoint_path))
saver.restore(sess, ckpt.model_checkpoint_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self):\n self._logger = LOGGER\n self._param_store = pyro.get_param_store()\n self.set_state(self.best_params)\n self._alpha_guide_prior_params = dict(\n self._param_store.named_parameters()\n )",
"def restore(self):\n if os.path.isfile( \\\n ... | [
"0.8418335",
"0.80244166",
"0.74308294",
"0.73372585",
"0.73254377",
"0.72526085",
"0.7194377",
"0.7181483",
"0.71472156",
"0.7045396",
"0.7040525",
"0.70233345",
"0.70205426",
"0.6965303",
"0.6950016",
"0.69295305",
"0.6920862",
"0.6879667",
"0.6879667",
"0.6855527",
"0.6833... | 0.6935549 | 15 |
Converts a networkx graph to a graphtool graph. | def nx2gt(nxG):
# Phase 0: Create a directed or undirected graph-tool Graph
gtG = Graph(directed=nxG.is_directed())
# Add the Graph properties as "internal properties"
for key, value in list(nxG.graph.items()):
# Convert the value and key into a type for graph-tool
tname, value, key = g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertGraph(G):\n G_new = nx.Graph()\n for nd, attrs in G.nodes(data=True):\n G_new.add_node(str(nd), chem=attrs['atom_symbol'])\n# G_new.add_node(str(nd), x=str(attrs['attributes'][0]),\n# y=str(attrs['attributes'][1]))\n ... | [
"0.6956446",
"0.6858025",
"0.6852269",
"0.6420233",
"0.6407672",
"0.63540167",
"0.6352175",
"0.6263276",
"0.625571",
"0.6189421",
"0.61776185",
"0.616564",
"0.61190283",
"0.60974497",
"0.60711974",
"0.6051375",
"0.6025335",
"0.5982495",
"0.59679276",
"0.5966493",
"0.59647673"... | 0.66158944 | 3 |
Write a given dataframe to a csv file. | def writefile(data, filepath, encoding='utf-8', header=False):
data.to_csv(filepath, encoding=encoding, header=header) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)",
"def write_dataframe_to_csv(filename: str, df: pandas.DataFrame) -> None:\n print('\\nWriting to csv file: ' + filename + '... ', end='', fl... | [
"0.8371662",
"0.8254608",
"0.8229808",
"0.8102605",
"0.80133224",
"0.7931951",
"0.7922548",
"0.79037845",
"0.7854983",
"0.78273106",
"0.7793187",
"0.7721374",
"0.7719001",
"0.7690041",
"0.7664396",
"0.76365304",
"0.75780135",
"0.7577078",
"0.75538766",
"0.7515488",
"0.7494781... | 0.0 | -1 |
Get the surprisal score of the target token. | def get_surprisal(out: Tensor, target_idx: Optional[Tensor] = None) -> Tensor:
out = out.squeeze(1)
out = F.softmax(out)
# If target indices are not given, just use most likely token
if target_idx is None:
target_idx = torch.argmax(out, dim=1, keepdim=True)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surprisal(self, token: str, follower: str) -> float:\n try: \n dist = self._cooccurrence_matrix.distribution(token)\n except KeyError:\n dist = self._cooccurrence_matrix.distribution('UNKNOWN_TOKEN')\n return dist.surprisal(follower)",
"def get_token_score(self) ... | [
"0.71494824",
"0.65639997",
"0.64691204",
"0.64601636",
"0.6340134",
"0.6272869",
"0.6241693",
"0.6241693",
"0.6241693",
"0.62019074",
"0.62019074",
"0.62019074",
"0.6172992",
"0.6130303",
"0.6123889",
"0.61006594",
"0.6100553",
"0.6091367",
"0.6081719",
"0.60721576",
"0.6071... | 0.5877035 | 31 |
Get list of lowercase words with no hyphens from /usr/share/dict/words. | def get_words_from_unix_dict():
process = subprocess.Popen("cat /usr/share/dict/words".split(), stdout=subprocess.PIPE)
output, error = process.communicate()
output = output.decode("utf-8")
words = set(word.lower() for word in output.splitlines() if "-" not in word)
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def words_without_letter(l):\n\treturn {w for w in word_set if has_no_letter(w, l)}",
"def get_words(doc):\n splitter = re.compile('\\\\W*')\n # Split the words by non-alpha characters\n words = [s.lower() for s in splitter.split(doc) \n if len(s)>2 and len(s)<20]\n # Return the unique set o... | [
"0.6964795",
"0.6918155",
"0.6915159",
"0.6775845",
"0.6747031",
"0.6747031",
"0.66540176",
"0.659432",
"0.65687025",
"0.6557906",
"0.6540956",
"0.6515429",
"0.64967954",
"0.64820147",
"0.64820147",
"0.6472539",
"0.646143",
"0.6424281",
"0.64075494",
"0.64024436",
"0.6402056"... | 0.7877812 | 0 |
Return value if a positive number representation, else NoneType. | def return_value(original_value):
try:
result = original_value if float(original_value) > 0 else None
except (ValueError, TypeError):
result = None
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonNegativeIntOrNone(value):\n return None if value == None or value < 0 else int(value)",
"def nonNegativeFloatOrNone(value):\n return None if value == None or value < 0 else float(value)",
"def value_or_none(value):\n if value or value == 0:\n return value\n return None",
"de... | [
"0.7861091",
"0.77754116",
"0.7371319",
"0.67531484",
"0.6665421",
"0.6665421",
"0.66544694",
"0.6626181",
"0.6605246",
"0.656462",
"0.65139335",
"0.64448595",
"0.643142",
"0.643142",
"0.63611954",
"0.6346943",
"0.630479",
"0.6289362",
"0.6285839",
"0.62751186",
"0.62698936",... | 0.6933792 | 3 |
Insert features into the dataset from iterables of iterable items. | def insert_features_from_iters(etl, insert_iters_kwargs):
import arcetl
func = functools.partial(etl.transform,
transformation=arcetl.features.insert_from_iters)
tuple(func(**insert_kwargs) for insert_kwargs in insert_iters_kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_feature_list(self, features): \n for f in features:\n featuretype = f.pop('featuretype', None)\n if featuretype is None:\n raise LoopException\n if featuretype == 'strati':\n self.create_and_add_foliation(f)\n #... | [
"0.5972539",
"0.5828876",
"0.5810859",
"0.57505304",
"0.567875",
"0.5677376",
"0.56661165",
"0.563806",
"0.56223744",
"0.5590745",
"0.5571025",
"0.5544879",
"0.55069107",
"0.5500455",
"0.5488998",
"0.54677796",
"0.5411551",
"0.54105675",
"0.54063845",
"0.53908396",
"0.5385259... | 0.6382074 | 0 |
Read requirements.txt file and returns list of requirements. | def find_requirements():
with open("requirements.txt", 'r') as f:
return f.read().splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_requirements():\r\n reqs_path = os.path.join('.', 'requirements.txt')\r\n with open(reqs_path, 'r') as f:\r\n requirements = [line.rstrip() for line in f]\r\n return requirements",
"def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r'... | [
"0.9123963",
"0.9116706",
"0.9001196",
"0.85081416",
"0.84037703",
"0.8356296",
"0.82185894",
"0.81810987",
"0.8170526",
"0.8153894",
"0.8146366",
"0.80244815",
"0.80017686",
"0.79979545",
"0.7921747",
"0.7910726",
"0.7907223",
"0.78268754",
"0.77456623",
"0.77045256",
"0.766... | 0.86554515 | 3 |
A `cron()` or `rate()` expression that defines the schedule for rotating your secret. Either `automatically_after_days` or `schedule_expression` must be specified. | def schedule_expression(self) -> Optional[str]:
return pulumi.get(self, "schedule_expression") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cron(self):\n hour, day = (self.pk // 30) % 24, self.pk % 30 + 1\n return f\"0 {hour} {day} * *\"",
"def auto_expire_after(self, auto_expire_after):\n\n self._auto_expire_after = auto_expire_after",
"def test_plan_autorenew_at_expire(self):\n up = baker.make(\"UserPlan\", expire... | [
"0.5616396",
"0.55404145",
"0.53792703",
"0.5358782",
"0.5358782",
"0.52988315",
"0.52660215",
"0.52118903",
"0.51159984",
"0.5104934",
"0.5102926",
"0.50840324",
"0.50840324",
"0.5053304",
"0.5053304",
"0.50051266",
"0.50025934",
"0.49932772",
"0.49902967",
"0.49731132",
"0.... | 0.5228385 | 7 |
Delete all the mappings for an organization. Note that this will erase all the mappings so if a user views an existing Data Mapping the mappings will not show up as the actual mapping, rather, it will show up as new suggested mappings | def delete_mappings(organization):
count, _ = ColumnMapping.objects.filter(super_organization=organization).delete()
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_mappings(self):\n if config.HAS_RBAC:\n RBACMapping.objects(org=self._instance.id, team=self.id).delete()",
"def delete_all(organization):\n cm_delete_count, _ = ColumnMapping.objects.filter(super_organization=organization).delete()\n c_count, _ = Column.objects.filter(or... | [
"0.6900911",
"0.6609467",
"0.57543826",
"0.5686556",
"0.5653826",
"0.5535062",
"0.55096567",
"0.5478229",
"0.5349959",
"0.5336606",
"0.5304741",
"0.5249965",
"0.524425",
"0.5218497",
"0.52136016",
"0.51615363",
"0.51562613",
"0.5145556",
"0.51436937",
"0.5137076",
"0.5126562"... | 0.7834001 | 0 |
Check whether stack is empty. | def is_empty(self):
return self.size() == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def is_empty(self): #checks to see if stack is empty or not\n if self.num_items == 0:\n return True\n else:\n return False",
"def isEm... | [
"0.9122795",
"0.90365535",
"0.884293",
"0.8835341",
"0.88147336",
"0.88068",
"0.88068",
"0.87527984",
"0.87487656",
"0.869364",
"0.86491513",
"0.8640534",
"0.8617872",
"0.858031",
"0.85726327",
"0.85658294",
"0.85477036",
"0.8488841",
"0.8444297",
"0.8444297",
"0.84195274",
... | 0.7368214 | 83 |
Return the maximum element in the stack, which is always on top of the stack | def return_the_maximum(self):
return self.__max_stack[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n # 0(1)\n return self.max_stack.peek()\n\n # Don't need find_max we returned max_stack.peek()",
"def max_stack(self):\n if self.maxx == []:\n return None\n return self.maxx[-1]",
"def max(self):\n\n maximum = -float('inf')\n\n for ... | [
"0.85754836",
"0.8533794",
"0.80209136",
"0.8018417",
"0.7681228",
"0.7611001",
"0.75346667",
"0.7420958",
"0.7335006",
"0.7327212",
"0.7273262",
"0.7255503",
"0.7250815",
"0.72318596",
"0.7225981",
"0.720322",
"0.7173221",
"0.7143676",
"0.7098698",
"0.7087455",
"0.7065829",
... | 0.8481513 | 2 |
Get a path parameter and cast it to an integer, if the parameter is not present, or the value can not be cast to an integer, return default | def getIntParam(self, paramkey, default=None):
value = self.request.getParameter(paramkey)
if value is None: return default
try: return int(value)
except: return default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_int_param(request, param):\n try:\n int_param = utils.validate_integer(request.GET[param], param,\n min_value=0)\n except exception.InvalidInput as e:\n raise webob.exc.HTTPBadRequest(explanation=e.format_message())\n return int_param",
"d... | [
"0.7222848",
"0.71844774",
"0.689845",
"0.68008476",
"0.677647",
"0.6595834",
"0.642048",
"0.6330228",
"0.63142705",
"0.6284213",
"0.6257861",
"0.6248694",
"0.6131737",
"0.61102664",
"0.6103521",
"0.6075317",
"0.6068539",
"0.6060045",
"0.605451",
"0.60239136",
"0.60233426",
... | 0.748394 | 0 |
Get a regexp group from the path, and convert it to an integer, if the group does not exist or if the value can't be cast to an integer, return default | def getIntGroup(self, groupname, default=None):
try: return int(self.match.group(groupname))
except: return default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_num(path):\n nbasename = path.basename.lower()\n if nbasename.startswith(nprefix):\n try:\n return int(nbasename[len(nprefix) :])\n except ValueError:\n pass",
"def get_pattern(src_string, regex):\n ret = N... | [
"0.67850995",
"0.6364526",
"0.6231727",
"0.60164464",
"0.5760809",
"0.5678779",
"0.56726784",
"0.5668769",
"0.5566954",
"0.55648816",
"0.5536623",
"0.55349666",
"0.55137295",
"0.54903203",
"0.5432066",
"0.54236746",
"0.54184467",
"0.53953445",
"0.53455734",
"0.5335527",
"0.53... | 0.7309398 | 0 |
Compute first author name | def first_author(self) -> Tuple[str, str]:
first_author = self.author[0]
*name, last_name = first_author.split()
name = ' '.join(name)
return name, last_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_first_author(self):\n if not len(self.get_authors()):\n return ''\n return self.get_authors()[0]",
"def get_author_full_name(self, obj):\n return obj.author.get_full_name()",
"def get_author_name(author_node):\n surname = author_node.xpath(\"string(./surname[1])\... | [
"0.7985612",
"0.72938526",
"0.7268936",
"0.7205666",
"0.7199039",
"0.71618026",
"0.7085625",
"0.70763063",
"0.7024325",
"0.69922245",
"0.69894844",
"0.6986968",
"0.69864804",
"0.6933969",
"0.6914182",
"0.6905755",
"0.6863087",
"0.6845996",
"0.6841327",
"0.68049496",
"0.677685... | 0.7818143 | 1 |
Returns the number of vertices in this graph. | def V(self):
return self._V | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_vertices(self):\n\n return self._graph_state.get_num_vertices()",
"def vertexCount(self):\n return self._nVertices",
"def return_num_vertices(self):\n return self.__size",
"def num_vertices(self):\r\n return len(self.__graph_dict.keys())",
"def num_vertices(self):\n ... | [
"0.91784006",
"0.89555126",
"0.8831613",
"0.8826087",
"0.8793151",
"0.8753308",
"0.8753308",
"0.8739798",
"0.86378086",
"0.8595506",
"0.85551095",
"0.854068",
"0.83232296",
"0.81510115",
"0.8078607",
"0.8072659",
"0.7731173",
"0.7691621",
"0.7685481",
"0.76742816",
"0.7333157... | 0.0 | -1 |
Returns the number of edges in this graph. | def E(self):
return self._E | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def edge_count(self) -> int:\n return self._n_edges",
"def get_num_edges(self):\n\n return self._graph_state.get_num_edges()",
"def num_edges(self):\n return sum(1 for _ in self.iteredges())",
"def num_ed... | [
"0.91547024",
"0.91172725",
"0.8940439",
"0.8718884",
"0.87164164",
"0.86571723",
"0.86352956",
"0.8592467",
"0.85633326",
"0.8544694",
"0.84911984",
"0.84471273",
"0.83731735",
"0.8359442",
"0.8335001",
"0.82914424",
"0.82011163",
"0.81875676",
"0.8176531",
"0.80892587",
"0.... | 0.0 | -1 |
Returns a string representation of this graph. | def __repr__(self):
s = ["{} vertices, {} edges\n".format(self._V, self._E)]
for v in range(self._V):
s.append("%d : " % (v))
for w in self._adj[v]:
s.append("%d " % (w))
s.append("\n")
return "".join(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n built_string = \"Graph(\"\n built_string += str(self.get_nodes())\n built_string += \", \"\n built_string += str(self.get_edges())\n built_string += \")\"\n return built_string",
"def __str__(self):\n built_string = \"Graph(\"\n built_s... | [
"0.8727078",
"0.8727078",
"0.8592699",
"0.849728",
"0.8452277",
"0.84223205",
"0.8066962",
"0.80621034",
"0.7998013",
"0.79017246",
"0.78627264",
"0.78589535",
"0.78113735",
"0.77909976",
"0.7773326",
"0.7773326",
"0.7614871",
"0.7602122",
"0.75904197",
"0.7550327",
"0.754929... | 0.7556336 | 19 |
Returns an array with three elments R, G and B with a certain level of black or red (depending on the sign of the numbre provided) | def getColor(self,number):
if number >= 0:
if self.inverse:
ret = cs.hsv_to_rgb(0,0,abs(number/self.maxp))
else:
ret = cs.hsv_to_rgb(0,0,1-abs(number/self.maxp))
else:
if self.inverse:
ret = cs.hsv_to_rgb(0,1-abs(number/self.maxn),1)
else:
ret = cs.hsv_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inner_colour(self, r1, r2, r3, b1, b2, b3):\n\n def colour(z, i):\n \"\"\"\n Gets the colour of a z and step value.\n\n :param z: the z value from the mandelbrot set\n :param i: the step value\n\n :rtype: list\n :return: list containi... | [
"0.635454",
"0.62969494",
"0.62657106",
"0.6203923",
"0.60647345",
"0.60170394",
"0.5949997",
"0.59244925",
"0.5915436",
"0.59111035",
"0.5882366",
"0.58785224",
"0.58674186",
"0.58631635",
"0.5857275",
"0.58562654",
"0.58516127",
"0.58327127",
"0.5824512",
"0.5811129",
"0.57... | 0.61071146 | 4 |
Return image data from a raw PGM file as numpy array. | def read_pgm(filename, byteorder='>'):
with open(filename, 'rb') as f:
buffer = f.read()
try:
header, width, height, maxval = re.search(
b"(^P5\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\r\n]\s)*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_pgm(filename, byteorder='>'):\r\n with open(filename, 'rb') as f:\r\n buffer = f.read()\r\n try:\r\n header, width, height, maxval = re.search(\r\n b\"(^P5\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n... | [
"0.7748824",
"0.77299756",
"0.7727519",
"0.754521",
"0.74380463",
"0.693373",
"0.67342716",
"0.6438904",
"0.643014",
"0.6368058",
"0.6235226",
"0.6227864",
"0.62165743",
"0.62102395",
"0.6148964",
"0.614161",
"0.61345595",
"0.61345595",
"0.6133193",
"0.61088204",
"0.60848856"... | 0.7712526 | 3 |
Update the maximum value when the current max value in the subtree is being deleted | def _update_max(self):
tmp = self
while tmp.right is not None:
tmp = tmp.right
return tmp.parent.key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_max(self):\r\n maxVal = self.find_max()\r\n if maxVal is not None:\r\n self.items[1] = self.items[self.size]\r\n self.items[self.size] = None\r\n self.size -= 1\r\n self.perc_down(1)",
"def delete_max(self):\n max_val = self.peek_max()\n ... | [
"0.7530098",
"0.71699107",
"0.7165871",
"0.7061611",
"0.690767",
"0.6665692",
"0.66488254",
"0.65591323",
"0.6554057",
"0.65443826",
"0.65426123",
"0.654217",
"0.6498053",
"0.64890814",
"0.6472941",
"0.64411527",
"0.6433384",
"0.64287454",
"0.64040786",
"0.64035296",
"0.62817... | 0.7038411 | 4 |
Rotate a tree left and return the new root Modifies the size of the nodes as well | def _rotate_left(self):
tmp = self.right
tmp.parent = self.parent
self.right = tmp.left
if self.right is not None:
self.right.parent = self
tmp.left = self
self.parent = tmp
self.size -= 1 + (0 if tmp.right is None else tmp.right.size)
tmp.size += 1 + (0 if self.left is None else s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_left(self, og_root):\r\n new_root = og_root.right\r\n og_root.right = new_root.left\r\n if new_root.left:\r\n new_root.left.parent = og_root\r\n new_root.parent = og_root.parent\r\n if og_root is self.root: # if our original root of the rotation is the tre... | [
"0.8173081",
"0.8088282",
"0.79202396",
"0.7783937",
"0.777258",
"0.7703586",
"0.7575167",
"0.7540651",
"0.74887735",
"0.7466078",
"0.7451864",
"0.7298625",
"0.72931796",
"0.7272772",
"0.72682625",
"0.7140214",
"0.71175265",
"0.7104431",
"0.708291",
"0.70764065",
"0.7032826",... | 0.82076174 | 0 |
Rotate a tree right and return the new root Modifies the size of the nodes as well Same as rotate left but with any 'left' or 'right' keys switched | def _rotate_right(self):
tmp = self.left
tmp.parent = self.parent
self.left = tmp.right
if self.left is not None:
self.left.parent = self
tmp.right = self
self.parent = tmp
self.size -= 1 + (0 if tmp.left is None else tmp.left.size)
tmp.size += 1 + (0 if self.right is None else sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __rotate_right(self) -> \"Node\":\n lower = self.left\n # add right subtree of lower to upper (self) as left child and update links\n self.left = lower.right\n if self.left is not None:\n self.left.parent = self\n self.__update_all()\n # update lower and upp... | [
"0.78687704",
"0.78209996",
"0.78091145",
"0.7664605",
"0.762527",
"0.7535265",
"0.7526474",
"0.74918157",
"0.7457018",
"0.73454833",
"0.7336216",
"0.72811484",
"0.72555596",
"0.7242179",
"0.723877",
"0.72349346",
"0.721108",
"0.7205842",
"0.71098554",
"0.71051055",
"0.708358... | 0.81039554 | 0 |
Balances an AVL tree recursively | def _balance(self):
if self.left is not None:
self.left = self.left._balance()
if self.right is not None:
self.right = self.right._balance()
left_height = self._get_left_height()
right_height = self._get_right_height()
if abs(left_height - right_height) > 1:
if left_height > right_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __balance(self) -> \"Node\":\n current = self\n\n while True:\n current.__update_height()\n\n if current.balance_factor == 2: # right subtree is higher\n middle = current.right\n if middle.balance_factor < 0: # left subtree of middle node is h... | [
"0.7180249",
"0.67818254",
"0.6774664",
"0.6591408",
"0.6572365",
"0.64446664",
"0.6439464",
"0.64075893",
"0.63833135",
"0.63699925",
"0.6280604",
"0.6236592",
"0.619945",
"0.6110363",
"0.60964173",
"0.6072044",
"0.607162",
"0.60674816",
"0.6067034",
"0.6057581",
"0.5999757"... | 0.5994183 | 22 |
Checks if elements is a list. If yes returns elements without modifying it. If not creates and return a list with elements inside. | def make_list( elements ):
if isinstance(elements, (list, tuple)):
return elements
else:
return [elements] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aslist(something):\n return something if isinstance(something, list) else [something]",
"def convert_to_list(element):\r\n return list(element)",
"def to_list(ls):\r\n if isinstance(ls, (list, tuple)):\r\n return list(ls)\r\n else:\r\n return [ls]",
"def to_list(x):\n if isinst... | [
"0.73977375",
"0.719733",
"0.69436336",
"0.6927054",
"0.6915838",
"0.6777641",
"0.67414266",
"0.6739485",
"0.6717947",
"0.6665002",
"0.6664991",
"0.6660195",
"0.66500103",
"0.66500103",
"0.65808976",
"0.6575578",
"0.65654665",
"0.65247697",
"0.65160424",
"0.65102667",
"0.6491... | 0.8192664 | 0 |
This small function regroups a list in sub lists of n elements | def grouper( n, iterable, fillvalue=None ):
args = [iter(iterable)]*n
return list( it.izip_longest(fillvalue=fillvalue, *args) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group(lst, n):\n return zip(*[lst[i::n] for i in range(n)])",
"def group(lst, n):\n iters = tee(lst, n)\n iters = [iters[0]] + [chain(iter, repeat(None)) \n for iter in iters[1:]]\n return izip(\n *[islice(iter, i, None, n) for i, iter \n in enumerate(iters)]... | [
"0.80574286",
"0.7555499",
"0.75041294",
"0.7490965",
"0.72536016",
"0.7200001",
"0.70920956",
"0.70827264",
"0.7062838",
"0.6999427",
"0.69940925",
"0.6983986",
"0.6936684",
"0.69245774",
"0.6915232",
"0.6900256",
"0.68744797",
"0.68650615",
"0.68621546",
"0.6825319",
"0.679... | 0.6907411 | 15 |
Generate a random string of fixed length | def randomString(stringLength=10, mode='uppercase'):
if(mode == 'uppercase'):
letters = string.ascii_uppercase + string.digits
else:
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8680464",
"0.8573714",
"0.85486245",
"0.85297275",
"0.85209286",
"0.84331024",
"0.8432044",
"0.84157014",
"0.84120053",
"0.8389201",
"0.8345882",
"0.8343962",
"0.83406156",
"0.83348686",
"0.83240855",
"0.82986933",
"0.82911193",
"0.8281826",
"0.82818025",
"0.82811046",
"0.... | 0.0 | -1 |
Returns a boolean to indicate if this is a valid instance of the type. | def validate(self, text, **kwargs):
cleaned = self.clean(text, **kwargs)
return cleaned is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __is_type_instance( self, instance_type ):\n for index, instance in enumerate(INSTANCE_TYPES):\n if instance == instance_type:\n return True\n return False",
"def __instancecheck__(self, instance):\n\n if isinstance(instance, ObjCInstance):\n return b... | [
"0.7571926",
"0.7425595",
"0.73539346",
"0.71977013",
"0.7159909",
"0.7155322",
"0.712772",
"0.71084297",
"0.6954524",
"0.6916076",
"0.68892044",
"0.6864939",
"0.6826037",
"0.6804925",
"0.6787317",
"0.6771618",
"0.6764319",
"0.6735622",
"0.67305005",
"0.6677509",
"0.66490614"... | 0.0 | -1 |
Find name in database. This function query by the given 'name' inside the database. Due to 'ItemModel' is query by a database model we can use the database functions | def find_by_name(cls, name):
return ItemModel.query.filter_by(name=name).first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(self, name):\n return Search(self.request).find(name)",
"def getAllWhereNameIs(table, name):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name like'\" + name + \"%'\")\n\t\tob = cur.fetchall()\n\t\tif not ob:\n\t\t\... | [
"0.6843878",
"0.67994064",
"0.67933",
"0.6748153",
"0.6691129",
"0.6649968",
"0.66435677",
"0.6589996",
"0.6589585",
"0.65795267",
"0.65149915",
"0.6436015",
"0.63629144",
"0.6352037",
"0.6344547",
"0.6344547",
"0.6344547",
"0.6341606",
"0.6333529",
"0.62845",
"0.6280528",
... | 0.768194 | 0 |
``ymodel'' ycomponent of Model(x)Model(y) PDF | def ymodel ( self ) :
return self.__ymodel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y0(self):\n return self.params['y0']",
"def yfit(self):\n return np.dot(self.amatrix,self.acoeff)",
"def y ( self ) :\n return self.yvar",
"def y(self) -> float:\n return self.data[1]",
"def y(self):\n return self.y",
"def Y(self):\n return self.y\n ... | [
"0.61384946",
"0.58751535",
"0.5871694",
"0.58649796",
"0.5859683",
"0.5848901",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.5826444",
"0.58197093",
"0.57861423",
"0.5760726",
"0.57001406",
"0.5691801... | 0.72975826 | 0 |
Return the error on the flux (Maggies). | def computeMaggiesErr(instFluxErr, instFlux, calibrationErr, calibration, flux):
return flux*np.hypot(instFluxErr/instFlux, calibrationErr/calibration) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flux(self) -> ErrorValue:\n try:\n return ErrorValue(self._data['Flux'], self._data.setdefault('FluxError',0.0))\n except KeyError:\n return 1 / self.pixelsizex / self.pixelsizey / ErrorValue(self._data['NormFactor'],\n ... | [
"0.7377714",
"0.6984676",
"0.67859906",
"0.67430687",
"0.6597278",
"0.6559986",
"0.65204525",
"0.6392747",
"0.63471514",
"0.6333605",
"0.6270748",
"0.6263025",
"0.62438375",
"0.6214635",
"0.61943483",
"0.61771154",
"0.6110171",
"0.6110171",
"0.6110171",
"0.6103438",
"0.609988... | 0.7140936 | 1 |
Return the error on the magnitude. | def computeMagnitudeErr(instFluxErr, instFlux, calibrationErr, calibration, flux):
return 2.5/np.log(10)*computeMaggiesErr(instFluxErr, instFlux, calibrationErr, calibration, flux) / flux | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mag_err(self):\n return self.photosamplers.get_estimate(mag=True)[1:]",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def diff_of_errors(self):\n self.e_of_e = self.azimuth_error - self.altitude_error\n return self.e_of_e",
"def _random_error(self):\n return self._... | [
"0.73644763",
"0.7275651",
"0.7134168",
"0.7112408",
"0.70242167",
"0.7000992",
"0.6970782",
"0.6967914",
"0.6885142",
"0.68594104",
"0.6858145",
"0.68404806",
"0.6821548",
"0.6761407",
"0.6670948",
"0.6640482",
"0.66240245",
"0.66154456",
"0.66120386",
"0.66047907",
"0.65938... | 0.6915245 | 8 |
Returns color of plane at the point. | def get_color(self, point):
d = point - self._origin
dist = int(d.dot(d) ** 0.5) % 2
if dist == 0:
return self.c1.dup()
else:
return self.c2.dup() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self, point):\n return self._color.dup()",
"def get(self, point):\n string = self.__grid.get(point)\n if string is None:\n return None\n return string.color",
"def _getDockColor(self, plane):\n color = (0,0,0)\n if plane.zAxis != -1:\n ... | [
"0.74562883",
"0.6550895",
"0.6486555",
"0.6477857",
"0.64018226",
"0.62828004",
"0.62539417",
"0.62002486",
"0.6174206",
"0.6174074",
"0.61452585",
"0.6124049",
"0.61142814",
"0.6078319",
"0.6073159",
"0.6073159",
"0.6063732",
"0.6060672",
"0.60540885",
"0.6039171",
"0.60092... | 0.7516173 | 0 |
Forward calculation of MultiIndicesEmbedding | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
self.offsets = self.offsets.cuda() if inputs.is_cuda else self.offsets.cpu()
inputs = inputs + self.offsets
outputs = self.embedding(inputs.rename(None))
outputs.names = ('B', 'N', 'E',)
if self.flatten:
output... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, features: EmbeddedFeatures):\n assert len(features.token_embeddings.shape) == 3 and features.token_embeddings.shape[0] == 2, \\\n \"Input must have 2 embeddings\"\n\n # [x, z]\n x = features.token_embeddings[0].to(torch.float)\n y = features.token_embeddings[1].to(torch.floa... | [
"0.6778776",
"0.6335555",
"0.6270472",
"0.6225502",
"0.6206049",
"0.61833984",
"0.6182648",
"0.6161769",
"0.61611927",
"0.61304617",
"0.6067866",
"0.6062029",
"0.6056844",
"0.6051513",
"0.6045421",
"0.59999794",
"0.59976214",
"0.5996875",
"0.59798104",
"0.5979475",
"0.5976571... | 0.6378756 | 1 |
full path to the driver code driver path | def driver_dir(self):
if not self.metadata.driver_path:
raise DriverParameterUndefined("driver_path undefined in metadata")
return os.path.join(self.driver_base_dir(),self.metadata.driver_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_base_dir(self):\n if not self.metadata.driver_path:\n log.info(\"metadata is %s\", self.metadata)\n raise DriverParameterUndefined(\"driver_path undefined in metadata\")\n \n return os.path.join(Config().base_dir(),\n \"mi\", \"platfo... | [
"0.74633574",
"0.6906101",
"0.66586006",
"0.6465747",
"0.6314876",
"0.62924784",
"0.62500924",
"0.62278515",
"0.62261313",
"0.6198176",
"0.61371577",
"0.6129475",
"0.6129059",
"0.6127803",
"0.6113415",
"0.6105749",
"0.60987973",
"0.60800505",
"0.60543334",
"0.6036382",
"0.603... | 0.7425451 | 1 |
path to the driver template dir driver test code template path | def template_dir(self):
return os.path.join(Config().template_dir(), 'platform') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixtures_path():\n return path.abspath(\n path.join(path.dirname(path.realpath(__file__)),\n \"..\",\n \"conf\",\n \"jenkins\",\n \"update-templates.xml\"))",
"def templates_folder(self):\n return os.path.join(\n ... | [
"0.6569441",
"0.6521011",
"0.65049523",
"0.64926296",
"0.6428833",
"0.6420114",
"0.64102596",
"0.6353654",
"0.6328816",
"0.6308255",
"0.6294894",
"0.62118244",
"0.61754274",
"0.617094",
"0.615957",
"0.6159473",
"0.61055934",
"0.61048186",
"0.60940653",
"0.60915905",
"0.607498... | 0.6818623 | 0 |
True when this file does not exist on the disk yet. | def is_new_file(self):
return self.filename is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_file_exist(self):\n return False",
"def file_exists(self):\r\n if os.path.exists(self.file_path):\r\n return True\r\n else:\r\n return False",
"def file_exist() -> bool:\n pass",
"def is_file_exists(self):\n pass",
"def file_exists(self):\n... | [
"0.8353665",
"0.8156253",
"0.81440854",
"0.80480963",
"0.7930249",
"0.7841727",
"0.77997446",
"0.77747965",
"0.7762794",
"0.761182",
"0.75814545",
"0.7573657",
"0.75231063",
"0.7486455",
"0.7468047",
"0.7464813",
"0.738591",
"0.737985",
"0.73401135",
"0.7339895",
"0.7334294",... | 0.7108131 | 37 |
Tokenizes a text and maps tokens to tokenids | def tokenize(self, texts: Union[List[str], List[Dict], List[Tuple[str, str]]]):
output = {}
if isinstance(texts[0], str):
to_tokenize = [texts]
elif isinstance(texts[0], dict):
to_tokenize = []
output['text_keys'] = []
for lookup in texts:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ids(cls, text):\n tokens = TokenizerContainer.TOKENIZER.tokenize(text)\n token_ids = TokenizerContainer.TOKENIZER.convert_tokens_to_ids(tokens)\n input_ids = token_ids + [0] * (cls.MAX_LEN-len(token_ids))\n return tokens, input_ids",
"def tokenize(text):\n global TOK\n t... | [
"0.7407736",
"0.73601663",
"0.72941417",
"0.7202924",
"0.713212",
"0.7116175",
"0.71030444",
"0.7050334",
"0.69642794",
"0.6955619",
"0.69235754",
"0.6922563",
"0.6842361",
"0.68406314",
"0.6824744",
"0.6798709",
"0.6782027",
"0.6777919",
"0.67726904",
"0.67357945",
"0.673165... | 0.64355 | 64 |
Mean of the Sojourn Time Distribution (STD) | def mean_STD(self,counter):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def std_mean(self):\n std = self.std\n if self.ddof != 0:\n # ddof correction, (need copy of std)\n std = std * np.sqrt(\n (self.sum_weights - self.ddof) / self.sum_weights\n )\n\n return std / np.sqrt(self.sum_weights - 1)",
"def mov_mean_st... | [
"0.7237057",
"0.7130763",
"0.7022579",
"0.7000155",
"0.69642323",
"0.6875677",
"0.6847646",
"0.68306047",
"0.68264556",
"0.67895555",
"0.6789159",
"0.6776282",
"0.67686665",
"0.67655325",
"0.6753049",
"0.6738328",
"0.6726274",
"0.67069745",
"0.67062867",
"0.66899",
"0.6683038... | 0.7852976 | 0 |
The identity block is the block that has no conv layer at shortcut. Arguments | def identity_block(input_tensor, units):
x = layers.Dense(units, kernel_regularizer=reg)(input_tensor)
x = l()(x)
x = layers.Activation('relu')(x)
x = layers.Dense(units, kernel_regularizer=reg)(x)
x = l()(x)
x = layers.Activation('relu')(x)
x = layers.Dense(units, kernel_regularizer=reg)(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.7127628",
"0.70221424",
"0.69109476",
"0.6883743",
"0.6850768",
"0.6847016",
"0.6822091",
"0.68218416",
"0.6803063",
"0.6799531",
"0.67845774",
"0.6771418",
"0.67158985",
"0.67147744",
"0.6713781",
"0.6663493",
"0.6624325",
"0.662224",
"0.662224",
"0.6607485",
"0.6598618",... | 0.6252752 | 30 |
A block that has a dense layer at shortcut. Arguments | def dens_block(input_tensor, units, reps=2):
x = input_tensor
for _ in range(reps):
x = layers.Dense(units, kernel_regularizer=reg)(x)
x = l()(x)
x = layers.Activation('relu')(x)
x = layers.Dense(units, kernel_regularizer=reg)(x)
x = l()(x)
shortcut = layers.Dense(units, ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dense_block(self, input_data, name):\n block_input = input_data\n with tf.variable_scope(name):\n for i in range(self._block_depth):\n block_layer_name = '{:s}_layer_{:d}'.format(name, i+1)\n block_input = self._dense_connect_layer(input_data=block_input,... | [
"0.7100738",
"0.6797704",
"0.674442",
"0.6719941",
"0.66443944",
"0.6468649",
"0.6318449",
"0.6207323",
"0.62051785",
"0.60883194",
"0.59949267",
"0.59478694",
"0.59379214",
"0.5936867",
"0.59223205",
"0.5900823",
"0.5889332",
"0.58529305",
"0.5812902",
"0.5812242",
"0.580822... | 0.59485495 | 11 |
Instantiates the RegResNet50 architecture. | def RegResNet(input_size=8, reps=3, initial_weights=None, width=16, num_gpus=0, lr=1e-4):
input_layer = layers.Input(shape=(input_size,))
x = input_layer
for _ in range(reps):
x = resnet_block(x, width)
x = l()(x)
x = layers.Dense(1, activation=None)(x)
model = models.Model(inputs=inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bl_resnet50(pretrained=False, **kwargs):\n model = bL_ResNet([2, 3, 5, 3], **kwargs)\n # print ('model created')\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n return model",
"def resnet50(**kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], ... | [
"0.643081",
"0.6414394",
"0.63670504",
"0.63670504",
"0.62997276",
"0.6282535",
"0.6279612",
"0.6266622",
"0.6266622",
"0.6236883",
"0.62268806",
"0.62151706",
"0.6211645",
"0.6211645",
"0.6211645",
"0.6211645",
"0.6100689",
"0.6076469",
"0.6048872",
"0.60391986",
"0.60226554... | 0.0 | -1 |
Retourne un graphique piechart des activites d'un pays pour une annee et un sexe donnes. | def graph_pie_subjects_country_year(pYear, pCountry, pActivity, pSex):
data = employment.query('year == {} and country == "{}" and activity == "{}" and sex == "{}"'.format(pYear, pCountry, pActivity, pSex))
pie = px.pie(
data,
values='value',
hover_name="subject",
names='subjec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pie_chart(self, pct=True, day='today'):\n assert isinstance(pct, bool), 'Error! The pct parameter must be boolean.'\n assert day == 'today' or isinstance(day, date), 'Error! You have to pass a datetime.date istance to the day parameter.'\n def func(pct, allvals):\n \"\"\"Funcito... | [
"0.67582905",
"0.6620302",
"0.66178596",
"0.65956396",
"0.65569645",
"0.64094836",
"0.6241727",
"0.61666256",
"0.5945641",
"0.5929483",
"0.5888111",
"0.5839827",
"0.5757337",
"0.567788",
"0.56668335",
"0.55388486",
"0.55366176",
"0.5514163",
"0.5429092",
"0.54083383",
"0.5399... | 0.5573477 | 15 |
Resource not found handler Render `404` template to users if they try to access a resource that doesn't exist | def not_found(e):
return render_template("errors/404.html"), 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found():\n return render_template(\"errors/404.html\"), 404",
"def page_not_found(e):\n return render_template(\"404.html\"), 404",
"def page_not_found(e):\n return render_template('404.html'), 404",
"def page_not_found(e):\n return render_template('404.html'), 404",
"def page_not_... | [
"0.85009044",
"0.8449569",
"0.8440069",
"0.8440069",
"0.84247965",
"0.84142125",
"0.8393681",
"0.83430785",
"0.8318381",
"0.8266272",
"0.8245807",
"0.8245197",
"0.81975293",
"0.8183757",
"0.81817615",
"0.8178368",
"0.81286657",
"0.8127586",
"0.8119932",
"0.8080045",
"0.807956... | 0.8438743 | 4 |
Resource not found handler Render `500` template to users if an unhandled error causes an internal server error | def internal_error(e):
return render_template("errors/500.html"), 500 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found(e):\n return render_template(\"500.html\"), 500",
"def resource_not_found(exc, request):\r\n request.response_status = \"404 Not Found\"\r\n return {'message': str(exc)}",
"def handler404(request):\n \n #Setting the variable and template page for the 500 error\n response = ... | [
"0.8514205",
"0.8458573",
"0.8265747",
"0.8228102",
"0.81759393",
"0.81021196",
"0.80958486",
"0.8080167",
"0.80626035",
"0.80626035",
"0.803206",
"0.80296206",
"0.8028229",
"0.80241436",
"0.80202514",
"0.80180335",
"0.8010909",
"0.7991792",
"0.7980635",
"0.79748416",
"0.7972... | 0.7741789 | 36 |
Index view Handle the index route. | def index():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index(self):\n return self.load_view('index.html')",
"def index():\r\n return render_template('... | [
"0.78159976",
"0.78159976",
"0.781592",
"0.7769366",
"0.77623016",
"0.7725835",
"0.7709985",
"0.76503575",
"0.7637082",
"0.75976986",
"0.75976986",
"0.7562273",
"0.754978",
"0.7540001",
"0.75336874",
"0.7509746",
"0.7507895",
"0.75052875",
"0.7492715",
"0.7492715",
"0.7492715... | 0.7497949 | 29 |
Test retrieving a list of ingredients | def test_retrieve_ingredient_list(self):
Ingredient.objects.create(user=self.user, name='Cucumber')
Ingredient.objects.create(user=self.user, name='Tomatoes')
res = self.client.get(INGREDIENTS_URL)
ingredients = Ingredient.objects.all().order_by('-name')
serializer = Ingredien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retreive_ingredients_list(self):\n Ingredients.objects.create(user=self.user, name='Kale')\n Ingredients.objects.create(user=self.user, name='Carrot')\n\n res = self.client.get(INGREDIENT_URL)\n\n ingredients = Ingredients.objects.all().order_by('-name')\n serializer = I... | [
"0.823363",
"0.8180721",
"0.8131388",
"0.81218594",
"0.79578096",
"0.79049695",
"0.79049534",
"0.7780523",
"0.77609193",
"0.7659895",
"0.7372919",
"0.73394305",
"0.733618",
"0.7312919",
"0.72876316",
"0.72604406",
"0.7229725",
"0.7184084",
"0.713639",
"0.7131115",
"0.71271926... | 0.80470085 | 4 |
Test that ingredients returned are for the authenticated user | def test_ingredients_limited_to_user(self):
user_2 = get_user_model().objects.create_user(
email='test4@gmail.com',
password='tlkgg4167463'
)
Ingredient.objects.create(user=user_2, name='Potatoes')
ingredient = Ingredient.objects.create(user=self.user, name='Tom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ingredients_limited_to_authenticated_user(self):\n\n # Create a new user addition to the user created in\n # the setUp, and leave it without an authentication.\n credentials = {'email': 'newuser@gmail.com', 'password': 'Testpass34'}\n new_user = get_user_model().objects.create_... | [
"0.81573176",
"0.792153",
"0.7905486",
"0.7756392",
"0.77126473",
"0.7655067",
"0.76026106",
"0.7581155",
"0.75424343",
"0.7423538",
"0.74170744",
"0.7415886",
"0.7288985",
"0.7260578",
"0.7195325",
"0.71669585",
"0.7157253",
"0.7144459",
"0.70969516",
"0.708998",
"0.7085052"... | 0.7790611 | 3 |
Test creating a new ingredient with invalid payload | def test_create_ingredient_invalid(self):
payload = {'name': ''}
res = self.client.post(INGREDIENTS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_ingredient_invalid_payload(self):\n\n ingredient_payload = {'name': ''}\n response = self.client.post(URL_INGREDIENTS, ingredient_payload)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)",
"def test_create_ingredient_invalid(self):\n payload = {... | [
"0.8968946",
"0.8823915",
"0.87549347",
"0.8747518",
"0.81524444",
"0.7710182",
"0.76047856",
"0.755547",
"0.74441105",
"0.74412686",
"0.74408144",
"0.74206495",
"0.73897123",
"0.73525536",
"0.7336853",
"0.73020923",
"0.72844446",
"0.72050196",
"0.7163112",
"0.71616334",
"0.7... | 0.8799089 | 2 |
Test retrieving ingredients that are asigned for recipe | def test_retrieve_ingredients_assigned_to_recipe(self):
recipe_1 = Recipe.objects.create(
user=self.user, title='Massefouf', time_minutes=30, price=5
)
ingredient_1 = Ingredient.objects.create(
user=self.user, name='Semoule'
)
recipe_1.ingredients.add(ingr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_recipe_ingredients_by_id(self):\n pass",
"def test_search_recipes_by_ingredients(self):\n pass",
"def test_search_by_ingredients(self):\n recipe_id = self.request_mgr.search_by_ingredients(['butter', 'sugar', 'eggs'])\n self.assertGreater(recipe_id, 0)",
"def test_cre... | [
"0.82133204",
"0.8057333",
"0.7828773",
"0.771751",
"0.7621522",
"0.7621025",
"0.76038283",
"0.7597671",
"0.7596974",
"0.7578876",
"0.7520048",
"0.7518831",
"0.7498932",
"0.7487093",
"0.74810153",
"0.74624836",
"0.74579585",
"0.74051464",
"0.7403728",
"0.73912543",
"0.7374186... | 0.7255696 | 27 |
Whether the current line is trying to spell "function". Starts at "fu", ends at "function" | def is_function(self):
line = self.line.strip()
if line.startswith('fu'):
if line.startswith('function') is False:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_function(self, words):\n if words[0] == 'function':\n if len(words) != 3:\n raise SyntaxError(\"File line {}: Invalid number of arguments for C_FUNCTION command.\".format(self._file_line))\n return True\n else:\n return False",
"def function_a... | [
"0.73219293",
"0.7122321",
"0.70839775",
"0.7053461",
"0.6880245",
"0.6875435",
"0.67338496",
"0.6678853",
"0.6677187",
"0.6578307",
"0.64248425",
"0.64226377",
"0.6088391",
"0.607114",
"0.60165817",
"0.59738064",
"0.59253985",
"0.59207326",
"0.5916146",
"0.5866438",
"0.58609... | 0.85421336 | 0 |
Get a commadelimited string of the tags on this object | def print_tags(self):
tags = [tag.name for tag in self.tags.all().order_by('name')]
return ", ".join(tags) if tags else "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def taglist(self):\n tags = []\n for tag in self.tags:\n tags.append(tag.title)\n return ', '.join(map(str, tags))",
"def tags_nice(self):\n ret = ''\n\n if not self.tags.all():\n return ret\n\n for t in self.tags.all():\n ret += str(t) +... | [
"0.83805954",
"0.81421846",
"0.79291755",
"0.7401775",
"0.73846537",
"0.73781943",
"0.73283356",
"0.730563",
"0.7278276",
"0.7278276",
"0.70973974",
"0.70850503",
"0.706671",
"0.7045805",
"0.7041455",
"0.70160043",
"0.69881684",
"0.69835776",
"0.68850446",
"0.68754506",
"0.68... | 0.84311604 | 0 |
This method returns the publish ad limit of the particular ad type | def _get_publish_ad_limit(self, ad_typeObj=False):
plan = self.request_id.plan_id
subscription_type_ad_line = self.env['merchant.plan.deal.line'].search([('plan_id','=',plan.id), ('deal_type_id','=',ad_typeObj.id)], limit=1)
if not subscription_type_ad_line:
return 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self):\n if self._limit:\n return self._limit\n else: # no custom limit, go with the default\n return PublicAppPlan",
"def get_limit(self):\n return self.limit",
"def get_limit(self):\n return self._limit",
"def get_limit(self):\n return sel... | [
"0.6939389",
"0.6679499",
"0.6549988",
"0.6549988",
"0.63961196",
"0.63961196",
"0.6326061",
"0.63119394",
"0.62082624",
"0.6134478",
"0.6121572",
"0.6082944",
"0.601611",
"0.590854",
"0.5856685",
"0.58102894",
"0.5807954",
"0.5797209",
"0.57869756",
"0.5758583",
"0.5741416",... | 0.7947987 | 0 |
See S. Eineckes dissertation p. 134, all energies in TeV, lengths in cm | def get_mc_livetime(n_gen, γ=-1.6, f_crab=3.39*10**-11, r_max=35000, e_min=0.01, e_max=30):
return n_gen*(γ+1) / (f_crab * r_max**2 * np.pi * (e_max**(γ+1) - e_min**(γ+1))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def V2E(V):\n# for v in m/s returns energy in meV\n return 5.227e-6*V*V",
"def E2V(E):\n# for energy in mev returns velocity in m/s\n return sqrt(E/5.227e-6)",
"def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))",
"def _calc_Em(self):\n ... | [
"0.67004985",
"0.6587298",
"0.64621264",
"0.64261997",
"0.64071953",
"0.6398197",
"0.6356911",
"0.6340504",
"0.61599034",
"0.61423886",
"0.6113839",
"0.61122364",
"0.60841316",
"0.6051426",
"0.60402334",
"0.6032638",
"0.6017686",
"0.6007953",
"0.600207",
"0.5995677",
"0.59806... | 0.0 | -1 |
returns the number of unread messages for the given user but does not mark them seen | def inbox_count_for(user):
return Message.inbox.for_user(user).unread().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unseen_count_for(self, user):\r\n return self.filter(user=user, unseen=True).count()",
"def get_unread_count(username, password):\n obj = imaplib.IMAP4_SSL('imap.gmail.com', '993')\n obj.login(username, password)\n obj.select('Inbox')\n message_ids = obj.search(None, \"UNSEEN\")[1]\n li... | [
"0.7776218",
"0.70774996",
"0.7009565",
"0.69207907",
"0.6762714",
"0.6750473",
"0.6633908",
"0.66306823",
"0.65717554",
"0.64566976",
"0.64541656",
"0.6358348",
"0.6306796",
"0.62267613",
"0.6201039",
"0.616344",
"0.60736185",
"0.59927684",
"0.5967663",
"0.5901079",
"0.58753... | 0.80871254 | 0 |
output the list of neighbors of this vertex | def __str__(self):
return str(self.id) + " adjancent to " + str([x.id for x in self.neighbors]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbors(self):\n # return the neighbors\n # if len(self.neighbors.keys()) != 0:\n # # print('\\n')\n return self.neighbors.keys()\n # else:\n # # print(self.id)\n # raise ValueError('No neighbors')\n # return self.neighbors.keys()",
"... | [
"0.7438499",
"0.7421126",
"0.73782206",
"0.7347334",
"0.7347292",
"0.72861534",
"0.72157913",
"0.71973306",
"0.7175777",
"0.7175777",
"0.7175777",
"0.7175777",
"0.7169617",
"0.70941323",
"0.703832",
"0.7014702",
"0.7014702",
"0.7008875",
"0.7008608",
"0.70022535",
"0.6977722"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.