code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _simuPOP_op.BaseQuanTrait_swiginit(self, _simuPOP_op.new_BaseQuanTrait(*args, **kwargs))
Usage: BaseQuanTrait(ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a base quantitative trait operator. This operator assigns one or more quantitative traits to trait fields in the present generation (default). If ALL_AVAIL...
625941c7d4950a0f3b08c392
def test_helptext(self): <NEW_LINE> <INDENT> sys.argv = [''] <NEW_LINE> self.exec_module() <NEW_LINE> self.assertEqual(self.retcode, 1) <NEW_LINE> self.assertEqual(len(self.stdout), 0) <NEW_LINE> self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
$ pdb_tidy
625941c7283ffb24f3c55945
def lauchBehavior(self, name): <NEW_LINE> <INDENT> behaviorPath = self.getBehaviorName(name) <NEW_LINE> print(behaviorPath) <NEW_LINE> if name in behaviorPath: <NEW_LINE> <INDENT> self.abm.runBehavior(behaviorPath) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("Le comportement n'existe pas")
* Lance un comportement donné en pararmètre s'il existe. * L'adresse d'un comportement est sous la forme de : comportement-identifiant/behavior_1 * Pour connaitre l'adresse du comportement, il faut regarder sur chorégraphe. :param name: nom du comportement
625941c7d58c6744b4257ca2
@register(r"(?:get|list) logs? for pod (\S+)$") <NEW_LINE> def pod_logs(**payload): <NEW_LINE> <INDENT> pod_name = re.search(payload["regex"], payload["data"]["text"]).group(1) <NEW_LINE> pod = next( ( pod for pod in k.list_pod_for_all_namespaces(watch=False).items if pod_name in pod.metadata.name ), None, ) <NEW_LINE>...
Get logs for a given pod
625941c730c21e258bdfa4df
def test_get_orga_unknown(self): <NEW_LINE> <INDENT> retour = self.api.get_orga('not-an-orga') <NEW_LINE> assert(not retour)
Test the get_orga call
625941c74e4d5625662d441b
def set_compression_region_gain(self, compression_region_gain): <NEW_LINE> <INDENT> self.set_param('compression_region_gain', compression_region_gain)
Sets Compression Region GainXI_PRM_COMPRESSION_REGION_GAIN
625941c7bf627c535bc13211
def GetInPlace(self): <NEW_LINE> <INDENT> return _itkInPlaceImageFilterBPython.itkInPlaceImageFilterIF2VIF2_GetInPlace(self)
GetInPlace(self) -> bool
625941c7c4546d3d9de72a75
def release_temp(self): <NEW_LINE> <INDENT> if self.read_field('tempholdmins') == 0: <NEW_LINE> <INDENT> return self.set_field('tempholdmins', 0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logging.warn("%i address, temp hold applied so won't remove set temp"%(self.set_address))
release setTemp back to the program, but only if temp isn't held for a time (holdTemp).
625941c79b70327d1c4e0e17
def get_stat(self, stat, base=0, default=0): <NEW_LINE> <INDENT> if stat in self.set_calculated_stats: <NEW_LINE> <INDENT> return self.calculated_stats[stat] <NEW_LINE> <DEDENT> bonus = self.calculated_stats.get(stat, default) <NEW_LINE> return base + bonus
Calculates the final value of a stat, based on modifiers and feats.
625941c766673b3332b920d3
def prop(*input_signals): <NEW_LINE> <INDENT> frame = sys._getframe(1) <NEW_LINE> def _prop(func): <NEW_LINE> <INDENT> return PropSignal(func, input_signals, frame=frame) <NEW_LINE> <DEDENT> if _first_arg_is_func(input_signals): <NEW_LINE> <INDENT> func, input_signals = input_signals[0], [] <NEW_LINE> return _prop(func...
Decorator to transform a function into a PropSignal object. A prop signal is a special kind of input signal that allows the user to set and get the value by assignment. This works, but not sure if this is a good idea API-wise, because it is not consistent with how signals work, and it hides the signal object. However...
625941c7f7d966606f6aa045
def get_pet_labels(image_dir): <NEW_LINE> <INDENT> in_files = listdir(image_dir) <NEW_LINE> print(f"Number of files = {len(in_files)}") <NEW_LINE> results_dic = dict() <NEW_LINE> for idx in range(0, len(in_files), 1): <NEW_LINE> <INDENT> if in_files[idx][0] != ".": <NEW_LINE> <INDENT> pet_label = "" <NEW_LINE> split_st...
Creates a dictionary of pet labels (results_dic) based upon the filenames of the image files. These pet image labels are used to check the accuracy of the labels that are returned by the classifier function, since the filenames of the images contain the true identity of the pet in the image. Be sure to format the pe...
625941c721a7993f00bc7d30
def bitwiseComplement(self, N): <NEW_LINE> <INDENT> if N==0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> ret="" <NEW_LINE> while N//2 or N%2: <NEW_LINE> <INDENT> if N%2: <NEW_LINE> <INDENT> ret="0"+ret <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ret="1"+ret <NEW_LINE> <DEDENT> N=N//2 <NEW_LINE> <DEDENT> return i...
:type N: int :rtype: int
625941c771ff763f4b5496cc
def enthalpy_equality_deriv(self): <NEW_LINE> <INDENT> deriv = np.zeros(( self.num_i, self.num_i + self.num_o + self.num_vars, self.num_nw_vars)) <NEW_LINE> for i in range(self.num_i): <NEW_LINE> <INDENT> deriv[i, i, 2] = 1 <NEW_LINE> <DEDENT> for j in range(self.num_o): <NEW_LINE> <INDENT> deriv[j, j + i + 1, 2] = -1 ...
Calculate partial derivatives for all mass flow balance equations. Returns ------- deriv : ndarray Matrix with partial derivatives for the mass flow balance equations.
625941c7adb09d7d5db6c7d3
def search(self, binary_item, first_item=0, last_item=None, count_iter=0): <NEW_LINE> <INDENT> if not last_item: <NEW_LINE> <INDENT> last_item = self.length - 1 <NEW_LINE> <DEDENT> if binary_item == self[first_item]: <NEW_LINE> <INDENT> return {'index': first_item, 'count': count_iter} <NEW_LINE> <DEDENT> elif binary_i...
method to search for a binary_item within a generated list instance and return a dictioray containing the indexof the item searched and number of iterations executed
625941c70a50d4780f666ed4
def semantic_uri_from_uri(self,uri): <NEW_LINE> <INDENT> con = self.create_db_connection() <NEW_LINE> cursor = con.cursor() <NEW_LINE> sql_command = "SELECT semantic_uri FROM public.term where uri='{}'".format(uri) <NEW_LINE> try: <NEW_LINE> <INDENT> cursor.execute(sql_command) <NEW_LINE> fetched_items = cursor.fetchal...
query semantic uri from uri. Use in xml_parser to get semantic_uri's of the corresopnding collections. Example of query: select semantic_uri from public.term where uri='http://vocab.nerc.ac.uk/collection/L05/current/'
625941c73617ad0b5ed67f3b
def __init__(self, width, height, basename): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height <NEW_LINE> self.basename = basename
width and height are the size of the largest layer. basename excludes path and "Stadium" prefix, but excludes layer number and '.png'.
625941c74a966d76dd551051
def checkKey(self, credentials): <NEW_LINE> <INDENT> log.msg('Checking key for creds: %s' % credentials, system='ssh-pubkey', logLevel=DEBUG) <NEW_LINE> home = os.environ.get("HOME") <NEW_LINE> if home is not None: <NEW_LINE> <INDENT> key_path = '%s/.ssh/authorized_keys' % home <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND...
Accepts any user name
625941c730bbd722463cbe08
def select_variable_1(): <NEW_LINE> <INDENT> global var <NEW_LINE> var[0] = clicked_var_1.get() <NEW_LINE> variable_label_1.config(text=var[0]) <NEW_LINE> if start_year and start_month and end_year and end_month and lon and lat and var[0] and var[1]: <NEW_LINE> <INDENT> download_button.grid(column=0, row=14)
Saves the 1st variable the user chooses Author: Marie Schroeder and Gorosti Mancho Returns -------- variable_1 : str The variable the user chose chosen_variables : list A list with the 2 variables
625941c7236d856c2ad4481c
def processAlgorithm(self, parameters, context, feedback): <NEW_LINE> <INDENT> feedback.pushInfo('parametros = ' + str(parameters)) <NEW_LINE> ida = self.parameterAsVectorLayer(parameters, self.IDA, context) <NEW_LINE> volta = self.parameterAsVectorLayer(parameters, self.VOLTA, context) <NEW_LINE> feedback.pushInfo('Da...
Here is where the processing itself takes place.
625941c7507cdc57c6306d1b
def place_maximize(self): <NEW_LINE> <INDENT> window_height = self.winfo_screenheight() - 73 <NEW_LINE> window_width = window_height <NEW_LINE> self.geometry('{width}x{height}+{xpad}+{ypad}'.format( width=int(window_width), height=int(window_height), xpad=int(self.winfo_screenwidth()/2 - window_width/2), ypad=int(self....
Maximize Window
625941c78e7ae83300e4b00f
def listPlaylist(sender, playlistType): <NEW_LINE> <INDENT> if ValidatePrefs() != None: <NEW_LINE> <INDENT> return ValidatePrefs() <NEW_LINE> <DEDENT> if Prefs['username'] != None: <NEW_LINE> <INDENT> validateUser() <NEW_LINE> <DEDENT> Log.Info('Listing Playlist: %s' % playlistType) <NEW_LINE> dir = MediaContainer(view...
Creates a MediaContainer with a list of Movies, Documentaries or TV Show Episodes based on playlistType @type sender: @param sender: Contains an ItemInfoRecord object, including information about the previous window state and the item that initiated the function call. @type playlistType: str @param pla...
625941c79f2886367277a8d1
def rename(self, rename_dict): <NEW_LINE> <INDENT> df_copy = self.df.copy() <NEW_LINE> df_copy = df_copy.rename(index=str, columns=rename_dict) <NEW_LINE> return Frame(df_copy, self.groups[:])
Renames the dataframe. Expects a a dictionary of strings where the keys represent the old names and the values represent the new names. <pre>Example: kf.rename({"aa":"a", "bb":"b"}) </pre>
625941c7287bf620b61d3aa7
def compare_test_results(model_mgr: jbfs.ModelManager, error_summary) -> int: <NEW_LINE> <INDENT> latest = model_mgr.get_latest_results() <NEW_LINE> known = model_mgr.get_known_results() <NEW_LINE> if known.exists(): <NEW_LINE> <INDENT> if not filecmp.cmp(known, latest): <NEW_LINE> <INDENT> logging.error(f">>> Unit tes...
Compares the latest results to the known results in the model directory. :param model_mgr: The model dir :param error_summary: A summary of generated errors :return: 0 if no errors, 1 if an error
625941c77d43ff24873a2ce3
def generate_data(n): <NEW_LINE> <INDENT> points=np.concatenate((ss.norm(0,1).rvs((n,2)) , ss.norm(1,1).rvs((n,2))), axis=0) <NEW_LINE> outcomes= np.concatenate((np.repeat(0,n),np.repeat(1,n))) <NEW_LINE> return points,outcomes
generates some data for demonstration
625941c7442bda511e8be45d
def getVariable(self, *args): <NEW_LINE> <INDENT> return _libsedml.SedFunctionalRange_getVariable(self, *args)
getVariable(SedFunctionalRange self, unsigned int n) -> SedVariable getVariable(SedFunctionalRange self, unsigned int n) -> SedVariable getVariable(SedFunctionalRange self, string sid) -> SedVariable getVariable(SedFunctionalRange self, string sid) -> SedVariable
625941c7187af65679ca5161
@pytest.mark.skip(reason='TODO refactor') <NEW_LINE> def test_past_without_instances(): <NEW_LINE> <INDENT> user = utils.create_user_account() <NEW_LINE> auth = utils.get_auth(user) <NEW_LINE> acct = '' <NEW_LINE> client = api.Client(authenticate=False) <NEW_LINE> report_start, report_end = utils.get_time_range() <NEW_...
Test accounts with instances only after the filter period. :id: 72aaa6e2-2c60-4e71-bb47-3644bd6beb71 :description: Test that an account with instances that were created prior to the current report end date. :steps: 1) Add a cloud account 2) Inject instance data for today 3) GET from the account report ...
625941c73cc13d1c6d3c73be
def wait(self): <NEW_LINE> <INDENT> gr.top_block.wait(self) <NEW_LINE> self.__analyze_sacch_messages()
Override gr.top_block's wait method.
625941c745492302aab5e305
def print_menu(exits, room_items, inv_items): <NEW_LINE> <INDENT> print("You can:") <NEW_LINE> for direction in exits: <NEW_LINE> <INDENT> print_exit(direction, exit_leads_to(exits, direction)) <NEW_LINE> <DEDENT> for item in room_items: <NEW_LINE> <INDENT> print("TAKE " + item["id"] + " to take a " + item["name"]) <NE...
This function displays the menu of available actions to the player. The argument exits is a dictionary of exits as exemplified in map.py. The arguments room_items and inv_items are the items lying around in the room and carried by the player respectively. The menu should, for each exit, call the function print_exit() t...
625941c77047854f462a144e
def manualRegexCreation(self): <NEW_LINE> <INDENT> regex = "['phising']+['\_'']+[\d_]+[\d]+\.csv" <NEW_LINE> return regex
Method Name: manualRegexCreation Description: This method contains a manually defined regex based on the "FileName" given in "Schema" file. This Regex is used to validate the filename of the training data. Output: Regex pattern On Failure: None Written By: iNeuron Intelligence Version: 1.0 Revisions: None...
625941c799cbb53fe6792c2a
def partial_predict(stage, state, x, qid, score_update): <NEW_LINE> <INDENT> prune, model = stage <NEW_LINE> if prune is None: <NEW_LINE> <INDENT> indexes = state['indexes'].copy() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pruned = [] <NEW_LINE> for a, b in group_offsets(qid[state['indexes']]): <NEW_LINE> <INDENT> ...
Run partial prediction by executing one cascade stage
625941c797e22403b379cfdc
def from_pystr_to_cstr(data: Union[str, List[str]]): <NEW_LINE> <INDENT> if isinstance(data, str): <NEW_LINE> <INDENT> return bytes(data, "utf-8") <NEW_LINE> <DEDENT> if isinstance(data, list): <NEW_LINE> <INDENT> pointers = (ctypes.c_char_p * len(data))() <NEW_LINE> data = [bytes(d, 'utf-8') for d in data] <NEW_LINE> ...
Convert a Python str or list of Python str to C pointer Parameters ---------- data str or list of str
625941c7f548e778e58cd5c0
def __getitem__(self, idx): <NEW_LINE> <INDENT> return super(FB15kDataset, self).__getitem__(idx)
Gets the graph object Parameters ----------- idx: int Item index, FB15kDataset has only one graph object Return ------- :class:`dgl.DGLGraph` The graph contains - ``edata['e_type']``: edge relation type - ``edata['train_edge_mask']``: positive training edge mask - ``edata['val_edge_mask']``: pos...
625941c7c432627299f04c88
def get_free_space(self, folder): <NEW_LINE> <INDENT> if os_version == 'Windows': <NEW_LINE> <INDENT> free_bytes = ctypes.c_ulonglong(0) <NEW_LINE> ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes)) <NEW_LINE> return free_bytes.value <NEW_LINE> <DEDENT> else: <N...
Return folder/drive free space (in bytes) Input: folder : string - Path to folder / drive Output: returns : int - Number of bytes available in path
625941c797e22403b379cfdd
def __init__(self): <NEW_LINE> <INDENT> self.s1 = [] <NEW_LINE> self.s2 = []
Initialise stacks
625941c76fece00bbac2d780
def process_response(self, request, response): <NEW_LINE> <INDENT> if (isinstance(response, HttpResponseRedirect) and conf.CLICK_REF_PARAMETER_NAME in request.GET): <NEW_LINE> <INDENT> url_parts = urlparse.urlparse(response['Location']) <NEW_LINE> querydict = urlparse.parse_qs(url_parts.query) <NEW_LINE> if conf.CLICK_...
Remove the add click-through parameter so that the confirmation request isn't duplicated when a redirect preserves the querystring
625941c766656f66f7cbc1ee
def _start_and_update_retry(self): <NEW_LINE> <INDENT> new_started_nodes = [] <NEW_LINE> selective_reuse = [] <NEW_LINE> Trace.log(Trace.FLOW_START, {'flow_name': self._flow_name, 'dispatcher_id': self._dispatcher_id, 'queue': Config.dispatcher_queues[self._flow_name], 'selective': self._selective, 'node_args': self._n...
Start the flow and update retry. :return: new/next retry
625941c776d4e153a657eb74
def talkWithNpc(self,npcId,taskId): <NEW_LINE> <INDENT> lastMainTaskId = self._MainRecord.get('mainRecord',10000) <NEW_LINE> if taskId!=lastMainTaskId: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> taskInfo = dbtask.ALL_MAIN_TASK.get(taskId) <NEW_LINE> if taskInfo['demandNPC']!=npcId: <NEW_LINE> <INDENT> return <NEW_L...
与Npc交谈(传话任务的处理) @param npcId: int npc的id
625941c7ab23a570cc2501c5
def get(self): <NEW_LINE> <INDENT> template = JINJA_ENVIRONMENT.get_template('thanks.html') <NEW_LINE> email = self.session.get('email') <NEW_LINE> if email is not None: <NEW_LINE> <INDENT> self.response.write(template.render(name=email)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.redirect("/")
Renders a simple api doc with the implemented methods.
625941c7be7bc26dc91cd645
def files_in_directory(directory_path: str): <NEW_LINE> <INDENT> filename_list = os.listdir(directory_path) <NEW_LINE> filename_list = list(filter(lambda filename: filename.endswith(".csv"), filename_list)) <NEW_LINE> if not directory_path.endswith("/"): <NEW_LINE> <INDENT> directory_path += "/" <NEW_LINE> <DEDENT> ret...
read a directory and returns a list of included file paths. :param directory_path: path's directory to read :return: filename's list in the data directory
625941c73539df3088e2e38e
def wrap_future(func): <NEW_LINE> <INDENT> def _(*args): <NEW_LINE> <INDENT> future = Future() <NEW_LINE> value = func(*args) <NEW_LINE> future.set_result(value) <NEW_LINE> return future <NEW_LINE> <DEDENT> return _
A decorator which is used to turn a function returning a value into a function returning a Future.
625941c7435de62698dfdc90
def OnLogin(self, event): <NEW_LINE> <INDENT> nick = self._nick.GetValue() <NEW_LINE> password = self._pass.GetValue() <NEW_LINE> self.protocol.login(nick, password)
Called when user pushes Login button. Call login method of protocol.
625941c77d847024c06be2fe
def plot_distributions(self, df): <NEW_LINE> <INDENT> for col in df.columns.values: <NEW_LINE> <INDENT> plt.figure(); plt.hist(df[col], bins=200) <NEW_LINE> plt.title("Histogram showing distribution of " + str(col))
Plot distributions of attributes as histogram Parameters: - df, dataframe containing attributes to plot
625941c7cc0a2c11143dced4
def stop(self): <NEW_LINE> <INDENT> return not self.advancing
Indique si on est au milieu d'un mouvement
625941c730dc7b76659019ab
def has_tensors(ls): <NEW_LINE> <INDENT> if isinstance(ls, (list, tuple)): <NEW_LINE> <INDENT> return any( tensor_util.is_tf_type(v) and not isinstance(v, ragged_tensor.RaggedTensor) for v in ls) <NEW_LINE> <DEDENT> if isinstance(ls, dict): <NEW_LINE> <INDENT> return any( tensor_util.is_tf_type(v) and not isinstance(v,...
Returns true if `ls` contains tensors.
625941c73317a56b86939c9e
def replays_get_with_http_info(self, match_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['match_id'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> params = l...
GET /replays # noqa: E501 Get data to construct a replay URL with # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replays_get_with_http_info(match_id, async_req=True) >>> result = thread.get() :param async_req bo...
625941c70fa83653e4656fff
def submodule(submod_name, name=None) -> Optional[ModuleType]: <NEW_LINE> <INDENT> module = sys.modules[name] if name else _module_from_frames() <NEW_LINE> try: <NEW_LINE> <INDENT> return import_module(f'{module.__name__}.{submod_name}', module.__package__) <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> re...
Try importing the submodule of current wrapped module Note that no ImportError will be raised if failed to import; `None` will be returned instead. Args: submod_name: Name of the submodule. name: Current module name. If not provided, will traverse the frame to get the module.
625941c79b70327d1c4e0e18
def get_opcode_pub_set_kvp_result_payload(payload_data): <NEW_LINE> <INDENT> payload_str = '' <NEW_LINE> payload_tuple = ast.literal_eval(payload_data) <NEW_LINE> temp_iter = 0 <NEW_LINE> payload_len = len(payload_tuple) <NEW_LINE> if temp_iter < payload_len: <NEW_LINE> <INDENT> source_node = "%0.2X" % payload_tuple[te...
Get M2M Payload for Publish Set Kvp Result message opcode :param payload_data: Payload data :return: Payload string
625941c745492302aab5e306
def fxr(n): <NEW_LINE> <INDENT> oribin = '{0:032b}'.format(n) <NEW_LINE> reversebin = oribin[::-1] <NEW_LINE> return int(reversebin, 2)
Runtime: 32 ms, faster than 77.68% of Python3 online submissions for Reverse Bits. https://stackoverflow.com/a/10411108/3984911 '{0:08b}'.format(6) {} places a variable into a string 0 takes the variable at argument position 0 : adds formatting options for this variable (otherwise it would represent decimal 6) 08 for...
625941c7b830903b967e9950
def evaluate_metrics_stopping(model_list, metric_name, bigger_is_better, search_criteria, possible_model_number): <NEW_LINE> <INDENT> tolerance = search_criteria["stopping_tolerance"] <NEW_LINE> stop_round = search_criteria["stopping_rounds"] <NEW_LINE> min_list_len = 2*stop_round <NEW_LINE> metric_list = [] <NEW_LINE>...
This function given a list of dict that contains the value of metric_name will manually go through the early stopping condition and see if the randomized grid search will give us the correct number of models generated. Note that you cannot assume the model_list is in the order of when a model is built. It actually al...
625941c7090684286d50ed28
def wav_to_nn_representation(wav): <NEW_LINE> <INDENT> XP = stft(wav) <NEW_LINE> X, P = np.float32(np.abs(XP)), np.angle(XP) <NEW_LINE> X = apply_to_magnitude(X) <NEW_LINE> return X.T, P.T
Convert the waveform into the representation for the NN.
625941c7711fe17d825423b1
def test_procedurerequest_5(base_settings): <NEW_LINE> <INDENT> filename = ( base_settings["unittest_data_dir"] / "procedurerequest-genetics-example-1.json" ) <NEW_LINE> inst = procedurerequest.ProcedureRequest.parse_file( filename, content_type="application/json", encoding="utf-8" ) <NEW_LINE> assert "ProcedureRequest...
No. 5 tests collection for ProcedureRequest. Test File: procedurerequest-genetics-example-1.json
625941c74e696a04525c948f
def registerSourceAuthority(self): <NEW_LINE> <INDENT> self._myRef.registerSourceAuthority(self.myAddress)
Registers this Actor as the Source Authority for authorizing (and decrypting) loadActorSource() inputs.
625941c7287bf620b61d3aa8
def insert_data(self, sql, param=None): <NEW_LINE> <INDENT> conn = self.__connect() <NEW_LINE> conn.execute(sql) <NEW_LINE> conn.close() <NEW_LINE> return 'success'
@summary: 向数据表插入一条记录 @param sql:要插入的SQL格式 @param value:要插入的记录数据tuple/list @return: insertId 受影响的行数
625941c78e05c05ec3eea3b7
def get_queryset(self, queryset=None): <NEW_LINE> <INDENT> if self.queryset is None: <NEW_LINE> <INDENT> project_slug = self.kwargs.get('project_slug', None) <NEW_LINE> if project_slug: <NEW_LINE> <INDENT> project = Project.objects.get(slug=project_slug) <NEW_LINE> queryset = CertifyingOrganisation.objects.filter( proj...
Get the queryset for this view. :param queryset: A query set :type queryset: QuerySet :returns: CertifyingOrganisation Queryset which is filtered by project. :rtype: QuerySet :raises: Http404
625941c7dd821e528d63b1ed
def evaluateTo(self, target): <NEW_LINE> <INDENT> return bool()
bool QXmlQuery.evaluateTo(QIODevice target)
625941c71f5feb6acb0c4b95
@pytest.mark.parametrize("popsize, nlocs, nexp", [(3, 1, 1), (3, 2, 2), (3, 5, 3)]) <NEW_LINE> def test_get_mutation_sample_locations(popsize, nlocs, nexp, mock_LocIdx): <NEW_LINE> <INDENT> mock_src_file = Path("source.py") <NEW_LINE> mock_sample = [GenomeGroupTarget(*i) for i in [(mock_src_file, mock_LocIdx)] * popsiz...
Test sample size draws for the mutation sample.
625941c7baa26c4b54cb1164
def delete_logparser(self, parser_id): <NEW_LINE> <INDENT> query = self.session.query(LogParserModel) <NEW_LINE> query = query.filter(LogParserModel.id == parser_id) <NEW_LINE> query.delete() <NEW_LINE> self.session.commit()
删除指定id的logparser :param parser_id: :return:
625941c76fb2d068a760f0e0
def open_midi_devices_from_config(self): <NEW_LINE> <INDENT> assert self._as_parameter_ <NEW_LINE> return buze_application_open_midi_devices_from_config(self)
Initializes a device on the Armstrong audio driver using settings from the Buze configuration.
625941c71f5feb6acb0c4b96
def main(): <NEW_LINE> <INDENT> module = AnsibleModule( argument_spec=dict( pn_cliswitch=dict(required=False, type='str'), state=dict(required=True, type='str', choices=['present', 'absent', 'update']), pn_oid_restrict=dict(required=False, type='str'), pn_priv=dict(required=False, type='bool'), pn_auth=dict(required=Fa...
This section is for arguments parsing
625941c76e29344779a62656
def printNice(myList, print_result=True): <NEW_LINE> <INDENT> buff = "" <NEW_LINE> for el in myList: <NEW_LINE> <INDENT> if isinstance(el, list) or isinstance(el, tuple): <NEW_LINE> <INDENT> for i, subel in enumerate(el): <NEW_LINE> <INDENT> if i != len(el) - 1: <NEW_LINE> <INDENT> buff += str(subel) + " " <NEW_LINE> <...
Print every element of an iterator in a different line, and subelements separated by spaces. @use printNice(("number", 1, "array", [1, 2, 3, 4, 5]))
625941c7b545ff76a8913e5a
def swap(self, QWebEngineScript): <NEW_LINE> <INDENT> pass
swap(self, QWebEngineScript)
625941c7566aa707497f45ae
def test_alignment_count(applet_id, project_id, folder, tmpdir): <NEW_LINE> <INDENT> applet = dxpy.DXApplet(applet_id) <NEW_LINE> input_dict = {"fastq": dxpy.dxlink(SAMPLE_FASTQ), "genomeindex_targz": dxpy.dxlink(HS37D5_BWA_INDEX)} <NEW_LINE> job = applet.run(input_dict, instance_type="mem1_ssd1_x16", folder=folder, pr...
Run BWA on a FASTQ file and verify that the number of alignments produced is correct.
625941c7eab8aa0e5d26db9c
def _handle_tagged_event(self, event_code, items): <NEW_LINE> <INDENT> if (event_code == 'PRIVCOUNT_CIRCUIT_CELL' or event_code == 'PRIVCOUNT_CIRCUIT_CLOSE' or event_code == 'PRIVCOUNT_CONNECTION_CLOSE' or event_code == 'PRIVCOUNT_HSDIR_CACHE_STORE' or event_code == 'PRIVCOUNT_HSDIR_CACHE_FETCH'): <NEW_LINE> <INDENT> f...
Handle an event with tagged fields.
625941c796565a6dacc8f70f
def parse_iso8601(value): <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return iso8601.parse_date(value)
Parses a datetime as a UTC ISO8601 date
625941c721bff66bcd684998
def vg_present(name, devices=None, **kwargs): <NEW_LINE> <INDENT> ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} <NEW_LINE> if __salt__['lvm.vgdisplay'](name): <NEW_LINE> <INDENT> ret['comment'] = 'Volume Group {0} already present'.format(name) <NEW_LINE> <DEDENT> elif __opts__['test']: <NEW_LINE> <...
Create an LVM volume group name The volume group name to create devices A list of devices that will be added to the volume group kwargs Any supported options to vgcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details.
625941c75f7d997b87174ada
def __init__(self, system): <NEW_LINE> <INDENT> super(RAT612, self).__init__("rat-6.1.2", system, "root-5.34.34", "6.1.2")
Initiliase the rat 6.1.2 package.
625941c7d6c5a1020814408e
def del_box(self): <NEW_LINE> <INDENT> box = Box.by_uuid(self.get_argument('uuid', '')) <NEW_LINE> if box is not None: <NEW_LINE> <INDENT> logging.info("Delete box: %s" % box.name) <NEW_LINE> self.dbsession.delete(box) <NEW_LINE> self.dbsession.commit() <NEW_LINE> self.redirect('/admin/view/game_objects') <NEW_LINE> <D...
Delete a box
625941c7925a0f43d2549eba
def to_implies_not(formula: Formula) -> Formula: <NEW_LINE> <INDENT> and_or_not_formula = to_not_and_or(formula) <NEW_LINE> substitute_dict = {'&': Formula.parse('~(p->~q)'), '|': Formula.parse('(~p->q)')} <NEW_LINE> return and_or_not_formula.substitute_operators(substitute_dict)
Syntactically converts the given formula to an equivalent formula that contains no constants or operators beyond ``'->'`` and ``'~'``. Parameters: formula: formula to convert. Return: A formula that has the same truth table as the given formula, but contains no constants or operators beyond ``'->'`` and `...
625941c74428ac0f6e5ba836
def subarraySum(self, nums, k): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> dic[0] = 1 <NEW_LINE> cursum = ans = 0 <NEW_LINE> for n in nums: <NEW_LINE> <INDENT> cursum += n <NEW_LINE> if cursum - k in dic: <NEW_LINE> <INDENT> ans += dic[cursum-k] <NEW_LINE> <DEDENT> if cursum in dic: <NEW_LINE> <INDENT> dic[cursum] += 1 <N...
:type nums: List[int] :type k: int :rtype: int
625941c78da39b475bd64fb6
def debug(self, components): <NEW_LINE> <INDENT> print(' ' * 5 + '[ Debug Mode ]' + ' ' * 5 + '\n') <NEW_LINE> for component in components: <NEW_LINE> <INDENT> print(component.NAME + "(x=" + str(component.x) + ", y=" + str(component.y) + ")") <NEW_LINE> <DEDENT> print('\n')
Debugs by displaying X-Axis and Y-Axis of components. Args: components: The list of components.
625941c75e10d32532c5ef6b
def post(self, request): <NEW_LINE> <INDENT> file = request.FILES.get('file', None) <NEW_LINE> if not file: <NEW_LINE> <INDENT> return Response({'msg': 'No file upload'}, status=400) <NEW_LINE> <DEDENT> path = os.path.join(settings.BASE_DIR, 'static', 'upload', file.name) <NEW_LINE> filepath = open(path, 'wb+') <NEW_LI...
用户或管理员上传文件
625941c71b99ca400220aaf5
def handler_signal(self, signum, frame): <NEW_LINE> <INDENT> if signum == signal.SIGINT: <NEW_LINE> <INDENT> loop = self.loop <NEW_LINE> loop.add_callback_from_signal(self.stop) <NEW_LINE> self.is_closing = True <NEW_LINE> <DEDENT> elif signum == signal.SIGUSR1: <NEW_LINE> <INDENT> self.configure()
Handle signals.
625941c77cff6e4e811179ca
def test_internal_node_labels(self): <NEW_LINE> <INDENT> ts1b = "(Cephalotaxus:125.000000,(Taxus:100.000000,Torreya:100.000000)" "TT1:25.000000)Taxaceae:90.000000;" <NEW_LINE> tree = Trees.Tree(ts1b) <NEW_LINE> self.assertEqual(self._get_flat_nodes(tree), [('Taxaceae', 90.0, None, None), ('Cephalotaxus', ...
Handle text labels on internal nodes.
625941c7cdde0d52a9e53076
@register.tag <NEW_LINE> def list_videos(parser, token): <NEW_LINE> <INDENT> args, kwargs = [], {} <NEW_LINE> bits = token.split_contents() <NEW_LINE> context_var = bits[2] <NEW_LINE> if len(bits) < 3: <NEW_LINE> <INDENT> message = "'%s' tag requires more than 2" % bits[0] <NEW_LINE> raise TemplateSyntaxError(message) ...
Used to pull a list of :model:`videos.Video` items. Usage:: {% list_videos as [varname] [options] %} Be sure the [varname] has a specific name like ``videos_sidebar`` or ``videos_list``. Options can be used as [option]=[value]. Wrap text values in quotes like ``tags="cool"``. Options include: ``limit`` ...
625941c7a17c0f6771cbe096
def create_floating_ip(neutron_client, ext_net): <NEW_LINE> <INDENT> body = { "floatingip": { "floating_network_id": ext_net['id'] } } <NEW_LINE> fip = neutron_client.create_floatingip(body) <NEW_LINE> return fip
Function that creates a floating ip and returns it Accepts the neutron client and ext_net Module level function since this is not associated with a specific network instance
625941c755399d3f055886f8
def readCoords(self, coordsFile): <NEW_LINE> <INDENT> Main.logger.debug("readCoords: c." + coordsFile) <NEW_LINE> coordsHits = dict() <NEW_LINE> coordsFile = open(coordsFile+".coords", mode="r") <NEW_LINE> for line in coordsFile: <NEW_LINE> <INDENT> line = line.split() <NEW_LINE> if len(line) == 16: <NEW_LINE> <INDENT>...
reads the coordinates from the results of nucmer :param coordsFile: location to the nucmer file :return:
625941c7de87d2750b85fdd6
def set_options(self, args): <NEW_LINE> <INDENT> self.options.clear() <NEW_LINE> options = args if isinstance(args, dict) else vars(args) <NEW_LINE> for key, value in options.items(): <NEW_LINE> <INDENT> if '.' in key: <NEW_LINE> <INDENT> dkey, key = key.split('.', 1) <NEW_LINE> if dkey not in self.options: <NEW_LINE>...
Set commandline options for the settingsobject. Commandline options override all other options, even setting set at runtime and presistend in the userconfig file. :param args: A dict of object passeble by `vars` to get dict. if a dot is in the key it is assum to be for a section. the return of argpars...
625941c7d18da76e23532519
def __eq__(self, other): <NEW_LINE> <INDENT> if self.__class__ != other.__class__: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.chr != other.chr: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.start != other.start: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.end != other.e...
Define Locus objects equality.
625941c791af0d3eaac9ba5c
def start_server(self): <NEW_LINE> <INDENT> if self._socket is None: <NEW_LINE> <INDENT> context = zmq.Context() <NEW_LINE> self._socket = context.socket(zmq.REP) <NEW_LINE> self._socket.setsockopt(zmq.RCVTIMEO, 100) <NEW_LINE> self._socket.bind("tcp://{0}:{1}".format(self.host, self.port)) <NEW_LINE> self.log.info("Li...
Binds the server to the configured host and port and starts listening.
625941c7d58c6744b4257ca5
def parse_command(self, inp): <NEW_LINE> <INDENT> inp_list = inp.split(' ') <NEW_LINE> if len(inp_list) > 2: <NEW_LINE> <INDENT> print("Invalid syntax") <NEW_LINE> <DEDENT> cmd = inp_list[0].lower() <NEW_LINE> param = inp_list[1] if len(inp_list) > 1 else None <NEW_LINE> if self.type == CLIENT: <NEW_LINE> <INDENT> cmds...
Parses a command Params: inp - command input (string)
625941c77c178a314d6ef4a2
def connect_to_db(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> conn = psycopg2.connect(host="options-prices.cetjnpk7rvcs.us-east-1.rds.amazonaws.com", database="options_prices", user="Stephen", password="password69") <NEW_LINE> cur = conn.cursor() <NEW_LINE> return cur, conn <NEW_LINE> <DEDENT> except ConnectionRefu...
This function uses the psycopg2 library to connect to an RDS instance where the tables for this project are being stored. I currently have the information here and I should remove it. :return: cursor and connection objects for interacting with the table
625941c74e4d5625662d441e
def voc_ap(rec, prec, use_07_metric=False): <NEW_LINE> <INDENT> if use_07_metric: <NEW_LINE> <INDENT> ap = 0. <NEW_LINE> for t in np.arange(0., 1.1, 0.1): <NEW_LINE> <INDENT> if np.sum(rec >= t) == 0: <NEW_LINE> <INDENT> p = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p = np.max(prec[rec >= t]) <NEW_LINE> <DEDENT> ...
ap = voc_ap(rec, prec, [use_07_metric]) Compute VOC AP given precision and recall. If use_07_metric is true, uses the VOC 07 11 point method (default:False). Adopted from https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/datasets/voc_eval.py
625941c7004d5f362079a378
def set_processor_affinity(self, *args, **kwargs): <NEW_LINE> <INDENT> return _filter_swig.fft_filter_fff_sptr_set_processor_affinity(self, *args, **kwargs)
set_processor_affinity(fft_filter_fff_sptr self, std::vector< int,std::allocator< int > > const & mask)
625941c7cad5886f8bd2701e
def analyze(self): <NEW_LINE> <INDENT> self.server.query('/%s/analyze' % self.key)
The primary purpose of media analysis is to gather information about that mediaitem. All of the media you add to a Library has properties that are useful to know–whether it's a video file, a music track, or one of your photos.
625941c7f7d966606f6aa047
def test_filter_facet(self): <NEW_LINE> <INDENT> FacetTest.index_data([ {'id': 1, 'color': 'red'}, {'id': 2, 'color': 'red'}, {'id': 3, 'color': 'red'}, {'id': 4, 'color': 'yellow'}, {'id': 5, 'color': 'yellow'}, {'id': 6, 'color': 'green'}, {'id': 7, 'color': 'blue'}, {'id': 8, 'color': 'white'}, {'id': 9, 'color': 'b...
Test filter facet
625941c7f7d966606f6aa048
def analyse_all_bonds(model): <NEW_LINE> <INDENT> from itertools import combinations_with_replacement <NEW_LINE> if isinstance(model, str) is True: <NEW_LINE> <INDENT> model = read(model) <NEW_LINE> <DEDENT> analysis = Analysis(model) <NEW_LINE> dash = "-" * 40 <NEW_LINE> list_of_symbols = list(set(model.get_chemical_s...
Returns a table of bond distance analysis for the supplied model. Parameters: model: Atoms object or string. If string it will read a file in the same folder, e.g. "name.traj"
625941c771ff763f4b5496ce
def serialize(self): <NEW_LINE> <INDENT> return {'id': self.id, 'c': self.c, 'f': self.f, 'notseal': self.notseal, 'seal': self.seal, }
Return object data in easily serializeable format
625941c7b57a9660fec338c8
def rmv_get_mutant(self, sr, mtype=None, meta=True): <NEW_LINE> <INDENT> if 'splice' in self.cat: <NEW_LINE> <INDENT> orig_score = sr.stats['motif'][str(self.motif_type)]['sum'] <NEW_LINE> good_score = sum( [f.extract_score() for f in sr.get_features( self.motif_type, correct=True)]) <NEW_LINE> if orig_score == good_sc...
for the clust_* and rbpmat muts this function gets self.num_feat_to_mut features that will be mutated, picking the ones with the highest scores.
625941c7498bea3a759b9af4
def setup_logger(name): <NEW_LINE> <INDENT> formatter = ColoredFormatter( "%(log_color)s%(levelname)s:%(filename)s:%(funcName)s:%(message)s", datefmt=None, reset=True, log_colors={ "DEBUG": "cyan", "INFO": "green", "WARNING": "yellow", "ERROR": "red", "CRITICAL": "red", }, ) <NEW_LINE> logger = logging.getLogger(name) ...
Return a logger with a default ColoredFormatter.
625941c7442bda511e8be45e
def __UpdateAllowEdit(self, song): <NEW_LINE> <INDENT> allow_edit = True if (song and (song._status != songs.SS_POSTPONED and song._status != songs.SS_NOT_STARTED)) else False <NEW_LINE> self.__accuracy.Enable(allow_edit) <NEW_LINE> self.__estimated.Enable(allow_edit) <NEW_LINE> s...
Allow or disallow editing based upon a song being present or not, etc
625941c763d6d428bbe44534
def list_products(): <NEW_LINE> <INDENT> return _settings.get('products', [])
Return a list of product names.
625941c78e7ae83300e4b011
def train(self, X, Y, noise=None): <NEW_LINE> <INDENT> if noise is not None: <NEW_LINE> <INDENT> self.noise = noise <NEW_LINE> <DEDENT> self.X = X.copy() <NEW_LINE> n = self.X.shape[0] <NEW_LINE> D = self.X.shape[1] <NEW_LINE> regularization = np.array(n * ([self.noise * self.kernel.l] + D * [self.noise])) <NEW_LINE> K...
Produces a PES model from data. Given a set of observations, X, Y, compute the K matrix of the Kernel given the data (and its cholesky factorization) This method should be executed whenever more data is added. Parameters: X: observations (i.e. positions). numpy array with shape: nsamples x D Y: targets (i.e. energy ...
625941c7097d151d1a222e9f
def union(G, H, rename=(None, None), name=None): <NEW_LINE> <INDENT> R = G.__class__() <NEW_LINE> if name is None: <NEW_LINE> <INDENT> name = "union( %s, %s )"%(G.name,H.name) <NEW_LINE> <DEDENT> R.name = name <NEW_LINE> def add_prefix(graph, prefix): <NEW_LINE> <INDENT> if prefix is None: <NEW_LINE> <INDENT> return gr...
Return the union of graphs G and H. Graphs G and H must be disjoint, otherwise an exception is raised. Parameters ---------- G,H : graph A NetworkX graph create_using : NetworkX graph Use specified graph for result. Otherwise rename : bool , default=(None, None) Node names of G and H can be changed by spe...
625941c7d10714528d5ffd26
def _new_mock_response(self, response, file_path): <NEW_LINE> <INDENT> mock_response = copy.copy(response) <NEW_LINE> mock_response.body = Body(open(file_path, 'rb')) <NEW_LINE> mock_response.fields = NameValueRecord() <NEW_LINE> for name, value in response.fields.get_all(): <NEW_LINE> <INDENT> mock_response.fields.add...
Return a new mock Response with the content.
625941c72eb69b55b151c8f2
def setAttrMapping(*args, **kwargs): <NEW_LINE> <INDENT> pass
This command applies an offset and scale to a specified device attachment. This command is different than the setInputDeviceMapping command, which applies a mapping to a device axis. The value from the device is multiplied by the scale and the offset is added to this product. With an absolute mapping, the attached attr...
625941c75fcc89381b1e1703
def vdot(x1: DNDarray, x2: DNDarray) -> DNDarray: <NEW_LINE> <INDENT> x1 = manipulations.flatten(x1) <NEW_LINE> x2 = manipulations.flatten(x2) <NEW_LINE> return arithmetics.sum(arithmetics.multiply(complex_math.conjugate(x1), x2))
Computes the dot product of two vectors. Higher-dimensional arrays will be flattened. Parameters ---------- x1 : DNDarray first input array. If it's complex, it's complex conjugate will be used. x2 : DNDarray second input array. Raises ------ ValueError If the number of elements is inconsistent. See Also...
625941c715fb5d323cde0b53
def part1(guard_dict): <NEW_LINE> <INDENT> most_slept = 0 <NEW_LINE> for sleepy_guard, slept in guard_dict.items(): <NEW_LINE> <INDENT> if len(slept) > most_slept: <NEW_LINE> <INDENT> most_slept = len(slept) <NEW_LINE> sleepiest_guard = sleepy_guard <NEW_LINE> <DEDENT> <DEDENT> most_seen_minute = find_sleepiest_minute(...
Strategy 1: Find the guard who sleeps the most overall.
625941c79f2886367277a8d3
def __init__(self, logger): <NEW_LINE> <INDENT> self._logger = logger
:param logging.Logger logger:
625941c750485f2cf553cdde
def is_inside(self, i, j): <NEW_LINE> <INDENT> if 0 <= i < self.size[0] and 0 <= j < self.size[1]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Checks if point is inside the board. :param i: position :param j: position :return:
625941c7925a0f43d2549ebb
def __init__(self, mdp, discount = 0.9, iterations = 100): <NEW_LINE> <INDENT> self.mdp = mdp <NEW_LINE> self.discount = discount <NEW_LINE> self.iterations = iterations <NEW_LINE> self.values = util.Counter() <NEW_LINE> for i in range(self.iterations): <NEW_LINE> <INDENT> action_values = util.Counter() <NEW_LINE> for ...
Your value iteration agent should take an mdp on construction, run the indicated number of iterations and then act according to the resulting policy. Some useful mdp methods you will use: mdp.getStates() mdp.getPossibleActions(state) mdp.getTransitionStatesAndProbs(state, action) mdp.getReward(state, a...
625941c7596a897236089b06