query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Calculates full IPv6 Address from configured prefix part (assigned_ip_block) + unique session prefix part + interface identifier
def alloc_ip_address(self, sid: str, _) -> IPDesc: if not self._assigned_ip_block: raise NoAvailableIPError('No IP block assigned to the allocator') # Take available ipv6 host from network ipv6_addr_part = next(self._assigned_ip_block.hosts()) # Calculate session part from r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PrefixIpv6Address(self):\n if self.force_auto_sync:\n self.get('PrefixIpv6Address')\n return self._PrefixIpv6Address", "def _get_ipv6_addresses(self, host: str) -> Dict[str, List[IPv6Address]]:\n if host == \"self\":\n command = \"show ipv6 interface\"\n elif...
[ "0.6910526", "0.65779537", "0.6209948", "0.61726016", "0.6144157", "0.61233974", "0.60638624", "0.604678", "0.60410076", "0.6017673", "0.59840125", "0.59752476", "0.59653044", "0.5943439", "0.59116113", "0.5887834", "0.58841777", "0.5866893", "0.5860087", "0.584282", "0.58301...
0.58512235
19
Deallocates session prefix part from identifier and allocated IID
def release_ip(self, ip_desc: IPDesc): sid = ip_desc.sid ip_addr = ip_desc.ip if not self._assigned_ip_block or not ip_addr: return ipv6_addr_part = int(next(self._assigned_ip_block.hosts())) session_prefix = self._store.sid_session_prefix_allocated.get(sid) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, session: \"pwncat.manager.Session\"):", "def __del__(self):\n\t\tself._pc.gid_clear()", "def uninstall_mac_processor(interface, mac_profile):\n pass", "def __del__(self) -> None:\n self.map.ent_id.discard(self.id)", "def __del__(self) -> None:\n self.map.face_id.discard(se...
[ "0.54009336", "0.5383645", "0.528721", "0.5048347", "0.50450915", "0.50395787", "0.5034124", "0.50252444", "0.4981584", "0.49631837", "0.4954482", "0.48777702", "0.48424858", "0.4835618", "0.4832245", "0.4826465", "0.48210236", "0.47948185", "0.47716922", "0.47629887", "0.475...
0.0
-1
Calculates IPv6 Interface identifier using random calculation, if it exceeds MAX_RAND calculation tries, it returns None
def _get_ipv6_iid_part(self, sid: str, length: int = 64) -> Optional[int]: for _ in range(MAX_CALC_TRIES): rand_iid_bits = random.getrandbits(length) if rand_iid_bits not in self._store.allocated_iid.values(): self._store.allocated_iid[sid] = float(rand_iid_bits) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_global_ip_ipv6():\n network_info_providers = [\n 'http://v6.ipv6-test.com/api/myip.php',\n 'http://v6.ident.me/',\n ]\n random.shuffle(network_info_providers)\n for url in network_info_providers:\n try:\n return requests.get(url).text.lstrip().rstrip()\n e...
[ "0.68891776", "0.64426214", "0.620123", "0.6159654", "0.604859", "0.60376155", "0.5968478", "0.58275694", "0.58260953", "0.57802504", "0.5730758", "0.5716164", "0.5675554", "0.5665045", "0.56566995", "0.565064", "0.5581765", "0.5577801", "0.55600667", "0.54716736", "0.5455122...
0.7597928
0
Returns unique session prefix using configurable allocation mode, it return None if it exceeds MAX calculation tries
def _get_session_prefix(self, sid: str) -> Optional[int]: if not self._assigned_ip_block: return None session_prefix_len = IPV6_PREFIX_PART_LEN - self._assigned_ip_block.prefixlen session_prefix_allocated = self._store.sid_session_prefix_allocated.get( sid, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_key():\r\n\tresult = \"\"\r\n\tfor i in range(1, 11):\r\n\t\tresult += str(int(9 * random.random())+1)[0]\r\n\treturn result", "def session_scope_prefix():\n return ''.join(choice(ascii_uppercase) for _ in range(6)) + '-'", "def generate_session_id():\n return utils.get_32bit_random_n...
[ "0.6613998", "0.6112346", "0.594193", "0.58871245", "0.5856393", "0.5854491", "0.5833352", "0.58139443", "0.56881344", "0.56545293", "0.56332517", "0.5606701", "0.5599535", "0.5568258", "0.5566027", "0.5544654", "0.5539258", "0.5526119", "0.548038", "0.54656816", "0.54589933"...
0.77052504
0
returns a distribtution of users language
def get_language_distribution(username): users_repos, api_calls = get_repos(username) language_count = {} for repo in users_repos: language_count[repo.language] = language_count.get(repo.language, 0) + 1 return language_count, api_calls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_language() -> str:\n languages = {\n \"arabic\": \"arb\",\n \"chinese\": \"cmn-CN\",\n \"danish\": \"da-DK\",\n \"english\": \"en-GB\",\n \"french\": \"fr-FR\",\n \"german\": \"de-DE\",\n \"portuguese\": \"pl-PT\",\n \"spanish\": \"es-ES\"\n ...
[ "0.67478734", "0.6641548", "0.66355497", "0.6397517", "0.6390574", "0.634528", "0.62134975", "0.6182951", "0.6168857", "0.61553353", "0.61037403", "0.60909534", "0.60517937", "0.6047791", "0.6003909", "0.59509397", "0.5943521", "0.5928852", "0.5909752", "0.5901832", "0.588105...
0.59818065
15
returns repos sorted by a function specific to the user
def repo_reccommender_by_language(username): # get a BFS of 100 repos or all of their second-degree repos (rate-limiting ourselves along the way) # we have to get their language # ideally i would get all of their repos, then get the full byte distribution of all the repos, # but unfortunately that...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getuserrepos(gh, user):\n repos = list()\n pages = int(math.ceil(n_public_repos(gh, user) / float(R_PAGE)))\n for i in range(pages):\n # github index their pages from 1, hence the +1\n qs = user + \"/repos?page=\" + str(i + 1)\n repos.extend(gh.users(qs).get())\n return repos",...
[ "0.65797734", "0.6357986", "0.6169354", "0.61645705", "0.6126076", "0.59924364", "0.59314895", "0.59142524", "0.59004796", "0.5889744", "0.5883316", "0.583544", "0.58113974", "0.5799293", "0.57418406", "0.56899685", "0.5682869", "0.5678501", "0.56633633", "0.56563205", "0.560...
0.66649884
0
gets a user as input from the user gets the users top languages gets the reccomended repos by language outputs information to the user
def repo_reccommender(): username = raw_input('Enter a username > ') language_sorted_repos = repo_reccommender_by_language(username) print "getting language distribution..." language_distribution, api_calls = get_language_distribution(username) top_languages = sorted(language_distribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n for feature in [\"stars\", \"forks\"]:\n top_repos = get_top_repos(feature, 100)\n languages = dict()\n for repo in top_repos:\n repo_lang = get_languages_info(repo)\n languages = merge_dicts(repo_lang, languages)\n languages = sort_dict_by_values(...
[ "0.71570027", "0.613498", "0.5938341", "0.5896585", "0.554118", "0.54729676", "0.5383736", "0.5352208", "0.5300897", "0.5294068", "0.5266819", "0.5192093", "0.5187008", "0.51816845", "0.51671326", "0.51529074", "0.51410156", "0.5128342", "0.5122156", "0.5088876", "0.5053089",...
0.69052
1
Invoke kinit command with credential parameters.
def invoke_kinit(user, password): proc = subprocess.Popen(['kinit', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) output = " ".join(proc.communicate()) if "Heimdal" in output: # Heimdal Kerberos implementation. with tempfil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_cmd(ctx: click.Context, create_certs: str):\r\n from pathlib import Path\r\n from .init_funcs import init\r\n\r\n init(Path(create_certs) if create_certs is not None else None, ctx.obj[\"root_path\"])", "def provider_init(self) -> str:\n return self.context.get(\"/ckks/provider/init\", N...
[ "0.61337215", "0.59598976", "0.5945157", "0.58642584", "0.5745467", "0.570381", "0.5647389", "0.56395113", "0.56101763", "0.55136085", "0.5466123", "0.54543585", "0.5422648", "0.5399167", "0.5387691", "0.5384564", "0.5343504", "0.5337933", "0.53334135", "0.5316237", "0.528744...
0.750472
0
Set network delay and wait for a TimeoutError during search.
def receive_search_timeout(client, ipaddr, search_dn): conn = client.connect() proxy = rpc.ServerProxy("http://%s:%d/" % (ipaddr, 8000)) proxy.set_delay(6.1) time.sleep(3.0) return conn.search(search_dn, 1, timeout=3.2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(self, connect_timeout, read_timeout, search_timeout = None):\n self.timeout = urllib3.util.timeout.Timeout(connect = connect_timeout, read = read_timeout)\n if (search_timeout != None):\n self.search_timeout = urllib3.util.timeout.Timeout(connect = connect_timeout, read = s...
[ "0.6397809", "0.6393789", "0.63774186", "0.6359635", "0.6314871", "0.6286007", "0.625403", "0.6253369", "0.6244708", "0.6162222", "0.6126679", "0.6104902", "0.5908944", "0.5907687", "0.5897068", "0.5891048", "0.5871515", "0.5843934", "0.58401537", "0.58351934", "0.5822568", ...
0.5839808
19
Set network delay and wait for a TimeoutError during whoami.
def receive_whoami_timeout(client, ipaddr): conn = client.connect() proxy = rpc.ServerProxy("http://%s:%d/" % (ipaddr, 8000)) proxy.set_delay(6.1) time.sleep(3.0) return conn.whoami(timeout=3.2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout(self):\n self._status_update(\"Pyloton: Timeout\")\n time.sleep(3)", "def _timeout(delay):\n loop = asyncio.get_running_loop()\n return _Timeout(loop.time() + delay if delay is not None else None)", "def set_timeout(self, timeout):\n self.timeout = timeout", "def set_timeou...
[ "0.6217196", "0.6111047", "0.6017958", "0.5990512", "0.58705217", "0.5795436", "0.57816774", "0.57786757", "0.5769765", "0.5763559", "0.5720535", "0.5702743", "0.56964594", "0.56891686", "0.5687772", "0.5677685", "0.56613404", "0.5650001", "0.564143", "0.56334734", "0.5632506...
0.5314187
48
Set LDAP URL and open connection.
def setUp(self): curdir = os.path.abspath(os.path.dirname(__file__)) self.cfg = configparser.ConfigParser() self.cfg.read(os.path.join(curdir, 'test.ini')) self.ipaddr = self.cfg["SERVER"]["hostip"] self.url = "ldap://%s:%s/ou=nerdherd,%s?%s?%s" % \ (self.cfg["SERVER"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n conf = self.conf\n\n if not conf.uris or not conf.base:\n raise ConfigError('Base DN and LDAP URI(s) must be provided.', 1)\n\n if conf.tls_require_cert is not None:\n if conf.tls_require_cert not in [ldap.OPT_X_TLS_DEMAND, ldap.OPT_X_TLS_HARD]:\n ...
[ "0.72773224", "0.72446734", "0.68512195", "0.6373252", "0.631165", "0.6288941", "0.62554586", "0.6027716", "0.5974323", "0.58640504", "0.5747047", "0.5709453", "0.5663428", "0.5642652", "0.56288767", "0.55807847", "0.5500194", "0.5495493", "0.54281527", "0.5393592", "0.525447...
0.5556497
16
Test DIGESTMD5 connection with authorization ID.
def test_bind_digest_with_authzid(self): if self.cfg["DIGESTAUTH"]["authzid"] == "None": self.skipTest("Authorization ID is not set.") if sys.platform == "win32": self.skipTest("Authz is not set on AD.") authzid = self.cfg["DIGESTAUTH"]["authzid"] with self._bindi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_digest_auth_error(self):\n if \"DIGESTAUTH\" not in self.cfg:\n self.skipTest(\"No digest authentication is set.\")\n client = LDAPClient(self.url)\n if self.cfg[\"DIGESTAUTH\"][\"realm\"] == \"None\":\n realm = None\n else:\n realm = self.cfg[\...
[ "0.6327718", "0.60657185", "0.5936145", "0.57661295", "0.5729836", "0.568655", "0.56798357", "0.5622916", "0.5620633", "0.5610848", "0.558695", "0.54626304", "0.5433472", "0.54068273", "0.5376766", "0.5373301", "0.53653115", "0.536526", "0.53354263", "0.53354263", "0.53083426...
0.68475235
0
Test GSSAPI connection with authorization ID.
def test_bind_gssapi_with_authzid_kinit(self): if self.cfg["GSSAPIAUTH"]["authzid"] == "None": self.skipTest("Authorization ID is not set.") authzid = self.cfg["GSSAPIAUTH"]["authzid"] conn = self._bind_gssapi_kinit(authzid) self.assertEqual(self.cfg["GSSAPIAUTH"]["dn"], conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bind_gssapi(self):\n if (\"realm\" not in self.cfg[\"GSSAPIAUTH\"]\n or self.cfg[\"GSSAPIAUTH\"][\"realm\"] == \"None\"):\n self.skipTest(\"Realm is not set.\")\n if sys.platform == \"linux\":\n # Make sure keytab is empty.\n subprocess.check_c...
[ "0.6637385", "0.6162936", "0.5963409", "0.5909624", "0.56840336", "0.5674692", "0.5672899", "0.5652379", "0.56363773", "0.56293917", "0.56263334", "0.5601988", "0.5553723", "0.5549749", "0.5543101", "0.5525071", "0.55245596", "0.54843396", "0.54602516", "0.5450428", "0.544928...
0.72466063
0
Test GSSAPI connection with automatic TGT requesting.
def test_bind_gssapi(self): if ("realm" not in self.cfg["GSSAPIAUTH"] or self.cfg["GSSAPIAUTH"]["realm"] == "None"): self.skipTest("Realm is not set.") if sys.platform == "linux": # Make sure keytab is empty. subprocess.check_call("kdestroy") c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_gw(test_cli):\n conn = await gw_start(test_cli)\n\n hello = await _json(conn)\n assert hello['op'] == OP.HELLO\n\n assert isinstance(hello['d'], dict)\n assert isinstance(hello['d']['heartbeat_interval'], int)\n assert isinstance(hello['d']['_trace'], list)\n\n await conn.close(...
[ "0.57935935", "0.5780655", "0.5607268", "0.55693626", "0.5539238", "0.5500747", "0.54985845", "0.54976887", "0.54841346", "0.5475272", "0.5446739", "0.5421863", "0.5406196", "0.5399782", "0.5370997", "0.5365647", "0.5359539", "0.5353054", "0.5349188", "0.5335557", "0.5328453"...
0.5683782
2
Test automatic TGT requesting with wrong realm name.
def test_bind_gssapi_error(self): if "GSSAPIAUTH" not in self.cfg: self.skipTest("GSSAPI authentication is not set.") if not bonsai.has_krb5_support(): self.skipTest("Module doesn't have KRB5 support.") if sys.platform == "darwin": self.skipTest("Kerberos is n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_org_specific_allowance_trial(self):\n self.given({\n \"rules\": {\n \"12\": \"restrict\",\n },\n \"rules:trial\": {\n \"123\": \"restrict\",\n },\n \"rules:org\": {\n \"1234\": \"allow\"\n ...
[ "0.5641785", "0.54971045", "0.536007", "0.5274659", "0.52139777", "0.5198941", "0.519817", "0.511543", "0.50957334", "0.50944114", "0.5092667", "0.50914085", "0.50912154", "0.5087112", "0.50351", "0.50296783", "0.49982587", "0.4993607", "0.49838197", "0.49684337", "0.496144",...
0.0
-1
Test EXTERNAL connection with authorization ID.
def test_bind_external_with_authzid(self): if self.cfg["EXTERNALAUTH"]["authzid"] == "None": self.skipTest("Authorization ID is not set.") authzid = self.cfg["EXTERNALAUTH"]["authzid"] with self._bind_external(authzid) as conn: self.assertEqual(self.cfg["EXTERNALAUTH"]["d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_o_auth_client_authorization(self):\n pass", "def test_read_o_auth_client(self):\n pass", "def test_create_o_auth_client_authorization(self):\n pass", "def test_auth_public(self):\n self.do_visible(True, None, True, tenant='froggy')", "def test_verify_connection_to_...
[ "0.6595947", "0.6288124", "0.60532445", "0.5988806", "0.5940299", "0.5915462", "0.59024686", "0.588784", "0.5816472", "0.58081985", "0.5744265", "0.57390004", "0.57381225", "0.5705428", "0.56985146", "0.56872666", "0.5663291", "0.5663291", "0.56296337", "0.56017727", "0.55908...
0.6811685
0
Test searching with LDAPDN object.
def test_search_ldapdn(self): ldap_dn = LDAPDN(self.basedn) obj = self.conn.search(ldap_dn, 1) self.assertIsNotNone(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ldap(self):\n results = self.sync.ldap.conn.search_s('ou=example,o=test', ldap.SCOPE_ONELEVEL, '(cn=*)')\n self.assertEquals(self.ldapobj.methods_called(), ['initialize', 'simple_bind_s', 'search_s'])\n self.assertEquals(sorted(results), sorted([self.manager, self.alice]))", "def te...
[ "0.70454746", "0.6954678", "0.6645752", "0.6632754", "0.6471215", "0.6217639", "0.6171891", "0.6105286", "0.60873157", "0.6058489", "0.60166645", "0.6012985", "0.60115427", "0.59174424", "0.5915946", "0.5903678", "0.5895523", "0.5862923", "0.5836762", "0.57706964", "0.5753892...
0.882768
0
Test searching with given list of attributes.
def test_search_attr(self): obj = self.conn.search(self.basedn, 2, "(objectclass=person)", ['cn'])[0] self.assertIsNotNone(obj) if 'cn' not in obj.keys(): self.fail()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_attr_list(self, attrs):\n for other in attrs:\n if other.matches(self): return True\n return False", "def test_attributes(self):\n comp = str(self.test1)\n attr = ['BaseModel', 'id', 'created_at', 'updated_at']\n counter = 0\n for a in attr:\n if a in attr...
[ "0.66435045", "0.63999295", "0.6337153", "0.6267349", "0.6267349", "0.61889493", "0.6158053", "0.61370564", "0.6100694", "0.6098542", "0.60753375", "0.6055099", "0.6048664", "0.603057", "0.5954546", "0.5943922", "0.59394", "0.5937579", "0.59231544", "0.5869347", "0.5784163", ...
0.56246084
29
Test search receiving only attributes.
def test_search_attrsonly(self): obj = self.conn.search(self.basedn, 2, "(objectclass=person)", ['cn'], attrsonly=True)[0] self.assertIsNotNone(obj) self.assertListEqual(obj['cn'], [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_attributes(self):\n pass", "def test_search_attr(self):\n obj = self.conn.search(self.basedn, 2, \"(objectclass=person)\",\n ['cn'])[0]\n self.assertIsNotNone(obj)\n if 'cn' not in obj.keys():\n self.fail()", "def test_search_mis...
[ "0.6979749", "0.69117343", "0.689508", "0.67205864", "0.6559061", "0.6548601", "0.63411415", "0.63288885", "0.6302406", "0.6302406", "0.6302406", "0.62407386", "0.6193288", "0.6188873", "0.61561745", "0.61465657", "0.61031437", "0.6068137", "0.60603863", "0.60401607", "0.5984...
0.6743762
3
Test adding and removing an LDAP entry.
def test_add_and_delete(self): entry = bonsai.LDAPEntry("cn=example,%s" % self.basedn) entry.update({"objectclass" : ["top", "inetorgperson"], "cn" : "example", "sn" : "example"}) try: self.conn.add(entry) res = self.conn.search(entry.dn, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAsLDIF(self):\n sut = delta.AddOp(\n entry.BaseLDAPEntry(\n dn=\"dc=example,dc=com\",\n attributes={\n \"foo\": [\"bar\", \"baz\"],\n \"quux\": [\"thud\"],\n },\n )\n )\n\n result =...
[ "0.7018198", "0.67601484", "0.63521296", "0.6233793", "0.60527146", "0.5993023", "0.5943836", "0.5865035", "0.5850916", "0.5821462", "0.5703637", "0.5692997", "0.5683843", "0.5639278", "0.56210375", "0.5592167", "0.55881655", "0.55870444", "0.55792624", "0.5564181", "0.556384...
0.8286179
0
Test removing a subtree recursively.
def test_recursive_delete(self): org1 = bonsai.LDAPEntry("ou=testusers,%s" % self.basedn) org1.update({"objectclass" : ['organizationalUnit', 'top'], "ou" : "testusers"}) org2 = bonsai.LDAPEntry("ou=tops,ou=testusers,%s" % self.basedn) org2.update({"objectclass" : ['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_childless_on_delete_tree2(delete_tree):\n delete_tree.remove(\"teabaggers\")\n assert delete_tree.contains(\"teabaggers\") is False", "def test_remove_top_but_not_root2(delete_tree):\n delete_tree.remove(\"tea\")\n assert delete_tree.contains(\"teabag\") is True", "def test_remove_m...
[ "0.77839214", "0.74135566", "0.7287522", "0.71570563", "0.6911262", "0.6886111", "0.68713844", "0.68078643", "0.68013424", "0.6751551", "0.6650767", "0.6635288", "0.6632491", "0.6611354", "0.6564653", "0.6559428", "0.65034735", "0.6447768", "0.63806474", "0.6378148", "0.62895...
0.0
-1
Test simple authentication error.
def test_simple_auth_error(self): client = LDAPClient(self.url) client.set_credentials("SIMPLE", ("cn=wrong", "wronger")) self.assertRaises(bonsai.AuthenticationError, client.connect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_failure(self):\n \n result = self.authenticator.authenticate(\n username=u'thruflo', \n password=u'wrong'\n )\n self.assertTrue(result is None)", "def test_valid_login_form_but_failed_authentication(self):\n\n\n\t\tpass", "def test_auth_neg(self):\n ...
[ "0.8160639", "0.7902072", "0.78756416", "0.7854512", "0.7853043", "0.78114414", "0.7806747", "0.77066267", "0.77066267", "0.769299", "0.76880956", "0.7650529", "0.7629429", "0.76141727", "0.75927913", "0.7539589", "0.75344485", "0.75258625", "0.74972916", "0.7496218", "0.7488...
0.7740019
7
Test DIGESTMD5 authentication error.
def test_digest_auth_error(self): if "DIGESTAUTH" not in self.cfg: self.skipTest("No digest authentication is set.") client = LDAPClient(self.url) if self.cfg["DIGESTAUTH"]["realm"] == "None": realm = None else: realm = self.cfg["DIGESTAUTH"]["realm"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authenticationChallengeDecodingException(self):\n transport = StringTransportWithDisconnection()\n protocol = imap4.IMAP4Client()\n transport.protocol = protocol\n\n protocol.makeConnection(transport)\n protocol.lineReceived(\n b'* OK [CAPABILITY IMAP4rev1 IDL...
[ "0.6640376", "0.6612457", "0.6572347", "0.6549485", "0.6495003", "0.6441326", "0.636666", "0.63042474", "0.62318647", "0.61930764", "0.61313355", "0.61058384", "0.60507107", "0.59778947", "0.5900525", "0.5880734", "0.5875102", "0.5864537", "0.5811011", "0.57827723", "0.576572...
0.7635065
0
Test setting sort order.
def test_sort_order(self): obj = self.conn.search(self.basedn, 2, attrlist=['uidNumber'], sort_order=["-uidNumber"]) sort = [o['uidNumber'][0] for o in obj if 'uidNumber' in o] self.assertTrue((all(sort[i] >= sort[i+1] for i in range(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSorting(self):\n if self.sorting in tools.SORTINGS:\n self.assertEqual(\n self.sorting,\n self.config.sorting\n )\n else:\n self.assertNotEqual(\n self.sorting,\n self.config.sorting\n )\n ...
[ "0.8135057", "0.7092", "0.6721787", "0.6597684", "0.6479855", "0.64016086", "0.6378493", "0.6352672", "0.6286349", "0.62723154", "0.6233688", "0.61776847", "0.61464125", "0.61213744", "0.61046416", "0.6052762", "0.6042817", "0.6038616", "0.6021032", "0.59977347", "0.59925616"...
0.6106187
14
Test remove pending operations after close.
def test_async_close_remove_pendig_ops(self): msgid = self.async_conn.open() while self.async_conn.get_result(msgid) is None: pass self.async_conn.search(self.basedn, 2) self.async_conn.search(self.basedn, 0) self.async_conn.close() self.assertTrue(self.async_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _teardown(self, commit: bool = None):", "def test_terminate_run(self):\n pass", "def test_remove(self):\n pass", "def test_close(self):\n db = database.Database()\n db.close()\n self.assertTrue(self.mocked_connection.close.call_count is 1)", "def test_cleanup_as...
[ "0.64919806", "0.6325584", "0.6325501", "0.61880726", "0.617823", "0.6134211", "0.6123258", "0.6067313", "0.60664797", "0.60664797", "0.60664797", "0.60664797", "0.6056546", "0.5998878", "0.59824914", "0.59811395", "0.5954082", "0.59276146", "0.59248227", "0.59237075", "0.592...
0.6874929
0
Test VLV control with offset.
def test_vlv_offset(self): search_dn = "ou=nerdherd,%s" % self.basedn res, ctrl = self.conn.search(search_dn, 1, attrlist=['uidNumber'], offset=2, sort_order=["-uidNumber"], before_count=1, after_count=1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_SemiF47_level_0_5(self):\n self.assertEqual(viol_check(self.vol,5), [[131, 143]])", "def test_minv_keyword(self):\n # Set minv to 200\n byt = bytscl(self.array2, minv=200)\n control = numpy.sum(self.array2 <= 200)\n total = numpy.sum(byt == 0)\n self.assertEqual...
[ "0.54132396", "0.53664666", "0.5291695", "0.5147984", "0.51463264", "0.51174176", "0.510954", "0.50887066", "0.5086787", "0.5055929", "0.50394547", "0.4952077", "0.49265426", "0.4918608", "0.49168146", "0.4895624", "0.48828602", "0.4879761", "0.4838646", "0.483553", "0.483007...
0.6655514
0
Test VLV control with attribute value.
def test_vlv_attrvalue(self): search_dn = "ou=nerdherd,%s" % self.basedn res, ctrl = self.conn.search(search_dn, 1, attrlist=['uidNumber'], attrvalue=2, sort_order=["uidNumber"], before_count=1, after_count=2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testPsychControl(self):\n attr = self.session.create_visit_attr()\n\n self.util.intTypeTest(self, attr, \"control\")\n\n self.util.intPropertyTest(self, attr, \"control\")", "def test_attributeWithValue(self):\n xp = XPathQuery(\"/foo[@attrib1='value1']\")\n self.assertEqua...
[ "0.5968753", "0.5513699", "0.5358866", "0.5314102", "0.5314102", "0.5314102", "0.5314102", "0.5263289", "0.5260972", "0.5128111", "0.5100677", "0.5072715", "0.5041433", "0.5022484", "0.50177157", "0.5000374", "0.49968424", "0.4985033", "0.49849218", "0.4967097", "0.49632353",...
0.62106925
0
Test VLV control without sort control.
def test_vlv_without_sort_order(self): search_dn = "ou=nerdherd,%s" % self.basedn self.assertRaises(bonsai.UnwillingToPerform, lambda: self.conn.search(search_dn, 1, attrlist=['uidNumber'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lv_test(self):\n raise NotImplementedError('Levene Test is not implemented')", "def test_DisplayReturnsNone(self):\r\n self.assertEqual(self.lv._display([]), None)", "def test_call_suppress_sort(self):\r\n\r\n exp_otu_ids = range(3)\r\n exp_clusters = [['uclust_test_seqs_0'],\r...
[ "0.5744305", "0.5515212", "0.54154176", "0.5396088", "0.5275995", "0.52594316", "0.5172056", "0.5172056", "0.51444876", "0.5143461", "0.51239437", "0.5066076", "0.5050928", "0.5001201", "0.49996036", "0.4972062", "0.49702373", "0.49619678", "0.49604535", "0.495707", "0.494579...
0.62800914
0
Test VLV control with page size.
def test_vlv_with_page_size(self): search_dn = "ou=nerdherd,%s" % self.basedn self.assertRaises(bonsai.UnwillingToPerform, lambda: self.conn.search(search_dn, 1, page_size=3, sort_order=["-uidNumber"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_05_vmcp(self):\r\n url = '/api/vmcp'\r\n self.check_limit(url, 'get', 'app')", "def test_size_layout(testapp):\n response = testapp.get('/size', status=200)\n html = response.html\n assert 'Size' in html.find(\"h1\").text", "def test_svm_vs_vm_count():\n assert templates.svms...
[ "0.58396465", "0.5596314", "0.55891645", "0.55699897", "0.5551119", "0.5515642", "0.54765373", "0.5391576", "0.53537965", "0.5290339", "0.5280267", "0.52721274", "0.5219186", "0.52178174", "0.52002454", "0.51872075", "0.51788443", "0.5148499", "0.5134438", "0.5123979", "0.510...
0.67544186
0
Test paged results control.
def test_paged_search(self): search_dn = "ou=nerdherd,%s" % self.basedn res = self.conn.search(search_dn, 1, page_size=2) for ent in res: self.assertIsInstance(ent, bonsai.LDAPEntry) page = 1 # First page already is acquired. while True: if len(res) > 2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pagination(self):\n self.check_pagination()", "def test_pagination(self):\n for page in range(1, 5):\n self._test_one_page(page=page)", "def test_iter_paging(self):\n ref = mock.Mock()\n ref.side_effect = [\n {'rows': [x for x in range(100)]},\n ...
[ "0.73542345", "0.70421594", "0.6698459", "0.6664925", "0.66160214", "0.6580792", "0.6575952", "0.62992656", "0.6298293", "0.6291728", "0.6289881", "0.6248205", "0.62364775", "0.62084365", "0.6200387", "0.61718667", "0.6151887", "0.60827196", "0.60827196", "0.60296124", "0.601...
0.658415
5
Test paged results control with automatic page acquiring.
def test_paged_search_with_auto_acq(self): client = LDAPClient(self.url) conn = client.connect() search_dn = "ou=nerdherd,%s" % self.basedn res = conn.search(search_dn, 1, page_size=3) if len(res) != 3: self.fail("The size of the page is not what is expected.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pagination(self):\n self.check_pagination()", "def test_pagination(self):\n for page in range(1, 5):\n self._test_one_page(page=page)", "def test_search_paginate(page_size, page_num, expected_result):\n result = search_paginate(page_size, page_num)\n assert result == exp...
[ "0.7288579", "0.6902279", "0.6450426", "0.64395285", "0.6397602", "0.6360776", "0.62607944", "0.6246416", "0.6217707", "0.62045294", "0.61306936", "0.61147946", "0.61100405", "0.60696965", "0.6053422", "0.6053422", "0.60343534", "0.5994941", "0.5988161", "0.59819627", "0.5969...
0.6649057
2
Test passing wrong parameters for LDAPConnection.
def test_wrong_conn_param(self): self.assertRaises(TypeError, lambda: LDAPConnection("wrong")) self.assertRaises(TypeError, lambda: LDAPConnection(LDAPClient(), 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInvalidConnectionParameters(self):\r\n \r\n self._configuration.serverUri = _SERVER_DOWN_URI\r\n self.assertRaises(PersistenceError, self._ldapPrincipalSearcher.searchPrincipal,\r\n _VALID_USER_GROUP_QUERY, constants.SEARCH_MODE_GROUP_ONLY)", "def test_wrong_...
[ "0.7524373", "0.70150065", "0.6916773", "0.68465286", "0.66269404", "0.6596362", "0.6466661", "0.6193457", "0.61694545", "0.59333795", "0.5901588", "0.58959955", "0.58886415", "0.58343107", "0.5831784", "0.57771206", "0.57743895", "0.5743263", "0.57277405", "0.57073027", "0.5...
0.75680727
0
Test passing wrong parameters for search method.
def test_wrong_search_param(self): def close_conn(): cli = LDAPClient("ldap://%s" % self.ipaddr) LDAPConnection(cli).search() def missing_scope(): cli = LDAPClient("ldap://%s" % self.ipaddr) LDAPConnection(cli).open().search() def wrong(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_no_params_error(self):\n self.assertRaises(\n TypeError,\n lambda: self.t['Scrubs'].search()\n )", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search_query_wrongtype(obj...
[ "0.7945164", "0.77503645", "0.77503645", "0.77503645", "0.7738949", "0.7389785", "0.73361635", "0.72530264", "0.72413445", "0.71735513", "0.71677125", "0.7097528", "0.70773447", "0.7055344", "0.69934136", "0.69510794", "0.69244516", "0.68074024", "0.67974705", "0.6763249", "0...
0.6752381
20
Test passing wrong parameter for add method.
def test_wrong_add_param(self): def close_conn(): cli = LDAPClient("ldap://%s" % self.ipaddr) LDAPConnection(cli).add(bonsai.LDAPEntry("cn=dummy")) self.assertRaises(ClosedConnection, close_conn) self.assertRaises(TypeError, lambda: self.conn.add("wrong"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add(self):\n self.assertEqual(3, foo.add(1, 2))\n self.assertNotEqual(3, foo.add(2, 2))", "def test_add(self):\n self.assertEqual(3, add(1, 2))\n self.assertNotEqual(3, add(2, 2))", "def test_add(self):\n print('test_add')\n \n self.assertEqual(120, add...
[ "0.8064812", "0.79411405", "0.77598226", "0.7634203", "0.7425481", "0.7362449", "0.731181", "0.7137341", "0.70950186", "0.70194846", "0.6975826", "0.6966621", "0.6905885", "0.6871949", "0.6864412", "0.68441737", "0.68376404", "0.6798079", "0.67966104", "0.67796755", "0.677035...
0.6966413
12
Test passing wrong parameter for delete method.
def test_wrong_delete_param(self): def close_conn(): cli = LDAPClient("ldap://%s" % self.ipaddr) LDAPConnection(cli).delete("cn=dummy") self.assertRaises(ClosedConnection, close_conn) self.assertRaises(TypeError, lambda: self.conn.delete(0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete(self):\n pass", "def test_delete1(self):\n pass", "def test_delete_case(self):\n pass", "def do_delete(self, arg):\n \treturn False", "def test_delete_run(self):\n pass", "def test_delete_item_using_delete(self):\n pass", "def test_delete_record(sel...
[ "0.81362563", "0.78087914", "0.7780758", "0.7746777", "0.774375", "0.76655203", "0.7561211", "0.7514759", "0.7312061", "0.72756827", "0.72699475", "0.72408867", "0.7219854", "0.721095", "0.71852905", "0.7138387", "0.7133738", "0.7111839", "0.71118313", "0.70879745", "0.708017...
0.72905856
9
Test password locking with password policy.
def test_password_lockout(self): if sys.platform == "win32": self.skipTest("Cannot use password policy on Windows") user_dn = "cn=jeff,ou=nerdherd,dc=bonsai,dc=test" cli = LDAPClient("ldap://%s" % self.ipaddr) cli.set_password_policy(True) try: cli.set_cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_forced_password_change(self):\r\n\r\n student_email, student_password = self._setup_user()\r\n staff_email, staff_password = self._setup_user(is_staff=True)\r\n\r\n self._login(student_email, student_password)\r\n self._login(staff_email, staff_password)\r\n\r\n staff_re...
[ "0.6874066", "0.6578467", "0.6546355", "0.65354776", "0.6521407", "0.6484819", "0.64839184", "0.6438782", "0.6404049", "0.6390272", "0.63591725", "0.63541543", "0.6281434", "0.6275415", "0.62695897", "0.6252212", "0.62510914", "0.62440634", "0.62384504", "0.6221138", "0.61975...
0.73470205
0
Test password expiring with password policy.
def test_password_expire(self): user_dn = "cn=skip,ou=nerdherd,dc=bonsai,dc=test" cli = LDAPClient("ldap://%s" % self.ipaddr) cli.set_password_policy(True) cli.set_credentials("SIMPLE", (user_dn, "p@ssword")) conn, ctrl = cli.connect() entry = conn.search(user_dn, 0)[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_passwordsuccess(self):\n old_time = timezone.now()\n self.u.extra.password_expires = old_time\n form_data = self.form_data('2$n5[]$nnA5Y}2}}^gba')\n form = self.form(data=form_data, user=self.u)\n self.assertTrue(form.is_valid())\n form.save()\n new_time = ...
[ "0.73911214", "0.7176944", "0.66216415", "0.6572187", "0.6437454", "0.634047", "0.63339823", "0.63237965", "0.6312588", "0.63042474", "0.6275768", "0.6275104", "0.6263584", "0.624678", "0.62428534", "0.6227891", "0.62078655", "0.61909306", "0.61644655", "0.6162078", "0.615218...
0.76759005
0
Test Password Modify extended operation.
def test_password_modify_extop(self): user_dn = LDAPDN("cn=skip,ou=nerdherd,dc=bonsai,dc=test") cli = LDAPClient("ldap://%s" % self.ipaddr) cli.set_credentials("SIMPLE", (str(user_dn), "p@ssword")) conn = cli.connect() self.assertRaises(TypeError, lambda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEditPassword(self):\n self._login_user('eschoppik','secret')\n response = self.client.post('/users/1/edit_password?_method=PATCH',\n data=dict(new_password='newpass', confirm_password='newpass',\n old_password='secret'), follow_redirects=True)\n user = User.query....
[ "0.72992325", "0.72059107", "0.71185523", "0.7043154", "0.6966417", "0.69475526", "0.69261074", "0.68819994", "0.68134713", "0.6801481", "0.6751851", "0.67470604", "0.6723605", "0.6700132", "0.6692681", "0.6681687", "0.66731286", "0.66515154", "0.6604505", "0.6600074", "0.658...
0.784557
0
Test searching with manageDsaIT control.
def test_search_with_managedsait_ctrl(self): refdn = LDAPDN("o=admin-ref,ou=nerdherd,dc=bonsai,dc=test") cli = LDAPClient("ldap://%s" % self.ipaddr) with cli.connect() as conn: res = conn.search(refdn, LDAPSearchScope.BASE, attrlist=['ref'])[0] self.assertEqual(str(res.dn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def testSEFinder(self):\n\n seNames = self.mySiteDB.getAllSENames()\n self.assertTrue(len(seNames) > 1)\n self.assertTrue('cmsdcadisk01.fnal.gov' in seNames)\n r...
[ "0.64256716", "0.64256716", "0.64256716", "0.581726", "0.57539856", "0.57405406", "0.57157606", "0.57095516", "0.5678199", "0.55709195", "0.5569848", "0.5566419", "0.5517554", "0.54758906", "0.5449588", "0.5442283", "0.5432611", "0.542784", "0.5410762", "0.538501", "0.5368395...
0.5767459
4
Create a new bank information
def create_new_banks(): city = request.form.get('bankCity', '') name = request.form.get('bankName', '') address = request.form.get('bankAddress', '') info = dict(city=city, name=name, address=address) # print(info) bank = Bank(city, name, address) res = bank.save() # print('res=%d' % res) return send_result(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bank():\n\n bank = Bank.objects.create(name='Random Bank')\n return bank", "def test_client_bank_account_create(self):\n pass", "def new_bank_account(payment_doc, bankData):\n from erpnextfints.utils.bank_account_controller import \\\n BankAccountController\n return BankAccountCon...
[ "0.7559602", "0.71903527", "0.69491756", "0.6763208", "0.67325413", "0.6730462", "0.66991276", "0.6647563", "0.66253805", "0.65569913", "0.6554133", "0.6422634", "0.6422634", "0.64211667", "0.63165236", "0.6168401", "0.6161851", "0.61598647", "0.61535907", "0.61501044", "0.61...
0.8252264
0
get a new bank object and details
def get_banks(): bank_list = [] bank_obj = lib.operations.bank.get_bank_list() for obj in bank_obj: checkbox = "<div class='checkbox'>" \ "<label><input name='checkbox' type='checkbox' id='bankBox' value='{id}'></label>" \ "</div>".format(id=obj.id) btn_group = "<div class='btn-group'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bank():\n\n bank = Bank.objects.create(name='Random Bank')\n return bank", "def bank_account():\n return BankAccount()", "def example_bank_account():\n \n return BankAccount(\"Test User\", 1000.0)", "def create_new_banks():\n\n\tcity = request.form.get('bankCity', '')\n\tname = request.for...
[ "0.77258354", "0.7678284", "0.7248556", "0.6961261", "0.67643434", "0.67433494", "0.6585655", "0.6585587", "0.64266276", "0.63645226", "0.63021654", "0.6287894", "0.6259636", "0.6231028", "0.6111299", "0.6096521", "0.6052425", "0.6022077", "0.60201436", "0.6006879", "0.598461...
0.0
-1
delete a bank information from bank store
def delete_banks(): res = None request_str = "request url: {0}?{1}".format(request.url, request.get_data().decode('utf8')) # print("request url: %s" % request_str) req_param = request_str.split('?')[-1] for id_param in req_param.split('&'): id_value = id_param.split('=')[1] print("id=%s" % id_value) res = B...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_bank_account_delete(self):\n pass", "def delete_account(request):\n ubanks = request.user.userbank.all()\n for ubank in ubanks:\n ubank.delete()\n user = request.user\n log_out(request)\n user.delete()\n return HttpResponse(\"Account succesfully deleted\")", "def...
[ "0.71329033", "0.68773824", "0.680916", "0.67814386", "0.65903366", "0.63704675", "0.6302377", "0.6252257", "0.6244305", "0.6241191", "0.61959", "0.6166826", "0.6166826", "0.6166826", "0.6166826", "0.6139188", "0.6130949", "0.6124565", "0.60743225", "0.6066364", "0.60517305",...
0.74057645
0
delete a bank information from bank store
def update_banks(bank_id): city = request.form.get('bankCity', '') name = request.form.get('bankName', '') address = request.form.get('bankAddress', '') info = dict(id=bank_id, city=city, name=name, address=address) print(info) bank = Bank.query.filter_by(id=bank_id).first() if bank: bank.name = name bank...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_banks():\n\n\tres = None\n\trequest_str = \"request url: {0}?{1}\".format(request.url, request.get_data().decode('utf8'))\n\t# print(\"request url: %s\" % request_str)\n\treq_param = request_str.split('?')[-1]\n\tfor id_param in req_param.split('&'):\n\t\tid_value = id_param.split('=')[1]\n\t\tprint(\"i...
[ "0.7404798", "0.7132652", "0.68761516", "0.68083924", "0.6781729", "0.6588969", "0.6368554", "0.6302607", "0.6252452", "0.6243891", "0.62412745", "0.61952716", "0.61665446", "0.61665446", "0.61665446", "0.61665446", "0.6137177", "0.6130539", "0.6124873", "0.6073968", "0.60649...
0.0
-1
Two Register and Immediate instructions Parser.
def parse(arg: Tuple[str, str, str, str, str]) -> Tuple[str, str, str]: return (arg[2], arg[3], arg[4])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_control(self,ins): \n if ins.instr == 'j':\n if len(ins.args) == 1:\n if type(ins.args[0]) == Register:\n self.need = [ins.args[0]]\n if ins.args[0].expr == \"$31\":\n self.need += [Register(\"$2\"), Register...
[ "0.5297825", "0.526232", "0.52386516", "0.51448655", "0.5074047", "0.5039886", "0.5036299", "0.5004861", "0.50040513", "0.49939978", "0.49608114", "0.4955953", "0.49455416", "0.4897556", "0.48950177", "0.48696256", "0.48126158", "0.47999066", "0.47873563", "0.47853625", "0.47...
0.42107955
97
Branch to label if Reg[rs] == Reg[rt].
def beq(program: MipsProgram, rs: str, rt: str, label: str): if program.registers[rs] == program.registers[rt]: program.registers["pc"] = program.labels[label].value - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bne(program: MipsProgram, rs: str, rt: str, label: str):\n if program.registers[rs] != program.registers[rt]:\n program.registers[\"pc\"] = program.labels[label].value - 1", "def branch_if_equal_reg(self):\n registers = self.return_middle_registers(self.opcode)\n\n if self.registers[r...
[ "0.62456226", "0.60115707", "0.54348534", "0.54297096", "0.5392624", "0.5327324", "0.52737606", "0.52281475", "0.5189784", "0.51500887", "0.50746506", "0.5074509", "0.503317", "0.5016388", "0.5003025", "0.50009066", "0.49789795", "0.49279445", "0.49165267", "0.49081331", "0.4...
0.6317092
0
Branch to label if Reg[rs] != Reg[rt].
def bne(program: MipsProgram, rs: str, rt: str, label: str): if program.registers[rs] != program.registers[rt]: program.registers["pc"] = program.labels[label].value - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def branch_if_equal_reg(self):\n registers = self.return_middle_registers(self.opcode)\n\n if self.registers[registers[0]] == self.registers[registers[1]]:\n self.pc += 2\n logger.info(\n \"Skipped {} because register V{} and V{} are equal to {}\".format(\n ...
[ "0.62894225", "0.6026388", "0.55991274", "0.5560397", "0.54077464", "0.5354878", "0.5353679", "0.5219369", "0.5173581", "0.5097688", "0.5076022", "0.50460917", "0.5016778", "0.4973996", "0.49441072", "0.4922955", "0.49188864", "0.4892238", "0.4891666", "0.4877365", "0.4875250...
0.6580701
0
creates DNS workspace with fake data angle Angle of detector bank rotation flipper Flipper state (ON/OFF) dataY Data array to set as DataY of the created workspace, will be set to np.ones if None loadinstrument If True api.LoadInstrument will be executed, needed for DNSMergeRuns
def create_fake_dns_workspace(wsname, angle=-7.53, flipper='ON', dataY=None, loadinstrument=False): ndet = 24 dataX = np.zeros(2*ndet) dataX.fill(4.2 + 0.00001) dataX[::2] -= 0.000002 if dataY is None: dataY = np.ones(ndet) dataE = np.sqrt(dataY) # create workspace api.CreateWork...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_test_data():\n # Dictionary in which to store data\n data_dict = {}\n # Load data01.nc Dataset\n data01 = xr.open_dataset(os.path.dirname(__file__)+'/data/data01.nc',\n decode_times=False, autoclose=True)\n data_dict['data01'] = data01.copy()\n # Extract tw...
[ "0.528857", "0.5275683", "0.5244616", "0.5172132", "0.5155412", "0.50693256", "0.5061431", "0.50385815", "0.5015966", "0.50138897", "0.5005705", "0.49955073", "0.49795848", "0.49606365", "0.4959157", "0.49444878", "0.49352133", "0.49344248", "0.49275932", "0.49208367", "0.491...
0.6685899
0
Randomly generates objects based on rarity
def drop_item(dictionary): drops_i = [] for k, v in dictionary.items(): quantity = dropper(v['rarity']) if quantity: drops_i.append(Item(name=k, quantity=quantity, **v)) return drops_i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandomRarity():\n r = random.randint(1,100)\n if r <= Rarities.IMPOSIBIL:\n return \"IMPOSIBIL\"\n elif r <= Rarities.LEGENDAR:\n return \"LEGENDAR\"\n elif r <= Rarities.EPIC:\n return \"EPIC\"\n else:\n return \"COMUN\"", "de...
[ "0.6996102", "0.6694256", "0.6340941", "0.622799", "0.620527", "0.6175181", "0.61681855", "0.61256886", "0.6113648", "0.6070151", "0.6064537", "0.6034091", "0.60101193", "0.600747", "0.59982055", "0.5995867", "0.59806323", "0.5942219", "0.5933879", "0.59222144", "0.5916376", ...
0.0
-1
Remove items with quantity of zero from the map inventory
def clean_up_map(self): self.items = [i for i in self.items if i.quantity != 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_0_items(inventory):\n for k,v in inventory.copy().items():\n if inventory[k] == 0:\n inventory.pop(k)\n return inventory", "def clean_up_inventory(self):\n self.inventory = [i for i in self.inventory if i.quantity != 0]", "def filter_0_items(inventory):\r\n\r\n\tnew_li...
[ "0.819584", "0.771313", "0.76574916", "0.68226224", "0.6534319", "0.65251803", "0.6427881", "0.61505413", "0.6041092", "0.5901576", "0.587836", "0.5865126", "0.585266", "0.5846387", "0.5802365", "0.5761933", "0.57600087", "0.57220966", "0.57096773", "0.57003164", "0.56371963"...
0.8265239
0
With the player's location in the center, draw a 5 x 5 map with map square type and coordinates in each square
def map_picture(the_map, p): xy = (p.location[0] - 2, p.location[1] + 2) map_coords = [] for y in range(0, 5): row = [(xy[0] + x, xy[1] - y) for x in range(0, 5)] map_coords.append(row) pretty_map = [] for r in map_coords: row = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawMap(self):\n for position, contain in self.map.items():\n if contain is \"block\":\n self.blocks.add(Block(position[1]*50,position[0]*50))\n elif contain is \"Coins\":\n self.Coins.add(Coins(position[1]*50+10,position[0]*50+10))", "def test_sprea...
[ "0.7309115", "0.71187574", "0.7117415", "0.7008887", "0.6868376", "0.6814788", "0.6781789", "0.6701914", "0.6671221", "0.6619516", "0.6612153", "0.6599288", "0.65620023", "0.6553493", "0.6492683", "0.64801276", "0.64664316", "0.6461657", "0.64449847", "0.643181", "0.63907826"...
0.6469946
16
Remove items with quantity of zero from the map inventory
def clean_up_inventory(self): self.inventory = [i for i in self.inventory if i.quantity != 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_map(self):\n self.items = [i for i in self.items if i.quantity != 0]", "def filter_0_items(inventory):\n for k,v in inventory.copy().items():\n if inventory[k] == 0:\n inventory.pop(k)\n return inventory", "def filter_0_items(inventory):\r\n\r\n\tnew_list = [] # crea...
[ "0.8266549", "0.8194865", "0.7657122", "0.682121", "0.6535803", "0.65241736", "0.64271444", "0.61508083", "0.6040893", "0.59006655", "0.5876113", "0.5865422", "0.5852331", "0.58450437", "0.580205", "0.576084", "0.5757937", "0.5721766", "0.571097", "0.5699798", "0.5637236", ...
0.77110225
2
Pick the skills for a mob, these determine what a player can get from completing a quest
def skills(): all_skills = ["strength", "patience", "cleanliness", "leadership", "communication", "science", "math", "engineering", "intelligence", "driving"] random.shuffle(all_skills) return all_skills[0:2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_quest(self):\n\n if odds(3):\n\n quest_items = add_dicts_together(items[\"master\"], items[self.p.square.square_type])\n quest_item = random.choice(list(quest_items.keys()))\n\n i = Item(quest_item, 0, **quest_items[quest_item])\n self.inventory.appen...
[ "0.63136405", "0.6310787", "0.6310787", "0.6310787", "0.6310787", "0.6231838", "0.6196677", "0.619384", "0.61357206", "0.6035391", "0.60149455", "0.5892159", "0.57440823", "0.5698521", "0.5648801", "0.56278664", "0.56115097", "0.56068945", "0.5603691", "0.55618465", "0.555885...
0.6408001
0
inventory based bring me x of an object to learn a skill
def generate_quest(self): if odds(3): quest_items = add_dicts_together(items["master"], items[self.p.square.square_type]) quest_item = random.choice(list(quest_items.keys())) i = Item(quest_item, 0, **quest_items[quest_item]) self.inventory.append(i) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_skill(self, other_card):\n ## YOUR CODE IS HERE ##", "def get_skill(self, other_card):\n ## YOUR CODE IS HERE ##", "def get_skill(self, other_card):\n ## YOUR CODE IS HERE ##", "def get_skill(self, other_card):\n ## YOUR CODE IS HERE ##", "def use_skill(self, g, i, x, y)...
[ "0.6652004", "0.6652004", "0.6652004", "0.6652004", "0.6390162", "0.6274836", "0.624927", "0.62181085", "0.606496", "0.6056187", "0.59883636", "0.5947959", "0.59235936", "0.5900774", "0.5862118", "0.578877", "0.5775404", "0.5752975", "0.57500863", "0.5741891", "0.5694833", ...
0.5862948
14
Convert magnitude to AB magnitude
def convert_to_abmag(value, name): mag_constants = { 'tmassJmag': 0.90, 'tmassHmag': 1.37, 'tmassKsMag': 1.85, 'SDSSuMag': 0.0, 'SDSSgMag': 0.0, 'SDSSrMag': 0.0, 'SDSSiMag': 0.0, 'SDSSzMag': 0.0, 'JpgMag': -0.055, 'FpgMag': 0.24, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(a):\n return dot_product(a, a)**0.5", "def magtoflux(_mag, _id):\n return math.pow(10, -0.4*(_mag + VegaToAB[_id] - 8.9))", "def AB_zero_mag(self):\n if self.wavelength_unit is None:\n raise AttributeError('Needs wavelength units')\n\n C1 = (Unit(self.wavelength_uni...
[ "0.67562544", "0.6364612", "0.62620175", "0.622684", "0.5995404", "0.59550416", "0.5898912", "0.58955497", "0.588089", "0.58797747", "0.5833462", "0.58331496", "0.58265626", "0.5806616", "0.57999116", "0.57599926", "0.5759203", "0.57434416", "0.5739705", "0.57364446", "0.5704...
0.6649778
1
Returns the given HTML with all tags stripped.
def strip_tags(value): return re.sub(r'<[^>]*?>', '', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},...
[ "0.8138946", "0.8109891", "0.810231", "0.8100899", "0.80280966", "0.7989464", "0.79603654", "0.78888774", "0.788333", "0.78830826", "0.78644603", "0.7843869", "0.7843869", "0.7841764", "0.78237224", "0.7817937", "0.77888054", "0.7782822", "0.7782822", "0.77559096", "0.7739701...
0.67446905
69
Presents the response of the DBLP Query to the user
def do_response(data): def on_done(i): if i == -1: return cite_key = data[i][2] view = sublime.active_window().active_view() view.run_command("dblp_insert_result", {"text": cite_key}) sublime.active_window().show_quick_panel(data, on_done)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_query_response(response):\n if response.text is not None:\n print(json.loads(response.text))\n else:\n logger.warning('Response not valid.')", "def query(output, query):\n gqlapi = gql.get_api()\n print_output(output, gqlapi.query(query))", "def display_results():\n pass"...
[ "0.6287405", "0.6051548", "0.5986355", "0.5806126", "0.5794586", "0.5725075", "0.57025176", "0.5640118", "0.5639316", "0.563691", "0.56218725", "0.56141347", "0.56090456", "0.5501721", "0.54835856", "0.54765683", "0.54745716", "0.54676145", "0.5460552", "0.54593676", "0.54542...
0.6363756
0
Get the task ids of running celery tasks.
def running_celery_tasks(request): active_dict = CELERY_INSPECT.active() active_tasks = [] if active_dict: for task_list in active_dict.values(): active_tasks.extend(task_list) if active_tasks: active_tasks = [dikt.get("id", "") for dikt in active_tasks] return Response({...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTaskIds(self, director):\n # the computation record\n computation = self._getComputationRecord(director)\n \n # search for tasks\n iworker = self.inventory.iworker\n tasks = computation.findTasks(director.clerk.db, iworker)\n\n ids = [t.id for t in tasks]\n ...
[ "0.75938624", "0.7282718", "0.7028011", "0.690821", "0.6904824", "0.6813038", "0.6770491", "0.6752051", "0.66965824", "0.6624447", "0.66147155", "0.66134167", "0.6579048", "0.6572047", "0.65634185", "0.6556381", "0.6547194", "0.6485782", "0.6478132", "0.64532846", "0.6437751"...
0.68382025
5
Get the length of the celery queues.
def celery_queue_lengths(request): queue_len = collect_queue_metrics() LOG.info(f"Celery queue backlog info: {queue_len}") return Response(queue_len)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_count(self):\n with self.mutex:\n return len(self.queues)", "def _getqueuesize(self):\n return self._queuesize", "def queue_size(self):\n return len(self.groups)", "def api_get_queue_len():\n try:\n ret = AppStatus.check_manager_status(brief=False)\...
[ "0.7977187", "0.7841889", "0.7757675", "0.769324", "0.7620035", "0.76058805", "0.7603171", "0.7603171", "0.7603171", "0.7603171", "0.7571514", "0.7556391", "0.75545263", "0.75499344", "0.75499344", "0.75169873", "0.7493885", "0.7483426", "0.7447149", "0.7440828", "0.74081135"...
0.81154
0
Makes sure that a matrix is square
def check_squareness(A): if len(A) != len(A[0]): raise ArithmeticError("Matrix must be square to inverse.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_square(self):\n if self.rows != self.cols:\n raise IndexError(\"Matrix is not square\")", "def is_square(matrix):\n return is_matrix(matrix) and matrix.shape[0] == matrix.shape[1]", "def square_check(self):\n return len(self.matrix) == len(self.matrix[0])", "def chec...
[ "0.82600665", "0.8005253", "0.7705513", "0.76000637", "0.7547414", "0.7547172", "0.7285882", "0.7285882", "0.7253775", "0.7096642", "0.690228", "0.681686", "0.6795993", "0.67146957", "0.66360945", "0.66099375", "0.6561458", "0.65606064", "0.65251964", "0.651151", "0.6493142",...
0.7680184
4
Creates a matrix filled with zeros.
def zeros_matrix(rows, cols): M = [] while len(M) < rows: M.append([]) while len(M[-1]) < cols: M[-1].append(0.0) return M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)", "def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in range(width):\n newrow = [0] * height\n returnvalue.addRow(*newrow)\n return returnvalue", "def ze...
[ "0.83105844", "0.82251585", "0.8177624", "0.814171", "0.80738527", "0.8053129", "0.7960837", "0.7792159", "0.7705187", "0.7678834", "0.76101226", "0.7580145", "0.74690133", "0.7464018", "0.7462307", "0.74617356", "0.7240482", "0.7231481", "0.718796", "0.71302176", "0.70924646...
0.7950135
8
Creates and returns an identity matrix.
def identity_matrix(n): I = zeros_matrix(n, n) for i in range(n): I[i][i] = 1.0 return I
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_matrix():\r\n return numpy.identity(4)", "def identity_matrix():\n return numpy.identity(4)", "def IdentityMatrix():\n return RotationMatrix([\n [1, 0, 0],\n [0, 1, 0],\n [0, 0, 1]\n ])", "def identity_matrix(n: int) -> Matrix:\n return make_matrix(n, n, lambd...
[ "0.87470335", "0.874405", "0.82996976", "0.82049274", "0.82049274", "0.82049274", "0.8065252", "0.80513746", "0.792574", "0.78846717", "0.78415334", "0.7787648", "0.7665313", "0.7528092", "0.7517327", "0.7159512", "0.68217206", "0.67490846", "0.67490846", "0.6670712", "0.6534...
0.7780349
13
Creates and returns a copy of a matrix.
def copy_matrix(M): rows = len(M) cols = len(M[0]) MC = zeros_matrix(rows, cols) for i in range(rows): for j in range(rows): MC[i][j] = M[i][j] return MC
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_matrix(matrix):\n import numpy as np\n copy_of_m = np.copy(matrix)\n return copy_of_m", "def copy(self):\n rdd = self._data.map(\n lambda m: m\n )\n\n return Matrix(rdd, self._shape,\n dtype=self._dtype, coord_format=self._coord_format, nelem...
[ "0.8205669", "0.79022706", "0.78004694", "0.7544755", "0.7494636", "0.7439033", "0.7438018", "0.73586124", "0.72616833", "0.72254306", "0.7184861", "0.71509737", "0.71381754", "0.70306104", "0.6880537", "0.6872653", "0.6872653", "0.6836561", "0.68200153", "0.67752004", "0.644...
0.76325834
3
Creates and returns a transpose of a matrix.
def transpose(M): rows = len(M) cols = len(M[0]) MT = zeros_matrix(cols, rows) for i in range(rows): for j in range(cols): MT[j][i] = M[i][j] return MT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose_matrix(matrix):\n n = len(matrix[0])\n m = len(matrix)\n matrix_t = create_matrix(n,m)\n for j in range(n):\n for i in range(m):\n matrix_t[j][i] = matrix[i][j]\n \n return matrix_t", "def transpose(self):\n transposed_data = []\n for i in range(1, ...
[ "0.81251967", "0.7924036", "0.79103607", "0.79101074", "0.78539556", "0.7807774", "0.7785112", "0.7656858", "0.7643545", "0.76049787", "0.7601282", "0.75942373", "0.759238", "0.7577282", "0.7569614", "0.75598514", "0.75094044", "0.74728984", "0.74510014", "0.74472064", "0.742...
0.7711812
7
Returns the product of the matrix A B
def matrix_multiply(A,B): rowsA = len(A) colsA = len(A[0]) rowsB = len(B) colsB = len(B[0]) if colsA != rowsB: raise ArithmeticError('Number of A columns must equal number of B rows.') C = zeros_matrix(rowsA, colsB) for i in range(rowsA): for j in range(colsB): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matr_prod(_A, _B):\r\n # Matrix multiplication\r\n B0 = _B[0]\r\n lenB = len(_B)\r\n lenA = len(_A)\r\n if(len(_A[0]) != lenB): # Check matrix dimensions \r\n Exception('Matrices have wrong dimensions')\r\n if(isinstance(B0, list) or isinstance(B0, array) or isinstance(B0, tuple...
[ "0.8343431", "0.8087157", "0.8086567", "0.80407274", "0.79556924", "0.7707546", "0.77015364", "0.76632124", "0.76312715", "0.76082563", "0.7588993", "0.75824964", "0.75753325", "0.74819463", "0.7461189", "0.74422127", "0.74324286", "0.7333407", "0.72310764", "0.7207229", "0.7...
0.824016
1
Checks the equality of two matrices.
def check_matrix_equality(A,B, tol=None): if len(A) != len(B) or len(A[0]) != len(B[0]): return False for i in range(len(A)): for j in range(len(A[0])): if tol == None: if abs(A[i][j] - B[i][j]) > 1e-10: return False else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsEqual(*args, **kwargs):\n return _gdi_.GraphicsMatrix_IsEqual(*args, **kwargs)", "def _are_matrix_elements_equal(element, another_element):\n difference = sympy.N(sympy.expand(element) - sympy.expand(another_element))\n\n try:\n return np.allclose(\n float(sympy.re(difference...
[ "0.7714554", "0.740203", "0.7387387", "0.73428464", "0.73169017", "0.7311009", "0.7276583", "0.7269618", "0.7231773", "0.71865493", "0.7137955", "0.71372896", "0.7098439", "0.7072754", "0.7070013", "0.7067749", "0.70479655", "0.69766957", "0.69462913", "0.6940412", "0.693163"...
0.7398573
2
Returns the inverse of the passed in matrix.
def invert_matrix(A, tol=None): check_squareness(A) check_non_singular(A) n = len(A) AM = copy_matrix(A) I = identity_matrix(n) IM = copy_matrix(I) indices = list(range(n)) for fd in range(n): fdScaler = 1.0 / AM[fd][fd] for j in range(n): AM[fd][j] *= fdSca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self,mat):\n result = np.linalg.inv(mat)\n self.out = result\n return self.out", "def inv(matrix):\n if sp.sparse.issparse(matrix):\n result = spla.inv(matrix)\n else:\n result = sp.linalg.inv(matrix)\n return result", "def invert(M):\r\n M = isMatrix(...
[ "0.8345577", "0.8109512", "0.7889959", "0.7608118", "0.7588944", "0.75702876", "0.7569624", "0.7557103", "0.7554652", "0.7536533", "0.7501843", "0.74276596", "0.74266934", "0.73573285", "0.735046", "0.7318116", "0.73134756", "0.7303804", "0.72714496", "0.7263057", "0.7237953"...
0.66334236
42
Multiply vector by scalar.
def mult_vect_by_scalar(v, a): return [a * i for i in v]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(s: float, v: Vector) -> Vector:\n return [s * v_item for v_item in v]", "def apply_scalar(vector, scalar):...
[ "0.80728054", "0.80728054", "0.78996766", "0.77208054", "0.7540622", "0.746231", "0.74302906", "0.7429139", "0.7425227", "0.72692066", "0.7259795", "0.7232113", "0.72266245", "0.72266245", "0.7076444", "0.7076444", "0.7040157", "0.7023348", "0.6994792", "0.6898495", "0.687613...
0.7260508
10
Scalar multiplication of two vectors.
def scalar_mult(v, u): return [v[i] * u[i] for i in range(len(v))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mulVectors(X1,X2):\n _checkSize(X1,X2)\n return sum([ X1[i] * X2[i] for i in range(len(X1))])", "def vectordot(a, b):\n return np.sum(a * b, 1)", "def __mul__(self, other): \n if isinstance(other, Iterable):\n # dot product\n return self.x * other[0] + self.y *...
[ "0.7891071", "0.7588624", "0.745898", "0.7430685", "0.7415986", "0.7390709", "0.738733", "0.7380874", "0.7380874", "0.7368991", "0.7364799", "0.7343856", "0.73292464", "0.7321248", "0.7282088", "0.7271174", "0.7239274", "0.72315997", "0.7225507", "0.72147185", "0.7187455", ...
0.70368165
27
L1norm of a vector.
def l1_norm(v): res = 0 for e in v: res += abs(e) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l1(vec):\n return np.linalg.norm(vec, ord=1)", "def l1_norm(f):\n return dmp_l1_norm(f.rep, f.lev, f.dom)", "def l1_norm(vec):\n res = sum(abs(float(x)) for x in vec.values())\n return res", "def func_val_l1_norm(w):\n\treturn np.linalg.norm(w,ord = 1)", "def normalise1D(*vector):\n\n ...
[ "0.9103843", "0.8192758", "0.810895", "0.8001383", "0.78128934", "0.7798467", "0.77959925", "0.7714896", "0.76301044", "0.7540783", "0.75042504", "0.7388181", "0.72909045", "0.7280093", "0.72323036", "0.72279674", "0.7182461", "0.715058", "0.71115243", "0.70706004", "0.706851...
0.856022
1
L2norm of a vector.
def l2_norm(v): res = 0 for e in v: res += e * e return math.sqrt(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2(vec):\n return np.linalg.norm(vec)", "def norm_l2(v):\n return np.sqrt((v**2).sum())", "def norm_l2(u):\n return linalg.norm(u.ravel())", "def l2norm(X):\n norm = np.linalg.norm(X, axis=1, keepdims=True)\n return 1.0 * X / norm", "def l2_norm(vec_or_matrix):\n if len(vec_or_mat...
[ "0.8957043", "0.8518496", "0.8318099", "0.82683444", "0.8182556", "0.8119852", "0.8069992", "0.8067408", "0.800764", "0.79987574", "0.78410333", "0.7818018", "0.77782995", "0.775152", "0.77224255", "0.77148014", "0.7711236", "0.7711236", "0.7711236", "0.76835793", "0.7682921"...
0.88052756
1
Get chain info by chain_code
def get_chain_info(chain_code: str) -> ChainInfo: if chain_code not in registry.chain_dict: raise exceptions.ChainNotFound(chain_code) return registry.chain_dict[chain_code]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chain(self, chain_id, model_num = 0):\n return self.struct[model_num][chain_id]", "def getChain(self, chain):\n\n\t\tfor i in self.chain:\n\t\t\tif i.name == chain:\n\t\t\t\treturn i\n\n\t\treturn None", "def get_chain(self, chain_id):\n if self.chain_dict.has_key(chain_id):\n retu...
[ "0.6661691", "0.66171616", "0.66006386", "0.6534698", "0.65320975", "0.6259728", "0.59668124", "0.5826618", "0.57274354", "0.56827086", "0.56827086", "0.56683314", "0.5597438", "0.5557106", "0.55414283", "0.54523975", "0.54389966", "0.5433401", "0.5423506", "0.5423506", "0.54...
0.85973877
0
Check if a specific chain is enabled
def is_chain_enabled(chain_code: str) -> bool: return chain_code in settings.ENABLED_CHAIN_COINS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chainExists(self, chain):\n\n\t\tfor i in self.chain:\n\t\t\tif i.name == chain:\n\t\t\t\treturn True\n\n\t\treturn False", "def is_enabled(self):", "def Enabled(self) -> bool:", "def check_enable_mode(self, *args, **kwargs):\n pass", "async def enabled(self) -> bool:\n response = await s...
[ "0.65481395", "0.64991826", "0.62574923", "0.6183565", "0.60547596", "0.6043707", "0.5994459", "0.5947198", "0.5914833", "0.58447534", "0.5816314", "0.5812519", "0.58103377", "0.5808176", "0.5804365", "0.57402676", "0.5713707", "0.5713226", "0.5707869", "0.56262934", "0.56247...
0.8113589
0
Get coin info by coin_code
def get_coin_info(coin_code: str, nullable: bool = False) -> Optional[CoinInfo]: coin = registry.coin_dict.get(coin_code) or daos.get_coin_info(coin_code) if not coin and not nullable: raise exceptions.CoinNotFound(coin_code) return coin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coin_info(self):\n res = r.get(self.url + self.coin)\n return self.execute(res)", "def get_related_coins(coin_code: str) -> Tuple[CoinInfo, CoinInfo, CoinInfo]:\n coin_info = get_coin_info(coin_code)\n chain_info = get_chain_info(coin_info.chain_code)\n\n return get_coin_info(coin_info...
[ "0.70733917", "0.697701", "0.6623063", "0.63734275", "0.60808015", "0.6028087", "0.59553903", "0.580595", "0.5796195", "0.579552", "0.5762164", "0.56983614", "0.5668701", "0.5658127", "0.56063265", "0.56048506", "0.55384284", "0.5512767", "0.55095935", "0.5492337", "0.5482836...
0.7121802
0
Get all chains info
def get_all_chains() -> List[ChainInfo]: return list(registry.chain_dict.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_chains(self):\n pass", "def get_chain_info(self, symbol: str): \n return self.trader.fetch_chain_info(symbol)", "def chains(self, model_num = 0):\n return [c for c in self.struct]", "def iter_all_chains(self):\n for model in self.model_list:\n for chain in ...
[ "0.6648737", "0.66053885", "0.6406602", "0.6345221", "0.6315527", "0.62710094", "0.62423307", "0.6205776", "0.61464137", "0.61464137", "0.5986051", "0.59603333", "0.58953345", "0.58749545", "0.58068633", "0.58068633", "0.57895243", "0.57617736", "0.567747", "0.565552", "0.565...
0.7985782
0
Get all coins info
def get_all_coins() -> List[CoinInfo]: coins = list(registry.coin_dict.values()) coins.extend(daos.get_all_coins()) coins = _deduplicate_coins(coins) return coins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coin_info(self):\n res = r.get(self.url + self.coin)\n return self.execute(res)", "def getCoins(self):\n return self.coins", "def get_coins(self):\n if self.coins:\n return self.coins.keys()\n else:\n return []", "def get_coins():\n coinsq = ses...
[ "0.809754", "0.7908469", "0.78092235", "0.7444306", "0.6880037", "0.684716", "0.6776203", "0.65017116", "0.6385217", "0.6361425", "0.6349795", "0.6266025", "0.61859596", "0.61856484", "0.61380804", "0.6127478", "0.60958624", "0.60535365", "0.5931904", "0.5909271", "0.58948857...
0.7782449
3
Get coins by specific chain_code
def get_coins_by_chain(chain_code: str) -> List[CoinInfo]: coins = [i for i in registry.coin_dict.values() if i.chain_code == chain_code] coins.extend(daos.get_coins_by_chain(chain_code)) coins = _deduplicate_coins(coins) return coins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_related_coins(coin_code: str) -> Tuple[CoinInfo, CoinInfo, CoinInfo]:\n coin_info = get_coin_info(coin_code)\n chain_info = get_chain_info(coin_info.chain_code)\n\n return get_coin_info(coin_info.chain_code), coin_info, get_coin_info(chain_info.fee_code)", "def get_chain_info(chain_code: str) ->...
[ "0.66432834", "0.6530525", "0.6016952", "0.59838", "0.5890483", "0.57192004", "0.5628259", "0.5595202", "0.5588637", "0.5577032", "0.55668074", "0.55609953", "0.5553892", "0.5499243", "0.5496403", "0.54455143", "0.5414286", "0.54084104", "0.5376834", "0.53712624", "0.53567535...
0.81350636
0
Get tuple of (coin info of chain_code, coin info of coin_code, coin info of fee_code) at the same time
def get_related_coins(coin_code: str) -> Tuple[CoinInfo, CoinInfo, CoinInfo]: coin_info = get_coin_info(coin_code) chain_info = get_chain_info(coin_info.chain_code) return get_coin_info(coin_info.chain_code), coin_info, get_coin_info(chain_info.fee_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coins_by_chain(chain_code: str) -> List[CoinInfo]:\n coins = [i for i in registry.coin_dict.values() if i.chain_code == chain_code]\n coins.extend(daos.get_coins_by_chain(chain_code))\n\n coins = _deduplicate_coins(coins)\n return coins", "async def get_coins_of_interest(\n self,\n ...
[ "0.63832754", "0.62517136", "0.6153005", "0.6009365", "0.58502924", "0.5819006", "0.57800615", "0.5763463", "0.56328285", "0.5569762", "0.5514283", "0.5464755", "0.545611", "0.54450524", "0.53672785", "0.53528535", "0.53291386", "0.53156674", "0.5303876", "0.530158", "0.52653...
0.79970706
0
Generate an internal objective, `dlik_dh H`, for a given GP layer.
def gen_gp_loss(gp): def loss(_, H): dlik_dh_times_H = H * K.gather(gp.dlik_dh, gp.batch_ids[:gp.batch_sz]) return K.sum(dlik_dh_times_H, axis=1, keepdims=True) return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dh(z,h=0.7,omegalambda=0.7,omegam=0.3,omegak=0.0):\n return distcalc(z,h,omegalambda,omegam,omegak)['dh']", "def Hstep_cost_function(H): \n U = Wold - Yold\n #cost = -np.trace(H.T@K@H) + (self.admm_rho/2)*(norm(H.T@D - Wold + self.Y, 'fro')**2) \n ...
[ "0.6006004", "0.585712", "0.57309765", "0.57007205", "0.55555654", "0.5549013", "0.54939693", "0.5392773", "0.5370718", "0.53684366", "0.5349288", "0.53174835", "0.529212", "0.52497977", "0.5234803", "0.5220896", "0.52103525", "0.5194645", "0.51926285", "0.5189824", "0.517168...
0.6818806
0
Tokenizes code into a list of CuBERT sentences.
def code_to_cubert_sentences( code, initial_tokenizer, subword_tokenizer, ): tokens = initial_tokenizer.tokenize(code)[:-1] # type: List[Text] logging.vlog(5, 'Code >>>%s<<< is tokenized into >>>%s<<<.', code, tokens) # This will split the list into sublists of non-NEWLINE tokens (key is # False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_for_bleu_eval(self, code):\n code = re.sub(r'([^A-Za-z0-9_])', r' \\1 ', code)\n code = re.sub(r'([a-z])([A-Z])', r'\\1 \\2', code)\n code = re.sub(r'\\s+', ' ', code)\n code = code.replace('\"', '`')\n code = code.replace('\\'', '`')\n tokens = [t for t in co...
[ "0.6863243", "0.67525357", "0.67525357", "0.669251", "0.6580094", "0.65743464", "0.6467367", "0.64577", "0.63880205", "0.6343771", "0.62983996", "0.62966585", "0.6272456", "0.6251971", "0.62455213", "0.6221313", "0.61965567", "0.6195651", "0.61892426", "0.61888105", "0.616274...
0.7083132
0
121 yes ! 21 no! nouse str space
def is_palindrome(a): max = a min = 0 while max > 0: min = (min * 10 + max % 10) max /= 10 return min == a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nostatement(phrase):\n\n is_printable = lambda x: x in printable\n is_whitespace = lambda x: x in whitespace\n if not any([is_printable(x) and not is_whitespace(x) for x in phrase]):\n return 'Fine. Be that way!'", "def verse_2():\n print(\"Old MacDonald had a farm\")\n print(\"E-I-E-I-...
[ "0.6229907", "0.6042719", "0.5840087", "0.57881814", "0.5769659", "0.57432306", "0.5722412", "0.57041365", "0.5596774", "0.55785036", "0.55535126", "0.55232805", "0.5517944", "0.55135435", "0.5506934", "0.5497256", "0.5475314", "0.5472987", "0.54542875", "0.5442861", "0.54366...
0.0
-1
format metadata, multiline tags are not supported in markdown2
def format_markdown(md_content: str) -> str: tag_index = md_content.find('tags') if tag_index > -1: meta_end = md_content.find(META_SEPARATOR) r = format_meta(md_content[:meta_end]) return r + md_content[meta_end:] return md_content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _display_metadata_markdown(self, filename, metadata, options):\n show_all = \"all\" in options\n options = string_to_list(options)\n lines = []\n if \"description\" in options or show_all:\n if metadata.description:\n lines += [f\":Description: {metadata.de...
[ "0.6714001", "0.6370263", "0.6355281", "0.6342423", "0.620168", "0.61515206", "0.61427075", "0.614102", "0.60519606", "0.6008847", "0.59557945", "0.59388214", "0.5937017", "0.5912883", "0.5902827", "0.590074", "0.5844119", "0.57907736", "0.57890886", "0.5786218", "0.5786025",...
0.6650283
1
Function to export multiple Jobs, with folder hierarchy for each Job
def export_records_as_xml(spark, ct_id): # init logging support spark.sparkContext.setLogLevel('INFO') log4jLogger = spark.sparkContext._jvm.org.apache.log4j logger = log4jLogger.LogManager.getLogger(__name__) # hydrate CombineBackgroundTask ct = CombineBackgroundTask.objects.get(pk=int(ct_id)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_jobs_file(jobs_file: Path, root_dir: Path):\n output_dir = root_dir / 'output'\n output_dir.mkdir(exist_ok=True)\n\n jobs_entries = []\n\n input_root_dir = root_dir / 'inputs' # This will contain one or more line folders or a single baseline folder\n\n # Get the line subdirectories\n fo...
[ "0.6415777", "0.6293375", "0.61829567", "0.6166739", "0.6111535", "0.5940927", "0.58963144", "0.58238053", "0.5741773", "0.57335037", "0.573221", "0.571614", "0.57016623", "0.5636251", "0.5616405", "0.56129754", "0.5601236", "0.55718577", "0.555322", "0.553652", "0.55194795",...
0.0
-1
Function to export multiple Jobs, with folder hierarchy for each Job
def export_records_as_tabular_data(spark, ct_id): # hydrate CombineBackgroundTask ct = CombineBackgroundTask.objects.get(pk=int(ct_id)) # reconstitute fm_export_config_json fm_config = json.loads(ct.task_params['fm_export_config_json']) # clean base path output_path = "file:///%s" % ct.task_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_jobs_file(jobs_file: Path, root_dir: Path):\n output_dir = root_dir / 'output'\n output_dir.mkdir(exist_ok=True)\n\n jobs_entries = []\n\n input_root_dir = root_dir / 'inputs' # This will contain one or more line folders or a single baseline folder\n\n # Get the line subdirectories\n fo...
[ "0.6415852", "0.62944436", "0.61835885", "0.6166434", "0.6109709", "0.5941371", "0.5897114", "0.58242196", "0.5741506", "0.5733732", "0.5731104", "0.5715749", "0.57014203", "0.56365126", "0.56180114", "0.56140405", "0.560171", "0.55737257", "0.55544275", "0.55366474", "0.5519...
0.0
-1
SubFunction to convert RDD of XML to KVP
def _convert_xml_to_kvp(batch_rdd, fm_config): def kvp_writer_udf(row, fm_config): """ Converts XML to kvpjson """ # get handler, that includes defaults xml2kvp_defaults = XML2kvp(**fm_config) # convert XML to kvp xml2kvp_handler = XML2kvp.xml_to_kvp( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kml_extract_RDD(xml_file):\n soup = BeautifulSoup(xml_file, \"lxml-xml\")\n return get_kml_content(soup)", "def apply_transformations(rdd):\n ### BEGIN SOLUTION ###\n return rdd", "def test_xml_kpointsw(xml_parser):\n \n kpointsw = xml_parser.get_kpointsw()\n test = np.array([0.0046296...
[ "0.68342566", "0.610607", "0.56533575", "0.56469774", "0.5593624", "0.55702865", "0.532358", "0.5312068", "0.52508914", "0.52455354", "0.52455354", "0.51781493", "0.5105279", "0.5073926", "0.5057156", "0.500157", "0.4992597", "0.49787492", "0.49769318", "0.49672762", "0.49443...
0.66812235
1
Converts XML to kvpjson
def kvp_writer_udf(row, fm_config): # get handler, that includes defaults xml2kvp_defaults = XML2kvp(**fm_config) # convert XML to kvp xml2kvp_handler = XML2kvp.xml_to_kvp( row.document, return_handler=True, handler=xml2kvp_defaults) # loop through and convert list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_to_json(xml):\n\n logging.debug(\"-> xml_to_json()\")\n\n xml_as_dict = xmltodict.parse(xml)\n xml_as_json = json.dumps(xml_as_dict)\n\n logging.debug(\"<- xml_to_json()\")\n\n return xml_as_json", "def parse_xml(request):\n data = xmltodict.parse(request.data)\n return json.dumps(da...
[ "0.67457545", "0.67316794", "0.6506803", "0.6358584", "0.62381154", "0.6031014", "0.59227693", "0.5880872", "0.58055216", "0.5778025", "0.5774834", "0.5770503", "0.5769801", "0.56389093", "0.552329", "0.5490419", "0.54871583", "0.54609096", "0.5427796", "0.54215163", "0.53701...
0.0
-1
Function to write RDD to S3
def _write_rdd_to_s3( spark, rdd, bucket, key, access_key=settings.AWS_ACCESS_KEY_ID, secret_key=settings.AWS_SECRET_ACCESS_KEY): # dynamically set s3 credentials spark.sparkContext._jsc.hadoopConfiguration().set("fs.s3a.access.key", access_key) spark.sparkCo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_s3(df, bucket, path):\n pass", "def write_to_S3(data_bucket, data_key, model_version, bucket_name):\n df = get_S3_df(data_bucket, data_key)\n X = df.drop(columns='target')\n y = df['target']\n fitted_model = fit(RF, X, y)\n\n key = f'model_{model_version}.joblib'\n\n with tempfi...
[ "0.76141727", "0.6810543", "0.6776571", "0.6726307", "0.6726292", "0.6584743", "0.635899", "0.63203007", "0.6299286", "0.62920445", "0.6272629", "0.62652814", "0.61964273", "0.61855865", "0.6088748", "0.60656327", "0.60344815", "0.6034407", "0.6029303", "0.6028873", "0.602505...
0.79717773
0
Convenience method to retrieve set of records as Spark DataFrame
def get_job_as_df(spark, job_id, remove_id=False): pipeline = json.dumps({'$match': {'job_id': job_id}}) mdf = spark.read.format("com.mongodb.spark.sql.DefaultSource")\ .option("uri", "mongodb://%s" % settings.MONGO_HOST)\ .option("database", "combine")\ .option("collection", "record")\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qset_to_df(qset, datatype='object'):\n df = pd.DataFrame(list(qset.values()), dtype=datatype)\n return df", "def spark_df_to_records(df):\n return [tuple(r) for r in df.collect()]", "def pd(self, *args, **kwargs):\n return pd.DataFrame.from_records(self.aslist(), *args, **kwargs)", "def dat...
[ "0.6874762", "0.67645144", "0.6537734", "0.6515892", "0.6470557", "0.6428499", "0.6179536", "0.61614597", "0.61406046", "0.6136869", "0.61283815", "0.6064281", "0.60510206", "0.6005521", "0.5992337", "0.5990479", "0.5971488", "0.5949681", "0.59414095", "0.5937641", "0.5907337...
0.0
-1
Convenience method to retrieve mapped fields from ElasticSearch
def get_job_es(spark, job_id=None, indices=None, doc_type='record', es_query=None, field_include=None, field_exclude=None, as_rdd=False): # handle indices if job_id: es_indexes = 'j%s' % job_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_get_mapping(es):\n index = 'customer'\n\n print(es.indices.get_mapping(index=index))", "def get_field_mapping(self, index: str, field_name: str) -> Dict[str, str]:\n try:\n response = self.__client__.indices.get_field_mapping(\n fields=field_name,\n ...
[ "0.59721637", "0.5970356", "0.59351563", "0.5892698", "0.5837377", "0.57440674", "0.5576286", "0.55681604", "0.54960465", "0.54954594", "0.54876953", "0.5435626", "0.5426065", "0.5390112", "0.5383841", "0.538376", "0.5365062", "0.5359541", "0.53305423", "0.5322735", "0.530604...
0.0
-1
Reads the config dictionary from the yaml file.
def read_config(path: str) -> Dict[str, Any]: with open(path, 'r') as stream: config = yaml.load(stream, Loader=yaml.FullLoader) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config() -> dict:\n with Path(\"config.yaml\").open(\"r\") as file_pointer:\n try:\n return yaml.safe_load(file_pointer)\n except yaml.YAMLError as e:\n logging.error(e)", "def _parse_from_yaml(self) -> Dict:\n config_path = path.join(path.dirname(path.abspath(_...
[ "0.8510703", "0.8170443", "0.81028724", "0.79346716", "0.7744516", "0.77233523", "0.7691615", "0.7677799", "0.76556385", "0.7655394", "0.76022524", "0.75331354", "0.75172734", "0.7492183", "0.7491954", "0.74798125", "0.7412121", "0.7409238", "0.74053746", "0.73853785", "0.738...
0.7777115
4
Saves the config as a yaml file.
def save_config(config: Dict[str, Any], path: str) -> None: with open(path, 'w+', encoding='utf-8') as stream: yaml.dump(config, stream, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():\n print(\"Saving config file..\")\n\n res = yaml.round_trip_dump(_conf, indent=2, block_seq_indent=1)\n\n with open(__config_file, 'w', encoding='utf-8') as stream:\n stream.write(res)", "def _save_configuration_to_yml(self):\n data = self.get_configuration_data()\n time...
[ "0.8711886", "0.8137157", "0.8060888", "0.8050422", "0.78260994", "0.780826", "0.77677363", "0.7716582", "0.7687827", "0.76815486", "0.7630702", "0.7618591", "0.7603628", "0.75903785", "0.7572619", "0.7515349", "0.7492995", "0.7472796", "0.7456314", "0.7413156", "0.74058336",...
0.78916246
4
Recursively retrieves all files with a given extension from a folder.
def get_files(path: str, extension: str = '.wav') -> List[Path]: return list(Path(path).expanduser().resolve().rglob(f'*{extension}'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllFilesWithExtension(directory,extension):\n filesWithExtension = []\n for root, dirs, files in os.walk(directory):\n for file in files:\n if file.endswith(extension):\n filesWithExtension.append(os.path.realpath(os.path.join(root, file)))\n return filesWithExtens...
[ "0.7754233", "0.77189565", "0.76108575", "0.7574856", "0.7549951", "0.75188273", "0.7362993", "0.73599476", "0.7358571", "0.73053837", "0.72964454", "0.72771573", "0.7267167", "0.7237166", "0.72353244", "0.71759224", "0.7163786", "0.71300334", "0.7105351", "0.708306", "0.7051...
0.6895741
36
Pickles a given object to a binary file.
def pickle_binary(data: object, file: Union[str, Path]) -> None: with open(str(file), 'wb') as f: pickle.dump(data, f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickle_object(Object, file):\n filehandler = open(file, 'wb')\n pickle.dump(Object, filehandler)\n filehandler.close()", "def pickleSave(object, filename):\n #Todo: Handle exceptions from pickle\n filehandler = open(\"obj/\" + filename + \".obj\", 'wb')\n pickle.dump(object, filehandler)", ...
[ "0.8000543", "0.7845757", "0.7839422", "0.7826546", "0.78225243", "0.78010195", "0.7790488", "0.7765061", "0.7754899", "0.771234", "0.770211", "0.76987827", "0.7672998", "0.7647847", "0.7638088", "0.7612324", "0.7594783", "0.75926596", "0.75694567", "0.7567726", "0.75617766",...
0.74191135
30
Unpickles a given binary file to an object
def unpickle_binary(file: Union[str, Path]) -> object: with open(str(file), 'rb') as f: return pickle.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpickle_object(file):\n filehandler = open(file, 'rb')\n Object = pickle.load(filehandler)\n filehandler.close()\n return Object", "def pickle2obj(file):\n with open(file, mode = \"rb\") as fileObj:\n return pickle.load(fileObj)", "def load_object(fpath):\r\n with open(fpath, 'rb'...
[ "0.7907008", "0.7405966", "0.7287658", "0.7250862", "0.718685", "0.7156075", "0.70729834", "0.7040878", "0.70087326", "0.69523394", "0.6948881", "0.68949765", "0.6875697", "0.6867291", "0.68491626", "0.684888", "0.6835081", "0.6835064", "0.683392", "0.682806", "0.6804208", ...
0.8081387
0
Sends a batch of data to the given torch devicee (cpu or cuda).
def to_device(batch: Dict[str, torch.Tensor], device: torch.device) -> Dict[str, torch.Tensor]: return {key: val.to(device) for key, val in batch.items()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_device(data, device):\n if isinstance(data, (list,tuple)): # allows to apply function to lists or tuples of tensors\n return [to_device(x, device) for x in data]\n return data.to(device, non_blocking=True)", "def sample_batch(pid, args, batch_queue, port_dict, device, actor_id_to_ip_dataport,...
[ "0.6475205", "0.6251601", "0.6216795", "0.6203235", "0.6198509", "0.61853004", "0.61313254", "0.6042927", "0.60021627", "0.6000432", "0.5995935", "0.5995935", "0.5995935", "0.5995935", "0.5981431", "0.5953888", "0.5864239", "0.58164024", "0.5712651", "0.57055473", "0.56818134...
0.5653224
22
To jest prosta strategia
def strategiaa(stan_gry): ruch = min(random.randint(1,3), stan_gry) return ruch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_categories():\n pass", "def test_get_categories(self):\n pass", "def test_category_manip_pipeline(self):\n raise NotImplementedError(\"\")", "def test_create_category(self):\n pass", "def test_category(self):\n # XXX identifiers would be groovy\n self....
[ "0.7005442", "0.68592596", "0.67686164", "0.64699984", "0.6344549", "0.62875855", "0.6275784", "0.62219745", "0.6193412", "0.6188195", "0.6186761", "0.61033666", "0.60116494", "0.60108453", "0.59562004", "0.59385", "0.5936525", "0.5885948", "0.5882332", "0.5873498", "0.587303...
0.0
-1
Pick GPU if available, else CPU
def get_default_device(): if torch.cuda.is_available(): return torch.device('cuda') else: return torch.device('cpu')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gpu_device_if_present():\n d = dpctl.SyclDevice(\"gpu,cpu\")\n print(\"Selected \" + (\"GPU\" if d.is_gpu else \"CPU\") + \" device\")", "def return_free_GPU():\r\n if torch.cuda.is_available():\r\n gpu_num = torch.cuda.device_count()\r\n device = torch.device('cuda:{}'.format(g...
[ "0.7640736", "0.7275291", "0.7263306", "0.71874255", "0.70942754", "0.70831823", "0.7029543", "0.7010545", "0.69923997", "0.69889635", "0.69889635", "0.69889635", "0.69685453", "0.6955028", "0.6901109", "0.6901109", "0.68919945", "0.68757796", "0.68671566", "0.6804158", "0.67...
0.6680308
27
Move tensor(s) to chosen device
def to_device(data, device): if isinstance(data, (list,tuple)): return [to_device(x, device) for x in data] return data.to(device, non_blocking=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_device(input_tensors: List[torch.Tensor],\n target_device: Optional[torch.device],\n non_blocking: bool = False) -> Iterable[torch.Tensor]:\n return (tensor if tensor.device == target_device or target_device is None\n else tensor.to(target_device, non_b...
[ "0.62680835", "0.5991555", "0.58284396", "0.5823883", "0.57600415", "0.5746575", "0.56958485", "0.56943864", "0.5671953", "0.56672454", "0.56561226", "0.55128235", "0.55102444", "0.5509777", "0.547726", "0.5452295", "0.54366887", "0.53767467", "0.53539515", "0.53539515", "0.5...
0.0
-1
Yield a batch of data after moving it to device
def __iter__(self): for b in self.dl: yield to_device(b, self.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for b in self.dl: \n yield to_device(b, self.device) # yield pauses the execution, not store values in memory, forgets about them once iterated\n # no need to remove batch of data from device, done automatically", "def __iter__(self):\n while True:\n ...
[ "0.8038773", "0.6822095", "0.6774101", "0.6757084", "0.6754781", "0.67486644", "0.66554976", "0.6627214", "0.6619876", "0.65627116", "0.6536915", "0.6529731", "0.6469983", "0.64140165", "0.63782895", "0.6337724", "0.631927", "0.63143736", "0.6306672", "0.62904304", "0.6277047...
0.6813648
5
Shortcut to test "total population" field from the P1 (race) table since this table exists for both 2000 and 2010.
def _test_totalpop(self, obj, known_2000, known_2010): known_delta = known_2010 - known_2000 known_pct = float(known_delta) / float(known_2000) self.assertEqual(float(obj['data']['2000']["P1"]['P001001']), known_2000) self.assertEqual(float(obj['data']['2010']["P1"]['P001001']), known_2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_county(self):\n counties = self.geographies.find({ 'geoid': '15009' })\n\n self.assertEqual(counties.count(), 1)\n\n county = counties[0]\n\n self.assertEqual(county['sumlev'], config.SUMLEV_COUNTY)\n self.assertEqual(county['metadata']['NAME'], 'Maui County')\n s...
[ "0.5652595", "0.5537479", "0.55229443", "0.55086374", "0.54755175", "0.53278923", "0.5322063", "0.53090984", "0.5220111", "0.5202973", "0.51130104", "0.51096696", "0.5104361", "0.5068363", "0.5034627", "0.5024377", "0.50120425", "0.50120425", "0.49283358", "0.49250224", "0.49...
0.6115375
0
Data import test against known values that Hawaii should have.
def test_state(self): states = self.geographies.find({ 'geoid': config.SUMLEV_STATE }) self.assertEqual(states.count(), 1) state = states[0] self.assertEqual(state['sumlev'], config.SUMLEV_STATE) self.assertEqual(state['metadata']['NAME'], 'Hawaii') self.assertEqual(st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_addr_country_good_values(self):\n for input_val, output_val in self.known_values:\n self.line._parse_addr_country(input_val)\n self.assertEqual(output_val, self.line.addr_country)", "def test_csv_reader_data_contents(process_data):\n data = process_data(file_name_or_type=...
[ "0.5858138", "0.5747929", "0.557032", "0.5442017", "0.5428693", "0.54078037", "0.5387139", "0.53781325", "0.53706044", "0.5339871", "0.53369933", "0.5305489", "0.5301975", "0.5299098", "0.5246788", "0.5234629", "0.5231527", "0.52192", "0.52166295", "0.5214664", "0.5204877", ...
0.0
-1