code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def eval_grad(self, w): <NEW_LINE> <INDENT> dim = w.shape[0] <NEW_LINE> n = self.xis.shape[0] <NEW_LINE> xis = self.xis <NEW_LINE> yis = self.yis <NEW_LINE> s = np.zeros(dim) <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> if yis[i]*xis[i, :].dot(w) < 1: <NEW_LINE> <INDENT> s += -yis[i] * xis[i, :] <NEW_LINE> <DEDENT... | Result should be a vector of dimensionality of input w. | 625941d9283ffb24f3c55b93 |
def up(scanline, previous, filter_unit): <NEW_LINE> <INDENT> scanline_length = len(scanline) <NEW_LINE> if previous is None: <NEW_LINE> <INDENT> previous = array.array('B', [0] * scanline_length) <NEW_LINE> <DEDENT> return array.array('B', [scanline[index] + previous[index] & 0xff for index in range(scanline_length)]) | Undo up filter. | 625941d9099cdd3c635f0eee |
def get_relative_phase_difference(self, first=0, last=None, referenceray=None, wavelength=None): <NEW_LINE> <INDENT> final_phase_difference = self.get_phase_difference(first=first, last=last) <NEW_LINE> if referenceray is not None: <NEW_LINE> <INDENT> final_phase_difference -= final_phase_difference[referenceray] <NEW_... | Calculate relative phase differences in relation to a chiefray | 625941d9498bea3a759b9d43 |
def write_in4_detectors_type(f, indent): <NEW_LINE> <INDENT> theta = 2.0 / numpy.cos(RosaceProperties.mean_theta * scipy.constants.degree) <NEW_LINE> f.write(indent + '<type name="detectors">\n') <NEW_LINE> f.write(indent + ' <component type="wide_angle">\n') <NEW_LINE> f.write(indent + ' <location />\n') <NEW_LINE... | Writes the detectors type to f.
| 625941d956b00c62f0f148ef |
def get_clique_leader(self, id) -> BioObject: <NEW_LINE> <INDENT> response = self.get_response("dynamic/cliqueLeader", q=id, format="json") <NEW_LINE> nodes = response.json()['nodes'] <NEW_LINE> if len(nodes) == 0: <NEW_LINE> <INDENT> raise NoResultFoundException('SciGraph dynamic/cliqueLeader yields no result for {}'.... | :raises NoResultFoundException
:return: BioObject | 625941d9d486a94d0b98e3db |
def _sha1_provider(self): <NEW_LINE> <INDENT> if self.supports_content_filtering(): <NEW_LINE> <INDENT> return ContentFilterAwareSHA1Provider(self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None | A function that returns a SHA1Provider suitable for this tree.
:return: None if content filtering is not supported by this tree.
Otherwise, a SHA1Provider is returned that sha's the canonical
form of files, i.e. after read filters are applied. | 625941d963b5f9789fde737a |
def run_gen(self, *args, parallel=False, dry_run=False, exporters=[default, ], stats=[defaultStats], outdir=None, exporter_params={}, stats_params={}, log_level=None, **kwargs): <NEW_LINE> <INDENT> if log_level: <NEW_LINE> <INDENT> logger.setLevel(log_level) <NEW_LINE> <DEDENT> logger.info('Using exporters: %s', export... | Run the simulation and yield the resulting environments. | 625941d9627d3e7fe0d690e6 |
def on_incomplete_file_received(self, filepath): <NEW_LINE> <INDENT> logger.info("Incomplete file received %s", filepath) <NEW_LINE> try: <NEW_LINE> <INDENT> self.handle_file_received(filepath) <NEW_LINE> <DEDENT> except Exception as exc: <NEW_LINE> <INDENT> raven.captureException() <NEW_LINE> logger.exception("On Inco... | Incomplete File received. | 625941d90a50d4780f667129 |
def begin_create_or_update( self, resource_group_name, virtual_network_gateway_connection_name, parameters, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) <NEW_LINE> con... | Creates or updates a virtual network gateway connection in the specified resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param virtual_network_gateway_connection_name: The name of the virtual network gateway
connection.
:type virtual_network_gateway_connecti... | 625941d9b830903b967e9b9d |
def topic_get(self, topic_path): <NEW_LINE> <INDENT> conn = self._connection <NEW_LINE> return conn.api_request(method='GET', path='/%s' % (topic_path,)) | API call: retrieve a topic
See:
https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/get
:type topic_path: string
:param topic_path: the fully-qualified path of the topic, in format
``projects/<PROJECT>/topics/<TOPIC_NAME>``.
:rtype: dict
:returns: ``Topic`` resource returned fr... | 625941d92ae34c7f2600d3c5 |
def oushi_distance_by_scipy(x, y): <NEW_LINE> <INDENT> X = np.vstack([x, y]) <NEW_LINE> d3 = pdist(X) <NEW_LINE> print("d3: ", d3) <NEW_LINE> d1 = pairwise_distances(x.reshape(-1, 10), y.reshape(-1, 10)) <NEW_LINE> print("d1: ", d1) <NEW_LINE> d2 = distance_matrix(x.reshape(-1, 10), y.reshape(-1, 10)) <NEW_LINE> print(... | 根据scipy库求解 | 625941d9009cb60464c63645 |
def deconv2d_bilinear_upsampling_initializer(shape): <NEW_LINE> <INDENT> if shape[0] != shape[1]: <NEW_LINE> <INDENT> raise Exception('deconv2d_bilinear_upsampling_initializer only supports symmetrical filter sizes') <NEW_LINE> <DEDENT> if shape[3] < shape [2]: <NEW_LINE> <INDENT> raise Exception('deconv2d_bilinear_ups... | Returns initializer that can be passed to DeConv2dLayer to initalize the
weights to correspond to channel wise bilinear upsampling.
Used in some segmantic segmentation approches such as [FCN](https://arxiv.org/abs/1605.06211)
Parameters
----------
shape : list of shape
shape of the filters, [height, width,... | 625941d9099cdd3c635f0eef |
def lqr_infinite_horizon(A, B, Q, R): <NEW_LINE> <INDENT> nA = A.shape[0] <NEW_LINE> if len(B.shape) == 1: <NEW_LINE> <INDENT> nB = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> nB = B.shape[1] <NEW_LINE> <DEDENT> P_current = np.zeros([nA, nA]) <NEW_LINE> P_new = np.eye(nA) <NEW_LINE> K_current = np.zeros([nB, nA]) <... | Computes the LQR infinte horizon controller associated with linear dyamics A, B and quadratic cost Q, R | 625941d910dbd63aa1bd2e37 |
def __init__(self,xtrue,param_fn='param.p', erase_pix0=280, erase_pix1=560, n_steps=1000, recon_mode='mmse', nsteps_init=500, lr_adam=0.01, lr_sgd=0.001,nsteps_burn=500, nsteps_save=500,restore=False,avg_only=False): <NEW_LINE> <INDENT> InpaintMeth.__init__(self,xtrue,param_fn,erase_pix0,erase_pix1... | Inpainting method based on the VAE-based likelihood. Two methods are
supported.
If :code:`recon_mode=='map'`, then the method finds the MAP estimate
using numerical minimization of the negative log likelihood.
If :code:`recon_mode=='mmse'`, then the method finds the MMSE estimate
using Langevin sampling.
:param nst... | 625941d92ae34c7f2600d3c6 |
def main(fname): <NEW_LINE> <INDENT> content = StringIO.StringIO() <NEW_LINE> content.write(_rst_title("Listener/Contributor API")) <NEW_LINE> for f in iterate_sources(PATH, exclude=["MaKaC/po"]): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> mod = __import__(f) <NEW_LINE> for pelem in f.split('.')[1:]: <NEW_LINE> <INDE... | main function | 625941d9eab8aa0e5d26dded |
def __bool__(self): <NEW_LINE> <INDENT> return _pyBasePython.listUC___bool__(self) | __bool__(self) -> bool | 625941d93617ad0b5ed6818b |
def teardown(self): <NEW_LINE> <INDENT> if self.ae: <NEW_LINE> <INDENT> self.ae.shutdown() <NEW_LINE> <DEDENT> import importlib <NEW_LINE> importlib.reload(pynetdicom.utils) | This function runs after all test methods | 625941d93d592f4c4ed1d2fd |
def test_add_car(self): <NEW_LINE> <INDENT> with patch('model.charge.Charge.add_car') as perm_mock: <NEW_LINE> <INDENT> perm_mock('zaz', 32) <NEW_LINE> perm_mock.assert_called_once_with('zaz', 32) | I run out of imagination to write this comments | 625941d9b5575c28eb68e297 |
def main(city_id, key): <NEW_LINE> <INDENT> pprint.pprint(curren_city_weather(city_id, key)) | Prints out the output form the public_api function in a pretty print format | 625941d991af0d3eaac9bcb0 |
def softmax(x): <NEW_LINE> <INDENT> exps = np.exp(x-np.max(x)) <NEW_LINE> return exps/np.sum(exps) | softmax函数,返回softmax后的向量 | 625941d9aad79263cf390cd9 |
def get_end_route(image, start_x, height): <NEW_LINE> <INDENT> left_limit = 0 <NEW_LINE> right_limit = image.shape[1] - 1 <NEW_LINE> end_route = [] <NEW_LINE> cur_p = (start_x, 0) <NEW_LINE> last_p = cur_p <NEW_LINE> end_route.append(cur_p) <NEW_LINE> while cur_p[1] < (height - 1): <NEW_LINE> <INDENT> sum_n = 0 <NEW_LI... | 获得滴水的路径
: param start_x: 滴水的起始x位置 | 625941d98a349b6b435e8408 |
def _build_analysis_files(analysis, r_depth=None): <NEW_LINE> <INDENT> analysis.status = "running" <NEW_LINE> analysis.build_files(r_depth) <NEW_LINE> mapping_file = analysis.mapping_file <NEW_LINE> biom_tables = analysis.biom_tables <NEW_LINE> for job_id in analysis.jobs: <NEW_LINE> <INDENT> job = Job(job_id) <NEW_LIN... | Creates the biom tables and mapping file, then adds to jobs
Parameters
----------
analysis : Analysis object
The analysis to build files for
r_depth : int, optional
Rarefaction depth for biom table creation. Default None | 625941d91f5feb6acb0c4de1 |
def validate_confusables(value): <NEW_LINE> <INDENT> if not isinstance(value, six.text_type): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if confusables.is_dangerous(value) or confusables.is_dangerous(value.lower()): <NEW_LINE> <INDENT> raise ValidationError(CONFUSABLE, code='confusable_value') | Validator which disallows 'dangerous' usernames likely to
represent homograph attacks.
A username is 'dangerous' if it is mixed-script (as defined by
Unicode 'Script' property) and contains one or more characters
appearing in the Unicode Visually Confusable Characters file. | 625941d91d351010ab855db0 |
def set_birth_death_date(self, date, line_number): <NEW_LINE> <INDENT> words = date.split() <NEW_LINE> try: <NEW_LINE> <INDENT> date = datetime.datetime.strptime(date, '%d %b %Y').date() <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> date = datetime.datetime.strptime(words[len(words... | Function that sets the birth-date and death-date of individual. | 625941d992d797404e304420 |
def train(self, inputs, targets, class_num=0): <NEW_LINE> <INDENT> outputs = self.net(inputs, class_num) <NEW_LINE> loss = self.loss(outputs.view(-1, self.in_channels), targets.long().view(-1)) <NEW_LINE> self.optimizer.zero_grad() <NEW_LINE> loss.backward() <NEW_LINE> self.optimizer.step() <NEW_LINE> return loss.data.... | Train 1 time
:param inputs: Tensor[batch, timestep, channels]
:param targets: Torch tensor [batch, timestep, channels]
:return: float loss | 625941d9b7558d58953c51a5 |
def main(): <NEW_LINE> <INDENT> y_or_n = input('是否退出程序(y/n)') <NEW_LINE> while y_or_n != 'y': <NEW_LINE> <INDENT> gender = input('性别:') <NEW_LINE> weight = float(input('体重(kg):')) <NEW_LINE> height = float(input('身高(cm):')) <NEW_LINE> age = int(input('年龄:')) <NEW_LINE> if gender == '男': <NEW_LINE> <INDENT> bmr = (13.7 ... | 祝函数 | 625941d9283ffb24f3c55b94 |
def get_items(self, assessment_taken_id): <NEW_LINE> <INDENT> return | Gets the items questioned in a assessment.
:param assessment_taken_id: ``Id`` of the ``AssessmentTaken``
:type assessment_taken_id: ``osid.id.Id``
:return: the list of assessment questions
:rtype: ``osid.assessment.ItemList``
:raise: ``NotFound`` -- ``assessment_taken_id`` is not found
:raise: ``NullArgument`` -- ``as... | 625941d95fcc89381b1e1956 |
@register.tag <NEW_LINE> def breadcrumb_url_root(parser, token): <NEW_LINE> <INDENT> bits = token.split_contents() <NEW_LINE> if len(bits) == 2: <NEW_LINE> <INDENT> return breadcrumb(parser, token) <NEW_LINE> <DEDENT> title = bits.pop(1) <NEW_LINE> token.contents = ' '.join(bits) <NEW_LINE> url_node = url(parser, token... | Same as breadcrumb but instead of url context variable takes in all the
arguments URL tag takes.
.. code-block:: python
{% breadcrumb "Title of breadcrumb" person_detail person.id %}
{% breadcrumb person.name person_detail person.id %} | 625941d94e696a04525c96e1 |
def calc_running_median(self, num, median = 0): <NEW_LINE> <INDENT> if len(self.max_heap_left) > len(self.min_heap_right): <NEW_LINE> <INDENT> if num < median: <NEW_LINE> <INDENT> heapq.heappush(self.min_heap_right, self.negate(heapq.heappop(self.max_heap_left))) <NEW_LINE> heapq.heappush(self.max_heap_left, self.negat... | :param num: Incoming new streaming number
:return: new medium number at this point of time
At any time we try to make heaps balanced and
their sizes differ by atmost 1. If heaps are
balanced,then we declare median as average of
min_heap_right.top() and max_heap_left.top()
If heaps are unbalanced,then m... | 625941d9fff4ab517eb2f6d2 |
def _render_scatterchart_plotly(self, key_word_sep=" ", title=None, **kwargs): <NEW_LINE> <INDENT> self.build_columns() <NEW_LINE> quantity_columns = [c for c in self.columns[1:] if c.is_quantity] <NEW_LINE> if len(quantity_columns) < 1: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> xticks = self.columns[0] <NEW_... | Generates a pylab plot from the result set.
``matplotlib`` must be installed, and in an
IPython Notebook, inlining must be on::
%%matplotlib inline
First column is x-axis, and should be a numeric column. Other numeric columns are y-axes.
kind = default, unstacked, stacked, stacked100
Parameters
----------
titl... | 625941d98c3a873295158652 |
def write_random_state(self): <NEW_LINE> <INDENT> log.info("Writing the state of the random number generator ...") <NEW_LINE> if self.config.writing.prng_path is not None: <NEW_LINE> <INDENT> if types.is_string_type(self.config.writing.prng_path): <NEW_LINE> <INDENT> prng_path = fs.absolute_or_in(self.config.writing.pr... | This function ...
:return: | 625941d945492302aab5e55b |
def parse_model_data(model_fn): <NEW_LINE> <INDENT> e = xml.etree.ElementTree.parse(model_fn).getroot() <NEW_LINE> metabolite_name = e.get('name') <NEW_LINE> compound_formula = e.get('compound_formula') <NEW_LINE> ion_formula = e.get('ion_formula') <NEW_LINE> moieties = {} <NEW_LINE> constraints = [] <NEW_LINE> for moi... | Parse the model data file.
Args:
model_fn - Required : full path to file (Str)
Returns:
metabolite_name : metabolite name (Str)
compound_formula : metabolite compound formula (Str)
ion_formula : metabolite ion formula (Str)
moieties : moiety information (Dict)
constraints :... | 625941d921a7993f00bc7f88 |
def _parse_email(self, index): <NEW_LINE> <INDENT> time_stamp = self._get_time_stamp(index) <NEW_LINE> tmp_sender = Sender() <NEW_LINE> tmp_sender.timestamp = time_stamp <NEW_LINE> byte_lines = self.server.retr(index)[1] <NEW_LINE> msg_content = '' <NEW_LINE> try: <NEW_LINE> <INDENT> for x in byte_lines: <NEW_LINE> <IN... | 根据邮件在邮件列表中的编号,解析邮件
:param index: 邮件在邮件列表中的编号
:return: None | 625941d944b2445a3393232a |
def test5_json_to_file3(self): <NEW_LINE> <INDENT> Base._Base__nb_objects = 0 <NEW_LINE> s1 = Rectangle(4, 5) <NEW_LINE> s2 = Rectangle(6, 7) <NEW_LINE> s3 = Rectangle(8, 9) <NEW_LINE> Rectangle.save_to_file([s1, s2, s3]) <NEW_LINE> with open("Rectangle.json", "r") as file: <NEW_LINE> <INDENT> file1 = file.read() <NEW_... | test json string into file | 625941d9e8904600ed9f21c5 |
def track_strategy_worker(self, strategy, name, interval=10, **kwargs): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> transactions = self.query_strategy_transaction( strategy, **kwargs ) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> log.warning("无法获取策略 %s 调仓信息, 错误: %s, 跳过... | 跟踪下单worker
:param strategy: 策略id
:param name: 策略名字
:param interval: 轮询策略的时间间隔,单位为秒 | 625941d9498bea3a759b9d44 |
def get_transaction_value(): <NEW_LINE> <INDENT> tx_recipient = input('Enter the recipient of the transaction: ') <NEW_LINE> tx_amount = float(input('Your transaction amount: ')) <NEW_LINE> return (tx_recipient, tx_amount) | Returns the input of the user transaction amount as a float. | 625941d9aad79263cf390cda |
def process_data(zip_data_path: str, zip_domain_path: str) -> (list, list): <NEW_LINE> <INDENT> domain_fh = open(zip_domain_path, "r") <NEW_LINE> domain = domain_fh.readlines() <NEW_LINE> domain_cat = [] <NEW_LINE> for line in domain: <NEW_LINE> <INDENT> if line[0] is "C": <NEW_LINE> <INDENT> domain_cat.append(["C"]) <... | Processes the data into a usable list for machine learning
:param zip_data_path: path to extracted data
:param zip_domain_path: path to extracted domain
:return: x_data and y_data | 625941d996565a6dacc8f960 |
def parse_format_method_string( format_string: str, ) -> Tuple[List[Tuple[str, List[Tuple[bool, str]]]], int, int]: <NEW_LINE> <INDENT> keyword_arguments = [] <NEW_LINE> implicit_pos_args_cnt = 0 <NEW_LINE> explicit_pos_args = set() <NEW_LINE> for name in collect_string_fields(format_string): <NEW_LINE> <INDENT> if nam... | Parses a PEP 3101 format string, returning a tuple of
(keyword_arguments, implicit_pos_args_cnt, explicit_pos_args),
where keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
is the number of arguments required by the format string and
explicit_pos_args is the number of arguments pa... | 625941d96aa9bd52df03703a |
def __init__(self, dim_1_tapes): <NEW_LINE> <INDENT> self.__tapes = dim_1_tapes | Initialisiert ein neues n-dimensionales Band.
:param dim_1_tapes: die eindimensionalen Bänder der Turingmaschine. | 625941d9a17c0f6771cbe2e5 |
def update_data(self): <NEW_LINE> <INDENT> if self.sk8 is not None: <NEW_LINE> <INDENT> imu = self.spinIMU.value() <NEW_LINE> data = self.sk8.get_imu(imu) <NEW_LINE> if self.current_imuid in self.calibration_data: <NEW_LINE> <INDENT> calib_data = self.calibration_data[self.current_imuid] <NEW_LINE> <DEDENT> else: <NEW_... | Updates the displayed data in the GUI for the current IMU, applying
current calibration if it is available. | 625941d916aa5153ce36270d |
def dumps(self, dumps): <NEW_LINE> <INDENT> if self.flag == 1: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return dumps | Mock dumps method. | 625941d9a8370b7717052b34 |
def test_update_element(self): <NEW_LINE> <INDENT> pass | Test case for update_element
Update some fields of an element # noqa: E501 | 625941d91b99ca400220ad47 |
def remove_phenotype(self, institute, case, user, link, phenotype_id, is_group=False): <NEW_LINE> <INDENT> LOG.info("Removing HPO term from case {0}".format(case["display_name"])) <NEW_LINE> if is_group: <NEW_LINE> <INDENT> updated_case = self.case_collection.find_one_and_update( {"_id": case["_id"]}, { "$pull": { "phe... | Remove an existing phenotype from a case
Args:
institute (dict): A Institute object
case (dict): Case object
user (dict): A User object
link (dict): The url to be used in the event
phenotype_id (str): A phenotype id
Returns:
updated_case(dict) | 625941d999fddb7c1c9de626 |
def __make_actor(self, species, gender, head, features, torso_size, legs_size): <NEW_LINE> <INDENT> if species == "mouse": <NEW_LINE> <INDENT> features = "n" <NEW_LINE> <DEDENT> dog_head = {"nn": "m_skirt", "nl": "s_shorts", "ln": "m_shorts", "ll": "l_shorts"} <NEW_LINE> gender_dict = {"m": "shorts", "f": "skirt"} <NEW... | Generates the parts needed to contruct an Actor.
| 625941d95510c4643540f674 |
def parse_inputs(): <NEW_LINE> <INDENT> parser = ArgumentParser(description='Input either encrypt or decrypt.') <NEW_LINE> parser.add_argument('mode', type=str, help='show cam while recording') <NEW_LINE> args = parser.parse_args() <NEW_LINE> return args.mode | Helper method for parsing user input | 625941d9bd1bec0571d908c4 |
def is_valid(self, *args, **kwargs): <NEW_LINE> <INDENT> return not self.contains_whitespace(kwargs["test_object"].name) | Return False if the bay name contains whitespace, otherwise True. | 625941d96fb2d068a760f336 |
def __init__(self, name, column_separator=COLUMN_SEPARATOR, ephem_format='CFHT ET', runid='16BP06'): <NEW_LINE> <INDENT> self.name = str(name).replace(" ", "_") <NEW_LINE> self.format = ephem_format <NEW_LINE> self.doc = create_astrores_document() <NEW_LINE> self.column_separator = column_separator <NEW_LINE> self.coor... | create an ephmeris target, either with a 'orbfit' object or some mean rate of motion.
:param name: a string containing the name of the target. | 625941d9167d2b6e31218e2b |
def fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_tx_ls_rjt(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> fcoe_get_interface = ET.Element("fcoe_get_interface") <NEW_LINE> config = fcoe_get_interface <NEW_LINE> if kwargs.pop('delete_fcoe_get_interface', False) is True: <NEW_LINE> <IN... | Auto Generated Code
| 625941d9379a373c97cfaddc |
def lsp_candidates(cls: Any, prefix: str = 'lsp_') -> Iterator[str]: <NEW_LINE> <INDENT> assert not prefix[:1] == '_' <NEW_LINE> if prefix: <NEW_LINE> <INDENT> for fn in dir(cls): <NEW_LINE> <INDENT> if fn[:len(prefix)] == prefix and callable(getattr(cls, fn)): <NEW_LINE> <INDENT> yield fn <NEW_LINE> <DEDENT> <DEDENT> ... | Returns an iterator over all method names from a class that either
have a certain prefix or, if no prefix was given, all non-special and
non-private-methods of the class. | 625941d90c0af96317bb847e |
def scheme_color(self, value): <NEW_LINE> <INDENT> if value in self._colorscheme: <NEW_LINE> <INDENT> return self._colorscheme[value][0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError("Scheme color out of range: %d" % value) | scheme_color(self, value)
o value An int representing a single color in the user-defined
color scheme
Takes an int representing a user-defined color and returns the
appropriate colors.Color object | 625941d97cff6e4e81117c1b |
def setUpperUncertainty(self, *args): <NEW_LINE> <INDENT> return _DataModel.WaveformQuality_setUpperUncertainty(self, *args) | setUpperUncertainty(WaveformQuality self, Seiscomp::Core::Optional< double >::Impl const & upperUncertainty) | 625941d9b545ff76a89140ab |
def copy(self): <NEW_LINE> <INDENT> res = ConnectionSet(self.allow_all) <NEW_LINE> for protocol, properties in self.allowed_protocols.items(): <NEW_LINE> <INDENT> res.allowed_protocols[protocol] = self.copy_properties(properties) <NEW_LINE> <DEDENT> return res | :return: A deep copy of self
:rtype: ConnectionSet | 625941d94428ac0f6e5baa89 |
def print_output(self, message, end="\n", color=COLOR_DEFAULT): <NEW_LINE> <INDENT> if not self.__silent: <NEW_LINE> <INDENT> print( "{}{}{}".format(color, message, COLOR_DEFAULT), end=end, flush=True ) <NEW_LINE> <DEDENT> self.__output.write("{}{}".format(message, end)) <NEW_LINE> self.__output.flush() | Prints a message (you can set its colour)
:param message: the message to print
:type message: str
:param end: endline character. Default to ``"\n"``
:type end: str
:param color: colour of the message. Default to ``COLOR_DEFAULT``
:type color: str | 625941d999cbb53fe6792e7c |
def pageLayoutToXmlPrint(self, pageLayout, mxPrintIn=None): <NEW_LINE> <INDENT> if mxPrintIn is None: <NEW_LINE> <INDENT> mxPrint = Element('print') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> mxPrint = mxPrintIn <NEW_LINE> <DEDENT> setb = _setAttributeFromAttribute <NEW_LINE> setb(pageLayout, mxPrint, 'new-page', 'i... | Given a PageLayout object, set object data for <print>
>>> pl = layout.PageLayout()
>>> pl.pageHeight = 4000
>>> pl.isNew = True
>>> pl.rightMargin = 30.25
>>> pl.leftMargin = 20
>>> pl.pageNumber = 5
>>> XPBase = musicxml.m21ToXml.XMLExporterBase()
>>> mxPrint = XPBase.pageLayoutToXmlPrint(pl)
>>> XPBase.dump(mxPrin... | 625941d95510c4643540f675 |
def get_property(self, property_name, mol_idx=0, replica_idx=None, atomistic=False): <NEW_LINE> <INDENT> if property_name == Structure.Z: <NEW_LINE> <INDENT> return self.properties[Structure.Z][mol_idx] <NEW_LINE> <DEDENT> if property_name not in self.properties: <NEW_LINE> <INDENT> raise HDF5LoaderError(f"Property {pr... | Extract property from dataset.
Args:
property_name (str): Name of the property as contained in the self.properties dictionary.
mol_idx (int): Index of the molecule to extract, by default uses the first molecule (mol_idx=0)
replica_idx (int): Replica of the molecule to extract (e.g. for ring polymer molecul... | 625941d982261d6c526ab738 |
def test_patch_metadata(self): <NEW_LINE> <INDENT> input_id1 = uuid.uuid4().hex <NEW_LINE> img = self.app.inputs.create_image_from_url( image_id=input_id1, url=sample_inputs.METRO_IMAGE_URL, allow_duplicate_url=True) <NEW_LINE> self.assertTrue(isinstance(img, ClarifaiImage)) <NEW_LINE> self.assertEqual(img.url, sample_... | test patching metadata | 625941d90a366e3fb873eab2 |
def start(self, context): <NEW_LINE> <INDENT> assert isinstance(context, BundleContext) <NEW_LINE> for handler in BUILTIN_HANDLERS: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> bundle = context.install_bundle(handler) <NEW_LINE> bundle.start() <NEW_LINE> self._bundles.append(bundle) <NEW_LINE> <DEDENT> except pelix.Bun... | The bundle has started
:param context: The bundle context | 625941d955399d3f0558894b |
def get(self, label_id, user_id): <NEW_LINE> <INDENT> log_info("[Users.labels]: Get the label with id={label_id}".format(label_id=label_id)) <NEW_LINE> url = '{host}/{api}/{user_id}/labels/{label_id}'.format(host=self.host, api=self.api, user_id=user_id, label_id=label_id) <NEW_LINE> http = HttpLib(url=url) <NEW_LINE> ... | Gets the specified label.
:param label_id: The ID of the label to update.
:param user_id: The user's email address.
:return: response, (LabelModel) model | 625941d901c39578d7e750d2 |
def remove_xml_namespaces(treedom): <NEW_LINE> <INDENT> xslt_doc = et.parse(io.StringIO(drop_namespace_xslt)) <NEW_LINE> transform = et.XSLT(xslt_doc) <NEW_LINE> return transform(treedom) | Given an lxml tree object, remove all XML namespaces. | 625941d97c178a314d6ef6f9 |
def __init__(self, request_type=None, transaction_amount=None, store_id=None, merchant_transaction_id=None, transaction_origin=None, order=None, ipg_transaction_id=None, allow_partial_approval=None, payment_method=None): <NEW_LINE> <INDENT> self._request_type = None <NEW_LINE> self._transaction_amount = None <NEW_LINE>... | AchCreditTransaction - a model defined in OpenAPI | 625941d971ff763f4b549926 |
def __init__(self, *, start, end, opt): <NEW_LINE> <INDENT> self.start_city_name = start <NEW_LINE> self.end_city_name = end <NEW_LINE> self.cost_function = opt <NEW_LINE> self.city_data = dict() <NEW_LINE> self.road_data = dict() <NEW_LINE> self.build_city_data() <NEW_LINE> self.build_road_data() <NEW_LINE> start_city... | Initialize an instance of this class.
Parameters:
start: Name of the starting city or location.
end: Name of the ending city or location.
opt: Optimization method. | 625941d9f9cc0f698b140890 |
def add_text_record(self, absolute_name, txt, ttl=-1, properties={}): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._api.get_entity_by_id( self._soap_client.service.addTXTRecord(self.get_id(), absolute_name, txt, ttl, util.parse_properties(properties)) ) <NEW_LINE> <DEDENT> except WebFault as e: <NEW_LINE> <... | Add a new TEXT TXT record.
This method adds the record under a zone.
:param absolute_name: The FQDN of the text record. If you are adding a record in a zone that is linked
to a incremental Naming Policy, a single hash (#) sign must be added at the
appropriate location in the FQDN. Depending on the policy orde... | 625941d9f548e778e58cd815 |
def crystal_to_cart(self, r): <NEW_LINE> <INDENT> return np.matmul(r, self.cell_params) | takes an array r, which is written in crystal coordinates
and transforms it to cartesian coordinates
the array is assumed to have its components in its last axis,
i.e. its shape is (...,3) | 625941d9e64d504609d74ad6 |
def test_seed_dir_valid_extra(self): <NEW_LINE> <INDENT> userdata = b'valid-extra-userdata' <NEW_LINE> data = {'meta-data/instance-id': 'i-valid-extra', 'meta-data/local-hostname': 'valid-extra-hostname', 'user-data': userdata, 'foo': 'bar'} <NEW_LINE> my_d = os.path.join(self.tmp, "valid_extra") <NEW_LINE> populate_di... | Verify extra files do not affect seed_dir validity. | 625941d930c21e258bdfa735 |
def _setup_stub(self, channel): <NEW_LINE> <INDENT> self._stub = tracking_server_pb2_grpc.TrackingServerServiceStub(channel) | Setups the api stub | 625941d94428ac0f6e5baa8a |
def getText(filename): <NEW_LINE> <INDENT> image = cv2.imread(filename) <NEW_LINE> gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) <NEW_LINE> text = pytesseract.image_to_string(gray) <NEW_LINE> return text | Takes a file name and returns the text in that file. | 625941d994891a1f4081bd40 |
def _update_progress_bar(self, curr): <NEW_LINE> <INDENT> pg = str(curr) <NEW_LINE> sys.stdout.write(pg) <NEW_LINE> sys.stdout.flush() <NEW_LINE> sys.stdout.write('\b' * len(pg)) <NEW_LINE> return | Update counter with current iteration | 625941d926068e7796caef78 |
def type_param(self, node, ct): <NEW_LINE> <INDENT> types = self.get_types(node) <NEW_LINE> ftyp = types[0] <NEW_LINE> if len(types) == 1: <NEW_LINE> <INDENT> if ftyp in type_class: <NEW_LINE> <INDENT> jtyp = type_class[ftyp] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> jtyp = "other" <NEW_LINE> <DEDENT> self.xsl_with... | Resolve the type of a leaf or leaf-list node for JSON.
| 625941d9a4f1c619b28b02ca |
def preferences_for_item(self, item_id, order_by_id=True): <NEW_LINE> <INDENT> raise NotImplementedError("cannot instantiate Abstract Base Class") | Parameters
----------
item_id: id of the item in the model
string or int
order_by_id: bool
If True order by user_id otherwise by the preference values.
default = True
Returns
----------
Return all existing Preferences expressed for that item,
ordered by user id (if order_by_id is Tru... | 625941d9a17c0f6771cbe2e6 |
def _load_plugins(options, config): <NEW_LINE> <INDENT> paths = config['pluginpath'].as_str_seq(split=False) <NEW_LINE> paths = [util.normpath(p) for p in paths] <NEW_LINE> log.debug(u'plugin paths: {0}', util.displayable_path(paths)) <NEW_LINE> paths = [util.py3_path(p) for p in paths] <NEW_LINE> import beetsplug <NEW... | Load the plugins specified on the command line or in the configuration.
| 625941d94e696a04525c96e2 |
def updates_tag_membership(self, memberToTags=None, memberType=None, headers=None, payload=None, active_validation=True, **request_parameters): <NEW_LINE> <INDENT> check_type(headers, dict) <NEW_LINE> check_type(payload, dict) <NEW_LINE> if headers is not None: <NEW_LINE> <INDENT> if 'Content-Type' in headers: <NEW_LIN... | Updates tag membership. As part of the request payload through
this API, only the specified members are added /
retained to the given input tags. Possible values of
memberType attribute in the request payload can be
queried by using the /tag/member/type API.
Args:
memberToTags(list): TagMemberDTO's memberToTags (l... | 625941d98e7ae83300e4b263 |
def get_handler(self, protocol): <NEW_LINE> <INDENT> handler = self.protocol_handlers.get(protocol) <NEW_LINE> if not handler: <NEW_LINE> <INDENT> raise Exception('Protocol %s not supported' % protocol) <NEW_LINE> <DEDENT> return handler | Looks up a ProtocolHandler instance for the specified protocol.
If no such handler has been register, an Exception is raised.
Returns the found protocol handler. | 625941d9f8510a7c17cf9994 |
def dismiss_parent(self): <NEW_LINE> <INDENT> self.root.setting_popup.dismiss() | close popup | 625941d9ac7a0e7691ed435e |
def _partition(self): <NEW_LINE> <INDENT> training_size = self.sample_size * TRAINING_SIZE_RATIO <NEW_LINE> rng_state = np.random.get_state() <NEW_LINE> np.random.shuffle(self.data) <NEW_LINE> np.random.set_state(rng_state) <NEW_LINE> np.random.shuffle(self.target) <NEW_LINE> self.train_data = self.data[training_size:]... | Split the data into training/testing sets and stores as instance attributes.
Returns: None | 625941d9596a897236089d54 |
def testify_requirement_name(test_name, prefix=""): <NEW_LINE> <INDENT> return prefix + test_name | Generates a name for a Requirement by taking the <test name=XXX> name attribute, and prefixing with prefix
:param test_name:
:param prefix:
:return: | 625941d94c3428357757c5bd |
def namespace(self, namespace, to=None): <NEW_LINE> <INDENT> qs = super(EventQuerySet, self).namespace(namespace, to) <NEW_LINE> app = EventsConfig.objects.filter(namespace=namespace).first() <NEW_LINE> if app and app.latest_first: <NEW_LINE> <INDENT> qs = qs.reverse() <NEW_LINE> <DEDENT> return qs | Overrides the 'normal' namespace QS to also use the 'latest_first'
flag on the namespace to set the ordering accordingly. | 625941d9d4950a0f3b08c5e3 |
def periods_per_year(p): <NEW_LINE> <INDENT> if type(p) == str: <NEW_LINE> <INDENT> return len(pd.date_range('2000-01-01', '2010-01-01', freq=p)) / 10.0 <NEW_LINE> <DEDENT> elif type(p) == pd.Series: <NEW_LINE> <INDENT> if p.index.freq: <NEW_LINE> <INDENT> return periods_per_year(p.index.freq.name) <NEW_LINE> <DEDENT> ... | Return average number periods per year.
Two overloads:
periods_per_year(series):
Return number of periods in a year for the series.
periods_per_year(p):
Return number of periods in a year for period p (pandas syntax). | 625941d9a05bb46b383ecab7 |
def _get_auto_neg(self): <NEW_LINE> <INDENT> cisco_duplex = self._get_cisco_duplex() <NEW_LINE> if cisco_duplex: <NEW_LINE> <INDENT> if cisco_duplex in ["auto", "disagree"]: <NEW_LINE> <INDENT> return "True" <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> return super(CiscoSnmpIfPort, self)._get_auto_neg() | Get port auto negotiation status.
:return return "True" | 625941d9d7e4931a7ee9e1b4 |
def generator_consumer(coro): <NEW_LINE> <INDENT> if not asyncio.iscoroutinefunction(coro): <NEW_LINE> <INDENT> raise TypeError('paco: coro must be a coroutine function') <NEW_LINE> <DEDENT> @functools.wraps(coro) <NEW_LINE> @asyncio.coroutine <NEW_LINE> def wrapper(*args, **kw): <NEW_LINE> <INDENT> if len(args) > 1 an... | Decorator wrapper that consumes sync/async generators provided as
interable input argument.
This function is only intended to be used internally.
Arguments:
coro (coroutinefunction): function to decorate
Raises:
TypeError: if function or coroutine function is not provided.
Returns:
function: decorated f... | 625941d98e7ae83300e4b264 |
def _create_button_hat_ui(self): <NEW_LINE> <INDENT> self.min_speed = QtWidgets.QSpinBox() <NEW_LINE> self.min_speed.setRange(0, 1e5) <NEW_LINE> self.max_speed = QtWidgets.QSpinBox() <NEW_LINE> self.max_speed.setRange(0, 1e5) <NEW_LINE> self.time_to_max_speed = gremlin.ui.common.DynamicDoubleSpinBox() <NEW_LINE> self.t... | Creates the UI for button setups. | 625941d9adb09d7d5db6ca25 |
def test_load_as_matrix_explicit_grayscale(self): <NEW_LINE> <INDENT> inst = PilImageReader(explicit_mode="L") <NEW_LINE> mat = inst.load_as_matrix(self.gh_file_element) <NEW_LINE> assert isinstance(mat, numpy.ndarray) <NEW_LINE> assert mat.dtype == numpy.uint8 <NEW_LINE> assert mat.shape == (600, 512) | Test loading valid Grace Hopper image with an explicit conversion
type to grayscale. Should result in a single channel image (only 2
dims). | 625941d9cad5886f8bd2726f |
def fit2d(self, X=None, n_features: Tuple[int, int] = None, packed: bool = False, online=False, **override): <NEW_LINE> <INDENT> return self.__fit(X, n_features, packed, online, True, **override) | Configure OPU transform for 2d vectors
The function can be either called with input vector, for fitting OPU
parameters to it, or just vector dimensions, with `n_features`.
When input is bit-packed the packed flag must be set to True.
Number of features must be then provided with `n_features`
When input vectors must ... | 625941d9925a0f43d254a10f |
@cmd.command() <NEW_LINE> @click.pass_context <NEW_LINE> def configure(ctx): <NEW_LINE> <INDENT> initialize_logger(f"{PROGRAM_NAME:s} configure", ctx.obj[Context.LOG_LEVEL]) <NEW_LINE> logger.debug(f"{PROGRAM_NAME} configuration file existence: {app_config_mgr.exists}") <NEW_LINE> sys.exit(app_config_mgr.configure()) | Configure the following application settings:
(1) Default encoding to load files.
(2) HTTP/HTTPS proxy server URI (for url sub-command).
Configurations are written to '~/.sqlitebiter'.
You can remove these settings by deleting '~/.sqlitebiter'. | 625941d9a8ecb033257d3363 |
def read_json_zstd(obj): <NEW_LINE> <INDENT> dctx = zstd.ZstdDecompressor() <NEW_LINE> if isinstance(obj, str): <NEW_LINE> <INDENT> with open(obj, 'rb') as p: <NEW_LINE> <INDENT> obj1 = dctx.decompress(p.read()) <NEW_LINE> <DEDENT> <DEDENT> elif isinstance(obj, bytes): <NEW_LINE> <INDENT> obj1 = dctx.decompress(obj) <N... | Deserializer from a compressed zstandard json object to a dictionary.
Parameters
----------
obj : bytes
The bytes object.
Returns
-------
Dict | 625941d92ae34c7f2600d3c8 |
def eloglik(X_t, xattr, Y_t, s): <NEW_LINE> <INDENT> n = X_t.shape[0] <NEW_LINE> return -(n/2) * torch.log(2*np.pi*s['sigma2']) - (1/(2*s['sigma2'])) * get_ER2(X_t, xattr, Y_t, s) | expected loglikelihood for a susie fit | 625941d9187af65679ca53b6 |
def preset_Default(self, event): <NEW_LINE> <INDENT> if wx.MessageBox(_("Be careful! The selected preset will be " "overwritten with the default one. Your profiles " "may be deleted!\n\nDo you want to continue?"), _("Warning"), wx.ICON_WARNING | wx.YES_NO | wx.CANCEL, self) == wx.YES: <NEW_LINE> <INDENT> filename = sel... | Replace the selected preset at default values. | 625941d9be7bc26dc91cd892 |
def test_ascii_is_ascii(self): <NEW_LINE> <INDENT> stl = Stl(asset('block.stl')) <NEW_LINE> assert stl.stats['type'] == Stl.ASCII | Tests if loaded ASCII file is recognized as ASCII | 625941d93d592f4c4ed1d2ff |
def __getitem__(self, item): <NEW_LINE> <INDENT> raise NotImplementedError("must be implemented by subclass.") | Return the value associated with the key item in the MutableMapping.
:param item:
:return: | 625941d9b545ff76a89140ac |
def create_account(dbuser, dbuserpass, port): <NEW_LINE> <INDENT> url = 'bolt://' + Config.container_ip + ':' + str(port) <NEW_LINE> password = Config.accounts['Neo4j']['admin_pass'] <NEW_LINE> try: <NEW_LINE> <INDENT> driver = GraphDatabase.driver(url, auth=("neo4j", password)) <NEW_LINE> <DEDENT> except: <NEW_LINE> <... | Create Neo4j accounts
specified in the configure file. Then add the user account. | 625941d97d43ff24873a2f38 |
def group_required(raise_exception=False, *group_names): <NEW_LINE> <INDENT> def in_groups(u): <NEW_LINE> <INDENT> if u.is_authenticated(): <NEW_LINE> <INDENT> if bool(u.groups.filter(name__in=group_names)) | u.is_superuser: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> if raise_exception: <NEW_LINE> <IN... | Requuires user membership at least one of the groups passed in. | 625941d96e29344779a628a7 |
def train(net, X_train, T_train, batch_size=1, n_epochs=2, eta=0.1, X_test=None, T_test=None, verbose=False): <NEW_LINE> <INDENT> n_samples = X_train.shape[0] <NEW_LINE> assert T_train.shape[0] == n_samples <NEW_LINE> assert batch_size <= n_samples <NEW_LINE> run_info = defaultdict(list) <NEW_LINE> def process_info(epo... | Trains a network using vanilla gradient descent.
:param net:
:param X_train:
:param T_train:
:param batch_size:
:param n_epochs:
:param eta: learning rate
:param X_test:
:param T_test:
:param verbose: prints evaluation for each epoch if True
:return: | 625941d91f5feb6acb0c4de3 |
def __init__(self, analysis_objects=None): <NEW_LINE> <INDENT> super(analysis_task_list, self).__init__() <NEW_LINE> self.update(analysis_objects) | Initialize the set of analysis tasks to be performed as part of the workflow
:param analysis_objects: Set or list of unique analysis objects to be added.
Duplicates will be removed. | 625941d9be7bc26dc91cd893 |
def submit_run(self, json): <NEW_LINE> <INDENT> response = self._do_api_call(SUBMIT_RUN_ENDPOINT, json) <NEW_LINE> return response['run_id'] | Utility function to call the ``api/2.0/jobs/runs/submit`` endpoint.
:param json: The data used in the body of the request to the ``submit`` endpoint.
:type json: dict
:return: the run_id as a string
:rtype: string | 625941d9091ae356686671f1 |
def get_data(qs, start_date, date_field, extra_fields): <NEW_LINE> <INDENT> if start_date: <NEW_LINE> <INDENT> kwargs = {'{0}__gt'.format(date_field): start_date} <NEW_LINE> qs = qs.filter(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> qs = qs.all() <NEW_LINE> <DEDENT> truncate = connection.ops.date_trunc_sql(... | Helper function that:
1) Limits results to after start_date
2) Group results by day on date_field and annotate with count | 625941d9b7558d58953c51a7 |
def teacher_courserecord_add(request,class_id): <NEW_LINE> <INDENT> classes_obj=models.ClassList.objects.get(id=class_id) <NEW_LINE> if request.method=="GET": <NEW_LINE> <INDENT> course_record_form=forms.CourseRecordForm() <NEW_LINE> <DEDENT> elif request.method=="POST": <NEW_LINE> <INDENT> data_copy=request.POST.copy(... | 增加上课记录
:param request:
:param class_id:
:return: | 625941d9091ae356686671f2 |
def dynamic(self): <NEW_LINE> <INDENT> idx=range(self.N) <NEW_LINE> idx=np.random.permutation(idx) <NEW_LINE> h=np.ones(self.N) <NEW_LINE> for ii in idx: <NEW_LINE> <INDENT> h[ii]=np.sum(self.weight*self.x,axis=1)[ii] <NEW_LINE> if h[ii]==0: <NEW_LINE> <INDENT> self.x[ii]=1; <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT... | Executes one timestep of the dynamics | 625941d95e10d32532c5f1bd |
def apply_method(self, r, **attr): <NEW_LINE> <INDENT> output = {} <NEW_LINE> if r.http == "GET": <NEW_LINE> <INDENT> if r.representation == "xls": <NEW_LINE> <INDENT> output = self.xls(r, **attr) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> r.error(415, current.ERROR.BAD_FORMAT) <NEW_LINE> <DEDENT> <DEDENT> else: <NE... | Page-render entry point for REST interface.
@param r: the S3Request instance
@param attr: controller attributes | 625941d956ac1b37e6264463 |
def event_m10_17_x37(z98=10173250, z99=117020170): <NEW_LINE> <INDENT> SetEventFlag(z99, 0) <NEW_LINE> SetObjSync(z98, 0) <NEW_LINE> IsPlayerInTheMap(8, 1, 0) <NEW_LINE> CompareEventFlag(8, z99, 0) <NEW_LINE> assert ConditionGroup(8) <NEW_LINE> if IsGuest() != 0: <NEW_LINE> <INDENT> ChangeOwnObjState(10) <NEW_LINE> Com... | [Lib] OBJ Pledge: First move
z98: OBJ instance ID
z99: During menu operation: Area and other flags | 625941d94e696a04525c96e3 |
def solve(text): <NEW_LINE> <INDENT> result = None <NEW_LINE> res = [] <NEW_LINE> for word in text.strip().splitlines(): <NEW_LINE> <INDENT> res.append(word[0]) <NEW_LINE> <DEDENT> result = ''.join(res).title() <NEW_LINE> return result | Trả về tiêu đề bài thơ ghép từ các chữ cái đầu tiên của mỗi dòng.
Chỉ viết hoa chữ cái đầu tiên. | 625941d97b180e01f3dc4a90 |
def shell(cmd): <NEW_LINE> <INDENT> return subprocess.getoutput(cmd) | Возвращает функцию, выполняющую команду в терминале (асинхронно).
:cmd - команда; | 625941d9377c676e9127243f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.