code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_context(self): <NEW_LINE> <INDENT> cont = super(PhotoBox, self).get_context() <NEW_LINE> cont.update({ 'title' : self.params.get('title', self.obj.title), 'alt' : self.params.get('alt', ''), 'description' : self.params.get('description', self.obj.description), 'show_title' : self.params.get('show_title', ''), '...
Updates box context with photo-specific variables.
625941e0de87d2750b86010c
def mse(pred, tgt): <NEW_LINE> <INDENT> return lasagne.objectives.squared_error(pred, tgt).mean()
Mean-squared-error.
625941e021a7993f00bc806c
def typos(oov_word, morph_model, lm_segmented, threshold=-50): <NEW_LINE> <INDENT> nbest = min(2, len(oov_word)) <NEW_LINE> segmentations = [morph_model.viterbi_nbest(oov_word, nbest)[i][0] for i in range(nbest)] <NEW_LINE> segmentations = [segmented_word for segmented_word in segmentations if len(segmented_word) > 1] ...
Check an OOV word for typos.
625941e007d97122c4178c09
def get_change_info(self): <NEW_LINE> <INDENT> return self.get_element("descendant::office:change-info")
Get the ChangeInfo child of the element. Return: ChangeInfo element.
625941e060cbc95b062c68ba
def mon_remove(self, name, **kwargs): <NEW_LINE> <INDENT> return self.put('mon/remove?name={0}' .format(name), **kwargs)
Remove monitor node from cluster :param name: :param kwargs: :return:
625941e0d18da76e23532850
def replace_namespaced_stateful_set_scale(self, name, namespace, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.replace_namespaced_stateful_set_scale_with_http_info(name, namespace, body, **kwargs)
replace_namespaced_stateful_set_scale # noqa: E501 replace scale of the specified StatefulSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_stateful_set_scale(name, namespace, body, async_req=...
625941e091af0d3eaac9bd92
def run(applescript, background=False): <NEW_LINE> <INDENT> if os.path.exists(applescript): <NEW_LINE> <INDENT> path = applescript <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> path = tempfile() <NEW_LINE> open(path, "w").write(applescript) <NEW_LINE> <DEDENT> cmd = ["osascript", path] <NEW_LINE> r = runcmd.run(cmd, ba...
run applescript file/code
625941e044b2445a3393240a
def extend_volume(self, volume, new_size): <NEW_LINE> <INDENT> self.appliance.resize_volume(volume['name'], new_size)
Extend an existing volume.
625941e07047854f462a177c
@commandWrap <NEW_LINE> def ZoomTool(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.ZoomTool(*args, **kwargs)
:rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base
625941e09c8ee82313fbbaec
def cat(p): <NEW_LINE> <INDENT> cmd = 'cat ' + p <NEW_LINE> return util.cmd.cmd(cmd)
return the text in a file as a whole
625941e01f037a2d8b946574
def query(self, SCPI): <NEW_LINE> <INDENT> self.write(SCPI) <NEW_LINE> try: <NEW_LINE> <INDENT> sOut = self.s.recv(40000).strip() <NEW_LINE> sOut = sOut.decode() <NEW_LINE> <DEDENT> except socket.error: <NEW_LINE> <INDENT> sOut = '<not Read>' <NEW_LINE> <DEDENT> logging.info(f'Read < {sOut}') <NEW_LINE> return sOut
Socket Query
625941e03eb6a72ae02ec85c
def _build_local_host_path(local_data_directory): <NEW_LINE> <INDENT> return os.path.join(local_data_directory, 'host')
建立存储本地本地主机数据的路径;
625941e0d8ef3951e32438b4
def find_pets_by_tags(self, **kwargs): <NEW_LINE> <INDENT> allParams = ['tags'] <NEW_LINE> params = locals() <NEW_LINE> for (key, val) in params['kwargs'].items(): <NEW_LINE> <INDENT> if key not in allParams: <NEW_LINE> <INDENT> raise TypeError("Got an unexpected keyword argument '%s' to method find_pets_by_tags" % key...
Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. Args: tags, list[str]: Tags to filter by (optional) Returns: list[Pet]
625941e094891a1f4081be21
def addProperty(self, *args): <NEW_LINE> <INDENT> return _osgVolume.Layer_addProperty(self, *args)
addProperty(Layer self, Property property)
625941e094891a1f4081be22
def node_id(): <NEW_LINE> <INDENT> hash = sha1() <NEW_LINE> hash.update( entropy(20) ) <NEW_LINE> return hash.digest()
生成node ID
625941e00fa83653e465732f
def action_camcapture(self, imgname='image.jpg'): <NEW_LINE> <INDENT> camera = picamera.PiCamera() <NEW_LINE> camera.capture(self.datadir + '/image.jpg')
Capture an image using the rpi camera @param imgname string Use the image filename
625941e0a8ecb033257d3442
def generator_class(cls): <NEW_LINE> <INDENT> for name in list(cls.__dict__.keys()): <NEW_LINE> <INDENT> generator = getattr(cls, name) <NEW_LINE> if not name.startswith("generate_") or not callable(generator): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if not generator.__class__.__name__ == 'method': <NEW_LINE> ...
Class decorator for classes that use test generating methods. A class that is decorated with this function will be searched for methods starting with "generate_" (similar to "test_") and then run like a nosetest generator. Note: The generator function must be a classmethod! Generate tests using the following statemen...
625941e0236d856c2ad44b55
@xframe_options_exempt <NEW_LINE> @login_required(login_url="/auth/auth_in/") <NEW_LINE> def upload_maj(request): <NEW_LINE> <INDENT> val_jonction = request.GET.get("jonction") <NEW_LINE> val_etat = request.GET.get("etat_id") <NEW_LINE> val_etude = request.GET.get("etude_id") <NEW_LINE> id_log = JonctionEtapeSuivi.obje...
Appel ajax lors du changement d'état d'une étape. Ce module modifie l'état dans la base de donnée puis renvois vers la page pour afficher la modification
625941e056ac1b37e6264540
def on_faraday_plugin(self, action, param): <NEW_LINE> <INDENT> active_workspace = self.get_active_workspace() <NEW_LINE> if active_workspace: <NEW_LINE> <INDENT> name = active_workspace.getName() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> name = "" <NEW_LINE> <DEDENT> pluginsOption_window = FaradayPluginsDialog(sel...
Defines what happens when you press "Faraday Plugin..." on the menu
625941e0711fe17d825426da
def network(self): <NEW_LINE> <INDENT> return self._network
The implied network.
625941e08a349b6b435e84ea
def scan_params(self, gParameters): <NEW_LINE> <INDENT> self.epoch_max = param(gParameters, "epochs", ParamRequired(), ParamType.INTEGER_NN) <NEW_LINE> self.skip_epochs = param(gParameters, "ckpt_skip_epochs", 0, ParamType.INTEGER_NN) <NEW_LINE> self.ckpt_directory = param(gParameters, "ckpt_directory", "./save", Param...
Simply translate gParameters into instance fields
625941e00a50d4780f66720c
def _get_explicit_graded(block): <NEW_LINE> <INDENT> field_value = getattr( block.transformer_data[GradesTransformer], GradesTransformer.EXPLICIT_GRADED_FIELD_NAME, None, ) <NEW_LINE> return True if field_value is None else field_value
Returns the explicit graded field value for the given block.
625941e0a4f1c619b28b03a8
def health_check(self, instance_qs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> private_data_dir = tempfile.mkdtemp( prefix='awx_iso_heartbeat_', dir=settings.AWX_PROOT_BASE_PATH ) <NEW_LINE> self.runner_params = self.build_runner_params([ instance.hostname for instance in instance_qs ]) <NEW_LINE> self.runner_params...
:param instance_qs: List of Django objects representing the isolated instances to manage Runs playbook that will - determine if instance is reachable - find the instance capacity - clean up orphaned private files Performs save on each instance to update its capacity.
625941e04f88993c3716c3db
def update_host_compression_log(message): <NEW_LINE> <INDENT> host_compression_id = message.content['host_compression_id'] <NEW_LINE> group_name = 'host_compression_log%s' % host_compression_id <NEW_LINE> Group(group_name).send({ "text": json.dumps(message.content), })
刷新机器回收日志
625941e0004d5f362079a6a8
def toggle_labels(self): <NEW_LINE> <INDENT> self.cardinal.show_text = not self.cardinal.show_text <NEW_LINE> self.cardinal.repaint()
Inverts the boolean value of show_text then calls for a repaint. :return:
625941e0d6c5a102081443c4
def updateParamValues(self): <NEW_LINE> <INDENT> if DEBUG: print("ImgProcsFrame.updateParamValues()") <NEW_LINE> w = wx.FindWindowByName("processName_sTxt", self.panel["ui"]) <NEW_LINE> pn = w.GetLabel() <NEW_LINE> nP = len(self.ipParams[pn]) <NEW_LINE> lc = wx.FindWindowByName("proc_lst", self.panel["ui"]) <NEW_LINE> ...
Update parameter values for an image processing Args: None Returns: None
625941e07b180e01f3dc4b6e
def orb_normal_15_pattern_trend_b(sif,sopened=None,pfunc=pattern_uu,filter=null_filter,length=2): <NEW_LINE> <INDENT> dstretch = ma(gmin(sif.open15-sif.low15,sif.high15-sif.open15),10) <NEW_LINE> stretch = dnext_cover(dstretch,sif.close,sif.i_cof15,15) <NEW_LINE> open15 = dnext_cover(sif.open15,sif.close,sif.i_cof15,15...
stretch15
625941e08a43f66fc4b543d8
def meet(ts, ys): <NEW_LINE> <INDENT> mn = 100 <NEW_LINE> tmn = 0 <NEW_LINE> for ti, (y1, y2, y3) in zip(ts,ys): <NEW_LINE> <INDENT> dst = abs(y1-y2)+abs(y1-y3)+abs(y2-y3) <NEW_LINE> if dst < mn: <NEW_LINE> <INDENT> mn = dst <NEW_LINE> tmn = ti <NEW_LINE> <DEDENT> <DEDENT> yavg = (y1 + y2 + y3) / 3. <NEW_LINE> mX = mu(...
Return total distance of alphas at best unification, and corresponding scale.
625941e030bbd722463cc13e
def generate_error_control_forms(problem, goal): <NEW_LINE> <INDENT> msg = "Generating forms required for error control, this may take some time..." <NEW_LINE> cpp.log.info(msg) <NEW_LINE> for form in [goal]: <NEW_LINE> <INDENT> assert len(form.ufl_domains()) > 0, "Error control got as input a form with no domain!" <NE...
Create UFL forms required for initializing an ErrorControl object *Arguments* problem (:py:class:`LinearVariationalProblem <dolfin.fem.solving.LinearVariationalProblem>` or :py:class:`NonlinearVariationalProblem <dolfin.fem.solving.NonlinearVariationalProblem>`) The (primal) problem goal (:py:cl...
625941e08da39b475bd652ee
def build_url(**kwargs): <NEW_LINE> <INDENT> base = kwargs['settings']['base_url'] <NEW_LINE> education = "CMI" <NEW_LINE> option = kwargs['settings'][kwargs['option']] <NEW_LINE> week = str(kwargs['week']) <NEW_LINE> base_quarter = '/kw' <NEW_LINE> quarter = str(kwargs['quarter']) <NEW_LINE> slash = "/" <NEW_LINE> num...
Function to build url based on given input :param kwargs: dict with following keys: settings, option, quarter, week and num :return: constructed url string
625941e03eb6a72ae02ec85d
def test_ec_wrapper(self): <NEW_LINE> <INDENT> import electrochemistry <NEW_LINE> import numpy as np <NEW_LINE> model = electrochemistry.ECModel(DEFAULT) <NEW_LINE> times = model.suggest_times() <NEW_LINE> values = model.simulate(times) <NEW_LINE> parameters = ['E0', 'k0', 'Cdl'] <NEW_LINE> pints_model = electrochemist...
Wraps a `pints.ForwardModel` around a model.
625941e03d592f4c4ed1d3db
def _convert_dataset(dataset_split): <NEW_LINE> <INDENT> image_files = _get_files('image', dataset_split) <NEW_LINE> label_files = _get_files('label', dataset_split) <NEW_LINE> num_images = len(image_files) <NEW_LINE> num_per_shard = int(math.ceil(num_images / float(_NUM_SHARDS))) <NEW_LINE> image_reader = build_data.I...
Converts the specified dataset split to TFRecord format. Args: dataset_split: The dataset split (e.g., train, val). Raises: RuntimeError: If loaded image and label have different shape, or if the image file with specified postfix could not be found.
625941e09b70327d1c4e114d
def setUp(self): <NEW_LINE> <INDENT> user = _login(self.client)[0] <NEW_LINE> self.character = factories.CharacterFactory.create(owner=user) <NEW_LINE> self.path = reverse( 'gurps-manager-character-id', args=[self.character.id] )
Create a character and set ``self.path``. The created character is accessible as ``self.character``, and the test user owns the character.
625941e03539df3088e2e6c2
def test__results_contents_co_cirs_0408031652_fp1_files(self): <NEW_LINE> <INDENT> url = "/api/files/co-cirs-0408031652-fp1.json" <NEW_LINE> self._run_json_equal_file(url, "results_co_cirs_0408031652_fp1_files.json")
[test_results_contents.py] co-cirs-0408031652-fp1 files
625941e04c3428357757c69d
def __profile_handler(self, frame, event, arg): <NEW_LINE> <INDENT> self.__debug("__profile_handler('%s', %s, '%s')" % (frame.f_code.co_filename, frame.f_lineno, event)) <NEW_LINE> if self.__is_ignored(self.__make_abs(frame.f_code.co_filename)): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> tls_data = self.__get_...
Main profiling function, called by either sys.settrace or sys.setprofile action
625941e076d4e153a657eea9
def plot_decomposition_loadings(self, comp_ids=None, calibrate=True, same_window=True, comp_label=None, with_factors=False, cmap=plt.cm.gray, no_nans=False, per_row=3, axes_decor='all', title=None): <NEW_LINE> <INDENT> if self.axes_manager.navigation_dimension > 2: <NEW_LINE> <INDENT> raise NotImplementedError("This me...
Plot loadings from a decomposition. In case of 1D navigation axis, each loading line can be toggled on and off by clicking on the legended line. Parameters ---------- comp_ids : None, int, or list of ints if None (default), returns maps of all components if the output_dimension was defined when executing ``de...
625941e0e5267d203edce010
def cleanSamples(self, samplesCl, labelsCl, onlyLast=False): <NEW_LINE> <INDENT> if self._STMLabels.shape[0] > self.n_neighbors and samplesCl.shape[0] > 0: <NEW_LINE> <INDENT> if onlyLast: <NEW_LINE> <INDENT> loopRange = [len(self._STMLabels)-1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> loopRange = range(len(self._...
Removes distance-based all instances from the input samples that contradict those in the STM.
625941e01b99ca400220ae2a
def finish_initializing(self, builder): <NEW_LINE> <INDENT> self.builder = builder <NEW_LINE> self.ui = builder.get_ui(self)
Called while initializing this instance in __new__ finish_initalizing should be called after parsing the ui definition and creating a AboutDialog object with it in order to finish initializing the start of the new AboutKareldesktopDialog instance. Put your initialization code in here and leave __init__ undefined.
625941e0b7558d58953c5285
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None): <NEW_LINE> <INDENT> if extra_args is None: extra_args = [ None for i in range(num_nodes) ] <NEW_LINE> return [ start_node(i, dirname, extra_args[i], rpchost) for i in range(num_nodes) ]
Start multiple fargocashds, return RPC connections to them
625941e0097d151d1a2231cf
def fitPca(self): <NEW_LINE> <INDENT> print('Load via dataset features.') <NEW_LINE> via_all_features, _ = self._loadFeature('via_all_conv') <NEW_LINE> print('Fit PCA whitening paramters from via dataset.') <NEW_LINE> via_all_features = np.vstack(via_all_features) <NEW_LINE> sklearn.preprocessing.normalize(via_all_feat...
Compute PCA whitening paramters from the via dataset. Args: dim, int: Dimension of the final retrieval descriptor.
625941e0cb5e8a47e48b7e1c
def findDiagonalOrder(self, matrix): <NEW_LINE> <INDENT> r = 0 <NEW_LINE> c = 0 <NEW_LINE> dir = True <NEW_LINE> if len(matrix) == 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> res = [] <NEW_LINE> res.append(matrix[0][0]) <NEW_LINE> while True: <NEW_LINE> <INDENT> r, c, dir = self.getNext(r, c, dir, len(matrix),...
:type matrix: List[List[int]] :rtype: List[int]
625941e0ff9c53063f47c569
def __init__(self, api_definition, project, zone, tpu_names, job_name='tpu_worker', credentials='default', service=None): <NEW_LINE> <INDENT> self._project = project <NEW_LINE> self._zone = zone <NEW_LINE> self._tpu_names = tpu_names <NEW_LINE> self._job_name = job_name <NEW_LINE> self._credentials = credentials <NEW_L...
Creates a new TPUClusterResolver object. The ClusterResolver will then use the parameters to query the Cloud TPU APIs for the IP addresses and ports of each Cloud TPU listed. Args: api_definition: (Alpha only) A copy of the JSON API definitions for Cloud TPUs. This will be removed once Cloud TPU enters beta. ...
625941e0e76e3b2f99f3ab7d
def train_test_preparation(X, y, cv, use_reprs, use_pca, num_feat, test_size=0.2, **args): <NEW_LINE> <INDENT> x_train, x_test, y_train, y_test = train_test_split( X, y, test_size=test_size, random_state=cv) <NEW_LINE> train_reprs = None <NEW_LINE> if use_reprs: <NEW_LINE> <INDENT> train_reprs = get_representatives(x_t...
Apply Standard Scaler when desired.
625941e0be383301e01b57f6
def clean(situation): <NEW_LINE> <INDENT> return situation
cleans the situation :param situation: situation: the current situation :type situation: a game situation
625941e082261d6c526ab81b
def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): <NEW_LINE> <INDENT> self._pt_1 = pt_3d_1 <NEW_LINE> self._pt_2 = pt_3d_2 <NEW_LINE> self._pt_3 = pt_3d_3
:param pt_3d_1: :param pt_3d_2: :param pt_3d_3:
625941e0566aa707497f48db
@pytest.mark.test <NEW_LINE> def test_alert_collection_constructor_new_db(before): <NEW_LINE> <INDENT> importExportUtils.ALERT_DB_PATH = join(dirname(abspath(__file__)), "new_alertsDB_test.json") <NEW_LINE> alert_collection = AlertCollection() <NEW_LINE> alert_collection.db.close() <NEW_LINE> assert os.path.isfile(impo...
Test the :class:`~_clockalarm.AllertCollection` constructor. Build AlertCollection object with a nonexistent db path create the db.
625941e0d6c5a102081443c5
def update_organisation(self, query_params=None): <NEW_LINE> <INDENT> organisation_json = self.fetch_json( uri_path=self.base_uri, http_method='PUT', query_params=query_params or {} ) <NEW_LINE> return self.create_organisation(organisation_json)
Update this organisations information. Returns a new organisation object.
625941e0a17c0f6771cbe3c7
def setFont(self): <NEW_LINE> <INDENT> font = QtGui.QFont(self.fontInfo().family(), localsettings.appointmentFontSize) <NEW_LINE> if self.font != font: <NEW_LINE> <INDENT> self.font = font <NEW_LINE> self.fm = QtGui.QFontMetrics(font) <NEW_LINE> self.vheaderwidth = self.fm.width(_("Wednesday") + " 28 ") <NEW_LINE> <DED...
set the Font, and adjust the header column widths
625941e030bbd722463cc13f
def fun(str): <NEW_LINE> <INDENT> list = str.split() <NEW_LINE> i = 0 <NEW_LINE> j = len(list)-1 <NEW_LINE> while i < len(list)/2: <NEW_LINE> <INDENT> list[i], list[j] = list[j], list[i] <NEW_LINE> i = i+1 <NEW_LINE> j = j-1 <NEW_LINE> <DEDENT> str = ' '.join(list) <NEW_LINE> return str
objective : reverse of a sentence input parameter : str : string that contains the sentence return value : string that contains reverse of string
625941e026238365f5f0f1ea
def display(self, gamer, data, dice_result): <NEW_LINE> <INDENT> player_dict = data['player_dict'] <NEW_LINE> epic_bank = data['epic_bank'] <NEW_LINE> if self._status == 1: <NEW_LINE> <INDENT> owner_id = self.owner <NEW_LINE> owner = player_dict[owner_id] <NEW_LINE> if owner_id == gamer.id: <NEW_LINE> <INDENT> operatio...
Display description :param dice_result: :return:
625941e091af0d3eaac9bd93
def _getObjProperty(obj,prop_name): <NEW_LINE> <INDENT> objtmp = obj <NEW_LINE> pro_names = prop_name.split('.') <NEW_LINE> for i in range(len(pro_names)): <NEW_LINE> <INDENT> propvalue = getattr(objtmp, pro_names[i]) <NEW_LINE> objtmp = propvalue <NEW_LINE> <DEDENT> return propvalue
获取对象多层属性值
625941e0d4950a0f3b08c6c2
def interval_or_delta(duration): <NEW_LINE> <INDENT> if isinstance(duration, basestring): <NEW_LINE> <INDENT> return parse_interval(duration)[2] <NEW_LINE> <DEDENT> elif type(duration) == datetime.timedelta: <NEW_LINE> <INDENT> return duration <NEW_LINE> <DEDENT> raise ValueError( 'Invalid duration value: {}. ' 'Must b...
Accept a timedelta or an ISO-8601 interval and return a timedelta.
625941e056b00c62f0f149d3
def get_samples(self, name=None, projectname=None, projectlimsid=None, udf=dict(), udtname=None, udt=dict(), start_index=None): <NEW_LINE> <INDENT> params = self._get_params(name=name, projectname=projectname, projectlimsid=projectlimsid, start_index=start_index) <NEW_LINE> params.update(self._get_params_udf(udf=udf, u...
Get a list of samples, filtered by keyword arguments. name: Sample name, or list of names. projectlimsid: Samples for the project of the given LIMS id. projectname: Samples for the project of the name. udf: dictionary of UDFs with 'UDFNAME[OPERATOR]' as keys. udtname: UDT name, or list of names. udt: dictionary of UDT ...
625941e05fcc89381b1e1a38
@cli.command(name="evaluate-prediction", no_args_is_help=True) <NEW_LINE> @click.option('--pred_filepath', help='Prediction filepath', type=click.Path(exists=True), required=True) <NEW_LINE> @click.option('--gold_filepath', help='Gold standard filepath', type=click.Path(exists=True), required=True) <NEW_LINE> @click.op...
Evaluate the performance of a prediction file. Example prediction and goldstandard files are found in test/data/new_prediction.json and test/data/new_goldstandard.json respectively.
625941e0a219f33f34628cdc
def RTBoxKeysPressed(self,N=1): <NEW_LINE> <INDENT> if self._inWaiting() > 7*N - 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Check to see if (at least) the appropriate number of RTBox style key presses have been made. Example: bits.RTBoxKeysPressed(5) will return false until 5 button presses have been recorded. Note that the firmware in Bits# units varies over time and some features of this class may not work for all firmware ve...
625941e00383005118ecf959
def __init__( self, agg: ResultAnalyzer, unit_symbol: str = "", time_start=None, time_end=None, node_coord: Dict[str, List[float]] = None, ): <NEW_LINE> <INDENT> self.plotting = None <NEW_LINE> self.agg = agg <NEW_LINE> self.unit = "(%s)" % unit_symbol if unit_symbol != "" else "" <NEW_LINE> self.coord = node_coord <NE...
Create instance. :param agg: ResultAggragator instence to use :param unit_symbol: symbol on quantity unit used. ex. MW, litter, Go, ... :param time_start: time to use as the start of study horizon :param time_end: time to use as the end of study horizon :param node_coord: nodes coordinates to use for map plotting :par...
625941e0167d2b6e31218f0c
def FWHM(self, response=False, velocity=True): <NEW_LINE> <INDENT> if velocity: <NEW_LINE> <INDENT> midpoints = calculate_midpoints(self._bins_vel) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> midpoints = calculate_midpoints(self._bins_wave) <NEW_LINE> <DEDENT> if response: <NEW_LINE> <INDENT> return calculate_FWHM(mi...
Calculates the full width half maximum of the TF
625941e082261d6c526ab81c
def postprocess_form(self, form_class): <NEW_LINE> <INDENT> return form_class
Post process form. Use this to contribute fields. For example:: class MyInlineForm(InlineFormAdmin): def postprocess_form(self, form): form.value = TextField('value') return form class MyAdmin(ModelView): inline_models = (MyInlineForm(ValueModel),)
625941e0187af65679ca5497
def update(rrdclient, rrdfile, cgrp, sys_maj_min, block_dev): <NEW_LINE> <INDENT> rrd_last = rrdutils.lastupdate(rrdfile) <NEW_LINE> try: <NEW_LINE> <INDENT> rrd_metrics = app_metrics(cgrp, rrd_last, sys_maj_min, block_dev) <NEW_LINE> rrdclient.update( rrdfile, rrd_metrics ) <NEW_LINE> <DEDENT> except KeyError: <NEW_LI...
get and update metrics in rrd files
625941e026068e7796caf05b
def test_NumberThree(self): <NEW_LINE> <INDENT> a = BaseModel() <NEW_LINE> b = BaseModel() <NEW_LINE> self.assertEqual(type(a.id), str) <NEW_LINE> self.assertNotEqual(a.id, b.id) <NEW_LINE> self.assertEqual(type(a.created_at), datetime.datetime) <NEW_LINE> self.assertEqual(type(a.updated_at), datetime.datetime)
testing items from problem 3
625941e05fc7496912cc3cf5
def sort_edges_by_cluster_size(cluster_assignments, edge_similarity_matrix): <NEW_LINE> <INDENT> nb_edges = cluster_assignments.shape[0] <NEW_LINE> if min(cluster_assignments) == 0: <NEW_LINE> <INDENT> cluster_assignments+=1 <NEW_LINE> <DEDENT> cluster_assignments = cluster_assignments.astype(int) <NEW_LINE> cluster_si...
Sorts the edges of an edge_similarity_matrix in order of increasing cluster size for a given cluster_assignement vector. Parameters ---------- cluster_assignments: a nb_edges*1 sized array indicates the cluster assignment for each edge. edge_similarity_matrix: nb_edges x nb_edges matrix For each ...
625941e010dbd63aa1bd2f1a
def analyzePackets(self, packet): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if packet.haslayer(http.HTTPRequest): <NEW_LINE> <INDENT> httpLayer = packet.getlayer(http.HTTPRequest) <NEW_LINE> print("Host = {}".format(self.stringDesign(httpLayer.getfieldval("Host")))) <NEW_LINE> print("Path = {}".format(self.stringDes...
Ağda gönderilen packetleri inceler ve bulduğu sonuçları ekrana yazdırır.
625941e0711fe17d825426db
def test114_random_shell_graph(self): <NEW_LINE> <INDENT> g = nx.random_shell_graph([(7,15,0.4),(7,15,0.4)]) <NEW_LINE> mate1 = mv.max_cardinality_matching( g ) <NEW_LINE> mate2 = nx.max_weight_matching( g, True ) <NEW_LINE> self.assertEqual( len(mate1), len(mate2) )
Random shell graph.
625941e0a4f1c619b28b03a9
def font(self): <NEW_LINE> <INDENT> font_path = os.path.join(os.path.dirname(__file__), 'font', 'UbuntuMono-B.ttf') <NEW_LINE> font_size = self.font_size() <NEW_LINE> return ImageFont.truetype(font_path, size=font_size)
returns an ImageFont object with the font used to generate the avatar
625941e08a43f66fc4b543d9
def __str__(self): <NEW_LINE> <INDENT> raise NotImplementedError("Problem 2 incomplete.")
String representation: the same as a standard Python list. Example: >>> my_list = LinkedList() >>> my_list.add(1) >>> my_list.add(2) >>> my_list.add(3) >>> print(my_list) [1, 2, 3] >>> str(my_list) == str([1,2,3]) True
625941e0e8904600ed9f22a9
def start_of_line(self, line_number): <NEW_LINE> <INDENT> self.make_lines() <NEW_LINE> position = 0 <NEW_LINE> for i in range(line_number): <NEW_LINE> <INDENT> position += len(self.lines[i]) <NEW_LINE> <DEDENT> return position
find the position of the start of the requested line (in total characters from buffer start) lines are indexed from 0
625941e0009cb60464c63727
def getAction(self, gameState): <NEW_LINE> <INDENT> depth = self.depth * gameState.getNumAgents() <NEW_LINE> alpha = -float('inf') <NEW_LINE> for action in gameState.getLegalActions(0): <NEW_LINE> <INDENT> v = self.alphaBeta(gameState.generateSuccessor(0, action), depth - 1, 1, alpha, float('inf')) <NEW_LINE> if v > al...
Returns the minimax action using self.depth and self.evaluationFunction
625941e0be383301e01b57f7
@commands('tell', 'ask') <NEW_LINE> @nickname_commands('tell', 'ask') <NEW_LINE> @example('Willie, tell Embolalia he broke something again.') <NEW_LINE> def f_remind(bot, trigger): <NEW_LINE> <INDENT> teller = trigger.nick <NEW_LINE> verb = trigger.group(1) <NEW_LINE> if not trigger.group(3): <NEW_LINE> <INDENT> bot.re...
Give someone a message the next time they're seen
625941e02eb69b55b151cc2b
def delete(self): <NEW_LINE> <INDENT> db.session.delete(self) <NEW_LINE> db.session.commit()
deletes a new model into a database the model must exist in the database
625941e0379a373c97cfaebe
def scene_Kazi(N, Dmin, Dmax): <NEW_LINE> <INDENT> peak_position = (16.0, 63.0, 230.0) <NEW_LINE> intensity = (1.0, 1.0/3, 2.0/3) <NEW_LINE> x = np.zeros((N,1)) <NEW_LINE> for p, I in zip(peak_position, intensity): <NEW_LINE> <INDENT> x[dtoi(p, N, Dmin, Dmax)] = I <NEW_LINE> <DEDENT> x = x.reshape((N,1)) <NEW_LINE> ret...
Plot the Kazimierczuk scene for peak_position = (16.0, 63.0, 230.0) and intensity = (0.6, 0.2, 0.4) (ITAMeD by Kazimierczuk et al., 2013)
625941e0b545ff76a891418d
def last_added(self, num=10): <NEW_LINE> <INDENT> sorted_dict = self.sorted('scanned', reversed_sort=True) <NEW_LINE> count = 0 <NEW_LINE> last_added_dict = {} <NEW_LINE> for folder, data in sorted_dict.items(): <NEW_LINE> <INDENT> last_added_dict[folder] = data <NEW_LINE> count += 1 <NEW_LINE> if count == num: <NEW_LI...
Get the most recently added episodes
625941e067a9b606de4a822f
def __init__(self, frac, seed=1234): <NEW_LINE> <INDENT> self.frac = frac <NEW_LINE> self.seed = seed
A Custom BaseEstimator that can switch between classifiers. :param estimator: sklearn object - The classifier
625941e0d53ae8145f87a5e1
def test_json_return(): <NEW_LINE> <INDENT> returned = ASGARD.regions.list() <NEW_LINE> logging.debug(returned) <NEW_LINE> assert isinstance(returned, list) <NEW_LINE> for item in returned: <NEW_LINE> <INDENT> assert isinstance(item, dict) <NEW_LINE> <DEDENT> returned = ASGARD.cluster.list() <NEW_LINE> logging.debug(re...
With a good list call, we should get a list of dicts. When doing list operations, Asgard returns a JSON response with a list of dict objects for iterating over.
625941e06fece00bbac2daba
def set_modified_sourceslist(self): <NEW_LINE> <INDENT> self.modified_sourceslist = True <NEW_LINE> if self.options and self.options.massive_debug: <NEW_LINE> <INDENT> self.massive_debug_output() <NEW_LINE> <DEDENT> self.save_sourceslist() <NEW_LINE> self.reload_sourceslist()
The sources list was changed and now needs to be saved and reloaded
625941e08e71fb1e9831db20
def do_show(self, args): <NEW_LINE> <INDENT> args = shlex.split(args) <NEW_LINE> if len(args) == 0: <NEW_LINE> <INDENT> print("** class name missing **") <NEW_LINE> return <NEW_LINE> <DEDENT> if len(args) == 1: <NEW_LINE> <INDENT> print("** instance id missing **") <NEW_LINE> return <NEW_LINE> <DEDENT> obj_dict = stora...
Print the string representation of an instance baed on the class name and id given as args.
625941e0ec188e330fd5ab10
def assert_folder(self, folder_name): <NEW_LINE> <INDENT> return
STUB: Create a folder in the user_folders relation :type folder_name: basestring :param folder_name: The name of the folder Uses self.get_uuid(): the identity of the current user. Folders are local to the current user.
625941e08e05c05ec3eea6ef
def parse_line_to_row(self, line, delimiter=None): <NEW_LINE> <INDENT> assert len(self.vars()) > 0 <NEW_LINE> if delimiter is None: <NEW_LINE> <INDENT> delimiter = self.delimiter <NEW_LINE> <DEDENT> if delimiter is not None: <NEW_LINE> <INDENT> fields = line.split(delimiter) <NEW_LINE> return [v.python_type( fields[v.p...
Parse a line using the current table schema and return an array of values. Much more efficient than extracting variables one at a time.
625941e04e696a04525c97c4
def get_approved_context(self): <NEW_LINE> <INDENT> return self.get_approval_context(True)
A context marking all operations as approved (confirmed)
625941e0cdde0d52a9e533ad
def test_63111(self): <NEW_LINE> <INDENT> tmpdir = self.testdir() <NEW_LINE> filename = self.zip_CVE_2018_11 <NEW_LINE> file_url = self.url_CVE_2018_11 <NEW_LINE> if not download_raw(file_url, filename, tmpdir): <NEW_LINE> <INDENT> self.skipTest("no zip_CVE_2018_11 available: " + filename) <NEW_LINE> <DEDENT> exe = sel...
unzzip-big -l $(CVE).zip
625941e0cad5886f8bd27351
def __init__(self, game_actions, run_ID="x"): <NEW_LINE> <INDENT> self.game_actions = game_actions <NEW_LINE> if g.cluster == 1: <NEW_LINE> <INDENT> folder_path = '/lustre/sohamde/Inertia-AAMAS/stats/' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> folder_path = './stats/' <NEW_LINE> <DEDENT> if sys.argv[0] == 'main.py'...
Initializing the log files with header information
625941e045492302aab5e63f
def get_common_subtype(self, type): <NEW_LINE> <INDENT> subtype = None <NEW_LINE> for item in self.hardware.find_all_items(type): <NEW_LINE> <INDENT> item_subtype = item.get_value(self.RESOURCE_SUB_TYPE) <NEW_LINE> if subtype is None: <NEW_LINE> <INDENT> subtype = item_subtype <NEW_LINE> logger.info("Found {0} subtype ...
Get the sub-type common to all devices of the given type. If multiple such devices exist and they do not all have the same sub-type, returns None.
625941e03346ee7daa2b30e6
def add_vertex(self, name): <NEW_LINE> <INDENT> check = False <NEW_LINE> for item in self.vertexlist: <NEW_LINE> <INDENT> if name == item: <NEW_LINE> <INDENT> check = True <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> if check is False: <NEW_LINE> <INDENT> self.vertexlist.append(name) <NEW_LINE> self.numvertices = self...
add vertex identified by the string name
625941e05166f23b2e1a54d1
def test_get_details_filter_size_min(self): <NEW_LINE> <INDENT> extra_fixture = self.get_fixture(id=_gen_uuid(), size=18) <NEW_LINE> db_api.image_create(self.context, extra_fixture) <NEW_LINE> extra_fixture = self.get_fixture(id=_gen_uuid(), disk_format='ami', container_format='ami') <NEW_LINE> db_api.image_create(self...
Tests that the /images/detail registry API returns list of public images that have a size greater than or equal to size_min
625941e0be7bc26dc91cd972
def name(self, total_suites: int, suite_name: Optional[str] = None) -> str: <NEW_LINE> <INDENT> if suite_name is None: <NEW_LINE> <INDENT> suite_name = self.suite_name <NEW_LINE> <DEDENT> return taskname.name_generated_task(suite_name, self.index, total_suites)
Get the name of this suite.
625941e007d97122c4178c0b
def canCollapse(self): <NEW_LINE> <INDENT> count = Counter() <NEW_LINE> for col in self.__size_range: <NEW_LINE> <INDENT> count.update(filter(lambda x: x > 0, self.getCol(col))) <NEW_LINE> <DEDENT> highestElementCount = count.most_common(1)[0][1] <NEW_LINE> return highestElementCount > 1
return true if it is possible for two cells to collapse into each other For now, this tests if there are at least two cells of the same value
625941e0090684286d50f063
@logger.log_decorator <NEW_LINE> def create_simulation(simu_type, **kwargs): <NEW_LINE> <INDENT> if simu_type == 'md' : <NEW_LINE> <INDENT> return MolecularDynamicsProduction(**kwargs) <NEW_LINE> <DEDENT> elif simu_type == 'mc': <NEW_LINE> <INDENT> return MonteCarlo(**kwargs) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDE...
Create a simulation of the chosen type Argumuents : ------------ simu_type : string Type of the simulation. Could be : 'md' - Molecular Dynamics 'mc' - Monte Carlo Currently the only one that works is 'md' **kwargs : Every named argumnents needed for the constructor of the chosen type. Return ...
625941e03c8af77a43ae3b1c
def test_part1(): <NEW_LINE> <INDENT> assert part1(EXAMPLE) == 0 <NEW_LINE> assert part1(DATA) == 243
Part 1 test
625941e07d43ff24873a301b
def is_unread(self): <NEW_LINE> <INDENT> return bool(self.read_at is None)
returns whether the recipient has read the message or not
625941e026068e7796caf05c
def test_modify(self): <NEW_LINE> <INDENT> self.printHeader("modify") <NEW_LINE> test_prefix = 'UT6_' <NEW_LINE> host_set_name1 = test_prefix + "HS1_" + HPE3ParClient_base.TIME <NEW_LINE> host_sets_to_delete.append(host_set_name1) <NEW_LINE> self.cl.createHostSet(host_set_name1) <NEW_LINE> host_set_name2 = test_prefix ...
Test modify of host sets.
625941e060cbc95b062c68bc
def calculate_discriminant(coeff_a, coeff_b, coeff_c): <NEW_LINE> <INDENT> discriminant = coeff_b * coeff_b - 4 * coeff_a * coeff_c <NEW_LINE> return discriminant
Returns the discriminant of the given quadratic equation coefficients
625941e02c8b7c6e89b35b37
def _finish_iterating(self): <NEW_LINE> <INDENT> self._report_metrics()
Used for any cleanup after the result set iterator is done.
625941e015baa723493c42f0
def new_tile(self): <NEW_LINE> <INDENT> empty_items = [] <NEW_LINE> for row in range(self.get_grid_height()): <NEW_LINE> <INDENT> for col in range(self.get_grid_width()): <NEW_LINE> <INDENT> if self.get_tile(row, col) == 0: <NEW_LINE> <INDENT> empty_items.append((row, col)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> random_...
Create a new tile in a randomly selected empty square. The tile should be 2 90% of the time and 4 10% of the time.
625941e0046cf37aa974d0bd
def squash(vector): <NEW_LINE> <INDENT> vector_norm=tf.reduce_sum(tf.square(vector),axis=-2,keep_dims=True) <NEW_LINE> scalar_factor=vector_norm/(vector_norm+1)/tf.sqrt(vector_norm+epsilon) <NEW_LINE> vec_squashed=scalar_factor*vector <NEW_LINE> return vec_squashed
原文公式(1)
625941e073bcbd0ca4b2c3ee
def AssignEpisodeColor(self,Tag): <NEW_LINE> <INDENT> if self.data["ColorIndex"] == len(self.labelColors)-1: <NEW_LINE> <INDENT> self.data["DictColors"][Tag]=(random.random(),random.random(),random.random()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.data["DictColors"][Tag]=self.labelColors[self.data["ColorInde...
Assigns color to episodes tags
625941e09f2886367277ac04
def getListingname(self): <NEW_LINE> <INDENT> fn = self.getFirstname() <NEW_LINE> sn = self.getSurname() <NEW_LINE> if fn and sn: <NEW_LINE> <INDENT> return '%s, %s' % (self.getSurname(), self.getFirstname()) <NEW_LINE> <DEDENT> elif fn or sn: <NEW_LINE> <INDENT> return '%s %s' % (self.getSurname(), self.getFirstname()...
return Person's Fullname as Surname, Firstname
625941e015baa723493c42f1
def Yolo_head(feats, anchors, num_classes, input_shape, calc_loss=False): <NEW_LINE> <INDENT> num_anchors = len(anchors) <NEW_LINE> anchors_tensor = tf.reshape(tf.constant(anchors, dtype=feats.dtype), [1, 1, 1, num_anchors, 2]) <NEW_LINE> conv_dims = tf.shape(feats)[1:3] <NEW_LINE> height_index, width_index = tf.range(...
Create the spatial grid and adjust the prediction to their respective cell
625941e07b180e01f3dc4b6f
def cleanCache(self): <NEW_LINE> <INDENT> paths = self.tracklogPathList <NEW_LINE> garbage = filter(lambda x: x not in paths, self.cache) <NEW_LINE> for g in garbage: <NEW_LINE> <INDENT> del self.cache[g]
remove files that are not present from the cache
625941e0236d856c2ad44b57
def get_normal(building_block): <NEW_LINE> <INDENT> placer_centroid = building_block.get_centroid( atom_ids=building_block.get_placer_ids(), ) <NEW_LINE> normal = stk.get_acute_vector( reference=building_block.get_centroid() - placer_centroid, vector=building_block.get_plane_normal( atom_ids=building_block.get_placer_i...
Get a normal to a plane crossing the building block. The normal is defined by the plane of best fit to the placer atoms of the building block. It is defined such that the it always forms an acute angle with the vector running from the centroid of the placer atoms to the centroid of the building block. Parameters ----...
625941e0a17c0f6771cbe3c8
def test_output_out_of_date(self): <NEW_LINE> <INDENT> cleanup_tmpdir() <NEW_LINE> with open(transform1_out, 'w') as outfile: <NEW_LINE> <INDENT> outfile.write('testme') <NEW_LINE> <DEDENT> time.sleep(0.1) <NEW_LINE> with open(input_file, 'w') as outfile: <NEW_LINE> <INDENT> outfile.write('testme') <NEW_LINE> <DEDENT> ...
Input file exists, output out of date
625941e050485f2cf553d114
def create(): <NEW_LINE> <INDENT> global img <NEW_LINE> global current <NEW_LINE> sit = tictactoe.create_game() <NEW_LINE> g = tictactoe.initSituation(sit) <NEW_LINE> if ask.askplayer() == 1: <NEW_LINE> <INDENT> p1 = Player.new_player('human','X') <NEW_LINE> p2 = Player.new_player('computer','O') <NEW_LINE> <DEDENT> el...
creates the initial situation and draws it
625941e067a9b606de4a8230