code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def config_file_provider(parser, xml_parent, data): <NEW_LINE> <INDENT> cfp = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.configfiles.' 'buildwrapper.ConfigFileBuildWrapper') <NEW_LINE> cfp.set('plugin', 'config-file-provider') <NEW_LINE> config_file_provider_builder(cfp, data)
yaml: config-file-provider Provide configuration files (i.e., settings.xml for maven etc.) which will be copied to the job's workspace. Requires the Jenkins :jenkins-wiki:`Config File Provider Plugin <Config+File+Provider+Plugin>`. :arg list files: List of managed config files made up of three parameters :files: ...
625941dbf548e778e58cd869
def List(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Retrieves the list of MongoDB Database resources in the specified cluster.
625941dba05bb46b383ecb0a
def __init__(self, **kwargs): <NEW_LINE> <INDENT> print("Training Start......") <NEW_LINE> self.train_iter = kwargs["train_iter"] <NEW_LINE> self.dev_iter = kwargs["dev_iter"] <NEW_LINE> self.test_iter = kwargs["test_iter"] <NEW_LINE> self.model = kwargs["model"] <NEW_LINE> self.config = kwargs["config"] <NEW_LINE> sel...
:param kwargs: Args of data: train_iter : train batch data iterator dev_iter : dev batch data iterator test_iter : test batch data iterator Args of train: model : nn model config : config
625941db97e22403b379d285
def _create_xmltag(self, tagtype, value): <NEW_LINE> <INDENT> if tagtype not in self.SUPPORTED_MARKUP: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> elif tagtype == DocBackend.LINK: <NEW_LINE> <INDENT> return self.format_link(value) <NEW_LINE> <DEDENT> elif tagtype == DocBackend.FONTSIZE: <NEW_LINE> <INDENT> valu...
overwrites the method in DocBackend creates the pango xml tags needed for non bool style types
625941db73bcbd0ca4b2c360
def browse_file_path(self): <NEW_LINE> <INDENT> idx = self.view.selectedIndexes()[0] <NEW_LINE> selected_item = idx.model().itemFromIndex(idx) <NEW_LINE> parent = selected_item.parent() <NEW_LINE> file_path = str(idx.data()) <NEW_LINE> new_dir = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a folder ...", fi...
Browse for the data file path.
625941db167d2b6e31218e7f
def stop(self): <NEW_LINE> <INDENT> self.logger.log("Trader closing down") <NEW_LINE> if self.status == TraderStatus.HOT: <NEW_LINE> <INDENT> self.cancel_orders() <NEW_LINE> <DEDENT> self.cancelMktData(3) <NEW_LINE> self.disconnect() <NEW_LINE> self.print_pnl()
Stops all streaming data, cancels all orders Closes the TWS connection :return:
625941db85dfad0860c3b146
def get_selected_row_number(self): <NEW_LINE> <INDENT> selection = self._treeview.get_selection() <NEW_LINE> if selection.get_mode() == Gtk.SelectionMode.MULTIPLE: <NEW_LINE> <INDENT> model, paths = selection.get_selected_rows() <NEW_LINE> if paths: <NEW_LINE> <INDENT> return paths[0][0] <NEW_LINE> <DEDENT> <DEDENT> el...
Get the selected row number or None if no rows were selected
625941db60cbc95b062c682e
def adjoint(self, add, model, data): <NEW_LINE> <INDENT> self.checkDomainRange(model, data) <NEW_LINE> if not add: <NEW_LINE> <INDENT> model.zero() <NEW_LINE> <DEDENT> y = data.clone().getNdArray() <NEW_LINE> if self.axis > 0: <NEW_LINE> <INDENT> y = self.backend.swapaxes(y, self.axis, 0) <NEW_LINE> <DEDENT> x = self.b...
Adjoint operator
625941db2eb69b55b151cb9d
def bisection(f, a, b, tol, N): <NEW_LINE> <INDENT> if f(a) * f(b) > 0: <NEW_LINE> <INDENT> return 'No real roots contained within the chosen interval.' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> n = 1 <NEW_LINE> while n <= N: <NEW_LINE> <INDENT> c = (b + a) / 2 <NEW_LINE> if abs(f(c)) < tol: <NEW_LINE> <INDENT> pri...
N is the maximum number of iterations, tol is the tolerance (how accurate of a solution you want). Generally, as the tolerance becomes smaller, the number of iterations N must grow. a and b are the endpoints of the close interval, while f is your function.
625941dbd164cc6175783039
def test_get(self): <NEW_LINE> <INDENT> rsp = self.apiGet(get_server_info_url(), expected_mimetype=server_info_mimetype) <NEW_LINE> self.assertEqual(rsp['stat'], 'ok') <NEW_LINE> self.assertTrue('info' in rsp) <NEW_LINE> self.assertTrue('product' in rsp['info']) <NEW_LINE> self.assertTrue('site' in rsp['info']) <NEW_LI...
Testing the GET info/ API
625941dbdc8b845886cb5821
def start(self): <NEW_LINE> <INDENT> pass
Start service.
625941db6e29344779a628fa
def shifted_color_map(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'): <NEW_LINE> <INDENT> cdict = { 'red': [], 'green': [], 'blue': [], 'alpha': [] } <NEW_LINE> reg_index = np.linspace(start, stop, 257) <NEW_LINE> shift_index = np.hstack([ np.linspace(0.0, midpoint, 128, endpoint=False), np.linspace(midpoin...
Function to offset the "center" of a colormap. Useful for data with a negative min and positive max and you want the middle of the colormap's dynamic range to be at zero Input ----- cmap : The matplotlib colormap to be altered start : Offset from lowest point in the colormap's range. Defaults to 0.0 (no lowe...
625941db96565a6dacc8f9b5
def _step(self, optimizer): <NEW_LINE> <INDENT> gradient_scale = self.gradient_accumulator.step * self.args.strategy.num_replicas_in_sync <NEW_LINE> gradients = [ gradient / tf.cast(gradient_scale, gradient.dtype) for gradient in self.gradient_accumulator.gradients ] <NEW_LINE> gradients = [(tf.clip_by_value(grad, -sel...
Applies gradients and resets accumulation.
625941dbe5267d203edcdf84
def _get_thumbnail_filename(self, name): <NEW_LINE> <INDENT> return get_thumbnail_filename(self.path, name)
get thumbnail filename with name thumbnail filename is generated with utils.get_thumbnail_filename method. original path is path of this field file
625941dbd268445f265b5159
@keyword_decorator <NEW_LINE> def myia_static(fn, **kwargs): <NEW_LINE> <INDENT> return MyiaStatic(fn, **kwargs)
Create a function that can be run by the inferrer at compile time.
625941db9f2886367277ab76
def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/Netflix/SearchTitleCatalog')
Create a new instance of the SearchTitleCatalog Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
625941dbaad79263cf390d30
def get(self, key, default=None): <NEW_LINE> <INDENT> return self.cache.get(key, default)
Get value for the given key If no value is found the default value will be returned.
625941dbcad5886f8bd272c3
def review_alive_checks(): <NEW_LINE> <INDENT> tools.log.info("*** alive check() review ***") <NEW_LINE> t = Timer(alive_review_frequency, review_alive_checks) <NEW_LINE> t.start() <NEW_LINE> now = datetime.datetime.now() <NEW_LINE> for service in services: <NEW_LINE> <INDENT> if (now - service_TS[service]).total_secon...
alive_check timestamp regular check
625941dbbe8e80087fb20f29
def J_B(y_squared, method="bessel", derivative=0, **kwargs): <NEW_LINE> <INDENT> if derivative == 0: <NEW_LINE> <INDENT> assert method in METHODS, "{} is not a known method: {}".format(method, METHODS) <NEW_LINE> name = "J_B_{}".format(method) <NEW_LINE> <DEDENT> elif derivative == 1: <NEW_LINE> <INDENT> assert method ...
:param y_squared: Thermal function argument :type y_squared: float :param method: Method of calculating thermal function :type method: str :param derivative: Order of deriviatve :type derivative: int :returns: Thermal function J_B(y^2) :rtype: float
625941db498bea3a759b9d99
def pose_flip(pose, use_flip): <NEW_LINE> <INDENT> pose_new = pose <NEW_LINE> if use_flip[0]: <NEW_LINE> <INDENT> pose_new = pose[::-1] <NEW_LINE> <DEDENT> if use_flip[1] and use_flip[2]: <NEW_LINE> <INDENT> pose_new = 1 - pose <NEW_LINE> pose_new[pose_new == 1] = 0 <NEW_LINE> <DEDENT> elif use_flip[1]: <NEW_LINE> <IND...
:param pose: T V C[x,y] M :param use_flip: :return:
625941db435de62698dfdf38
def parse_delimited_list(name, value, default): <NEW_LINE> <INDENT> parsed_value = value <NEW_LINE> if isinstance(value, str): <NEW_LINE> <INDENT> parsed_value = value.split(",") <NEW_LINE> <DEDENT> return [item.strip(" ") for item in parsed_value]
Parses a comma separated string into a list Argumments: value (str or list[str]): the value as a string or list of strings Returns: list[str]: the parsed value
625941db21a7993f00bc7fdf
def clear_copyright_registration_terms(self): <NEW_LINE> <INDENT> raise errors.Unimplemented()
Clears the copyright registration terms. *compliance: mandatory -- This method must be implemented.*
625941db1f037a2d8b9464e8
def levelOrder(self, root): <NEW_LINE> <INDENT> travel_result = [] <NEW_LINE> search_queue = [(root, 0)] <NEW_LINE> while search_queue != []: <NEW_LINE> <INDENT> node, depth = search_queue.pop(0) <NEW_LINE> if node is None: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if len(travel_result) <= depth: <NEW_LINE> <IND...
:type root: TreeNode :rtype: List[List[int]]
625941db16aa5153ce362762
def sweep(self, *args, **kwargs): <NEW_LINE> <INDENT> return Parameter.sweep(self, *args, **kwargs)
Create a SweepValues from this parameter. See Parameter.sweep.
625941db76e4537e8c35195f
def problem_builder(args, config): <NEW_LINE> <INDENT> if not args.problem_paths: <NEW_LINE> <INDENT> print("usage: shell_manager package [-h] [-s STAGING_DIR] [-o OUT] [-i IGNORE] problem_path") <NEW_LINE> print("shell_manager bundle: error: the following arguments are required: problem_path") <NEW_LINE> raise FatalEx...
Main entrypoint for package building operations.
625941dbb545ff76a8914100
def set_stb(self, command): <NEW_LINE> <INDENT> self._log('set_stb') <NEW_LINE> ret = lib.DioSetStbPulseCommand(self.ndev, command) <NEW_LINE> self._error_check(ret) <NEW_LINE> return
16. DioSetStbPulseCommand
625941db4527f215b584c73f
def create_filer_image(pil_image, user): <NEW_LINE> <INDENT> if FilerImage is None: <NEW_LINE> <INDENT> raise ImportError(FILER_IMPORT_ERROR) <NEW_LINE> <DEDENT> file_obj = DjangoFile(pil_image, name=pil_image.name) <NEW_LINE> image = FilerImage.objects.create(owner=user, original_filename=pil_image.name, file=file_obj...
Create from a PIL image a filer.models.Image() instance
625941db925a0f43d254a164
def single_parameter_singleton(cls): <NEW_LINE> <INDENT> _instances = dict() <NEW_LINE> def get(*args, **kwargs): <NEW_LINE> <INDENT> key = None <NEW_LINE> if args: <NEW_LINE> <INDENT> key = args[0] <NEW_LINE> <DEDENT> if kwargs: <NEW_LINE> <INDENT> key = list(kwargs.values())[0] <NEW_LINE> <DEDENT> if key not in _inst...
decorator for a class to make a singleton out of it
625941dbcdde0d52a9e53320
def update_chassis(self, chassis, **attrs): <NEW_LINE> <INDENT> return self._update(_chassis.Chassis, chassis, **attrs)
Update a chassis. :param chassis: Either the name or the ID of a chassis, or an instance of :class:`~openstack.bare_metal.v1.chassis.Chassis`. :param dict attrs: The attributes to update on the chassis represented by the ``chassis`` parameter. :returns: The updated chassis. :rtype: :class:`~openstack.bare_met...
625941db30bbd722463cc0b3
def getAllOverrideClasses(): <NEW_LINE> <INDENT> pass
Returns the list of Override subclasses
625941dbfb3f5b602dac3981
def __str__(self): <NEW_LINE> <INDENT> return ','.join([str(x) for x in self.stack])
Comma seperated values
625941dbbe383301e01b576c
def summary(args): <NEW_LINE> <INDENT> print('Summary') <NEW_LINE> print(20 * '=') <NEW_LINE> overview = simcity.overview_total() <NEW_LINE> for k in sorted(overview.keys()): <NEW_LINE> <INDENT> print('{0:<15} {1}'.format(k, overview[k])) <NEW_LINE> <DEDENT> print(20 * '=')
Print summary of tasks.
625941db1d351010ab855e06
def unpin(self, cluster_name=None, cluster_id=None): <NEW_LINE> <INDENT> METHOD = 'POST' <NEW_LINE> API_PATH = 'clusters/unpin' <NEW_LINE> return self.__send_cluster_id_to_endpoint(method=METHOD, api_path=API_PATH, cluster_name=cluster_name, cluster_id=cluster_id)
Pin the cluster to the cluster list Either cluster_name or cluster_id are required. If both are specified cluster_name is ignored. Parameters ---------- cluster_name : str, optional The name of the cluster. cluster_id : str, optional The id of the cluster to be unpinned. Returns ------- The cluster ID o...
625941db07d97122c4178b7c
def getAvailabilityGroup(self, id0, id1, id2, id3): <NEW_LINE> <INDENT> total_weight = 0 <NEW_LINE> list_of_ids = [id0, id1, id2, id3] <NEW_LINE> for i in range(0, len(list_of_ids)): <NEW_LINE> <INDENT> for j in range(0, len(list_of_ids)): <NEW_LINE> <INDENT> if i != j: <NEW_LINE> <INDENT> total_weight += self.getAvail...
Compute the weight for a group of 4 people on availability
625941db24f1403a92600e4f
def get_price(self, region, imageid, cpu, memory, count, charge_type=None, disk_space=None): <NEW_LINE> <INDENT> body = {} <NEW_LINE> body['Region'] = region <NEW_LINE> body['Action'] = 'GetUHostInstancePrice' <NEW_LINE> body['ImageId'] = imageid <NEW_LINE> body['CPU'] = cpu <NEW_LINE> body['Memory'] = memory <NEW_LINE...
get price of the given configuration instance :param region: :param imageid: :param cpu: :param memory: :param count: :param charge_type: :param disk_space: :return:
625941dbcad5886f8bd272c4
def webob_to_django_response(webob_response): <NEW_LINE> <INDENT> from django.http import HttpResponse <NEW_LINE> django_response = HttpResponse( webob_response.app_iter, content_type=webob_response.content_type ) <NEW_LINE> for name, value in webob_response.headerlist: <NEW_LINE> <INDENT> django_response[name] = value...
Returns a django response to the `webob_response`
625941db379a373c97cfae31
def setup_logger(log_folder: str, modname=__name__): <NEW_LINE> <INDENT> logger = getLogger(modname) <NEW_LINE> logger.setLevel(DEBUG) <NEW_LINE> if not logger.hasHandlers(): <NEW_LINE> <INDENT> sh = StreamHandler() <NEW_LINE> sh.setLevel(DEBUG) <NEW_LINE> formatter = Formatter("%(asctime)s - %(name)s - %(levelname)s -...
loggerの設定をする
625941db046cf37aa974d030
def hdi_classification(hdi): <NEW_LINE> <INDENT> if 1.0 > hdi >= 0.7: <NEW_LINE> <INDENT> return 1.0 <NEW_LINE> <DEDENT> elif 0.7 > hdi >= 0.30: <NEW_LINE> <INDENT> return 0.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError('Invalid HDI')
Input: hdi: HDI (human development index) value Output: high HDI vs low HDI class identification
625941db8e71fb1e9831da93
def test_parallel_beta_diversity_wo_tree(self): <NEW_LINE> <INDENT> params = {'metrics': 'bray_curtis', 'tree_path': None, 'jobs_to_start': 3, 'full_tree': False } <NEW_LINE> app = ParallelBetaDiversitySingle() <NEW_LINE> r = app(self.input1_fp, self.test_out, params, job_prefix='BTEST', poll_directly=True, suppress_su...
parallel beta diveristy functions in single file mode
625941db44b2445a3393237f
def get_asset_fields(self): <NEW_LINE> <INDENT> schema = self.sg.schema_field_read('Asset') <NEW_LINE> fields = schema.keys() <NEW_LINE> return sorted(fields)
Get all fields used by Shotgun to describe an Asset entity :returns: A list of Shotgun field names
625941db26068e7796caefcd
def p_fraction_divide(t): <NEW_LINE> <INDENT> t[0] = t[1] / t[3]
fraction : fraction DIVIDE fraction
625941db3617ad0b5ed681e1
def _poll(self, timeout): <NEW_LINE> <INDENT> processed = set() <NEW_LINE> start_select = time.time() <NEW_LINE> ready = self._selector.select(timeout) <NEW_LINE> end_select = time.time() <NEW_LINE> if self._sensors: <NEW_LINE> <INDENT> self._sensors.select_time.record((end_select - start_select) * 1000000000) <NEW_LIN...
Returns list of (response, future) tuples
625941db6fece00bbac2da2c
def update_model(self, form, model): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> form.populate_obj(model) <NEW_LINE> self.on_model_change(form, model) <NEW_LINE> self.session.commit() <NEW_LINE> <DEDENT> except Exception as ex: <NEW_LINE> <INDENT> flash(gettext('Failed to update model. %(error)s', error=str(ex)), 'err...
Update model from form. :param form: Form instance :param model: Model instance
625941db3c8af77a43ae3a8e
def get_id(self): <NEW_LINE> <INDENT> return str(self.soup['data-movie-id'])
Get the id.
625941db8e7ae83300e4b2b9
def _get_albums(self, artist_id): <NEW_LINE> <INDENT> sql = Lp.db.get_cursor() <NEW_LINE> if artist_id == Type.COMPILATIONS: <NEW_LINE> <INDENT> albums = [Lp.player.current_track.album_id] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> albums = Lp.artists.get_albums(artist_id, sql) <NEW_LINE> <DEDENT> sql.close() <NEW_L...
Get albums @return album ids as [int]
625941db97e22403b379d286
@app.route('/dining/hours') <NEW_LINE> @support_jsonp <NEW_LINE> @require_client_id() <NEW_LINE> def req_dining_hours(): <NEW_LINE> <INDENT> eatery = verify_eatery(request.args.get('eatery', '')) <NEW_LINE> now = get_dining_date() <NEW_LINE> year = int(request.args.get('year', now.year)) <NEW_LINE> month = int(request....
Endpoint for all hours requests (see README for documentation)
625941db0a366e3fb873eb07
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941dba79ad161976cc431
def geometry_minimization (self, selection=None, bond=True, nonbonded=True, angle=True, dihedral=True, chirality=True, planarity=True, max_number_of_iterations=500, number_of_macro_cycles=5, rmsd_bonds_termination_cutoff = 0, rmsd_angles_termination_cutoff = 0) : <NEW_LINE> <INDENT> from mmtbx.refinement import geomet...
Perform geometry minimization on a selection of boxed atoms.
625941db66656f66f7cbc498
def pearson_loss_function(output1, output2, p): <NEW_LINE> <INDENT> new_output = output1 / p <NEW_LINE> m = (new_output @ output2.transpose(1,0)) <NEW_LINE> m1 = m*I <NEW_LINE> m2 = m*(E-I) <NEW_LINE> m2 = m2*m2 <NEW_LINE> return -(2 * sum(sum(m1)) - 2 * Config.batch_size) / normalize_1 + (sum(sum(m2)) - normalize_2) ...
:param output1: left output :param output2: right output :param p: priori :return: -MIG^f where f-divergence is Pearson X^2
625941db9b70327d1c4e10c1
def test_fromdict2(self): <NEW_LINE> <INDENT> sergrp = ServiceGroup('S1') <NEW_LINE> sergrp.fromdict( {'services': {'hpss_nfs': {'target': 'localhost', 'require': ['lustre', 'test'], 'actions': {'start': {'cmd': '/bin/True'}, 'stop': {'cmd': '/bin/False'}}, 'desc': "I'm the service hpss_nfs" }, 'lustre': {'target': 'lo...
Test instanciation of a service group with dependencies between subservices.
625941dbd53ae8145f87a557
def __init__(__self__, *, description: Optional[pulumi.Input[str]] = None, events: Optional[pulumi.Input['ServiceLevelEventsArgs']] = None, guid: Optional[pulumi.Input[str]] = None, name: Optional[pulumi.Input[str]] = None, objective: Optional[pulumi.Input['ServiceLevelObjectiveArgs']] = None, sli_guid: Optional[pulumi...
Input properties used for looking up and filtering ServiceLevel resources. :param pulumi.Input[str] description: The description of the SLI. :param pulumi.Input['ServiceLevelEventsArgs'] events: The events that define the NRDB data for the SLI/SLO calculations. See Events below for details. :param pulumi.Input[s...
625941db0fa83653e46572a5
def tree_to_recarray_py(trees, branches=None, use_cache=False, cache_size=1000000, include_weight=False, weight_name='weight', weight_dtype='f4'): <NEW_LINE> <INDENT> if not isinstance(trees, (list, tuple)): <NEW_LINE> <INDENT> trees = [trees] <NEW_LINE> <DEDENT> trees = [asrootpy(tree) for tree in trees] <NEW_LINE> tr...
Convert a tree or a list of trees into a numpy.recarray with fields corresponding to the tree branches (the slow pure-Python way...)
625941db3d592f4c4ed1d353
def extract_person_certifications(self, person): <NEW_LINE> <INDENT> sec = self.soup.find(id='certifications') <NEW_LINE> if sec is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> items = sec.find_all('li', class_='certification') <NEW_LINE> for li in items: <NEW_LINE> <INDENT> pc = PersonCertification() <NEW_LINE...
Extracts a person's certifications information from HTML. :param person: a Person object :return: None
625941db5166f23b2e1a5444
def observe_transition(self, state, action, next_state, next_action, reward): <NEW_LINE> <INDENT> self.episode_rewards += reward <NEW_LINE> self.update(state, action, next_state, next_action, reward)
state: the state (s) in which action was taken action: the action (a) taken in the state (s) next_state: the next state (s'), in which agnet will perform next action, that resulted from state (s) and action (a) reward: reward obtained for taking action (a) in state (s) and going to next state (s')
625941db82261d6c526ab78e
def firstUniqChar(self, s): <NEW_LINE> <INDENT> chard = {} <NEW_LINE> for i in range(len(s)): <NEW_LINE> <INDENT> if s[i] in chard: <NEW_LINE> <INDENT> chard[s[i]] += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> chard[s[i]] = 1 <NEW_LINE> <DEDENT> <DEDENT> for i in range(len(s)): <NEW_LINE> <INDENT> if chard[s[i]] =...
:type s: str :rtype: int
625941dbcc0a2c11143dd17c
def _decode_next_layer(self, dict_, proto=None, length=None): <NEW_LINE> <INDENT> next_ = self._import_next_layer(proto, length) <NEW_LINE> name_ = str(proto or 'Raw').lower() <NEW_LINE> dict_[name_] = next_[0] <NEW_LINE> self._protos = ProtoChain(proto, next_[1]) <NEW_LINE> return dict_
Decode next layer protocol. Keyword arguments: dict_ -- dict, info buffer proto -- str, next layer protocol name length -- int, valid (not padding) length
625941db9f2886367277ab77
def els_min_distance(self, el1, el2, points_idxs=[0, 1, 2, 3]): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = self.execute_jsfun('_XPS.minDistance', el1, el2, points_idxs) <NEW_LINE> return res <NEW_LINE> <DEDENT> except (selenium.common.exceptions.NoSuchElementException, selenium.common.exceptions.StaleElementRef...
Minimal distance between middle-points of borders of two elements.
625941db4f6381625f114d27
def test_update_ipsec_site_connection_peer_cidrs(self): <NEW_LINE> <INDENT> new_peers = {'peer_cidrs': ['192.168.4.0/24', '192.168.5.0/24']} <NEW_LINE> self._test_update_ipsec_site_connection( update=new_peers)
Test updating an ipsec_site_connection for peer_cidrs.
625941dbcb5e8a47e48b7d92
def __init__(self, meter_id=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.meter_id = meter_id
Instruction structure for OFPIT_METER. Args: - meter_id (int): Meter instance.
625941db26238365f5f0f15d
def gamma(self): <NEW_LINE> <INDENT> return exp(-self.c*self.t)*calcphi(self.d1)/(self.sigma*self.s0*sqrt(self.t))
gamma
625941db1d351010ab855e07
def send_log_email(message): <NEW_LINE> <INDENT> email_data = ReceiverEmailConfiguration.objects.values_list( 'email_address', flat=True) <NEW_LINE> email = list(email_data) <NEW_LINE> sender_email_configuration = SenderEmailConfiguration.objects.first() <NEW_LINE> sender = sender_email_configuration.sender_email_addre...
function to send emails of log file to personas
625941db56ac1b37e62644b6
def inverse(self): <NEW_LINE> <INDENT> inverse = Bareme(self._name + "'") <NEW_LINE> seuilImp, taux = 0, 0 <NEW_LINE> for seuil, taux in self: <NEW_LINE> <INDENT> if seuil==0: theta, tauxp = 0,0 <NEW_LINE> seuilImp = (1-tauxp)*seuil + theta <NEW_LINE> inverse.addTranche(seuilImp, 1/(1-taux)) <NEW_LINE> theta = (taux - ...
Returns a new instance of Bareme Inverse un barème: étant donné des tranches et des taux exprimés en fonction du brut, renvoie un barème avec les tranches et les taux exprimé en net. si revnet = revbrut - BarmMar(revbrut, B) alors revbrut = BarmMar(revnet, B.inverse()) seuil : seuil de revenu brut seuil imposable ...
625941db26068e7796caefce
def p_record_variable_list_1(p): <NEW_LINE> <INDENT> p[0] = IdentifierListNode(p[3], p[1]) <NEW_LINE> p[0].pos_info = get_pos(p, 0)
record_variable_list : record_variable_list comma variable_access
625941dbe5267d203edcdf85
def get_kb_angle(lons, lats, alts, ephtimes, tx_lon=-75.552, tx_lat=45.503, tx_alt=0.07): <NEW_LINE> <INDENT> import numbers <NEW_LINE> if isinstance(lons, numbers.Number): <NEW_LINE> <INDENT> logging.info("Inputting single query") <NEW_LINE> kv = get_kvecs(lons, lats, alts) <NEW_LINE> bv = get_bvec(lons, lats, alts, e...
This function takes the ephemeris data as arguments and using the Ottawa NRCAN transmitter, compares the k (line of sight) vector and the IGRF B field vector to determine the relative angle between the propagating radio wave and the Bfield in the ionospheric plasma. The purpose of this is to get an idea of which mode ...
625941dbb5575c28eb68e2ee
def test_sub_disband(): <NEW_LINE> <INDENT> daide_str = 'SUB ( ( RUS FLT GOB ) DSB )' <NEW_LINE> expected_str = 'SUB ((RUS FLT GOB) DSB)' <NEW_LINE> request = RequestBuilder.from_bytes(str_to_bytes(daide_str)) <NEW_LINE> assert isinstance(request, requests.SUB), 'Expected a SUB request' <NEW_LINE> assert bytes(request)...
Tests the SUB request
625941dbcc40096d61595c3b
def rollback(self): <NEW_LINE> <INDENT> self._connection.rollback()
回滚
625941db91af0d3eaac9bd07
def validSelf(self): <NEW_LINE> <INDENT> API().assertElementByName(self.testcase, self.driver, self.logger, GoodsDetailsPageConfigs.name_reource_goods_details_title_st, GoodsDetailsPageConfigs.assert_view_timeout)
usage: verify whether the current page is correct page.
625941db009cb60464c6369b
def test_topologykey_hash_uniqueness(): <NEW_LINE> <INDENT> smirks = "[#1:1]-[#8X2:2]" <NEW_LINE> ref = TopologyKey(id=smirks) <NEW_LINE> with_atom_indices = TopologyKey(id=smirks, atom_indices=(2, 0)) <NEW_LINE> with_mult = TopologyKey(id=smirks, mult=2) <NEW_LINE> with_bond_order = TopologyKey(id=smirks, bond_order=5...
Test that TopologyKey hashes differ when optional attributes are set.
625941db8a43f66fc4b5434e
def _download_srtm_file_unlocked(zone): <NEW_LINE> <INDENT> tmpdir = cfg.PATHS['tmp_dir'] <NEW_LINE> mkdir(tmpdir) <NEW_LINE> outpath = os.path.join(tmpdir, 'srtm_' + zone + '.tif') <NEW_LINE> if os.path.exists(outpath): <NEW_LINE> <INDENT> return outpath <NEW_LINE> <DEDENT> wwwfile = ('http://srtm.csi.cgiar.org/wp-con...
Checks if the srtm data is in the directory and if not, download it.
625941db5510c4643540f6c9
def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(NUVNFMetadata, self).__init__() <NEW_LINE> self._name = None <NEW_LINE> self._last_updated_by = None <NEW_LINE> self._last_updated_date = None <NEW_LINE> self._description = None <NEW_LINE> self._blob = None <NEW_LINE> self._embedded_metadata = None <NEW_LINE> sel...
Initializes a VNFMetadata instance Notes: You can specify all parameters while calling this methods. A special argument named `data` will enable you to load the object from a Python dictionary Examples: >>> vnfmetadata = NUVNFMetadata(id=u'xxxx-xxx-xxx-xxx', name=u'VNFMetadata') >>> vnfmetadata = ...
625941db5fc7496912cc3c6a
def cast(*args): <NEW_LINE> <INDENT> return _itkSaltAndPepperNoiseImageFilterPython.itkSaltAndPepperNoiseImageFilterIUS2IUS2_cast(*args)
cast(itkLightObject obj) -> itkSaltAndPepperNoiseImageFilterIUS2IUS2
625941db566aa707497f4851
def register_request_manager_mapping(self, component, request_manager): <NEW_LINE> <INDENT> if not request_manager in self._request_managers: <NEW_LINE> <INDENT> raise MorseServiceError("Request manager '%s' has not been registered!" % request_manager) <NEW_LINE> <DEDENT> instance = self._request_managers[request_manag...
Adds a mapping between a component and a request manager: all services exposed by this component are handled by this request manager. A component may have 0, 1 or more request managers. if more than one, each request manager can independently invoke the service. :param string component: the name of the component that...
625941db21bff66bcd684c3b
def test_65403(self): <NEW_LINE> <INDENT> tmpdir = self.testdir() <NEW_LINE> filename = self.zip_CVE_2018_15 <NEW_LINE> file_url = self.url_CVE_2018_15 <NEW_LINE> download_raw(file_url, filename, tmpdir) <NEW_LINE> exe = self.bins("unzzip-mix") <NEW_LINE> run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), ...
unzzip-mix -l $(CVE).zip
625941dbbaa26c4b54cb1408
def connect(self, ip, port): <NEW_LINE> <INDENT> self.client.connect((ip, port))
:param ip: :param port: :return:
625941db627d3e7fe0d6913d
def test_strip_message(self): <NEW_LINE> <INDENT> self.login("hamlet@zulip.com") <NEW_LINE> post_data = {"type": "stream", "to": "Verona", "client": "test suite", "content": " I like whitespace at the end! \n\n \n", "subject": "Test subject"} <NEW_LINE> result = self.client_post("/json/messages", post_data) <NEW_LINE>...
Sending a message longer than the maximum message length succeeds but is truncated.
625941db96565a6dacc8f9b6
def list_categories(self): <NEW_LINE> <INDENT> q = "SELECT category, count(category) FROM blog_article" " GROUP BY category ORDER BY category ASC" <NEW_LINE> cur = self.dbh.cursor() <NEW_LINE> cur.execute(q) <NEW_LINE> return cur.fetchall()
Returns list of categories (category, num articles).
625941dbadb09d7d5db6ca7a
def _filter_data(lhs, rhs, weights=None): <NEW_LINE> <INDENT> if not isinstance(lhs, Series): <NEW_LINE> <INDENT> if not ((len(lhs) == len(rhs))): <NEW_LINE> <INDENT> raise AssertionError() <NEW_LINE> <DEDENT> lhs = Series(lhs, index=rhs.index) <NEW_LINE> <DEDENT> rhs = _combine_rhs(rhs) <NEW_LINE> lhs = DataFrame({'__...
Cleans the input for single OLS. Parameters ---------- lhs : Series Dependent variable in the regression. rhs : dict, whose values are Series, DataFrame, or dict Explanatory variables of the regression. weights : array-like, optional 1d array of weights. If None, equivalent to an unweighted OLS. Returns ...
625941db0c0af96317bb84d4
def f(N, S): <NEW_LINE> <INDENT> ans = N <NEW_LINE> w_cumsum = [0] * N <NEW_LINE> w_cumsum[0] = int(S[0] == "W") <NEW_LINE> for i in range(1, N): <NEW_LINE> <INDENT> w = int(S[i] == "W") <NEW_LINE> w_cumsum[i] = w_cumsum[i-1] + w <NEW_LINE> <DEDENT> for i in range(N): <NEW_LINE> <INDENT> diff = w_cumsum[i] - int(S[i] =...
leaderにする人の東西について どちらを向いているか分かればよい
625941db7b25080760e39744
def call_constructor(constr, args, kwargs=None): <NEW_LINE> <INDENT> if kwargs is None: <NEW_LINE> <INDENT> if isinstance(args, Iterable): <NEW_LINE> <INDENT> op = constr(*args) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> op = constr(args) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if isinstance(args, Ite...
Function to call the constructor
625941db4e4d5625662d46c0
def test(test_dataloader, test_entity_list, id2tag, model): <NEW_LINE> <INDENT> device = torch.device("cuda" if torch.cuda.is_available() else "cpu") <NEW_LINE> model.eval() <NEW_LINE> output_tag_ids = [] <NEW_LINE> with torch.no_grad(): <NEW_LINE> <INDENT> for _, (batch_tensor, batch_sent_len, batch_tags) in enumerate...
测试模型
625941dbad47b63b2c50a26a
def absolute_path(self, path): <NEW_LINE> <INDENT> return TFNode.hdfs_path(self, path)
Convenience function to access ``TFNode.hdfs_path`` directly from this object instance.
625941dbbf627c535bc134bb
def unpack_source(): <NEW_LINE> <INDENT> run('mkdir -p ~/emol') <NEW_LINE> with cd('~/emol'): <NEW_LINE> <INDENT> run('tar -xzf /tmp/emol_source.tgz .')
Extract the eMoL source to the public_html directory.
625941db8e05c05ec3eea663
def VPI_StopPWM(DevType, DevIndex, ChannelMask): <NEW_LINE> <INDENT> return GinkgoLib.VPI_StopPWM(c_int(DevType), c_int(DevIndex), c_ubyte(ChannelMask))
Stop PWM
625941dbb830903b967e9bf4
def SignContractByKeyword(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("SignContractByKeyword", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.SignContractByKey...
此接口适用于:客户平台在创建好合同后,由合同签署方对创建的合同内容进行确认,无误后再进行签署。客户平台使用该接口对PDF合同文档按照关键字和坐标进行签署。 :param request: 调用SignContractByKeyword所需参数的结构体。 :type request: :class:`tencentcloud.ds.v20180523.models.SignContractByKeywordRequest` :rtype: :class:`tencentcloud.ds.v20180523.models.SignContractByKeywordResponse`
625941db462c4b4f79d1d9bc
def test_insert_lines_z(self): <NEW_LINE> <INDENT> target_path, gpkg, srs, fields = self._setup_basics( 'test_insert_lines_z.gpkg') <NEW_LINE> fc = gpkg.create_feature_class( 'test1', srs, fields=fields, shape_type=GeometryType.linestring, z_enabled=True) <NEW_LINE> line = [(300000, 1, 10), (300000, 4000000, 20), (7000...
Test insert a line
625941db45492302aab5e5b2
def test_handleEvent(self): <NEW_LINE> <INDENT> sf = SpiderFoot(self.default_options) <NEW_LINE> module = sfp_yandexdns() <NEW_LINE> module.setup(sf, dict()) <NEW_LINE> target_value = 'example target value' <NEW_LINE> target_type = 'IP_ADDRESS' <NEW_LINE> target = SpiderFootTarget(target_value, target_type) <NEW_LINE> ...
Test handleEvent(self, event)
625941db21a7993f00bc7fe0
def get_total_fuel(mass: int) -> int: <NEW_LINE> <INDENT> initial_fuel = int(mass/3) - 2 <NEW_LINE> if initial_fuel <= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return initial_fuel + get_total_fuel(initial_fuel)
:return: >>> get_total_fuel(1969) 966 >>> get_total_fuel(100756) 50346
625941db167d2b6e31218e81
def load_dataset(data_dir, include_mass = True, **params): <NEW_LINE> <INDENT> ir_path = os.path.join(data_dir, 'ir.csv') <NEW_LINE> logging.info('Loading IR data from {}'.format(ir_path)) <NEW_LINE> ir_df = pd.read_csv(ir_path, index_col = 0) <NEW_LINE> ir_df = preprocess_spectra_df(ir_df, is_mass = False, **params).T...
Load the spectra and target dataset for training Args: data_dir: (string) contains data path for csv file include_mass: (bool) whether to include mass spectra while training params: (dict) containing methods for interpolation Returns: X: (np.array) contains processed spectra values y: (np.array) c...
625941db21bff66bcd684c3c
def setTargetPosition(tcp, axis, target): <NEW_LINE> <INDENT> axis = str(axis) <NEW_LINE> target = str(target) <NEW_LINE> tcp.send(bytes('{"jsonrpc": "2.0", "method": "com.attocube.amc.move.setControlTargetPosition", "params": ['+axis+','+target+'], "id": 3}', 'utf-8')) <NEW_LINE> response = json.loads(getJSONresponse(...
sets the target position for the movement on the selected axis Parameters ---------- tcp : Int32 TCP/IP connection ID axis : Int32 Number of the axis to be used [0..2] target : Int32 target position in nm Returns ------- errorNumber : Int32 No error = 0
625941dc10dbd63aa1bd2e8e
def create_aeff(event_class, event_type, egy, cth): <NEW_LINE> <INDENT> irf = create_irf(event_class, event_type) <NEW_LINE> irf.aeff().setPhiDependence(False) <NEW_LINE> theta = np.degrees(np.arccos(cth)) <NEW_LINE> m = np.zeros((len(egy), len(cth))) <NEW_LINE> for i, x in enumerate(egy): <NEW_LINE> <INDENT> for j, y ...
Create an array of effective areas versus energy and incidence angle. Binning in energy and incidence angle is controlled with the egy and cth input parameters. Parameters ---------- event_class : str Event class string (e.g. P8R2_SOURCE_V6). event_type : list egy : array_like Evaluation points in energy (M...
625941db090684286d50efd4
def get_substitutes(product): <NEW_LINE> <INDENT> url = "cgi/search.pl?tagtype_0=categories&tag_contains_0=contains&tag_0={}&page_size=500&page=1&action=process&json=1" <NEW_LINE> result = fetch_m(url.format(product.categorie)) <NEW_LINE> products = list() <NEW_LINE> for element in result['products']: <NEW_LINE> <INDEN...
Get healthier products from a selected product
625941dcde87d2750b860081
def p_case_statement_4(p): <NEW_LINE> <INDENT> p[0] = CaseStatementNode(p[2], p[4], p[7]) <NEW_LINE> p[0].pos_info = get_pos(p, 0)
case_statement : CASE case_index OF case_list_element_list semicolon otherwisepart statement SEMICOLON END
625941dc5fcc89381b1e19ae
def select_cross_event(slclist, event_date, num_igrams=None): <NEW_LINE> <INDENT> insert_idx = np.searchsorted(slclist, event_date) <NEW_LINE> num_igrams = num_igrams or len(slclist) - insert_idx <NEW_LINE> start_idx = np.clip(insert_idx - num_igrams, 0, None) <NEW_LINE> end_idx = insert_idx + num_igrams <NEW_LINE> geo...
Choose a list of independent igrams spanning `event_date`
625941dc5f7d997b87174d87
def readlink(self, path): <NEW_LINE> <INDENT> path = self._adjust_cwd(path) <NEW_LINE> self._log(DEBUG, 'readlink(%r)' % path) <NEW_LINE> t, msg = self._request(CMD_READLINK, path) <NEW_LINE> if t != CMD_NAME: <NEW_LINE> <INDENT> raise SFTPError('Expected name response') <NEW_LINE> <DEDENT> count = msg.get_int() <NEW_L...
Return the target of a symbolic link (shortcut). You can use `symlink` to create these. The result may be either an absolute or relative pathname. :param str path: path of the symbolic link file :return: target path, as a `str`
625941dc50812a4eaa59c60b
def whoami(args): <NEW_LINE> <INDENT> scheduler = Scheduler(mnr_crt, mnr_key) <NEW_LINE> print(scheduler.auth())
Function that prints user identity
625941dcbe383301e01b576d
def heat_capacity_ratio_std(self, temp): <NEW_LINE> <INDENT> if temp <= 600: <NEW_LINE> <INDENT> return self.gamma_air_perfect <NEW_LINE> <DEDENT> elif 600 < temp <= 900: <NEW_LINE> <INDENT> return self.gamma_air_comp <NEW_LINE> <DEDENT> elif 900 < temp <= 1400: <NEW_LINE> <INDENT> return self.gamma_air_exp <NEW_LINE> ...
Piece-wise heat capacity ratio as a function of the temperature. The heat capacity ratio is made constant during the temperature interval where it is defined: Until 600K: gamma_air_perfect, from 600 to 900K gamma_air_comp, from 900K to 1400K gamma_air_exp and from 1400K to 2000K gamma_air_comb. + Inputs: -------...
625941dc45492302aab5e5b3
def clip_by_rect(geom, xmin, ymin, xmax, ymax): <NEW_LINE> <INDENT> if geom.is_empty: <NEW_LINE> <INDENT> return geom <NEW_LINE> <DEDENT> result = geom_factory(lgeos.methods['clip_by_rect'](geom._geom, xmin, ymin, xmax, ymax)) <NEW_LINE> return result
Returns the portion of a geometry within a rectangle The geometry is clipped in a fast but possibly dirty way. The output is not guaranteed to be valid. No exceptions will be raised for topological errors. Parameters ---------- geom : geometry The geometry to be clipped xmin : float Minimum x value of the rec...
625941dc6aa9bd52df037091
def ccid_xfr_block(self, data, timeout=0.1): <NEW_LINE> <INDENT> frame = struct.pack("<BI5B", 0x6F, len(data), 0, 0, 0, 0, 0) + data <NEW_LINE> self.transport.write(bytearray(frame)) <NEW_LINE> frame = self.transport.read(int(timeout * 1000)) <NEW_LINE> if not frame or len(frame) < 10: <NEW_LINE> <INDENT> log.error("in...
Encapsulate host command *data* into an PC/SC Escape command to send to the device and extract the chip response if received within *timeout* seconds.
625941dcd6c5a10208144339
def streamTo(self, *args): <NEW_LINE> <INDENT> return _coda_io.SeekableBidirectionalStream_streamTo(self, *args)
streamTo(SeekableBidirectionalStream self, OutputStream & soi, sys::SSize_T numBytes) -> sys::SSize_T streamTo(SeekableBidirectionalStream self, OutputStream & soi) -> sys::SSize_T
625941dc4f6381625f114d28
def weird_filter(self, elems): <NEW_LINE> <INDENT> return [e for e in elems if e.startswith('-')]
When building packages, the output of the enclosing Make is sometimes mixed among the subprocess output. I have no idea why. As a hack filter out everything that is not a flag.
625941dce64d504609d74b2c