code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def create_machines(configData, full_path): <NEW_LINE> <INDENT> if json_key in configData: <NEW_LINE> <INDENT> jsonDataArray = configData[json_key] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logging.error(json_key + " config data missing from json. will not install") <NEW_LINE> return <NEW_LINE> <DEDENT> if common_k...
Meant to add machines to a running WebLogic domain
625941e5be383301e01b589a
def assert_response_content(self, dictionary): <NEW_LINE> <INDENT> assert_true(isinstance(dictionary, dict)) <NEW_LINE> assert_greater(len(dictionary), 0) <NEW_LINE> self.assert_error_key(dictionary)
All requests responses should pass through this tests
625941e573bcbd0ca4b2c492
def formatHtml(text, fail): <NEW_LINE> <INDENT> text = list(text.strip().split('\n')) <NEW_LINE> output = [] <NEW_LINE> longest = 0 <NEW_LINE> lineLen = [] <NEW_LINE> s = 0 <NEW_LINE> for line in text: <NEW_LINE> <INDENT> if line: <NEW_LINE> <INDENT> i = line.index(SEED[s]) <NEW_LINE> s += 1 <NEW_LINE> if s > SEEDLIM: ...
(str) -> list of str Clothes the capitalized letter in each line with html bold tags, converts the mesostic string to a list splitting new lines into new empty-string elements (which will be displayed as blank lines by the template) so that it is ready to print in html <pre> tags. The Django template ...
625941e51b99ca400220aed0
def _init_base_err(self): <NEW_LINE> <INDENT> args = self.args <NEW_LINE> if 'base' in self.records: <NEW_LINE> <INDENT> valid_errs = self.records['base'][1:] <NEW_LINE> self.base_err = valid_errs[args.validate_on] <NEW_LINE> return <NEW_LINE> <DEDENT> metrics = ['acc'] <NEW_LINE> if args.task[args.primary_task] != 'cl...
Compute validation results using base model.
625941e599cbb53fe6793001
def encrypt(data, key, iv=None): <NEW_LINE> <INDENT> assert isinstance(key, str) <NEW_LINE> assert isinstance(iv, str) or iv is None <NEW_LINE> key_raw = common.b64decode(key) <NEW_LINE> assert len(key_raw) == 32 <NEW_LINE> iv_raw = None <NEW_LINE> if iv is None: <NEW_LINE> <INDENT> iv_raw = os.urandom(AES.block_size) ...
Encrypts the data using specified key and IV (specified or random) Args: data: The data to be encrypted in raw form key (str): The base64-encoded key to use for AES-256 encryption iv (Optional[str]): If specified, the base64-encoed iv used for AES-256 encryption. If not specified, a random one is g...
625941e55166f23b2e1a5575
def get_pycon_events(data=_get_pycon_data()) -> List[PyCon]: <NEW_LINE> <INDENT> data = _get_pycon_data() <NEW_LINE> events = _reformat_html(data) <NEW_LINE> result = [] <NEW_LINE> for event in events: <NEW_LINE> <INDENT> if 'PyCon' in event['name']: <NEW_LINE> <INDENT> result.append( PyCon(event['name'] ,event['locati...
Scrape the PyCon events from the given website data and return a list of PyCon namedtuples. Pay attention to the application/ld+json data structure website data.
625941e51d351010ab855f37
def test_backward_with_simplified_cross_entropy_loss_gradient(self): <NEW_LINE> <INDENT> x = np.array([ [2, 5, 6, 4, 3], [3, 2, 3, 1, 1], ], dtype=np.float64) <NEW_LINE> y = np.array([2, 4]) <NEW_LINE> y_hat = self.softmax(x) <NEW_LINE> cce = CategoricalCrossEntropy() <NEW_LINE> cce(y_hat, y) <NEW_LINE> chained_gradien...
Compare the chained gradient with the known simplified gradient using cross-entropy loss.
625941e5dd821e528d63b5c2
def store_rule_group( self, rule_group_store, **kwargs ): <NEW_LINE> <INDENT> kwargs['async_req'] = kwargs.get( 'async_req', False ) <NEW_LINE> kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) <NEW_LINE> kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) <NEW_LINE> kwargs...
Store a new rule group. # noqa: E501 Creates a new rule group. The data required can be submitted as a JSON body or as a list of parameters. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.store_rule_group(rule_g...
625941e5596a897236089ed8
def sample_period(self,timeline_index=None): <NEW_LINE> <INDENT> if not self.exist_timeline_data():return None <NEW_LINE> if timeline_index is not None and 'NSAMPLES' in self.tdata[timeline_index].keys(): <NEW_LINE> <INDENT> self.nsamples = self.tdata[timeline_index]['NSAMPLES'] <NEW_LINE> <DEDENT> if self.nsamples is ...
the integration time per sample. This is in seconds. 2MHz is the sampling rate of the ASIC
625941e58c3a8732951587dc
def validate_tuple(validator, data): <NEW_LINE> <INDENT> if type(data) is not tuple: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if len(validator) != len(data): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return all(imap(validate_common, validator, data))
>>> validate_tuple((int, int), (1, 2)) True >>> validate_tuple((int, str), (1, 2)) False >>> validate_tuple((int,), 'foo') False
625941e5be7bc26dc91cda15
def __init__(self): <NEW_LINE> <INDENT> self.DealId = None <NEW_LINE> self.InstanceIds = None <NEW_LINE> self.RequestId = None
:param DealId: 交易的ID :type DealId: str :param InstanceIds: 实例ID :type InstanceIds: list of str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
625941e50a50d4780f6672b2
def log(self, action, extra=None, save=False): <NEW_LINE> <INDENT> params = { 'project': self.node.parent_id, 'node': self.node._primary_key, 'folder': self.node.get_addon('dropbox', deleted=True).folder } <NEW_LINE> if self.file_obj or self.path: <NEW_LINE> <INDENT> path = self.file_obj.path if self.file_obj else self...
Log an event. Wraps the Node#add_log method, automatically adding relevant parameters and prefixing log events with `"dropbox_"`. :param str action: Log action. Should be a class constant from NodeLog. :param dict extra: Extra parameters to add to the ``params`` dict of the new NodeLog.
625941e56aa9bd52df0371c3
def __init__(self, file_bool=False, argument="ecg_data.csv", threshold=0.9, thr_brady=50, thr_tachy=140, rawdata=None): <NEW_LINE> <INDENT> self.__threshold = threshold <NEW_LINE> self.__thr_brady = thr_brady <NEW_LINE> self.__thr_tachy = thr_tachy <NEW_LINE> self.data = None <NEW_LINE> self.avg_data = None <NEW_LINE> ...
.. function:: __init__(self, threshold=0.9, thr_brady=50, thr_tachy=140) :param argument: specifies the input file name :param threshold: specifies a heart beat :param thr_brady: indicates whether Bradycardia is detected :param thr_tachy: indicates whether Tachycardia is detected
625941e58e05c05ec3eea794
def login(self, username, password, googleauthcode=None, smsauthcode=None, pincode=None): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> self.password = password <NEW_LINE> self.pincode = pincode <NEW_LINE> url = 'https://www.emoney.ge/index.php/main/authorize' <NEW_LINE> headers = {"Host": "www.emoney.ge","Us...
:param username: mobile number or email of your account :param password: password :param googleauthcode: google authentication code (if enabled) :param smsauthcode: sms authentication code (if enabled) call .send_code() first to get code :return: dict
625941e5656771135c3ebc90
def normalize(localename): <NEW_LINE> <INDENT> code = localename.lower() <NEW_LINE> if ':' in code: <NEW_LINE> <INDENT> code = code.replace(':', '.') <NEW_LINE> <DEDENT> if '@' in code: <NEW_LINE> <INDENT> code, modifier = code.split('@', 1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> modifier = '' <NEW_LINE> <DEDENT...
Returns a normalized locale code for the given locale name. The returned locale code is formatted for use with setlocale(). If normalization fails, the original name is returned unchanged. If the given encoding is not known, the function defaults to the default encoding for the locale code just like setlocale() does...
625941e556b00c62f0f14a78
def yieldOutput(self): <NEW_LINE> <INDENT> width = self.__width <NEW_LINE> if width: <NEW_LINE> <INDENT> num_cols = len(width) <NEW_LINE> fmt = ['%%%ds' % -w for w in width] <NEW_LINE> if width[-1] > 0: <NEW_LINE> <INDENT> fmt[-1] = '%s' <NEW_LINE> <DEDENT> fmt = self.__sep.join(fmt) <NEW_LINE> for row in self.__cols: ...
Generate the text output for the table. @rtype: generator of str @return: Text output.
625941e550485f2cf553d1b8
def __init__(self, ai_settings, screen): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.image = pygame.image.load(r'\images\ships.png').convert_alpha() <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.screen_rect = screen.get_...
初始化飞船并设置其初始位置
625941e54527f215b584c86f
def performActionOnSelectedLayers(self, key): <NEW_LINE> <INDENT> layerType = self.getActiveLayerType() <NEW_LINE> if not layerType: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> lt = self.layersTable[layerType] <NEW_LINE> table = lt['tableWidget'] <NEW_LINE> sm = table.selectionModel() <NEW_LINE> lines = sm.selectedR...
Perform actions on selected layers for the clicked button key
625941e51f037a2d8b94661a
@pytest.mark.parametrize("cm", CacheMode) <NEW_LINE> @pytest.mark.parametrize("cls", CacheLineSize) <NEW_LINE> @pytest.mark.security <NEW_LINE> def test_neg_change_cache_mode(pyocf_ctx, cm, cls): <NEW_LINE> <INDENT> cache_device = Volume(S.from_MiB(50)) <NEW_LINE> cache = Cache.start_on_device(cache_device, cache_mode=...
Test whether it is possible to change cache mode to invalid value. :param pyocf_ctx: basic pyocf context fixture :param cm: cache mode we start with :param cls: cache line size we start with
625941e5b7558d58953c5328
def stop_export(self, finished=True): <NEW_LINE> <INDENT> if self._file: <NEW_LINE> <INDENT> self._file.close() <NEW_LINE> self._file = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(self._out)
Stops the writing to a file and closes it, if it was opened. :param finished: True if the process is finished. :type finished: bool.
625941e5be8e80087fb21059
def set_router_id(self, rid): <NEW_LINE> <INDENT> self._router_id = rid
Sets the router id of the object :param rid: String containing the router id
625941e5d99f1b3c44c679a4
def GetOutputMaximum(self): <NEW_LINE> <INDENT> return _itkIntensityWindowingImageFilterPython.itkIntensityWindowingImageFilterID2ID2_GetOutputMaximum(self)
GetOutputMaximum(self) -> double
625941e54f6381625f114e59
def load_calcs(selection): <NEW_LINE> <INDENT> load = pd.pivot_table( load_MW[selection].MW.reset_index(), index='FACILITY_ID', columns='REPORTING_YEAR', aggfunc=np.sum ).loc[:, ('MW')] <NEW_LINE> load.loc[:, 'load_max'] = load.max(axis=1) <NEW_LINE> load.loc[:, 't_max'] = target_char.groupby('FAC...
Final load calulcations.
625941e5a05bb46b383ecc3b
@app.route('/') <NEW_LINE> @templated('index.html') <NEW_LINE> def index(): <NEW_LINE> <INDENT> ctx = { 'statements': json.dumps( serialize_statements(ALCHEMY_STATEMENTS)), } <NEW_LINE> return ctx
The application payload of HTML, CSS, and JS. Bootstraps the default statement list.
625941e5460517430c394597
def create_zipfile(src, dist, zip_name): <NEW_LINE> <INDENT> os.chdir(src) <NEW_LINE> filename = zip_name + '.zip' <NEW_LINE> parent = os.path.abspath(os.path.join(dist, os.pardir)) <NEW_LINE> filename = os.path.join(parent, filename) <NEW_LINE> logger.info('Creating zip file at: {0}'.format(filename)) <NEW_LINE> zf = ...
Create a ZIP file.
625941e5004d5f362079a74e
def get_image(self, *a, **kwargs): <NEW_LINE> <INDENT> item_id = kwargs.get('item_id', None) <NEW_LINE> path = os.path.join(zoom.system.site.data_path, 'buckets') <NEW_LINE> bucket = Bucket(path) <NEW_LINE> return image_response('house.png', bucket.get(item_id))
return one of the images
625941e5a79ad161976cc562
def transact(self, initiator=None, security_credential=None, command_id=None, sender_identifier_type=None, receiver_identifier_type=None, amount=None, party_a=None, party_b=None, remarks=None, account_reference=None, queue_timeout_url=None, result_url=None): <NEW_LINE> <INDENT> payload = { "Initiator": initiator, "Secu...
This method uses Mpesa's B2B API to transact from one company to another. **Args:** - initiator (str): Username used to authenticate the transaction. - security_credential (str): Generate from developer portal - command_id (str): Options: BusinessPayBill, BusinessBuyGoods, DisburseFundsToBusiness, Business...
625941e5287bf620b61d3e7e
def get_scaling_info(self, instance_id, scaling_groups, scaling_instances): <NEW_LINE> <INDENT> if scaling_instances is None or scaling_groups is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> matched_scaling_group = self.get_matched_scaling_group( instance_id, scaling_groups, scaling_instances ) <NEW_LINE> ...
data.scaling_group = { 'id': '', 'name': '', 'active_scaling_configuration_id': '', 'launch_template': { 'id': '', 'version': '' } }
625941e596565a6dacc8fae7
def abs(self): <NEW_LINE> <INDENT> comment("Switching to absolute positioning") <NEW_LINE> self._grbl.streamLine("G90")
Switch to absolute positioning (G90)
625941e5711fe17d8254277f
def GetHistoryFile(self, index): <NEW_LINE> <INDENT> return self._fileHistory[index]
Returns the file at this index (zero-based). :param integer `index`: the index at which the file is stored in the file list (zero-based).
625941e510dbd63aa1bd2fbf
def _known(self, words): <NEW_LINE> <INDENT> return {w for w in words if w in self.bagOfWords}
Return the subset of words that are in the corpus.
625941e5460517430c394598
def load_topology_send_route_spec(self): <NEW_LINE> <INDENT> def _parse_one_group(elem, route_spec): <NEW_LINE> <INDENT> groups = elem.get("groups") <NEW_LINE> hosts = elem.get("hosts") <NEW_LINE> cidr = elem.get("cidr") <NEW_LINE> if groups and type(groups) is list: <NEW_LINE> <INDENT> for group in groups: <NEW_LIN...
Retrieve latest topology info from Romana topology store and send new spec. The topology information may contain recursive definitions of groups. Those need to be traversed and the host information for each group collected. * A group may either have another group (child group) or a list of hosts. * A group always h...
625941e53346ee7daa2b318c
def setUp(self): <NEW_LINE> <INDENT> self.client = Client() <NEW_LINE> self.teacher = User.objects.create_user( username='Test1', email='test1@gmail.com', password='test1234' ) <NEW_LINE> self.student = User.objects.create_user( username='Test2', email='test2@gmail.com', password='test1234', is_teacher=False ) <NEW_LIN...
This method will run before any test case.
625941e5fbf16365ca6f65e9
def last_update_timestamp(self): <NEW_LINE> <INDENT> path = os.path.expanduser(os.path.join( config['data_dir'], 'importer', self.external_name+'.timestamp', )) <NEW_LINE> if not os.path.isfile(path): <NEW_LINE> <INDENT> return int(time.time()) - 86400 <NEW_LINE> <DEDENT> with open(path, 'r') as f: <NEW_LINE> <INDENT> ...
Get the unix timestamp from when `incremental_updates()` was last run. For this to work it's required that `incremental_updates()` calls `save_timestamp()` after it's done. If there is no saved info it defaults to 24 hours ago. :returns: int
625941e5be8e80087fb2105a
def put(self, key: int, value: int): <NEW_LINE> <INDENT> index: int = key % self.number_of_hash_nodes <NEW_LINE> if self.hash_nodes[index] is None: <NEW_LINE> <INDENT> self.hash_nodes[index] = HashNode(key, value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> current = self.hash_nodes[index] <NEW_LINE> while True: <NEW...
value will always be non-negative.
625941e5f548e778e58cd99c
def read_date(self): <NEW_LINE> <INDENT> seconds, minutes, hours, dayofweek, day, month, year =self._bus.read_i2c_block_data(self.__rtcaddress, 0, 7) <NEW_LINE> date = ( "%02d-%02d-%02dT%02d:%02d:%02d " % (self.__bcd_to_dec(year) + self.__century, self.__bcd_to_dec(month), self.__bcd_to_dec(day), self.__bcd_...
read the date and time from the RTC in ISO 8601 format - YYYY-MM-DDTHH:MM:SS
625941e5091ae35668667374
def alerts(self, comcatId, server): <NEW_LINE> <INDENT> alert = self.find_match(comcatId, server) <NEW_LINE> if alert is None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> timestamp = dateutil.parser.parse(alert["timestamp"]) <NEW_LINE> conditions = [ "category=?", "(message_type=? OR message_type=?)", "event_id=?...
Get ShakeAlert alerts for event matching ComCat id. :type comcatId: str :param comcatId: ComCat event id.
625941e5a4f1c619b28b044d
def testExitingTag(self): <NEW_LINE> <INDENT> with open(os.devnull, 'w') as dev_null: <NEW_LINE> <INDENT> subprocess.Popen( ["git", "tag", 'v.' + self.new_version], stdout=dev_null, stderr=dev_null).communicate() <NEW_LINE> <DEDENT> assert self.sandbox.has_local_tag('v.' + self.new_version) <NEW_LINE> with pytest.raise...
Test existing tag
625941e582261d6c526ab8c3
def test_del_node_removes_all_edges_leading_to_that_node(empty_graph): <NEW_LINE> <INDENT> d = empty_graph <NEW_LINE> d.add_edge(1, 2) <NEW_LINE> d.del_node(2) <NEW_LINE> assert d.edges() == []
Test that del_node also removes all edges leading to that node.
625941e530bbd722463cc1e5
def _get_altaz(times, observer, targets, force_zero_pressure=False): <NEW_LINE> <INDENT> if not hasattr(observer, '_altaz_cache'): <NEW_LINE> <INDENT> observer._altaz_cache = {} <NEW_LINE> <DEDENT> aakey = _make_cache_key(times, targets) <NEW_LINE> if aakey not in observer._altaz_cache: <NEW_LINE> <INDENT> try: <NEW_LI...
Calculate alt/az for ``target`` at times linearly spaced between the two times in ``time_range`` with grid spacing ``time_resolution`` for ``observer``. Cache the result on the ``observer`` object. Parameters ---------- times : `~astropy.time.Time` Array of times on which to test the constraint. targets : {list, ...
625941e53eb6a72ae02ec905
def zip_files(): <NEW_LINE> <INDENT> for dirname in next(os.walk(plugin_dir))[1]: <NEW_LINE> <INDENT> archive_path = os.path.join(plugin_dir, dirname) <NEW_LINE> archive = zipfile.ZipFile(archive_path + ".zip", "w") <NEW_LINE> dirpath = os.path.join(plugin_dir, dirname) <NEW_LINE> plugin_files = [] <NEW_LINE> for root,...
Zip up plugin folders
625941e5d4950a0f3b08c766
def is_valid(self): <NEW_LINE> <INDENT> _filters = [] <NEW_LINE> _errors = [] <NEW_LINE> for field_name, field_validator in self._declared_fields.iteritems(): <NEW_LINE> <INDENT> if field_name in self.query_params: <NEW_LINE> <INDENT> result = field_validator.validate(self.query_params[field_name]) <NEW_LINE> if result...
Check if the query parameters are valid.
625941e5bde94217f368320a
def get_success_url(self): <NEW_LINE> <INDENT> dt = Log.objects.latest().start <NEW_LINE> return reverse('logs-day', kwargs={'year': dt.year, 'month': dt.month, 'day': dt.day})
After delete is complete return to latest log day view.
625941e5796e427e537b09e7
@register.tag(name='range') <NEW_LINE> def do_range(parser, token): <NEW_LINE> <INDENT> bits = token.split_contents() <NEW_LINE> if len(bits) != 4 or bits[2] != 'as': <NEW_LINE> <INDENT> raise TemplateSyntaxError( "%r expected format is '[start:][step:]end as name'" % bits[0] ) <NEW_LINE> <DEDENT> var_name = bits[3] <N...
Work much like forloop with a range. Takes both variables and constant integers. Syntax: {% range end as i %} {{ i }} {% endrange %} {% range start:end as i %} {{ i }} {% endrange %} {% range start:step:end as i %} {{ i }} {% endrange %}
625941e5aad79263cf390e64
def wordPattern(self, pattern, str): <NEW_LINE> <INDENT> pattern, str = list(pattern), str.split() <NEW_LINE> pdic, sdic = collections.defaultdict(), collections.defaultdict() <NEW_LINE> for i, v in enumerate(zip(pattern, str)): <NEW_LINE> <INDENT> if ( v[0] not in pdic )!= (v[1] not in sdic) or v[0] in pdic and v[1] i...
:type pattern: str :type str: str :rtype: bool
625941e58a43f66fc4b5447e
def exception(self, timeout=None): <NEW_LINE> <INDENT> self._clear_tb_log() <NEW_LINE> if self._exc_info is not None: <NEW_LINE> <INDENT> return self._exc_info[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._check_done() <NEW_LINE> return None
If the operation raised an exception, return the `Exception` object. Otherwise returns None.
625941e5fbf16365ca6f65ea
def get_seq_obj_from_srch_res_csv_info(acc, description, seq, abbrev=False, paralogue_names=False): <NEW_LINE> <INDENT> seq_obj = Seq(seq) <NEW_LINE> seq_rec_obj = SeqRecord(seq_obj) <NEW_LINE> if abbrev: <NEW_LINE> <INDENT> seq_rec_obj.id = description + '__' + acc <NEW_LINE> seq_rec_obj.description = '' <NEW_LINE> <D...
Takes components and assembles a Bio.Seq sequence object. If abbreviating, now puts the description before the assession, but used to be the other way around.
625941e59c8ee82313fbbb93
def LibrarySparseNumeric_mutual_information_estimate_fast(self): <NEW_LINE> <INDENT> return LibrarySparseNumeric_mutual_information_estimate_fast_numba( self.substrate_probabilities, self.c_means, self.c_vars, self.sens_mat )
returns a simple estimate of the mutual information for the special case that ret_prob_activity=False, excitation_model='default', mutual_information_method='default', and clip=True.
625941e526068e7796caf103
def image_cb(self, msg): <NEW_LINE> <INDENT> self.has_image = True <NEW_LINE> self.camera_image = msg
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light's stop line to /traffic_waypoint Args: msg (Image): image from car-mounted camera
625941e5498bea3a759b9ecb
def add_authorization_to_org(self, object_id, role, participant_id=None): <NEW_LINE> <INDENT> update = {'UpdateType': 'UpdateOrganizationAuthorization', 'ObjectId': object_id, 'Action': 'add', 'Role': role, 'Nonce': create_nonce()} <NEW_LINE> if participant_id is not None: <NEW_LINE> <INDENT> update['ParticipantId'] = ...
Add an authorization (participant/role combination) to an organization. Args: object_id: The object ID of the organization role: (str) "marketmaker" or "trader" participant_id: The participant ID that grants the authorization or None to indicate the participant that created ...
625941e56e29344779a62a2d
def _extract(self, kg: KG, entity: Vertex) -> EntityWalks: <NEW_LINE> <INDENT> return super()._extract(kg, entity)
Extracts random walks for an entity based on a Knowledge Graph. Args: kg: The Knowledge Graph. entity: The root node to extract walks. Returns: A dictionary having the entity as key and a list of tuples as value corresponding to the extracted walks.
625941e56fece00bbac2db61
def angle(self, other): <NEW_LINE> <INDENT> if self.is_parallel(other): <NEW_LINE> <INDENT> raise ValueError("geodesics do not intersect") <NEW_LINE> <DEDENT> if (not(self.is_complete() and other.is_complete()) and not self.intersection(other)): <NEW_LINE> <INDENT> print("Warning: Geodesic segments do not intersect. " ...
Return the angle between any two given completed geodesics if they intersect. INPUT: - ``other`` -- a hyperbolic geodesic in the UHP model OUTPUT: - the angle in radians between the two given geodesics EXAMPLES:: sage: UHP = HyperbolicPlane().UHP() sage: g = UHP.get_geodesic(2, 4) sage: h = UHP.get_ge...
625941e591f36d47f21ac914
def _test__add_ping(self): <NEW_LINE> <INDENT> time = datetime.datetime.now().strftime('%Y%m%d%H') <NEW_LINE> p = PingResult(id=201, time=time+'0101', origin='o-201', target='t-201', success=True, rtt=201) <NEW_LINE> add_ping(p) <NEW_LINE> p1 = test_session.query(PingResult).one() <NEW_LINE> self.assertEqual...
test: pusta baza, wstawienie nowego, select wykazuje obecność nowego i tylko jego
625941e53539df3088e2e769
def _drawFragments(self, objID, matModelObj, matPerspCam): <NEW_LINE> <INDENT> frags = self.newSVs[objID]['frag'] <NEW_LINE> for fragID, frag in frags.items(): <NEW_LINE> <INDENT> textureHandle = self.textureBuffer[objID][fragID] <NEW_LINE> VAO = self.vertex_array_object[objID][fragID] <NEW_LINE> numVertices = self.num...
Instruct the GPU to draw each fragment of ``objID``. The ``matModelObj`` and ``matPerspCam`` matrices will compute the world coordinates for the object. However, fragments are defined purely in object coordinate. This function will therefore scale, move, and rotate each fragment before it applies the world coordinate ...
625941e53539df3088e2e768
def get_builder(builder_file_name): <NEW_LINE> <INDENT> ui_filename = get_data_file('ui', '%s.ui' % (builder_file_name,)) <NEW_LINE> if not os.path.exists(ui_filename): <NEW_LINE> <INDENT> ui_filename = None <NEW_LINE> <DEDENT> builder = Builder() <NEW_LINE> builder.set_translation_domain('metau') <NEW_LINE> builder.ad...
Return a fully-instantiated Gtk.Builder instance from specified ui file :param builder_file_name: The name of the builder file, without extension. Assumed to be in the 'ui' directory under the data path.
625941e524f1403a92600f80
def normalized_exponential_discounted_cumulative_gain(y_true, y_pred, k=None): <NEW_LINE> <INDENT> return exponential_discounted_cumulative_gain( y_true, y_pred, k ) / exponential_discounted_cumulative_gain(y_true, y_true, k)
Normalized Exponential Discounted Cumulative Gain (neDCG). Info: https://en.wikipedia.org/wiki/Discounted_cumulative_gain Args: y_true (list or np.array): True values. y_pred (list or np.array): Predicted values. k (int): Limit of predicted values. Returns: float: neDCG (max=1, min=0) Examples: >...
625941e5de87d2750b8601b4
def RenderText(self, text, context): <NEW_LINE> <INDENT> if self._comment_type == 'doc': <NEW_LINE> <INDENT> start_prefix = _GetFromContext(context, _DOC_COMMENT_START, _COMMENT_START) <NEW_LINE> continue_prefix = _GetFromContext(context, _DOC_COMMENT_CONTINUE, _COMMENT_CONTINUE) <NEW_LINE> comment_end = _GetFromContex...
Format text according to the context. The strategy is to divide the text into blocks (on blank lines), then to format the blocks individually, then reassemble. Args: text: (str) The text to format. context: (django_template.Context) The rendering context. Returns: The rendered comment.
625941e5187af65679ca553e
@docstr.get_sections(base='models.phase.vapor_pressure', sections=['Returns']) <NEW_LINE> @docstr.dedent <NEW_LINE> def antoine(target, A, B, C, temperature='pore.temperature'): <NEW_LINE> <INDENT> T = target[temperature] - 273.15 <NEW_LINE> value = (10**(A-B/(C+T)))/760*101325 <NEW_LINE> return value
Uses Antoine equation to estimate vapor pressure of a pure component Parameters ---------- %(models.target.parameters)s A, B, C : scalars Antoine vapor pressure coefficients for pure compounds. Since virtually all Antoine coefficients are reported for units of mmHg and C for historical reasons, this metho...
625941e5ad47b63b2c50a39c
def users(self): <NEW_LINE> <INDENT> return self.__users
Return : La liste des utilisateurs du Channel : -> list()
625941e5287bf620b61d3e7f
def parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser( description="This script filters a set of annotated SVs output from everythingSV.py based on overlap with inhouse databases") <NEW_LINE> parser.add_argument( "--annovar_output_with_overlap", type=str, required=True, help="Path to annovar output wit...
Parse command-line arguments Returns ---- Parser argument namespace
625941e5097d151d1a223275
def visual_training(self): <NEW_LINE> <INDENT> self._draw_window() <NEW_LINE> for i in range(50): <NEW_LINE> <INDENT> episode_rewards = [] <NEW_LINE> for _ in range(100): <NEW_LINE> <INDENT> env = Flatland(10, 10) <NEW_LINE> self.agent.new_environment(env) <NEW_LINE> result = self.agent.learn(50, False) <NEW_LINE> epis...
Display the evolution of the ANN during a training
625941e538b623060ff0b20b
def logout(self): <NEW_LINE> <INDENT> self.session.get( 'http://authserver.sdut.edu.cn/authserver/logout?service=/authserver/login')
退出登录
625941e52ae34c7f2600d54e
def __repr__(self): <NEW_LINE> <INDENT> return str(tuple(self))
Return the list as a string literal.
625941e557b8e32f524838bb
def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'file_name': 'str', 'last_modified_time': 'datetime', 'size': 'int' } <NEW_LINE> self.attribute_map = { 'file_name': 'fileName', 'last_modified_time': 'lastModifiedTime', 'size': 'size' } <NEW_LINE> self._file_name = None <NEW_LINE> self._last_modified_time...
SupportArtifact - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941e5b7558d58953c5329
def surface_dehn_twist(self,k): <NEW_LINE> <INDENT> assert len(self._alphabet)%2==0 <NEW_LINE> g=len(self._alphabet)/2 <NEW_LINE> if (0<=k and k<g): result=self._surface_dehn_twist_e(k) <NEW_LINE> elif (g<=k and k<2*g): result=self._surface_dehn_twist_m(k-g) <NEW_LINE> elif (2*g<=k and k<3*g-1): result=self._surface_de...
Dehn twist of the surface (with one boundary component) with fundamental group ``self``. The surface is assumed to have genus g and 1 boundary component. The fundamental group has rank 2g, thus ``self`` is assumed to be of even rank. ``k`` is an integer 0<=k<3g-1. MCG(S_{g,1}) is generated by the Dehn twist along th...
625941e529b78933be1e5ac5
def __init__( self, api_key, *, domain='api.geocode.earth', timeout=DEFAULT_SENTINEL, proxies=DEFAULT_SENTINEL, user_agent=None, scheme=None, ssl_context=DEFAULT_SENTINEL, adapter_factory=None ): <NEW_LINE> <INDENT> super().__init__( api_key=api_key, domain=domain, timeout=timeout, proxies=proxies, user_agent=user_agen...
:param str api_key: Geocode.earth API key, required. :param str domain: Specify a custom domain for Pelias API. :param int timeout: See :attr:`geopy.geocoders.options.default_timeout`. :param dict proxies: See :attr:`geopy.geocoders.options.default_proxies`. :param str user_agent: See :attr:`geopy.geoco...
625941e59b70327d1c4e11f5
def nb_osc(sig,max): <NEW_LINE> <INDENT> m=0 <NEW_LINE> nb_oscill=0 <NEW_LINE> for i in range(1,len(sig)-1) : <NEW_LINE> <INDENT> if sig[i] > 0.5*max: <NEW_LINE> <INDENT> if sig[i-1]<0.5*max: <NEW_LINE> <INDENT> m=1 <NEW_LINE> <DEDENT> if sig[i+1]<0.5*max: <NEW_LINE> <INDENT> nb_oscill+=m <NEW_LINE> <DEDENT> <DEDENT> <...
Ayant un signal sig et une amplitude max, on compte le nombre de signaux étant 50% au dessus de l'amplitude max
625941e5e8904600ed9f2351
def set_row_range(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapper(self, *args, **kwargs): <NEW_LINE> <INDENT> spec = inspect.getfullargspec(func) <NEW_LINE> spec_args_len = len(spec.args) <NEW_LINE> if spec.args[0] == 'self': <NEW_LINE> <INDENT> spec.args.pop(0) <NEW_LINE> <DEDENT> all_kwargs =...
メソッドの引数row_start_idxとrow_end_idxの値をself.data_row_rangeで設定する func呼び出し時にrow_start_idxやrow_end_idxが指定されていれば、その指定を優先する
625941e54f88993c3716c481
def random_direction_vector(size): <NEW_LINE> <INDENT> return to_unit_vector(np.random.normal(size=size))
Return unit vector on the sphere in cartesian coordinates (x, y, z).
625941e566673b3332b924af
def data(self, siz: int = buffer_size, ptr: int = None) -> np.array: <NEW_LINE> <INDENT> if ptr is None: <NEW_LINE> <INDENT> ptr = int(self.pointer) <NEW_LINE> <DEDENT> adr = (self.buffer_size + ptr - siz) % self.buffer_size <NEW_LINE> wave = np.roll(self.buffer, -ptr) <NEW_LINE> return wave.astype('uint16')[-siz:]
Data. Parameters ---------- siz : int, optional Number of data samples to be read from the FPGA buffer. ptr : int, optional End of data pointer, only use if you understand the source code. Returns ------- array Array containing binary samples. The data is alligned at the end to the last sample ...
625941e5adb09d7d5db6cbab
def format_subplot(s_plot, title="Title"): <NEW_LINE> <INDENT> s_plot.set_title(title, **k_dict['k_title_font']) <NEW_LINE> chart_tools.format_axis_x_ticks(ax=s_plot, p_dict=p_dict, k_dict=k_dict, logger=log) <NEW_LINE> chart_tools.format_axis_y(ax=s_plot, p_dict=p_dict, k_dict=k_dict, logger=log) <NEW_LINE> if p_dict[...
Note that we have to set these for each subplot as it's rendered or else the settings will only be applied to the last subplot rendered.
625941e5fff4ab517eb2f85c
def get_images(self): <NEW_LINE> <INDENT> log.info("Getting the images ...") <NEW_LINE> names_and_urls = self.database.get_image_names_and_urls(self.ngc_name) <NEW_LINE> paths = dict() <NEW_LINE> for instrument in self.config.instruments: <NEW_LINE> <INDENT> log.info("Creating directory for the " + instrument + " instr...
This function ... :return:
625941e592d797404e3045aa
def cmdSimState(self, ref, paramId, value): <NEW_LINE> <INDENT> simState = False <NEW_LINE> simEngine = self.comp.diagram.parent.simEngine <NEW_LINE> if simEngine is not None: <NEW_LINE> <INDENT> simState = self.comp.diagram.parent.simEngine.flagSimActive <NEW_LINE> <DEDENT> return [ref, paramId, simState, PSE_ERR_NONE...
! @if English @endif @if Slovak @brief Nacitanie stavu simulacie. @endif
625941e591f36d47f21ac915
def add(num_list): <NEW_LINE> <INDENT> return reduce((lambda memo, num: memo + num), num_list)
Returns sum of all integers in list
625941e599fddb7c1c9de7ad
def testTooFewInit(self): <NEW_LINE> <INDENT> self.init = self.init[:-1] <NEW_LINE> self.assertRaises(RuntimeError,deltaLDA,self.docs,self.alpha, self.beta, self.numsamp,self.randseed,init=self.init)
Too few docs
625941e55fc7496912cc3d9c
def showList(parent, header, items, maxItems=0, title=u''): <NEW_LINE> <INDENT> numItems = len(items) <NEW_LINE> if maxItems <= 0: <NEW_LINE> <INDENT> maxItems = numItems <NEW_LINE> <DEDENT> message = string.Template(header).substitute(count=numItems) <NEW_LINE> message += u'\n* ' + u'\n* '.join(items[:min(numItems, ma...
Formats a list of items into a message for use in a Message.
625941e5b830903b967e9d25
def update_toc_levels(table): <NEW_LINE> <INDENT> pass <NEW_LINE> l = [r[0][0] for r in table] <NEW_LINE> s = sorted(set(l)) <NEW_LINE> for j, vv in enumerate(l): <NEW_LINE> <INDENT> for k, v in enumerate(s): <NEW_LINE> <INDENT> if vv == v: <NEW_LINE> <INDENT> l[j] = vv - v + k + 1 <NEW_LINE> table[j][0] = int(l[j]) <N...
update levels in all pages :return:
625941e55510c4643540f7f8
def _boundary_line(self): <NEW_LINE> <INDENT> return b'--' + self.boundary + b'\r\n'
Helper to build the formatted boundary line.
625941e530bbd722463cc1e6
def install_firmware(self, image_path): <NEW_LINE> <INDENT> return False
Installs firmware to the component Args: image_path: A string, path to firmware image Returns: A boolean, True if install was successful, False if not
625941e53d592f4c4ed1d480
def step(optimizer, records): <NEW_LINE> <INDENT> rewards = records.get("reward") <NEW_LINE> log_probs = records.get("log_prob") <NEW_LINE> assure_equal_and_not_empty(rewards, log_probs) <NEW_LINE> R = 0 <NEW_LINE> discount_rewards = [] <NEW_LINE> policy_loss = [] <NEW_LINE> for r in rewards[::-1]: <NEW_LINE> <INDENT> ...
implements REINFORCE for learning
625941e5d6c5a1020814446c
def test_clear_delete_referenced_action(self): <NEW_LINE> <INDENT> name1, name2 = self.make_test_thumbnails('400x300', '200x200') <NEW_LINE> management.call_command('thumbnail', 'clear', verbosity=0) <NEW_LINE> name3, = self.make_test_thumbnails('100x100') <NEW_LINE> out = StringIO('') <NEW_LINE> management.call_comman...
Clear KV store and delete referenced thumbnails
625941e55e10d32532c5f343
def _check(self, wait=300): <NEW_LINE> <INDENT> log_output = self._read_log() <NEW_LINE> check = [] <NEW_LINE> for line in log_output: <NEW_LINE> <INDENT> if 'cmd=DelegateAuth' in line: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _filter = line.split() <NEW_LINE> data = [' '.join([_filter[0], _filter[1]])] <NEW_LINE> ...
Check for "DelegateAuthRequest" in log line. If the string is found, send an email the accountName information.
625941e5a934411ee3751ab3
def object(self): <NEW_LINE> <INDENT> return self.__object
Return underlying object. EXAMPLES:: sage: X = Set(QQ) sage: X.object() Rational Field sage: X = Primes() sage: X.object() Set of all prime numbers: 2, 3, 5, 7, ...
625941e58a349b6b435e8591
def strict_predecessors(self, node): <NEW_LINE> <INDENT> result = set([]) <NEW_LINE> for edge in self.node[node]: <NEW_LINE> <INDENT> for node_index in range(self.edge[edge].multiplcity()): <NEW_LINE> <INDENT> result.update(self.edge[edge].strictly_below(node, node_index)) <NEW_LINE> <DEDENT> <DEDENT> return result
Get a set of neighboring nodes strictly below the current node in any incident edges. Parameters ---------- node : object The node to find the neighbors of. Returns ------- neighbors : set A set of all nodes that are predecessors to the queries node.
625941e52ae34c7f2600d54f
def GetCommentPattern(self): <NEW_LINE> <INDENT> if self.LangId == synglob.ID_LANG_MATLAB: <NEW_LINE> <INDENT> return [u'%'] <NEW_LINE> <DEDENT> elif self.LangId == synglob.ID_LANG_OCTAVE: <NEW_LINE> <INDENT> return [u'#'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return list()
Returns a list of characters used to comment a block of code
625941e5d268445f265b528d
def create_yara_indicator( yara_rule: YaraRule, created_by: Optional[Identity] = None, created: Optional[datetime] = None, modified: Optional[datetime] = None, labels: Optional[List[str]] = None, confidence: Optional[int] = None, object_markings: Optional[List[MarkingDefinition]] = None, ) -> Indicator: <NEW_LINE> <IND...
Create a YARA rule indicator.
625941e55f7d997b87174eb9
def test_parser_complete(parser): <NEW_LINE> <INDENT> args = parser.parse_args( ["-T", "postgres", "-H", "localhost", "-U", "user", "-p", "password", "-P" "5432", "-db", "sampledb", "--driver", "local", "backups"]) <NEW_LINE> assert args.type == 'postgres' <NEW_LINE> assert args.host == 'localhost' <NEW_LINE> assert ar...
The parser will not exit if it receives all arguments
625941e51f037a2d8b94661b
def load_AttributeList(atts={}): <NEW_LINE> <INDENT> attlist = core.AttributeList() <NEW_LINE> a = attlist <NEW_LINE> for key in atts: <NEW_LINE> <INDENT> a.next = core.AttributeList() <NEW_LINE> a = a.next <NEW_LINE> a.name = key <NEW_LINE> val = atts[key] <NEW_LINE> a.value = val <NEW_LINE> <DEDENT> return at...
Load a dictionary of attributes into an AttributeList object. Parameters ---------- atts : {attribute:value} Attributes Returns ------- out: AttributeList Notes ----- AttributeList needs to eventually be destroyed (otherwise memory leaks) core.DestroyAttributeList2(Attatttributesxt)
625941e591af0d3eaac9be3b
def process_record(self, new, old=None): <NEW_LINE> <INDENT> new = super(ShareableResource, self).process_record(new, old) <NEW_LINE> permissions = self.request.validated.get('permissions', {}) <NEW_LINE> annotated = new.copy() <NEW_LINE> if permissions: <NEW_LINE> <INDENT> is_put = (self.request.method.lower() == 'put...
Read permissions from request body, and in the case of ``PUT`` every existing ACE is removed (using empty list).
625941e55166f23b2e1a5577
def test_sample_62(self): <NEW_LINE> <INDENT> self.fail("shouldn't happen")
failed template
625941e599cbb53fe6793004
def get_rssis(self) -> dict: <NEW_LINE> <INDENT> devices = self._scan_devices() <NEW_LINE> return {dev.addr: dev.rssi for dev in devices}
Returns the strength of the scanned devices signals as seen by this device. Ranges from 0 (close) to -100 (far)
625941e5283ffb24f3c55d1b
@app.schedule(Rate(12, unit=Rate.HOURS)) <NEW_LINE> def renew_token_job(): <NEW_LINE> <INDENT> refresh_access_token()
The cron job that trigger renew all OAuth access token every 12 hours The job doesn't neccessarily renew any OAuth access in the OAuth table, it's up to function renewToken to decide wheter an access token should be renewed.
625941e56fece00bbac2db62
def test_appl(self): <NEW_LINE> <INDENT> basket = ['AP1', 'AP1', 'CH1', 'AP1'] <NEW_LINE> expected = ['AP1', 'APPL', 'AP1', 'APPL', 'CH1', 'AP1', 'APPL'] <NEW_LINE> self.assertEqual(expected, market.appl(basket))
apply APPL discount
625941e55fdd1c0f98dc0654
def seek_relative(self, offset): <NEW_LINE> <INDENT> position = self.player.query_position(Gst.Format.TIME)[1] or 0 <NEW_LINE> position += offset <NEW_LINE> self.seek(position)
Send a seek event relative to the current position Parameters ---------- offset : int Offset in nanoseconds
625941e576e4537e8c351a94
def fetch_kill(p, c, m, run_name, cloudinitd, controller_name=None): <NEW_LINE> <INDENT> if not controller_name: <NEW_LINE> <INDENT> controller_name = p.get_arg_or_none(em_args.CONTROLLER) <NEW_LINE> <DEDENT> if not controller_name: <NEW_LINE> <INDENT> raise InvalidInput("fetch-kill requires a controller") <NEW_LINE> <...
Get logs and then kill a worker. If controller_name is not supplied to this function, it is expected to be in the cmdline args
625941e544b2445a339324b2
def all(self): <NEW_LINE> <INDENT> return self._chats
Get dict of all chats. Returns: dict of {chat_token: Chat object}
625941e58c3a8732951587de
def clone(self, **kwargs): <NEW_LINE> <INDENT> options = self.extract() <NEW_LINE> options.update(**kwargs) <NEW_LINE> return self.__class__(**options)
Clone the environment with additional parameter override
625941e58e05c05ec3eea796
def test_proximal_arg_scaling(scalar, sigma): <NEW_LINE> <INDENT> sigma = float(sigma) <NEW_LINE> space = odl.uniform_discr(0, 1, 10) <NEW_LINE> lam = 1.2 <NEW_LINE> prox_factory = proximal_l2_squared(space, lam=lam) <NEW_LINE> scaling_param = scalar <NEW_LINE> prox = proximal_arg_scaling(prox_factory, scaling_param)(s...
Test for the proximal of scaling: ``prox[F(. * a)]``.
625941e53cc13d1c6d3c7797
def generate_line(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Generate lines. This function can be written in synchronous or asynchronous manner. To make it work asynchronously, return an empty record immediately under blocking situations. Note: When operating synchronously, flushing with time interval does not work. Yields: str: A text line.
625941e545492302aab5e6e6
def vm_qs_for_admins(user): <NEW_LINE> <INDENT> if user.is_superuser: <NEW_LINE> <INDENT> qs = VirtualMachine.objects.all() <NEW_LINE> <DEDENT> elif user.is_anonymous(): <NEW_LINE> <INDENT> qs = VirtualMachine.objects.none() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> qs = user.get_objects_any_perms(VirtualMachine, g...
Retrieve a queryset of all of the virtual machines for which this user is an administrator.
625941e5ff9c53063f47c610