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 |
|---|---|---|---|---|---|---|
Load the trained weights useful if we are interested in using the network right away | def load_weights(self,
actor_weights,
value_weights=None):
self.actor_model.load_weights(actor_weights)
if value_weights is not None:
self.value_model.load_weights(value_weights) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
"def load_weights(self):\n try:\n print('loading weights from {}'.format(self.c... | [
"0.8149269",
"0.8046892",
"0.7966396",
"0.7762461",
"0.77416885",
"0.7731906",
"0.77233225",
"0.76293164",
"0.7567901",
"0.75481004",
"0.7544414",
"0.7544414",
"0.75363386",
"0.7476935",
"0.7473997",
"0.7447324",
"0.73636097",
"0.73597133",
"0.73484033",
"0.7320584",
"0.73113... | 0.67272556 | 74 |
Load encoder trained weights useful if we are interested in using the network right away | def load_encoder_weights(self, encoder_weights):
self.encoder.load_weights(encoder_weights) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
"def load_weights(self, model_file):\n if not self.encoder_decoder:\n raise Typ... | [
"0.71977484",
"0.7108447",
"0.7079507",
"0.7074155",
"0.7068651",
"0.69985104",
"0.68239534",
"0.6814837",
"0.6799466",
"0.6793236",
"0.6781963",
"0.6750167",
"0.67456377",
"0.66809803",
"0.6642684",
"0.6608131",
"0.6605895",
"0.6573823",
"0.65735775",
"0.6532399",
"0.6518993... | 0.822055 | 0 |
Returns a onehotencoded tensor given a character. Uses string.printable as a dictionary. | def character_to_label(character):
character_label = all_characters.find(character)
return character_label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_enc(self, word):\n word = self.text_to_int(word)\n word = Variable(torch.tensor(word))\n word = torch.nn.functional.one_hot(word, len(self.index_map))\n return word.transpose(0, 1)",
"def one_hot_translate(self, input, depth):\n output = tf.one_hot(input, depth)\n ... | [
"0.7244076",
"0.7047601",
"0.69945157",
"0.694073",
"0.69263846",
"0.6899737",
"0.6858095",
"0.6839027",
"0.67830604",
"0.67167556",
"0.66415966",
"0.6640895",
"0.66262805",
"0.65833485",
"0.6556137",
"0.6555406",
"0.65040916",
"0.6446278",
"0.64401245",
"0.6432777",
"0.64241... | 0.0 | -1 |
Get Astris Probe ID for expect auto run. | def getAstrisProbeID(cableName):
# 处理未格式化的 cablename 字符串
cableName_0 = cableName
if re.search("-", cableName_0):
cableName_0 = cableName_0.split("-")[1]
# writeLogs("Python script current path = %s" %script_path)
res, rev = readCMD([script_path+"/auto_reset.rep", "-1"], False)
for item in rev:
if re.search(ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAstrisProbeID(cableName, path_sn):\n\t# 处理未格式化的 cablename 字符串\n\tcableName_0 = cableName\n\tif re.search(\"-\", cableName_0):\n\t\tcableName_0 = cableName_0.split(\"-\")[1]\n\tres, rev = readCMD([script_path+\"/runAstrisID.exp\"], True, path_sn)\n\tfor item in rev:\n\t\tif re.search(cableName_0, item):\n\t\... | [
"0.62572783",
"0.60221374",
"0.59610516",
"0.5781551",
"0.54951805",
"0.54826176",
"0.53770113",
"0.5346869",
"0.5300724",
"0.5293963",
"0.5200376",
"0.5192322",
"0.5189581",
"0.5182847",
"0.51727706",
"0.51677996",
"0.516563",
"0.5154109",
"0.5132441",
"0.5076258",
"0.505942... | 0.63461185 | 0 |
Get the address book from the connection and set it as site. Usable in a `yield_fixture`. Resets the site to its previous value at exit. | def site(connection):
addressbook = connection.rootFolder['ab']
with zope.component.hooks.site(addressbook):
yield addressbook | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site(self):\n if not self.__site:\n self.__site = Site(self)\n return self.__site",
"def set_site_id(self):\n self.site_id = entities.sites['next id']\n entities.sites['object list'].append(self)\n entities.sites['next id'] += 1",
"def binding_site(self, bindin... | [
"0.53857213",
"0.5260137",
"0.52374446",
"0.5166174",
"0.5025457",
"0.5025457",
"0.4981199",
"0.49783882",
"0.4973166",
"0.49452066",
"0.49368873",
"0.4936476",
"0.49046156",
"0.48921686",
"0.4889268",
"0.4889268",
"0.48857737",
"0.48744017",
"0.48673022",
"0.47820503",
"0.47... | 0.70541525 | 0 |
Convert an etree into a list (lines without leading whitespace.) | def etree_to_list(self, etree):
return [x.strip()
for x in lxml.etree.tostring(etree).split(b'\n')
if x.strip()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _toList(self):\n return [block.text() \\\n for block in _iterateBlocksFrom(self._doc.firstBlock())]",
"def node_values_list(xml_doc, xpath_expr):\n return [x.text for x in xml_doc.xpath(xpath_expr)]",
"def preorder_traverse_to_list(self):\n\t\tif (not self.root()):\n\t\t\tretur... | [
"0.65748215",
"0.64058447",
"0.62444264",
"0.6187622",
"0.61562085",
"0.598008",
"0.5975466",
"0.59687763",
"0.59673715",
"0.5877245",
"0.5877245",
"0.58539253",
"0.58449924",
"0.5841456",
"0.5814778",
"0.5796926",
"0.578838",
"0.571083",
"0.5656784",
"0.56325203",
"0.5616504... | 0.885886 | 0 |
Assert accessing a URL is forbidden for the current user. | def assert_forbidden(self, url):
with pytest.raises(zope.testbrowser.browser.HTTPError) as err:
self.open(url)
assert 'HTTP Error 403: Forbidden' == str(err.value), \
'Raised "{}" instead of HTTP-403 Forbidden'.format(err.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_cannot_view(obj):\n selenium_utils.open_url(obj.url)\n assert ui_utils.is_error_403()",
"def test_no_permission(self):\n self.assertStatusCode(self.url, 403)",
"def test_no_permission(self):\n self.assertStatusCode(self.url, 403)",
"def test_no_permission(self):\n self.asser... | [
"0.8000752",
"0.7694377",
"0.7694377",
"0.7694377",
"0.7694377",
"0.7608875",
"0.7608875",
"0.7608875",
"0.7608875",
"0.76026374",
"0.7563031",
"0.7559528",
"0.7456628",
"0.7259732",
"0.72473574",
"0.7137632",
"0.71092284",
"0.7105218",
"0.703141",
"0.702715",
"0.70260704",
... | 0.82247144 | 0 |
Return the path of the current URL. | def path(self):
return self._selenium.current_url.replace(
'http://{}'.format(self._address), '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relative_path(self):\n return urlparse(self.browser.current_url).path",
"def url(self):\n url = os.environ.get('PATH_INFO')\\\n or os.environ.get('REQUEST_URI')\n return url if url else ''",
"def get_current_url():\n return current_url",
"def base_url_path(self):\n ... | [
"0.8045751",
"0.7860338",
"0.7843175",
"0.7681547",
"0.7657414",
"0.7556152",
"0.7454252",
"0.73733723",
"0.72848135",
"0.72544324",
"0.7248617",
"0.7246251",
"0.7240855",
"0.7232208",
"0.7232208",
"0.72299534",
"0.72229844",
"0.7148184",
"0.71357614",
"0.71186143",
"0.705911... | 0.78406364 | 3 |
Return the message string. | def __str__(self):
return self.msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMessage():\n return message",
"def message(self) -> str:\n return self.fields.get('msg', self.raw_string)",
"def msg(self):\n\t\treturn self.message",
"def getMessage() -> str:\n pass",
"def message(self) -> str:\r\n\r\n return self.__message",
"def message(self) -> str:\n ... | [
"0.84238553",
"0.8370318",
"0.81186795",
"0.809563",
"0.80558914",
"0.8037184",
"0.8037184",
"0.8037184",
"0.8037184",
"0.8037184",
"0.798403",
"0.79701376",
"0.79701376",
"0.79701376",
"0.79701376",
"0.79701376",
"0.79701376",
"0.7948221",
"0.79359037",
"0.79209256",
"0.7910... | 0.7117751 | 68 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
if not hasattr(g, 'sqlite_db'):
g.sqlite_db = connect_db()
return g.sqlite_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.7737639",
"0.7582971",
"0.73180443",
"0.71693045",
"0.70220166",
"0.6966687",
"0.6954785",
"0.69486743",
"0.6897534",
"0.6842663",
"0.68292314",
"0.68191963",
"0.680592",
"0.67950195",
"0.67697805",
"0.6762173",
"0.6751266",
"0.6746273",
"0.67316663",
"0.670031",
"0.668866... | 0.640242 | 81 |
Y location of the center of the vox origin cell. | def origin_y(self):
return self._origin[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self) -> int:\n return self.data.y_centre >> 4",
"def get_origin_y_position(self):\n return self.origin_coordinates[1]",
"def get_y_position(self): \n return self.rect.y",
"def y_origin(self):\n return self._y_origin",
"def y_coord(self):\n\n return self.y0 +... | [
"0.7643201",
"0.75332236",
"0.7500555",
"0.748291",
"0.741654",
"0.73992527",
"0.73974466",
"0.7372707",
"0.73612255",
"0.73535573",
"0.7312977",
"0.7310892",
"0.7299653",
"0.72099054",
"0.7155415",
"0.71518373",
"0.71356577",
"0.7087288",
"0.7079076",
"0.7058118",
"0.7057718... | 0.7770951 | 0 |
`geosoft.gxapi.GXPG` instance (3D) for this vox. The GXPG will always index z from minimum elevation (bottom of the vox). | def gxpg(self):
if self._pg is None:
self._pg = self.gxvox.create_pg()
return self._pg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gxvoxe(self):\n if self._gxvoxe is None:\n self._gxvoxe = gxapi.GXVOXE.create(self.gxvox)\n return self._gxvoxe",
"def get_voxel(self, x, y, z):\n return self.data[x, y, z]",
"def _get_gpos ( self ):\n bpos = mgrid[self.x_min:self.x_max:self.nxsteps*1j, \\\n ... | [
"0.6002154",
"0.57037175",
"0.5678189",
"0.56597245",
"0.56174684",
"0.56116027",
"0.55986893",
"0.55934274",
"0.55800647",
"0.54536456",
"0.5416887",
"0.53505135",
"0.53166646",
"0.53103614",
"0.5301282",
"0.5299376",
"0.5292475",
"0.527485",
"0.5247133",
"0.52323467",
"0.52... | 0.6669877 | 0 |
True if z is elevation. Can be set. | def is_elevation(self):
return not self._is_depth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidZ(self, z):\n if (z <= self.getZMin()):\n return False\n if (z >= self.getZMax()):\n return False\n else:\n return True",
"def has_z(self): # -> bool:\n ...",
"def has_z(geometry, **kwargs):\n return lib.has_z(geometry, **kwargs)",
"... | [
"0.6915572",
"0.67464244",
"0.63976145",
"0.63737357",
"0.62254256",
"0.6122626",
"0.60416377",
"0.5987085",
"0.59565634",
"0.58624625",
"0.5848523",
"0.5845565",
"0.5838115",
"0.58047813",
"0.57426697",
"0.5699921",
"0.568909",
"0.568274",
"0.5647695",
"0.5646807",
"0.563039... | 0.76048076 | 0 |
Sets the text of this VoiceTestDefinition. | def text(self, text):
if text is None:
raise ValueError("Invalid value for `text`, must not be `None`") # noqa: E501
if text is not None and len(text) > 1024:
raise ValueError("Invalid value for `text`, length must be less than or equal to `1024`") # noqa: E501
if text ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetText(self, text):\r\n\r\n self._text = text",
"def SetText(self, text):\r\n\r\n self._text = text\r\n return self",
"def set_text(self, text):\n\n self.text = text",
"def set_text(self, text):\n self.set_text_f(\"%s\", text)",
"def set_text(self):\n pass",
... | [
"0.8067421",
"0.7943375",
"0.79192626",
"0.76345444",
"0.75078213",
"0.74641514",
"0.7456194",
"0.7456194",
"0.7456194",
"0.7456194",
"0.7456194",
"0.7456194",
"0.74341553",
"0.741207",
"0.73176336",
"0.7296186",
"0.72168875",
"0.7184222",
"0.714263",
"0.7096561",
"0.7090245"... | 0.63773996 | 36 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, VoiceTestDefinition):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456082",
"0.83912885",
"0.81436425",
"0.81406975",
"0.8131807",
"0.8093013",
"0.80912536",
"0.80912536",
"0.80912536",
"0.8084505",
"0.8084505",
"0.8075543",
"0.8075543",
"0.8065009"
] | 0.0 | -1 |
convert local time to UTC | def localToUTC(t, local_tz):
t_local = local_tz.localize(t, is_dst=None)
t_utc = t_local.astimezone(pytz.utc)
return t_utc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_to_utc(local_dt):\n local_dt = local_dt.replace(tzinfo=tz.tzlocal())\n return local_dt.astimezone(tz.tzlocal())",
"def local_to_utc(local_dt: datetime) -> datetime:\n if local_dt is None:\n return None\n utc_dt = local_dt.astimezone(tz.UTC)\n return utc_dt",
"def localti... | [
"0.77810234",
"0.758805",
"0.7319871",
"0.73162836",
"0.73162836",
"0.721521",
"0.70631915",
"0.70631915",
"0.70631915",
"0.70206225",
"0.6936033",
"0.6929881",
"0.69084597",
"0.68680924",
"0.6771832",
"0.66714317",
"0.6648412",
"0.66378766",
"0.66121143",
"0.657472",
"0.6537... | 0.7824375 | 0 |
convert UTC timestamp to local time | def UTCtimestampTolocal(ts, local_tz):
t_utc = dt.datetime.fromtimestamp(ts,tz=pytz.timezone("UTC"))
t_local = t_utc.astimezone(local_tz)
return t_local | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_local(timestamp):\n naive = datetime.datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=pytz.utc)\n return naive.astimezone(_tz)",
"def utc_to_local_timestamp(ts, orig_tz=UTC):\n timestamp = datetime.datetime.fromtimestamp(ts,tz=orig_tz)\n return timestamp.asti... | [
"0.78659517",
"0.7846324",
"0.76822674",
"0.7601609",
"0.7547206",
"0.74419934",
"0.743735",
"0.73040867",
"0.7291476",
"0.72130024",
"0.7120191",
"0.7109391",
"0.7106713",
"0.70798624",
"0.69732815",
"0.69682235",
"0.6947693",
"0.69418275",
"0.69271356",
"0.68864924",
"0.686... | 0.8274902 | 0 |
Returns a list of selected variables in the current view | def getSelectedVariables(self):
variables = []
if self.ui.variablesStackedWidget.currentWidget() == self.ui.treePage:
for index in self.ui.treeView.selectionModel().selectedRows():
sourceIndex = self.treeFilterModel.mapToSource(index)
treeItem = sourc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return [self.item]",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\r\n return self.get_field('variable')",
"def variables(self):\n if save_context.in_save_context():\n return [self._vars[0]]\n return... | [
"0.6890182",
"0.68224275",
"0.68167204",
"0.6789719",
"0.6756814",
"0.6725311",
"0.6666111",
"0.6618946",
"0.6522759",
"0.64665145",
"0.6447478",
"0.64048487",
"0.6348317",
"0.6316992",
"0.62837243",
"0.62506264",
"0.6203347",
"0.62001896",
"0.6182224",
"0.613966",
"0.6138310... | 0.7452965 | 0 |
Returns a list of parameter NULL values, with the preferred one being the first element. Child classes can override this to handle one or more attributes specially. | def getAttributeParamNullValues(self, sAttr):
sPrefix = self.getHungarianPrefix(sAttr);
if sPrefix in ['id', 'uid', 'i', 'off', 'pct']:
return [-1, '', '-1',];
elif sPrefix in ['l', 'c',]:
return [long(-1), '', '-1',];
elif sPrefix == 'f':
return ['',]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_optional_parameters(self) -> list:\n results = []\n if self.no_params or self.params_required:\n return []\n else:\n for parameter, parameter_details in self.parameters.items():\n # Fixing issue #92\n # if parameter == \"effect\":\n ... | [
"0.69190115",
"0.64131165",
"0.63192934",
"0.6291569",
"0.6269836",
"0.6231749",
"0.6221704",
"0.62021524",
"0.62021524",
"0.61993235",
"0.60666734",
"0.6025088",
"0.60132694",
"0.5948471",
"0.594662",
"0.59249294",
"0.59194756",
"0.5917253",
"0.59119874",
"0.5906074",
"0.588... | 0.73671734 | 0 |
Checks if the specified attribute value indicates NULL. Return True/False. Note! This isn't entirely kosher actually. | def isAttributeNull(self, sAttr, oValue):
if oValue is None:
return True;
aoNilValues = self.getAttributeParamNullValues(sAttr);
return oValue in aoNilValues; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __null_check(self, record_attribute, attribute_schema):\n if attribute_schema[NULLABLE_KEY]:\n return True\n elif record_attribute is not None:\n return True\n else:\n IS_VALID_FILE = False\n return False",
"def _val_is_null(self, val):\r\n ... | [
"0.78757244",
"0.7438803",
"0.74387854",
"0.7316441",
"0.72109246",
"0.7005877",
"0.6959067",
"0.6959067",
"0.6959067",
"0.6959067",
"0.6959067",
"0.6843644",
"0.68309885",
"0.6794519",
"0.67846787",
"0.67376745",
"0.6705671",
"0.6686406",
"0.6655515",
"0.66371065",
"0.659112... | 0.85452604 | 0 |
Converts an attribute from parameter NULL to database NULL value. Returns the new attribute value. | def _convertAttributeFromParamNull(self, sAttr, oValue):
aoNullValues = self.getAttributeParamNullValues(sAttr);
if oValue in aoNullValues:
oValue = None if sAttr not in self.kasAltArrayNull else [];
#
# Perform deep conversion on ModelDataBase object and lists of them.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertFromParamNull(self):\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n oNewValue = self._convertAttributeFromParamNull(sAttr, oValue);\n if oValue != oNewValue:\n setattr(self, sAttr, oNewValue);\n return self;",
"... | [
"0.742224",
"0.73244095",
"0.729691",
"0.5908886",
"0.5790638",
"0.55650306",
"0.55595267",
"0.55458456",
"0.55324733",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
"0.5517855",
... | 0.725843 | 3 |
Compares two instances, omitting the given attributes. | def isEqualEx(self, oOther, asExcludeAttrs):
for sAttr in self.getDataAttributes():
if sAttr not in asExcludeAttrs \
and getattr(self, sAttr) != getattr(oOther, sAttr):
# Delegate the final decision to an overridable method.
if not self.areAttributeVa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_comparison(obj1,obj2,attrs):\n return [Difference(f\"{obj1.__class__.__name__}.{attr}\",(result1,result2)) for attr in attrs if (result1 := getattr(obj1,attr)) != (result2 := getattr(obj2,attr))]",
"def __ne__(self, other: 'Attribute') -> bool:\n return not self == other",
"def compare(a, b,... | [
"0.7461806",
"0.6606661",
"0.652038",
"0.6516327",
"0.64668286",
"0.6457904",
"0.6445087",
"0.63312477",
"0.631773",
"0.6292929",
"0.62816066",
"0.62139916",
"0.6203377",
"0.62015563",
"0.6198498",
"0.6195475",
"0.6180157",
"0.6173154",
"0.6164043",
"0.61484087",
"0.6146747",... | 0.6043878 | 31 |
Stringifies the object. Returns string representation. | def toString(self):
sMembers = '';
for sAttr in self.getDataAttributes():
oValue = getattr(self, sAttr);
sMembers += ', %s=%s' % (sAttr, oValue);
oClass = type(self);
if sMembers == '':
return '<%s>' % (oClass.__name__);
return '<%s: %s>' % (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.serialize())",
"def str_(object_):\n return str(object_)",
"def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)",
"def __str__(self):\n return str(self.obj)",
"def to_strin... | [
"0.7506738",
"0.74586356",
"0.7258361",
"0.7218806",
"0.71957",
"0.7166881",
"0.7165539",
"0.7139487",
"0.7090761",
"0.70517224",
"0.70501816",
"0.7025512",
"0.7001984",
"0.6948369",
"0.6948369",
"0.6948369",
"0.69387436",
"0.6908546",
"0.6907089",
"0.6905434",
"0.6897113",
... | 0.0 | -1 |
Validates a string field. | def validateStr(sValue, cchMin = 0, cchMax = 4096, aoNilValues = tuple([None, '']), fAllowNull = True,
fAllowUnicodeSymbols = False):
if sValue in aoNilValues:
return (sValue, None if fAllowNull else 'Mandatory.');
if cchMin is not None and len(sValue) < cchMin:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_element(self, value):\n # If value is str is it considered valid. Satisfies \"required=True\".\n\n if isinstance(value, bytes):\n try:\n six.text_type(value, 'ascii')\n except UnicodeDecodeError as err:\n try:\n name = self.name\n except AttributeError:\n... | [
"0.74253744",
"0.74208415",
"0.7374959",
"0.72864664",
"0.7246695",
"0.71871084",
"0.7154195",
"0.6989683",
"0.6966621",
"0.68956023",
"0.6889763",
"0.68423563",
"0.67504436",
"0.67465925",
"0.6733587",
"0.6696586",
"0.6682746",
"0.6613083",
"0.66082656",
"0.659321",
"0.65776... | 0.5729418 | 90 |
Validates a string field. | def _validateStr(dErrors, sName, sValue, cchMin = 0, cchMax = 4096):
(sValue, sError) = ModelDataBase.validateStr(sValue, cchMin, cchMax, fAllowNull = True);
if sError is not None:
dErrors[sName] = sError;
return sValue; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_element(self, value):\n # If value is str is it considered valid. Satisfies \"required=True\".\n\n if isinstance(value, bytes):\n try:\n six.text_type(value, 'ascii')\n except UnicodeDecodeError as err:\n try:\n name = self.name\n except AttributeError:\n... | [
"0.74253744",
"0.74208415",
"0.7374959",
"0.72864664",
"0.7246695",
"0.71871084",
"0.7154195",
"0.6989683",
"0.6966621",
"0.68956023",
"0.6889763",
"0.68423563",
"0.67504436",
"0.67465925",
"0.6733587",
"0.6696586",
"0.6682746",
"0.66082656",
"0.659321",
"0.6577604",
"0.64955... | 0.6613083 | 17 |
Validates a string field, not null. | def _validateStrNN(dErrors, sName, sValue, cchMin = 0, cchMax = 4096):
(sValue, sError) = ModelDataBase.validateStr(sValue, cchMin, cchMax, fAllowNull = False);
if sError is not None:
dErrors[sName] = sError;
return sValue; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _str_validator(arg):\n if arg is None or arg is '' or type(arg) != str:\n raise ValueError('Incorrect value: input should be a string')",
"def _validate_string(display_name, input_value):\n\n if not isinstance(input_value, str):\n raise ValueError(display_name + \" must be... | [
"0.767338",
"0.7408153",
"0.73341775",
"0.72661185",
"0.7265452",
"0.7163427",
"0.7155701",
"0.7144745",
"0.71218705",
"0.7028805",
"0.70231056",
"0.6969482",
"0.69310814",
"0.6785847",
"0.67741376",
"0.6765377",
"0.6758959",
"0.6721232",
"0.66710526",
"0.6624626",
"0.6575498... | 0.62115806 | 37 |
Validates a list of text items, not null and len >= 1. | def _validateListOfStrNN(dErrors, sName, asValues, asValidValues = None):
(sValue, sError) = ModelDataBase.validateListOfStr(asValues, asValidValues = asValidValues, fAllowNull = False);
if sError is not None:
dErrors[sName] = sError;
return sValue; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_empty_list_elements(items: List[Text]):\n for item in items:\n if Utility.check_empty_string(item):\n return True\n return False",
"def clean_items(self):\n items = self.cleaned_data['items']\n if len(items) < 1:\n v_err('no_items')\n ... | [
"0.7195141",
"0.6712807",
"0.6572784",
"0.65014946",
"0.6034439",
"0.5997386",
"0.59821457",
"0.58832294",
"0.58318144",
"0.57791656",
"0.57645917",
"0.5716486",
"0.569774",
"0.56956303",
"0.56180435",
"0.56173664",
"0.560659",
"0.5600455",
"0.5600349",
"0.55966073",
"0.55952... | 0.52953994 | 42 |
Gets the database connection. This should only be used for instantiating other ModelLogicBase children. | def getDbConnection(self):
return self._oDb; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connection(cls):\n return cls.database.connection",
"def obtainDatabaseConnection(self):\n\t\tself.databaseConnector = DatabaseConnector()",
"def getDb(self):\n return self.db",
"def get_db():\n # this is a bit of a hack, since it assumes all the models talk to the same\n # db. t... | [
"0.7785817",
"0.7329198",
"0.71892035",
"0.71099144",
"0.7093842",
"0.7072977",
"0.7050669",
"0.70497996",
"0.70107067",
"0.70043844",
"0.70043844",
"0.6999895",
"0.6966073",
"0.6965309",
"0.69474334",
"0.69444954",
"0.68784475",
"0.6875405",
"0.6867934",
"0.6867934",
"0.6856... | 0.74550015 | 1 |
Given str (unicode, latin1, or not) return ascii. | def str_to_ascii(a_string):
try:
return unicode(a_string).encode("ascii", "ignore")
except UnicodeDecodeError:
return a_string.decode("ascii", "ignore") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_to_ascii(string):\n if string is None:\n return\n\n if isinstance(string, str):\n string = string.decode('utf-8')\n\n return normalize('NFKD', string).encode('ASCII', 'ignore')",
"def _UnicodeToAscii(string):\n return unicode(string).encode('utf-8')",
"def unicode_to_ascii(s)... | [
"0.75257957",
"0.7480308",
"0.72379214",
"0.7105091",
"0.70763785",
"0.7036202",
"0.7002097",
"0.6975409",
"0.6933777",
"0.6864804",
"0.68498427",
"0.6792946",
"0.6772615",
"0.6707549",
"0.66334283",
"0.6578035",
"0.65771323",
"0.6568837",
"0.65534526",
"0.65534526",
"0.65145... | 0.7165687 | 3 |
Converts an execution result from EvoROS into a format for Enki. | def convert_from_evoros_result(self, evoros_result):
error = np.abs(np.array(evoros_result['Actual Speed']) - np.array(evoros_result['Goal Speed']))
# convert to Enki result
enki_result = {
'error': error
}
return enki_result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_result_to_json(self, lines):\n if not lines:\n return {'status': 'Failed',\n 'msg': 'Final result is not available.'}\n\n lines = lines.split('\\n')\n n = len(lines)\n\n if n == 1:\n return self._result_to_dict(lines[0])\n\n r... | [
"0.61867934",
"0.59432",
"0.5779423",
"0.5740296",
"0.56522864",
"0.5643881",
"0.5544683",
"0.55357957",
"0.5526455",
"0.5514593",
"0.5441012",
"0.543424",
"0.5405496",
"0.54001427",
"0.5397595",
"0.5360325",
"0.5354287",
"0.5348141",
"0.5344966",
"0.5336439",
"0.5335771",
... | 0.7040401 | 0 |
Computes a list of ramp parameters from a set of ramp angles. | def compute_ramps(ramp_angles, ramp_length=20.0, x_pos=0.0, y_pos=0.0, z_pos=0.0):
n = len(ramp_angles)
ramp_params = np.zeros((n, 6))
ramp_params[:, 4] = ramp_angles
ramp_params[0, :3] = (x_pos, y_pos, z_pos)
for i in range(1, len(ramp_params)):
(x, y, z, u, v, w) = ramp_params[i - 1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ramp4p(params, phase, args=dict(n=5, guess=[1, -0.068, 2.33, 0.933, -20.5])):\n # 2013-12-07 14:08 IJMC: Created.\n\n return params[0] * (1. + np.exp(-params[1]*phase + params[2]) + \\\n params[3] * (phase - 0.5) + \\\n params[4] * (phase - 0.5)**2)... | [
"0.57274586",
"0.5697873",
"0.5659067",
"0.55219954",
"0.5388157",
"0.5351052",
"0.5317289",
"0.5316341",
"0.5314027",
"0.52170384",
"0.5198033",
"0.5171314",
"0.5161887",
"0.51576054",
"0.5145033",
"0.5078017",
"0.5044133",
"0.50359976",
"0.5023953",
"0.4967695",
"0.49594",
... | 0.73454 | 0 |
init small cls prob parameters | def init_small_clsprob_param(self, param):
param['ub_a'] = self.instance.Tensor(self.dtype,
(self.one_max_size // self.dsize,),
scope=tik.scope_ubuf, name="ub_a")
param['ub_b'] = self.instance.Tensor(self.dtype,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, classes, data_size):\r\n self.classes = classes\r\n self.data_size = data_size\r\n self.conditional_prob = {class_:{} for class_ in classes} # Conditional Probability Table for storing parameters useful to compute P(feat|class_)\r\n self.class_prob = {} # Stores the p... | [
"0.7302363",
"0.6900915",
"0.68818927",
"0.6841304",
"0.6841304",
"0.6841304",
"0.6800334",
"0.67570823",
"0.67509097",
"0.6715748",
"0.6658863",
"0.6651701",
"0.66029763",
"0.6585666",
"0.6519696",
"0.6515056",
"0.6482098",
"0.64801204",
"0.6456403",
"0.6446261",
"0.64074904... | 0.6224274 | 40 |
return True if n is a prime number | def is_prime(n):
if n < 2:
return False
if n == 2 | n == 3:
return True
if n % 2 == 0 | n % 3 == 0:
return False
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def isprime(n):\n if n % 2 == 0:return False\n return all(n % i for i in range(3, int(n**0.5) + 1, 2))",
"def isprime(n: int) -> bool:\r\n if n > 1:\r\n for i in range(2, int(n / 2) + 1):\r\n if (n ... | [
"0.8848491",
"0.8838163",
"0.8630065",
"0.86087567",
"0.860345",
"0.8588974",
"0.8586852",
"0.85864645",
"0.8582361",
"0.85803086",
"0.8576298",
"0.8530761",
"0.8525803",
"0.84985477",
"0.849435",
"0.849369",
"0.8492627",
"0.8485174",
"0.8478475",
"0.8467156",
"0.84513164",
... | 0.8309483 | 42 |
Get current activated X layout and variant | def get_current_layout(self):
# ported from the widgets/src/LayoutIndicator.c code
self._engine.start_listen(Xkl.EngineListenModes.TRACK_KEYBOARD_STATE)
state = self._engine.get_current_state()
cur_group = state.group
num_groups = self._engine.get_num_groups()
# BUG?: i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_x(self):\n return self.floris.farm.layout_x",
"def currentLayout( self ):\n return self._current_layout_name",
"def getCurrentView(self):\n if self.viewFrame._expanded == -1: #four view\n self.currentView = None\n if self.viewFrame._expanded == 0: #top view\n ... | [
"0.605387",
"0.6011307",
"0.5662959",
"0.5584125",
"0.55323714",
"0.55323374",
"0.5441459",
"0.54347074",
"0.53799796",
"0.53772086",
"0.5370531",
"0.5356763",
"0.5211902",
"0.51930255",
"0.5178601",
"0.51521975",
"0.51432216",
"0.5141289",
"0.51308936",
"0.5130336",
"0.50792... | 0.64071596 | 0 |
Return file path for home directory (Windows or Linux) | def homedir():
return os.path.expanduser('~') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_home_dir(self) -> str:\n ret = os.path.expanduser(\"~\")\n if not os.path.exists(ret):\n raise RuntimeError(\"The home directory does not exist.\")\n return ret",
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def us... | [
"0.7899748",
"0.788515",
"0.77646345",
"0.7750621",
"0.76751894",
"0.74801713",
"0.74759996",
"0.746117",
"0.72324556",
"0.7166405",
"0.71596915",
"0.7116814",
"0.70766926",
"0.70766926",
"0.706985",
"0.7066753",
"0.7035286",
"0.7033459",
"0.7016307",
"0.69969046",
"0.6982097... | 0.7970018 | 0 |
Return a list/array object from the input. If input is a single value (e.g. int, str, etc.) then output is a list of length 1. If input is already a list or array, then output is the same as input. | def makelist(input):
if isinstance(input, list) or isinstance(input, np.array):
output = input
else:
output = [input]
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _MakeList(input):\n if len(input) == 0:\n raise ValueError(\n 'input cannot be empty.')\n elif len(input) == 1:\n output = input[0]\n if not isinstance(output, list):\n output = [output]\n else:\n output = list(input)\n return output",
"def _to_li... | [
"0.79715425",
"0.79601175",
"0.7177029",
"0.70683575",
"0.7038864",
"0.7033162",
"0.7027106",
"0.693738",
"0.6904807",
"0.6889374",
"0.6865846",
"0.67974997",
"0.6787147",
"0.66201985",
"0.6612872",
"0.65375596",
"0.6506465",
"0.6494574",
"0.64896965",
"0.64349765",
"0.642113... | 0.81284493 | 0 |
Return home directory for this computer. | def homedir(options=['/home/jennifer/', '/home/jwalker/',
'C:/Users/jenfl/']):
home = None
for h in options:
if os.path.isdir(h):
home = h
if home is None:
raise ValueError('Home directory not found in list of options.')
return home | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_home_dir(self) -> str:\n ret = os.path.expanduser(\"~\")\n if not os.path.exists(ret):\n raise RuntimeError(\"The home directory does not exist.\")\n return ret",
"def get_home_dir():\r\n home = os.getenv('HOME')\r\n if home is None:\r\n # This expanduser usua... | [
"0.855701",
"0.82702553",
"0.81739444",
"0.813368",
"0.8084931",
"0.7991301",
"0.7881473",
"0.7797294",
"0.7797294",
"0.7732274",
"0.7645844",
"0.75857484",
"0.75256646",
"0.7429106",
"0.73639876",
"0.70974565",
"0.70605797",
"0.7031101",
"0.7005657",
"0.6978099",
"0.6924563"... | 0.69547516 | 20 |
Returns the string e.g. 'JAN' corresponding to month | def month_str(month, upper=True):
months=['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
'sep', 'oct', 'nov', 'dec']
mstr = months[month - 1]
if upper:
mstr = mstr.upper()
return mstr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthname(self):\n return self.strftime(\"%B\")",
"def get_month_name(month_of_year):\n return VALID_MONTHS[month_of_year - 1].title()",
"def month_name(month_number):\n return calendar.month_name[month_number]",
"def get_month_name(month):\n datetime_object = datetime.datetime.strptime(s... | [
"0.80254114",
"0.7758206",
"0.7496757",
"0.7430308",
"0.7304122",
"0.7240897",
"0.7238173",
"0.7206049",
"0.71150947",
"0.7110264",
"0.70951515",
"0.70748454",
"0.69632405",
"0.6923557",
"0.68850803",
"0.6844022",
"0.6844004",
"0.6801583",
"0.67842543",
"0.6770507",
"0.669222... | 0.77181786 | 2 |
Return list of months (112) for the selected season. | def season_months(season):
ssn=['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
'sep', 'oct', 'nov', 'dec', 'djf', 'mam', 'jja', 'son',
'mayjun', 'julaug', 'marapr', 'jjas', 'ond', 'ann']
imon = [1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, [1,2,12], [3,4,5], [6,7,8], [9,10,11]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_months(self, cr, uid, context):\n months=[(str(n),str(n)) for n in range(1,13)]\n return months",
"def get_months(self):\n return self.__months;",
"def month(self):\n return self._months",
"def get_month(self, data):\n\n # Create two empty list.\n month = []\n ... | [
"0.7139848",
"0.6721564",
"0.6720109",
"0.6623628",
"0.6539094",
"0.6514505",
"0.6488083",
"0.6457306",
"0.63939476",
"0.6348616",
"0.63004607",
"0.62996686",
"0.627289",
"0.6212778",
"0.6148962",
"0.61293715",
"0.60808825",
"0.6069642",
"0.60561514",
"0.60021144",
"0.5996275... | 0.8147387 | 0 |
Returns the shortest distance between two points on a circle | def circ_dist(azimuth1, azimuth2, radius=1.0):
return np.arccos(np.cos(azimuth1 - azimuth2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance(first: Point, second: Point) -> Float:\n\n return sqrt(\n (second.x - first.x) ** 2\n +\n (second.y - first.y) ** 2\n )",
"def great_circle_distance(pnt1, pnt2, radius):\n\t\t\tlat1 = radians(pnt1[0])\n\t\t\tlat2 = radians(pnt2[0])\n\t\t\tdLat = lat2 - lat1\n\t\t\tdLon... | [
"0.7725868",
"0.7439184",
"0.7357595",
"0.7344613",
"0.72522837",
"0.7220122",
"0.7193245",
"0.7157339",
"0.71407026",
"0.71002424",
"0.70845574",
"0.70843244",
"0.7055846",
"0.70451635",
"0.70373017",
"0.70327085",
"0.7028982",
"0.70034313",
"0.700322",
"0.69876975",
"0.6985... | 0.0 | -1 |
Endpoint for listing the available actions. | def list(self, _request):
serializer = TaskSerializer(instance=TASKS.values(), many=True)
return response.Response(serializer.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self) -> List[str]:\n return list(self.__endpoints.keys())",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n return []",
"def list_actions(self, query_params: Dict[str, object] = None) -> List[Action]:\n if query_params is None:\n ... | [
"0.7520243",
"0.7514089",
"0.74697655",
"0.7428571",
"0.74263626",
"0.738024",
"0.7374991",
"0.73484164",
"0.73089343",
"0.72765934",
"0.7109194",
"0.7079867",
"0.7039582",
"0.7039582",
"0.7022842",
"0.7021607",
"0.701933",
"0.7011425",
"0.69516975",
"0.6932179",
"0.6903505",... | 0.0 | -1 |
Add a X conv + 1fc head, with GroupNorm | def add_roi_Xconv1fc_gn_head(model, blob_in, dim_in, spatial_scale):
hidden_dim = cfg.FAST_RCNN.CONV_HEAD_DIM
roi_size = cfg.FAST_RCNN.ROI_XFORM_RESOLUTION
roi_feat = model.RoIFeatureTransform(
blob_in, 'roi_feat',
blob_rois='rois',
method=cfg.FAST_RCNN.ROI_XFORM_METHOD,
reso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_group_norm(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n num_groups = op.attr(\"groups\")\n epsilon = op.attr(\"epsilon\")\n gamma = g.get_node(op.input(\"Scale\")[0])\n beta = g.get_node(op.input(\"Bias\")[0])\n out = _op.nn.group_norm(\n x,\n gamma=gamma,\n ... | [
"0.59164983",
"0.5727869",
"0.566289",
"0.5602198",
"0.54132724",
"0.5386572",
"0.53635406",
"0.5336108",
"0.53305835",
"0.5299321",
"0.52981585",
"0.5246872",
"0.5242593",
"0.52328086",
"0.52215046",
"0.5217488",
"0.521675",
"0.5194634",
"0.51860344",
"0.51815903",
"0.512805... | 0.5650509 | 3 |
Compute the onedimensional local linear form (f,phi) | def oned_linear(kernel, test, w_g):
b = np.dot(test.T, kernel*w_g)
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fLinear(Vc1,Vc2,Vc3,Vk,Vw,Va,Vf,Pc1,Pc2,Pc3,Pk,Pw,Pa,Pf):\n#\n# 1. Normalise volumetric components:\n#\t-----------------------------------\n\tSum=abs(Vc1)+abs(Vc2)+abs(Vc3)+abs(Vk)+abs(Vw)+abs(Va)+abs(Vf)\n\tVc1=abs(Vc1)/Sum\n\tVc2=abs(Vc2)/Sum\n\tVc3=abs(Vc3)/Sum\n\tVk=abs(Vk)/Sum\n\tVw=abs(Vw)/Sum\n\tVa=a... | [
"0.62282854",
"0.6205783",
"0.61138064",
"0.60453856",
"0.57911116",
"0.57124776",
"0.57002366",
"0.5693049",
"0.56332254",
"0.562311",
"0.5599616",
"0.5580253",
"0.55734074",
"0.5570558",
"0.55538654",
"0.5532057",
"0.55198",
"0.550955",
"0.54811203",
"0.54804295",
"0.547950... | 0.0 | -1 |
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, nothing at this URL.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81159586",
"0.80410045",
"0.7738874",
"0.77369535",
"0.77182025",
"0.7689595",
"0.7670471",
"0.76112473",
"0.7602477",
"0.7570698",
"0.75528365",
"0.7545827",
"0.751882",
"0.74745256",
"0.7458403",
"0.7455682",
"0.74548143",
"0.74505144",
"0.7442062",
"0.7428278",
"0.74065... | 0.72672606 | 30 |
returns true of the uri of the entity is not a bnode | def is_named(self):
return isinstance(self.uri, rdflib.URIRef) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_nodes(self, uri=''):\n if self.get_nodes(uri):\n return True\n return False",
"def is_end_node():\n return False",
"def __ne__(self, other: 'FirstHref') -> bool:\n return not self == other",
"def hasEntityLink(self, link):\r\n return self.feed_han... | [
"0.59824306",
"0.5884854",
"0.5854641",
"0.58155274",
"0.57446367",
"0.5716514",
"0.5707275",
"0.5697329",
"0.56939554",
"0.56939554",
"0.5675469",
"0.5669543",
"0.56520087",
"0.5637798",
"0.56250226",
"0.55768865",
"0.55719775",
"0.5568983",
"0.5504727",
"0.5487473",
"0.5485... | 0.5368802 | 35 |
This test simulates a spawn failure with no retry data. If driver spawn raises an exception and there is no retry data available, the instance fault message should not contain any details about rescheduling. The fault message field is limited in size and a long message about rescheduling displaces the original error me... | def test_instance_fault_message_no_rescheduled_details_without_retry(self):
instance = self._create_fake_instance_obj()
with mock.patch.object(self.compute.driver, 'spawn') as mock_spawn:
mock_spawn.side_effect = test.TestingException('Preserve this')
self.compute.build_and_run_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_instance_spawn_fail(self):\n def fake(*args, **kwargs):\n raise test.TestingException()\n self.stub_out('nova.virt.fake.FakeDriver.spawn', fake)\n instance = self._create_fake_instance_obj()\n self.compute.build_and_run_instance(\n self.c... | [
"0.69014883",
"0.6290831",
"0.6179854",
"0.6179283",
"0.61531883",
"0.61460716",
"0.612878",
"0.6011953",
"0.59722716",
"0.59667265",
"0.5964098",
"0.59471655",
"0.5941641",
"0.5910479",
"0.5884765",
"0.5883148",
"0.5868876",
"0.58456767",
"0.58346635",
"0.57932943",
"0.57890... | 0.75284296 | 0 |
Test behavior when ``filter_properties`` is None. This should disable rescheduling and the original exception should be raised. | def test_reschedule_resize_or_reraise_no_filter_properties(self):
filter_properties = None
try:
raise test.TestingException("Original")
except Exception:
exc_info = sys.exc_info()
# because we're not retrying, we should re-raise the exception
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_errors(self):\n\n with self.assertRaises(ValueError):\n self.test_table.filter()\n\n with self.assertRaises(ValueError):\n self.test_table.filter(mode='wrongmode', Property='Property')",
"def test_filter_function_settings_fail(self):\n with self.assertRa... | [
"0.6384467",
"0.620909",
"0.61859995",
"0.61689985",
"0.6095652",
"0.5783643",
"0.57635003",
"0.5734415",
"0.57223344",
"0.57017463",
"0.56646395",
"0.56625396",
"0.5657957",
"0.565173",
"0.561798",
"0.56025827",
"0.55968857",
"0.5586738",
"0.5547431",
"0.55296874",
"0.552965... | 0.72615784 | 0 |
Generate random position of pipe for upper and lower one's | def random_pipe():
pipe_height = GAME_SPRITES['pipe'][0].get_height()
offset = SCREENHEIGHT/3
position_for_lower_pipe_at_y = random.randrange(0, int(SCREENHEIGHT - GAME_SPRITES['base'].get_height() - 1.2 * offset))
pipe_x = SCREENWIDTH * 10
position_for_upper_pipe_at_y = pipe_height - position_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandomPipe():\n # y of gap between upper and lower pipe\n gapY = random.randrange(int(BASEY * 0.5), int(BASEY * 0.8))\n\n pipeX = SCREEN_WIDTH - 10\n\n return [{'x': pipeX, 'y': gapY}] # lower pipe",
"def get2RandomPipeY():\n gap = minPipeLen = int(SCREEN_HEIGHT * 0.3)\n pipe_invertedY =... | [
"0.7413132",
"0.7373159",
"0.72579426",
"0.7049988",
"0.69439995",
"0.67171836",
"0.6709101",
"0.6546268",
"0.65138906",
"0.6510075",
"0.64200574",
"0.6292457",
"0.62199825",
"0.62191665",
"0.6166769",
"0.61153907",
"0.60637087",
"0.603667",
"0.60052437",
"0.5946807",
"0.5944... | 0.73725826 | 2 |
Validates Oculus session ticket. Returns a unique ID for this player. | def run_ticket_validation(user_id, access_token, nonce):
token_check_url = 'https://graph.oculus.com/user_nonce_validate?access_token={access_token}&nonce={nonce}&user_id={user_id}'
url = token_check_url.format(user_id=user_id, access_token=access_token, nonce=nonce)
try:
ret = requests.post(url, h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_oculus_ticket():\n\n ob = request.get_json()\n try:\n OculusProviderAuthSchema().load(ob)\n except ma.ValidationError as e:\n abort_unauthorized(\"Oculus token property %s is invalid\" % e.field_name)\n\n provider_details = ob['provider_details']\n # Get Oculus authenticat... | [
"0.6811697",
"0.54994696",
"0.547516",
"0.53120875",
"0.529673",
"0.52818805",
"0.52368057",
"0.5234665",
"0.5192762",
"0.5180851",
"0.5159935",
"0.50768316",
"0.50611377",
"0.50514615",
"0.4996486",
"0.49881732",
"0.498304",
"0.4970404",
"0.49622655",
"0.49377736",
"0.492466... | 0.56009 | 1 |
Just returns the "index" text on the base api url | def index(self):
return dict(data='index') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def index():\n return \"Index\"",
"def get_index(self):\n self.client.get('/')",
"def index():\n return 'Thanks for using the Bird Stats API.'",
"def index():\n return (\n f\"Welcome to the Climate App API!<br/>\"\n f\"Available Routes:<br/>\"\n f\"/api/v1.0/precipi... | [
"0.7340468",
"0.7339138",
"0.7306913",
"0.72906536",
"0.7290007",
"0.7149814",
"0.71319246",
"0.70897335",
"0.7062784",
"0.7054696",
"0.7043132",
"0.70310926",
"0.70305705",
"0.7018785",
"0.70159453",
"0.6918297",
"0.6915131",
"0.6913194",
"0.68822044",
"0.68792313",
"0.68792... | 0.0 | -1 |
raises click.UsageError if the current experiment has a dependecy using a git+ssh url, since they're not supported on Heroku without docker | def fail_on_unsupported_urls(f):
@wraps(f)
def wrapper(**kwargs):
if "\ngit+ssh" in Path("requirements.txt").read_text():
raise click.UsageError(
"This experment has a git+ssh dependency.\n"
"Dallinger does not support this for Heroku deployment using non-doc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_giturl_missing(self):\r\n response = self.client.get(self.test_url)\r\n self.assertEqual(200, response.status_code)\r\n self.assertIn(\r\n ('giturl must be defined in your '\r\n 'course settings before you can export to git.'),\r\n response.content\r\... | [
"0.5872089",
"0.5724708",
"0.55480397",
"0.54968745",
"0.54607356",
"0.541308",
"0.539932",
"0.534126",
"0.53302205",
"0.5326562",
"0.5312911",
"0.5226174",
"0.52177185",
"0.51851946",
"0.51745653",
"0.5156039",
"0.5132064",
"0.5124223",
"0.5105844",
"0.50707114",
"0.50376904... | 0.703439 | 0 |
If x1_i is +0 and x2_i is 0, the result is an approximation to +pi. | def test_atan2_special_case_pzero_and_nzero(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(+0.0, dtype=dt)
x2 = dpt.asarray([-0.0], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(dpt.pi, dtype=dt)
diff = dpt.abs(dpt.subtract(actual, expected)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def ip(self, psi_1, psi_2):\n return np.dot(np.conjugate(psi_1), psi_2) * self.dx",
"def atan2(y, x):\n return 0.0",
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm... | [
"0.6267272",
"0.60406315",
"0.6025863",
"0.5863307",
"0.58493674",
"0.5834824",
"0.5822923",
"0.5802591",
"0.57997376",
"0.57789564",
"0.57533866",
"0.57507426",
"0.5720936",
"0.57158244",
"0.5707037",
"0.56690854",
"0.5661951",
"0.56287724",
"0.5623909",
"0.55873954",
"0.556... | 0.57807004 | 9 |
If x1_i is +0 and x2_i is less than 0, the result is an approximation to +pi. | def test_atan2_special_case_pzero_and_negatvie(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(+0.0, dtype=dt)
x2 = dpt.asarray([-0.5, -1, -2, -dpt.inf], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(dpt.pi, dtype=dt)
diff = dpt.abs(dpt.subtr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def l1(x1, x2):\n return np.abs(x1 - x2)",
"def ip(self, psi_1, psi_2):\n return np.dot(np.conjugate(psi_1), psi_2) * self.dx",
"def fixed_signs(popt1, popt2):\n if np.sign(popt1[0]) != np.sign(popt2[0]):\n ... | [
"0.6307693",
"0.596727",
"0.5958959",
"0.5937109",
"0.592713",
"0.59124225",
"0.58818066",
"0.58754313",
"0.5831002",
"0.5761324",
"0.572725",
"0.57018584",
"0.57017636",
"0.56919664",
"0.5684063",
"0.5663974",
"0.5659805",
"0.5634702",
"0.56192374",
"0.5616215",
"0.5581256",... | 0.55944765 | 20 |
If x1_i is 0 and x2_i is 0, the result is an approximation to pi. | def test_atan2_special_case_nzero_and_nzero(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray([-0.0], dtype=dt)
x2 = dpt.asarray([-0.0], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi, dtype=dt)
diff = dpt.abs(dpt.subtract(actual, expect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm = dec.Decimal(0.25)\r\n agm2 = dec.Decimal(0.5).sqrt()\r\n # Uses the elliptic integral relation to the agm to calculate pi.\... | [
"0.6377798",
"0.6333334",
"0.6095232",
"0.60379565",
"0.6031754",
"0.6010324",
"0.5970948",
"0.58610284",
"0.58510697",
"0.582096",
"0.58136797",
"0.58045906",
"0.57947624",
"0.57875955",
"0.5756818",
"0.57533133",
"0.5745103",
"0.5727128",
"0.57029456",
"0.56960905",
"0.5681... | 0.5308813 | 87 |
If x1_i is 0 and x2_i is less than 0, the result is an approximation to pi. | def test_atan2_special_case_nzero_and_negative(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray([-0.0], dtype=dt)
x2 = dpt.asarray([-dpt.inf, -2, -1, -0.5], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi, dtype=dt)
diff = dpt.abs(dpt.su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm = dec.Decimal(0.25)\r\n agm2 = dec.Decimal(0.5).sqrt()\r\n # Uses the elliptic integral relation to the agm to calculate pi.\... | [
"0.6366942",
"0.63605756",
"0.60826313",
"0.60589015",
"0.59939265",
"0.5972934",
"0.59452593",
"0.5901275",
"0.5899337",
"0.58781934",
"0.5866349",
"0.5839281",
"0.58179456",
"0.57995176",
"0.5773858",
"0.5770369",
"0.57121265",
"0.5672166",
"0.565147",
"0.56277204",
"0.5624... | 0.0 | -1 |
If x1_i is less than 0 and x2_i is 0, the result is an approximation to pi/2. | def test_atan2_special_case_negative_and_nzero(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray([-dpt.inf, -2, -1, -0.5], dtype=dt)
x2 = dpt.asarray(-0.0, dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi / 2, dtype=dt)
diff = dpt.abs(dpt.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def l2(x1, x2):\n return np.sqrt((x1 - x2)**2)",
"def atan2(y, x):\n return 0.0",
"def fidelity(self, psi_1, psi_2):\n return np.abs(self.ip(psi_1, psi_2))**2",
"def xi(element1, element2, distance):\n re... | [
"0.6567152",
"0.62541723",
"0.6240584",
"0.61348456",
"0.6088892",
"0.60442483",
"0.6035881",
"0.59666276",
"0.5963197",
"0.59327036",
"0.5900643",
"0.5883083",
"0.587695",
"0.58225435",
"0.58208567",
"0.58052015",
"0.5799738",
"0.57911533",
"0.5786032",
"0.57812285",
"0.5776... | 0.0 | -1 |
If x1_i is greater than 0, x1_i is a finite number, and x2_i is infinity, the result is an approximation to +pi. | def test_atan2_special_case_pfinite_and_ninf(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray([0.5, 1, 2, 5], dtype=dt)
x2 = dpt.asarray(-dpt.inf, dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(dpt.pi, dtype=dt)
diff = dpt.abs(dpt.subtract(actu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def linf(x1, x2):\n return np.max(np.abs(x1 - x2))",
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm = dec.Decimal(0.25)\r\n agm2 = dec.Decimal(0.5).sqrt()\r\n # Uses ... | [
"0.6256534",
"0.61559767",
"0.6017998",
"0.58868545",
"0.5804983",
"0.5785986",
"0.573189",
"0.5730896",
"0.5718055",
"0.57105035",
"0.5680693",
"0.5650491",
"0.5649155",
"0.56457764",
"0.56342196",
"0.56011516",
"0.5599038",
"0.55962646",
"0.5575096",
"0.55556864",
"0.554938... | 0.59414405 | 3 |
If x1_i is less than 0, x1_i is a finite number, and x2_i is infinity, the result is an approximation to pi. | def test_atan2_special_case_nfinite_and_ninf(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray([-0.5, -1, -2, -5], dtype=dt)
x2 = dpt.asarray(-dpt.inf, dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi, dtype=dt)
diff = dpt.abs(dpt.subtract... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm = dec.Decimal(0.25)\r\n agm2 = dec.Decimal(0.5).sqrt()\r\n # Uses the elliptic integral relation to the agm to calculate pi.\r\n while True:\r\n agm1 = (agm1 + agm2) / 2\r\n agm2 = (agm0 * agm2).sq... | [
"0.6436234",
"0.6257629",
"0.59987813",
"0.5971408",
"0.59569323",
"0.59115046",
"0.58437914",
"0.5835988",
"0.581221",
"0.5777042",
"0.5746533",
"0.57395697",
"0.57395035",
"0.57285154",
"0.56861067",
"0.5660675",
"0.56545585",
"0.5632691",
"0.56264806",
"0.5581733",
"0.5580... | 0.5632402 | 18 |
If x1_i is +infinity and x2_i is a finite number, the result is an approximation to +pi/2. | def test_atan2_special_case_pinf_and_finite(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(dpt.inf, dtype=dt)
x2 = dpt.asarray([-2, -0.0, 0.0, 2], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(dpt.pi / 2, dtype=dt)
diff = dpt.abs(dpt.subtrac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linf(x1, x2):\n return np.max(np.abs(x1 - x2))",
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def test_atan2_special_case_pfinite_and_ninf(dt):\n q = get_queue_or_skip()\n skip_if_dtype_not_supported(dt, q)\n\n x1 = dpt.asarray([0.5, 1, 2, 5], dtype=dt... | [
"0.6402555",
"0.63679695",
"0.6131822",
"0.6073823",
"0.5933657",
"0.59333557",
"0.59000796",
"0.58781886",
"0.58662075",
"0.5822566",
"0.5812585",
"0.57847697",
"0.5725153",
"0.5685548",
"0.56758904",
"0.5646981",
"0.56345046",
"0.5627198",
"0.5619317",
"0.5619271",
"0.56181... | 0.59165984 | 6 |
If x1_i is infinity and x2_i is a finite number, the result is an approximation to pi/2. | def test_atan2_special_case_ninf_and_finite(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(-dpt.inf, dtype=dt)
x2 = dpt.asarray([-2, -0.0, 0.0, 2], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi / 2, dtype=dt)
diff = dpt.abs(dpt.subtr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def test_atan2_special_case_pfinite_and_ninf(dt):\n q = get_queue_or_skip()\n skip_if_dtype_not_supported(dt, q)\n\n x1 = dpt.asarray([0.5, 1, 2, 5], dtype=dt)\n x2 = dpt.asarray(-dpt.inf, dtype=dt)\n\n actual =... | [
"0.62907547",
"0.62660867",
"0.6163705",
"0.6130893",
"0.60858595",
"0.60476124",
"0.59948826",
"0.598838",
"0.59295696",
"0.5928273",
"0.5898101",
"0.58973503",
"0.5895721",
"0.5868295",
"0.5826398",
"0.5787167",
"0.5767206",
"0.57665265",
"0.57661396",
"0.57214695",
"0.5664... | 0.58919275 | 13 |
If x1_i is +infinity and x2_i is +infinity, the result is an approximation to +pi/4. | def test_atan2_special_case_pinf_and_pinf(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(dpt.inf, dtype=dt)
x2 = dpt.asarray([dpt.inf], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(dpt.pi / 4, dtype=dt)
diff = dpt.abs(dpt.subtract(actual, e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def linf(x1, x2):\n return np.max(np.abs(x1 - x2))",
"def xi(element1, element2, distance):\n return (float(covalence_radius[element1]) + float(covalence_radius[element2]) -\n (0.08 * float(abs(electro_negat... | [
"0.6547007",
"0.6428182",
"0.58895326",
"0.58487666",
"0.5847909",
"0.5805441",
"0.5793036",
"0.5686634",
"0.56774825",
"0.5674597",
"0.56681997",
"0.5649038",
"0.56483895",
"0.5646257",
"0.5632014",
"0.56013274",
"0.5600212",
"0.5592367",
"0.55766135",
"0.5575396",
"0.557045... | 0.5497608 | 31 |
If x1_i is infinity and x2_i is +infinity, the result is an approximation to pi/4. | def test_atan2_special_case_ninf_and_pinf(dt):
q = get_queue_or_skip()
skip_if_dtype_not_supported(dt, q)
x1 = dpt.asarray(-dpt.inf, dtype=dt)
x2 = dpt.asarray([dpt.inf], dtype=dt)
actual = dpt.atan2(x1, x2)
expected = dpt.asarray(-dpt.pi / 4, dtype=dt)
diff = dpt.abs(dpt.subtract(actual,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def linf(x1, x2):\n return np.max(np.abs(x1 - x2))",
"def pi():\r\n getcontext().prec += 2\r\n agm0 = agm1 = pow2 = dec.Decimal(1)\r\n denm = dec.Decimal(0.25)\r\n agm2 = dec.Decimal(0.5).sqrt()\r\n # Uses ... | [
"0.62768745",
"0.62370145",
"0.5994263",
"0.58813924",
"0.5853484",
"0.57996005",
"0.5741806",
"0.5725664",
"0.5724673",
"0.57189685",
"0.5710294",
"0.57089883",
"0.5704483",
"0.568278",
"0.5652218",
"0.56403536",
"0.5604532",
"0.5599775",
"0.5595153",
"0.55847514",
"0.557186... | 0.5719304 | 9 |
Check if having the extension in the middle gives a valid url. | def check_in_middle(self, components, extension):
protocol, root, directory, filename = components
if len(filename.split('.')) > 1:
name, original_extension = filename.split('.')
original_extension = '.' + original_extension
else:
return False
check_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url(url=None, parse_url=None):\n \n if not parse_url:\n parse_url = urlparse.urlparse(url)\n \n return parse_url.netloc.endswith('slideshare.net')",
"def IsValidURL(s):\n return RE_COMPLEX_URL.match(s)",
"def _validate_url(url):\n if not url or url.count('/') != 1 or ... | [
"0.7260568",
"0.7256971",
"0.72072756",
"0.71938086",
"0.718865",
"0.71626246",
"0.7007787",
"0.6927225",
"0.6901204",
"0.6866132",
"0.6864475",
"0.68623626",
"0.68619543",
"0.6843714",
"0.68430316",
"0.6840791",
"0.68405545",
"0.6837551",
"0.6815936",
"0.6812255",
"0.6792726... | 0.6617167 | 34 |
Check if having the extension in the front gives a valid url. | def check_in_front(self, components, extension):
protocol, root, directory, filename = components
check_filename = extension + filename
self.request(protocol, root, directory, check_filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url_format(self):\r\n m = re.match(\"^http://www.tesco.com/direct/[0-9a-zA-Z-]+/[0-9-]+\\.prd$\", self.product_page_url)\r\n n = re.match(\"^http://www.tesco.com/.*$\", self.product_page_url)\r\n return (not not m) or (not not n)",
"def _validate_url(url):\n if not url or ur... | [
"0.70492357",
"0.70414305",
"0.68689746",
"0.68677413",
"0.68407744",
"0.6835004",
"0.6818683",
"0.6809452",
"0.6803073",
"0.67173827",
"0.6651397",
"0.66501904",
"0.66481525",
"0.6611492",
"0.6586792",
"0.65758324",
"0.655019",
"0.6545764",
"0.65304476",
"0.6527323",
"0.6524... | 0.61452323 | 64 |
True if the archive does not contain any snapshots yet. Returns bool | def is_empty(self) -> bool:
return self.snapshots.is_empty() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_snap(self, ignore_system_snap=False):\n snaps = filter(lambda s: s.state != SnapStateEnum.DESTROYING,\n self.snapshots)\n if ignore_system_snap:\n snaps = filter(lambda s: not s.is_system_snap, snaps)\n return len(list(snaps)) > 0",
"def validate_arch... | [
"0.67442197",
"0.65825623",
"0.6560397",
"0.6465076",
"0.63251346",
"0.6270676",
"0.62357104",
"0.6127455",
"0.6098874",
"0.6098874",
"0.60922045",
"0.6071595",
"0.6053992",
"0.6051384",
"0.6050659",
"0.60475665",
"0.6037429",
"0.602775",
"0.6006261",
"0.5993758",
"0.59807444... | 0.7827068 | 0 |
Get a single fact from this node. | def fact(self, name):
facts = self.facts(name=name)
return next(fact for fact in facts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fact(self, fact):\n for kbfact in self.facts:\n if fact == kbfact:\n return kbfact",
"def _get_fact(self, fact):\n for kbfact in self.facts:\n if fact == kbfact:\n return kbfact",
"def _get_fact(self, fact):\n for kbfact in self.... | [
"0.70351624",
"0.70351624",
"0.70351624",
"0.59265506",
"0.5738547",
"0.5694769",
"0.5545534",
"0.54983246",
"0.547722",
"0.54647297",
"0.5426895",
"0.53897",
"0.53519064",
"0.53446215",
"0.5332148",
"0.5316645",
"0.5309529",
"0.5301001",
"0.5299595",
"0.52242947",
"0.5221461... | 0.75231826 | 0 |
Join variables from source_df based on the largest intersection. In case of a tie it picks the first one. | def area_join(source_df, target_df, variables):
if not pd.api.types.is_list_like(variables):
variables = [variables]
for v in variables:
if v in target_df.columns:
raise ValueError(f"Column '{v}' already present in target_df.")
target_df = target_df.copy()
target_ix, source... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sjoin(left_df, right_df, how=..., op=..., lsuffix=..., rsuffix=...):\n ...",
"def _(x: DataFrame, y: DataFrame) -> DataFrame:\n _check_xy(x, y)\n from .distinct import distinct\n\n return distinct(\n pandas.merge(x, y, how=\"outer\"), __calling_env=CallingEnvs.REGULAR\n )",
"def _(x: ... | [
"0.5709279",
"0.5651439",
"0.55513024",
"0.53694797",
"0.53600264",
"0.53399664",
"0.5288595",
"0.5258657",
"0.5235305",
"0.52097523",
"0.51912016",
"0.51606303",
"0.511207",
"0.50648284",
"0.5021239",
"0.5013139",
"0.5013028",
"0.49965718",
"0.49946815",
"0.4988488",
"0.4987... | 0.6509416 | 0 |
Insert vocab to dict | def _insert_vocab(self, json_obj, mode=InsertVocabMode.ALL):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_vocab_dict(vocab):\n v_dict = {}\n for word in vocab:\n if len(word) in v_dict:\n v_dict[len(word)].append(word)\n else:\n v_dict[len(word)] = [word]\n return v_dict",
"def add_doc_to_vocab(filename, vocab):\n doc = load_doc(filename)\n tokens = cle... | [
"0.67291254",
"0.64789885",
"0.64789885",
"0.6311739",
"0.62610775",
"0.62112105",
"0.61968094",
"0.61667484",
"0.61313975",
"0.6084326",
"0.6077198",
"0.607301",
"0.59525466",
"0.5937014",
"0.5920589",
"0.59125036",
"0.5908248",
"0.58962715",
"0.58859",
"0.58821195",
"0.5870... | 0.7250865 | 0 |
r"""Get details of a single network. | def Get(self, request, global_params=None):
config = self.GetMethodConfig('Get')
return self._RunMethod(
config, request, global_params=global_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_network(self, network, **_params):\r\n return self.get(self.network_path % (network), params=_params)",
"def getNetworksDetails(network_id):\n logger.debug('Start.')\n code, res = rest_requests.get(networks_url + \"/\" + network_id)\n if code != requests.codes.ok:\n logger.error((... | [
"0.815506",
"0.7704009",
"0.7371045",
"0.7345053",
"0.7232661",
"0.7220386",
"0.69502354",
"0.6907718",
"0.6883879",
"0.67998445",
"0.67691416",
"0.67555165",
"0.6704264",
"0.6638899",
"0.6621451",
"0.6621451",
"0.6621451",
"0.65764344",
"0.6552145",
"0.65111405",
"0.64780307... | 0.0 | -1 |
r"""Get ProvisioningConfig by name. | def Get(self, request, global_params=None):
config = self.GetMethodConfig('Get')
return self._RunMethod(
config, request, global_params=global_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, name):\n return self.configs[name][0]",
"def lookup(self, name):\n for config in self._config:\n if name in config:\n return config[name]\n raise AttributeError(\"%s not found\" % name)",
"def get_app_cfg_by_name(self, name: str) -> Any:\n\n ... | [
"0.7345858",
"0.686669",
"0.67890775",
"0.648133",
"0.6444499",
"0.64383674",
"0.64087373",
"0.63643354",
"0.63213897",
"0.62877935",
"0.62379706",
"0.6136968",
"0.6134061",
"0.6123744",
"0.6072195",
"0.60451186",
"0.6015365",
"0.59920514",
"0.59862214",
"0.595897",
"0.592218... | 0.0 | -1 |
Finds materials that cooccur with specified entities. The returned materials can be screened by specifying elements that must be included/excluded from the stoichiometry. | def materials_search_ents(self, entities, elements, cutoff=None):
method = "POST"
sub_url = "/search/material_search"
payload = {
"entities": entities,
"elements": elements,
"cutoff": cutoff
}
return self._make_request(sub_url, payload=payload... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info_materials_polymer_get():\n materials = _material_by_group(974) # 974 == intermediate group\n return materials, 200",
"def SBO_isMaterialEntity(*args):\n return _libsbml.SBO_isMaterialEntity(*args)",
"def isMaterialEntity(*args):\n return _libsbml.SBO_isMaterialEntity(*args)",
"def info... | [
"0.573126",
"0.57132316",
"0.5693752",
"0.5596915",
"0.54570955",
"0.54510254",
"0.539075",
"0.5283809",
"0.52684116",
"0.52134013",
"0.51560014",
"0.51263773",
"0.51011544",
"0.5078595",
"0.50741714",
"0.5062508",
"0.500604",
"0.49858084",
"0.49765977",
"0.49579725",
"0.4949... | 0.7370446 | 0 |
Returns the embedding(s) for the supplied wordphrase. If the wordphrase is a string, returns a single embedding vector as a list. If the wordphrase is a list of string, returns a matrix with each row corresponding to a single (potentially cumulative) embedding. If the words (after preprocessing) do not have embeddings ... | def get_embedding(self, wordphrases, ignore_missing=True):
if isinstance(wordphrases, list):
method = "POST"
sub_url = '/embeddings'
payload = {
'wordphrases': wordphrases,
'ignore_missing': ignore_missing
}
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_phrase_embedding(phrase):\r\n \r\n vector = np.zeros([model.vector_size], dtype='float32')\r\n \r\n # 1. lowercase phrase\r\n phrase = phrase.lower()\r\n \r\n # 2. tokenize phrase\r\n phrase_tokens = tokenizer.tokenize(phrase)\r\n \r\n # 3. average word vectors for all words i... | [
"0.73960686",
"0.70414907",
"0.6483139",
"0.62810344",
"0.62624717",
"0.6149495",
"0.6084008",
"0.60005426",
"0.5944097",
"0.59321856",
"0.59114236",
"0.58615047",
"0.5838983",
"0.583431",
"0.5831618",
"0.5808516",
"0.58059406",
"0.5798245",
"0.5732393",
"0.5725381",
"0.57170... | 0.6797651 | 2 |
Returns either module config or file config. | def get_config():
config = tools.get_config_file()
session_config = session.get_session_config()
for config_key in config:
# checking for not false, but truthy value here is the desired behavior
session_value = session_config.get(config_key)
if session_value is False or session_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_module_config(name):\n return _CONFIGS[name]",
"def get_config():\n return CONFIG",
"def get_config():\n return _CONFIG",
"def get_config():\n #Read the config file and initialize the return code\n global CONF\n\n if CONF is None:\n CONF = ConfigParser.ConfigParser()\n ... | [
"0.77617985",
"0.76757246",
"0.7585763",
"0.7419122",
"0.7401795",
"0.72572345",
"0.71894085",
"0.70543003",
"0.69967026",
"0.6987272",
"0.6951504",
"0.691294",
"0.6885667",
"0.68699",
"0.6853856",
"0.6853856",
"0.6853856",
"0.6853856",
"0.6853856",
"0.6853856",
"0.6853856",
... | 0.0 | -1 |
Create an instance node from a raw data tree. | def from_raw(self, robj: RawObject) -> RootNode:
cooked = self.schema.from_raw(robj)
return RootNode(cooked, self.schema, cooked.timestamp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(self, hx, data):\n return Node(hx, data)",
"def _to_node(self, data):\n return Node(\n id = data['ps'],\n name = data['ps'],\n state = NodeState.UNKNOWN,\n public_ip = [data['ip']],\n private_ip = [],\n driver = self.... | [
"0.6649338",
"0.66471016",
"0.66142434",
"0.64108074",
"0.6342457",
"0.63026017",
"0.62881625",
"0.6281121",
"0.62695885",
"0.6254876",
"0.6219861",
"0.621602",
"0.6181345",
"0.61517584",
"0.61318654",
"0.611718",
"0.60613894",
"0.6024656",
"0.6015697",
"0.6010512",
"0.600753... | 0.6256618 | 9 |
determines the number of days in the month | def findingDaysInAMonth (month):
leapYear = findingLeapYear(year)
if month < 8 and month != 2 and month % 2 == 1:
return 31
elif month >= 8 and month % 2 == 0:
return 31
elif month == 2 and leapYear == True:
return 29
elif month == 2 and leapYear == False:
return 28
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days_in_month(self):\n return calendar.monthrange(self.year, self.month)[1]",
"def days_per_month(leap=False):\n\n ndays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n if leap:\n ndays[1]+= 1\n return ndays",
"def days_in_month(month):\r\n if month==\"February\":\r\n ... | [
"0.8117014",
"0.8059049",
"0.7982327",
"0.787143",
"0.77689046",
"0.7747756",
"0.7598317",
"0.757265",
"0.75391054",
"0.75314146",
"0.7527411",
"0.74603957",
"0.73927236",
"0.73768693",
"0.7330679",
"0.73134524",
"0.73096293",
"0.72906435",
"0.7279032",
"0.7232347",
"0.720305... | 0.6642775 | 42 |
same as os.path.split if full=True, returns list of strings | def splitpath(self, full=False):
path = _os.path.split(self.__str__())
if full == True:
return self.__str__().split(os.path.sep)
else:
return [getpath(path[0], custom=True), path[1]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fullsplit(path, result=None):\n if result is None:\n result = []\n head, tail = os.path.split(path)\n if head == '':\n return [tail] + result\n if head == path:\n return result\n return fullsplit(head, [tail] + result)",
"def fullsplit(path, result=None):\n if result is... | [
"0.7536966",
"0.7536966",
"0.75319433",
"0.75233877",
"0.7445839",
"0.7031331",
"0.7009655",
"0.70020056",
"0.69828326",
"0.6922166",
"0.6915515",
"0.6881448",
"0.6839428",
"0.68080384",
"0.6780427",
"0.6766675",
"0.66983646",
"0.66367644",
"0.66265345",
"0.6623053",
"0.65492... | 0.8281656 | 0 |
Optional. A humanreadable description of this TargetServer. | def description(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description(self):\n return \"%s/%s\" % (self['host_name'], self['service_description'])",
"def get_description(self):\n return self['host_name']",
"def shortDescription(self):\n return None",
"def description(self) -> str:\n pass",
"def description(self):\n pass"... | [
"0.69860595",
"0.6788127",
"0.66692686",
"0.6624607",
"0.64894116",
"0.64894116",
"0.646238",
"0.64381766",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.6414445",
"0.63857615",
"0.63829696",
"0.6381301",
"0... | 0.0 | -1 |
Get an existing TargetServer resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'TargetServer':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = TargetServerArgs.__new__(TargetServerArgs)
__props__.__dict__["descr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n arn: Optional[pulumi.Input[str]] = None,\n auth_mode: Optional[pulumi.Input[str]] = None,\n default_s3_location: Optional[pulumi.Input[str]] = None,\n ... | [
"0.56621665",
"0.5576519",
"0.5345026",
"0.5308341",
"0.5271964",
"0.52251685",
"0.5206424",
"0.5160413",
"0.5154615",
"0.51376736",
"0.5128834",
"0.5110236",
"0.51063865",
"0.51052237",
"0.50697595",
"0.505821",
"0.5034661",
"0.5021231",
"0.5018435",
"0.5003287",
"0.49566856... | 0.6828982 | 0 |
Optional. A humanreadable description of this TargetServer. | def description(self) -> pulumi.Output[str]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description(self):\n return \"%s/%s\" % (self['host_name'], self['service_description'])",
"def get_description(self):\n return self['host_name']",
"def shortDescription(self):\n return None",
"def description(self) -> str:\n pass",
"def description(self):\n pass"... | [
"0.69860595",
"0.6788127",
"0.66692686",
"0.6624607",
"0.64894116",
"0.64894116",
"0.646238",
"0.64381766",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.64371914",
"0.6414445",
"0.63857615",
"0.63829696",
"0.6381301",
"0... | 0.0 | -1 |
Removes samples from the scan whose angles are within the specified range | def remove_angular_window(scan, low, high):
# angle of samples is encoded in millidegrees
scan.samples[:] = [sample for sample in scan.samples if (
0.001 * sample.angle < low or 0.001 * sample.angle > high)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_distance_extremes(scan, low, high):\n scan.samples[:] = [sample for sample in scan.samples if (\n sample.distance >= low and sample.distance <= high)]",
"def filterNotInRange(frame, min, max, colorMode):\n\n tempFrame = cv2.cvtColor(frame, colorMode)\n\n mask = cv2.inRange(tempFrame, m... | [
"0.6928175",
"0.56809044",
"0.56583273",
"0.5586618",
"0.55851233",
"0.5578326",
"0.557583",
"0.5549034",
"0.5502325",
"0.5499968",
"0.5484574",
"0.5476749",
"0.54178315",
"0.5402092",
"0.53786355",
"0.536102",
"0.53586066",
"0.53470314",
"0.5308349",
"0.53003824",
"0.5295707... | 0.74890226 | 0 |
Parse various timestamp formats into SignalFx API epoch milliseconds | def parse_timestamp(input_time: str) -> int:
ts = int(float(input_time)) # either integer or real UNIX epoch time
# milliseconds
if 1e12 < ts < 1e13:
return round(ts / 1000) * 1000 # round to second
# seconds
if 1e9 < ts < 1e10:
return ts * 1000
print(f'ERROR: {input_time} is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_timestamp(input_time: str) -> int:\n parsers = (parse_sfx_now, parse_sfx_relative_time, parse_timestamp, parse_date)\n for parser in parsers:\n try:\n return parser(input_time)\n except ValueError:\n pass\n print(\n f'ERROR: unrecognized time format {... | [
"0.6815342",
"0.6712268",
"0.66906375",
"0.65800685",
"0.6573987",
"0.6542337",
"0.6531243",
"0.65027535",
"0.6498108",
"0.6445176",
"0.6416543",
"0.63951284",
"0.63584894",
"0.6357023",
"0.63367444",
"0.63324636",
"0.6324575",
"0.6316184",
"0.63154113",
"0.6309105",
"0.63080... | 0.69153917 | 0 |
Parse various timestamp formats into SignalFx API epoch milliseconds | def parse_date(input_time: str) -> int:
return int(dateutil.parser.parse(input_time).timestamp() * 1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_timestamp(input_time: str) -> int:\n ts = int(float(input_time)) # either integer or real UNIX epoch time\n # milliseconds\n if 1e12 < ts < 1e13:\n return round(ts / 1000) * 1000 # round to second\n # seconds\n if 1e9 < ts < 1e10:\n return ts * 1000\n print(f'ERROR: {inp... | [
"0.69153917",
"0.6815342",
"0.6712268",
"0.66906375",
"0.65800685",
"0.6573987",
"0.6542337",
"0.6531243",
"0.65027535",
"0.6498108",
"0.6445176",
"0.6416543",
"0.63951284",
"0.63584894",
"0.6357023",
"0.63367444",
"0.63324636",
"0.6324575",
"0.6316184",
"0.63154113",
"0.6309... | 0.0 | -1 |
Return timestamp in epoch milliseconds (but rounded to the closest second, as requested by SignalFx) from input time. | def extract_timestamp(input_time: str) -> int:
parsers = (parse_sfx_now, parse_sfx_relative_time, parse_timestamp, parse_date)
for parser in parsers:
try:
return parser(input_time)
except ValueError:
pass
print(
f'ERROR: unrecognized time format {input_time}. ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp():\n\n # Convert timestamp to int after multiply by 1000 to get millisecond timestamp in int.\n return int(time.time() * 1000)",
"def timestamp_normalized(self):\r\n if not self.timestamp:\r\n return None\r\n\r\n if isinstance(self.timestamp, (int, long)):... | [
"0.72728246",
"0.70581204",
"0.70415354",
"0.70404994",
"0.7000549",
"0.6878203",
"0.6852216",
"0.6837512",
"0.67750245",
"0.6771532",
"0.67688626",
"0.6673831",
"0.6653796",
"0.66079926",
"0.65607804",
"0.65493566",
"0.6544701",
"0.6537429",
"0.6487191",
"0.64799756",
"0.647... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(self,itr, meta_lr, lr_decay_itr):
if lr_decay_itr > 0:
if int(itr % lr_decay_itr) == 0 and itr > 0:
meta_lr = meta_lr / (10 ** int(itr / lr_decay_itr))
self.fast_net.step_size = self.fast_net.step_size / 10
for param_group in s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.7285849 | 99 |
Get train dataset reader. | def train(batch_size, num_sample=128):
return paddle.batch(_read_creater(num_sample=num_sample), batch_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_dataloader(self):\n if self.train_dataloader is not None:\n return self.train_dataloader\n\n assert self.schema is not None, \"schema is required to generate Train Dataloader\"\n return T4RecDataLoader.parse(self.args.data_loader_engine).from_schema(\n self.... | [
"0.77700317",
"0.774745",
"0.7302727",
"0.7240547",
"0.7170945",
"0.71632415",
"0.7056123",
"0.69895285",
"0.6856822",
"0.6791193",
"0.67125654",
"0.66330856",
"0.65704936",
"0.6558212",
"0.65283644",
"0.6512667",
"0.6505271",
"0.6468414",
"0.6456797",
"0.64534414",
"0.643268... | 0.0 | -1 |
Get test dataset reader. | def test(batch_size=1, num_sample=16):
return paddle.batch(_read_creater(num_sample=num_sample), batch_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataloader(self) -> data.DataLoader:\n return data.DataLoader(dataset=self.datasets['test'], batch_size=self.batch_size,\n num_workers=self.num_workers, shuffle=False, pin_memory=False)",
"def test_dataloader(self) -> DataLoader:\n return self._custom_data_loa... | [
"0.68845206",
"0.68450505",
"0.6735679",
"0.6711656",
"0.6699268",
"0.65802914",
"0.6448174",
"0.64179075",
"0.6417357",
"0.6312482",
"0.62544525",
"0.6237945",
"0.62045234",
"0.6201351",
"0.6177521",
"0.61449075",
"0.6138964",
"0.61154217",
"0.60540706",
"0.602839",
"0.60072... | 0.0 | -1 |
Concatenates zero or more iterables into a single iterable. | def concat(*seqs):
return itertools.chain.from_iterable(seqs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(iterables):\n return itertools.chain.from_iterable(iterables)",
"def union(iterable, *iterables):\n return iter(it.chain(iterable, *iterables))",
"def concat(seqs):\n return itertools.chain.from_iterable(seqs)",
"def gen_concatenate(iterators):\n for it in iterators:\n yield fro... | [
"0.8237647",
"0.7762626",
"0.7314292",
"0.7228797",
"0.68410534",
"0.6754106",
"0.661785",
"0.64577717",
"0.64477557",
"0.62693614",
"0.62614954",
"0.61770934",
"0.6173104",
"0.6151694",
"0.60528463",
"0.59739566",
"0.5946892",
"0.591301",
"0.58938015",
"0.5870306",
"0.585451... | 0.738074 | 2 |
Return the index of the element in `seq` that returns ``True`` for `iteratee`. If no match is found, ``1`` is returned. | def findindex(iteratee, seq):
iteratee = fnc.iteratee(iteratee)
return next((i for i, value in enumerate(seq) if iteratee(value)), -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indexMatching(seq, condition):\n for i,x in enumerate(seq):\n if condition(x):\n return i\n return -1",
"def find(f, seq):\n\tfor num,item in enumerate(seq):\n\t\tif f(item): return num\n\treturn -1",
"def findlastindex(iteratee, seq):\n iteratee = fnc.iteratee(iteratee)\n ret... | [
"0.6897988",
"0.68529224",
"0.64155096",
"0.62858737",
"0.62728447",
"0.59207135",
"0.5899974",
"0.5858445",
"0.5808833",
"0.57182574",
"0.5695591",
"0.5688631",
"0.56836134",
"0.56835765",
"0.5586463",
"0.5571871",
"0.5526262",
"0.54960287",
"0.54898024",
"0.54633707",
"0.54... | 0.8353897 | 0 |
Return the index of the element in `seq` that returns ``True`` for `iteratee`. If no match is found, ``1`` is returned. | def findlastindex(iteratee, seq):
iteratee = fnc.iteratee(iteratee)
return next((i for i, value in reversed(tuple(enumerate(seq))) if iteratee(value)), -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findindex(iteratee, seq):\n iteratee = fnc.iteratee(iteratee)\n return next((i for i, value in enumerate(seq) if iteratee(value)), -1)",
"def indexMatching(seq, condition):\n for i,x in enumerate(seq):\n if condition(x):\n return i\n return -1",
"def find(f, seq):\n\tfor num,i... | [
"0.8351631",
"0.6893782",
"0.68500185",
"0.62868077",
"0.6269523",
"0.5920056",
"0.5899648",
"0.5854641",
"0.5808691",
"0.57168275",
"0.5694773",
"0.5682713",
"0.5681728",
"0.56801414",
"0.5586588",
"0.55696803",
"0.5529989",
"0.54927",
"0.548727",
"0.5460768",
"0.5459611",
... | 0.6412658 | 3 |
Merge multiple iterables into a single iterable by inserting the next element from each iterable by sequential roundrobin. | def interleave(*seqs):
queue = deque(iter(seq) for seq in seqs)
while queue:
seq = queue.popleft()
try:
yield next(seq)
except StopIteration:
pass
else:
queue.append(seq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roundrobin(*iterables):\n # Recipe credited to George Sakkis\n pending = len(iterables)\n nexts = cycle(iter(it).next for it in iterables)\n while pending:\n try:\n for next in nexts:\n yield next()\n except StopIteration:\n pending -= 1\n ... | [
"0.807873",
"0.7960328",
"0.7131847",
"0.7107807",
"0.6972965",
"0.69667405",
"0.6695864",
"0.66517425",
"0.6648675",
"0.6536531",
"0.653047",
"0.64290506",
"0.6406485",
"0.6403531",
"0.64025295",
"0.6362741",
"0.6362741",
"0.6362741",
"0.6362741",
"0.63369346",
"0.63369346",... | 0.6969696 | 5 |
Map `iteratee` to each element of iterable and yield the results. If additional iterable arguments are passed, `iteratee` must take that many arguments and is applied to the items from all iterables in parallel. | def map(iteratee, *seqs):
return _map(fnc.iteratee(iteratee), *seqs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foreach(func, iterable):\n\n\tfor x in iterable:\n\t\tfunc(x)",
"def __call__(self, iterable):\n if self._ordered:\n imap = self._distrubtor.imap\n else:\n imap = self._distrubtor.imap_unordered\n\n for result in imap(iterable):\n yield result",
"def ma... | [
"0.6287315",
"0.61571527",
"0.6119844",
"0.5986487",
"0.579307",
"0.5779388",
"0.57537603",
"0.55571175",
"0.5495698",
"0.54143965",
"0.5413135",
"0.5391306",
"0.5364085",
"0.5347157",
"0.5329722",
"0.5319261",
"0.53168696",
"0.5298442",
"0.52736145",
"0.5271662",
"0.5267115"... | 0.6504665 | 0 |
Map an `iteratee` to each element of each iterable in `seqs` and concatenate the results into a single iterable. | def mapcat(iteratee, *seqs):
return concat(*map(iteratee, *seqs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(seqs):\n return itertools.chain.from_iterable(seqs)",
"def map(iteratee, *seqs):\n return _map(fnc.iteratee(iteratee), *seqs)",
"def mapflat(iteratee, *seqs):\n return flatten(map(iteratee, *seqs))",
"def concat(*seqs):\n return itertools.chain.from_iterable(seqs)",
"def flatten(*seq... | [
"0.7218634",
"0.7121129",
"0.7031422",
"0.6953051",
"0.65094924",
"0.6183503",
"0.6170696",
"0.61580867",
"0.606676",
"0.6064979",
"0.5951596",
"0.59219646",
"0.57494605",
"0.57471144",
"0.563964",
"0.55347234",
"0.54885954",
"0.54501843",
"0.54352033",
"0.54314435",
"0.54237... | 0.7142581 | 1 |
Map an `iteratee` to each element of each iterable in `seqs` and flatten the results. | def mapflat(iteratee, *seqs):
return flatten(map(iteratee, *seqs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(*seqs):\n for item in itertools.chain.from_iterable(seqs):\n if iscollection(item):\n yield from item\n else:\n yield item",
"def mapflatdeep(iteratee, *seqs):\n return flattendeep(map(iteratee, *seqs))",
"def map(iteratee, *seqs):\n return _map(fnc.iter... | [
"0.73454547",
"0.7130974",
"0.6868883",
"0.6416716",
"0.622025",
"0.59813577",
"0.59355426",
"0.5847847",
"0.5828699",
"0.5823845",
"0.56376565",
"0.56056476",
"0.5592745",
"0.55456495",
"0.5537511",
"0.5406828",
"0.5384987",
"0.53773874",
"0.53609574",
"0.53536326",
"0.53394... | 0.7819542 | 0 |
Map an `iteratee` to each element of each iterable in `seqs` and recurisvely flatten the results. | def mapflatdeep(iteratee, *seqs):
return flattendeep(map(iteratee, *seqs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapflat(iteratee, *seqs):\n return flatten(map(iteratee, *seqs))",
"def flatten(*seqs):\n for item in itertools.chain.from_iterable(seqs):\n if iscollection(item):\n yield from item\n else:\n yield item",
"def map(iteratee, *seqs):\n return _map(fnc.iteratee(ite... | [
"0.77104026",
"0.7165713",
"0.6836431",
"0.6366307",
"0.6279933",
"0.5781198",
"0.5738247",
"0.5704751",
"0.56244874",
"0.5578052",
"0.55542344",
"0.55492115",
"0.5507023",
"0.54375625",
"0.542309",
"0.5381507",
"0.5258559",
"0.5203589",
"0.51849985",
"0.51794124",
"0.5169449... | 0.7394263 | 1 |
Return a ``tuple`` of 2 lists containing elements from `seq` split into two groups where the first group contains all elements the `iteratee` returned truthy for and the second group containing the falsey elements. | def partition(iteratee, seq):
iteratee = fnc.iteratee(iteratee)
successes = []
failures = []
for item in seq:
if iteratee(item):
successes.append(item)
else:
failures.append(item)
return successes, failures | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_if(seq, pred):\n\n retval = []\n for key, group in itertools.groupby(\n sorted(seq, key=pred, reverse=True), key=pred):\n retval.append(list(group))\n return retval",
"def split(func, iterable):\n falsy, truthy = [], []\n for e in iterable:\n if func(e):\n ... | [
"0.68307215",
"0.6188622",
"0.5976946",
"0.5955248",
"0.57734525",
"0.5757055",
"0.5666889",
"0.56374425",
"0.5634822",
"0.559969",
"0.5577922",
"0.55418676",
"0.5532985",
"0.5527043",
"0.5519347",
"0.54946417",
"0.54889053",
"0.53819406",
"0.5369003",
"0.5369003",
"0.5369003... | 0.6613658 | 1 |
It will be called when you click on the file name or the catalog selection button. | def select_path(self, path):
self.exit_manager()
if path.endswith('.obj'):
EVENTS['IS_OBJ'] = True
EVENTS['EDITOR_SAVED'] = True
EVENTS['CAN_WRITE'] = True
EVENTS['FILE_PATH'] = path
EVENTS['LOADED_FILE'] = True
toast(f'{path} loaded successfully... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planet_clicked(self, filename):\n self.chosen_filename = filename\n self.accept()",
"def choose_file(self):\n pass",
"def on_coding_standard_file_browse(self, *args):\n file = GPS.MDI.file_selector()\n if file.path != \"\":\n self.fileEntry.set_text(file.path)"... | [
"0.7417943",
"0.7281278",
"0.71098447",
"0.71098447",
"0.70490915",
"0.69734997",
"0.68711185",
"0.68575567",
"0.682788",
"0.681039",
"0.67672783",
"0.6764563",
"0.6756567",
"0.6727736",
"0.6672591",
"0.66621506",
"0.663606",
"0.6628477",
"0.6625624",
"0.6599949",
"0.658399",... | 0.0 | -1 |
IndexView.get_queryset() should return question lists whose pub_date is smaller than now | def test_get_queryset(self):
app = IndexView()
question_list = app.get_queryset()
for question in question_list:
self.assertEqual(question.pub_date<=timezone.now(), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n\t\treturn Question.objects.filter(pub_date__lte=timezone.now())",
"def get_queryset(self):\n\t\treturn Question.objects.filter(pub_date__lte=timezone.now())",
"def get_queryset(self):\n return Question.objects.filter(pub_date__lte=timezone.now()).order_by('-pub_date')",
"def ... | [
"0.8360111",
"0.8360111",
"0.82696366",
"0.82691413",
"0.824242",
"0.8228787",
"0.8179848",
"0.8179825",
"0.8179825",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
"0.8178434",
... | 0.77091694 | 49 |
Creates a question with the given `question_text` and published the given number of `days` offset to now (negative for questions publisehd in the past, positive for qeustions that yet to be publisehd) =30 30days ago from now =True question with a choice =False question with no choices | def create_question(question_text, days, create_choice=True):
time = timezone.now() + datetime.timedelta(days=days)
question = Question.objects.create(question_text=question_text, pub_date=time)
if create_choice:
question.choice_set.create(choice_text="Choice 1", votes=0)
return question | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_question(question_text, days):\n\ttime = timezone.now()+dt.timedelta(days=days)\n\treturn Question.objects.create(question_text=question_text, pub_date=time)",
"def create_question(question_text, days):\n time = timezone.now() + timezone.timedelta(days=days)\n return Question.objects.create(ques... | [
"0.7715429",
"0.7607345",
"0.7586892",
"0.7586892",
"0.75394225",
"0.6945187",
"0.6920731",
"0.60915214",
"0.60882306",
"0.59568065",
"0.579994",
"0.57891566",
"0.57620883",
"0.5751672",
"0.57444733",
"0.5719077",
"0.57152987",
"0.570855",
"0.56953657",
"0.56895417",
"0.56895... | 0.71903 | 5 |
Questions with a pub_date in the past should be displayed on the index page | def test_index_view_with_a_past_question(self):
create_question(question_text="Past question", days=-30)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(response.context['latest_question_list'],
['<Question: Past question>']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_view_with_a_past_question(self):\n create_question(question_text=\"Past question.\", days=-30)\n response = self.client.get(reverse('polls:index'))\n self.assertQuerysetEqual(\n response.context['latest_question_list'],\n ['<Question: Past question.>']\n ... | [
"0.70348626",
"0.69843",
"0.696719",
"0.68652076",
"0.68496466",
"0.68274385",
"0.67930853",
"0.67864686",
"0.6784498",
"0.6783662",
"0.6766472",
"0.6748948",
"0.6739776",
"0.67051053",
"0.67034024",
"0.6677366",
"0.6676848",
"0.667426",
"0.66492295",
"0.6647384",
"0.66461027... | 0.7087898 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.