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
add the content to a specific waiting area
def addContent(self,wait,start,content): if self.checkAddContent(wait,start,content): for i in range(content.length): self.w[wait][start+i] = (start+i,content) else: print content,"can not override existing content"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleContentComplete():", "def addMainWindow(self,appendToTask):\n self.appendToTask = appendToTask", "def set_content(self, widget):\n\t\tpass", "def _add_content_to_hex_view(self) -> None:\r\n \r\n try:\r\n queue_item = self.hex_thread_queue.get(block = False)\r\n\r\n ...
[ "0.5674969", "0.53723633", "0.5367427", "0.525665", "0.5225978", "0.5200504", "0.51720566", "0.50997674", "0.5084396", "0.5079925", "0.5061745", "0.5059036", "0.50525177", "0.50514406", "0.504467", "0.50442374", "0.5042535", "0.50417733", "0.50417733", "0.50417733", "0.504177...
0.635612
0
Delete the content from a specfic waiting area
def delContent(self,wait,start,content): for i in range(content.length): self.w[wait][start+i] = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_delete():\r\n del win.box[-1] # delete last line\r\n #del win.box[0:-1] # delete all lines \r", "def delete():", "def delete_this_region(self):", "def del_mail(self,box):\n self.logger.debug('delete the mail of %s',box)\n if not self.device(text=box).exists:\n self.devic...
[ "0.60315347", "0.58551013", "0.58246267", "0.5749008", "0.5742068", "0.56990933", "0.5674887", "0.5603075", "0.5589578", "0.5526692", "0.5517584", "0.5516292", "0.5492436", "0.5492046", "0.5476662", "0.5476108", "0.5449119", "0.54362226", "0.5420728", "0.5418204", "0.5415539"...
0.7333313
0
Print the content in each waiting areas
def printWaiting(self): for wait in self.w: w_print="" for c in wait: if c: w_print += str(c[1]) else: w_print += 'NO' w_print += " " print w_print
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_contents(self):\n try:\n # We only wait for 0.001 seconds.\n self.print_all_contents(indef_wait=False)\n except NotYourTurnError:\n # It's not our turn, so try again the next time this function is called.\n pass", "def print_all_contents(self, *...
[ "0.68055356", "0.63277084", "0.6271929", "0.6271929", "0.6091832", "0.60454845", "0.5984652", "0.5973602", "0.59443873", "0.59372497", "0.59012204", "0.58839536", "0.58236563", "0.57862055", "0.57712454", "0.57689494", "0.5733052", "0.56877106", "0.5687649", "0.5642108", "0.5...
0.7349046
0
Only when id, length, value all the same, These two content objects are equal
def __eq__(self,other): if other != None: return self.id==other.id and \ self.length == other.length and \ self.value==other.value else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_identical(self):\n write this test!", "def test_id(self):\n self.assertNotEqual(self.bm1.id, self.bm2.id)\n self.assertEqual(type(self.bm1.id), str)", "def __eq__(self, other):\n contentsmatchfail = False\n equal = False\n for i in self.contents:\n ...
[ "0.64666635", "0.6464577", "0.642242", "0.63855004", "0.63848305", "0.6381619", "0.6336744", "0.62777966", "0.6222118", "0.62202317", "0.62084025", "0.6182196", "0.6180592", "0.61721146", "0.61274123", "0.61194813", "0.60897243", "0.6081066", "0.6071086", "0.6068542", "0.6062...
0.6664983
0
Combinatorial search algorithm, Given area1, and area2 ...and a given time, return a selection, which maximize total weights, O(n^k), k is the number of areas, n is the the number of waiting contents in each areas in one time Backtrack to generate all solution and compare with current best solution, if it is better, re...
def select_bruteforce(self,time,a1,a2,*args): areas = [] areas.append(a1) areas.append(a2) areas.extend(args) candidates = [[wait[time][1] if wait[time]!=None else None \ for wait in area.w] for area in areas] weights = [area.weight for area in areas] input = (candidates,weights) best = [None]*le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_greedy(self,time,a1,a2,*args):\n\t\tareas = []\n\t\tareas.append(a1)\n\t\tareas.append(a2)\n\t\tareas.extend(args)\n\t\tareas_sorted = sorted(areas,reverse=True)\n\t\tresult = []\n\t\tcandidates = [[wait[time][1] if wait[time]!=None else None \\\n\t\t\t\t\t for wait in area.w] for area in areas]\n\t\tu...
[ "0.71428865", "0.58655334", "0.57385504", "0.5726437", "0.5719283", "0.5708327", "0.5681849", "0.5659449", "0.56578714", "0.56546485", "0.5613668", "0.5609115", "0.55987585", "0.5598416", "0.5590872", "0.5587801", "0.55872273", "0.55849886", "0.55798554", "0.5577924", "0.5570...
0.728321
0
Given a solution and weights, calculate the total cost, the higher, the better
def calculateCost(self,sol,weights): return sum([x.value*y if x != None else 0 \ for x,y in zip(sol,weights)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cost_and_weight_of_knapsack(solution,weight_cost):\r\n cost,weight = 0,0 \r\n for item in solution:\r\n weight += weight_cost[item][0]\r\n cost += weight_cost[item][1]\r\n return cost,weight", "def cost_total(X, cost_weights=(1.0, 1.0, 1.0)):\n return cost_weights[0] * cost_dist...
[ "0.78241587", "0.7021364", "0.7016164", "0.68439823", "0.6772242", "0.66974974", "0.6579343", "0.65689176", "0.6504397", "0.6427664", "0.6424668", "0.641193", "0.64020264", "0.63749844", "0.6369628", "0.6342488", "0.6327875", "0.63274056", "0.63259715", "0.6325849", "0.632312...
0.7787033
1
greedy algorithm, take the most weight area first, and give it most valuable content, then second area, and so on , O(klogk + knlogn), not optimal, but efficient sort area by their weight in descreasing order, and choose the most valuable content in the area, and then second area ,keep checking whether the content have...
def select_greedy(self,time,a1,a2,*args): areas = [] areas.append(a1) areas.append(a2) areas.extend(args) areas_sorted = sorted(areas,reverse=True) result = [] candidates = [[wait[time][1] if wait[time]!=None else None \ for wait in area.w] for area in areas] used_content = set() for area,cands...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TightStrategy(I_list,box_list):\n iso = 0\n lemon = []\n SortedItems = quick_sort(I_list)\n for element in range(0, len(SortedItems)):\n w = SortedItems[element].weight\n x = FindTightFit(box_list, w)\n if x == None:\n iso+=1\n pass\n else:\n ...
[ "0.6643813", "0.6288931", "0.625988", "0.61211926", "0.6088565", "0.5934902", "0.58888906", "0.572068", "0.57132936", "0.5708484", "0.56786495", "0.56729484", "0.56564474", "0.5643351", "0.5632886", "0.5576396", "0.55385184", "0.55242544", "0.5523174", "0.5466446", "0.5464137...
0.6629955
1
Randomly generate a schedule based on given contents
def randomSchedule(self,contents): import random as ran import copy contents_copy = copy.deepcopy(contents) sol = Area('sb',ran.random()) while contents_copy: cont = ran.choice(contents_copy) i = 0 while True: ran_waiting = ran.randint(0,2) ran_start = ran.randint(0,19) if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomize_schedule(self):\n #Creates a new Schedule Object\n new_schedule = Schedule(len(self.chromo_list),self.config)\n\n #For all of the entries in the hash map\n for classes,index in self.hash_map.items():\n #Get New Random Position\n rand = random.randint(...
[ "0.7032516", "0.7032402", "0.6492854", "0.6483966", "0.6446885", "0.6158377", "0.60977435", "0.60693073", "0.6060243", "0.58782053", "0.58338886", "0.57139707", "0.5703477", "0.5686992", "0.5677032", "0.56692207", "0.56571686", "0.5630544", "0.5605559", "0.55920166", "0.55627...
0.79615617
0
Check whether the given schedule is a valid schedule
def validSchedule(self,schedule): def validRow(content,start,row): """ part of valid Schedule, only check whether a given row is valid @param start: the start position @param row: given waiting area...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_exist(self, schedule_name):\r\n schedule = self.find(\"schedules\", schedule_name, attribute=\"name\")\r\n if schedule is not None:\r\n return True\r\n else:\r\n return False", "def setSchedule(self, schedule):\r\n if isinstance(schedule, list) == Fa...
[ "0.6923885", "0.67132664", "0.6674424", "0.6440875", "0.638306", "0.6347903", "0.63186556", "0.62030065", "0.6196701", "0.6159916", "0.6103682", "0.60652125", "0.60501474", "0.6044724", "0.60263616", "0.5999478", "0.5983755", "0.5954077", "0.5950224", "0.5926107", "0.5923733"...
0.7410286
0
Simply combine validRow and validCol
def validRowCol(content,start,row,schedule): if validRow(content,start,row) and \ validCol(content,start,schedule): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, row):\n raise NotImplementedError", "def isValid(self):\n for ir in range(self.nRow): # Check rows for duplicates\n row = ir + 1\n vals = {}\n for ic in range(self.nCol):\n col = ic + 1\n val = self.getCellVal(row...
[ "0.684255", "0.68137574", "0.6745641", "0.6707384", "0.66674656", "0.66391826", "0.65778613", "0.65593165", "0.650532", "0.64353895", "0.6420084", "0.63877106", "0.6331596", "0.63072574", "0.63056093", "0.6256621", "0.6225988", "0.62184995", "0.61916417", "0.6106615", "0.6101...
0.70008266
0
transition method use validSchedule to find the problematic content, and switch it with another potential valid content
def transition(self,schedule): c_p = self.validSchedule(schedule)[1] row = c_p[1] start = c_p[0][0] c = c_p[0][1] space = c.length start_new = start for i in range(19): try: if schedule.w[row][start-i-1] == None: space += 1 start_new -= 1 else: break except IndexError: bre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validSchedule(self,schedule):\n\t\tdef validRow(content,start,row):\n \"\"\"\n part of valid Schedule, only check whether a given\n row is valid\n @param start: the start position\n @param row: gi...
[ "0.64331365", "0.53829914", "0.53537375", "0.5132803", "0.5085885", "0.4992951", "0.49866506", "0.4924441", "0.4908995", "0.489999", "0.48967925", "0.4888517", "0.48863095", "0.4878813", "0.4878402", "0.48645383", "0.48517662", "0.48221093", "0.48145336", "0.4810384", "0.4799...
0.71358395
0
Driver for scheduling problem
def mainSchedule(): import time c1 = Content(1,5,20) c2 = Content(2,6,30) c3 = Content(3,5,25) c1_ = Content(1,1,20) c5 = Content(5,3,29) c6 = Content(6,11,50) c7 = Content(7,7,34) c1__ = Content(1,3,20) c8 = Content(8,6,10) a1 = Area('a1',1.0) a2 = Area('a2',0.5) a3 = Area('a3',0.8) contents = [c1,c2,c3,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_schedules(self):\n\n ''''''", "def checkUpstreamScheduler():", "def transmission_scheduler(self, ap_index:int):\n # sched_load = False\n # next_transmission_time = 0\n # current_sq = self.rec_reg.read()[ap_index]\n \n # for i in range(len(self.sch.queue)):\n ...
[ "0.6768109", "0.64659697", "0.64603806", "0.6372004", "0.63610935", "0.6340818", "0.63037664", "0.6301751", "0.62980455", "0.6271578", "0.62470627", "0.6239573", "0.6231668", "0.6222913", "0.6192812", "0.6166951", "0.6150469", "0.6150188", "0.61315256", "0.61208034", "0.60991...
0.6536917
1
Returns the Minio client
def minio_client(self): return Minio( os.environ.get("MINIO_SERVER"), access_key=os.environ.get("MINIO_ACCESS_KEY"), secret_key=os.environ.get("MINIO_SECRET_KEY"), secure=False )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minio_client():\n minio_client = Minio(\n Config.MINIO_ENDPOINT,\n access_key=Config.MINIO_ACCESS_KEY,\n secret_key=Config.MINIO_SECRET_KEY,\n secure=Config.MINIO_SECURE,\n )\n return minio_client", "def get_minio_client(\n host=\"minio\", \n port=\"9000\", \n ...
[ "0.8690317", "0.8170216", "0.7581131", "0.7048299", "0.6804743", "0.6720981", "0.6715593", "0.66408753", "0.65887773", "0.6549165", "0.65434384", "0.65317345", "0.64015293", "0.638567", "0.6359832", "0.63489944", "0.6335766", "0.6322186", "0.62669396", "0.62140334", "0.620351...
0.86054754
1
Returns the S3 resource
def s3_resource(self): return boto3.resource('s3', aws_access_key_id=os.environ.get("MINIO_ACCESS_KEY"), aws_secret_access_key=os.environ.get("MINIO_SECRET_KEY"), endpoint_url=f'http://{os.environ.get("MINIO_SERVER")}', config=Config(signature_version='s3v4') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3resource(self):\n return self._s3resource", "def get_s3_client():\n return boto3.resource('s3')", "def _get_s3_object(self, s3_path):\n bucket_name, key = S3Util.get_bucket_and_key(s3_path)\n return self.s3_resource.Object(bucket_name, key)", "def _get_resource(\n session: Op...
[ "0.8834526", "0.8136219", "0.80481434", "0.77161956", "0.75156814", "0.7499978", "0.7383272", "0.73342884", "0.7209911", "0.71779615", "0.71755385", "0.7132572", "0.71012807", "0.7084859", "0.7083436", "0.70288396", "0.70011854", "0.6988842", "0.6984709", "0.69316506", "0.690...
0.81758285
1
Moves a specified amount of messages to the specified channel.
async def move(self, ctx, limit: int, channel: TextChannel): # Clear the bot command message await ctx.message.delete() messages = [] async for message in ctx.message.channel.history(limit=limit): embed = Embed(description=message.content) embed.set_author(name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def move_messages(\n client,\n event,\n channel: ('channel_group_messageable', 'Where to move the message.'),\n):\n check_move_permissions(client, event, channel, False)\n \n if channel.is_in_group_thread():\n channel_id = channel.parent_id\n thread_id = channel.id\n else:\...
[ "0.7316035", "0.6188762", "0.61035264", "0.60280615", "0.5928516", "0.5692596", "0.56376415", "0.5602749", "0.5475421", "0.53118956", "0.5237113", "0.5188172", "0.51433134", "0.51310295", "0.5110141", "0.5107266", "0.5092806", "0.5050932", "0.5045758", "0.5038465", "0.5031702...
0.7020896
1
Check client version string, and save their reward address
def _cmd_version(self): version = self._recv().split('.') rewards = self._recv() if version[0] != MINER_VERSION_ROOT: self._send('notok') return self.close() is_hex = all(c in string.hexdigits for c in rewards) if len(rewards) == 56 and is_hex: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkVersion(self, clientName, edamVersionMajor, edamVersionMinor):\r\n pass", "async def get_version(self) -> str or bool:\n # pause logic\n if not self.running.is_set():\n self.add_to_output(\"Paused...\")\n await self.running.wait()\n\n # tell the user we are gett...
[ "0.6100829", "0.5877899", "0.57476854", "0.5690405", "0.56460065", "0.5602962", "0.55144006", "0.55133027", "0.5433361", "0.54241884", "0.5423058", "0.5406405", "0.5389954", "0.53869414", "0.5382821", "0.53797954", "0.5372991", "0.53600615", "0.533975", "0.5339371", "0.532725...
0.6978058
0
Highest block consensus information for all peers
def consensus(self): total_peers = 0 blocks = list() for peer in self.peers.values(): assert len(peer.blocks) > 0 if not peer.synched: continue total_peers += 1 blocks.extend(peer.blocks) # blocks = [peer.blocks[-1] for peer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consensus():\n global blockchain\n\n longest_chain = None\n current_len = len(blockchain.chain)\n\n for node in peers:\n response = requests.get('{}chain'.format(node))\n length = response.json()['length']\n chain = response.json()['chain']\n if length > current_len and ...
[ "0.6532132", "0.6532132", "0.649755", "0.63097155", "0.62579066", "0.60755134", "0.6013463", "0.5995913", "0.5967726", "0.5833175", "0.5774598", "0.5754582", "0.5719536", "0.5695856", "0.5680934", "0.5660314", "0.5659518", "0.55405015", "0.553655", "0.5525904", "0.55225396", ...
0.7636462
0
Check warnings for a business.
def check_warnings(business: Business) -> list: result = [] # Currently only checks for missing business info warnings but in future other warning checks can be included # e.g. compliance checks - result.extend(check_compliance(business)) result.extend(check_business(business)) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning_check(self, rule_to_check, valid):\r\n for warning in self.warning_functions:\r\n warning(rule_to_check, valid)", "def log_check_warnings(self):\n pass", "def log_check_warnings(self):\n pass", "def log_check_warnings(self):\n pass", "def log_check_warning...
[ "0.6800652", "0.6201962", "0.6201962", "0.6201962", "0.6201962", "0.6201962", "0.6201962", "0.6201962", "0.6201962", "0.61174935", "0.58892727", "0.5828802", "0.5805223", "0.57828254", "0.5765763", "0.57578164", "0.5753095", "0.5727858", "0.57266426", "0.56829894", "0.5682989...
0.7674091
0
inintialize the two objects reload if database can be reloaded else init a database return two bills objects
def init(): database = "database.pkl" onsite_bills = BillID(database) online_bills = BillID(database) return onsite_bills, online_bills
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.postgres = PostgreSQL()\r\n self.couch_query = Queries()\r\n super(Blockages, self).__init__()", "def load_database(self, main_class):\n main_class.database.delete_all(\"render\")\n main_class.database.delete_all(\"object\")\n #ma...
[ "0.5736022", "0.56434137", "0.564165", "0.55726427", "0.5544261", "0.5475631", "0.5469645", "0.54065984", "0.53900474", "0.538401", "0.53686905", "0.5361027", "0.5327386", "0.5313991", "0.5283589", "0.5282382", "0.52822435", "0.52694327", "0.52486396", "0.5237471", "0.5233377...
0.6783798
0
move_class method uses MoveClassRefactorListener to move the class to the target package
def move_class(token_stream, parse_tree, args): move_class_listener = MoveClassRefactoringListener( common_token_stream=token_stream, source_package=source_package, target_package=target_package, class_identifier=class_identifier, filename=args.file, dirname=directory ) walker = ParseTreeWal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_move_class_propagation(token_stream, parse_tree, args):\n has_import = False\n has_exact_import = False\n\n file_to_check = open(file=args.file, mode='r')\n for line in file_to_check.readlines():\n text_line = line.replace('\\n', '').replace('\\r', '').strip()\n if (text_line.sta...
[ "0.620782", "0.59406626", "0.57894206", "0.5473868", "0.53981787", "0.5352078", "0.52304465", "0.52080524", "0.51873934", "0.51725787", "0.51608354", "0.5137262", "0.5135531", "0.5134518", "0.5097473", "0.508304", "0.5065531", "0.5065531", "0.5053348", "0.5053348", "0.5044372...
0.74356085
0
post_move_class_propagation method is used to propagate postconditions after moving the class
def post_move_class_propagation(token_stream, parse_tree, args): has_import = False has_exact_import = False file_to_check = open(file=args.file, mode='r') for line in file_to_check.readlines(): text_line = line.replace('\n', '').replace('\r', '').strip() if (text_line.startswith('impor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_class(token_stream, parse_tree, args):\n move_class_listener = MoveClassRefactoringListener(\n common_token_stream=token_stream, source_package=source_package, target_package=target_package,\n class_identifier=class_identifier, filename=args.file, dirname=directory\n )\n walker = Pa...
[ "0.5597115", "0.55090684", "0.5470342", "0.5460749", "0.5460749", "0.5460749", "0.5460749", "0.5402134", "0.5387696", "0.5336143", "0.5325261", "0.5315068", "0.53143436", "0.5280691", "0.5276908", "0.52355665", "0.5204402", "0.51873684", "0.51575035", "0.5106735", "0.5092696"...
0.6519298
0
returns parse tree and token stream base on the file stream
def get_parse_tree_token_stream(args): # Step 1: Load input source into stream stream = FileStream(args.file, encoding='utf8') # Step 2: Create an instance of AssignmentStLexer lexer = JavaLexer(stream) # Step 3: Convert the input source into a list of tokens token_stream = CommonTokenStream(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self, path):\r\n return self._parse(antlr3.ANTLRFileStream(path))", "def parse(self):\n print_DBG(\"Parsing master file: \"+self.tokenizer.get_file_information()[0])\n for token_line in self.tokenizer.next_tokenized_line():\n if not token_line[0].isspace():\n ...
[ "0.6474443", "0.62446785", "0.61728376", "0.6170358", "0.6150989", "0.60873765", "0.60797954", "0.60496897", "0.60075635", "0.59771377", "0.59643596", "0.59559005", "0.5909493", "0.58725095", "0.5828897", "0.58060056", "0.578644", "0.5780078", "0.57655746", "0.5764479", "0.57...
0.7330537
0
This function creates 1d polynomial toy data for linear regression y= w[0]+w[1]x+..w[d]x^d Input
def toyData(w,sigma,N): #Degree of polynomial degree=w.size; #generate x values x=np.linspace(0, 1,N); poly=preprocessing.PolynomialFeatures(degree-1,include_bias=True) PHI=poly.fit_transform(x.reshape(N,1)) y=np.dot(PHI,w); target=y+np.random.normal(0, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_polynomial_regression(self, x_train, y_train):\n x_poly = self.poly_reg.fit_transform(x_train)\n self.lin_reg.fit(x_poly, y_train)", "def generate_polynomial_features(self, X) :\n\n n,d = X.shape\n\n ### ========== TODO : START ========== ###\n # part b: modify to creat...
[ "0.6825394", "0.6576377", "0.65696436", "0.6495577", "0.64582753", "0.6423641", "0.6405825", "0.6357386", "0.6354499", "0.6313618", "0.6298149", "0.62897635", "0.6238766", "0.623336", "0.61870444", "0.6183656", "0.6180649", "0.61638725", "0.61339", "0.6129765", "0.61093587", ...
0.6982522
0
Encodes a string with the given encoder name.
def encode(data: str, encoder_name: str) -> str: func = globals()["_encode_" + encoder_name] data = func(data) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registerEncoder (encoder):\n assert False, \"TODO:\"", "def register(self, coder_name, raw_coder):\n coder = coderize(raw_coder)\n self.coders[coder_name] = coder", "def encoder_from_string(encoder: str) -> json.JSONEncoder:\n return util.import_obj(encoder) if encoder else None", "de...
[ "0.64407706", "0.61046815", "0.6079837", "0.5847847", "0.5770759", "0.5728369", "0.56867754", "0.5659111", "0.56393677", "0.5635285", "0.5635285", "0.560628", "0.5529888", "0.5525563", "0.55111885", "0.5491491", "0.54693437", "0.5467637", "0.54634774", "0.54603595", "0.543289...
0.79553246
0
List available encoder for argument listencoders.
def argparse_encoder_list() -> None: print("Available encoders:\n") print("{:<12}| {}".format("NAME", "DESCRIPTION")) print("{}|{}".format("-" * 12, "-" * 12)) for encoder in AVAILABLE_ENCODERS: print("{:<12}| {}".format(encoder, AVAILABLE_ENCODERS[encoder]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEncoders ():\n return _registeredEncoders", "def list():\n return [Drive.ENCODER_L,\n Drive.ENCODER_R]", "def get_encoder_names(cls) -> list[str]:\n return cls.backbone_names", "def read_encoders(self):\n enc_list = Drive.list()\n rtn = {}\n\n for e...
[ "0.7441287", "0.6809621", "0.67048085", "0.6366758", "0.63201123", "0.6299589", "0.62778974", "0.6232592", "0.608029", "0.6028224", "0.597877", "0.59699005", "0.59497845", "0.5925195", "0.5882375", "0.5660411", "0.5649066", "0.56255937", "0.55458534", "0.55051184", "0.5460158...
0.729824
1
URL encodes the string.
def _encode_url(data: str) -> str: return urllib.parse.quote(data, safe="")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b2_url_encode(s):\n return quote(s.encode('utf-8'))", "def _encode_url(full_url):\n return urllib.parse.quote(full_url, safe=\"%/:=&?~#+!$,;'@()*[]|\")", "def _encode(self, url):\n\n\t\ttiny_url = ''\n\n\t\tstring_id = self.get_string_id(url)\n\n\t\twhile string_id > 0:\n\t\t\tstring_id, mod = di...
[ "0.73567134", "0.7325704", "0.72661626", "0.71775556", "0.71566695", "0.7070874", "0.7048081", "0.70204276", "0.7011386", "0.69716555", "0.68814105", "0.68672156", "0.68672156", "0.6819084", "0.67636806", "0.6643498", "0.6638649", "0.6609854", "0.6606962", "0.65300757", "0.65...
0.7664371
0
URL encodes the string and converts spaces to a '+' sign.
def _encode_urlplus(data: str) -> str: return urllib.parse.quote_plus(data, safe="")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _url_encode(self, text):\n try:\n return (urllib.quote(text.replace(u'and', u'&'), safe='')\n .replace(u'%20', u'+'))\n except:\n print('Using python3')\n return (urllib.parse.quote(text.replace(u'and', u'&'), safe='')\n .repl...
[ "0.7584783", "0.74393106", "0.72772896", "0.72347313", "0.72131795", "0.7179806", "0.7172637", "0.7165301", "0.7084647", "0.6912815", "0.6858822", "0.6854565", "0.6832598", "0.6832171", "0.68085265", "0.678919", "0.677692", "0.67722255", "0.6757509", "0.6684567", "0.66667247"...
0.79795545
0
Html entity encodes the string.
def _encode_html(data: str) -> str: return html.escape(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self, text):\n # taken from htmlcss1 writer\n # @@@ A codec to do these and all other HTML entities would be nice.\n text = text.replace(\"&\", \"&amp;\")\n text = text.replace(\"<\", \"&lt;\")\n text = text.replace('\"', \"&quot;\")\n text = text.replace(\">\",...
[ "0.76823986", "0.7436511", "0.7403639", "0.73916006", "0.732849", "0.71537197", "0.70061815", "0.69845724", "0.6976353", "0.6944052", "0.68957525", "0.68801415", "0.6877136", "0.6862977", "0.66983545", "0.6685174", "0.6656498", "0.6608553", "0.65870816", "0.65712136", "0.6549...
0.766779
1
Base64 encodes with space padding to ensure output only contains [azAZ09+].
def _encode_base64pad(data: str) -> str: pattern = r"[^a-zA-Z0-9\+]" regex = re.compile(pattern) while True: ebytes = base64.b64encode(data.encode("utf-8")) estring = str(ebytes, "utf-8") if not regex.findall(estring): break # Pad with trailing space and try again...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_2xbase64pad(data: str) -> str:\n pattern = r\"[^a-zA-Z0-9]\"\n regex = re.compile(pattern)\n while True:\n # First run\n ebytes = base64.b64encode(data.encode(\"utf-8\"))\n estring = str(ebytes, \"utf-8\")\n\n # Second run\n ebytes = base64.b64encode(estring....
[ "0.77566636", "0.7302048", "0.71138585", "0.70349246", "0.7016238", "0.6873493", "0.6863052", "0.685882", "0.6854486", "0.6766383", "0.66630834", "0.6654437", "0.66174877", "0.66125387", "0.65900755", "0.65900755", "0.6526679", "0.6524847", "0.6427443", "0.6425861", "0.640876...
0.7900289
0
Base64 encodes twice with space padding to ensure output only contains [azAZ09].
def _encode_2xbase64pad(data: str) -> str: pattern = r"[^a-zA-Z0-9]" regex = re.compile(pattern) while True: # First run ebytes = base64.b64encode(data.encode("utf-8")) estring = str(ebytes, "utf-8") # Second run ebytes = base64.b64encode(estring.encode("utf-8")) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_base64pad(data: str) -> str:\n pattern = r\"[^a-zA-Z0-9\\+]\"\n regex = re.compile(pattern)\n while True:\n ebytes = base64.b64encode(data.encode(\"utf-8\"))\n estring = str(ebytes, \"utf-8\")\n if not regex.findall(estring):\n break\n # Pad with trailing...
[ "0.7583209", "0.7163318", "0.7001192", "0.69024086", "0.68460166", "0.68253416", "0.6691286", "0.6659967", "0.66558814", "0.6631023", "0.65908706", "0.6589733", "0.6513986", "0.64372027", "0.6431788", "0.64234906", "0.629073", "0.62886935", "0.6261819", "0.6261819", "0.624456...
0.7789818
0
Retrieve topic schema from the Schema Registry. Returns
async def get_schema(self) -> AvroSchemaT: schema = None try: schema = await self._client.schema_by_topic(self._subject) except Exception: msg = f"Could not retrieve schema for subject {self._subject}." raise SchemaException(msg) return schema
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_schema(self):\n response = self.client.get(self._get_collection_url('schema'))\n\n return response.get('schema', {})", "def get_schema(self, engine_name):\n endpoint = \"engines/{}/schema\".format(engine_name)\n return self.swiftype_session.request('get', endpoint)", "def sc...
[ "0.69318485", "0.6648944", "0.66151816", "0.65597457", "0.64833015", "0.64112085", "0.6292522", "0.6284893", "0.6240288", "0.61408865", "0.61262184", "0.6110277", "0.60988575", "0.6020327", "0.6005132", "0.60021394", "0.5995657", "0.5993152", "0.5985525", "0.59844315", "0.598...
0.7383239
0
Get topic fields. Parses the topic Avro schema and returns a list of fields with Python types. Returns
async def get_fields(self) -> List[Field]: schema = await self.get_schema() fields = [] if schema: # The faust-avro parser expects a json-parsed avro schema # https://github.com/masterysystems/faust-avro/blob/master/faust_avro/parsers/avro.py#L20 parsed_schema...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields(\n schema: Union[Config, Schema], types: Union[Type, Tuple[Type]] = None\n) -> List[Tuple[str, BaseField]]:\n\n fields = list(schema._fields.items())\n if isinstance(schema, Config):\n fields += list(schema._schema._fields.items())\n\n if types:\n fields = [item for item in...
[ "0.6299269", "0.60301435", "0.5931615", "0.5922192", "0.57615733", "0.57452226", "0.56565475", "0.5619404", "0.55596054", "0.5541145", "0.5519022", "0.5483845", "0.54358023", "0.54198164", "0.53955734", "0.5376999", "0.5376526", "0.537617", "0.53621113", "0.53554416", "0.5350...
0.72090507
0
Register an Avro schema with the Schema Registry. If the schema is already register for this subject it does nothing.
async def register(self, schema: AvroSchemaT) -> Union[int, None]: logger.info(f"Register schema for subject {self._subject}.") is_registered = False try: is_registered = await self._client.is_registered( self._subject, schema ) except Exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, schema):\n if schema.fullname in VALID_TYPES:\n raise SchemaParseException(\n '%s is a reserved type name.' % schema.fullname)\n if schema.fullname in self.names:\n raise SchemaParseException(\n 'Avro name %r already exists.' % sc...
[ "0.75095624", "0.636198", "0.6255365", "0.62535286", "0.62535286", "0.62535286", "0.60564584", "0.6006052", "0.59905624", "0.5787812", "0.5713144", "0.5643266", "0.5495948", "0.5483089", "0.54456383", "0.53514594", "0.5350759", "0.51839006", "0.5180588", "0.51743895", "0.5140...
0.7447215
1
This function obtains Excel file path using tkinter module.
def get_file_path(): root = tk.Tk() root.withdraw() file_path = filedialog.askopenfilename(filetypes=[("Excel file", "*.xlsx")]) return file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_file():\n \n from tkinter import Tk\n from tkinter.filedialog import askopenfilename\n \n # Make a top-level instance and hide from user.\n root = Tk()\n root.withdraw()\n\n # Make it almost invisible - no decorations, 0 size, top left corner.\n root.overrideredirect(True)\n ...
[ "0.67193115", "0.65942097", "0.6497085", "0.6414859", "0.6397723", "0.6352703", "0.6035921", "0.59851617", "0.58859783", "0.5827919", "0.5658049", "0.5592338", "0.55894524", "0.55575365", "0.5459018", "0.54376125", "0.5339908", "0.5337097", "0.5326472", "0.5319257", "0.529570...
0.81460154
0
Loads scores from the given handle.
def load_scores(handle): logging.info('Loading scores') result = pd.read_csv(handle, index_col=0) logging.info('Loaded a table with shape {}'.format(result.shape)) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_scores(self, score_file_name):\n try:\n with open(score_file_name, 'rb') as score_file:\n self.scores = pickle.load(score_file)\n except FileNotFoundError:\n pass", "def load_score(fhandle: TextIO) -> annotations.NoteData:\n\n #### read start, end ti...
[ "0.6391052", "0.60156506", "0.6003782", "0.58916295", "0.5874204", "0.5735446", "0.5705583", "0.5670833", "0.5634658", "0.5388726", "0.5343005", "0.5258118", "0.5206841", "0.5193093", "0.5190318", "0.5149233", "0.51236445", "0.5112225", "0.5052212", "0.50291836", "0.50266147"...
0.79614854
0
Obtains the MLE variance given a series of values and a calculated mean.
def get_mle_variance(series, mean=None): if mean is None: mean = series.mean() return 1 / series.size * ((series - mean)**2).sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variance(numbers, mean):\n variance = 0 # We will add to this value in a loop\n N = len(numbers)\n \n for i in numbers:\n\n # Operations follow typical BEDMAS\n variance += ((i - mean) * (i - mean))/N\n \n return variance", "def variance( values, sample=False ):\n mean_val ...
[ "0.7475806", "0.71996796", "0.7120669", "0.69633657", "0.69283533", "0.6919777", "0.690976", "0.67857486", "0.6750658", "0.6750658", "0.66914403", "0.6673788", "0.6655616", "0.6629216", "0.6552021", "0.6552021", "0.65044594", "0.65044594", "0.65044594", "0.6442417", "0.643663...
0.8110193
0
Obtains cluster assignments from the given scores.
def get_clusters(df, allow_unassigned, variance_coefficient, letters): logging.info('Calculating cluster assignments') # Calculate minimum thresholds to call cluster assignments. min_thresholds = pd.Series(np.tile(1e-6, df.shape[1]), index=df.columns) if allow_unassigned: # Estimate the var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clustering(self, pred_boxes, pred_scores):\n pred_boxes_cat = torch.cat(pred_boxes, dim=0)\n\n pred_boxes_cat[:, -1] = limit_period(pred_boxes_cat[:, -1])\n pred_scores_cat = torch.cat(pred_scores, dim=0)\n ious = boxes_iou3d_gpu(pred_boxes_cat, pred_boxes_cat)\n cluster_indi...
[ "0.6563418", "0.6028029", "0.6001135", "0.5851254", "0.5810269", "0.57647604", "0.5749857", "0.56806594", "0.5671507", "0.56269217", "0.56164557", "0.5607218", "0.5606947", "0.5574019", "0.5556459", "0.55542016", "0.55088186", "0.5474318", "0.5459507", "0.54418623", "0.543269...
0.6130404
1
Return the set of all inlined instructions in `root_insn` (included).
def get_inlined_insns(root_insn): result = set() def helper(insn): result.add(insn) for input in insn.inputs: if ( isinstance(input.value, ir.ComputingInstruction) and input.value.inline ): helper(input.value) helper(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instructions(self):\n tmp_ins = []\n idx = 0\n for i in self.method.get_instructions():\n if idx >= self.start and idx < self.end:\n tmp_ins.append(i)\n\n idx += i.get_length()\n return tmp_ins", "def getIncludes(self):\n return self...
[ "0.5307971", "0.500042", "0.49988607", "0.4996068", "0.49914584", "0.49559152", "0.49267817", "0.49252596", "0.48164862", "0.4806877", "0.47919488", "0.4760398", "0.47565317", "0.4750424", "0.47436726", "0.47354415", "0.4718832", "0.46956724", "0.46533853", "0.46467805", "0.4...
0.8623057
0
Tries to select single node from nested dict and write it to the list at the index.
def _try_set(set_list, index, nested_dict, dict_keys=[]): try: for dict_key in dict_keys: nested_dict = nested_dict.__getitem__(dict_key) set_list[index] = str(nested_dict) return nested_dict except: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSubkeyByIndex(self, index):", "def _dictitem_gen(self, index):\n # first call can be assumed to work on structure dict\n if index in self.struct['dict']: # \"dict\" is a standard dictionary, thus iterating over it is the same as iterating over the keys\n for idx in self.struct['di...
[ "0.5381771", "0.5373577", "0.5308455", "0.52927774", "0.52425617", "0.523762", "0.5215978", "0.5201783", "0.5195301", "0.5146156", "0.5132212", "0.5052306", "0.5043918", "0.503015", "0.50289166", "0.50024855", "0.49894303", "0.4979314", "0.4975182", "0.49483192", "0.49455285"...
0.55979466
0
Appends selected single node from nested dict to the list at the index. Append instead of rewriting as in case of __try_set.
def _try_append(set_list, index, nested_dict, dict_keys=[]): try: for dict_key in dict_keys: nested_dict = nested_dict.__getitem__(dict_key) if set_list: set_list[index] += str(nested_dict) return nested_dict except: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n left, right = 2 * parent + 1, 2 * parent + 2\n self.__tree[parent] = self.__tree[left] + self.__tree[right]\n parent = (parent - 1) // 2", "def __setitem__(self, i: int, o: 'Tree') -> None:\n ...
[ "0.57342213", "0.56596655", "0.56033224", "0.5559192", "0.54839617", "0.54343253", "0.5398545", "0.53620857", "0.535225", "0.53277856", "0.53153884", "0.53132755", "0.5304931", "0.52992874", "0.5288722", "0.52861303", "0.5253632", "0.52518916", "0.5250139", "0.523779", "0.523...
0.6493033
0
Use try_func and converts its string result to date string.
def _try_date(set_list, index, nested_dict, dict_keys=[], try_func=_try_set): import datetime try: dt = try_func(None, None, nested_dict, dict_keys) # 2012-07-05T00:00:00+04:00 dt = datetime.datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S%z") try_func(set_list, index, str(dt.date())) pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_func(func):\n try:\n return func()\n except Exception as e:\n return e", "def _get_normal_date(self, args):\n\n func1, func2, func3 = args\n self.assertIsNotNone(func1(20130201, \"20190120\"))\n self.assertIsNotNone(func2(\"2013/02/01\", \"2019-01-20\"))\n ...
[ "0.6210365", "0.5784953", "0.56346416", "0.55400366", "0.5485929", "0.54631007", "0.5443882", "0.5425232", "0.54151005", "0.5411978", "0.53939974", "0.5378411", "0.5376887", "0.5360426", "0.5290894", "0.5288425", "0.52860683", "0.5281345", "0.52689224", "0.52656925", "0.52461...
0.6782496
0
Selects features filterwise per filterband, starting with no features, then selecting the best filterpair from the bestfilterband (measured on internal train/test split)
def collect_best_features(self): bincsp = self.binary_csp # just to make code shorter n_folds = len(self.binary_csp.folds) n_class_pairs = len(self.binary_csp.class_pairs) result_shape = (n_folds, n_class_pairs) self.train_feature = np.empty(result_shape, dtype=object) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_selection(train_features, test_features, train_similarity_target, test_similarity_target, regressor, used_features):\n\t# percentile selector\n\tpercentile_selector, percentile_score, percentile_train_features_selected, percentile_test_features_selected, percentile_mask = best_percentile_selector(train...
[ "0.5992918", "0.59564954", "0.59535414", "0.5932676", "0.5923692", "0.58042324", "0.5780261", "0.57645375", "0.5748206", "0.57386553", "0.56789696", "0.5660202", "0.56304276", "0.55929834", "0.55776244", "0.5565502", "0.5558058", "0.5543337", "0.5526073", "0.55201733", "0.551...
0.6909208
0
Demonstrates the syntax necessary for basic usage of the FoldTree object performs these changes with a demonstrative pose example and writes structures to PDB files if is True
def fold_tree(PDB_out = False): ########## # FoldTree # a FoldTree encodes the internal coordinate dependencies of a Pose # a Pose object MUST have a FoldTree # the FoldTree allows regions of a pose to become independent, # it is used in many important applications, particularly: # lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree():\n nobv.visual_tree()", "def main():\n \n # 1. Learn a decision tree from the data in training.txt\n print \"--Building trees--\"\n train_examples = read_file('training.txt')\n print(train_examples)\n attrs = range(len(train_examples[0])-1)\n rand_tree = decision_tree_learning(...
[ "0.5582495", "0.55227566", "0.55077416", "0.5327612", "0.53146017", "0.52920765", "0.52888846", "0.5259966", "0.5250141", "0.52456695", "0.52336556", "0.5221779", "0.5210651", "0.5195875", "0.5167817", "0.5102092", "0.5098444", "0.50898075", "0.5076373", "0.50581986", "0.5050...
0.78134197
0
Download instancedata.csv from MINLPLib which can be used to get statistics on the problems from minlplib.
def get_minlplib_instancedata(target_filename=None): if target_filename is None: target_filename = os.path.join(os.getcwd(), 'minlplib', 'instancedata.csv') download_dir = os.path.dirname(target_filename) if os.path.exists(target_filename): raise ValueError('A file named {filename} already ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self, verbose):\n # Download datasets\n if verbose:\n print(\"Retrieving datasets from Our World In Data https://github.com/owid/covid-19-data/\")\n # Vaccinations\n v_rec_cols = [\n \"date\", \"location\", \"iso_code\", \"total_vaccinations\", \"peopl...
[ "0.5701007", "0.5519135", "0.5494347", "0.54325104", "0.5428697", "0.5407511", "0.5373714", "0.5348428", "0.5331514", "0.53146833", "0.5308775", "0.5301517", "0.52482224", "0.5236613", "0.5229138", "0.5218212", "0.52168965", "0.5206146", "0.5202182", "0.5193772", "0.5179708",...
0.7105052
0
This function filters problems from MINLPLib based on instancedata.csv from MINLPLib and the conditions specified through the function arguments. The function argument names correspond to column headings from instancedata.csv. The arguments starting with min or max require int or float inputs. The arguments starting wi...
def filter_minlplib_instances(instancedata_filename=None, min_nvars=0, max_nvars=math.inf, min_nbinvars=0, max_nbinvars=math.inf, min_nintvars=0, max_nintvars=math.inf, min_nnlvars=0, max_nnlvars=math...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max_outliers(res, min=None, max=None):\n min_max_list = []\n if isinstance(min, (int, float)):\n data1 = res[res < min].reset_index()\n data1['limit type'] = 'minimum'\n data1['limit'] = min\n min_max_list.append(data1)\n if isinstance(max, (int, float)):\n data1...
[ "0.5590699", "0.54717195", "0.546341", "0.5421935", "0.5389123", "0.53543043", "0.5188106", "0.5153531", "0.51267356", "0.5076835", "0.50677097", "0.50538373", "0.50466853", "0.5036201", "0.5033214", "0.5024426", "0.49925968", "0.49806297", "0.4965975", "0.49592558", "0.49578...
0.6130292
0
Return a steemstyle amount string given a (numeric, assetstr).
def _amount(amount, asset='HBD'): assert asset == 'HBD', 'unhandled asset %s' % asset return "%.3f HBD" % amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cp_asset_sale(self, amt: float) -> str:\n raise NotImplementedError", "def obtain_amount(cls, amount_string):\n return float(string.replace(amount_string, ',', '.'))", "def make_quantity(string):\n pass", "def format_amount(self) -> str:\n if self.amount_debit != '':\n ...
[ "0.6219759", "0.5915044", "0.5800827", "0.5674921", "0.56510484", "0.56374365", "0.56039447", "0.55580014", "0.54944694", "0.5424905", "0.53800106", "0.5352545", "0.5346404", "0.5282491", "0.5272913", "0.526662", "0.526149", "0.52452654", "0.52430576", "0.5226036", "0.5224858...
0.73780584
0
Given a hive_posts row, create a legacystyle post object.
def database_post_object(row, truncate_body=0): paid = row['is_paidout'] post = {} post['active'] = json_date(row['active']) post['author_rewards'] = row['author_rewards'] post['id'] = row['id'] post['author'] = row['author'] post['permlink'] = row['permlink'] post['category'] = row['c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_blog_post(user_id):\n \n data = request.get_json()\n\n # Check if the user is in the database\n user = User.query.filter_by(id=user_id).first()\n if not user:\n return jsonify({\"message\": \"user does not exist!\"}), 400\n\n # Create an instance of a HashTable\n ht = hash_ta...
[ "0.5269831", "0.5175269", "0.51678485", "0.5167002", "0.51123905", "0.5089774", "0.50829285", "0.50513357", "0.5044976", "0.50155133", "0.49868736", "0.49727294", "0.49441043", "0.4942868", "0.4867174", "0.48466963", "0.4832807", "0.48096168", "0.4804877", "0.47906214", "0.47...
0.56856656
0
Computes the number of effective training iterations. An effective iteration is defined as the the aggregation of iterations. For examples, if accumulate_size = 4, then 4 iterations are considered as one effective iteration.
def compute_effective_steps_per_epoch(dataloader: Iterable, accumulate_size: int) -> int: return len(dataloader) // accumulate_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculateIterations(self):\n #iterations = self.nb_images/self.batchsize\n imgs = self.protofile.nb_test()\n batch = self.protofile.batch_test()\n iterations = imgs/batch\n if imgs % batch != 0:\n iterations += 1\n return iterations", "def get_iterations(...
[ "0.68272024", "0.6722169", "0.6686256", "0.661356", "0.6491655", "0.6375589", "0.6240505", "0.61844486", "0.61844486", "0.6106719", "0.60720783", "0.6068031", "0.6068031", "0.6049805", "0.5977738", "0.5970602", "0.59378844", "0.5913421", "0.5890675", "0.5831778", "0.57741433"...
0.7493815
0
Returns the states of the lr scheduler as dictionary.
def state_dict(self) -> dict: return self.lr_scheduler.state_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_state_dict(self) -> dict:\n return {\n 'optimizers': [o.state_dict() for o in self.optimizers],\n 'schedulers': [s.state_dict() for s in self.schedulers],\n }", "def _get_state_dict(self) -> dict:\n return {\n 'optimizers': [o.state_dict() for o in s...
[ "0.7723254", "0.7723254", "0.7137493", "0.6843552", "0.67712843", "0.6729426", "0.6640449", "0.6620688", "0.6570829", "0.6513248", "0.6504064", "0.6473677", "0.64505357", "0.64180076", "0.6406267", "0.640395", "0.6358328", "0.6326163", "0.6309934", "0.628206", "0.6259487", ...
0.8734462
0
Load the states of the lr scheduler from a dictionary object.
def load_state_dict(self, state_dict: dict) -> None: self.lr_scheduler.load_state_dict(state_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state_dict(self, state_dict):\n if self._lr_scheduler is not None:\n self._lr_scheduler.load_state_dict(state_dict)\n else: # here we store the state_dict until we instantiate the optimizer\n self._state_dict = state_dict", "def _load_state_dict(optimizer, state: dic...
[ "0.78618276", "0.74135333", "0.7223805", "0.7223805", "0.6929675", "0.6774868", "0.67248166", "0.671686", "0.6587653", "0.65414304", "0.65217894", "0.65166456", "0.63904953", "0.63904953", "0.63904953", "0.63538444", "0.6286555", "0.62593186", "0.6239442", "0.6191234", "0.606...
0.8198997
0
Handle gradients reduction only in the last gradient accumulation step.
def handle_gradient(self) -> None: self.accumulate_step += 1 if self.accumulate_step < self.accumulate_size: pass else: self.accumulate_step = 0 self.grad_handler.handle_gradient()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_gradient(self):\n self._optimizer.sync_grad()", "def on_batch_end(self, state: _State):\n if not state.need_backward_pass:\n return\n\n loss = state.batch_metrics[self.loss_key]\n optimizer = self._optimizer\n\n self._accumulation_counter += 1\n nee...
[ "0.7104751", "0.670676", "0.6691065", "0.6685171", "0.64572406", "0.6428213", "0.6427255", "0.6425612", "0.6366954", "0.63388497", "0.63243264", "0.6315425", "0.62372506", "0.61818844", "0.61289996", "0.61289996", "0.6127821", "0.611862", "0.60883456", "0.6080549", "0.607218"...
0.8042873
0
Set the loaded background image as background pixmap for the scene.
def _setup_background(self): self.background_image = QtGui.QImage() data = self.model.get_background_image_data() self.background_image.loadFromData(data,'PNG') self.scene().addPixmap(QtGui.QPixmap.fromImage(self.background_image)) self.fitInView(QtCore.QRectF(self.backgroun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_background(self, image):\n self.bg = pygame.image.load(image).convert()", "def set_background_image(self, imagename):\n self.background.image = ui.get_image(imagename, '/home/pi/music/images/')", "def display_background(self, imagepath):\n background_image = Image.open(imagepath)\...
[ "0.774536", "0.7230186", "0.68150884", "0.68150884", "0.6737236", "0.67317253", "0.65337086", "0.65113914", "0.64595455", "0.6448829", "0.6414376", "0.63675696", "0.6260566", "0.6160613", "0.6140638", "0.6133443", "0.60689527", "0.59405315", "0.5938807", "0.591215", "0.586479...
0.8143723
0
Open a file dialog for letting the user choose a background image
def _open_background_image_dialog(self): new_background_image_file = QtGui.QFileDialog.getOpenFileName(parent=None, caption="Open background image file", directory="resources", filter="Image ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectImageFile(self):\n fileName = QFileDialog.getOpenFileName()\n if fileName:\n self.set_image(fileName[0])", "def showOpenImageDialog(self, event):\r\n openImageDialog = wx.FileDialog(self, \"Open\",\r\n style=wx.FD_OPEN | wx.FD_FILE_...
[ "0.69813025", "0.69487387", "0.6716531", "0.6712335", "0.65396273", "0.64668244", "0.6403048", "0.63787997", "0.6329275", "0.63117164", "0.62948525", "0.6234983", "0.6209773", "0.6207649", "0.6191353", "0.60875744", "0.60574764", "0.60410905", "0.6035234", "0.60351324", "0.60...
0.8290579
0
Update the scene by first clearing it, and then add everything it should contain.
def updateScene_(self): self.scene().clear() self._setup_background() self._add_sockets() self._add_rooms() self._add_fuses() self._add_switchs() self._add_lamp_outlets()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_scene(self, event):\n self.shapes = []\n self.redraw()", "def refresh(self):\n\n # Set Graphics scene\n self.setScene(QtGui.QGraphicsScene())\n self._connections = set()\n self._nodes = {}\n self._selection = set()\n self._manipulation_mode = 0\n ...
[ "0.7382362", "0.72062266", "0.7178352", "0.70843875", "0.70334196", "0.68328506", "0.68294317", "0.6741447", "0.6685606", "0.656615", "0.64471614", "0.64011264", "0.637065", "0.63602686", "0.63602686", "0.62540436", "0.6220356", "0.6220356", "0.6220356", "0.61881584", "0.6180...
0.844773
0
Create a new TargetItem and TargetInfoWidget and add them to the scene
def _add_room(self, room_model): # Create a new TargetItem and set the model room_item = RoomItem() room_item.setModel(room_model) # Create a new TargetInfoWidget and set the model room_widget = RoomInfoWidget() room_widget.setModel(room_model) # Conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_target(self, widget):\n\t\tself.main.window.set_sensitive(False)\n\t\tself.add_window = Targetadd(self.engine.database)\n\t\tself.add_window.cancel_button.connect(\"clicked\", self._sensitive_true, False)\n\t\tself.add_window.add_button.connect(\"clicked\", self._sensitive_true, True)\n\t\tself.add_window....
[ "0.59375006", "0.57411295", "0.57406944", "0.5679419", "0.5618925", "0.55654866", "0.5560117", "0.5528846", "0.55212057", "0.5515769", "0.5513372", "0.5508875", "0.55074173", "0.5503268", "0.5492187", "0.54622674", "0.54380214", "0.54370105", "0.5423204", "0.54188454", "0.538...
0.6025717
0
Raises a ValidationError if value has not length 32
def validate_authkey(value): if not len(value) == 32: raise ValidationError( 'Value must be a string containing 32 alphanumeric characters')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longer_than_9(value):\n if len(value) < 10:\n raise forms.ValidationError('must be 10 characters or longer')", "def validate_length(string):\n if len(string) > 110:\n raise ValidationError('Tweet must be less than 110 characters')", "def clean(self, value):\r\n if value and (len(...
[ "0.72884405", "0.6955354", "0.6885741", "0.68818116", "0.6824072", "0.66354096", "0.6615882", "0.6587561", "0.6587561", "0.65413004", "0.6537108", "0.65263134", "0.65212256", "0.6502707", "0.6483852", "0.6479096", "0.6475491", "0.6464795", "0.6441646", "0.6430137", "0.6428241...
0.76096874
0
Get the body of the bind c function definition. Get the body of the bind c function definition by inserting if blocks to check the presence of optional variables. Once we have ascertained the presence of the variables the original function is called. This code slices array variables to ensure the correct step.
def _get_function_def_body(self, func, func_def_args, func_arg_to_call_arg, results, handled = ()): optional = next((a for a in func_def_args if a.original_function_argument_variable.is_optional and a not in handled), None) if optional: args = func_def_args.copy() optional_var = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __compile_subroutine_body(self):\r\n self.compile_statements()", "def _get_call_argument(self, bind_c_arg):\n original_arg = bind_c_arg.original_function_argument_variable\n arg_var = self.scope.find(original_arg.name, category='variables')\n if original_arg.is_ndarray:\n ...
[ "0.5091313", "0.50208336", "0.48778033", "0.485153", "0.48233292", "0.48153418", "0.48068014", "0.48034468", "0.47375363", "0.47292742", "0.4714741", "0.4679764", "0.46484953", "0.46120793", "0.4569959", "0.45631406", "0.45606202", "0.45545164", "0.45443997", "0.45401987", "0...
0.57275337
0
Get the argument which should be passed to the function call. The FunctionDefArgument passed to the function may contain additional information which should not be passed to the function being wrapped (e.g. an array with strides should not pass the strides explicitly to the function call, nor should it pass the entire ...
def _get_call_argument(self, bind_c_arg): original_arg = bind_c_arg.original_function_argument_variable arg_var = self.scope.find(original_arg.name, category='variables') if original_arg.is_ndarray: start = LiteralInteger(1) # C_F_Pointer leads to default Fortran lbound s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArgument(self, *args):\n return _libsbml.FunctionDefinition_getArgument(self, *args)", "def _wrap_FunctionDefArgument(self, expr):\n var = expr.var\n name = var.name\n self.scope.insert_symbol(name)\n collisionless_name = self.scope.get_expected_name(var.name)\n i...
[ "0.68676627", "0.63390875", "0.6240098", "0.60637504", "0.59205437", "0.5899934", "0.57536966", "0.5694595", "0.55618656", "0.55556196", "0.5553342", "0.5541516", "0.5448954", "0.5444387", "0.5425658", "0.53730434", "0.5355409", "0.52947515", "0.5220035", "0.51893306", "0.515...
0.7051167
0
Create a Module which is compatible with C. Create a Module which provides an interface between C and the Module described by expr. This includes wrapping functions, interfaces, classes and module variables.
def _wrap_Module(self, expr): # Define scope scope = expr.scope mod_scope = Scope(used_symbols = scope.local_used_symbols.copy(), original_symbols = scope.python_names.copy()) self.scope = mod_scope # Wrap contents funcs_to_wrap = expr.funcs funcs = [self._wrap(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_module(\n submodule_name: str, cython_src_files: list,\n c_src_paths: list = None, c_include_paths: list = None,\n c_libraries: list = None\n):\n\n if c_include_paths is None: c_include_paths = []\n if c_libraries is None: c_libraries = []\n if c_src_paths is None: c_src_path...
[ "0.58194566", "0.5692998", "0.56872624", "0.56411546", "0.5595038", "0.5511902", "0.54851526", "0.54670924", "0.5420265", "0.5383697", "0.5296799", "0.5263366", "0.52061045", "0.51810807", "0.5178292", "0.5156475", "0.5152217", "0.51299", "0.5128299", "0.51144826", "0.5095938...
0.747593
0
Create a Ccompatible function which executes the original function. Create a function which can be called from C which internally calls the original function. It does this by wrapping the arguments and the results and unrolling the body using self._get_function_def_body to ensure optional arguments are present before a...
def _wrap_FunctionDef(self, expr): if expr.is_private: return EmptyNode() name = self.scope.get_new_name(f'bind_c_{expr.name.lower()}') self._wrapper_names_dict[expr.name] = name # Create the scope func_scope = self.scope.new_child_scope(name) self.scope = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_as_arg(self, node, C_new):\n F_new = C_new.clone()\n\n # Fortran function should wrap the new C function\n F_new._PTR_F_C_index = C_new._function_index\n F_new.wrap.assign(fortran=True)\n # Do not add '_bufferify'\n F_new.fmtdict.function_suffix = node.fmtdict.f...
[ "0.65536374", "0.62138677", "0.6150388", "0.6098803", "0.6089656", "0.60039127", "0.59987605", "0.59216076", "0.59151495", "0.58322114", "0.5787681", "0.57753617", "0.5758665", "0.5709189", "0.5702252", "0.564342", "0.5591137", "0.55847555", "0.5573809", "0.55646837", "0.5563...
0.75368756
0
Create the equivalent BindCFunctionDefArgument for a Ccompatible function. Take a FunctionDefArgument and create a BindCFunctionDefArgument describing all the information that should be passed to the Ccompatible function in order to be able to create the argument described by `expr`. In the case of a scalar numerical t...
def _wrap_FunctionDefArgument(self, expr): var = expr.var name = var.name self.scope.insert_symbol(name) collisionless_name = self.scope.get_expected_name(var.name) if var.is_ndarray or var.is_optional: new_var = Variable(BindCPointer(), self.scope.get_new_name(f'boun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wrap_FunctionDef(self, expr):\n if expr.is_private:\n return EmptyNode()\n\n name = self.scope.get_new_name(f'bind_c_{expr.name.lower()}')\n self._wrapper_names_dict[expr.name] = name\n\n # Create the scope\n func_scope = self.scope.new_child_scope(name)\n ...
[ "0.6402835", "0.59598666", "0.58069235", "0.5668584", "0.54364705", "0.5237507", "0.5124962", "0.49953586", "0.48212668", "0.47471574", "0.47356513", "0.46868324", "0.46776998", "0.46632668", "0.46530426", "0.46255657", "0.45983043", "0.45781806", "0.45673853", "0.45637605", ...
0.76825356
0
Create the equivalent BindCFunctionDefResult for a Ccompatible function. Take a FunctionDefResult and create a BindCFunctionDefResult describing all the information that should be returned from the Ccompatible function in order to fully describe the result `expr`. This function also adds any expressions necessary to bu...
def _wrap_FunctionDefResult(self, expr): var = expr.var name = var.name scope = self.scope # Make name available for later scope.insert_symbol(name) local_var = var.clone(scope.get_expected_name(name)) if local_var.rank: # Allocatable is not returned ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wrap_FunctionDef(self, expr):\n if expr.is_private:\n return EmptyNode()\n\n name = self.scope.get_new_name(f'bind_c_{expr.name.lower()}')\n self._wrapper_names_dict[expr.name] = name\n\n # Create the scope\n func_scope = self.scope.new_child_scope(name)\n ...
[ "0.6197848", "0.5908766", "0.5702783", "0.5584586", "0.5551152", "0.5510475", "0.53075147", "0.5056599", "0.5053299", "0.5033014", "0.50257194", "0.50233", "0.49712402", "0.4809258", "0.47916153", "0.4786185", "0.47819734", "0.477247", "0.4735379", "0.46769652", "0.46176627",...
0.8009484
0
classifies the label for the queried case by finding highest probability item P(B|A)P(A) is used to compare the probabilities
def classify(self, toBeClassified, laPlace = 0): #counting P(B|A) probability probabilitiesDictionary = {} for label in self.trainingY: probability = 1.0 #for every part of toBeClassified count the probability of occuring if the given test was correct choice and multiply ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, testData=[]):\n result = []\n for classValue in self._classAttrs:\n #print(f'Computing Label: {classValue}, {self._classLabelMap[classValue]}')\n result.append(self._computeCondProb(testData, classValue))\n return self._classLabelMap[result.index(max(res...
[ "0.6739165", "0.6672079", "0.6487649", "0.6459216", "0.64419186", "0.6410345", "0.64069885", "0.6355552", "0.63476574", "0.6324833", "0.631852", "0.6314344", "0.631261", "0.6312608", "0.62935036", "0.62587637", "0.6247219", "0.62198925", "0.6213259", "0.6187837", "0.6165054",...
0.71006674
0
A decorator which wraps a function's return value in ``list(...)``. Useful when an algorithm can be expressed more cleanly as a generator but the function should return an list.
def listify(fn=None, wrapper=list): def listify_return(fn): @functools.wraps(fn) def listify_helper(*args, **kw): return wrapper(fn(*args, **kw)) return listify_helper if fn is None: return listify_return return listify_return(fn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_list(f):\n @functools.wraps(f)\n def wrapper(*args, **kwargs):\n return list(f(*args, **kwargs))\n return wrapper", "def Listor(fun):\n @functools.wraps(fun)\n def inside(*args, **kwargs):\n return list(fun(*args, **kwargs))\n return inside", "def decorator(arg):\n ret...
[ "0.78704184", "0.74657214", "0.72008944", "0.6643089", "0.66166073", "0.660685", "0.65524614", "0.6306997", "0.6270299", "0.62679815", "0.61245453", "0.6116196", "0.59481525", "0.5898619", "0.5858969", "0.58522457", "0.5849124", "0.58287376", "0.578699", "0.5776788", "0.57767...
0.75534225
1
Given the flow cell configuration, return RTA version tuple.
def config_to_rta_version(config): input_dir = config["input_dir"] path_run_info = glob.glob(os.path.join(input_dir, "?un?arameters.xml"))[0] run_parameters = load_run_parameters(path_run_info) rta_version = run_parameters["rta_version"] return rta_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_version(config):\n return 2 if is_v2_config(config) else 1", "def version(self):\n return self._call_txtrader_api('version', {})", "def test_get_cons3rt_version(self):\n pass", "def _get_revision(config):\n if config.revision:\n tokens = config.revision.split(\":\")\...
[ "0.5258042", "0.51598346", "0.51081574", "0.5086691", "0.50494105", "0.49595442", "0.48709843", "0.48570353", "0.48323405", "0.48223144", "0.48180148", "0.4808632", "0.47978392", "0.4786692", "0.47680828", "0.47165644", "0.4712013", "0.4689256", "0.46807617", "0.46767527", "0...
0.6845571
0
Return name of bcl2fastq wrapper to use.
def bcl2fastq_wrapper(config): rta_version = config_to_rta_version(config) if rta_version >= RTA_MIN_BCL2FASTQ2: return "bcl2fastq2" else: return "bcl2fastq"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fastq_id(fastq_name):\n return fastq_name.split(' ')[0]", "def fastq_filename(fastq_base):\n return fastq_base+\"_1.fastq\", fastq_base+\"_2.fastq\"", "def genSamName(fastq):\n return os.path.join(samFolder, os.path.splitext(fastq)[0] + \".sam\")\n # return os.path.join(samFolder, ntpath.sp...
[ "0.6006824", "0.5955702", "0.5946697", "0.59362376", "0.5814921", "0.56512016", "0.56245565", "0.55948746", "0.5536678", "0.54754657", "0.54747206", "0.54504925", "0.54346836", "0.5389236", "0.5371127", "0.5359996", "0.53590393", "0.5320611", "0.5313797", "0.52888805", "0.528...
0.72031164
0
Generate path to wrapper
def wrapper_path(path): return "file://" + os.path.abspath(os.path.join(os.path.dirname(__file__), "wrappers", path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __GetWrapperFileName(cls, src):\n return FileUtils.GetBinPathForFile(src).replace('.i', '.swig.cc')", "def get_wrapper_js_path(cls):\n return os.path.join(os.path.dirname(__file__), \"wrap_crowd_source.js\")", "def _make_path(self) -> str:\r\n path_ = Path(path.join(conf.instance.output_pa...
[ "0.6649867", "0.6346353", "0.6323831", "0.5990675", "0.5835186", "0.57515067", "0.56931067", "0.56383884", "0.5632164", "0.5619172", "0.5572063", "0.556947", "0.55476326", "0.5536915", "0.5534219", "0.55296135", "0.55116963", "0.5505502", "0.54755765", "0.54253846", "0.542409...
0.7444612
0
Return library dicts for undetermined libraries in ``flowcell``.
def undetermined_libraries(flowcell, rta_version): lanes = set() for library in flowcell["libraries"]: lanes |= set(library["lanes"]) result = [] for lane in lanes: result.append( { "name": "lane{}".format(lane) if rta_version < RTA_MIN_BCL2FAS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ExtractLibraryLoadAddressesFromLogcat(logs):\n browser_libs = LibraryLoadMap()\n renderer_libs = LibraryLoadMap()\n for m in re_library_address.finditer(logs):\n process_type, lib_name, lib_address = m.groups()\n lib_address = int(lib_address, 16)\n if process_type == 'BROWSER':\n browser_lib...
[ "0.5857328", "0.566059", "0.56077105", "0.5509866", "0.54729795", "0.54636264", "0.54300827", "0.5420543", "0.53581333", "0.5282064", "0.52263796", "0.5219019", "0.51474965", "0.5139492", "0.51295364", "0.51262486", "0.5125705", "0.5117036", "0.5068313", "0.50656843", "0.5049...
0.60556275
0
Return list with file names for the given library.
def lib_file_names(library, rta_version, n_template, n_index, lane=None, seq=None, name=None): if rta_version < RTA_MIN_BCL2FASTQ2 and library.get("barcode2", "Undetermined") not in ( "", "Undetermined", ): indices = ["".join((library["barcode"], "-", library["barcode2"]))] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def library_directories(self):\n\n status, stdout, stderr = self.__xcall__(['--libs-only-L'])\n\n if status != 0:\n raise RuntimeError(\"error querying --libs-only-L for package `%s': %s\" % (self.name, stderr))\n\n retval = []\n for token in stdout.split():\n retval.append(token[2:])\n\n ...
[ "0.68197584", "0.6612801", "0.65860647", "0.651696", "0.634841", "0.6239582", "0.6212851", "0.6169241", "0.61667246", "0.61667246", "0.6149375", "0.6090225", "0.6061063", "0.6045163", "0.6041969", "0.60409045", "0.602381", "0.60000515", "0.5995119", "0.5987065", "0.5984702", ...
0.68200177
0
Build sample map ``dict`` for the given flowcell.
def build_sample_map(flowcell): result = {} rows = [(lane, lib["name"]) for lib in flowcell["libraries"] for lane in lib["lanes"]] i = 1 for _, name in sorted(set(rows)): if name not in result: result[name] = "S{}".format(i) i += 1 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMap(self):\n map = {}\n for rows in xrange(0,(size[1]/50)):\n for columns in xrange(0,(size[0]/50)):\n if rows == (size[1]/50)-1 or rows == 0 or columns== (size[0]/50)-1 or columns==0:\n map.update({(rows,columns):\"block\"})\n eli...
[ "0.65350825", "0.6120123", "0.5987722", "0.5963165", "0.5949888", "0.57955086", "0.57083774", "0.5609627", "0.55620164", "0.5537006", "0.54921776", "0.54663897", "0.54227394", "0.5419855", "0.5395792", "0.5388628", "0.53751236", "0.5370007", "0.53461546", "0.534331", "0.53185...
0.7460185
0
Return list with FASTQC results files.
def get_result_files_fastqc(config): res_zip = [] res_html = [] for path in get_result_files_demux(config): ext = ".fastq.gz" if path.endswith(ext): folder = os.path.dirname(path) base = os.path.basename(path)[: -len(ext)] res_zip.append(os.path.join(folde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_test_files(self, results_list):\n return [results[INPUT_FILE_PATH] for results in results_list]", "def get_fastqc_files(sample, unit, pairs, config, pre):\n if config[\"preprocessing\"][\"fastqc\"]:\n files = expand(config[\"paths\"][\"results\"]+\"/intermediate/fastqc/{sample}_{unit}_...
[ "0.6973742", "0.6926766", "0.6716288", "0.6668739", "0.6503206", "0.64518744", "0.6330193", "0.6203264", "0.61732537", "0.6152446", "0.6145649", "0.6103352", "0.6013842", "0.59969056", "0.595812", "0.5938934", "0.59029835", "0.589157", "0.587857", "0.5876882", "0.5875305", ...
0.7692394
0
Return marker file for either bcl2fastq, bcl2fastq2 or picard for snakemake
def get_tool_marker(config): if len(config["flowcell"]["demux_reads_override"]) > 1: if config["demux_tool"] == "bcl2fastq2": return "bcl2fastq2.done" else: raise InvalidConfiguration( "Only bcl2fastq2 supports more than one bases mask at once, but you have {}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_barcodes(fastq1,\r\n fastq2=None,\r\n output_dir=\".\",\r\n input_type=\"barcode_single_end\",\r\n bc1_len=6,\r\n bc2_len=6,\r\n rev_comp_bc1=False,\r\n rev_comp_b...
[ "0.5712822", "0.5585956", "0.55091625", "0.53963697", "0.5361064", "0.524931", "0.5248761", "0.51786894", "0.5167982", "0.51404357", "0.51352984", "0.5132739", "0.5129055", "0.5116135", "0.5114908", "0.5113061", "0.5099794", "0.5082188", "0.5070987", "0.50707835", "0.5056807"...
0.6935189
0
Sets the price_source of this QuoteSeriesId.
def price_source(self, price_source): self._price_source = price_source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_price(self, price):\n assert isinstance(price, float), 'Price must be a float'\n self._price = price", "def price(self, price):\n\n self._price = price", "def price(self, price):\n\n self._price = price", "def price(self, price):\n\n self._price = price", "def pri...
[ "0.6167126", "0.6058284", "0.6058284", "0.6058284", "0.6058284", "0.60502464", "0.6015236", "0.5999806", "0.59924823", "0.59658754", "0.58039397", "0.5769713", "0.5769713", "0.57653004", "0.5605163", "0.5595293", "0.55577815", "0.55550915", "0.5468279", "0.54497796", "0.53435...
0.8176036
0
Sets the instrument_id of this QuoteSeriesId.
def instrument_id(self, instrument_id): if self.local_vars_configuration.client_side_validation and instrument_id is None: # noqa: E501 raise ValueError("Invalid value for `instrument_id`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_instrument(self, instrument_id, channel=0):\n if not 0 <= instrument_id <= 127:\n raise ValueError(f\"Undefined instrument id: {instrument_id}\")\n\n if not 0 <= channel <= 15:\n raise ValueError(\"Channel not between 0 and 15.\")\n\n self.write_short(0xC0 + chann...
[ "0.6593195", "0.65317917", "0.65317917", "0.65317917", "0.65317917", "0.6389134", "0.63215214", "0.6160165", "0.6136501", "0.61186457", "0.60556626", "0.60402614", "0.603777", "0.5880715", "0.5880715", "0.58299214", "0.576715", "0.5766734", "0.566574", "0.55925006", "0.559149...
0.70015216
0
Sets the instrument_id_type of this QuoteSeriesId.
def instrument_id_type(self, instrument_id_type): allowed_values = [None,"LusidInstrumentId", "Figi", "RIC", "QuotePermId", "Isin", "CurrencyPair", "ClientInternal", "Sedol", "Cusip"] # noqa: E501 if self.local_vars_configuration.client_side_validation and instrument_id_type not in allowed_values: # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_type(self, id_type):\n\n self._id_type = id_type", "def type_id(self, type_id):\n if type_id is None:\n raise ValueError(\"Invalid value for `type_id`, must not be `None`\")\n\n self._type_id = type_id", "def identifier_type(self, identifier_type):\n self._identifi...
[ "0.7232628", "0.65018576", "0.6447048", "0.6281578", "0.61472297", "0.6039474", "0.6032719", "0.5949014", "0.5932484", "0.5932484", "0.59108263", "0.58610237", "0.5860774", "0.5670331", "0.56138617", "0.56090164", "0.5546033", "0.55052215", "0.55052215", "0.55052215", "0.5505...
0.8050317
0
Sets the quote_type of this QuoteSeriesId.
def quote_type(self, quote_type): allowed_values = [None,"Price", "Spread", "Rate", "LogNormalVol", "NormalVol", "ParSpread", "IsdaSpread", "Upfront", "Index", "Ratio", "Delta", "PoolFactor"] # noqa: E501 if self.local_vars_configuration.client_side_validation and quote_type not in allowed_values: # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_quote_kind(self, quote_kind: QuoteKind):\n if quote_kind != self.quote_kind:\n self.quote_kind = quote_kind\n if self.geo is None:\n self.load_candles()\n else:\n self.geo.update(quote_kind=quote_kind)\n self.chart.redraw(...
[ "0.6272611", "0.5894381", "0.585228", "0.57743025", "0.57743025", "0.57674825", "0.55836105", "0.5559522", "0.5559522", "0.5559522", "0.5559522", "0.55181074", "0.5478835", "0.54692364", "0.5365564", "0.5340443", "0.5340443", "0.5340443", "0.5340443", "0.5340443", "0.5340443"...
0.75797933
0
Defines a list of coordinates to consider neighbors.
def define_neighbors(x: int, y: int, z: int) -> list: diffs = range(-1, 2) coords = [] # might need to add some if guards (if x > 0) (if x < len(blah) etc) xdiffs = (x + diff for diff in diffs) ydiffs = (y + diff for diff in diffs) zdiffs = (z + diff for diff in diffs) neighbors = product(xd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, x):\n pass", "def neighbors(self, coord):\n if not self.check_coord(coord):\n raise ValueError(\"Invalid coordinates\")\n x, y = coord\n n = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]\n ret = [c for c in n if self.check_coord(c)]\n\n ...
[ "0.7418102", "0.7229692", "0.72068447", "0.71410286", "0.7103896", "0.7096486", "0.70576566", "0.691093", "0.68926316", "0.6864414", "0.68611205", "0.685419", "0.6842417", "0.6837201", "0.6831657", "0.6794186", "0.679363", "0.6752783", "0.67450017", "0.6739434", "0.6675337", ...
0.72768927
1
Factory method for Mechanism; returns the type of mechanism specified or a default mechanism. If called with no arguments, returns the `default mechanism `. Arguments
def mechanism(mech_spec=None, params=None, context=None): # Called with a keyword if mech_spec in MechanismRegistry: return MechanismRegistry[mech_spec].mechanismSubclass(params=params, context=context) # Called with a string that is not in the Registry, so return default type with the name specif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n variable=None,\n params=None,\n name=None,\n prefs=None,\n context=None):\n\n # Forbid direct call to base class constructor\n if not isinstance(context, type(self)) and not kwValidate in context:\n ...
[ "0.5741221", "0.5434691", "0.53697497", "0.53344387", "0.5290686", "0.5281561", "0.51853085", "0.5178649", "0.51337963", "0.51319104", "0.5109797", "0.5094142", "0.50054866", "0.49880317", "0.49759454", "0.49759454", "0.49715793", "0.49620983", "0.49507004", "0.49353167", "0....
0.8268517
0
Add rather than override INPUT_STATES and/or OUTPUT_STATES Allows specification of INPUT_STATES or OUTPUT_STATES in params dictionary to be added to, rather than override those in paramClassDefaults (the default behavior)
def _filter_params(self, params): # INPUT_STATES: try: input_states_spec = params[INPUT_STATES] except KeyError: pass else: # Convert input_states_spec to list if it is not one if not isinstance(input_states_spec, list): in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_params(self, state_dicts):\n raise NotImplementedError", "def __call__(self, inputs, states, **kwargs):\n raise NotImplementedError()", "def load_state_dict(self, state_dict):\n own_state = self.state_dict()\n new_state = OrderedDict()\n for name, param in state_dict....
[ "0.64630955", "0.6062027", "0.60496604", "0.5760335", "0.5741909", "0.570772", "0.56517667", "0.56494284", "0.55282074", "0.5507505", "0.5502789", "0.54870814", "0.54785043", "0.544063", "0.5429442", "0.54287565", "0.5422423", "0.5397873", "0.5389292", "0.53798217", "0.536765...
0.76059157
0
validate TimeScale, INPUT_STATES, FUNCTION_PARAMS, OUTPUT_STATES and MONITOR_FOR_CONTROL
def _validate_params(self, request_set, target_set=None, context=None): # Perform first-pass validation in Function.__init__(): # - returns full set of params based on subclass paramClassDefaults super(Mechanism, self)._validate_params(request_set,target_set,context) params = target_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_processing_validate(cfg, app, win, events):", "def __check_inputs__(self):\n # | - __check_inputs__\n # #####################################################################\n stop_mode = self.stop_mode\n stop_num_generations = self.stop_num_generations\n # ##########...
[ "0.6713494", "0.6423591", "0.6374488", "0.6332665", "0.62544966", "0.61950964", "0.61750597", "0.6171884", "0.6162123", "0.6159163", "0.6152436", "0.6104958", "0.6092222", "0.60662305", "0.6036017", "0.60181445", "0.59977424", "0.59622264", "0.59588736", "0.5957072", "0.59514...
0.6468564
1
Call State._instantiate_input_states to instantiate orderedDict of inputState(s) This is a stub, implemented to allow Mechanism subclasses to override _instantiate_input_states
def _instantiate_input_states(self, context=None): from PsyNeuLink.Components.States.InputState import _instantiate_input_states _instantiate_input_states(owner=self, context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(StateInstantiation, self).__init__(*args, **kwds)\n # message fields cannot be None, assign default values for those that are\n if self.state_path is None:\n self.state_path = ''\n if self.state_class is None:\n self...
[ "0.6572184", "0.6553156", "0.6509993", "0.63697404", "0.6302613", "0.6276372", "0.61691505", "0.6134963", "0.6134963", "0.6125563", "0.60870796", "0.60617393", "0.5963223", "0.59394586", "0.593735", "0.5896586", "0.5886525", "0.5884756", "0.5863762", "0.58548564", "0.5840322"...
0.7393264
0
Call State._instantiate_parameter_states to instantiate a parameterStates for each parameter in user_params This is a stub, implemented to allow Mechanism subclasses to override _instantiate_parameter_states
def _instantiate_parameter_states(self, context=None): from PsyNeuLink.Components.States.ParameterState import _instantiate_parameter_states _instantiate_parameter_states(owner=self, context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user_params):\n self.ParseParameters(\n toggle_param_name=self._TOGGLE_PARAM,\n required_param_names=self._REQUIRED_PARAMS,\n optional_param_names=self._OPTIONAL_PARAMS,\n user_params=user_params)", "def set_params(self, state_dicts):\n ...
[ "0.63577443", "0.6197192", "0.6121723", "0.60824007", "0.5890091", "0.5702104", "0.5656338", "0.55621827", "0.5540772", "0.5516861", "0.54957217", "0.5488176", "0.5467186", "0.54659873", "0.5458149", "0.545528", "0.5446187", "0.5445284", "0.542465", "0.5403631", "0.53810585",...
0.73195183
0
Call State._instantiate_output_states to instantiate orderedDict of outputState(s) This is a stub, implemented to allow Mechanism subclasses to override _instantiate_output_states
def _instantiate_output_states(self, context=None): from PsyNeuLink.Components.States.OutputState import _instantiate_output_states _instantiate_output_states(owner=self, context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_output_states(self):\n for mech in self.terminalMechanisms.mechanisms:\n self.outputStates[mech.name] = mech.outputStates", "def init_output_dict(self):\n return {\n \"outputs\": torch.FloatTensor(),\n \"pred_probs\": torch.FloatTensor(),\n \"...
[ "0.661413", "0.615965", "0.6121957", "0.6087392", "0.5996337", "0.5966779", "0.5943477", "0.59083056", "0.590116", "0.58777857", "0.5782015", "0.57762533", "0.57592046", "0.5745391", "0.5730775", "0.5730775", "0.5689425", "0.5666847", "0.56508785", "0.563107", "0.56296754", ...
0.73715085
0
Add projection to specified state
def _add_projection_from_mechanism(self, receiver, state, projection, context=None): from PsyNeuLink.Components.Projections.Projection import _add_projection_from _add_projection_from(sender=self, state=state, projection_spec=projection, receiver=receiver, context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallel_projection(self, state):\n self.camera.parallel_projection = state\n self.Modified()", "def projection(self):\n pass", "def setCrsIsProjection(self):\n self.isgeographic = False", "def test_project(self):\n basis = self.Dummy()\n state = 5\n asser...
[ "0.65063393", "0.5794265", "0.55886", "0.551689", "0.5484942", "0.5446427", "0.53433836", "0.5326458", "0.5302247", "0.52575725", "0.5254479", "0.52378243", "0.5235828", "0.52268904", "0.5216963", "0.5197505", "0.51842076", "0.5154298", "0.51300246", "0.5101129", "0.5098088",...
0.62162536
1
Execute function for each outputState and assign result of each to corresponding item of self.outputValue
def _update_output_states(self, runtime_params=None, time_scale=None, context=None): for i in range(len(self.outputStates)): state = list(self.outputStates.values())[i] state.update(params=runtime_params, time_scale=time_scale, context=context) # self.outputValue[i] = state.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_output_states(self):\n for mech in self.terminalMechanisms.mechanisms:\n self.outputStates[mech.name] = mech.outputStates", "def __set_outputs__(self):\n self.__set_in_out_var__(None, 1)", "def outputStateValues(self):\n values = []\n for item in self.mechanis...
[ "0.67218447", "0.6400146", "0.63258046", "0.63037884", "0.62867457", "0.61272424", "0.6066108", "0.5995027", "0.5982473", "0.5972857", "0.5955611", "0.5936051", "0.5929208", "0.5926685", "0.59119964", "0.5906643", "0.58903944", "0.58846825", "0.5864265", "0.58555716", "0.5815...
0.6929011
0
Return dict with current value of each ParameterState in paramsCurrent
def _get_mechanism_param_values(self): from PsyNeuLink.Components.States.ParameterState import ParameterState return dict((param, value.value) for param, value in self.paramsCurrent.items() if isinstance(value, ParameterState) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self) -> Dict:\n state_dict = {}\n for param in self.optim_objs:\n param_name = pyro.get_param_store().param_name(param)\n state_dict[param_name] = _get_state_dict(self.optim_objs[param])\n return state_dict", "def _get_current_params(self):\n retur...
[ "0.7163409", "0.70638406", "0.6930823", "0.6792512", "0.678194", "0.67451435", "0.6702676", "0.6664253", "0.6624333", "0.6506222", "0.64265686", "0.641892", "0.6387138", "0.6354353", "0.63507247", "0.6341828", "0.63148063", "0.6303014", "0.6279106", "0.62353814", "0.6232896",...
0.7810785
0
Evaluate whether spec is a valid Mechanism specification
def _is_mechanism_spec(spec): if inspect.isclass(spec) and issubclass(spec, Mechanism): return True if isinstance(spec, Mechanism): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def satisfies(self, spec):\n if spec.is_abs and self.is_abs and self.path != spec.path:\n return False\n if spec.implementation is not None and spec.implementation.lower() != self.implementation.lower():\n return False\n if spec.architecture is not None and spec.architect...
[ "0.64936244", "0.62401366", "0.59179676", "0.57815427", "0.574602", "0.5699332", "0.5636195", "0.56295824", "0.56248266", "0.55786574", "0.55650556", "0.55578905", "0.5553887", "0.55463713", "0.5500796", "0.5500796", "0.5499033", "0.54248726", "0.54123193", "0.5409698", "0.53...
0.7282306
0
Return specified mechanism in MechanismList
def __getitem__(self, item): # return list(self.mech_tuples[item])[MECHANISM] return self.mech_tuples[item].mechanism
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mechanism(self):", "def mechanism(self):\n return self._config[\"sasl.mechanism\"]", "def mechanism(mech_spec=None, params=None, context=None):\n\n # Called with a keyword\n if mech_spec in MechanismRegistry:\n return MechanismRegistry[mech_spec].mechanismSubclass(params=params, context...
[ "0.65825075", "0.6185662", "0.6071519", "0.5876531", "0.5666677", "0.55671114", "0.55444735", "0.5027946", "0.50223094", "0.49115574", "0.4835837", "0.4697217", "0.4634386", "0.4627337", "0.4619326", "0.46091038", "0.46083066", "0.45971072", "0.45962238", "0.45860544", "0.455...
0.7015279
0
Return first mechanism tuple containing specified mechanism from the list of mech_tuples
def _get_tuple_for_mech(self, mech): if list(item.mechanism for item in self.mech_tuples).count(mech): if self.owner.verbosePref: print("PROGRAM ERROR: {} found in more than one mech_tuple in {} in {}". format(append_type_to_name(mech), self.__class__.__name__,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tuple_for_process(self, process):\n # FIX:\n # if list(item[MECHANISM] for item in self.mech_tuples).count(mech):\n # if self.owner.verbosePref:\n # print(\"PROGRAM ERROR: {} found in more than one mech_tuple in {} in {}\".\n # format(append_ty...
[ "0.6098379", "0.59788513", "0.5090942", "0.50808626", "0.5065904", "0.5063802", "0.49735767", "0.4960984", "0.4960984", "0.47289914", "0.46709287", "0.4653381", "0.4653381", "0.46489593", "0.46172774", "0.46143988", "0.4596028", "0.45947242", "0.4572531", "0.45490372", "0.452...
0.753147
0
Return list of mech_tuples sorted by mechanism name
def mech_tuples_sorted(self): return sorted(self.mech_tuples, key=lambda mech_tuple: mech_tuple[0].name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _toposort_with_ordered_mech_tuples(self, data):\n result = []\n for dependency_set in toposort(data):\n d_iter = iter(dependency_set)\n result.extend(sorted(dependency_set, key=lambda item : next(d_iter).mechanism.name))\n return result", "def process_tuples_sorted(...
[ "0.6864003", "0.6052932", "0.5644417", "0.5614844", "0.5578877", "0.54707015", "0.5399016", "0.5365707", "0.52200633", "0.52057385", "0.51932687", "0.51804656", "0.5163078", "0.5157249", "0.51540923", "0.5145842", "0.51417196", "0.51395947", "0.51385456", "0.5123252", "0.5119...
0.8169331
0
Return list of all mechanisms in MechanismList
def mechanisms(self): return list(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mechanisms(self):\n return self._allMechanisms.mechanisms", "def all_mechanism_types():\n global _mechtype_cache\n if _mechtype_cache is None:\n _mechtype_cache = collections.OrderedDict()\n mname = neuron.h.ref('')\n # Iterate over two mechanism types (distributed, point/ar...
[ "0.7457537", "0.6442857", "0.64399815", "0.6387835", "0.63475055", "0.57350904", "0.563451", "0.55697984", "0.556451", "0.55643797", "0.55007714", "0.54672724", "0.5466031", "0.5441859", "0.5441859", "0.54243684", "0.54232997", "0.54208225", "0.54185826", "0.5391006", "0.5389...
0.8228584
0
Return names of all mechanisms in MechanismList
def names(self): return list(item.name for item in self.mechanisms)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mechanisms(self):\n return list(self)", "def mechanisms(self):\n return self._allMechanisms.mechanisms", "def all_mechanism_types():\n global _mechtype_cache\n if _mechtype_cache is None:\n _mechtype_cache = collections.OrderedDict()\n mname = neuron.h.ref('')\n # I...
[ "0.7161391", "0.7059877", "0.62531763", "0.61171705", "0.61171705", "0.605576", "0.605576", "0.60354906", "0.59550285", "0.5927225", "0.59185094", "0.5845466", "0.5844643", "0.58219707", "0.57987136", "0.572241", "0.5700778", "0.5663072", "0.564435", "0.56276786", "0.5585007"...
0.7593656
0
Return values of all mechanisms in MechanismList
def values(self): return list(item.value for item in self.mechanisms)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mechanisms(self):\n return list(self)", "def mechanisms(self):\n return self._allMechanisms.mechanisms", "def all_mechanism_types():\n global _mechtype_cache\n if _mechtype_cache is None:\n _mechtype_cache = collections.OrderedDict()\n mname = neuron.h.ref('')\n # I...
[ "0.77822113", "0.72421145", "0.6594636", "0.6244238", "0.62421274", "0.6206884", "0.59909046", "0.5811207", "0.56841445", "0.56830424", "0.56811684", "0.56572896", "0.56133693", "0.55849606", "0.5560125", "0.55568486", "0.5521477", "0.55109787", "0.54702985", "0.5464897", "0....
0.7669883
1
Return names of all outputStates for all mechanisms in MechanismList
def outputStateNames(self): names = [] for item in self.mechanisms: for output_state in item.outputStates: names.append(output_state) return names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputStateValues(self):\n values = []\n for item in self.mechanisms:\n for output_state_name, output_state in list(item.outputStates.items()):\n values.append(output_state.value)\n return values", "def _assign_output_states(self):\n for mech in self.term...
[ "0.7530865", "0.70368683", "0.66437596", "0.6507888", "0.64815927", "0.6261194", "0.618265", "0.6167137", "0.61004376", "0.6096525", "0.6073762", "0.6020162", "0.5990912", "0.5978331", "0.5945884", "0.5944969", "0.5890002", "0.58796084", "0.587672", "0.58669186", "0.5857786",...
0.8376996
0
Return values of outputStates for all mechanisms in MechanismList
def outputStateValues(self): values = [] for item in self.mechanisms: for output_state_name, output_state in list(item.outputStates.items()): values.append(output_state.value) return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_output_states(self):\n for mech in self.terminalMechanisms.mechanisms:\n self.outputStates[mech.name] = mech.outputStates", "def outputStateNames(self):\n names = []\n for item in self.mechanisms:\n for output_state in item.outputStates:\n nam...
[ "0.7471102", "0.7393028", "0.6943229", "0.6363082", "0.6308046", "0.6297066", "0.62822974", "0.6233221", "0.61901164", "0.6188034", "0.61457056", "0.61176836", "0.6104881", "0.60902965", "0.6057253", "0.6047594", "0.60425544", "0.6013339", "0.59914774", "0.5939767", "0.593849...
0.813667
0
test that the hexagonal number generator generates hexagonal numbers, as expected.
def test_generation(self): generator = math_helpers.hexagonal_number_generator() first_ten_hex_numbers = [next(generator) for _ in range(10)] canonical_values = [1, 6, 15, 28, 45, 66, 91, 120, 153, 190] self.assertEqual(canonical_values, first_ten_hex_numbers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hexamethylcyclohexane(self):\n def draw(image: ShapeImage):\n image.add_regular_hexagon(\n 100, start_coord=(400, 400)\n )\n image.add_line((487, 350), (487, 250))\n image.add_line((574, 400), (661, 350))\n image.add_line((574, 5...
[ "0.70229656", "0.6910454", "0.67191875", "0.66082317", "0.6522414", "0.6509602", "0.64584404", "0.63799065", "0.6312566", "0.62936777", "0.62752265", "0.62654024", "0.6260626", "0.6257527", "0.6133599", "0.6133188", "0.6108747", "0.60841763", "0.599618", "0.5921129", "0.59114...
0.8259293
0
test that the pentagonal number generator generates pentagonal numbers, as expected.
def test_generation(self): generator = math_helpers.pentagonal_number_generator() first_ten_pentagonal_numbers = [next(generator) for _ in range(10)] canonical_values = [1, 5, 12, 22, 35, 51, 70, 92, 117, 145] self.assertEqual(canonical_values, first_ten_pentagonal_numbers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_pentagonal(self):\n generator = math_helpers.pentagonal_number_generator()\n pents = set(next(generator) for _ in range(1000))\n non_pentagonals = set(x for x in range(max(pents)) if x not in pents)\n any_pentagonals = any(map(lambda x: math_helpers.is_pentagonal(x), non_pe...
[ "0.74531734", "0.7395402", "0.71977144", "0.6693339", "0.6635609", "0.6610927", "0.6543196", "0.65372956", "0.6495699", "0.6472204", "0.64258176", "0.64011145", "0.62475634", "0.6194243", "0.60921097", "0.6078972", "0.6033385", "0.60184103", "0.5992109", "0.5987961", "0.59840...
0.7832997
0
test that the first thousand pentagonal numbers are identified as such.
def test_first_thousand_pentagonal_numbers(self): generator = math_helpers.pentagonal_number_generator() first_thousand_pentagonal_numbers = [next(generator) for _ in range(1000)] all_pentagonal = all(map(lambda x: math_helpers.is_pentagonal(x), first_thousand_pentagonal_numbers)) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def istele(number):\n if number[:3] == '140':\n return True\n return False", "def test_nth_digit_of_fractional_part(self):\n\t\tcounter = 1\n\t\tfor digit in generate_digits(13):\n\t\t\tif counter == 1 or counter == 10 or counter == 12:\n\t\t\t\tself.assertEqual(1, digit)\n\t\t\n\t\t\tcounter += 1",...
[ "0.62571967", "0.59747773", "0.59705544", "0.5876851", "0.58684933", "0.5842661", "0.5808757", "0.57252103", "0.5721397", "0.56414974", "0.563688", "0.5632761", "0.55704457", "0.55383325", "0.55375504", "0.5511389", "0.550329", "0.5498879", "0.54719704", "0.5465385", "0.54608...
0.7510158
0
test that even large pentagonal numbers are correctly identified as such (i.e. check whether we might expect to run into floatingpoint error)
def test_very_large_pentagonal_numbers(self): large_n = [x**9 for x in range(10000,10500)] pentagonals = [(n * (3 * n - 1)) // 2 for n in large_n] all_pentagonal = all(map(lambda x: math_helpers.is_pentagonal(x), pentagonals)) self.assertEqual(all_pentagonal, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_pentagonal(self):\n generator = math_helpers.pentagonal_number_generator()\n pents = set(next(generator) for _ in range(1000))\n non_pentagonals = set(x for x in range(max(pents)) if x not in pents)\n any_pentagonals = any(map(lambda x: math_helpers.is_pentagonal(x), non_pe...
[ "0.7146114", "0.6994994", "0.69625324", "0.69192934", "0.68733996", "0.67430663", "0.67230994", "0.6540389", "0.6376136", "0.62863314", "0.62853134", "0.62769395", "0.6264355", "0.6264355", "0.6261929", "0.6246477", "0.6208479", "0.61807215", "0.617333", "0.6156477", "0.61531...
0.7652133
0
test some nonpentagonal numbers, make sure they don't show up as pentagonal.
def test_not_pentagonal(self): generator = math_helpers.pentagonal_number_generator() pents = set(next(generator) for _ in range(1000)) non_pentagonals = set(x for x in range(max(pents)) if x not in pents) any_pentagonals = any(map(lambda x: math_helpers.is_pentagonal(x), non_pentagonals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pentagonal(n):\n if (1+(24*n+1)**0.5) % 6 == 0:\n return True\n return False", "def is_pentagonal(n):\r\n if ((1+(24*n+1)**0.5) / 6)%1 == 0:\r\n return True\r\n return False", "def test_very_large_pentagonal_numbers(self):\n large_n = [x**9 for x in range(10000,10500)]\n...
[ "0.7697014", "0.766817", "0.7655574", "0.74935836", "0.74237895", "0.72347325", "0.72115386", "0.7103618", "0.69874036", "0.69399244", "0.66400045", "0.65678006", "0.6297902", "0.6223127", "0.59932196", "0.59665614", "0.5896299", "0.58934504", "0.58915144", "0.5882717", "0.58...
0.8459626
0