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
Test a color light and that all transitions are correctly passed.
async def test_color_light( hass: HomeAssistant, bulb: MagicMock, transition: float | None ) -> None: already_migrated_config_entry = MockConfigEntry( domain=DOMAIN, data={}, unique_id=MAC_ADDRESS ) already_migrated_config_entry.add_to_hass(hass) bulb.color_temp = None with _patch_discov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_color(self):\n self._calibration_test(\"color_full\")", "def test_change_color_of_the_device__true():", "async def test_pure_rgb_dimmer_light(\n hass, light_data, light_pure_rgb_msg, sent_messages\n):\n receive_message = await setup_ozw(hass, fixture=light_data)\n\n # Test loaded\n ...
[ "0.73225784", "0.7197311", "0.7078075", "0.7028157", "0.699897", "0.6973402", "0.69457805", "0.6872013", "0.6779776", "0.6763643", "0.67399496", "0.66207445", "0.66100854", "0.65070266", "0.6479111", "0.64671254", "0.64391786", "0.6391853", "0.63860404", "0.6375118", "0.63614...
0.75342244
0
Test smart strip effects.
async def test_smart_strip_effects(hass: HomeAssistant) -> None: already_migrated_config_entry = MockConfigEntry( domain=DOMAIN, data={}, unique_id=MAC_ADDRESS ) already_migrated_config_entry.add_to_hass(hass) strip = _mocked_smart_light_strip() with _patch_discovery(device=strip), _patch_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_smart_strip_custom_random_effect_at_start(hass: HomeAssistant) -> None:\n already_migrated_config_entry = MockConfigEntry(\n domain=DOMAIN, data={}, unique_id=MAC_ADDRESS\n )\n already_migrated_config_entry.add_to_hass(hass)\n strip = _mocked_smart_light_strip()\n strip.effect ...
[ "0.6361351", "0.61246073", "0.5959019", "0.59088546", "0.57851887", "0.5769608", "0.5742806", "0.56796753", "0.5610683", "0.55301934", "0.5520051", "0.5466668", "0.541421", "0.5308746", "0.5303473", "0.5281852", "0.5269009", "0.526287", "0.5260101", "0.52488464", "0.524781", ...
0.7341831
0
Test smart strip custom random effects.
async def test_smart_strip_custom_random_effect(hass: HomeAssistant) -> None: already_migrated_config_entry = MockConfigEntry( domain=DOMAIN, data={}, unique_id=MAC_ADDRESS ) already_migrated_config_entry.add_to_hass(hass) strip = _mocked_smart_light_strip() with _patch_discovery(device=str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_smart_strip_custom_random_effect_at_start(hass: HomeAssistant) -> None:\n already_migrated_config_entry = MockConfigEntry(\n domain=DOMAIN, data={}, unique_id=MAC_ADDRESS\n )\n already_migrated_config_entry.add_to_hass(hass)\n strip = _mocked_smart_light_strip()\n strip.effect ...
[ "0.73686266", "0.71495104", "0.64665323", "0.6170363", "0.5751459", "0.5737569", "0.5713314", "0.5693127", "0.5576544", "0.55595744", "0.54812014", "0.54451704", "0.5440141", "0.539129", "0.53864384", "0.5383464", "0.5345336", "0.5341675", "0.5341675", "0.53096324", "0.530741...
0.7563376
0
Test smart strip custom random effects at startup.
async def test_smart_strip_custom_random_effect_at_start(hass: HomeAssistant) -> None: already_migrated_config_entry = MockConfigEntry( domain=DOMAIN, data={}, unique_id=MAC_ADDRESS ) already_migrated_config_entry.add_to_hass(hass) strip = _mocked_smart_light_strip() strip.effect = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_smart_strip_custom_random_effect(hass: HomeAssistant) -> None:\n already_migrated_config_entry = MockConfigEntry(\n domain=DOMAIN, data={}, unique_id=MAC_ADDRESS\n )\n already_migrated_config_entry.add_to_hass(hass)\n strip = _mocked_smart_light_strip()\n\n with _patch_discover...
[ "0.75341916", "0.708192", "0.64202553", "0.5781483", "0.5716931", "0.57089716", "0.56820685", "0.5680902", "0.5653683", "0.56015724", "0.5568503", "0.5542406", "0.5532533", "0.5527679", "0.55205363", "0.5489674", "0.5489674", "0.5489674", "0.5484125", "0.5457625", "0.5457625"...
0.7762053
0
Test smart strip custom sequence effects.
async def test_smart_strip_custom_sequence_effect(hass: HomeAssistant) -> None: already_migrated_config_entry = MockConfigEntry( domain=DOMAIN, data={}, unique_id=MAC_ADDRESS ) already_migrated_config_entry.add_to_hass(hass) strip = _mocked_smart_light_strip() with _patch_discovery(device=s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_smart_strip_effects(hass: HomeAssistant) -> None:\n already_migrated_config_entry = MockConfigEntry(\n domain=DOMAIN, data={}, unique_id=MAC_ADDRESS\n )\n already_migrated_config_entry.add_to_hass(hass)\n strip = _mocked_smart_light_strip()\n\n with _patch_discovery(device=stri...
[ "0.6362198", "0.5931741", "0.5872136", "0.53356624", "0.52627647", "0.52093023", "0.51283836", "0.50968724", "0.5058186", "0.50516105", "0.5050715", "0.50301987", "0.49923107", "0.49752647", "0.49752647", "0.4969584", "0.49603987", "0.49464494", "0.49423063", "0.49384758", "0...
0.7224626
0
If the queue is empty, forces a context switch using `time.sleep(0)` and then returns `None`
def non_blocking_get(self): try: return self.q.get(block=False) except queue.Empty: time.sleep(0) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_emptyget(clean_queue):\n assert clean_queue.get(timeout=0.1) is None", "def _wait_queue(self):\n while True:\n time.sleep(0.1)\n if self.queue.unfinished_tasks == 0 or self.stop_signal.is_set():\n return", "def _wait_empty(self):\n while True:\n if self.queue.e...
[ "0.7356383", "0.712769", "0.7041314", "0.66561407", "0.66292536", "0.6616189", "0.66126084", "0.6578465", "0.6507309", "0.64968026", "0.6493364", "0.6463779", "0.6421498", "0.6394601", "0.6387362", "0.63381475", "0.6312137", "0.62479764", "0.6243379", "0.622851", "0.622851", ...
0.728921
1
If timeout is reached returns `False`, else puts item in queue and returns `True`
def timeout_put(self, item, timeout): try: self.q.put(item, timeout=timeout) return True except queue.Full: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deque_timeout_put(self, item, timeout):\n try:\n self.q.put(item, timeout=timeout)\n return True\n except queue.Full:\n try:\n _ = self.q.get(block=False)\n dropped = False\n except queue.Empty:\n dropped = T...
[ "0.8141072", "0.7471339", "0.732629", "0.70964736", "0.6637272", "0.6571582", "0.6445345", "0.64253104", "0.6404255", "0.634525", "0.6319699", "0.621202", "0.6196223", "0.6174424", "0.6165567", "0.6138826", "0.6132959", "0.610219", "0.6079432", "0.607623", "0.6063355", "0.6...
0.8391726
0
If queue is full, returns `False`, else puts item in queue and returns `True`
def non_blocking_put(self, item): try: self.q.put(item, block=False) return True except queue.Full: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enQueue(self, value):\n if not self.isFull():\n self.queue.append(value)\n return True\n else:\n return False", "def deque_non_blocking_put(self, item):\n try:\n self.q.put(item, block=False)\n return True\n except queue.Full:...
[ "0.76965094", "0.75622535", "0.7529039", "0.7514545", "0.7485089", "0.74832875", "0.747405", "0.7467226", "0.73592937", "0.7342824", "0.7243091", "0.7227299", "0.7219982", "0.7184339", "0.71474993", "0.7135513", "0.70544595", "0.7022678", "0.7021418", "0.701333", "0.7008695",...
0.78973645
0
If timeout is reached, it tries to take an item from the queue and then puts the item in the queue.
def deque_timeout_put(self, item, timeout): try: self.q.put(item, timeout=timeout) return True except queue.Full: try: _ = self.q.get(block=False) dropped = False except queue.Empty: dropped = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout_put(self, item, timeout):\n try:\n self.q.put(item, timeout=timeout)\n return True\n except queue.Full:\n return False", "def put(\n self, item: _T, timeout: Optional[Union[float, datetime.timedelta]] = None\n ) -> \"Future[None]\":\n fu...
[ "0.763813", "0.7160285", "0.6806975", "0.67765784", "0.67449653", "0.66737187", "0.6652387", "0.6575092", "0.64584327", "0.64514005", "0.6440006", "0.6315036", "0.63126075", "0.6309276", "0.62999815", "0.6295127", "0.6285218", "0.61960906", "0.61946386", "0.61174345", "0.6076...
0.73539823
1
Finds an object of Note class with matching holes in the 'notes' array. Returns Object if found, None otherwise.
def find_note_by_holes(self, holes): for i in xrange(self._notes.__len__()): note = self._notes[i] if note.compare_holes(holes): return i, note return -1, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_note(self, note_id):\n for note in self.notes:\n if str(note.id) == str(note_id):\n return note\n return None", "def _find_note(self, id):\n for note in self.notes:\n if note.id == id:\n return note\n return None", "def g...
[ "0.6979893", "0.68126583", "0.5763362", "0.56197876", "0.55595404", "0.5455401", "0.5376674", "0.53602576", "0.53131527", "0.5286646", "0.5110404", "0.5102847", "0.5093283", "0.50774926", "0.505993", "0.505993", "0.50581837", "0.5057793", "0.5034487", "0.5032037", "0.5026107"...
0.6892782
1
constructor. The Owner must be a HpPclDocument instance
def __init__( self, owner, barcode_height = 1 ): assert isinstance( owner, HpPclDocument ), "Owner must be an HpPclDocument" assert isinstance( barcode_height, int ), "barcode_height must be integer (1 or 2)" self.owner = owner self.bc_height = barcode_height # Create the internal structure needed for prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__(self, py_dict=None):\n super(PagedSystemEventListSchema, self).__init__()\n self.set_data_type(\"xml\")\n self.dataPage = DataPageSchema()\n\n\n if py_dict is not None:\n ...
[ "0.6366382", "0.6364496", "0.6188456", "0.6146618", "0.60822606", "0.6062771", "0.6040923", "0.6033547", "0.60324967", "0.60127354", "0.60127354", "0.60127354", "0.60127354", "0.6007639", "0.59893674", "0.59433454", "0.5908976", "0.5900826", "0.5892047", "0.5892047", "0.58871...
0.63852096
0
Defines characters for HP LaserJet. Initialize the nb,wb,ns variables
def basic_char_setup( self ): small_bar = 3 # number of points per bar wide_bar = round(small_bar * 2.25,0) # 2.25 x small_bar dpl = 50 # dots per line 300dpi/6lpi = 50dpl self._nb = bytes( self.owner.PRINTER_ESC + ( '*c%02ia%ib0P' % (small_bar, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.file_name = 'assets/a.jpg'\n self.digit_to_word = {y: x for x, y in zip(list(string.ascii_uppercase), range(26))}\n self.digit_to_word[-1] = '?'", "def __init__(self):\n self.chars = {}\n self.end_of_word = '#'", "def init_characters( self ):\n ...
[ "0.58924115", "0.5828618", "0.57575417", "0.5717876", "0.56802845", "0.55833006", "0.5511343", "0.54970366", "0.5461241", "0.54266137", "0.54266137", "0.53666145", "0.5346338", "0.53396857", "0.5306011", "0.5303513", "0.5255024", "0.5245139", "0.5237999", "0.5207317", "0.5201...
0.6977605
0
write the barcode corresponding to ucode in the ower document. Do not include the header and trailing in the ucode!
def write( self, ucode ): assert isinstance( ucode, unicode ), "the code to compute in barcode must be a unicode string" # code barre message must starts and finish with * ucode = u'*%s*' % ucode.strip() self.owner.write_bytes( self._bc_start ) # Transfert every computed esc sequence into the document...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_barcode39_doc( ):\n\t\n\tprint( 'Print the Barcode39 ZPL document' )\n\tprint( '--------------------------------' )\n\tmedium = PrinterCupsAdapter( printer_queue_name = PRINTER_QUEUE_NAME )\n\td = ZplDocument( target_encoding = PRINTER_ENCODING, printer_adapter = medium, title = 'Barcode doc' )\n\t\n\t# ...
[ "0.6549394", "0.6161541", "0.6088262", "0.6026922", "0.5781653", "0.56635714", "0.55983096", "0.54897916", "0.5396298", "0.5393378", "0.53841203", "0.5334388", "0.5332752", "0.5301636", "0.5269321", "0.52679354", "0.5262624", "0.52521694", "0.5235161", "0.5198051", "0.5193918...
0.82345665
0
return the message as enclosed with the barcode picture. That message must have a special format (as returned). Do not include the header and trailing in the ucode!
def barcode_message( self, ucode ): assert isinstance( ucode, unicode ), "the code to compute in barcode must be a unicode string" for uchar in ucode: if not( uchar in self._char39 ): raise Barcode39Error( '%s char is not listed in Barcode39 characters [0..9,A..Z,space,9,-,.,$,/,+,%]' ) return u'*%s*'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write( self, ucode ):\n\t\tassert isinstance( ucode, unicode ), \"the code to compute in barcode must be a unicode string\" \n\t\t\n\t\t# code barre message must starts and finish with *\n\t\tucode = u'*%s*' % ucode.strip()\n\t\t\n\t\tself.owner.write_bytes( self._bc_start )\n\t\t# Transfert every computed es...
[ "0.63482064", "0.6304082", "0.6261126", "0.61815864", "0.6150009", "0.6086616", "0.6008638", "0.59737855", "0.5826097", "0.5742768", "0.5732979", "0.57284933", "0.570038", "0.56773186", "0.56588334", "0.5654453", "0.5652266", "0.5648033", "0.5608692", "0.5600925", "0.5572903"...
0.67835295
0
Returns the GenerateCompletionReport class by passing a default value to the required_block_ids argument. This is intended to use the same logic without change the class it all. Pass the users argument as a single user list, this is to maintain the naming convention and keep the type of the field, since it is supposed ...
def activity_completion_data_per_user(cls, user, course_key, block_types, passing_score): return cls( users=[user], course_key=course_key, required_block_ids=[], block_types=block_types, passing_score=passing_score, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_report_data(self):\n activity_completion_data = []\n required_ids = self.required_block_ids\n\n for user in self.users:\n user, user_profile = get_user(user.email)\n first_name, last_name = get_first_and_last_name(user_profile.name)\n completed_act...
[ "0.59483504", "0.5182398", "0.49078426", "0.47534046", "0.4726567", "0.46588582", "0.4648847", "0.45807", "0.44224325", "0.44196746", "0.44096172", "0.43751413", "0.43586865", "0.43492255", "0.434037", "0.43025714", "0.4290661", "0.42843515", "0.4276948", "0.4270173", "0.4266...
0.5484924
1
Returns blocks matching by self.block_type_filter.
def matching_blocks_by_type(self): try: block_structure = get_course_in_cache(self.course_key) matching_blocks = block_structure.topological_traversal( filter_func=self.block_type_filter, yield_descendants_of_unyielded=True, ) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBlocks(self, bType=None, **kwargs):\n blocks = [b for a in self.getAssemblies(**kwargs) for b in a]\n if bType:\n blocks = [b for b in blocks if b.hasFlags(bType)]\n return blocks", "async def read_block_types(self) -> List[BlockType]:\n response = await self._client...
[ "0.75468904", "0.753983", "0.69720924", "0.66560584", "0.65421176", "0.6442769", "0.6383516", "0.6228126", "0.6221034", "0.62125427", "0.6184911", "0.61110973", "0.6103225", "0.5944606", "0.59304005", "0.57383245", "0.57287693", "0.5717933", "0.5691384", "0.5688969", "0.56550...
0.78613025
0
Returns True if the block type exists in the self.required_block_types otherwise False.
def block_type_filter(self, block_item): return True if block_item.block_type in self.required_block_types else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_block(self):\n\t\treturn self.name in get_elements_collection(self.__res, 'block_level')", "def contains(self, block_):\n return block_ in self._inventory", "def _check_block_type():\n \n \n maxBlocks = blocks[0]['maxBlocks']\n freeEnd = blocks[0]['freeEnd']\n \n while(blkcoun...
[ "0.65525854", "0.6548108", "0.63276935", "0.6238664", "0.62270314", "0.61931926", "0.61172473", "0.6105601", "0.60642296", "0.5987289", "0.59709585", "0.59688735", "0.59647185", "0.5879927", "0.5874857", "0.5874857", "0.5863194", "0.57651323", "0.572694", "0.56981945", "0.568...
0.7265587
0
Returns blocks that have been completed by the user.
def get_completed_activities(self, user): return get_block_completion_model().get_course_completions(user, self.course_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_completed_user_requests(self):\n user_request_table = Table('user_request', self.metadata, autoload=True)\n try:\n u = self.session.query(user_request_table).filter(user_request_table.c.complete_date != None).all()\n return u\n except Exception as e:\n ...
[ "0.6218784", "0.6052319", "0.6034997", "0.59983146", "0.59812194", "0.5918162", "0.5892164", "0.5890043", "0.58205473", "0.5819803", "0.58095765", "0.5795065", "0.5789588", "0.5741628", "0.5703117", "0.5669344", "0.5582402", "0.5574295", "0.55629104", "0.5530578", "0.5500819"...
0.64022523
0
Filters the required_block_ids list, and returns only the required block ids that belong to the same course key. If the self.matching_blocks_by_type is set, it returns a mix with required_block_ids which exists in self.matching_blocks_by_type too. If required_block_ids is not provided, it returns just the self.matching...
def get_course_required_block_ids(self, required_block_ids): matching_blocks_by_type = self.matching_blocks_by_type if not required_block_ids: return matching_blocks_by_type required_course_block_ids = [] for required_block_id in required_block_ids: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_blocks_by_type(self):\n try:\n block_structure = get_course_in_cache(self.course_key)\n matching_blocks = block_structure.topological_traversal(\n filter_func=self.block_type_filter,\n yield_descendants_of_unyielded=True,\n )\n ...
[ "0.6557363", "0.6500718", "0.6320025", "0.569946", "0.527388", "0.5220393", "0.47971398", "0.47683832", "0.47679332", "0.46310264", "0.45374176", "0.45242417", "0.446175", "0.44509283", "0.44328925", "0.44196752", "0.44044483", "0.43976763", "0.43727362", "0.4361584", "0.4358...
0.84080374
0
Returns the completion data per course for the class instance user.
def get_user_completion_data(self): activity_completion_data = self.generate_report_data() if not activity_completion_data: return {} user_activity_completion_data = { 'total_activities': activity_completion_data[0].get('total_activities', 0), 'course_is_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity_completion_data_per_user(cls, user, course_key, block_types, passing_score):\n return cls(\n users=[user],\n course_key=course_key,\n required_block_ids=[],\n block_types=block_types,\n passing_score=passing_score,\n )", "def get_c...
[ "0.6755468", "0.6603702", "0.65039897", "0.56848747", "0.5649237", "0.55590683", "0.55026984", "0.54581296", "0.54488295", "0.5444516", "0.5392738", "0.537646", "0.53391474", "0.5320991", "0.5295563", "0.5264577", "0.5260205", "0.51627874", "0.5157417", "0.51184624", "0.50506...
0.72001636
0
Takes the argument full_name a returns a list with the first name and last name.
def get_first_and_last_name(full_name): try: result = full_name.split(' ', 1) except AttributeError: return ['', ''] else: if len(result) == 2: return result return [full_name, full_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def get_full_name(self):\n return self.last_name + self.first_name", "def split_name(fullname):", "def get_full_name(self):\n f...
[ "0.7590404", "0.74639326", "0.70186174", "0.70075244", "0.6983704", "0.6980194", "0.6935376", "0.69228685", "0.68679065", "0.68193257", "0.68101746", "0.68101746", "0.6767583", "0.6767583", "0.6767583", "0.6767583", "0.6767583", "0.6767583", "0.6767583", "0.6767583", "0.67675...
0.8341495
0
Verifies if the course is complete depending on the total of the provided course_blocks, divided by the total of completed blocks if it is greater than or equal to passing_score. PASS = ( COUNT OF BLOCKS COMPLETED / COUNT OF TOTAL COURSE BLOCKS ) >= passing_score
def is_course_activities_complete(course_blocks, completed_activities, passing_score): required_completed_activities = filter_completed_blocks( course_blocks, completed_activities, ) if not required_completed_activities: return False return (len(required_completed_activities) /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_courses(self, courses):\n assert len(courses) == 1\n self.verify_course(courses[0])", "def test_only_students_courses(self):\n user = self.make_user()\n enrollment = EnrollmentFactory(grade_level__school_year__school=user.school)\n course = CourseFactory(grade_levels...
[ "0.6163569", "0.6038663", "0.5717701", "0.57028186", "0.56399417", "0.5635293", "0.5497239", "0.54884076", "0.53935885", "0.5388074", "0.533387", "0.5311524", "0.53057474", "0.5279345", "0.52715147", "0.5239961", "0.5237964", "0.52328265", "0.52155447", "0.52152973", "0.52135...
0.7317892
0
Filters the activities completed by the required blocks. This is in order to get only the completed activities that exists in the required blocks.
def filter_completed_blocks(required_blocks, completed_activities): required_block_filter_list = [] for activity_block in required_blocks: for block_completed in completed_activities: if block_completed.block_id == activity_block.block_id: required_block_filter_list.append(b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_activity_completed(block_id, activities):\n for activity in activities:\n if block_id == activity.block_id:\n return 'completed'\n\n return 'not_completed'", "def is_course_activities_complete(course_blocks, completed_activities, passing_score):\n required_completed_activities =...
[ "0.6190682", "0.6170428", "0.574587", "0.55516094", "0.5340726", "0.5340285", "0.5323958", "0.51667595", "0.51666766", "0.5016277", "0.5001909", "0.49712154", "0.49642438", "0.49401593", "0.49247268", "0.4916293", "0.49026245", "0.4866728", "0.4820909", "0.48120883", "0.48081...
0.854114
0
Class for representing a menu on the display. Takes in a list of options in the format ["Option1", "Option2", ...] as well as a instance of a Adafruit_CharLCDPlate (display). You can set the title of the menu in the optional title parameter, and which menu option should be initially selected. If you supply a list of ch...
def __init__(self, options, display, title="", initial_selection=0, led_control=None, icons=None, blinking_leds=[]): if not options: raise ValueError("No options were given!") elif not isinstance(options, list): raise ValueError("Incompatible op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, gui, text, callback=None, shortcut=None):\r\n menu_text = pi3d.String(font=gui.font, string=text, is_3d=False,\r\n camera=gui.camera, justify='L')\r\n menu_text.set_shader(gui.shader)\r\n super(MenuItem, self).__init__(gui, [menu_text], 0, 0,\r\n call...
[ "0.6275959", "0.62204564", "0.60935247", "0.5983542", "0.5974542", "0.5947254", "0.5941323", "0.5930326", "0.5906486", "0.59027725", "0.58876145", "0.58293545", "0.5772815", "0.5732663", "0.57317424", "0.5730695", "0.5702266", "0.56929266", "0.56883335", "0.5682782", "0.56827...
0.77158916
0
Default base argument parser for DeepState frontends. Comprises of default arguments all frontends must implement to maintain consistency in executables. Users can inherit this method to extend and add own arguments or override for outstanding deviations in fuzzer CLIs. Arguments provided by this method and usable in f...
def parse_args(cls) -> Optional[argparse.Namespace]: L.debug("Parsing arguments with internal base class routine") if cls._ARGS: L.debug("Returning already-parsed arguments") return cls._ARGS # use existing argparser if defined in fuzzer object, or initialize new one, both with default argume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n parser = common.default_args(net_name=NET_NAME, \n num_classes=21, image_size=IMAGE_SIZE)\n parser.add_argument('--trained-model', required=False, help='Path to trained state_dict file', \n default=TRAINED_MODEL_PATH)\n return par...
[ "0.6864175", "0.67253065", "0.66529006", "0.65952647", "0.65521514", "0.6540375", "0.6537568", "0.6531153", "0.6460761", "0.6460188", "0.6436988", "0.6434888", "0.643052", "0.6427478", "0.64250255", "0.64175427", "0.6409228", "0.64016813", "0.6395138", "0.6374057", "0.6368534...
0.69134575
0
Calls fuzzer to print executable help menu.
def print_help(self) -> None: subprocess.call([self.fuzzer_exe, "--help"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help(self, dummy):\r\n help = self.doc + \"\\n\"\r\n if help.find(\"%s\") > 0:\r\n help = help.replace(\"%s\", self.progname)\r\n print_function(help, end='', file=self.stdout)\r\n self.exit(0)", "def help():", "def help():\n \n pass", "def test_help(self)...
[ "0.7114987", "0.705882", "0.6926778", "0.6906779", "0.68930775", "0.68923116", "0.6886856", "0.68852854", "0.68826824", "0.6873092", "0.6817056", "0.6800002", "0.67714405", "0.6763148", "0.67114705", "0.67114705", "0.66620547", "0.66542", "0.6626958", "0.6606252", "0.66038287...
0.83762217
0
Called before fuzzer execution in order to perform sanity checks. Base method contains default argument checks. Users should implement inherited method for any other environment checks or initializations before execution.
def pre_exec(self): if self.parser is None: raise FuzzFrontendError("No arguments parsed yet. Call parse_args() before pre_exec().") if self.fuzzer_help: self.print_help() sys.exit(0) # search for executables and set proper variables self._set_executables() # if compile_test is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanity_check(self):\n pass", "def _pre_argument_parsing(self):\n pass", "def setUp(self):\n\n self.niceArgV = (\"--long Alpha -n Beta \"\n \"--shortless Gamma -f --myflag \"\n \"--myparam Tofu\").split()\n\n self.nice = WellBehaved...
[ "0.6298498", "0.6257972", "0.62256056", "0.62091714", "0.62091714", "0.61326456", "0.6116244", "0.60748065", "0.60604477", "0.6002801", "0.5999785", "0.5991092", "0.59894985", "0.596327", "0.596321", "0.59577787", "0.59487563", "0.59440607", "0.59437156", "0.5926644", "0.5914...
0.63671744
0
Spawns a singular fuzzer process for execution with proper errorhandling and foreground STDOUT output. Also supports rsyncstyle seed synchronization if configured to share seeds between a global queue.
def _run(self, command: List[str]) -> int: L.info("Executing command `%s`", command) self._on = True self._start_time = int(time.time()) try: # if we are syncing seeds, we background the process and all of the output generated if self.enable_sync or self.num_workers > 1: self.pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_fuzztest(test_one_input,\n custom_setup=None,\n setup_kwargs=None,\n expected_output=None,\n timeout=10,\n args=None,\n enabled_hooks=None):\n pipe = os.pipe()\n\n pid = os.fork()\n if pid == 0:\n _fuzztes...
[ "0.6517869", "0.63203514", "0.6005611", "0.58855444", "0.58564705", "0.5733993", "0.5642118", "0.5630151", "0.5551692", "0.55479735", "0.5528578", "0.5454291", "0.54424274", "0.5414544", "0.53830457", "0.5379846", "0.5371483", "0.53506935", "0.5350012", "0.5300708", "0.529898...
0.742826
0
Kills running fuzzer process. Can be used forcefully if KeyboardInterrupt signal falls through and process continues execution.
def _kill(self) -> None: if not hasattr(self, "proc"): raise FuzzFrontendError("Attempted to kill non-running PID.") self.proc.terminate() try: self.proc.wait(timeout=0.5) L.info("Fuzzer subprocess exited with `%d`", self.proc.returncode) except subprocess.TimeoutExpired: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(self):\n self._stop_proc(signal.SIGKILL)", "def stop(self):\n if self.is_running():\n self._stdin_queue.put_nowait(None) # Ask to stop the stdin_thread\n try:\n self._popen.terminate() # Send SIGTERM to the player, asking to stop\n log....
[ "0.7164689", "0.67970186", "0.6796788", "0.67674947", "0.66868937", "0.6676354", "0.6662293", "0.6660932", "0.66277575", "0.6572951", "0.654707", "0.64200455", "0.6414739", "0.64069873", "0.63796246", "0.63703704", "0.63606185", "0.62899566", "0.6286276", "0.6228303", "0.6225...
0.694694
1
Helper that checks the number of seeds in queue, returns 0 if path doesn't exist yet.
def _queue_len(queue_path: str) -> int: if not os.path.exists(queue_path): return 0 return len([path for path in os.listdir(queue_path)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_size_empty(the_queue):\n assert the_queue.size() == 0", "def number_of_jobs_in_queue():\n\n # Initialize #\n user_name = get_username()\n\n process = subprocess.check_output([\"squeue\", \"-u\", user_name])\n\n return len([line for line in process.split(\"\\n\") if user_name in line])", ...
[ "0.5894595", "0.57291204", "0.56057847", "0.5546977", "0.5518375", "0.5472955", "0.5456383", "0.5416765", "0.53940296", "0.53917253", "0.53707904", "0.5353235", "0.5340963", "0.5334798", "0.5286593", "0.5286593", "0.5284456", "0.5255616", "0.52479565", "0.52454233", "0.522261...
0.6888466
0
Batch create Google Drive file with specific MIME type. Returns list of IDs in order of passed names.
def batch( arguments: List[BatchArgument], *, uniform_mime_type: str, include_output: bool = True, drive_service: Optional[discovery.Resource] = None, ) -> List[drive_api.ResourceID]: # callback will append resulting IDs in order result: List[drive_api.ResourceID] = [] def batch_respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(\n name: str,\n *,\n mime_type: str,\n parent_folder_id: drive_api.ResourceID,\n drive_service: Optional[discovery.Resource] = None,\n) -> http.HttpRequest:\n if drive_service is None:\n drive_service = drive_api.build_service()\n file_metadata = {\n \"name\": name,\n...
[ "0.60962206", "0.5557956", "0.5538896", "0.54742557", "0.54322815", "0.53908795", "0.53772753", "0.53763443", "0.5320586", "0.5316404", "0.5250249", "0.52436626", "0.5243005", "0.52341455", "0.5219147", "0.52063817", "0.520081", "0.51934254", "0.5133051", "0.5126762", "0.5107...
0.58004826
1
Generate request to create new Google sheet.
def gsheet_request( file_name: str, *, parent_folder_id: drive_api.ResourceID, drive_service: Optional[discovery.Resource] = None, ) -> http.HttpRequest: return request( name=file_name, mime_type=mime_types.gsheets, parent_folder_id=parent_folder_id, drive_service=dri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_spreadsheet(self, spreadsheet_name: str):\n service = build(\"sheets\", \"v4\", credentials=self.creds)\n spreadsheet = {\"properties\": {\"title\": spreadsheet_name}}\n spreadsheet = (\n service.spreadsheets()\n .create(body=spreadsheet, fields=\"spreadsheetId...
[ "0.61989534", "0.6073698", "0.5953142", "0.590696", "0.5885533", "0.58621305", "0.5854493", "0.5852856", "0.58307767", "0.58208287", "0.5765394", "0.57367474", "0.5584121", "0.54093784", "0.5395045", "0.53731966", "0.5370041", "0.53256404", "0.53151286", "0.52886915", "0.5279...
0.6188744
1
Generate request to create new Google slides presentation.
def gslides_request( file_name: str, *, parent_folder_id: drive_api.ResourceID, drive_service: Optional[discovery.Resource] = None, ) -> http.HttpRequest: return request( name=file_name, mime_type=mime_types.gslides, parent_folder_id=parent_folder_id, drive_service=dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_slideshow(slideshow_name):\n\n ss = frappe.get_doc({\"doctype\": \"Website Slideshow\",\n \"slideshow_name\": slideshow_name})\n\n ss.insert(ignore_permissions=True)\n return ss", "def CreatePresentation(self, event):\n pass", "def gslides(\n file_name: str,\...
[ "0.5689356", "0.55692714", "0.54583454", "0.5343218", "0.5277055", "0.52721393", "0.524634", "0.51034176", "0.5097129", "0.5079705", "0.5060169", "0.50562334", "0.5042719", "0.5030487", "0.5027685", "0.5027685", "0.5027685", "0.5027685", "0.5027685", "0.5027685", "0.5027685",...
0.59257597
0
Generate request to create new Google form.
def gform_request( file_name: str, *, parent_folder_id: drive_api.ResourceID, drive_service: Optional[discovery.Resource] = None, ) -> http.HttpRequest: return request( name=file_name, mime_type=mime_types.gform, parent_folder_id=parent_folder_id, drive_service=drive_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crear():\n\n return dict(form=form)", "def make_form(self):", "def render_creation_form(request: Request):\n return templates.TemplateResponse(\"creation_form.html\",{'request': request})", "def gform(\n file_name: str,\n *,\n parent_folder_id: drive_api.ResourceID,\n drive_service: Opt...
[ "0.6112762", "0.58454615", "0.58238566", "0.5816422", "0.58025336", "0.57844096", "0.56917024", "0.55713505", "0.5526634", "0.5505735", "0.547781", "0.5472188", "0.54276896", "0.539651", "0.53915656", "0.53780717", "0.5325138", "0.5308509", "0.53019726", "0.52918446", "0.5288...
0.6309211
0
Generate computational art and save as a movie file.
def generate_movie(filename, x_size=640, y_size=360, numframes=150, dpi=100): global timeflag timeflag = 1 # Functions for red, green, and blue channels - where the magic happens! red_function = build_random_function(7, 9) green_function = build_random_function(7, 9) blue_function = build_rando...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_video(org_arr, pred_arr, file_name):\n fig = plt.figure()\n ax1 = fig.add_subplot(1,2,1)\n ax2 = fig.add_subplot(1,2,2)\n ax1.set_title('Actual')\n ax2.set_title('Predicted')\n\n im_list = []\n org_length = org_arr.shape[0]\n total_length = pred_arr.shape[0]\n \n for t in ran...
[ "0.6346806", "0.6117194", "0.609142", "0.6059405", "0.60121894", "0.59942466", "0.59374064", "0.5933743", "0.59236395", "0.5886954", "0.58816856", "0.58632165", "0.5831349", "0.5826374", "0.578365", "0.5779356", "0.57666063", "0.5763358", "0.5758736", "0.57562274", "0.5747698...
0.63296103
1
takes the folname or take the(.) for the same directory and file name and data the data written in the file and saved with the given name and also confirms the file is written or not.
def write_file(self, fname, name, inputd): self.filename = name if fname != ".": self.fname = f"{fname}\\" self.pathwrite = os.path.join(self.p, self.fname) else: self.pathwrite = self.p self.input = inputd try: self.path =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file(self, name, data):\n if os.path.isdir(\"saved_data\"):\n with open(f'saved_data/{name}.txt', 'wb') as file:\n pickle.dump(data, file)\n else:\n os.mkdir(\"saved_data\")\n self.save_to_file(name, data)", "def save_file(file_name: str, ...
[ "0.67826235", "0.6542774", "0.6287567", "0.6241281", "0.6241281", "0.6241281", "0.6241281", "0.6241281", "0.6241281", "0.62283665", "0.6212737", "0.6131624", "0.6083841", "0.6066758", "0.60610497", "0.60541207", "0.60511506", "0.6041941", "0.597744", "0.5911162", "0.58997786"...
0.6663117
1
parse string format market data, accept one single line only
def __parse_market_data__(self, market_data_str): """return an MarketData instance if format correct, return None otherwise""" OMSLogger.debug("Parsing market data - {0}".format(market_data_str)) result = re.match(".*var hq_str_(.+)=(.*)", market_data_str) if result is not None: market_data = MarketData(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_string(self, data):\n pass", "def parse(cls, s):\n raise NotImplementedError", "def parseString(self, s):\n pass", "def parse(s):\n return s", "def parseOne(self, s):\n \n m = self.re.match(s)\n if not m:\n self.findParsingFailure(s)\n ...
[ "0.67632836", "0.6200467", "0.618981", "0.6178353", "0.609115", "0.6069867", "0.5988729", "0.5965979", "0.59618026", "0.59277654", "0.5899768", "0.5864829", "0.5862139", "0.5855816", "0.5801726", "0.5801726", "0.5801726", "0.5801726", "0.57985425", "0.5795013", "0.57932127", ...
0.70342225
0
start to load market data for registered products
def start(self): self.load_market_data = True while(self.load_market_data):#TODO lock if(len(self.registered_symbol_list) > 0): OMSLogger.info("Start loading market data for registered symbols...") self.__reload_market_data__(self.market_data_list, self.registered_symbol_list) OMSLogger.info("Success...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_products():\n\n print \"Loading Products\"\n\n for i, row in enumerate(open(\"data/mock_product_data.csv\")):\n row = row.rstrip()\n title, price, inventory = row.split(\",\")\n\n product = Product(title=title,\n price=price,\n a...
[ "0.6241907", "0.61440766", "0.6117367", "0.61021024", "0.59254026", "0.5895285", "0.5854448", "0.5854448", "0.58486074", "0.5825481", "0.58013105", "0.5767315", "0.57244426", "0.5699746", "0.5688672", "0.5682539", "0.5681925", "0.5681052", "0.5663799", "0.56473595", "0.563094...
0.78145844
0
mousepos() > (x, y) get the mouse coordinates on the screen (linux, Xlib).
def mousePos(): data = display.Display().screen().root.query_pointer()._data return data["root_x"], data["root_y"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_coords(desktop=False):\n x, y = c_int(0), c_int(0)\n if desktop:\n mouse.SDL_GetGlobalMouseState(byref(x), byref(y))\n else:\n mouse.SDL_GetMouseState(byref(x), byref(y))\n return (int(x.value), int(y.value))", "def get_mouse_pos(self):\n return self.mouse_pos", "def ...
[ "0.7897899", "0.78212535", "0.7606964", "0.74203545", "0.73762643", "0.7368579", "0.7278506", "0.7201637", "0.71994823", "0.71690476", "0.71617246", "0.7146447", "0.6999823", "0.6990059", "0.6960489", "0.6835099", "0.6821031", "0.6763449", "0.67225814", "0.6697521", "0.669446...
0.8089616
0
Get various information about the current state of the API. This provides general information such as the API version number, but also use specific information such as the limitations on your account. Some of this information is needed to ensure that your API calls will go through within your limits.
def get_info(self): url = self._url_for_op('info') data= None # This will be a GET request since data is None response = self._get_raw_response(self._get_json_headers, self._get_json_response, url, data) response = json.loads(response) self.api_info = response['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(self):\n resp = requests.get(\"%s/api/info\"%self.urlbase, verify=False)\n return resp.json", "def version_info(self):\n if self._api_version is None:\n self.query_api_version()\n return self._api_version['api-major-version'],\\\n self._api_version['api-...
[ "0.6621979", "0.6436655", "0.63704216", "0.63581526", "0.63548934", "0.62414426", "0.6217001", "0.6209317", "0.61035305", "0.60124165", "0.59930694", "0.59762084", "0.5974568", "0.59436816", "0.5878771", "0.58714795", "0.58355135", "0.58355135", "0.5806497", "0.5798459", "0.5...
0.66126287
1
Embed a single image from an open file object or multiples images from a list of open file objects. The only method used on the file object is read() to get the bytes of the compressed image representation.
def embed_images(self, image_files, model=None): return self._multi_image_op(image_files, ['embed'], model=model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_image_files(self, input_files):\n # Handle single file-object as arg.\n if not isinstance(input_files, list):\n input_files = [input_files]\n self._check_batch_size(input_files)\n # Handle unnames images as lists of file objects. Named by index in list.\n image_files = []\n for ...
[ "0.58293635", "0.5824773", "0.5678383", "0.56531245", "0.5567011", "0.55600524", "0.55577356", "0.5552136", "0.55514264", "0.5506007", "0.54603636", "0.54087603", "0.536422", "0.5363578", "0.5356601", "0.5346315", "0.5337838", "0.5323492", "0.52770257", "0.5259858", "0.525752...
0.64598346
0
Tag an image from a url or images from a list of urls.
def tag_image_urls(self, image_urls, model=None): return self._multi_imageurl_op(image_urls, ['tag'], model=model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_and_embed_image_urls(self, image_urls, model=None):\n return self._multi_imageurl_op(image_urls, ['tag','embed'], model=model)", "def tag_images(self, image_files, model=None):\n return self._multi_image_op(image_files, ['tag'], model=model)", "def multi_tag_image(self, owner_userid, tag_userid, ...
[ "0.7519806", "0.7042171", "0.6486261", "0.63569546", "0.6291437", "0.6287635", "0.6284102", "0.62144685", "0.6171674", "0.6171674", "0.6051872", "0.59324396", "0.5905229", "0.5878078", "0.58752596", "0.58505106", "0.573084", "0.5697158", "0.5688559", "0.56181186", "0.561193",...
0.8037529
0
Embed an image from a url or images from a list of urls.
def embed_image_urls(self, image_urls, model=None): return self._multi_imageurl_op(image_urls, ['embed'], model=model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_images(self, html):\n if not self.SUPPORT_EMBED_IMAGES:\n raise RuntimeError('%r does not support embed_images' % type(self))\n\n return self.RE_IMG.sub(self._embed_image, html)", "def tag_and_embed_image_urls(self, image_urls, model=None):\n return self._multi_imageurl_op(image_urls, ['t...
[ "0.71564054", "0.6972918", "0.67951477", "0.6553891", "0.5842587", "0.58314836", "0.57488525", "0.57395905", "0.5737635", "0.5713767", "0.56395465", "0.55615705", "0.55264586", "0.5499014", "0.5482101", "0.5468197", "0.54649043", "0.5451965", "0.5435891", "0.54182047", "0.538...
0.7587019
0
Tag AND Embed an image from a url or images from a list of urls.
def tag_and_embed_image_urls(self, image_urls, model=None): return self._multi_imageurl_op(image_urls, ['tag','embed'], model=model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_image_urls(self, image_urls, model=None):\n return self._multi_imageurl_op(image_urls, ['embed'], model=model)", "def tag_image_urls(self, image_urls, model=None):\n return self._multi_imageurl_op(image_urls, ['tag'], model=model)", "def embed_images(self, html):\n if not self.SUPPORT_EMBED_...
[ "0.6972238", "0.6813266", "0.6444531", "0.62220436", "0.6167947", "0.59146017", "0.58651495", "0.58619255", "0.5770083", "0.57586116", "0.55937934", "0.54536104", "0.5404317", "0.53990984", "0.53934556", "0.5376384", "0.5332877", "0.5310744", "0.5295787", "0.5269873", "0.5265...
0.7946391
0
Ensure the maximum batch size is obeyed on the client side.
def _check_batch_size(self, data_list): if self.api_info is None: self.get_info() # sets the image size and other such info from server. MAX_BATCH_SIZE = self.api_info['max_batch_size'] if len(data_list) > MAX_BATCH_SIZE: raise ApiError(("Number of images provided in bach %d is greater than max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _global_batch_size(self):\n return True", "def batch_size(self) -> int:\n ...", "def ExpectedMaxBatchSizes(self, run_params):\n return self.max_batch_sizes", "def test_exceed_limit_request(self):\n actions.login(ADMIN_EMAIL)\n ids_list = list(range(SkillAggregateRestHandler.MAX...
[ "0.7186128", "0.7025111", "0.6904064", "0.6675011", "0.66657996", "0.6511049", "0.6463051", "0.64404786", "0.64300257", "0.6408258", "0.64028066", "0.63467777", "0.6273385", "0.6272483", "0.6264146", "0.62434876", "0.6241865", "0.622064", "0.622064", "0.622064", "0.622064", ...
0.7375943
0
Get a raw_response from the API, retrying on TOKEN_EXPIRED errors.
def _get_raw_response(self, header_func, request_func, *args): headers = header_func() attempts = 3 while attempts > 0: attempts -= 1 try: # Try the request. raw_response = request_func(*args, headers=headers) return raw_response except urllib2.HTTPError as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response(self, response, no_refresh=False):\n data = self.get_data(response)\n\n if 200 <= response.status_code < 300:\n return data\n elif (not no_refresh and response.status_code == 401 and not\n response.url.endswith(\"auth/token\") and\n sel...
[ "0.67919916", "0.640818", "0.6403639", "0.6336694", "0.63265896", "0.62888855", "0.6216558", "0.62123924", "0.61564237", "0.61526924", "0.61292577", "0.6016049", "0.60055137", "0.5952076", "0.59160644", "0.5898027", "0.58644927", "0.5862486", "0.5855144", "0.58018047", "0.579...
0.7350345
0
Archives a .isolate file into the isolate server and returns the isolated hash.
def isolate(self, isolate_path): dump_json = os.path.join(self._tmpdir, 'digest.json') cmd = [ ISOLATE_CLI, 'archive', '-cas-addr', self._cas_addr, '-i', isolate_path, '-dump-json', dump_json, '-log-level', 'debug', ] loggin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive(self, step_name, isolate_server=None):\n isolate_server = isolate_server or self._api.isolated.isolate_server\n cmd = [\n 'archive',\n '-verbose',\n '-isolate-server', isolate_server,\n '-namespace', self._api.isolated.namespace,\n '-dump-hash', self._api.raw_io...
[ "0.7544583", "0.59696853", "0.5371816", "0.5008424", "0.49662116", "0.49118322", "0.4882244", "0.48687083", "0.4844938", "0.47982392", "0.47649038", "0.47252056", "0.47209853", "0.46957988", "0.46950313", "0.46912673", "0.46882662", "0.46671316", "0.46639213", "0.4634718", "0...
0.71852726
1
Triggers a task and return the task id.
def task_trigger(self, args): h, tmp = tempfile.mkstemp( dir=self._tmpdir, prefix='trigger_raw', suffix='.json') os.close(h) cmd = [ '-user', 'joe@localhost', '-d', 'pool=default', '-dump-json', tmp, ] cmd.extend(args) assert not self._run_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_id(self):\n return self._task_id", "def task_id(self):\n return self._task_id", "def task_id(self):\n return self._task_id", "def task_id(self):\n return self._task_id", "def task_id(self) -> str:\n return self.get_from_redis(\"task_id\")", "def task_trigger_ra...
[ "0.6570979", "0.6570979", "0.6570979", "0.6570979", "0.6354358", "0.63243306", "0.6189464", "0.61105305", "0.6065831", "0.60404944", "0.6007011", "0.5980283", "0.59606063", "0.59173083", "0.58610845", "0.58577853", "0.58472985", "0.58402574", "0.5835049", "0.57727355", "0.575...
0.70949566
0
Triggers a task with the very raw RPC and returns the task id.
def task_trigger_raw(self, request): input_json = os.path.join(self._tmpdir, 'task_trigger_raw_input.json') with open(input_json, 'wb') as f: json.dump({'requests': [request]}, f) output_json = os.path.join(self._tmpdir, 'task_trigger_raw_output.json') args = [ '-json-input', input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_trigger(self, args):\n h, tmp = tempfile.mkstemp(\n dir=self._tmpdir, prefix='trigger_raw', suffix='.json')\n os.close(h)\n cmd = [\n '-user',\n 'joe@localhost',\n '-d',\n 'pool=default',\n '-dump-json',\n tmp,\n ]\n cmd.extend(args)\n ass...
[ "0.7293252", "0.64789873", "0.6228203", "0.6104907", "0.6104907", "0.6104907", "0.6104907", "0.6100243", "0.6083053", "0.6071605", "0.6056533", "0.60088867", "0.60020906", "0.59660983", "0.59599125", "0.5910463", "0.5890931", "0.58901036", "0.58385223", "0.57957363", "0.57720...
0.71051115
1
Runs swarming command and capture the stdout to a log file. The log file will be printed by the test framework in case of failure or verbose mode.
def _run_swarming(self, command, args): cmd = [ SWARMING_CLI, command, '-verbose', ] if command != 'logout': cmd += [ '-S', self._swarming_server, ] cmd += args logging.debug('SwarmingClient._run_swarming: executing command. %s', cmd) with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testRunSmoke(self):\n stage = self.ConstructStage()\n with self.OutputCapturer():\n stage.Run()", "def cli(stage, maas_url, maas_key, debug, output_log):\n if debug:\n log.setLevel(logging.DEBUG)\n detail = {'start': datetime.utcnow().isoformat(), }\n results = {}\n log_id = '{}...
[ "0.6251319", "0.62271297", "0.57874525", "0.5717028", "0.5714953", "0.56853086", "0.554318", "0.5528274", "0.55195636", "0.54882896", "0.5466986", "0.54646045", "0.5421403", "0.5404279", "0.5391624", "0.53725785", "0.53719467", "0.5367206", "0.53547883", "0.5349812", "0.53459...
0.6886164
0
Creates a dummy task that keeps the bot busy, while other things are being done.
def _make_wait_task(self, name): signal_file = os.path.join(self.tmpdir, name) open(signal_file, 'wb').close() args = [ '-task-name', 'wait', '-priority', '20', '--', 'python', '-u', '-c', # Cheezy wait. ('import os,time;' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def giveaway_master_task(self, ctx):\n self.bot.loop.create_task(self.giveaway_task(ctx))", "def create_task():", "def test_executes_single_task(self):\n g = TaskDependencyGraph(MockWorkflowContext())\n task = tasks.NOPLocalWorkflowTask(mock.Mock())\n g.add_task(task)\n ...
[ "0.67689013", "0.6701022", "0.6641222", "0.6636222", "0.62674546", "0.62674546", "0.61298436", "0.611172", "0.61108345", "0.598856", "0.59104913", "0.5859133", "0.5830989", "0.58294445", "0.58265203", "0.5805587", "0.57962686", "0.578669", "0.57530785", "0.5750359", "0.574634...
0.7077946
0
Kills bot, kills server, print logs if failed, delete tmpdir.
def cleanup(bot, client, servers, print_all): try: if bot: bot.stop() finally: if servers: servers.stop() if print_all: if bot: bot.dump_log() if servers: servers.dump_log() if client: client.dump_log() if not Test.leak: shutil.rmtree(Test.tmpdir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def shutdown(self, ctx):\n await self.bot.session.close()\n await self.bot.logout()", "def remote_kill():", "def close(self):\n try:\n process_id = get_pid(\"broker_mqtts\")\n except subprocess.CalledProcessError:\n pass\n else:\n os.sys...
[ "0.6709724", "0.6427267", "0.6385896", "0.62827206", "0.6259758", "0.6243886", "0.6232867", "0.6232867", "0.6231214", "0.6204245", "0.61856025", "0.61398697", "0.6138116", "0.612066", "0.61199355", "0.6105347", "0.6100323", "0.60950816", "0.6047881", "0.6047881", "0.6047881",...
0.7208726
0
Checks record count+addrH+addrL+type+sum(dd)+ss == 0x00. If checksum doesn't match, it raises exceptions, else silently return.
def check_record(self, record): checking = reduce(lambda x,y: x + y, [int(record[i*2:i*2+2], 16) for i in [x for x in xrange(len(record)/2)]]) if ('%02x' % checking)[-2:] != '00': raise Exception ('ERROR: Checksum doesn\' match! Record is %s' % (record, ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkChecksum(self):\n if not self.checkPacketLength():\n return False\n return CCSDS.DU.DataUnit.checkChecksum(self)", "def validate_checksum(blob: bytes, offset: int, length: int):\n\n checksum = ord(blob[offset + length - 1:offset + length])\n data_sum = sum(\n struct.unpack('%dB' ...
[ "0.6866023", "0.6373411", "0.61275214", "0.6117228", "0.60390735", "0.60103786", "0.5990756", "0.59753776", "0.5865991", "0.5719064", "0.57116556", "0.56435835", "0.561588", "0.5603592", "0.558702", "0.5583555", "0.5563853", "0.5543512", "0.55383164", "0.5534948", "0.55262834...
0.7502026
0
calculate similarity of text text using shingle similarity shingle similarity is defined as similarity of minhash obtained by hashing ngrams of length n=shingle_length
def text_similarity(this_text, other_text, shingle_length=5, minhash_size=200, random_seed=5): this_shingles = ShingledText(this_text, random_seed=random_seed, shingle_length=shingle_length, minhash_size=minhash_size) other_shingles = ShingledText(other_text, random_seed=random_seed, shingle_length=shingle_leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordSimilarityRatio(sent_1,sent_2):", "def hamming_dist(s1, s2):\n\n if s1 is None or s2 is None:\n return np.NaN\n if pd.isnull(s1) or pd.isnull(s2):\n return np.NaN\n\n # Create the similarity measure object\n measure = sm.HammingDistance()\n\n s1 = gh.convert_to_str_unicode(s1...
[ "0.6907867", "0.6709597", "0.6569809", "0.6449686", "0.6283343", "0.6216669", "0.6194504", "0.61827755", "0.61811525", "0.61566395", "0.61413586", "0.61285746", "0.61087114", "0.60887563", "0.6070071", "0.6042183", "0.60106283", "0.59998983", "0.59986806", "0.59706545", "0.59...
0.8130138
0
create a image with the specified number and size
def create_num(num, size): img = Image.new("RGB", size, (255,255,255)) dr = ImageDraw.Draw(img) font = ImageFont.truetype(font=os.path.join('Fonts', 'Futura.ttc'), size=size[0] /10 * 8 ) dr.text((0, 0), str(num), font=font, fill='#FF0000') return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomImage(size, lims=[0,255]):\n a,b = lims\n image_array = (b-a)*np.random.random(size) + a\n image = sitk.GetImageFromArray(image_array.astype(int))\n return image", "def generate_image(color):\n color_tuple = int_rgb_tuple(color)\n return Image.new('RGB', (500, 500), color=colo...
[ "0.667464", "0.6608456", "0.6537252", "0.64230597", "0.63795525", "0.6339639", "0.63377255", "0.6257815", "0.6180493", "0.6125759", "0.61154306", "0.60663456", "0.6043323", "0.6009479", "0.6007449", "0.59937465", "0.5991408", "0.5976749", "0.5964706", "0.5963398", "0.59488356...
0.7388024
0
Test if this labyrinth list of nodes is equal to an other list of nodes. Return True if the lists are the same, False else.
def equals_list_nodes(self, self_list_nodes, other_list_nodes): #If the two list of nodes have different lengths, they are automatically different if len(self_list_nodes) != len(other_list_nodes): return False else: #We sort both list of nodes self_list_node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_same(lst1, lst2):\n return len(lst1) == len(lst2) and all([x == y for x, y in zip(lst1, lst2)])", "def __eq__(self, other: LinkedList) -> bool:\n curr1 = self._first\n curr2 = other._first\n are_equal = True\n\n while are_equal and curr1 is not None and curr2 is not None:\...
[ "0.73232615", "0.7302792", "0.72638583", "0.7238595", "0.71936786", "0.6982857", "0.6915042", "0.6912449", "0.6912093", "0.6910182", "0.68487555", "0.6829646", "0.68256193", "0.6825079", "0.6809668", "0.6764149", "0.6756064", "0.6748823", "0.6730351", "0.6709269", "0.6703674"...
0.7905905
0
This method is looking for the node where the agent must move depending on the breadth first search done just before
def find_node_to_move_on(self, node): #We start from the node where the agent must go, and we climb up through each father of each node to reach #the agent position which is set with distance_from_start_point = 0 while(node.pere is not None and node.pere.distance_from_start_point > 0): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\"\n #the logic is same as for DFS just that i made use of a Queue data structure\n #Here the queue acts as a FIFO queue\n neighbourNodes = util.Queue()\n moves = []\n neighbourNodes.push((problem.getStartState(),moves))\n seenNodes = ...
[ "0.67212075", "0.6716057", "0.66419077", "0.6634997", "0.6630803", "0.6558829", "0.64843696", "0.6451893", "0.6438612", "0.6373548", "0.6360561", "0.6351132", "0.6327111", "0.6313252", "0.6310004", "0.62989646", "0.62894976", "0.6265604", "0.62528837", "0.6246162", "0.6243308...
0.7852436
0
Get every line of the labyrinth from a file with the name stocked in self.file_name
def get_labyrinth_from_file_name(self, file_name): excel_file = xlrd.open_workbook(self.file_name) labyrinth = list() for sheet in excel_file.sheets(): for i in range(sheet.nrows): row = list() for j in range(sheet.ncols): row.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(file_name):\n with open(file_name, \"r\", encoding=\"latin-1\") as file:\n text = file.read()\n text = text.lower() # Make everything lowercase\n text = text.split(\"\\n\")\n return text", "def load_file(file):\r\n\r\n try:\r\n with open(Path(file), \...
[ "0.5950002", "0.58714116", "0.58625305", "0.5798636", "0.57638735", "0.5742098", "0.5712175", "0.57048666", "0.566401", "0.5655647", "0.5642948", "0.56216055", "0.55988544", "0.55596155", "0.5548152", "0.5544395", "0.5543723", "0.55341923", "0.5507374", "0.5503031", "0.549952...
0.73383474
0
Initialize all the parameters of the labyrinth. 1. Create the list of nodes of the labyrinth. 2. Calculate the connections between the nodes 3. Set the labyrinth statistics
def initialization_labyrinth(self): self.set_datas_from_labyrinth() self.set_connection_between_nodes() self.set_labyrinth_statistics_from_labyrinth()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_labyrinth_statistics_from_labyrinth(self):\n\n self.labyrinth_statistics[\"number_of_walls\"] = len(self.list_wall_nodes)\n self.labyrinth_statistics[\"number_of_empty_nodes\"] = len(self.list_empty_nodes)\n self.labyrinth_statistics[\"number_of_lines\"] = len(self.labyrinth_nodes)\n ...
[ "0.7524213", "0.7488672", "0.6862151", "0.60401005", "0.59584546", "0.5929167", "0.58454657", "0.57737875", "0.57659703", "0.57571495", "0.57440484", "0.5661195", "0.56515986", "0.5642341", "0.5628112", "0.5624133", "0.5606988", "0.55746317", "0.5562131", "0.55599517", "0.554...
0.8518649
0
Initialize all the nodes in self.list_empty_nodes for the BFS algorithm
def initialization_list_empty_nodes(self, n): for node in self.list_empty_nodes: node.status = 0 node.distance_from_start_point = n+1 node.pere = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, nodes=None, edges=None):\n self._nodes = []\n self.nodes = nodes\n self._edges = []\n self.edges = edges\n self._create_connections()\n self._sorted_nodes = None\n self._node_wip = []", "def __init__(self):\n\n self.head = None\n s...
[ "0.6770023", "0.6636124", "0.6586944", "0.6540928", "0.64224684", "0.6420743", "0.63750565", "0.63307583", "0.63259214", "0.629918", "0.62707126", "0.626963", "0.626963", "0.626963", "0.626963", "0.626963", "0.626963", "0.6255182", "0.6231805", "0.61988544", "0.61955404", "...
0.72693366
0
Test if this labyrinth is the same as another_labyrinth. If it is, it returns True, else False
def is_equal_to(self, another_labyrinth): if self.equals_list_nodes(self.list_empty_nodes, another_labyrinth.list_empty_nodes) and \ self.equals_list_nodes(self.list_wall_nodes, another_labyrinth.list_wall_nodes) and \ self.start_point.position_is_equal_to(another_labyrinth.start_point)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equal(self, other):\n return (other.__class__ == self.__class__\n and other.subscript == self.subscript\n and other.swept_inames == self.swept_inames)", "def __eq__(self, other: object) -> bool:\n if isinstance(other, Lintable):\n return bool(self.nam...
[ "0.6251987", "0.6195345", "0.60476583", "0.6036093", "0.5908117", "0.58896196", "0.58731157", "0.58171904", "0.5816576", "0.5771325", "0.57470727", "0.5745427", "0.57334596", "0.5723429", "0.5710649", "0.5685042", "0.5677588", "0.5671364", "0.56665087", "0.5658457", "0.565556...
0.7355141
0
Move the Agent through the labyrinth to reach the exit point
def move_to_exit(self, time_move=0.25): #While the agent is not on the exit, we keep going through the labyrinth while self.agent_node.labyrinth_position != self.exit_point.labyrinth_position: #We use breadth first search to create the tree with the distance of every node from the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n try:\n self.agents.sort(key=lambda x: x.dist)\n except Exception as e:\n print(e)\n\n for agent in self.agents:\n try:\n agent.step()\n except Exception as e:\n print(e)\n\n\n # Removes agent...
[ "0.67376053", "0.67096335", "0.65246594", "0.64401746", "0.639557", "0.63772166", "0.63708514", "0.6310117", "0.6295505", "0.62909174", "0.62547857", "0.62440604", "0.6238981", "0.61872786", "0.6130196", "0.6120935", "0.6107114", "0.6103596", "0.6073263", "0.60596234", "0.603...
0.7861196
0
Print the labyrinth and its element in the terminal
def print_labyrinth(self): for line in self.labyrinth_nodes: for column in line: #If there is only one element, we print its symbol if len(column.elements) == 1: print(column.elements[0].symbol, end="") #Else, we are looking for t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_colored(word):\n for char in word:\n print(c.rc() + char + c.x, end='')", "def print(self):\n self.print_avec_separateur(\" \")", "def displayField(self):\n print(\"Field :\")\n for i in range(len(self.field)):\n currentSuit = Suit(i + 1)\n print(B...
[ "0.630278", "0.62854207", "0.6244289", "0.6218718", "0.6127208", "0.6041815", "0.5927468", "0.5927468", "0.5927468", "0.59241295", "0.5916692", "0.59164774", "0.5880909", "0.5877843", "0.58704937", "0.58370924", "0.5823288", "0.5793524", "0.5780061", "0.57733345", "0.5755348"...
0.79485613
0
Set every attributes connected_to for every node in self.list_empty_nodes. It establishes the connection between nodes.
def set_connection_between_nodes(self): for i, node in enumerate(self.list_empty_nodes): line = node.labyrinth_position[0] column = node.labyrinth_position[1] for j in range(i+1, len(self.list_empty_nodes)): line_j = self.list_empty_nodes[j].labyrinth_positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_nodes(self):\n for src_id, trg_id in itertools.product(self.selected_nodes, repeat=2):\n if src_id != trg_id:\n app.edges[src_id].add(trg_id)\n self.mark_as_unsaved()\n self.update()", "def set_empty_pconn(self):\n self.pconn = []\n for i i...
[ "0.6065682", "0.6034549", "0.6007116", "0.59849316", "0.59627634", "0.58610946", "0.57516867", "0.5659547", "0.56399775", "0.56309634", "0.55913776", "0.5507225", "0.5498471", "0.5487025", "0.5473204", "0.5469353", "0.54625124", "0.54582596", "0.5454004", "0.54386586", "0.541...
0.741215
0
Create the list of nodes depending on the labyrinth read in a xls file and set self.start_point and self.exit_point and self.agent_node
def set_datas_from_labyrinth(self): node_number = 1 for i, line in enumerate(self.labyrinth): row = list() for j, column in enumerate(line): node = Node(node_number, (i,j)) #If it is an empty space if column == "": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_nodes(self):\r\n for line in self._ansys_file:\r\n node_match = self._node_pattern.match(line)\r\n if node_match: # if we find a node\r\n # save the first 4 entries (drop last 3: thxy, thyz, thzx)\r\n (node_num, x, y, z) = line.strip().split()[:-...
[ "0.6326119", "0.61467755", "0.6062751", "0.603949", "0.59207296", "0.58894974", "0.583295", "0.5701879", "0.56606984", "0.5651923", "0.5636672", "0.55520123", "0.55446404", "0.5490439", "0.5490439", "0.5490439", "0.5490439", "0.5490439", "0.5490439", "0.5488257", "0.54751027"...
0.69683915
0
Set the dictionary for the attributes labyrinth_statistics and returns it
def set_empty_labyrinth_statistics(self): labyrinth_statistics = { "number_of_nodes" : 0, "number_of_empty_nodes" : 0, "number_of_walls" : 0, "number_of_lines" : 0, "number_of_columns" : 0, "distance_between_start_and_end_point" : 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_labyrinth_statistics_from_labyrinth(self):\n\n self.labyrinth_statistics[\"number_of_walls\"] = len(self.list_wall_nodes)\n self.labyrinth_statistics[\"number_of_empty_nodes\"] = len(self.list_empty_nodes)\n self.labyrinth_statistics[\"number_of_lines\"] = len(self.labyrinth_nodes)\n ...
[ "0.68640757", "0.6362609", "0.5700266", "0.56478715", "0.5451247", "0.53629506", "0.52479935", "0.51935875", "0.5114774", "0.5094963", "0.50317144", "0.50205755", "0.5017635", "0.5013693", "0.5010334", "0.50047064", "0.49711466", "0.49693966", "0.4938572", "0.49112397", "0.48...
0.6776317
1
Change the statistics that vary with the movement of the agent through the labyrinth
def update_statistics_after_move(self, node_to_move_on): distance_exit = self.exit_point.distance_from_start_point distance_node_to_move_on = node_to_move_on.distance_from_start_point self.labyrinth_statistics["distance_between_agent_and_end_point"] = distance_exit - distance_node_to_move_on ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_labyrinth_statistics_from_labyrinth(self):\n\n self.labyrinth_statistics[\"number_of_walls\"] = len(self.list_wall_nodes)\n self.labyrinth_statistics[\"number_of_empty_nodes\"] = len(self.list_empty_nodes)\n self.labyrinth_statistics[\"number_of_lines\"] = len(self.labyrinth_nodes)\n ...
[ "0.65501183", "0.6097163", "0.60504586", "0.59589857", "0.59070337", "0.57910967", "0.5789092", "0.5759537", "0.57431936", "0.5737679", "0.57340133", "0.573259", "0.5719384", "0.57143474", "0.57058847", "0.5694831", "0.5671721", "0.5659433", "0.56249106", "0.5616941", "0.5616...
0.6247528
1
Return a url to the Sentera API for the path supplied.
def sentera_api_url(self, path): return "{}{}".format(self.config["sentera_api_url"], path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_path(self, path=\"\"):\n return \"https://{domain}/{path}\".format(\n domain=self.setting(\"DOMAIN\"), path=path\n )", "def url(self, path):\n return '%s://%s/v2/%s' % (self.scheme, self.host, path)", "def smUrl(path):\n return SM_API_ORIGIN + path", "def get_url(dom...
[ "0.7508254", "0.71337175", "0.7019564", "0.6793392", "0.658173", "0.6573704", "0.6560741", "0.65258485", "0.63363427", "0.630894", "0.6263704", "0.621973", "0.61832464", "0.60847974", "0.60666865", "0.5996007", "0.59950614", "0.59947544", "0.5992645", "0.5982476", "0.5979119"...
0.8931896
0
Return a url to the weather service for the path supplied.
def weather_api_url(self, path): return "{}{}".format(self.config["weather_api_url"], path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weather_url(user_entry, daily_or_weekly):\n daily_partial_url = \"http://api.openweathermap.org/data/2.5/weather?\"\n forecast_partial_url = \"http://api.openweathermap.org/data/2.5/forecast/daily?q=\"\n # The API key is stored in a separate file using tiny db\n api_key = apis.open_weather()\n z...
[ "0.65166354", "0.63241583", "0.6320176", "0.6144665", "0.6139227", "0.6108755", "0.6093535", "0.6056453", "0.60426855", "0.6011638", "0.59330595", "0.5874844", "0.58732975", "0.5793996", "0.57851017", "0.5733007", "0.5709437", "0.5665166", "0.55615014", "0.5536083", "0.552861...
0.86925185
0
DESCRIPTION ............ This method displays more information about a particular post. PARAMETER ............
def detail(request, post_id, post_type): user_additional_info = UserAdditionalInfo.objects.get(user_id = 1) user = User.objects.get(id=1) try: if post_type == "i": # i represents images post = ImagePost.objects.get(id = post_id) else: post = VideoPost.objects.get(id = post_id) except (ImagePost.DoesNotEx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_post_details(post_id):\r\n post = Post.query.get(post_id)\r\n user = User.query.get_or_404(post.user_id)\r\n return render_template('post-details.html', user=user, post=post)", "def showPost(self, id):\n post = self._extractPost(id)\n date = datetime.datetime.strptime(post['dateCr...
[ "0.6667812", "0.66466486", "0.6591754", "0.6476291", "0.6439535", "0.6404022", "0.6375105", "0.63720626", "0.634993", "0.6340292", "0.630216", "0.6275537", "0.62745774", "0.62730753", "0.62696445", "0.62314063", "0.6202702", "0.6145485", "0.6142997", "0.614029", "0.6108172", ...
0.6875685
0
Determines which fighter attacks first. The fighter with the higher speed starts. If their speeds are equal the higher luck attacks first. If their luck is also equal it is determined by chance.
def DetermineAttackOrder(self): if self.fighter1.speed > self.fighter2.speed: self.attacker = self.fighter1 self.defender = self.fighter2 elif self.fighter2.speed > self.fighter1.speed: self.attacker = self.fighter2 self.defender = self.fighter1 e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fight_trainer(trainer1, trainer2, pkmn1, pkmn2) -> bool:\n win = False\n while True:\n if pkmn1[\"speed\"] > pkmn2[\"speed\"]:\n # you go first\n pkmn2[\"health\"] = _attack(pkmn1, pkmn2)\n if pkmn2[\"health\"] <= 0:\n win = True\n br...
[ "0.6655411", "0.5982354", "0.5968946", "0.59331137", "0.58603865", "0.5779226", "0.5752654", "0.57503355", "0.57442063", "0.5699704", "0.5662761", "0.5622021", "0.5618552", "0.5544327", "0.5514454", "0.5496776", "0.54727185", "0.5436363", "0.54332215", "0.5421181", "0.5361963...
0.7598537
0
Checks if the combat has ended, either by knockout or turn limit. If it is not over it swaps the attacker and defender and continues. Returns True If the defenders health is <= 0 If currentTurn == maxTurns False Otherwise
def EndTurn(self): if self.defender.health <= 0: print("{0} ran out of health and passed out, {1} is the victor!".format(self.defender.name, self.attacker.name)) return True self.currentTurn += 1 if self.currentTurn >= self.maxTurns: print("Both parties got b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defend(self):\n\n # get the total amount of defense from each piece of armor\n\n # if hero is alive return total amount of defense\n # if hero dead return zero defense\n\n total_armor_defense = 0\n if len(self.armors) > 0 and self.health > 0:\n for armor in self.ar...
[ "0.60795766", "0.5904419", "0.5861529", "0.5846946", "0.5845766", "0.583376", "0.5821096", "0.58195776", "0.57916456", "0.5774565", "0.5746493", "0.5702514", "0.56995195", "0.5672191", "0.5660526", "0.56502867", "0.56337184", "0.5632309", "0.56074345", "0.5593043", "0.5591338...
0.7368726
0
Makes the attacker attack the defender. Calls the attacking Units Attack method.
def CombatAttack(self): self.attacker.Attack(target=self.defender)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attack(self,target):\r\n damage = self.get_strength() * self.get_lvl()\r\n target.receive_damage(damage)", "def squad_attacks(self, attacker, defender):\n\n for unit in attacker.units:\n if(len(defender.units) != 0):\n if(unit.hit):\n enemy =...
[ "0.74969095", "0.71675205", "0.7126437", "0.7021401", "0.7010186", "0.6983794", "0.6840642", "0.676588", "0.66549474", "0.66131586", "0.65972745", "0.6572043", "0.6547982", "0.64753354", "0.64724374", "0.64450777", "0.64372104", "0.6383117", "0.6373401", "0.6365232", "0.63125...
0.7564646
0
Starts the fight, the combat cycle also occurs here. The fight continues until one of the end conditions from EndTurn() is met.
def StartCombat(self): print("------------------------------------") self.fighter1.PrintInfo() self.fighter2.PrintInfo() print("------------------------------------") self.combatInProgress = True while self.combatInProgress and self.currentTurn < self.maxTurns: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_game(self):\n while self.can_deal:\n self.take_turn()", "def run(self):\n while True:\n if self.is_game_over():\n break\n self.run_turn()", "async def fight(self, ctx):\r\n attacker = ctx.message.author.name\r\n defenders = c...
[ "0.6901953", "0.6589875", "0.6561355", "0.65505356", "0.6544337", "0.6433341", "0.6362572", "0.60511637", "0.60483456", "0.60335976", "0.60231423", "0.60127974", "0.5959739", "0.5952476", "0.59394664", "0.5922757", "0.5904346", "0.5894737", "0.5893751", "0.58871776", "0.57986...
0.79987514
0
Retrieve a blacklist by type
def list_blacklist_by_type(event, context): blacklist_type = str(event['pathParameters']['id']) table = dynamodb.Table(os.environ['BLACKLIST_TABLE']) result = table.scan( FilterExpression=Attr('type').eq(blacklist_type) ) error_type = None error_msg = "" response = { 'status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_blacklist(self):\n blacklist = {}\n for b in TransifexBlacklist.objects.filter(domain=self.app.domain, app_id=self.app.id).all():\n blacklist.setdefault(b.domain, {})\n blacklist[b.domain].setdefault(b.app_id, {})\n blacklist[b.domain][b.app_id].setdefault(b....
[ "0.65904284", "0.62621343", "0.61832756", "0.6096455", "0.6028515", "0.59900206", "0.5934769", "0.58364505", "0.5784382", "0.5762556", "0.57247627", "0.5624533", "0.5574837", "0.5561115", "0.5532088", "0.5526379", "0.5511776", "0.5467456", "0.545285", "0.5451864", "0.53814113...
0.7739401
0
Generates a standardized __repr__ implementation for the decorated class using the provided attributes and the class name.
def generate_repr(*attrs): def _repr(self): args = [] for attr in attrs: value = getattr(self, attr) args.append('{}={}'.format(attr, repr(value))) return '{}({})'.format(type(self).__name__, ', '.join(args)) def decorator(cls): setattr(cls, '__repr__',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_repr(attrs):\n def repr_(self):\n return \"<{0}({1})>\".format(\n self.__class__.__name__,\n \", \".join(a + \"=\" + repr(getattr(self, a)) for a in attrs)\n )\n\n def wrap(cl):\n cl.__repr__ = repr_\n return cl\n\n return wrap", "def __repr__(s...
[ "0.75279635", "0.7434022", "0.73817474", "0.734851", "0.7289963", "0.7056438", "0.70449835", "0.7012147", "0.7011501", "0.6999215", "0.6976403", "0.6934403", "0.68853855", "0.68566287", "0.6846473", "0.6751938", "0.6704135", "0.66496694", "0.66479456", "0.6638455", "0.6622205...
0.82027036
0
Test case for result_file_path_get
def test_result_file_path_get(self): headers = { 'Accept': 'application/zip', } response = self.client.open( '/v1/result/{file_path}'.format(file_path='file_path_example'), method='GET', headers=headers) self.assert200(response, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_result_filepath(): # ***Incomplete test\n ##########################\n # Arrange.\n query_filename = \"query_filename\"\n db_filename = \"db_filename\"\n dirpath = \"dirpath\"\n\n ##########################\n # Act.\n #x = search_result_filepath(query_filename,\n #\t\tdb...
[ "0.7307293", "0.70525354", "0.6954749", "0.69366705", "0.69337755", "0.68409187", "0.68076044", "0.64767283", "0.6400558", "0.6377951", "0.6355058", "0.6352662", "0.63244474", "0.6316151", "0.6279268", "0.6241323", "0.62316996", "0.62279445", "0.61965686", "0.6192357", "0.618...
0.76812017
0
Clicking on create new collection box
def select_create_collection(self): select_create_collection_sitem = self.locator_finder_by_id(self.select_create_collection_id) select_create_collection_sitem.click() time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_collection_btn(self):\n create_new_collection_btn_sitem = self.locator_finder_by_id(self.create_new_collection_btn_id)\n create_new_collection_btn_sitem.click()\n time.sleep(3)", "def create_new_collections(self, name, doc_type, is_cluster):\n print('selecting collectio...
[ "0.8201279", "0.68475103", "0.67038965", "0.6635956", "0.6504946", "0.64569426", "0.64425117", "0.6355775", "0.63269925", "0.6292967", "0.618473", "0.6030624", "0.59561235", "0.5943071", "0.59305096", "0.58467245", "0.581182", "0.58021486", "0.57901967", "0.5789227", "0.57818...
0.7849847
1
selecting number of shards for the collection
def select_number_of_shards(self, shard_value): shards = "new-collection-shards" shards_sitem = self.locator_finder_by_id(shards) shards_sitem.click() shards_sitem.clear() shards_sitem.send_keys(shard_value) time.sleep(2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shards_count(self) -> Optional[int]:\n return pulumi.get(self, \"shards_count\")", "def num_shards(self) -> int:\n return self.db_nodes", "def num_shards(self) -> int:\n return pulumi.get(self, \"num_shards\")", "def num_shards(self) -> Optional[int]:\n return pulumi.get(self,...
[ "0.71894944", "0.71069247", "0.6986659", "0.68420625", "0.67356455", "0.67356455", "0.66347474", "0.64961046", "0.6279026", "0.62539583", "0.62539583", "0.62473404", "0.6202461", "0.6188655", "0.61487025", "0.6133491", "0.6110816", "0.60548335", "0.60518616", "0.59645885", "0...
0.7287722
0
Select create new collection button
def create_new_collection_btn(self): create_new_collection_btn_sitem = self.locator_finder_by_id(self.create_new_collection_btn_id) create_new_collection_btn_sitem.click() time.sleep(3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_create_collection(self):\n select_create_collection_sitem = self.locator_finder_by_id(self.select_create_collection_id)\n select_create_collection_sitem.click()\n time.sleep(1)", "def addCollection():\n return render_template(\"addCollection.html\")", "def goto_create(self):\...
[ "0.77789605", "0.6749844", "0.6548977", "0.65079147", "0.6468074", "0.6390506", "0.6258899", "0.624495", "0.6242971", "0.6090356", "0.60410297", "0.6005766", "0.6001406", "0.5970816", "0.5934289", "0.5910283", "0.59008586", "0.5884747", "0.58427113", "0.5807141", "0.5754695",...
0.8116856
0
Displaying status unloaded collection
def select_status_unloaded(self): select_status_unloaded_sitem = self.locator_finder_by_xpath(self.select_status_unloaded_id) select_status_unloaded_sitem.click() time.sleep(2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):", "def display_all(self) -> None:\n self.display.draw_list(self.read_all_statuses())", "def refresh_status(self):\n\n pass", "def refresh_statuses(self):\n if self.skill_tree_displaying:\n return\n _, self.buff_rects, self.debuff_rects = player_panel_r...
[ "0.5891288", "0.5858282", "0.57516074", "0.5678427", "0.5616648", "0.5616648", "0.561524", "0.5595779", "0.55628484", "0.55051094", "0.54805464", "0.5469546", "0.5456605", "0.5438218", "0.5434008", "0.5422827", "0.54181147", "0.5416889", "0.5384084", "0.53639454", "0.53470737...
0.5887363
1
Sorting collection by type
def sort_by_type(self): # sort_by_type_sitem = self.locator_finder_by_idx(self.sort_by_type_id, 30) # sort_by_type_sitem = sort_by_type_sitem.find_element_by_xpath("./..") # while True: # try: # sort_by_type_sitem.click() # break # except E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortby(self):\n ...", "def _sort_by_type(self, x, y):\n\n x_key, x_value = x\n y_key, y_value = y\n\n # if both values are map or list, sort by their keys\n if ((isinstance(x_value, schema.Map) or\n isinstance(x_value, schema.List)) and\n (isinsta...
[ "0.6522596", "0.6505784", "0.6309146", "0.59581107", "0.59497154", "0.5936003", "0.59347135", "0.5932307", "0.5880536", "0.58756715", "0.5828105", "0.58228177", "0.5797284", "0.57818633", "0.5744325", "0.5717619", "0.5678926", "0.56669235", "0.5651889", "0.5639227", "0.563242...
0.66848755
0
Selecting Hand selection button
def select_hand_pointer(self): self.locator_finder_by_hover_item(self.select_hand_pointer_id) time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HandButton(self, event):\n pass", "def OnButtonClick(self):\n self.choice()", "def select_action(self, state):", "def select(self, mouse_x: int, mouse_y: int) -> None:\n # if the button is clicked, get the button response.\n for btn in self.__menu.get_buttons():\n if ...
[ "0.72994137", "0.6960458", "0.67044544", "0.6637564", "0.65500456", "0.63675857", "0.6346767", "0.62731683", "0.62323046", "0.6207225", "0.61534756", "0.61500597", "0.61244184", "0.6106129", "0.60824054", "0.60824054", "0.60781616", "0.60620815", "0.60306877", "0.6026055", "0...
0.69659746
1
Selecting index menu from collection
def select_index_menu(self): self.click_submenu_entry("Indexes")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self,item):\r\n pass", "def choose_menu(self, n):\n self.view.menu_chosen(n, uw.Button(MENUS[n]))", "def selectItem(*args):", "def invoke(self, index):\n return T.Menu.invoke(self,self.get_tkinter_index(index))", "def select(self):\r\n pass", "def misc_select(self, ...
[ "0.6331167", "0.6313667", "0.61918956", "0.61655647", "0.60532516", "0.6050607", "0.60395396", "0.60395396", "0.59796774", "0.59796774", "0.59579307", "0.58689034", "0.58144414", "0.5806223", "0.5768524", "0.57398134", "0.57222116", "0.5702014", "0.5702014", "0.5698822", "0.5...
0.80061555
0
Selecting info tab from the collection submenu
def select_info_tab(self): self.click_submenu_entry("Info") time.sleep(2) self.wait_for_ajax()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tabSelected(self):", "def tabSelected(self):", "def OnSelect(self,event):\r\n index = event.GetSelection()\r\n item = self.items[index]\r\n self.data.select(item)\r\n if self.gInfoBox:\r\n self.gInfoBox.DiscardEdits()\r\n self.gInfoBox.SetValue(self.data.ge...
[ "0.6502883", "0.6502883", "0.63704497", "0.6222535", "0.6208121", "0.60554117", "0.60081744", "0.5907997", "0.58503175", "0.57812005", "0.5779127", "0.5758804", "0.5702744", "0.5702533", "0.563473", "0.5617591", "0.5606806", "0.5595339", "0.55792826", "0.5572613", "0.5559217"...
0.78100437
0
Selecting Schema tab from the collection submenu
def select_schema_tab(self): if self.current_package_version() >= semver.VersionInfo.parse("3.8.0"): if self.current_package_version() >= semver.VersionInfo.parse("3.9.100"): schema = '//*[@id="subNavigationBar"]/ul[2]/li[6]/a' select_schema_tab_sitem = self.locator_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_index_menu(self):\n self.click_submenu_entry(\"Indexes\")", "def Root_Profile(self):\r\n self.combobox_profile.selectitem( 0 )", "def tabSelected(self):", "def tabSelected(self):", "def _build_main_menu(self):\n if self._args.execution_environment:\n columns = [\"...
[ "0.57872015", "0.57661813", "0.5644065", "0.5644065", "0.5623658", "0.5515484", "0.5358062", "0.532752", "0.52927786", "0.5239944", "0.5235729", "0.5210115", "0.5164248", "0.5161918", "0.5159015", "0.51539546", "0.51514035", "0.51360935", "0.50902945", "0.5063692", "0.5057593...
0.7167426
0
this method will select ComputedValueCol
def select_computedValueCol(self): col = "//*[text()='ComputedValueCol']" self.locator_finder_by_xpath(col).click() time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_value(self, value_column):\n pass", "def __get__(self, instance, owner):\r\n try:\r\n return instance._values[self.column.column_name].getval()\r\n except AttributeError as e:\r\n return self.query_evaluator", "def get_real_col(self, index):\n\n return...
[ "0.6398883", "0.59787905", "0.57945806", "0.5785816", "0.5730667", "0.5713592", "0.5594945", "0.5589257", "0.5582514", "0.55263186", "0.5486027", "0.5398794", "0.53984684", "0.53960323", "0.5382566", "0.5368404", "0.536287", "0.53083116", "0.5296757", "0.5293655", "0.52480394...
0.7897636
0
this method will take to collection content tab
def navigate_to_col_content_tab(self): content = "//div[@id='subNavigationBar']/ul[2]//a[.='Content']" content_sitem = self.locator_finder_by_xpath(content) content_sitem.click() time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tabSelected(self):", "def tabSelected(self):", "def action(self,item):\r\n pass", "def collection_selected(self):\n self.processgraph.set_collection(str(self.collectionBox.currentText()))\n self.reload_processgraph_view()", "def init_tab(self):", "async def connect_to_tab(self) -...
[ "0.61206627", "0.61206627", "0.5591553", "0.55463517", "0.5541172", "0.5531857", "0.55144304", "0.54553694", "0.5443288", "0.54292786", "0.53906536", "0.5380386", "0.5376564", "0.53741264", "0.5362106", "0.5330219", "0.5320045", "0.529473", "0.5288396", "0.5249436", "0.524767...
0.6149049
0
selecting Edge collection for data uploading
def select_edge_collection_upload(self): self.select_collection("TestEdge")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection(self):\r\n raise NotImplementedError", "def select_create_collection(self):\n select_create_collection_sitem = self.locator_finder_by_id(self.select_create_collection_id)\n select_create_collection_sitem.click()\n time.sleep(1)", "def collection_selected(self):\n ...
[ "0.5752783", "0.5689443", "0.5643403", "0.5624722", "0.5614894", "0.55462676", "0.5483144", "0.54772705", "0.5470694", "0.54232883", "0.53897476", "0.5381354", "0.5344163", "0.5338225", "0.528611", "0.52707195", "0.5260049", "0.5257488", "0.5256666", "0.52337027", "0.52241826...
0.8732357
0
Delete users without active logins during date_limit and who are no admins
def remove_obsolete_users(self, date_limit): for user in User.objects.filter(last_login__lt=date_limit): if not ServiceProvider.objects.filter(admins=user): self.output("Removing user: " + user.username) if not self.list_only: user.delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_expired_users(self):\r\n for profile in self.all():\r\n if profile.activation_key_expired():\r\n user = profile.user\r\n if not user.is_active:\r\n user.delete()", "def delete_expired_users(self):\n for profile in self.all():\n ...
[ "0.66599715", "0.66148704", "0.6606649", "0.6438065", "0.6430087", "0.6354417", "0.6314219", "0.62766325", "0.62580293", "0.62499964", "0.61996806", "0.61491936", "0.60980284", "0.60713595", "0.6063046", "0.6058939", "0.6043361", "0.5952243", "0.594812", "0.59322053", "0.5886...
0.7763422
0
a method that converts a queried item into an object
def to_object(cls, query_dict: Dict): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object(self):\n if not self._item:\n self._item = get_object_or_404(Item, pk=self.kwargs['item_id'])\n return self._item", "def __getattr__(self, item):\n return getattr(self.original_query, item)", "def fetch_db_object(cls: ClassVar, body: Any):\n\n if body is None:\...
[ "0.6037884", "0.59593964", "0.59398377", "0.5827964", "0.5827964", "0.5794033", "0.57739586", "0.57723254", "0.5747426", "0.5732511", "0.5689211", "0.5682318", "0.5676652", "0.5620891", "0.5612151", "0.55681676", "0.5554434", "0.5544719", "0.55427927", "0.5539909", "0.5538802...
0.63010305
0
Queries all items with a given field name
def query_by_field(cls, field: str, value: str)->List: database.cursor.execute( "SELECT * FROM {0} WHERE {1} = %s".format(cls.table_name, field), (value,)) items = database.cursor.fetchall() return [cls.to_object(item) for item in items]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchField(name, table, field):\n connection, cursor = DBconnect(name)\n lista =[]\n cursor.execute('SELECT ({coi}) FROM {tn}'.\\\n format(coi=field, tn=table))\n result = cursor.fetchone()\n while result: \n lista.append(result[0])\n result = cursor.fetchone()\n DBdisco...
[ "0.6764546", "0.6468641", "0.6349627", "0.62236315", "0.62180805", "0.6138816", "0.6092172", "0.60396606", "0.5998464", "0.5877591", "0.58476895", "0.5804074", "0.5778627", "0.5764116", "0.5757204", "0.57452214", "0.57376456", "0.5735396", "0.5717391", "0.5700946", "0.569869"...
0.68838584
0
Saves a question object into the database
def save(self)->None: database.cursor.execute("INSERT INTO questions(created_date,created_by,meetup,title,body,votes,upvotes,downvotes) VALUES(%s,%s,%s,%s,%s,%s,%s,%s) RETURNING id", ( self.created_on, self.created_by, self.meet_up, self.title, self.bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n\n if not self.title or not self.body:\n api.abort(400, \"Incorrect Data Format. Try again\")\n\n \"\"\" check if question exists \"\"\"\n\n question_exists = self.filter_by_title()\n\n if question_exists:\n api.abort(409, \"Question with that titl...
[ "0.6963589", "0.6706251", "0.6639273", "0.6637549", "0.66372633", "0.6621168", "0.6586674", "0.6581567", "0.6543977", "0.65285057", "0.6484668", "0.6484668", "0.6484668", "0.6484668", "0.6484668", "0.6484668", "0.6484668", "0.6484668", "0.6475654", "0.6475654", "0.6475654", ...
0.7287063
0
Creates the rsvp table during migrations
def migrate(cls)->None: database.cursor.execute("""CREATE TABLE IF NOT EXISTS rsvps ( creatd_date varchar, meetup integer, user_id integer, response varchar, PRIMARY KEY(meetup,user_id) )""") database.connection.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def db_setup(self):\n revision: Table = Table(self.revision_table,\n self.sql_metadata,\n Column(self._MigrationTableColumns.revisions.value, Text, primary_key=True),\n sch...
[ "0.6748451", "0.65405947", "0.6401107", "0.6291565", "0.6291565", "0.6236949", "0.6234556", "0.62183714", "0.6186747", "0.6151317", "0.6010008", "0.5995399", "0.59316874", "0.5899041", "0.5869159", "0.58643955", "0.5844462", "0.58382285", "0.58260334", "0.5801839", "0.5767228...
0.7242542
0
Converts the query into Rsvp object
def to_object(cls, query_dict: Dict): rsvp = Rsvp() rsvp.meetup = query_dict.get("meetup") rsvp.user = query_dict.get("user_id") rsvp.response = query_dict.get("response") return rsvp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, query):", "def visit_query(self, query):\n return query", "def to_object(cls, query_dict: Dict):\n pass", "def convert_query(self, query):\n rescaled = pd.read_json('[' + query + ']') / self.SCALE_FACTOR\n model_input = rescaled.values.reshape(1, -1)\n retur...
[ "0.5918314", "0.59124494", "0.5810197", "0.5745735", "0.5739712", "0.56960344", "0.5694148", "0.56722224", "0.56608", "0.5546151", "0.55272985", "0.54980296", "0.54664934", "0.5446992", "0.5441562", "0.54369926", "0.54369926", "0.54334027", "0.54121107", "0.5368752", "0.53586...
0.7104509
0
Creates meetups table during migrations
def migrate(cls): database.cursor.execute("""CREATE TABLE IF NOT EXISTS meetups( id serial PRIMARY KEY, topic varchar, happening_date varchar, tags varchar, location varchar, images varchar, body varchar )""") da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate(cls)->None:\n database.cursor.execute(\"\"\"CREATE TABLE IF NOT EXISTS rsvps (\n creatd_date varchar,\n meetup integer,\n user_id integer,\n response varchar,\n PRIMARY KEY(meetup,user_id)\n )\"\"\")\n database.connection.commi...
[ "0.70260376", "0.6249825", "0.6122265", "0.6122265", "0.60098815", "0.60076773", "0.5999287", "0.5995182", "0.59177905", "0.5882311", "0.5849617", "0.5825808", "0.5818836", "0.5792055", "0.5780796", "0.57418895", "0.57374847", "0.57237387", "0.57169706", "0.57145536", "0.5676...
0.8189868
0
used to convert queries into meetup objects
def to_object(cls, query_dict: Dict): meetup = Meetup() meetup.topic = query_dict.get("topic") meetup.happening_on = query_dict.get("happening_date") meetup.location = query_dict.get("location") meetup.images = query_dict.get("images") meetup.id = query_dict.get("id") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, query):", "def to_object(cls, query_dict: Dict):\n rsvp = Rsvp()\n rsvp.meetup = query_dict.get(\"meetup\")\n rsvp.user = query_dict.get(\"user_id\")\n rsvp.response = query_dict.get(\"response\")\n return rsvp", "def make_query(self):", "def query(self):", ...
[ "0.62267005", "0.6154672", "0.6056601", "0.5911618", "0.5839806", "0.5722632", "0.56891584", "0.56524706", "0.56524706", "0.56524706", "0.56524706", "0.56500995", "0.5638098", "0.56360155", "0.5604236", "0.5585999", "0.5545642", "0.55318904", "0.5481741", "0.5479466", "0.5463...
0.6858023
0
Saves the meetup object into the database
def save(self)->None: database.cursor.execute("INSERT INTO meetups(topic,happening_date,tags,location,images,body) VALUES(%s,%s,%s,%s,%s,%s) RETURNING id", ( self.topic, self.happening_on, self.tags, self.location, self.images, self.body ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self)->None:\n database.cursor.execute(\"INSERT INTO rsvps(meetup,user_id,response) VALUES(%s,%s,%s) RETURNING (meetup,user_id)\", (\n self.meetup,\n self.user,\n self.response\n ))\n database.connection.commit()", "def post_meetup(self):\n re...
[ "0.70291704", "0.68331474", "0.6499362", "0.6434788", "0.6346913", "0.63410205", "0.6323697", "0.6217198", "0.61910135", "0.6141971", "0.6141971", "0.6141971", "0.6141971", "0.60580075", "0.60580075", "0.60580075", "0.60580075", "0.60580075", "0.60580075", "0.60580075", "0.60...
0.7207207
0
Creates table for holding blacklisted tokens
def migrate(cls)->None: database.cursor.execute("""CREATE TABLE IF NOT EXISTS blacklist( id serial PRIMARY KEY, token varchar )""") database.connection.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(token):\n\n try:\n black = BlackList()\n black.jti = token[\"jti\"]\n db.session.add(black)\n db.session.commit()\n\n except Exception:\n db.session.rollback()\n raise", "def _blacklist_new_tblname(self):\n return '...
[ "0.66535884", "0.6160046", "0.6031394", "0.5924062", "0.577799", "0.5754951", "0.57339317", "0.5578157", "0.5518635", "0.5518412", "0.54830736", "0.54477423", "0.54330516", "0.5406037", "0.53414714", "0.53411424", "0.53378135", "0.53302634", "0.5302102", "0.5275991", "0.52744...
0.69235814
0
Saves a blacklist token into blacklst database
def save(self)->None: database.cursor.execute( "INSERT INTO blacklist (token) VALUES(%s) RETURNING id", (self.token,)) super().save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blacklist_token(token):\n curr_token = BlacklistToken(token=token)\n try:\n db.session.add(curr_token)\n db.session.commit()\n except:\n return False\n return True", "def create(token):\n\n try:\n black = BlackList()\n black.jti = token[\"jti\"]\n...
[ "0.774238", "0.7457819", "0.6903901", "0.6768797", "0.6689375", "0.6671483", "0.6652736", "0.6633953", "0.63507223", "0.6039324", "0.5986671", "0.59059024", "0.5876711", "0.582253", "0.5743959", "0.5681947", "0.5629917", "0.55944276", "0.552058", "0.550083", "0.5494133", "0...
0.77735966
0