code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def login(self): <NEW_LINE> <INDENT> self.client.login(**self.credentials)
Login the test user.
625941d5e5267d203edcdea7
def some(seq): <NEW_LINE> <INDENT> for e in seq: <NEW_LINE> <INDENT> if e: <NEW_LINE> <INDENT> return e <NEW_LINE> <DEDENT> <DEDENT> return False
Renvoit un élément de la liste qui est True.
625941d5b545ff76a8914022
@task <NEW_LINE> def pre_index(new_index, old_index, alias, index_name, settings): <NEW_LINE> <INDENT> indexer = INDEXER_MAP[index_name] <NEW_LINE> _print('Flagging the database to start the reindexation.', alias) <NEW_LINE> Reindexing.flag_reindexing(new_index=new_index, old_index=old_index, alias=alias) <NEW_LINE> ti...
This sets up everything needed before indexing: * Flags the database. * Creates the new index.
625941d567a9b606de4a80c5
def get_at_index(self, index: int) -> object: <NEW_LINE> <INDENT> return self.data[index]
Return value of element at a given index
625941d5091ae35668667168
def authorized(self, allowed_roles, resource, method): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> token = request.headers.get('Authorization').split(' ')[1] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> token = None <NEW_LINE> <DEDENT> return self.check_auth(token, allowed_roles, resource, method)
Validates the the current request is allowed to pass through. :param allowed_roles: allowed roles for the current request, can be a string or a list of roles. :param resource: resource being requested.
625941d5fb3f5b602dac38a1
def question3c(): <NEW_LINE> <INDENT> answerDiscount = 0.9 <NEW_LINE> answerNoise = 0 <NEW_LINE> answerLivingReward = 0.0 <NEW_LINE> return answerDiscount, answerNoise, answerLivingReward
No noise makes the agent confident. No living reward allows it to choose an arbitrarily long path
625941d5d99f1b3c44c67799
def add_tablest(self, tid, x, y, comment=''): <NEW_LINE> <INDENT> table = TABLEST(tid, x, y, comment=comment) <NEW_LINE> self._add_table_object(table) <NEW_LINE> return table
Creates an TABLEST card
625941d5ad47b63b2c50a18c
def is_valid(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.validate(value) <NEW_LINE> return True <NEW_LINE> <DEDENT> except (ValidationError, ValueError): <NEW_LINE> <INDENT> return False
Check if the value is valid. :return: ``True`` if the value is valid, ``False`` if invalid.
625941d54527f215b584c662
def _get_project_id_from_service_account_email(service_account_email: str) -> str: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return service_account_email.split('@')[1].split('.')[0] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> raise AirflowException( f"Could not extract project_id from service account'...
Extracts project_id from service account's email address. :param service_account_email: email of the service account. :type service_account_email: str :return: Returns the project_id of the provided service account. :rtype: str
625941d5851cf427c661a71a
def get_daemon_admin_socket(self): <NEW_LINE> <INDENT> return "/var/run/ceph/cephfs-mirror.asok"
overloaded by teuthology override (fs/mirror/clients/mirror.yaml)
625941d563f4b57ef0001322
def show_edges(filename): <NEW_LINE> <INDENT> pgm = util.PGM(filename) <NEW_LINE> img8 = cv.CreateImage((1280,960), 8, 1) <NEW_LINE> cv.ConvertScale(pgm.img, img8, scale=1.0/256) <NEW_LINE> edge1 = cv.CreateImage((1280,960), 8, 1) <NEW_LINE> cv.Canny(img8, edge1, 250, 255, 5) <NEW_LINE> edgecolor = cv.CreateImage((1280...
show ediges in an image
625941d5498bea3a759b9cbb
def firstpl() -> int: <NEW_LINE> <INDENT> import random <NEW_LINE> p1 = 0 <NEW_LINE> p2 = 0 <NEW_LINE> while p1 == p2: <NEW_LINE> <INDENT> p1 = random.randint(1, 99) <NEW_LINE> p2 = random.randint(1, 99) <NEW_LINE> <DEDENT> if p2 > p1: <NEW_LINE> <INDENT> return 2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 1
Procédure pour choisir le premier joueur si les joueurs sont 'humain'. La fonction prendre aucune input mais return 1 si le gagneur et le 1er joueur ou 2 pour le 2eme.
625941d55fdd1c0f98dc0440
def _select_in_voltage_range(self, min_voltage=None, max_voltage=None): <NEW_LINE> <INDENT> min_voltage = min_voltage if min_voltage is not None else self.min_voltage <NEW_LINE> max_voltage = max_voltage if max_voltage is not None else self.max_voltage <NEW_LINE> return list(filter(lambda p: min_voltage <= p.voltage <=...
Selects VoltagePairs within a certain voltage range. Args: min_voltage (float): The minimum allowable voltage for a given step. max_voltage (float): The maximum allowable voltage allowable for a given step. Returns: A list of VoltagePair objects
625941d5d58c6744b4257e6b
def load_miyawaki_masked(): <NEW_LINE> <INDENT> pass
See http://nilearn.github.io/auto_examples/02_decoding/plot_miyawaki_reconstruction.html#sphx-glr-auto-examples-02-decoding-plot-miyawaki-reconstruction-py
625941d53c8af77a43ae39ae
@require_arg <NEW_LINE> @numeric <NEW_LINE> def cmd_frequency(value): <NEW_LINE> <INDENT> config.set('frequency', value) <NEW_LINE> cli.print_settings()
Define a frequência de atualização para X Hz
625941d530bbd722463cbfd4
def copy(self, new_path): <NEW_LINE> <INDENT> new_path = abspath(new_path) <NEW_LINE> if not self.is_link(): <NEW_LINE> <INDENT> shutil.copytree(self._path, new_path) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> shutil.copy(self._path, new_path) <NEW_LINE> <DEDENT> return Directory(new_path)
return copy with new path (including renaming)
625941d54f6381625f114c48
def __getitem__(self, indx): <NEW_LINE> <INDENT> if isinstance(indx, slice): <NEW_LINE> <INDENT> if indx.step is not None and indx.step != 1: <NEW_LINE> <INDENT> raise NotImplementedError("Only step == 1 are supported.") <NEW_LINE> <DEDENT> start, stop, _ = indx.indices(len(self.text)) <NEW_LINE> if stop < start: <NEW_...
Get a slice of the text
625941d5fb3f5b602dac38a2
def configure(self, node): <NEW_LINE> <INDENT> config = self.xmpp['xep_0004'].Form() <NEW_LINE> config['type'] = 'submit' <NEW_LINE> for field, value in self.profile.items(): <NEW_LINE> <INDENT> config.add_field(var=field, value=value) <NEW_LINE> <DEDENT> return self.xmpp['xep_0060'].set_node_config(None, node, config,...
Update a node's configuration to match the public storage profile.
625941d5167d2b6e31218da2
def parse_message(self, message): <NEW_LINE> <INDENT> content = sms_utilities.SMS_Parse.parse(message.getBody()) <NEW_LINE> return dict(content)
Take a FS message and return a dictionary with the keys: vbts_text vbts_tp_user_data vbts_tp_data_coding_scheme vbts_tp_protocol_id vbts_tp_dest_address vbts_tp_dest_address_type vbts_tp_message_type vbts_rp_dest_address vbts_rp_originator_address vbts_rp_originator_address_type vbts_rp_message_reference vbts_rp_messag...
625941d510dbd63aa1bd2daf
def remove_entry(self, abook_item=None, event=None, item=None): <NEW_LINE> <INDENT> if item is None: <NEW_LINE> <INDENT> item = self.tree.selection()[0] <NEW_LINE> item_id = self.tree.item(item, "values")[-1] <NEW_LINE> abook_item = search_base(self.abook, id=int(item_id))[0] <NEW_LINE> <DEDENT> ask = tkinter.messagebo...
Remove Person object from AddressBook
625941d599fddb7c1c9de59e
def yield_rst_only_markup(lines): <NEW_LINE> <INDENT> substs = [ (r":abbr:`([^`]+)`", r"\1"), (r":envvar:`([^`]+)`", r"``env[$\1]``"), (r":ref:`([^`]+)`", r"ref: *\1*"), (r":term:`([^`]+)`", r"**\1**"), (r":dfn:`([^`]+)`", r"**\1**"), (r":(samp|guilabel|menuselection|doc|file):`([^`]+)`", r"\1(`\2`)"), (r":(\w+):`([^`]...
:param file_inp: a `filename` or ``sys.stdin``? :param file_out: a `filename` or ``sys.stdout`?`
625941d5507cdc57c6306eeb
def getHypoMatrices(plainTexts, keyLengthInBytes): <NEW_LINE> <INDENT> H_all = () <NEW_LINE> for i in range(keyLengthInBytes): <NEW_LINE> <INDENT> H = genHypoMatrix(plainTexts, i) <NEW_LINE> H_all = H_all + (H,) <NEW_LINE> <DEDENT> return H_all
This function generates the hypothesis matrix of each key byte and return them as a tuple. Each element of the tuple is a hypothetical matrix. plainTextBytes = plain text numpy array keyLengthInBytes = number of bytes in the key
625941d5293b9510aa2c34a1
def _collect_imported_nodes(self): <NEW_LINE> <INDENT> return cmds.ls("temp:*", type="joint")
Only collect joints
625941d57c178a314d6ef66e
def test_show_0(self): <NEW_LINE> <INDENT> cli = self.create() <NEW_LINE> ex_o = "** class name missing **\n" <NEW_LINE> cli.onecmd("show") <NEW_LINE> self.assertEqual(ex_o, self._last_write())
Test show command without arguments
625941d5498bea3a759b9cbc
def modify(self, **kwargs): <NEW_LINE> <INDENT> pass
Alter the details or settings of the session group
625941d515fb5d323cde0d1e
def forward(self, x) -> torch.Tensor: <NEW_LINE> <INDENT> x = x.permute(0, 2, 1) <NEW_LINE> output = self.embedding(x).permute(0, 2, 1) <NEW_LINE> output, (_, _) = self.lstm(output) <NEW_LINE> return output
Parameters ---------- x: [Batch Size, Sequence Length, Features]
625941d5fbf16365ca6f63d2
def derived_state_matrix( char_matrix, ancestral_sequence=None, derived_state_alphabet=None, ignore_uncertain=True, ): <NEW_LINE> <INDENT> if derived_state_alphabet is None: <NEW_LINE> <INDENT> derived_state_alphabet = dendropy.StateAlphabet( fundamental_states="01", polymorphic_states=None, ambiguous_states=None, no_d...
Given a list of CharDataSequence objects, and a reference ancestral sequence, this returns a list of strings corresponding to the list of CharDataSequence objects, where a '0' indicates the ancestral state and '1' a derived state. e.g. Given: GGCTAATCTGA GCTTTTTCTGA GCTCTCTCTTC...
625941d5b57a9660fec33a93
def map_parallel_processes(self, fn, **sopts): <NEW_LINE> <INDENT> return self.map_processes(False, fn, **sopts)
Maps on processes started by MPI_Comm_spawn().
625941d5956e5f7376d71079
def printPreOrder(self): <NEW_LINE> <INDENT> return "(%s %s %s)" % (str(self.expr), str(self.left), str(self.right))
Metodo que transforma el contenido del objeto en la notacion prefija de operacion binaria Parameters ---------- self : ExpresionTree Se trabaja sobre el mismo objeto Return ------ Retorna la transformacion del contenido en la notacion prefija de la operacion binaria Side Effect ----------- El contenido del objet...
625941d5c432627299f04e54
def _stop_blocking_system_structures(self): <NEW_LINE> <INDENT> self._stop_kill_system_timer()
Stops all the blocking system structures. These blocking structures could create a situation where a lock would block the system.
625941d5ff9c53063f47c400
def destroy(picture, upper_left_x, upper_left_y): <NEW_LINE> <INDENT> for i in range(2 * RADIUS): <NEW_LINE> <INDENT> for j in range(2 * RADIUS): <NEW_LINE> <INDENT> x_coordinate = upper_left_x + j <NEW_LINE> y_coordinate = upper_left_y + i <NEW_LINE> if x_coordinate > WINDOW_WIDTH - 1: <NEW_LINE> <INDENT> continue <NE...
Function: destroy This fucntion is designed for the BOMB particle: If it's next to an ACID(in any of the four directions, it will destroy everything(including itself) in a radius of square. Arguments: picture -- A nested list containing what type of substance is at each position...
625941d53539df3088e2e558
def get_query_params(query_terms): <NEW_LINE> <INDENT> if isinstance(query_terms, list): <NEW_LINE> <INDENT> query_terms = '%20'.join(query_terms) <NEW_LINE> <DEDENT> elif isinstance(query_terms, str): <NEW_LINE> <INDENT> query_terms = query_terms.replace(' ', '%20') <NEW_LINE> <DEDENT> suggest_params['q'] = query_term...
format the search terms in to google get request parameters
625941d5f9cc0f698b140807
def dict_partial_from_keys(keys): <NEW_LINE> <INDENT> def dict_partial(values): <NEW_LINE> <INDENT> return dict(zip(keys, values)) <NEW_LINE> <DEDENT> return dict_partial
Return a function that constructs a dict with predetermined keys.
625941d58e7ae83300e4b1da
def to_dict(self): <NEW_LINE> <INDENT> return { 'id': self.id, 'order': self.order, 'priority': self.priority, 'content': self.content, 'duedate': str(self.duedate), 'done': self.done, }
Return the information of the event in the format of dictionary
625941d521a7993f00bc7eff
def set_location(self, file_loc): <NEW_LINE> <INDENT> self.file_loc = file_loc <NEW_LINE> self.__update_module()
Set the location of where the file exists This will update the module as well :param file_loc: string location of the file
625941d56fb2d068a760f2ad
def test_archive_name(self): <NEW_LINE> <INDENT> self.assertEquals(archive_name(self.table_name), "archive_campaign")
Test archive name
625941d51d351010ab855d29
def main(): <NEW_LINE> <INDENT> args = parse_commandline() <NEW_LINE> if args.version_debug: <NEW_LINE> <INDENT> import debuginfo <NEW_LINE> sys.stdout.write(debuginfo.version_info_string() + '\n') <NEW_LINE> sys.exit(0) <NEW_LINE> <DEDENT> check_ly() <NEW_LINE> patch_pyqt() <NEW_LINE> if args.list_sessions: <NEW_LINE>...
Main function.
625941d5b545ff76a8914023
def List_Str2Int(list): <NEW_LINE> <INDENT> listint = [float(i) for i in list] <NEW_LINE> return listint
功能:将元素为字符串的列表转换为浮点类型的列表 参数:list(元素为字符串的列表)
625941d5aad79263cf390c51
def get_namespaced_job_with_http_info(self, namespace, name, **kwargs): <NEW_LINE> <INDENT> all_params = ['namespace', 'name', 'pretty', 'export', 'exact'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(pa...
read the specified Job This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_namespaced_job_with_http_info(name...
625941d5fff4ab517eb2f649
def update_status(self): <NEW_LINE> <INDENT> self.status['temperature'] = self.read_temperature_energy_module() <NEW_LINE> self.status['filament_bias'] = self.read_filament_voltage() <NEW_LINE> self.status['sputter_current'] = self.read_sputter_current() <NEW_LINE> self.status['filament_current'] = self.read_filament_c...
Update the status of the instrument Runs a number of status queries and updates self.status :return: The direct reply from the device :rtype: str
625941d585dfad0860c3b068
@string_filter <NEW_LINE> def replace_last(val: str, seq: str, sub: str) -> str: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> before, _, after = val.rpartition(soft_str(seq)) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return val + soft_str(sub) <NEW_LINE> <DEDENT> if before: <NEW_LINE> <INDENT> return b...
Replace the last occurrence of the first argument in a string with the second argument.
625941d5566aa707497f4774
def get_eng_to_piglatin(text): <NEW_LINE> <INDENT> words = text.replace('\W', ' ').split() <NEW_LINE> pig_words = '' <NEW_LINE> for word in words: <NEW_LINE> <INDENT> word = re.sub(r'\b([aeiouhAEIOUH]\w+)', r'\1ya', word) <NEW_LINE> word = re.sub(r'\b([^aeiouhAEIOUHqQ ]+)(\w+)', r'\2\1ay', word) <NEW_LINE> word = re.su...
translate english to pig latin
625941d50a366e3fb873ea28
def _command_stager_job_finished(self, s, message): <NEW_LINE> <INDENT> if message[1] not in self._jobs: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> self._jobs[message[1]].set_stager_finished(s)
Processes the ``STAGER_JOB_FINISHED`` command. The stager server is currently doing no work for the job assigned to it. The stager server is set to have finished job. Args: s (:obj:`webarchiver.server.base.Node`): The stager server that queued the command. message (list): The command that was received...
625941d58da39b475bd65182
def normalForces(self): <NEW_LINE> <INDENT> epsilonBar = self.membraneStrain() <NEW_LINE> epsilonBar2D = voigt2D(epsilonBar) <NEW_LINE> nBar2D = self.h_th*self.D*epsilonBar2D <NEW_LINE> nBar = invVoigt2D(nBar2D, strain=False) <NEW_LINE> n = contravariantTensorToCurvilinear2D(nBar, self.A, self.A0, self.A1) <NEW_LINE> n...
Returns the normal forces of Kirchhoff--Love shell in actual configuration.
625941d566656f66f7cbc3ba
def _end_Hsp_hit_frame(self): <NEW_LINE> <INDENT> self._hsp.frame += (int(self._value),)
Frame of the database sequence if applicable (PRIVATE).
625941d54e696a04525c9659
def check(self, password, oldpassword=None, username=None): <NEW_LINE> <INDENT> c_password = ct.create_string_buffer(to_bytes(password)) <NEW_LINE> if oldpassword: <NEW_LINE> <INDENT> c_oldpassword = ct.create_string_buffer(to_bytes(oldpassword)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> c_oldpassword = oldpassword...
Check whether the password conforms to the requirements and return password strength score :arg password: password string to be checked :kwarg oldpassword: old password string (or None) for additional checks :kwarg username: user name (or None) for additional checks
625941d5f548e778e58cd78c
def _separate_evaluation_dataset(arguments, musdb_root_directory, params): <NEW_LINE> <INDENT> songs = glob(join(musdb_root_directory, _SPLIT, '*/')) <NEW_LINE> mixtures = [join(song, _MIXTURE) for song in songs] <NEW_LINE> audio_output_directory = join( arguments.output_path, _AUDIO_DIRECTORY) <NEW_LINE> separate_entr...
Performs audio separation on the musdb dataset from the given directory and params. :param arguments: Entrypoint arguments. :param musdb_root_directory: Directory to retrieve dataset from. :param params: Spleeter configuration to apply to separation. :returns: Separation output directory path.
625941d571ff763f4b54989c
def compute_local_alignment(seq_x, seq_y, scoring_matrix, alignment_matrix): <NEW_LINE> <INDENT> (score, (idx_limit, jdx_limit)) = max_in_alig_matrix(alignment_matrix) <NEW_LINE> alig_cut = [] <NEW_LINE> for num_iter in range(idx_limit+1): <NEW_LINE> <INDENT> alig_cut.append(alignment_matrix[num_iter][: jdx_limit+1]) <...
find the best local alignment by finding the max alig_matrix cell
625941d5be7bc26dc91cd80b
def __init__(self, db_set: Node = Node()): <NEW_LINE> <INDENT> assert db_set.hidden is False, 'Root Node can not be hidden' <NEW_LINE> pk_set = set() <NEW_LINE> def check_pk_unique(child, path): <NEW_LINE> <INDENT> for pk, node in child or {}: <NEW_LINE> <INDENT> assert pk not in pk_set, f"{pk} is not unique for path {...
Check that test DB set is validated :param db_set:
625941d555399d3f055888c2
def resolve_future_dependencies(__provider_name=None): <NEW_LINE> <INDENT> new_providers = dict() <NEW_LINE> if __provider_name: <NEW_LINE> <INDENT> targets = _future_dependencies.pop(__provider_name, []) <NEW_LINE> for target in targets: <NEW_LINE> <INDENT> setattr(target, __provider_name, get_provider(__provider_name...
Forces injection of all dependencies. Before this function is called, circular dependencies may not have been injected. This function should be called only once, after all global providers are registered. If an object needs to be created after this call, it must not have circular dependencies. If any required depende...
625941d5293b9510aa2c34a2
def test_AppEditDialog_display_values(base_fixture, qtbot): <NEW_LINE> <INDENT> app_info = UiAppLinkConfig(name="test", conan_ref="abcd/1.0.0@usr/stable", executable="bin/myexec", is_console_application=True, icon="//myicon.ico", conan_options={"a": "b", "c": "True", "d": "10"}) <NEW_LINE> root_obj = QtWidgets.QWidget(...
Test, if the already existent app data is displayed correctly in the dialog.
625941d5287bf620b61d3c70
def remove(self, val): <NEW_LINE> <INDENT> if self.indexs[val]: <NEW_LINE> <INDENT> index, lastval = self.indexs[val].pop(), self.values[-1] <NEW_LINE> self.values[index] = lastval <NEW_LINE> self.indexs[lastval].add(index) <NEW_LINE> self.indexs[lastval].discard(len(self.values) - 1) <NEW_LINE> self.values.pop() <NEW_...
Removes a value from the collection. Returns true if the collection contained the specified element. :type val: int :rtype: bool
625941d5d486a94d0b98e354
def train(X_train, y_train, reg=0): <NEW_LINE> <INDENT> xtx = X_train.T.dot(X_train) <NEW_LINE> return scipy.linalg.solve(xtx + reg*np.eye(xtx.shape[0]), X_train.T.dot(y_train), sym_pos=True)
Build a model from X_train -> y_train
625941d55fdd1c0f98dc0441
def classify_image(image: LoadedImage, img_path: str, yolov3: Model, animals_to_find: List[AnimalType] = ("cat", "dog"), save_bbox: bool = True) -> Dict[AnimalType, List[BoundBox]]: <NEW_LINE> <INDENT> net_h, net_w = 416, 416 <NEW_LINE> obj_thresh, nms_thresh = 0.5, 0.45 <NEW_LINE> anchors = [[116, 90, 156, 198, 373, 3...
Find specified animals in the image :param image: loaded image :param img_path: path to the image :param yolov3: loaded Yolo v3 model :param animals_to_find: list of animal types to find :param save_bbox: when True, save image with detected bounding box - for debugging mainly :return: map of found animals and their bou...
625941d5bde94217f3682ffd
def CompressData(self, indata): <NEW_LINE> <INDENT> self.uncomp_data = indata <NEW_LINE> if self.compress != 'none': <NEW_LINE> <INDENT> self.uncomp_size = len(indata) <NEW_LINE> <DEDENT> data = tools.Compress(indata, self.compress) <NEW_LINE> return data
Compress data according to the entry's compression method Args: indata: Data to compress Returns: Compressed data (first word is the compressed size)
625941d5d53ae8145f87a47b
def tai2date(seconds=None): <NEW_LINE> <INDENT> import datetime as dt <NEW_LINE> if seconds is None: <NEW_LINE> <INDENT> raise ValueError('Please provide number of seconds') <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> seconds = float(seconds) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> raise ValueError('...
Converts *International Atomic Time (TAI)* to Common-Era (CE) Python datetime object. TAI: Number of econds since 1858-11-17. Parameters ---------- seconds : positive int or float, required The number of seconds since 17 November 1858 Returns ------- Python datetime.datetime References ---------- Survey Interfa...
625941d5b830903b967e9b17
def get_primary_clipboard_text(self): <NEW_LINE> <INDENT> return self.primary_clipboard.get_text()
Get primary clipboard contents. :return: Current clipboard contents. :rtype: QMimeData
625941d54c3428357757c535
@app.route('/user/<int:id>') <NEW_LINE> def user_page(id): <NEW_LINE> <INDENT> user = User.query.get(id) <NEW_LINE> job = Job.query.filter_by(user=user).first() <NEW_LINE> if job: <NEW_LINE> <INDENT> events = Event.query.filter_by(job_id=job.id, msg_type='inbound').all() <NEW_LINE> return render_template('user.html', u...
show user page/info
625941d5dd821e528d63b3b6
def increase_views(self): <NEW_LINE> <INDENT> self.views += 1 <NEW_LINE> self.save(update_fields=['views'])
阅读量
625941d58e05c05ec3eea584
def table_contains_all_answers(table, question): <NEW_LINE> <INDENT> def _check_one_answer(answer): <NEW_LINE> <INDENT> if answer.HasField("is_valid") and not answer.is_valid: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not answer.answer_texts: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for answer...
Checks if a table contains all the answers. Args: table: the table to check. question: containing the answers to check. Returns: False if no answer to check from the question. False if any of the answers text and alternative answers tests is not found. A answer text is considered as non existing if the fiel...
625941d5baa26c4b54cb132c
def test_records_for_spell(self): <NEW_LINE> <INDENT> records = self.spellgen.data.findall('record') <NEW_LINE> activity_spell_record = records[0] <NEW_LINE> spell_record = records[1] <NEW_LINE> activity_update_record = records[2] <NEW_LINE> self.assertEqual(activity_spell_record.attrib['model'], 'nh.activity', 'Incorr...
Make sure that it generates the right models for records for the spell
625941d5ec188e330fd5a9aa
def get_client_side_filters(self): <NEW_LINE> <INDENT> return self._client_filters
Return a dictionary of filters that must be processed on the client rather than the server.
625941d55e10d32532c5f134
def calculate_timebase(years, months, days, hours, mins, secs): <NEW_LINE> <INDENT> base_dt = None <NEW_LINE> current_year = str(datetime.now().year) <NEW_LINE> clock_variation = OrderedDict() <NEW_LINE> if not len(years) == len(months) == len(days) == len(hours) == len(mins) == len(secs): <NEW_LINE> <INDENT> rai...
Calculates the timestamp most common in the array of timestamps. Returns timestamp calculated for start of array by applying the offset of the most common timestamp. Accepts arrays and numpy arrays at 1Hz. WARNING: If at all times, one or more of the parameters are masked, you willnot get a valid timestamp and an exc...
625941d5a79ad161976cc354
def _loop_through(self, elements, tab='', depth=1): <NEW_LINE> <INDENT> elements_to_string = "" <NEW_LINE> for item in elements: <NEW_LINE> <INDENT> if isinstance(item, list): <NEW_LINE> <INDENT> if item and depth > 1: <NEW_LINE> <INDENT> elements_to_string += self._loop_through(item, tab=tab+'\t', depth=depth-1) <NEW_...
Method that go through a list of elements that contain strings and other list and return a string. The returned string is ready to be written in a markdown file in order to create a table of contents. :param elements: contain all the headers defined on the main class. :param tab: Inserts tabulations. :param depth: al...
625941d560cbc95b062c6751
def noun_to_verb(sentence, index): <NEW_LINE> <INDENT> return sentence[:-1].split(" ")[index] + "en"
:param sentence: str that uses the word in sentence :param index: index of the word to remove and transform :return: str word that changes the extracted adjective to a verb. A function takes a `sentence` using the vocabulary word, and the `index` of the word once that sentence is split apart. The function should re...
625941d563d6d428bbe446fd
def checksum(source_string): <NEW_LINE> <INDENT> count_to = (int(len(source_string)/2))*2 <NEW_LINE> _sum = 0 <NEW_LINE> count = 0 <NEW_LINE> while count < count_to: <NEW_LINE> <INDENT> if sys.byteorder == "little": <NEW_LINE> <INDENT> lo_byte = source_string[count] <NEW_LINE> hi_byte = source_string[count + 1] <NEW_LI...
A port of the functionality of in_cksum() from ping.c Ideally this would act on the string as a series of 16-bit ints (host packed), but this works. Network data is big-endian, hosts are typically little-endian
625941d523e79379d52ee770
def opExecute(self, obj): <NEW_LINE> <INDENT> PathLog.track() <NEW_LINE> jobshapes = [] <NEW_LINE> if len(obj.Base) >= 1: <NEW_LINE> <INDENT> PathLog.track(len(obj.Base)) <NEW_LINE> wires = [] <NEW_LINE> for base, subs in obj.Base: <NEW_LINE> <INDENT> edges = [] <NEW_LINE> basewires = [] <NEW_LINE> for feature in subs:...
opExecute(obj) ... process engraving operation
625941d5ad47b63b2c50a18d
def update_device_config(self, **kwargs): <NEW_LINE> <INDENT> if self._update_try_count >= 5: <NEW_LINE> <INDENT> self._config_updated = True <NEW_LINE> return <NEW_LINE> <DEDENT> successful = True <NEW_LINE> self._update_try_count += 1 <NEW_LINE> self._config_updated = successful
Updated the devices to the desired config params. This will be useful to make new default devices configs. For example when there is a gen6 multisensor I want it to always report every 5 minutes and timeout to be 30 seconds. Args: **kwargs ():
625941d51b99ca400220acbf
def connect(self): <NEW_LINE> <INDENT> logging.info("Mounting gluster volume locally...") <NEW_LINE> t0 = time.time() <NEW_LINE> label = gconf.get('mountbroker', None) <NEW_LINE> if not label and not privileged(): <NEW_LINE> <INDENT> label = syncdutils.getusername() <NEW_LINE> <DEDENT> mounter = label and MountbrokerMo...
inhibit the resource beyond Choose mounting backend (direct or mountbroker), set up glusterfs parameters and perform the mount with given backend
625941d550812a4eaa59c52e
def process_pgturl(self, params): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pattern = ServicePattern.validate(self.pgt_url) <NEW_LINE> if pattern.proxy_callback: <NEW_LINE> <INDENT> proxyid = utils.gen_pgtiou() <NEW_LINE> pticket = ProxyGrantingTicket.objects.create( user=self.ticket.user, service=self.pgt_url, serv...
Handle PGT request :param dict params: A template context dict :raises ValidateError: if pgtUrl is invalid or if TLS validation of the pgtUrl fails :return: The rendering of ``cas_server/serviceValidate.xml``, using ``params`` :rtype: django.http.HttpResponse
625941d5167d2b6e31218da3
def test_word_embedder_soft_ids(self): <NEW_LINE> <INDENT> init_value = np.expand_dims(np.arange(5), 1) <NEW_LINE> embedder = WordEmbedder(init_value=init_value) <NEW_LINE> ids = np.array([3]) <NEW_LINE> soft_ids = np.array([[0, 0, 0, 1, 0]]) <NEW_LINE> outputs = embedder(ids=ids) <NEW_LINE> soft_outputs = embedder(sof...
Tests the correctness of using soft ids.
625941d5956e5f7376d7107a
def cheat_interest_points(eval_file, scale_factor): <NEW_LINE> <INDENT> with open(eval_file, 'rb') as f: <NEW_LINE> <INDENT> d = pickle.load(f, encoding='latin1') <NEW_LINE> <DEDENT> return d['x1'] * scale_factor, d['y1'] * scale_factor, d['x2'] * scale_factor, d['y2'] * scale_factor
This function is provided for development and debugging but cannot be used in the final hand-in. It 'cheats' by generating interest points from known correspondences. It will only work for the 3 image pairs with known correspondences. Args: - eval_file: string representing the file path to the list of known correspo...
625941d58c3a8732951585c9
def three_number_sum(array, target_sum): <NEW_LINE> <INDENT> triplets = [] <NEW_LINE> array.sort() <NEW_LINE> for idx in range(0, len(array) - 2): <NEW_LINE> <INDENT> left = idx + 1 <NEW_LINE> right = len(array) - 1 <NEW_LINE> while left < right: <NEW_LINE> <INDENT> current_sum = array[idx] + array[left] + array[right]...
Loops over array with one pointer and uses two more to complete the triplet This function uses three pointers, the first one loops over the array from the index 0 to the index len(array) - 2, the two other pointers correspond to the right and left pointers. The left pointer is always initialized right after the first ...
625941d5bf627c535bc133dd
def teximage_param(width, height, vram_offset=0, format=TeximageParam.Format.NO_TEXTURE, palette_transparency=TeximageParam.Color0.DISPLAYED, transform_mode=0, u_repeat=TeximageParam.Repeat.REPEAT, v_repeat=TeximageParam.Repeat.REPEAT, u_flip=TeximageParam.Flip.NO, v_flip=TeximageParam.Flip.NO, texture_name=None): <NEW...
Specify which texture is used and how to interpret it. http://problemkaputt.de/gbatek.htm#ds3dtextureattributes
625941d5099cdd3c635f0e68
def __init__(self, config, account_, dv_auth, installer): <NEW_LINE> <INDENT> self.account = account_ <NEW_LINE> self.installer = installer <NEW_LINE> self.network = network.Network( config.server, jwk.JWKRSA.load(self.account.key.pem), verify_ssl=(not config.no_verify_ssl)) <NEW_LINE> self.config = config <NEW_LINE> i...
Initialize a client. :param dv_auth: IAuthenticator that can solve the :const:`letsencrypt.constants.DV_CHALLENGES`. The :meth:`~letsencrypt.interfaces.IAuthenticator.prepare` must have already been run. :type dv_auth: :class:`letsencrypt.interfaces.IAuthenticator`
625941d5d6c5a1020814425a
def __init__(self, primary_key=False, partition_key=False, index=False, db_field=None, default=None, required=False, clustering_order=None, polymorphic_key=False, static=False): <NEW_LINE> <INDENT> self.partition_key = partition_key <NEW_LINE> self.primary_key = partition_key or primary_key <NEW_LINE> self.index = inde...
:param primary_key: bool flag, indicates this column is a primary key. The first primary key defined on a model is the partition key (unless partition keys are set), all others are cluster keys :param partition_key: indicates that this column should be the partition key, defining more than one partition key col...
625941d5507cdc57c6306eec
def f_diff_schema(regle, obj): <NEW_LINE> <INDENT> pass
#aide||compare un nouveau schema en sortant les differences #pattern||;?C;;compare_schema;C;?N #patternC||C;C;;compare_schema;;;
625941d5d164cc6175782f5c
def addItem(self, value): <NEW_LINE> <INDENT> if self.root == None: <NEW_LINE> <INDENT> self.root = Node(value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> node = self.getLastNode() <NEW_LINE> tmp = Node(value) <NEW_LINE> tmp.next = None <NEW_LINE> tmp.prev = node <NEW_LINE> node.next = tmp
add/append item to LL
625941d5e1aae11d1e749ec7
def __init__(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._publish_manager = publish_manager.PublishManager() <NEW_LINE> <DEDENT> except exceptions.PublishServeException as e: <NEW_LINE> <INDENT> self._publish_manager = None <NEW_LINE> logger.error(e, exc_info=True) <NEW_LINE> <DEDENT> except psycopg2.Warni...
Inits publish servlet.
625941d5eab8aa0e5d26dd66
def _pre_run(self): <NEW_LINE> <INDENT> pass
Execute code needed before step run. In this method, all neccesary preparation of data can be done. It can be also used to determine if step should run or not by setting self.skip to True and providing self.skip_reason string with explanation.
625941d5eab8aa0e5d26dd67
def neighbors(self, node): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.graph[node] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise KeyError('{} not in graph'.format(node))
Return the neighbors of a node.
625941d5a8370b7717052aad
def get_datapoints(self, query_list, disable_presampling=False): <NEW_LINE> <INDENT> path = b'/v1/datapoint' <NEW_LINE> params = {'query': '', 'disablePresampling': disable_presampling} <NEW_LINE> body = json.dumps({"queries": query_list}) <NEW_LINE> return self._send_request(http_methods.PUT, path=path, params=params,...
query datapoints :param query_list: a list of query dict :type query_list: list :param disable_presampling: open of close presampling result query :type disable_presampling: boolean :return: a list of result dict :rtype: baidubce.bce_response.BceResponse
625941d5e8904600ed9f213d
def test_sql_interp_dict(self): <NEW_LINE> <INDENT> where = { 'first_name': 'John', 'last_name': 'Doe' } <NEW_LINE> sql, bind = self.sqli.interp("SELECT * FROM users WHERE", where) <NEW_LINE> self.assertEquals(sql, "SELECT * FROM users WHERE first_name = ? AND last_name = ?") <NEW_LINE> self.assertEquals(bind, ('John',...
Test interpolating a dictionary.
625941d54e4d5625662d45e4
def is_object_blocked(context, object_id, object_type): <NEW_LINE> <INDENT> standard_attr_id = _get_standard_attr_id(context, object_id, object_type) <NEW_LINE> if not standard_attr_id: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return bool(context.session.query(ProvisioningBlock).filter_by( standard_attr_id=...
Return boolean indicating if object has a provisioning block. :param context: neutron api request context :param object_id: ID of object that has been provisioned :param object_type: callback resource type of the object
625941d50383005118ecf7f0
def event_m10_17_x3(z134=_, z135=_, npc1=_): <NEW_LINE> <INDENT> PlayerActionRequest(6) <NEW_LINE> IsPlayerPlayingMotion(0, 6, 1) <NEW_LINE> assert ConditionGroup(0) <NEW_LINE> AddSouls(-1 * GraveSoulsRequired(npc1)) <NEW_LINE> CompareStateTime(0, 4, 2, 4) <NEW_LINE> assert ConditionGroup(0) <NEW_LINE> SetEventFlag(z13...
[Lib] NPC: Grave: Key Guide: Appearance of Ghosts z134: Area other flags: Ghost appearance z135: Area other flags: Conversation start npc1: NPC information parameter ID
625941d5a8ecb033257d32da
def _export_envs(params): <NEW_LINE> <INDENT> for c in env_config: <NEW_LINE> <INDENT> _run("sudo sh -c 'echo \"%(KEY)s=%(VALUE)s\" >> /etc/environment'" % {'KEY': c, 'VALUE': env_config[c]})
Export env to profile
625941d5d53ae8145f87a47c
def create_cached() -> List[Dict]: <NEW_LINE> <INDENT> events = load_from_ical(datetime.now(), datetime.now() + timedelta(days=7)) <NEW_LINE> log.info("loaded %s events", len(events)) <NEW_LINE> json_events = [] <NEW_LINE> for event in events: <NEW_LINE> <INDENT> json_events.append( { "start": event.start.strftime("%Y-...
Load events for the next 7 daysfrom ical and return as a list.
625941d53317a56b86939e63
@registry.register_ranged_hparams <NEW_LINE> def rl_modelrl_pixel_noise(rhp): <NEW_LINE> <INDENT> rhp.set_categorical("loop.generative_model_params", ["next_frame_pixel_noise"]) <NEW_LINE> rhp.set_discrete("model.video_modality_input_noise", [0.0025 * i for i in range(200)])
Input pixel noise tuning grid.
625941d5377c676e912723b7
def spath(title): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> first_path = PATH <NEW_LINE> if not os.path.isdir(first_path): <NEW_LINE> <INDENT> os.mkdir(first_path) <NEW_LINE> <DEDENT> save = PATH+title+BACKSLASH <NEW_LINE> if not os.path.isdir(save): <NEW_LINE> <INDENT> os.mkdir(save) <NEW_LINE> <DEDENT> return save...
创建保存目录
625941d57d43ff24873a2eaf
def test_ap_open_reconnect_on_inactivity_disconnect(dev, apdev): <NEW_LINE> <INDENT> hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" }) <NEW_LINE> dev[0].connect("open", key_mgmt="NONE", scan_freq="2412") <NEW_LINE> hapd.request("DEAUTHENTICATE " + dev[0].p2p_interface_addr() + " reason=4") <NEW_LINE> ev = d...
Reconnect to open mode AP after inactivity related disconnection
625941d530dc7b7665901b73
def change_profile(path_to_json: str, dt_name: str, new_prof: str): <NEW_LINE> <INDENT> self.status_lbl.setPixmap(self.question_pix) <NEW_LINE> self.status_lbl.setToolTip('Not yet tested') <NEW_LINE> new_prof_settings = get_profile_settings_value(path_to_json, dt_name, new_prof) <NEW_LINE> change_profile_settings_value...
Функция перерисовывает параметры подкючения при изменении профиля Парсит файл Settings/connection_profiles.json :param path_to_json: путь к файлу профилей подключения :param dt_name: имя диалекта, что бы найти корректные значения для профиля :param new_prof: имя нового профиля :return: None
625941d54e696a04525c965a
def _blanking_rule_ftld_or5(rule): <NEW_LINE> <INDENT> if rule == 'Blank if Question 1 FTDIDIAG = 0 (No)': <NEW_LINE> <INDENT> return lambda packet: packet['FTDIDIAG'] == 0 <NEW_LINE> <DEDENT> elif rule == 'Blank if Question 5 FTDCBFSP = 0 (No)': <NEW_LINE> <INDENT> return lambda packet: packet['FTDCBFSP'] == 0 <NEW_LI...
See _blanking_rule_ftld_or2 for rules
625941d5099cdd3c635f0e69
def clean_body(self, column, remove_template=True, remove_code=True): <NEW_LINE> <INDENT> logging.info("Start Removing Templates..") <NEW_LINE> for i in range(len(self.data)): <NEW_LINE> <INDENT> if remove_template and "## Environment info" in self.data[column][i]: <NEW_LINE> <INDENT> index = self.data.loc[i, column].f...
This methods is to remove template and code from issue's body
625941d5b7558d58953c5120
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, LdapConf): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d55510c4643540f5ef
def getACL(self): <NEW_LINE> <INDENT> if self._repository.getCapabilities()['ACL']: <NEW_LINE> <INDENT> aclUrl = self._getLink(ACL_REL) <NEW_LINE> result = self._cmisClient.get(aclUrl.encode('utf-8')) <NEW_LINE> if type(result) == HTTPError: <NEW_LINE> <INDENT> raise CmisException(result.code) <NEW_LINE> <DEDENT> retur...
Repository.getCapabilities['ACL'] must return manage or discover. >>> acl = folder.getACL() >>> acl.getEntries() {u'GROUP_EVERYONE': <cmislib.model.ACE object at 0x10071a8d0>, 'jdoe': <cmislib.model.ACE object at 0x10071a590>} The optional onlyBasicPermissions argument is currently not supported.
625941d53d592f4c4ed1d279
def del_columns(df, columns): <NEW_LINE> <INDENT> for column in columns: <NEW_LINE> <INDENT> if column in df.columns: <NEW_LINE> <INDENT> del df[column] <NEW_LINE> print("Deleted: ", column) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("Not in DataFrame: ",column) <NEW_LINE> <DEDENT> <DEDENT> return df
Deletes columns one by one from the DataFrame. Easier to use during development compared to df.drop(columns)
625941d54c3428357757c536
def search_hashed_measurement(mfile, index_item, directories, version): <NEW_LINE> <INDENT> mfile = pathlib.Path(mfile) <NEW_LINE> for adir in directories: <NEW_LINE> <INDENT> for root, _ds, fs in os.walk(str(adir)): <NEW_LINE> <INDENT> root = pathlib.Path(root) <NEW_LINE> if mfile.name in fs: <NEW_LINE> <INDENT> this_...
Search for a data set using hashes Parameters ---------- mfile: str The original path of the measurement file. index_item: dict Dictionary of this measurement file obtained from the index.txt file of a session (see `index` submodule). directories: list of str A list of directories to search recursively...
625941d5fb3f5b602dac38a3
def get_all_rois(normalized=True, read_data=False): <NEW_LINE> <INDENT> files = get_file_list() <NEW_LINE> normalized_file = get_file_list(True) <NEW_LINE> return [ RegionsOfInterest(files[i], normalizing_path=normalized_file[i], normalize=normalized, read_data=read_data) for i in range(len(files)) ]
Makes all the regions of interest from the different files, and returns them in a list :param normalized: Toggles whether or not the output is normalized or not. Default is True. :param read_data: Toggles whether or not the data will be loaded at creation or not. :type normalized: bool :type read_data: bool...
625941d550812a4eaa59c52f
def stripBlank(originStr, sliceStart=0): <NEW_LINE> <INDENT> return originStr.replace('\n', '').replace(' ', '')[sliceStart:]
将字符串中的换行符和空格去掉
625941d556ac1b37e62643dc
def __init__(self, message): <NEW_LINE> <INDENT> ServiceHttpFastCgiException.__init__(self) <NEW_LINE> self.message = message
Constructor of the class. @type message: String @param message: The message to be printed.
625941d55fdd1c0f98dc0442