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
returns the new values when stage_id has changed
def _onchange_stage_id_values(self, stage_id): if not stage_id: return {} print('1111') call_attempt = len(self.env['call.attempt'].browse(self.call_attempt_ids)) call_pitch = len(self.env['call.pitch'].browse(self.call_pitch_ids)) contact_meeting = len(self.env['co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_stages(self, stages: Set[str], deployment_id: Optional[str]) -> Set[str]:\n prev_dep_ids = set()\n for stage in stages:\n # Collects previous deployment IDs to clean up\n response_get = cast(Dict, self._api_client.get_stage(restApiId=self._api_physical_id, stageName=...
[ "0.6233984", "0.57401246", "0.5710629", "0.5523506", "0.5523506", "0.5495152", "0.54223007", "0.5403869", "0.53606635", "0.5297145", "0.5296984", "0.52794987", "0.52597815", "0.51409966", "0.51221114", "0.51093155", "0.5060696", "0.50557554", "0.50440127", "0.5032552", "0.500...
0.6233945
1
get_battle and get_root work, right?
def test_get_battle(self): battle = self.battle s1 = battle.create_skirmish(self.alice, 1) s2 = battle.create_skirmish(self.bob, 1) s3 = s2.react(self.alice, 1) self.assertEqual(battle, s1.get_battle()) self.assertEqual(battle, s3.get_battle())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def battle(ctx):\n return await battle(ctx)", "def test_get_game(self):\n pass", "def test_get_player_battles(self):\n pass", "def test_root_get(self):\n pass", "def test_root_get(self):\n pass", "def battle_resting(self):\n pass", "def run_new_battle(self):\...
[ "0.605957", "0.5823376", "0.5775074", "0.57509583", "0.57509583", "0.56359965", "0.55681175", "0.5435227", "0.5349742", "0.5342036", "0.5325338", "0.527473", "0.52361184", "0.5203507", "0.520066", "0.5183148", "0.5136757", "0.51365817", "0.5120829", "0.5114948", "0.5092223", ...
0.62494785
0
Setting a troop cap should work
def test_troop_cap(self): self.conf["game"]["troopcap"] = 106 self.assertEqual(self.alice.loyalists, 100) self.assertEqual(self.bob.loyalists, 100) s1 = self.battle.create_skirmish(self.alice, 50) s1.react(self.bob, 50, troop_type='cavalry') self.end_battle(self.battle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_capacity(self, cap):\n return self.get_interaction().set_capacity(cap)", "async def set_captain(self, cap : Player, team):\r\n self.captains[team.upper()] = cap\r\n await self.add_to_team(cap,team)\r\n self.order.append(cap)", "def set_pop_cap(self):\n v = simpledialog.as...
[ "0.66989356", "0.613216", "0.6131752", "0.56685257", "0.5661737", "0.54281896", "0.53787345", "0.5358742", "0.53274834", "0.5327376", "0.5314123", "0.53038776", "0.52905774", "0.52834314", "0.52774733", "0.5231526", "0.51952356", "0.5183654", "0.5179682", "0.51791334", "0.515...
0.68233424
0
Each participant can only make one toplevel skirmish
def test_single_toplevel_skirmish_each(self): self.battle.create_skirmish(self.alice, 1) with self.assertRaises(db.InProgressException): self.battle.create_skirmish(self.alice, 1) n = (self.sess.query(db.SkirmishAction).filter_by(parent_id=None). filter_by(participant=s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_rookies_toplevel(self):\n self.bob.recruited = now() + 6000\n\n # Top level\n with self.assertRaises(db.TimingException):\n self.battle.create_skirmish(self.bob, 1)\n\n self.assertEqual(self.sess.query(db.SkirmishAction).count(), 0)", "def test_disallow_betrayal...
[ "0.6052868", "0.57790726", "0.5696843", "0.5659765", "0.56102735", "0.55996853", "0.5477823", "0.544987", "0.54137665", "0.54113007", "0.5380825", "0.5371291", "0.5340069", "0.53215677", "0.53103054", "0.5306986", "0.53066045", "0.52727365", "0.52668405", "0.52482265", "0.524...
0.6565452
0
Each participant can only response once to a skirmishaction
def test_single_response_to_skirmish(self): s1 = self.battle.create_skirmish(self.alice, 1) s1.react(self.bob, 1) with self.assertRaises(db.InProgressException): s1.react(self.bob, 1) n = (self.sess.query(db.SkirmishAction). count()) self.assertEqual(n,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disallow_betrayal(self):\n s1 = self.battle.create_skirmish(self.alice, 1)\n with self.assertRaises(db.TeamException):\n s1.react(self.bob, 1, hinder=False)\n\n n = (self.sess.query(db.SkirmishAction).filter_by(parent_id=None).\n filter_by(participant=self.alice)...
[ "0.6221245", "0.60473037", "0.6030545", "0.5727721", "0.5595633", "0.5559653", "0.5541494", "0.5517209", "0.5507739", "0.5506363", "0.5452872", "0.5406337", "0.5401216", "0.53752905", "0.53640044", "0.5348013", "0.5331567", "0.5330819", "0.5329682", "0.5308434", "0.5278392", ...
0.65196186
0
Can't start a skirmish with more loyalists than you have
def test_no_overdraw_skirmish(self): with self.assertRaises(db.InsufficientException): self.battle.create_skirmish(self.alice, 9999999) n = (self.sess.query(db.SkirmishAction).filter_by(parent_id=None). filter_by(participant=self.alice)).count() self.assertEqual(n, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_adds_to_overdraw_skirmish(self):\n s1 = self.battle.create_skirmish(self.alice, 99)\n with self.assertRaises(db.InsufficientException):\n s1.react(self.alice, 2, hinder=False)\n\n n = (self.sess.query(db.SkirmishAction).filter_by(parent_id=None).\n filter_by(p...
[ "0.597504", "0.5931134", "0.59167415", "0.5845247", "0.56866354", "0.5659165", "0.5635481", "0.5633224", "0.5616283", "0.5575347", "0.55748", "0.55045563", "0.5464928", "0.54558235", "0.5416244", "0.54081935", "0.5394443", "0.53809035", "0.5369932", "0.5360778", "0.53253394",...
0.6116105
0
But you can move away if it's to another sector in the same region
def test_allow_sector_movement_in_battle(self): self.conf["game"]["num_sectors"] = 7 self.conf["game"]["allow_sector_retreat"] = True self.battle.create_skirmish(self.alice, 1) curr = self.alice.region self.alice.move(100, curr, 15, sector=3, conf=self.conf) n = (self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_cytokine(self) :\n for cy in self.cytokine :\n if self.cytosol.get(cy, False) and self.cytosol[cy] > 0:\n cy(self.pos, tool.rand_2D(1.2))\n self.cytosol[cy] -= 1\n else : \n self.ribosome.mrna(cy, 100)\n self.cytokine.clea...
[ "0.5858422", "0.5820193", "0.5819938", "0.5819938", "0.58107525", "0.5809525", "0.5758881", "0.5746851", "0.5674281", "0.5662257", "0.56605774", "0.56362796", "0.5608948", "0.5545998", "0.5540973", "0.55380243", "0.5533503", "0.5502532", "0.54935884", "0.5492089", "0.54900664...
0.6191313
0
Still can't spearhead a skirmish even if your last skirmish is done
def test_ended_skirmishes_block(self): skirmish, _ = self.start_endable_skirmish() self.end_skirmish(skirmish) with self.assertRaises(db.InProgressException): self.battle.create_skirmish(self.alice, 1) n = (self.sess.query(db.SkirmishAction).filter_by(parent_id=None). ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_skirmish_end(self):\n s1, s2 = self.start_endable_skirmish()\n\n self.assertTrue(s1.ends)\n self.assertFalse(s1.is_resolved())\n\n # Go through one round of battle updating to verify skirmish\n # doesn't end early\n sess = self.sess\n db.Battle.update_all(s...
[ "0.62651765", "0.6077142", "0.60739297", "0.60575885", "0.60405356", "0.6004787", "0.5990118", "0.5935853", "0.5932327", "0.5794377", "0.57839346", "0.5757753", "0.57397354", "0.5735527", "0.56593466", "0.5652513", "0.56437516", "0.56142443", "0.5613523", "0.5601323", "0.5598...
0.6307598
0
Ties still count as resolved
def test_ties_resolve_correctly(self): skirmish, _ = self.start_endable_skirmish(alice_forces=1, bob_forces=1) self.assertFalse(skirmish.is_resolved()) self.end_skirmish(skirmish) self.assertTrue(skirmish.is_resolved())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_ties(self,rank):\n for k in self._run:\n curr_dict = defaultdict(list)\n qid = self._run[k][0].get_qid()\n for t in self._run[k]:\n # print t.get_str()\n curr_dict[t.get_score()].append(t)\n curr_dict = OrderedDict(sorted(c...
[ "0.5656237", "0.53306234", "0.5308136", "0.5208707", "0.5158958", "0.51538366", "0.5144621", "0.5038073", "0.4976401", "0.49506652", "0.49289313", "0.4908449", "0.48834485", "0.48820204", "0.48729697", "0.48721874", "0.48557138", "0.48290616", "0.48149484", "0.48135033", "0.4...
0.539613
1
Use of codewords in response skirmishes
def test_response_codeword(self): self.bob.add_codeword('muppet', 'ranged') battle = self.battle s1 = battle.create_skirmish(self.alice, 100) s2 = s1.react(self.bob, 100, troop_type='muppet') self.assertEqual(s2.troop_type, 'ranged')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_word_info(self):\n word = \"vitality\"\n rv = self.wordInfo(input_word=word)\n expected_output = {\n word: {\n \"frequency\": \"975\",\n \"defination\": \"{'Noun': ['an energetic style', 'a healthy capacity for vigorous activity', '(biology', '...
[ "0.5700817", "0.5638408", "0.5615774", "0.5550162", "0.55433565", "0.5511571", "0.54545414", "0.54381716", "0.54381716", "0.5403765", "0.5395792", "0.53828865", "0.5371855", "0.535695", "0.5337701", "0.53147566", "0.5295624", "0.52706325", "0.5251627", "0.5242964", "0.5225923...
0.6663941
0
Can't oppose a fight in a sector you're not in
def test_no_oppose_different_sectors(self): battle = self.battle self.bob.sector = 7 s1 = battle.create_skirmish(self.alice, 2) prev_skirmishes = self.sess.query(db.SkirmishAction).count() with self.assertRaises(db.WrongSectorException): s1.react(self.bob, 2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_support_different_sectors(self):\n battle = self.battle\n self.carol.sector = 7\n\n s1 = battle.create_skirmish(self.alice, 2)\n prev_skirmishes = self.sess.query(db.SkirmishAction).count()\n with self.assertRaises(db.WrongSectorException):\n s1.react(self....
[ "0.6505528", "0.6414374", "0.62349933", "0.6039099", "0.6032844", "0.6025839", "0.5965786", "0.5951273", "0.59395003", "0.59286326", "0.5919667", "0.59127593", "0.59070486", "0.5892684", "0.58916175", "0.5877553", "0.5849762", "0.5848409", "0.5803564", "0.5768749", "0.5751785...
0.6416511
1
Can't support a fight in a sector you're not in
def test_no_support_different_sectors(self): battle = self.battle self.carol.sector = 7 s1 = battle.create_skirmish(self.alice, 2) prev_skirmishes = self.sess.query(db.SkirmishAction).count() with self.assertRaises(db.WrongSectorException): s1.react(self.carol, 2, hi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cant_start_fight_in_sector_zero(self):\n battle = self.battle\n self.alice.sector = 0\n\n prev_skirmishes = self.sess.query(db.SkirmishAction).count()\n with self.assertRaises(db.NoSuchSectorException):\n battle.create_skirmish(self.alice, 2)\n now_skirmishes ...
[ "0.6679059", "0.6258045", "0.6146013", "0.614008", "0.6102599", "0.6074899", "0.60706127", "0.6017862", "0.6010168", "0.5993785", "0.5981388", "0.5903833", "0.5761203", "0.5753857", "0.5733192", "0.57187116", "0.56712544", "0.5667836", "0.56673616", "0.5666955", "0.5656628", ...
0.65712726
1
Sector zero isn't a valid place to fight
def test_cant_start_fight_in_sector_zero(self): battle = self.battle self.alice.sector = 0 prev_skirmishes = self.sess.query(db.SkirmishAction).count() with self.assertRaises(db.NoSuchSectorException): battle.create_skirmish(self.alice, 2) now_skirmishes = self.sess....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_support_different_sectors(self):\n battle = self.battle\n self.carol.sector = 7\n\n s1 = battle.create_skirmish(self.alice, 2)\n prev_skirmishes = self.sess.query(db.SkirmishAction).count()\n with self.assertRaises(db.WrongSectorException):\n s1.react(self....
[ "0.66198516", "0.64547235", "0.6400996", "0.60747266", "0.5686613", "0.5592364", "0.5578621", "0.54812294", "0.5431174", "0.5384251", "0.53677344", "0.5342912", "0.5332669", "0.53319407", "0.53308547", "0.53085345", "0.52721715", "0.52696204", "0.52576536", "0.5248324", "0.52...
0.71960646
0
Make sure VP2.0 is working as intended
def test_vp_mark2(self): # Test of the VP system as outlined at http://redd.it/2k96il battle = self.battle s1 = battle.create_skirmish(self.bob, 30) # Attack with 30 -> 8vp s2 = s1.react(self.alice, 15, troop_type="cavalry") # Oppose with 30 -> 7vp s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_going_down(self):", "def test_post_nveto_pmts(self):\n pass", "def has_vp(self):\n raise NotImplementedError", "def test_post_voltage_maps(self):\n pass", "def is_vp_on(self):\n raise NotImplementedError", "def test_vsg_f...
[ "0.61182004", "0.60457355", "0.59960026", "0.5870055", "0.58510983", "0.5850618", "0.58469063", "0.5836071", "0.57391274", "0.5677977", "0.5674923", "0.56707656", "0.56542206", "0.5651678", "0.56377363", "0.5611573", "0.56004316", "0.55828303", "0.55753917", "0.5574288", "0.5...
0.610728
1
Buffs should expire during update
def test_buff_expiration(self): sess = self.sess battle = self.battle # For the buff to work, alice needs to own this region battle.region.owner = self.alice.team sess.commit() s1 = battle.create_skirmish(self.alice, 30) # Attack 30 infantry s1.react(self.bob, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expire_ban(self):\n pass", "def _do_expire(self):\n t = time.time()\n\n # Expire probes\n for ip, expire_at in self.outstanding_probes.items():\n if t > expire_at:\n self.outstanding_probes.pop(ip, None)\n if ip in self.live_servers:\n...
[ "0.6242827", "0.5879021", "0.57970774", "0.5760357", "0.5757112", "0.56892097", "0.5640932", "0.5618423", "0.55453074", "0.5532479", "0.55143934", "0.5485789", "0.5456731", "0.5439161", "0.54201627", "0.54194653", "0.5411782", "0.54014707", "0.53992915", "0.53857243", "0.5325...
0.66497093
0
Make sure orangered victories actually count
def test_orangered_victory(self): self.assertEqual(None, self.sapphire.owner) sess = self.sess self.battle.create_skirmish(self.alice, 5) self.battle.ends = self.battle.begins sess.commit() updates = Battle.update_all(sess) sess.commit() self.assertNotEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_violence(self):\n # First time offender get registered in the system and changes category into an Aggressor and a Victim\n if self.assaulted == 0:\n if self.stress > self.random.random():\n self.category = 'aggressor'\n self.assaulted += 1\n ...
[ "0.63099396", "0.59010875", "0.58280236", "0.5823622", "0.5699804", "0.5681795", "0.5663191", "0.5559387", "0.5555499", "0.5537396", "0.55281454", "0.55118805", "0.5493975", "0.54680467", "0.5466667", "0.5458474", "0.5455572", "0.54442436", "0.5437801", "0.5426647", "0.541308...
0.6376024
0
Make sure homeland defense buffs work properly
def test_homeland_defense(self): self.conf["game"]["homeland_defense"] = "100/50/25" self.assertEqual(None, self.sapphire.owner) battle = self.battle sess = self.sess # Skirmish 1 s1 = battle.create_skirmish(self.alice, 10) # Attack 10 s1a = s1.react(self.carol,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_buff_nostacking(self):\n battle = self.battle\n s1 = battle.create_skirmish(self.alice, 20) # Attack 20 infantry\n s1.react(self.bob, 20) # -- oppose 20 infantry\n s1.react(self.dave, 6) # -- oppose 6 infantry\n\n s1.buff_with...
[ "0.64206195", "0.6213481", "0.6145314", "0.6064711", "0.59478605", "0.5906304", "0.58735126", "0.5822274", "0.5806574", "0.58036184", "0.57708496", "0.5770829", "0.57505125", "0.57458353", "0.5717229", "0.57041544", "0.5693837", "0.5692482", "0.56834847", "0.56811273", "0.565...
0.64651537
0
The `time_units` object should list singular/plural string tuples for each possible time unit choice.
def test_fields_effort_time_units_dictionary_string(self, _mock_check): field = EffortField(time_units={"minute": "minute"}) errors = field.check() self.assertEqual(len(errors), 1) error = errors[0] self.assertEqual(error.msg, "'time_units' must be a dictionary of tuples.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_unit(self, variables):\n if len(self.TIME_VARIABLE):\n # times = self._get_variable(variables, self.TIME_VARIABLE)[:]\n units = variables['time'].units\n return units\n else:\n return \"\"", "def time_units(self) -> str:\n return self....
[ "0.66210455", "0.64962125", "0.6310256", "0.6243986", "0.6172801", "0.6071503", "0.6054874", "0.597073", "0.5903953", "0.58468944", "0.5775648", "0.57703346", "0.57623714", "0.5754559", "0.5732214", "0.572949", "0.5704426", "0.56998724", "0.56950045", "0.562585", "0.55660784"...
0.65280527
1
Successfuly instantiate an effort field with a valid definition of time_units.
def test_fields_effort_time_units_dictionary_success(self, _mock_check): field = EffortField(time_units={"minute": ("minute", "minutes")}) errors = field.check() self.assertEqual(len(errors), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fields_effort_time_units_required(self, _mock_check):\n field = EffortField()\n errors = field.check()\n self.assertEqual(len(errors), 1)\n error = errors[0]\n self.assertEqual(\n error.msg, \"Effort fields must define a 'time_units' attribute.\"\n )\n ...
[ "0.70330894", "0.6708433", "0.637528", "0.61861193", "0.6182248", "0.60161173", "0.5713787", "0.57050014", "0.57042706", "0.5659156", "0.56355757", "0.55543", "0.5543725", "0.55088395", "0.5478543", "0.53843373", "0.537652", "0.5352166", "0.5351796", "0.53372765", "0.53111565...
0.6872836
1
Trying to instantiate an effort field with an invalid default effort unit should not pass the checks.
def test_fields_effort_default_effort_unit_invalid(self, _mock_check): field = EffortField( time_units={"minute": ("minute", "minutes")}, default_effort_unit="invalid" ) errors = field.check() self.assertEqual(len(errors), 1) error = errors[0] self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fields_effort_default_effort_unit_success(self, _mock_check):\n field = EffortField(\n time_units={\"minute\": (\"minute\", \"minutes\")}, default_effort_unit=\"minute\"\n )\n\n errors = field.check()\n self.assertEqual(len(errors), 0)", "def test_fields_effort_def...
[ "0.6407443", "0.6119699", "0.5791611", "0.56821656", "0.56788296", "0.56445104", "0.5627635", "0.5598608", "0.5586389", "0.5577874", "0.550885", "0.54858345", "0.5473265", "0.5447214", "0.5441613", "0.5421066", "0.5402424", "0.5385762", "0.5336041", "0.5326429", "0.5322604", ...
0.68223494
0
Successfully instantiating an effort field with a default effort unit.
def test_fields_effort_default_effort_unit_success(self, _mock_check): field = EffortField( time_units={"minute": ("minute", "minutes")}, default_effort_unit="minute" ) errors = field.check() self.assertEqual(len(errors), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_glass_capacity__has_expected_default_value():\n glass = moet.create_glass(\"A\")\n assert glass.capacity == 250", "def test_fields_effort_default_effort_unit_invalid(self, _mock_check):\n field = EffortField(\n time_units={\"minute\": (\"minute\", \"minutes\")}, default_effort_un...
[ "0.5566992", "0.55520004", "0.52832985", "0.5258384", "0.52392936", "0.52114844", "0.5147716", "0.51188076", "0.5114156", "0.50971746", "0.5062016", "0.5045789", "0.50389683", "0.5030574", "0.50296533", "0.5029191", "0.5028355", "0.5025197", "0.5020525", "0.50115055", "0.4975...
0.5687161
0
Trying to instantiate an effort field with an invalid default reference unit should not pass the checks.
def test_fields_effort_default_reference_unit_invalid(self, _mock_check): field = EffortField( time_units={"minute": ("minute", "minutes")}, default_reference_unit="invalid", ) errors = field.check() self.assertEqual(len(errors), 1) error = errors[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fields_effort_default_effort_unit_invalid(self, _mock_check):\n field = EffortField(\n time_units={\"minute\": (\"minute\", \"minutes\")}, default_effort_unit=\"invalid\"\n )\n\n errors = field.check()\n self.assertEqual(len(errors), 1)\n\n error = errors[0]\n...
[ "0.6802078", "0.6742572", "0.65150154", "0.6235477", "0.60174453", "0.6001082", "0.5874366", "0.57094264", "0.56961966", "0.56684256", "0.56497365", "0.56440604", "0.5609837", "0.5588175", "0.5564511", "0.55639386", "0.55550784", "0.55489916", "0.55264205", "0.5523252", "0.55...
0.7106623
0
Successfully instantiating an effort field with a default reference unit.
def test_fields_effort_default_reference_unit_success(self, _mock_check): field = EffortField( time_units={"minute": ("minute", "minutes")}, default_reference_unit="minute", ) errors = field.check() self.assertEqual(len(errors), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fields_effort_default_reference_unit_invalid(self, _mock_check):\n field = EffortField(\n time_units={\"minute\": (\"minute\", \"minutes\")},\n default_reference_unit=\"invalid\",\n )\n\n errors = field.check()\n self.assertEqual(len(errors), 1)\n\n ...
[ "0.6068699", "0.57065034", "0.5490475", "0.5445494", "0.541955", "0.5358551", "0.5281326", "0.52773386", "0.5230165", "0.5155736", "0.5153045", "0.512243", "0.50940686", "0.50860965", "0.50385386", "0.50339186", "0.502558", "0.502396", "0.5011245", "0.49972126", "0.49727124",...
0.6300686
0
Ensures request is Json, session is active and the correct session key is supplied
def _ValidRequest(request): if not request.json: abort(400) sessId = request.json['sessionId'] sessKey = request.json['sessionKey'] # Check if it is active and correct key return database.SessionActive(sessId) and database.CorrectSessionKey(sessId, sessKey)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def view_session(request: Request):\n return JSONResponse(request.session)", "def test_new_session_created_with_auth_json_no_cookie(self):\n\n with self.app_sess1 as c:\n data = {\n \"token\": \"pretend_token\"\n }\n ret = c.post('/', data=json.dump...
[ "0.6244704", "0.6231964", "0.6157186", "0.6138115", "0.6120776", "0.5998519", "0.5970557", "0.59146553", "0.58658266", "0.58612305", "0.5842166", "0.5771671", "0.5743049", "0.5724865", "0.5712974", "0.5704158", "0.56624156", "0.56435186", "0.563466", "0.5626631", "0.56000286"...
0.7161011
0
returns artist email if it is unique
def get_artist_email(): artist_email = input('Please enter artist\'s email: ') while controls_utils.artist_email_not_unique(artist_email): print('Artist\'s email must be unique. ') artist_email = input('Please enter artist\'s email: ') return artist_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_artist(self):\n artists = FileRecord.query(FileRecord.artist).distinct().filter(\n FileRecord.album == self.name).filter(\n FileRecord.year == self.year).all()\n\n if len(artists) > 1:\n return \"Various Artists\"\n elif len(artists) == 1:\n ...
[ "0.66312927", "0.6207215", "0.61675626", "0.6128956", "0.612181", "0.6059138", "0.6052142", "0.6011615", "0.60024756", "0.59820944", "0.5937926", "0.5915206", "0.58750767", "0.5872202", "0.58694685", "0.5866588", "0.58505774", "0.5826908", "0.58094186", "0.57954603", "0.57947...
0.76967454
0
returns artwork name if it is unique for creating new records
def get_new_artwork_name(): artwork_name = input('Please enter title of artwork: ') while not controls_utils.artwork_name_is_unique(artwork_name): print('Artwork name is taken') artwork_name = input('Please enter title of artwork: ') return artwork_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_artwork_name():\n artwork_name = input('Please enter title of artwork: ')\n if not controls_utils.artwork_name_is_unique(artwork_name):\n return artwork_name\n else:\n print('artwork not found')", "def try_create_uniqe_title(self,title,owner):\n if self.valid_title(title):\n...
[ "0.73656523", "0.6096115", "0.6094721", "0.60884243", "0.5944674", "0.58501154", "0.58242446", "0.5798604", "0.56803983", "0.56430686", "0.56228995", "0.5541038", "0.5530707", "0.5527085", "0.5525762", "0.551446", "0.55008", "0.54562396", "0.5454412", "0.5428754", "0.54002196...
0.7228978
1
returns artwork name already in db for accessing artwork for functions
def get_artwork_name(): artwork_name = input('Please enter title of artwork: ') if not controls_utils.artwork_name_is_unique(artwork_name): return artwork_name else: print('artwork not found')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artwork_id(self) -> str:\n return self.relay(\"artwork_id\")", "def get_new_artwork_name():\n artwork_name = input('Please enter title of artwork: ')\n while not controls_utils.artwork_name_is_unique(artwork_name):\n print('Artwork name is taken')\n artwork_name = input('Please ent...
[ "0.6272623", "0.627238", "0.6110136", "0.6011075", "0.5951154", "0.59244585", "0.58771366", "0.5704116", "0.5623007", "0.55986863", "0.5502767", "0.5487516", "0.5482874", "0.5481453", "0.5475872", "0.5459583", "0.541917", "0.54038113", "0.54038113", "0.53657216", "0.535134", ...
0.7119328
0
checks if artist name is already registered and if not, registers them before adding new artwork
def add_new_artwork(): artist_name = get_artist_name() if not controls_utils.artist_already_in_db(artist_name): print('Artist not registered, creating new registration. ') email = get_artist_email() new_artist = Artist(artist_name, email) artwork_db.add_artist(new_artist) art...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_artist(artist_name):\n if controls_utils.artist_already_in_db(artist_name):\n print('This artist is already in database')\n\n else:\n artist_email = get_artist_email()\n new_artist = Artist(artist_name, artist_email)\n artwork_db.add_artist(new_artist)", "def addArti...
[ "0.7512231", "0.70247054", "0.6972556", "0.6826065", "0.6521868", "0.6520903", "0.6467225", "0.64457726", "0.63808656", "0.6248312", "0.6247259", "0.620168", "0.6199984", "0.6120154", "0.60596985", "0.6055652", "0.60216147", "0.59817195", "0.59527135", "0.5930472", "0.5866090...
0.71755606
1
adds new artist to db if they are not already in
def add_new_artist(artist_name): if controls_utils.artist_already_in_db(artist_name): print('This artist is already in database') else: artist_email = get_artist_email() new_artist = Artist(artist_name, artist_email) artwork_db.add_artist(new_artist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_artist(self, artist):\n\n insert_artist = 'INSERT INTO artists (name, email, artist_id) VALUES (?, ?, ?)'\n\n try:\n with sqlite3.connect(db_path) as conn:\n res = conn.execute(insert_artist, (artist.name, artist.email, artist.artist_id))\n new_id = r...
[ "0.8128571", "0.7432734", "0.72047126", "0.7142562", "0.7089367", "0.6940522", "0.6874244", "0.687114", "0.68703157", "0.6851918", "0.6840053", "0.67764634", "0.67681867", "0.6488752", "0.6475834", "0.6470941", "0.6462443", "0.64317393", "0.62935674", "0.62439895", "0.6226857...
0.77281874
1
checks if artist is in db, if so displays their works that are unsold
def display_artist_available_portfolio(artist_name): if controls_utils.artist_has_work_in_db(artist_name): results = artwork_db.get_available_artwork_from_one_artist(artist_name) if results: for piece in results: print(piece) else: print('Sorry this ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_artist_complete_portfolio(artist_name):\n if controls_utils.artist_has_work_in_db(artist_name):\n results = artwork_db.get_all_artwork_from_one_artist(artist_name)\n for piece in results:\n print(piece)\n else:\n print('Sorry, no artwork from this artist to display...
[ "0.629018", "0.6007671", "0.5936472", "0.58785075", "0.5646522", "0.54772884", "0.5399925", "0.5379606", "0.53653336", "0.5363873", "0.53454787", "0.5341607", "0.53369594", "0.53170526", "0.531617", "0.5293473", "0.5213106", "0.5198957", "0.51982343", "0.51897067", "0.5182730...
0.6492745
0
gets name of artwork to delete and checks to make sure before deleting
def get_artwork_to_delete(): artwork = input('Which artwork would you like to delete? ') while not controls_utils.artwork_exists(artwork): artwork = input('Which artwork would you like to delete? ') artist = controls_utils.name_of_artist(artwork) response = input('Are you sure you want to delete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_artwork(artwork):\n artwork_db.delete_artwork(artwork)", "def delete_thumbnail(self, thumbnail_name):", "def get_artwork_name():\n artwork_name = input('Please enter title of artwork: ')\n if not controls_utils.artwork_name_is_unique(artwork_name):\n return artwork_name\n else:\n ...
[ "0.74340343", "0.6875369", "0.6488465", "0.6230092", "0.61193043", "0.60223025", "0.600303", "0.59973776", "0.5964071", "0.5895225", "0.5831127", "0.58218324", "0.5801476", "0.5795376", "0.5749312", "0.57488483", "0.5737199", "0.5734383", "0.5707277", "0.5698352", "0.5694252"...
0.72529954
1
after confirming the artwork exists and is not already sold, changes status to sold
def change_availability(): artwork_sold = get_artwork_name() if not controls_utils.artwork_exists(artwork_sold): print('No record of that piece of art. ') else: artist = controls_utils.name_of_artist(artwork_sold) if not controls_utils.artwork_available(artwork_sold, artist): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_sold(artwork):\n artwork_db.update_artwork(artwork)\n print(artwork + ' has been marked as sold. ')", "def _update_availability(self, artwork):\n\n if not artwork.artist_id:\n raise ArtworkError('Book does not have ID, can\\'t update')\n\n query_update_availability = 'U...
[ "0.76929826", "0.66940457", "0.6220531", "0.604035", "0.6011558", "0.58244693", "0.5766954", "0.56088907", "0.5524131", "0.548621", "0.5472159", "0.5438635", "0.5438635", "0.5418989", "0.539853", "0.5393509", "0.5359396", "0.53583866", "0.53555226", "0.534612", "0.531315", ...
0.7106835
1
prints all artwork for testing purposes
def display_all(): results = artwork_db.get_all_artwork() for artist in results: print(artist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n art = \"\\n\".join([\"\".join(row) for row in self.text])\n if self.args.output:\n with open(self.args.output, \"w\") as f:\n f.write(art)\n\n if self.args.verbose:\n print(art)", "def test_artwork(self):\n # Create some art wi...
[ "0.6744282", "0.63890773", "0.61532515", "0.6067221", "0.6010384", "0.59992516", "0.5979724", "0.58644783", "0.5831193", "0.5777325", "0.5777325", "0.5749137", "0.5746105", "0.57324183", "0.57141465", "0.5633593", "0.5600985", "0.55797815", "0.5532287", "0.55314124", "0.55311...
0.703469
0
Create an FtpUser instance from a URL. The scheme, username, password, host and port are extracted from the URL; any path data, query string and hash are ignored. A title is, if not specified, constructed from the scheme and host.
def create_from_url(self, url, title=None): url = urlparse(url) if url.scheme == 'ftp': port = 21 elif url.scheme == 'ftps': port = 990 elif url.scheme == 'sftp': port = 22 elif url.scheme == '': raise ValueError('URL has no scheme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_url(cls, url: URL, *, encoding: str = \"latin1\") -> Optional[\"BasicAuth\"]:\n if not isinstance(url, URL):\n raise TypeError(\"url should be yarl.URL instance\")\n if url.user is None:\n return None\n return cls(url.user, url.password or \"\", encoding=encoding...
[ "0.62467754", "0.6042227", "0.601402", "0.583077", "0.5744555", "0.5706708", "0.56767875", "0.551295", "0.54875374", "0.5467554", "0.54085314", "0.5384588", "0.5314198", "0.52867806", "0.52697563", "0.52619296", "0.52078646", "0.51161796", "0.51135653", "0.5037481", "0.498040...
0.78416204
0
Should return 'ftp', 'ftps' or 'sftp', but can return other values if the host is instead a URL with a different scheme.
def protocol(self): if '://' in self.host: scheme, host = self.host.split('://', 1) return scheme elif self.port == 21: return 'ftp' elif self.port == 22: return 'sftp' elif self.port == 990: return 'ftps' else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match(cls, url, **kwargs):\n return url.scheme.startswith('ftp')", "def getSchemes(clazz):\n return [\"sftp\"]", "def default_protocol(self):\n return \"sftp://\"", "def test_scheme(self):\n self.assertEqual(self.ftp_case.scheme, \"ftp\")\n self.assertEqual(self.ldap_c...
[ "0.6515323", "0.6393162", "0.63670725", "0.6297537", "0.6294226", "0.6239581", "0.6223189", "0.6099167", "0.60723436", "0.59676903", "0.59063804", "0.5817976", "0.58139056", "0.5719531", "0.570742", "0.5649601", "0.5646128", "0.562775", "0.561612", "0.5568476", "0.5562886", ...
0.7592643
0
``self`` as a URL, including the username and password where possible.
def as_url(self): if self.host.startswith(('http://', 'https://')): # Some persons have put HTTP details in an FtpUser. At least # partially any UI's fault, though still their fault... return self.host protocol, port, host = self.protocol, self.port, self.host ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, url, username, password, **kwargs):\n self.url = url\n self.username = username\n self.password = password\n self.context = kwargs", "def url(self, privacy=False, *args, **kwargs):\n\n # Our URL parameters\n params = self.url_parameters(privacy=privacy...
[ "0.682425", "0.67110646", "0.66964537", "0.6692836", "0.64586484", "0.634907", "0.6341694", "0.6297712", "0.6285951", "0.62704325", "0.6253215", "0.6201056", "0.61710817", "0.61552453", "0.6132472", "0.6080954", "0.60625875", "0.60589164", "0.60349417", "0.60145766", "0.59989...
0.68590957
0
Build task A branch.
def build_task_a(self, x, y, is_training, ext_wts=None): config = self.config global_step = self.global_step if config.backbone_class == 'resnet_backbone': bb_config = config.resnet_config else: assert False, 'Not supported' proto_config = config.protonet_config opt_config = config.o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def trigger_build(self, *, branch=None, message=None):", "def create_branch(self):\n os.chdir(str(self.repository_path))\n sh.git.checkout('master')\n sh.git.checkout('-b', self.branch)\n logger.debug('Branch {} created', self.branch)", "def task_build(argv):\n pytaskmaster...
[ "0.6055547", "0.5845551", "0.58151907", "0.5802773", "0.57201207", "0.5653951", "0.5646536", "0.5626943", "0.55422276", "0.5541642", "0.55228865", "0.55066115", "0.5382394", "0.5382394", "0.53815293", "0.5371971", "0.5292997", "0.5239128", "0.5233028", "0.5226324", "0.5212434...
0.6202664
0
Returns a set of slow weights.
def get_slow_weights(self): var_list = tf.trainable_variables() var_list = list(filter(lambda x: 'phi' in x.name, var_list)) layers = self.config.transfer_config.meta_layers if layers == "all": pass elif layers == "4": keywords = ['TaskB', 'unit_4_'] filter_fn = lambda x: any([kw i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weights(self):\n return []", "def get_weights(self):", "def get_weights(self):\n return [self.w, self.b]", "def weights(self) -> List[float]:", "def calculate_weights():\n weights = {}\n\n\n # estimate run time of step 1 (fast sweep)\n f_range = sweepe...
[ "0.6849988", "0.683276", "0.6728212", "0.67091906", "0.66474336", "0.6596948", "0.658838", "0.658838", "0.658838", "0.65582275", "0.6556428", "0.6556385", "0.6556385", "0.65001744", "0.65001744", "0.65001744", "0.64975744", "0.64975744", "0.64801264", "0.64801264", "0.6453062...
0.7462858
0
Evaluate one step on task A.
def eval_step_a(self, sess, task_a_data): x_a, y_a = task_a_data fdict = self.get_fdict(task_a_data=task_a_data) prediction_a, y_a = sess.run([self.prediction_a_all, self.labels_all], feed_dict=fdict) return prediction_a, y_a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_step_a(self, sess, task_a_data):\n x_a, y_a = task_a_data\n fdict = self.get_fdict(task_a_data=task_a_data)\n cost_a, _ = sess.run([self.cost_a, self.train_op_a], feed_dict=fdict)\n return cost_a", "def step_A(self, *args, **kwargs):\n # note - this could be done with a direct db que...
[ "0.65628225", "0.6294123", "0.6179907", "0.6160043", "0.61450297", "0.6023741", "0.59158623", "0.5862764", "0.5809173", "0.5795603", "0.5762719", "0.57541555", "0.5721735", "0.5702014", "0.5693075", "0.5686475", "0.56840885", "0.5677659", "0.5667791", "0.56597733", "0.5618881...
0.68857276
0
Evaluate one step on task B.
def eval_step_b(self, sess, task_b_data): raise NotImplemented()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_step(self, sess, task_a_data, task_b_data):\r\n fdict = self._prerun(sess, None, task_b_data)\r\n sess.run(self._update_grads_b, feed_dict=fdict)\r\n train_op = self.train_op_b\r\n\r\n cost_b_v, _ = sess.run([self.cost_b_v, train_op],\r\n feed_dict=fdict)\r\n...
[ "0.71829134", "0.6771176", "0.6767714", "0.6698021", "0.63905007", "0.63236654", "0.62424046", "0.6112074", "0.60616606", "0.59855074", "0.59512186", "0.5926077", "0.5890276", "0.5878687", "0.58514184", "0.58282244", "0.58180755", "0.5784487", "0.57340306", "0.56864625", "0.5...
0.73499215
0
Searches for gitignore file in current and parent directories
def get_gitignore(path): if '.gitignore' in os.listdir(path): return parse_gitignore(os.path.join(path, '.gitignore')) else: full_path = os.path.abspath(path) if full_path == '/': return return get_gitignore(os.path.dirname(full_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gitignored(self, path):\n if path.startswith(self.options.target_repo.location):\n repo_prefix_len = len(self.options.target_repo.location) + 1\n path = path[repo_prefix_len:]\n return self.gitignore.match_file(path)", "def gitignore(self):\n patterns = []\n ...
[ "0.7278777", "0.6781642", "0.64230764", "0.636225", "0.6207674", "0.6181297", "0.61577624", "0.61192256", "0.6116596", "0.61151797", "0.6023385", "0.6021016", "0.60138816", "0.5991891", "0.59749573", "0.5922214", "0.590698", "0.58640575", "0.5849364", "0.58041465", "0.5761537...
0.6787644
1
Returns a list with gitignore's content
def parse_gitignore(gipath): gitignore_file = open(os.path.abspath(gipath), 'r') gilist = [] for row in gitignore_file.readlines(): if not row.startswith('#') and row != '\n': if row.endswith('/\n'): gilist.append(row[:-2]) else: gilist.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_gitignore():\n excludes = []\n gitignore = Path(\".gitignore\")\n if gitignore.exists():\n with gitignore.open() as f:\n excludes += f.read().split(\"\\n\")\n else:\n raise ValueError(\n \"No exclude configuration option and no .gitignore file present\"\n ...
[ "0.7136777", "0.68094444", "0.6735772", "0.6703383", "0.656776", "0.6520689", "0.6497992", "0.6473873", "0.64219946", "0.6379378", "0.6348677", "0.63169664", "0.6281277", "0.62797284", "0.62559724", "0.62339705", "0.62146395", "0.6168146", "0.61291796", "0.60304403", "0.60273...
0.70429176
1
Prints a report at the end of the search
def report(): global COUNTER if COUNTER > 0: print('\n\n') print('Searched {0} files'.format(SEARCHED)) print('Found {0} TODOs in {1} files'.format(COUNTER, F_COUNTER))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report():\n pass", "def test_03_print_result(self, pages):\n pages.search.close_location_pop_up()\n pages.search.print_search_results()", "def fullreport(self):\n print \"\"\n print \"Liten2 Full Reporting\"\n print \"--------------------------------------\"\n ...
[ "0.7021992", "0.6844773", "0.6789687", "0.66836685", "0.66819364", "0.65366095", "0.65018225", "0.648304", "0.64820206", "0.64493674", "0.64239174", "0.64180636", "0.6405773", "0.632852", "0.62888855", "0.62459767", "0.6233217", "0.6169831", "0.61656654", "0.6095023", "0.6093...
0.7143622
0
Create the perspective in a workbench window. For most cases you should just be able to set the 'contents' trait to lay out views as required. However, you can override this method if you want to have complete control over how the perspective is created.
def create(self, window): # Set the size of the editor area. if self.editor_area_size != (-1, -1): window.editor_area_size = self.editor_area_size # If the perspective has specific contents then add just those. if len(self.contents) > 0: self._add_conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n\n cv2.namedWindow(winname=self.title, flags=self.style)", "def create(self, verbose=False):\r\n # delete the window if its handle exists\r\n if cmds.window(self.window, exists=True):\r\n cmds.deleteUI(self.window)\r\n # initialize the window as a pane fo...
[ "0.6131212", "0.5922545", "0.58861494", "0.5807673", "0.57519644", "0.5720677", "0.56706893", "0.56655294", "0.56585646", "0.5613341", "0.5611122", "0.5565591", "0.5520122", "0.55085135", "0.5473944", "0.54577786", "0.54514945", "0.54325914", "0.54226893", "0.54205424", "0.54...
0.7491928
0
Called when the perspective is shown in a workbench window. The default implementation does nothing, but you can override this method if you want to do something whenever the perspective is activated.
def show(self, window): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendererWindowActivated(self, sw):\n pass", "def show(self):\n if AMOEBA_CREATE_EXPERIMENT_DEBUG:\n print \"Show Window.\"\n self.subWindow.show()", "def show_window(self):\n self.show()", "def show(self):\n # * displays the window, after using either the ico...
[ "0.636253", "0.6302572", "0.61699057", "0.61239356", "0.6110351", "0.6086942", "0.60822815", "0.59712666", "0.59361935", "0.59361935", "0.59361935", "0.59168285", "0.59083813", "0.5892436", "0.585637", "0.58189636", "0.57990617", "0.5798876", "0.5788901", "0.57813394", "0.576...
0.6407262
0
Adds a perspective item to a window.
def _add_perspective_item(self, window, item): # If no 'relative_to' is specified then the view is positioned # relative to the editor area. if len(item.relative_to) > 0: relative_to = window.get_view_by_id(item.relative_to) else: relative_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perspective(self, perspective):\n\n self.container['perspective'] = perspective", "def create(self, window):\r\n\r\n # Set the size of the editor area.\r\n if self.editor_area_size != (-1, -1):\r\n window.editor_area_size = self.editor_area_size\r\n\r\n # If the perspec...
[ "0.65281814", "0.59958583", "0.5550467", "0.54392403", "0.5326437", "0.5264936", "0.52013224", "0.5158011", "0.51520026", "0.5143954", "0.51338893", "0.5127427", "0.50639695", "0.50639695", "0.50639695", "0.5023666", "0.49614492", "0.49010316", "0.48866042", "0.48582387", "0....
0.81795806
0
Adds all of the window's views defined in the window.
def _add_all(self, window): for view in window.views: if view.visible: self._add_view(window, view) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_views(self, *args):\n for view in args:\n self.add_view(view)", "def _add_contents(self, window, contents):\r\n\r\n # If we are adding specific contents then we ignore any default view\r\n # visibility.\r\n #\r\n # fixme: This is a bit ugly! Why don't we pass...
[ "0.6691571", "0.6673106", "0.63949", "0.6238598", "0.6078048", "0.6038041", "0.5954232", "0.5949496", "0.5762432", "0.57136166", "0.56896406", "0.5647092", "0.557947", "0.5575854", "0.55426127", "0.5486439", "0.5435242", "0.543413", "0.5398227", "0.53780955", "0.53368187", ...
0.8775787
0
Adds a view to a window.
def _add_view(self, window, view): # If no 'relative_to' is specified then the view is positioned # relative to the editor area. if len(view.relative_to) > 0: relative_to = window.get_view_by_id(view.relative_to) else: relative_to = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_window(self, window: AbstractView) -> None:\n self._logger.debug(\"running\")\n window.setParent(self)\n self.addSubWindow(window)\n window.show()\n window.restore_window()\n self._logger.debug(\"done\")", "def add_view(self, view):\n # Add to views\n ...
[ "0.70577765", "0.6667131", "0.6417828", "0.63806814", "0.6346493", "0.630583", "0.62911326", "0.6290349", "0.6270349", "0.6236298", "0.6112068", "0.6045884", "0.60054344", "0.5985006", "0.5970879", "0.5946463", "0.5931123", "0.5889573", "0.58193064", "0.5818502", "0.57805985"...
0.8629264
0
When a required privilege is not even defined in the database, permission is denied; no crashing.
def test_requires_privilege_no_such(self): @requires_privilege('bomboozle', domain='zizzle') def view(request, *args, **kwargs): pass requestor_role = arbitrary.role() request = HttpRequest() request.role = requestor_role with self.assertRaises(PermissionDeni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeniedPermissions(self) -> _n_6_t_0:", "def test_requires_privilege_denied(self):\n\n @requires_privilege(self.zazzle_privilege.slug, domain='zizzle')\n def view(request, *args, **kwargs):\n pass\n\n requestor_role = arbitrary.role()\n\n request = HttpRequest()\n ...
[ "0.67563957", "0.6332472", "0.6197399", "0.61634755", "0.6141772", "0.6102919", "0.6063586", "0.59873784", "0.5971427", "0.59551877", "0.58554024", "0.5852332", "0.5852332", "0.5848382", "0.580401", "0.57996124", "0.5798952", "0.57737225", "0.5743074", "0.57005423", "0.570054...
0.6504519
1
Parses a line from subnetdata.txt Returns None if the line did not contain network information. Otherwise it returns the attributes that are interesting to us as a dict.
def parse_line(self, line): # Format of subnetdata.txt: # - Fields are separated by tabs # - A field is a key/value pair, separated by a space # - The value of the DefaultRouters field is a comma-separated list of # IP addresses # - The value of the UDF field is a list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_subnet_info(self, context):\n\n subnet = {}\n data = {}\n subnet_id = str(context.get('id', ''))\n data['subnet_id'] = subnet_id\n data['subnet_name'] = str(context.get('name', ''))\n data['tenant_id'] = str(context.get('tenant_id', ''))\n data['network_id'...
[ "0.5925786", "0.57917464", "0.5593678", "0.55182445", "0.55075026", "0.52525884", "0.5221545", "0.5205276", "0.5152222", "0.5098498", "0.50964147", "0.5092493", "0.50791293", "0.5054493", "0.5048382", "0.5023908", "0.49907443", "0.49807265", "0.4974957", "0.49546623", "0.4918...
0.70451194
0
Return a triangle strip Gouraudshaded based on values at each vertex.
def gouraud_triangle_strip(triangle_strip, vertex_vals, shape, accumulate=False, background=0): triangle_strip = numpy.asarray(triangle_strip, dtype=numpy.float32, order='C') vertex_vals = numpy.asarray(vertex_vals, dtype=numpy.float32, order='C') assert triangle_strip.ndim == 2 and triangle_strip.shape[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gouraud_triangles(triangle_strip, vertex_vals, shape):\n triangle_strip = numpy.asarray(triangle_strip)\n vertex_vals = numpy.asarray(vertex_vals)\n assert triangle_strip.ndim == 2 and triangle_strip.shape[1] == 2 and len(triangle_strip) > 2\n unpack_out = False\n if vertex_vals.ndim == 1:\n ...
[ "0.70117754", "0.59974504", "0.58845705", "0.58478296", "0.58071446", "0.57811844", "0.5730023", "0.5624095", "0.56165123", "0.56160176", "0.5601126", "0.555866", "0.55583763", "0.5546502", "0.5501326", "0.5475135", "0.5457648", "0.5451304", "0.54182714", "0.5414708", "0.5394...
0.7244856
0
Return a triangle strip rasterized into a boolean mask. Mask is guaranteed to be identical to the region drawn by gouraud_triangle_strip, which is not necessarily exactly the case for draw_mask() (which uses a slightly different algorithm internally).
def mask_triangle_strip(triangle_strip, shape): triangle_strip = numpy.asarray(triangle_strip, dtype=numpy.float32, order='C') assert triangle_strip.ndim == 2 and triangle_strip.shape[1] == 2 and len(triangle_strip) > 2 num_vertices = len(triangle_strip) out = numpy.zeros(tuple(shape), dtype=bool, order...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gouraud_triangles(triangle_strip, vertex_vals, shape):\n triangle_strip = numpy.asarray(triangle_strip)\n vertex_vals = numpy.asarray(vertex_vals)\n assert triangle_strip.ndim == 2 and triangle_strip.shape[1] == 2 and len(triangle_strip) > 2\n unpack_out = False\n if vertex_vals.ndim == 1:\n ...
[ "0.660964", "0.572978", "0.56846446", "0.56614095", "0.5645633", "0.5615826", "0.56016004", "0.55722696", "0.5571411", "0.5390756", "0.5227696", "0.52020264", "0.5185661", "0.5173398", "0.5168185", "0.51425934", "0.5140048", "0.513411", "0.51229304", "0.5054843", "0.504088", ...
0.77402407
0
We don't really care how this happens as long as the worker winds up with a worker pool with a correct base_job_template when creating a new work pool
async def test_base_worker_gets_job_configuration_when_syncing_with_backend_with_job_config_and_variables( session, client ): class WorkerJobConfig(BaseJobConfiguration): other: Optional[str] = Field(template="{{ other }}") class WorkerVariables(BaseVariables): other: Optional[str] = Field...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_poolStartServiceChecksForWork(self):\n reactor = MemoryReactorWithClock()\n cph = SteppablePoolHelper(jobSchema + schemaText)\n then = datetime.datetime(2012, 12, 12, 12, 12, 0)\n reactor.advance(astimestamp(then))\n cph.setUp(self)\n pcp = ControllerQueue(reactor...
[ "0.6296183", "0.62347543", "0.615321", "0.6071176", "0.60353386", "0.60198176", "0.5917459", "0.59044653", "0.5898099", "0.58407146", "0.58316094", "0.5808723", "0.57955056", "0.5765526", "0.5756927", "0.57000154", "0.5697046", "0.5683254", "0.5608928", "0.5606832", "0.557531...
0.6370928
0
Test that the job configuration is correctly built from the template and overrides
async def test_base_job_configuration_from_template_and_overrides( template, overrides, expected ): config = await BaseJobConfiguration.from_template_and_values( base_job_template=template, values=overrides ) assert config.dict() == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_job_configuration_from_template_and_overrides(\n template, overrides, expected\n):\n\n class ArbitraryJobConfiguration(BaseJobConfiguration):\n var1: str = Field(template=\"{{ var1 }}\")\n var2: int = Field(template=\"{{ var2 }}\")\n\n config = await ArbitraryJobConfiguration....
[ "0.80357426", "0.72256106", "0.69125086", "0.6896827", "0.6699468", "0.663811", "0.64339805", "0.6272028", "0.6243319", "0.6226876", "0.6217676", "0.6210075", "0.618887", "0.617924", "0.61525685", "0.61100477", "0.6062935", "0.6060679", "0.6009658", "0.5990625", "0.59586096",...
0.8151706
0
Test that the job configuration is correctly built from the template and overrides
async def test_job_configuration_from_template_and_overrides( template, overrides, expected ): class ArbitraryJobConfiguration(BaseJobConfiguration): var1: str = Field(template="{{ var1 }}") var2: int = Field(template="{{ var2 }}") config = await ArbitraryJobConfiguration.from_template_and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_base_job_configuration_from_template_and_overrides(\n template, overrides, expected\n):\n config = await BaseJobConfiguration.from_template_and_values(\n base_job_template=template, values=overrides\n )\n assert config.dict() == expected", "def testJobProperties(databases):\n\n ...
[ "0.8150813", "0.7224147", "0.69114107", "0.68947124", "0.6698226", "0.6636703", "0.6432527", "0.6272015", "0.6242813", "0.6228083", "0.6216085", "0.6208851", "0.6188286", "0.6177688", "0.6151176", "0.6108306", "0.60626", "0.6059457", "0.60078806", "0.5989153", "0.59566575", ...
0.8035178
1
Write the position and vector field in XSF format.
def write_xsf(imode, atoms, vector, scale=1.0): vector = np.asarray(vector, dtype=float) * scale assert vector.shape == atoms.positions.shape pos_vec = np.hstack((atoms.positions, vector)) nions = pos_vec.shape[0] chem_symbs = atoms.get_chemical_symbols() with open('mode_{:04d}.xsf'.format(imod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeXYZPos(self,phys,xyzname):\r\n XYZWriter.XYZWriter(xyzname).write(phys.posvec, phys.myTop.atoms, phys.myTop.atomTypes)", "def output(self):\n to_write = 'X '\n to_write += str(self.def_field['name'])+' '\n to_write += str(self.def_field['pin_number'])+' '\n to_write += s...
[ "0.6510679", "0.62536174", "0.6112638", "0.5977228", "0.59565", "0.59240866", "0.59199125", "0.58994395", "0.58610994", "0.5860792", "0.5841133", "0.58250743", "0.57749456", "0.5760919", "0.57023495", "0.56638163", "0.56223685", "0.56162715", "0.55931556", "0.55753946", "0.55...
0.64434624
1
Retrieve all restaurants in file as a RestaurantCatalog
def get_all(self) -> RestaurantCatalog: catalog = RestaurantCatalog() catalog.add_many(list(self.__data.values())) return catalog
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_restaurant(file):\r\n name_to_rating = {}\r\n price_to_names = {'$':[], '4$':[],'$$$':[],'$$':[]}\r\n cuisine_to_names = {}", "def restaurants_all() -> str:\n restaurant_objects = restaurants.load_restaurants()\n return jsonify(restaurant_objects)", "def get_all_restaurants():\n retu...
[ "0.7021534", "0.6264984", "0.5770384", "0.5722723", "0.56450224", "0.564491", "0.5568687", "0.5530623", "0.551046", "0.5477675", "0.54734993", "0.5457776", "0.54333824", "0.5407601", "0.5406789", "0.5387293", "0.538584", "0.53767186", "0.53694475", "0.5349914", "0.53391904", ...
0.67553145
1
Checks the if the first column of a csv file appears to contain timestamps. Refactored to include __csv_process_header functionality.
def csv_has_timestamps(file_name: str, sample_size: int) -> (bool, int, list): # keep track of how many entries pandas # can and can't parse as datetime confirmed_timestamps = 0 confirmed_non_timestamps = 0 header_lines = 0 columns_list = ["Timestamp", "Value"] with open(file_name) as csvf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _guess_time_format(self, csv_file):\n import csv\n\n fmt_lst = ['%Y/%m/%d %H:%M', '%Y-%m-%d %H:%M:%S']\n\n fmt_found = None\n\n with open(csv_file,'r') as fp:\n reader = csv.DictReader(fp)\n for i,line in enumerate(reader):\n for k,v in line.iter...
[ "0.640366", "0.63820136", "0.6264246", "0.61585444", "0.6134612", "0.6077781", "0.6066581", "0.5915225", "0.5872344", "0.57468706", "0.5743505", "0.5737332", "0.57336193", "0.57112074", "0.5702082", "0.56855357", "0.56678337", "0.56237334", "0.5601129", "0.55361897", "0.55332...
0.7445921
0
Only called when there are 3 columns of data. This function checks if the second column of the DataFrame python list is comprised of integers, parsable pandas. Timestamp strings, or something not accepted as timerelated. In either of the first two cases, the second column is reassigned to be parsable as the time of a p...
def __process_times(raw_array: list, num_row: int): # format strings used in datetime.time().strftime() full_time_format = '%H:%M:%S' hours_time_format = '%H:00:00' minutes_time_format = '00:%M:00' seconds_time_format = '00:00:%S' # booleans for telling what the integers in the second column r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_timestamp(column_name, value, date_format, column_data_type=\"timestamp\"):\n value = value.replace(\"T\", \" \")\n date_format = date_format.replace(\"T\", \" \")\n date_value, time_value = value.split(\" \")\n format_firstpart, format_secondpart = date_format.split('tzh')\n if \"-\" i...
[ "0.6067635", "0.60331184", "0.60145605", "0.5865809", "0.5851198", "0.5844736", "0.5796423", "0.5776691", "0.57648784", "0.5759746", "0.5731371", "0.5680792", "0.5634782", "0.5600407", "0.5599236", "0.55912846", "0.55862063", "0.55465883", "0.55208796", "0.5520295", "0.551307...
0.6348015
0
Redrawing at 50 hz causes the data to freeze. IMU box is refreshing at 10 hz now
def redraw_viz(): global g_last_draw if (rospy.Time.now().to_sec() > (refresh_rate + g_last_draw)): g_last_draw = rospy.Time.now().to_sec() # redraw imu box doDraw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redraw(self):\r\n self.c.update()", "def refresh(self, _loop, data):\n try:\n if(self.model.mode == 'live'):\n self.updateGraphs()\n self.model.memory = int(self.dataClient.recv())\n self.model.cpu = float(self.dataClient.recv())\n ...
[ "0.6556265", "0.6498374", "0.63705957", "0.63530284", "0.63191485", "0.63020533", "0.62957853", "0.62957853", "0.62845606", "0.62845606", "0.62780565", "0.6274635", "0.62744427", "0.62476283", "0.62291384", "0.62132174", "0.6209274", "0.62041783", "0.6187864", "0.6184698", "0...
0.7307154
0
returns True if n is a 'bouncy' number.
def bouncy(n): diffs = [int(b)-int(a) for a,b in zip(str(n)[:-1],str(n)[1:])] return sum([abs(x) for x in diffs])>abs(sum(diffs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Happy(n, b):\r\n n = ToBase(b, n)\r\n seen = set()\r\n while n not in seen:\r\n seen.add(n) \r\n v = 0\r\n while n:\r\n d = n % 10\r\n n = n // 10\r\n v += d * d\r\n n = ToBase(b, v) \r\n if n == 1:\r\n return True\r\n return False", "def i...
[ "0.6266255", "0.5925547", "0.5884278", "0.58818424", "0.5877583", "0.58409125", "0.5840892", "0.58336264", "0.5791553", "0.5779341", "0.57189405", "0.5716756", "0.56896675", "0.56802714", "0.56628543", "0.56577027", "0.5654589", "0.5652041", "0.565071", "0.5629876", "0.561209...
0.71531487
0
Gets the AI's move from the current configuration.
def get_ai_move(board): return Connect4MiniMax.get_move(board)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_move(self, game_state: BotGameState) -> BotMove:\n return", "def get_move(self):\n if self._difficulty == 0:\n return self._get_easy_move()\n else:\n # Different stategies/difficulties can be attached here\n return", "def get_move(self, game):\n ...
[ "0.75694376", "0.7480863", "0.7418201", "0.7150604", "0.68652487", "0.6862122", "0.68234956", "0.67731434", "0.6764384", "0.67577225", "0.6746614", "0.66947275", "0.6655632", "0.6652874", "0.6640375", "0.6605584", "0.66051507", "0.6581102", "0.6555464", "0.6554516", "0.655252...
0.78304815
0
returns message info. with v2 messaging, this method does not work.
def get_message_info(self, msgid=None): raise NotImplementedError('This method is not supported ' 'with v2 messaging') if msgid: return self.sms_client.get_message(msgid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Get_Message_Info(service, userId, message_id):\n message_info = service.users().messages().get(userId=userId, id=message_id).execute()\n\n ID = message_info['id']\n thread_id = message_info['threadId']\n header_info = message_info['payload']['headers']\n for header in header_info:\n if header['name']==...
[ "0.7477835", "0.7271753", "0.72640973", "0.7257839", "0.71884465", "0.71884465", "0.71538955", "0.71054775", "0.7103566", "0.7045384", "0.7045384", "0.70283306", "0.686375", "0.6844654", "0.6824819", "0.6769432", "0.6716818", "0.66525507", "0.66496587", "0.66455567", "0.66245...
0.8126016
0
buy a phone number 'phone_number' from bandwidth
def buy_phone_number(self, phone_number=None, area_code=None, user_id=None, site_id=None, country_code='US'): if country_code not in ('US', 'CA'): logging.info('Only numbers in US or CA are supported, requested ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, phone_number):\n #response = self.client.publish(PhoneNumber=phone_number, Message=self.message)\n return True", "def phonecall():\n phone_number = choice(phone_numbers)\n r = twiml.Response()\n r.dial(phone_number)\n return str(r)", "def dial(phone_number):\n call =...
[ "0.60898256", "0.60582405", "0.6051987", "0.6038466", "0.59917986", "0.5905722", "0.5898733", "0.5886916", "0.5838351", "0.58346975", "0.58340526", "0.58339083", "0.58324045", "0.5787865", "0.574295", "0.5731969", "0.57210875", "0.56918734", "0.56572384", "0.5640075", "0.5599...
0.6985683
0
Find a number within an area code.
def find_number_in_area_code(self, area_code, quantity=1, country_code='US'): if country_code not in ('US', 'CA'): logging.info('Only numbers in US/CA are supported, requested ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_code(self):\n return self.number[:3]", "def main():\n print(search(range(1, 21, 2), 9)) # will print 4\n print(search(range(1, 21, 2), 0)) # will print -1", "def is_in(m):\n\tf=open('places.dat','r')\n\tr = f.read()\n\tf.close()\n\tif str(m) in r:\n\t\tj = r.find(m)/7\n\t\treturn j\n\te...
[ "0.6367211", "0.6041845", "0.5946915", "0.59178984", "0.5855319", "0.57144153", "0.56851524", "0.56310326", "0.55546224", "0.55464876", "0.55371064", "0.55183727", "0.55147284", "0.53723645", "0.53643304", "0.5352899", "0.5344583", "0.53374916", "0.5331702", "0.5317512", "0.5...
0.66250336
0
procures a toll free number.
def buy_toll_free_number(self, quantity=1, pattern=None, site_id=None, user_id=None): if quantity < 1: raise ValueError('Quantity can not be < 1 - passed: {}'. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_free(self, t):\n term1 = (self.snr.E_SN ** 3 * self.pulsar.L_0 ** 2) / (self.snr.m ** 5)\n term2 = (t * YEAR_TO_SEC) ** (6. / 5)\n return CM_TO_PC * 1.44 * term1 ** (1. / 10) * term2", "def use(self):\n if self.credit < self.price_of_trip:\n print(\"Your credit is not...
[ "0.62152404", "0.59016234", "0.5845852", "0.5821504", "0.5800439", "0.56484985", "0.5638114", "0.56370085", "0.5564734", "0.55455524", "0.5474723", "0.5458936", "0.5431911", "0.5408704", "0.5308613", "0.530613", "0.5302213", "0.52963436", "0.528371", "0.52709514", "0.5269176"...
0.6200835
1
verifies if number if in service
def in_service(self, number): nat_number = phonenumber_as_e164(number) nat_number = self._parse_number_to_bw_format(str(nat_number), 'US') retval = False try: self.account_client.get_phone_number(nat_number) retval = True except BandwidthAccountAPIExceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_service_name_correct(self, service):\r\n return service in self.services", "def check_for_int(check):", "def check(self, number):\n return number in self.numbers", "def test_hugepage_service_state(Service):\n\n service = Service('disable-transparent-hugepages')\n\n assert service.i...
[ "0.59083414", "0.5883824", "0.5763368", "0.5710403", "0.5586025", "0.5581765", "0.5541488", "0.5524599", "0.55024534", "0.5413349", "0.53525877", "0.53385204", "0.5334024", "0.5252063", "0.52470577", "0.52399766", "0.52303386", "0.5215163", "0.52144957", "0.5174327", "0.51610...
0.66074604
0
fetches media file that was part of a MMS. returns out filename or None if unable to
def get_media(self, url, out_filename=None, raw_data=False): if not raw_data: if not out_filename: out_filename = os.path.join(settings.BW_MMS_DIRECTORY, url.split('/')[-1]) if not os.path.isdir(os.path.dirname(out_filename)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_media_filename(media_url):\n return media_url.split(\"/\")[-1]", "def _get_file_path(self, url):\n try:\n row = ET.fromstring(self._session.get(url, headers={\"Access-Token\":self._token}).text)[1][2][1]\n data = [row[1].text, row[1].text, row[2].text]\n if \" -...
[ "0.6806104", "0.66842276", "0.63569075", "0.63093585", "0.6236515", "0.6230892", "0.6010185", "0.5981271", "0.5938037", "0.591105", "0.59071726", "0.5906296", "0.5849572", "0.5843085", "0.58247674", "0.58222777", "0.57600147", "0.57513124", "0.5730131", "0.571751", "0.5716952...
0.7086234
0
function to return keys from my_dict for any value return empty list if no value
def get_keys(my_dict, val): keys=[] for key, value in my_dict.items(): if val == value: keys.append(key) return keys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_keys(d):\n return list(d.keys())", "def keys(self):\n return [entry.key for entry in self.table if entry.value is not None]", "def select_keys(my_dict: Dict, keys: Sequence) -> Dict:\n keyset = set(keys)\n return {k: v for k, v in my_dict.items() if k in keyset}", "def getall(self, k...
[ "0.66081107", "0.6273039", "0.62509716", "0.6220051", "0.62197506", "0.61547536", "0.61087847", "0.6104465", "0.60851574", "0.6081447", "0.60670567", "0.60422623", "0.5984794", "0.5969637", "0.59643", "0.5940668", "0.59390646", "0.5931389", "0.59045744", "0.58952636", "0.5874...
0.7193149
0
from a list of tuples, return one np.array which sums of items is the minimum
def get_minimum_tuple(liste_of_tuple): sum_of_tuple=0 given_array=0 for tup in liste_of_tuple: arr = np.array(tup) if (sum_of_tuple == 0): sum_of_tuple = np.sum(arr) if (np.sum(arr))<=sum_of_tuple: given_array = arr return given_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argmin(self, values: pdarray) -> Tuple[groupable, pdarray]:\n k, v = self.aggregate(values, \"argmin\")\n return k, cast(pdarray, v)", "def pmin(\n *x: NumericType,\n na_rm: bool = False\n) -> Iterable[float]:\n maxlen = max(map(length_of, x))\n x = (recycle_value(elem, maxl...
[ "0.6525309", "0.6434365", "0.61789453", "0.5923437", "0.5893343", "0.5817158", "0.5815836", "0.58061725", "0.57888776", "0.57280415", "0.569099", "0.5679934", "0.5679168", "0.5647516", "0.563053", "0.55849946", "0.5577152", "0.55327713", "0.55204874", "0.55086505", "0.5495106...
0.7566244
0
Updates the current configuration with a new object.
def update(self, obj): self.cfg.update(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_update(self):\n pass", "def update(self, config_dict):\r\n self._update(config_dict, allow_new_keys=True)", "def update(self, config_dict):\n self._update(config_dict, allow_new_keys=True)", "def update(self):\n self.save_config_file()", "def configure(self, config: dict):\...
[ "0.7416382", "0.7137878", "0.6981426", "0.697743", "0.69123477", "0.68403643", "0.68191355", "0.6810213", "0.6806464", "0.67775714", "0.67775714", "0.674697", "0.67232466", "0.6714576", "0.6706718", "0.67066795", "0.6673145", "0.6670666", "0.66530377", "0.6601052", "0.6578826...
0.8169484
0
Get a resource from property Resources of config.
def resource(self, n): cfg = self.read() for res in cfg.get('Resources', []): res_name = res.get('Resource') if res_name == n: return ConfigResource(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetResource(self, name):\r\n matches = [x for x in self.resources if x.name == name]\r\n if len(matches) == 1:\r\n return matches[0]\r\n elif len(matches) > 1:\r\n raise errors.ConfigError(\"Multiple resources with the name [%s]\" % name)\r\n else:\r\n return None", "def get_resour...
[ "0.7069354", "0.65950155", "0.63619065", "0.62713015", "0.6215465", "0.620397", "0.61216813", "0.60930693", "0.6085507", "0.5970844", "0.59512824", "0.58540356", "0.58053327", "0.5800865", "0.5777375", "0.57626045", "0.57626045", "0.57626045", "0.57626045", "0.5752824", "0.57...
0.75324243
0
Does the bot save images to imgs folder?
def test_postImages(self): # GIVEN the group chat has at least one image testBot = bot.Bot(os.environ['bot_id'], os.environ['token'], os.environ['group_ID']) testBot.run() #THEN the bot should save images from the group to the imgs folder self.assertTrue(len(os.listdir('./imgs')) > 0) #AND there...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_images(self):\n save_file(self.quart.save_images, to_single_file=False)", "def save_imgs(self):\n print(\"Saving the images with required categories ...\")\n os.makedirs(self.imgs_dir, exist_ok=True)\n # Save the images into a local folder\n for im in tqdm(self.im...
[ "0.7295236", "0.70829517", "0.6849836", "0.6494285", "0.64765847", "0.64765847", "0.6462699", "0.64444625", "0.6435254", "0.6420794", "0.6361256", "0.6350175", "0.63492787", "0.6334107", "0.62305295", "0.6226776", "0.6194464", "0.6176622", "0.6167687", "0.6155911", "0.6128892...
0.7626312
0
Does the bot retrieve a list of images?
def test_getImages(self): # GIVEN the group chat has at least one image testBot = bot.Bot(os.environ['bot_id'], os.environ['token'], os.environ['group_ID']) imageList = testBot.run() #AND THEN post_images calls the private get_images method which returns an array self.assertTrue(len(imageList) >...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_images():\n return json_response(list_manifests())", "def list(self):\n r = self.target.ttbd_iface_call(\"images\", \"list\", method = \"GET\")\n return r['result']", "def list_images(self):\n raise NotImplementedError()", "def getimgs():", "def test_images(self):\n\n ...
[ "0.7578336", "0.7562665", "0.753567", "0.73441315", "0.728204", "0.725693", "0.72322696", "0.71710795", "0.7144439", "0.7026034", "0.69665307", "0.69051415", "0.69041944", "0.6901124", "0.6854555", "0.6846331", "0.676336", "0.6719417", "0.6709045", "0.6673847", "0.6651568", ...
0.75715417
1
Load the dictionary from a file. The file must be whitespaceseparated words. Creates the data structures.
def load(filename): print "Loading dictionary..." dictionary = Dictionary() print " Loading file..." whole_file = file(filename).read().upper() print " Splitting file..." words = whole_file.split() print " Removing unsuitable words..." words = di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dictionary():\n\tglobal dictionary\n\twith open(FILE, \"r\") as f:\n\t\tfor words in f:\n\t\t\tdictionary += words.split()", "def load_wordlist(filename):\n # YOUR CODE HERE\n words = {}\n f = open(filename, 'rU')\n text = f.read()\n text = text.split('\\n')\n for line in text:\n ...
[ "0.7021809", "0.6869227", "0.68494225", "0.6806351", "0.6769147", "0.67662203", "0.673899", "0.67387104", "0.67215824", "0.6672152", "0.6645686", "0.664437", "0.66190505", "0.6611564", "0.65786475", "0.6577035", "0.65754235", "0.6568509", "0.6560537", "0.6529585", "0.65052617...
0.7865121
0
Remove words that can't be used in Scrabble, such as those with hyphens and those larger than the size of the board.
def remove_unsuitable_words(words): max_length = Board.SIZE return [word for word in words if word and "-" not in word and len(word) <= max_length]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterPossibleWords(self): \r\n filledInSpaces = []\r\n for i in range(len(self.currentBoard)):\r\n if self.currentBoard[i] != '_':\r\n filledInSpaces.append( (i, self.currentBoard[i]) )\r\n \r\n self.wordList = list(filter(lambda word: self.viableWor...
[ "0.7085279", "0.6904262", "0.69013506", "0.6823802", "0.6685156", "0.65086526", "0.64731383", "0.6419102", "0.6413617", "0.6413319", "0.64127964", "0.6403451", "0.63925976", "0.6373155", "0.6363011", "0.63588434", "0.63422495", "0.6331452", "0.6307014", "0.62975794", "0.62825...
0.785968
0
Generate the maps from the used letters to the list of words.
def generate_letter_maps(self): word_count = len(self.words) last_percent = 0 # Do no-blank words. for i, word in enumerate(self.words): letters = "".join(sorted(set(word))) self.letters_map[letters].append(word) # Do one-blank words. fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_map():\n known_mappings = {\"a zoo\": \"y qee\",\n \"our language is impossible to understand\": \"ejp mysljylc kd kxveddknmc re jsicpdrysi\",\n \"there are twenty six factorial possibilities\": \"rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd\",\n ...
[ "0.76034564", "0.7033079", "0.68971705", "0.6837685", "0.68305516", "0.6805587", "0.6706723", "0.6682043", "0.6676078", "0.6675726", "0.6638174", "0.661801", "0.6579658", "0.65770775", "0.65488666", "0.65322185", "0.6516602", "0.64874303", "0.6452002", "0.64316815", "0.641845...
0.80057627
0
Returns a sequence of words from "word" with each letter missing.
def remove_one_letter(word): for i in range(len(word)): yield word[:i] + word[i + 1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_without_letter(l):\n\treturn {w for w in word_set if has_no_letter(w, l)}", "def remove_two_letters(word):\n for i in range(len(word) - 1):\n first_part = word[:i]\n for j in range(i + 1, len(word)):\n yield first_part + word[i + 1:j] + word[j + 1:]", "def ...
[ "0.6977009", "0.6552175", "0.6551507", "0.63555896", "0.6343313", "0.62956893", "0.62667996", "0.62119746", "0.620326", "0.619742", "0.6173767", "0.61558497", "0.61534464", "0.61103296", "0.60804164", "0.6049091", "0.5966941", "0.5939155", "0.5914981", "0.5904095", "0.5892561...
0.7108938
0
Returns a sequence of words from "word" with pairs of letters missing.
def remove_two_letters(word): for i in range(len(word) - 1): first_part = word[:i] for j in range(i + 1, len(word)): yield first_part + word[i + 1:j] + word[j + 1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extrachar(word: str) -> Iterator[str]:\n if len(word) < 2:\n return\n\n for i in range(0, len(word)):\n yield word[:i] + word[i+1:]", "def twowords(word: str) -> Iterator[List[str]]:\n\n for i in range(1, len(word)):\n yield [word[:i], word[i:]]", "def doubletwochars(word: str...
[ "0.71038306", "0.6765064", "0.67550427", "0.6735594", "0.6625915", "0.6620199", "0.65177166", "0.65156925", "0.6513065", "0.6501058", "0.64591277", "0.64591277", "0.6438254", "0.6437247", "0.624116", "0.6238542", "0.6235051", "0.6182002", "0.616684", "0.61635417", "0.60932815...
0.7147192
0
r"""Get basic information about the algorithm.
def algorithmInfo(): return r"""TODO"""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def algorithmInfo():\n\t\treturn r\"\"\"Fister Jr., Iztok and Fister, Dusan and Yang, Xin-She. \"A Hybrid Bat Algorithm\". Elektrotehniski vestnik, 2013. 1-7.\"\"\"", "def getInfo():", "def describe_algorithm(AlgorithmName=None):\n pass", "def info() -> None:", "def get_algo_info(self, algo=None, **kwar...
[ "0.7340363", "0.7214091", "0.72085875", "0.7114501", "0.6941842", "0.69047254", "0.683423", "0.683423", "0.66760594", "0.6650416", "0.66345215", "0.6631911", "0.6631911", "0.65858006", "0.6542308", "0.6487851", "0.64559406", "0.6408391", "0.63860804", "0.63573605", "0.6355828...
0.8159429
0
r"""Get basic information about the algorithm.
def algorithmInfo(): return r"""Fister Jr., Iztok and Fister, Dusan and Yang, Xin-She. "A Hybrid Bat Algorithm". Elektrotehniski vestnik, 2013. 1-7."""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def algorithmInfo():\n\t\treturn r\"\"\"TODO\"\"\"", "def getInfo():", "def describe_algorithm(AlgorithmName=None):\n pass", "def info() -> None:", "def get_algo_info(self, algo=None, **kwargs):\n if algo:\n return self.mrr_obj.get('/info/algos' + '/' + algo, **kwargs)\n return ...
[ "0.8159429", "0.7214091", "0.72085875", "0.7114501", "0.6941842", "0.69047254", "0.683423", "0.683423", "0.66760594", "0.6650416", "0.66345215", "0.6631911", "0.6631911", "0.65858006", "0.6542308", "0.6487851", "0.64559406", "0.6408391", "0.63860804", "0.63573605", "0.6355828...
0.7340363
1
r"""Get parameters of the algorithm.
def getParameters(self): d = AdaptiveBatAlgorithm.getParameters(self) d.update({ 'A_l': self.A_l, 'A_u': self.A_u, 'r_l': self.r_l, 'r_u': self.r_u, 'tao_1': self.tao_1, 'tao_2': self.tao_2 }) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(self):", "def get_params(self):\n raise NotImplementedError", "def get_params(self):\n pass", "def get_params(self) -> np.array:\n pass", "def _get_params(self):\r\n return self.k._get_params()", "def parameters(self):\n return self.pars", "def get_para...
[ "0.7806842", "0.7683025", "0.7607203", "0.7535243", "0.75247824", "0.7506232", "0.7460225", "0.7407546", "0.7397588", "0.7395876", "0.7346837", "0.7346205", "0.7313976", "0.73048675", "0.7240246", "0.72340614", "0.7218383", "0.7201478", "0.7182246", "0.7177862", "0.71744525",...
0.7740987
1
downloads entire database and saves to .h5, replacing old file
def download_entire_db(storage_path=DEFAULT_STORAGE, remove_previous=True, return_df=False, return_latest_date=False, write=['feather']): # first check if we have the latest data if not os.path.exists(storage_path): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_database():\n\n # We obtain the data from the official database\n df = getData.extractData()\n\n # We save the dataframe for later use in the API\n auxiliary.saveToCsv(df, 'app/resources')", "def download():\n return response.download(request,db)", "def download():\n return respons...
[ "0.63205135", "0.62534106", "0.62534106", "0.62534106", "0.62534106", "0.62534106", "0.62534106", "0.6183906", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.6038901", "0.603890...
0.6550079
0
Checks to see if market is open today. Uses the pandas_market_calendars package as mcal
def check_market_status(): today_ny = datetime.datetime.now(pytz.timezone('America/New_York')) ndq = mcal.get_calendar('NASDAQ') open_days = ndq.schedule(start_date=today_ny - pd.Timedelta('10 days'), end_date=today_ny) if today_ny.date() in open_days.index: return open_days else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_market_status():\n # today = datetime.datetime.now(pytz.timezone('America/New_York')).date()\n today_utc = pd.to_datetime('now').date()\n ndq = mcal.get_calendar('NASDAQ')\n open_days = ndq.schedule(start_date=today_utc - pd.Timedelta('10 days'), end_date=today_utc)\n if today_utc in open_...
[ "0.7844019", "0.7299794", "0.71417683", "0.64564335", "0.62261474", "0.6127471", "0.6050444", "0.596668", "0.57297295", "0.5713947", "0.5685722", "0.5678899", "0.5610287", "0.55595165", "0.54880613", "0.5486532", "0.5417402", "0.540892", "0.53961575", "0.53872633", "0.5376947...
0.7893472
0
checks if it is a trading day today, and downloads entire db after it has been updated (930pm ET) need to refactor this is messy and touchy. Have to start before midnight UTC to work ideally
def daily_download_entire_db(storage_path=DEFAULT_STORAGE): latest_db_date = get_latest_db_date() while True: latest_close_date = get_latest_close_date() if latest_db_date is None: print('no database file exists, downloading...') latest_db_date = download_entire_db(return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_up_to_date():\n last_daily = get_latest_dl_date()\n last_trading_day = get_last_open_trading_day()", "def updateToday(tradingDay):\n if date.today() != tradingDay.today:\n tradingDay = TradingDay(tradingDay.contractDetails)\n\n if tradingDay.isMarketOpen():\n if not tradin...
[ "0.6510461", "0.635234", "0.6323189", "0.62475073", "0.6163681", "0.61534476", "0.60295653", "0.5952129", "0.5790337", "0.5765544", "0.57649076", "0.56893873", "0.56848735", "0.56789535", "0.5656514", "0.5644254", "0.5641715", "0.554061", "0.5536549", "0.5522466", "0.551798",...
0.6581072
0
gets the latest date the markets were open (NASDAQ), and returns the closing datetime if last_close is True, gets last datetime that market has closed (not in the future)
def get_latest_close_date(market='NASDAQ', return_time=False, last_close=False): # today = datetime.datetime.now(pytz.timezone('America/New_York')).date() # today_utc = pd.to_datetime('now').date() today_ny = datetime.datetime.now(pytz.timezone('America/New_York')) ndq = mcal.get_calendar(market) op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_close(self, symbol):\n if symbol in self.symbol:\n close_price = self.symbol[symbol][\"close\"]\n return close_price\n else:\n print(\n \"Close price for ticker %s is not \"\n \"available from the YahooDailyBarPriceHandler.\"...
[ "0.7029767", "0.68433356", "0.676066", "0.65362865", "0.63972265", "0.62123173", "0.6211086", "0.60124016", "0.59920776", "0.59762216", "0.5918298", "0.58333004", "0.5784651", "0.5730271", "0.5675742", "0.5673005", "0.56588376", "0.56233525", "0.56153977", "0.5592313", "0.554...
0.8209045
0
Checks to see if market is open today. Uses the pandas_market_calendars package as mcal
def check_market_status(): # today = datetime.datetime.now(pytz.timezone('America/New_York')).date() today_utc = pd.to_datetime('now').date() ndq = mcal.get_calendar('NASDAQ') open_days = ndq.schedule(start_date=today_utc - pd.Timedelta('10 days'), end_date=today_utc) if today_utc in open_days.index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_market_status():\n today_ny = datetime.datetime.now(pytz.timezone('America/New_York'))\n ndq = mcal.get_calendar('NASDAQ')\n open_days = ndq.schedule(start_date=today_ny - pd.Timedelta('10 days'), end_date=today_ny)\n if today_ny.date() in open_days.index:\n return open_days\n else:...
[ "0.7893472", "0.7299794", "0.71417683", "0.64564335", "0.62261474", "0.6127471", "0.6050444", "0.596668", "0.57297295", "0.5713947", "0.5685722", "0.5678899", "0.5610287", "0.55595165", "0.54880613", "0.5486532", "0.5417402", "0.540892", "0.53961575", "0.53872633", "0.5376947...
0.7844019
1
return_headers will just return the column names. update_small_file will just update the small file that starts on 1/1/2000
def update_all_stocks(return_headers=False, update_small_file=False): # 7-13-2017: 28788363 rows in full df zip_file_url = 'https://www.quandl.com/api/v3/databases/EOD/download?api_key=' + \ Q_KEY + '&download_type=partial' r = req.get(zip_file_url) z = zipfile.ZipFile(io.BytesIO(r.content)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_headers(headers, out):\r\n out.write(common.to_csv_line(headers, \"efficient\"))", "def reformat_csv_header(self, path, train_file, test_file):\n\n \"\"\"\n \"id\",\"comment_text\",\"toxic\",\"severe_toxic\",\"obscene\",\"threat\",\"insult\",\"identity_hate\"\n \"\"\"\n\n t...
[ "0.5855104", "0.5634152", "0.5610796", "0.5565353", "0.55391574", "0.553298", "0.54687357", "0.54682636", "0.5437986", "0.54259366", "0.53932583", "0.53861797", "0.53778136", "0.53684855", "0.53658843", "0.5357169", "0.5348249", "0.5340234", "0.5294776", "0.52871776", "0.5254...
0.6717363
0
Retrieves and saves last n days from the full stock dataset for analysis.
def get_last_n_days(n=100): df = pd.read_csv('../stockdata/all_stocks.csv.gzip', parse_dates=True) dates = sorted(df.index.unique())[-n:] new_df = df.loc[dates] new_df.to_csv('../stockdata/all_stocks_last' + str(n) + '_days.csv.gzip', compression='gzip') return new_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_data(self, symbol='SPY', n=1):\n return self.data.ix[-n:]", "def get_latest_data(self, symbol, n=1):\n raise NotImplementedError", "def fetch_history(self, dname, *args, **kwargs):\n if dname != 'returnsN':\n return super(QuoteFetcher, self).fetch_history(dname, *...
[ "0.6434268", "0.6245548", "0.62428504", "0.621487", "0.6203779", "0.6103657", "0.6098898", "0.6059008", "0.6043774", "0.6032302", "0.6018421", "0.5985612", "0.596977", "0.5917684", "0.5898063", "0.58806944", "0.5870792", "0.58161986", "0.57779366", "0.5773703", "0.5767346", ...
0.7667367
0
With about 8k stocks and about 2s per stock download, this would take forever. Don't use.
def download_all_stocks(): stocks = get_stocklist() dfs = {} for i, r in stocks.iterrows(): start = time.time() s = r['Ticker'] stockfile = '../stockdata/' + s + '.csv.gz' print('downloading', s) stock = quandl.get('EOD/' + s) stock.to_csv(stockfile, compressi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_all():\r\n f = open('stock_symbols.txt', 'r')\r\n fout = open('../data/stocks_read.txt', 'w')\r\n count_max = 500\r\n count = 0\r\n for stock_symbol in f:\r\n stock_symbol = stock_symbol.strip()\r\n try:\r\n stock_download(stock_symbol)\r\n fout.write...
[ "0.63830006", "0.6112706", "0.6052205", "0.60002667", "0.5892348", "0.58545315", "0.58131224", "0.5802235", "0.5686907", "0.56537914", "0.5645122", "0.5633165", "0.5632974", "0.55785567", "0.5570575", "0.5567166", "0.5490028", "0.54742014", "0.5439857", "0.53706014", "0.53656...
0.6356083
1
Downloads stock data and returns dict of pandas dataframes. First checks if data is up to date, if so, just loads the data.
def download_stocks(stocklist=STOCKLIST, fresh=False): # load stocklist with open(stocklist) as f: stocks = f.read().strip('\n').split('\n') dfs = {} for s in stocks: print(s) stockfile = '../stockdata/' + s + '.csv.gz' if fresh or not os.path.exists(stockfile): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_all_stocks():\n stocks = get_stocklist()\n dfs = {}\n for i, r in stocks.iterrows():\n start = time.time()\n s = r['Ticker']\n stockfile = '../stockdata/' + s + '.csv.gz'\n print('downloading', s)\n stock = quandl.get('EOD/' + s)\n stock.to_csv(stockf...
[ "0.7036214", "0.67121357", "0.6564997", "0.65192896", "0.6485223", "0.6379464", "0.6363341", "0.62925714", "0.625687", "0.62474936", "0.62401634", "0.62270105", "0.62196875", "0.6214444", "0.616288", "0.6152651", "0.610115", "0.6098597", "0.6087366", "0.6072621", "0.60664415"...
0.6932429
1
makes smaller h5 file with only data after specific time only have historic data for last 2 years for shortsqueeze, so that's an example
def make_small_df(storage_path=DEFAULT_STORAGE, filename='EOD_{}.h5', latest_eod=None, earliest_date='20150101'): if latest_eod is None: latest_eod = get_latest_eod() eod_datapath = storage_path + filename.format(latest_eod) new_filename = storage_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_aggregated_ds_v2(file_src,file_dest):\n groups = {'2015_2016' : [2015,2016],'2017' : [2017],'2018' : [2018]}\n # Print fields of source file.\n with h5py.File(file_src,'r') as f :\n for k in [k for k in f.keys()] :\n print('k',k)\n #print(f'{k}: {f[k].dtype}')\n p...
[ "0.61954635", "0.5543161", "0.5523801", "0.5363741", "0.5354672", "0.53035545", "0.5271555", "0.52168626", "0.5188428", "0.51519525", "0.5116143", "0.51147294", "0.50999475", "0.5096456", "0.5094596", "0.50637907", "0.49918783", "0.49796364", "0.49706373", "0.49468142", "0.49...
0.5730075
1
Test that the queue module was properly imported
def test_queue_class_exists(): assert Queue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init():\n from parenthetics import Queue\n my_queue = Queue()\n assert isinstance(my_queue, Queue)", "def test_queue_not_installed(): # pragma: windows\n nt.assert_equal(IPCComm.get_queue(), None)", "def test_qm_project_python_testing_imported():\n assert \"qm_project_python_testing\" ...
[ "0.74117076", "0.68037856", "0.66626453", "0.6641566", "0.65427667", "0.6481025", "0.64770365", "0.6446653", "0.64384985", "0.6342957", "0.63057685", "0.6301307", "0.6292537", "0.62752134", "0.6245541", "0.61794436", "0.61595434", "0.61325556", "0.61323863", "0.61238384", "0....
0.804297
0
Test that the queue's length increases after enqueuing a new value
def test_insertion_of_value_increases_length(empty_queue): assert len(empty_queue) == 0 empty_queue.enqueue(100) assert len(empty_queue) == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_size_increments_with_enqueue():\n queue = Queue()\n queue.enqueue('val')\n assert queue.size() == 1", "def test_the_queue_size(the_queue):\n the_queue.enqueue(1)\n the_queue.enqueue(2)\n the_queue.enqueue(3)\n assert the_queue.size() == 3", "def test_size(self):\n queue = Queue...
[ "0.8218401", "0.8080756", "0.7737941", "0.76956904", "0.7611223", "0.7446187", "0.73378056", "0.7295381", "0.7244632", "0.72361594", "0.710653", "0.70698786", "0.7049939", "0.70439875", "0.704351", "0.70268536", "0.6978875", "0.6974477", "0.69701475", "0.6932488", "0.6918494"...
0.8624658
0
Test that the front property is none prior to enqueuing
def test_default_value_of_front(empty_queue): assert empty_queue.front is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_am_at_the_front(self):\n return self is self.queue[0]", "def empty_queue(queue):\n return queue.front is None", "def test_enquque_enqueue_check_first_node_val():\n queue = Queue()\n anode = queue.enqueue('a')\n bnode = queue.enqueue('b')\n assert queue._queue.first_node is anode", ...
[ "0.7659449", "0.7099113", "0.6992859", "0.6959401", "0.69548464", "0.6852271", "0.67845005", "0.67837906", "0.6695713", "0.6672456", "0.6582717", "0.6582628", "0.657398", "0.65670973", "0.656031", "0.6504475", "0.64835936", "0.6478431", "0.6462574", "0.64194036", "0.64177316"...
0.7998886
0
Append service to the service name
def append_service_to_name(self, data, **kwargs): data['name'] = f'{data.get("name").upper()}_SERVICE' return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def service_name(self):\n return self._service_name", "def getServiceName(self) -> str:\n ...", "def get_full_service_name(...
[ "0.72060347", "0.72060347", "0.71748763", "0.7068025", "0.7060443", "0.70234215", "0.69514245", "0.69514245", "0.69514245", "0.69364977", "0.69364977", "0.69364977", "0.6925165", "0.67653453", "0.6744948", "0.6667049", "0.6590735", "0.6590735", "0.6590735", "0.65813726", "0.6...
0.783467
0
Copies the given file or folder to the target folder, whereby the file/folder name is constructed by appending the current date (and possibly time) to the file/folder name. If another copies exist in the given target folder, the old ones are deleted to maintain at most num_copies of. The command creates a new copy only...
def multicopy(src_file_or_dir, target_dir, num_copies, min_period_days=0, target_base_name=None, append_time=True, ignore_errors=False, reporter=None): def log_info(message): if reporter: reporter.info(message) else: print(message) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cp(src, dst):\n os.makedirs(os.path.dirname(dst), exist_ok=True)\n src_stat = os.stat(src)\n try:\n dst_stat = os.stat(dst)\n except FileNotFoundError:\n dst_stat = (0,)*10\n src_modif_time = src_stat[stat.ST_MTIME]\n dst_modif_time = dst_stat[stat.ST_MTIME]\n if src_modif_ti...
[ "0.540258", "0.5268108", "0.49308607", "0.479153", "0.47826353", "0.475972", "0.47528076", "0.47310272", "0.469119", "0.46287873", "0.45539945", "0.45484373", "0.4509758", "0.45064256", "0.44562772", "0.4437004", "0.44316283", "0.44010857", "0.43905577", "0.43826994", "0.4366...
0.6508326
0
Make a HTTP request packet request headers message
def make_packet(message, host): RESOURCE = "/" # dummy resource # First line is the request request = HTTPConstants.GET_REQUEST + " " + RESOURCE + " " + HTTPConstants.VERSION + HTTPConstants.CRLF # Next are the headers headers = "Host: {0}".format(host) + HTTPConstants.CRLF # Construct the head head = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_request_message(request):\n url = urlparse(request.url)\n request_headers = dict(request.headers)\n if 'Host' not in request_headers:\n request_headers['Host'] = url.netloc\n return HTTPMessage(\n line='{method} {path} HTTP/1.1'.format(\n method=request.method,\n ...
[ "0.6875337", "0.6805739", "0.66936874", "0.66936874", "0.64733094", "0.64733094", "0.6256127", "0.623692", "0.6143666", "0.61382276", "0.6119428", "0.6079149", "0.6015242", "0.5993089", "0.5989563", "0.5983968", "0.5971236", "0.59581345", "0.59575814", "0.59575814", "0.594263...
0.69332606
0
Parse a HTTP response packet statusline body
def parse_response(conn): # HEAD head = read2CRLF(conn) if debug == 0: print("STATUS LINE: ", head ) # Tokens in the status line are separated by spaces # status_line = http-version <SP> status_code <SP> Reason status_line = head.decode().split(' ') # Parse the status line if len(status_line) < 3: ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_status_line(line):\n # Up to the first space is the protocol version.\n index0 = line.index(SPACE)\n http_version = line[: index0]\n # Make sure it's the protocol version we recognize.\n assert http_version == HTTP_VERSION\n # Starting from the first space, up to the next space is the ...
[ "0.7128819", "0.6732791", "0.66464615", "0.659241", "0.6506562", "0.6455829", "0.63313085", "0.62830883", "0.6256949", "0.6198643", "0.6171631", "0.61465275", "0.60450613", "0.598626", "0.5964472", "0.5955491", "0.5901113", "0.58969516", "0.5878095", "0.58769494", "0.5867655"...
0.7798692
0
Accepts a coco object detection file. Returns list of images and categories.
def process_coco(coco_file_path: str) -> (list, dict): coco_dict = load_json(coco_file_path) # rearrange coco file for better annotation reach images = list() for image in coco_dict["images"]: image_annotations = list() for annotation in coco_dict["annotations"]: if image["i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_labelme_to_coco(path_to_data):\r\n # convert labelme annotations to coco\r\n labelme2coco.convert(path_to_data, path_to_data + r'\\coco_annotation.json')\r\n\r\n # Open the coco format data\r\n with open(path_to_data + r'\\coco_annotation.json') as f:\r\n coco_d = json.load(f)\r\n\r\...
[ "0.6292812", "0.62888265", "0.602774", "0.5988227", "0.5976888", "0.5939347", "0.5826487", "0.58208746", "0.5818549", "0.58161163", "0.5813985", "0.57310075", "0.5711495", "0.56712824", "0.56664807", "0.5657252", "0.5646004", "0.5624283", "0.56121266", "0.5607481", "0.5555343...
0.80364597
0