code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def __rand__(self, other): <NEW_LINE> <INDENT> a, b = _coerce_exprs(self, other) <NEW_LINE> return BitVecRef(Z3_mk_bvand(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
Create the Z3 expression bitwise-or `other & self`. >>> x = BitVec('x', 32) >>> 10 & x 10 & x
625941f5796e427e537b0bfa
def markUpdated(self, updated): <NEW_LINE> <INDENT> self.updated=updated <NEW_LINE> if self.parent is not None: <NEW_LINE> <INDENT> self.parent.markUpdated(updated)
Set the updated field for this value and its parents.
625941f5236d856c2ad44e13
def clear(self): <NEW_LINE> <INDENT> self.__data = []
Clears the data list which makes the queue empty.
625941f556b00c62f0f14c8c
def _triggeredRecently(self, msg, uid, timeout=DEFAULT_TIMEOUT): <NEW_LINE> <INDENT> sid = msg.server.id <NEW_LINE> cid = msg.channel.id <NEW_LINE> if sid not in self.lastTriggered.keys(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if cid not in self.lastTriggered[sid].keys(): <NEW_LINE> <INDENT> return False...
See if a user has been recently triggered. Parameters: ----------- msg: discord.Message The message that we wish to check the time, server ID, and channel ID against. uid: int The user ID of the user we want to check. timeout: int The user timeout, in seconds. Returns: -------- bool True if the us...
625941f54e696a04525c9a7d
def dropout_forward(x, dropout_param): <NEW_LINE> <INDENT> p, mode = dropout_param['p'], dropout_param['mode'] <NEW_LINE> if 'seed' in dropout_param: <NEW_LINE> <INDENT> np.random.seed(dropout_param['seed']) <NEW_LINE> <DEDENT> mask = None <NEW_LINE> out = None <NEW_LINE> if mode == 'train': <NEW_LINE> <INDENT> mask = ...
Performs the forward pass for (inverted) dropout. Inputs: - x: Input data, of any shape - dropout_param: A dictionary with the following keys: - p: Dropout parameter. We keep each neuron output with probability p. - mode: 'test' or 'train'. If the mode is train, then perform dropout; if the mode is test, then ...
625941f5379a373c97cfb176
def find_file(folder, filename): <NEW_LINE> <INDENT> matches = [] <NEW_LINE> for root, _, filenames in os.walk(folder): <NEW_LINE> <INDENT> for filename in fnmatch.filter(filenames, filename): <NEW_LINE> <INDENT> matches.append(os.path.join(root, filename)) <NEW_LINE> <DEDENT> <DEDENT> return matches[-1]
Find a file given folder and filename.
625941f54527f215b584ca80
def searchyoutube(self): <NEW_LINE> <INDENT> xbmc.executebuiltin("ActivateWindow(busydialog)") <NEW_LINE> title = self.params.get("title", "") <NEW_LINE> window_header = self.params.get("header", "") <NEW_LINE> results = [] <NEW_LINE> for media in self.get_youtube_listing(title): <NEW_LINE> <INDENT> if not media["filet...
helper to search youtube for the given title
625941f591af0d3eaac9c04c
def buildBSliceMbTypeName(): <NEW_LINE> <INDENT> lst = ['Direct', 'L0', 'L1', 'Bi'] <NEW_LINE> lst = [i + '_16x16' for i in lst] <NEW_LINE> def addPair(prefix): <NEW_LINE> <INDENT> l = ['16x8', '8x16'] <NEW_LINE> return [prefix + "_" + i for i in l] <NEW_LINE> <DEDENT> l = ['L0_L0', 'L1_L1', 'L0_L1', 'L1_L0', 'L0_Bi', ...
>>> l = buildBSliceMbTypeName() >>> l[7] 'B_L1_L1_8x16' >>> l[17] 'B_Bi_L0_8x16'
625941f501c39578d7e7546a
def test_key_headers_data(self): <NEW_LINE> <INDENT> keys_data = Keys(TestData) <NEW_LINE> keys_data.set_headers('value') <NEW_LINE> self.assertEqual(keys_data.column_field,'value') <NEW_LINE> self.assertEqual(keys_data.table_one_column,True) <NEW_LINE> self.assertEqual(keys_data.index_headers,['testitema','testitemb',...
Testing the AssessData meta model's interaction with Keys().
625941f5adb09d7d5db6cdbb
def _upsampled_dft(data, upsampled_region_size, upsample_factor=1, axis_offsets=None): <NEW_LINE> <INDENT> if not hasattr(upsampled_region_size, "__iter__"): <NEW_LINE> <INDENT> upsampled_region_size = [upsampled_region_size, ] * data.ndim <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if len(upsampled_region_size) != d...
Upsampled DFT by matrix multiplication. This code is intended to provide the same result as if the following operations were performed: - Embed the array "data" in an array that is ``upsample_factor`` times larger in each dimension. ifftshift to bring the center of the image to (1,1). - Take the F...
625941f557b8e32f52483ace
def observe(self, observation, gameState): <NEW_LINE> <INDENT> noisyDistance = observation <NEW_LINE> emissionModel = busters.getObservationDistribution(noisyDistance) <NEW_LINE> pacmanPosition = gameState.getPacmanPosition() <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> allPossible = util.Counter() <NEW_LINE> if nois...
Updates beliefs based on the distance observation and Pacman's position. The noisyDistance is the estimated Manhattan distance to the ghost you are tracking. The emissionModel below stores the probability of the noisyDistance for any true distance you supply. That is, it stores P(noisyDistance | TrueDistance). self....
625941f5462c4b4f79d1dcfe
def _process_config_dict(self, config_dict): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._process_backends(config_dict['BACKENDS']) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise ConfigFileDataError( "Config file should have BACKENDS list specified.")
Processes dict loaded from json file
625941f57c178a314d6efa9a
def _PromptForConditionRemoveBindingFromIamPolicy(policy, member, role): <NEW_LINE> <INDENT> conditions = PromptChoicesForRemoveBindingFromIamPolicy(policy, member, role) <NEW_LINE> if not conditions: <NEW_LINE> <INDENT> raise IamPolicyBindingNotFound('Policy binding with the specified member ' 'and role not found!') <...
Prompt user for a condition when removing binding.
625941f5be383301e01b5aa8
def search(self, searchKey): <NEW_LINE> <INDENT> node = self.head <NEW_LINE> for i in range(self.level, -1, -1): <NEW_LINE> <INDENT> key = node[3 + i][0] <NEW_LINE> while key is not None and key < searchKey: <NEW_LINE> <INDENT> node = node[3 + i] <NEW_LINE> key = node[3 + i][0] <NEW_LINE> <DEDENT> <DEDENT> node = node[...
Return the value associated with `searchKey`, or ``None`` if `searchKey` does not exist.
625941f5b545ff76a8914444
def getRoles(allRoles): <NEW_LINE> <INDENT> roles = [] <NEW_LINE> for x in allRoles: <NEW_LINE> <INDENT> roles.append(x.name) <NEW_LINE> <DEDENT> return roles
Helper function to get all unique roles
625941f5507cdc57c630731a
def start_new_task(self): <NEW_LINE> <INDENT> command, data = self.parentServer.task_manager.get_next_task() <NEW_LINE> if command is not None: <NEW_LINE> <INDENT> self.send_command(command, data)
Get new task from server and send to client. Returns: None
625941f51b99ca400220b0e3
def stop_recording(): <NEW_LINE> <INDENT> if is_recording(): <NEW_LINE> <INDENT> pygame.event.get = pygame_event_get
Stop recording the macro.
625941f57d847024c06be8f1
def transform_to(self, tosys): <NEW_LINE> <INDENT> from copy import deepcopy <NEW_LINE> from .transformations import master_transform_graph <NEW_LINE> from .errors import ConvertError <NEW_LINE> if tosys is self.__class__: <NEW_LINE> <INDENT> return deepcopy(self) <NEW_LINE> <DEDENT> trans = master_transform_graph.get_...
Transform this coordinate to a new system. Parameters ---------- tosys : class The system to transform this coordinate into. Returns ------- transcoord A new object with this coordinate represented in the `tosys` system. Raises ------ ValueError If there is no possible transformation route.
625941f58c0ade5d55d3eff0
def test_postpone_task_chunk(self): <NEW_LINE> <INDENT> task_chunk = TaskChunk.objects.create( task=self.task, day=self.day, day_order=1, duration=Decimal(1)) <NEW_LINE> resp = self.client.delete('/task/chunk/{}/?postpone=1'.format(task_chunk.pk)) <NEW_LINE> self.assertEqual( resp.status_code, status.HTTP_204_NO_CONTEN...
Test the deletion of a task chunk with postponing.
625941f58c3a8732951589f2
def get_user_by_login_or_email(self, login_or_email): <NEW_LINE> <INDENT> for user in self.users: <NEW_LINE> <INDENT> if user.login == login_or_email or user.email == login_or_email: <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDENT> <DEDENT> return None
Returns user instances by login or email :param login_or_email: str -> login or email of user instance to be returned :return: User -> an instance of user
625941f52ae34c7f2600d75f
def randFH(X, Y, Z, Res, flag): <NEW_LINE> <INDENT> return operation[operator[random.randint(0, 3)]](X, Y, Z, Res, flag)
随机前半部分
625941f5a05bb46b383ece4a
def is_duplicate(hit, overlap_cutoff=0.5, len_cutoff=50): <NEW_LINE> <INDENT> if len(hit.hsps) < 2: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> valid_hsps = filter(lambda x: abs(x.hit_pos[1]-x.hit_pos[0]) > len_cutoff, hit.hsps) <NEW_LINE> for h1, h2 in combinations(valid_hsps, 2): <NEW_LINE> <INDENT> if overl...
Return True if this hit covers several regions of query sequence with the same region of hit sequence. Accepts two optional parameters: `len_cutoff` is a minimum length (on hit) an HSP must have to be considered meaningful. Defaults to 50. `overlap_cutoff` is a minimum percentage of both hsps that should be in the over...
625941f5796e427e537b0bfb
def compute_hessian(MF, U, mf_h): <NEW_LINE> <INDENT> return getfem('compute', MF, U, 'hessian', mf_h)
Compute the hessian of the field `U` defined on MeshFem `mf_h`. See also gf_compute('gradient', MeshFem mf_du).
625941f563d6d428bbe44b21
def SaveSpecsFile(self, filename): <NEW_LINE> <INDENT> pass
Save Options in a SPECS File Keyword arguments: ----------------- filename -> STRING: Spec File Name Documentation last updated: May. 08, 2008 - Ruben E. Perez
625941f5d18da76e23532b0e
def __init__(self,**kwargs): <NEW_LINE> <INDENT> for key,value in kwargs.iteritems(): <NEW_LINE> <INDENT> setattr(self,key,value)
set any parameters passed in :param kwargs: key/value pairs
625941f5091ae35668667583
def test_epicidin(self): <NEW_LINE> <INDENT> filename = path.get_full_path(__file__, 'data', 'epicidin_280.gbk') <NEW_LINE> expected_html_snippet = "Lanthipeptide(s) for eciB - Putative Class I" <NEW_LINE> _, result = self.run_lanthi(filename, expected_html_snippet) <NEW_LINE> prepeptide = self.gather_all_motifs(result...
Test lanthipeptide prediction for epicidin 280
625941f53617ad0b5ed68526
def testExecuteWithoutGroupTool(self): <NEW_LINE> <INDENT> self.portal._delOb('portal_groups') <NEW_LINE> e = GroupAction() <NEW_LINE> e.groupid = 'New Group' <NEW_LINE> ex = getMultiAdapter( (self.portal, e, DummyEvent(self.folder)), IExecutable) <NEW_LINE> self.assertFalse(ex())
Test what happens if portal_groups is not available
625941f51b99ca400220b0e4
def filter_data(data, condition): <NEW_LINE> <INDENT> field, op, value = condition.split(" ", 2) <NEW_LINE> if field not in data.columns.values : <NEW_LINE> <INDENT> raise Exception("'{}' não é uma coluna do DataFrame. Por acaso você escreveu de maneira errada?".format(field)) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDEN...
Remove os elementos que não correspondem à condição fornecida. Pega uma lista de dados como entrada e retorna uma lista filtrada. As condições devem ser uma lista de cadeias do seguinte formato: '<field> <op> <value>' onde as seguintes operações são válidas: >, <, >=, <=, ==, != Exemplo: ["duration < 15", "start_cit...
625941f576e4537e8c351ca8
def test_product_is_not_installed(self): <NEW_LINE> <INDENT> portal_quickinstaller = getToolByName(self.portal, 'portal_quickinstaller') <NEW_LINE> self.assertFalse(portal_quickinstaller.isProductInstalled('plonetheme.drupal'), 'package appears to be already installed')
Validate that our products is not yet installed
625941f55e10d32532c5f554
def _obj_load_attr(self, attrname): <NEW_LINE> <INDENT> if attrname == 'vnf_deployment_flavours': <NEW_LINE> <INDENT> self._load_vnf_deployment_flavours() <NEW_LINE> <DEDENT> elif attrname == 'vnfd': <NEW_LINE> <INDENT> self._load_vnfd() <NEW_LINE> <DEDENT> elif attrname in self.fields and attrname != 'id': <NEW_LINE> ...
Internal method for loading attributes from vnf package.
625941f5097d151d1a223485
def generate(self): <NEW_LINE> <INDENT> field = Field(width=self.width, height=self.height, tilesize=self.tilesize) <NEW_LINE> field.scatter(Field.CONTROL, self.num_points, pad = 4, mirror=self.mirror) <NEW_LINE> field.scatter(Field.SOURCE, self.num_crumbsource, pad = 2, mirror=self.mirror) <NEW_LINE> spawn_h = int(sqr...
Generates a new field using the parameters for random distribution set in the constructor. :returns: A :class:`~domination.core.Field` instance.
625941f5f548e778e58cdbb0
def __initCell(self, init_state): <NEW_LINE> <INDENT> for i in range(0, self.n_cell): <NEW_LINE> <INDENT> nei = self.__get_nei_index(i) <NEW_LINE> LCell = Cell(init_state[nei[0]]) <NEW_LINE> cell = Cell(init_state[i]) <NEW_LINE> RCell = Cell(init_state[nei[1]]) <NEW_LINE> EACC = EACcell(LCell, cell, RCell, mode='B') <N...
the initial modes of all cells are 'B' :param init_state: :return:
625941f560cbc95b062c6b73
def _psf_to_pascals(SI): <NEW_LINE> <INDENT> if SI: <NEW_LINE> <INDENT> factor = 47.880259 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> factor = 1. <NEW_LINE> <DEDENT> return factor
converts Pa -> psf
625941f5627d3e7fe0d69482
def printCommands (self,event=None): <NEW_LINE> <INDENT> k = self ; c = k.c ; tabName = 'Commands' <NEW_LINE> c.frame.log.clearTab(tabName) <NEW_LINE> inverseBindingDict = k.computeInverseBindingDict() <NEW_LINE> data,n = [],0 <NEW_LINE> for commandName in sorted(c.commandsDict): <NEW_LINE> <INDENT> dataList = inverseB...
Print all the known commands and their bindings, if any.
625941f530dc7b7665901f8f
def verkrijg_uitslag(leeftijd_in_maanden: int, chlorideconcentratie: int) -> str: <NEW_LINE> <INDENT> soorten_uitslagen = [ "CF is hoogst onwaarschijnlijk", "CF is mogelijk", "CF is waarschijnlijk" ] <NEW_LINE> if chlorideconcentratie >= 60: <NEW_LINE> <INDENT> return soorten_uitslagen[2] <NEW_LINE> <DEDENT> elif leeft...
Verkrijg de bijbehorende uitslag. :param leeftijd_in_maanden: de leeftijd in maanden als int. :param chlorideconcentratie: de chlorideconcentratie waarde als int. :return: de uitslag als string.
625941f54e696a04525c9a7e
@pytest.fixture <NEW_LINE> def minimal_data_ones(num_obs, feat_names): <NEW_LINE> <INDENT> df = pd.DataFrame(np.ones(shape=(num_obs, len(feat_names))), columns=feat_names) <NEW_LINE> return df
creates a minimal dataframe for applying models to. this dataframe is just... uniformly 1
625941f567a9b606de4a84e6
def make_stim(self): <NEW_LINE> <INDENT> if self.timing != 'step': <NEW_LINE> <INDENT> self.fill_mode = 'uniform' <NEW_LINE> <DEDENT> self.stim = visual.GratingStim(win=MyWindow.win, size=self.gen_size(), mask=self.gen_mask(), tex=self.gen_texture(), pos=self.location, phase=self.phase, ori=self.orientation, autoLog=Fa...
Creates instance of psychopy stim object.
625941f5377c676e912727d6
def process_tree(client, resource): <NEW_LINE> <INDENT> for record in resource.tree.walk: <NEW_LINE> <INDENT> aojson = record.json() <NEW_LINE> if aojson["title"].startswith("Foundation-Administered Project (FAP)"): <NEW_LINE> <INDENT> aojson["title"] = handle_fap_title(aojson["title"]) <NEW_LINE> <DEDENT> notes = aojs...
Iterates through a given collection, file, or series provided by user input. Finds note content that matches user input and then deletes or modifies relevant notes according to user preference.
625941f5bf627c535bc137ff
def shop(self): <NEW_LINE> <INDENT> print("Welcome to the shop!") <NEW_LINE> print("We have a variety of items for you to select!") <NEW_LINE> inv = self.inventory <NEW_LINE> while True: <NEW_LINE> <INDENT> print("You currently have", self.xp, "xp.") <NEW_LINE> print("-- Shop Inventory --") <NEW_LINE> for i in self.ite...
Shop of the game, upgrade weapons etc-
625941f5be7bc26dc91cdc24
def build(self): <NEW_LINE> <INDENT> self.header.push_to_storage() <NEW_LINE> if self.header.qdcount: <NEW_LINE> <INDENT> self.question.push_to_storage() <NEW_LINE> <DEDENT> for a_type in self.answers.values(): <NEW_LINE> <INDENT> for answer in a_type: <NEW_LINE> <INDENT> answer.push_to_storage() <NEW_LINE> <DEDENT> <D...
Build message for sending :return: None
625941f5a4f1c619b28b0659
def leap_year_range(start, end): <NEW_LINE> <INDENT> for year in range(start, end + 1): <NEW_LINE> <INDENT> if is_leap_year(year): <NEW_LINE> <INDENT> yield year
Leap year generator
625941f5498bea3a759ba0dd
def p_taskBlock(p): <NEW_LINE> <INDENT> global taskBoolz <NEW_LINE> global createdWorlds <NEW_LINE> global currentTask <NEW_LINE> attributesObjects = { "type": "Task", "line": p.lineno(2), "column": p.lexspan(2)[0] + 1, } <NEW_LINE> p[0] = Node("Task", [p[1], p[2]]) <NEW_LINE> if len(stack.stack) > 1: <NEW_LINE> <INDEN...
taskBlock : taskDefinition multiInstructions TkEndTask
625941f5099cdd3c635f1288
def record_user_operation(record): <NEW_LINE> <INDENT> path = os.path.join(setting.BASE_LOGDIR, "appOperationLog.txt") <NEW_LINE> timeStr = time.strftime("%Y-%m-%d %X ") <NEW_LINE> if os.path.exists(path): <NEW_LINE> <INDENT> with open(path,"r",encoding='utf-8') as f_read,open("tempBalance.txt","w+",encoding='utf-8') a...
保存用户操作记录 :param record: :return:
625941f54f88993c3716c690
def rstyle(ax): <NEW_LINE> <INDENT> for child in ax.get_children(): <NEW_LINE> <INDENT> if isinstance(child, matplotlib.spines.Spine): <NEW_LINE> <INDENT> child.set_alpha(0) <NEW_LINE> <DEDENT> <DEDENT> for line in ax.get_xticklines() + ax.get_yticklines(): <NEW_LINE> <INDENT> line.set_markersize(5) <NEW_LINE> line.set...
Styles an axes to appear like ggplot2 Must be called after all plot and axis manipulation operations have been carried out (needs to know final tick spacing)
625941f50fa83653e46575e7
def test_status_code(self): <NEW_LINE> <INDENT> for i, response in enumerate(self.responses): <NEW_LINE> <INDENT> with self.subTest(self.bodies[i]): <NEW_LINE> <INDENT> self.assertEqual(response.status_code, 201)
Assert that each response has an HTTP 201 status code.
625941f56fece00bbac2dd76
def __init__(self) -> None: <NEW_LINE> <INDENT> self.x = 'C2_x'
A function comment for testing.
625941f560cbc95b062c6b74
def solver(self, add, remove): <NEW_LINE> <INDENT> channels = [] <NEW_LINE> self._write_installed_packages() <NEW_LINE> for channel_name, packages in self._channel_packages.items(): <NEW_LINE> <INDENT> self._write_repo_packages(channel_name, packages) <NEW_LINE> channel = Channel(str(self._channels_path / channel_name)...
Writes ``repo_packages`` to the disk and creates a solver instance.
625941f5f9cc0f698b140c26
@flask_app.route('/create_from_logfile', methods=['GET', 'POST']) <NEW_LINE> def create_from_file(): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> if 'file' not in request.files: <NEW_LINE> <INDENT> flash('No file part', "info") <NEW_LINE> return redirect(request.url) <NEW_LINE> <DEDENT> file = r...
Returns page to create new log entry from logfiles
625941f563b5f9789fde7716
def s_relate_pattern(self, other, pattern): <NEW_LINE> <INDENT> pattern = c_char_p(pattern.encode('ascii')) <NEW_LINE> return bool(self.impl['relate_pattern'](self, other, pattern))
Returns True if the DE-9IM string code for the relationship between the geometries satisfies the pattern, else False
625941f544b2445a339326c1
def make_new_session_id() -> str: <NEW_LINE> <INDENT> return f"{datetime.datetime.utcnow():%Y%m%d%H%M%S}-{os.urandom(4).hex().upper()}"
SessionIDのためのUniqueっぽい文字列を作る
625941f54c3428357757c954
def train_step(x_batch, y_batch): <NEW_LINE> <INDENT> feed_dict = { cnn.input_x: x_batch, cnn.input_y: y_batch, cnn.dropout_keep_prob: FLAGS.dropout_keep_prob } <NEW_LINE> _, step, summaries, loss, accuracy = sess.run( [train_op, global_step, train_summary_op, cnn.loss, cnn.accuracy], feed_dict) <NEW_LINE> time_str = d...
A single training step
625941f550485f2cf553d3cc
def sign(self, msg): <NEW_LINE> <INDENT> self.update_counter() <NEW_LINE> sk = self.root_key[1] <NEW_LINE> sig = "" <NEW_LINE> for d in range(0, self.depth, 1): <NEW_LINE> <INDENT> subtree = merkle_tree([self.node_keys[d][x][0] for x in range(subtree_width)]) <NEW_LINE> subtree.prune(self.node_index[d]) <NEW_LINE> sig ...
Sign the path to a leaf in the tree and sign using that leaf
625941f5a8370b7717052ecd
def search_patterns(bwt_filename): <NEW_LINE> <INDENT> file = open('outputTask3.txt', 'w') <NEW_LINE> bwt_list = read_bwt(bwt_filename) <NEW_LINE> pattern_list = read_file(patt_filename) <NEW_LINE> new_occ_tb, freq_tb = no_occurence_freq_tb(bwt_filename) <NEW_LINE> rank_tb, old_occurences = rank_table(bwt_filename) <NE...
This function searches for the given patterns in the text and returns the no of occurences and the positions where that pattern appears in the original text :param: Any supplied text file with the bwt :precondition: The bwt must exist and the occurence table and rank table should have already been created :postconditio...
625941f5b5575c28eb68e637
def cons(lList, item): <NEW_LINE> <INDENT> return (item, lList)
Constructs a Linked list by prepending an item
625941f57b180e01f3dc4e1f
def find_action_index(actions, type): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> for action in actions: <NEW_LINE> <INDENT> if isinstance(action, type): <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> i = i + 1 <NEW_LINE> <DEDENT> raise Exception("Couldn't find %s action" % type)
Return the index of the given action type.
625941f5004d5f362079a95e
def clear_lock(remote=None, lock_type='update'): <NEW_LINE> <INDENT> gitfs = salt.utils.gitfs.GitFS(__opts__) <NEW_LINE> gitfs.init_remotes(__opts__['gitfs_remotes'], PER_REMOTE_OVERRIDES) <NEW_LINE> return gitfs.clear_lock(remote=remote, lock_type=lock_type)
Clear update.lk
625941f5956e5f7376d7149b
def unauthorized(message=None): <NEW_LINE> <INDENT> if message is None: <NEW_LINE> <INDENT> if current_app.config['USE_TOKEN_AUTH']: <NEW_LINE> <INDENT> message = 'Please authenticate with your token.' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> message = 'Please authenticate.' <NEW_LINE> <DEDENT> <DEDENT> response =...
HTTP 401
625941f52eb69b55b151cee9
def process_content_section( section, content_blocks, appended_content, prev, prefs=None ): <NEW_LINE> <INDENT> tag_name = section.get("tag_name") <NEW_LINE> content, tag_name, attr, action, wrap = process_content( tag_name, section.get("content"), prev, prefs ) <NEW_LINE> if ( (prev.get("wrap") and not wrap) or (wrap ...
profile and format the section content adding content blocks
625941f57b180e01f3dc4e20
def QA_fetch_stock_min_adv( code, start, end=None, frequence='1min', if_drop_index=False, collections=DATABASE.stock_min): <NEW_LINE> <INDENT> if frequence in ['1min', '1m']: <NEW_LINE> <INDENT> frequence = '1min' <NEW_LINE> <DEDENT> elif frequence in ['5min', '5m']: <NEW_LINE> <INDENT> frequence = '5min' <NEW_LINE> <D...
'获取股票分钟线' :param code: 字符串str eg 600085 :param start: 字符串str 开始日期 eg 2011-01-01 :param end: 字符串str 结束日期 eg 2011-05-01 :param frequence: 字符串str 分钟线的类型 支持 1min 1m 5min 5m 15min 15m 30min 30m 60min 60m 类型 :param if_drop_index: Ture False , dataframe drop index or not :param collections: mongodb 数据库 :return: QA_DataStru...
625941f515fb5d323cde114a
def process_queries(search_index, queries): <NEW_LINE> <INDENT> search(search_index, queries)
function to process the search queries iterate through all the queries and call the search function print the results returned by search function
625941f5091ae35668667584
def abrirventanaMetodo2(): <NEW_LINE> <INDENT> win2=tk.Tk() <NEW_LINE> win2.title("Calibracion Linel") <NEW_LINE> win2.geometry("350x210+500+200") <NEW_LINE> win2.configure(background="#2E2E2E") <NEW_LINE> e2=tk.Label(win2,text="Datos de entrada",bg="#2E2E2E", fg="#E4AB3B", font=('Helvetica', 12)) <NEW_LINE> e2.grid(ro...
Función que contiene la ventana que solicita los datos de entrada al usuario para la calibración lineal. Parameters ---------- Ningún parámetro de entrada Returns ------- Ningún parámetro de salida
625941f507d97122c4178ecb
def _is_suggestion_handled(thread_id, exploration_id): <NEW_LINE> <INDENT> thread = feedback_models.FeedbackThreadModel.get_by_exp_and_thread_id( exploration_id, thread_id) <NEW_LINE> return ( thread.status in [ feedback_models.STATUS_CHOICES_FIXED, feedback_models.STATUS_CHOICES_IGNORED])
Checks if the current suggestion has already been accepted/rejected.
625941f571ff763f4b549cc8
def can_bite(self, ilk: Ilk, urn: Urn) -> bool: <NEW_LINE> <INDENT> assert isinstance(ilk, Ilk) <NEW_LINE> assert isinstance(urn, Urn) <NEW_LINE> ilk = self.vat.ilk(ilk.name) <NEW_LINE> urn = self.vat.urn(ilk, urn.address) <NEW_LINE> rate = ilk.rate <NEW_LINE> safe = Ray(urn.ink) * ilk.spot >= Ray(urn.art) * rate <NEW_...
Determine whether a vault can be liquidated Args: ilk: Collateral type urn: Identifies the vault holder or proxy
625941f51f5feb6acb0c517a
def test_melt(self): <NEW_LINE> <INDENT> L = PyLammps() <NEW_LINE> L.units('lj') <NEW_LINE> L.atom_style('atomic') <NEW_LINE> L.lattice('fcc', 0.8442) <NEW_LINE> L.region('r1 block', 0, 10, 0, 10, 0, 10) <NEW_LINE> L.create_box(1, 'r1') <NEW_LINE> L.create_atoms(1, 'box') <NEW_LINE> L.mass(1, 1.0) <NEW_LINE> L.velocity...
3d Lennard-Jones melt
625941f5d18da76e23532b0f
def detect_intent_event(self, event_msg): <NEW_LINE> <INDENT> self.cancel_stream_intent = True <NEW_LINE> event_input = dialogflow.EventInput(language_code=self.language, name=event_msg.name) <NEW_LINE> params = struct_pb2.Struct() <NEW_LINE> for param in event_msg.parameters: <NEW_LINE> <INDENT> params[param.key] = pa...
Send event to dialogflow and publish response
625941f5507cdc57c630731b
def maxEnvelopes(self, envelopes): <NEW_LINE> <INDENT> l = len(envelopes) <NEW_LINE> in_degree = [0] * l <NEW_LINE> out = [[] for _ in range(0, l)] <NEW_LINE> count = l <NEW_LINE> for i in range(0, l): <NEW_LINE> <INDENT> for j in range(0, l): <NEW_LINE> <INDENT> if i != j and envelopes[i][0] < envelopes[j][0] and enve...
:type envelopes: List[List[int]] :rtype: int
625941f5cad5886f8bd27609
def test_decrement_by(self): <NEW_LINE> <INDENT> self._test_decrement(expected_value=2, expected_expr=F('counter') - 3, decrement_by=3)
Testing CounterField.decrement with decrement_by
625941f5925a0f43d254a4ae
def get_filename(node, file_path): <NEW_LINE> <INDENT> filename = node.expr <NEW_LINE> filenames = [] <NEW_LINE> if isinstance(filename, php.BinaryOp): <NEW_LINE> <INDENT> filenames = get_binaryop_params(filename) <NEW_LINE> <DEDENT> elif type(filename) is str: <NEW_LINE> <INDENT> filenames = [filename] <NEW_LINE> <DED...
获取 :param node: :param file_path: :return:
625941f563b5f9789fde7717
def getKey(self, context): <NEW_LINE> <INDENT> uid = getSecurityManager().getUser().getId() <NEW_LINE> if uid is not None: <NEW_LINE> <INDENT> return 'user:%s' % uid <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> session_manager = getToolByName(context, 'session_data_manager') <NEW_LINE> if not session_manager.hasSessio...
Return key that can be used to recover the cart for the current user or session.
625941f510dbd63aa1bd31d2
def to_ipv4 (self, check_ipv4 = True): <NEW_LINE> <INDENT> if check_ipv4: <NEW_LINE> <INDENT> if not self.is_ipv4: <NEW_LINE> <INDENT> raise RuntimeError('Not an IPv4ish IPv6 address') <NEW_LINE> <DEDENT> <DEDENT> return IPAddr(self._value[-4:])
Convert to an IPAddr This only makes sense if this address is ipv4 mapped/compatible. By default we check that this is the case.
625941f5460517430c3947a4
def drop_tables(cur, conn): <NEW_LINE> <INDENT> for query in drop_table_queries: <NEW_LINE> <INDENT> cur.execute(query) <NEW_LINE> conn.commit()
Drops tables in Redshift cluster :param cur: cursor object to execute query :param conn: connection object to commit changes :return: None
625941f5796e427e537b0bfc
def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'timestamp': 'datetime', 'event_number': 'int', 'event_type': 'str', 'added_objects': 'list[EventObjectIdentifier]', 'modified_objects': 'list[EventObjectIdentifier]', 'deleted_objects': 'list[EventObjectIdentifier]' } <NEW_LINE> self.attribute_map = { 'tim...
ObjectChangeEvent - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941f57d847024c06be8f2
def test_resolved_reichmoore(): <NEW_LINE> <INDENT> subsection = library.mat10020000['data'][10020]['resolved'][1] <NEW_LINE> assert_array_equal(subsection[2]['int']['intpoints'], [3,7]) <NEW_LINE> assert_array_equal(subsection[2]['int']['intschemes'], [4,1]) <NEW_LINE> obs_data = subsection[2][2.5,2] <NEW_LINE> exp_da...
The section looks like this: EL EH LRU LRF NRO NAPS 419 2151 3 0.000000+0 0.000000+0 0 0 NR NP 419 2151 4 SPI AP LAD 0 NLS NLSC 419 2151 5 AWRI APL L 0 6*...
625941f550485f2cf553d3cd
def setOverlayRenderModel(self, ulOverlayHandle, pchRenderModel): <NEW_LINE> <INDENT> fn = self.function_table.setOverlayRenderModel <NEW_LINE> pColor = HmdColor_t() <NEW_LINE> result = fn(ulOverlayHandle, pchRenderModel, byref(pColor)) <NEW_LINE> return result, pColor
Sets render model to draw behind this overlay and the vertex color to use, pass null for pColor to match the overlays vertex color. The model is scaled by the same amount as the overlay, with a default of 1m.
625941f55510c4643540fa04
def tr(self, message): <NEW_LINE> <INDENT> return QCoreApplication.translate('LCZ_test', message)
Get the translation for a string using Qt translation API. We implement this ourselves since we do not inherit QObject. :param message: String for translation. :type message: str, QString :returns: Translated version of message. :rtype: QString
625941f5adb09d7d5db6cdbc
def register_mimetype_file(self, fname): <NEW_LINE> <INDENT> for ext, t in mimetypes.read_mime_types(fname).items(): <NEW_LINE> <INDENT> mimetypes.add_type(t, ext)
Register a mimetype for a given extension.
625941f5d53ae8145f87a894
def solve(n, step=0): <NEW_LINE> <INDENT> if step == n**2: <NEW_LINE> <INDENT> return isValid(n) <NEW_LINE> <DEDENT> for val in range(1, n**2 + 1): <NEW_LINE> <INDENT> if not used[val]: <NEW_LINE> <INDENT> used[val] = True <NEW_LINE> board[step / n][step % n] = val <NEW_LINE> if solve(n, step + 1): <NEW_LINE> <INDENT> ...
Complete given step in magic square board
625941f58e05c05ec3eea9ab
def get_sequence_output(self): <NEW_LINE> <INDENT> return self.sequence_output
Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder.
625941f5379a373c97cfb178
def receive(self): <NEW_LINE> <INDENT> if self.current_packet_size == -1: <NEW_LINE> <INDENT> if self._receive_to_buffer(_packet_length_size): <NEW_LINE> <INDENT> msg = self.buffer <NEW_LINE> self.buffer = b'' <NEW_LINE> self.current_packet_size = struct.unpack('I', msg)[0] <NEW_LINE> <DEDENT> <DEDENT> if self.current_...
Processes a notification or response from server. :return: If there was something processed.
625941f591af0d3eaac9c04e
def _rpc(self, frame_value): <NEW_LINE> <INDENT> if self.channel.closed: <NEW_LINE> <INDENT> raise exceptions.ChannelClosedException() <NEW_LINE> <DEDENT> return self.channel.rpc(frame_value)
Execute the RPC command for the frame. :param pamqp.specification.Frame frame_value: The frame to send :rtype: pamqp.specification.Frame or pamqp.message.Message
625941f5a4f1c619b28b065a
def _prepare_threads(self): <NEW_LINE> <INDENT> self._threads = [] <NEW_LINE> for i in range(self.num_workers): <NEW_LINE> <INDENT> t = threading.Thread(target=self._fetch) <NEW_LINE> t.setDaemon(True) <NEW_LINE> t.start() <NEW_LINE> self._threads.append(t)
Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web templates).
625941f5435de62698dfe27e
def setSize(self, *args, **kwargs): <NEW_LINE> <INDENT> return _VISHNU.FileStat_setSize(self, *args, **kwargs)
setSize(self, EBigInteger _size)
625941f5b830903b967e9f35
def dbox(self, d): <NEW_LINE> <INDENT> return self.wann(self.ann.dbox(d))
Increase the size of boxes by 2*d
625941f563d6d428bbe44b22
def __check_attributes(features, allowed_values, attributes=None, islike=None): <NEW_LINE> <INDENT> return check_attributes(features, allowed_values)
Empty proxy function for calling check_attributes with propper parameters
625941f50a366e3fb873ee51
def post_allocate_jobsteps(self, jobstep_ids, cluster=None): <NEW_LINE> <INDENT> data = {'jobstep_ids': jobstep_ids} <NEW_LINE> if cluster: <NEW_LINE> <INDENT> data['cluster'] = cluster <NEW_LINE> <DEDENT> return self._api_request("/jobsteps/allocate/", data)['allocated']
Attempt to allocate the given list of JobStep ids. Args: jobstep_ids: list of JobStep ID hexs to allocate. cluster: cluster to allocate in. Returns: list: list of jobstep ID hexs that were actually allocated.
625941f59b70327d1c4e1409
def parseNone(self): <NEW_LINE> <INDENT> self.tokens.append( ('n', self.s[self.pos]) ) <NEW_LINE> self.pos += 1
just skips
625941f5167d2b6e312191c5
def existing_url(module): <NEW_LINE> <INDENT> url_base = "/axapi/v3/import-periodic/auth-portal/{auth-portal}" <NEW_LINE> f_dict = {} <NEW_LINE> f_dict["auth-portal"] = module.params["auth_portal"] <NEW_LINE> return url_base.format(**f_dict)
Return the URL for an existing resource
625941f5a219f33f34628f91
def get_breakpoints(elements, max_characters): <NEW_LINE> <INDENT> breakpoints = [] <NEW_LINE> length_tracker = 0 <NEW_LINE> for i, element in enumerate(elements): <NEW_LINE> <INDENT> if length_tracker + len(element) + 1 > max_characters: <NEW_LINE> <INDENT> breakpoints.append(i) <NEW_LINE> length_tracker = len(element...
return the indices of the element in elements to break on, so that the printed output does not exceed max_characters when joining the elements to form an putput string. Called by WERCalculator.print_alignment(). Parameters: ----------- elements : iterable max_characters : int Returns: breakpoints : list
625941f57047854f462a1a33
def validateProjects(self, target_projects): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> mep_projects = list(set([project for project in target_projects if ' // ' in project])) <NEW_LINE> <DEDENT> except Exception as msg: <NEW_LINE> <INDENT> raise OperationalError("%s %s" % ("error in agicen_bld_connection.py ...
make requests to AgileCentral to retrieve basic info for each project in target_projects. If any project name in target_projects does NOT have a corresponding project in AgileCentral raise and Exception naming the offending project.
625941f56aa9bd52df0373d9
def reset_current_etcd_installation(): <NEW_LINE> <INDENT> lock_file = "{}/var/lock/clustered.lock".format(snapdata_path) <NEW_LINE> if not os.path.isfile(lock_file): <NEW_LINE> <INDENT> print("Not in clustering mode.") <NEW_LINE> exit(2) <NEW_LINE> <DEDENT> os.remove(lock_file) <NEW_LINE> os.remove(ca_cert_file) <NEW_...
Take a node out of a cluster
625941f54e4d5625662d4a00
def getAnnotatedImage(self, data, split): <NEW_LINE> <INDENT> minibatch = sample_coco_minibatch(data, batch_size=1, split=split) <NEW_LINE> captions, features, urls = minibatch <NEW_LINE> gt_captions = decode_captions(captions, data['idx_to_word'] ) <NEW_LINE> _,captions_out = self.beam_decode(features) <NEW_LINE> sam...
samples image and returns it with GT and generated capture
625941f545492302aab5e8fb
def manipulation_binascii(): <NEW_LINE> <INDENT> c = 'A' <NEW_LINE> v = ord(c) <NEW_LINE> print("{} = 0x{:x}".format(v, v)) <NEW_LINE> """ Definition classique d'une string """ <NEW_LINE> s = "ff00" <NEW_LINE> print(type(s)) <NEW_LINE> print(s) <NEW_LINE> print("{} / {} / {} / {}".format(s[0], s[1], s[2], s[3])) <NEW...
Jouons juste ce qu'il faut avec les octets ...
625941f5a79ad161976cc777
def __setitem__(self, key, value): <NEW_LINE> <INDENT> if isinstance(key, toplevels.Name): <NEW_LINE> <INDENT> if len(key.sub_names) == 1: <NEW_LINE> <INDENT> name = key.sub_names[0] <NEW_LINE> if name in self: <NEW_LINE> <INDENT> self[name] = CascadeDict(self[name], value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
key can be an Name instance. When key is a path in the form of an Name instance, all the parents and grandparents of the value are created along the way as instances of NamedDict. If the parent of the value exists, it is replaced with a CascadeDict() that cascades the old parent value with a new NamedDict that contain...
625941f515fb5d323cde114b
def issue_token(self, expiration=TWO_HOURS): <NEW_LINE> <INDENT> secret_key = os.environ.get('SECRET_KEY') <NEW_LINE> token = jwt.encode( {'exp': datetime.datetime.utcnow() + datetime.timedelta(seconds=expiration), 'username': self.username}, secret_key) <NEW_LINE> return token
Generate a token with timestamp and expiration.
625941f50383005118ecfc11
def test_exp_and_log_from_identity_left_metrics(self): <NEW_LINE> <INDENT> result = helper.exp_then_log_from_identity( metric=self.left_metric, tangent_vec=self.point_1) <NEW_LINE> expected = self.point_1 <NEW_LINE> expected = helper.to_vector(expected) <NEW_LINE> with self.test_session(): <NEW_LINE> <INDENT> self.asse...
Test that the riemannian exponential and the riemannian logarithm are inverse. Expect their composition to give the identity function.
625941f55fcc89381b1e1cf6
def git_encode_object(sha): <NEW_LINE> <INDENT> kind = git_object_kind(sha) <NEW_LINE> size = git_command_output('cat-file', '-s', sha) <NEW_LINE> contents = git_object_data(sha, kind) <NEW_LINE> data = kind.encode('utf8') + b' ' + size.encode('utf8') + b'\0' + contents <NEW_LINE> compressed = zlib.compress(data) <NEW_...
Return the encoded contents of the object. The encoding is identical to the encoding git uses for loose objects. This operation is the inverse of `git_decode_object`.
625941f597e22403b379d5cd
@auto.doc() <NEW_LINE> @mod.route('/buy_set', methods=['POST']) <NEW_LINE> def buy_set(): <NEW_LINE> <INDENT> lang = request.args.get('lang', type=unicode, default=u'en') <NEW_LINE> vendor_id = request.args.get('vendor_id', type=unicode, default=u'') <NEW_LINE> store_id = request.json.get('store_id') <NEW_LINE> if stor...
Buy set with store id in json. List of parameters in json request (one of them is required): store_id Example of request: {"store_id": "1"} :return: json with parameters: error_code - server response_code result - information about set
625941f5796e427e537b0bfd
def __init__(self, state=None): <NEW_LINE> <INDENT> self._state = None <NEW_LINE> self.discriminator = None <NEW_LINE> if state is not None: <NEW_LINE> <INDENT> self.state = state
WebReputationPolicyExtension - a model defined in Swagger
625941f5bde94217f368341c
def approve(self, approved_by): <NEW_LINE> <INDENT> data = { 'email': self.email, 'username': self.username, 'title': self.title, 'short_name': self.short_name, 'full_name': self.full_name, 'institute': self.institute, 'department': self.department, 'position': self.position, 'telephone': self.telephone, 'mobile': self...
Create a new user from an applicant.
625941f53617ad0b5ed68528
def color_producer(name): <NEW_LINE> <INDENT> if name == "Microsoft Headquarters": <NEW_LINE> <INDENT> return 'blue' <NEW_LINE> <DEDENT> elif name == 'Harvard of Central Minnesota': <NEW_LINE> <INDENT> return 'red' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'green'
This funcion returns the color of the markers for the map inputs: string name of college Ouputs: returns color of the marker to be used.
625941f52ae34c7f2600d762