query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Load of the queue widgets into QGIS
def Queues(self): if not self._queues: queues = AimsQueueWidget(self.iface.mainWindow()) self._dockWindow = DockWindow(self.iface.mainWindow(),queues,"AimsQueues","Aims Queues") self._queues = queues self._dockWindow.unloadPlugin.connect(self.unload) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadQueues( self ):\n queues = self.Queues()\n if not queues.isVisible():\n queues.parent().show()", "def initGui(self):\n\n # set srs\n self._displayCrs = QgsCoordinateReferenceSystem()\n self._displayCrs.createFromOgcWmsCrs('EPSG:4167') \n self.iface.map...
[ "0.6825356", "0.64986914", "0.64414537", "0.61414856", "0.6099628", "0.60929966", "0.60136247", "0.59926194", "0.59847957", "0.5973503", "0.59125465", "0.5899035", "0.5886042", "0.58763236", "0.5862038", "0.58405805", "0.58287394", "0.5811405", "0.5809613", "0.579309", "0.578...
0.6401524
3
Start the Data Manager only once the user enables the Plugin
def startDM(self): self.uidm.startDM()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startManager(self):\n\t\tlogging.info(\"----->>>The DeviceDataManager will be started\")\n\t\tself.sysPerfManager.startManager()\n\t\tself.sensorAdapterManager.startManager()\n\t\tif self.enableRedis:\n\t\t\tself.redisClient.connectClient()\n\t\t\n\t\tif self.enableMqtt:\n\t\t\tself.mqttClient.connectClient()"...
[ "0.6325973", "0.62396085", "0.61796075", "0.60785794", "0.60785794", "0.60785794", "0.60785794", "0.60785794", "0.60785794", "0.60785794", "0.60785794", "0.60226977", "0.60226977", "0.60048974", "0.5926709", "0.5925948", "0.590267", "0.588879", "0.58218265", "0.58185536", "0....
0.54009974
95
Due to problems reloading the plugin and configuring once the plugin is running, the option to alter the configuration is removed once running. The user must configure prior to loading the plugin
def disableConfig(self): self._configdialog.setEnabled(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_config(self):\n pass", "def configure(self, options, conf):", "def configure(self):\r\n pass", "def configure(self) -> None:", "def configure(self):", "def configure(self):", "def configure(self):", "def configure(self):", "def configure(self):\n pass", "def config...
[ "0.67500955", "0.66955775", "0.6669793", "0.66473037", "0.6607928", "0.6607928", "0.6607928", "0.6607928", "0.6604924", "0.6604924", "0.65339464", "0.65292645", "0.6526727", "0.64767134", "0.64493877", "0.64451873", "0.64063466", "0.63903636", "0.6359761", "0.6352427", "0.634...
0.0
-1
enable tools that are dependent on the Address Layer only when the address layer exists
def enableAddressLayer(self): self._deladdressaction.setEnabled(True) self._createnewaddressaction.setEnabled(True) self._moveaddressaction.setEnabled(True) self._updateaddressaction.setEnabled(True) self._highlightaction.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startNewAddressTool(self):\n self.iface.mapCanvas().setMapTool(self._createnewaddresstool)\n self._createnewaddresstool.setEnabled(True)", "def startUpdateAddressTool(self):\n\n self.iface.mapCanvas().setMapTool(self._updateaddtool)\n self._updateaddtool.setEnabled(True)", "def ...
[ "0.6397762", "0.6317302", "0.62492037", "0.5946098", "0.5643869", "0.5643869", "0.5643869", "0.5643869", "0.5431085", "0.5409157", "0.53970134", "0.52877194", "0.5281901", "0.52637166", "0.5215913", "0.51913553", "0.51730245", "0.5157076", "0.513665", "0.51271325", "0.5119784...
0.63172174
2
Track the current maptool (excluding rcl tool) to allow for rollback to previous tool when the Rcltool is deactivated
def mapToolChanged(self): if (isinstance(self.iface.mapCanvas().mapTool(), GetRcl) == False and isinstance(self.iface.mapCanvas().mapTool(), UpdateReviewPosition) == False): self._currentMapTool = self.iface.mapCanvas().mapTool() #self.highlighter.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPreviousMapTool(self):\n if self.iface.mapCanvas().mapTool() != self._currentMapTool:\n self.iface.mapCanvas().setMapTool(self._currentMapTool)", "def set_current_tool_to_none(self):\n\n self.variables.active_tool = None\n self.variables.current_tool = None", "def set_act...
[ "0.6610602", "0.6047771", "0.5808479", "0.5766622", "0.5683215", "0.5666312", "0.5622825", "0.55997235", "0.5575052", "0.53866893", "0.53748834", "0.53327566", "0.53001404", "0.5243126", "0.5231501", "0.51420516", "0.50829107", "0.50697356", "0.50646985", "0.5024823", "0.5017...
0.6357746
1
Roll back to the previous maptool
def setPreviousMapTool(self): if self.iface.mapCanvas().mapTool() != self._currentMapTool: self.iface.mapCanvas().setMapTool(self._currentMapTool)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback(self, mapset=None):\n if mapset is None:\n mapset = self.current_mapset", "def rollback(self):\n pass", "def restore_last_undo_point(self):\n self.unload()", "def resetTool(*args, **kwargs)->None:\n pass", "def _revert(self):\n self.release_from_outpu...
[ "0.66519207", "0.63949555", "0.61096495", "0.6086316", "0.6046814", "0.6029025", "0.601352", "0.6011927", "0.59067875", "0.589292", "0.589292", "0.589292", "0.5890216", "0.5872236", "0.5859716", "0.583847", "0.58294845", "0.5820746", "0.58008325", "0.5768287", "0.57375896", ...
0.57408303
20
Enable the 'configure aims' dialog
def configureAims(self): self._config_ui.showDialog()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self):\n self.SetInteractive(1)", "def configure(self):\n dlg = ConfigureDialog(QtGui.QApplication.activeWindow().currentWidget())\n dlg.identifierOccursCount = self._identifierOccursCount\n\n if dlg.exec_():\n self._config = dlg.getConfig()\n dlg.setConfi...
[ "0.6400439", "0.6159485", "0.6057136", "0.60529816", "0.6036737", "0.5965732", "0.59589297", "0.58659977", "0.5775678", "0.57545274", "0.5744145", "0.57255495", "0.5702786", "0.5681207", "0.56680506", "0.56298286", "0.5622051", "0.5619457", "0.5604328", "0.5602475", "0.559994...
0.81929576
0
Enable the 'create new address' map tool
def startNewAddressTool(self): self.iface.mapCanvas().setMapTool(self._createnewaddresstool) self._createnewaddresstool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startUpdateAddressTool(self):\n\n self.iface.mapCanvas().setMapTool(self._updateaddtool)\n self._updateaddtool.setEnabled(True)", "def startMoveAddressTool(self):\n\n self.iface.mapCanvas().setMapTool(self._moveaddtool)\n self._moveaddtool.setEnabled(True)", "def new_map(self):\...
[ "0.7219506", "0.7039836", "0.6763633", "0.6633369", "0.65668374", "0.59695303", "0.59218526", "0.58349395", "0.5776906", "0.5717231", "0.57104254", "0.5676744", "0.56628376", "0.5605186", "0.55983114", "0.549823", "0.5495299", "0.5492283", "0.5473432", "0.54679406", "0.545776...
0.84176415
0
Enable the 'get rcl tool' map tool
def startRclTool(self, parent = None): self.rclParent = parent self.iface.mapCanvas().setMapTool(self._rcltool) self._rcltool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onMapToolActivated(self, e):\n pass", "def mapToolChanged(self):\n \n if (isinstance(self.iface.mapCanvas().mapTool(), GetRcl) == False and\n isinstance(self.iface.mapCanvas().mapTool(), UpdateReviewPosition) == False): \n self._currentMapTool = sel...
[ "0.6035034", "0.59180385", "0.5910891", "0.5775591", "0.570419", "0.5659089", "0.5643911", "0.5594283", "0.55799174", "0.5391594", "0.5363833", "0.53254557", "0.531566", "0.5236203", "0.5193972", "0.51902187", "0.518054", "0.5168814", "0.5163724", "0.5154438", "0.51030445", ...
0.60152096
1
Enable the 'get update Review position tool' map tool
def startUpdateReviewPosTool(self, revItem = None): self.currentRevItem = revItem self.iface.mapCanvas().setMapTool(self._updateReviewPos) self._rcltool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapToolChanged(self):\n \n if (isinstance(self.iface.mapCanvas().mapTool(), GetRcl) == False and\n isinstance(self.iface.mapCanvas().mapTool(), UpdateReviewPosition) == False): \n self._currentMapTool = self.iface.mapCanvas().mapTool()\n #self.hig...
[ "0.6898773", "0.6807094", "0.6599226", "0.62207574", "0.61673176", "0.6149542", "0.5958839", "0.58545905", "0.57583255", "0.57081556", "0.5629216", "0.5621588", "0.5572837", "0.55716854", "0.5395851", "0.5385057", "0.5360681", "0.53506345", "0.5344912", "0.5344672", "0.534018...
0.60526603
6
Enable the 'move address' map tool
def startMoveAddressTool(self): self.iface.mapCanvas().setMapTool(self._moveaddtool) self._moveaddtool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startNewAddressTool(self):\n self.iface.mapCanvas().setMapTool(self._createnewaddresstool)\n self._createnewaddresstool.setEnabled(True)", "def enableAddressLayer(self):\n\n self._deladdressaction.setEnabled(True)\n self._createnewaddressaction.setEnabled(True)\n self._move...
[ "0.70482296", "0.6882556", "0.6680604", "0.6600201", "0.6302381", "0.6076492", "0.5613634", "0.5609297", "0.5577446", "0.5559024", "0.5549096", "0.5530175", "0.5403303", "0.53529227", "0.5299035", "0.52719486", "0.52694035", "0.5255019", "0.523649", "0.52247787", "0.52008283"...
0.802022
0
Enable the "update address" map tool
def startUpdateAddressTool(self): self.iface.mapCanvas().setMapTool(self._updateaddtool) self._updateaddtool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startNewAddressTool(self):\n self.iface.mapCanvas().setMapTool(self._createnewaddresstool)\n self._createnewaddresstool.setEnabled(True)", "def enableAddressLayer(self):\n\n self._deladdressaction.setEnabled(True)\n self._createnewaddressaction.setEnabled(True)\n self._move...
[ "0.731475", "0.68513423", "0.65981966", "0.63955295", "0.5972027", "0.5911757", "0.5825655", "0.5821094", "0.5787878", "0.5732821", "0.5685454", "0.5596522", "0.5579056", "0.556285", "0.5560578", "0.55568826", "0.5414187", "0.5379938", "0.53794837", "0.53684026", "0.5366601",...
0.8050349
0
Enable the "delete address" map tool
def startDelAddressTool(self): self.iface.mapCanvas().setMapTool(self._deladdtool) self._deladdtool.setEnabled(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erase_address(self):\n self.remove_pointer_or_layer()\n if self.geocoder_source_model is not None:\n self.geocoder_source_model.clear()\n if self.dlg.geocoder_search is not None:\n self.dlg.geocoder_search.clear()\n if self.toolbar_search is not None:\n ...
[ "0.6550085", "0.6467427", "0.6311727", "0.62195885", "0.6132217", "0.61023366", "0.60953397", "0.60527706", "0.5956514", "0.5815314", "0.57877815", "0.5704363", "0.56430364", "0.5642785", "0.5599457", "0.5550336", "0.5488163", "0.54792076", "0.5436945", "0.54259276", "0.53910...
0.7489834
0
Remove Plugins UI Elements From QGIS
def unload(self): self._layerManager.disconnectExtentEvent() if self._queues: self._queues.close() self._queues = None self.uidm.killDm() self.iface.mainWindow().removeToolBar(self._toolbar) self.iface.removeToolBarIcon(self._loadaction) self.ifa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unload(self):\n \n ImajnetLog.info(\"** UNLOAD QGisImajnetPlugin\")\n\n if self.pluginIsActive:\n self.onClosePlugin(False)\n \n for action in self.actions:\n self.iface.removePluginWebMenu(\n self.tr(u'&Imajnet'),\n act...
[ "0.68107015", "0.67886394", "0.67092305", "0.6709", "0.67069304", "0.6686318", "0.66338986", "0.66202736", "0.66201824", "0.6592137", "0.6585883", "0.655749", "0.654264", "0.6527813", "0.6521251", "0.6518538", "0.6468899", "0.6466132", "0.64427376", "0.64320093", "0.64218587"...
0.6038854
38
Review data changed, update review layer and table
def rDataChanged(self): self._queues.uResolutionTab.refreshData() self._layerManager.updateReviewLayer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(self, info, id, input):\n user = info.context.user\n\n model, node_id = from_global_id(id)\n try:\n data_review = DataReview.objects.get(pk=node_id)\n except DataReview.DoesNotExist:\n raise GraphQLError(\"DataReview was not found\")\n\n # Check p...
[ "0.6250439", "0.59114504", "0.5905991", "0.58744705", "0.57848674", "0.5783843", "0.5747949", "0.5709248", "0.5637344", "0.5614386", "0.56124216", "0.558743", "0.55666566", "0.5545397", "0.55370015", "0.55307335", "0.550496", "0.5492444", "0.5486151", "0.54773945", "0.5464195...
0.6456079
0
Feature data changed, update review layer and table
def fDataChanged(self): self._layerManager.getAimsFeatures()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rDataChanged(self):\n\n self._queues.uResolutionTab.refreshData()\n self._layerManager.updateReviewLayer()", "def updateAttributesAfterAdding(self):\n layer = self.sender()\n while self.addedFeatures:\n featureId = self.addedFeatures.pop()\n #begining the edi...
[ "0.6235317", "0.60541224", "0.6049854", "0.57644933", "0.56803846", "0.5665546", "0.5665546", "0.56608504", "0.559064", "0.55822855", "0.5540997", "0.5530786", "0.55232674", "0.55232483", "0.5520127", "0.54641056", "0.5430033", "0.5420449", "0.54120576", "0.54066986", "0.5397...
0.6226966
1
Return instance of the Controller
def instance(): if Controller._instance == None: Controller._instance = Controller() return Controller._instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller( self ):\n\t\ttry:\n\t\t\treturn self._controller\n\t\texcept Exception as e:\n\t\t\tself.logToConsole( \"controller: %s\" % str(e) )", "def create_controller() -> Controller:\n _controller = Controller()\n return _controller", "def _get_controller(self):\n return self.__controller", ...
[ "0.79567254", "0.7908007", "0.788236", "0.7821275", "0.7791155", "0.7606602", "0.73090816", "0.7151729", "0.66534436", "0.6500115", "0.64955103", "0.6494055", "0.64003295", "0.6300476", "0.62928957", "0.6199271", "0.6160714", "0.6128002", "0.61126775", "0.6013205", "0.5929797...
0.83611196
0
Searches entries in LDAP.
def search_from_ldap(conn, base, scope=ldap.SCOPE_BASE, filterstr="(objectClass=*)", attrlist=None, attrsonly=0): try: result = conn.search_s(base, scope) ret = result[0] except ldap.NO_SUCH_OBJECT: ret = ("", {},) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_search(self, ldapfilter):\n # Determine the scope value\n if self.args.recursive:\n scope = ldap.SCOPE_SUBTREE\n else:\n scope = ldap.SCOPE_ONELEVEL\n \n # Search ldap for results\n try:\n self.searchresult = self.ldapobj.search_s(self...
[ "0.7578374", "0.72124135", "0.71250767", "0.6938553", "0.6875933", "0.6797734", "0.6741676", "0.66584826", "0.63358796", "0.62970775", "0.62518626", "0.62087023", "0.6083377", "0.6035152", "0.59834754", "0.5945353", "0.58633006", "0.5857559", "0.5854493", "0.58153236", "0.579...
0.67688143
6
Gather many HTTP call made async
async def run(users): async with aiohttp.ClientSession() as session: tasks = [] for user in users: tasks.append( TornAPI.fetch_torn_user_data( session, user.params, user.id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def run_requests(self):\n loop = asyncio.get_event_loop()\n tasks = []\n async with aiohttp.ClientSession(connector=self.connector) as session:\n\n for index, id in enumerate(self.ids):\n if id not in self.processed_ids:\n url = self.base_url ...
[ "0.7323078", "0.69803554", "0.69192135", "0.68714285", "0.68630415", "0.6749683", "0.66467226", "0.6620924", "0.658006", "0.6534733", "0.6530346", "0.6517283", "0.63778806", "0.636628", "0.62896025", "0.62821156", "0.6238751", "0.61890155", "0.6162785", "0.61416656", "0.61216...
0.6315403
14
Read data with features and create dataframe with information.
def create_output_filenames(input_file, output_folder, method): # Create output folder if os.path.exists(output_folder): os.system('rm -rf %s' % output_folder) os.makedirs(output_folder, exist_ok=True) os.chdir(output_folder) # Create output filenames screen_name = '%s_%s' % (input_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataframe_for_training(data):\n feature_column_name = 'X'\n #data_cp = data[['label']].copy()\n for i, row in tqdm(data.iterrows(), total=len(data)):\n all_features = f'{row.claimant} {row.claim} {row.article_content}'\n data.loc[i, feature_column_name] = all_features\n\n retur...
[ "0.72818357", "0.70350075", "0.6846047", "0.67715937", "0.67710847", "0.6743549", "0.6727138", "0.6570921", "0.65569043", "0.65353185", "0.6531053", "0.6512847", "0.6483446", "0.6477788", "0.6444555", "0.6426078", "0.6421392", "0.63999", "0.63460165", "0.6320502", "0.6299188"...
0.0
-1
Open and write to the log file
def log_write(log_f, text, action='a'): f = open(log_f, action) f.write(text) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_to_file(self, message):\n if self.log is not None:\n message = \"[%s] %s\" % (datetime.datetime.utcnow().strftime('%H:%M:%S'), message)\n self.log.write(\"%s\\n\" % (message,))\n self.log.flush()\n print message", "def create_log_file(path):\n wi...
[ "0.77165127", "0.7496576", "0.7493469", "0.740579", "0.73121864", "0.7169272", "0.71224487", "0.70322204", "0.7023049", "0.7012907", "0.69566447", "0.6947546", "0.69442004", "0.69372445", "0.6931374", "0.6907031", "0.6872325", "0.68370783", "0.6835948", "0.68103623", "0.68003...
0.6913625
15
The WT strain IDs matched with WT ORFs
def wt_strains(df): ts_plates = [] dma_plates = [] for plate in df.Plate.unique(): if ('_26C_' in plate) or ('_37C_' in plate): ts_plates.append(plate) else: dma_plates.append(plate) wt_strain_ids_dma = df[(df['ORF'].isin(['YOR202W'])) & ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_otus_from_otu_table_ids(self):\r\n otu_table = parse_biom_table_str(dense_otu_table1)\r\n filtered_otu_table = filter_otus_from_otu_table(otu_table,\r\n set(otu_table.ObservationIds) - set(['34', '155', '152']), 0, inf, 0, inf)\r\...
[ "0.5487055", "0.5474353", "0.54263955", "0.52766407", "0.5237478", "0.5204371", "0.508735", "0.50703365", "0.5059241", "0.50212437", "0.5014215", "0.50075287", "0.49974915", "0.4996851", "0.4983923", "0.49771553", "0.4968982", "0.49651924", "0.49472168", "0.49351105", "0.4927...
0.6810067
0
Read data with features and create dataframe with information.
def read_input_data(input_f, features_file, output): print('\n Reading input...') log_write(output['log'], 'Input file: %s\n' % input_f, 'w+') # Read input data df = pd.read_csv(input_f, low_memory=False) df = df.astype({'Column': int, 'Row': int, 'ImageNum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataframe_for_training(data):\n feature_column_name = 'X'\n #data_cp = data[['label']].copy()\n for i, row in tqdm(data.iterrows(), total=len(data)):\n all_features = f'{row.claimant} {row.claim} {row.article_content}'\n data.loc[i, feature_column_name] = all_features\n\n retur...
[ "0.72818357", "0.70350075", "0.6846047", "0.67715937", "0.67710847", "0.6743549", "0.6727138", "0.6570921", "0.65569043", "0.6531053", "0.6512847", "0.6483446", "0.6477788", "0.6444555", "0.6426078", "0.6421392", "0.63999", "0.63460165", "0.6320502", "0.6299188", "0.6290497",...
0.65353185
9
Outlier Detection with Mahalanobis Distance Method.
def outlier_detection(df, method, wt, features, output): print('\n Detecting outliers...') start_time = time.time() # Model wt morphology wt_data = df[df['Strain ID'].isin(wt)][features].values # Create a subset with only WT cells and fit the model if method == 'GMM': gmm = mixture....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MahalanobisOutliers(featMatProjected, extremeness=2., showplot=True):\n # NB: Euclidean distance puts more weight than it should on correlated variables\n # Chicken and egg situation, we can’t know they are outliers until we calculate \n # the stats of the distribution, but the stats of the distributi...
[ "0.6984684", "0.6515336", "0.6263613", "0.6187706", "0.6028466", "0.600878", "0.59888786", "0.5946161", "0.5898555", "0.58214605", "0.5808384", "0.58005", "0.57199794", "0.5709858", "0.56994855", "0.5677547", "0.56032544", "0.55887216", "0.5580992", "0.5574399", "0.554997", ...
0.58291215
9
Plot data with inoutlier information using the first 2 PCs
def plot_in_outliers(data, mask, output): oc = 'lightskyblue' ic = 'navy' plt.figure(figsize=(15, 18)) sns.set_style('white') x_all = pd.DataFrame({'PC1': data[:, 0], 'PC2': data[:, 1]}) x_inliers = pd.DataFrame({'PC1': data[mask == 0, 0], 'PC2': data[mask == 0, 1]}) x_outliers = pd.DataFra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotOutlier(data_dict, feature_x, feature_y):\n data = featureFormat(data_dict, [feature_x, feature_y, 'poi'])\n for point in data:\n x = point[0]\n y = point[1]\n poi = point[2]\n if poi:\n color = 'red'\n else:\n color = 'blue'\n plt.scatt...
[ "0.6546934", "0.6507884", "0.64871204", "0.6229395", "0.6091009", "0.58001107", "0.5764339", "0.57519376", "0.57438624", "0.5653837", "0.56201476", "0.56173015", "0.55946594", "0.5585635", "0.5563802", "0.5529469", "0.55118716", "0.5480892", "0.5454786", "0.5449976", "0.54473...
0.7036596
0
Calculate the maximum difference in percentage between mutant and wt populations on cumulative distribution of score as an estimate for penetrance
def estimate_penetrance(wt, mut): # Find the maximum difference between two CDFs maxx = 0 for i in range(len(wt)): diff = wt[i]-mut[i] if diff > maxx: maxx = diff return maxx * 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_drift_score(ref_col_prob, col_prob):\n\n return sum(abs(np.asarray(ref_col_prob) - np.array(col_prob)) * 100)", "def mutual_info_score(self):\n _, _, I_CK = self._entropies()\n return I_CK / self.grand_total", "def grade(population, target_sum, target_mult):\r\n summed = reduce(ad...
[ "0.6367103", "0.63137776", "0.624538", "0.61520624", "0.6144295", "0.6119892", "0.6105903", "0.60700804", "0.6008827", "0.59998465", "0.59672254", "0.5960492", "0.5921287", "0.5896108", "0.58913654", "0.58866644", "0.5866073", "0.5849949", "0.58120936", "0.5789974", "0.577659...
0.72945195
0
Estimate penetrance for the group
def calculate_penetrace_per_group(df, group_features, neg): # Group information info = list(df[group_features].drop_duplicates().values[0]) num_cells = df.shape[0] info.append(num_cells) # Calculate penetrance penetrance = np.nan ks_penetrance = np.nan wt_percentile = np.nan mut_sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pie_chart_score(self, grouped):\n picked_scenario = self.scenario_dict[\"%d\" % (self.scenario_num-1)]\n distinct_enum_X = self.data_dict[picked_scenario[\"X\"]]['distinct_enum']\n score = 0\n if min(grouped) < 0:\n score = 0\n elif distinct_enum_X == 1:\n ...
[ "0.5930809", "0.5871412", "0.57584465", "0.570286", "0.56643695", "0.56087494", "0.5525248", "0.550499", "0.5489124", "0.5488275", "0.5467969", "0.5459607", "0.5425661", "0.54031116", "0.53869504", "0.5381044", "0.5365898", "0.5334589", "0.53107226", "0.52837145", "0.52837145...
0.6121099
0
Prepare the output files with penetrance estimations
def prepare_output_results(df, cell_features, pop_features, pop_type, neg, output): print('\n Calculating penetrance values per %s...' % pop_type) # Initialize output file columns = pop_features + ['Num_cells', 'Penetrance', 'KS_Penetrance', 'WT_percentile_at_threshold'] df_output = pd.DataFrame(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_output_files(self):\r\n if not self.C.restart:\r\n print(\"* Touching output files.\", flush=True)\r\n # begin writing `generation.csv` file\r\n csv_path_and_filename = self.C.job_dir + \"generation.csv\"\r\n util.properties_to_csv(\r\n ...
[ "0.63686013", "0.6325922", "0.6170364", "0.61561066", "0.61384374", "0.6063473", "0.6040741", "0.6021471", "0.60086155", "0.59537876", "0.5953476", "0.5935497", "0.5882352", "0.5881769", "0.5862629", "0.5853274", "0.58269155", "0.58128333", "0.58001506", "0.57809675", "0.5771...
0.5423263
81
Prepare the output file with average WT penetrance per plate
def prepare_wt_penetrance_results(df, neg, output): df_output = pd.DataFrame(columns=['Plate', 'Sum - Num_cells', 'Penetrance', 'KS_Penetrance']) plates = sorted(df.Plate.unique()) this_row = 0 for plate in plates: df_p = df[(df['Plate'] == plate) & (df['Strain ID'].isin(neg))] df_p = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pre(df, df_rain, df_runoff, df_sm, watershed):\n\n df_xy = pd.read_csv(os.path.join(os.path.dirname(__file__), 'Lucky_hills_input_data', 'WGEW_gauge_locations.csv'))\n\n avgsm = df_sm.sm5.mean()\n\n for preName in df.preName:\n\n print(f'create .pre file for event {preName}')\n\n d...
[ "0.6286624", "0.5683134", "0.5586905", "0.5525071", "0.552144", "0.5507411", "0.5504974", "0.5461099", "0.54522216", "0.5407216", "0.53955317", "0.5394013", "0.5390017", "0.53712225", "0.53609866", "0.535998", "0.53588486", "0.53359824", "0.53238076", "0.5320318", "0.5318068"...
0.6270066
1
Save high confidence outlier cells from strains with > penetrance of 90th WT penetrance
def save_outlier_cells(df_well, df_strain, df_strain_scores, output): # Filter strains wt_strain_ids = wt_strains(df_strain_scores) df_strain = df_strain[df_strain['Strain ID'].isin(df_strain_scores['Strain ID'].unique())] df_well = df_well[(df_well['Strain ID'].isin(wt_strain_ids)) & ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_high_gi(df):\n df = df[df['2h-iAUC'] <= 75]\n writer = pd.ExcelWriter('final_dataset_with_median.xlsx', engine='xlsxwriter')\n df.to_excel(writer, sheet_name='Sheet1')\n writer.save()", "def early_warnings_sensitivity_analysis(series,\n indicators=['v...
[ "0.5806118", "0.5517937", "0.5420683", "0.54034156", "0.5347539", "0.534004", "0.5339723", "0.53011847", "0.5298448", "0.5295308", "0.52592945", "0.52575207", "0.52557695", "0.52543205", "0.52489877", "0.52084166", "0.52046674", "0.5196227", "0.51782423", "0.51771146", "0.517...
0.6827614
0
Plot ROC and PR curves, penetrance agreement and confusion matrices if the positive control file is available
def calculate_auc(df, neg, pos): nc = df[df['Strain ID'].isin(neg)]['Penetrance'].values pc = df[df['Strain ID'].isin(pos)]['Penetrance'].values y_score = np.append(nc, pc) y_true = np.append(np.repeat(0, len(nc)), np.repeat(1, len(pc))) sample_weights = np.append(np.repeat(float(len(pc)) / len(nc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _roc_plot_single(metrics, save_name):\n plt.figure()\n plt.plot([0, 1], [0, 1], \"k--\")\n plt.plot(metrics[\"fpr\"], metrics[\"tpr\"], \"r\", linewidth=2)\n plt.xscale(\"log\")\n plt.yscale(\"log\")\n plt.grid()\n plt.xlabel(\"True Positive Rate\")\n plt.ylabel(\"False Positive Rate\")...
[ "0.7281352", "0.7193849", "0.713243", "0.7124756", "0.70862824", "0.7062829", "0.69989294", "0.697844", "0.697795", "0.69754905", "0.6926731", "0.6896871", "0.6875325", "0.6868472", "0.6796516", "0.67538035", "0.67431104", "0.67360616", "0.6718275", "0.6686963", "0.6663083", ...
0.0
-1
Plot ROC and PR curves, penetrance agreement and confusion matrices if the positive control file is available
def plot_penetrance_agreement(df, df_cont, neg, output): # Positive controls pos = df_cont['Strain ID'].values df_pos = df[df['Strain ID'].isin(pos)][['Strain ID', 'Penetrance']].reset_index(drop=True) df_pos.insert(loc=len(df_pos.columns), column='Predicted_penetrance', value=0) df_pos.insert(loc=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _roc_plot_single(metrics, save_name):\n plt.figure()\n plt.plot([0, 1], [0, 1], \"k--\")\n plt.plot(metrics[\"fpr\"], metrics[\"tpr\"], \"r\", linewidth=2)\n plt.xscale(\"log\")\n plt.yscale(\"log\")\n plt.grid()\n plt.xlabel(\"True Positive Rate\")\n plt.ylabel(\"False Positive Rate\")...
[ "0.72813594", "0.7194766", "0.71336013", "0.7125148", "0.7087321", "0.7063653", "0.70003015", "0.69796777", "0.697831", "0.6976867", "0.6927569", "0.6897298", "0.68765956", "0.6869951", "0.6797397", "0.6755818", "0.67445564", "0.6737552", "0.67196417", "0.6688396", "0.6664592...
0.0
-1
Calculate outlier detection performance on all metrics
def calculate_performance(controls_f, df, pop_type, neg, output): print('\n Calculating performance...') log_write(output['log'], '\n\nPerformance based on results per %s\n\n' % pop_type) # Remove strains with missing penetrance and few cell count df = df.iloc[df['Penetrance'].isna().values == 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_outliers(self):\n\n # outliers categorized\n self.by_feature = dict()\n self.by_sample = dict()\n\n if self.disable_outlier_detection:\n print('outlier detection: disabled, as requested.')\n return\n\n if len(self.feature_paths) < 1:\n ...
[ "0.710637", "0.70049024", "0.6792978", "0.6761988", "0.67603177", "0.65477294", "0.6203474", "0.6200095", "0.6193399", "0.61832106", "0.61709476", "0.61471057", "0.6145133", "0.6142967", "0.613758", "0.6125183", "0.6119651", "0.6104144", "0.60948646", "0.6064788", "0.60635704...
0.57430667
64
Plot WT inlier cells and outlier cells from highly penetrant genes
def plot_cells(df, df_well, df_strain, df_score, neg, cell_features, data_features, output): # Strains with high penetrance values wt_penetrances = df_well[df_well['Strain ID'].isin(neg)]['Penetrance'].dropna().values pene_threshold = stats.scoreatpercentile(wt_penetrances, 95) high_pene_strains = df_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_in_outliers(data, mask, output):\n\n oc = 'lightskyblue'\n ic = 'navy'\n plt.figure(figsize=(15, 18))\n sns.set_style('white')\n x_all = pd.DataFrame({'PC1': data[:, 0], 'PC2': data[:, 1]})\n x_inliers = pd.DataFrame({'PC1': data[mask == 0, 0], 'PC2': data[mask == 0, 1]})\n x_outliers...
[ "0.64420354", "0.5983264", "0.59060514", "0.5854271", "0.5798881", "0.5769779", "0.57064456", "0.5657062", "0.563888", "0.5605974", "0.560229", "0.5599474", "0.5576867", "0.5527959", "0.5516743", "0.55078536", "0.5483265", "0.5426917", "0.5398972", "0.53946674", "0.53912854",...
0.6301111
1
Can be execute when receive HTTP Method 'GET'. Will be return the Dict object as post_fields.
def get(self, post_id=None): if post_id: post = Post.query.filter_by(id=post_id).first() if not post: abort(404) return post else: args = parsers.post_get_parser.parse_args() page = args['page'] or 1 # Return the p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_data():\n if request.method in ('POST', \"PUT\"):\n return request.get_json(force=True)\n else:\n return request.values", "def do(request, **kwargs):\n logger.debug(request.raw_post_data)\n if request.method == 'POST':\n method = request.POST.get('_method', 'POST')\n else:\n...
[ "0.65958524", "0.6590844", "0.6548057", "0.65243036", "0.6425696", "0.64177984", "0.6371229", "0.6337785", "0.63315296", "0.6198202", "0.61963314", "0.61678755", "0.6151517", "0.6151517", "0.6144513", "0.6144513", "0.6138687", "0.6131597", "0.61260194", "0.61146164", "0.60834...
0.0
-1
Can be execute when receive HTTP Method 'POST'.
def post(self, post_id=None): if post_id: abort(400) else: args = parsers.post_post_parser.parse_args(strict=True) new_post = Post(args['title']) new_post.text = args['text'] # new_post.user = user if args['tags']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_POST(self,):\n self.http_method = 'POST'\n self.response()", "def do_POST(self):\r\n self._send_handler_response('POST')", "def do_POST(self):\r\n self.do_GET()", "def http_method_post():\n return 'POST'", "def post(self):", "def do_POST(self): # pylint: disable...
[ "0.82315195", "0.816325", "0.8136307", "0.8066405", "0.8023862", "0.80042607", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.7917753", "0.79055834", ...
0.0
-1
create directory of it is not exist
def mkdir(path): if not os.path.exists(path): os.mkdir(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dir():\n if check_dir_exist():\n return False\n else:\n os.makedirs(path_structure)\n return True", "def mkdir(path):", "def make_dir(self):\n if not os.path.exists(self.d):\n try:\n os.mkdir(self.d)\n except OSError, e:\n ...
[ "0.8131621", "0.8035905", "0.8021882", "0.8016714", "0.8004138", "0.7967038", "0.79378766", "0.79378766", "0.79312384", "0.79282224", "0.791509", "0.7892394", "0.7882598", "0.7872448", "0.78720444", "0.78555393", "0.78460974", "0.7828939", "0.78242785", "0.7821966", "0.782043...
0.7672673
40
Parsing a datetime into a pandas.Timestamp
def test_parse_date_from_datetime(self): bxl = pytz.timezone('Europe/Brussels') dt_ = bxl.localize(dt.datetime(2014, 11, 23, 1, 2, 3)) epoch = pytz.UTC.localize(dt.datetime(1970, 1, 1, 0, 0, 0)) epoch_expected = (dt_ - epoch).total_seconds() pts = parse_date(dt_) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_timestamp(ts):\n return DateTimeField()._to_python(ts)", "def parse_timestamp(row):\n ts0 = pd.Timestamp(row['raw_timestamp_part_1'], unit='s')\n ts1 = pd.Timedelta(row['raw_timestamp_part_2'], unit='microseconds')\n return ts0 + ts1", "def _pd_datetime_to_timestamp_proto(dtype, value) ->...
[ "0.66713554", "0.66511303", "0.64544904", "0.64049304", "0.6398411", "0.63614136", "0.6346307", "0.6269649", "0.6210043", "0.6187754", "0.61801153", "0.61687887", "0.6164123", "0.6163249", "0.6162522", "0.6138763", "0.6111186", "0.60905814", "0.60867035", "0.607121", "0.60709...
0.0
-1
Parsing some commong types of strings
def test_parse_date_from_string(self): dt_ = pytz.UTC.localize(dt.datetime(2014, 11, 23, 1, 2, 3)) epoch = pytz.UTC.localize(dt.datetime(1970, 1, 1, 0, 0, 0)) epoch_expected = (dt_ - epoch).total_seconds() pts = parse_date('20141123 01:02:03') self.assertEqual(pts.value / 1e9, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseString(self, s):\n pass", "def parse_string(self, data):\n pass", "def parse(s):\n return s", "def parse(cls, s):\n raise NotImplementedError", "def parse_string(self, in_str):\n match = MAIN_REGEX.search(in_str)\n if not match:\n err_str = \"Un...
[ "0.71482205", "0.7027541", "0.68106294", "0.6537094", "0.64149195", "0.6322251", "0.6309026", "0.63043857", "0.6225313", "0.6172142", "0.61480796", "0.6053881", "0.60218215", "0.6010432", "0.6005794", "0.5965541", "0.59482807", "0.5941513", "0.591379", "0.5909908", "0.5903934...
0.0
-1
Open lenfile to determine length of each contig in ref.fa.
def openlenfile(lenfile): with open(lenfile, 'r') as o: text = o.read().split("\n") return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_length(fileName):\n with open(f_pass) as f:\n for i, l in enumerate(f):\n pass\n return i + 1", "def file_len(fname):\n with open(fname) as f:\n for i, l in enumerate(f):\n pass\n Nrows = i + 1\n return Nrows", "def file_len(f):\n\n ...
[ "0.6596299", "0.65170276", "0.6510556", "0.64972013", "0.6382751", "0.634846", "0.6290514", "0.6267712", "0.6207364", "0.61850536", "0.6170275", "0.6133182", "0.61330396", "0.6116903", "0.6094633", "0.60247296", "0.59479153", "0.59410506", "0.5937424", "0.588958", "0.58894855...
0.6669815
0
Create dir for bedfiles.
def make_beddir(): bname = op.basename(ref).split(".fa")[0] beddir = makedir(op.join(op.dirname(ref), 'bedfiles_%s' % bname)) return bname, beddir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDir(self, dir_name):\n os.mkdir(os.path.join(self.user[\"Save\"], dir_name))", "def make_case_dir(self):\n\n mkdir(directory=self.dir)\n mkdir(directory=self.sub_dir)", "def make_dir(self):\n if not os.path.exists(self.d):\n try:\n os.mkdir(self.d...
[ "0.7125149", "0.70820016", "0.70502377", "0.69840735", "0.6936681", "0.68457246", "0.6840222", "0.6807135", "0.6796343", "0.67916274", "0.67853177", "0.67853177", "0.6780806", "0.6770088", "0.67424643", "0.6727917", "0.6727697", "0.6726145", "0.6721723", "0.67215335", "0.6704...
0.7920128
0
Create a name for a bedfile based on the ref.fa path name and num.
def get_prereqs(num): bname, beddir = make_beddir() f = op.join(beddir, "%s_bedfile_%s.bed" % (bname, str(num).zfill(4))) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_final_name(fname, date, fc_id, sample_name):\n \n # Split the file name according to CASAVA convention\n m = re.match(r'(\\S+?)_(?:[ACGTN\\-]+|NoIndex|Undetermined)_L0*(\\d+)_R(\\d)_\\d+\\.fastq(.*)', fname)\n if m is not None:\n lane = m.group(2)\n read = m.group(3)\n ...
[ "0.64326787", "0.6390889", "0.6162014", "0.60992646", "0.60372376", "0.60265815", "0.5936168", "0.5925598", "0.59065956", "0.58931446", "0.5885672", "0.5868783", "0.5835747", "0.5821631", "0.5794155", "0.5765308", "0.57223356", "0.57214165", "0.57152283", "0.5710554", "0.5700...
0.5480523
37
Write contig/chrom, start, stop positions to bedfile.
def make_bed(lines, num): f = get_prereqs(num) with open(f, 'w') as o: for contig, start, stop in lines: o.write("%s\t%s\t%s\n" % (contig, start, stop))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, outfile):\n outfile.write(\n '\\t'.join(\n [\n str(i) for i in [\n self.chrom, self.start, self.end, self.name,\n self.count, self.fold_change, self.log10p\n ]\n ]\n ...
[ "0.60150325", "0.59635466", "0.56702024", "0.56527853", "0.56182194", "0.55816156", "0.55281764", "0.54684925", "0.5462438", "0.53775287", "0.5333092", "0.53054655", "0.52583885", "0.5236999", "0.5216365", "0.52040017", "0.5203083", "0.51540524", "0.5143235", "0.5138014", "0....
0.6088629
0
If intervals.list files exist, use these instead of ref.fa.length file.
def make_bed_from_intervals(intdir): intfiles = [f for f in fs(intdir) if f.endswith('.list')] for intfile in intfiles: num = intfile.split("_")[-1].replace(".list", "") lines = [] with open(intfile, 'r') as o: text = o.read().split("\n") for line in text: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_positions():\n refdir = op.dirname(ref)\n intdir = op.join(refdir, 'intervals')\n # look for intervals directory with .list files\n if op.exists(intdir):\n print('\\tusing intervals dir to create bedfiles for %s' % ref)\n make_bed_from_intervals(intdir)\n return\n # loo...
[ "0.5596598", "0.5420073", "0.53824025", "0.52861524", "0.5261305", "0.50874186", "0.50684524", "0.4995538", "0.49851644", "0.4981738", "0.49681863", "0.49664834", "0.49223024", "0.49208766", "0.49206412", "0.4918922", "0.49170592", "0.49125102", "0.49114218", "0.49038002", "0...
0.5453543
1
Use ref.order file to create bedfiles for parallelization. Evenly distributes contigs across X number of files specified to calculate thresh.
def make_beds_from_orderfile(): orderfile = ref.replace(".fa", "") + '.order' print('\n\tCreating bedfiles from %s. Please confirm:\n\tAssuming .order file is of format:\n\t\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile) askforinput(tab='\t', newline='') with open(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_bedfiles():\n df = pd.read_csv(\"%s.length\" % ref, sep='\\t', header=None)\n thresh = math.ceil(sum(df[1]) / globals()['jobs_per_pool'])\n lines = []\n fcount = 0\n fsum = 0\n for count,row in enumerate(df.index):\n contig, length = list(df.loc[row, :])\n fsum += length\n ...
[ "0.6590571", "0.61164385", "0.6017592", "0.5689988", "0.5628261", "0.5574964", "0.5478103", "0.54726285", "0.5446761", "0.54318154", "0.54137427", "0.54006183", "0.53667706", "0.53506273", "0.53197247", "0.5316093", "0.5272207", "0.52560264", "0.5221501", "0.5205024", "0.5189...
0.6294389
1
Find positions to create bedfiles. First look for an intervals directory, then for a ref.order file. If neither exist, use ref.length file (ie, a lenfile) if this doesn't exist, create one from the ref.fa. A lenfile is a file created from the ref.fa that has lengths of each contig/chromosome.
def find_positions(): refdir = op.dirname(ref) intdir = op.join(refdir, 'intervals') # look for intervals directory with .list files if op.exists(intdir): print('\tusing intervals dir to create bedfiles for %s' % ref) make_bed_from_intervals(intdir) return # look for a ref.or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_beds_from_orderfile():\n orderfile = ref.replace(\".fa\", \"\") + '.order'\n print('\\n\\tCreating bedfiles from %s. Please confirm:\\n\\tAssuming .order file is of format:\\n\\t\\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile)\n askforinput(tab='\\t', newlin...
[ "0.6035527", "0.59248257", "0.52282196", "0.51990765", "0.5198975", "0.51359016", "0.5092171", "0.49188724", "0.48909006", "0.48892576", "0.48381808", "0.4836135", "0.47870463", "0.47688", "0.47637847", "0.4749879", "0.47248846", "0.47141135", "0.47044", "0.47014743", "0.4699...
0.83084154
0
Use ref.fa.length or ref.order file to write contig/chorm, start, stop to bedfile.
def make_bedfile(lines, fcount, from_orderfile=False): f = get_prereqs(fcount) text = [] with open(f, 'w') as o: for line in lines: if from_orderfile is False: contig, length = line text.append("%s\t%s\t%s" % (contig, 0, int(length)-1)) # contig \t start ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_beds_from_orderfile():\n orderfile = ref.replace(\".fa\", \"\") + '.order'\n print('\\n\\tCreating bedfiles from %s. Please confirm:\\n\\tAssuming .order file is of format:\\n\\t\\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile)\n askforinput(tab='\\t', newlin...
[ "0.6323418", "0.62829024", "0.61649925", "0.6098245", "0.60466856", "0.5953595", "0.5946328", "0.5867471", "0.57360923", "0.57180756", "0.5669914", "0.56460124", "0.5614862", "0.5594809", "0.5577744", "0.55528116", "0.554931", "0.55370843", "0.55333304", "0.55181164", "0.5512...
0.65602005
0
Use ref.fa.length file to create bedfiles. Evenly distributes basepairs across X number of files specified to calculate thresh.
def make_bedfiles(): df = pd.read_csv("%s.length" % ref, sep='\t', header=None) thresh = math.ceil(sum(df[1]) / globals()['jobs_per_pool']) lines = [] fcount = 0 fsum = 0 for count,row in enumerate(df.index): contig, length = list(df.loc[row, :]) fsum += length lines.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_positions():\n refdir = op.dirname(ref)\n intdir = op.join(refdir, 'intervals')\n # look for intervals directory with .list files\n if op.exists(intdir):\n print('\\tusing intervals dir to create bedfiles for %s' % ref)\n make_bed_from_intervals(intdir)\n return\n # loo...
[ "0.6323582", "0.60488206", "0.5817745", "0.5746369", "0.5689245", "0.5664225", "0.5551799", "0.551062", "0.5500697", "0.54490316", "0.543353", "0.5415477", "0.53688526", "0.53139466", "0.5303735", "0.52852124", "0.52845037", "0.5283229", "0.5273382", "0.52659917", "0.52022564...
0.77063954
0
Avoid accidentally using incorrect bedfiles by removing any that exist.
def check_beddir(): bname, beddir = make_beddir() files = [f for f in fs(beddir) if f.endswith('.bed')] if len(files) > 0: text = '\tThere are already existing bedfiles in %s. These will be deleted.' % beddir print(Bcolors.WARNING + text + Bcolors.ENDC) askforinput(tab='\t', newline=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup() -> None:\n\n for fname in glob(os.path.join(tdir, 'alexandria.*')):\n if os.path.splitext(fname)[1] not in {'.c', '.h'}:\n os.unlink(fname)", "def _clean_input_dir():\n for existing_file in os.listdir(join(input_dir, 'analysis')):\n ...
[ "0.67623425", "0.6754878", "0.67248297", "0.6710017", "0.6476191", "0.6463225", "0.6392083", "0.6380994", "0.6339569", "0.63066906", "0.6296585", "0.6264032", "0.6262186", "0.62532663", "0.6250286", "0.62268937", "0.6203356", "0.6201634", "0.6197063", "0.61752784", "0.6161145...
0.7251923
0
Use cluster ID and numpools to determine how many bedfiles to create.
def determine_jobs_per_pool(numpools, totaljobs): cluster = os.environ['CC_CLUSTER'] if cluster in ['graham', 'beluga']: jobs_per_pool = math.floor(totaljobs / numpools) else: jobs_per_pool = totaljobs return jobs_per_pool
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_partitions(self): # -> int:\n ...", "def num_partitions(self): # -> None:\n ...", "def make_bedfiles():\n df = pd.read_csv(\"%s.length\" % ref, sep='\\t', header=None)\n thresh = math.ceil(sum(df[1]) / globals()['jobs_per_pool'])\n lines = []\n fcount = 0\n fsum = 0\n fo...
[ "0.5990177", "0.5830299", "0.57824516", "0.5737202", "0.5685508", "0.53107566", "0.52840227", "0.5245606", "0.5210243", "0.5175091", "0.5117674", "0.5112534", "0.51030594", "0.50904185", "0.5052817", "0.5039198", "0.5023452", "0.5008179", "0.5007929", "0.5004022", "0.49951395...
0.57108104
4
`other` is the event triggering a transition.
def __add__(self, other): if not isinstance(other, Event): raise Error( 'expected an Event instance, but got {}'.format(repr(other))) self._event = other return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition(self, action):\n raise NotImplementedError", "def transition(self):\n raise NotImplementedError()", "def test_other_event(self):\n M = simulation.EventMonitor(self.G, event='other')\n sim = simulation.Simulation(self.G, M, dt=self.dt)\n sim.run(self.t_max)\n\n times = (~sel...
[ "0.5809566", "0.577302", "0.5757552", "0.5671358", "0.56565297", "0.56291336", "0.5628853", "0.5579457", "0.55250674", "0.5485554", "0.5344338", "0.5312438", "0.5298879", "0.5295169", "0.5270889", "0.52699006", "0.524914", "0.52199113", "0.5210242", "0.51854557", "0.5164349",...
0.50949544
22
`other` is the state to transition to.
def __rshift__(self, other): if not isinstance(other, State): raise Error( 'expected a State instance, but got {}'.format(repr(other))) self._transitions.append((self._event, other)) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\r\n if other:\r\n if self.state == other.state:\r\n return True", "def switch_to_state(self, Rover, name):\n name.execute(Rover)\n self.curr_state = name", "def state_changed(self, old_state, new_state, target_state):\n pass", "de...
[ "0.60229385", "0.5950636", "0.58616793", "0.5826824", "0.57995635", "0.57883424", "0.57480127", "0.57173836", "0.5704981", "0.5686667", "0.5667739", "0.566679", "0.56586593", "0.5653753", "0.5637859", "0.5632062", "0.5630901", "0.5603314", "0.5575363", "0.55619264", "0.556186...
0.6611836
0
`key` is the transition guard.
def __getitem__(self, key): if not callable(key): raise Error('expected a callable guard, but got {}'.format(key)) self.guard = key return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_state(self, key):\r\n return self.handler.key_state(key_to_code(key))", "def handle_key(self, key):\n direction = DIRECTIONS.get(key)\n if direction:\n self.move(direction)", "def _get_from_back(self, key):\n\n raise KeyError", "def on_key_event(self, key):\n ...
[ "0.6381055", "0.6206628", "0.6192051", "0.6084931", "0.60613495", "0.6039523", "0.59086335", "0.5875724", "0.5848142", "0.58422166", "0.5838721", "0.5838721", "0.5837078", "0.578663", "0.57231176", "0.5712439", "0.56723154", "0.56640273", "0.5640742", "0.56326944", "0.5571676...
0.58493537
8
`other` is the transition action.
def __truediv__(self, other): if not callable(other): raise Error( 'expected a callable action, but got {}'.format(other)) self.action = other return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition(self, action):\n raise NotImplementedError", "def prev_action(self):\n raise NotImplementedError", "def handle_other(self):\n pass", "def choose_action(self):\r\n pass", "def __ne__(self, other):\n if not isinstance(other, SubsequentAction):\n return...
[ "0.65385056", "0.6014882", "0.5783903", "0.5669829", "0.56653583", "0.5573415", "0.5570023", "0.5556622", "0.55503625", "0.5479104", "0.54706556", "0.5465142", "0.5462288", "0.54350334", "0.5428809", "0.5422753", "0.54097885", "0.5403576", "0.53994787", "0.5376164", "0.537524...
0.57327193
3
Process given event `event`. Raises an `UnexpectedEventError` if given event was unexpected.
def process_event(self, event): print('Current state: {}, Event to process: {}'.format( self._current_state.name, event)) # # Is the event expected? # try: # transition = self._current_state.events[type(event)] # except KeyError: # raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_event(event_processor, event):\n\n log = logging.getLogger(__name__)\n try:\n log.debug(\"Processing Event: %s - %s\" % (event[\"content_type\"], event[\"routing_key\"]))\n event_processor.process_event(event[\"content_type\"], event[\"routing_key\"], event[\"body\"])\n except:\n...
[ "0.70300627", "0.6771751", "0.67416", "0.66380054", "0.642705", "0.6365013", "0.6362536", "0.62995046", "0.6274929", "0.6259453", "0.61244756", "0.6117413", "0.6094892", "0.60790133", "0.59835047", "0.5926056", "0.59134126", "0.5895901", "0.58831525", "0.5871841", "0.5862529"...
0.69930625
1
Take a list of package loaders and returns a list of package names
def test_get_package_name_list(): package_list = [warrior.Actions.CommonActions] result = kw_driver.get_package_name_list(package_list) check1 = 'warrior.Actions.CommonActions' in result assert check1 == True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_packages():\n all_providers_yaml = load_package_data()\n provider_package_names = [\n provider[\"package-name\"] for provider in all_providers_yaml if not provider.get(\"suspended\")\n ]\n return [\n \"apache-airflow\",\n \"docker-stack\",\n *provider_packa...
[ "0.680388", "0.644909", "0.64283586", "0.64128625", "0.6353792", "0.63058865", "0.6247957", "0.6229011", "0.6202141", "0.6185931", "0.61721045", "0.61707085", "0.6143838", "0.6106092", "0.6104382", "0.6086591", "0.6051464", "0.6011092", "0.6003829", "0.59999084", "0.5982122",...
0.0
-1
Executes the keyword provided by product driver
def test_execute_keyword(): keyword = 'store_in_repo' data_repository = {'db_obj': False, 'war_file_type': 'Case', 'wt_results_execdir': None,\ 'wt_logs_execdir': None, 'wt_name': 'test', 'step_num':None} args_repository = {'datavar': 'a', 'datavalue': 'b'} warrior.Framework.Utils.testcase_Utils.pS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_method_for_keyword(self):\n\n kwargs, kw_status = self.get_argument_as_keywords()\n print_info(\"The Arguments passed for the current Step is: '{0}'\".format(kwargs))\n if kw_status:\n # Execute the corresponding method\n method_loader = self.exec_obj.im_class...
[ "0.6734542", "0.66397667", "0.6439564", "0.6229538", "0.6033111", "0.6021556", "0.59995455", "0.56600654", "0.5628254", "0.5510531", "0.5510531", "0.5477481", "0.546144", "0.5443456", "0.5430221", "0.5398615", "0.5371088", "0.5365336", "0.5324174", "0.53204644", "0.53204644",...
0.70761853
0
Executes the keyword provided by product driver
def test_execute_keyword_empty_package_list(): keyword = '' data_repository = {'db_obj': False, 'war_file_type': 'Case', 'wt_results_execdir': None,\ 'wt_logs_execdir': None, 'wt_name': 'test', 'step_num':None} args_repository = {'datavar': 'a', 'datavalue': 'b'} warrior.Framework.Utils.testcase_Ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_keyword():\n keyword = 'store_in_repo'\n data_repository = {'db_obj': False, 'war_file_type': 'Case', 'wt_results_execdir': None,\\\n 'wt_logs_execdir': None, 'wt_name': 'test', 'step_num':None}\n args_repository = {'datavar': 'a', 'datavalue': 'b'}\n warrior.Framework.Utils.testca...
[ "0.7076708", "0.67344", "0.6639031", "0.6439181", "0.60340077", "0.6021442", "0.5999301", "0.56590194", "0.5627547", "0.55113786", "0.55113786", "0.5477494", "0.5462222", "0.54428744", "0.5431307", "0.53987", "0.53705627", "0.53651017", "0.532413", "0.5321094", "0.5321094", ...
0.6230661
4
Create a normal boring user, not a super user. This user has no news related permissions by default.
def create_test_user(self): user = User.objects.create_user( username='test@email.com', password='password') user.groups.add(self.group) user.user_permissions.add(p('wagtailadmin.access_admin')) user.save() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self):\n User.objects.create_user('test', 'testing@test.com', 'testing')", "def create_user(self):\n return User.objects.create_user(**self.user_data)", "def create_new_user(self):\n username = 'pseudo'\n email = 'carole@tests.com'\n password = '00000000'\n ...
[ "0.77364284", "0.7445896", "0.7428837", "0.7307158", "0.7305627", "0.7264574", "0.7252679", "0.7195865", "0.71800965", "0.71787715", "0.7176444", "0.7171227", "0.7150902", "0.7139617", "0.71316", "0.7130504", "0.71181756", "0.7114516", "0.7110715", "0.71024036", "0.70900804",...
0.70274866
27
Test the chooser when there are multiple valid choices, and some missing due to lack of permissions.
def test_chooser_multiple_choices(self): root_page = Page.objects.get(pk=2) news1 = root_page.add_child(instance=NewsIndex( title='Normal News 1', slug='news-1')) news2 = root_page.add_child(instance=NewsIndex( title='Normal News 2', slug='news-2')) secondary_news...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_choices_ok(self, choices, value):\n opt = scheme.Option('test-option', choices=choices)\n opt.validate('foo', value)", "def test_choose_from_list_6(self, ask_mock):\n ask_mock.side_effect = [False, False, False]\n field = basic.choose_from_list(self.options)\n ...
[ "0.66817105", "0.64637005", "0.6450645", "0.64118063", "0.64103216", "0.6404033", "0.63465583", "0.6318701", "0.6296135", "0.6285464", "0.6275242", "0.6213478", "0.62034816", "0.6117522", "0.60733455", "0.60711354", "0.60417986", "0.6000661", "0.5982559", "0.59810966", "0.597...
0.6283165
10
Test the chooser when there is a single valid choice, and some missing due to lack of permissions.
def test_chooser_one_choice(self): root_page = Page.objects.get(pk=2) news = root_page.add_child(instance=NewsIndex( title='News', slug='news')) root_page.add_child(instance=SecondaryNewsIndex( title='Secondary News', slug='secondary-news')) response = self.clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_choice(self, choice):\n if choice not in self.choices:\n error = \"Invalid Choice please choose from {}\".format(\n \", \".join(self.choices)\n )\n return error\n return choice", "def test_validate_choices_ok(self, choices, value):\n ...
[ "0.6474098", "0.64373815", "0.6308194", "0.6300221", "0.6291836", "0.624899", "0.6239352", "0.6210023", "0.6153591", "0.6152879", "0.6147857", "0.6137659", "0.6074012", "0.6074012", "0.6031723", "0.60148275", "0.60034484", "0.59956425", "0.5980814", "0.5973894", "0.5972679", ...
0.5406085
96
Test the chooser when there are no valid choices.
def test_chooser_no_perms(self): root_page = Page.objects.get(pk=2) root_page.add_child(instance=NewsIndex( title='News', slug='news')) root_page.add_child(instance=SecondaryNewsIndex( title='Secondary News', slug='secondary-news')) response = self.client.get(rev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_choices_failure(self, choices, value):\n opt = scheme.Option('test-option', choices=choices)\n with pytest.raises(errors.SchemeValidationError):\n opt.validate('foo', value)", "def test_vote_when_none_choice_was_selected(self):\n question_no_choices = create_ques...
[ "0.6961869", "0.6830949", "0.6724233", "0.66625845", "0.6622834", "0.64742875", "0.62666386", "0.62199634", "0.6218201", "0.61922085", "0.61864614", "0.616241", "0.61574924", "0.6151992", "0.6121114", "0.60897505", "0.60819733", "0.60698235", "0.6036761", "0.6030251", "0.6027...
0.5461697
86
Test the chooser when there are no news items, but the user has relevant permissions.
def test_chooser_has_perms_no_news(self): response = self.client.get(reverse('wagtailnews:choose')) self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_chooser_no_perms(self):\n root_page = Page.objects.get(pk=2)\n root_page.add_child(instance=NewsIndex(\n title='News', slug='news'))\n root_page.add_child(instance=SecondaryNewsIndex(\n title='Secondary News', slug='secondary-news'))\n\n response = self.cl...
[ "0.73646075", "0.61538947", "0.6025898", "0.5865416", "0.58521277", "0.5842307", "0.582308", "0.57966214", "0.57383853", "0.572046", "0.5719911", "0.5717424", "0.5702386", "0.56986713", "0.56581986", "0.5656366", "0.56463605", "0.56425077", "0.56178695", "0.5616088", "0.56047...
0.813045
0
Check the user is allowed to access the news index list
def test_news_index_has_perm(self): self.assertStatusCode(self.url, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)", "def can_view(self, user):\r\n return True", "def test_news_index_no_perm(self):\n self.assertStatusCode(self.url, 403)", "def has_super_access():\n current_user = frappe.get_doc('User', frappe.session.use...
[ "0.71869683", "0.701034", "0.6941104", "0.6793444", "0.67805856", "0.67128044", "0.66727525", "0.66707075", "0.66169983", "0.6611218", "0.65815014", "0.65591043", "0.6556533", "0.6549251", "0.6537417", "0.6531668", "0.65135354", "0.65135354", "0.65135354", "0.64980245", "0.64...
0.72420925
0
Check the user is denied access to the news index list
def test_news_index_no_perm(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_everyone_denied(self):", "def test_news_index_has_perm(self):\n self.assertStatusCode(self.url, 200)", "def test_if_forbiden_for_authenticated_permissions(self):\r\n res = self.client_authenticated.get(reverse(LIST_USER_URL),data={})\r\n self.assertEqual(res.status_code, status.HTT...
[ "0.6909648", "0.6811918", "0.66676253", "0.661869", "0.6616912", "0.6532068", "0.6532068", "0.6508571", "0.6508571", "0.6508571", "0.6508571", "0.6493177", "0.6466608", "0.64571303", "0.6441584", "0.64142835", "0.6403795", "0.63929635", "0.6385503", "0.63569266", "0.6335534",...
0.75531065
0
Test users can create NewsItems
def test_has_permission(self): self.assertStatusCode(self.url, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_news_create(self):\n news = News.save_news('www.testing.com', 'testing', 'testing is painful but important', datetime.utcnow(), 'www.sometestimg.url' )\n news_created = News.query.get(news.url)\n\n all_news = News.query.all()\n\n self.assertEqual(len(all_news), 1)\n self...
[ "0.6972671", "0.6793335", "0.67640114", "0.672659", "0.67262614", "0.67136234", "0.6670086", "0.66526836", "0.6628409", "0.6612906", "0.6513603", "0.64985555", "0.64849335", "0.64679796", "0.64426315", "0.64425945", "0.64192855", "0.6411061", "0.6403463", "0.63438976", "0.634...
0.0
-1
Users need both add and edit. Add is not sufficient
def test_only_add_perm(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(self):\n\n pass", "def user_can_edit(self, user):\n return user == self.owner", "def allow_to_edit(user):\n return allow_to_edit_well(user)", "def add(self, user: U) -> None:\n ...", "def edit():", "def home_edituser():\n\tpass", "def can_edit(self, user):\n return s...
[ "0.6993943", "0.67083204", "0.66459835", "0.66431636", "0.64818656", "0.6458078", "0.6394788", "0.6369395", "0.6352475", "0.63279235", "0.63279235", "0.62939936", "0.6235992", "0.6187183", "0.6171549", "0.6162502", "0.6141428", "0.6141428", "0.6140597", "0.6133903", "0.612375...
0.0
-1
Users need both add and edit. Edit is not sufficient
def test_only_edit_perm(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(self):\n\n pass", "def edit():", "def edit(self, **kwargs):\n ...", "def allow_to_edit(user):\n return allow_to_edit_well(user)", "def user_can_edit(self, user):\n return user == self.owner", "def home_edituser():\n\tpass", "def can_edit(self, user):\n return self.au...
[ "0.746256", "0.70134765", "0.68477565", "0.68377763", "0.6837059", "0.66111666", "0.65164244", "0.6491908", "0.6365437", "0.62689954", "0.6266815", "0.62600476", "0.62545645", "0.62244517", "0.6216448", "0.62075764", "0.6207041", "0.6185706", "0.61667067", "0.6128112", "0.612...
0.0
-1
Test user can not create without permission
def test_no_permission(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_if_not_created_authenticated_permissions(self):\r\n payload = {\r\n \"email\": \"t@t.pl\",\r\n \"password\": \"password\",\r\n \"name\": \"asdasd\",\r\n \"is_superuser\": False,\r\n }\r\n\r\n res = self.client_authenticated.post(reverse(CREA...
[ "0.7918982", "0.7771127", "0.7771127", "0.7771127", "0.77341586", "0.74601835", "0.742769", "0.7394454", "0.7384439", "0.7380802", "0.73551154", "0.73485357", "0.72738314", "0.7262976", "0.7240507", "0.72152865", "0.7182163", "0.71769214", "0.7160252", "0.71446407", "0.710691...
0.0
-1
Test that the add button appears
def test_add_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_button(self):\n btn = utils.add_button()\n self.assertIsInstance(btn, Button)", "def test_create_custom_button(self):\n pass", "def test_update_custom_button(self):\n pass", "def test_add_form(self):\n\n with self.client:\n result = self.client.get('...
[ "0.7815246", "0.7325054", "0.69925904", "0.69816005", "0.6961596", "0.67576945", "0.6751668", "0.67433363", "0.6669086", "0.65231645", "0.64985496", "0.64942086", "0.6476833", "0.64543915", "0.64284575", "0.64268816", "0.64163435", "0.64100766", "0.63750327", "0.634055", "0.6...
0.7192711
2
Test that the add button does not appear
def test_no_add_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertNotContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_button(self):\n btn = utils.add_button()\n self.assertIsInstance(btn, Button)", "def test_can_not_add_more(self):\n set_up_one_user(self, 1, 0)\n login = self.client.login(username='test', password='2HJ1vRV0Z&3iD')\n response = self.client.get(reverse('index'))\n ...
[ "0.7187858", "0.7186731", "0.71256816", "0.7048631", "0.68383086", "0.6767297", "0.65683776", "0.65635896", "0.65399176", "0.65163064", "0.6511349", "0.65104187", "0.64470893", "0.6418005", "0.63748497", "0.62681", "0.62287384", "0.6181235", "0.6170643", "0.61644083", "0.6162...
0.7127412
2
Test users can create NewsItems
def test_has_permission(self): self.assertStatusCode(self.url, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_news_create(self):\n news = News.save_news('www.testing.com', 'testing', 'testing is painful but important', datetime.utcnow(), 'www.sometestimg.url' )\n news_created = News.query.get(news.url)\n\n all_news = News.query.all()\n\n self.assertEqual(len(all_news), 1)\n self...
[ "0.6971999", "0.6795873", "0.67656213", "0.6726738", "0.67258906", "0.67142934", "0.66693985", "0.66526544", "0.6627908", "0.6612012", "0.6514119", "0.65005606", "0.64833426", "0.6468198", "0.64452285", "0.6442098", "0.64234686", "0.6410922", "0.6403401", "0.63442045", "0.634...
0.0
-1
Test user can not edit without permission
def test_no_permission(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_only_edit_perm(self):\n self.assertStatusCode(self.url, 403)", "def test_handle_edit_not_admin(self):\n test_user = User(\"userid\")\n team = Team(\"BRS\", \"brs\", \"brS\")\n self.db.retrieve.return_value = test_user\n self.db.query.return_value = [team]\n with...
[ "0.8186143", "0.78191847", "0.7762394", "0.7759971", "0.77389044", "0.7626638", "0.7610116", "0.75772184", "0.75056833", "0.7469706", "0.74189234", "0.7386552", "0.73486775", "0.7288264", "0.72760946", "0.7274553", "0.7251353", "0.72066283", "0.7193407", "0.7173011", "0.71517...
0.0
-1
Test that the edit button appears
def test_edit_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_the_edit_button_that_appears(driver):\n driver.find_element_by_xpath(xpaths.users.eric_Edit_Button).click()", "def test_update_custom_button(self):\n pass", "def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk'...
[ "0.73463446", "0.7318908", "0.71983856", "0.7112342", "0.7079817", "0.703186", "0.69559354", "0.69065946", "0.68714213", "0.6804673", "0.66963583", "0.66772723", "0.66686046", "0.66202444", "0.6597754", "0.6578515", "0.654788", "0.6525747", "0.6478392", "0.647718", "0.647047"...
0.76415926
0
Test that the edit button does not appear
def test_no_edit_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertNotContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertNotContains(response, self.url)", "def test_that_not_logged_in_does_not_shows_edit_button(testapp):\n ...
[ "0.7547432", "0.7475458", "0.7041201", "0.69749355", "0.6963794", "0.67356116", "0.67291766", "0.67238355", "0.6703853", "0.66721207", "0.66637516", "0.6596547", "0.64760447", "0.64688814", "0.64615196", "0.6449737", "0.6417447", "0.62691915", "0.62185276", "0.6200553", "0.61...
0.7441782
2
Test users can unpublish NewsItems
def test_has_permission(self): self.assertStatusCode(self.url, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)", "def test_no_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', k...
[ "0.7390404", "0.7325027", "0.72067845", "0.6946993", "0.67321724", "0.65183187", "0.63950413", "0.6372304", "0.62763035", "0.6249247", "0.6227952", "0.6131288", "0.61038554", "0.6050085", "0.6009835", "0.5970444", "0.59577054", "0.594893", "0.594354", "0.5930259", "0.59085625...
0.0
-1
Test user can not unpublish without permission
def test_no_permission(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unpublish_as_editor(self):\n e = self.make_event()\n e.published=True\n e.save()\n resp = self.request_with_role('/admin/events/unpublish/%s' % e.id, role='editor',\n method='POST')\n self.assertEqual(resp.status_code, 401)\n self.ass...
[ "0.74638283", "0.7355094", "0.70630115", "0.68820363", "0.6800916", "0.65782726", "0.6507541", "0.6507541", "0.6506113", "0.64861435", "0.64700913", "0.6458604", "0.64489305", "0.6434196", "0.6426245", "0.6423437", "0.6409583", "0.6387935", "0.63756144", "0.63734823", "0.6311...
0.58224934
91
Test that the unpublish button appears
def test_unpublish_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertNotContains(response, self.url)", "def test_unpublish_as_publisher(self):\n e = self.make_event()\n e.published=True\n ...
[ "0.79772043", "0.70692533", "0.67827237", "0.6501703", "0.6320983", "0.6103904", "0.60975456", "0.6091303", "0.60491884", "0.6046391", "0.6036287", "0.6016861", "0.60101634", "0.59801006", "0.5962303", "0.5924949", "0.5915684", "0.5897269", "0.58937395", "0.58638966", "0.5822...
0.8308116
0
Test that the unpublish button does not appear
def test_no_unpublish_button_appears(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertNotContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)", "def test_unpublish_as_publisher(self):\n e = self.make_event()\n e.published=True\n e.sav...
[ "0.8303605", "0.71829754", "0.69715375", "0.6870269", "0.67917633", "0.65356666", "0.65167207", "0.64881694", "0.6480685", "0.63422185", "0.6219732", "0.6219732", "0.62114465", "0.6083142", "0.60725623", "0.6066293", "0.60468704", "0.6006602", "0.5987236", "0.5967933", "0.594...
0.83218503
0
Test users can delete NewsItems
def test_has_permission(self): self.assertStatusCode(self.url, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_item_using_delete(self):\n pass", "def test_delete_of_an_escalated_article_with_user(self):\n token = self.user1.token()\n self.client.credentials(\n HTTP_AUTHORIZATION='Bearer ' + token)\n resp = self.delete_article()\n self.assertEqual(resp.status_c...
[ "0.7346576", "0.7196256", "0.7074144", "0.7073241", "0.70127547", "0.6967538", "0.69355977", "0.68979067", "0.6893966", "0.6867691", "0.68661195", "0.6843971", "0.6843971", "0.6819755", "0.6792642", "0.67875606", "0.6777115", "0.67718256", "0.6741807", "0.6733608", "0.6723089...
0.0
-1
Test user can not delete without permission
def test_no_permission(self): self.assertStatusCode(self.url, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_permission(self):\r\n self.assertFalse(self.creator_admin.has_delete_permission(self.request))", "def test_delete_user(self):\n pass", "def test_delete_user(self):\n pass", "def testDeleteIsAllowed(self):\n UserAPI().create([(u'user', u'secret', u'User', u'user@exa...
[ "0.8438554", "0.8078905", "0.8078905", "0.7888322", "0.78348", "0.78141594", "0.7754141", "0.77347636", "0.7728823", "0.7716653", "0.7666044", "0.7666044", "0.765646", "0.76123804", "0.74949557", "0.7486341", "0.7471117", "0.74592483", "0.7451529", "0.74371904", "0.74333715",...
0.0
-1
Test that the delete button appears on the index page
def test_delete_button_appears_index(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_custom_button(self):\n pass", "def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertContains(response, self.url)", "def test_no_delete_b...
[ "0.7964029", "0.7892996", "0.7400673", "0.73430234", "0.71478194", "0.7119191", "0.7053078", "0.6989711", "0.6853455", "0.6781707", "0.6727742", "0.6702557", "0.66956884", "0.6683815", "0.6649543", "0.66001225", "0.65985805", "0.65659857", "0.6558182", "0.6522168", "0.6506768...
0.81418383
0
Test that the delete button does not appear on the index page
def test_no_delete_button_appears_index(self): response = self.client.get(reverse('wagtailnews:index', kwargs={ 'pk': self.index.pk})) self.assertNotContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_button_appears_index(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)", "def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit...
[ "0.7858739", "0.78354084", "0.7627659", "0.75596243", "0.74663603", "0.7334929", "0.70581496", "0.7052979", "0.7024209", "0.68837976", "0.6852879", "0.67638767", "0.67259175", "0.671539", "0.6689493", "0.66716695", "0.6657678", "0.66534823", "0.66348356", "0.6614664", "0.6606...
0.80642617
0
Test that the delete button appears on the edit page
def test_delete_button_appears_edit(self): response = self.client.get(reverse('wagtailnews:edit', kwargs={ 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk})) self.assertContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_custom_button(self):\n pass", "def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertNotContains(response, self.url)", "def test_comme...
[ "0.8166414", "0.7414952", "0.723374", "0.7127024", "0.6995213", "0.68870395", "0.6840543", "0.67911434", "0.6724883", "0.6652456", "0.66225034", "0.65894556", "0.655768", "0.6549066", "0.6507977", "0.6503928", "0.6462864", "0.6460414", "0.64468193", "0.64352983", "0.637209", ...
0.82615966
0
Test that the delete button does not appear on the edit page
def test_no_delete_button_appears_edit(self): response = self.client.get(reverse('wagtailnews:edit', kwargs={ 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk})) self.assertNotContains(response, self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertContains(response, self.url)", "def test_delete_custom_button(self):\n pass", "def test_no_edit_but...
[ "0.7922662", "0.78152597", "0.74040025", "0.7340192", "0.7057694", "0.6956841", "0.6919261", "0.68916804", "0.6828039", "0.6781857", "0.67025316", "0.6697165", "0.66651994", "0.658142", "0.6545721", "0.6544052", "0.6535346", "0.6535192", "0.6469189", "0.64268947", "0.6397583"...
0.8121819
0
resize image to 227x227, since alexnet only take 227x227 input normalize and standardize input so it will learn faster
def process_images(image, label): # Normalize images to have a mean of 0 and standard deviation of 1 # per_image_standardization is preferred, which normalize the entire image to mean zero and std 1. # It also make learning fast. image = tf.image.per_image_standardization(image) # Resize images from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_128(img): \n return cv2.resize(img,(128,128))", "def image_resize(img, min_size=600, max_size=1000):\n C, H, W = img.shape\n scale1 = min_size / min(H, W)\n scale2 = max_size / max(H, W)\n scale = min(scale1, scale2)\n img = img / 255\n img = transform.resize(img, (C, H * scale, W...
[ "0.71284246", "0.6869551", "0.6833134", "0.6727817", "0.6690876", "0.6602364", "0.6560142", "0.6558303", "0.6550661", "0.65303195", "0.65273684", "0.64954686", "0.649254", "0.6489743", "0.6474268", "0.6472914", "0.6454352", "0.644202", "0.64024377", "0.6396688", "0.6371476", ...
0.0
-1
Load user submission to staging area Loads the testing files into the tmpdir Will create build folder and cd into that for compiling and marking Calls the compile and marking functions. If the program does not compile, the submission receives a zero and is not passed forward to marking.
def loadTmpDir(submissiondir, assndir, tmpdir, outputdir): # Deals with the joys of connex BS # Copy and open grade file in_gradefname = os.path.join(submissiondir, 'grades.csv') out_gradefname = os.path.join(outputdir, 'grades.csv') if not os.path.exists(in_gradefname): print("grade.csv do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # Specify path\n training_filepath = 'data/training.csv'\n testing_filepath = 'data/public_test_features.csv'\n\n # Check whether the specified path exists or not\n isExist = os.path.exists(training_filepath)\n if(isExist):\n print('Reading from ' + training_filepath)\n el...
[ "0.5892896", "0.5865184", "0.5749212", "0.5715827", "0.566875", "0.56655097", "0.5611292", "0.55734986", "0.5533466", "0.5521134", "0.54782826", "0.5474354", "0.54190505", "0.5393382", "0.53775716", "0.5355639", "0.53504", "0.53474844", "0.5336007", "0.5317935", "0.5317675", ...
0.5278558
23
Compile the user submission CMakeLists.txt should be in the cwd
def cpp_compile(threads=2): cmake_ret = subprocess.run(["cmake", "../"], encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = cmake_ret.stdout errors = cmake_ret.stderr output = "" errors = "" make_ret = subprocess.run(["make", f"-j{threads}"], encoding='utf-8', stdout=su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit(user, user_file):\n user_job = '{\"localFile\" : \"userfile\", \"destFile\" : \"primes.py\"}'.replace(\n \"userfile\", user_file)\n run(['bash', 'submit.sh', user_file, user_job, user])", "def build():\n\timport subprocess\n\tfrom os import listdir, getcwd\n\tfrom os.path import isfile, j...
[ "0.5829583", "0.57398903", "0.5694149", "0.56572914", "0.56046396", "0.5515011", "0.54561096", "0.54488283", "0.5433041", "0.54104203", "0.54102594", "0.5293359", "0.5293359", "0.52712715", "0.52614814", "0.51956767", "0.5161417", "0.514239", "0.51241314", "0.5068415", "0.506...
0.47778746
65
Mark student submissions using the test file Runs "make test" in cwd
def mark(): test_ret = subprocess.run(["make", "test"], encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = test_ret.stdout errors = test_ret.stderr lines = output.split('\n') # find the line with the info we are looking for i = 0 for idx, l in enumerate(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_students(submitdir):\n all_students = os.listdir(submitdir)\n all_students.remove(\"copyToMarking\")\n for student in all_students:\n \n # construct the path to the individual student's submission\n studentdir = submitdir + os.sep + student + os.sep + \"marking\" + os.sep...
[ "0.63928264", "0.634952", "0.61645955", "0.60830367", "0.60749525", "0.6020589", "0.5999138", "0.59990764", "0.5984428", "0.59788895", "0.59666836", "0.59627587", "0.5923612", "0.5902439", "0.5902212", "0.5883938", "0.582872", "0.5822552", "0.5814578", "0.58090425", "0.580015...
0.6165958
2
Frame a time series as a supervised learning dataset.
def series_to_supervised(self,data, n_in=1, n_out=1, dropnan=True): n_vars = 1 if type(data) is list else data.shape[1] df = pd.DataFrame(data) cols, names = list(), list() # input sequence (t-n, ... t-1) for i in range(n_in, 0, -1): cols.append(df.shift(i)) names += [('var%d(t-%d)' % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeseries_dataframe(self):\n return", "def get_dataset_from_series(dataset_pproc, n_hours):\n # obtenemos los valores como una matriz\n values = dataset_pproc.values\n # ensure all data is float\n values = values.astype(\"float32\")\n # normalize features\n scaler = MinMaxScaler(fea...
[ "0.6862202", "0.6632737", "0.63935363", "0.6334693", "0.6085144", "0.6066157", "0.5989121", "0.5984844", "0.5874774", "0.58342695", "0.58256793", "0.582205", "0.581701", "0.57913315", "0.5782771", "0.57459015", "0.5725978", "0.5696099", "0.5673701", "0.56698066", "0.56486726"...
0.5799269
13
Quantify the rhythmicity of an oscillation using lagged coherence.
def lagged_coherence(sig, f_range, fs, n_cycles=3, f_step=1, return_spectrum=False): # Identify Fourier components of interest freqs = np.arange(f_range[0], f_range[1] + f_step, f_step) # Calculate lagged coherence for each frequency lc = np.zeros(len(freqs)) for ind, freq in enumerate(freqs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_strehl(self):\n\n self.strehl = np.exp(-1*((2*np.pi/self.science_wavelength)*self.high_order_wfe)**2)", "def rochelobe(q):\n return 0.49*q**(2./3)/(0.6*q**(2./3) + log(1+q**(1./3)))", "def soundspeed(temp,pres):\n g_p = liq_g(0,1,temp,pres)\n g_tt = liq_g(2,0,temp,pres)\n g_tp...
[ "0.5506311", "0.54322857", "0.54039633", "0.53244144", "0.5197453", "0.51922834", "0.5187615", "0.5161913", "0.5131058", "0.5111093", "0.50948024", "0.5079271", "0.5075758", "0.5067517", "0.50656", "0.5057913", "0.5053487", "0.5033692", "0.5029003", "0.50254285", "0.5017855",...
0.0
-1
Calculate lagged coherence of sig at frequency freq using the hanningtaper FFT method
def _lagged_coherence_1freq(sig, freq, fs, n_cycles=3): # Determine number of samples to be used in each window to compute lagged coherence n_samps = int(np.ceil(n_cycles * fs / freq)) # For each N-cycle chunk, calculate the fourier coefficient at the frequency of interest, freq chunks = _nonoverlappi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_freqs(sig, fft_size):\n Lf = np.fft.fft(sig, fft_size)\n Lc = Lf[0:fft_size//2]\n La = np.abs(Lc[0:fft_size//2])\n Lg = np.angle(Lc[0:fft_size//2])\n return La, Lg", "def lagged_coherence(sig, f_range, fs, n_cycles=3, f_step=1, return_spectrum=False):\n\n # Identify Fourier components o...
[ "0.6763134", "0.6559883", "0.6400544", "0.6346103", "0.6291018", "0.62314177", "0.6180077", "0.6164072", "0.6131286", "0.61223423", "0.6004857", "0.60042465", "0.5987924", "0.5978381", "0.5971407", "0.59468603", "0.5940557", "0.5932638", "0.59309757", "0.5929165", "0.5924323"...
0.7040043
0
Split sig into nonoverlapping chunks of length N
def _nonoverlapping_chunks(sig, n_samples): n_chunks = int(np.floor(len(sig) / float(n_samples))) chunks = np.reshape(sig[:int(n_chunks * n_samples)], (n_chunks, int(n_samples))) return chunks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_n(seq, n):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split_seq(seq,size):\n for i in range(0,len(seq),size):\n if i+size<len(seq) and seq[i+size] - seq[i] == ...
[ "0.6515251", "0.65040153", "0.6353311", "0.63250804", "0.6303389", "0.6263644", "0.6134201", "0.6105199", "0.6078715", "0.6029697", "0.5970635", "0.59692246", "0.5947306", "0.5942355", "0.59412867", "0.5921488", "0.5913542", "0.59111804", "0.58984333", "0.5897976", "0.5883429...
0.81064266
0
Solution to the bombbaby puzzle. Here, we are given some dynamical update rules, a pair (m,f) could be succeeded either by (m+f,f) or (m,m+f). Given two numbers (m,f), we are tasked with finding the shortest path (in generations) to generate (m,f) from (1,1), or to determine that the outcome is impossible. The 'real ch...
def solution(m,f): m = int(m) f = int(f) # number of accumulated generations n = 0 ## A tail-recursive implementation with constant memory usage ## is easily possible, but unfortunately Python cannot handle/optimize ## tail recursion, and is still limited by maximum recursion d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mLFG(a,b,m):\n \n require_integers([\"a\",\"b\",\"m\"],[a,b,m])\n \n while True:\n yield a\n a,b = b,(a*b)%m", "def aLFG(a,b,m):\n \n require_integers([\"a\",\"b\",\"m\"],[a,b,m])\n \n while True:\n yield a\n a,b = b,(a+b)%m", "def ackermanFunc(m, n):\n\n...
[ "0.60956544", "0.6033427", "0.5956995", "0.5933056", "0.5878195", "0.58694607", "0.5835559", "0.58092266", "0.578852", "0.576956", "0.5687345", "0.5661254", "0.56494594", "0.5646951", "0.56302994", "0.56298953", "0.56073564", "0.560453", "0.55908364", "0.55840373", "0.5580158...
0.76117283
0
Prompts the user to specify how long their train has been delayed.
def ask_previous_delay(context=None): options = [ 'How long have you been waiting for?', 'How long has your train been delayed?', 'What\'s the length of the delay?', 'How many minutes are you being delayed for?', ] # Check for context if context: # Check for dep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setdelay(self):\n delay=self.inputdelay.getEntry()\n cmd=\"setDelay(\"+self.board+','+self.inpedge+','+delay+')'\n self.vb.io.execute(cmd,log=\"out\",applout=\"<>\")", "def setTimeDelay(*args):\n args[0].TimeState.TimeDelay.time_delay = args[1]", "def _delay(self, n=None):", "def wait(self, ms=None...
[ "0.61388785", "0.55709624", "0.5552502", "0.5459696", "0.54312676", "0.54147136", "0.53658587", "0.53658587", "0.5360396", "0.5349062", "0.533876", "0.5317978", "0.5289466", "0.5288345", "0.5288043", "0.52846265", "0.5271598", "0.52613497", "0.52591294", "0.5234578", "0.52275...
0.6142175
0
Although Spark docs don't mention the "unit" argument, Spark3 added support for it at some point. Databricks also supports this variant (see below).
def _parse_datediff(args: t.List) -> exp.Expression: unit = None this = seq_get(args, 0) expression = seq_get(args, 1) if len(args) == 3: unit = this this = args[2] return exp.DateDiff( this=exp.TsOrDsToDate(this=this), expression=exp.TsOrDsToDate(this=expression), unit=uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def useUnits():", "def unit_of_measurement(self):\n return None", "def native_unit_of_measurement(self):\n return self._unit_of_measurement", "def unit(cls, val):\n raise NotImplementedError", "def set_unit(self,unit):\n self.unit = unit", "def unit_of_measurement(self):\n ...
[ "0.6497393", "0.5888979", "0.5616296", "0.5584569", "0.55432117", "0.5522629", "0.5515228", "0.54870135", "0.547054", "0.5467974", "0.54404426", "0.5430543", "0.5413083", "0.54087776", "0.540503", "0.53957516", "0.5384174", "0.5380267", "0.5344825", "0.5342134", "0.53236264",...
0.0
-1
return a dic of attrs containing the parsed attributes of attrs
def parseAttrs(self,attrs,date_type): attrs=copy.copy(attrs) #make sure we don't change user/group attributes attr_holders=self.getAttrHolders(attrs) map(lambda x:x.setDateType(date_type),attr_holders) map(lambda x:attrs.update(x.getParsedDic()),attr_holders) return attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_attribute_dic(self, attrs):\n attr_dic = {}\n for attr_pair in attrs:\n attr_dic[attr_pair[0]] = attr_pair[1]\n return attr_dic", "def process_attrs(attrs):\n if attrs.getLength() == 0:\n return {}\n tmp_dict = {}\n for name in attrs.getNames():\n t...
[ "0.8419787", "0.83242214", "0.81790084", "0.7966316", "0.7808244", "0.769806", "0.7539741", "0.7467827", "0.7240442", "0.72257674", "0.7224075", "0.71555316", "0.71403545", "0.7140015", "0.71320254", "0.7071827", "0.70067286", "0.7001645", "0.6907734", "0.6907734", "0.6907734...
0.6255561
81
create attr searcher instances and execute their "run" method
def runAttrSearchers(self,conditions,admin_obj): search_helper=SearchUserHelper(conditions,admin_obj) attr_searchers=self.__getAllAttrSearchers(search_helper) map(lambda x:apply(getattr(x,"run")),attr_searchers) return search_helper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n self.args = args\n self.matchers = []\n for a in args:\n if a is _:\n a = lambda k: True\n elif isinstance(a, basestring):\n a = a.__eq__\n elif isinstance(a, (list, tuple, set)):\n a = (...
[ "0.55047566", "0.54139805", "0.5282983", "0.5266308", "0.5251558", "0.52377003", "0.52111524", "0.520506", "0.5197755", "0.51204234", "0.5095355", "0.50885457", "0.5088183", "0.5087449", "0.50618327", "0.5061558", "0.50412923", "0.5020508", "0.4992534", "0.49858615", "0.49814...
0.67694384
0
The ACE command line client provides a tool for configuring analytics and other ACE components as well as providing users with a means of sending frames directly to analytics running in the system. This CLI can also be used to run other ACE services, such as creating an RTSP server or starting and configuring a filteri...
def main(ctx, debug): if debug: logger.setLevel(logging.DEBUG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def cli(log_level):\n util.setup_logger(log_level)\n # if not util.check_in_path('aria2c'):\n # raise logger.ERROR(\"Aria2 is not in path. Please follow installation instructions: https:/...
[ "0.62369883", "0.6065571", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844", "0.59926844",...
0.0
-1
Command used to configure the specified analytic to connect to an RTSP stream, process the video, and publish the results to the specified database and kafka brokers (if any).
def config(ctx, stream_source, kafka_addr, db_addr, analytic_host, analytic_port, tags): tag_map = {} for tag_str in tags: tag_map.update(parse_tag(tag_str)) a = analytic_pb2.AnalyticData( addr="{!s}:{!s}".format(analytic_host, analytic_port)) client = aceclient.ConfigClient(host=analyti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video(ctx, video_file, analytic_addr):\n if not analytic_addr:\n analytic_addr = [\"localhost:50051\"]\n db = ctx.obj.db\n client = aceclient.AnalyticMultiClient()\n classes = {}\n cap = cv2.VideoCapture(video_file)\n window_names = []\n f_req = analytic_pb2.FrameRequest()\n for ...
[ "0.5585309", "0.52380216", "0.5229384", "0.52075493", "0.51906437", "0.51906437", "0.5142656", "0.51353914", "0.51277053", "0.5063001", "0.5056543", "0.50216717", "0.50200486", "0.49780482", "0.4960555", "0.49345553", "0.49277937", "0.49211228", "0.49086675", "0.4890077", "0....
0.5494512
1