code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def stage_oblique_edges_UD(self): <NEW_LINE> <INDENT> for x in range(2): <NEW_LINE> <INDENT> original_state = self.state[:] <NEW_LINE> original_solution = self.solution[:] <NEW_LINE> original_solution_len = len(self.solution) <NEW_LINE> self.fake_move_UD_to_UFDB() <NEW_LINE> self.lt_UD_oblique_edge_stage.solve() <NEW_L... | The 7x7x7 uses this that is why it is in its own method. | 625941d06e29344779a62792 |
def test_set_method_invalid(): <NEW_LINE> <INDENT> s = Session() <NEW_LINE> with pytest.raises(ArgumentTypeErr) as exc: <NEW_LINE> <INDENT> s.set_method(sherpa.models.basic.Const1D) <NEW_LINE> <DEDENT> assert str(exc.value) == "'meth' must be a method name or object" | Errors out with invalid argument | 625941d066656f66f7cbc32b |
def cells_ext(h_lines, v_lines, start_r=0, start_c=0, end_r=0, end_c=0): <NEW_LINE> <INDENT> if end_r == end_c == 0: <NEW_LINE> <INDENT> end_c = len(v_lines) - 1 <NEW_LINE> end_r = len(h_lines) - 1 <NEW_LINE> <DEDENT> ret_cell = [] <NEW_LINE> for i in range(0, len(h_lines) - 1): <NEW_LINE> <INDENT> for j in range(0, le... | Extracts four corners of the cell from the horizontal and vertical lines POI
:param h_lines: r, theta form horizontal lines
:param v_lines: r, theta form vertical lines
:param start_r: starting row number
:param start_c: starting column number
:param end_r: ending row number
:param end_c: ending column number
:return: ... | 625941d063f4b57ef0001297 |
def compute_logits(self): <NEW_LINE> <INDENT> test_embeddings = tf.expand_dims(self.test_embeddings, 1) <NEW_LINE> prototypes = tf.expand_dims(self.prototypes, 0) <NEW_LINE> distances = tf.reduce_sum(tf.square(test_embeddings - prototypes), 2) <NEW_LINE> self.test_logits = -distances <NEW_LINE> return self.test_logits | Computes the negative distances of each test point to each prototype. | 625941d0009cb60464c63531 |
def gdl_loss(gen_frames, gt_frames): <NEW_LINE> <INDENT> scale_losses = [] <NEW_LINE> for i in xrange(len(gen_frames)): <NEW_LINE> <INDENT> pos = torch.from_numpy(np.identity(c.CHANNELS, dtype=np.float32)) <NEW_LINE> if c.CUDA: <NEW_LINE> <INDENT> pos = pos.cuda() <NEW_LINE> <DEDENT> neg = -1 * pos <NEW_LINE> filter_x ... | Calculates the sum of GDL losses between the predicted and ground truth frames.
@param gen_frames: The predicted frames at each scale.
@param gt_frames: The ground truth frames at each scale
@param alpha: The power to which each gradient term is raised.
@return: The GDL loss. | 625941d085dfad0860c3afdb |
def blitme(self): <NEW_LINE> <INDENT> self.screen.blit(self.image, self.rect) | Blit image | 625941d0dd821e528d63b329 |
def __init__(self, handler): <NEW_LINE> <INDENT> super(DebitlyFilter, self).__init__(handler) <NEW_LINE> self._bitly2url = { u'http://bit.ly/mDfYBE': u'http://www.haiti-liberte.com/archives/volume4-46/Les%20c%C3%A2bles%20de%20WikiLeaks%20sur%20Ha%C3%AFti%20publi%C3%A9s%20par%20Ha%C3%AFti%20Libert%C3%A9.asp' } | `handler`
The ICableHandler which should receive the (filtered) events. | 625941d0f548e778e58cd6fe |
def default(fn, parser_help_value): <NEW_LINE> <INDENT> @functools.wraps(fn) <NEW_LINE> def wrapper(): <NEW_LINE> <INDENT> return fn() <NEW_LINE> <DEDENT> wrapper.__clik_wtf__ = parser_help_value <NEW_LINE> return wrapper | Specify human-friendly labels for default value functions.
Consider the following (silly) form::
def my_default():
return datetime.date.today().strftime('%Y-%m-%d')
class MyForm(Form):
value = StringField(default=my_default)
clik-wtforms can't know the default value, so for help messages it ... | 625941d021a7993f00bc7e71 |
def xml_properties(self, data): <NEW_LINE> <INDENT> self.set_syntax('XML') <NEW_LINE> rows = '{n}'.join( "{i}<row " + ' '.join('{0}="{1}"'.format(head, value or "") for head, value in zip(self.headers, row)) + "></row>" for row in data ) <NEW_LINE> output = '<?xml version="1.0" encoding="UTF-8"?>{n}<rows>{n}' + rows + ... | XML properties converter | 625941d06fece00bbac2d8bf |
def draw_background(screen): <NEW_LINE> <INDENT> background = pygame.Rect((0, 0), (SCREEN_WIDTH, SCREEN_HEIGHT)) <NEW_LINE> pygame.draw.rect(screen, WHITE, background) | 게임의 배경을 그린다. | 625941d01f037a2d8b94637e |
def get_url(self): <NEW_LINE> <INDENT> return self.to_url(self) | Returns dabase URL
At this moment mostly used internaly in session | 625941d056b00c62f0f147da |
def six_hundred_cell(self, exact=False): <NEW_LINE> <INDENT> if exact: <NEW_LINE> <INDENT> from sage.rings.number_field.number_field import QuadraticField <NEW_LINE> K = QuadraticField(5, 'sqrt5') <NEW_LINE> sqrt5 = K.gen() <NEW_LINE> g = (1 + sqrt5) / 2 <NEW_LINE> base_ring = K <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN... | Return the standard 600-cell polytope.
The 600-cell is a 4-dimensional regular polytope. In many ways this is
an analogue of the icosahedron.
.. WARNING::
The coordinates are not exact by default. The computation with exact
coordinates takes a huge amount of time.
INPUT:
- ``exact`` - (boolean, default ``F... | 625941d0046cf37aa974cec7 |
def vdocksplit(*args, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('orientation', 'vertical') <NEW_LINE> split = docksplit(*args, **kwargs) <NEW_LINE> return split | A convenience function for creating a vertical docksplit.
| 625941d0a05bb46b383ec9a2 |
def setJobState(self, jobState): <NEW_LINE> <INDENT> self._jobState = jobState <NEW_LINE> for key in _jobStateKeys: <NEW_LINE> <INDENT> if key == 'mood': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> v = jobState.get(key) <NEW_LINE> if v != None: <NEW_LINE> <INDENT> self.set(key, v) <NEW_LINE> <DEDENT> <DEDENT> for ... | Set the job state I proxy from.
@type jobState: L{ManagerJobState} | 625941d0796e427e537b0747 |
@asyncio.coroutine <NEW_LINE> def update_external_systems(data): <NEW_LINE> <INDENT> json_data = json.dumps(data).encode('utf-8') <NEW_LINE> yield from enqueue(queue="search", data=bytes( json_data)) <NEW_LINE> yield from enqueue(queue="followers", data=bytes( json_data)) | Once a post is created enqueue to `search`, `followers` queue
| 625941d0379a373c97cfacc6 |
def __init__(self): <NEW_LINE> <INDENT> self.Result = None <NEW_LINE> self.RequestId = None | :param Result: 微服务分页列表信息
注意:此字段可能返回 null,表示取不到有效值。
:type Result: :class:`tencentcloud.tsf.v20180326.models.TsfPageMicroservice`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
| 625941d0711fe17d825424eb |
def kill(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.process.kill() <NEW_LINE> self.process.wait() <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass | Kill the process. | 625941d032920d7e50b28351 |
@cli.command() <NEW_LINE> @pass_process_cmd <NEW_LINE> def stacks(processcmd): <NEW_LINE> <INDENT> print(processcmd.ef._str_stacks()) | list stacks in experiment folder | 625941d0851cf427c661a68f |
def getSpecLines(self, spec): <NEW_LINE> <INDENT> stdout, stderr, rt = runCommand("rpmspec -D '%gocraftmeta(i) %{{expand:# comment}}' -D '%gometa(i) %{{expand:# comment}}' -P {}".format(spec)) <NEW_LINE> if rt != 0: <NEW_LINE> <INDENT> logging.error(stderr) <NEW_LINE> return [] <NEW_LINE> <DEDENT> return stdout.split('... | Get interpreted content of spec file | 625941d031939e2706e4cfea |
def attach_hooks(hooks): <NEW_LINE> <INDENT> def _deco(func): <NEW_LINE> <INDENT> def select_hooks(obj, kind): <NEW_LINE> <INDENT> phase = kind + func.__name__ <NEW_LINE> if phase not in hooks: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> return [h for h in hooks.get(phase, []) if h.__name__ not in getattr(obj, '_... | Attach pipeline hooks to phase ``name''.
This function returns a decorator for pipeline functions that will run the
registered hooks before and after the function.
If ``name'' is :class:`None`, both pre- and post-hooks will run, otherwise
only the hooks of the phase ``name'' will be executed. | 625941d038b623060ff0af6e |
def input(self,row,value): <NEW_LINE> <INDENT> element = self.get_element_local.get_local_path(row) <NEW_LINE> if element == None: <NEW_LINE> <INDENT> return logging.info('元素没找到') <NEW_LINE> <DEDENT> element.send_keys(value) <NEW_LINE> logging.info('输入'+ value) | 封装操作动作s | 625941d04f6381625f114bbb |
def number(self, item): <NEW_LINE> <INDENT> idx = self.known.get(item) <NEW_LINE> if idx is None: <NEW_LINE> <INDENT> if self.add: <NEW_LINE> <INDENT> self.current += 1 <NEW_LINE> self.items.append(item) <NEW_LINE> self.known[item] = self.current <NEW_LINE> return self.current <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE... | Get index for item provided.
Parameters
----------
item hashable
item to index | 625941d0c432627299f04dc7 |
def test_get_id_from_url(self): <NEW_LINE> <INDENT> urls = [ 'http://www.youtube.com/user/dreamtheater#p/u/1/oTJRivZTMLs', 'https://youtu.be/oTJRivZTMLs?list=PLToa5JuFMsXTNkrLJbRlB--76IAOjRM9b', 'http://www.youtube.com/watch?v=oTJRivZTMLs&feature=youtu.be', 'https://youtu.be/oTJRivZTMLs', 'http://youtu.be/oTJRivZTMLs&f... | Test VideoIDDialog.get_id_from_url function | 625941d026068e7796caee61 |
def get_trusted_time_verify_result(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> content = self.find_elem_text(self.trusted_time_verify_result_loc) <NEW_LINE> time.sleep(1) <NEW_LINE> return content <NEW_LINE> <DEDENT> except Exception as msg: <NEW_LINE> <INDENT> return "异常原因%s" % msg | 获取可信时间验证结果
:return:异常原因 | 625941d0cc40096d61595ad1 |
def reset(self): <NEW_LINE> <INDENT> self.epsilons = np.linspace(start=self.start_value, stop=self.end_value, num=self.num_steps) | Start the decay over at the start value. | 625941d15f7d997b87174c19 |
def test_vmf_to_articulation_004(self): <NEW_LINE> <INDENT> assert type(ArticulationConverter.vmf_to_articulation(6)) == Accent | Tests the VMF to Articulation conversion for accent articulation. | 625941d0283ffb24f3c55a81 |
def parse_email_content(email_msg): <NEW_LINE> <INDENT> return BeautifulSoup(email_msg.get_payload()) | Takes an email.message.Message and returns a BeautifulSoup object containing its payload. | 625941d04f6381625f114bbc |
def _on_previous_track_click(self): <NEW_LINE> <INDENT> logger.debug(f"State: {self.player_state}") <NEW_LINE> return self.player_state.on_previous_track_click(self) | Callback for clicking previous button. | 625941d055399d3f05588836 |
def _handle_user(self, request, method, mode='login'): <NEW_LINE> <INDENT> user = request.environ['ao.social.user'] <NEW_LINE> session = request.environ['beaker.session'] <NEW_LINE> if 'postlogin' in request.GET: <NEW_LINE> <INDENT> session['postlogin'] = request.GET['postlogin'] <NEW_LINE> session.save() <NEW_LINE> <D... | Handles authentication for the user.
If `mode` is set to 'connect', it will assume that a user is already
logged in and connects the new account to the logged in user.
Otherwise, simply logs in the user. | 625941d1dc8b845886cb56b6 |
def _initialise(self): <NEW_LINE> <INDENT> self.noise_vector = placeholder_node(self.extend_name('noise'), [self.noise_dimension], dynamic_dimensions=1) <NEW_LINE> self.real_input = placeholder_node(self.extend_name('real_input'), [self.latent_dimension], dynamic_dimensions=1) <NEW_LINE> if type(self.generator_builder)... | () -> () | 625941d1b545ff76a8913f96 |
def app_constraints(self, field, operator, value=None): <NEW_LINE> <INDENT> return MarathonConstraint(field=field, operator=operator, value=value) | Constraints control where apps run. It is to allow optimizing for either fault tolerance (by spreading a task
out on multiple nodes) or locality (by running all of an application tasks on the same node). Constraints have
three parts
@args:
field: Field can be the hostname of the agent node or any attribute of the agent... | 625941d0009cb60464c63532 |
def save(self, filename = None): <NEW_LINE> <INDENT> if filename is None: filename = self.filename <NEW_LINE> if filename is None: raise Exception("No filename specified") <NEW_LINE> temp_fh = self.copy() <NEW_LINE> temp_fh.data = self._encode_to_JSON(temp_fh.data) <NEW_LINE> temp_fh.headers = self._encode_to_JSON(temp... | Saves the File_Handler Hiar_Storage structures in file <filename>.
If <filename> is not specified uses the default Handlers filename.
If the default filename is also not specified, raises an Exception. | 625941d107d97122c4178a0e |
def getXLabelPropsFromAxes(self): <NEW_LINE> <INDENT> self.xLabel['Text'] = self.axes.get_xaxis().get_label_text() <NEW_LINE> self.xLabel['Show Label'] = self.axes.get_xaxis().get_label_position() <NEW_LINE> if not self.axes.get_xaxis().get_label().get_visible(): <NEW_LINE> <INDENT> self.xLabel['Show Label'] = 'none' <... | Get X-label properties from the axes instant
| 625941d1498bea3a759b9c30 |
def onModuleDiscovered(self, module): <NEW_LINE> <INDENT> if module.getFullName().hasNamespace("tensorflow"): <NEW_LINE> <INDENT> self.warnUnusedPlugin("tensorflow support.") | This method checks whether a tensorflow module is imported.
Notes:
For this we check whether its full name contains the string "tensorflow".
Args:
module: the module object
Returns:
None | 625941d150485f2cf553cf1b |
def set_AncestorFolderIDs(self, value): <NEW_LINE> <INDENT> super(QueryInputSet, self)._set_input('AncestorFolderIDs', value) | Set the value of the AncestorFolderIDs input for this Choreo. ((optional, string) A comma-seperated list of folder IDs which are used to filter your search.) | 625941d1b545ff76a8913f97 |
def get_index(shape, position): <NEW_LINE> <INDENT> shape2=list() <NEW_LINE> for i in range(len(shape)): <NEW_LINE> <INDENT> shape2.append(0) <NEW_LINE> <DEDENT> shape3=get_increment(shape) <NEW_LINE> if shape3[0]>position: <NEW_LINE> <INDENT> shape2[0]=0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> shape2[0]=divmod(p... | Return the index in the multidimensional array that is corresponds to the
element in the given position in the linear ordered.
Parameters
----------
shape : tuple
The shape of the input array
position : int
The position in the linear ordering
Returns
-------
index : tuple (same number of elements as shape)
... | 625941d171ff763f4b54980d |
def setupVifibMachineAuthenticationPlugin(self): <NEW_LINE> <INDENT> pas = self.getPortal().acl_users <NEW_LINE> vifib_auth_list = [q for q in pas.objectValues() if q.meta_type == 'Vifib Machine Authentication Plugin'] <NEW_LINE> if len(vifib_auth_list) == 0: <NEW_LINE> <INDENT> vifib_dispacher = pas.manage_addP... | Sets up Vifib Authentication plugin | 625941d124f1403a92600ce6 |
def intToRoman(self, num): <NEW_LINE> <INDENT> m = Solution.intMap <NEW_LINE> r = '' <NEW_LINE> for n in sorted(m.keys(), reverse=True): <NEW_LINE> <INDENT> r += m[n] * (num//n) <NEW_LINE> num %= n <NEW_LINE> <DEDENT> return r | :type num: int
:rtype: str | 625941d1b830903b967e9a8c |
def refactor_v2_container_spec(container_spec: PipelineContainerSpec) -> None: <NEW_LINE> <INDENT> if not '--function_name' in container_spec.args: <NEW_LINE> <INDENT> raise RuntimeError( 'V2 component is expected to have function_name as a ' 'command line arg.') <NEW_LINE> <DEDENT> fn_name_idx = list(container_spec.ar... | Refactor the container spec for a v2 component. | 625941d1187af65679ca52a0 |
def getUnreadMessagesNumber(self): <NEW_LINE> <INDENT> unreadLabelInfo = self.service.users().labels().get(userId='me', id='UNREAD').execute() <NEW_LINE> return unreadLabelInfo["messagesUnread"] | Returns the number of unread messages
return: The number of unread messages | 625941d115fb5d323cde0c92 |
def get_last_update(db: DB, group_id: int) -> ty.Optional[datetime]: <NEW_LINE> <INDENT> with db.cursor() as cur: <NEW_LINE> <INDENT> cur.execute( "SELECT max(datetime(coalesce(updated, created))) " "FROM entries " "WHERE source_id IN (SELECT id FROM sources WHERE group_id= %s)", (group_id,), ) <NEW_LINE> row = cur.fet... | Find last update time for entries in group | 625941d1cdde0d52a9e531b5 |
def convert_kernel(kernel): <NEW_LINE> <INDENT> kernel = np.asarray(kernel) <NEW_LINE> if not 3 <= kernel.ndim <= 5: <NEW_LINE> <INDENT> raise ValueError('Invalid kernel shape:', kernel.shape) <NEW_LINE> <DEDENT> slices = [slice(None, None, -1) for _ in range(kernel.ndim)] <NEW_LINE> no_flip = (slice(None, None), slice... | Converts a Numpy kernel matrix from Theano format to TensorFlow format.
Also works reciprocally, since the transformation is its own inverse.
# Arguments
kernel: Numpy array (3D, 4D or 5D).
# Returns
The converted kernel.
# Raises
ValueError: in case of invalid kernel shape or invalid data_format. | 625941d171ff763f4b54980e |
def DescribeGameServerSessions(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("DescribeGameServerSessions", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Describ... | This API is used to query the list of game server sessions.
:param request: Request instance for DescribeGameServerSessions.
:type request: :class:`tencentcloud.gse.v20191112.models.DescribeGameServerSessionsRequest`
:rtype: :class:`tencentcloud.gse.v20191112.models.DescribeGameServerSessionsResponse` | 625941d19c8ee82313fbb8f7 |
def bajaCli(dni): <NEW_LINE> <INDENT> query = QtSql.QSqlQuery() <NEW_LINE> query.prepare('delete from clientes where dni = :dni') <NEW_LINE> query.bindValue(':dni', dni) <NEW_LINE> if query.exec_(): <NEW_LINE> <INDENT> print('Baja cliente') <NEW_LINE> var.ui.lblstatus.setText('Cliente con dni ' + dni + ' dado de baja')... | '
Modulo para eliminar cliente. se llama desde fichero clientes.py
:param dni
:type: string
:return None
:rtype None | 625941d15fdd1c0f98dc03b5 |
def test_init(self): <NEW_LINE> <INDENT> p = cssutils.css.property.Property('top', '1px') <NEW_LINE> self.assertEqual('top: 1px', p.cssText) <NEW_LINE> self.assertEqual('top', p.literalname) <NEW_LINE> self.assertEqual('top', p.name) <NEW_LINE> self.assertEqual('1px', p.value) <NEW_LINE> self.assertEqual('1px', p.prope... | Property.__init__() | 625941d1097d151d1a222fdb |
def vgg_16(inputs, num_classes=1000, is_training=True, dropout_keep_prob=0.5, spatial_squeeze=True, scope='vgg_16'): <NEW_LINE> <INDENT> saved_activations = [] <NEW_LINE> with variable_scope.variable_scope(scope, 'vgg_16', [inputs]) as sc: <NEW_LINE> <INDENT> end_points_collection = sc.original_name_scope + '_end_point... | Oxford Net VGG 16-Layers version D Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes.
is_training: whethe... | 625941d18c3a87329515853d |
def _recalculate_block_properties(self): <NEW_LINE> <INDENT> self.w = [[self._block_weight(i, j) for j in self.groups()] for i in self.groups()] <NEW_LINE> self.P = [[self._block_density(i, j) for j in self.groups()] for i in self.groups()] | This method has to be called every time the adjacency matrix changes, otherwise the cached
properties will return invalid values for block_density and block_weight
Block properties = weight w(D_i,j), density P_i,j | 625941d101c39578d7e74fbd |
def svl_to_sql_number(svl_plot): <NEW_LINE> <INDENT> if "agg" not in svl_plot["value"]: <NEW_LINE> <INDENT> query = "SELECT {} AS value FROM {}".format( _get_field(svl_plot["value"]), svl_plot["data"] ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> query = "SELECT {}({}) AS value FROM {}".format( svl_plot["value"]["agg... | Constructs a SQL query for number charts.
Parameters
----------
svl_plot : dict
The SVL plot definition.
Returns
-------
str
The SQL query for the dataset required for the plot. | 625941d156b00c62f0f147db |
def get_primary_image(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tag = mutagen.id3.ID3(self["~filename"]) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> cover = None <NEW_LINE> for frame in tag.getall("APIC"): <NEW_LINE> <INDENT> cover = cover or frame <NEW_LINE> if frame.... | Returns the primary embedded image | 625941d1236d856c2ad4495d |
def numStr(self, format='#.##'): <NEW_LINE> <INDENT> formMain, formExp = _doubleSplit('eE', format) <NEW_LINE> if not formExp: <NEW_LINE> <INDENT> return self.basicNumStr(format) <NEW_LINE> <DEDENT> exp = math.floor(math.log10(abs(self.num))) <NEW_LINE> num = float(self.num) / 10**exp <NEW_LINE> totPlcs = len(re.findal... | Returns string in given format, including exponents, e=exponent,
#=optional digit, 0=required digit, -=optional sign, +=required sign
space=digit or space (external) or thousands sep (internal),
\, and \. are thousands separators | 625941d1aad79263cf390bc3 |
def get_postData(Jsparams): <NEW_LINE> <INDENT> postdata = {} <NEW_LINE> params = json.loads(Jsparams) <NEW_LINE> postdata["encrypt"] = 0 <NEW_LINE> postdata["product"] = "share" <NEW_LINE> postdata["uk"] = str(params.get("uk")) <NEW_LINE> postdata["primaryid"] = str(params.get("shareid")) <NEW_LINE> postdata["fid_list... | 拼接请求百度网盘真实下载地址post的请求参数 | 625941d130dc7b7665901ae7 |
def removeDummyRootType(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> del self[dummyRootTypeName] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass | Remove the temporary dummy root format if present.
| 625941d1d18da76e23532658 |
def forward_translate_dna_firstframe(dna_sequence, stop_before_stop=False): <NEW_LINE> <INDENT> result = "" <NEW_LINE> pos = 0 <NEW_LINE> while pos <= len(dna_sequence) - 3: <NEW_LINE> <INDENT> aa = CODON_TABLE[dna_sequence[pos:pos + 3]] <NEW_LINE> if stop_before_stop and aa == '*': <NEW_LINE> <INDENT> break <NEW_LINE>... | forward-translate the DNA sequence in Frame 1.
If stop_before_stop, end with the last AA before the first in-frame stop codon
:param dna_sequence:
:param stop_before_stop:
:return: | 625941d13d592f4c4ed1d1ee |
def _fetch_rss_feed(self): <NEW_LINE> <INDENT> r = requests.get(self.rss_url) <NEW_LINE> return r.content | Fetches the RSS XML from the webserver | 625941d14e4d5625662d4558 |
def update_auto_size(self, new_size): <NEW_LINE> <INDENT> self.size = (self.border[0] + new_size[0], self.border[1] + new_size[1]) | Updates the size given new texture size
:param new_size: The new texture size | 625941d182261d6c526ab622 |
def query_string(self): <NEW_LINE> <INDENT> self._check_headers_complete() <NEW_LINE> return self.parser.get_query_string() | get query string of the url | 625941d10fa83653e465713c |
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.')) <NEW_LINE> def do_suspend(cs, args): <NEW_LINE> <INDENT> _find_server(cs, args.server).suspend() | Suspend a server. | 625941d1fbf16365ca6f6348 |
def cmp_noun_list(data): <NEW_LINE> <INDENT> savetxt_list=[] <NEW_LINE> mecab = MeCab.Tagger("-Ochasen") <NEW_LINE> data = data.replace("<", "<") <NEW_LINE> data = data.replace(">", ">") <NEW_LINE> cmp_nouns = mecab.parse(data) <NEW_LINE> every_row = cmp_nouns.split('\n') <NEW_LINE> save_word_list = [] <NEW_LINE>... | 和文テキストを受け取り、複合語(空白区切りの単名詞)のリストを返す | 625941d14c3428357757c4a9 |
@skip_if_no_nornir <NEW_LINE> def test_xml_xpath_elem_by_value(): <NEW_LINE> <INDENT> nr_with_dp = nr.with_processors([DataProcessor([ {"fun": "xpath", "expr": '//a:config/a:address[text()="1.1.1.11"]', "namespaces": {"a": "http://openconfig.net/yang/system"}} ])]) <NEW_LINE> output = nr_with_dp.run( task=nr_test, ret_... | results are XML filtered using XPATH | 625941d1e5267d203edcde1e |
def get_bottleneck_path(image_lists, label_name, index, bottleneck_dir, category, module_name): <NEW_LINE> <INDENT> module_name = (module_name.replace('://', '~') .replace('/', '~') .replace(':', '~').replace('\\', '~')) <NEW_LINE> return get_image_path(image_lists, label_name, index, bottleneck_dir, category) + '_' + ... | Returns a path to a bottleneck file for a label at the given index.
Args:
image_lists: OrderedDict of training images for each label.
label_name: Label string we want to get an image for.
index: Integer offset of the image we want. This will be moduloed by the
available number of images for the label, so it can... | 625941d10a366e3fb873e99c |
def p_typedargslist_times4_comma(self, p): <NEW_LINE> <INDENT> p0 = ast.arguments( posonlyargs=[], args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=p[2], defaults=[], ) <NEW_LINE> p[0] = p0 | typedargslist : TIMES comma_pow_tfpdef | 625941d1462c4b4f79d1d853 |
def hexDisplay(self, address, length): <NEW_LINE> <INDENT> raise NotImplementedError("Pure function call") | Display hex dump | 625941d13346ee7daa2b2eee |
def get_inherit_image(self) -> Tuple[str, str]: <NEW_LINE> <INDENT> name, tag = str(self.inherit_image).split(":") <NEW_LINE> if self.image_exists(name, tag): <NEW_LINE> <INDENT> return name, tag <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.client.images.pull(name, tag) <NEW_LINE> <DEDENT> except docker.errors.API... | Parses the ``inherit_image`` setting, checks if the image is present locally and pulls it otherwise.
:return: Returns the name and the tag of the image.
:raise ArcaMisconfiguration: If the image can't be pulled from registries. | 625941d18da39b475bd650f7 |
def _indices(self, x): <NEW_LINE> <INDENT> for i in x: <NEW_LINE> <INDENT> yield i <NEW_LINE> <DEDENT> if self.interaction: <NEW_LINE> <INDENT> D = self.D <NEW_LINE> L = len(x) <NEW_LINE> for i in xrange(1, L): <NEW_LINE> <INDENT> for j in xrange(i+1, L): <NEW_LINE> <INDENT> yield (i * j) % D | A helper generator that yields the indices in x
The purpose of this generator is to make the following
code a bit cleaner when doing feature interaction. | 625941d126238365f5f0eff1 |
def gen_rand_dist_hosts(self, no_switches, number_of_hosts): <NEW_LINE> <INDENT> switches_hosts = [] <NEW_LINE> for i in range(0, no_switches): <NEW_LINE> <INDENT> switches_hosts.append(random.randint(0, number_of_hosts)) <NEW_LINE> <DEDENT> self.logger.debug("Number of hosts " + str(number_of_hosts)) <NEW_LINE> self.l... | Generate randomly distributed hosts.
:param no_switches:
:param number_of_hosts:
:return: | 625941d1d6c5a102081441cd |
def annulla(self, bot, update, user_data, msg=""): <NEW_LINE> <INDENT> if msg: <NEW_LINE> <INDENT> update.message.reply_text(msg, reply_markup=ReplyKeyboardRemove()) <NEW_LINE> <DEDENT> if "quantita" in user_data.keys(): <NEW_LINE> <INDENT> user_data['quantita'] = [] <NEW_LINE> <DEDENT> if "zaino" in user_data.keys(): ... | Annulla la conversazione e inizzializza lo user data | 625941d1a79ad161976cc2c7 |
def handle(self, data): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> user_path = data['user_path'].replace(data['user_dir'], '') <NEW_LINE> choice = input("[%s@%s]$" %(data['user'], user_path)).strip().split() <NEW_LINE> if not choice:continue <NEW_LINE> data['choice'] = choice <NEW_LINE> if hasattr(self, '_%s' ... | 解析指令并交给具体的方法处理 | 625941d1baa26c4b54cb12a1 |
def _fill_attr_entry(self, stat): <NEW_LINE> <INDENT> entry = llfuse.EntryAttributes() <NEW_LINE> for attr in ('st_ino', 'st_mode', 'st_nlink', 'st_uid', 'st_gid', 'st_rdev', 'st_size', 'st_atime_ns', 'st_mtime_ns', 'st_ctime_ns'): <NEW_LINE> <INDENT> setattr(entry, attr, getattr(stat, attr)) <NEW_LINE> <DEDENT> entry.... | fill in a llfuseEntryAttributes- object from the stat
and some default attributed | 625941d1d6c5a102081441ce |
def test_follow_link_excess(httpbin): <NEW_LINE> <INDENT> browser = mechanicalsoup.StatefulBrowser() <NEW_LINE> html = '<a href="/foo">Bar</a><a href="/get">Link</a>' <NEW_LINE> browser.open_fake_page(html, httpbin.url) <NEW_LINE> browser.follow_link(url_regex='get') <NEW_LINE> assert browser.url == httpbin + '/get' <N... | Ensure that excess args are passed to BeautifulSoup | 625941d1bde94217f3682f72 |
def test_find_users(self): <NEW_LINE> <INDENT> pass | Test case for find_users
Returns users matching the given search criteria # noqa: E501 | 625941d12ae34c7f2600d2b3 |
def emphHold(img, xc, yc, color=colormap['black'] , width=4): <NEW_LINE> <INDENT> x,y = X[xc],Y[yc] <NEW_LINE> draw = ImageDraw.Draw(img) <NEW_LINE> for i in range(width): <NEW_LINE> <INDENT> draw.rectangle([x - DX / 2 + i, y - DY / 2 + i, x + DX / 2 - i, y + DY / 2 - i], outline=color) <NEW_LINE> <DEDENT> return img | draw rectagle around hold position | 625941d1a219f33f34628aeb |
def save_csv(self,csv_name = 'landmark'): <NEW_LINE> <INDENT> name = str(csv_name) + '.csv' <NEW_LINE> self.landmark.to_csv(name,index= False) | this method save self.landmark as csv_name.csv files
or
csv_name if none , it save as landmark.csv files | 625941d18a349b6b435e82f6 |
def __init__(self, start, end): <NEW_LINE> <INDENT> if start > end: <NEW_LINE> <INDENT> start, end = end, start <NEW_LINE> <DEDENT> self.start = start <NEW_LINE> self.end = end | `start` and `end` are datetime.date objects, both are required.
For creating a DateRange object for an exact date (like if exact
date-of-birth is known) just pass the same value for `start` and `end`. | 625941d19f2886367277aa0f |
def __contains__(self, key): <NEW_LINE> <INDENT> return ( key in ["type", "id", "video_file_id", "title", "description", "caption", "parse_mode", "caption_entities", "reply_markup", "input_message_content"] and hasattr(self, key) and bool(getattr(self, key, None)) ) | Implements `"key" in inlinequeryresultcachedvideo_instance` | 625941d13539df3088e2e4cd |
def _attach_volume(self, context, volume, connector): <NEW_LINE> <INDENT> iscsi_properties = None <NEW_LINE> host_device = None <NEW_LINE> init_conn = self.initialize_connection(volume, connector) <NEW_LINE> iscsi_properties = init_conn['data'] <NEW_LINE> iscsi = initiator.ISCSIConnector() <NEW_LINE> conf = iscsi.conne... | Attach the volume. | 625941d1d8ef3951e32436bf |
def test_expansion(utility, index, stored, expanded): <NEW_LINE> <INDENT> self.assertEqual(get_action_url(utility, index), stored) <NEW_LINE> expanded_utility = expand_utility_action_url(self.course, utility) <NEW_LINE> self.assertEqual(get_action_url(expanded_utility, index), expanded) <NEW_LINE> self.assertEqual(get_... | Tests that the expected expanded value is returned for the item at the given index.
Also verifies that the original utility is not modified. | 625941d129b78933be1e582d |
def make_minimal_tables(): <NEW_LINE> <INDENT> tables = tskit.TableCollection(1) <NEW_LINE> tables.nodes.add_row(flags=tskit.NODE_IS_SAMPLE, time=0, population=0) <NEW_LINE> tables.nodes.add_row(flags=tskit.NODE_IS_SAMPLE, time=0, population=0) <NEW_LINE> tables.populations.add_row() <NEW_LINE> ll_tables = _msprime.Lig... | Returns the simplest set of tables we can run a simulation from | 625941d166656f66f7cbc32d |
def get_html(url): <NEW_LINE> <INDENT> r = requests.get(url, headers=headers) <NEW_LINE> return r.text | Get method of request on site | 625941d1e76e3b2f99f3a98c |
def getWidth(self): <NEW_LINE> <INDENT> return int(self.width.get()) | Returns Width from user
| 625941d1b7558d58953c5095 |
def test_publish_cmd_blacklisted(self): <NEW_LINE> <INDENT> mock_ret = {'error': {'name': 'AuthorizationError', 'message': 'Authorization error occurred.'}} <NEW_LINE> with patch('salt.acl.PublisherACL.user_is_blacklisted', MagicMock(return_value=False)), patch('salt.acl.PublisherACL.cmd_is_blacklisted',... | Asserts that an AuthorizationError is returned when the command has been blacklisted. | 625941d18c0ade5d55d3eb3e |
def to_newick(self): <NEW_LINE> <INDENT> if self.rooted: <NEW_LINE> <INDENT> return self._rooted_to_newick() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.rooted_at(self.internal_root())._rooted_to_newick() | Returns a Newick string such that the order of the subtrees is
increasing in terms of the minimum of the leaf labels. | 625941d1d486a94d0b98e2c8 |
def isValidBST(self, root): <NEW_LINE> <INDENT> if not root: return True <NEW_LINE> self.inorder(root) <NEW_LINE> if self.res: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | :type root: TreeNode
:rtype: bool | 625941d1dd821e528d63b32b |
def get_series_info(itemUserId, item): <NEW_LINE> <INDENT> if item['Type'] == 'Episode': <NEW_LINE> <INDENT> season = get_item(itemUserId, item['SeasonId'])['Name'] <NEW_LINE> series = get_item(itemUserId, item['SeriesId'])['Name'] <NEW_LINE> LOGGER.info('%s: "%s" "%s" "%s"', item['Type'], series, season, item['Name'])... | get series info | 625941d191f36d47f21ac675 |
def _prepare_episode(self): <NEW_LINE> <INDENT> self.last_state = self.pool.map(env_do_reset, self.env) <NEW_LINE> self.episode_score = 0 <NEW_LINE> self.episode += 1 | Does everything to prepare the episode internally and externally | 625941d1f548e778e58cd700 |
def generate_swaps(self): <NEW_LINE> <INDENT> for i in range(self.size // 2, -1, -1): <NEW_LINE> <INDENT> self.sift_down(i) | Heapify procedure.
It calls sift down procedure 'size // 2' times. It's enough to make
the heap completed. | 625941d16fece00bbac2d8c1 |
def __init__(self, assessment_result_path, copied_module_set_path): <NEW_LINE> <INDENT> self.assessment_result_path = assessment_result_path <NEW_LINE> self.copied_module_set_path = copied_module_set_path <NEW_LINE> self.paths_to_all_modules = self.get_module_dirs() <NEW_LINE> self.solution_texts = {} | assessment_result_path .. path to the directory where all results of
the assessment are stored
copied_module_set_path .. path to the module set directory copied for
the assessment to the assessment_result_path | 625941d1a05bb46b383ec9a4 |
def organization_activity_list( group_id: str, limit: int, offset: int, include_hidden_activity: bool = False) -> list[Activity]: <NEW_LINE> <INDENT> q = _organization_activity_query(group_id, include_hidden_activity) <NEW_LINE> return _activities_at_offset(q, limit, offset) | Return the given org's public activity stream.
Returns activities where the given org or one of its datasets is the
object of the activity, e.g.:
"{USER} updated the organization {ORG}"
"{USER} updated the dataset {DATASET}"
etc. | 625941d131939e2706e4cfec |
def __register_service(self): <NEW_LINE> <INDENT> svc = ServiceRegistrationInfo(self.dxlc, self.__config.service_type) <NEW_LINE> for endpoint in self.__endpoints: <NEW_LINE> <INDENT> topic = self.__config.service_type + '/' + endpoint.name <NEW_LINE> svc.add_topic(topic, Dispatcher(endpoint, self, self.__register_moni... | Create dispatchers for each endpoint provided by the GRR API and register the service with the OpenDXL service
fabric
:return: None | 625941d1460517430c394306 |
def import_transactions(self, block): <NEW_LINE> <INDENT> for node in block.trans_tree.walk(block.trans_tree.root): <NEW_LINE> <INDENT> if type(node._data) == Transaction: <NEW_LINE> <INDENT> if self.add_transaction(node._data) == False: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return True | Insert all the transactions in the given block to this transaction pool.
Returns True if successful.
Note that if this returns False, then only some of the transactions
may have been added to this transaction pool. | 625941d166673b3332b92214 |
def test_Version_with_bad_delimiter(self): <NEW_LINE> <INDENT> self.assertRaises(versions.InvalidVersionStringFormat, versions.Version, '2-6-0', package='tor') | Test parsing a version number which uses '-' as a delimiter. | 625941d14d74a7450ccd4346 |
def _parallel_entropy_estimate(X, y, train_mask, pool_mask, classifier, classes, n_classes, probs, i, index): <NEW_LINE> <INDENT> potential_entropy = np.zeros(n_classes) <NEW_LINE> train_mask[index] = True <NEW_LINE> for cls_idx, cls in enumerate(classes): <NEW_LINE> <INDENT> y[index] = cls <NEW_LINE> classifier.fit(X[... | Helper function. | 625941d1bde94217f3682f73 |
def list_resource_history( project_id, location, dataset_id, fhir_store_id, resource_type, resource_id, ): <NEW_LINE> <INDENT> import os <NEW_LINE> from google.auth.transport import requests <NEW_LINE> from google.oauth2 import service_account <NEW_LINE> credentials = service_account.Credentials.from_service_account_fi... | Gets the history of a resource.
See https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/healthcare/api-client/v1/fhir
before running the sample. | 625941d196565a6dacc8f84e |
def delete_network_postcommit(self, context): <NEW_LINE> <INDENT> pass | Delete a network.
:param context: NetworkContext instance describing the current
state of the network, prior to the call to delete it.
Called after the transaction commits. Call can block, though
will block the entire process so care should be taken to not
drastically affect performance. Runtime errors are not
expect... | 625941d1ab23a570cc250305 |
def Insert(self, index, Element): <NEW_LINE> <INDENT> return super(IVarStringArray, self).Insert(index, Element) | Method IVarStringArray.Insert
INPUTS
index : long
Element : BSTR | 625941d1442bda511e8be59a |
def setLongitude(self, longitude_dg): <NEW_LINE> <INDENT> longitude = int(round((longitude_dg * 10), 0)) <NEW_LINE> if not -1800 <= longitude <= 1800: <NEW_LINE> <INDENT> raise weewx.ViolatedPrecondition("vantage: Invalid longitude %.1f degree" % (longitude_dg,)) <NEW_LINE> <DEDENT> self.port.send_data(b"EEBWR 0D 02\n"... | Set the stations longitude.
longitude_dg: Must be in the closed range -180.0...180.0 | 625941d1c432627299f04dc9 |
def __init__(self, size, const=False): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.const = const <NEW_LINE> self._bool = False <NEW_LINE> self._orig = self | Initialize type. | 625941d116aa5153ce3625fa |
def random_list_generator(list_length: int) -> list: <NEW_LINE> <INDENT> return [randint(0, 1000) for i in range(list_length)] | Returns a random list | 625941d17d43ff24873a2e23 |
def _compute_inverse_map_to_self(self): <NEW_LINE> <INDENT> return self.reference_vertices | Compute the inverse map from the canonical reference to this reference. | 625941d17047854f462a158c |
def mutate_wubi(char, wubi=None): <NEW_LINE> <INDENT> return 1 | 使用五笔规则mutate char | 625941d14428ac0f6e5ba975 |
def __repr__(self): <NEW_LINE> <INDENT> return self.raw | Return the text from the FSSP SUMMARY section. | 625941d1b830903b967e9a8d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.