code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def func(self, func): <NEW_LINE> <INDENT> return self.visit(func) | convenience function called from visit_Call. | 625941e856b00c62f0f14ad8 |
def save_contents(contents_save, filename_save): <NEW_LINE> <INDENT> content_type, content_string = contents_save.split(',') <NEW_LINE> decoded = base64.b64decode(content_string + "==") <NEW_LINE> try: <NEW_LINE> <INDENT> if 'csv' in filename_save: <NEW_LINE> <INDENT> print('yes, it`s csv') <NEW_LINE> df = pd.read_csv(... | данные, загруженные в скрипт сохраняются в скрытом элементе страницы в
json массиве, это необходимо для передачи данных между callback`ами.
это решение - единственный способ передать данные без использования глобальных переменных | 625941e88c0ade5d55d3ee3a |
def create_event_tracker(name=None, datasetGroupArn=None): <NEW_LINE> <INDENT> pass | Creates an event tracker that you use when sending event data to the specified dataset group using the PutEvents API.
When Amazon Personalize creates an event tracker, it also creates an event-interactions dataset in the dataset group associated with the event tracker. The event-interactions dataset stores the ... | 625941e8462c4b4f79d1db4b |
def has_right_descent(self, i): <NEW_LINE> <INDENT> i = self.parent().index_set().index(i) <NEW_LINE> col = self.matrix().column(i) <NEW_LINE> return all(x <= 0 for x in col) | Return whether ``i`` is a right descent of ``self``.
A Coxeter system `(W, S)` has a root system defined as
`\{ w(\alpha_s) \}_{w \in W}` and we define the positive
(resp. negative) roots `\alpha = \sum_{s \in S} c_s \alpha_s`
by all `c_s \geq 0` (resp. `c_s \leq 0`). In particular, we note
that if `\ell(w s) > \ell(w... | 625941e83539df3088e2e7c7 |
def test_eccentricity(): <NEW_LINE> <INDENT> mu = 10 <NEW_LINE> r_vector = [1, 2, 3] <NEW_LINE> v_vector = [4, 5, 6] <NEW_LINE> h_vector = [-3, 6, -3] <NEW_LINE> actual_out = RV2COE.eccentricity(mu, r_vector, v_vector, h_vector) <NEW_LINE> expected_out = [(-51/10)-(1/np.sqrt(14)), (-3/5)-np.sqrt(2/7), (39/10)-(3/np.sqr... | Test for Eccentricity Function
| 625941e8167d2b6e31219010 |
def key_iterator(self): <NEW_LINE> <INDENT> return _donutengine.StringToStringMap_key_iterator(self) | key_iterator(StringToStringMap self) -> SwigPyIterator
Parameters:
self: std::map< std::string,std::string > * | 625941e823e79379d52ee9da |
def add_event(self, name, time, chan): <NEW_LINE> <INDENT> self.annot.add_event(name, time, chan=chan) <NEW_LINE> self.update_annotations() | Action: add a single event. | 625941e88e7ae83300e4b44a |
def run_cuff_norm(transcripts, sorted_sam_paths, output_path, overwrite=False): <NEW_LINE> <INDENT> if not os.path.exists(output_path) or overwrite: <NEW_LINE> <INDENT> cmd = 'cuffnorm -p 4 -o %s %s ' % (output_path, transcripts) <NEW_LINE> for sam_file in sorted_sam_paths: <NEW_LINE> <INDENT> cmd += '%s ' % sam_file <... | Method to run Cuffnorm on command line.
:param transcripts:
:param sorted_sam_paths:
:param output_path:
:return: | 625941e894891a1f4081bf27 |
def getPredecessors(self, state): <NEW_LINE> <INDENT> predecessorSet = set() <NEW_LINE> if not self.mdp.isTerminal(state): <NEW_LINE> <INDENT> for s in self.mdp.getStates(): <NEW_LINE> <INDENT> if not self.mdp.isTerminal(s): <NEW_LINE> <INDENT> for a in self.mdp.getPossibleActions(s): <NEW_LINE> <INDENT> for ns, t in s... | return a set containing all predecessors of state | 625941e82c8b7c6e89b35c39 |
def update_ancien_date(id_ancien): <NEW_LINE> <INDENT> success = False <NEW_LINE> if helper.is_valid_integer(id_ancien): <NEW_LINE> <INDENT> up = __ancien.update().where( __ancien.c.id_ancien == id_ancien ).values( date_update=date.today() ) <NEW_LINE> result = engine.execute(up) <NEW_LINE> if result is not None: <NEW_... | Mettre à jour ancien.date_update pour marquer que la fiche ancien à été mise à jour à la date du jour
:param id_ancien: l'id de l'ancien
:return: boolean success = true si l'update fonctionne | 625941e85fc7496912cc3df9 |
def getLineFit(X, Y): <NEW_LINE> <INDENT> func = lambda P: P[0]*X - Y <NEW_LINE> P0 = np.array([0.0]) <NEW_LINE> P = leastsq(func, P0) <NEW_LINE> return P[0][0]*X, P[0][0] | Fit a line to data | 625941e815fb5d323cde0f92 |
def log2Xcpt(sText=None, cFrames=1): <NEW_LINE> <INDENT> return logXcptWorker(2, False, "", sText, cFrames); | Log level 2: Log an exception, optionally with a preceeding message and
more than one call frame. | 625941e8566aa707497f49de |
def testSeqMv4(self): <NEW_LINE> <INDENT> self.createSequence("tmp/spam#.txt", Range("1-2,5")) <NEW_LINE> os.system("%s ../utilities/seqmv.py tmp/spam tmp/foo -d2-"%sys.executable) <NEW_LINE> self.assertFiles("tmp/foo#.txt", "spam#.txt", Range("2-4"), Range("1,2,5")) | Test seqmv -d | 625941e83c8af77a43ae3c21 |
def _chapter_url(self, book, chapter): <NEW_LINE> <INDENT> return '{}book-{}-chapter-{}/'.format(self.index_path, book, chapter) | return chapter url | 625941e8a05bb46b383ecc99 |
def get_seq(dict_hg19,big_read,strandness): <NEW_LINE> <INDENT> chr=big_read.split(",")[0] <NEW_LINE> start=atoi(big_read.split(",")[1]) <NEW_LINE> end=atoi(big_read.split(",")[2]) <NEW_LINE> if strandness=="+": <NEW_LINE> <INDENT> return dict_hg19[chr][start-1:end] <NEW_LINE> <DEDENT> elif strandness=="-": <NEW_LINE> ... | function: get base sequece in ref according to big_read pos and strandness
input: (dict_hg19,"chr2,240026798,240027034","+")
output: "GGGGTTACCC" | 625941e866673b3332b9250d |
def fix(self, inp: List[str]) -> List[str]: <NEW_LINE> <INDENT> pass | Fixes the error given in the inp (input) and
returns the corrected lines | 625941e891af0d3eaac9be99 |
def send_templated_email(template_name, context, recipient_list, from_email=settings.DEFAULT_FROM_EMAIL, attachment_filename=None, attachment_data=None): <NEW_LINE> <INDENT> template_engine = Engine() <NEW_LINE> email_template = EmailTemplate.objects.get(name=template_name) <NEW_LINE> subject_template = template_engine... | Sends an email using a template stored in the database (based on the template name)
Also supports attaching a file | 625941e80c0af96317bb8663 |
def enter_api_call(name, request, kwargs=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> global _API_CALL_NUMBER <NEW_LINE> _API_CALL_NUMBER += 1 <NEW_LINE> if settings.OPUS_LOG_API_CALLS: <NEW_LINE> <INDENT> s = 'API ' + str(_API_CALL_NUMBER) + ' ' <NEW_LINE> if request ... | Record the entry into an API | 625941e876d4e153a657efae |
def pop(self): <NEW_LINE> <INDENT> self.stack.pop() <NEW_LINE> call = self.stack[-1] <NEW_LINE> self.setCurrentSection(call['section'], call['number'], call['words'], call['PC']) | Pop the current code section and set the last one as the current one.
This is done when a macro ends, it restores its caller and its PC. | 625941e82ae34c7f2600d5ac |
@register.filter <NEW_LINE> def parse_iso(value): <NEW_LINE> <INDENT> return parse(value) | Parses an iso datetime string into a datetime object
Args:
value (str): datetime str
Returns:
datetime: the parsed datetime | 625941e8d18da76e23532958 |
def test_octave_origin(self): <NEW_LINE> <INDENT> self.oc.run('x = test_datatypes()') <NEW_LINE> self.oc.put('y', self.data) <NEW_LINE> try: <NEW_LINE> <INDENT> self.oc.isequaln <NEW_LINE> func = 'isequaln' <NEW_LINE> <DEDENT> except Oct2PyError: <NEW_LINE> <INDENT> func = 'isequalwithequalnans' <NEW_LINE> <DEDENT> for... | Test all of the types, originating in octave, and returning
| 625941e83cc13d1c6d3c77f4 |
def test_algo_record_allow_mock(self): <NEW_LINE> <INDENT> test_algo = TradingAlgorithm( script=record_variables, sim_params=self.sim_params, ) <NEW_LINE> set_algo_instance(test_algo) <NEW_LINE> test_algo.record(foo=MagicMock()) | Test that values from "MagicMock"ed methods can be passed to record.
Relevant for our basic/validation and methods like history, which
will end up returning a MagicMock instead of a DataFrame. | 625941e8fbf16365ca6f664a |
def run_game(): <NEW_LINE> <INDENT> correct = False <NEW_LINE> code = create_code() <NEW_LINE> show_instructions() <NEW_LINE> turns = 0 <NEW_LINE> while not correct and turns < 12: <NEW_LINE> <INDENT> correct_digits_only, correct_digits_and_position = take_turn(code) <NEW_LINE> turns += 1 <NEW_LINE> correct = check_c... | Main function for running the game | 625941e86fece00bbac2dbc0 |
def check_table(db, tablename): <NEW_LINE> <INDENT> cur_ = db.cursor() <NEW_LINE> query = "SELECT * FROM information_schema.tables WHERE table_name = '{}' LIMIT 1;".format(tablename) <NEW_LINE> cur_.execute(query) <NEW_LINE> is_exist = cur_.fetchone() <NEW_LINE> db.commit() <NEW_LINE> cur_.close() <NEW_LINE> if is_exis... | check if table exist or not | 625941e863f4b57ef0001588 |
def _handle_result(self, target, func_name, func_opts, result): <NEW_LINE> <INDENT> alert_emails = func_opts.get('alert_emails', []) <NEW_LINE> if alert_emails in [False, None]: <NEW_LINE> <INDENT> alert_emails = models.Check.NO_EMAIL_FLAG <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> alert_emails = ",".join(alert_emai... | handle salt check result and stores results to database. | 625941e8f7d966606f6aa486 |
def read(self, size): <NEW_LINE> <INDENT> tmp = self._b[self._pos: self._pos + size] <NEW_LINE> self._pos += size <NEW_LINE> return tmp | If all bytes are read the function returns b''. | 625941e8a8ecb033257d3547 |
def __init__(self, data, messagetype=LTDATA, ses=None): <NEW_LINE> <INDENT> self.session = ses <NEW_LINE> self.data = data <NEW_LINE> self.type = messagetype | Initialize.
@param data: the message string
@type data: string
@param messagetype: the message type (use a constant defined in ui.ui)
@type messagetype: int
@param ses: the session this message belongs to
@type ses: session.Session | 625941e81f5feb6acb0c4fc6 |
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <... | Returns the model properties as a dict | 625941e81f5feb6acb0c4fc5 |
def parse_item(self, item): <NEW_LINE> <INDENT> item = item.decode("utf-8") <NEW_LINE> try: <NEW_LINE> <INDENT> parsed_item = json.loads(item) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> parsed_item = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._parsed_logs.append(parsed_item) <NEW_LINE> <DED... | :param item: str, json-encoded string | 625941e8507cdc57c6307161 |
def select_line(self, object, name, old, visible_lines): <NEW_LINE> <INDENT> newset = set(visible_lines) <NEW_LINE> cv = self.control_view <NEW_LINE> if cv.line_to_edit: <NEW_LINE> <INDENT> fullset = newset.union(set([cv.line_toedit])) <NEW_LINE> cv.on_trait_change(self.select_line, name='visible_lines', remove=True) <... | Called when controlview.visible_lines changes in order to actually
change the visibility of the lines. Need to make sure the new list
includes the selected lines which means if someone unchecks it we have
to not only make it visible but add it to visible lines which will
re-call this method | 625941e882261d6c526ab922 |
def _compare_lists(path, src, dst, optimization=True): <NEW_LINE> <INDENT> patch = list(_compare(path, src, dst, *_split_by_common_seq(src, dst))) <NEW_LINE> if optimization: <NEW_LINE> <INDENT> return list(_optimize(patch)) <NEW_LINE> <DEDENT> return patch | Compares two lists objects and return JSON patch about. | 625941e899cbb53fe6793061 |
def url_to_slug(self, url): <NEW_LINE> <INDENT> url = url.replace('.atom', '') <NEW_LINE> url = url.replace('.rss', '') <NEW_LINE> url = url.replace('.xml', '') <NEW_LINE> url = url.replace('http', '') <NEW_LINE> slug = slugify(url) <NEW_LINE> return slug | Turn a feed url into a string we can use as a filename.
>>> args = build_parser([])
>>> rf = RecentFeed(args)
>>> rf.url_to_slug('http://extras.denverpost.com/app/bill-tracker/updates.atom')
'extras-denverpost-com-app-bill-tracker-updates' | 625941e826238365f5f0f2f1 |
def id_rule(self): <NEW_LINE> <INDENT> multiplier = self.multiplier <NEW_LINE> last_num = self.last_num <NEW_LINE> id_num = self.id_num <NEW_LINE> temp = zip(id_num[0:17],multiplier[0:17]) <NEW_LINE> mult_id = map(lambda x:int(x[0])*x[1],temp) <NEW_LINE> sum_id = sum(mult_id) <NEW_LINE> if last_num[sum_id%11]==id_num[-... | 身份证校验位规则 | 625941e84428ac0f6e5bac72 |
@login_required <NEW_LINE> def create_pseudofolder(request, container, prefix=None): <NEW_LINE> <INDENT> storage_url = get_endpoint(request, 'adminURL') <NEW_LINE> auth_token = get_token_id(request) <NEW_LINE> http_conn = client.http_connection(storage_url, insecure=settings.SWIFT_INSECURE) <NEW_LINE> form = PseudoFold... | Creates a pseudofolder (empty object of type application/directory) | 625941e87d43ff24873a3120 |
def get_tasks_by_tag_id(self, tag_id): <NEW_LINE> <INDENT> tasks = self.client.tasks.find_all( { 'tag': tag_id, 'completed_since': self.current_date } ) <NEW_LINE> return tasks | Performs tasks query with searched by ASANA_TAG_ID
Mathias Ssenabulya
Workspace_ID = 1968482998660
[{'id': 14410378551182, 'name': 'Most Important This Week'},
{'id': 14423571806636, 'name': 'Most Important Today'},
{'id': 28211362476024, 'name': 'Next Important This Week'}] | 625941e8be383301e01b58f9 |
def change_relationships(line_id, split_half, genotype): <NEW_LINE> <INDENT> LOGGER.debug(WRITE['DELREL'], line_id, line_id) <NEW_LINE> try: <NEW_LINE> <INDENT> CURSOR['sage'].execute(WRITE['DELREL'], (line_id, line_id)) <NEW_LINE> <DEDENT> except Exception as exc: <NEW_LINE> <INDENT> template = "An exception of type {... | Change a line's relationships
Keyword arguments:
line_id: line ID
split_half: split half dictionary
genotype: line genotype
Returns 1 for success, 0 for failure | 625941e826068e7796caf162 |
def get_database(self, name='presentations.db'): <NEW_LINE> <INDENT> if name not in self._databases: <NEW_LINE> <INDENT> self._databases[name] = QtDBConnector(self.get_filepath(name), PluginManager(self)) <NEW_LINE> <DEDENT> return self._databases[name] | Returns an instance of QtDBConnector for a specific database file.
It is also cached for future gets. | 625941e8d268445f265b52eb |
def getAccentWeight(self, qLenPos, level=0, forcePositionMatch=False, permitMeterModulus=False): <NEW_LINE> <INDENT> minWeight = min( [mt.weight for mt in self.accentSequence._partition]) * .5 <NEW_LINE> msLevel = self.accentSequence.getLevel(level) <NEW_LINE> if forcePositionMatch: <NEW_LINE> <INDENT> localSpan = msLe... | Given a qLenPos, return an accent level. In general, accents are assumed to define only a first-level weight.
If `forcePositionMatch` is True, an accent will only be returned if the provided qLenPos is a near exact match to the provided quarter length. Otherwise, half of the minimum quarter length will be provided.
... | 625941e8236d856c2ad44c5d |
def _read_hex(self): <NEW_LINE> <INDENT> self.read(1) <NEW_LINE> word = b'' <NEW_LINE> while True: <NEW_LINE> <INDENT> c = self.peek() <NEW_LINE> if c and c in HEXDIGITS: <NEW_LINE> <INDENT> word += self.read(1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> return word | Read hexadecimal literal. | 625941e815baa723493c43f5 |
def _sort_for_spark(ds): <NEW_LINE> <INDENT> return ( sorted( sorted( sorted( ds, key=_attempt_num, reverse=True), key=_container_num), key=_step_sort_key, reverse=True)) | Sort the given list/sequence of dicts in forward order by task/container
ID, with most recent attempts first. This is used for finding errors on
Spark, see #2056. | 625941e826068e7796caf163 |
def symmetric_orthogonalization(x): <NEW_LINE> <INDENT> m = tf.reshape(x, (-1, 3, 3)) <NEW_LINE> _, u, v = tf.svd(m) <NEW_LINE> det = tf.linalg.det(tf.matmul(u, v, transpose_b=True)) <NEW_LINE> r = tf.matmul( tf.concat([u[:, :, :-1], u[:, :, -1:] * tf.reshape(det, [-1, 1, 1])], 2), v, transpose_b=True) <NEW_LINE> retur... | Maps 9D input vectors onto SO(3) via symmetric orthogonalization. | 625941e891f36d47f21ac974 |
def _drag_start(x, y, evt): <NEW_LINE> <INDENT> editor.on_click(evt) | begin mouse interaction | 625941e81f037a2d8b94667a |
def delete_user_auth(user_auth_id): <NEW_LINE> <INDENT> return db_instance.delete(UserAuth, user_auth_id) | 删除信息
:param user_auth_id:
:return: Number of affected rows (Example: 0/1)
:except: | 625941e8e5267d203edce114 |
def __sub__(self, value): <NEW_LINE> <INDENT> return self._change(-value) | Subtract value from counter.
Returns:
An integer indicating the new count after the change. | 625941e8d10714528d600165 |
def build_image_from_markov(probs, nodes, flatten_img_size): <NEW_LINE> <INDENT> new_c = np.zeros(flatten_img_size) <NEW_LINE> first_pixel = np.random.choice(nodes) <NEW_LINE> new_c[0] = first_pixel <NEW_LINE> x = np.where(nodes==first_pixel)[0][0] <NEW_LINE> for i, _ in enumerate(new_c[1:]): <NEW_LINE> <INDENT> next_p... | Uses the markov chain to generate an flattened image | 625941e8cc0a2c11143dd30f |
def switch_tab(driver, tab_name, number=1): <NEW_LINE> <INDENT> handles = driver.window_handles <NEW_LINE> repeat_counts = 0 <NEW_LINE> for single_handle in handles: <NEW_LINE> <INDENT> driver.switch_to_window(single_handle) <NEW_LINE> if tab_name.lower() in driver.title.lower(): <NEW_LINE> <INDENT> repeat_counts += 1 ... | Switch the focused tab in browser
Args:
driver: The browser driver
tab_name: The key name of the tab you want to switch. It can be the part of the full title.
number: When more than 1 tab have the `tab_name`, indicate the sequence number of the tab you want to switch. | 625941e80383005118ecfa5e |
def InitCL(GPU=0): <NEW_LINE> <INDENT> platform, device, context, queue = None, None, None, None <NEW_LINE> for iplatform in range(3): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> platform = cl.get_platforms()[iplatform] <NEW_LINE> if (GPU>0): <NEW_LINE> <INDENT> device = platform.get_devices(cl.device_type.GPU) <NEW... | Initialise the OpenCL environment.
Usage:
platform, device, context, queue, cl.mem_flags = InitCL(GPU=0)
Input:
GPU = if 1, try to get a GPU device, otherwise get a CPU device (default=0)
Return:
OpenCL platform, device, context, and queue and the flags object.
If no valid devices are found, values a... | 625941e8627d3e7fe0d692ce |
def make_loader(dataset, sample_size=None, batch_size=10, sampler=None, **kwargs): <NEW_LINE> <INDENT> if isinstance(dataset, torch.Tensor): <NEW_LINE> <INDENT> dataset = torch.utils.data.TensorDataset(dataset) <NEW_LINE> <DEDENT> if sampler is None: <NEW_LINE> <INDENT> if sample_size is not None: <NEW_LINE> <INDENT> i... | Utility for creating a dataloader on fixed sample subset. | 625941e83d592f4c4ed1d4de |
def _stop_exp(self): <NEW_LINE> <INDENT> self.queue_tx.put('Print last') <NEW_LINE> with self.dataLock: <NEW_LINE> <INDENT> self.end_experiment.set() <NEW_LINE> <DEDENT> logging.info('before the led_end_experiment_signal, time: {0}, thread: {1}'.format(time.time(), threading.current_thread())) <NEW_LINE> self._led_end_... | it makes print the last modulation results | 625941e860cbc95b062c69c0 |
def update_qconfig_for_fusion( model: GraphModule, qconfig_dict: Any, ) -> Any: <NEW_LINE> <INDENT> object_type_dict = qconfig_dict.get("object_type", None) <NEW_LINE> if object_type_dict is None: <NEW_LINE> <INDENT> return qconfig_dict <NEW_LINE> <DEDENT> modules = dict(model.named_modules()) <NEW_LINE> for node in mo... | Update the qconfig_dict to account for fused modules such as LinearReLU. | 625941e8851cf427c661a988 |
def __init__(self, weights=None): <NEW_LINE> <INDENT> self.weights = weights <NEW_LINE> if weights is None: <NEW_LINE> <INDENT> input_tensor = Input(shape=(299, 299, 3)) <NEW_LINE> base_model = InceptionV3( input_tensor=input_tensor, weights='imagenet', include_top=True ) <NEW_LINE> self.model = Model( input=base_model... | Either load pretrained from imagenet, or load our saved
weights from our own training. | 625941e8d6c5a102081444cb |
def umfpack_dl_get_numeric(*args): <NEW_LINE> <INDENT> return __umfpack.umfpack_dl_get_numeric(*args) | umfpack_dl_get_numeric(UF_long Lp, UF_long Lj, double Lx, UF_long Up, UF_long Ui,
double Ux, UF_long P, UF_long Q, double Dx,
UF_long do_recip, double Rs, void Numeric) -> UF_long | 625941e84f6381625f114eb8 |
def age_check( parameter_value: int, parameter_name: str): <NEW_LINE> <INDENT> if (parameter_value is None): <NEW_LINE> <INDENT> raise ValueError(f"{parameter_name} cannot be None") <NEW_LINE> <DEDENT> elif (parameter_value <= 0): <NEW_LINE> <INDENT> raise ValueError(f"{parameter_name} cannot be zero or negative") <NEW... | Perform basic parameter checks for an age `int` parameter. This ranges from checking for `None`, negative values, bigger than, etc.
Parameters
----------
`parameter_value` : int
the parameter's value. in terms of a person's age
`parameter_name` : str
the parameter's name | 625941e8377c676e91272624 |
def checkKey(self): <NEW_LINE> <INDENT> if self.isClosed(): <NEW_LINE> <INDENT> raise GraphicsError("checkKey in closed window") <NEW_LINE> <DEDENT> self.update() <NEW_LINE> return self.lastKey | Return last key pressed or None if no key pressed since last call | 625941e8b7558d58953c5387 |
def before_first(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Positions the scan before its first record. | 625941e8bde94217f368326a |
def map(fn, parser: Parser) -> Parser: <NEW_LINE> <INDENT> def parser_(st: ST) -> Tuple[ST, list]: <NEW_LINE> <INDENT> st, x = parser(st) <NEW_LINE> return st, fn(x) <NEW_LINE> <DEDENT> return parser_ | Aplica a função no resultado obtido pelo parser. | 625941e8091ae356686673d3 |
def generate_mma_template(self): <NEW_LINE> <INDENT> return { '_id': to_md5_hexdigest(self.youtube_url), 'projectId': self.projectId, 'fullCameraLocationMd5': to_md5_hexdigest(self.fullCameraLocation), '$set': { 'modifiedBy': self.userId, 'type': 'MovingImage', 'date_time_original': self.video_org_datetime.strftime("%Y... | create mma json template
Args:
None
Return:
None | 625941e892d797404e304609 |
def _obtain_access_token(self): <NEW_LINE> <INDENT> encoded_bearer = base64.b64encode(('%s:%s' % ( env.client_key, env.client_secret)).encode("utf-8")) <NEW_LINE> headers = {"User-Agent": env.user_agent, "Authorization": "Basic %s" % encoded_bearer.decode( "utf-8"), "Content-Type": "application/x-www-form-urlencoded;" ... | @todo token may get expired | 625941e867a9b606de4a8334 |
def parse(start_symbol, text, grammar): <NEW_LINE> <INDENT> tokenizer = grammar[' '] + '(%s)' <NEW_LINE> @memo <NEW_LINE> def parse_sequence(sequence, text): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for atom in sequence: <NEW_LINE> <INDENT> tree, text = parse_atom(atom, text) <NEW_LINE> if text is None: return Fail <... | Example call: parse('Exp', '3*x + b', G).
Returns a (tree, remainder) pair. If remainder is '', it parsed the whole
string. Failure iff remainder is None. This is a deterministic PEG parser,
so rule order (left-to-right) matters. Do 'E => T op E | T', putting the
longest parse first; don't do 'E => T | T op E'
Also, no... | 625941e84c3428357757c7a2 |
def export_mappers(self): <NEW_LINE> <INDENT> export_wiz = self.env['export.webservice.mapper'].create({}) <NEW_LINE> export_files = self.env['export.webservice.file'] <NEW_LINE> for rec in self: <NEW_LINE> <INDENT> file_data, file_name = rec.get_export_data() <NEW_LINE> export_wiz.file_ids += export_files.create({ 'fi... | Creates the files and open the wizard to download them | 625941e8ac7a0e7691ed4541 |
def isComplete(): <NEW_LINE> <INDENT> pass | Whether this instance of Maya is 'Unlimited' (deprecated)
:rtype: bool | 625941e8091ae356686673d4 |
def complete(self): <NEW_LINE> <INDENT> self.transfer_followers_to_children() <NEW_LINE> self.kill() <NEW_LINE> for child in self.children: <NEW_LINE> <INDENT> child.is_archived = False <NEW_LINE> child.is_visible = True | Do the steps to mark a contract as complete
1. Transfer the followers to children
2. Modify description to make contract explicitly completed/archived
3. Mark self as archived and not visible
4. Mark children as not archived and visible | 625941e8f9cc0f698b140a74 |
def top_network_plot(self, top = 100, file = 'panda_top_100.png'): <NEW_LINE> <INDENT> subset_panda_results = self.panda_results.sort(['force'], ascending = [0]) <NEW_LINE> subset_panda_results = subset_panda_results[subset_panda_results.tf != subset_panda_results.gene] <NEW_LINE> subset_panda_results = subset_panda_re... | Select top genes. | 625941e8fff4ab517eb2f8bc |
def filter_multiple(self, *keys: str, mode: FilterMode) -> FilterType: <NEW_LINE> <INDENT> patterns_for_keys = [self.patterns_with_key(key) for key in keys] <NEW_LINE> sets_of_files = [ set(self.files_with_patterns(*patterns)) for patterns in patterns_for_keys ] <NEW_LINE> if mode is self.FilterMode.UNION: <NEW_LINE> <... | Filters files by multiple keys from the PATTERNS dict.
Mode determines aggregation of resulting files for every key. | 625941e8f9cc0f698b140a75 |
@app.route("/connect", methods=['POST', 'GET']) <NEW_LINE> def connect_instrument(): <NEW_LINE> <INDENT> global rm <NEW_LINE> global instruments <NEW_LINE> data = '' <NEW_LINE> errors = '' <NEW_LINE> address = '' <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> post = request.form <NEW_LINE> if 'address' in ... | create a visa resource for the instrument and store it in the
instruments/instruments_address arrays | 625941e815fb5d323cde0f93 |
def settings(self): <NEW_LINE> <INDENT> self.manager.transition.direction = "left" <NEW_LINE> self.manager.current = "settings_page" | Go to settings page.
Args:
None | 625941e8956e5f7376d712e9 |
def _parse_specline(specline: str) -> OptionSpec: <NEW_LINE> <INDENT> tokens = _parse_specline_tokens(specline) <NEW_LINE> required = False <NEW_LINE> type_value = str <NEW_LINE> default = None <NEW_LINE> is_list = False <NEW_LINE> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> attr_name = next(tokens) <NEW_L... | Parse a spec line
Parameters
----------
specline : str
spec line to parse
Returns
-------
NamedTuple
fields required, type, default, and list | 625941e8462c4b4f79d1db4d |
def expr3(self): <NEW_LINE> <INDENT> token = self.cur_token <NEW_LINE> if token.type == TokenType.ADD: <NEW_LINE> <INDENT> self.check_token_type(TokenType.ADD) <NEW_LINE> return UnaryOp(token, self.expr3()) <NEW_LINE> <DEDENT> if token.type == TokenType.SUB: <NEW_LINE> <INDENT> self.check_token_type(TokenType.SUB) <NEW... | expr3: ADD expr3 |
SUB expr3 |
OPAR expr1 CPAR |
variable |
num | 625941e88da39b475bd653f7 |
def unfollow(network, arg1, arg2): <NEW_LINE> <INDENT> list_l = [] <NEW_LINE> for k in d: <NEW_LINE> <INDENT> if arg1 in d[k]: <NEW_LINE> <INDENT> list_l.append(k) <NEW_LINE> <DEDENT> <DEDENT> return list_l | 3 arguments are passed to this function
network is a dictionary representing the social network
arg1 and arg2 are two people in the network
unfollow function is called when arg1 wants to stop following arg2
so, this should result in removing arg2 from the followers list of arg1
update the network dictionary and return ... | 625941e8b830903b967e9d84 |
def set_freq_ref(self, source='INT'): <NEW_LINE> <INDENT> self.setup_sequence(command='SENS:ROSC:SOUR ', val=source, list_val=['INT', 'EXT', 'EXTernal', 'INTernal']) <NEW_LINE> return self.query('SENS:ROSC:SOUR?') | Use this command to set the frequency reference source.
:param source: INTernal\INT, EXTernal\EXT
:return: the current setting(EXT, INT) | 625941e8167d2b6e31219012 |
def __init__( self, parent=None, classifierFile=None, recognizerFile=None, namesFile=None, trainingSourceFolder=None, videoDeviceIndex=0, framesPerSecond=29.97, orientation=0, callback=None): <NEW_LINE> <INDENT> from karen import __version__ <NEW_LINE> self.version = __version__ <NEW_LINE> self._packageName = "karen" <... | Watcher Initialization
Args:
classifierFile (str): Classifier file such as haarcascades to identify generic objects.
recognizerFile (str): Trained file to be used to identify specific objects. (optional)
namesFile (str): File with friendly names tied to recognizer trained data set. (optional)
trainin... | 625941e823e79379d52ee9dc |
def loopInit(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Part of the main loop, should be implemented by subclasses.
:return: | 625941e8a219f33f34628de1 |
def calculate_menu_height(self): <NEW_LINE> <INDENT> return max(2, len(self.host.interfaces)) | Calculate menu height for wid2et. | 625941e86e29344779a62a8d |
def acceleration(self, new_acc=None, from_config=False): <NEW_LINE> <INDENT> if from_config: <NEW_LINE> <INDENT> return self.config.get("acceleration", float) <NEW_LINE> <DEDENT> if new_acc is not None: <NEW_LINE> <INDENT> self.__controller.set_acceleration(self, new_acc * abs(self.steps_per_unit)) <NEW_LINE> <DEDENT> ... | <new_acc> is given in user_units/s2. | 625941e885dfad0860c3b2d9 |
def p_tagged(p): <NEW_LINE> <INDENT> if p[1].name != p[3].name: <NEW_LINE> <INDENT> p[0] = Text(p[1].raw) + p[2] + Text(p[3].raw) <NEW_LINE> return <NEW_LINE> <DEDENT> p[0] = Tagged(p[1], p[2].compress(), p[3], "".join(raw(item) for item in p[1:])) | tagged : opentag content closetag
| 625941e821a7993f00bc8175 |
@cpc_group.command('set-power-capping', options_metavar=COMMAND_OPTIONS_METAVAR) <NEW_LINE> @click.argument('CPC', type=str, metavar='CPC') <NEW_LINE> @click.option('--power-capping-state', type=click.Choice(POWER_CAPPING_STATES), required=True, help='Defines the state of power capping.') <NEW_LINE> @click.option('--po... | Set the power capping settings of a CPC.
In addition to the command-specific options shown in this help text, the
general options (see 'zhmc --help') can also be specified right after the
'zhmc' command name. | 625941e8009cb60464c6382b |
def parse_slack_output(slack_rtm_output , AT_BOT): <NEW_LINE> <INDENT> output_list = slack_rtm_output <NEW_LINE> if output_list and len(output_list) > 0: <NEW_LINE> <INDENT> for output in output_list: <NEW_LINE> <INDENT> if output and 'text' in output and AT_BOT in output['text']: <NEW_LINE> <INDENT> return output['tex... | The Slack Real Time Messaging API is an events firehose.
this parsing function returns None unless a message is
directed at the Bot, based on its ID. | 625941e87c178a314d6ef8e4 |
def get_kit_storages(self): <NEW_LINE> <INDENT> kit_storages = [] <NEW_LINE> form_uids = self.form['kit_storage_uids'].split(',') <NEW_LINE> for uid in form_uids: <NEW_LINE> <INDENT> brain = self.bsc(UID=uid)[0] <NEW_LINE> instance = brain.getObject() <NEW_LINE> if IUnmanagedStorage.providedBy(instance) ... | Take a list of UIDs from the form, and resolve to a list of Storages.
Accepts ManagedStorage, UnmanagedStorage, or StoragePosition UIDs. | 625941e88c3a87329515883e |
def create_scraper(session=None): <NEW_LINE> <INDENT> sess = session or requests.session() <NEW_LINE> adapter = CloudflareAdapter() <NEW_LINE> sess.mount("http://", adapter) <NEW_LINE> sess.mount("https://", adapter) <NEW_LINE> return sess | Convenience function for creating a ready-to-go requests.Session object.
You may optionally pass in an existing Session to mount the CloudflareAdapter to it. | 625941e810dbd63aa1bd3020 |
def testDefaultFields_Enum(self): <NEW_LINE> <INDENT> class Symbol(messages.Enum): <NEW_LINE> <INDENT> ALPHA = 1 <NEW_LINE> BETA = 2 <NEW_LINE> GAMMA = 3 <NEW_LINE> <DEDENT> field = messages.EnumField(Symbol, 1, default=Symbol.ALPHA) <NEW_LINE> self.assertEquals(Symbol.ALPHA, field.default) | Test the default for enum fields. | 625941e8a05bb46b383ecc9b |
def __getitem__(id): <NEW_LINE> <INDENT> pass | Returns a child object given a child id. If there is no child
with the given id, a KeyError is raised. This method makes it easy
to refer to children that have id with file extensions. For
example::
page=folder['index.html']
Note: this function only finds children; it doesn't return
properties or other non-child at... | 625941e8796e427e537b0a48 |
def __init__(self, threshold=0.15, max_depth=10, eta=0.05, gamma=0.1, silent=1, min_child_weight=1, subsample=0.8, colsample_bytree=1, booster='gbtree', objective='binary:logistic', eval_metric='auc'): <NEW_LINE> <INDENT> self.threshold = threshold <NEW_LINE> self.max_depth = max_depth <NEW_LINE> self.eta = eta <NEW_LI... | :param threshold: The critical point of normal.
:param max_depth: Maximum tree depth for base learners.
:param eta: Value means model more robust to overfitting but slower to compute.
:param gamma: Minimum loss reduction required to make a further partition on a leaf node of the tree.
:param silent: If 1, it will print... | 625941e821a7993f00bc8176 |
def to_halfwidth(text): <NEW_LINE> <INDENT> res = '' <NEW_LINE> for char in text: <NEW_LINE> <INDENT> inside_code = ord(char) <NEW_LINE> if inside_code == 0x3000: <NEW_LINE> <INDENT> inside_code = 0x0020 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> inside_code -= 0xfee0 <NEW_LINE> <DEDENT> if inside_code < 0x0020 or i... | 将文本中的全角字符转换为半角字符 | 625941e8e1aae11d1e74a13a |
def fit_transform(self, X, y=None, sample_weight=None): <NEW_LINE> <INDENT> X = check_array(X, accept_sparse=['csc']) <NEW_LINE> if issparse(X): <NEW_LINE> <INDENT> X.sort_indices() <NEW_LINE> <DEDENT> rnd = check_random_state(self.random_state) <NEW_LINE> y = rnd.uniform(size=X.shape[0]) <NEW_LINE> super().fit(X, y, s... | Fit estimator and transform dataset.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Input data used to build forests. Use ``dtype=np.float32`` for
maximum efficiency.
sample_weight : array-like, shape = [n_samples] or None
Sample weights. If None, then samples are equ... | 625941e856ac1b37e6264644 |
def select_low_importance_feature(feature_names_, feature_importances_, threshold_=0.01): <NEW_LINE> <INDENT> return np.array(feature_names_)[np.where(feature_importances_ < threshold_)[0]].tolist() | return a list of feature names that has feature_importances smaller than threthold
:param feature_names_: a list of feature_names
:param feature_importances: a list/array of feature importances (which has the same length as feature_names)
:param threshold_: threshold of selection | 625941e8a4f1c619b28b04ac |
def is_identifier(s): <NEW_LINE> <INDENT> return IDENTIFIER.match(s) is not None | Check whether a variable name is a proper identifier.
:param s: variable
:return: True if variable is an identifier. | 625941e8956e5f7376d712ea |
def test_predict_length(): <NEW_LINE> <INDENT> model = ARIMA(data=data, ar=2, ma=2, family=Laplace()) <NEW_LINE> x = model.fit() <NEW_LINE> assert(model.predict(h=5).shape[0] == 5) | Tests that the prediction dataframe length is equal to the number of steps h | 625941e80c0af96317bb8665 |
def _wrap_text(text: str, words_per_line=20) -> str: <NEW_LINE> <INDENT> text = text.replace('\r', '') <NEW_LINE> text = text.replace('\n', '') <NEW_LINE> wordlist = text.split() <NEW_LINE> result = [] <NEW_LINE> for i, word in enumerate(wordlist): <NEW_LINE> <INDENT> if i % words_per_line == 0 and i != 0: <NEW_LINE> <... | Takes a block of text which may or may not have newlines in it and formats it
so that it contains occasional, sensical newlines. | 625941e896565a6dacc8fb48 |
def configure_methods(mol): <NEW_LINE> <INDENT> import ipywidgets as ipy <NEW_LINE> children = [] <NEW_LINE> if mol.energy_model: <NEW_LINE> <INDENT> children.append(mol.energy_model.configure()) <NEW_LINE> <DEDENT> if mol.integrator: <NEW_LINE> <INDENT> children.append(mol.integrator.configure()) <NEW_LINE> <DEDENT> r... | Interactively configure this molecule's simulation methods (notebooks only)
Returns:
ipywidgets.Box: configuration widget | 625941e8fbf16365ca6f664b |
def load_data(df: DataFrame, output_path: str) -> None: <NEW_LINE> <INDENT> df.write.mode("overwrite").save(output_path) | Load the aggregated book revie data into a S3 bucket
Arguments:
output_path (str): AWS S3 bucket for writing processed data | 625941e8fb3f5b602dac3b16 |
def insertTreePARTY(party): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> size = 0 <NEW_LINE> BT = DSABinaryTrees() <NEW_LINE> if party == "A": <NEW_LINE> <INDENT> party = "LP" <NEW_LINE> <DEDENT> elif party == "B": <NEW_LINE> <INDENT> party = "ALP" <NEW_LINE> <DEDENT> elif party == "C": <NEW_LINE> <INDENT> party = "GRN" <NEW_L... | Inserting items by party to a Binary Tree and preorder display.
Keyword arguments:
party -- chosen party
order -- order is default by surname | 625941e8d4950a0f3b08c7c7 |
def index(self, row, column, parent = QModelIndex()): <NEW_LINE> <INDENT> return QModelIndex() | QModelIndex Akonadi.EntityTreeModel.index(int row, int column, QModelIndex parent = QModelIndex()) | 625941e8187af65679ca559e |
def stop(self): <NEW_LINE> <INDENT> return _gnuradio_core_filter.gr_hilbert_fc_sptr_stop(self) | stop(self) -> bool | 625941e876d4e153a657efb1 |
def get_access_control_string(self, information=SecurityInformation.OWNER | SecurityInformation.GROUP | SecurityInformation.DACL): <NEW_LINE> <INDENT> if os.path.exists(self.original_path): <NEW_LINE> <INDENT> if isinstance(information, SecurityInformation): <NEW_LINE> <INDENT> information = information.value <NEW_LINE... | fi.get_access_control_string([information]) -> int or a SECURITY string
Gets a string thats represent the access control for the file or directory described by the current FileInfo object.
If non-WinNT system, return os.stat() of self.original_path, else return SECURITY string, returned by GetFileSecurity(self.original... | 625941e824f1403a92600fe0 |
def options(option_list, arg_desc="arg"): <NEW_LINE> <INDENT> if not isinstance(option_list, list): <NEW_LINE> <INDENT> option_list = [option_list] <NEW_LINE> <DEDENT> def option_setup(func): <NEW_LINE> <INDENT> option_parser = OptionParser() <NEW_LINE> for option in option_list: <NEW_LINE> <INDENT> option_parser.add_o... | Used as a decorator and passed a list of optparse-style options,
alters a cmd2 method to populate its ``opts`` argument from its
raw text argument.
Example: transform
def do_something(self, arg):
into
@options([make_option('-q', '--quick', action="store_true",
help="Makes things fast")],
"source d... | 625941e863f4b57ef000158a |
def setup(bot): <NEW_LINE> <INDENT> bot.add_cog(Teams(bot)) | Adds this cog to the main bot | 625941e8a8ecb033257d3549 |
def test_prefix(self): <NEW_LINE> <INDENT> g = compile(r'(hello\ world|something\ else)') <NEW_LINE> m = g.match_prefix('hello world') <NEW_LINE> self.assertTrue(isinstance(m, Match)) <NEW_LINE> m = g.match_prefix('he') <NEW_LINE> self.assertTrue(isinstance(m, Match)) <NEW_LINE> m = g.match_prefix('') <NEW_LINE> self.a... | Test `match_prefix`. | 625941e832920d7e50b28652 |
def _load_context(self): <NEW_LINE> <INDENT> log.debug("Loading context for plugin execution") <NEW_LINE> self._context = ContextLoader(self._config_overrides()).load() | Set the context of the execution.
It should be called only from the plugin manager once
it has the context loaded. | 625941e8a8ecb033257d354a |
def nextGen(self): <NEW_LINE> <INDENT> self.current_gen += 1 <NEW_LINE> self.change_gen[self.current_gen % 3] = copy.copy(self.grid) <NEW_LINE> grid_cp = copy.copy(self.grid) <NEW_LINE> for cell in self.grid: <NEW_LINE> <INDENT> y, x = cell <NEW_LINE> y1 = (y - 1) % self.y_grid <NEW_LINE> y2 = (y + 1) % self.y_grid <NE... | Decide the fate of the cells | 625941e882261d6c526ab925 |
def __init__(self, gateway): <NEW_LINE> <INDENT> self.gateway = gateway | Init. | 625941e8e64d504609d74cbe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.