query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Return pretty string representation of x.
def tostr (x): if isinstance (x, tuple): return tuple ( map (tostr, x)) if isinstance(x, (float, numpy.float32,numpy.float64)): return float_to_str(x) return str(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_str(self) -> str:\n ...", "def pprint(x):\n if is_theano_object(x):\n return _gettheano().printing.pprint(x)\n else:\n return str(x)", "def pretty_repr(x: Any, num_spaces: int = 4) -> str:\n\n if isinstance(x, FrozenDict):\n return x.pretty_repr()\n else:\n\n def p...
[ "0.68052506", "0.67240494", "0.6638014", "0.66270936", "0.6526375", "0.64931875", "0.64578533", "0.6433521", "0.637899", "0.63540995", "0.6342875", "0.62580365", "0.6173003", "0.6159281", "0.61371696", "0.6119064", "0.611821", "0.6089578", "0.60637194", "0.60572577", "0.60359...
0.6772707
1
Expand data to given shape by zeropadding.
def expand_to_shape(data, shape, dtype=None, background=None): if dtype is None: dtype = data.dtype if shape==data.shape: return data.astype(dtype) if background is None: background = data.min() expanded_data = numpy.zeros(shape, dtype=dtype) + background slices = [] rhs_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_data(X, orig_shape=(256, 256)):\n\n return X.reshape((-1, *orig_shape, X.shape[-1]))", "def dataset_zeropadding(data, training=True):\n # Flatten Data into 1D Vector\n ##Maximum number of points = 72 , keep around 80 values for even number\n ####max_len = np.max([len(a) for a in arr])\n ...
[ "0.63390535", "0.60706556", "0.594458", "0.57902503", "0.5786774", "0.5715383", "0.5558415", "0.553652", "0.54733175", "0.5471953", "0.54562503", "0.5387259", "0.53608185", "0.536063", "0.5359308", "0.5348232", "0.5347931", "0.53136796", "0.5310307", "0.5289619", "0.5283824",...
0.68397105
0
Return a directory name with suffix that will be used to save data related to given path.
def get_path_dir(path, suffix): if os.path.isfile(path): path_dir = path+'.'+suffix elif os.path.isdir(path): path_dir = os.path.join(path, suffix) elif os.path.exists(path): raise ValueError ('Not a file or directory: %r' % path) else: base, ext = os.path.splitext(path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDirectoryFilename(path):\n\tfrom os.path import splitext\n\tpath = normalizePath(path)\n\treturn splitext(path)[0]", "def data_path(path: str, createdir: bool = False) -> str:\n path_obj = Path(path)\n if not path_obj.is_absolute():\n if inside_project():\n path_obj = Path(project_...
[ "0.7162813", "0.66013575", "0.6581869", "0.64441097", "0.64150935", "0.6364166", "0.633812", "0.6298539", "0.6284165", "0.6278799", "0.62650996", "0.62615657", "0.6255409", "0.62436426", "0.6233815", "0.6168217", "0.61586595", "0.61431384", "0.6131991", "0.61302805", "0.61132...
0.6724265
1
Adds IP block to the assigned IP block of the IPv6 allocator
def add_ip_block(self, ipblock: IPNetwork): if self._assigned_ip_block and ipblock.overlaps( self._assigned_ip_block, ): raise OverlappedIPBlocksError(ipblock) if ipblock.prefixlen > self._ipv6_prefixlen: log_error_and_raise( InvalidIPv6Ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ipv6(self, id_network_ipv6, id_equip, description):\n\n ip_map = dict()\n ip_map['id_network_ipv6'] = id_network_ipv6\n ip_map['description'] = description\n ip_map['id_equip'] = id_equip\n\n code, xml = self.submit({'ip': ip_map}, 'POST', 'ipv6/')\n\n return self....
[ "0.6616031", "0.62040496", "0.60433906", "0.59782785", "0.59601086", "0.59469026", "0.5781444", "0.57143337", "0.56583583", "0.5587608", "0.5586854", "0.550963", "0.5483628", "0.54783916", "0.544025", "0.537757", "0.5374095", "0.5303565", "0.52504593", "0.5202539", "0.5193527...
0.7826192
0
Removes assigned IP block (as it only supports one for now) If force is False, blocks that have any addresses currently allocated will not be removed. Otherwise, if force is True, the indicated blocks will be removed regardless of whether any addresses have been allocated and any allocated addresses will no longer be s...
def remove_ip_blocks( self, ipblocks: List[IPNetwork], force: bool = False, ) -> List[IPNetwork]: if self._assigned_ip_block not in ipblocks: return [] if not force: allocated_ip_block_set = self._store.ipv6_state_map.get_allocated_ip_block_set() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(self, usage_locator, user_id, force=False): # lint-amnesty, pylint: disable=arguments-differ\n if not isinstance(usage_locator, BlockUsageLocator) or usage_locator.deprecated:\n # The supplied UsageKey is of the wrong type, so it can't possibly be stored in this modulestore.\n ...
[ "0.5939767", "0.5938632", "0.56954473", "0.56054527", "0.55543953", "0.55501753", "0.5495851", "0.544292", "0.5290664", "0.52457166", "0.52143854", "0.5211263", "0.5097896", "0.5064577", "0.50482243", "0.50213253", "0.49973372", "0.49596322", "0.49533314", "0.49437845", "0.49...
0.7909288
0
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 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
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 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 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 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 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 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 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
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
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
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
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
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
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
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 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
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
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 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
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
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
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
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
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 Hilo CCD County Subdivision, HI should have.
def test_county_subdivision(self): counties = self.geographies.find({ 'geoid': '1500190630' }) self.assertEqual(counties.count(), 1) county = counties[0] self.assertEqual(county['sumlev'], config.SUMLEV_COUNTY_SUBDIVISION) self.assertEqual(county['metadata']['NAME'], 'Hilo CCD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_census_county_population():\n dataframe = get_county_population_dataframe()\n boulder_county_row = dataframe.loc[dataframe['county_fips'] == 8013]\n boulder_county_population = boulder_county_row.get('county_population')\n assert float(boulder_county_population) == 326196", "def load_unicef_data():\...
[ "0.61219215", "0.58023244", "0.57063735", "0.5699347", "0.56686944", "0.56636924", "0.5659856", "0.5624004", "0.56009614", "0.55768406", "0.55667585", "0.5562145", "0.55168825", "0.546884", "0.54502296", "0.5442449", "0.54413635", "0.5411472", "0.5400325", "0.53584874", "0.53...
0.58564246
1
Verify that a split tract is crosswalked correctly.
def test_tract_split(self): # Check that split tract does not exist in 2010 split_tract = self.geographies.find({ 'geoid': '15003003500' }) self.assertEqual(split_tract.count(), 0) # Validate first new tract from the split tract # Tract 35.01 tract1 = self.geographies.fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_split_feature(tree):\r\n print(\"test_split_feature()...\", end = \"\")\r\n assert (tree.process_split_feature() == True)\r\n print(\"Passed!\")", "def test_tract_split_housing(self):\n # Validate first new tract from the split tract\n # Tract 35.01\n tract1 = self.geograph...
[ "0.60647726", "0.5963358", "0.5910475", "0.56907934", "0.5444362", "0.5392605", "0.53274345", "0.52772987", "0.5269114", "0.525364", "0.52471393", "0.5222307", "0.5215429", "0.5199001", "0.5181526", "0.51758754", "0.5166498", "0.5156083", "0.5148666", "0.51433253", "0.5138643...
0.6179793
0
Verify that a merged tract is crosswalked correctly. TODO test housing
def test_tract_merged(self): # Verify that the first dissolved tract no longer exists tract1 = self.geographies.find({ 'geoid': '15003008607' }) self.assertEqual(tract1.count(), 0) tract2 = self.geographies.find({ 'geoid': '15003008608' }) self.assertEqual(tract2.count(), 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_block_merged(self):\n # Compute crosswalked values\n block1_pop_2000 = 12 # 150010210011329\n block2_pop_2000 = 27 # 150010210011331\n merged_pop_2000 = block1_pop_2000 + block2_pop_2000\n merged_pop_2010 = 78 \n merged_pop_delta = merged_pop_2010 - merged_pop_2...
[ "0.60011363", "0.59322906", "0.5837479", "0.58345", "0.58085495", "0.56822234", "0.5644508", "0.5596146", "0.55923694", "0.5589906", "0.55234635", "0.5479351", "0.5457161", "0.5450034", "0.54229236", "0.5405898", "0.5401507", "0.53951335", "0.53843933", "0.53771603", "0.53687...
0.68002003
0
Verify that the total population of all blocks adds up to the expected amount.
def test_block_sum(self): blocks = self.geographies.find({ 'sumlev': config.SUMLEV_BLOCK }) pop_2010 = sum([int(block['data']['2010']['P1']['P001001']) for block in blocks]) self.assertEqual(pop_2010, 1360301)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_block(self):\n if config.SUMLEV_BLOCK not in config.SUMLEVS:\n pass\n\n blocks = self.geographies.find({ 'geoid': '150010210053029' })\n\n self.assertEqual(blocks.count(), 1)\n\n block = blocks[0]\n\n self.assertEqual(block['sumlev'], config.SUMLEV_BLOC...
[ "0.66755617", "0.6447338", "0.63877445", "0.63238794", "0.630733", "0.6278169", "0.62258786", "0.6192991", "0.6188777", "0.6168206", "0.6166373", "0.61379033", "0.61377835", "0.61257434", "0.61126506", "0.6111476", "0.60747224", "0.60439485", "0.6043113", "0.6012321", "0.5988...
0.69447994
0
Verify that a split block is crosswalked correctly.
def test_block_split(self): block1 = self.geographies.find({ 'geoid': '150010210051016' }) self.assertEqual(block1.count(), 1) block1 = block1[0] split_block_pop = 448 block1_land_pct = float(184458) / 587158 # AREALAND_INT / AREALAND_2000 block1_pop_2000 = int(block1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_xblocks_are_good(self, block):\r\n scope_ids = block.scope_ids\r\n self.assertIsNotNone(scope_ids.usage_id)\r\n self.assertIsNotNone(scope_ids.def_id)\r\n\r\n for child_id in block.children:\r\n child = block.runtime.get_block(child_id)\r\n self.assert_x...
[ "0.6441555", "0.6140265", "0.60267013", "0.5991844", "0.59660476", "0.59307206", "0.5927383", "0.58419365", "0.5799914", "0.5759384", "0.5749067", "0.57229954", "0.57199514", "0.57078195", "0.5696112", "0.56438005", "0.56323946", "0.5596334", "0.5545447", "0.5543341", "0.5539...
0.6697141
0
Verify that a merged block is crosswalked correctly. 150010210011329 + 150010210011331 > 150010210051009
def test_block_merged(self): # Compute crosswalked values block1_pop_2000 = 12 # 150010210011329 block2_pop_2000 = 27 # 150010210011331 merged_pop_2000 = block1_pop_2000 + block2_pop_2000 merged_pop_2010 = 78 merged_pop_delta = merged_pop_2010 - merged_pop_2000 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_block_split(self):\n block1 = self.geographies.find({ 'geoid': '150010210051016' }) \n self.assertEqual(block1.count(), 1)\n block1 = block1[0]\n\n split_block_pop = 448 \n block1_land_pct = float(184458) / 587158 # AREALAND_INT / AREALAND_2000\n block1_pop_2000 ...
[ "0.6599209", "0.6434663", "0.62785393", "0.6059824", "0.60417795", "0.59117043", "0.5910834", "0.5839638", "0.5807155", "0.57834464", "0.5780635", "0.57694", "0.57457066", "0.56926054", "0.56888676", "0.56786174", "0.56585085", "0.564916", "0.5635768", "0.5618506", "0.5567812...
0.78313726
0
Test that the tables documented size matches its actual label count.
def test_table_sizes(self): labels_tables = self.labels.find_one({ 'dataset': 'SF1' })['tables'] for label_data in labels_tables.values(): self.assertEqual(label_data['size'], len(label_data['labels']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_test_data_length(self):\n total_count = 0\n for batch in self._dataset.get_test():\n total_count += len(batch['label'])\n\n self.assertEqual(total_count, self._dataset.get_test_len())", "def test_train_data_length(self):\n total_count = 0\n for batch in self._dataset.get_train():\n ...
[ "0.70430565", "0.65831393", "0.64576143", "0.6415789", "0.6392821", "0.63588977", "0.63588977", "0.6333525", "0.6237331", "0.62271243", "0.6209417", "0.62073797", "0.6188158", "0.61876047", "0.6105959", "0.6100322", "0.6094092", "0.6077378", "0.6064207", "0.60563827", "0.6050...
0.86687344
0
returns True if we need to reoptimize. returns False if we reached a viable solution.
def do_we_need_to_reoptimize(MFE): # check that we found a solution and run optimizer again if not MFE.CalculateMeritFunction() Nop = MFE.NumberOfOperands REOPTIMIZE = False for j in range(6): op = MFE.GetOperandAt(Nop - j) contribution = op.Contribution print("Contribution %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_solve(self):\n return self._solution[\"status\"] == \"optimal\"", "def has_solution(self) -> bool:\n pass", "def is_solved(self):\n self.solved = self.current_pos == self.finish_pos\n return self.solved", "def should_reschedule(self, iteration):\n if not self.max_it...
[ "0.6744845", "0.67123806", "0.6618959", "0.66112566", "0.6573712", "0.6526234", "0.64699936", "0.64646727", "0.64346564", "0.6389327", "0.6386308", "0.6377075", "0.63534486", "0.6308071", "0.63058066", "0.62828004", "0.6271961", "0.62512046", "0.62361073", "0.6218692", "0.621...
0.70585865
0
This is custom assert to compare actual and expected pinterest pin content
def __assert_pinterest_pin(actual_pinterest_pin, expected_pinterest_pin): assert isinstance(actual_pinterest_pin, EPinterestPin) assert actual_pinterest_pin.pin_url == expected_pinterest_pin.pin_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n self.assertEqual(self.post.title, \"Ugandan anthem\")\n self.assertEqual(self.post.body, \"George William Kakoma\")\n self.assertEqual(str(self.post), \"Ugandan anthem - George William Kakoma\")", "def _test_html_content(self, xblock, expected_section_tag, expected_bre...
[ "0.59018815", "0.58148205", "0.5752738", "0.5717734", "0.5668471", "0.5617492", "0.5600811", "0.5596509", "0.55932516", "0.55932516", "0.55932516", "0.55932516", "0.55932516", "0.55932516", "0.55932516", "0.55932516", "0.5588442", "0.5588204", "0.5587021", "0.55467755", "0.55...
0.8085749
0
Check if the caffe version provides all required functions. The deep visualization toolbox requires a modified version of caffe, that supports deconvolution. Without this functions, the toolbox is able to run, but will not provide full functionality. This method will issue a warning, if caffe does not provide the requi...
def _check_caffe_version(self, caffe): if 'deconv_from_layer' in dir(caffe.classifier.Classifier): print "debug[caffe]: caffe version provides all required functions. Good!" else: print "warning: Function 'deconv_from_layer' is missing in caffe. Probably you are using a wrong caf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_supported_features(self):", "def check_model(self):\n layers_map = self.core.query_network(network=self.network,\n device_name=self.device)\n\n unsupported_layers = [\n l for l in self.network.layers.keys() if l not in layers_map\n ...
[ "0.6309257", "0.5592987", "0.5414365", "0.5400118", "0.5359996", "0.5341707", "0.53116417", "0.52959627", "0.524418", "0.52095294", "0.5181111", "0.51800066", "0.5171557", "0.516595", "0.5159423", "0.5142306", "0.51367754", "0.51344347", "0.5122423", "0.5117072", "0.5110706",...
0.86351883
0
Initialize the data mean. The data mean values are loaded from a separate file. Caffe can use thes
def _init_data_mean(self): if isinstance(self.settings.caffevis_data_mean, basestring): # If the mean is given as a filename, load the file try: data_mean = np.load(self.settings.caffevis_data_mean) except IOError: print '\n\nCound not load mea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_train_data(self):\n\n self.train_loader = data.Train_loader(self.N_max, self.n_per_conn,\n self.data_path, self.device)\n self.train_loader.load_data()\n\n # load mean and std\n scc_mean_std = np.loadtxt(\n os.path.join(s...
[ "0.7117414", "0.6322619", "0.6275586", "0.61665565", "0.61113983", "0.6075296", "0.60675895", "0.60323304", "0.6005589", "0.5972925", "0.5936495", "0.593206", "0.5929003", "0.5923068", "0.5913995", "0.5909106", "0.5898676", "0.58928245", "0.5888134", "0.5873146", "0.5871425",...
0.8448032
0
Check the force_backward flag is set in the caffe model definition. Checks whether the given file contains a line with the
def _check_force_backward_true(self): prototxt_file = self.settings.caffevis_deploy_prototxt found = False with open(prototxt_file, 'r') as ff: for line in ff: fields = line.strip().split() if len(fields) == 2 and fields[0] == 'force_backward:' and fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, checkpoint_file_path, output_file):\n\n print('Loading model...')\n self.cfg.data.test.test_mode = True\n self.cfg.model.pretrained = None\n\n model = build_detector(self.cfg.model, train_cfg=None,\n test_cfg=self.cfg.test_cfg)\n f...
[ "0.5316316", "0.5299176", "0.52399695", "0.5212688", "0.518687", "0.5174068", "0.51119065", "0.5104641", "0.508452", "0.5083251", "0.49776924", "0.49598014", "0.49144304", "0.49131376", "0.4904619", "0.48898187", "0.4878091", "0.48573712", "0.48020813", "0.47783345", "0.47759...
0.7716643
0
Get the identifier for the input layer.
def get_input_id(self): return self.net.inputs[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"layer_name\")", "def getId(self):\n return _libsbml.Input_getId(self)", "def layer_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"layer_name\")", "def input_context_id(self) -> uuid.UUID:\n ...
[ "0.7396382", "0.7224933", "0.6950218", "0.678996", "0.6704823", "0.6689467", "0.65569127", "0.65569127", "0.65569127", "0.65165687", "0.65165687", "0.6348905", "0.63131356", "0.63131356", "0.63131356", "0.62872255", "0.62872255", "0.62817043", "0.62789243", "0.6232706", "0.62...
0.7791593
0
Get the shape of the given layer.
def get_layer_shape(self,layer_id): return self.net.blobs[layer_id].data.shape[1:] # Chop off batch size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vshape(self, layer_name):\n if (\n layer_name in self.config[\"layers\"]\n and \"vshape\" in self.config[\"layers\"][layer_name]\n ):\n return self.config[\"layers\"][layer_name][\"vshape\"]\n else:\n return None", "def shape(self):\n re...
[ "0.6944331", "0.6796373", "0.6796373", "0.6788921", "0.67862785", "0.6770543", "0.66934526", "0.66934526", "0.66934526", "0.6661691", "0.66413033", "0.65672153", "0.65354097", "0.65207624", "0.6502295", "0.6502295", "0.64716536", "0.64617896", "0.64338744", "0.6427219", "0.63...
0.7470105
0
Provide diff data for a given layer.
def get_layer_diff(self, layer_id, flatten = False): diff = self.net.blobs[layer_id].diff return diff.flatten() if flatten else diff[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_diff_dc(self):\n self._diff_dc = tuple(encode_differential(self.data[:, 0, 0]))", "def record_from_diff_layer( self, layer_name, layer, text_category, start_new_doc=True ):\n assert isinstance(text_category, str)\n assert len(text_category) > 0\n if layer_name not in self.dif...
[ "0.6205495", "0.59054196", "0.57996625", "0.57300365", "0.56836796", "0.5591027", "0.55622244", "0.54525185", "0.5411178", "0.5383342", "0.53817004", "0.5350295", "0.52542555", "0.5209332", "0.51370484", "0.5130064", "0.5128682", "0.51156783", "0.51114106", "0.5077166", "0.50...
0.6409963
0
Prepare image data for processing and do forward propagation. Uses caffe.transformer.preprocess and caffe.net.forward
def preproc_forward(self, img, data_hw): appropriate_shape = data_hw + (3,) assert img.shape == appropriate_shape, 'img is wrong size (got %s but expected %s)' % (img.shape, appropriate_shape) #resized = caffe.io.resize_image(img, self.net.image_dims) # e.g. (227, 227, 3) data_blob = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caffe_preprocess_and_compute(pimg, caffe_transformer=None, caffe_net=None,\n output_layers=None):\n import caffe # noqa\n\n if caffe_net is not None:\n\n # Grab the default output names if none were requested specifically.\n if output_layers is None:\n ...
[ "0.72574115", "0.71630454", "0.68571496", "0.68417084", "0.67703617", "0.6742037", "0.66416997", "0.66330516", "0.6609757", "0.6579736", "0.65306133", "0.6512324", "0.64565074", "0.6393043", "0.6366664", "0.6346399", "0.63361263", "0.6304797", "0.628596", "0.62672687", "0.625...
0.76032746
0
Checks CreateSymbolicLinkW and CreateHardLinkW result
def _errcheck_link(value, func, args): # pylint: disable=W0613 # The windows api returns nonzero if the call was successful if value != 0: return last_error = ctypes.windll.kernel32.GetLastError() # Somehow CreateSymbolicLinkW and CreateHardLinkW retuns zero # and the last error is 2 (The ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _symlink(source, link_name):\n flags = 0\n\n if source is not None and os.path.isdir(source):\n flags = 1\n\n CreateSymbolicLinkW(link_name, source, flags)", "def IsSymlink(info):\n return (info.external_attr >> 16) == 0120777", "def testIsSymlink(self):\r\n P=lambda p:ufsi.NativeUn...
[ "0.66747856", "0.6535924", "0.65076035", "0.63529927", "0.63279533", "0.62025636", "0.6157352", "0.6096215", "0.60850304", "0.6043955", "0.5876485", "0.58321327", "0.5827599", "0.5806281", "0.57590836", "0.56664973", "0.56608623", "0.5647082", "0.5577218", "0.55411834", "0.54...
0.73756194
0
Gets whether the specified path is symlink
def _islink(path): if not os.path.isdir(path): return False if not isinstance(path, str): path = str(path) attributes = ctypes.windll.kernel32.GetFileAttributesW(path) if attributes == INVALID_FILE_ATTRIBUTES: return False return (attributes & FILE_ATTRIBUTE_REPARSE_POINT)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsSymlink(info):\n return (info.external_attr >> 16) == 0120777", "def islink(self, path):\n return os.path.islink(path)", "def is_symlink(self):\n return self._security_class == \"lnk_file\"", "def islink(self):\n return os.path.islink(self.path)", "def testIsSymlink(self):\r\n ...
[ "0.8075467", "0.805757", "0.804531", "0.776759", "0.7659457", "0.76041", "0.7551097", "0.7407655", "0.69485855", "0.68642277", "0.6857747", "0.68385595", "0.6785136", "0.67650145", "0.6695639", "0.66765994", "0.6640182", "0.66331863", "0.6607957", "0.657642", "0.6508227", "...
0.8072735
1
symlink(source, link_name) Creates a symbolic link pointing to source named link_name
def _symlink(source, link_name): flags = 0 if source is not None and os.path.isdir(source): flags = 1 CreateSymbolicLinkW(link_name, source, flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symlink(source, link_name):\n os_symlink = getattr(os, \"symlink\", None)\n if callable(os_symlink):\n os_symlink(source, link_name)\n else:\n import ctypes\n csl = ctypes.windll.kernel32.CreateSymbolicLinkW\n csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uin...
[ "0.8876452", "0.8523786", "0.8494452", "0.792622", "0.792622", "0.78699785", "0.7556373", "0.74791694", "0.7476503", "0.7431358", "0.74118215", "0.73978883", "0.73689723", "0.7355676", "0.7316988", "0.7311006", "0.72249603", "0.71154326", "0.7024773", "0.6996191", "0.69960237...
0.89284223
0
Logs the given inputs in tabular form according to the specifications
def table_log(self, iteration, dt, name, entity, extra): s = self.__format.format(iteration, dt, name, entity, extra) self.log(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showInput( Tables, LayersInfo ):\n\n Tables[ \"ElasticModulus\" ].fillTableWithBufferData( \"Input\" )\n Tables[ \"ShearModulus\" ].fillTableWithBufferData( \"Input\")\n Tables[ \"PoissonRatios\" ].fillTableWithBufferData( \"Input\" )\n Tables[ \"MaterialProperties\" ].fillTableWithBufferData( \"In...
[ "0.59025437", "0.5595348", "0.5479879", "0.5442281", "0.5421877", "0.54134625", "0.5390005", "0.533628", "0.53107667", "0.52907676", "0.5278041", "0.52709395", "0.52709395", "0.52679795", "0.5247194", "0.5232541", "0.5192523", "0.51739985", "0.51507646", "0.5137148", "0.51252...
0.56412184
1
Records 'string' to the inner message array
def log(self, string): if self.PRINT: print(string) sys.stdout.flush() self.message_list.append(string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(self, string):\n print (string)", "def __add_data(self, string):\n encoded = string.encode()\n header = NTR('data {}\\n').format(len(encoded))\n self.__append(header.encode() + encoded)", "def add_message_to_list(message):\n messages.append(ast.literal_eval(messag...
[ "0.605422", "0.59752476", "0.59538656", "0.58901", "0.5728579", "0.57223994", "0.5720431", "0.56584924", "0.5648494", "0.5642683", "0.5633131", "0.5604764", "0.55973125", "0.5571379", "0.5537977", "0.55165595", "0.55126595", "0.55072063", "0.547958", "0.54738235", "0.5461688"...
0.60436004
1
Returns the equivalent timestamp of just the day
def day_ts(self): return self.raw() // (60 * 24)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())", "def get_timestamp(self, days=1):\n offset = datetime.datetime.utcnow().date() - datetime.timedelta(days=days-1)\n # est = tz.gettz('Europe/Amsterdam')\n # temporary ...
[ "0.67507184", "0.6686723", "0.66458243", "0.66195476", "0.6554564", "0.651344", "0.6512791", "0.6455556", "0.6454444", "0.6416096", "0.64133775", "0.6387338", "0.6334385", "0.63157105", "0.63127744", "0.6266428", "0.6238006", "0.6220144", "0.6213184", "0.61673725", "0.6166025...
0.76245064
0
Turns an integer timestamp to a Time object
def timestamp_to_time(timestamp): n_day = timestamp // (60*24) n_time = timestamp - n_day * (60*24) n_hour = n_time // 60 n_minutes = n_time - n_hour * 60 return Time(n_day, n_hour, n_minutes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _time_from_timestamp(timestamp: int) -> time:\n SECONDS_IN_MINUTE = 60\n SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE\n\n remaining_time = timestamp\n hour, remaining_time = divmod(remaining_time, SECONDS_IN_HOUR)\n minute, second = divmod(remaining_time, SECONDS_IN_MINUTE)\n\n return time(hour, ...
[ "0.75011736", "0.73684907", "0.73529524", "0.7269059", "0.71579236", "0.71579236", "0.6700021", "0.659858", "0.65557265", "0.65520114", "0.6545578", "0.65429866", "0.6487895", "0.64222044", "0.64216304", "0.641571", "0.6412379", "0.63947934", "0.63376164", "0.6257602", "0.623...
0.76291776
0
Apply the sepia tone transformation to the specified image, and return the modified image
def sepia_tone(img): #reading image im = Image.open("filename") #defining sepia sepia = make_linear_ramp((255,240,192)) #converting to grayscale if im.mode != "L": im = im.convert("L") #converting to sepia im.putpalette(sepia) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sepia_filter(image_filename):\n if not os.path.exists(f'{image_filename}'):\n raise FileNotFoundError(f'The input filename, {image_filename}, does not exitst')\n image = cv2.imread(image_filename)\n image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n sepia_matrix = [[0.393, 0.769, 0.189], [...
[ "0.63036513", "0.62655187", "0.61923456", "0.6135245", "0.60255116", "0.60221195", "0.59708905", "0.59675497", "0.58476627", "0.5686066", "0.5636777", "0.5627934", "0.55913067", "0.555422", "0.55318344", "0.55283034", "0.55268687", "0.5449728", "0.5449728", "0.5435592", "0.54...
0.7549688
0
Rotate the specified image 90 degrees to the right and return the modified image
def rotate_right_90(img): #reading image im = Image.open("filename") #flipping image 90 degrees newimg = im.transpose(PIL.Image.ROTATE_90) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotated_image(image):\n orientation = parameter('Orientation',90) # in degrees counter-clockwise\n if orientation == None: orienation = 0\n return image.rotate(orientation)", "def rotate_image(image):\n return tf.image.rot90(image)", "def apply_rotation(image):\n\n\t# Load the image into a new ...
[ "0.81389964", "0.7862073", "0.76297975", "0.74537015", "0.7406075", "0.74016446", "0.73322016", "0.7293305", "0.7235672", "0.72160155", "0.7200374", "0.71974003", "0.71129453", "0.70985675", "0.70875394", "0.70830107", "0.70608974", "0.7029308", "0.70149535", "0.69883496", "0...
0.8637562
0
Apply the red filter transformation to the specified image, and return the modified image
def red_filter(img): #with Image.open(filename) as img: w = img.width h = img.height newimg = Image.new('RGB', (w,h)) for y in range(h): for x in range(w): r, g, b = img.getpixel((x,y)) newimg.putpixel((x, y), (r, 0, 0)) return n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_image(self):\n im = cv2.imread(\"result.png\", 0)\n im2 = cv2.resize(im, (28, 28))\n im = im2.reshape(28, 28, -1)\n im = im.reshape(1, 1, 28, 28)\n im = cv2.bitwise_not(im)\n im = im.reshape(28,28)\n \n with out:\n clear_output()\n ...
[ "0.6625443", "0.6617209", "0.65860623", "0.65070266", "0.65070266", "0.6466145", "0.6289985", "0.6281362", "0.62701166", "0.62686855", "0.6268338", "0.62629455", "0.62200516", "0.61386067", "0.6090802", "0.60895586", "0.6073873", "0.60302836", "0.6029795", "0.59945774", "0.59...
0.7478904
0
Apply the negative transformation to the specified image, and return the modified image
def negative(img): w = img.width h = img.height newimg = Image.new('RGB', (w,h)) for y in range(h): for x in range(w): p = img.getpixel((x,y)) # in mode RGBA, p is a 4-tuple, in mode RGB a 3-tuple newpixel = (255 - p[0], 255 - p[1], 255...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negate_image(p):\n img = read_img(p)\n img_negative = negativo(img.reshape((-1)))\n show_imgs([img, img_negative.reshape(img.shape)])", "def transform(self, previousimage):", "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", ...
[ "0.6982764", "0.68320686", "0.66874176", "0.66874176", "0.6649427", "0.6583862", "0.6541176", "0.6463704", "0.6367161", "0.63568556", "0.6352128", "0.6332034", "0.63253516", "0.63253516", "0.63253516", "0.63253516", "0.63253516", "0.6307967", "0.62963116", "0.6240215", "0.623...
0.71091735
0
Returns the name of the CSV file associated with active monitor.
def monitors_file_name(self) -> str: result = ctypes.c_char_p(self.dss_obj.MonitorsS(ctypes.c_int32(0), ctypes.c_int32(0))) return result.value.decode('ascii')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActiveName(self):\n aw = self.activeWindow()\n if aw:\n return aw.getFileName()\n else:\n return None", "def _get_csv_path(name):\n return os.path.join(cwd, 'output/app_info', name)", "def filename(self):\n return self.system.fileName()", "def monit...
[ "0.60110694", "0.58750284", "0.5766104", "0.56713307", "0.559028", "0.5538154", "0.5519725", "0.55033624", "0.54591256", "0.5454045", "0.5453486", "0.54391897", "0.5412839", "0.5412839", "0.53502816", "0.5346869", "0.5337917", "0.53117466", "0.5284131", "0.5263165", "0.526074...
0.69333947
0
Sends HTTP requests to create mock data according to the given command line options.
def main(option_list: List[str]): if "verbose" in option_list: verbose = True option_list.remove("verbose") else: verbose = False for option in option_list: if option == "mock-departments": create_departments(MOCK_DEPARTMENTS, verbose) elif option == "mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_http_mock(self):\n if self.http_mock is not None:\n return\n\n filename = glob(f\"{DATASET_DIR}/{DATASETS[self.dataset]['file_pattern']}\")\n with open(filename[0]) as csv_file:\n csv_reader = csv.DictReader(csv_file, delimiter=DATASETS[self.dataset]['delimiter...
[ "0.59420115", "0.5708873", "0.5603419", "0.55786556", "0.55075824", "0.5487022", "0.54423136", "0.5397772", "0.53794146", "0.53646374", "0.5362348", "0.53264755", "0.52982754", "0.52700907", "0.52610075", "0.5255256", "0.5237482", "0.5213639", "0.52105945", "0.5188251", "0.51...
0.61405534
0
Allows the return value to be optionally returned as json output with the 'json' flag. When a command fails but still has data to be printed as json, a Two1Error should be raised because it takes an optional json param. This means we can pass any json data using the Two1Error as a vehicle to "return" the json data to t...
def json_output(f): @click.option('--json', default=False, is_flag=True, help='Uses JSON output.') @click.pass_context def _json_output(ctx, json, *args, **kwargs): """ This wrapper disables logging when json is set and restores it after print json value In order for this to work ALL o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _json_output(ctx, json, *args, **kwargs):\n # call early if --json wasn't given as a cmd line arg\n if not json:\n return f(ctx, *args, **kwargs)\n\n # gets the original level so the decorator can restore it\n original_level = logging.getLogger('').manager.disable\n\n ...
[ "0.7699958", "0.652651", "0.61536723", "0.61089456", "0.59036016", "0.58828914", "0.5818656", "0.58150786", "0.58132255", "0.58130234", "0.5793484", "0.5730432", "0.57149374", "0.56762546", "0.56458783", "0.56127894", "0.56077045", "0.55681086", "0.55615586", "0.5533116", "0....
0.6707917
1
This wrapper disables logging when json is set and restores it after print json value In order for this to work ALL output printed to console needs to be done through a logger.
def _json_output(ctx, json, *args, **kwargs): # call early if --json wasn't given as a cmd line arg if not json: return f(ctx, *args, **kwargs) # gets the original level so the decorator can restore it original_level = logging.getLogger('').manager.disable # disable...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_output(f):\n\n @click.option('--json', default=False, is_flag=True, help='Uses JSON output.')\n @click.pass_context\n def _json_output(ctx, json, *args, **kwargs):\n \"\"\" This wrapper disables logging when json is set and restores it after print json value\n\n In order for thi...
[ "0.6563427", "0.637549", "0.5867237", "0.57501084", "0.5654326", "0.5630194", "0.5569698", "0.555525", "0.5553591", "0.55344504", "0.55321467", "0.5526902", "0.55174536", "0.54873204", "0.54290414", "0.54219997", "0.5353988", "0.5306761", "0.5289048", "0.5284649", "0.52789533...
0.6480132
1
Wraps a 21 CLI command in a function that logs usage statistics
def capture_usage(func): def _capture_usage(ctx, *args, **kwargs): """ Captures usages and sends stastics to the 21 api if use opted in Args: ctx (click.Context): cli context object args (tuple): tuple of args of the fuction kwargs (dict): keyword args of the fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_stat(args):", "def usage():", "def usage():", "def usage():\n pass", "def usage():\n return _usage", "def execute_usage_command() -> MarkdownString:\n return execute_help_command(\"usage\")", "def print_usage_command(self):\n print self.get_usage_command()", "def print_usage_c...
[ "0.70189947", "0.6885436", "0.6885436", "0.67559195", "0.6703775", "0.6688787", "0.65517044", "0.65517044", "0.6463498", "0.6448686", "0.6387754", "0.6387754", "0.63705873", "0.63705873", "0.63705873", "0.63705873", "0.63705873", "0.63705873", "0.63705873", "0.63705873", "0.6...
0.70451176
0
Shows the details of a single person by szemelyi_szam
def show_person(szemelyi_szam): conn = get_db() try: cur = conn.cursor() try: # Note: don't use prefixes like "oktatas." above for tables # within your own schema, as it ruins portability cur.execute('SELECT nev FROM oktatas.szemelyek WHERE szemelyi_szam = :sz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_person(uuid=None, fanchart=False):\n t0 = time.time()\n uuid = request.args.get(\"uuid\", uuid)\n fanchart_shown = request.args.get(\"fanchart\", fanchart)\n dbg = request.args.get(\"debug\", None)\n u_context = UserContext(user_session, current_user, request)\n\n with PersonReaderTx(\"r...
[ "0.5745826", "0.57102567", "0.56153953", "0.5596609", "0.5504312", "0.54718465", "0.5425698", "0.54069406", "0.5363168", "0.53174984", "0.53056276", "0.527947", "0.52716875", "0.52642244", "0.5243467", "0.52137864", "0.52009374", "0.5176038", "0.51611185", "0.5152382", "0.514...
0.6907046
1
Lets you test HTTP verbs different from GET, expects and returns data in JSON format
def verb_test(): # it also shows you how to access the method used and the decoded JSON data return jsonify(method=request.method, data=request.get_json(), url=request.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test_two_legged_get(self):\n resp, content = self._two_legged(\"GET\")\n self.assertEqual(int(resp['status']), 200)", "def test_get_method(self):\n self.getPage('/')\n self.assertSta...
[ "0.7386842", "0.7203227", "0.7170921", "0.7162372", "0.7118212", "0.70815897", "0.7051631", "0.69784915", "0.6888869", "0.68721557", "0.68026114", "0.68026114", "0.6785055", "0.6744668", "0.6738315", "0.6706094", "0.6701752", "0.6701752", "0.6683287", "0.6681289", "0.6639867"...
0.7727215
1
applies desired filter and returns a new image
def apply_filter(image, filter): filteredImage = create_image(image) # Apply Filter: # FIXME! return filteredImage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filter(self, image):\n pass", "def apply(filter_fn, img):\n width, height = img.size\n newimg = Image.new(\"RGB\", (width, height))\n for j in range(1, height - 1):\n for i in range(1, width - 1):\n newimg.putpixel((i, j), filter_fn(img, i, j))\n return newimg", "...
[ "0.7991067", "0.7453954", "0.72541666", "0.70461065", "0.70124483", "0.67743874", "0.6765661", "0.67387867", "0.67131186", "0.66427565", "0.66376305", "0.6634414", "0.65986735", "0.65206426", "0.65076965", "0.649829", "0.6451336", "0.64409816", "0.6418331", "0.639753", "0.633...
0.8058654
0
Parse MeSH tree from bin file
def _parse_mesh_bin(self, bin_file, json_file): def _chunks(filename, start): """ Split file into chunks :param filename: :param start: :return: """ with open(filename, 'r') as f: buffer = [] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse(self):\n # raw/objects: detect name, type, use major tag for type as parent node\n # raw/graphics: as object raw, but add TILE_PAGE\n # init: usually flat file, except\n # embark_profiles.txt: [PROFILE] is parent\n # interface.txt: [BIND] is parent (legacy will be...
[ "0.59550416", "0.578597", "0.5505974", "0.544396", "0.5331556", "0.5322069", "0.5312597", "0.52813524", "0.5267293", "0.5237262", "0.5228618", "0.5199379", "0.518287", "0.5182435", "0.5178287", "0.5173431", "0.5137329", "0.51313764", "0.5130195", "0.5124704", "0.5118085", "...
0.6865124
0
Helper function to do mathematical operations /+
def do_math(operator, op1, op2): if operator == "*": return op1 * op2 if operator == "/": return op1 / op2 if operator == "+": return op1 + op2 if operator == "-": return op1 - op2 if operator == "^": return op1**(op2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_operation(operator, num_1, num_2):\n\n if operator == \"*\":\n return num_1 * num_2\n if operator == \"+\":\n return num_1 + num_2\n if operator == \"-\":\n return num_1 - num_2\n if operator == \"/\":\n return num_1 / num_2", "def calculate_expression(number1,...
[ "0.7359163", "0.7181013", "0.7104238", "0.6985625", "0.697319", "0.697319", "0.6970828", "0.6933551", "0.69055194", "0.6828667", "0.67890763", "0.6654178", "0.6600834", "0.657938", "0.6561923", "0.65443194", "0.6537193", "0.6487585", "0.6484884", "0.6473484", "0.6470769", "...
0.7230534
1
Returns a recommendation for a specified user via classical singular value decomposition.
def classical_recommendation(self, user, rank, quantum_format=True): # Make sure the user and rank are ok self._validate_user(user) self._validate_rank(rank) # Do the classical SVD _, _, vmat = np.linalg.svd(self.matrix, full_matrices=True) # Do the projection r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recommend(self, user):\n K = self.n_sim_user\n N = self.n_rec_movie\n rank = dict()\n watched_movies = self.trainset[user]\n\n # v=similar user, wuv=similarity factor\n for v, wuv in sorted(self.user_sim_mat[user].items(),\n key=itemgetter(1...
[ "0.62279725", "0.6218502", "0.593269", "0.58930665", "0.570855", "0.56177104", "0.5597132", "0.5564896", "0.55526376", "0.5535168", "0.5519044", "0.5508257", "0.54996467", "0.5496056", "0.54412323", "0.54394263", "0.5439314", "0.5430811", "0.5413947", "0.5373785", "0.53643227...
0.6778557
0
Validates a user (vector). If an invalid user for the recommendation system is given, a UserError is thrown. Else, nothing happens.
def _validate_user(self, user): # Make sure the user is of the correct type if not isinstance(user, (list, tuple, np.ndarray)): raise UserVectorError("Invalid type for user. Accepted types are list, tuple, and numpy.ndarray.") # Make sure the user vector has the correct length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_user(_):\n pass", "def validate_by_user(self, user, value):\n if not self.validated and not self.destroyed:\n self.parent.logger.write(\"vote\", user, [value, self.createur.identifier])\n if value == 0:\n if self.validator.count(user) > 0:\n ...
[ "0.6562727", "0.605157", "0.5901822", "0.5775897", "0.57269454", "0.56912977", "0.56912977", "0.5518426", "0.5507653", "0.5503397", "0.55014575", "0.54806924", "0.5464648", "0.5460626", "0.54598135", "0.53860456", "0.5361218", "0.53423893", "0.53335655", "0.53295267", "0.5252...
0.8340915
0
Throws a RankError if the rank is not valid, else nothing happens.
def _validate_rank(self, rank): if rank <= 0 or rank > self.num_users: raise RankError("Rank must be in the range 0 < rank <= number of users.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_rank(self, rank: int) -> None:\n if not isinstance(rank, int):\n raise TypeError(\"rank should be an integer\")\n if rank < 0:\n raise ValueError(\"rank cannot be negative\")\n if rank >= self.L**2:\n raise ValueError(f\"rank should be less than {...
[ "0.8221189", "0.6799999", "0.6629772", "0.64921623", "0.6485812", "0.6354266", "0.6354266", "0.6263529", "0.60272527", "0.5991913", "0.59675074", "0.58497083", "0.5840833", "0.58285457", "0.5822559", "0.57317233", "0.56980824", "0.56085336", "0.55671346", "0.5528553", "0.5522...
0.86043864
0
Converts the rank to a ctrl_string for thresholding.
def _rank_to_ctrl_string(rank, length): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __rank_from_int_to_str(rank: int) -> str:\n return str(rank + 1)", "def __str__(self):\n return str(self.rank)", "def _threshold_to_control_string(self, threshold):\n # Make sure the threshold is ok\n if threshold < 0 or threshold > 1:\n raise ThresholdError(\"Argumen...
[ "0.6593619", "0.6022002", "0.56026626", "0.5538748", "0.53891945", "0.5351683", "0.5284331", "0.52622", "0.52310747", "0.5225471", "0.5217082", "0.5201264", "0.51567566", "0.5155428", "0.5123787", "0.51021874", "0.5084797", "0.5050555", "0.50300705", "0.50247926", "0.5008611"...
0.8312594
0
Returns a control string for the threshold circuit which keeps all values strictly above the threshold.
def _threshold_to_control_string(self, threshold): # Make sure the threshold is ok if threshold < 0 or threshold > 1: raise ThresholdError("Argument threshold must satisfy 0 <= threshold <= 1.") # Compute the angle 0 <= theta <= 1 for this threshold singular value theta = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_threshold_str(self):\n if self.unit == ThresholdUnit.PERCENTAGE:\n return f\"{self.threshold}%\"\n return self.threshold", "def _strHard(self):\n if self.checkGreaterThanThreshold:\n operator += \">\"\n else:\n operator += \"<\"\n return \"(Hard) %s %...
[ "0.67489445", "0.64910465", "0.61631197", "0.60861534", "0.60524446", "0.60228556", "0.5994099", "0.5945274", "0.590314", "0.590314", "0.590314", "0.590314", "0.590314", "0.58639866", "0.5801137", "0.5792392", "0.5790814", "0.5790814", "0.57659495", "0.5691014", "0.5691014", ...
0.7095868
0
Generate Campaign Mailer File
def put(self, campaign_id): campaign = Campaign.query.filter_by(public_id=campaign_id).first() if campaign.candidates.count() > 0: campaign.launch_task('generate_mailer_file') return {'success': True, 'message': 'Initiated generate mailer file'}, 200 else: api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendEmail(householdID):\n contactID = mdb.getContact(householdID)\n sqlq = \"\"\"\n SELECT Name, Surname, Address1, Address2, Town, Postcode, email, status\n FROM Contact\n WHERE idContact = '{}';\n \"\"\".format(contactID)\n result = mdb.getSQL(sqlq)[0]\n\n...
[ "0.62662476", "0.6100366", "0.6038897", "0.60258704", "0.6018833", "0.5995741", "0.59857935", "0.59802675", "0.59382075", "0.59136933", "0.5876253", "0.58697945", "0.58588535", "0.585498", "0.5701235", "0.5700115", "0.5661588", "0.5602806", "0.55970114", "0.5536965", "0.55360...
0.6127983
1
Download Generated Campaign Mailer File
def get(self, campaign_id): campaign = Campaign.query.filter_by(public_id=campaign_id).first() if campaign: return send_file(campaign.mailer_file) else: api.abort(404, message='Campaign does not exist', success=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_attachment(self, msg):\n path = None\n for part in msg.walk():\n if part.get_content_type() == 'application/pdf':\n\n time_prefix = datetime.datetime.now().strftime(\"%Y-%m-%dT%H:%M:%S\")\n filename = time_prefix+\"-\"+part.get_filename()\n ...
[ "0.6207587", "0.61629426", "0.61061794", "0.60872763", "0.6069316", "0.6033814", "0.6006443", "0.5982717", "0.5926988", "0.5911624", "0.5889739", "0.5855126", "0.5819009", "0.57935196", "0.5749433", "0.5705398", "0.56524426", "0.5646966", "0.5636374", "0.5617726", "0.5607355"...
0.64709884
0
Assign Candidate Import to Campaign
def put(self, campaign_id, import_id): try: campaign = Campaign.query.filter_by(public_id=campaign_id).first() candidate_import = CandidateImport.query.filter_by(public_id=import_id).first() Candidate.query.filter_by(import_id=candidate_import.id).update({Candidate.campaign_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, campaign_id):\n campaign = Campaign.query.filter_by(public_id=campaign_id).first()\n if campaign.candidates.count() > 0:\n campaign.launch_task('generate_mailer_file')\n return {'success': True, 'message': 'Initiated generate mailer file'}, 200\n else:\n ...
[ "0.57850623", "0.53894794", "0.52772266", "0.52463496", "0.5215476", "0.5212152", "0.51909935", "0.50752306", "0.5036112", "0.5028312", "0.50166535", "0.50076145", "0.4974562", "0.48906434", "0.48841932", "0.48716426", "0.48612928", "0.48469207", "0.48326838", "0.4820747", "0...
0.72279286
0
Delete filters from the pcigale database
def del_filters(fnames): with Database(writable=True) as base: names = base.get_filter_names() for fname in fnames: if fname in names: base.del_filter(fname) print("Removing filter {}".format(fname)) else: print("Filter {} not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_list_filter(self,*args,**kwargs):\n # import pdb;pdb.set_trace()\n if args:\n for arg in args:\n if isinstance(arg,SqliteTable):\n try:\n del session[self.HEADER_NAME][arg.table_name]\n except Exception a...
[ "0.6794046", "0.6666188", "0.64374053", "0.6412906", "0.6134906", "0.612257", "0.60874057", "0.60324705", "0.60267925", "0.6019257", "0.5974808", "0.594915", "0.59430444", "0.59391993", "0.5930648", "0.58455044", "0.5835066", "0.58248544", "0.5820826", "0.58151543", "0.578677...
0.717233
0
Worker to plot filter transmission curves in parallel
def worker_plot(fname): with Database() as base: _filter = base.get_filter(fname) plt.clf() plt.plot(_filter.trans_table[0], _filter.trans_table[1], color='k') plt.xlim(_filter.trans_table[0][0], _filter.trans_table[0][-1]) plt.minorticks_on() plt.xlabel('Wavelength [nm]') plt.ylabel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_filters(fnames):\n if len(fnames) == 0:\n with Database() as base:\n fnames = base.get_filter_names()\n with mp.Pool(processes=mp.cpu_count()) as pool:\n pool.map(worker_plot, fnames)", "def doAllPlots ():\n #df = processIp (\"18-06-01-1-attack.pcap\", \"ec:1a:59:79:f4:...
[ "0.63512516", "0.6205365", "0.61081904", "0.5971916", "0.5961135", "0.5878029", "0.5855526", "0.58490413", "0.5817654", "0.58115464", "0.5803139", "0.5800116", "0.57768595", "0.57581633", "0.5753977", "0.5733456", "0.5699219", "0.56965303", "0.5688704", "0.5669338", "0.566890...
0.69686276
0
Plot the filters provided as parameters. If not filter is given, then plot all the filters.
def plot_filters(fnames): if len(fnames) == 0: with Database() as base: fnames = base.get_filter_names() with mp.Pool(processes=mp.cpu_count()) as pool: pool.map(worker_plot, fnames)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_filters(net, layer, x, y):\n filters = net.layers[layer].w.eval()\n fig = plt.figure()\n for j in range(len(filters)):\n ax = fig.add_subplot(y, x, j)\n ax.matshow(filters[j][0], cmap = matplotlib.cm.binary)\n plt.xticks(np.array([]))\n plt.yticks(np.array([]))\n pl...
[ "0.7144101", "0.68334246", "0.6760905", "0.66760325", "0.64315146", "0.63357484", "0.626112", "0.6214689", "0.6168091", "0.6132944", "0.61184967", "0.61166304", "0.6065469", "0.60580444", "0.60235727", "0.59663427", "0.5963482", "0.5903638", "0.58925027", "0.5876012", "0.5876...
0.70423925
1
Reads ATP matches and parses time into datetime object
def readATPMatchesParseTime(dirname): allFiles = glob.glob(dirname + "/atp_matches_" + "20??.csv") allFiles = allFiles[:-1] ## avoid 2017 since its incomplete matches = pd.DataFrame() container = list() for filen in allFiles: df = pd.read_csv(filen, index_col=None, header=0, parse_dates=[5],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_time(time_string: str) -> datetime:\n\n # Strings with timezone (+01:00) in v2 are not easily parsed. But time\n # zones are not important here, so we just omit them.\n time_string = time_string.rsplit('+')[0]\n\n time_formats = [\n '%Y-%m-%dT%H:%M:%S.%fZ', # Defa...
[ "0.63215744", "0.6218922", "0.620877", "0.60958487", "0.60541457", "0.60302633", "0.6005715", "0.5943619", "0.59128654", "0.59121895", "0.58951235", "0.58806336", "0.58780116", "0.58697003", "0.5864516", "0.5851861", "0.5849143", "0.5806065", "0.5782346", "0.5781294", "0.5772...
0.65270346
0