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 |
|---|---|---|---|---|---|---|
Test get inventory with invalid credentials. | def test_get_inventory_with_invalid_credentials(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=invalid-username&Password=invalid-password&Table=Inventory&Format=tab&Location=1"
file = open("./tests/fixtures/not_logged.html", "r")
m.register_uri("GET", url, status_code=200, text=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_cart_items_unauthorized(self):\n with self.assertRaises(ResourceAccessError):\n self.cart_item_manager.get_cart_items('123', '1')",
"def test_view_products_from_empty_inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['... | [
"0.72891784",
"0.7049541",
"0.70311075",
"0.6959351",
"0.6825989",
"0.6814998",
"0.68067497",
"0.670419",
"0.6692419",
"0.6646352",
"0.6573171",
"0.6533507",
"0.64439726",
"0.63825655",
"0.6371585",
"0.6353738",
"0.62687594",
"0.6267913",
"0.6264232",
"0.6224487",
"0.62170744... | 0.7145424 | 1 |
Test get purchase with invalid credentials. | def test_get_purchase_with_invalid_credentials(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=invalid-username&Password=invalid-password&Table=Purchase&Format=tab&Location=1"
file = open("./tests/fixtures/not_logged.html", "r")
m.register_uri("GET", url, status_code=200, text=fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_purchase_not_available(self):\n purchase_model = {\"id\": 2, \"amount\": 1}\n resp = self.app.post(\"/products/2/purchase\", json=purchase_model, content_type=\"application/json\")\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)\n resp = self.app.get(\"/products... | [
"0.71725756",
"0.70651263",
"0.66444236",
"0.6586424",
"0.64858687",
"0.63915944",
"0.63801366",
"0.63122135",
"0.629866",
"0.6251077",
"0.6238342",
"0.6225395",
"0.6222349",
"0.6202544",
"0.6166017",
"0.6156618",
"0.614757",
"0.6137711",
"0.6120282",
"0.6103197",
"0.60943735... | 0.7200314 | 0 |
Test get pending with error. | def test_get_pending_with_error(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=test-username&Password=test-password&Table=Pending&Format=tab&Location=1"
m.register_uri("GET", url, exc=requests.exceptions.ConnectTimeout)
cellartracker = CellarTracker(username="test-username", pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.get(-1)",
"def test_GET_fetcher_fail():\n bad_url = GET_ECHO_ENDPOINT.replace('.com', '.comx')\n\n with pytest.raises(Exception): #TODO: specific exception?\n resp = wf_utils.fetch_GET_request(bad_ur... | [
"0.6771275",
"0.6379431",
"0.63694656",
"0.6267654",
"0.6244516",
"0.6191648",
"0.6189287",
"0.6172019",
"0.6152225",
"0.6152225",
"0.611806",
"0.61145324",
"0.6055385",
"0.6052007",
"0.60438395",
"0.60400736",
"0.6031691",
"0.60305566",
"0.601856",
"0.59807783",
"0.59763587"... | 0.7029641 | 0 |
Test get consumed with invalid credentials. | def test_get_consumed_with_invalid_credentials(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=invalid-username&Password=invalid-password&Table=Consumed&Format=tab&Location=1"
file = open("./tests/fixtures/not_logged.html", "r")
m.register_uri("GET", url, status_code=200, text=fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_credentials(self):\n twine = Twine(source=self.VALID_CREDENTIALS_TWINE)\n with self.assertRaises(exceptions.CredentialNotFound):\n twine.validate_credentials()",
"def test_expired_credentials():\n pass",
"def test_credentialsInvalidResponse(self):\n cred = im... | [
"0.745211",
"0.733641",
"0.7150095",
"0.7079808",
"0.70068645",
"0.69933873",
"0.6989952",
"0.69570684",
"0.69124043",
"0.681617",
"0.68137914",
"0.680708",
"0.6801464",
"0.67813504",
"0.67420554",
"0.67373925",
"0.6727609",
"0.66905385",
"0.66900116",
"0.6667284",
"0.6667284... | 0.73038304 | 2 |
Test get bottles with invalid credentials. | def test_get_bottles_with_invalid_credentials(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=invalid-username&Password=invalid-password&Table=Bottles&Format=tab&Location=1"
file = open("./tests/fixtures/not_logged.html", "r")
m.register_uri("GET", url, status_code=200, text=file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_bottles_with_error(self, m):\n url = \"https://www.cellartracker.com/xlquery.asp?User=test-username&Password=test-password&Table=Bottles&Format=tab&Location=1\"\n m.register_uri(\"GET\", url, exc=requests.exceptions.ConnectTimeout)\n\n cellartracker = CellarTracker(username=\"test... | [
"0.70782477",
"0.679802",
"0.66639733",
"0.6604175",
"0.6595696",
"0.65823257",
"0.6545929",
"0.6544791",
"0.6538514",
"0.64535004",
"0.6452193",
"0.64453954",
"0.641575",
"0.6410027",
"0.63942605",
"0.63816494",
"0.6377596",
"0.63649637",
"0.6335554",
"0.6300085",
"0.6297576... | 0.7687243 | 0 |
Test get bottles with error. | def test_get_bottles_with_error(self, m):
url = "https://www.cellartracker.com/xlquery.asp?User=test-username&Password=test-password&Table=Bottles&Format=tab&Location=1"
m.register_uri("GET", url, exc=requests.exceptions.ConnectTimeout)
cellartracker = CellarTracker(username="test-username", pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trucks_api_error(self):\n resp = self.app.get('/asfdasdf')\n self.assertEqual(resp.status_code, 404)\n assert \"NOT FOUND\" in resp.status",
"def test_error404():\n response = echo_client(\"GET test/test HTTP/1.1\")\n assert '404' in response",
"def test_errors(self):\n ... | [
"0.68223417",
"0.66187614",
"0.65590686",
"0.65168506",
"0.6387264",
"0.6374729",
"0.6314384",
"0.63135433",
"0.6287473",
"0.61839414",
"0.6173578",
"0.6164031",
"0.61136866",
"0.6103255",
"0.60856366",
"0.6055569",
"0.6048167",
"0.6035857",
"0.5996943",
"0.59839314",
"0.5978... | 0.7469969 | 0 |
Returns the end of the current path. | def path_dest(life):
if not life['path']:
return None
_existing_chunk_map = brain.get_flag(life, 'chunk_path')
if _existing_chunk_map:
return _existing_chunk_map['end']
return tuple(life['path'][len(life['path'])-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_path(self) -> str:\n return self.get_from_redis(\"end_path\")",
"def getLastPath(self):\n return self.getSection(CFG_GENERAL, CFG_LASTPATH)",
"def endPath(self) -> None:\n pass",
"def dcurrent(self):\n return self.dirlist[-1]",
"def end(self):\n return self.__end_... | [
"0.80031127",
"0.7489223",
"0.7283913",
"0.6774825",
"0.675885",
"0.6705829",
"0.6618774",
"0.6613938",
"0.6603387",
"0.65991884",
"0.65908545",
"0.64441276",
"0.6419887",
"0.63677835",
"0.6353797",
"0.63062435",
"0.6295527",
"0.62901366",
"0.6277769",
"0.62616634",
"0.625965... | 0.5911073 | 78 |
Performs gravity. Returns True if falling. | def perform_collisions(life):
if not WORLD_INFO['map'][life['pos'][0]][life['pos'][1]][life['pos'][2]]:
if WORLD_INFO['map'][life['pos'][0]][life['pos'][1]][life['pos'][2]-1]:
life['pos'][2] -= 1
return True
if not life['gravity']:
life['falling_startzpos'] = life['pos'][2]
if life.has_key('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def falling(self):\r\n if self.y_vel < 10:\r\n self.y_vel += self.gravity",
"def compute_gravity(self):\r\n # compute the gravity from the Gauss form.\r\n # if it fails, marks divergence\r\n try:\r\n self.gravsolver.solve()\r\n except:\r\n print... | [
"0.6951226",
"0.68006706",
"0.67951584",
"0.66035753",
"0.6324846",
"0.60683084",
"0.5675074",
"0.56440794",
"0.5630943",
"0.56145",
"0.5606529",
"0.5567958",
"0.5545147",
"0.55408776",
"0.5515549",
"0.5514481",
"0.5514481",
"0.54694283",
"0.5436957",
"0.5433943",
"0.5419621"... | 0.5134025 | 44 |
Returns highest action in the queue. | def get_highest_action(life):
if life['actions'] and life['actions'][0]:
return life['actions'][0]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _best_action(self, state):\n actions_rewards = list(self.Q[state].items())\n return max(actions_rewards, key=lambda x: x[1])[0]",
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getBestAction(sel... | [
"0.76782316",
"0.73539627",
"0.7346948",
"0.73396516",
"0.71897584",
"0.695773",
"0.6945965",
"0.6945565",
"0.69393677",
"0.69388634",
"0.6898143",
"0.68882644",
"0.6875586",
"0.68577313",
"0.6849443",
"0.68479115",
"0.6796921",
"0.6795897",
"0.6736728",
"0.6712853",
"0.66806... | 0.7408795 | 1 |
Return the ONLINENIC_DOMAIN_TYPE for a domain. | def determine_domaintype(self, domain):
for ext, code in ONLINENIC_DOMAIN_TYPES.iteritems():
if domain.endswith(ext):
return code
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_domain(self, rel_name):\n return self._declaration[rel_name].domain_type",
"def domain(self, domain=None):\n\n return self.domain_class(apiobj=self, domainname=domain)",
"def _get_identity_type():\n try:\n if current_domain.config[\"IDENTITY_TYPE\"] == IdentityType.INTEGER.value:\n ... | [
"0.66455853",
"0.65767837",
"0.6000622",
"0.59564245",
"0.5825118",
"0.5825118",
"0.5778933",
"0.5778933",
"0.5778933",
"0.5778933",
"0.5777263",
"0.5777263",
"0.57748497",
"0.57748497",
"0.57748497",
"0.5747152",
"0.5733168",
"0.5690767",
"0.5643772",
"0.5640674",
"0.5588909... | 0.82058483 | 0 |
Assign a nucleotide to a site. | def _apply_action(self, action):
current_site = self.design.first_unassigned_site
paired_site = self.target.get_paired_site(current_site) # None for unpaired sites
self.design.assign_sites(action, current_site, paired_site) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_sites(self, action, site, paired_site=None):\n self._current_site += 1\n if paired_site:\n base_current, base_paired = self.action_to_pair[action]\n self._primary_list[site] = base_current\n self._primary_list[paired_site] = base_paired\n else:\n ... | [
"0.55735487",
"0.55066365",
"0.55066365",
"0.5447393",
"0.5373297",
"0.53454715",
"0.5323073",
"0.5302113",
"0.5262395",
"0.514211",
"0.5082815",
"0.5041682",
"0.5022051",
"0.5006563",
"0.49224195",
"0.4884981",
"0.486752",
"0.4839947",
"0.47571135",
"0.47380257",
"0.47158426... | 0.49331862 | 14 |
Compute the reward after assignment of all nucleotides. | def _get_reward(self, terminal):
if not terminal:
return 0
folded_design, _ = fold(self.design.primary)
hamming_distance = hamming(folded_design, self.target.dot_bracket)
if 0 < hamming_distance < self._env_config.mutation_threshold:
hamming_distance = self._loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_reward(self, observations, done):\n raise NotImplementedError()",
"def _compute_reward(self, observations, done):\n raise NotImplementedError()",
"def _compute_reward(self, observations, done):\n raise NotImplementedError()",
"def _compute_reward(self, observations, done):\n... | [
"0.67755234",
"0.67755234",
"0.67755234",
"0.67755234",
"0.67755234",
"0.67755234",
"0.6091281",
"0.60783124",
"0.6075239",
"0.60708886",
"0.60635626",
"0.604156",
"0.6002082",
"0.59508026",
"0.59274286",
"0.59274286",
"0.59274286",
"0.5926192",
"0.59241444",
"0.5885139",
"0.... | 0.0 | -1 |
Creates a new symmetric matrix. If `num_rows` is not ``None``, initializes the symmetric matrix to the specified size. Otherwise, initializes an empty symmetric matrix. | def __init__(self, num_rows = None,
resize_type=_matrix_common.MatrixResizeType.SET_ZERO):
super(SpMatrix, self).__init__()
if num_rows is not None:
if isinstance(num_rows, int) and num_rows >= 0:
self.resize_(num_rows, resize_type)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, num_rows = None,\n resize_type=_matrix_common.MatrixResizeType.SET_ZERO):\n super(DoubleSpMatrix, self).__init__()\n if num_rows is not None:\n if isinstance(num_rows, int) and num_rows >= 0:\n self.resize_(num_rows, resize_type)\n ... | [
"0.60046697",
"0.58309686",
"0.5685358",
"0.563368",
"0.55932754",
"0.5420318",
"0.541395",
"0.5300403",
"0.5254204",
"0.52449507",
"0.5156571",
"0.51535815",
"0.51515347",
"0.51515347",
"0.51515347",
"0.5140766",
"0.5128838",
"0.51173854",
"0.5096485",
"0.508117",
"0.5071065... | 0.581435 | 2 |
Creates a new symmetric matrix. If `num_rows` is not ``None``, initializes the symmetric matrix to the specified size. Otherwise, initializes an empty symmetric matrix. | def __init__(self, num_rows = None,
resize_type=_matrix_common.MatrixResizeType.SET_ZERO):
super(DoubleSpMatrix, self).__init__()
if num_rows is not None:
if isinstance(num_rows, int) and num_rows >= 0:
self.resize_(num_rows, resize_type)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, num_rows = None,\n resize_type=_matrix_common.MatrixResizeType.SET_ZERO):\n super(DoubleTpMatrix, self).__init__()\n if num_rows is not None:\n if isinstance(num_rows, int) and num_rows >= 0:\n self.resize_(num_rows, resize_type)\n ... | [
"0.5828498",
"0.58107424",
"0.5681936",
"0.5633288",
"0.5593159",
"0.54219234",
"0.54128",
"0.530031",
"0.52542025",
"0.52439934",
"0.5156517",
"0.5154767",
"0.51518154",
"0.51518154",
"0.51518154",
"0.5138122",
"0.512859",
"0.5116859",
"0.50965834",
"0.50810516",
"0.5071113"... | 0.6001942 | 0 |
Inverted Residual Block This function defines a sequence of 1 or more identical layers. Arguments | def _inverted_residual_block(inputs: "Layer",
filters: int,
kernel: int or Tuple[int, int],
t: int,
strides: int or Tuple[int, int],
n: int) -> "Layer":
layer = _bottlene... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_layer(self, out_channels, num_blocks):\n layers = []\n for i in range(num_blocks):\n stride = 2 if i == 0 else 1\n layers.append(InvertedResidual(in_channels=self.in_channels, out_channels=out_channels, stride=stride, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act... | [
"0.67172647",
"0.647474",
"0.6435105",
"0.61938757",
"0.6112829",
"0.60320497",
"0.59010494",
"0.58956856",
"0.58546406",
"0.58282983",
"0.5771489",
"0.5766134",
"0.57625544",
"0.57586265",
"0.5753303",
"0.5741169",
"0.5733296",
"0.5732418",
"0.56642705",
"0.5660712",
"0.5648... | 0.6359181 | 3 |
Restores configuration from previously saved model settings. | def restore_args(self, model_settings: Dict[str, Any]) -> None:
self.lrpatience = model_settings["config"]["lrpatience"]
self.lrdecay = model_settings["config"]["lrdecay"]
self.ntest = model_settings["config"]["ntest"]
self.ndiscard = model_settings["config"]["ndiscard"]
self.see... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_config(self):\n self._clear_previous_windows_assigment()\n self._restart_i3_config()",
"def restore(self):\n if os.path.isfile( \\\n os.path.join(self.network_path,'net_parameters.nnprm.index')):\n self.load_network_parameters(\n file_name='ne... | [
"0.71367735",
"0.6829217",
"0.6786415",
"0.645705",
"0.63774854",
"0.63543224",
"0.63483846",
"0.63415456",
"0.63402516",
"0.63259757",
"0.6301926",
"0.62882435",
"0.62661296",
"0.6262327",
"0.6245814",
"0.61846125",
"0.6169434",
"0.61381125",
"0.613011",
"0.6129817",
"0.6111... | 0.6513118 | 3 |
Convert a string (unicode or bytestring in `encoding`), to bytestring in utf8. | def to_utf8(text, errors='strict', encoding='utf8'):
if isinstance(text, unicode):
return text.encode('utf8')
# do bytestring -> unicode -> utf8 full circle, to ensure valid utf8
else:
return unicode(text, encoding, errors=errors).encode('utf8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utf8(self, _string):\n if isinstance(_string, unicode):\n _string = _string.encode(\"UTF-8\")\n return _string",
"def _encode_to_utf8(s):\n return s.encode('utf-8')",
"def str_to_bytes(s, encoding='ascii'):\n return s.encode(encoding)",
"def unicode2utf8(s):\n return ... | [
"0.8087589",
"0.80213624",
"0.7923646",
"0.79139525",
"0.7870919",
"0.75788885",
"0.7566202",
"0.7526143",
"0.7487947",
"0.7465527",
"0.7464595",
"0.7460673",
"0.7454483",
"0.74267066",
"0.73802096",
"0.7372138",
"0.73461235",
"0.7324182",
"0.7321296",
"0.7289867",
"0.7285413... | 0.7727883 | 5 |
Convert a string (bytestring in `encoding` or unicode), to unicode. | def to_unicode(text, encoding='utf8', errors='strict'):
if isinstance(text, unicode):
return text
else:
return unicode(text, encoding=encoding, errors=errors) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unicode(string):\n\n if isinstance(string, str):\n return string.decode('utf-8')\n else:\n return unicode(string)",
"def to_unicode(s, encoding=\"utf-8\"):\n if isinstance(s, six.text_type):\n return s\n elif isinstance(s, bytes):\n return s.decode(encoding)\n # ... | [
"0.85251766",
"0.8524837",
"0.83010745",
"0.81882405",
"0.81632316",
"0.8149855",
"0.8114386",
"0.8092626",
"0.8046262",
"0.7950895",
"0.7921842",
"0.7917224",
"0.78339505",
"0.78276324",
"0.7822083",
"0.780238",
"0.77633584",
"0.77592474",
"0.7722087",
"0.7688505",
"0.768850... | 0.73695195 | 34 |
Merge fields from new (dict) into d (dict). Toplevel list values will be concatenated, and toplevel dict values will be shallowmerged. All other cases of conflicting keys will result in values from ndict overwriting those in odict. | def merge_fields(d, new):
if not new:
return
for k, v in new.iteritems():
if k not in d:
d[k] = v
elif isinstance(v, list) and isinstance(d[k], list):
d[k].extend(v)
elif isinstance(v, dict) and isinstance(d[k], dict):
d[k].update(v)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge(old_dict, new_dict):\n dict3 = old_dict.copy()\n for k, v in new_dict.items():\n if k in dict3:\n dict3[k].append(v)\n else:\n dict3[k] = [v]\n return dict3",
"def merge_dict(base, new, extend=True):\n\n if isinstance(new, dict):\n for key, value ... | [
"0.69707173",
"0.6914549",
"0.66984814",
"0.66665274",
"0.66463983",
"0.6600201",
"0.6582735",
"0.65201235",
"0.6503241",
"0.64961135",
"0.6450896",
"0.6434673",
"0.64251935",
"0.64128983",
"0.6410486",
"0.64053714",
"0.63618094",
"0.63353914",
"0.633446",
"0.63224113",
"0.63... | 0.7964927 | 0 |
gets current time in specific format | def get_current_time():
return time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_current_time() -> str:\n return datetime.now().strftime(\"%FT%H:%M:%S\")",
"def current_time():\n now = datetime.datetime.now()\n time = now.strftime(\"%Y-%m-%d %H:%M:%S:%f\")\n return time",
"def get_now():\r\n now = dt.datetime.now()\r\n now_str = now.strftime(\"%d/%m %H:%M\")\r\n ... | [
"0.8058969",
"0.80171126",
"0.8012582",
"0.79531944",
"0.7940529",
"0.7906048",
"0.7894938",
"0.7846459",
"0.7831381",
"0.78209347",
"0.78016675",
"0.7799628",
"0.77691907",
"0.7738094",
"0.77266926",
"0.7721027",
"0.7716973",
"0.76995486",
"0.76486456",
"0.7617456",
"0.76089... | 0.78640044 | 7 |
wrapper to get users home directory | def get_user_homedir():
return os.path.expanduser("~") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def get_home_directory():\n \n try:\n directory=os.path.expanduser(\"~\")\n except EnvironmentError:\n directory=None\n \n return directory",
"def get_home_dir(self, username):\... | [
"0.8350158",
"0.8161493",
"0.8081569",
"0.80230796",
"0.79311764",
"0.782808",
"0.7784562",
"0.7773301",
"0.7712547",
"0.76299274",
"0.7615728",
"0.7609976",
"0.7609976",
"0.7602641",
"0.75275564",
"0.74710214",
"0.7370221",
"0.73030293",
"0.7245979",
"0.7207039",
"0.71563303... | 0.81629175 | 1 |
Return an iterator of unique applications of ``key`` to the decoded malware family of each engine in ``results``. ``top_k`` selects only the most common k applications of key. | def summarize(
self,
key: Callable[['Classification'], Union[Iterable[str], str]] = None,
top_k: int = None,
):
ctr = Counter(sorted(filter(None, flatmap(key, self.values()))))
return [elt for elt, _ in ctr.most_common(top_k)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_k_result(self, score, k=1):\n self.candidates = []\n self.candidate_sub = []\n self.top_k = heapq.nlargest(n=k, iterable=score)\n\n # Iterate the Top k scores, print each score and standard term\n for top_i in self.top_k:\n max_index = score.index(top_i)\n\n ... | [
"0.5283313",
"0.5253146",
"0.52267945",
"0.51010954",
"0.50638056",
"0.49978474",
"0.49916115",
"0.49638972",
"0.4940303",
"0.49292162",
"0.49151984",
"0.4902592",
"0.48761088",
"0.48753935",
"0.4856851",
"0.48377475",
"0.4830211",
"0.48111674",
"0.48101324",
"0.4772459",
"0.... | 0.6126833 | 0 |
Calculates the softmax function that outputs a vector of values that sum to one. We take max(softmax(v)) to be the predicted label. The output of the softmax function is also used to calculate the crossentropy loss | def softmax(self, v):
logC = -np.max(v)
return np.exp(v + logC)/np.sum(np.exp(v + logC), axis = 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _softmax(self, x):\n return np.exp(x - np.max(x)) / np.sum(np.exp(x - np.max(x)))",
"def _softmax(x):\n e = K.exp(x - K.max(x, axis=-1, keepdims=True))\n s = K.sum(e, axis=-1, keepdims=True)\n return e / s",
"def softmax(self, vector):\n e = np.exp(vector)\n return e / e.sum()... | [
"0.75548977",
"0.75018734",
"0.7492074",
"0.74466175",
"0.7435949",
"0.7408507",
"0.7405518",
"0.7396742",
"0.73894185",
"0.73631847",
"0.73469627",
"0.7342626",
"0.73348105",
"0.7334019",
"0.7334019",
"0.7331462",
"0.73302543",
"0.73147196",
"0.73056346",
"0.72963953",
"0.72... | 0.80864614 | 0 |
Sets half of the activations to zero | def compute_dropout(self, activations, dropout_prob = 0.5):
# handle error
if dropout_prob < 0 or dropout_prob > 1:
dropout_prob = 0.5
# scale the activations (see http://cs231n.github.io/neural-networks-2/)
activations/=dropout_prob
mult = np.random.binomial(1, d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAllZero(self):\n self.robot.set_joint([0,0,0,0,0])\n self.robot.save_config()",
"def reset(self):\n for i in range(0, len(self.current_state)):\n self.current_state[i] = 0\n\n for i in range(0, len(self.weights)):\n self.weights[i] = 0",
"def initializeW... | [
"0.66157115",
"0.6514132",
"0.63419855",
"0.631131",
"0.6229309",
"0.62005895",
"0.61363745",
"0.61305106",
"0.61293983",
"0.6113483",
"0.6072449",
"0.6062573",
"0.6033491",
"0.6021118",
"0.6012818",
"0.5972606",
"0.5969989",
"0.5959389",
"0.59466",
"0.5940646",
"0.5929724",
... | 0.0 | -1 |
Use Canny edge detction algorythm | def edge_detection(gray_image, sigma=0.6):
# compute the mean of image
y,x = gray_image.shape
win_frac = 3
l_image = gray_image[y/win_frac:y-(y/win_frac),(x/win_frac):x/(win_frac-1)-((x/win_frac))]
r_image = gray_image[y/win_frac:y-(y/win_frac),x/(win_frac-1)-(x/win_frac):x-(x/win_frac)]
v = (np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canny_edge(self):\n self.frame = cv.Canny(self.frame, 100, 200)",
"def canny(img, kernel_size=5, sigma=1.4, high=20, low=15):\n ### YOUR CODE HERE\n gaussiankernel = gaussian_kernel(kernel_size, sigma)\n smoothed_image = conv(img, kernel)\n G, theta = gradient(smoothed_image)\n nms = no... | [
"0.75788176",
"0.736098",
"0.7347227",
"0.7332677",
"0.7319752",
"0.72965264",
"0.7265759",
"0.7163671",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
"0.7153332",
... | 0.57515645 | 70 |
Get the user's home directory from the /etc/passwd. Used by $HOME initialization in osh/state.py. Tilde expansion and readline initialization use mem.GetVar('HOME'). | def GetMyHomeDir():
# type: () -> Optional[str]
uid = posix.getuid()
try:
e = pwd.getpwuid(uid)
except KeyError:
return None
else:
return e.pw_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_homedir():\n return os.path.expanduser(\"~\")",
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def get_home_directory():\n \n try:\n directory=os.path.expanduser(\"~\")\n except EnvironmentError:\n directory=None\n ... | [
"0.8165428",
"0.81105864",
"0.80209076",
"0.7983959",
"0.79142696",
"0.7753437",
"0.7688685",
"0.7625669",
"0.7625669",
"0.7582689",
"0.72642183",
"0.7154504",
"0.712184",
"0.7114156",
"0.7001951",
"0.69151855",
"0.6899522",
"0.68665785",
"0.6833929",
"0.66983867",
"0.6643939... | 0.7563891 | 10 |
Renormalize a wavefunction. Returns None if the wavefunction has norm 0. | def renormalize(wavefunc: dict, tol = 1e-7) -> dict:
summands = [abs(val) ** 2 for val in wavefunc.values()]
state_norm = np.sqrt(sum(summands))
# catch the case of a non renormalizeable (zero) wavefunction:
if state_norm < tol:
warnings.warn('Warning! Wavefunction norm smaller than tolerance. ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def renormalize(flux, ivar):\n\n # axis=1 corresponds to the rebinned spectral axis\n # Finding the weighted mean both for normalization and for the rms\n mean = np.average(flux, axis=1, weights=ivar)[:, None]\n rms = np.sqrt(np.average((flux - mean) ** 2, axis=1, weights=ivar))[:, None]\n\n # Norma... | [
"0.6292382",
"0.62034726",
"0.6043704",
"0.5997593",
"0.5809755",
"0.580518",
"0.57872105",
"0.5759789",
"0.5721429",
"0.57125306",
"0.5698163",
"0.5678056",
"0.56470406",
"0.56319",
"0.5589896",
"0.5561012",
"0.5521596",
"0.55139655",
"0.55109507",
"0.55092907",
"0.5488312",... | 0.72123045 | 0 |
This property is `True` if and only if the unit has a member function named `reverse`. By convention, this member function implements the inverse of `refinery.units.Unit.process`. | def is_reversible(cls) -> bool:
if cls.reverse is MissingFunction:
return False
try:
return not cls.reverse.__isabstractmethod__
except AttributeError:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_reverse(self):\n return not bool(self._reverse_callback())",
"def is_reverse(self):\n if self.strand == -1 or self.strand == '-':\n return True\n return False",
"def reverse(self):\n enabled = self.lib.iperf_get_test_reverse(self._test)\n\n if enabled:\n ... | [
"0.71909606",
"0.6725343",
"0.6721668",
"0.6340359",
"0.60837674",
"0.5904811",
"0.5897568",
"0.5893109",
"0.58756375",
"0.58317",
"0.5666225",
"0.56473535",
"0.5639712",
"0.55708873",
"0.5547994",
"0.548675",
"0.54254115",
"0.54251635",
"0.5383272",
"0.5331694",
"0.5311196",... | 0.7056145 | 1 |
Default (root) route shows the home page. | def index():
from managers import banks_manager, rates_manager
# acquiring number of all banks in DB
banks_count = banks_manager.get_banks_count()
# acquiring last update time
updated = rates_manager.get_last_update_time()
last_update = None if updated is None else updated.strftime('%Y %d %b, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n logging.info('Entering route: HOME')\n\n logging.info('Rendering template: main.html')\n return render_template('main.html')",
"def home_page():\n return redirect(url_for(_DEFAULT_ROUTE, _external=True))",
"def go_home(request):\n\n url = request.route_url('home', _app_url=get_app_... | [
"0.7712157",
"0.74631655",
"0.7349149",
"0.73479915",
"0.7181117",
"0.7174881",
"0.71263945",
"0.71263945",
"0.71263945",
"0.71263945",
"0.71263945",
"0.71263945",
"0.71184814",
"0.71184814",
"0.71184814",
"0.71184814",
"0.7100445",
"0.70463955",
"0.704518",
"0.70335233",
"0.... | 0.0 | -1 |
Set up the sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
try:
api = blueair.BlueAir(username=config["user"], password=config["password"])
except KeyError as e:
raise Unauthorized(f"BlueAir authorizarion failed")
ha_entities = []
devices = api.get_devices()
for dev in dev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')",
"def setup_platform(\n hass: HomeAssistant,\n config: ConfigType,\n add_entities: AddEntitiesCallback,\n discovery_info: DiscoveryInfoType | None = None,\n) -> None:\n name = config... | [
"0.7161053",
"0.7153387",
"0.7075047",
"0.7040154",
"0.6979527",
"0.6920127",
"0.6885005",
"0.6857596",
"0.68458396",
"0.6802712",
"0.680186",
"0.677836",
"0.67364186",
"0.67142266",
"0.67105585",
"0.6710512",
"0.6702681",
"0.6694298",
"0.6671031",
"0.6669839",
"0.6637563",
... | 0.0 | -1 |
Return the state attributes of the device. | def device_state_attributes(self):
return self._ba_attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_a... | [
"0.92738223",
"0.92053986",
"0.91516256",
"0.91516256",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148889",
"0.9148746",
"0.9148746",
"0.9137698",
"0.9110632",... | 0.8926821 | 26 |
Return the name of the sensor. | def name(self):
return f"BlueAir {self._ba_name}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Check if a ray (infinite line) intersects with a line segment. | def ray_segment_intersect(p_ray, d_ray, seg):
d_seg = seg[1] - seg[0]
t_max = np.linalg.norm(d_seg)
d_seg = d_seg / t_max
d_ray = d_ray / np.linalg.norm(d_ray)
D = np.stack([d_ray, -d_seg], axis=1)
b = seg[0] - p_ray
try:
T = np.linalg.solve(D, b)
except np.linalg.LinAlgError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects(self, line):\n\t\treturn self.intersection(lint) != None",
"def is_intersecting(self, ray):\n\n intersecting_point = self._sympy_plane.intersection(ray.sympy_line)[0]\n\n if 'x' in self._name:\n\n if self._within_y_bounds(intersecting_point.y) and self._within_z_bounds(int... | [
"0.73986447",
"0.717157",
"0.70875484",
"0.7030127",
"0.6964711",
"0.68454385",
"0.68243337",
"0.68099266",
"0.6752138",
"0.67489934",
"0.67352694",
"0.6705001",
"0.6686737",
"0.6679702",
"0.66361797",
"0.6577494",
"0.65583396",
"0.653545",
"0.64833945",
"0.64337516",
"0.6431... | 0.7030379 | 3 |
Sets the type of this RecurrenceWebinar. | def type(self, type):
if type is None:
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
self._type = type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recurrence_type(self, recurrence_type):\n allowed_values = [\"None\", \"Minute\", \"Hour\", \"Day\", \"Week\", \"Month\", \"Year\"] # noqa: E501\n if recurrence_type not in allowed_values:\n raise ValueError(\n \"Invalid value for `recurrence_type` ({0}), must be one of... | [
"0.70522773",
"0.68042535",
"0.68042535",
"0.6678514",
"0.6678514",
"0.662273",
"0.662273",
"0.65698576",
"0.6541763",
"0.650004",
"0.6264317",
"0.6264317",
"0.6264317",
"0.6264317",
"0.6233299",
"0.62064594",
"0.62064594",
"0.61924493",
"0.61924493",
"0.61924493",
"0.6192449... | 0.63432646 | 10 |
Sets the repeat_interval of this RecurrenceWebinar. | def repeat_interval(self, repeat_interval):
self._repeat_interval = repeat_interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_looping_interval(self, interval: float) -> None:\n \n self._looping_interval = interval",
"def set_repeat_mode(self, mode):\n params = [('repeatmode', mode)]\n\n self.get(COMMAND_UIC, 'SetRepeatMode', params)",
"def repeat(self, repeat):\n if repeat in RepeatTypes.val... | [
"0.55552894",
"0.5496152",
"0.5484667",
"0.5419772",
"0.5394802",
"0.53591055",
"0.5296349",
"0.52824026",
"0.52642095",
"0.51827794",
"0.5164376",
"0.5164376",
"0.5159871",
"0.5122879",
"0.5090412",
"0.5082951",
"0.5013749",
"0.49532303",
"0.49462688",
"0.4872365",
"0.486687... | 0.7524219 | 0 |
Sets the monthly_day of this RecurrenceWebinar. | def monthly_day(self, monthly_day):
self._monthly_day = monthly_day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthly_week_day(self, monthly_week_day):\n\n self._monthly_week_day = monthly_week_day",
"def day_of_month(self, day_of_month):\n\n self._day_of_month = day_of_month",
"def set_monthly(self, interval, *, day_of_month=None, days_of_week=None,\n index=None, **kwargs):\n ... | [
"0.7670384",
"0.70721793",
"0.6473545",
"0.6262128",
"0.6207521",
"0.6163003",
"0.5887884",
"0.5831907",
"0.58194804",
"0.5671228",
"0.5671228",
"0.5579083",
"0.5534142",
"0.5534142",
"0.54731494",
"0.54430324",
"0.5280507",
"0.5237128",
"0.5208169",
"0.5195557",
"0.51457924"... | 0.8477817 | 0 |
Sets the end_times of this RecurrenceWebinar. | def end_times(self, end_times):
self._end_times = end_times | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):... | [
"0.6822538",
"0.6822538",
"0.6822538",
"0.67487687",
"0.67487687",
"0.67251647",
"0.66125315",
"0.6555195",
"0.6545528",
"0.6354424",
"0.6289996",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5977812",
"0.5966365",
"0.59156615"... | 0.81673425 | 0 |
Sets the end_date_time of this RecurrenceWebinar. | def end_date_time(self, end_date_time):
self._end_date_time = end_date_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date... | [
"0.75676894",
"0.75676894",
"0.75676894",
"0.75676894",
"0.75676894",
"0.75676894",
"0.75676894",
"0.75676894",
"0.75225276",
"0.7319299",
"0.72738266",
"0.72738266",
"0.72738266",
"0.72546273",
"0.7211648",
"0.7205112",
"0.7179562",
"0.7179562",
"0.717188",
"0.71530116",
"0.... | 0.818622 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, RecurrenceWebinar):
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.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026"
] | 0.0 | -1 |
Generate the diagonal terms for the tensor product of Z_1 x Z_2 ... Z_n | def generate_diagonal_factors(n):
factors = np.array([1, -1]) # Initialize the diag terms with the diagonal of the Z Pauli matrix
for _ in range(n - 1): # Iterate n - 1 times
factors = np.hstack([factors, factors * -1]) # Append the same array multiplied by -1
return factors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal(d, axis=0):\n assert d.ndim == 1\n n = d.shape[0]\n times = lambda x: d * x\n trans = lambda x: _hermitian(d) * x\n times, trans = apply_along_axis(times, trans, axis)\n return Operator(times=times, trans=trans, shape=(n,n))",
"def diag(diag_elements):\n return tf.diag(tf.reshape(... | [
"0.6298258",
"0.62838084",
"0.610529",
"0.5909333",
"0.5826106",
"0.5793806",
"0.5792055",
"0.57580733",
"0.5755984",
"0.5713872",
"0.5686964",
"0.56842875",
"0.5651821",
"0.56460583",
"0.5639222",
"0.5605835",
"0.56007034",
"0.55977905",
"0.55949056",
"0.55926776",
"0.558882... | 0.5943337 | 3 |
A method which returns a reward metric based on information about the state of the system, sensors and possible actions they can take. This requires a mapping of sensors to action(s) to be evaluated by reward function, a set of tracks at given time and the time at which the actions would be carried out until. Returns | def __call__(self, config: Mapping[Sensor, Sequence[Action]], tracks: Set[Track],
metric_time: datetime.datetime, *args, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward_func(self, state, action, Time_matrix):\n curr_loc, curr_time, curr_day = state\n pickup_loc, drop_loc = action\n \n if action == (0,0):\n reward = -1 * C\n \n else:\n # time from curr_loc to reach pickup_loc\n t1 = int(Time_matr... | [
"0.65989274",
"0.64750695",
"0.6452138",
"0.63417464",
"0.63144916",
"0.629885",
"0.6277645",
"0.61293465",
"0.6127169",
"0.6119157",
"0.606574",
"0.60635054",
"0.6055147",
"0.60513437",
"0.6039913",
"0.59863836",
"0.59606814",
"0.5941401",
"0.59401643",
"0.5901283",
"0.58840... | 0.0 | -1 |
Returns string corresponding to current player's color. | def getCurrentString(self):
if self.getTurn() == RED:
return 'red'
return 'white' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player(self):\n return self._color",
"def get_color(self) -> str:\r\n return self.color",
"def get_color(self) -> str:\n return self.color",
"def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"",
"def get_col... | [
"0.79932624",
"0.79619354",
"0.7867891",
"0.78051555",
"0.74832904",
"0.7460913",
"0.73376524",
"0.73056597",
"0.7284531",
"0.7163658",
"0.71455365",
"0.7133136",
"0.70796925",
"0.70189434",
"0.7000213",
"0.6896414",
"0.68868756",
"0.688194",
"0.6869263",
"0.686863",
"0.68686... | 0.7615549 | 4 |
Returns True if the current player's checkers are all home by checking whether the current player has checkers in any pieces that are not in the home area.. | def isCurrentPlayerHome(self):
#creates corresponding starting and ending points for each player
if self.getTurn() == RED:
start = 0
end = 18
else:
start = 6
end = 24
#checks whether the current player has checke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_in_check(self, player):\n # List of coords in board\n col = ['a','b','c','d','e','f','g','h','i'] # the columns\n a = []\n for i in range(10):\n a.append([j + str(i+1) for j in col])\n \n # Flatten the list\n board_coords = []\n for subl... | [
"0.68318194",
"0.656037",
"0.65133274",
"0.64841634",
"0.63701266",
"0.636233",
"0.63060015",
"0.62938964",
"0.6292915",
"0.6255463",
"0.6240663",
"0.62359285",
"0.6140453",
"0.6130867",
"0.6124297",
"0.6101155",
"0.6088822",
"0.60821927",
"0.6071864",
"0.60630715",
"0.606205... | 0.767915 | 0 |
Returns the color corresponding to whos turn it is. | def getTurn(self):
return self.players[self.getCurrentPlayer()].getColor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"",
"def __get_whose_turn_in_history(self, time_index: int) -> chess.Color:\n\n # get player from history\n side = self.history[time_index].split(\" \")[1]\n\n if side ... | [
"0.7513672",
"0.72917706",
"0.72479516",
"0.71659607",
"0.7137658",
"0.71300066",
"0.711982",
"0.709366",
"0.7092548",
"0.7053248",
"0.7053248",
"0.7029754",
"0.7029628",
"0.70172626",
"0.70172626",
"0.70172626",
"0.70172626",
"0.7007881",
"0.69710314",
"0.69540024",
"0.69378... | 0.78129524 | 0 |
Returns the color corresponding to player. | def getColor(self):
return self.color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player(self):\n return self._color",
"def get_player_colors() -> List[Tuple[float, float, float]]:\n return PLAYER_COLORS",
"def getCurrentColor(self):\n if self.__currentnode__ is None:\n return None\n else:\n return self.__currentnode__.getPlayer().getColor()... | [
"0.8586081",
"0.7547753",
"0.74115014",
"0.7290328",
"0.7110825",
"0.7097036",
"0.70593846",
"0.70036995",
"0.6977603",
"0.6969286",
"0.6939346",
"0.69283205",
"0.69115895",
"0.68747056",
"0.6862336",
"0.68612957",
"0.68605983",
"0.68522686",
"0.68522686",
"0.68138325",
"0.68... | 0.6797491 | 21 |
Specifies the name which should be used for this Managed Private Endpoint. Changing this forces a new resource to be created. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name: str) -> None:\n self._name = na... | [
"0.63130194",
"0.63130194",
"0.63130194",
"0.63130194",
"0.63072026",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.6267607",
"0.6267607",
"0.6267607",
... | 0.0 | -1 |
Specifies the name which should be used for this Managed Private Endpoint. Changing this forces a new resource to be created. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name: str) -> None:\n self._name = na... | [
"0.63130194",
"0.63130194",
"0.63130194",
"0.63130194",
"0.63072026",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.6267607",
"0.6267607",
"0.6267607",
... | 0.0 | -1 |
Get an existing ManagedPrivateEndpoint 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,
data_factory_id: Optional[pulumi.Input[str]] = None,
fqdns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Endpoint':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = EndpointArgs.__new__(EndpointArgs)\n\n __props__.__dict__[\"crea... | [
"0.60675704",
"0.59782195",
"0.58830386",
"0.5770188",
"0.5662154",
"0.5613158",
"0.5432273",
"0.54302716",
"0.5276689",
"0.52562374",
"0.52047586",
"0.5062059",
"0.5058369",
"0.49977422",
"0.49856365",
"0.49726778",
"0.49272516",
"0.49223006",
"0.49080345",
"0.49068418",
"0.... | 0.72481805 | 0 |
Specifies the name which should be used for this Managed Private Endpoint. Changing this forces a new resource to be created. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n self._name = name",
"def name(self, name: str) -> None:\n self._name = na... | [
"0.63130194",
"0.63130194",
"0.63130194",
"0.63130194",
"0.63072026",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.62888455",
"0.6267607",
"0.6267607",
"0.6267607",
... | 0.0 | -1 |
Takes the pseudofasta and returns a list of SeqFeatures. | def parse_prodigal(prodigal_record):
for rec in prodigal_record:
# each one of these records is a feature
m = re.match(">?(\S+)_(\d+) # (\d+) # (\d+) # (-?\d+) # ID=([^;]+);", rec.description)
if m:
name, id_number, start, end, strand, prod_id = m.groups()
start = int(start)
end = int(end)
strand = i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_seqrecord_features(phage_genome):\n\n features = []\n for phage_cds in phage_genome.cds_features:\n features.append(phage_cds.seqfeature)\n\n return features",
"def construct_features(seq_df, paaclamb=6, paacw=0.5):\n seq_df = insert_aac(seq_df)\n seq_df = insert_ngrams(seq_df, n=2)... | [
"0.61208755",
"0.5914918",
"0.5903202",
"0.5869545",
"0.57834435",
"0.5748143",
"0.57089883",
"0.56855613",
"0.56256235",
"0.5611815",
"0.55566466",
"0.55493504",
"0.55436647",
"0.55371994",
"0.5525839",
"0.54867256",
"0.5473579",
"0.54365134",
"0.54323936",
"0.5427045",
"0.5... | 0.0 | -1 |
Set weight norm and equalized learning rate like demodulated convs in StyleGAN2 for module m. The weight matrix is initialized for a leaky relu nonlinearity of slope a. An extra gain can be specified, as well as a differential learning rate multiplier. See StyleGAN2 paper for more info. | def weight_norm_and_equal_lr(m: T_Module,
leak: float = 0.,
mode: str = 'fan_in',
init_gain: float = 1.,
lr_gain: float = 1.,
name: str = 'weight') -> T_Module:
kai_gain =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\n\n self.w += self.learn_rate * (self.X.T.dot(self.T - self.Y)\n - self.reg_L1 * np.sign(self.w)\n - self.reg_L2 * 2*self.w)",
"def __update(self, learning_rate):\n for layer in self.layers:\n ... | [
"0.68877965",
"0.66274416",
"0.65879446",
"0.65734744",
"0.654113",
"0.6500359",
"0.6478602",
"0.64614373",
"0.6459425",
"0.64389426",
"0.63849235",
"0.6380105",
"0.6356033",
"0.6353052",
"0.6322342",
"0.6313975",
"0.6312195",
"0.62999314",
"0.6294918",
"0.62566745",
"0.62552... | 0.6905776 | 0 |
Remove a weight_norm_and_equal_lr hook previously applied on | def remove_weight_norm_and_equal_lr(module: Module,
name: str = 'weight') -> Module:
return remove_weight_lambda(module, 'norm_equal_lr', name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_weight_norm(self):\n\n def _remove_weight_norm(m):\n try:\n logging.debug(f\"Weight norm is removed from {m}.\")\n torch.nn.utils.remove_weight_norm(m)\n except ValueError: # this module didn't have weight norm\n return\n\n ... | [
"0.7430771",
"0.7430771",
"0.73113716",
"0.6385965",
"0.6230463",
"0.6148673",
"0.61290026",
"0.6033146",
"0.5996444",
"0.59843165",
"0.59464246",
"0.59353507",
"0.5889315",
"0.5869284",
"0.5828503",
"0.581247",
"0.579487",
"0.5781963",
"0.57792133",
"0.5753717",
"0.5702136",... | 0.7224118 | 3 |
Get the start time of the first layout after a resource received. | def FirstLayoutTime(events):
has_received_response = False
for event in events:
if event.name == 'ResourceReceiveResponse':
has_received_response = True
elif has_received_response and event.name == 'Layout':
return event.start
assert False, 'There were no layout eve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_starting_time(self):\n return self.__starting_time",
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__rawInfo.startTime",
"def start_time(self):\n return self._get(\"start_time\")",
"def start_time(self):\n ... | [
"0.683066",
"0.6720937",
"0.661076",
"0.6603061",
"0.6505805",
"0.6491422",
"0.6478206",
"0.644336",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6364763",
"0.6331986",
"0.6292473",
"0.628365",
"0.6259188",
"0.625791",
"0.625... | 0.7099817 | 0 |
Gets topleft and bottomright coordinates from paint event. In the timeline data from devtools, paint rectangle dimensions are represented xy coordinates of four corners, clockwise from the topleft. | def GetBox(quad):
x0, y0, _, _, x1, y1, _, _ = quad
return (x0, y0, x1, y1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetRectangle(self, paint_event):\n def GetBox(quad):\n \"\"\"Gets top-left and bottom-right coordinates from paint event.\n\n In the timeline data from devtools, paint rectangle dimensions are\n represented x-y coordinates of four corners, clockwise from the top-left.\n See: function We... | [
"0.7452361",
"0.62214136",
"0.6126398",
"0.60872865",
"0.6036266",
"0.60307467",
"0.6017129",
"0.5997782",
"0.59919477",
"0.5973431",
"0.5956432",
"0.59314734",
"0.5919059",
"0.59070325",
"0.59069633",
"0.58780426",
"0.586322",
"0.58482915",
"0.5812974",
"0.58056384",
"0.5801... | 0.0 | -1 |
InlineResponse2018 a model defined in Swagger | def __init__(self, field=None, recommended_values=None, required=None, visible=None): # noqa: E501 # noqa: E501
self._field = None
self._recommended_values = None
self._required = None
self._visible = None
self.discriminator = None
if field is not None:
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_api_repr(self):\n raise NotImplementedError",
"def to_dict(self):\n result = {}\n\n for attr, _ in six.iteritems(self.swagger_types):\n value = getattr(self, attr)\n if isinstance(value, list):\n result[attr] = list(map(\n lambda... | [
"0.5706212",
"0.5652803",
"0.55990404",
"0.55960345",
"0.5561138",
"0.55305517",
"0.552081",
"0.5480535",
"0.5469129",
"0.5461303",
"0.5455373",
"0.5455373",
"0.5455373",
"0.5453811",
"0.542682",
"0.54252666",
"0.533678",
"0.5324745",
"0.52587974",
"0.5251553",
"0.52331567",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, InlineResponse2018):
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.8088463",
"0.8088463",
"0.80553037",
"0.7983272",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
... | 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 |
Add commandline flags for pytest. | def pytest_addoption(parser):
parser.addoption("--run-flaky", action="store_true",
help="runs flaky tests")
parser.addoption("--run-network-tests", action="store_true",
help="runs tests requiring a network connection") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_argv(self, verbose, extra_argv):\r\n #self.package_path = os.path.abspath(self.package_path)\r\n argv = [__file__, self.package_path]\r\n argv += ['--verbosity', str(verbose)]\r\n if extra_argv:\r\n argv += extra_argv\r\n return argv",
"def test_options_fla... | [
"0.6812163",
"0.6802424",
"0.67751586",
"0.6676299",
"0.662692",
"0.6577288",
"0.64935213",
"0.6471614",
"0.6435689",
"0.63643086",
"0.63515633",
"0.6346988",
"0.63400584",
"0.6339355",
"0.6318536",
"0.62863284",
"0.62459767",
"0.62310207",
"0.6219351",
"0.62022555",
"0.61905... | 0.6994068 | 0 |
Test that video uploads throws error message when file name contains special characters. | def test_upload_with_non_ascii_charaters(self, mock_conn):
file_name = 'test\u2019_file.mp4'
files = [{'file_name': file_name, 'content_type': 'video/mp4'}]
bucket = Mock()
mock_conn.return_value = Mock(get_bucket=Mock(return_value=bucket))
response = self.client.post(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_file_name(self):\n\n url = '/%s/jobs/%i/input_files/?file_name=%s' % (self.api, self.job.id, 'not_a.file')\n response = self.client.get(url)\n self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)\n\n results = json.loads(response.content)\n re... | [
"0.65014195",
"0.64077914",
"0.6348901",
"0.6323032",
"0.62804186",
"0.61693007",
"0.6168725",
"0.6156098",
"0.61090165",
"0.61028373",
"0.60547227",
"0.6040566",
"0.6023144",
"0.6018803",
"0.6013347",
"0.6002795",
"0.5984377",
"0.5978695",
"0.5961935",
"0.59532267",
"0.59524... | 0.753336 | 0 |
Test video upload token in s3 metadata. | def test_video_upload_token_in_meta(self, data, mock_conn, mock_key):
@contextmanager
def proxy_manager(manager, ignore_manager):
"""
This acts as proxy to the original manager in the arguments given
the original manager is not set to be ignored.
"""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_initiate_upload_token_user(self):\n video = factories.VideoFactory(\n id=\"27a23f52-3379-46a2-94fa-697b59cfe3c7\",\n upload_state=random.choice([\"ready\", \"error\"]),\n )\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(vi... | [
"0.7368541",
"0.6995017",
"0.6718038",
"0.64010864",
"0.63380766",
"0.6298333",
"0.6274303",
"0.6181222",
"0.61766404",
"0.6136056",
"0.60941523",
"0.6061968",
"0.597264",
"0.59438384",
"0.59107804",
"0.58267504",
"0.58176035",
"0.58051354",
"0.58034986",
"0.574365",
"0.57132... | 0.67830575 | 2 |
Verify that 405 is returned in case of notallowed request methods. Allowed request methods are POST and DELETE. | def test_405_with_not_allowed_request_method(self):
video_transcript_url = self.get_url_for_course_key(self.course.id)
response = self.client.get(
video_transcript_url,
content_type='application/json'
)
self.assertEqual(response.status_code, 405) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertHttpMethodNotAllowed(self, resp):\r\n return self.assertEqual(resp.status_code, 405)",
"def assertHttpMethodNotAllowed(self, response):\r\n self.assertEqual(response.status_code, 405)",
"def test_unsupported_request_methods(self):\n unsupported_methods = [\"POST\", \"PUT\", \"PAT... | [
"0.8357455",
"0.8211209",
"0.8046897",
"0.80000913",
"0.7773894",
"0.7766967",
"0.77525026",
"0.7738045",
"0.76858914",
"0.76725394",
"0.75897217",
"0.7580933",
"0.7569696",
"0.75621045",
"0.7558983",
"0.75564307",
"0.75035876",
"0.74502814",
"0.74450946",
"0.74406147",
"0.73... | 0.63679504 | 66 |
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) >>> e = OrderedDict(d) >>> c >> d >> d <= dict(c) | def __le__(self, other):
if not isinstance(other, OrderedDict):
raise TypeError('Can only compare with other OrderedDicts')
# FIXME: efficiency?
# Generate both item lists for each compare
return (self.items() <= other.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordered_dict_to_dict(d: OrderedDict) -> dict:\n return loads(dumps(d))",
"def test_dict_ancestor_and_reversed():\n from collections import OrderedDict\n\n class Child(dict):\n def __reversed__(self):\n return reversed(range(10))\n\n seq = reversed(OrderedDict())\n return reve... | [
"0.6843226",
"0.6692992",
"0.66495454",
"0.6529051",
"0.62890685",
"0.62730014",
"0.62454283",
"0.60648537",
"0.6052807",
"0.60262173",
"0.6024055",
"0.5927168",
"0.58370733",
"0.58279186",
"0.5819881",
"0.5750652",
"0.57445085",
"0.5738992",
"0.57109064",
"0.5699998",
"0.569... | 0.539246 | 40 |
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) >>> e = OrderedDict(d) >>> c >= d False >>> d >= c True >>> d >= dict(c) | def __ge__(self, other):
if not isinstance(other, OrderedDict):
raise TypeError('Can only compare with other OrderedDicts')
# FIXME: efficiency?
# Generate both item lists for each compare
return (self.items() >= other.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_match_ordered(self):\n first = dict(\n a=1,\n b=2,\n )\n\n second = OrderedDict(\n b=2,\n a=1,\n )\n\n check_keys_match_recursive(first, second, [])",
"def __le__(self, other):\n if not isinstance(other, OrderedDict):\... | [
"0.6889557",
"0.6537838",
"0.6489328",
"0.64315635",
"0.6317654",
"0.6257606",
"0.60580415",
"0.59793144",
"0.582819",
"0.5820886",
"0.58135664",
"0.5797685",
"0.57934564",
"0.57647294",
"0.575626",
"0.5682618",
"0.5670448",
"0.5668834",
"0.56667155",
"0.56289274",
"0.5580798... | 0.6802523 | 1 |
To allow deepcopy to work with OrderedDict. >>> from copy import deepcopy >>> a = OrderedDict([(1, 1), (2, 2), (3, 3)]) >>> a['test'] = {} >>> b = deepcopy(a) >>> b == a True >>> b is a False >>> a['test'] is b['test'] False | def __deepcopy__(self, memo):
from copy import deepcopy
return self.__class__(deepcopy(self.items(), memo), self.strict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_merge_immutable():\n x1 = {'one': 1, 'two': 2}\n x1_cop = x1.copy()\n ir.dict_merge(x1, {'three': 3, 'two': None})\n assert x1 == x1_cop\n ir.dict_merge({'ten': 10, 'one': '1'}, x1)\n assert x1 == x1_cop",
"def test_match_ordered(self):\n first = dict(\n a=1,\n ... | [
"0.6616694",
"0.651716",
"0.650658",
"0.6433758",
"0.63547564",
"0.6268876",
"0.6167069",
"0.61574876",
"0.60883147",
"0.6034296",
"0.59298754",
"0.5912151",
"0.5911761",
"0.58892554",
"0.5881475",
"0.58261335",
"0.58185995",
"0.57840717",
"0.5769797",
"0.5767842",
"0.5740850... | 0.0 | -1 |
Return a list of all the values in the OrderedDict. Optionally you can pass in a list of values, which will replace the current list. The value list must be the same len as the OrderedDict. >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> d.values() [3, 2, 1] | def values(self, values=None):
return [self[key] for key in self._sequence] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_values(d):\n return list(d.values())",
"def get_values(self) -> list:\r\n values = []\r\n for key, value in self._items:\r\n values.append(value)\r\n return values",
"def values(self):\n return [_ for _ in self._dict.values()]",
"def values(self):\n r... | [
"0.730715",
"0.72716796",
"0.7256918",
"0.7222337",
"0.7217952",
"0.71289635",
"0.71289635",
"0.71289635",
"0.7123241",
"0.69804955",
"0.6979699",
"0.6929698",
"0.6880294",
"0.6873703",
"0.6856028",
"0.67444545",
"0.67212576",
"0.67073",
"0.6702768",
"0.66397107",
"0.66226614... | 0.72916514 | 1 |
Delete and return an item specified by index, not a random one as in dict. The index is 1 by default (the last item). >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> d.popitem() (2, 1) >>> d OrderedDict([(1, 3), (3, 2)]) >>> d.popitem(0) (1, 3) >>> OrderedDict().popitem() | def popitem(self, i=-1):
if not self._sequence:
raise KeyError('popitem(): dictionary is empty')
try:
key = self._sequence[i]
except IndexError:
raise IndexError('popitem(): index %s not valid' % i)
return (key, self.pop(key)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, item_index: Index) -> Item:\n raise NotImplementedError(\"pop\")",
"def pop(self, idx=-1):\n to_ret =self. __getitem__(idx)\n self.__delitem__(idx)\n return to_ret",
"def popitem(self):\n with self.__plock:\n if len(self._keys) == 0:\n ... | [
"0.7199599",
"0.7189128",
"0.7087956",
"0.70186776",
"0.69510645",
"0.6915811",
"0.69067305",
"0.6887911",
"0.68701714",
"0.68093777",
"0.6802625",
"0.6796943",
"0.67953944",
"0.6725816",
"0.6684777",
"0.66766125",
"0.6663623",
"0.65798527",
"0.6542532",
"0.6537321",
"0.65338... | 0.7008463 | 4 |
Return the position of the specified key in the OrderedDict. >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> d.index(3) 1 >>> d.index(4) | def index(self, key):
return self._sequence.index(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_idx(self, key):\n found = [i for i, e in enumerate(self.list) if e.key == key]\n if found:\n return found[0]\n\n else:\n return -1",
"def get_index(self, key):\n return self.keys.index(key)",
"def _index(self,key):\n index=0\n for item in ... | [
"0.7372155",
"0.72729975",
"0.72009754",
"0.7028726",
"0.7022663",
"0.686849",
"0.6712287",
"0.66815394",
"0.6599689",
"0.6250449",
"0.61981755",
"0.6148143",
"0.6086364",
"0.6055276",
"0.6051836",
"0.59959704",
"0.597735",
"0.59474194",
"0.5917152",
"0.5879304",
"0.5877715",... | 0.66418 | 8 |
Sort the key order in the OrderedDict. This method takes the same arguments as the ``list.sort`` method on your version of Python. >>> d = OrderedDict(((4, 1), (2, 2), (3, 3), (1, 4))) >>> d.sort() >>> d OrderedDict([(1, 4), (2, 2), (3, 3), (4, 1)]) | def sort(self, *args, **kwargs):
self._sequence.sort(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ordered_dictionary_sort(d, key=None):\n\n items = [(k, d[k]) for k in sorted(d, key=key)]\n\n d.clear()\n\n d.update(items)",
"def dictorder():\n d = {1: 'a', 3: 'c', 2: 'b'}\n d.sort()\n print(d)",
"def sort_dict(unsorted: dict, key: typing.Callable, reverse: bool = False):\n if len(... | [
"0.7525017",
"0.68232757",
"0.6545513",
"0.65296596",
"0.6355049",
"0.6353015",
"0.63237214",
"0.63209325",
"0.62559307",
"0.61383796",
"0.60651803",
"0.60596883",
"0.6035827",
"0.60106295",
"0.6010007",
"0.60078585",
"0.5970376",
"0.5944",
"0.58513135",
"0.5848322",
"0.58204... | 0.58168525 | 21 |
Fetch the item at position i. | def __getitem__(self, index):
if isinstance(index, types.SliceType):
# fetching a slice returns an OrderedDict
return self._main[index].items()
key = self._main._sequence[index]
return (key, self._main[key]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self,i):\n return self._items[i]",
"def __getitem__(self, i):\n return self.get(i, i + 1)",
"def __getitem__(self, i):\n return self.data[i]",
"def __getitem__(self, i):\n self._load(False)\n\n if type(i) == slice:\n # Normalize the slice a bit su... | [
"0.7284395",
"0.7136758",
"0.6999644",
"0.6933897",
"0.6884076",
"0.6807567",
"0.67794466",
"0.6640364",
"0.6623135",
"0.65492845",
"0.6538738",
"0.65382785",
"0.650954",
"0.647378",
"0.6408744",
"0.63350844",
"0.6300505",
"0.6298018",
"0.6282538",
"0.6271112",
"0.622911",
... | 0.0 | -1 |
Fetch the value at position i. | def __getitem__(self, index):
if isinstance(index, types.SliceType):
return [self._main[key] for key in self._main._sequence[index]]
else:
return self._main[self._main._sequence[index]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, i):\n return self.get(i, i + 1)",
"def __getitem__(self, i):\n return self.data[i]",
"def get(self, i):\n\t\tif(i < 0 or i >= self.d):\n\t\t\traise ValueError(\"Illegal index\")\n\t\tif(self.st.contains(i)):\n\t\t\treturn self.st.get(i)\n\t\telse:\n\t\t\treturn 0.0",
"def ... | [
"0.7384709",
"0.726249",
"0.7255751",
"0.7151705",
"0.6965363",
"0.6955769",
"0.6845706",
"0.67990077",
"0.6791194",
"0.677847",
"0.6771419",
"0.6696457",
"0.662713",
"0.6574288",
"0.65724236",
"0.65354854",
"0.64672744",
"0.64509934",
"0.64006656",
"0.64006656",
"0.63724226"... | 0.0 | -1 |
Create from an mturk object. | def from_mturk(cls, assn):
assert "Output" in assn
ret = cls(
id=assn["AssignmentId"],
hit_id=assn["HITId"],
worker_id=assn["WorkerId"],
output_data=assn["Output"],
)
if assn["AssignmentStatus"] == "Accepted":
ret.update_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'RomaniaSettlement':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'AdvancePaymentRequest':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'Reviewer':\n return util.deserialize_model(dikt, cls)",
"def _fro... | [
"0.5509269",
"0.5472349",
"0.53903097",
"0.53798133",
"0.5308502",
"0.527019",
"0.52133715",
"0.52102536",
"0.5201566",
"0.5189333",
"0.51888394",
"0.51882577",
"0.51834285",
"0.513579",
"0.51299465",
"0.51127434",
"0.51066047",
"0.5066716",
"0.5066716",
"0.5048919",
"0.50394... | 0.6195365 | 0 |
Get the plugin settings from a config path. The keys follow the JupyterLab settings naming convention, of module and identifier e.g. | def get_lite_plugin_settings(
self, config_path: Path, plugin_id: str
) -> Dict[str, Any]:
if not config_path.exists():
return {}
config = json.loads(config_path.read_text(**UTF8))
# if a notebook, look in the top-level metadata (which must exist)
if config_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plugin_config():\n return json.loads(os.getenv(\"DKU_CUSTOM_RECIPE_PLUGIN_CONFIG\"))",
"def get_plugin_config():\n return json.loads(os.getenv(\"SKU_CUSTOM_RECIPE_PLUGIN_CONFIG\"))",
"def get_plugin_settings(plugin, directory=None):\n repo = require_repo(directory)\n plugins = get_value(rep... | [
"0.70205945",
"0.68047935",
"0.65930206",
"0.6457502",
"0.6382777",
"0.6142315",
"0.6100943",
"0.60296994",
"0.5991842",
"0.5986234",
"0.5963826",
"0.59546286",
"0.5936476",
"0.5932889",
"0.59237623",
"0.588939",
"0.5884509",
"0.5843358",
"0.58408326",
"0.5835414",
"0.5830358... | 0.77131206 | 0 |
Loads the data graph consisting of the encoder and decoder input placeholders, Label (Target tip summary) placeholders and the weights of the hidden layer of the Seq2Seq model. | def _load_data_graph(self):
# input
with tf.variable_scope("train_test", reuse=True):
# review input - Both original and reversed
self.enc_inp_fwd = [tf.placeholder(tf.int32, shape=(None,), name="input%i" % t)
for t in range(self.seq_length)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create_recurrent_layers()\n\t\tself._create_de_embedding()\n\t\tself._create_loss()\n\t\tself._create_optimizer()\n\t\tself._create_summaries()",
"def build_graph(self):\n self.__create_placeholders()\n ... | [
"0.64967436",
"0.64279914",
"0.62839854",
"0.6272801",
"0.6237684",
"0.6153953",
"0.61201334",
"0.60997933",
"0.6094104",
"0.60688454",
"0.603969",
"0.5908006",
"0.58944833",
"0.5890593",
"0.58564377",
"0.5846074",
"0.58221906",
"0.58042973",
"0.57966864",
"0.57845634",
"0.57... | 0.7857012 | 0 |
Get the sender's email | def get_sender_email(message):
message_headers = message['payload']['headers']
for header in message_headers:
if header['name'] == 'From':
return header['value'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_email(self):\n return self._email",
"def notification_sender_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"notification_sender_email\")",
"def get_email(self):\n return self.email",
"def get_email(self):\n return self.reference[REF_EMAIL_ADDRESS][REF_VALUE... | [
"0.78257656",
"0.7786797",
"0.77664906",
"0.7705415",
"0.7682987",
"0.7674341",
"0.7674341",
"0.75320226",
"0.75300425",
"0.75300425",
"0.75300425",
"0.75300425",
"0.75175834",
"0.7507526",
"0.7507526",
"0.7507526",
"0.74909765",
"0.7452558",
"0.74323577",
"0.73145396",
"0.72... | 0.7534542 | 7 |
Takes file path as string; returns text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text. | def open_and_read_file(file_path, file_path_2):
contents = open(file_path).read()
#file.close(file_path)
#print words
return contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text",
"def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string",
... | [
"0.8120648",
"0.8084976",
"0.80740315",
"0.8067914",
"0.7955153",
"0.7940907",
"0.78899425",
"0.7814253",
"0.7714841",
"0.76988804",
"0.76642245",
"0.76313204",
"0.76245683",
"0.76132447",
"0.7578637",
"0.7531003",
"0.75279164",
"0.74878705",
"0.7439701",
"0.74098176",
"0.737... | 0.64976066 | 87 |
Display the file explorer, and ask user to select a file | def ask_file(window_title):
root = tk.Tk()
root.withdraw()
media_info_path = os.path.join(os.path.realpath(__file__))
if ASK_DLL_LOCATION:
return filedialog.askopenfile(title=window_title).name
else:
return os.path.join(os.path.dirname(__file__), 'modules', 'pymediainfo', 'pymediainf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_file() -> True:\n current_directory = os.getcwd()\n selected_file = eg.fileopenbox(title=EG_TITLE+': Open a file',\n default=os.path.join(current_directory, \"..\"),\n filetypes=\"*.txt,*.py\")\n print(f\"Selected file: {os.pat... | [
"0.78546935",
"0.77978504",
"0.7627124",
"0.75477326",
"0.73248255",
"0.73088586",
"0.7308781",
"0.7301424",
"0.72777504",
"0.7231558",
"0.7163177",
"0.7101676",
"0.70955664",
"0.7094162",
"0.7071998",
"0.69481647",
"0.6931329",
"0.69309866",
"0.6919352",
"0.69015837",
"0.689... | 0.0 | -1 |
get the 4 bayes parameters for the normal distribution after updating for the data | def get_model_pars(self, data, weights=None):
ndata = data.shape
ws = np.full(ndata, self.lr)
if weights is not None: ws *= weights
weights[::-1] *= np.asarray([self.mem**i for i in range(ndata)])
wsum = np.sum(ws)
datasum = np.sum(ws*data)
datamean = datasum/wsum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInitParams(self):\n paramDict = BoostDistribution.getInitParams(self)\n paramDict['mean' ] = self.mean\n paramDict['sigma'] = self.sigma\n return paramDict",
"def getInitParams(self):\n paramDict = BoostDistribution.getInitParams(self)\n paramDict['mean' ] = self.mean\n paramDict['sig... | [
"0.61323804",
"0.6054306",
"0.6018378",
"0.5927716",
"0.5850915",
"0.58506656",
"0.5822253",
"0.580562",
"0.5803575",
"0.58012784",
"0.5782148",
"0.5766498",
"0.57433856",
"0.57433856",
"0.5741607",
"0.57377005",
"0.572918",
"0.572918",
"0.57188153",
"0.5714172",
"0.5714172",... | 0.0 | -1 |
Predict the action values from a single state | def predict_one(self, state):
# print("predict one state shape: ", state.shape)
s0 = np.expand_dims(state[0], axis = 0)
# s1 = np.expand_dims(state[1], axis = 0)
s2 = np.expand_dims(state[2], axis = 0)
return self._model.predict([s0,s2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, state):\n self.model.eval()\n if len(self.history_states) < self.history_states.maxlen:\n action = self.baseline_agent.predict(state)\n else:\n history_state = np.array(self.history_states)\n history_action = np.array(self.history_actions)\n ... | [
"0.78213114",
"0.7794668",
"0.7650977",
"0.7584253",
"0.75813156",
"0.7523047",
"0.7474721",
"0.7365014",
"0.7306148",
"0.7289428",
"0.7276042",
"0.7172682",
"0.71392137",
"0.7120325",
"0.70958847",
"0.70626825",
"0.70178133",
"0.7000655",
"0.6973197",
"0.6973047",
"0.6971317... | 0.6919491 | 22 |
Predict the action values from a single state | def predict_one(self, state):
# print("predict one state shape: ", state.shape)
s0 = np.expand_dims(state[0], axis = (0,1))
# s1 = np.expand_dims(state[1], axis = (0,1))
s2 = np.expand_dims((state[2], ), axis = (0,1))
return self._model.predict([s0,s2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, state):\n self.model.eval()\n if len(self.history_states) < self.history_states.maxlen:\n action = self.baseline_agent.predict(state)\n else:\n history_state = np.array(self.history_states)\n history_action = np.array(self.history_actions)\n ... | [
"0.78213114",
"0.7794668",
"0.7650977",
"0.7584253",
"0.75813156",
"0.7523047",
"0.7474721",
"0.7365014",
"0.7306148",
"0.7289428",
"0.7276042",
"0.7172682",
"0.71392137",
"0.7120325",
"0.70958847",
"0.70626825",
"0.70178133",
"0.7000655",
"0.6973197",
"0.6973047",
"0.6971317... | 0.67705554 | 37 |
Predict the action values from a single state | def predict_one(self, state):
#if it is a recurrent model:
if self._recurrent == True:
s0 = np.expand_dims(state[0], axis = (0,1))
s2 = np.expand_dims((state[2], ), axis = (0,1))
else:
s0 = np.expand_dims(state[0], axis = 0)
s2 = np.expand_dims(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, state):\n self.model.eval()\n if len(self.history_states) < self.history_states.maxlen:\n action = self.baseline_agent.predict(state)\n else:\n history_state = np.array(self.history_states)\n history_action = np.array(self.history_actions)\n ... | [
"0.7821018",
"0.7795372",
"0.7650384",
"0.7584177",
"0.7581264",
"0.75221133",
"0.7474681",
"0.73646206",
"0.7306502",
"0.7288949",
"0.7276128",
"0.71725845",
"0.71398133",
"0.7120894",
"0.7095977",
"0.70635974",
"0.70175916",
"0.7001309",
"0.6973668",
"0.6973543",
"0.6970834... | 0.6699567 | 44 |
Return the current recording status | def recording_status(self):
return self._get('recording/status') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self._camera_data[\"recording_mode\"]",
"def recording(self) -> bool:\n\t\treturn self._raw_result['data']['recording']",
"def is_recording(self):\n return self._recording_status in RECORDING_STATUS",
"def is_recording(self):\n return self._isrecording",
"def ... | [
"0.7430561",
"0.7307564",
"0.71591455",
"0.69374746",
"0.66680574",
"0.66595846",
"0.66542345",
"0.66120565",
"0.6596724",
"0.6590134",
"0.6581085",
"0.65721667",
"0.65721667",
"0.65721667",
"0.65710247",
"0.6548528",
"0.6536829",
"0.65368277",
"0.6521222",
"0.65156823",
"0.6... | 0.9055529 | 0 |
Computes the accuracy over the k top predictions for the specified values of k | def __accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8330555",
"0.8284951",
"0.8238012",
"0.8229784",
"0.82199013",
"0.8186353",
"0.8184883",
"0.8175146",
"0.81715065",
"0.8169989",
"0.81665415",
"0.81645787",
"0.8163826",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81... | 0.78499347 | 81 |
Get all of the local functions called in the given VBA object. item (VBA_Object item) The code chunk to check for function calls. context (Context object) The current program state. (list) List of the function definitions (VBA_Object) of all the functions called in the code chunk. | def _get_all_called_funcs(item, context):
# Get all the functions called in the VBA object.
call_visitor = function_call_visitor()
item.accept(call_visitor)
func_names = call_visitor.called_funcs
# Get all of the 0 argument functions called in the VBA object.
tmp_context = Context(context=cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls_in_function( ea ):\r\n\tcallist = []\r\n\tflowgraph = create_flowgraph_from( ea )\r\n\tfor x in flowgraph.nodes.items():\r\n\t\tname = x[0]\r\n\t\tblock = get_basic_block( string.atol( name, 16 ))\r\n\t\tfor instruction in block:\r\n\t\t\tif instruction[ 1 ] == \"call\":\r\n\t\t\t\tcallist.append( in... | [
"0.61334014",
"0.6015595",
"0.5961293",
"0.5925871",
"0.58588576",
"0.5841914",
"0.5669255",
"0.56626135",
"0.5653114",
"0.5648828",
"0.55623496",
"0.5476694",
"0.5437098",
"0.53984344",
"0.53814507",
"0.53734314",
"0.5343787",
"0.53431135",
"0.5195523",
"0.5157648",
"0.51384... | 0.8658288 | 0 |
return a json file | def json_status():
return jsonify({"status": "OK"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json(filename) :\n result = json.load(open(filename,'r'))\n return result",
"def get_file(file):\n with open(file) as data_file:\n return json.load(data_file)",
"def get_json_file(filename, lang='en'):\n\n filepath = os.path.join(current_app.config['APP_PATH'], 'data', filename)\n\... | [
"0.8026045",
"0.7407527",
"0.73929656",
"0.7388725",
"0.7349754",
"0.7074287",
"0.7074287",
"0.70704126",
"0.7033332",
"0.7025407",
"0.70242095",
"0.69774973",
"0.69706196",
"0.6898332",
"0.6847141",
"0.6845315",
"0.68355024",
"0.68355024",
"0.683302",
"0.683302",
"0.6792806"... | 0.0 | -1 |
Return a list of (row, col) tuples for all empty squares | def get_empty_squares(self):
empty = []
for row in range(self._dim):
for col in range(self._dim):
if self._board[row][col] == EMPTY:
empty.append((row, col))
return empty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_empty_square(self) -> list:\n empty_square = []\n for line_index in range(len(self.grid)):\n for col_index in range(len(self.grid[line_index])):\n if self.grid[line_index][col_index].color is None:\n empty_square.append((line_index, col_index))\n\n... | [
"0.8361795",
"0.7815093",
"0.77929056",
"0.7743958",
"0.76313215",
"0.7579525",
"0.7506691",
"0.7499226",
"0.7407885",
"0.7392123",
"0.7314479",
"0.72431177",
"0.72227556",
"0.71967113",
"0.7151703",
"0.7146917",
"0.7134806",
"0.7134608",
"0.7131203",
"0.71150994",
"0.7019608... | 0.8531321 | 0 |
remove duplicates value in array without change ordering. | def remove_duplicates_array(self, array: List) -> List:
seen = set()
seen_add = seen.add
return [x for x in array if not (x in seen or seen_add(x))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates(a):\n b = np.ascontiguousarray(a).view(np.dtype((np.void, a.dtype.itemsize * a.shape[1])))\n dedup = np.unique(b).view(a.dtype).reshape(-1, a.shape[1])\n return dedup",
"def remove_dups(nums):\r\n nums[:] = sorted(list(set(nums)))\r\n return nums",
"def removeDuplicates(arr... | [
"0.7426852",
"0.73934925",
"0.72941434",
"0.7105764",
"0.7085488",
"0.707724",
"0.7038563",
"0.69971734",
"0.69305474",
"0.69050586",
"0.68889517",
"0.685222",
"0.6829121",
"0.6800059",
"0.67379326",
"0.6663416",
"0.6659319",
"0.6638999",
"0.6617136",
"0.66085964",
"0.6599073... | 0.8351871 | 0 |
Returns indices of unique rows. It will return the | def unique_rows(data, digits=None):
hashes = hashable_rows(data, digits=digits)
garbage, unique, inverse = np.unique(hashes,
return_index=True,
return_inverse=True)
return unique, inverse | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_rows(data):\n udict = dict()\n for row in range(len(data)):\n row_data = tuple(data[row,:])\n if not row_data in udict:\n udict[row_data] =row\n uInd=udict.values()\n uRows=np.c_[udict.keys()]\n return uInd, uRows",
"def unique_rows(mat, return_inverse=False):\n... | [
"0.74752986",
"0.7377348",
"0.7186815",
"0.66557336",
"0.660684",
"0.66025394",
"0.65168226",
"0.6386453",
"0.6382838",
"0.63546836",
"0.635133",
"0.63070077",
"0.62817407",
"0.62611425",
"0.61399555",
"0.6130404",
"0.6117788",
"0.6091982",
"0.6075318",
"0.6066619",
"0.602919... | 0.6665538 | 3 |
Given a numpy array of float/bool/int, return as integers. | def float_to_int(data, digits=None, dtype=np.int32):
# convert to any numpy array
data = np.asanyarray(data)
# if data is already an integer or boolean we're done
# if the data is empty we are also done
if data.dtype.kind in 'ib' or data.size == 0:
return data.astype(dtype)
# populate ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertToIntArray(booleanArray: typing.List[bool]) -> typing.List[int]:\n ...",
"def get_integer_from(bool_array: List[bool]) -> int:\n return_value = 0\n for i in range(0, MAX_BIT_LENGTH - 1):\n return_value |= (1 << i) if bool_array[i] else 0\n return return_value",
"def _BoolsToIn... | [
"0.7508742",
"0.66353786",
"0.64538914",
"0.62721467",
"0.6242583",
"0.6212227",
"0.6174294",
"0.61720973",
"0.6169771",
"0.60958344",
"0.59704983",
"0.59086007",
"0.5849584",
"0.5835249",
"0.5813303",
"0.577827",
"0.5744131",
"0.5732795",
"0.5732577",
"0.5674554",
"0.5642336... | 0.55121005 | 25 |
Gets the volume_parameter_type of this VolumeParameterConfigJson. | def volume_parameter_type(self):
return self._volume_parameter_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"volume_type\")",
"def volume_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"volume_type\")",
"def volume_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"volume_type\")",
"def volume_type(se... | [
"0.70652926",
"0.70652926",
"0.70652926",
"0.7061523",
"0.68399704",
"0.675154",
"0.6748226",
"0.6746302",
"0.63791543",
"0.60950685",
"0.6079069",
"0.6010364",
"0.59719723",
"0.59433204",
"0.5869628",
"0.5869628",
"0.5866091",
"0.5810834",
"0.57976526",
"0.5793928",
"0.57821... | 0.82693887 | 0 |
Sets the volume_parameter_type of this VolumeParameterConfigJson. | def volume_parameter_type(self, volume_parameter_type):
self._volume_parameter_type = volume_parameter_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_parameter_type(self):\n return self._volume_parameter_type",
"def volume_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"volume_type\")",
"def volume_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"volume_type\")",
"def volume_type(self) -> pulumi.Inp... | [
"0.72152936",
"0.6003705",
"0.6003705",
"0.6003705",
"0.59166175",
"0.59071124",
"0.58656573",
"0.584993",
"0.58123356",
"0.56261647",
"0.5613104",
"0.5559818",
"0.55470544",
"0.5501279",
"0.5501279",
"0.5489209",
"0.54585415",
"0.539317",
"0.5365945",
"0.5365945",
"0.5357764... | 0.87820834 | 0 |
Gets the minimum_size of this VolumeParameterConfigJson. | def minimum_size(self):
return self._minimum_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_disk_size(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_disk_size\")",
"def min_disk_size(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"min_disk_size\")",
"def min_disk_size(self) -> int:\n return pulumi.get(self, \"min_disk_size\")",
"def GetMi... | [
"0.75240874",
"0.7201429",
"0.7195609",
"0.71837574",
"0.701028",
"0.69646543",
"0.68866587",
"0.68126845",
"0.6788793",
"0.6788793",
"0.6788793",
"0.6755158",
"0.67133516",
"0.6669962",
"0.6669962",
"0.66689074",
"0.6636167",
"0.6636167",
"0.6636167",
"0.6587228",
"0.6577175... | 0.75552446 | 0 |
Gets the maximum_size of this VolumeParameterConfigJson. | def maximum_size(self):
return self._maximum_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_volume_size(self) -> typing.Optional[str]:\n value = self._properties.get(\"maximumVolumeSize\")\n return f\"{value}\" if value is not None else None",
"def max_size_bytes(self) -> Optional[float]:\n return pulumi.get(self, \"max_size_bytes\")",
"def maxsize(self):\r\n r... | [
"0.78841496",
"0.75457275",
"0.73311037",
"0.72901136",
"0.72797656",
"0.71792495",
"0.71278065",
"0.7090006",
"0.70585084",
"0.7041302",
"0.69984853",
"0.69913036",
"0.69423544",
"0.69372",
"0.6867082",
"0.680238",
"0.67761666",
"0.6773955",
"0.6759096",
"0.67569816",
"0.675... | 0.7355193 | 2 |
Gets the minimum_number of this VolumeParameterConfigJson. | def minimum_number(self):
return self._minimum_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _minimum(self) -> float:\n return self._config[CONF_MIN]",
"def minimum(self):\n return self.properties.get('minimum')",
"def _minimum(self) -> float:\n if self._type == \"power\":\n return 1.0\n elif self._type == \"setpoint\":\n return self._product.get_d... | [
"0.7107358",
"0.70209235",
"0.6835927",
"0.673631",
"0.673631",
"0.6613049",
"0.6613049",
"0.6612601",
"0.6508327",
"0.643321",
"0.632031",
"0.6290966",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6280815",
"0.6... | 0.68665 | 2 |
Gets the maximum_number of this VolumeParameterConfigJson. | def maximum_number(self):
return self._maximum_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum(self):\n return self.properties.get('maximum')",
"def get_max_param(self):\r\n\r\n sql_str = \"SELECT jsonb_array_length(parameters) as length FROM alarm_condition\"\r\n\r\n param = self.postgres.query_fetch_all(sql_str)\r\n\r\n if param:\r\n\r\n max_param = max... | [
"0.7127248",
"0.69818145",
"0.6979241",
"0.69700575",
"0.69700575",
"0.6783774",
"0.6783774",
"0.662681",
"0.6587704",
"0.65630394",
"0.65490407",
"0.6535894",
"0.6522369",
"0.6493728",
"0.6486667",
"0.6469134",
"0.64543957",
"0.6414031",
"0.6402993",
"0.6399235",
"0.63951033... | 0.674023 | 7 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, VolumeParameterConfigJson):
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.80891633",
"0.80891633",
"0.8055254",
"0.7983334",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
... | 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 |
Return a timezone object representing the UTC offset found in the timestamp | def get_utc_offset(timestamp: str):
offset_direction = timestamp[-5] # A plus or minus sign
offset_hours = int(timestamp[-4:-2])
offset_minutes = int(timestamp[-2:])
offset_seconds = offset_hours * 3600 + offset_minutes * 60
return datetime.timezone(datetime.timedelta(seconds=in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_timezone_offset(self, timestamp):\n try:\n ts = int(timestamp)\n except ValueError:\n LOG.error(\"__get_timezone_offset() given non-numeric input {}\".format(timestamp))\n if self.__tzname is None:\n r = self.ctx.p4.run('counter', '-u', p4gf_const.P4G... | [
"0.72862536",
"0.72606134",
"0.7232389",
"0.7065637",
"0.6865707",
"0.6853038",
"0.6767184",
"0.67400986",
"0.6641264",
"0.6553563",
"0.65382755",
"0.65018976",
"0.649584",
"0.64774954",
"0.645704",
"0.6422225",
"0.6419141",
"0.6414567",
"0.6372871",
"0.6297294",
"0.629661",
... | 0.81272197 | 0 |
Test with this event equals another. | def __eq__(self, other):
if self is other:
return True
elif type(self) != type(other):
return False
else:
return self._start_time == other._start_time \
and self._end_time == other._end_time \
and self._events == other._events | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other: Event) -> bool:\n return self.timestamp == other.timestamp",
"def __eq__(self, other):\n if isinstance(other, OrderEvent):\n return self.order_id == other.order_id and self.event_id == other.event_id\n return False",
"def __eq__(self, other):\n if ... | [
"0.81692857",
"0.7777155",
"0.7573733",
"0.7561496",
"0.7517026",
"0.74785167",
"0.7472027",
"0.74436045",
"0.7436912",
"0.7426592",
"0.733518",
"0.73232013",
"0.7265174",
"0.7053242",
"0.7026145",
"0.7012799",
"0.7001662",
"0.6956984",
"0.69134295",
"0.68931925",
"0.6861212"... | 0.743286 | 9 |
Return the debugging representation of this event. | def __repr__(self):
return "{}(start_time={!r}, end_time={!r}, events={!r})" \
.format(self.__class__.__name__,
self._start_time, self._end_time, self._events) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self._event)",
"def debug_string(self):\n\n raise NotImplementedError",
"def dumps(self):\n evn_data = {\"id\": self.id,\n \"name\": self.name,\n \"code\": [line.strip() for line in self.source_code]}\n\n return {... | [
"0.7673768",
"0.7481672",
"0.7319104",
"0.7200058",
"0.71906203",
"0.71906203",
"0.714141",
"0.6938771",
"0.67682594",
"0.6754195",
"0.67536163",
"0.67536163",
"0.67536163",
"0.6735151",
"0.6711061",
"0.67068255",
"0.67068255",
"0.67068255",
"0.67068255",
"0.67068255",
"0.669... | 0.7263413 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.