query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Executes uworker_main of a utask.
def execute(self, task_argument, job_type, uworker_env): # These values are None for now. del job_type del uworker_env input_path = task_argument utasks.uworker_main(input_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utask_main(uworker_input):\n # Get deadline to finish this task.\n deadline = tasks.get_task_completion_deadline()\n\n # Locate the testcase associated with the id.\n testcase = data_handler.get_testcase_by_id(uworker_input.testcase_id)\n if not testcase:\n return\n\n # Update comments to reflect bot ...
[ "0.6592799", "0.6584488", "0.6151679", "0.60917395", "0.5936469", "0.57894874", "0.56936616", "0.5117679", "0.5112947", "0.51035345", "0.50557613", "0.49710706", "0.49703535", "0.49653524", "0.49606892", "0.49327928", "0.48630843", "0.48537174", "0.48239788", "0.47589198", "0...
0.68786454
0
Returns true if |command_name| is asking the bot to execute the trustedportion of a utask (preprocess and postprocess). The workflow for
def is_trusted_portion_of_utask(command_name): task_type = COMMAND_TYPES[command_name] # Postprocess and preprocess tasks are executed on tworkers, while utask_mains # are executed on uworkers. Note that the uworker_main command will be used to # execute uworker_main, while the name of the task itself will be u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_execute(self, message):\n\t\tif self.command_str is not None:\n\t\t\treturn message.content.startswith(\"{}{}\".format(cmd_prefix, self.command_str))\n\t\telse:\n\t\t\treturn False", "def is_cmd(self, name):\n \n return name in self.cmds", "def has_command_with_name(self, command_name)...
[ "0.6628396", "0.6341763", "0.61010563", "0.6000019", "0.5956287", "0.5875269", "0.5766882", "0.5753408", "0.5691533", "0.5653731", "0.56504345", "0.56447273", "0.5617064", "0.558748", "0.55396634", "0.5526971", "0.54412466", "0.54300296", "0.540894", "0.5387936", "0.53811234"...
0.8036643
0
Returns val if it's a number, or memory[val] otherwise
def get_val(self, val): try: return int(val) except ValueError: return int(self.registers[val])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast(val, regs):\n try:\n return int(val)\n except ValueError as ve:\n return regs[val]", "def _get_value(self, value):\r\n try:\r\n return int(value)\r\n except ValueError:\r\n return self.registers[value]", "def get_address_value(cls, addr):\n\t\tpr...
[ "0.58805645", "0.58731955", "0.5762528", "0.5755033", "0.5714117", "0.5663656", "0.5657975", "0.5530095", "0.5527874", "0.55196637", "0.5507359", "0.5379817", "0.53593343", "0.5324086", "0.5322418", "0.5300576", "0.5272352", "0.5244326", "0.52234364", "0.5215526", "0.52137566...
0.618178
0
Update given control signals based on inst_spec.
def SetControlSignals(inst_spec, itype, ctrl): itype <<= inst_spec.itype # # The Literal() function (see instructions.py) generates an Atlas 'literal' # value that can be used on the right-hand side of an assignment (as is done # below). # ctrl.ex <<= inst_spec.ex_ctrl.Literal() ctrl....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSignals(self):\n self.parser.read(self.file)\n self.signalType = self.parser.get('Signals', 'signalType')\n if self.signalType == 'single':\n self.single = self.parser.get('Signals', 'single')\n elif self.signalType == 'dual':\n self.fast = self.parser.ge...
[ "0.5736947", "0.5348778", "0.5193618", "0.5189527", "0.5170351", "0.50618017", "0.50196683", "0.49247122", "0.4921499", "0.48986036", "0.48947203", "0.48771906", "0.48701057", "0.48410356", "0.4823585", "0.48069215", "0.47758275", "0.477138", "0.47626817", "0.47603008", "0.47...
0.67490107
0
The primary register file for Geode. This register file contains two read and one write port.
def RegisterFile(): io = Io({ 'r0_addr': Input(Bits(Log2Ceil(C['reg-count']))), 'r0_en' : Input(Bits(1)), 'r1_addr': Input(Bits(Log2Ceil(C['reg-count']))), 'r1_en' : Input(Bits(1)), 'w0_addr': Input(Bits(Log2Ceil(C['reg-count']))), 'w0_data': Input(Bits(C['core-width...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peripheral_regfile(self, regfile, name='', base_address=0x0):\n\n # local alias\n av = self # register bus\n rf = regfile # register file definition\n\n # get the list-of-signals that represent the regfile\n al, rl, rol, dl = rf.get_reglist()\n addr_list, regs_l...
[ "0.6034706", "0.59078133", "0.5416123", "0.5315896", "0.5255332", "0.5240859", "0.5160738", "0.51302814", "0.50777", "0.4963432", "0.4909955", "0.48653468", "0.4853084", "0.48362663", "0.48134685", "0.48059726", "0.4796955", "0.47939265", "0.4781006", "0.47774667", "0.4772508...
0.67031235
0
The instruction decode stage for Geode. This stage consumes the instruction produced by the most recent imem access and produces control signals and a signextended immediate value. In addition, this module contains the register file and produces read values for register source data.
def DecodeStage(): io = Io({ 'if_id': Input(if_bundle), 'inst': Input(Bits(32)), 'stall': Input(Bits(1)), 'reg_write': Input(reg_write_bundle), 'ras_ctrl': Output(ras_ctrl_bundle), 'id_ex': Output(id_ex_bundle), 'rs1_data': Output(Bits(C['core-width'])), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode():\r\n # Open the file with binary instructions\r\n with open(file_name) as file:\r\n lines = file.readlines()\r\n with open(PATH + file_name, \"w\") as file_write:\r\n for line in lines:\r\n file_write.write(line + \"\\n\")\r\n\r\n # Read the instruction...
[ "0.52422917", "0.48928273", "0.4891811", "0.48560217", "0.4826264", "0.47931454", "0.478725", "0.47545552", "0.4701519", "0.46852124", "0.46659783", "0.46642125", "0.46184734", "0.45768088", "0.45673305", "0.45663705", "0.4565097", "0.45595637", "0.4558815", "0.45467347", "0....
0.53101176
0
Wrapper for tf.matmul to handle a 3D input tensor X. Will perform multiplication along the last dimension.
def matmul3d(X, W): Xr = tf.reshape(X, [-1, tf.shape(X)[2]]) XWr = tf.matmul(Xr, W) newshape = [tf.shape(X)[0], tf.shape(X)[1], tf.shape(W)[1]] return tf.reshape(XWr, newshape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matmul_3d_by_2d(in_tensor, in_matrix, name):\n with tf.name_scope(name, default_name=\"Matmul_3D_by_2D\", values=[in_tensor, in_matrix]):\n tensor_shape = tf.shape(in_tensor)\n matrix_shape = tf.shape(in_matrix)\n return tf.reshape(tf.matmul(\n tf.reshape(in_tensor, [tensor_s...
[ "0.73880917", "0.70586354", "0.6665486", "0.66470534", "0.6628609", "0.6539024", "0.6524309", "0.64226633", "0.63756275", "0.63578874", "0.6351136", "0.6317665", "0.62558126", "0.6218351", "0.62166584", "0.6211592", "0.61143637", "0.6046977", "0.6034157", "0.60330373", "0.600...
0.7766877
1
Make a fancy RNN cell. Use tf.nn.rnn_cell functions to construct an LSTM cell. Initialize forget_bias=0.0 for better training.
def MakeFancyRNNCell(hidden_units, is_train, keep_prob, num_layers=1): cell = tf.nn.rnn_cell.BasicLSTMCell(hidden_units, forget_bias=0.0,state_is_tuple=True) if is_train: cell = tf.nn.rnn_cell.DropoutWrapper(cell, input_keep_prob=keep_prob, output_keep_prob=keep_prob) cell = tf.nn.rnn_cell.MultiRNNC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MakeFancyRNNCell(H, keep_prob, num_layers=1):\n cells = []\n for _ in range(num_layers):\n cell = tf.nn.rnn_cell.BasicLSTMCell(H, forget_bias=0.0)\n cell = tf.nn.rnn_cell.DropoutWrapper(\n cell, input_keep_prob=keep_prob, output_keep_prob=keep_prob)\n cells.append(cell)\n retur...
[ "0.78747785", "0.7639967", "0.74660856", "0.73393416", "0.720917", "0.71914715", "0.7180293", "0.7115852", "0.7056523", "0.7051457", "0.7023873", "0.6989063", "0.69696546", "0.6959872", "0.6919868", "0.68901706", "0.68696064", "0.68200225", "0.68127483", "0.67832047", "0.6719...
0.83980954
0
L{CachingUserAPI.set} invalidates L{User}s to ensure the cache is always fresh.
def testSetInvalidatesCachedUsers(self): cache = UserCache() self.users.create([(u'user', u'hash', u'User', u'user@example.com')]) user = getUser(u'user') cache.save(user) self.users.set([(u'user', u'hash2', u'User2', u'user@example.com', Role.USER)]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testClear(self):\n user = User(u'testuser', 'hash', u'fullname',\n u'email@example.com', Role.USER)\n user.objectID = UUID('04585bec-28cf-4a21-bc3e-081f3ed62680')\n user.id = 1\n self.userCache.save(user)\n self.assertNotEqual({}, json.loads(self.cache.get(...
[ "0.63206255", "0.6239041", "0.6037295", "0.59857213", "0.5957234", "0.59255457", "0.59225523", "0.5908656", "0.5883347", "0.5804851", "0.5784229", "0.5772786", "0.5753557", "0.5731293", "0.5713896", "0.5657422", "0.5654774", "0.5643493", "0.5634091", "0.56192946", "0.56178147...
0.71436715
0
L{CachingUserAPI.delete} invalidates L{User}s to ensure the cache is always fresh.
def testDeleteInvalidatesCachedUsers(self): cache = UserCache() self.users.create([(u'user', u'hash', u'User', u'user@example.com')]) user = getUser(u'user') cache.save(user) self.users.delete([u'user']) cached = cache.get(u'user') self.assertIdentical(None, cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n\n user_id = get_jwt_identity()\n user = user_crud.get(user_id)\n if not user:\n abort(404, message=\"User not Found\")\n all_tokens = auth_crud.get_user_tokens(user_id)\n tokens = [token.to_dict() for token in all_tokens]\n for token in token...
[ "0.773925", "0.7428699", "0.7396749", "0.73698646", "0.7285817", "0.7275998", "0.7275998", "0.7275998", "0.7257163", "0.72521716", "0.7245495", "0.72087294", "0.7177763", "0.7172984", "0.71635026", "0.7144139", "0.7132386", "0.7091204", "0.70784503", "0.7039663", "0.70159113"...
0.77058977
1
L{getUser} adds missing L{User}s to the cache.
def testCachingGetUserUsesTheCache(self): createUser(u'user', u'password', u'User', u'user@example.com') user = self.getUser(u'user') self.assertIsInstance(user, User) # Delete the user from the store self.store.remove(user) user = self.getUser(u'user') self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_request():\n if 'user_key' in session:\n user = cache.get(session['user_key'])\n\n if user is None:\n # if the user is not available in memcache we fetch\n # it from the datastore\n user = User.get_by_key_name(session['user_key'])\n\n if user:...
[ "0.65135384", "0.62498146", "0.61357033", "0.61260444", "0.60963696", "0.5999933", "0.5951216", "0.5951216", "0.5951216", "0.58676547", "0.5826912", "0.5749707", "0.57448345", "0.5741831", "0.5714162", "0.5679868", "0.5673627", "0.5665487", "0.56632787", "0.56497926", "0.5636...
0.67583513
0
If L{UserCache.get} can't find a username in the cache, it returns it in the C{uncachedFields} of the L{CacheResult}.
def testGetReturnsUncachedUsername(self): result = self.userCache.get(u'testuser') self.assertIdentical(None, result.results) self.assertIdentical(u'testuser', result.uncachedValues)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self, username):\n return self._cache.get(username)", "def getUser(self, username):\r\n if (self._credCache is None or\r\n os.path.getmtime(self.filename) > self._cacheTimestamp):\r\n self._cacheTimestamp = os.path.getmtime(self.filename)\r\n self._cred...
[ "0.70665663", "0.6930752", "0.67943776", "0.67680264", "0.6695826", "0.6427036", "0.63393986", "0.6305542", "0.6223729", "0.6212584", "0.6166572", "0.614635", "0.6099459", "0.6024896", "0.5936805", "0.5919918", "0.5901436", "0.58985335", "0.5869537", "0.58669674", "0.58608776...
0.78936446
0
L{UserCache.save} stores a L{User} object in the cache.
def testSave(self): user = User(u'testuser', 'hash', u'fullname', u'email@example.com', Role.USER) user.objectID = UUID('04585bec-28cf-4a21-bc3e-081f3ed62680') user.id = 1 self.userCache.save(user) expected = {'username': 'testuser', 'objec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user(user):\n User.save_user(user)", "def save(self):\n users = User.getall()\n users[self.username] = dict(self)\n return self.db().put(self.udb, users)", "def save_user(self):\n db.session.add(self)\n db.session.commit()", "def save_user(self):\n\n User...
[ "0.7058516", "0.67909503", "0.6769596", "0.66412824", "0.6630806", "0.6630806", "0.6612456", "0.6574879", "0.6568598", "0.6535604", "0.6503006", "0.63838196", "0.6355027", "0.62969315", "0.6254048", "0.62147534", "0.62033594", "0.6135145", "0.61223334", "0.61082166", "0.60666...
0.7089535
0
L{UserCache.save} doesn't store the email if it's C{None}.
def testSaveWithNoneEmail(self): user = User(u'testuser', 'hash', u'fullname', None, Role.USER) user.objectID = UUID('04585bec-28cf-4a21-bc3e-081f3ed62680') user.id = 1 self.userCache.save(user) expected = {'username': 'testuser', 'objectID': '04585bec-28cf-4a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n if not self.id and User.objects.filter(email=self.email).exists():\n raise IntegrityError()\n super().save(*args, **kwargs)", "def test_email_is_optional(self):\n self.updated_data['email'] = ''\n self.update_user()\n self.assertEqu...
[ "0.65561724", "0.6460006", "0.63828677", "0.6158506", "0.61568534", "0.6129084", "0.6072426", "0.58946896", "0.5845287", "0.5831763", "0.5778681", "0.5758452", "0.5751286", "0.57251394", "0.5678467", "0.5649341", "0.5577546", "0.5574549", "0.5565182", "0.55609834", "0.5557282...
0.7602133
0
L{UserCache.clear} removes users objects from the cache.
def testClear(self): user = User(u'testuser', 'hash', u'fullname', u'email@example.com', Role.USER) user.objectID = UUID('04585bec-28cf-4a21-bc3e-081f3ed62680') user.id = 1 self.userCache.save(user) self.assertNotEqual({}, json.loads(self.cache.get('user:testu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache(self):\n pass", "def clear_cache():\n # TODO\n pass", "def clear_cache(self):\n self.mongo_database.cache.delete_many({})", "def reset_all_users():\n for user in User.objects.all():\n user.delete()", "def cleanPMUserCache(cache):\n\n removeUser = []\n n...
[ "0.70607805", "0.7050289", "0.70376426", "0.6966127", "0.6850462", "0.6749529", "0.6723224", "0.67149514", "0.6693951", "0.66863495", "0.6676159", "0.6618681", "0.6612367", "0.6585179", "0.65808356", "0.6518402", "0.6510977", "0.6491811", "0.64808726", "0.6465845", "0.6457393...
0.7352511
0
replot the stat based on selected row
def on_scatter_toolbar_table_click(self): #print('*** on table click ***') row = self.myTableWidget.currentRow() if row == -1 or row is None: return yStat = self.myTableWidget.item(row,0).text() self.myParent.replot()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_plot(self,ax):\n self.replot(ax)", "def plot_data(self):", "def update_plot():\n pass", "def replot(self,ax):\n for i,line in enumerate(self.lines):\n line.set_ydata(self.data[i].f)\n line.set_xdata(self.data[i].x)\n for line in self.lines: \n ...
[ "0.60310996", "0.5961721", "0.59443575", "0.58525187", "0.5459975", "0.5447468", "0.54446393", "0.542774", "0.5423931", "0.5422714", "0.5420948", "0.54185706", "0.54017895", "0.5373525", "0.53420407", "0.5312166", "0.53026396", "0.52903605", "0.52900815", "0.5285374", "0.5284...
0.6480088
0
visually select a point in scatter plot
def _selectInd(self, ind): logger.info(f'plotNumber:{self.plotNumber} ind: {ind}') if ind > len(self.plotDf)-1: return xVal = self.plotDf.at[ind, self.stateDict['xStat']] yVal = self.plotDf.at[ind, self.stateDict['yStat']] if self.scatterPlotSelection is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter_points(self):\n self.plot(1)", "def inter_scatter(xdata,ydata, xlabel, ylabel, colours, title, datalabels):\n fig = plt.figure()\n ax = plt.subplot()\n ax.scatter(xdata, ydata, c = colours, picker=True, s = 5 )\n plt.title(title)\n plt.xlabel(xlabel)\n plt.ylabel(ylabel)...
[ "0.748926", "0.67908734", "0.6651126", "0.652679", "0.6444487", "0.6235487", "0.622473", "0.62231815", "0.62062585", "0.6193854", "0.61508846", "0.6145576", "0.61234045", "0.61209714", "0.60633296", "0.60369855", "0.6036804", "0.6010712", "0.59805655", "0.5958724", "0.5942313...
0.74631494
1
update globals but do not plot globals are things shared across all plots like mpl toolbar and legend (???)
def myUpdateGlobal(self, stateDict): self.canvas.axes.legend().set_visible(stateDict['showLegend']) #self.myLegend.set_visible(stateDict['showLegend']) if stateDict['showMplToolbar']: self.mplToolbar.show() else: self.mplToolbar.hide() if stateDict['doHo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doPlots(self):\n ax = self.sp.ax\n if ax: ax.helper.doPlots()\n # Setting calls now use new local options\n self.opts.newLocal()", "def updateGlobal(self):\n state = self.getState()\n n = len(self.myPlotCanvasList)\n for i in range(n):\n if self.my...
[ "0.7136725", "0.71208197", "0.69662887", "0.6544124", "0.6506336", "0.62599367", "0.6176364", "0.6165653", "0.6165653", "0.61404157", "0.61018187", "0.6099678", "0.60163236", "0.6005408", "0.5995129", "0.5962337", "0.59540373", "0.59223676", "0.590179", "0.590179", "0.5900819...
0.71902066
0
switch model for mean table (Self.xxx)
def _switchTableModel(self, newModel): #print('bScatterPlotMainWindow._switchTableModel()') self.signalMeanModelChange.emit(newModel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelmean(self, model_params, this_data, this_suff_stat):\n pass", "def model_switch_to_training(self):\n pass", "def front_column_model_p_gain():", "def reset(self, model):\n def replace_parameters(module, target_weight, target_bias=None):\n module.weight = nn.Parameter(t...
[ "0.67934966", "0.60766894", "0.58103824", "0.57759386", "0.57472", "0.5741252", "0.57362556", "0.56253165", "0.5610932", "0.559356", "0.55697846", "0.5541668", "0.5513365", "0.55085325", "0.5499417", "0.54983395", "0.5486742", "0.54799324", "0.5479599", "0.5449819", "0.544746...
0.69430614
0
Respond to signal self.tableView.clicked
def slotTableViewClicked(self, clickedIndex): row=clickedIndex.row() model=clickedIndex.model() logger.info(f'row:{row} clickedIndex:{clickedIndex}') # select in plot for oneCanvas in self.myPlotCanvasList: if oneCanvas is not None: oneCanvas._selectI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectSignals(self):\n QtCore.QObject.connect(self.list_view, QtCore.SIGNAL(\"clicked(QModelIndex)\"),\n self.openFile)", "def on_tableWidget_Trade_Args_cellClicked(self, row, column):\n # TODO: not implemented yet\n raise NotImplementedError", "def handl...
[ "0.6278429", "0.61831206", "0.6127437", "0.6059382", "0.60591596", "0.6027708", "0.5973218", "0.5955884", "0.592479", "0.5897677", "0.5894791", "0.5836359", "0.57231337", "0.56931245", "0.5668279", "0.55650187", "0.5546571", "0.55259275", "0.5482555", "0.54822165", "0.5467551...
0.68858665
0
Extract the period from the the provided signal
def get_period(signal, signal_sr): # perform a sanity check if signal is None: raise ValueError("Input signal cannot be None") # transform the signal to the hilbert space hy = hilbert(signal) ey = np.sqrt(signal ** 2 + hy ** 2) min_time = 1.0 / signal_sr tot_time = len(ey) * min_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def period(self) -> int:", "def period(self, value: int, /) -> None:", "def fft_find_period(data):\n fourier = np.fft.fft(data) # 傅里叶变换\n modulus = np.abs(fourier) # 振幅?自相关?\n max_ind = np.argmax(modulus[1:]) + 1\n n = len(data)\n timestep = 1 # 最小分辨率\n freq_ary = np.fft.fftfreq(n, timeste...
[ "0.70984435", "0.6538235", "0.6534962", "0.64168197", "0.64149565", "0.64149565", "0.64149565", "0.64149565", "0.64149565", "0.64149565", "0.64149565", "0.64149565", "0.6410683", "0.6346873", "0.6316261", "0.6204189", "0.61718976", "0.6147146", "0.6103969", "0.6095955", "0.60...
0.77004224
0
Extracts the Melfrequency cepstral coefficients (MFCC) from the provided signal
def extract_mfcc(signal, signal_sr=SR, n_fft=FRAME_LEN, hop_length=HOP, n_mfcc=MFCC_dim): # compute the mfcc of the input signal mfcc = librosa.feature.mfcc( y=signal, sr=signal_sr, n_fft=n_fft, hop_length=hop_length, n_mfcc=n_mfcc, dct_type=3 ) # extract the first and second order deltas from ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mfcc(signal,samplerate=16000,winlen=0.025,winstep=0.01,numcep=13,\n nfilt=23,nfft=512,lowfreq=20,highfreq=None,dither=1.0,remove_dc_offset=True,preemph=0.97,\n ceplifter=22,useEnergy=True,wintype='povey'):\n feat,energy = fbank(signal,samplerate,winlen,winstep,nfilt,nfft,lowfreq,highfreq,dit...
[ "0.759154", "0.75382686", "0.7180689", "0.68264645", "0.68051136", "0.6783081", "0.6781847", "0.65965694", "0.65184706", "0.64992434", "0.6469248", "0.64137614", "0.6402052", "0.63880444", "0.63148886", "0.6281936", "0.6263741", "0.62393486", "0.6217584", "0.61987865", "0.618...
0.76791483
0
Extract hancrafted features from the input signal.
def extract_features_hc(signal, signal_sr): # extract the signal features signal_features, trimmed_signal = extract_signal_features(signal, signal_sr) # extract the mfcc's from the trimmed signal and get the statistical feature. mfccs = extract_mfcc(trimmed_signal) return np.concatenate((signal_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self, inputs):\n pass", "def extract_signal_features(signal, signal_sr):\n\n # normalise the sound signal before processing\n signal = signal / np.max(np.abs(signal))\n signal = np.nan_to_num(signal)\n # trim the signal to the appropriate length\n trimmed_signal, idc = ...
[ "0.6755068", "0.63000125", "0.62263036", "0.61218923", "0.6110187", "0.6108695", "0.6107083", "0.60533607", "0.60296726", "0.6009989", "0.6004884", "0.5998477", "0.5991481", "0.59679574", "0.5950577", "0.59461135", "0.5931205", "0.59294534", "0.5862456", "0.58572507", "0.5827...
0.6388671
1
Extract all sound features (handcrafted + VGG) from the input signal
def extract_sound_features(metadata, audio_dataset_path): import vggish_input import vggish_params import vggish_slim with tf.Graph().as_default(), tf.Session() as sess: # load pre-trained vggish model vggish_slim.define_vggish_slim() vggish_slim.load_vggish_slim_checkpoint(ses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(wavfile, feature, sampling_rate=16000):\n\n raw_signal, sr = librosa.core.load(wavfile,\n sampling_rate,\n mono=True,\n dtype='float'\n )\n\n\n if feature == 'MFCC':\n feat_seq = librosa.feature.mfcc(raw_signal,\n sampling_rate,\n n_ff...
[ "0.6706339", "0.6657797", "0.66045797", "0.64384127", "0.6363259", "0.6324644", "0.630266", "0.6300102", "0.62188286", "0.6072575", "0.59740984", "0.5878169", "0.58593893", "0.58389527", "0.58302414", "0.58034766", "0.5803223", "0.5794859", "0.5782613", "0.57785773", "0.57244...
0.67601633
0
_load_extensions(path) Where path is a directory containing extension modules, basically python scripts containing functions to make testing easier.
def _load_extensions(path): extension_dir = os.environ.get(path, path) print(f"looking for extensions in {extension_dir}") if not os.path.isdir(extension_dir): print(f"No such {extension_dir}") return import sys import importlib sys.path.append(path) imports = [ filename ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_extensions(self):\n extension_module_name = f\"{utils.get_project_name()}.cogs\"\n for extension in CONF.LOADED_EXTENSIONS:\n try:\n self.load_extension(extension_module_name + \".\" + extension)\n LOG.debug(f\"The extension '{extension.split('.')[0]}...
[ "0.6876064", "0.6848801", "0.67258954", "0.64945656", "0.64478", "0.64290076", "0.634863", "0.62544084", "0.6215138", "0.61788785", "0.6156764", "0.6060829", "0.59870154", "0.59660614", "0.59611404", "0.5940448", "0.59081095", "0.590406", "0.5901972", "0.5868798", "0.5760118"...
0.8750006
0
Generates the specified example curve. Generates a 2xT array of numbers that give the coordinates of the nodes of the curve (and optionally its derivative w.r.t. its parameterization t) specified by 'name' and param1,param2,param3. The input arguments 'name' and 't' need to be specified, but the curvespecific parameter...
def curve_example(name, t, param1=None, param2=None, param3=None): if np.isscalar(t): # then t is the number of nodes t = np.linspace( 0.0, 1.0, t ) # now t is the array of nodes [0 h 2h .... 1] n = len(t) if name == 'circle': r = param1 if param1 is not None else 1.0 C =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_curve(self, **args):\n if \"name\" not in args:\n raise KeyError(\"No curve name given.\")\n if \"coords\" not in args:\n raise KeyError(\"No coordinates given.\")\n if \"values\" not in args:\n raise KeyError(\"No values given.\")\n if len(args[...
[ "0.61331236", "0.5711774", "0.53900844", "0.53244305", "0.5280862", "0.52690184", "0.52690184", "0.5250512", "0.52365875", "0.51998883", "0.51961094", "0.51711726", "0.5094311", "0.5086748", "0.50850046", "0.5073083", "0.50568026", "0.5047064", "0.50305986", "0.5022265", "0.4...
0.80247974
0
Generates an example reparameterization function gamma(t).
def gamma_example(name, param1=None, param2=None): if name == 'identity': gamma = lambda s: s dgamma = lambda s: np.ones(len(s)) elif name == "flat+steep": gamma = flat_steep dgamma = lambda s: 1 elif name == 'polynomial': a = param1 if param1 is not None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gamma(flag, S, K, t, r, sigma, q):\n\n b = r-q\n\n return numerical_gamma(flag, S, K, t, r, sigma, b, f)", "def gamma(k, z):\n return 1", "def estG(self, R, gamma, T):\n if T < 2:\n print(\"The trajectory is not valid!\")\n sys.exit(1)\n else:\n G = n...
[ "0.6359254", "0.61615777", "0.61484605", "0.6116787", "0.6111899", "0.6098207", "0.6046198", "0.6042693", "0.5996652", "0.5985765", "0.59231", "0.58998877", "0.5865027", "0.58347934", "0.58159065", "0.5805619", "0.57942295", "0.57893234", "0.5785024", "0.5760069", "0.5749973"...
0.62480253
1
Configuring an addressbook(set security addressbook...) (set logicalsystems lsys1 security addressbook...)
def configure_address_book(device=None, address_book_name=None, addresses=None, address_set_name=None, address_set=None, attach_zone=None, logical_systems=None, commit=False): if device is None: raise Exception("'device' is mandatory parameter for configuring an application") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_book_config(device=None, mode=\"set\", **kwargs):\n if device is None:\n raise Exception(\"Device handle is a mandatory argument\")\n\n addr_name = kwargs.get('addr_name', None)\n addr_set = kwargs.get('addr_set', None)\n ip_prefix = kwargs.get('ip_prefix', None)\n addr_set_name =...
[ "0.6248633", "0.55673414", "0.5314912", "0.5236194", "0.51923275", "0.51152927", "0.5072222", "0.50640446", "0.50144076", "0.49871236", "0.49781147", "0.49734813", "0.4969781", "0.4957126", "0.49280006", "0.4914681", "0.48688605", "0.48628506", "0.4852834", "0.48295894", "0.4...
0.6119146
1
Utility function for process images from MRI fids and combining the channels using the sum of squares processing; reducing the diemsionality of the data by 1. Applies ndim FFT and zero freq shift prior to combining channel data by sumofsqaures method.
def process_sum_square( fids, ndim=2 ): img = process( fids, ndim) img *= np.conj(img) return np.squeeze(np.sqrt( np.sum( np.abs(img), axis=0) ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process( fids, ndim=2 ):\n\timg = np.empty_like( fids )\n\tax = -1*(np.array( range(ndim) )+1)\n\t\n\timg = np.fft.fftshift( np.fft.fftn( fids, axes=ax, ).astype( np.complex64), axes=ax )\n\t\n\treturn np.squeeze(img)", "def image_reduction(self, FF_name, BF_name, DF_name):\n print '----------------...
[ "0.657754", "0.5959673", "0.5860905", "0.574902", "0.5630167", "0.5411804", "0.54078305", "0.5366531", "0.5320234", "0.5319785", "0.5289418", "0.5262578", "0.5236267", "0.52353674", "0.51927364", "0.5186559", "0.5176783", "0.51720285", "0.5166814", "0.51348925", "0.51344746",...
0.708026
0
Utility function for process images from MRI fids. Applies ndim FFT and zero freq shift.
def process( fids, ndim=2 ): img = np.empty_like( fids ) ax = -1*(np.array( range(ndim) )+1) img = np.fft.fftshift( np.fft.fftn( fids, axes=ax, ).astype( np.complex64), axes=ax ) return np.squeeze(img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _imfilter(x_data, f_data):\n return pipe(f_data, ifftshift, fftn, lambda x: x * fftn(x_data), ifftn).real", "def to_freq_space(img,mask):\n img_f = np.fft.fft2(img) # FFT\n #print('img_f = ', img_f)\n img_undersample = img_f * ( mask)\n #print('img_under = ', img_undersample)\n #plt.figure...
[ "0.5895258", "0.5843952", "0.567556", "0.5664679", "0.5541432", "0.5496599", "0.54671603", "0.5422096", "0.5414651", "0.5408185", "0.5388965", "0.53729117", "0.53548676", "0.53525287", "0.5344764", "0.5313876", "0.53069645", "0.53005946", "0.5257108", "0.5253687", "0.52490556...
0.7794177
0
Creates spec and control limits
def create_limits(p, df, xaxis, metric_attrib): #Creates the specification and control limits time_range = [min(df[xaxis]), max(df[xaxis])] if metric_attrib['usl'] != "NA": usl = metric_attrib['usl'] p.line(time_range, 2*[usl], color='red', lege...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_limit(self, test_suite_name, test_instance, test_pins, test_modes, test_numbers, usl_list, lsl_list, test_limits_dict=None):\n if not test_limits_dict:\n test_limits_dict = self.test_limits_dict\n if not isinstance(test_modes, list):\n test_modes = [test_modes]\n ...
[ "0.6308946", "0.62537664", "0.6140157", "0.5992715", "0.5766335", "0.56663066", "0.55813056", "0.55786115", "0.55198485", "0.5510212", "0.5495408", "0.54922944", "0.54656434", "0.5456835", "0.54165673", "0.541265", "0.54029864", "0.539856", "0.5396237", "0.5392576", "0.538545...
0.6350971
0
Create a temporary file with the given content, and execute tbe given function after the temporary file has been closed. The file is guaranteed to be deleted whether function succeeds or not
def run_with_tempfile(content, function, mode="w"): f = NamedTemporaryFile(mode=mode, delete=False) try: f.write(content) f.close() return function(f.name) finally: f.close() os.remove(f.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeTestFile(text):\n f = tempfile.NamedTemporaryFile()\n f.write(text)\n f.flush()\n return f", "def make_tempfile(content=None):\n fd, tmpfile = mkstemp()\n\n if content:\n write(fd, content)\n\n close(fd)\n return tmpfile", "def get_file(content):\n fde = tempfile.Named...
[ "0.696316", "0.6734355", "0.67312926", "0.67084134", "0.663623", "0.6562515", "0.6507107", "0.6481868", "0.6435379", "0.63675094", "0.63634664", "0.6349387", "0.6314697", "0.6295794", "0.62846774", "0.6245273", "0.621032", "0.6182933", "0.6182456", "0.618182", "0.6158046", ...
0.86484283
0
API endpoint to upload excel sheet
def excelSheetData(request, *args, **kwargs): if request.method == "POST": try: file = request.FILES.get('file') # Reading file using pandas data = pd.read_excel(file, dtype={'Column1': str, 'Column10': str}) # data = pd.read_excel(file, dtype={'ASOF': str, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_sheet(self, request):\n file = self.request.data['file']\n\n # validating requested payload.\n if not file:\n return Response(\"Got no file! Please hit me again with file.\")\n # Only .csv/xls format file are allowed\n if file.name.rsplit('.')[1] == 'csv':\n...
[ "0.7384743", "0.7086318", "0.667222", "0.6189384", "0.6166458", "0.6036736", "0.59621745", "0.5958881", "0.58606374", "0.5818634", "0.57912683", "0.57526237", "0.5691375", "0.5609803", "0.5558857", "0.5544932", "0.5537596", "0.55355155", "0.5528366", "0.55272907", "0.5509852"...
0.7357898
1
Checks valid email format
def is_valid_email(self, email): rex = "^[\w]+[\d]?@[\w]+\.[\w]+$" return re.match(rex, email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self):\n # source: https://docs.python.org/2/howto/regex.html\n if not re.match(r\"[^@.]+@[A-Za-z]+\\.[a-z]+\", self.email):\n return 'Invalid email address!'\n return self.email", "def is_valid_email(email):\n return \"@\" in email and \".\" in email", "def ...
[ "0.77603203", "0.76291794", "0.75458664", "0.75293684", "0.7497755", "0.7488799", "0.74762905", "0.7444427", "0.73887795", "0.73887235", "0.7387213", "0.7383561", "0.73558056", "0.7317135", "0.7316265", "0.72983664", "0.7290154", "0.72854716", "0.7279127", "0.72720516", "0.72...
0.7670356
1
Return a filename within the output directory.
def GetOutputFilename(fname): return os.path.join(outdir, fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_output_path(self, filename):\n return os.path.join(self._output_directory, filename)", "def getOutputFile(fname):\n return os.path.join(Configurations.getOutputDir(), fname)", "def get_filename(out_dir, file_date, extension):\n return path.join(out_dir, f'CrossrefCitations_{file_date...
[ "0.79068506", "0.7682309", "0.7528231", "0.74512047", "0.7444181", "0.73997456", "0.73594296", "0.73369807", "0.7334667", "0.7203401", "0.72021586", "0.71942586", "0.718863", "0.7164495", "0.71479046", "0.7146181", "0.71377903", "0.7103986", "0.7084866", "0.70560557", "0.7038...
0.8252266
0
Add a list of input directories, where input files are kept.
def SetInputDirs(dirname): global indir indir = dirname tout.Debug("Using input directories %s" % indir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_directory(current_path, parent_dir, path_list):\n try:\n for item in scandir(current_path):\n path_list.append(join(current_path, item.name))\n except PermissionError:\n pass", "def split_input_dirs(self, paths):\n\n for path in paths:\n yield path", "de...
[ "0.6542568", "0.63296777", "0.6250825", "0.6199112", "0.610647", "0.6038407", "0.6030287", "0.6025278", "0.6025278", "0.5992349", "0.5966089", "0.595913", "0.59172374", "0.59054834", "0.588247", "0.5877849", "0.58401114", "0.5793068", "0.57564956", "0.5735068", "0.56827235", ...
0.6547283
0
Set the path to search for tools
def SetToolPaths(toolpaths): global tool_search_paths tool_search_paths = toolpaths
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUtilPath(self):\r\n utilpath.COMMANDER = _search_file(BASE_DIR,'Commander',True)[0]\r\n utilpath.STATBLOCKFIELDREADER = _search_file(BASE_DIR,'StatBlockFieldReader',True)[0]\r\n utilpath.HOSTMANAGER = _search_file(BASE_DIR,'HostManager',True)[0]\r\n utilpath.DATAVIEW = _search_fi...
[ "0.6995057", "0.68291336", "0.6618051", "0.65983933", "0.65538526", "0.6453777", "0.63016194", "0.62757593", "0.6189143", "0.6185107", "0.61420476", "0.6093446", "0.5949574", "0.5948626", "0.59212077", "0.5906891", "0.5887044", "0.5755212", "0.5747042", "0.5739396", "0.572380...
0.81573063
0
Resolve a file path to an absolute path. If fname starts with / and chroot is available, / gets replaced with the chroot path. If chroot is not available, this file name can not be resolved, `None' is returned. If fname is not prepended with the above prefix, and is not an existing file, the actual file name is retriev...
def Filename(fname): if fname.startswith('##/'): if chroot_path: fname = os.path.join(chroot_path, fname[3:]) else: return None # Search for a pathname that exists, and return it if found if fname and not os.path.exists(fname): for path in search_paths: pathn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_file(filename, search_path, pathsep=os.pathsep):\n for path in string.split(search_path, pathsep):\n candidate = os.path.join(path, filename)\n if os.path.exists(candidate): return os.path.abspath(candidate)\n return None", "def search_file(filename, search_path, pathsep=os.pathsep...
[ "0.6556237", "0.6556237", "0.6362824", "0.6302942", "0.5983575", "0.5954136", "0.5920078", "0.58796614", "0.5873802", "0.58684903", "0.5848765", "0.5835817", "0.5798721", "0.5786824", "0.57293224", "0.57009906", "0.56894046", "0.567273", "0.5667614", "0.55977374", "0.5596409"...
0.6848928
0
Convert a byte to a character This is useful because in Python 2 bytes is an alias for str, but in Python 3 they are separate types. This function converts an ASCII value to a value with the appropriate type in either case.
def ToChar(byte): return chr(byte) if type(byte) != str else byte
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ToByte(ch):\n return ord(ch) if type(ch) == str else ch", "def ascii_to_character():\n c = int(input(\"Enter a ASCII value: \"))\n print(\"The character for ASCII value '{}' is {}\".format(c, chr(c)))", "def toChar(integer):\n\tif integer >= 0x80:\n\t\treturn eval(u\"'\\\\x%02X'\"%integer)\n\telse...
[ "0.77193636", "0.74389523", "0.71454066", "0.68444216", "0.68192506", "0.6804314", "0.67649716", "0.67414314", "0.6503247", "0.64818764", "0.64240617", "0.637185", "0.63654816", "0.62920666", "0.62736773", "0.6215953", "0.6103034", "0.6059591", "0.60465175", "0.5998226", "0.5...
0.8612316
0
Compress some data using a given algorithm Note that for lzma this uses an old version of the algorithm, not that provided by xz. This requires 'lz4' and 'lzma_alone' tools. It also requires an output directory to be previously set up, by calling PrepareOutputDir().
def Compress(indata, algo, with_header=True): if algo == 'none': return indata fname = GetOutputFilename('%s.comp.tmp' % algo) WriteFile(fname, indata) if algo == 'lz4': data = Run('lz4', '--no-frame-crc', '-c', fname, binary=True) # cbfstool uses a very old version of lzma elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Compress(input_filename, output_filename):\n _Write(zlib.compress(_Read(input_filename)), output_filename)", "def compress_file(compression, pretty, src, dst):\n str_tail = \"sed 1d\"\n str_cleanup = \";exit\"\n if pretty:\n str_tail = \"tail -n+2\"\n str_cleanup = \";rm ~;exit\"\n if \"lzma\" == ...
[ "0.6223333", "0.58320516", "0.56864977", "0.56864977", "0.56745553", "0.5614417", "0.5590766", "0.55787146", "0.55589175", "0.55197126", "0.5508625", "0.5496768", "0.54746044", "0.54536915", "0.54491365", "0.5365819", "0.53569126", "0.53339446", "0.5310723", "0.5308122", "0.5...
0.7375073
0
Decompress some data using a given algorithm Note that for lzma this uses an old version of the algorithm, not that provided by xz. This requires 'lz4' and 'lzma_alone' tools. It also requires an output directory to be previously set up, by calling PrepareOutputDir().
def Decompress(indata, algo, with_header=True): if algo == 'none': return indata if with_header: data_len = struct.unpack('<I', indata[:4])[0] indata = indata[4:4 + data_len] fname = GetOutputFilename('%s.decomp.tmp' % algo) with open(fname, 'wb') as fd: fd.write(indata) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress(data):\n pickled = zlib.decompress(data)\n return pickle_util.load(pickled)", "def decompress(data):\n compression_type = ord(data[0:1])\n if compression_type == 0:\n return data\n elif compression_type == 2:\n return zli...
[ "0.63721454", "0.635455", "0.6353785", "0.6321827", "0.60929906", "0.6081484", "0.6065513", "0.60409904", "0.59250253", "0.5893188", "0.58730775", "0.58566064", "0.5856275", "0.5787938", "0.5783741", "0.5783741", "0.5689562", "0.5634158", "0.56267583", "0.5615433", "0.5584401...
0.7470436
0
Iterates over a directory yielding tuples ``(model, protocol)`` where
def iterdir(path, guarantee_model_names=True): # Fix path path = os.path.expanduser(os.path.abspath(path)) if not os.path.isdir(path): raise ValueError('Given path is not a directory.') # Scan files for fname in sorted(os.listdir(path)): fpath = os.path.join(path, fname) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dedup_model_dir(model_directory):\n root = Path(model_directory)\n results = defaultdict(lambda: defaultdict(list))\n\n for implementation_path in root.iterdir():\n implementation_results = dedup_implementation_dir(implementation_path)\n for protocol, model_dicts in implementation_result...
[ "0.61792064", "0.58637816", "0.5846289", "0.57381916", "0.5694947", "0.56699145", "0.56688094", "0.55739194", "0.55447733", "0.5505068", "0.54890054", "0.5410096", "0.54074204", "0.53999466", "0.53833705", "0.5383127", "0.53742254", "0.5363918", "0.5362736", "0.5333145", "0.5...
0.72479665
0
Returns the variable bound to `binding` from the given
def binding(model, binding): var = model.binding(binding) if var is None: raise myokit.IncompatibleModelError( model.name(), 'No variable found with binding "' + str(binding) + '".') return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binding(self, v: str) -> Optional[str]:\n assert is_var(v)\n t = self\n ret = t.binding.get(v)\n while not ret and t.parent:\n t = t.parent\n ret = t.binding.get(v)\n return ret", "def lookup(self, variable):\n for binding in self.bindings:\...
[ "0.67766637", "0.6677324", "0.65505093", "0.6339696", "0.628388", "0.6258308", "0.6204852", "0.6185816", "0.618469", "0.61041546", "0.60743606", "0.6000287", "0.59985673", "0.59162676", "0.5905713", "0.5894709", "0.5825109", "0.57859683", "0.5728141", "0.5722611", "0.571233",...
0.78081375
0
Checks if the given variable's unit can be converted into units `unit` and, if so, returns the appropriate conversion factor. If not, a
def unit(variable, unit): try: return myokit.Unit.convert(1, variable.unit(), unit) except myokit.IncompatibleUnitError: raise myokit.IncompatibleModelError( variable.model().name(), 'Incompatible units: ' + str(variable.unit()) + ' and ' + str(unit) + '.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conversion_factor_internal(unit: str):\n return globals()[unit]", "def _convert_unit(self, unit):\n if unit in self.units:\n return self.units[unit]\n elif unit in unit_map:\n return unit_map[unit]\n else:\n raise SBMLError('Unit not recognized: ' + st...
[ "0.72050637", "0.71823657", "0.70987743", "0.7093719", "0.7055857", "0.69677114", "0.6825671", "0.67841786", "0.6749037", "0.6733423", "0.6701637", "0.6664573", "0.6524792", "0.64470017", "0.6440047", "0.63927376", "0.6315019", "0.62821126", "0.6275423", "0.622558", "0.620977...
0.74828035
0
Calculate the finite difference weights for approximating the kth derivative at x_bar based on points x. Based on the approach described by Randall J. LeVeque in Chapter 1 of Finite Difference Methods for Ordinary and Partial Differential Equations
def finite_difference_weights(x, x_bar, k): n = len(x) L = np.zeros((n, n)) for i in range(1, n+1): for j in range(1, n+1): L[i-1, j-1] = 1./factorial(i-1.)*(x[j-1]-x_bar)**(i-1.) r = np.zeros(n) r[k] = 1. c = np.linalg.solve(L, r) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dcweights(x):\n\n #Form the vanderMonde matrix:\n A=np.vander(x).T\n A=A[::-1,:]\n F=0*A\n n=snp.arange(len(x))+1\n for i in range(len(x)-1):\n a=x[i]; b=x[i+1]\n f=(b**n-a**n)/n\n F[:,i]=f\n w=snp.solve(A,F)\n\n return w[:,:-1]", "def getCurvature(f,x):\n df =...
[ "0.5916175", "0.5808175", "0.57658887", "0.57546985", "0.5730765", "0.5721213", "0.57035285", "0.5701481", "0.565435", "0.5633175", "0.55855006", "0.5573417", "0.55621237", "0.55608344", "0.5553385", "0.55507314", "0.55459243", "0.5536343", "0.5527051", "0.5513224", "0.550392...
0.82558095
0
Function to read a finite automata from file
def read_fa_from_file(path): states = set() transitions = {} with open(path, "r") as f: line = f.readline().strip() alphabet = line.split(' ') final_states = set(f.readline().strip().split(" ")) while line != "": line = f.readline().strip() elems = lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_fa_from_user():\n alphabet = input(\"Give the alphabet for the FA (space between every character): \").split(\" \")\n final_states = set(input(\"Give the final states of the FA (space between every state): \").split(\" \"))\n transitions = {}\n states = set()\n\n while True:\n elem =...
[ "0.6868818", "0.6783501", "0.62436754", "0.62070495", "0.6200139", "0.6174924", "0.6127137", "0.6011723", "0.59882045", "0.5985487", "0.5975876", "0.5947569", "0.5932211", "0.5927237", "0.5915772", "0.5913552", "0.5875891", "0.5866021", "0.5852381", "0.5848882", "0.58440715",...
0.73134375
0
Function to read a finite automata from standard input
def read_fa_from_user(): alphabet = input("Give the alphabet for the FA (space between every character): ").split(" ") final_states = set(input("Give the final states of the FA (space between every state): ").split(" ")) transitions = {} states = set() while True: elem = input("Give a trans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_input():\n with open(\"input_07.txt\", \"r\") as f:\n for line in f:\n Bag(line)", "def main():\n while True:\n s = sys.stdin.readline()\n if not s:\n break\n n = int(s.strip())\n matrix = list([0.0] * n for _ in range(n))\n for i in...
[ "0.6007448", "0.5992387", "0.5899864", "0.5859907", "0.5850103", "0.58187324", "0.5815116", "0.579744", "0.57797796", "0.56988543", "0.5667237", "0.56307346", "0.56194735", "0.5585987", "0.55587304", "0.55099726", "0.5508295", "0.55065715", "0.5448543", "0.54344714", "0.54303...
0.77068204
0
Function to convert the fip to file
def fip_to_file(fip, path): with open(path, "w") as f: string = "" for elem in fip: string += str(elem[0]) + " " f.write(string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _toFile(self):\n pass", "def to_file(self, file_path, smirnoff_data):\n pass", "def f2o(forfile, opath):\n return f2suff(forfile, opath, 'o')", "def export_to_file(self, fp, *args, **kwargs):\n with open(fp, 'w') as fh:\n self._to_str(fh)", "def to_file(self, f: str) ...
[ "0.6975363", "0.65158784", "0.60276353", "0.5928251", "0.58865476", "0.5863703", "0.5832562", "0.57981956", "0.57962465", "0.57863224", "0.578064", "0.5655496", "0.56399417", "0.561492", "0.5605868", "0.5538995", "0.5517694", "0.54983175", "0.54926884", "0.54778355", "0.54723...
0.7684656
0
Sets the userid of this MessageGroup.
def userid(self, userid): self._userid = userid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_user(self, id_user):\n\n self._id_user = id_user", "def set_user_id(uid):\n local.user_id = uid", "def set_userId(self, userId):\n self.authentication.userId = userId", "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n self._us...
[ "0.6161416", "0.6032017", "0.5961601", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.58187044", "0.5649097", "0.5494012", "0.5478898", "0...
0.7251328
0
Sets the user_full_name of this MessageGroup.
def user_full_name(self, user_full_name): self._user_full_name = user_full_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(self, full_name):\n\n self._full_name = full_name", "def full_name(self, full_name):\n\n self._full_name = full_name", "def user_name(self, user_name):\n\n self._user_name = user_name", "def set_fullname(self, value):\n self.fullname = value", "def sent_by_full_nam...
[ "0.69892496", "0.69892496", "0.63426995", "0.5873931", "0.5870512", "0.58664143", "0.57916003", "0.5769776", "0.57607913", "0.5697961", "0.5589663", "0.55581176", "0.5533578", "0.5505131", "0.549579", "0.549579", "0.549579", "0.549579", "0.549579", "0.549579", "0.549579", "...
0.8340968
0
Sets the datecreated of this MessageGroup.
def datecreated(self, datecreated): self._datecreated = datecreated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_created(self, date_created):\n \n self._date_created = date_created", "def date_created(self, date_created):\n self._date_created = date_created", "def date_created(self, date_created):\n self._date_created = date_created", "def date_created(self, date_created):\n\n ...
[ "0.77904725", "0.7743001", "0.7743001", "0.7730834", "0.7730834", "0.7730834", "0.77066827", "0.7587421", "0.7452277", "0.742094", "0.742094", "0.742094", "0.742094", "0.742094", "0.69096386", "0.66774035", "0.6663162", "0.6656734", "0.6479188", "0.6479188", "0.6479188", "0...
0.78653955
0
Sets the datefinished of this MessageGroup.
def datefinished(self, datefinished): self._datefinished = datefinished
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_finished(self, date_finished):\n self._date_finished = date_finished", "def date_finished(self):\n return self._date_finished", "def time_finished(self, time_finished):\n self._time_finished = time_finished", "def finish_time(self, finish_time):\n\n self._finish_time = fi...
[ "0.8156948", "0.6820392", "0.6587905", "0.58100235", "0.58100235", "0.58100235", "0.5797693", "0.5782575", "0.5782575", "0.5782575", "0.57209796", "0.56693375", "0.56536585", "0.5466588", "0.5463534", "0.54609746", "0.54329294", "0.5409526", "0.5409526", "0.5409526", "0.54095...
0.818147
0
Sets the sort_order of this MessageGroup.
def sort_order(self, sort_order): self._sort_order = sort_order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_order(self, sort_order: int):\n\n self._sort_order = sort_order", "def set_sort_order(self, sort_order):\n\n\t\tif sort_order is not None and not isinstance(sort_order, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_order EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__s...
[ "0.8012617", "0.7557925", "0.75307643", "0.6835182", "0.6835182", "0.6733337", "0.6646642", "0.6646642", "0.6646642", "0.6619364", "0.63929164", "0.63191", "0.6317047", "0.6317047", "0.62079895", "0.61994606", "0.6176629", "0.61346495", "0.6068687", "0.60417044", "0.59712255"...
0.79603904
1
Sets the mail_msg_id of this MessageGroup.
def mail_msg_id(self, mail_msg_id): self._mail_msg_id = mail_msg_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_id(self, val: str):\n self._message_id = val", "def mailing_id(self, val: str):\n self._mailing_id = val", "def pop3_msg_id(self, pop3_msg_id):\n\n self._pop3_msg_id = pop3_msg_id", "def set_email_template_id(self, email_template_id):\n self.email_template_id = email_t...
[ "0.6015266", "0.58872676", "0.56251985", "0.5620189", "0.54886806", "0.54886806", "0.54886806", "0.54886806", "0.54886806", "0.54886806", "0.532044", "0.52057475", "0.5202128", "0.518962", "0.50464046", "0.5020832", "0.49766263", "0.49766263", "0.49766263", "0.49766263", "0.4...
0.86478096
0
Sets the pop3_msg_id of this MessageGroup.
def pop3_msg_id(self, pop3_msg_id): self._pop3_msg_id = pop3_msg_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mail_msg_id(self, mail_msg_id):\n\n self._mail_msg_id = mail_msg_id", "def message_id(self, val: str):\n self._message_id = val", "def message_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"message_group_id\")", "def group_id(self, group_id):\n\n self._group_id =...
[ "0.63237476", "0.5964633", "0.5207801", "0.5155486", "0.5155486", "0.5155486", "0.5155486", "0.5155486", "0.5155486", "0.508969", "0.50258756", "0.50252366", "0.50252366", "0.50252366", "0.50252366", "0.4945956", "0.49097177", "0.48777446", "0.48777446", "0.48528895", "0.4839...
0.871121
0
Sets the messages of this MessageGroup.
def messages(self, messages): self._messages = messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages(self, messages):\n self._messages = messages", "def messages(self, messages):\r\n\r\n self._messages = messages", "def unread_messages(self, unread_messages):\n\n self._unread_messages = unread_messages", "def _set_message(self, value):\n self.__message = value", "d...
[ "0.75375044", "0.74025875", "0.59419316", "0.578991", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", "0.56408775", ...
0.75711966
1
Return the ItemManager by which IncomingEdges are queried.
def get_data_manager(): return IncomingEdge.items
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetManager(self):\r\n\r\n return self.manager", "def getManager(self):\n return self._manager", "def get_manager():\n return __manager__", "def event_manager(self):\n return ScriptDB.objects.get(db_key=\"Event Manager\")", "def GetManager(window):\r\n \r\n if not isinstanc...
[ "0.6031012", "0.5964164", "0.5638727", "0.5509461", "0.5444117", "0.53260106", "0.5311673", "0.5275034", "0.5191798", "0.5146738", "0.51389724", "0.51216197", "0.50709474", "0.5055134", "0.5030141", "0.5025454", "0.5023493", "0.5017184", "0.4973494", "0.495225", "0.495225", ...
0.6938071
0
For the given manager method, (specified by name), manufacture a unified query method, which will query the IncomingEdge/"data" manager for the items referred to by the result of a given OutgoingEdge query.
def _make_unified_method(method_name): @wraps(getattr(ItemManager, method_name), ('__name__', '__doc__')) def wrapped(self, *args, **kws): inherited_method = getattr(super(UnifiedEdgeManager, self), method_name) result = inherited_method(*args, **kws) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, method: str, params: dict) -> Any:\n context = self._context_factory.create(IconScoreContextType.QUERY)\n context.block = self._icx_storage.last_block\n step_limit = self._step_counter_factory.get_max_step_limit(context.type)\n\n if params:\n from_: 'Address' ...
[ "0.55433685", "0.5520531", "0.52749366", "0.5173932", "0.50144136", "0.5004251", "0.49837524", "0.49672294", "0.49278635", "0.4908809", "0.48863682", "0.48591214", "0.48053664", "0.47829974", "0.47261888", "0.47138768", "0.46559685", "0.46083963", "0.4606988", "0.45965266", "...
0.5902458
0
Counts the top 40 words for a data set.
def count_words(data, number_word_frequency_results=40): current_max_sentence_size = 0 count_word_frequency = Counter() for entry in data: print (entry) terms_all = [term for term in entry] count_word_frequency.update(terms_all) return count_word_frequency.most_common(number_word...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(self,top_only=True):\n if top_only:\n self.top_skill_list()\n else:\n self.all_skill_list()\n word_counts = Counter(self.skill_list)\n top_n = word_counts.most_common(len(word_counts))\n self.feature = []\n proportion = []\n for...
[ "0.77748466", "0.70829517", "0.69344556", "0.6900603", "0.6856679", "0.68506205", "0.6771012", "0.67679805", "0.67624205", "0.6757019", "0.6734754", "0.6678525", "0.6602326", "0.655216", "0.6528496", "0.6523394", "0.65085506", "0.6487718", "0.64699924", "0.6423054", "0.639907...
0.72458106
1
Determine the current token given a cursor position.
def GetCurrentToken(tokens, pos): i = 0 while i < len(tokens): if pos > tokens[i].start and pos < tokens[i].end: return tokens[i] if pos < tokens[i].start: return tokens[i-1] if i > 0 else None i += 1 return tokens[len(tokens)-1] if tokens else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor(self):\n try:\n return self.tokens[self.pos]\n except IndexError:\n raise ParseError(\"No tokens left for cursor to traverse\")", "def current(self) -> Token:\n return self.tokens[self.pos]", "def get_current_token(self) -> int:\n\n # Currently we do...
[ "0.79910094", "0.73645526", "0.6828625", "0.6635761", "0.6567594", "0.65006924", "0.6489812", "0.6467827", "0.6423576", "0.64196527", "0.6381184", "0.63142437", "0.6283434", "0.6264023", "0.6253619", "0.62421626", "0.6231462", "0.62234", "0.62161213", "0.62161213", "0.6212622...
0.76447517
1
Class representing a base class for psychological protocols and data collected within a study. The general structure of the protocol can be specified by passing a ``structure`` dict to the constructor of ``BaseProtocol``.
def __init__( self, name: str, structure: Optional[Dict[str, Any]] = None, test_times: Optional[Sequence[int]] = None, **kwargs, ): self.name: str = name """Study or protocol name""" self.structure: Dict[str, Any] = structure """Structure of p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, protocol):\r\n self._protocol = protocol", "def __init__(self, protocol: str):\n self.protocol = protocol\n\n # initalize context for pva\n self.context = None\n if protocol == \"pva\":\n self.context = Context(\"pva\")", "def __init__(self, prot...
[ "0.58112496", "0.55970025", "0.55595016", "0.5356677", "0.5319289", "0.5314981", "0.5229938", "0.5218937", "0.5142608", "0.5140367", "0.5140124", "0.5122984", "0.51086944", "0.50906116", "0.50671124", "0.5064617", "0.5046448", "0.50041556", "0.499588", "0.49370202", "0.492443...
0.72046685
0
Serialize ``Protocol`` object and export as file. This function converts the basic information of this object (``name``, ``structure``, ``test_times``) to a JSON object and saves the serialized object to a JSON file.
def to_file(self, file_path: path_t): # ensure pathlib file_path = Path(file_path) _assert_file_extension(file_path, ".json") to_export = ["name", "structure", "test_times"] json_dict = {key: self.__dict__[key] for key in to_export} with file_path.open(mode="w+", encodin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n keys = [\n 'uid',\n 'commit_sha',\n 'timestamp',\n 'filename',\n 'comment',\n 'train_data',\n 'val_data',\n 'test_data',\n 'model_files',\n 'custom_data',\n ]\n data = {key: self.__dict__[key] for key in keys}\n with open(os.path....
[ "0.6268191", "0.61834884", "0.6164836", "0.61081505", "0.609553", "0.6055284", "0.6022424", "0.59744525", "0.5930789", "0.591576", "0.58929795", "0.58900464", "0.5887467", "0.58748484", "0.5869331", "0.5851485", "0.5840395", "0.58150333", "0.5811053", "0.5784665", "0.575145",...
0.6591809
0
Compute heart rate data results from one study part. The different processing steps can be enabled or disabled by setting the function parameters to ``True`` or ``False``, respectively. Parameters that are required for a specific processing step can be provided in the ``params`` dict. The dict key must match the name o...
def compute_hr_results( # pylint:disable=too-many-branches # noqa: C901 self, result_id: str, study_part: Optional[str] = None, resample_sec: Optional[bool] = True, normalize_to: Optional[bool] = False, select_phases: Optional[bool] = False, split_into_subphases:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _f_parallel(parameters):\n # get experiment info\n experiment = parameters['experiment']\n \n # create experiment class instance\n exp_instance = Experiment()\n\n # get specific experiment function\n f = getattr(exp_instance, experiment)\n\n print f\n print parameters\n # run expe...
[ "0.52932763", "0.5215117", "0.5207013", "0.5187872", "0.5140799", "0.5120999", "0.5116341", "0.5030411", "0.50181484", "0.50146437", "0.50085676", "0.5002082", "0.49922666", "0.49804473", "0.49622753", "0.49347395", "0.49267757", "0.4921193", "0.49170506", "0.4902267", "0.488...
0.585529
0
Add existing heart rate ensemble data.
def add_hr_ensemble(self, ensemble_id: str, ensemble: Dict[str, pd.DataFrame]): _assert_is_dtype(ensemble, dict) ensemble = deepcopy(ensemble) self.hr_ensemble[ensemble_id] = ensemble
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_heart_rate(email, heart_rate, time):\n # Get the first user where _id=email\n user = models.User.objects.raw({\"_id\": email}).first()\n # Append the heart_rate to the user's list of heart rates\n user.heart_rate.append(heart_rate)\n # append the current time to the user's list of heart rate...
[ "0.6098084", "0.5798594", "0.5672255", "0.547009", "0.54096824", "0.5359623", "0.5356243", "0.53472507", "0.5337257", "0.53096783", "0.52913874", "0.5263048", "0.51895946", "0.51789165", "0.51674527", "0.5151739", "0.5136724", "0.5117974", "0.5098062", "0.5079463", "0.5073914...
0.6072395
1
Draw multiple features as boxplots with significance brackets, specifically designed for saliva features.
def saliva_multi_feature_boxplot( data: SalivaFeatureDataFrame, saliva_type: str, features: Union[Sequence[str], Dict[str, Union[str, Sequence[str]]]], hue: Optional[str] = None, stats_kwargs: Optional[Dict] = None, **kwargs, ) -> Tuple[plt.Figure, Iterable[plt.Axes]]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_feature_boxplots(self):\n\n num_features = len(self.feature_names)\n fig, ax = plt.subplots(nrows=1, ncols=num_features, figsize=(50, 2), tight_layout=True)\n fig.suptitle('Boxplots of 19 features', fontsize=14)\n\n for i in range(num_features):\n ax[i].boxplot(self....
[ "0.7276096", "0.6756028", "0.67420524", "0.66334265", "0.66136825", "0.66105974", "0.63785017", "0.63277566", "0.63201016", "0.6297335", "0.6288415", "0.62793034", "0.62766385", "0.6269879", "0.6266449", "0.62377346", "0.6190599", "0.6162445", "0.6156448", "0.6155786", "0.614...
0.6806002
1
Set a slug only if the original slug is not already previously set.
def set_slug(self, slug): if self.slug is None: self.slug = slug
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug(self, value: str):\n if value and self.slug:\n raise Exception('Order slug should never be updated.')\n elif value:\n self._slug = value", "def set_slug(self):\n if not self.slug:\n self.slug = slugify(self.name)[:50]", "def set_unique_slug(self):\...
[ "0.7520469", "0.7504834", "0.7118982", "0.70759165", "0.70759165", "0.7063391", "0.69718677", "0.6893182", "0.68507", "0.68228143", "0.68121773", "0.67801267", "0.6757212", "0.66788137", "0.63008267", "0.62607974", "0.6224608", "0.6210882", "0.6163315", "0.61136633", "0.60966...
0.81769043
0
Create a spine neck
def create_neck(self, neck_L=1.0, neck_dia=0.1, Ra=150.0, Cm=1.0): sec_name = 'spine_%d_neck' % (self.id) neck = h.Section(name=sec_name) neck.nseg = 1 neck.L = neck_L neck.diam = neck_dia neck.Ra = Ra ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spine(self):", "def add_spines_to_morphology(self):\n\n # A list of the data of all the spines that will be added to the neuron morphology\n spines_list = list()\n\n # Remove the internal samples, or the samples that intersect the soma at the first\n # section and each arbor\n ...
[ "0.6463096", "0.57109475", "0.5689323", "0.5638343", "0.55214053", "0.55013907", "0.54684144", "0.5404997", "0.5401996", "0.5383109", "0.53128815", "0.52997345", "0.5285193", "0.52620643", "0.5251282", "0.52377605", "0.5227206", "0.51833063", "0.5153798", "0.5148829", "0.5131...
0.6441047
1
Sample a transition of batch_size.
def sample(self, batch_size): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, batchsize):\n # randomly sample transitions\n random_sample = randsample(self.queue, batchsize)\n # zip\n zipped = [ torch.from_numpy( np.asarray(arr).astype(np.float32) ).float() for arr in zip(*random_sample) ]\n sample = Transition( zipped[0], zipped[1].unsque...
[ "0.7895489", "0.7662528", "0.7100215", "0.7054171", "0.6996548", "0.6925236", "0.69184905", "0.69033307", "0.6850436", "0.6829675", "0.67938393", "0.67938393", "0.6757639", "0.67004865", "0.66849464", "0.6660048", "0.66524017", "0.66335994", "0.660869", "0.65731823", "0.65623...
0.77074367
1
Add multiple transitions into the replay buffer. A transition contains one or multiple entries, e.g. observation, action, reward, terminal and next_observation. The same entry of all the transitions are stacked, e.g.
def add_transitions(self, **kwargs): if not self._initialized_buffer: self._initialize_buffer(**kwargs) for key, value in kwargs.items(): self._episode_buffer[key].append(value) if len(self._episode_buffer['observation']) == self._time_horizon: self.store_ep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend(self, transitions: list):\n for transition in transitions:\n self.add(*transition)", "def add(self, transition: Tuple[np.ndarray, ...]) -> Tuple[Any, ...]:\n self.n_step_buffer.append(transition)\n\n # single step transition is not ready\n if len(self.n_step_buff...
[ "0.6677511", "0.65858775", "0.6410083", "0.63191545", "0.62429816", "0.6203609", "0.6202936", "0.61612046", "0.61373895", "0.60175425", "0.6013549", "0.5996358", "0.5974118", "0.5894838", "0.58591044", "0.5832437", "0.5821877", "0.5789959", "0.5712879", "0.56887907", "0.56742...
0.6860526
0
Get the storage index for the episode to add into the buffer.
def _get_storage_idx(self, size_increment=1): if self._current_size + size_increment <= self._size: idx = np.arange(self._current_size, self._current_size + size_increment) elif self._current_size < self._size: overflow = size_increment - (self._size -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_episode(self):\n episode_buffer = self._convert_episode_to_batch_major()\n episode_batch_size = len(episode_buffer['observation'])\n idx = self._get_storage_idx(episode_batch_size)\n\n for key in self._buffer:\n self._buffer[key][idx] = episode_buffer[key]\n ...
[ "0.62591046", "0.6160716", "0.60362697", "0.5688734", "0.5676039", "0.5639769", "0.5636054", "0.5636054", "0.5593294", "0.5525902", "0.55179083", "0.55179083", "0.5486249", "0.5399521", "0.5389738", "0.53876173", "0.53737056", "0.5365808", "0.53423053", "0.5337236", "0.531627...
0.6701214
0
Convert the shape of episode_buffer.
def _convert_episode_to_batch_major(self): transitions = {} for key in self._episode_buffer: val = np.array(self._episode_buffer[key]) transitions[key] = val.swapaxes(0, 1) return transitions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_process_buffer(self):\r\n black_buffer = [cv2.resize(cv2.cvtColor(x, cv2.COLOR_RGB2GRAY), (84, 90))\r\n for x in self.process_buffer]\r\n black_buffer = [x[1:85, :, np.newaxis] for x in black_buffer]\r\n return np.concatenate(black_buffer, axis=2)", "def de...
[ "0.56121975", "0.5504163", "0.53242236", "0.5323291", "0.53163636", "0.5280504", "0.5277354", "0.52350706", "0.5213865", "0.5209187", "0.51714647", "0.51675475", "0.5160527", "0.50943303", "0.50886506", "0.50886506", "0.50886506", "0.50749224", "0.50125074", "0.4992466", "0.4...
0.60180026
0
Creates a binary (0/1) disease state column for the population with given initial infections.
def create_diseasestate_column(num_ppl, seed=1): # initialize all 0s array initial_diseasestate = np.zeros(num_ppl) # infect exactly `seed` number of elements initial_diseasestate[np.random.choice(num_ppl, seed)] = 1 # return infection state return initial_diseasestate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dummies(df):", "def states_initial(self):\n return self.states(\"Initial = YES\")", "def ipd_feats(state,action):\r\n f = np.zeros((5,2))\r\n a = int(action == \"C\") \r\n #dict for states to ints\r\n states = {(\"*\",\"*\"):0,(\"C\",\"D\"):1, (\"C\",\"C\"):2, (\"D\",\"C\"):3, (\"...
[ "0.5841251", "0.56705815", "0.5579194", "0.5320552", "0.5305993", "0.5295446", "0.526474", "0.52495533", "0.52435505", "0.5168077", "0.51623744", "0.5159894", "0.5143586", "0.5138274", "0.51131546", "0.508262", "0.5060702", "0.5041498", "0.5036296", "0.50254965", "0.50190634"...
0.70389897
0
Male of age greater than 10 are the wanderers in the camp
def create_wanderer_column(gender, age): return np.logical_and([gender == 1], [age >= 10]).transpose()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_age_medicals(self, medicament):\n age = self.get_age()\n if age:\n if age > medicament.maximum_age and medicament.maximum_age:\n return {\"valid\": False, \"message\": _(f\"The patient is {age} years old, and {medicament.name} could not be taken for ages above {me...
[ "0.68103325", "0.61463815", "0.61307013", "0.60826564", "0.6061001", "0.60349363", "0.6031252", "0.60239834", "0.59546506", "0.5953632", "0.59528995", "0.58525604", "0.5847692", "0.57500136", "0.57150906", "0.5714132", "0.56923485", "0.5692144", "0.5692144", "0.5682057", "0.5...
0.63310003
1
Create population matrix based on parameters.
def form_population_matrix(N, hb, Nb, ht, Nt, pac, age_and_gender): # 1 allocated to iso-boxes and tents household_column = create_household_column(hb, Nb, ht, Nt) # 2 allocate an infector disease_column = create_diseasestate_column(N) # 3 weibull distribution dsymptom_column = create_dayst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_population(datapoints_nr, population_size):\n\n # row = members\n population = np.empty(shape=(population_size, datapoints_nr))\n\n for member in range(population_size):\n # each member consist of the indices from 0 to datapoints_nr-1 and is\n # some random assignment between the...
[ "0.6541645", "0.63594633", "0.63435656", "0.62731165", "0.6089071", "0.60611784", "0.60480964", "0.6002917", "0.5997232", "0.5986117", "0.5986117", "0.59747916", "0.5948868", "0.5912161", "0.589112", "0.5889674", "0.58686346", "0.58631474", "0.58419394", "0.5790658", "0.57879...
0.6743794
0
Position toilets in the camp.
def position_toilet(hhloc, nx=12, ny=12): # Grid dimensions for toilet blocks tblocks = np.array([nx, ny]) # assign toilets to households return assign_block(hhloc, tblocks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positioning(self):\n pass", "def position(self):\r\n pass", "def move_to_position2(self):", "def move_to_position1(self):", "def setPosition(self):\n # determine posX, posY for battle\n (x1,y1) = globals.battlemapQuadrants[self.systemGrid]\n self.posX = x1+self.setX\n...
[ "0.62709737", "0.61841184", "0.6042508", "0.5962719", "0.587609", "0.5829434", "0.581898", "0.5778352", "0.57652444", "0.57444644", "0.5701726", "0.56904495", "0.56677485", "0.5660947", "0.5650912", "0.5650912", "0.56384367", "0.5618516", "0.5605595", "0.5591926", "0.5586355"...
0.64763534
0
Position foodline in the camp.
def position_foodline(hhloc, nx=1, ny=1): # Grid dimensions for foodline blocks fblocks = np.array([nx, ny]) # assign foodline to households return assign_block(hhloc, fblocks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positioning(self):\n pass", "def __pos__(self):\r\n\t\t\r\n\t\t# view the line\r\n\t\tself.view()\r\n\t\t\r\n\t\treturn None", "def place(self, line):\n # easy enough\n return self.leader + line", "def set_position( self, posx, posy ):\n\n self.__foodx = posx\n self.__f...
[ "0.64807636", "0.63352424", "0.6275664", "0.62156445", "0.61681056", "0.6153854", "0.60876507", "0.5988723", "0.5961082", "0.5921165", "0.58993", "0.586354", "0.5833066", "0.5829377", "0.58123446", "0.5801041", "0.57950765", "0.57879025", "0.56815696", "0.567328", "0.5634649"...
0.71578705
0
Get Infection status for newly infected people.
def impose_infection(infection_status, newly_infected): infection_status += (1 - np.sign(infection_status)) * newly_infected return infection_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInfected(self):\n\n # use a mask and sum it to see the number of infected people, designated as having a value equal to one\n self.infected = np.sum((self.getSpace()) == 1)\n\n return self.infected", "def infectious_intensity(self):\n return InfectiousIntensity(self)", "def _...
[ "0.6767245", "0.6180562", "0.6083309", "0.5946993", "0.576854", "0.5621374", "0.56035405", "0.55672944", "0.5547575", "0.54881275", "0.5463825", "0.54057145", "0.53823644", "0.5304878", "0.52280873", "0.52274394", "0.5196473", "0.5191378", "0.5169419", "0.5158272", "0.5141357...
0.6942959
0
Relative encounter rate between individuals in overlapping area
def relative_encounter_rate(d, R, r): # angle between center of circle centered at (1) and point of intersections of circles centered at (1) and (2) angle1 = 2*np.arccos( np.nan_to_num( # `nan_to_num` will replace `nan` values with 0 np.clip( ( d**2 + R**2 - r**2 ) / ( 2*d*R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n return self.known_individual_emission_rate", "def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n raise NotImplementedError(\"Subclass must implement\")", "def get_occupancy(self):\n ...
[ "0.6575103", "0.6274117", "0.61650914", "0.61382836", "0.6088704", "0.5968364", "0.59390694", "0.5880045", "0.5865787", "0.5834231", "0.5819034", "0.5777062", "0.57575995", "0.57560056", "0.5726682", "0.56597805", "0.56419855", "0.56173015", "0.5579812", "0.5563305", "0.55569...
0.6799078
0
Require the docker core installation.
def core(): from fabtools.require.deb import package as require_deb_package from fabtools.require.rpm import package as require_rpm_package family = distrib_family() # Check if sudo command exists if not files.exists('/usr/bin/sudo'): raise Exception("Please install the sudo package and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_docker(): # type: () -> DockerCommand\n if command := get_docker_command():\n return command\n\n raise ApplicationError(f'No container runtime detected. Supported commands: {\", \".join(DOCKER_COMMANDS)}')", "def ensure_docker_version() -> None:\n compose_version = get_compose_versio...
[ "0.67299694", "0.6283226", "0.60135204", "0.594149", "0.5918048", "0.57327676", "0.5673027", "0.5666471", "0.56446326", "0.5610128", "0.5589479", "0.55611426", "0.55368984", "0.5517129", "0.54987085", "0.54626423", "0.544127", "0.542997", "0.54229087", "0.5422412", "0.5419754...
0.7082806
0
Generate a time series of noise
def make_time_series_noise(dates, mean=0., std=1.): # TODO: implement Gaussian noise with mean/std # TODO: add kwarg to parametrize noise from clouds/shadows pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_noise(self, signal_only):\n\n #print >> sys.stdout, \"generating noise...\"\n\n if signal_only:\n\n # the noise is just a time series of zeros\n \n self.td_noise = pycbc.types.timeseries.TimeSeries(\n initial_array=np.zeros(self.duration/se...
[ "0.7505389", "0.72670496", "0.6726592", "0.6700925", "0.6699392", "0.66329044", "0.6629667", "0.652815", "0.6505489", "0.65036446", "0.6481513", "0.64745283", "0.64654976", "0.64600307", "0.6458718", "0.6448561", "0.64418566", "0.64416826", "0.6431314", "0.6428701", "0.642360...
0.75017184
1
Tests distributed encryption and decryption using communication
async def test_distributed_paillier_with_communication( distributed_schemes: Tuple[DistributedPaillier, ...], plaintext: Union[float, int], ) -> None: enc = {0: distributed_schemes[0].encrypt(plaintext)} distributed_schemes[0].pool.async_broadcast(enc[0], "encryption") assert not enc[0].fresh fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decrypt_encrypted(self):\n encrypted = encrypt('message')\n decrypted = decrypt(encrypted)\n\n assert decrypted == 'message'", "async def test_distributed_paillier_encrypt_decrypt(\n distributed_schemes: Tuple[DistributedPaillier, ...],\n plaintext: Union[float, int],\n) -> No...
[ "0.7074454", "0.70003396", "0.6773305", "0.67688775", "0.67687905", "0.67643243", "0.6720003", "0.6674549", "0.6618548", "0.656239", "0.6551485", "0.6540738", "0.65400225", "0.65195465", "0.6457282", "0.6340875", "0.6323224", "0.6251078", "0.6228203", "0.6224373", "0.6139704"...
0.70916307
0
Tests serialization of the distributed Paillier.
async def test_distributed_paillier_serialization( distributed_schemes: Tuple[DistributedPaillier, ...], plaintext: Union[float, int], ) -> None: enc = {0: distributed_schemes[0].encrypt(plaintext)} distributed_schemes[0].pool.async_broadcast(enc[0], "encryption") assert not enc[0].fresh distrib...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_serialize_no_metadata(self):\n pass # pragma: no cover", "def test_serialization():\n\n # Class is serializable.\n ray.put(DummyPredictor)\n\n # Instance is not serializable.\n predictor = DummyPredictor()\n with pytest.raises(PredictorNotSerializableException):\n ray.put(p...
[ "0.63788676", "0.6351683", "0.63130003", "0.63130003", "0.6274619", "0.6063678", "0.59384465", "0.57770497", "0.577566", "0.5763457", "0.57603747", "0.5741852", "0.57352495", "0.56964755", "0.56952596", "0.5691031", "0.5690396", "0.56821066", "0.56805634", "0.56683403", "0.56...
0.68095183
0
Tests distributed encryption and decryption in parallel
async def test_distributed_paillier_encrypt_decrypt_parallel( distributed_schemes: Tuple[DistributedPaillier, ...], plaintext: Union[float, int], ) -> None: encs = [distributed_schemes[0].encrypt(plaintext) for _ in range(3)] decs = await asyncio.gather( *[ asyncio.gather( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_distributed_paillier_encrypt_decrypt(\n distributed_schemes: Tuple[DistributedPaillier, ...],\n plaintext: Union[float, int],\n) -> None:\n enc = distributed_schemes[0].encrypt(plaintext)\n dec = await asyncio.gather(\n *[distributed_schemes[i].decrypt(enc) for i in range(len(dist...
[ "0.7296255", "0.722017", "0.7209572", "0.6965142", "0.6904452", "0.658782", "0.64674854", "0.6371152", "0.62883455", "0.6234982", "0.6191797", "0.61906976", "0.61693084", "0.613704", "0.6108122", "0.60402894", "0.59834576", "0.5954582", "0.59438497", "0.5916628", "0.5905156",...
0.76600707
0
Tests distributed sequence decryption
async def test_distributed_paillier_encrypt_decrypt_sequence( distributed_schemes: Tuple[DistributedPaillier, ...], ) -> None: plaintexts = [1, 2, 3, -1, -2, -3, 1.5, 42.42424242, -1.5, -42.42424242] ciphertexts = [] for plaintext in plaintexts: ciphertexts.append(distributed_schemes[0].encrypt(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_endecrypt():\n\n e, d, c = keygen()\n\n test_encryption(e, c)\n test_decryption(d, c)\n key_cracker(e, c)", "async def test_distributed_paillier_encrypt_decrypt_sequence_parallel(\n distributed_schemes: Tuple[DistributedPaillier, ...],\n) -> None:\n plaintexts_list: List[Union[List[flo...
[ "0.70300436", "0.6710199", "0.66527057", "0.6594419", "0.65599334", "0.6501647", "0.6370326", "0.63437337", "0.62604547", "0.6241448", "0.6222924", "0.6128493", "0.6106974", "0.6077586", "0.5999883", "0.59394217", "0.58960545", "0.5879859", "0.5871572", "0.58666563", "0.58373...
0.7276474
0
Tests distributed sequence decryption when run in parallel
async def test_distributed_paillier_encrypt_decrypt_sequence_parallel( distributed_schemes: Tuple[DistributedPaillier, ...], ) -> None: plaintexts_list: List[Union[List[float], List[int]]] = [ [1, 2, 3], [-1, -2, -3], [1.5, 42.42424242, -1.5 - 42.42424242], ] ciphertexts_list = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_distributed_paillier_encrypt_decrypt_sequence(\n distributed_schemes: Tuple[DistributedPaillier, ...],\n) -> None:\n plaintexts = [1, 2, 3, -1, -2, -3, 1.5, 42.42424242, -1.5, -42.42424242]\n ciphertexts = []\n for plaintext in plaintexts:\n ciphertexts.append(distributed_schemes[...
[ "0.75792736", "0.71062064", "0.67590517", "0.6522931", "0.62096304", "0.6137923", "0.6032338", "0.57845086", "0.5771082", "0.5711155", "0.5659981", "0.5655792", "0.56333125", "0.56255424", "0.56056845", "0.55568457", "0.5543826", "0.55259967", "0.55049443", "0.5500993", "0.54...
0.7547728
1
Tests distributed decryption revealing the results to a subset of receivers only.
async def test_distributed_paillier_encrypt_decrypt_receivers( distributed_schemes: Tuple[DistributedPaillier, ...], receivers_id: int, result_indices: Tuple[int], ) -> None: if receivers_id == 0: receiver0_list = [["local0"]] * len(distributed_schemes) receiver0_list[0] = ["self"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_distributed_paillier_encrypt_decrypt(\n distributed_schemes: Tuple[DistributedPaillier, ...],\n plaintext: Union[float, int],\n) -> None:\n enc = distributed_schemes[0].encrypt(plaintext)\n dec = await asyncio.gather(\n *[distributed_schemes[i].decrypt(enc) for i in range(len(dist...
[ "0.6784072", "0.67201483", "0.66704386", "0.6662081", "0.65046924", "0.6218146", "0.5975528", "0.58933204", "0.58051926", "0.57034224", "0.5578487", "0.55525106", "0.55024964", "0.54611325", "0.5435828", "0.5413401", "0.5393476", "0.5377231", "0.53749424", "0.536057", "0.5358...
0.72034925
0
Test whether sending of collections of ciphertexts using the broadcast method works as expected.
async def test_pool_broadcast_collection( distributed_schemes: Tuple[DistributedPaillier, ...], collection_type: Type[Any], ) -> None: plaintexts = [1, 2, 3, -1, -2, -3, 1.5, 42.42424242, -1.5, -42.42424242] ciphertexts = map(distributed_schemes[0].encrypt, plaintexts) if collection_type == dict: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_distribute_broadcast_to_network(self):\n if _debug: TestAnnexJCodec._debug(\"test_distribute_broadcast_to_network\")\n\n # read returns a table with an element\n xpdu = xtob('deadbeef')\n pdu_bytes = xtob('81.09.0008' # bvlci\n 'deadbeef' # PDU to b...
[ "0.6085873", "0.5929917", "0.58626044", "0.58533925", "0.58078873", "0.5802064", "0.5802064", "0.57945114", "0.5735595", "0.5734365", "0.5690688", "0.5688572", "0.5675366", "0.5623052", "0.55814284", "0.55802125", "0.5570106", "0.55492437", "0.5535505", "0.54879117", "0.54663...
0.6444453
0
Format the start time value in milliseconds into a string value suitable for some of the supported output formats (ex. SRT, DFXP).
def format_start(self, msec_separator=None): return self._format_timestamp(self.start, msec_separator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time_string(self):\r\n return time.strftime('%H:%M:%S', time.localtime(self.start_time))", "def start_delta_string(self):\r\n delta = int(self.start_time) - int(self.root().start_time)\r\n return '%02d:%02d' % (delta / 60, delta % 60)", "def format_start_time(self, data):\n return dat...
[ "0.7211427", "0.694554", "0.6940926", "0.69408184", "0.6898486", "0.67937607", "0.6674279", "0.6669438", "0.6621727", "0.66024446", "0.65528107", "0.65419763", "0.6506048", "0.6488599", "0.6479121", "0.644822", "0.6431824", "0.6426709", "0.6407089", "0.63642865", "0.62467617"...
0.7278223
0
Format the end time value in milliseconds into a string value suitable for some of the supported output formats (ex. SRT, DFXP).
def format_end(self, msec_separator=None): return self._format_timestamp(self.end, msec_separator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_end_time(self):\n return str(self._end_time)", "def time_to_string(value):\n if value == gst.CLOCK_TIME_NONE:\n return \"--:--:--.---\"\n ms = value / gst.MSECOND\n sec = ms / 1000\n ms = ms % 1000\n mins = sec / 60\n sec = sec % 60\n hours = mins / 60\n mins = mins ...
[ "0.6815521", "0.6603939", "0.65964884", "0.6524921", "0.6407275", "0.63813806", "0.62996995", "0.6276818", "0.6273975", "0.62591654", "0.6211727", "0.6205493", "0.6162361", "0.61458087", "0.61345196", "0.61345196", "0.6096289", "0.6042201", "0.6038373", "0.6019248", "0.601772...
0.7332041
0
Adjust the timing according to offset and rate_skew. Skew is applied first, then offset. e.g. if skew == 1.1, and offset is 5, a caption originally displayed from 1011 seconds would instead be at 1617.1
def adjust_caption_timing(self, offset=0, rate_skew=1.0): for lang in self.get_languages(): captions = self.get_captions(lang) out_captions = [] for caption in captions: caption.start = caption.start * rate_skew + offset caption.end = caption.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSkewXKeyTime(self, index, view) -> float:\n ...", "def setSkewXAnimCurve(self, index, animCurve, view) -> None:\n ...", "def set_clock_skews(self):\r\n for task in self.__tasks.values():\r\n if task.address not in self.__probes:\r\n #print self.__probes.key...
[ "0.5879001", "0.54689234", "0.51790327", "0.5095428", "0.5027254", "0.49545327", "0.49457186", "0.49102435", "0.48996425", "0.48687786", "0.48604754", "0.48485547", "0.47160017", "0.4699085", "0.46950173", "0.46892476", "0.46814936", "0.4678251", "0.46684384", "0.46684384", "...
0.82818824
0
Return correct XeLaTeX code for secret characters.
def secret_char(c): return "\\raisebox{{0.07ex}}{{{}}}".format(c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forbidden_latex_chars():\n\n tex_char = ['\\\\', '{', '}', '&', '[', ']', '^', '~']\n chars = ', '.join(['\"{char}\"'.format(char=char) for char in tex_char])\n message = _(u\"Următoarele caractere sunt interzise și trebuie scoase : {chars}.\".format(chars=chars))\n return tex_char, message", "de...
[ "0.67577153", "0.6311497", "0.63066787", "0.59765613", "0.5825334", "0.5811712", "0.5606645", "0.5590446", "0.55084443", "0.547428", "0.5454242", "0.54339135", "0.54216486", "0.5418305", "0.5367947", "0.5350882", "0.53442436", "0.5339911", "0.53341895", "0.52931374", "0.52505...
0.69234616
0
Generate TeX file with title, author and txt shifted at `indices` places.
def generate_tex(title, author, txt, indices=None): with open('head', 'r') as head,\ open('stegano.tex', 'w') as file_tex: # First lines are # - Title # - Author file_tex.write("".join(head.readlines())) # Write heading file_tex.write("\\title{{{}}}\n".format(title)) f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gravarArquivoIndices(indices):\n arq = open(\"arquivoIndices.txt\", \"w\")\n for i in indices.indices:\n linha = i.codigo + \",\" + str(i.indice) + \",\" + str(i.excluido) + \"\\n\"\n arq.write(linha)\n arq.close()\n return", "def __createIndexFile(self, dimensions):\n target...
[ "0.60819423", "0.5958763", "0.56864417", "0.5638963", "0.55088276", "0.5458908", "0.5453899", "0.54124224", "0.5330256", "0.5307766", "0.52922696", "0.5280326", "0.5268954", "0.52331114", "0.52276003", "0.51927924", "0.51921594", "0.5183668", "0.51798874", "0.51774716", "0.51...
0.7543601
0
Return the indices of the first appearance of `sub` in `txt`. Return [] if `sub` is not a subword of `txt`.
def subwords(txt, sub): txt = txt.lower() txt = txt.replace('’', '\'') sub = sub.lower().replace(' ', '') it = 0 indices = [] for c in sub: try: while txt[it] != c: it += 1 indices.append(it) except (IndexError): print('Cannot f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sub_string_index(self, sub):\n try:\n return self.__dna.index(sub)\n except ValueError:\n raise ValueError", "def occurence(main_seq,sub_seq):\n start= 0\n indices =[]\n while True:\n start = main_seq.find(sub_seq,start)\n if start > 0:\n ...
[ "0.6911704", "0.6570326", "0.6564814", "0.6311022", "0.6157971", "0.6006864", "0.58978117", "0.5889627", "0.562932", "0.55964553", "0.5531702", "0.55243814", "0.5477199", "0.54615635", "0.54546326", "0.54411507", "0.5414643", "0.53883916", "0.5364842", "0.5364486", "0.5349914...
0.7495914
0
Checks schema name and raises ``ValidationError`` if ``name`` is not a valid identifier.
def check_schema_name(name: str): if not is_valid_schema_name(name): raise ValidationError("Invalid string used for the schema name.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_attribute_name(self, name):\n if not self.has_attribute(name):\n raise AttributeContainerSchemaError(\n \"Attribute '%s' is not allowed by the schema\" % name\n )", "def test_nonreserved_name(self):\n try:\n field_name_validator('_identif...
[ "0.7171036", "0.68784094", "0.6800291", "0.6709458", "0.66736066", "0.65854275", "0.6428813", "0.64264417", "0.640889", "0.6408347", "0.6370404", "0.6363868", "0.6363868", "0.6353077", "0.6278121", "0.6276359", "0.6274018", "0.6237462", "0.6173211", "0.6170436", "0.61043185",...
0.88169014
0
Removes ``www``. from the beginning of the address. Only for routing purposes. `` and ``test.com/login/`` should find the same tenant.
def remove_www(hostname: str) -> str: if hostname.startswith("www."): return hostname[4:] return hostname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_nonwww():\n urlparts = urlparse(request.url)\n if urlparts.netloc != 'www.mealscount.com':\n return redirect('https://www.mealscount.com/', code=301)", "def host_cleanup(host):\n if not host.startswith('https://'):\n host = 'https://' + host # Add schema\n host...
[ "0.5988731", "0.5965765", "0.5824932", "0.5604685", "0.55799305", "0.55328894", "0.55265784", "0.5500028", "0.54909337", "0.5481837", "0.5471048", "0.5420226", "0.5415641", "0.5383179", "0.53325796", "0.5331758", "0.5331336", "0.5311387", "0.5299343", "0.5293716", "0.52858394...
0.7954738
0
Creates the schema ``schema_name``. Optionally checks if the schema already exists before creating it. Returns ``True`` if the schema was created, ``False`` otherwise.
def create_schema( schema_name: str, check_if_exists: bool = False, sync_schema: bool = True, verbosity: int = 1, ) -> bool: check_schema_name(schema_name) if check_if_exists and schema_exists(schema_name): return False cursor = connection.cursor() cursor.execute("CREATE SCHEMA %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_schema(self, schema_name):\n try:\n if not self.__engine.dialect.has_schema(self.__engine, schema_name):\n self.__session.execute(CreateSchema(schema_name))\n self._commit()\n except Exception:\n self._rollback()\n self._reset_ses...
[ "0.77359486", "0.7426219", "0.70516837", "0.66422844", "0.66274476", "0.65605444", "0.643813", "0.6399857", "0.63185936", "0.6145625", "0.5945153", "0.5913835", "0.586116", "0.5840135", "0.5800676", "0.57932574", "0.5755894", "0.56867963", "0.5683961", "0.56175995", "0.560376...
0.80329084
0
Drops the schema. Optionally checks if the schema already exists before dropping it.
def drop_schema(schema_name: str, check_if_exists: bool = True, verbosity: int = 1) -> bool: if check_if_exists and not schema_exists(schema_name): return False cursor = connection.cursor() cursor.execute("DROP SCHEMA %s CASCADE" % schema_name) cursor.close() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_schema(self):\n connRepo = self.connect(self.cxRepo)\n sql = f\"\"\"drop schema if exists {self.schemaRepo} cascade\"\"\"\n with connRepo:\n with connRepo.cursor() as curs:\n curs.execute(sql)", "def drop_schema(self, schema):\n sql = f'set role {sel...
[ "0.7882396", "0.7395428", "0.7274394", "0.71401274", "0.68213654", "0.6563808", "0.63283086", "0.62820953", "0.62494886", "0.62188715", "0.617423", "0.60646945", "0.60393625", "0.60074615", "0.59883136", "0.5977768", "0.5976941", "0.59746176", "0.5959718", "0.59513617", "0.59...
0.7950838
0
Creates a postgres function `clone_schema` that copies a schema and its contents. Will replace any existing `clone_schema` functions owned by the `postgres` superuser.
def _create_clone_schema_function(): with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "clone_schema.sql")) as f: CLONE_SCHEMA_FUNCTION = ( f.read() .replace("RAISE NOTICE ' source schema", "RAISE EXCEPTION ' source schema") .replace("RAISE NOTICE ' dest ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_schema(base_schema_name: str, new_schema_name: str, dry_run: bool = False):\n check_schema_name(new_schema_name)\n cursor = connection.cursor()\n\n # check if the clone_schema function already exists in the db\n try:\n cursor.execute(\n \"SELECT 'public.clone_schema(text, te...
[ "0.72572285", "0.58139735", "0.5525249", "0.5380185", "0.52100056", "0.5154858", "0.5054978", "0.5046618", "0.5025271", "0.50213", "0.50179625", "0.49579382", "0.49461487", "0.49370608", "0.49194336", "0.49034718", "0.47725475", "0.47425708", "0.47128892", "0.4707355", "0.466...
0.77113676
0
Creates a new schema ``new_schema_name`` as a clone of an existing schema ``base_schema_name``.
def clone_schema(base_schema_name: str, new_schema_name: str, dry_run: bool = False): check_schema_name(new_schema_name) cursor = connection.cursor() # check if the clone_schema function already exists in the db try: cursor.execute( "SELECT 'public.clone_schema(text, text, public.cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_schema(self, new_schema):\n return self.conn.update_schema(new_schema)", "def create_schema(self, schema: str):\n return", "def _create_clone_schema_function():\n with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), \"clone_schema.sql\")) as f:\n CLONE_SCHEMA_FU...
[ "0.63110983", "0.60908073", "0.58705336", "0.57240117", "0.5699317", "0.5695423", "0.56060517", "0.5588064", "0.5550963", "0.55290186", "0.54945", "0.5478936", "0.54227406", "0.5409052", "0.53544235", "0.5345179", "0.5295239", "0.52321637", "0.52121145", "0.51586914", "0.5117...
0.76892203
0
Internal function; reads 112 bytes, returns HVControl dict.
def _hvcontrol(self, hdr): # Called readHvControl by OpenMIMS d = {} d['hvcontrol enabled'], d['label'], d['begin'], \ d['duration'], d['limit low'], d['limit high'], d['step'], \ d['bandpass width'], d['count time'] = \ unpack(self._bo + 'i 64s 2i 3d i d', hd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_ctrl_block_attrs(raw):\n std_mask, _, ext_mask = struct.unpack('HHI', raw[:8])\n std_attrs = struct.unpack('I' * 16, raw[8:72])\n ext_attrs = struct.unpack('I' * 32, raw[72:200])\n return {\n 'std_mask': std_mask,\n 'ext_mask': ext_mask,\n 'std_attrs': std_attrs,\n ...
[ "0.5773219", "0.57307005", "0.5586502", "0.5550757", "0.549545", "0.54897165", "0.54762053", "0.5470067", "0.5408218", "0.5272468", "0.5208848", "0.5194883", "0.51768154", "0.51629055", "0.5151634", "0.5148797", "0.5140191", "0.51291066", "0.5122522", "0.50686663", "0.5036329...
0.6743356
0