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
Freelancer submits work for the client to approve.
def request_submission_approval(self, milestone_id, note2client, amount): data = {} data['milestone_id'] = milestone_id data['note2client'] = note2client data['amount'] = amount url = 'fp/submissions' return self.post(url, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve(self):\n self._check_if_open()\n data = {\"approved\": True}\n return self.post(\"approve\", data)", "def test_approve(self):\n\n username,userpass = self.testdata.find_account_for('toolsubmitter')\n\n self.utils.account.login_as(username,userpass)\n\n self.c...
[ "0.70053464", "0.68819475", "0.6813501", "0.67537534", "0.66796976", "0.6598325", "0.6511853", "0.6453754", "0.6377006", "0.6306528", "0.6282506", "0.62592375", "0.6228279", "0.6193639", "0.6178086", "0.6164796", "0.6145355", "0.61233836", "0.6102177", "0.60849494", "0.608254...
0.69773877
1
Get all submissions for specific milestone.
def get_milestone_submissions(self, milestone_id): data = {} url = 'fp/milestones/{0}/submissions'.format(milestone_id) return self.get(url, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_submissions(subreddit, start_date, end_date, limit):\n\n return API.search_submissions(after=start_date, before=end_date,\n subreddit=subreddit, limit=limit)", "def get_all_submissions(self):\n\n submissions = []\n for chump in self.chumps:\n s...
[ "0.6087795", "0.6016333", "0.5785119", "0.57595295", "0.5754489", "0.567518", "0.5617337", "0.54758453", "0.53993785", "0.53712153", "0.5342899", "0.53208053", "0.5313582", "0.53092235", "0.5305582", "0.5304025", "0.528234", "0.5224733", "0.51917493", "0.5191734", "0.5182368"...
0.8213427
0
Get active milestone for specific contract.
def get_active_milestone(self, contract_reference): data = {} url = 'fp/milestones/statuses/active/contracts/{0}'.format(contract_reference) return self.get(url, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLatestMilestone():\n # Use CQ Master target to get latest milestone.\n latest_url = LATEST_URL % {'target': constants.CQ_MASTER}\n gs_ctx = gs.GSContext()\n\n logging.info('Getting latest milestone from %s', latest_url)\n try:\n content = gs_ctx.Cat(latest_url).strip()\n\n # Expected syntax is li...
[ "0.5884148", "0.5760047", "0.56226885", "0.5472332", "0.539106", "0.5107177", "0.5066164", "0.5040432", "0.50038373", "0.4964783", "0.49621624", "0.49297655", "0.4894369", "0.488449", "0.4875231", "0.48544598", "0.48340154", "0.48127288", "0.4737784", "0.4665102", "0.46433663...
0.8093473
0
Strip mathematics, content of chosen sequences, sequences and braces from TeX source.
def stripTex(file): S_TEXT = 0 S_INLINE = 1 S_DISPLAY = 2 S_DOLLAR_IN = 3 S_DOLLAR_OUT = 4 S_SEQUENCE = 5 S_EXPECT_ARG = 6 S_OPTIONAL = 7 # sequences whose 1st argument content is not desired text forbidden = { 'begin', 'end', 'r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detex(tex):\n \n #tex = '\\n'.join(reformat(tex, listed=True)[1:])\n global subs\n \n for old, new in subs.iteritems():\n tex = tex.replace(old, new)\n \n return tex.strip()", "def cleanup_code(self, content):\n\n # remove ```py\\n```\n if content.startswith('```') a...
[ "0.6479548", "0.5733868", "0.5682467", "0.56789285", "0.56783", "0.5668825", "0.56371295", "0.5628203", "0.56041145", "0.55943316", "0.55638814", "0.5480592", "0.5398655", "0.53941464", "0.53648967", "0.5355816", "0.53553224", "0.531055", "0.5261205", "0.5241949", "0.52383715...
0.7133635
0
Splits out the IP, Port, Weight from the server argument for l7pools
def parse_server(ctx, param, values): servers = [] for server in values: splitout = server.split(':') if len(splitout) != 3: raise exceptions.ArgumentError( f"--server needs a port and a weight. {server} improperly formatted") server = { 'address':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pools():\n pools = ch_core.hookenv.action_get('pools')\n if pools:\n return [p.strip() for p in pools.split(',')]\n return None", "def recompose_ip(self, wl):\n ips = []\n r = re.search('([\\d\\.]+)\\(([\\d\\|]+)\\)', wl)\n base = r.group(1)\n items = re.split(...
[ "0.5644854", "0.55139905", "0.53467906", "0.5312967", "0.5159871", "0.51250684", "0.5100258", "0.50839937", "0.49522316", "0.49501953", "0.4949965", "0.49358037", "0.48972043", "0.48684308", "0.48380935", "0.48255715", "0.4824517", "0.48167664", "0.48154384", "0.4813256", "0....
0.5742994
0
Updates a listener's configuration. LISTENER should be a UUID, and can be found from `slcli lb detail `
def edit(env, identifier, listener, **args): mgr = SoftLayer.LoadBalancerManager(env.client) uuid, _ = mgr.get_lbaas_uuid_id(identifier) new_listener = { 'listenerUuid': listener } arg_to_option = { 'frontprotocol': 'frontendProtocol', 'backprotocol': 'backendProtocol', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_listener(self, context, old_listener, listener):\n old_val, new_val = self.get_diff_of_dict(old_listener, listener)\n LOG.info(\"Received request 'Update Listener' for Listener:\"\n \"%(listener)s in LB:%(lb_id)s with new Param:\"\n \"%(new_val)s and old Par...
[ "0.6794243", "0.62666476", "0.61793065", "0.59043264", "0.5821499", "0.56862515", "0.56750363", "0.5674302", "0.56067747", "0.5537184", "0.5383394", "0.53498125", "0.5346392", "0.53355396", "0.52670795", "0.52485996", "0.5239451", "0.5133966", "0.5121427", "0.51119864", "0.51...
0.70541364
0
Removes the listener from identified LBaaS instance LISTENER should be a UUID, and can be found from `slcli lb detail `
def delete(env, identifier, listener): mgr = SoftLayer.LoadBalancerManager(env.client) uuid, _ = mgr.get_lbaas_uuid_id(identifier) try: mgr.remove_lb_listener(uuid, listener) click.secho("Success", fg='green') except SoftLayerAPIError as exception: click.secho(f"ERROR: {exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_listener(self, context, listener):\n LOG.info(\"Received request 'Delete Listener' for LB:%(lb)s \",\n {'lb': listener['loadbalancer_id']})\n arg_dict = {'context': context,\n lb_const.LISTENER: listener,\n }\n self._send_event(l...
[ "0.7619018", "0.72021365", "0.7081414", "0.6927887", "0.6834801", "0.6769346", "0.6714219", "0.66600806", "0.6638011", "0.6612364", "0.6563146", "0.65185297", "0.6517619", "0.65116155", "0.6510315", "0.6408872", "0.6381993", "0.6373163", "0.6372998", "0.6254823", "0.6224056",...
0.77306855
0
Adds a new l7 pool
def l7pool_add(env, identifier, **args): mgr = SoftLayer.LoadBalancerManager(env.client) uuid, _ = mgr.get_lbaas_uuid_id(identifier) pool_main = { 'name': args.get('name'), 'loadBalancingAlgorithm': args.get('method'), 'protocol': args.get('protocol') } pool_members = list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_pool ( self, pool ):\n self._pool_id += 1\n try:\n self._poolstack.append ( pool )\n except:\n self._pool_id -= 1\n raise\n\n self._update_resolver()", "def addpool(miner: Miner, pool):\n api = MinerApi(host=miner.ipaddress, port=int(miner.port))\n jaddp...
[ "0.74670166", "0.6696249", "0.6556804", "0.6373237", "0.62294525", "0.62013334", "0.61743003", "0.61615366", "0.61531955", "0.6117457", "0.5936169", "0.59159166", "0.59124887", "0.5877003", "0.58275515", "0.58268243", "0.58231163", "0.5797193", "0.56864727", "0.5671812", "0.5...
0.8028086
0
Deletes the identified pool Identifier is L7Pool Id. NOT the UUID
def l7pool_del(env, identifier): mgr = SoftLayer.LoadBalancerManager(env.client) try: mgr.del_lb_l7_pool(identifier) click.secho("Success", fg='green') except SoftLayerAPIError as exception: click.secho(f"ERROR: {exception.faultString}", fg='red')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_pool(self, pool):\r\n return self.delete(self.pool_path % (pool))", "def delete(self):\n self._lbcall('delete_pool', [self._name])", "def deletePool(self,ippool_name): \n self.__deletePoolCheckInput(ippool_name)\n ippool_obj=ippool_main.getLoader().getIPpoolByName(ipp...
[ "0.8177328", "0.7949083", "0.7743754", "0.75254697", "0.74241215", "0.73715234", "0.73054725", "0.7275032", "0.7219141", "0.7130311", "0.71098506", "0.70405763", "0.69057125", "0.6834383", "0.66645586", "0.65110606", "0.6488428", "0.6485374", "0.64453715", "0.64181364", "0.63...
0.81102216
1
Return the probability of a trigram
def trigram_prob(self,u,v,w): ################### # Use the trigram_counts to get q(w|u,v) choices = self.trigram_counts[(u,v)] total = sum(choices.values())+sum(self.word_counts.values()) trigram_probability = (self.trigram_counts[(u,v)][w]+1)/float(total) return trigr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_trigram_probability(self, trigram):\n num = self.trigramcounts[trigram]\n den = self.bigramcounts[trigram[:-1]]\n\n # ??? why would there be a case where trigram has length 2 ???\n if len(trigram) == 2:\n print(trigram)\n return self.raw_bigram_probability(...
[ "0.7751923", "0.76878923", "0.7636409", "0.7597849", "0.7516805", "0.7431036", "0.73478115", "0.7341473", "0.73259956", "0.72539866", "0.72048503", "0.7177857", "0.7106165", "0.7045311", "0.7008787", "0.69239146", "0.69228655", "0.68907607", "0.6865925", "0.6857251", "0.68382...
0.7807621
0
print trigrams and their counts
def print_trigrams_count(self): for u_v in self.trigram_counts: for w in self.trigram_counts[u_v]: count=self.trigram_counts[u_v][w] print "{2}\tc({0} {1})".format(u_v,w,count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_trigrams():\n tokenizer = Tokenizer(trigram_freq=0.5)\n X = tokenizer.transform([[\"a b c a b c\"]])\n assert X[\"corpus\"][0] == [\"a_b_c\", \"a_b_c\"]\n assert isinstance(tokenizer.trigrams, pd.DataFrame)", "def count_ngrams(self):\n self.unigram = self.count_unigram(self.word_list)...
[ "0.6398917", "0.61486876", "0.61456525", "0.6103407", "0.60742563", "0.6020676", "0.59596294", "0.59009767", "0.5852056", "0.584664", "0.58018523", "0.57938594", "0.57902086", "0.57824033", "0.57702184", "0.5755301", "0.57186836", "0.56907433", "0.5649752", "0.5608072", "0.56...
0.8932815
0
A MP3 file is being downloaded because there of a SyncDescription. This method get a downloaded music file and searches the SyncDescription which was "responsible" for the music file's download.
def sync_description_for_video_id(self, music_file: DownloadedMusicFile) -> SyncDescription: video_id = music_file.get_video_id() sync_descriptions = self.load_sync_descriptions() for description in sync_descriptions: file_channel_archive = self.file_for_channel_archive(description)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_track(self, track = None, url = None):\n # check that track doesn't exist\n if url == None or track == None:\n return\n\n print \"Retrieving the name of the track.\"\n filename = self.get_track_filename(url)\n\n print \"Filename found: \" + filename\n ...
[ "0.6019038", "0.5953762", "0.5950835", "0.5851799", "0.5833112", "0.582813", "0.57368785", "0.57094854", "0.56998867", "0.56914955", "0.5675499", "0.5610916", "0.56106955", "0.56062835", "0.5562782", "0.5531623", "0.552138", "0.550489", "0.54986244", "0.54729104", "0.5463579"...
0.6188046
0
The empty string is not an IPv6 address literal.
def test_empty(self): self.assertFalse(isIPv6Address(""))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_ipv6_address(\n ip_str, unpack_ipv4=False, error_message=_(\"This is not a valid IPv6 address.\")\n):\n try:\n addr = ipaddress.IPv6Address(int(ipaddress.IPv6Address(ip_str)))\n except ValueError:\n raise ValidationError(error_message, code=\"invalid\")\n\n if unpack_ipv4 and ad...
[ "0.69366324", "0.69032264", "0.6863372", "0.6833882", "0.6812875", "0.67084074", "0.66962737", "0.6655872", "0.66131544", "0.65501314", "0.6547397", "0.6505707", "0.64604706", "0.6450955", "0.62647307", "0.6258979", "0.62298465", "0.6160988", "0.61486316", "0.6139477", "0.613...
0.81282455
0
An otherwise valid IPv6 address literal may also include a C{"%"} followed by an arbitrary scope identifier.
def test_scopeID(self): self.assertTrue(isIPv6Address("fe80::1%eth0")) self.assertTrue(isIPv6Address("fe80::2%1")) self.assertTrue(isIPv6Address("fe80::3%en2"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalidWithScopeID(self):\n self.assertFalse(isIPv6Address(\"%eth0\"))\n self.assertFalse(isIPv6Address(\":%eth0\"))\n self.assertFalse(isIPv6Address(\"hello%eth0\"))", "def format_url_address(address):\n try:\n addr = netaddr.IPAddress(address)\n if addr.version ==...
[ "0.6570045", "0.6097962", "0.5951029", "0.5886211", "0.54803467", "0.53652436", "0.5291592", "0.52783734", "0.52346325", "0.5228517", "0.5217647", "0.51812303", "0.51507074", "0.50619113", "0.5045487", "0.5031636", "0.5029411", "0.49807203", "0.49727854", "0.4952022", "0.4949...
0.6768701
0
An otherwise invalid IPv6 address literal is still invalid with a trailing scope identifier.
def test_invalidWithScopeID(self): self.assertFalse(isIPv6Address("%eth0")) self.assertFalse(isIPv6Address(":%eth0")) self.assertFalse(isIPv6Address("hello%eth0"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scopeID(self):\n self.assertTrue(isIPv6Address(\"fe80::1%eth0\"))\n self.assertTrue(isIPv6Address(\"fe80::2%1\"))\n self.assertTrue(isIPv6Address(\"fe80::3%en2\"))", "def is_valid_ipv6_address(address, allow_brackets = False):\n\n if allow_brackets:\n if address.startswith('[') ...
[ "0.664798", "0.6541076", "0.64991224", "0.62932837", "0.6253037", "0.6219661", "0.5915969", "0.589761", "0.5897295", "0.58603305", "0.58561504", "0.5848769", "0.5847096", "0.5829653", "0.58218837", "0.57730556", "0.57442063", "0.57431483", "0.5640292", "0.562629", "0.55638087...
0.72068405
0
Map (P_fn, b) over basis_elt. Generic adem basis elements alternate [b_0, P_1, b_1, ..., P_n, b_n]. Apply P_fn to P_i and if b_i is a 1 replace it with b, otherwise drop it.
def adem_basis_elt_generic_map(*, P_fn, b, basis_elt): Ps = [P_fn(P) for P in basis_elt[1::2]] bs = [b if epsilon else None for epsilon in basis_elt[ ::2]] result = [None] * len(basis_elt) result[1::2] = Ps result[ ::2] = bs return [x for x in result if x is not None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adem_basis_elt_2_map(*, Sq_fn, basis_elt):\r\n return [Sq_fn(Sq) for Sq in basis_elt]", "def map(self, function=lambda item: item):\n for i, row in enumerate(self):\n for j, item in enumerate(row):\n row[j] = function(item)", "def apply(self,i,x):\n #applies the i...
[ "0.7101953", "0.5635103", "0.52208865", "0.52161103", "0.5214447", "0.51587725", "0.51167256", "0.5001927", "0.49330238", "0.49207336", "0.49103978", "0.49085516", "0.48984176", "0.4893959", "0.48832047", "0.4866596", "0.48661175", "0.48558724", "0.48434997", "0.48409623", "0...
0.794436
0
Map Sq_fn over basis_elt We don't actually use this since it seems silly.
def adem_basis_elt_2_map(*, Sq_fn, basis_elt): return [Sq_fn(Sq) for Sq in basis_elt]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adem_basis_elt_generic_map(*, P_fn, b, basis_elt):\r\n Ps = [P_fn(P) for P in basis_elt[1::2]]\r\n bs = [b if epsilon else None for epsilon in basis_elt[ ::2]]\r\n result = [None] * len(basis_elt)\r\n result[1::2] = Ps\r\n result[ ::2] = bs\r\n return [x for x in result if x is not None]", ...
[ "0.62987316", "0.5471408", "0.53439796", "0.53395426", "0.5315071", "0.5250455", "0.5165612", "0.5135809", "0.51355493", "0.51285654", "0.5109317", "0.51041394", "0.51037663", "0.5101545", "0.50495", "0.50141466", "0.49532974", "0.49482656", "0.49316648", "0.4930328", "0.4926...
0.82150215
0
Multiply monomials m1 and m2 and write the result in the Adem basis for p = 2.
def product_2(m1, m2): return make_mono_admissible_2(list(m1) + list(m2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Multiply(M1,M2):\r\n M3=[]\r\n w=0\r\n while w<len(M2[0]):\r\n tap=[]\r\n t=0\r\n while t<len(M2):\r\n tap.append(M2[t][w])\r\n t=t+1\r\n M3.append(tap)\r\n w=w+1\r\n M=[]\r\n # Multiplying matrices\r\n k=0\r\n sums=0\r\n while k<...
[ "0.63990766", "0.6220588", "0.61849815", "0.61759233", "0.61419266", "0.6095974", "0.6068614", "0.6066465", "0.60507303", "0.60430276", "0.60147953", "0.5993608", "0.5992707", "0.5939356", "0.59325916", "0.59205264", "0.591044", "0.59056205", "0.5866907", "0.5812846", "0.5792...
0.6638194
0
Multiply monomials m1 and m2 and write the result in the Adem basis. This is a dispatch to product_2 and product_generic.
def product(m1, m2, *, algebra): if algebra.generic: return product_generic(m1, m2, algebra.p) else: return product_2(m1, m2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_2(m1, m2):\r\n return make_mono_admissible_2(list(m1) + list(m2))", "def matrix_mult(m1, m2):\n pass", "def Multiply(M1,M2):\r\n M3=[]\r\n w=0\r\n while w<len(M2[0]):\r\n tap=[]\r\n t=0\r\n while t<len(M2):\r\n tap.append(M2[t][w])\r\n t=t+1\...
[ "0.7025518", "0.6690894", "0.66277486", "0.6581569", "0.6568176", "0.6566743", "0.6516602", "0.6422083", "0.63616985", "0.632454", "0.6263163", "0.6245209", "0.6222676", "0.62163186", "0.6145855", "0.61392516", "0.60905725", "0.60873526", "0.60873526", "0.6052474", "0.6048148...
0.6928319
1
Get the basis for the n dimensional part of the Steenrod algebra. Build basis recursively. last = last term. last is >= bound, and we will append (last,) to the end of elements from basis (n last, bound=2 last). This means that 2 last <= n last, or 3 last <= n.
def basis_2(n, *, bound=1): if n == 0: return ((),) result = [(n,)] for last in range(bound, 1 + n // 3): for vec in basis_2(n - last, bound=2 * last): result.append(vec + (last,)) return tuple(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basis_generic(n, *, p, bound=1):\r\n if n == 0:\r\n return ((0,),) # \r\n if n == 1:\r\n return ((1,),)\r\n result = []\r\n \r\n # append P^{last} beta^{epsilon}\r\n for epsilon in [0,1]:\r\n # Without this lower bound edge case we lose the element (0, 1, 1) in degree...
[ "0.6352027", "0.62040514", "0.61184764", "0.6047273", "0.5897896", "0.5890074", "0.5885658", "0.57801056", "0.5759169", "0.5620241", "0.5595064", "0.5581936", "0.5580318", "0.55353695", "0.54639876", "0.54491794", "0.54146963", "0.5369703", "0.5367151", "0.5311752", "0.529558...
0.63450444
1
Adem basis in dimension `n`. Dispatch to basis_2 and basis_generic.
def basis(n, *, algebra): if algebra.generic: return basis_generic(n, p=algebra.p) else: return basis_2(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_basis(n, dim):\n planes = [np.random.randn(dim) for i in range(n)]\n return [p / np.linalg.norm(p) for p in planes]", "def basis_fns(n=0):\n return lambda x: np.sum(x ** (n+1), axis=1)", "def __init__(self, dimension, n):\n self.dimension = dimension\n self.n = n\n se...
[ "0.65958965", "0.6492095", "0.6303911", "0.6270258", "0.61579895", "0.5821242", "0.5714319", "0.5677949", "0.5546939", "0.5542931", "0.5516291", "0.54665136", "0.5442311", "0.5409004", "0.53772366", "0.5372782", "0.53276885", "0.5309369", "0.5297436", "0.52918196", "0.5289455...
0.7017382
0
Function that takes a number of nodes and returns a dictionary corresponding to a complete directed graph with the specified number of nodes
def make_complete_graph(num_nodes): digraph = {} if num_nodes < 1: return digraph else: edges = set(range(num_nodes)) for node in range(num_nodes): digraph[node] = edges.difference(set([node])) return digraph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_complete_graph(num_nodes):\n\tif num_nodes <= 0:\n\t\treturn {}\n\tdict_graph = {}\n\tfor node in range(num_nodes):\n\t\tnode_set = set()\n\t\tfor neighbor in range(num_nodes):\n\t\t\tif node != neighbor:\n\t\t\t\tnode_set.add(neighbor)\n\t\tdict_graph[node] = node_set\n\n\treturn dict_graph", "def make...
[ "0.8063795", "0.80589145", "0.80342263", "0.7942149", "0.78811663", "0.7867539", "0.7648591", "0.7568491", "0.75270027", "0.747973", "0.7331694", "0.7331694", "0.72387207", "0.72387207", "0.6977525", "0.69037884", "0.68886876", "0.6683224", "0.6630526", "0.6614204", "0.656334...
0.8065373
0
return json User objects
def user_ret(): user_list = [] all_objs = storage.all("User") for obj in all_objs.values(): user_list.append(obj.to_dict()) return jsonify(user_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userJSON():\n user = session.query(User).all()\n result = []\n\n for i in user:\n result += [i.serialize]\n\n return jsonify(Users=result)", "def json(self):\n result = {}\n for user in self.users:\n result[user.user_id] = user.json\n return result", "def ...
[ "0.82542247", "0.8115099", "0.7857184", "0.78480744", "0.7821726", "0.77648944", "0.7681941", "0.7616825", "0.7609725", "0.76026094", "0.760245", "0.7591317", "0.75394744", "0.75233406", "0.74818206", "0.7444616", "0.74334586", "0.7428471", "0.7423055", "0.7418192", "0.741690...
0.81571275
1
Creates a grade dict from an assignment form.
def form_to_grade_assignment(form): grade_id = "{student}-{assignment}-{course}".format(**form) grade = { "_id": grade_id, "student": form["student"], "assignment": form["assignment"], "course": form["course"], } if form["filename"]: grade["filename"] = form["file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_to_grade_row(form):\n course = form[\"course\"]\n student = form[\"student\"]\n assignment, _, _ = form[\"assignment\"].partition(\"[\")\n rowdata = json.loads(form[\"rowdata\"])\n grade = {\"student\": student, \"assignment\": assignment, \"course\": course}\n grade[\"_id\"] = \"{studen...
[ "0.69196707", "0.5971959", "0.58035874", "0.5640746", "0.5462263", "0.53878474", "0.5296486", "0.52632314", "0.52490896", "0.5249011", "0.52386457", "0.520961", "0.5207413", "0.516837", "0.51675934", "0.51528466", "0.51475215", "0.51040614", "0.5026935", "0.5017392", "0.49985...
0.7986096
0
Creates a grade dict from a row form.
def form_to_grade_row(form): course = form["course"] student = form["student"] assignment, _, _ = form["assignment"].partition("[") rowdata = json.loads(form["rowdata"]) grade = {"student": student, "assignment": assignment, "course": course} grade["_id"] = "{student}-{assignment}-{course}".form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dict(row):\n return dict((key[0], value) for key, value in zip(colnames, row))", "def get_row_dict(self, row):\n return self.get_dict(self.possibles[row], \"R\", row)", "def form_to_grade_assignment(form):\n grade_id = \"{student}-{assignment}-{course}\".format(**form)\n grade = {\...
[ "0.66509485", "0.65499103", "0.6370172", "0.62290734", "0.62213093", "0.6178408", "0.6127212", "0.6040272", "0.6037651", "0.5976455", "0.59096533", "0.58915955", "0.57766086", "0.5749406", "0.57470036", "0.57470036", "0.57470036", "0.57335395", "0.57335395", "0.5705864", "0.5...
0.75859386
0
Inserts a grade into the database.
def insert_grade(grade, form, rc): dbname = form["dbname"] collname = "grades" try: coll = rc.client[dbname][collname] except (KeyError, AttributeError): abort(404) try: added = rc.client.insert_one(dbname, collname, grade) except Exception: traceback.print_exc() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_grade(github, title, grade):\n QUERY = \"\"\"\n INSERT INTO Grades VALUES (?, ?, ?)\n \"\"\"\n\n db_cursor.execute(QUERY, (github, title, grade))\n db_connection.commit()\n\n print \"Successfully graded %s with a %s on %s\" % (github, grade, title)", "def assign_grade(github, tit...
[ "0.80697274", "0.7878323", "0.74185586", "0.6426635", "0.633985", "0.6160498", "0.6142165", "0.6109473", "0.6094631", "0.60664976", "0.6057973", "0.60507387", "0.60427445", "0.601331", "0.5962537", "0.5918605", "0.58787453", "0.5862085", "0.5807437", "0.5785798", "0.5780195",...
0.82849544
0
stripchars() Finds and replaces incompatible characters within all .txt files in the '\abstracts' directory. renameid() Renames files, stripping anything from filename after ID.
def main(): target_folder = r'Abstracts cleanup\abstracts\*.txt' try: stripchars(target_folder) except Exception as e: print(e) pass # renameid(target_folder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processFilename(filename):\n\n badchars = [\" \", \",\", \"+\", \"$\", \"_\", \"{\", \"}\", \"/\", \"&\"]\n fn = filename\n for bc in badchars:\n fn = fn.replace(bc, \"\")\n return fn", "def main():\n print(\"Current directory is\", os.getcwd())\n os.chdir('Lyrics/Lyrics')\n\n for...
[ "0.5564704", "0.547632", "0.54744965", "0.54623824", "0.5450538", "0.53844106", "0.5332848", "0.5256203", "0.5069885", "0.5069885", "0.5069355", "0.505932", "0.50335646", "0.501821", "0.50090104", "0.50069124", "0.4984751", "0.49745655", "0.49716756", "0.49537197", "0.4936913...
0.77768743
0
Iterator of the known sessions
def sessions(self): for session_id in self.get_sessions(): session = Session(self.session_cache, self.sid, session_id) yield session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_sessions():\n return iter(_session_stack)", "def itersessions(self):\n for x in np.unique(self.sessions):\n yield x, self.loc[self.sessions == x, :]", "def _sessions(self):\n return self.__sessions", "def sessions(self):\n return list(Session.get_sessions(self))", ...
[ "0.8693743", "0.7763374", "0.7717324", "0.7705798", "0.7550476", "0.75504535", "0.7429118", "0.74133444", "0.7401458", "0.7400774", "0.7281079", "0.7247437", "0.7214192", "0.69058543", "0.68678856", "0.6845615", "0.6703754", "0.6695977", "0.66274714", "0.6570915", "0.6526649"...
0.81237054
1
Parses and verifies a cookie value
def parse_cookie(self, value): if not value: return None parts = value.split("|") if len(parts) != 3: return None # verify the cookie signature if self.cookie_signature(parts[0], parts[1]) != parts[2]: raise Exception("Invalid cookie signature ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_cookie(request):\n\n raw_cookie = request.message.get('Cookie','')\n return SimpleCookie(raw_cookie)", "def _parse_cookie(self, request, response, cookie_header_value):\n try:\n # Note to self: This line may print some chars to the console\n return parse_cookie(cookie...
[ "0.680252", "0.6738563", "0.66854155", "0.66783154", "0.66516906", "0.6612051", "0.65850097", "0.6554575", "0.6554575", "0.65137666", "0.6496006", "0.64937854", "0.64632916", "0.6395168", "0.6386337", "0.63724625", "0.63631266", "0.63494116", "0.632701", "0.6297578", "0.62615...
0.72712016
0
Generates a cookie signature.
def cookie_signature(self, *parts): sha1 = hmac.new(self._secret, digestmod=hashlib.sha1) for part in parts: sha1.update(part) return sha1.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_signature(seed, *parts):\n sha1 = hmac.new(seed, digestmod=hashlib.sha1)\n for part in parts:\n if part:\n sha1.update(part)\n return sha1.hexdigest()", "def gen_sig():\n return hashlib.md5(\n (\n app.config[\"ROVI_API_KEY\"]\n + app.config[\"...
[ "0.753487", "0.7067199", "0.66266114", "0.6580719", "0.6503767", "0.6412105", "0.6123159", "0.60631573", "0.60524225", "0.6045356", "0.60235345", "0.6020113", "0.5952092", "0.59324956", "0.5925662", "0.5920742", "0.590129", "0.5891545", "0.58810997", "0.58740246", "0.58721316...
0.75094354
1
Transforms a json File containing installations informations into a list of installation objects >>> un = UnSerializerInstallation() >>> un.unSerialize("../test/testInstallation.json") >>> un.collection[0].InsNbPlaceParking '50'
def unSerialize(self): if path == None: path = UnSerializerActivity.path try: with open(path) as data: json_data = json.load(data) for item in json_data["data"]: inst = Installation(item["ComLib"],item["ComInsee"],item["InsCodePostal"],item["InsLieuDit"] ,item["InsNoVoie"],item["InsLibel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unserialise_installations_json(pathName):\n to_return = []\n\n try:\n with open(pathName) as json_file:\n json_data = json.load(json_file)\n\n for install in json_data[\"data\"]:\n to_return.append(Installations(\n install[\"InsNumeroInstall\...
[ "0.6997117", "0.5583104", "0.5576178", "0.5314316", "0.53104264", "0.529952", "0.52950263", "0.5268388", "0.5228337", "0.508466", "0.504718", "0.5035551", "0.50244963", "0.5004995", "0.49929768", "0.49869066", "0.49772638", "0.4975984", "0.49379867", "0.49078247", "0.48976195...
0.7680823
0
Returns the image and its label at the index 'ind' (after applying transformations to the image, if specified).
def __getitem__(self, ind): image = Image.open(os.path.join(self.root_dir,self.image_fns[ind])) #If a transform is specified, apply it if self.transform is not None: image = self.transform(image) # Verify that image is in Tensor format #if type(image) is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, idx):\n img = self.images[idx]\n label = self.labels[idx].split(\" \")[-1]\n img = Image.open(img)\n img = img.convert('RGB')\n img = self.transform(img)\n return(img, label[:-1])", "def __getitem__(self, ind):\n image = np.array([self.data[...
[ "0.7585008", "0.7584966", "0.73006594", "0.70862544", "0.7072327", "0.68898976", "0.68424433", "0.67992413", "0.6772978", "0.6754025", "0.6753745", "0.6637847", "0.66045636", "0.65445894", "0.6364122", "0.6302416", "0.62756693", "0.6274071", "0.62737787", "0.62412", "0.619360...
0.77679193
0
Test EventStreams with url from site.
def test_url_from_site(self, key): site = self.get_site(key) streams = 'recentchange' e = EventStreams(site=site, streams=streams) self.assertEqual( e._url, 'https://stream.wikimedia.org/v2/stream/' + streams) self.assertEqual(e._url, e.url) self.assertEqual(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_with_streams(self):\n streams = 'recentchange'\n e = EventStreams(streams=streams)\n self.assertEqual(\n e._url, 'https://stream.wikimedia.org/v2/stream/' + streams)\n self.assertEqual(e._url, e.url)\n self.assertEqual(e._url, e.sse_kwargs.get('url'))\n ...
[ "0.7481012", "0.7062626", "0.6835958", "0.6751704", "0.6703934", "0.64298284", "0.63931566", "0.63698363", "0.6357172", "0.6342528", "0.6255347", "0.61820084", "0.61741704", "0.6110761", "0.6060046", "0.6060046", "0.6050001", "0.6006673", "0.5970618", "0.5941284", "0.59273326...
0.73900414
1
Test EventStreams with url from default site.
def test_url_with_streams(self): streams = 'recentchange' e = EventStreams(streams=streams) self.assertEqual( e._url, 'https://stream.wikimedia.org/v2/stream/' + streams) self.assertEqual(e._url, e.url) self.assertEqual(e._url, e.sse_kwargs.get('url')) self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_missing_streams(self):\n with self.assertRaises(NotImplementedError):\n EventStreams()", "def test_url_from_site(self, key):\n site = self.get_site(key)\n streams = 'recentchange'\n e = EventStreams(site=site, streams=streams)\n self.assertEqual(\n ...
[ "0.7300169", "0.69946647", "0.68183845", "0.68033665", "0.65966797", "0.657555", "0.65181506", "0.6353719", "0.6353719", "0.6330753", "0.62743527", "0.62625444", "0.6214412", "0.61807495", "0.61765236", "0.6149776", "0.59979254", "0.5985642", "0.5975823", "0.5968839", "0.5920...
0.74042183
0
Test EventStreams with multiple streams.
def test_multiple_streams(self): streams = ('page-create', 'page-move', 'page-delete') e = EventStreams(streams=streams) combined_streams = ','.join(streams) self.assertEqual( e._url, 'https://stream.wikimedia.org/v2/stream/' + combined_streams) self.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_streams(self, dummy_streamers, dummy_receivers):\n dummy_ids = [source_id for _, _, source_id, _ in dummy_streamers]\n source_ids = [receiver._source_id\n for _, receiver in dummy_receivers.items()]\n assert set(source_ids) == set(dummy_ids)", "async de...
[ "0.709718", "0.7045089", "0.68629783", "0.6817295", "0.67916495", "0.65646744", "0.6538408", "0.6466485", "0.64646655", "0.64532644", "0.64400244", "0.6437063", "0.642483", "0.64189976", "0.6392507", "0.6370093", "0.63654864", "0.6338461", "0.62697303", "0.62565124", "0.62128...
0.812604
0
Test EventStreams with url from site with missing streams.
def test_url_missing_streams(self): with self.assertRaises(NotImplementedError): EventStreams()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_with_streams(self):\n streams = 'recentchange'\n e = EventStreams(streams=streams)\n self.assertEqual(\n e._url, 'https://stream.wikimedia.org/v2/stream/' + streams)\n self.assertEqual(e._url, e.url)\n self.assertEqual(e._url, e.sse_kwargs.get('url'))\n ...
[ "0.7969818", "0.73117185", "0.7227417", "0.664857", "0.6638547", "0.64848655", "0.6393822", "0.6392778", "0.63857347", "0.6359634", "0.6291006", "0.62475723", "0.62436795", "0.6234471", "0.6136316", "0.6136007", "0.6119837", "0.61162955", "0.6111094", "0.608338", "0.6051383",...
0.81596744
0
Test EventStreams timeout value.
def test_timeout_setting(self): self.assertEqual(self.es.sse_kwargs.get('timeout'), config.socket_timeout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_timeout(self) -> Optional[pulumi.Input['DurationArgs']]:\n return pulumi.get(self, \"test_timeout\")", "def test_timeout(self) -> Optional[pulumi.Input['DurationArgs']]:\n return pulumi.get(self, \"test_timeout\")", "def test_timeout(self) -> 'outputs.DurationResponse':\n return p...
[ "0.7090183", "0.7090183", "0.68827915", "0.68827915", "0.68628806", "0.68519783", "0.66885316", "0.6631813", "0.6575541", "0.6501257", "0.64762914", "0.6457156", "0.6440145", "0.6437468", "0.64241856", "0.64007854", "0.6395541", "0.63854843", "0.6382834", "0.63294137", "0.631...
0.7940405
0
Test EventStreams filter settings.
def test_filter_settings(self): self.es.register_filter(foo='bar') self.assertTrue(callable(self.es.filter['all'][0])) self.es.register_filter(bar='baz') self.assertLength(self.es.filter['all'], 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_filter(self, none_type, all_type, any_type, result):\n self.es.filter = {'all': [], 'any': [], 'none': []}\n self.es.register_filter(lambda x: none_type, ftype='none')\n self.es.register_filter(lambda x: all_type, ftype='all')\n if any_type is not None:\n self.es.re...
[ "0.6936592", "0.69136494", "0.68039805", "0.6733757", "0.6596865", "0.6570705", "0.6478815", "0.6402157", "0.6372731", "0.63112175", "0.62709296", "0.61745006", "0.6166551", "0.6156711", "0.6093567", "0.60266864", "0.5937779", "0.5915515", "0.5845479", "0.5836323", "0.5827848...
0.7220615
0
Test EventStreams filter all function.
def test_filter_function_all(self): self.es.register_filter(lambda x: True) self.assertTrue(self.es.streamfilter(self.data)) self.es.register_filter(lambda x: False) self.assertFalse(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_filter(self, none_type, all_type, any_type, result):\n self.es.filter = {'all': [], 'any': [], 'none': []}\n self.es.register_filter(lambda x: none_type, ftype='none')\n self.es.register_filter(lambda x: all_type, ftype='all')\n if any_type is not None:\n self.es.re...
[ "0.77774274", "0.76616883", "0.7252225", "0.71493006", "0.69759494", "0.69710374", "0.6735299", "0.6721623", "0.671708", "0.6675768", "0.6571128", "0.655881", "0.651373", "0.65121555", "0.6465832", "0.6444786", "0.643058", "0.6394015", "0.6354946", "0.6305483", "0.63004845", ...
0.83218205
0
Test EventStreams filter any function.
def test_filter_function_any(self): self.es.register_filter(lambda x: True, ftype='any') self.assertTrue(self.es.streamfilter(self.data)) self.es.register_filter(lambda x: False, ftype='any') self.assertTrue(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_function_all(self):\n self.es.register_filter(lambda x: True)\n self.assertTrue(self.es.streamfilter(self.data))\n self.es.register_filter(lambda x: False)\n self.assertFalse(self.es.streamfilter(self.data))", "def _test_filter(self, none_type, all_type, any_type, resu...
[ "0.8067357", "0.8008988", "0.76024616", "0.6966291", "0.6937647", "0.6935507", "0.6891078", "0.68547994", "0.6800666", "0.6789117", "0.6758554", "0.6741513", "0.6719263", "0.6610594", "0.65932226", "0.6562112", "0.6465409", "0.64569443", "0.63503873", "0.62503487", "0.6247966...
0.82227045
0
Test EventStreams filter none function.
def test_filter_function_none(self): self.es.register_filter(lambda x: False, ftype='none') self.assertTrue(self.es.streamfilter(self.data)) self.es.register_filter(lambda x: True, ftype='none') self.assertFalse(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_filter(self, none_type, all_type, any_type, result):\n self.es.filter = {'all': [], 'any': [], 'none': []}\n self.es.register_filter(lambda x: none_type, ftype='none')\n self.es.register_filter(lambda x: all_type, ftype='all')\n if any_type is not None:\n self.es.re...
[ "0.7962954", "0.7779999", "0.75724334", "0.7487395", "0.7410826", "0.7252385", "0.723975", "0.6878008", "0.6869562", "0.669162", "0.6551662", "0.644308", "0.638963", "0.63646346", "0.63293976", "0.6323907", "0.63005215", "0.6296376", "0.627124", "0.6240032", "0.6220857", "0...
0.8336108
0
Test EventStreams filter with assignment of an int value.
def test_filter_value(self): self.es.register_filter(foo=10) self.assertFalse(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_true(self):\n self.es.register_filter(foo=True)\n self.assertTrue(self.es.streamfilter(self.data))", "def test_filter_sequence_true(self):\n self.es.register_filter(bar=('foo', 'bar', 'baz'))\n self.assertTrue(self.es.streamfilter(self.data))", "def test_filter_funct...
[ "0.6781209", "0.6612637", "0.6382851", "0.63438815", "0.62980855", "0.62586474", "0.61791056", "0.6133874", "0.6049616", "0.6016297", "0.5830464", "0.57639474", "0.5736903", "0.5674254", "0.5672789", "0.56098026", "0.5580512", "0.5575643", "0.55115247", "0.55025834", "0.54811...
0.76163733
0
Test EventStreams filter with assignment of a sequence.
def test_filter_sequence_false(self): self.es.register_filter(bar=list('baz')) self.assertFalse(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_sequence_true(self):\n self.es.register_filter(bar=('foo', 'bar', 'baz'))\n self.assertTrue(self.es.streamfilter(self.data))", "def test_filter_value(self):\n self.es.register_filter(foo=10)\n self.assertFalse(self.es.streamfilter(self.data))", "def test_filter_true(...
[ "0.7480587", "0.631979", "0.63094825", "0.630064", "0.6229207", "0.62180775", "0.59581566", "0.59251046", "0.59033144", "0.58696556", "0.57505023", "0.57444876", "0.5740344", "0.57033825", "0.570173", "0.56660205", "0.56613576", "0.56367373", "0.5618477", "0.5604387", "0.5603...
0.68394476
1
Test EventStreams filter with assignment of a sequence.
def test_filter_sequence_true(self): self.es.register_filter(bar=('foo', 'bar', 'baz')) self.assertTrue(self.es.streamfilter(self.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_sequence_false(self):\n self.es.register_filter(bar=list('baz'))\n self.assertFalse(self.es.streamfilter(self.data))", "def test_filter_value(self):\n self.es.register_filter(foo=10)\n self.assertFalse(self.es.streamfilter(self.data))", "def test_filter_true(self):\n...
[ "0.6839882", "0.63193744", "0.63094485", "0.6301365", "0.62288755", "0.6219979", "0.5957509", "0.5924198", "0.5902188", "0.58685464", "0.57498527", "0.5746132", "0.5741277", "0.5704606", "0.57019025", "0.5666215", "0.566152", "0.5637792", "0.56193954", "0.5604694", "0.5602622...
0.7480586
0
Test EventStreams filter with multiple arguments.
def test_filter_multiple(self): self.es.register_filter(foo=False, bar='baz') self.assertFalse(self.es.streamfilter(self.data)) self.es.filter = {'all': [], 'any': [], 'none': []} self.es.register_filter(foo=True, bar='baz') self.assertTrue(self.es.streamfilter(self.data)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_filter(self, none_type, all_type, any_type, result):\n self.es.filter = {'all': [], 'any': [], 'none': []}\n self.es.register_filter(lambda x: none_type, ftype='none')\n self.es.register_filter(lambda x: all_type, ftype='all')\n if any_type is not None:\n self.es.re...
[ "0.73427314", "0.72020984", "0.7167585", "0.70557195", "0.6797048", "0.6734244", "0.6645825", "0.66414756", "0.6572019", "0.653977", "0.6431853", "0.6312299", "0.6298566", "0.6192424", "0.6158068", "0.6146278", "0.6141409", "0.61395323", "0.61179775", "0.60769707", "0.6067759...
0.7342077
1
This method selects the game type, the standard game or a default version where the user can select lenght of code and what numbers to include
def select_game_type(self): print('Please secect game type.\n' + 'NOTE! only standard game saves highscore') print('1. Standard game') print('2. Custom game, set your rules') print('0. Back to main menu') answer = InputHandler.input_integer_range('Your choice: ', 0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_game():\r\n game = input('choose a game :\\n *TicTacToe (1)\\n\\n *Nim (2)\\n\\n *Othello (3)\\n\\n *Puissance4 (4)\\n\\n *chess (5)')\r\n if game == '1':\r\n return tictactoe\r\n elif game == '2':\r\n return nim_game\r\n elif game == '3':\r\n return othello\r\n elif ...
[ "0.6393351", "0.6387377", "0.63826907", "0.6039702", "0.59779155", "0.589456", "0.5878415", "0.58534694", "0.58445454", "0.5796118", "0.5719777", "0.57154363", "0.56996566", "0.56939584", "0.5680214", "0.566861", "0.56489444", "0.5643704", "0.5640862", "0.5637051", "0.5613982...
0.7425328
0
This method runs the game using the bool custom to determing game type. It will create an object of Mastermind based on value of custom. It will then update scores, ask for another game and call itself using custom for same gametype in loop
def run_game(self, custom=False): # used for determining saving highscore or not self.custom = custom game = None if not custom: game = Mastermind() else: # The user gets to set custom rules for the game correct_range = False while not correct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_game(self):\n game = Poker()\n AI_win = game.play_round(self.name)\n self.update_scores(AI_win)\n message = 'Would you like to play another round? Y(es) or N(o): '\n answer = InputHandler.input_bool(message)\n if answer:\n self.run_game()", "def run_ga...
[ "0.6436216", "0.6383936", "0.6263446", "0.6183765", "0.61579436", "0.6104631", "0.6084379", "0.593151", "0.5889294", "0.58867204", "0.5882432", "0.5864209", "0.58618486", "0.582254", "0.58143973", "0.58041996", "0.57793134", "0.57723457", "0.5766427", "0.5762397", "0.5761544"...
0.7992603
0
Checks if the current user has permission to edit the given dataset.
def has_edit_permissions(ps_or_token, selected_dataset_id): try: role = pennsieve_get_current_user_permissions(selected_dataset_id, ps_or_token)["role"] except Exception as e: abort(500, "Could not get permissions for this dataset.") return role in ["owner", "manager"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkPermissionEditUsers(self):\n user = self.REQUEST.AUTHENTICATED_USER\n\n return bool(user.has_permission(eionet_edit_users, self))", "def edit_allowed(self):\n account = Account.current_user_account\n if account is None:\n return False\n return self.user_can_edit(account.user)...
[ "0.73684084", "0.7314556", "0.7221785", "0.718398", "0.71801096", "0.7136714", "0.703597", "0.7032112", "0.69825906", "0.69658035", "0.6953812", "0.69154143", "0.68954784", "0.68173236", "0.6797478", "0.67713076", "0.6757528", "0.6735634", "0.66979504", "0.66878027", "0.66732...
0.84489244
0
Check if exist bluetooth pairing failed window in current page
def handle_pairing_window(self, wait_time=5): logger.info("Handling bluetooth pairing prompt") sleep(1) try: self.wait_till_element_to_be_visible(self.driver.appium_driver, self.bluetooth_pair_button, wait_time) except Exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bt_unpair(self, target):\n is_target_unpaired = False\n try:\n # if phone is not paired with any device, return True\n any_paired_device = self.find_element(self.driver.appium_driver, self.paired_device_list, 0)\n wait(2)\n if any_paired_device is None:...
[ "0.5990399", "0.59855914", "0.58938396", "0.58894676", "0.578745", "0.5731907", "0.5639497", "0.56267965", "0.5602063", "0.5560094", "0.5515805", "0.55017823", "0.5442884", "0.5395704", "0.53537095", "0.53509915", "0.5342693", "0.5328098", "0.5326035", "0.5306663", "0.5292037...
0.66436934
0
Checks if the phone is paired with the last address we attempted a pairing operation with. To be used directly after pair(mac) or unpair(mac).
def bt_is_paired(self): is_paired = False try: self.show_more_for_paired_devices() self.wait_till_element_to_be_visible(self.driver.appium_driver, self.paired_device_list, 5) pair_device_list = self.find_elements(self.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_paired(self, phone):\n bt_util = BTUtils()\n target_addr = self.dut.bluetooth_address\n return bt_util.android_device_in_paired_state(phone, target_addr)", "def has_been_paired():\n # This forces a load from the identity file in case the pairing state\n # has recently changed\n ...
[ "0.7128904", "0.70029426", "0.6926195", "0.6679933", "0.6630855", "0.63567245", "0.6187539", "0.60254407", "0.59765", "0.5807887", "0.5801837", "0.56981874", "0.560043", "0.55862856", "0.55387974", "0.5527718", "0.5525297", "0.5495494", "0.5479396", "0.53446454", "0.53356194"...
0.7010961
1
Get list of discovered blutooth devices on mobile device
def bt_get_discovered_devices(self): discovered_bluetooth_device = [] try: self.bt_radio('on') if '8.1' in self.phone_info.os_version: self.wait_till_element_to_be_visible(self.driver.appium_driver, self.bluetoo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_mobile_global_beacons():\n return GlobalBeacon.list_mobile()", "def get_devices(self):\n return self.api_request('GET', self.url + '/device', {})", "def list_devices():\r\n DeviceManagerCLI.BuildDeviceList()\r\n return DeviceManagerCLI.GetDeviceList()", "async def find_devices() -> L...
[ "0.6909028", "0.6836376", "0.6818698", "0.68010455", "0.6787019", "0.67741495", "0.67020565", "0.669887", "0.6642634", "0.6622597", "0.66008425", "0.6589596", "0.6583874", "0.6577444", "0.65751064", "0.6569571", "0.6566964", "0.65413487", "0.651726", "0.65085953", "0.6506465"...
0.6911494
0
Start Bluetooth discovery on phone
def bt_start_discovery(self): is_start_discovery = False try: is_bluetooth_on = self.bt_radio('on') if '8.1' in self.phone_info.os_version: self.wait_till_element_to_be_visible(self.driver.appium_driver, self.bl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover(bt_addr):\n print \"performing inquiry...\"\n nearby_devices = bluetooth.discover_devices(lookup_names = True)\n print \"Found %d devices\" % len(nearby_devices)\n \n for addr, name in neaby_devices:\n print \" %s - %s\" % (addr, name)", "def device_discovery(endless):\r\n c...
[ "0.66967946", "0.6670762", "0.6263368", "0.618207", "0.61527777", "0.6101039", "0.59816295", "0.5966792", "0.5943673", "0.5851195", "0.583917", "0.5830259", "0.57935345", "0.5790345", "0.5767885", "0.56893414", "0.5688346", "0.5644812", "0.56335336", "0.5622003", "0.56168526"...
0.72633237
0
Stop Bluetooth discovery on phone
def bt_stop_discovery(self): is_stop_discovery = False try: is_bluetooth_off = self.bt_radio('off') if is_bluetooth_off: logger.debug("Bluetooth discovery Stoped {}".format( self.phone_info.bluetooth_name)) is_stop_discovery = T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n # Unregister ourselves with the XBee Device Manager instance:\n self.__xbee_manager.xbee_device_unregister(self)\n return True", "def stopAll():\n \n # Get paired and connected devices\n pairedDevices, connectedDevices = getPairConDevices()\n \n print('\\nSto...
[ "0.67808104", "0.6609006", "0.64793354", "0.64446414", "0.63968825", "0.6179201", "0.6133089", "0.6108425", "0.6105471", "0.6102414", "0.6078803", "0.6070525", "0.6045644", "0.60309994", "0.6012417", "0.6008918", "0.59882665", "0.5976908", "0.5957209", "0.59390825", "0.592763...
0.7281296
0
Tests if phone is connected to a specific bluetooth device
def bt_is_connected_to(self, blutooth_connected_device_name): bt_is_connected = False logger.debug("Checking if Phone is connected to {!r}".format( blutooth_connected_device_name)) try: bt_is_connected = self.bt_is_connected() logger.debug("Is the phone conne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bt_is_connected(self):\n try:\n is_bluetooth_on = self.bt_enabled()\n\n # if bluetooth is OFF then throw Exception\n if not is_bluetooth_on:\n logger.error(\"The bluetooth is disabled on {}\".format(self.phone_info.bluetooth_name))\n\n self....
[ "0.76891696", "0.7073294", "0.6921121", "0.6748067", "0.66977954", "0.6673443", "0.66152287", "0.6541235", "0.6521378", "0.6482565", "0.6402953", "0.64011633", "0.6394357", "0.6369237", "0.6361586", "0.6347135", "0.63391274", "0.63338757", "0.629647", "0.6224777", "0.6150923"...
0.75018513
1
Tests if phone is not connected to a specific bluetooth device
def bt_is_not_connected_to(self, bluetooth_not_connected_device_name): try: is_bt_connected_to_device = self.bt_is_connected_to( bluetooth_not_connected_device_name) if not is_bt_connected_to_device: logger.debug( 'Bluetooth is not conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bt_is_connected(self):\n try:\n is_bluetooth_on = self.bt_enabled()\n\n # if bluetooth is OFF then throw Exception\n if not is_bluetooth_on:\n logger.error(\"The bluetooth is disabled on {}\".format(self.phone_info.bluetooth_name))\n\n self....
[ "0.6554116", "0.6459646", "0.6418169", "0.6350835", "0.632681", "0.62795407", "0.62670743", "0.62643623", "0.6235742", "0.6226124", "0.61696416", "0.6103744", "0.6090443", "0.6086667", "0.60765886", "0.6050864", "0.604585", "0.6026215", "0.6014424", "0.60113806", "0.6004195",...
0.72711813
0
Set Buletooth Name of Mobile Device.
def set_name(self, set_device_name): is_device_name_set = False if self.phone_info.phone_type == PhoneType.IOS: is_general_visible = False try: try: # verify that General Button self.find_element(self.driver.appium_driver, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_user_changes_the_name_of_the_device(name):\n web_app.change_property_softassert(\"name\",name)", "def set_husb_name(self, h, line_number=0):\n self.husb_name = h\n self._husb_name = line_number", "def set_service_name(name):\n emit(UPDATE_SERVICE_SIGNAL, BREADCRUMB_SENDER, name=name...
[ "0.6283922", "0.6186607", "0.6144288", "0.6112249", "0.59848183", "0.5911058", "0.58778536", "0.5868408", "0.5848298", "0.5848298", "0.5848298", "0.5848298", "0.5808407", "0.5796167", "0.5793217", "0.5782618", "0.57755697", "0.57703006", "0.5767888", "0.5767599", "0.5767599",...
0.69250643
0
Get bluetooth MAC addrress of Mobile Device.
def get_mac(self): bluetooth_mac_address = '' is_general_visible = False if self.phone_info.phone_type == PhoneType.IOS: try: try: # verify that General Button is visible self.find_element(self.driver.appium_driver, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMac(self):\n # Import netifaces here to prevent error importing this module in setup.py\n import netifaces\n interfaces = ['eth0', 'wlan0']\n try:\n interfaces.append(netifaces.gateways()['default'][netifaces.AF_INET][1])\n except:\n pass\n for...
[ "0.7543795", "0.7485377", "0.7469252", "0.74010116", "0.73277986", "0.7310747", "0.7210467", "0.71960765", "0.71960765", "0.71486706", "0.70828235", "0.70595086", "0.70355076", "0.69185084", "0.6892908", "0.6890958", "0.68855166", "0.68241364", "0.68089026", "0.6738221", "0.6...
0.7547702
0
Airplane Mode in mobile device
def set_airplane_mode(self, action): is_action_performed = False is_airplane_mode_on_off_visible = False settings_more_button = \ 'self.android_locators.SETTINGS_MORE_BUTTON_ByXPATH' airplane_mode_on_off_toggle = \ 'self.android_locators.AIRPLANE_MODE_ON_OFF_ByI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _arm_and_offboard(self):\n arming_client = rospy.ServiceProxy('/mavros/cmd/arming', CommandBool)\n set_mode_client = rospy.ServiceProxy('/mavros/set_mode', SetMode)\n\n offb_set_mode = SetMode()\n offb_set_mode.custom_mode = \"OFFBOARD\"\n\n arm_cmd = CommandBool()\n a...
[ "0.5949399", "0.5559423", "0.5521669", "0.5517303", "0.5516471", "0.5408404", "0.5400011", "0.53811467", "0.5377833", "0.53648144", "0.53482664", "0.53304946", "0.52924544", "0.5291542", "0.52402145", "0.52201784", "0.52087885", "0.52014166", "0.51950693", "0.5189626", "0.517...
0.71507704
0
Enable/Disable Contact sharing on Mobile device ex. phone_obj.bluetooth.enable_contact_sharing('KLEOS',True)
def enable_contact_sharing(self, dut_name, enable=False): try: is_device_connected = self.bt_is_connected_to(dut_name) if is_device_connected is False: logger.warning( "Currently no bluetooth device is connected with" " {}".format(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_disable_media_sharing(self, dut_name, enable=True):\n try:\n is_bluetooth_button__visible = self.__verify_current_screen()\n if not is_bluetooth_button__visible:\n self._go_to_bluetooth_button()\n\n self.wait_till_element_to_be_visible(self.driver.a...
[ "0.622553", "0.5562689", "0.5413457", "0.5413457", "0.53648555", "0.52825093", "0.5253237", "0.5244934", "0.52176595", "0.5212403", "0.5204729", "0.5198043", "0.51253", "0.51239824", "0.5117424", "0.5071274", "0.5070263", "0.50200707", "0.5019455", "0.50189924", "0.50056666",...
0.7482193
0
Set Call Routing option on iOS Mobile device ex. phone_obj.bluetooth.select_call_audio_routing('automatic')
def select_call_audio_routing(self, target_type): is_action_performed = False try: call_audio_routing_status = self.get_audio_call_routing_status() if target_type.lower() not in call_audio_routing_status.lower(): if not self._is_audio_call_routing_option_availalbl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_call_forwarding_busy(self, dtmf_code: str, number: str) -> None:", "def set_routing(self, rinfo):\n\n self.routing = [ self.Routing(*r) for r in rinfo ]", "def phone_config(self, sip_server: str = \"\") -> None:", "def call_home_phone(self, sender, message):\n if self.home_phone:\n ...
[ "0.5423326", "0.5412785", "0.53772193", "0.53401875", "0.5183472", "0.5178245", "0.5069476", "0.5050856", "0.5033115", "0.5030598", "0.49928564", "0.4977638", "0.49533805", "0.4948706", "0.4892624", "0.48704916", "0.48552707", "0.4847174", "0.47952464", "0.47616562", "0.47191...
0.6607859
0
Enable/Disable Media sharing on Mobile device ex. phone_obj.bluetooth.enable_disable_media_sharing('KLEOS',True)
def enable_disable_media_sharing(self, dut_name, enable=True): try: is_bluetooth_button__visible = self.__verify_current_screen() if not is_bluetooth_button__visible: self._go_to_bluetooth_button() self.wait_till_element_to_be_visible(self.driver.appium_drive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_contact_sharing(self, dut_name, enable=False):\n try:\n is_device_connected = self.bt_is_connected_to(dut_name)\n if is_device_connected is False:\n logger.warning(\n \"Currently no bluetooth device is connected with\"\n \...
[ "0.62880474", "0.59915227", "0.5709176", "0.56337523", "0.557575", "0.55689085", "0.55470765", "0.5503501", "0.54586434", "0.54444385", "0.54250693", "0.53110087", "0.5295516", "0.5264291", "0.5264291", "0.5259133", "0.5258376", "0.52491593", "0.5245353", "0.51939344", "0.512...
0.76120937
0
Enable/Disable Media Sync Volume on Mobile device ex. phone_obj.bluetooth.set_media_volume_sync(enable=True)
def set_media_volume_sync(self, dut_name, enable=True): try: if self.phone_info.phone_type == PhoneType.ANDROID and 'SM' in self._get_android_phone_model(): is_bt_connected_to_device = self.bt_is_connected_to(dut_name) if not is_bt_connected_to_device: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_disable_media_sharing(self, dut_name, enable=True):\n try:\n is_bluetooth_button__visible = self.__verify_current_screen()\n if not is_bluetooth_button__visible:\n self._go_to_bluetooth_button()\n\n self.wait_till_element_to_be_visible(self.driver.a...
[ "0.65493476", "0.63896316", "0.6337036", "0.62550724", "0.6208844", "0.6174221", "0.6143452", "0.6109035", "0.60698545", "0.60579324", "0.6046454", "0.6025239", "0.60240513", "0.6016948", "0.6011351", "0.59646314", "0.5930123", "0.5896877", "0.5860657", "0.58456665", "0.57859...
0.81021565
0
Returns all the rects that ants have updated on screen and clears update array. Used for screen update optimization
def GetRectUpdates(cls): temp = [] temp += cls.updateArray cls.updateArray.clear() return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_statuses(self):\n if self.skill_tree_displaying:\n return\n _, self.buff_rects, self.debuff_rects = player_panel_renderer.draw_status(self.player_dict['status']['buffs'],\n self.player_dict['status...
[ "0.6439309", "0.6139465", "0.6006498", "0.5894537", "0.5695805", "0.56834847", "0.56322706", "0.561175", "0.5580826", "0.55793214", "0.5508129", "0.54993623", "0.5488387", "0.5486736", "0.54347324", "0.5434304", "0.54333586", "0.5427185", "0.5426566", "0.54118574", "0.5411804...
0.7783788
0
Kills all living ants within the given Rect
def KillAntsInRect(cls, givenRect=pygame.Rect(1,1,1,1)): assert type(givenRect) == pygame.Rect for a in cls.antArray: if givenRect.x+givenRect.w > a.x >= givenRect.x and givenRect.y+givenRect.h > a.y >= givenRect.y: a.isAlive = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def die(self):\n self.pjs.bombermen.remove(self)\n for block in self.physics.blocks[self.stype]:\n if block == self.rects[0]:\n self.physics.blocks[self.stype].remove(block)", "def kill(self, enemys):\n for enemy in enemys:\n for bullet in self.bullets:\n...
[ "0.59094775", "0.5874609", "0.58699363", "0.58131564", "0.5798624", "0.57615143", "0.57418394", "0.57174635", "0.57074404", "0.56431526", "0.5636674", "0.5634212", "0.55774325", "0.5563028", "0.5563028", "0.5557454", "0.5555643", "0.5487772", "0.5455775", "0.5404981", "0.5395...
0.7688294
0
Ant turns left and moves its current step that direction
def MoveLeftStep(self): if self.facing == 0: self.facing = 3 self.x -= self.stepLeft elif self.facing == 1: self.facing = 0 self.y -= self.stepUp elif self.facing == 2: self.facing = 1 self.x += self.stepRight elif s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left(self):\n self.yaw_motor.step_backward()", "def turn_left(self):\n temp = self.direction[0]\n self.direction[0] = self.direction[1]\n self.direction[1] = -temp", "def go_left(self):\n self.change_x = -6\n self.direction = \"L\"", "def left(self, angle):\...
[ "0.73117554", "0.726275", "0.7228604", "0.7218252", "0.71775174", "0.71680087", "0.7089251", "0.70846677", "0.6892116", "0.6867011", "0.6843716", "0.6843561", "0.6814537", "0.68001723", "0.67373395", "0.6727266", "0.67113245", "0.66811067", "0.66772133", "0.66585416", "0.6652...
0.7978667
0
Ant turns right and moves its current step that direction
def MoveRightStep(self): if self.facing == 0: self.facing = 1 self.x += self.stepLeft elif self.facing == 1: self.facing = 2 self.y += self.stepUp elif self.facing == 2: self.facing = 3 self.x -= self.stepRight elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self, angle):\r\n self.dir += math.radians(angle)", "def move_right(self):\n self.yaw_motor.step_forward()", "def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direction[1]\n self.direction[1] = temp", "def go_right(self):\n self....
[ "0.7485096", "0.7361091", "0.7325981", "0.73201174", "0.7136343", "0.69774735", "0.69543254", "0.6937253", "0.6920816", "0.6871856", "0.67709595", "0.6770527", "0.6758423", "0.6755053", "0.6742616", "0.67374164", "0.673683", "0.67274386", "0.6718059", "0.6709373", "0.6685019"...
0.79314137
0
Moves one space in the current ant direction facing
def MoveCurrentSpace(self): if self.facing == 0: self.y -= 1 elif self.facing == 1: self.x += 1 elif self.facing == 2: self.y += 1 elif self.facing == 3: self.x -= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveForward(self):\n if self.onGround:\n self.vx = 4", "def MoveLeftStep(self):\n if self.facing == 0:\n self.facing = 3\n self.x -= self.stepLeft\n elif self.facing == 1:\n self.facing = 0\n self.y -= self.stepUp\n elif self....
[ "0.6722689", "0.66532195", "0.657839", "0.65178674", "0.6484474", "0.6473384", "0.6455628", "0.6454375", "0.6426206", "0.64156604", "0.641183", "0.6391002", "0.6372444", "0.6338004", "0.63118315", "0.6276108", "0.6261837", "0.6261837", "0.6241037", "0.62397355", "0.62006986",...
0.762536
0
Ant will move a random direction by one space
def MoveRandom(self): r = random.randint(0,3) if r == 0: self.x += 1 elif r == 1: self.y += 1 elif r == 2: self.x -= 1 elif r == 3: self.y -= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_move(turtle, distance):\n angle = uniform(-90,90)\n d = uniform(0,distance)\n turtle.left(angle)\n turtle.forward(d)", "def setRandDirection(self):\n phi = 2*math.pi*random.random()\n u = 2*random.random() - 1\n v = math.sqrt(1-u*u)*math.cos(phi)\n w = math.sqrt(1-u*u)*...
[ "0.78114086", "0.7343114", "0.73377156", "0.7268426", "0.7248032", "0.7119226", "0.703144", "0.70097953", "0.6923677", "0.6908911", "0.68940854", "0.68913585", "0.67954284", "0.6795343", "0.67691827", "0.6748331", "0.6713536", "0.668025", "0.6644184", "0.6639902", "0.66380334...
0.75118154
1
Toggles the ant to show its position with a color
def ShowAnt(self, ShouldShow): if ShouldShow: self.TempScreenColor = self.display.get_at((self.x,self.y)) Ant.updateArray.append(pygame.Rect(self.x,self.y,1,1)) self.display.fill(Colors.A_red, ((self.x,self.y), (1,1))) elif pix == Colors.A_Fire: self.isAli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_color_arrow():\n global index_picker\n offset = 0\n if index_picker % 2 == 1:\n offset = 4\n for i in range(3):\n for j in range(2):\n sense.set_pixel(i+1+offset, j, [100, 100, 200])if ARROW[j][i] == 1 else sense.set_pixel(i+1+offset, j, [0, 0, 0])", "def toggle_co...
[ "0.6351094", "0.6189249", "0.6142086", "0.58642226", "0.5844731", "0.5740332", "0.5705326", "0.5699827", "0.5691193", "0.5687006", "0.56764317", "0.5641515", "0.5641049", "0.5637626", "0.56320447", "0.5620738", "0.5613831", "0.5603704", "0.55606014", "0.5553713", "0.55270195"...
0.7177802
0
Spawns ant in game and turns the current mouse pos to color of ant
def Spawn(self): if len(Ant.antArray) < Ant.antLimit: Ant.antArray.append(self) self.display.set_at((self.x,self.y), Colors.A_Wood) pygame.display.update(pygame.Rect(self.x,self.y,1,1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Spawn(self):\n if len(Ant.antArray) < Ant.antLimit:\n Ant.antArray.append(self)\n self.display.set_at((self.x,self.y), Colors.A_black)\n pygame.display.update(pygame.Rect(self.x,self.y,1,1))", "def Spawn(self):\n if len(Ant.antArray) < Ant.antLimit:\n ...
[ "0.6759585", "0.6687633", "0.65759635", "0.653857", "0.65238696", "0.65196604", "0.64285827", "0.64246964", "0.60423154", "0.58290994", "0.5784844", "0.5715071", "0.5691323", "0.568023", "0.56258106", "0.56255716", "0.55967313", "0.55849224", "0.55729926", "0.5561677", "0.554...
0.6703439
1
Return True if `self` is compatible to `other`.
def is_compatible_to(self, other: 'Signature') -> bool: if self is other or self == other: return True # self.return_type must be compatible to other.return_type self_return_type, other_return_type = (self.return_type, other.return_type)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compatible(self, other: 'Reaction') -> bool:\n return self.lhs.compatible(other.lhs) and self.rhs.compatible(other.rhs)", "def is_same_type_as_other(cls, other):\r\n return isinstance(other, cls)", "def is_compatible(self, other):\n return self.intervals == other.intervals and\\\n ...
[ "0.7865186", "0.75270057", "0.7411802", "0.73771805", "0.7337953", "0.7326996", "0.7268032", "0.72549725", "0.71684146", "0.7143496", "0.70590407", "0.70508957", "0.6964649", "0.69521296", "0.6904362", "0.6858526", "0.6841164", "0.6841164", "0.6841164", "0.68307346", "0.68211...
0.7725469
1
Retrieve the type signature of the callable `obj`.
def signature(obj: Callable) -> Signature: return Signature.from_callable(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_callable_signature(obj):\n if inspect.isclass(obj) or inspect.isfunction(obj):\n if obj.__name__ == \"<lambda>\":\n return _make_lambda_name(obj)\n return obj.__name__\n elif inspect.ismethod(obj):\n obj_self = obj.__self__\n if isinstance(obj_self, type):\n cls_name = obj_self.__...
[ "0.7464089", "0.6583049", "0.6352262", "0.6304821", "0.6268376", "0.6045959", "0.60015917", "0.5922175", "0.5805204", "0.57128704", "0.56448716", "0.56355196", "0.5625885", "0.560357", "0.5551908", "0.55509865", "0.55469924", "0.55452144", "0.55344373", "0.54780686", "0.54219...
0.8067756
0
Enable automatic upgrade of Sql IaaS extension Agent.
def enable_automatic_upgrade(self) -> Optional[bool]: return pulumi.get(self, "enable_automatic_upgrade")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):", "def upgrade(self):", "def upgrade():\n op.add_column(\n 'assessments',\n sa.Column(\n 'assessment_type',\n sa.String(length=250),\n nullable=False,\n server_default=\"Control\",\n )\n )\n # Change CA help text \"Assessment type\" to \"...
[ "0.5746555", "0.5746555", "0.5360772", "0.525915", "0.5241179", "0.5205984", "0.5202186", "0.51439685", "0.5128792", "0.51103", "0.5100761", "0.5082117", "0.50677305", "0.5032857", "0.50267804", "0.5008855", "0.50035113", "0.49937436", "0.4992535", "0.49824744", "0.4973609", ...
0.6036892
0
Key vault credential settings.
def key_vault_credential_settings(self) -> Optional['outputs.KeyVaultCredentialSettingsResponse']: return pulumi.get(self, "key_vault_credential_settings")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credentials(self):\n return CurrentProject().config.credentials[self.key]", "def set_credentials():", "def _get_credentials(self):\n if self.config_file:\n with open(self.config_file) as f:\n config_str = f.read()\n credentials_dict = json.loads(config...
[ "0.67248553", "0.66756296", "0.65379584", "0.6494901", "0.6491272", "0.6403726", "0.6381683", "0.6038071", "0.60170984", "0.60099757", "0.59500206", "0.59424424", "0.5904099", "0.5865562", "0.5857952", "0.58470386", "0.5843469", "0.5818919", "0.5775693", "0.5767203", "0.57606...
0.681181
0
SQL IaaS Agent least privilege mode.
def least_privilege_mode(self) -> Optional[str]: return pulumi.get(self, "least_privilege_mode")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy(agent):", "def which_security(self):\n # Tools and services\n if self.details[\"owner\"] in self.tas_override:\n # setup owner and oncall privs\n if self.details[\"platform\"] == \"prod\":\n self.details[\"security\"][\"role.service_owner\"] = \"%s-pr...
[ "0.5651815", "0.5552572", "0.53834474", "0.53759897", "0.5337457", "0.53322214", "0.52849346", "0.521477", "0.5178467", "0.517436", "0.5171991", "0.5171991", "0.5162061", "0.5162061", "0.5161537", "0.5125376", "0.5106921", "0.50724584", "0.50508195", "0.5049469", "0.5044538",...
0.6251558
0
SQL image offer. Examples include SQL2016WS2016, SQL2017WS2016.
def sql_image_offer(self) -> Optional[str]: return pulumi.get(self, "sql_image_offer")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryImage(name):\n\n width, height = queryDimensions(name)\n header, rows = querySciDB(\"scan(%s)\" % name)\n\n return render.renderPng(width, height, rows)", "def get_image(id_num):\n return sqldb.get_image(id_num)", "def sql_image_sku(self) -> Optional[str]:\n return pulumi.get(self, ...
[ "0.5541182", "0.5481096", "0.54725695", "0.52279735", "0.510517", "0.5102536", "0.5078968", "0.5022758", "0.49956042", "0.49684694", "0.49386504", "0.49383932", "0.49115917", "0.4904313", "0.4878855", "0.48654482", "0.486533", "0.48480713", "0.48383203", "0.4795004", "0.47740...
0.70571125
0
SQL Server license type.
def sql_server_license_type(self) -> Optional[str]: return pulumi.get(self, "sql_server_license_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lic_type():\n return VocabularyType.create(id='licenses', pid_type='lic')", "def get_license_type():\n sql = \"\"\"\n SELECT license_type license, description\n FROM license_types_codes\n WHERE can_use = 'Y'\n \"\"\"\n\n # [('P', 'Permanent'), ... ]\n record_set = get_record(sql)\n ...
[ "0.7388876", "0.6914536", "0.65520567", "0.6494581", "0.64759284", "0.6462194", "0.64542824", "0.61641365", "0.61452985", "0.6031865", "0.5985203", "0.59722406", "0.59193486", "0.5915004", "0.5913919", "0.5904301", "0.5891602", "0.5890338", "0.5859811", "0.5828259", "0.573464...
0.83057636
0
ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of.
def sql_virtual_machine_group_resource_id(self) -> Optional[str]: return pulumi.get(self, "sql_virtual_machine_group_resource_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")", "def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")", "def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")", "def resource_group_id(se...
[ "0.776278", "0.776278", "0.776278", "0.776278", "0.776278", "0.75804204", "0.7398866", "0.7398866", "0.7398866", "0.73647386", "0.7292113", "0.7292113", "0.7292113", "0.7292113", "0.7292113", "0.7292113", "0.7292113", "0.7292113", "0.71181333", "0.68674904", "0.67758405", "...
0.8492074
0
ARM Resource id of underlying virtual machine created from SQL marketplace image.
def virtual_machine_resource_id(self) -> Optional[str]: return pulumi.get(self, "virtual_machine_resource_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_virtual_machine_group_resource_id(self) -> Optional[str]:\n return pulumi.get(self, \"sql_virtual_machine_group_resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", ...
[ "0.67559993", "0.6314548", "0.6314548", "0.6314548", "0.62932324", "0.6195527", "0.61022866", "0.60891443", "0.6060182", "0.60245854", "0.59726673", "0.5938371", "0.5903513", "0.58927864", "0.58927864", "0.58927864", "0.58927864", "0.58927864", "0.58927864", "0.58927864", "0....
0.77778864
0
Gets a SQL virtual machine.
def get_sql_virtual_machine(expand: Optional[str] = None, resource_group_name: Optional[str] = None, sql_virtual_machine_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetSqlVirtualMachineResult: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vm(**kwargs):\n model = self.db.vm_table_from_provider('openstack')\n vm = self.db.select(model, **kwargs).all()\n assert len(vm) == 1, vm\n vm = vm[0]\n return vm", "def get_sql_virtual_machine_output(expand: Optional[pulumi.Input[Optional[str]]] = ...
[ "0.7051682", "0.6846531", "0.65177065", "0.6314297", "0.6176782", "0.6015212", "0.5942766", "0.58022934", "0.5735303", "0.5688736", "0.5669816", "0.5563412", "0.5531041", "0.5528453", "0.548521", "0.54187983", "0.53782344", "0.53499717", "0.52770954", "0.52686584", "0.5265019...
0.7139321
0
Densitydependent downsampling to a sample size smaller or equal to a specified value. This approach downsamples a point cloud such that regions of higher density are less likely to be sampled from. The resulting cloud therefore has a more uniform density. The approach used here is directly inspired by SPADE [ref 1]. No...
def ddds(cloud, sample_size, presample=None, processes=10): #-------------------------------------------------------------------------- ### Prep # Handle small point clouds if cloud.shape[0] <= sample_size: warn("(code 1) Point cloud is already <= desired sample size. " + "No sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_subsample(cloud, sample_size, replace=False):\n\n # Handle small point clouds\n if cloud.shape[0] <= sample_size:\n warn(\"(code 1) Point cloud is already <= desired sample size. \" +\n \"No subsampling is performed.\")\n return cloud\n\n # Perform subsamping\n samp...
[ "0.6413715", "0.59297705", "0.5833065", "0.58302635", "0.57907945", "0.57134163", "0.5706828", "0.56789315", "0.5579106", "0.55292034", "0.55220985", "0.5508379", "0.55038553", "0.5503162", "0.5483587", "0.5474814", "0.54742444", "0.54477376", "0.5436643", "0.54324836", "0.54...
0.666516
0
Copy the input content object into the session directory using archive naming conventions less version details. Return the full path of the session file or None
def copyToSession(self, contentType, formatType, version="latest", partitionNumber=1): inpFilePath = self.__getFilePath(fileSource=self.__fileSource, contentType=contentType, formatType=formatType, version=version, partitionNumber=partitionNumber) if self.__debug: self.__lfh.write("+DataExch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateArchiveFromSession(self, contentType, formatType, version=\"next\", partitionNumber=1):\n fn = self.__getArchiveFileName(contentType, formatType, version=\"none\", partitionNumber=partitionNumber)\n inpFilePath = os.path.join(self.__sessionPath, fn)\n if self.__verbose:\n ...
[ "0.6401436", "0.5103961", "0.5062158", "0.5057045", "0.5040292", "0.5029681", "0.5028371", "0.49832347", "0.49700403", "0.496026", "0.4940959", "0.4940322", "0.49357715", "0.49029315", "0.49014482", "0.4897062", "0.48897016", "0.48732707", "0.4855773", "0.4842807", "0.4842365...
0.6456665
0
Copy the input content object from the session directory stored using archive naming conventions less version details to archive storage. Return the full path of the archive file or None
def updateArchiveFromSession(self, contentType, formatType, version="next", partitionNumber=1): fn = self.__getArchiveFileName(contentType, formatType, version="none", partitionNumber=partitionNumber) inpFilePath = os.path.join(self.__sessionPath, fn) if self.__verbose: self.__lfh.wr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract(self, path, archivecontentmaxsize):\n return None", "def archive_path(self):\n return os.path.join(self.destination_directory, self.__archive_name__)", "def _expand_archive(self, name):\r\n target = path(self.temp_dir) / uuid.uuid4().hex\r\n os.mkdir(target)\r\n w...
[ "0.61428714", "0.611737", "0.60615754", "0.59071267", "0.57440823", "0.5698574", "0.5692508", "0.5683624", "0.56766564", "0.5667239", "0.56335604", "0.55756545", "0.5565427", "0.55461234", "0.5537251", "0.5460467", "0.545186", "0.5447522", "0.5439493", "0.54372364", "0.542585...
0.66665554
0
Decipher given text using Caesar method. Note you should use the same charset that ciphering end did.
def decipher(ciphered_text: str, key: int, charset: str = DEFAULT_CHARSET) -> str: deciphered_text = _offset_text(ciphered_text, key, False, Ciphers.CAESAR, charset) return deciphered_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt_caesar(ciphertext: str) -> str:\n plaintext = ''\n for ab in ciphertext:\n if ('a' <= ab <= 'z') or ('A' <= ab <= 'Z'):\n ans = ord(ab) - 3\n if (ans < ord('a')) and (ans > ord('Z')) or (ans < ord('A')):\n ans += 26\n plaintext += chr(ans)\n ...
[ "0.73526025", "0.7299322", "0.72758853", "0.71435684", "0.70446986", "0.69707316", "0.69267696", "0.692425", "0.68940175", "0.68750525", "0.67252564", "0.67230713", "0.6704006", "0.66632414", "0.6645716", "0.65805125", "0.64702874", "0.6456406", "0.6453587", "0.6432239", "0.6...
0.8169176
0
show progress if self.__is_show_proegress True. \param[in] _cur_file_idx current processing file index \param[in] _file_count number of total files
def __show_progress(self, _cur_file_idx, _file_count): if (self.__is_show_proegress == False): return if(_file_count == 0): raise StandardError('no file found.') # show progress for each 5% (20 steps) digit = math.modf(math.log10(_file_count))[1] if(digi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_progress(self, percentage_complete, filecount, filecomplete):\n ##TODO: display the current transfer rate\n ##TODO: display the current file being transferred and possibly the progress thereof.\n ##Perhaps use the statusbar method for this\n self.progress.setValue(int(percentag...
[ "0.59621894", "0.58859885", "0.58060676", "0.57941943", "0.5504679", "0.54205585", "0.5397171", "0.5359194", "0.53416574", "0.53402764", "0.53393024", "0.53196186", "0.5318342", "0.5314393", "0.5307423", "0.530685", "0.5302948", "0.52970344", "0.52880377", "0.52654934", "0.52...
0.84238493
0
read blacklist file and keep in the set. \param[in] _blacklist_fname blacklist filename
def read_blacklist(self, _blacklist_fname): try: blacklist_f = codecs.open(_blacklist_fname, mode='r', encoding='utf-8') line_idx = 0 for fline in blacklist_f: line_idx = line_idx + 1 line = fline.strip() if ((len(line) > 0) and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blacklist_file(self, fkey):\n self.blacklist.update([fkey])", "def open_blacklist(filepath):\n with open(filepath, 'r') as f:\n blacklist = [tuple(line.strip().split('\\t')) for line in f.readlines()]\n return blacklist", "def ReadBlackListFile(BlackListFile):\n blacklist = []\n i...
[ "0.74668455", "0.7435937", "0.7226039", "0.71409386", "0.69012386", "0.68086356", "0.65102315", "0.65102315", "0.6492251", "0.6445948", "0.6428848", "0.6298281", "0.62561387", "0.6169755", "0.6096331", "0.60444635", "0.59310824", "0.58466583", "0.58374816", "0.58168995", "0.5...
0.85046655
0
check _fname has writer description
def has_writer_description(self, _fname): # print u'info: checking ['+ _fname + u']' # # It seems some filename is not considered unicode (even I # made a unicode string with u'', so make sure the encoding is # utf-8. For example, Lemprière's_Bibliotheca_Classica can not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_filename(self):\n if self.filename == \"untitled\":\n return False\n else:\n return True", "def test_is_check_filename(self):\n self.assertTrue(check_filename('sample.csv'))", "def check_empty_desc_file(out):\n return MISSING_RESOURCE in out.lower()", "def test_is_check_file...
[ "0.6337745", "0.6027433", "0.60234314", "0.5945401", "0.5772521", "0.5772521", "0.5694627", "0.5692084", "0.56618637", "0.5653594", "0.56347966", "0.5584619", "0.5582658", "0.55805594", "0.5580391", "0.556575", "0.5557586", "0.5545394", "0.5540392", "0.55333614", "0.5510318",...
0.73286253
0
get vector from scanning directory. \param[in] _input_dir input files' directory \param[in] _output_file output file name
def get_vector(self, _input_dir, _output_file): if (not os.path.exists(_input_dir)): raise StandardError, ('No such input directory [' + _input_dir + ']') if (os.path.exists(_output_file)): raise StandardError, ('Output file exists [' + _output_file + ']') try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_vec_files(vec_directory, output_vec_file):\n\n\t# Check that the .vec directory does not end in '/' and if it does, remove it.\n\tif vec_directory.endswith('/'):\n\t\tvec_directory = vec_directory[:-1]\n\t# Get .vec files\n\tfiles = glob.glob('{0}/*.vec'.format(vec_directory))\n\n\t# Check to make sure t...
[ "0.6080736", "0.5842313", "0.573423", "0.57060766", "0.56463504", "0.55878353", "0.54047006", "0.53952485", "0.53682417", "0.5323462", "0.5306015", "0.528734", "0.5246308", "0.52261233", "0.51942784", "0.5187178", "0.517565", "0.5173988", "0.5163878", "0.5163753", "0.51474893...
0.7355258
0
Setup Gmail API instance
def get_gmail_api_instance(): if not os.path.exists('token.pickle'): print("err: no credentials .pickle file found") gmailtoken_generator() with open('token.pickle', 'rb') as token: creds = pickle.load(token) service = build('gmail', 'v1', credentials=creds) return servi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_gmail_api_v1():\n\n credentials = build_credentials()\n return googleapiclient.discovery.build('gmail', 'v1', credentials=credentials)", "def __init__(self, mailbox, api_key, base_url='https://mailosaur.com/api', smtp_host='mailosaur.io'):\n self.mailbox = mailbox\n self.api_key = a...
[ "0.67993057", "0.6465097", "0.6379843", "0.62756974", "0.6221557", "0.61724395", "0.6157281", "0.61341727", "0.60823137", "0.6077386", "0.6068", "0.6049752", "0.6017722", "0.59777987", "0.59563124", "0.59244496", "0.5898986", "0.58902305", "0.5883836", "0.57801676", "0.573785...
0.72582275
0
Set up Gmail API instance, use it to send an email 'sender' is the Gmail address that is authenticated by the Gmail API 'receiver' is the receiver's email address 'subject' is the subject of our email 'message_text' is the content of the email
def Gmail_mailsender(receiver, sender, subject, message_text): # authenticate with Gmail API service = get_gmail_api_instance() # create message structure message = create_message(sender, receiver, subject, message_text) # send email result = send_email(service, sender, message) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_api(cls, receiver, email_template, subject):\n\n url = 'https://api.mailgun.net/v3/{}/messages'.format(cls.domain_name)\n auth = ('api', cls.api_key)\n data = {\n 'from': cls.sender.format(cls.domain_name),\n 'to': receiver,\n 'subject': subject,\n ...
[ "0.7326535", "0.673758", "0.6671385", "0.6635266", "0.65357083", "0.6474429", "0.64681345", "0.6457392", "0.6438135", "0.6404577", "0.63888466", "0.6345327", "0.6312482", "0.6308214", "0.6279667", "0.6239861", "0.6233244", "0.62318534", "0.62204283", "0.62175447", "0.6185709"...
0.7533274
0
This is the main function to run the INCREMENT turing machine program
def main(argv): inputfile = '' try: opts, arg = getopt.getopt(argv, "hi:o:", ["ifile="]) except getopt.GetoptError: print('usage: main_increment.py -i <inputfile>') sys.exit(2) for opt, arg in opts: if opt == '-h': print('main_increment.py -i <inputfile>') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n\tif len(sys.argv) > 1 and sys.argv[1] in {'-V', '--version'}:\n\t\tprint(\"pokesim - Pokémon Battle Simulator - Version %s\" % __version__)\n\t\texit()\n\n\trandom.seed()\n\ttry:\n\t\tmain()\n\texcept (KeyboardInterrupt, EOFError):\n\t\texit(0)", "def main():\n\n GAME = \"Assignment1-Taxi-v2\"\n ...
[ "0.65374327", "0.6535227", "0.635439", "0.6309623", "0.6243766", "0.62209076", "0.6213963", "0.61493194", "0.61216235", "0.6104337", "0.60718757", "0.6022445", "0.6022445", "0.59985065", "0.5974082", "0.59726065", "0.5948179", "0.593142", "0.59125686", "0.59125686", "0.591256...
0.72980213
0
Generates human readable string for a number.
def MakeHumanReadable(num): i = 0 while i+1 < len(EXP_STRINGS) and num >= (2 ** EXP_STRINGS[i+1][0]): i += 1 rounded_val = round(float(num) / 2 ** EXP_STRINGS[i][0], 2) return '%s %s' % (rounded_val, EXP_STRINGS[i][1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _num2str(self, num):\n q, mod = divmod(num, 10)\n suffix = \"th\" if q == 1 else self.SUFFIX_DICT[mod]\n return f\"{num}{suffix}\"", "def __str__(self):\n if self.is_int():\n return str(self._num)\n else:\n return \"{0:d} / {1:d}\".format(self._num, se...
[ "0.7651889", "0.7019703", "0.6973662", "0.696883", "0.69481635", "0.69195724", "0.69157094", "0.6817007", "0.66960204", "0.6691108", "0.668076", "0.66506594", "0.6627283", "0.6615014", "0.66030735", "0.6598126", "0.6549139", "0.65482795", "0.6547588", "0.65153563", "0.650068"...
0.7083336
1
Constructs a StorageUri string for the given iterated_uri and object.
def UriStrFor(iterated_uri, obj): return '%s://%s/%s' % (iterated_uri.scheme, obj.bucket.name, obj.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StorageUri(self, uri_str, debug=0, validate=True):\n return boto.storage_uri(\n uri_str, 'file', debug=debug, validate=validate,\n bucket_storage_uri_class=self.bucket_storage_uri_class)", "def create_uri(uri):\n return URIRef(uri)", "def uri_string(self):\n if isinstance(self.en...
[ "0.60313696", "0.58099467", "0.57456857", "0.55637884", "0.55138993", "0.54192", "0.53465", "0.53278655", "0.53194463", "0.5285201", "0.52395695", "0.5174997", "0.51727", "0.51406395", "0.51248956", "0.5074739", "0.50008357", "0.49282068", "0.48954654", "0.48884666", "0.48881...
0.80973625
0
Helper to instantiate gslib.WildcardIterator, passing self.bucket_storage_uri_class to support mocking/testing. Args are same as gslib.WildcardIterator interface, but without the bucket_storage_uri_class param (which is instead filled in from Command class state).
def CmdWildcardIterator(self, uri_or_str, result_type=ResultType.URIS, headers=None, debug=0): return wildcard_iterator.wildcard_iterator( uri_or_str, result_type=result_type, headers=headers, debug=debug, bucket_storage_uri_class=self.bucket_storage_uri_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,args):\n storage_client = storage.Client()\n self.parsed = urlparse(args.input_dir)\n \n #parse gcp path\n self.bucket = storage_client.get_bucket(self.parsed.hostname) \n images=self.bucket.list_blobs(prefix=self.parsed.path[1:])\n \n #i...
[ "0.54212415", "0.52524996", "0.5115315", "0.50989044", "0.49958292", "0.49308628", "0.49241865", "0.4795049", "0.47617844", "0.47472653", "0.4741023", "0.47379297", "0.47305182", "0.4728124", "0.47225723", "0.46678272", "0.46606597", "0.4623661", "0.46185184", "0.46099395", "...
0.64149827
0
Implementation of setacl command.
def SetAclCommand(self, args, unused_sub_opts=None, headers=None, debug=0): acl_arg = args[0] uri_args = args[1:] provider = None first_uri = None # Do a first pass over all matched objects to disallow multi-provider # setacl requests, because there are differences in the ACL models. for uri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __acl__():", "def test_set_get_bad_acl(self):\n path_one = \"%s/one\" % (self.tests_path)\n auth_id = \"username_password:user:user\"\n self.shell.onecmd(\"create %s 'hello'\" % (path_one))\n self.shell.onecmd(\"set_acls %s 'world:anyone:r %s'\" % (\n path_one, auth_id)...
[ "0.6792879", "0.65921074", "0.61917096", "0.6073873", "0.59864783", "0.59574765", "0.5841796", "0.58087355", "0.5784863", "0.5783401", "0.57787913", "0.5765398", "0.5761703", "0.5728288", "0.5710621", "0.570529", "0.5671081", "0.56375176", "0.5577266", "0.5576396", "0.5572731...
0.73653114
0
Explains what to do if sudo needed to update gsutil software. Happens if gsutil was previously installed by a different user (typically if someone originally installed in a shared file system location, using sudo).
def ExplainIfSudoNeeded(self, tf, dirs_to_remove): system = platform.system() # If running under Windows we don't need (or have) sudo. if system.lower().startswith('windows'): return user_id = os.getuid() if (os.stat(self.gsutil_bin_dir).st_uid == user_id and os.stat(self.boto_lib_dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ExplainIfSudoNeeded(self, tf, dirs_to_remove, old_cwd):\n # If running under Windows or Cygwin we don't need (or have) sudo.\n if system_util.IS_CYGWIN or system_util.IS_WINDOWS:\n return\n\n user_id = os.getuid()\n if os.stat(gslib.GSUTIL_DIR).st_uid == user_id:\n return\n\n # Won't ...
[ "0.6868656", "0.622022", "0.586455", "0.5762399", "0.57385385", "0.5685918", "0.5684922", "0.56211627", "0.55667186", "0.55461246", "0.55407524", "0.5524709", "0.5474953", "0.54246354", "0.539118", "0.53812087", "0.5301683", "0.52991027", "0.52959615", "0.52026653", "0.519367...
0.71584785
0
Throws Exception if any of dirs is known to be unsafe for gsutil update. This provides a failsafe check to ensure we don't try to overwrite or delete any important directories. (That shouldn't happen given the way we construct tmp dirs, etc., but since the gsutil update cleanup use shutil.rmtree() it's prudent to add e...
def EnsureDirsSafeForUpdate(self, dirs): for d in dirs: if not d: d = 'null' if d.lstrip(os.sep).lower() in self.unsafe_update_dirs: raise CommandException('EnsureDirsSafeForUpdate: encountered unsafe ' 'directory (%s); aborting update' % d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _EnsureDirsSafeForUpdate(self, dirs):\n for d in dirs:\n if not d:\n d = 'null'\n if d.lstrip(os.sep).lower() in self.unsafe_update_dirs:\n raise CommandException('EnsureDirsSafeForUpdate: encountered unsafe '\n 'directory (%s); aborting update' % d)", ...
[ "0.8285823", "0.62391114", "0.6160257", "0.60179305", "0.5956509", "0.5822186", "0.58019644", "0.57795304", "0.5769533", "0.55969536", "0.5537894", "0.5536626", "0.5512073", "0.5500965", "0.54969025", "0.549504", "0.54783744", "0.5458695", "0.5420346", "0.5400437", "0.5382054...
0.8231699
1
Loads version string for currently installed gsutil command.
def LoadVersionString(self): ver_file_path = self.gsutil_bin_dir + os.sep + 'VERSION' if not os.path.isfile(ver_file_path): raise CommandException( '%s not found. Did you install the\ncomplete gsutil software after ' 'the gsutil "update" command was implemented?' % ver_file_path) v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getversion():\r\n\r\n global VERSION\r\n\r\n if len(VERSION) == 3:\r\n return '{}.{}.{}'.format(VERSION[0], VERSION[1], VERSION[2])\r\n else:\r\n return '{}.{}.{}-{}'.format(VERSION[0], VERSION[1], VERSION[2], VERSION[3])", "def get_version() -> str:\n version = read(\"pdf_utils/__v...
[ "0.6453992", "0.6367098", "0.6274387", "0.62553936", "0.6181244", "0.6180381", "0.617818", "0.6162138", "0.6157807", "0.6086163", "0.6051202", "0.60485405", "0.60243237", "0.60125846", "0.5997708", "0.5940522", "0.59365326", "0.5930519", "0.59246886", "0.59088504", "0.5905622...
0.8584573
0
Checks whether copying src_uri into dst_path is not possible. This happens if a directory exists in local file system where a file needs to go or vice versa. In that case we print an error message and
def CheckForDirFileConflict(self, src_uri, dst_path): final_dir = os.path.dirname(dst_path) if os.path.isfile(final_dir): raise CommandException('Cannot retrieve %s because it a file exists ' 'where a directory needs to be created (%s).' % (src_uri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safecopy(src, dst):\r\n abs_src = os.path.abspath(src)\r\n abs_dst = os.path.abspath(dst)\r\n if (abs_src != abs_dst) \\\r\n and os.path.isfile(abs_src): \r\n dirname = os.path.dirname(abs_dst)\r\n recurse_mkdir(dirname)\r\n shutil.copy(abs_src, abs_dst)", "def...
[ "0.6901259", "0.68268985", "0.673754", "0.6538259", "0.6497284", "0.64965814", "0.63711923", "0.6340625", "0.6311761", "0.6251322", "0.6174213", "0.61602324", "0.61496025", "0.60806686", "0.6078184", "0.6070296", "0.60689217", "0.59689426", "0.5968641", "0.5960017", "0.595896...
0.75770116
0
Implementation of getacl command.
def GetAclCommand(self, args, unused_sub_opts=None, headers=None, debug=0): # Wildcarding is allowed but must resolve to just one object. uris = list(self.CmdWildcardIterator(args[0], headers=headers, debug=debug)) if len(uris) != 1: raise CommandException('Wil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __acl__():", "def get_acl(registry=None):", "def _get_acl(self, path, replacement):\n auth = (properties.GMN_USER, properties.GMN_PASSWD)\n eml_acl = None\n url = self._url.replace(path, replacement)\n r = adapter_utilities.requests_get_url_wrapper(url=url, auth=auth)\n i...
[ "0.72654945", "0.719457", "0.6704867", "0.66731185", "0.65172094", "0.6427574", "0.6421802", "0.6291308", "0.6276502", "0.6174854", "0.61273634", "0.5993839", "0.59550744", "0.59331304", "0.5928578", "0.5918684", "0.5900413", "0.58834785", "0.5881256", "0.5859684", "0.5852145...
0.7747878
0