code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def parse_node(s, strip_comments=False, **kw): <NEW_LINE> <INDENT> if strip_comments: <NEW_LINE> <INDENT> s = COMMENT.sub('', s) <NEW_LINE> <DEDENT> s = s.strip() <NEW_LINE> parts = s.split(')') <NEW_LINE> if len(parts) == 1: <NEW_LINE> <INDENT> descendants, label = [], s <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> i...
Parse a Newick formatted string into a `Node` object. :param s: Newick formatted string to parse. :param strip_comments: Flag signaling whether to strip comments enclosed in square brackets. :param kw: Keyword arguments are passed through to `Node.create`. :return: `Node` instance.
625941eeb7558d58953c5458
def __SetSpringFrequencyHz(self, *args, **kwargs): <NEW_LINE> <INDENT> return _Box2D.b2WheelJoint___SetSpringFrequencyHz(self, *args, **kwargs)
__SetSpringFrequencyHz(self, float32 hz) Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring.
625941ee07d97122c4178de8
def adjust_learning_rate(optimizer, epoch, args): <NEW_LINE> <INDENT> lr = args.lr <NEW_LINE> if args.cos: <NEW_LINE> <INDENT> lr *= 0.5 * (1. + math.cos(math.pi * epoch / args.epochs)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for milestone in args.schedule: <NEW_LINE> <INDENT> lr *= 0.1 if epoch >= milestone else...
Decay the learning rate based on schedule
625941ee7b180e01f3dc4d41
def channel_03(self, value): <NEW_LINE> <INDENT> self._channel(3, value)
input from scratch to adapter, value = 0..100
625941ee283ffb24f3c55e4b
def __init__(self, app): <NEW_LINE> <INDENT> self._app = app <NEW_LINE> self.loop = asyncio.get_running_loop() <NEW_LINE> self._store = {}
:param app: feeluown app instance :param loop: asyncio event loop
625941eebaa26c4b54cb1669
def __init__(self, rgb_scale: bool, x_min=0, x_max=255, L=256): <NEW_LINE> <INDENT> super(DiscretizedMixLogisticLoss, self).__init__() <NEW_LINE> self.rgb_scale = rgb_scale <NEW_LINE> self.x_min = x_min <NEW_LINE> self.x_max = x_max <NEW_LINE> self.L = L <NEW_LINE> self.use_coeffs = rgb_scale <NEW_LINE> self._num_param...
:param rgb_scale: Whether this is the loss for the RGB scale. In that case, use_coeffs=True _num_params=_NUM_PARAMS_RGB == 4, since we predict coefficients lambda. See note above. :param x_min: minimum value in targets x :param x_max: maximum value in targets x :param L: number of symbols
625941ee71ff763f4b549be5
def hitBricks(self, grid, hits): <NEW_LINE> <INDENT> ret = [0 for i in range(len(hits))] <NEW_LINE> for hit in hits: <NEW_LINE> <INDENT> grid[hit[0]][hit[1]] -= 1 <NEW_LINE> <DEDENT> connected = self.build_connection(grid) <NEW_LINE> for idx in range(len(hits)): <NEW_LINE> <INDENT> r, c = hits[-1 - idx] <NEW_LINE> grid...
:type grid: List[List[int]] :type hits: List[List[int]] :rtype: List[int]
625941ee7047854f462a1953
def _symlink_to_workdir(data, key): <NEW_LINE> <INDENT> orig_file = tz.get_in(key, data) <NEW_LINE> if orig_file and not orig_file.startswith(dd.get_work_dir(data)): <NEW_LINE> <INDENT> variantcaller = genotype.get_variantcaller(data) <NEW_LINE> if not variantcaller: <NEW_LINE> <INDENT> variantcaller = "precalled" <NEW...
For CWL support, symlink files into a working directory if in read-only imports.
625941ee3617ad0b5ed68446
def my_walk(_action, identifier, key, value): <NEW_LINE> <INDENT> print('>', identifier, key, value)
Aggregate walker.
625941ee01c39578d7e7538b
def get_lexicon(lang, user_lexicon): <NEW_LINE> <INDENT> lang_lexicons = YAPUDLEX.lexicons()[lang] <NEW_LINE> if user_lexicon and user_lexicon not in lang_lexicons: <NEW_LINE> <INDENT> print("Unknown lexicon for languages %s, options are: %s" % (lang, "/".join(lang_lexicons))) <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT>...
Gets a UD lexicon from a languages available lexicons, or the only possible lexicon if there's only one
625941ee7d43ff24873a31f4
def pd_from_formula(f): <NEW_LINE> <INDENT> entries = get_chemsys(f) <NEW_LINE> return build_corrected_pd(entries)
pd_from_formula Builds a phase diagram containing the compound with formula f. :param f: (String) A chemical formula :return: A (corrected) PD built around formula f.
625941ee3cc13d1c6d3c78c7
def test_primary_admin(self, **kwargs): <NEW_LINE> <INDENT> if not self.user_id: <NEW_LINE> <INDENT> raise self.NotLoggedInException <NEW_LINE> <DEDENT> email = user_services.get_email_from_user_id(self.user_id) <NEW_LINE> if email != feconf.SYSTEM_EMAIL_ADDRESS: <NEW_LINE> <INDENT> raise self.UnauthorizedUserException...
Checks if the user is logged in and is a primary admin e.g. user with email address equal to feconf.SYSTEM_EMAIL_ADDRESS. Args: **kwargs: *. Keyword arguments. Returns: *. The return value of the decorated function. Raises: NotLoggedInException. The user is not logged in. UnauthorizedUserException. T...
625941ee4e696a04525c999d
def cache_drop(self, metric_name): <NEW_LINE> <INDENT> self._cache_drop(metric_name)
Drop metric from cache.
625941ee498bea3a759b9ffd
def handle_hero_portal(self, value): <NEW_LINE> <INDENT> if self.cur_level == 21: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not self.show_portal_page and value == -1: <NEW_LINE> <INDENT> self.show_portal_page = True <NEW_LINE> <DEDENT> elif self.show_portal_page and 0 <= value <= self.max_level: <NEW_LINE> <IND...
处理使用传送门道具的逻辑
625941ee5fcc89381b1e1c13
def test_list_repos_conflict_skipped_ignored_project( cli_runner, project_tree, piped_shell_execute ): <NEW_LINE> <INDENT> root = str(project_tree.join("root_c")) <NEW_LINE> base_args = ["-p", root, "--repos"] <NEW_LINE> command_args = base_args + [ "--skip-project=dep_c1.3", "--ignore-project=dep_c1.3", "-pp", ] <NEW_...
:type cli_runner: click.testing.CliRunner :type project_tree: py.path.local :type piped_shell_execute: mocker.patch
625941eed164cc617578329f
def get_entity_type_collection_with_http_info(self, entity_type_collection_id, **kwargs): <NEW_LINE> <INDENT> local_var_params = locals() <NEW_LINE> all_params = [ 'entity_type_collection_id' ] <NEW_LINE> all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth'...
Returns the EntityTypeCollection object for a given id # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_entity_type_collection_with_http_info(entity_type_collection_id, async_req=True) >>> result = thread.get()...
625941ee460517430c3946c6
def arraygraphics(a, idxstr, title=True, xscale=1.0, fgcolor=color.grey(1), bgcolor=color.hsb(0.9, 1, 0.5)): <NEW_LINE> <INDENT> assert a.ndim == 2 <NEW_LINE> n0, n1 = a.shape <NEW_LINE> highlighted = np.zeros_like(a, dtype=bool) <NEW_LINE> exec("highlighted{} = True".format(idxstr)) <NEW_LINE> unit.set(xscale=xscale) ...
create a graphical representation of a two-dimensional array a array containing the data to be shown slicestr string defining the slice to be highlighted xscale PyX scaling for text fgcolor color of highlighted data bgcolor color of highlighted cells
625941eeac7a0e7691ed4611
def test_opened_view(self): <NEW_LINE> <INDENT> target_url = url_for('opened.show_opened') <NEW_LINE> redirect_url = url_for('auth.login', next=target_url) <NEW_LINE> response = self.client.get(target_url) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE> self.assertRedirects(response, redirect_url)
Test that cutomers page is inaccessible without login and redirects to login page then to departments page
625941ee5fdd1c0f98dc0785
def reduce_over_axes( self, func=np.add, keepdims=False, axes_names=None, weights=None ): <NEW_LINE> <INDENT> if axes_names is None: <NEW_LINE> <INDENT> axes_names = self.geom.axes.names <NEW_LINE> <DEDENT> map_out = self.copy() <NEW_LINE> for axis_name in axes_names: <NEW_LINE> <INDENT> map_out = map_out.reduce( axis_...
Reduce map over non-spatial axes Parameters ---------- func : `~numpy.ufunc` Function to use for reducing the data. keepdims : bool, optional If this is set to true, the axes which are summed over are left in the map with a single bin axes_names: list Names of MapAxis to reduce over If None, all wi...
625941ee4f88993c3716c5b1
@mando.command("stack", formatter_class=RSTHelpFormatter, doctype="numpy") <NEW_LINE> @tsutils.doc(tsutils.docstrings) <NEW_LINE> def stack_cli( input_ts="-", columns=None, start_date=None, end_date=None, round_index=None, dropna="no", skiprows=None, index_type="datetime", names=None, source_units=None, target_units=No...
Return the stack of the input table. The stack command takes the standard table and converts to a three column table. From:: Datetime,TS1,TS2,TS3 2000-01-01 00:00:00,1.2,1018.2,0.0032 2000-01-02 00:00:00,1.8,1453.1,0.0002 2000-01-03 00:00:00,1.9,1683.1,-0.0004 To:: Datetime,Columns,Values 2000-01-01,TS...
625941ee07f4c71912b119d5
def test_add_changed(env): <NEW_LINE> <INDENT> file_ = join(env.repo_dir, 'foo') <NEW_LINE> open(file_, 'w').write(HELLO_CONTENT) <NEW_LINE> check_status(['A .gitattributes', '?? foo']) <NEW_LINE> add_file(env, file_, HELLO_DIGEST, ['A .gitattributes', 'A .gitbig', 'A foo']) <NEW_LINE> check_output(['git', 'big', '...
Adding a file and then changing its content should result in a new link
625941ee097d151d1a2233a6
def pos_no_conflict_check(positions, R): <NEW_LINE> <INDENT> for pos in positions: <NEW_LINE> <INDENT> if not single_pos_no_conflict_check(pos, R): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True
check the positions are vacant :param positions: :param R: :return:
625941ee73bcbd0ca4b2c5c5
def test_overlapping_rates(self): <NEW_LINE> <INDENT> with self.assertRaises(ValidationError): <NEW_LINE> <INDENT> self.wt1040.rate_ids = [(0, 0, { 'date_start': fields.Date.to_string( date.today() - timedelta(days=1)) })]
Check that overlapping rates cannot be created
625941eebde94217f368333c
def __init__(self): <NEW_LINE> <INDENT> self._queue = [] <NEW_LINE> self._semaphore = Semaphore(0) <NEW_LINE> self._lock = Lock()
Constructor of this class. It will set up the internal data structure as well as all synchronization variables.
625941eedd821e528d63b6f5
def rotate(self, matrix): <NEW_LINE> <INDENT> size = len(matrix) <NEW_LINE> for lvl in range(size//2): <NEW_LINE> <INDENT> bar1 = [(lvl, x) for x in range(lvl+1, size-lvl)] <NEW_LINE> bar2 = [(y, size-lvl-1) for y in range(lvl+1, size-lvl)] <NEW_LINE> bar3 = [(~lvl, ~x) for x in range(lvl+1, size-lvl)] <NEW_LINE> bar4 ...
:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
625941ee4e696a04525c999e
def verify_change_descs(src_p4, dst_p4, src_desc, dst_desc, src_change_id, dst_change_id, src_depot_map, dst_depot_map): <NEW_LINE> <INDENT> descVerify = VerifyChangeDescAttr(src_p4, dst_p4, src_desc, dst_desc, src_change_id, dst_change_id, src_depot_map, dst_depot_map) <NEW_LINE> if src_p4.is_unicode_server() != dst_p...
verify if description of replicated change is the same as orginal @param src_p4 [in] source p4server @param dst_p4 [in] destination p4server @param src_desc [in] output of "p4 describe src_change_id" @param dst_desc [in] output of "p4 describe dst_change_id" @param src_change_id [in] source change id @param dst_change...
625941ee283ffb24f3c55e4c
def read(*args, **kwargs): <NEW_LINE> <INDENT> return XYZSnapshot.read_single(*args, **kwargs)
Read a single snapshot from the disk.
625941ee56b00c62f0f14bad
def ancestor_names(self, node): <NEW_LINE> <INDENT> return node.ancestor_names()
Returns the ancestor names of the tree in order
625941eecb5e8a47e48b7ff2
def init_db(): <NEW_LINE> <INDENT> with db_conn() as conn: <NEW_LINE> <INDENT> with app.open_resource('schema.sql') as f: <NEW_LINE> <INDENT> conn.cursor().executescript(f.read().decode()) <NEW_LINE> <DEDENT> conn.commit()
此函数用于创建数据库,需要在 flask shell 里引入执行
625941ee15baa723493c44ca
def __init__(self): <NEW_LINE> <INDENT> return
! Initializer @param self this object @return none
625941eede87d2750b8602e9
@decorator_tools.decorator <NEW_LINE> def with_tree_lock(method, *args, **kwargs): <NEW_LINE> <INDENT> self = args[0] <NEW_LINE> with self.tree.lock.write: <NEW_LINE> <INDENT> return method(*args, **kwargs)
Decorator used in `Project`'s methods to acquire/release the tree lock. The tree lock will be acquired in write mode before calling the method, and released after the method is finished. (Note that it's a reentrant lock, so it may still be owned by the current thread after releasing.)
625941eef548e778e58cdad0
def on_save_event(self): <NEW_LINE> <INDENT> if self.dico.filename != "": <NEW_LINE> <INDENT> self.dico.save_dico()
Method used when the 'save' menu item is activate
625941ee5166f23b2e1a56a9
def _getLinkPorts(self, link_start, link_end): <NEW_LINE> <INDENT> self._eval("nlink = {:s}.getLinkNum({:s}, {:s});".format( self.opt.optName, str2mat(link_start), str2mat(link_end))) <NEW_LINE> self._eval("link = {:s}.link(nlink);".format(self.opt.optName)) <NEW_LINE> self._eval( ("optStart = {opt}.getOptic({opt}".for...
Get the ports of the start and end of a link
625941ee01c39578d7e7538c
def addStdItem(self, std_item): <NEW_LINE> <INDENT> if std_item._id > self.max_lab_id: <NEW_LINE> <INDENT> self.max_lab_id = std_item._id <NEW_LINE> <DEDENT> self.std_item_list[std_item._id] = std_item <NEW_LINE> if std_item.name not in self.item_index: <NEW_LINE> <INDENT> self.item_index[std_item.name] = [] <NEW_LINE...
@Brief addStdItem 添加标准词到内存索引 @Param std_item:
625941ee4d74a7450ccd4715
def train(): <NEW_LINE> <INDENT> with tf.Graph().as_default(): <NEW_LINE> <INDENT> global_step = tf.contrib.framework.get_or_create_global_step() <NEW_LINE> keep_prob3 = tf.placeholder(tf.float32) <NEW_LINE> keep_prob4 = tf.placeholder(tf.float32) <NEW_LINE> with tf.device('/cpu:0'): <NEW_LINE> <INDENT> images, labels ...
Train CIFAR-10 for a number of steps.
625941eed4950a0f3b08c897
def _get_request(self, target_uri, resource_type, params=None): <NEW_LINE> <INDENT> resource_object = None <NEW_LINE> sc, message = self.request(target_uri, GET, params=params) <NEW_LINE> operation = 'get %(res)s' % {'res': resource_type} <NEW_LINE> try: <NEW_LINE> <INDENT> self.check_status_code_success(operation, sc,...
Send a GET request to the array. :param target_uri: the target uri :param resource_type: the resource type, e.g. maskingview :param params: optional dict of filter params :returns: resource_object -- dict or None
625941ee66656f66f7cbc6fd
def _add_file(self, save_function): <NEW_LINE> <INDENT> if not self.recording: <NEW_LINE> <INDENT> raise ValueError('Movie is not initialized.') <NEW_LINE> <DEDENT> save_function("%s/frame_%09d.png" % (self.tempdir, self.frame)) <NEW_LINE> self.frame += 1
Adds a file to the current movie
625941ee3346ee7daa2b32c1
def _read_data(dataset, varname, step_var, sel_slice, avg_dim, tstep, dim): <NEW_LINE> <INDENT> if len(dataset[varname].shape) == dim: <NEW_LINE> <INDENT> return dataset[varname].values <NEW_LINE> <DEDENT> if step_var is None: <NEW_LINE> <INDENT> dset = dataset[varname] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if ...
The the data for a given step variable. Parameters ---------- dataset : collection datasets that contain the data that needs to be displayed varname : collection variable names that are displayed step_variable : collection variable names of the stpping dimension (dimension that is changed) sel_slice : dict if not ...
625941ee377c676e912726f7
def nombre_validation(value): <NEW_LINE> <INDENT> if not len(value) > 4: <NEW_LINE> <INDENT> raise ValidationError('Minimo 4 caracteres')
valida el tamanho del campo del nombre del paciente
625941ee851cf427c661aa5a
def get_sequence_child_item( model, required=False, child_attrs=('id', 'label'), ): <NEW_LINE> <INDENT> missing = colander.drop <NEW_LINE> if required: <NEW_LINE> <INDENT> missing = colander.required <NEW_LINE> <DEDENT> return [ get_sequence_child_item_id_node( widget=get_deferred_model_select(model, keys=child_attrs),...
Return the schema node to be used for sequence of related elements configuration Usefull in a many to many or one to many relationships. Needed to be able to configure a sequence of relations to existing objects e.g: ICPE_codes = relationship( "ICPECode", secondary=ICPE_CODE_ASSOCIATION_TABLE, ...
625941ee66673b3332b925e1
def t_tagattrvalstring_end(self, t): <NEW_LINE> <INDENT> t.lexer.pop_state()
"
625941ee187af65679ca5670
def before_register_message(self, node, user): <NEW_LINE> <INDENT> category = node.project_or_component <NEW_LINE> if self.user_settings and self.user_settings.has_auth: <NEW_LINE> <INDENT> return ( u'The contents of Dataverse add-ons cannot be registered at this time; ' u'the Dataverse study linked to this {category} ...
Return warning text to display if user auth will be copied to a registration.
625941ee566aa707497f4ab2
def main(): <NEW_LINE> <INDENT> data = input() <NEW_LINE> data = float(data) <NEW_LINE> temp = str(data).split('.') <NEW_LINE> if temp[1] == '0': <NEW_LINE> <INDENT> print(fourth_power(int(float(str(data))))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(fourth_power(data))
This prints x int or float
625941ee3617ad0b5ed68447
def close_spider(self, spider): <NEW_LINE> <INDENT> assert spider in self.sites, "Spider not opened: %s" % spider <NEW_LINE> site = self.sites[spider] <NEW_LINE> site.closing = defer.Deferred() <NEW_LINE> site.closing.addCallback(self.itemproc.close_spider) <NEW_LINE> self._check_if_closing(spider, site) <NEW_LINE> ret...
Close a spider being scraped and release its resources
625941eebe7bc26dc91cdb46
def test_can_access(self, **kwargs): <NEW_LINE> <INDENT> if not self.user_id: <NEW_LINE> <INDENT> raise base.UserFacingExceptions.NotLoggedInException <NEW_LINE> <DEDENT> if role_services.ACTION_ACCESS_LEARNER_DASHBOARD in self.user.actions: <NEW_LINE> <INDENT> return handler(self, **kwargs) <NEW_LINE> <DEDENT> else: <...
Checks if the user can access the learner dashboard. Args: **kwargs: *. Keyword arguments. Returns: *. The return value of the decorated function. Raises: NotLoggedInException. The user is not logged in. UnauthorizedUserException. The user does not have credentials to access the page.
625941eebe383301e01b59cb
def __init__(self, client, coordinator, index) -> None: <NEW_LINE> <INDENT> super().__init__(client, coordinator, index) <NEW_LINE> self._attr_name = f"{self.vehicle_name} Device Tracker" <NEW_LINE> self._attr_unique_id = self.vin
Initialize Mazda device tracker.
625941eee1aae11d1e74a20d
def send_document(self, data): <NEW_LINE> <INDENT> import telegram <NEW_LINE> caption = data.get(ATTR_CAPTION) <NEW_LINE> try: <NEW_LINE> <INDENT> document = load_data( url=data.get(ATTR_URL), file=data.get(ATTR_FILE), username=data.get(ATTR_USERNAME), password=data.get(ATTR_PASSWORD), ) <NEW_LINE> self.bot.sendDocumen...
Send a document.
625941ee5166f23b2e1a56aa
def process_month(self): <NEW_LINE> <INDENT> month = self.date_time[0] <NEW_LINE> move_len = month % len(self.code_list) <NEW_LINE> if move_len != 0: <NEW_LINE> <INDENT> for i in range(move_len): <NEW_LINE> <INDENT> pop_c = self.code_list.pop(0) <NEW_LINE> self.code_list.append(pop_c)
通过月来处理
625941ee9c8ee82313fbbcc8
def testUnsupportedImageFormatUpload(self): <NEW_LINE> <INDENT> response = upload_helper(self, "test.tiff") <NEW_LINE> self.failUnlessEqual(response.status_code, 200) <NEW_LINE> self.failUnlessEqual(len(response.redirect_chain), 0) <NEW_LINE> self.failIfEqual(response.context['upload_avatar_form'].errors, {})
Check with python-magic that we detect corrupted / unapprovd image files correctly
625941eeab23a570cc2506d8
def del_media(hostname, username, password, name): <NEW_LINE> <INDENT> media = check_settings(hostname, username, password, '/api/media') <NEW_LINE> for disk in media: <NEW_LINE> <INDENT> if disk['name'] == name: <NEW_LINE> <INDENT> response = requests.delete('https://' + hostname + '/api/media/%s' % disk['id'], auth=H...
A function to remove medium from foreman. Input parameter: Name of media (which is converted to ID) This allows you to remove existing values in Katello including default media.
625941ee7047854f462a1954
def gen_rev(): <NEW_LINE> <INDENT> r_time = time.time() - STD_EPOCH <NEW_LINE> return struct.pack('>Q', r_time * 1000000)
Return a revision based on timestamp
625941eee5267d203edce1e7
def CNN_inference(dim_patch, num_regions, argmax = True): <NEW_LINE> <INDENT> nb_classes = 3 <NEW_LINE> img_width, img_height = dim_patch,dim_patch <NEW_LINE> batch_size = 16 <NEW_LINE> n = 16 <NEW_LINE> samples_data_dir = '/tmp/SegNu' <NEW_LINE> model_pretrained = './weights/model_weights.h5' <NEW_LINE> base_model = V...
Generate patches with the input regions. :param dim_patch: An integer value. Number of the pixels in the side of the patch. :param num_regions: An integer value. Number of the region to be analyse. :param argmax: Wether get the inferred class for each region (True) or get the softmax prediction value for a region with...
625941ee8e7ae83300e4b51f
def extractall(self, path=".", members=None): <NEW_LINE> <INDENT> if members is None: <NEW_LINE> <INDENT> members = self <NEW_LINE> <DEDENT> for tarinfo in members: <NEW_LINE> <INDENT> self.extract(tarinfo, path, set_attrs=not tarinfo.isdir())
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers().
625941ee925a0f43d254a3cd
def forward(self,vertex_positions,mesh_faces,input_uvs,input_texture,mesh_face_textures): <NEW_LINE> <INDENT> images = [] <NEW_LINE> img_probs = [] <NEW_LINE> for i in range(self.N): <NEW_LINE> <INDENT> camera_view_mtx = self.cam_mat[i].repeat(vertex_positions.shape[0],1,1) <NEW_LINE> camera_view_shift = self.cameras_c...
输入: vertices : 顶点数*3 faces : 面数*3 uv : uv坐标值 : 顶点数x2 texture : NxCxHxW 图像 输出: N个视角下的渲染图像:NxCxHxW
625941ee5fc7496912cc3ece
def format_calendar(cal) -> Iterable[str]: <NEW_LINE> <INDENT> start, stop = cal.range <NEW_LINE> yield f"START {start}" <NEW_LINE> yield f"STOP {stop}" <NEW_LINE> yield "" <NEW_LINE> for date in cal.dates_array: <NEW_LINE> <INDENT> yield str(date)
Formats `cal` in the calendar file format.
625941eed53ae8145f87a7b6
def box_nms(bboxes, scores, threshold=0.5, mode='union'): <NEW_LINE> <INDENT> x1 = bboxes[:, 0] <NEW_LINE> y1 = bboxes[:, 1] <NEW_LINE> x2 = bboxes[:, 2] <NEW_LINE> y2 = bboxes[:, 3] <NEW_LINE> areas = (x2 - x1) * (y2 - y1) <NEW_LINE> order = argsort(scores.numpy())[::-1] <NEW_LINE> keep = [] <NEW_LINE> while len(order...
Non maximum suppression. Args: bboxes: (tensor) bounding boxes, sized [N,4]. scores: (tensor) bbox scores, sized [N,]. threshold: (float) overlap threshold. mode: (str) 'union' or 'min'. Returns: keep: (tensor) selected indices. Reference: https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/nms/...
625941ee21bff66bcd684e9e
def close(self) -> None: <NEW_LINE> <INDENT> for a_logger in self.loggers.values(): <NEW_LINE> <INDENT> a_logger.close()
At the end of the execution, closes the logger.
625941ee8a349b6b435e86c3
def compute_p_r_f1(gold_tuples, pred_tuples): <NEW_LINE> <INDENT> precision = float(len(gold_tuples & pred_tuples)) / len(pred_tuples) <NEW_LINE> recall = float(len(gold_tuples & pred_tuples)) / len(gold_tuples) <NEW_LINE> f1 = 2.0 * precision * recall / (precision + recall) <NEW_LINE> return precision, recall, f1
Compute Precision/Recall/F1 score for the predicted tuples. Parameters ---------- gold_tuples : set Set of gold-standard 4-tuples. pred_tuples : set Set of predicted 4-tuples. Returns ------- scores : tuple A 3-tuple containing (precision, recall, f1).
625941ee0c0af96317bb8739
def IsTransformPatternAvailable(self): <NEW_LINE> <INDENT> return _automationClient.dll.GetElementPattern(self.Element, PatternId.UIA_TransformPatternId) != 0
Return bool
625941ee4a966d76dd551566
def testTypedSort(self): <NEW_LINE> <INDENT> sort = Sort() <NEW_LINE> sort.setSort([SortField("int", SortField.INT), SortField.FIELD_DOC]) <NEW_LINE> self._assertMatches(self.full, self.queryX, sort, "IGAEC") <NEW_LINE> self._assertMatches(self.full, self.queryY, sort, "DHFJB") <NEW_LINE> sort.setSort([SortField("float...
test sorts where the type of field is specified
625941ee4e4d5625662d4921
def euclidean(start, goal): <NEW_LINE> <INDENT> return math.sqrt(((intersections[start][0] - intersections[goal][0]) ** 2) + ((intersections[start][1] - intersections[goal][1]) ** 2))
This function measures two things: 1- The distance from where we are to the next stop or how long its gonna take from where we are to the next stop. 2- An estimation distance of how long is gonna take from the next stop location(in front of us) to the final destination. Note: There are some other methods th...
625941ee30c21e258bdfa9f4
def style_check_1(self): <NEW_LINE> <INDENT> self.t_vm_id = []
This is public method for style check
625941ee2c8b7c6e89b35d0d
def __init__( self, *, pass_name: Optional[str] = None, component_name: Optional[str] = None, setting_name: Optional[Union[str, "SettingNames"]] = None, content: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(AdditionalUnattendContent, self).__init__(**kwargs) <NEW_LINE> self.pass_name = pass_name <NEW_LIN...
:keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. :paramtype pass_name: str :keyword component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup....
625941ee3eb6a72ae02eca3d
def _to_xml(self, xml, data, key=None): <NEW_LINE> <INDENT> if isinstance(data, (list, tuple)): <NEW_LINE> <INDENT> for item in data: <NEW_LINE> <INDENT> elemname = self._list_item_element_name(key) <NEW_LINE> xml.startElement(elemname, {}) <NEW_LINE> self._to_xml(xml, item) <NEW_LINE> xml.endElement(elemname) <NEW_LIN...
Recursively convert the data into xml. This function was originally copied from the `Piston project <https://bitbucket.org/jespern/django-piston/>`_ It has been modified since. :param xml: the xml document :type xml: SimplerXMLGenerator :param data: data to be formatted :param key: name of the parent element (for roo...
625941eea8ecb033257d361c
def batch_flatten(data): <NEW_LINE> <INDENT> return _make.batch_flatten(data)
BatchFlatten. This operator flattens all the dimensions except for the batch dimension. which results a 2D output. For data with shape ``(d1, d2, ..., dk)`` batch_flatten(data) returns reshaped output of shape ``(d1, d2*...*dk)``. Parameters ---------- data : tvm.relay.Expr The input data to the operator. Retu...
625941ee63b5f9789fde7637
def test_ipv4_to_int_invalid_out_of_range(self): <NEW_LINE> <INDENT> ip = '256.256.256.256' <NEW_LINE> self.assertRaises(Exception, ipv4_to_int, ip)
Verify IPv4 correctly raises exception for out of range IP
625941ee2c8b7c6e89b35d0e
def set_input_stream(self, input_stream): <NEW_LINE> <INDENT> self.input_stream = input_stream
Sets the input stream to read from when interacting with the user. This is mainly useful for testing purpose. @param input_stream: The input stream
625941ee8e7ae83300e4b520
def __init__(self, host='', useremail='', pwd='', debuglevel = 0): <NEW_LINE> <INDENT> self._host = host <NEW_LINE> self._user = useremail <NEW_LINE> self._pwd = pwd <NEW_LINE> self._debuglevel = 0
initialization of class, setting required properties. host : string, the smtp server url usermail : string, account to login host, email address of sender is ok pwd : password of login debuglevel : set the debug output level
625941ee4f6381625f114f8c
def retrieveall(self): <NEW_LINE> <INDENT> allmaterials = [] <NEW_LINE> self.dbcursor.execute('select * from materials order by name asc') <NEW_LINE> alldata = self.dbcursor.fetchall() <NEW_LINE> if alldata is not None: <NEW_LINE> <INDENT> for row in alldata: <NEW_LINE> <INDENT> allmaterials.append( Material.Material( ...
Retrieves all the materials currently in the database
625941eea17c0f6771cbe5a0
def over_limit(self, saddr): <NEW_LINE> <INDENT> if self.options["rate-limit"] < 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.deny_map[saddr]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> ret = False <NEW_LINE> ac_count = self.access_counts[saddr] or 0 <NEW_LINE> ac_count += 1 <NEW_LINE> self....
Check if the rate limit is over for a source address
625941eef9cc0f698b140b48
def package_switch_package_switch_uuid_delete(self, package_switch_uuid, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.package_switch_package_switch_uuid_delete_with_http_info(package_switch_uuid, **kwargs) <NEW_LINE> <DEDENT...
Deletes packageswitch This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.package_switch_package_switch_uuid_delete...
625941ee236d856c2ad44d33
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> report_subject = self._cook_report_subject() <NEW_LINE> url = server_settings.CIVICRM_REST_SERVER + server_settings.CIVICRM_REST_API_URL <NEW_LINE> civicrm = pythoncivicrm.CiviCRM(url, server_settings.CIVICRM_SITE_KEY, server_settings.CIVICRM_API_KEY, timeout=self.ci...
overriding save because we don't want to save stuff on the local machine rather to submit them to the civicrm server.
625941eebd1bec0571d90b80
def appendconeseq(self,_arg1_ct_,_arg2_conepar,_arg3_nummem,_arg4_j): <NEW_LINE> <INDENT> if not isinstance(_arg1_ct_,conetype): raise TypeError("Argument _arg1_ct has wrong type") <NEW_LINE> _arg1_ct = _arg1_ct_ <NEW_LINE> _arg2_conepar_ = _arg2_conepar <NEW_LINE> _arg3_nummem_ = _arg3_nummem <NEW_LINE> _arg4_j_ = _ar...
Appends a new conic constraint to the problem. appendconeseq(self,_arg1_ct_,_arg2_conepar,_arg3_nummem,_arg4_j) _arg1_ct: mosek.conetype. <no description> _arg2_conepar: double. <no description> _arg3_nummem: int. <no description> _arg4_j: int. Index of the first variable in the conic constraint.
625941ee99cbb53fe6793136
def contains_admin(ct): <NEW_LINE> <INDENT> pt = aes.cbc_decrypt(ct, KEY, IV) <NEW_LINE> return b";admin=true;" in pt
Returns whether the resulting plaintext contains an admin tuple (i.e ';admin=true;') :param ct: ciphertext :param key: decryption key :return: true if plaintext contains admin tuple; false otherwise
625941eebe7bc26dc91cdb47
def deassign_user_from_all_blog_posts(user_id): <NEW_LINE> <INDENT> blog_models.BlogPostRightsModel.deassign_user_from_all_blog_posts( user_id)
Removes the user from the list of editor_ids for all blog posts. Args: user_id: str. ID to be removed from editor_ids.
625941ee1f037a2d8b94674e
def test_animals_can_speak(self): <NEW_LINE> <INDENT> productoTests00000001 = Producto.objects.get( nombre="productoTests00000001") <NEW_LINE> productoTests00000002 = Producto.objects.get( nombre="productoTests00000002") <NEW_LINE> productoTests00000003 = Producto.objects.get( nombre="productoTests00000003") <NEW_LINE>...
Animals that can speak are correctly identified
625941ee3539df3088e2e89d
def write_telemetry(self, source_id, stream, timestamp, telemetry_datum, binary=False, **extra_headers): <NEW_LINE> <INDENT> for telemetry_protocol in self.telemetry_protocols: <NEW_LINE> <INDENT> telemetry_protocol.write_telemetry(source_id, stream, timestamp, telemetry_datum, binary=binary, **extra_headers)
Writes the provided telemetry datum to the registered telemetry protocols. This method passes the provided telemetry datum and headers to all registered telemetry protocols. It will be called by this session's associated pipeline and facilitates the sending of pipeline telemetry (state, additional data streams, etc.)...
625941ee091ae356686674a7
def intersection_update(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError()
Not implemented :raises: NotImplementedError
625941ee85dfad0860c3b3ae
def get_patient_idnum_value(self, which_idnum: int) -> Optional[int]: <NEW_LINE> <INDENT> idobj = self.get_patient_idnum_object(which_idnum=which_idnum) <NEW_LINE> return idobj.idnum_value if idobj else None
Get the patient's ID number value for the specified ID number type (``which_idnum``), or None.
625941ee76d4e153a657f085
def get_linear_velocity(self): <NEW_LINE> <INDENT> return utils.geom.Vec2(0, 0)
Returns the target linear velocity that the user is requesting the bot to do
625941ee656771135c3ebdc7
def test_construct(self, http_client, auth): <NEW_LINE> <INDENT> credentials_auth = pytan3.auth_methods.Credentials( http_client=http_client, **auth ) <NEW_LINE> api_client = pytan3.api_clients.Rest( http_client=http_client, auth_method=credentials_auth, ver_check=False ) <NEW_LINE> assert http_client.url in format(api...
Test init, str, repr, get_name, get_type, auth, url.
625941ee99fddb7c1c9de8e0
def test_manage_existing_snapshot_with_wrong_volume(self): <NEW_LINE> <INDENT> mock_db = mock.MagicMock() <NEW_LINE> mock_driver = mock.MagicMock() <NEW_LINE> real_size = 1 <NEW_LINE> manage_existing_ref = None <NEW_LINE> fake_snap = fake_snapshot.fake_snapshot_obj(self.ctxt, volume_size=real_size) <NEW_LINE> task = ma...
Test that raise an error when get_by_id fail.
625941ee379a373c97cfb099
@login_required <NEW_LINE> def add_book(request): <NEW_LINE> <INDENT> user_id = request.session.get('user_id', ) <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> book_form = BookForm(request.POST, request.FILES) <NEW_LINE> if book_form.is_valid(): <NEW_LINE> <INDENT> book_name = book_form.cleaned_data['book_...
添加书籍(管理员) :param request: 请求 :return:
625941eea8370b7717052def
def descargar_boletines(): <NEW_LINE> <INDENT> if not os.path.isfile(_TXT_BOLETINES_PATH): <NEW_LINE> <INDENT> print("No existe el archivo: {0}".format(_TXT_BOLETINES_PATH)) <NEW_LINE> print("Ejecute el metodo scrapear_url_boletines para obtener las url.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("Comenzando...
Descarga iterativamente todos los pdf de la pagina: - http://boletinoficial.cba.gov.ar/{year}/{month}/ Nota: - Utiliza los links obtenidos en el método scrapear_url_boletines
625941ee8c0ade5d55d3ef11
def on_click(self): <NEW_LINE> <INDENT> regions = self.textbox.text().split(" ") <NEW_LINE> self.main_window.add_regions( regions, self.alpha_textbox.text(), self.color_textbox.text() ) <NEW_LINE> self.close()
On click or 'Enter' get the regions from the input and call the add_regions method of the main window
625941ee23849d37ff7b35dd
def setFlowerAreaMask(self, region_matrix, mask, imsize): <NEW_LINE> <INDENT> if mask is not None: <NEW_LINE> <INDENT> assert isinstance(mask, np.ndarray), "Parameter 'mask' must be Numpy array" <NEW_LINE> assert mask.shape == imsize, "Mask has a different size" <NEW_LINE> <DEDENT> flower_region_matrix = region_matrix ...
Set mask of the flower area within the plot :param region_matrix = Region matrix representing the flower area :param mask: Mask of the flower area
625941ee5fcc89381b1e1c15
def get_column_articles(self, column): <NEW_LINE> <INDENT> archival_articles = ArchivalArticles.objects.filter(column=column) <NEW_LINE> result = self.none() <NEW_LINE> for a in archival_articles: <NEW_LINE> <INDENT> result = result | self.filter(id=a.article.id) <NEW_LINE> <DEDENT> return result
获取当前栏目下所有文章 :param column: 栏目 :return: query<Article>
625941ee7c178a314d6ef9ba
def slot_actionServers_status(self): <NEW_LINE> <INDENT> from linux_server_utility import linux_server_class <NEW_LINE> my_app = linux_server_class() <NEW_LINE> my_sub_window = self.mdiArea.addSubWindow(my_app) <NEW_LINE> my_icon = QtGui.QIcon() <NEW_LINE> my_icon.addPixmap(QtGui.QPixmap(":/icons/icons/console.gif"), Q...
Richiamo form di utilità sullo stato dei server linux
625941ee090684286d50f240
def convert(self, values, nan_rep, encoding): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> values = values[self.cname] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.set_data(values) <NEW_LINE> meta = _ensure_decoded(self.meta) <NEW_LINE> if self.dtype is not None: <NEW_LINE> <INDENT> dty...
set the data from this selection (and convert to the correct dtype if we can)
625941eedc8b845886cb5a89
def hlen(self, name, callback=None): <NEW_LINE> <INDENT> self._execute_command('HLEN', name, callback=callback)
Return the number of elements in hash ``name``
625941ee94891a1f4081bffe
def itkErodeObjectMorphologyImageFilterIUL2IUL2SE2_cast(*args): <NEW_LINE> <INDENT> return _itkErodeObjectMorphologyImageFilterPython.itkErodeObjectMorphologyImageFilterIUL2IUL2SE2_cast(*args)
itkErodeObjectMorphologyImageFilterIUL2IUL2SE2_cast(itkLightObject obj) -> itkErodeObjectMorphologyImageFilterIUL2IUL2SE2
625941ee090684286d50f241
def get_response(self, request: dict) -> dict: <NEW_LINE> <INDENT> super().get_response(request) <NEW_LINE> pbot = Plugin.get_class_from_fullyqualified( 'engines.python.bots.' + self.dotbot.chatbot_engine['bot_class'] + '.PythonBot') <NEW_LINE> pbot = pbot(self.config, self) <NEW_LINE> pbot.get_response(request) <NEW_L...
Return a response based on the input data. :param request: A dictionary with input data. :return: A response to the input data.
625941ee009cb60464c638ff
def answerOtherQuestion(self, queryInScheme): <NEW_LINE> <INDENT> start = datetime.datetime.now() <NEW_LINE> resultsData = scheme_eval_h(self.atomspace, queryInScheme) <NEW_LINE> delta = datetime.datetime.now() - start <NEW_LINE> self.logger.debug('The resultsData of pattern matching contains: ' '%s records, time: %s m...
Find answer for question with formula _det(A, B);_obj(C, D);_subj(C, A) :param queryInScheme: str query to pattern matcher or ure :return: Tuple[str, int, str] if answer was found Tuple[None, None, None] otherwise
625941ee097d151d1a2233a8
def defer(self, *args, **kwargs): <NEW_LINE> <INDENT> pass
Defers the loading of data for certain fields until they are accessed. The set of fields to defer is added to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case all deferrals are removed (None acts as a reset option).
625941ee1d351010ab85606d
def test_dict_like(self): <NEW_LINE> <INDENT> results = ResultMap() <NEW_LINE> results['1000'] = 'dir1000' <NEW_LINE> results['2000'] = 'dir2000' <NEW_LINE> results['1500'] = 'dir1500' <NEW_LINE> self.assertEqual(list(results.keys()), ['1000', '2000', '1500']) <NEW_LINE> self.assertEqual(list(results.values()), ['dir10...
Make sure the result map works like an ordered dictionary
625941ee32920d7e50b28727
def read_header(f): <NEW_LINE> <INDENT> block_size = np.fromfile(f, uint32, 1)[0] <NEW_LINE> if block_size == 256: <NEW_LINE> <INDENT> header = dict(((name, np.fromfile(f, dtype=size[0], count=size[1])) for name, size in zip(header_names, header_sizes))) <NEW_LINE> header['swap_endian'] = False <...
Read the binary GADGET header file into a dictionary
625941ee82261d6c526ab9fa
def hideMinibuffer (self): <NEW_LINE> <INDENT> frame = self <NEW_LINE> if frame.minibufferVisible: <NEW_LINE> <INDENT> frame.minibufferFrame.pack_forget() <NEW_LINE> frame.minibufferVisible = False
Hide the minibuffer.
625941ee7d43ff24873a31f7
def test_qty_delivered_with_bom(self): <NEW_LINE> <INDENT> self.env.ref('product.decimal_product_uom').digits = 5 <NEW_LINE> self.kit = self._create_product('Kit', 'product', 0.00) <NEW_LINE> self.comp = self._create_product('Component', 'product', 0.00) <NEW_LINE> bom_product_form = Form(self.env['mrp.bom']) <NEW_LINE...
Check the quantity delivered, when a bom line has a non integer quantity
625941ee5fdd1c0f98dc0788
def dispersion(self, k): <NEW_LINE> <INDENT> raise NotImplementedError
Takes wavevector k and returns the energy. Supports lists/arrays
625941ee283ffb24f3c55e4e
def testCatchExceptionsDoesNotInterfere(self): <NEW_LINE> <INDENT> SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, '1') <NEW_LINE> try: <NEW_LINE> <INDENT> self.RunAndVerify(env_var_value='1', flag_value='1', expect_seg_fault=1) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, None)
Google_tests that gtest_catch_exceptions doesn't interfere.
625941ee56b00c62f0f14baf