code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def __len__(self) -> int: <NEW_LINE> <INDENT> return self.shape()[0]
Returns the number of rows of the vector >>> x = Vector().load_token_vector('addiction', return_type='csc') >>> len(x) 11303161 :return: int
625941ced10714528d5ffe14
def unlink(self): <NEW_LINE> <INDENT> relation_model = self.env["res.partner.relation"] <NEW_LINE> for rec in self: <NEW_LINE> <INDENT> if rec.handle_invalid_onchange == "delete": <NEW_LINE> <INDENT> relations = relation_model.search([("type_id", "=", rec.id)]) <NEW_LINE> relations.unlink() <NEW_LINE> <DEDENT> <DEDENT>...
Allow delete of relation type, even when connections exist. Relations can be deleted if relation type allows it.
625941cead47b63b2c50a0b0
def timethis(func): <NEW_LINE> <INDENT> @wraps(func) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> start = time.time() <NEW_LINE> result = func(*args, **kwargs) <NEW_LINE> end = time.time() <NEW_LINE> print(func.__name__, end - start) <NEW_LINE> return result <NEW_LINE> <DEDENT> return wrapper
Decorator that reports the execution time. @wraps(func) annotation keeps origin func's metadata like name, docstring, etc.
625941ceb5575c28eb68e131
def Activated(self): <NEW_LINE> <INDENT> self.slope.setText(str(1.0)) <NEW_LINE> self.initial_time.setText(str(1.0)) <NEW_LINE> self.final_time.setText(str(2.0)) <NEW_LINE> self.initial_value.setText(str(0.0)) <NEW_LINE> self.show() <NEW_LINE> App.Console.PrintMessage(" Activated: " + "\n") <NEW_LINE> return
Do something here
625941cefbf16365ca6f62f6
def calc_metrics(predictions, labels, thr=0.5, stats=None): <NEW_LINE> <INDENT> if stats: <NEW_LINE> <INDENT> P, N, TP, TN, FP, FN = stats <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> P, N, TP, TN, FP, FN = calc_stats(predictions, labels, thr) <NEW_LINE> <DEDENT> c = sys.float_info.min <NEW_LINE> metrics = {} <NEW_LIN...
Calculates and returns dicitonary of most relevant MIR metrics.
625941ced7e4931a7ee9e04e
def cudnn_gru(inputs, init_h, kernel, recurrent_kernel, bias, mask, time_major, go_backwards): <NEW_LINE> <INDENT> if not time_major: <NEW_LINE> <INDENT> inputs = array_ops.transpose(inputs, perm=(1, 0, 2)) <NEW_LINE> <DEDENT> init_h = array_ops.expand_dims(init_h, axis=0) <NEW_LINE> weights = array_ops.split(kernel, 3...
GRU with CuDNN implementation which is only available for GPU.
625941ce16aa5153ce3625a9
def vary(system, **kwargs): <NEW_LINE> <INDENT> if not kwargs: <NEW_LINE> <INDENT> raise ValueError("No parameter to vary.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> variable_parameters = [(parameter, range_) for parameter, range_ in kwargs.items()] <NEW_LINE> <DEDENT> initial = {} <NEW_LINE> for parameter, range_...
Generate a list of Hamiltonians for use in `parallelize.mesolve`. The parameters and their values are provided as keyword arguments: .. code-block: python hamiltonians, parameters = vary(TwoLevelSystem(), delta=np.linspace(-10.0, 10.0, num=30), ...
625941ce187af65679ca524f
def _differences(self, from_list: Dict[str, Any], to_list: Dict[str, Any]): <NEW_LINE> <INDENT> return ([key for key in to_list if key not in from_list], [key for key in from_list if key not in to_list], [key for key in from_list if key in to_list])
Calculates the difference between two OrderedDicts. https://codereview.stackexchange.com/a/176303/140581 :param from_list: OrderedDict :param to_list: OrderedDict :return: (added, removed, overlap)
625941ce99fddb7c1c9de4c1
def middleNode(self, head): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> result = head <NEW_LINE> length = 0 <NEW_LINE> while head: <NEW_LINE> <INDENT> length += 1 <NEW_LINE> head = head.next <NEW_LINE> <DEDENT> count = length / 2 <NEW_LINE> for _ in range(count): <NEW_LINE> <INDENT> ...
:type head: ListNode :rtype: ListNode
625941ce925a0f43d2549fa8
def increase_speed(self): <NEW_LINE> <INDENT> self.ship_speed_factor *= self.speedup_scale <NEW_LINE> self.bullet_speed_factor *= self.speedup_scale <NEW_LINE> self.alien_speed_factor *= self.speedup_scale <NEW_LINE> self.alien_points = int(self.alien_points * self.score_scale)
Increase speed settings and alien point vals
625941ce4a966d76dd551140
def test_111(self): <NEW_LINE> <INDENT> self.assertEqual(1,2,"assert error --")
测试test_111的功能
625941cea79ad161976cc276
def ode_2nd_nonlinear_closed(a=100, b=-50, u_0=1.0, nT=100, dt=0.01): <NEW_LINE> <INDENT> t = numpy.linspace(0, nT * dt, num=nT + 1) <NEW_LINE> import scipy.special <NEW_LINE> c = numpy.sqrt(a + b * u_0**2) <NEW_LINE> k = b * u_0**2 / 2 / (a + b * u_0**2) <NEW_LINE> u = c * t <NEW_LINE> m = k <NEW_LINE> if m >= 0 and m...
Solve ODE in closed form (analytically, at discrete time instances). Second order nonlinear ODE: (Duffing) ddot u + a * u + b * u^3 = 0 with initial conditions u(t=0) = u_0 ; du(t=0) = 0
625941ce66656f66f7cbc2db
def with_confirmation(proc, TIMEOUT): <NEW_LINE> <INDENT> _set_confirmation(proc, True) <NEW_LINE> proc.sendline(u'ehco test') <NEW_LINE> proc.sendline(u'fuck') <NEW_LINE> assert proc.expect([TIMEOUT, u'echo test']) <NEW_LINE> assert proc.expect([TIMEOUT, u'enter']) <NEW_LINE> assert proc.expect_exact([TIMEOUT, u'ctrl+...
Ensures that command can be fixed when confirmation enabled.
625941ce55399d3f055887e5
def _getProcessMemory(): <NEW_LINE> <INDENT> return ProcessMemoryInfo().rss
Utility function that defined the logic to get memory.
625941cea8ecb033257d31fe
def record_auto_requirements(self): <NEW_LINE> <INDENT> __object_name = self.env.get('__object_name', None) <NEW_LINE> if __object_name: <NEW_LINE> <INDENT> parent = self.cdist_object.object_from_name(__object_name) <NEW_LINE> current_object = self.cdist_object <NEW_LINE> if not parent.name in current_object.requiremen...
An object shall automatically depend on all objects that it defined in it's type manifest.
625941ce3cc13d1c6d3c74ab
def countOfAtoms(self, formula: str) -> str: <NEW_LINE> <INDENT> stack = [1] <NEW_LINE> index = len(formula) - 1 <NEW_LINE> nums_str = '' <NEW_LINE> num = 1 <NEW_LINE> element = '' <NEW_LINE> atoms_count = defaultdict(int) <NEW_LINE> while index >= 0: <NEW_LINE> <INDENT> while '0' <= formula[index] <= '9': <NEW_LINE> <...
https://leetcode.com/problems/number-of-atoms/discuss/162066/Python%3A-with-stack-and-dict-at-O(-nlog)-solution
625941ce4e4d5625662d4508
def export_layer_as(layer, layer_name, layer_format, to_dir): <NEW_LINE> <INDENT> if layer_name is None: <NEW_LINE> <INDENT> if isinstance(layer, str): <NEW_LINE> <INDENT> layer_name = basename(layer).replace(".shp", "") <NEW_LINE> layer = QgsVectorLayer(layer, layer_name, "ogr") <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
Convertir un fichier sph en format donné :param layer: la couche :type layer: str ou QgsVectorLayer :param layer_name nom du fichier en sorti :type layer_name: str :param layer_format: le format final :type layer_format: str :param to_dir: le nouveau chemin :type to_dir: str
625941ce56b00c62f0f1478a
def generated_to_observables(mddsq, md1pisq): <NEW_LINE> <INDENT> tdd = np.clip((np.sqrt(mddsq) - 2*mdn), 0, None) <NEW_LINE> return (np.sqrt(tdd * mdn), np.sqrt(md1pisq))
(m^2(DD), m^2(D0pi+)) -> (p(D), m(D0pi+)) Cuts off negative kinetic energy (not a clean approach)
625941ce187af65679ca5250
def test_update_suppression(self): <NEW_LINE> <INDENT> ecan = self.get_ecan_object_ids() <NEW_LINE> postdata = {'id': ecan['sp_id'], 'label': 'changed'} <NEW_LINE> req = request(self, self.root, "PUT", self.uri + '/suppressions/' + ecan['sp_id'], json.dumps(postdata)) <NEW_LINE> resp = self.successResultOf(req) <NEW_LI...
Update an suppression
625941ce435de62698dfdd7e
def psi(expected_array, actual_array, buckets): <NEW_LINE> <INDENT> def scale_range (input, min, max): <NEW_LINE> <INDENT> input += -(np.min(input)) <NEW_LINE> input /= np.max(input) / (max - min) <NEW_LINE> input += min <NEW_LINE> return input <NEW_LINE> <DEDENT> breakpoints = np.arange(0, buckets + 1) / (buckets) * 1...
Calculate the PSI for a single variable Args: expected_array: numpy array of original values actual_array: numpy array of new values, same size as expected buckets: number of percentile ranges to bucket the values into Returns: psi_value: calculated PSI value
625941ce9b70327d1c4e0f06
def synthSDR(self,depth,az,dist,M0,strike,dip,rake): <NEW_LINE> <INDENT> MT = self.getMT(M0,strike,dip,rake) <NEW_LINE> Z_sac,L_sac,T_sac = self.synth(depth,az,dist,MT) <NEW_LINE> return Z_sac,L_sac,T_sac
Compute synthetic waveforms from strike, dip, rake and M0 Args: * depth: source depth (in km) * az: station azimuth (in deg) * dist: distance (in km or deg, depending on the database) * M0: seismic moment (units consistent with the database) * strike: strike angle (in deg) * dip: dip ang...
625941ce60cbc95b062c6674
def invalidate_state(self): <NEW_LINE> <INDENT> with self.state_mutex: <NEW_LINE> <INDENT> self.state.time.secs = 0
mark the state topic data as invalid
625941ce63d6d428bbe44620
def load(self, system_effect): <NEW_LINE> <INDENT> banks = self.banks_files.load(system_effect) <NEW_LINE> banks_ordered = self.index_file.load(banks) <NEW_LINE> manager = BanksManager() <NEW_LINE> manager.register(self) <NEW_LINE> for bank in banks_ordered: <NEW_LINE> <INDENT> manager.append(bank) <NEW_LINE> bank.mana...
Return a :class:`.BanksManager` instance contains the banks present in :attr:`~pluginsmanager.observer.autosaver.autosaver.Autosaver.data_path` :param SystemEffect system_effect: SystemEffect used in pedalboards :return BanksManager: :class:`.BanksManager` with banks persisted in :attr:`~pluginsmanager.observe...
625941ceb7558d58953c5045
def apply_read_scaling(arr, slope = 1.0, inter = 0.0): <NEW_LINE> <INDENT> if (slope, inter) == (1, 0): <NEW_LINE> <INDENT> return arr <NEW_LINE> <DEDENT> shape = arr.shape <NEW_LINE> arr, slope, inter = [np.atleast_1d(v) for v in (arr, slope, inter)] <NEW_LINE> if arr.dtype.kind in 'iu': <NEW_LINE> <INDENT> if (slope,...
Apply scaling in `slope` and `inter` to array `arr` This is for loading the array from a file (as opposed to the reverse scaling when saving an array to file) Return data will be ``arr * slope + inter``. The trick is that we have to find a good precision to use for applying the scaling. The heuristic is that the dat...
625941ce3d592f4c4ed1d19e
def func_show_active_dependencies( self ): <NEW_LINE> <INDENT> return ", ".join( sorted( self.dict_dependencies.keys() ) )
Show the dependencies that are still active. * Return : String A list of dependencies still needed in the pipeline.
625941ced268445f265b4f9f
def decrementSteps(self): <NEW_LINE> <INDENT> self.steps -= 1
Decrement remaining steps by 1
625941ce07d97122c41789bd
def _latest_and_next_version(state): <NEW_LINE> <INDENT> if state.release_type == Release.FEATURE: <NEW_LINE> <INDENT> previous_version = state.latest_overall_release <NEW_LINE> next_version = previous_version.next_minor() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> previous_version = state.latest_line_release <NEW_L...
Determine latest version for current branch, and its increment. E.g. on the ``1.2`` branch, we take the latest ``1.2.x`` release and increment its tertiary number, so e.g. if the previous release was ``1.2.2``, this function returns ``1.2.3``. If on ``main`` and latest overall release was ``1.2.2``, it returns ``1.3.0...
625941ce91f36d47f21ac624
def publish_user_event(uid, typ, **kwargs): <NEW_LINE> <INDENT> return publish_event('user/' + uid, typ, **kwargs)
发送一条事件消息到某用户的事件频道 (以便关注该用户的客户端接收). :param uid: 用户 ID. :type uid: :data:`six.text_type` :param typ: 事件类型, 如 ``'new_user'`` 或 ``'online_status'`` 等. :type typ: :data:`six.text_type` :param kwargs: 事件参数. :return: 消息总共抵达的订阅端总数. :rtype: :data:`six.integer_types`
625941ce6fece00bbac2d870
def repeatedly(func): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield func()
Repeat a function taking no argument :param func: a function :returns: a generator >>> import random as rd >>> rd.seed(123) >>> take(3, repeatedly(rd.random)) [0.052363598850944326, 0.08718667752263232, 0.4072417636703983]
625941ce090684286d50ee17
def get_rpc_transport(conf, url=None, allowed_remote_exmods=None): <NEW_LINE> <INDENT> return msg_transport._get_transport(conf, url, allowed_remote_exmods)
A factory method for Transport objects for RPCs. This method should be used to ensure the correct messaging functionality for RPCs. RPCs and Notifications may use separate messaging systems that utilize different drivers, different access permissions, message delivery, etc. Presently, this function works exactly the ...
625941ce4527f215b584c588
def do_let_form(vals, env): <NEW_LINE> <INDENT> check_form(vals, 2) <NEW_LINE> bindings = vals[0] <NEW_LINE> exprs = vals.second <NEW_LINE> if not scheme_listp(bindings): <NEW_LINE> <INDENT> raise SchemeError("bad bindings list in let form") <NEW_LINE> <DEDENT> names, values = nil, nil <NEW_LINE> for binding in binding...
Evaluate a let form with parameters VALS in environment ENV.
625941ce167d2b6e31218cc7
def test_get(self): <NEW_LINE> <INDENT> loc = get_location_from_uri( "s3://user:key@auth_address/glance/2") <NEW_LINE> (image_s3, image_size) = self.store.get(loc) <NEW_LINE> self.assertEqual(image_size, None) <NEW_LINE> expected_data = "*" * FIVE_KB <NEW_LINE> data = "" <NEW_LINE> for chunk in image_s3: <NEW_LINE> <IN...
Test a "normal" retrieval of an image in chunks
625941ce293b9510aa2c33c8
def for_each_surface( self, iterator: SurfaceCallback[T], data: T | None = None ) -> None: <NEW_LINE> <INDENT> py_handle = (iterator, data) <NEW_LINE> handle = ffi.new_handle(py_handle) <NEW_LINE> lib.wlr_layer_surface_v1_for_each_surface( self._ptr, lib.surface_iterator_callback, handle )
Calls the iterator function for each sub-surface and popup of this surface
625941cebe7bc26dc91cd731
def p_LowerEndpoint_1 (t): <NEW_LINE> <INDENT> t[0] = t[1]
LowerEndpoint : LowerEndValue
625941ce50812a4eaa59c453
def ascii_to_string(ascii_codes): <NEW_LINE> <INDENT> s = "" <NEW_LINE> for code in ascii_codes: <NEW_LINE> <INDENT> s += chr(code) <NEW_LINE> <DEDENT> return s
Returns the string corresponding to the list of the ASCII codes
625941ce73bcbd0ca4b2c1a7
def p_men_stmt(p): <NEW_LINE> <INDENT> p[0] = AST.ForNode(p[2], p[4], p[6], p[7])
men_stmt : MEN expression ',' expression ',' expression block
625941ce97e22403b379d0cb
@permission_required(['czn', ]) <NEW_LINE> def employer_create(request): <NEW_LINE> <INDENT> current_profile = get_object_or_404(UserProfile, user=request.user) <NEW_LINE> employer = Employer(Owner=current_profile, RegKatharsis=False, ) <NEW_LINE> employer.save() <NEW_LINE> create_event(employer, employer.Owner, 'Созда...
Создание карточки нарушителя вручную :param request: :return:
625941cea17c0f6771cbe182
def del_store(name, store, saltenv="base"): <NEW_LINE> <INDENT> ret = {"name": name, "result": True, "comment": "", "changes": {}} <NEW_LINE> cert_file = __salt__["cp.cache_file"](name, saltenv) <NEW_LINE> if cert_file is False: <NEW_LINE> <INDENT> ret["result"] = False <NEW_LINE> ret["comment"] += "Certificate file no...
Remove a certificate in the given store name The certificate to remove, this can use local paths or salt:// paths store The store to remove the certificate from saltenv The salt environment to use, this is ignored if a local path is specified
625941ce3539df3088e2e47c
def muteTeam(self, tid, accid, ope): <NEW_LINE> <INDENT> url = "https://api.netease.im/nimserver/team/muteTeam.action" <NEW_LINE> data = {'tid': tid, 'accid': accid, 'ope': ope} <NEW_LINE> resp = requests.post(url=url, headers=self.get_header(), data=data) <NEW_LINE> return resp.json()
修改消息提醒开关 :param tid:网易云通信服务器产生,群唯一标识,创建群时会返回 :param accid:要操作的群成员accid :param ope:1:关闭消息提醒,2:打开消息提醒,其他值无效 :return:
625941ce30bbd722463cbef8
def getToolByName(tool_name): <NEW_LINE> <INDENT> pass
Returns the tool with the name ``tool_name`` of the upgraded site.
625941ced4950a0f3b08c480
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, InlineResponse20072): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941ce50485f2cf553cecb
def print_stats(stats, glob_stats=None, prefix=""): <NEW_LINE> <INDENT> tot_msgs = stats["tot_msg"] <NEW_LINE> trans_msgs = stats["trans_msg"] <NEW_LINE> tot_ttips = stats["tot_ttips"] <NEW_LINE> trans_ttips = stats["trans_ttips"] <NEW_LINE> comm_msgs = stats["comm_msg"] <NEW_LINE> nbr_signs...
Print out some stats about a po file. glob_stats is for making global stats over several po's.
625941ce30dc7b7665901a98
def pretty_str(p: Path, only_path=True) -> str: <NEW_LINE> <INDENT> buffer = [p] <NEW_LINE> if not only_path: <NEW_LINE> <INDENT> buffer.append(p.stat().st_size) <NEW_LINE> buffer.append(p.suffix) <NEW_LINE> buffer.append(p.stem) <NEW_LINE> buffer.append(p.name) <NEW_LINE> <DEDENT> return '\n'.join(buffer)
Pretty string of the path
625941ce3d592f4c4ed1d19f
def processor_affinity(self): <NEW_LINE> <INDENT> return _blocks_swig5.tag_gate_sptr_processor_affinity(self)
processor_affinity(tag_gate_sptr self) -> std::vector< int,std::allocator< int > >
625941ce8e71fb1e9831d8da
def validate_request(request): <NEW_LINE> <INDENT> if 'command' not in request: <NEW_LINE> <INDENT> raise InvalidRequestError("`command' key in request is mandatory.") <NEW_LINE> <DEDENT> if 'password' not in request: <NEW_LINE> <INDENT> raise InvalidRequestError("`password' key in request is mandatory.") <NEW_LINE> <D...
Validates if the request have the required fields. @raise InvalidRequestError: If the request is not valid.
625941ce462c4b4f79d1d802
def sendError(self, message): <NEW_LINE> <INDENT> self.send({"status": "error", "message": message})
Send error message
625941ce8e71fb1e9831d8db
def download_track(track: dict, album: str = None): <NEW_LINE> <INDENT> track["title"] = clean_title(track["title"]) <NEW_LINE> if album: <NEW_LINE> <INDENT> directory = os.path.join(track["user"]["username"], album) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> directory = track["user"]["username"] <NEW_LINE> <DEDENT>...
Download a track based on url.
625941cee8904600ed9f205e
def after_move(self): <NEW_LINE> <INDENT> self.level.get_cell(self.pos).player_inside() <NEW_LINE> for item in self.level.get_items_in(self.pos): <NEW_LINE> <INDENT> if not self.inv.has(item): <NEW_LINE> <INDENT> self.inv.add(item) <NEW_LINE> <DEDENT> <DEDENT> for chip in self.level.get_sprites_in(self.pos, True, 'Chip...
Run checks for items in the new cell, and clean up movement actions.
625941ceadb09d7d5db6c8c1
def read_word(fd): <NEW_LINE> <INDENT> word = "" <NEW_LINE> ch = fd.read(1) <NEW_LINE> if ch == "": <NEW_LINE> <INDENT> common.queue_error(action_name, "End of file reached.") <NEW_LINE> return None <NEW_LINE> <DEDENT> while is_space(ch) and ch != "": <NEW_LINE> <INDENT> ch = fd.read(1) <NEW_LINE> <DEDENT> while ch == ...
Reads a word from the file (usually a keyword which is followed by a value or a block)
625941ce236d856c2ad4490d
def __repr__(self): <NEW_LINE> <INDENT> if len(self.categories) > 5: <NEW_LINE> <INDENT> cats = self.categories[:2] + self.categories[-2:] <NEW_LINE> probs = self._probs[:2] + self._probs[-2:] <NEW_LINE> prior = list(zip(cats, probs)) <NEW_LINE> prior.insert(2, _Ellipsis()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
Represent the object as a string.
625941cec4546d3d9de72b66
def increment(self, e): <NEW_LINE> <INDENT> drift = np.array([[1, self.length], [0, 1]]) <NEW_LINE> return np.dot(drift, e)
Modify electron beam vector by distance travelled. Args: e (numpy array): electron beam vector Returns: numpy array: e
625941ce4428ac0f6e5ba924
def to_representation(self, instance): <NEW_LINE> <INDENT> ret = super(ServerSerializer, self).to_representation(instance) <NEW_LINE> ret['group_name'] = self.get_group_name(instance.group.all()) <NEW_LINE> ret['tag_name'] = self.get_tag_name(instance.tag.all()) <NEW_LINE> ret['idc_name'] = instance.get_idc_display() <...
重写to_representation方法
625941ce0a366e3fb873e94c
@register.filter <NEW_LINE> def addAttrs(field, valor): <NEW_LINE> <INDENT> data = {} <NEW_LINE> attrs = valor.split(',') <NEW_LINE> for attr in attrs: <NEW_LINE> <INDENT> val = attr.split('/') <NEW_LINE> data[val[0]] = val[1] <NEW_LINE> <DEDENT> return field.as_widget(attrs=data)
Pasar en el parametro 'valor' el atributo HTML a ser modificado y/o agregado separando con '/' del valor que se le desea asignar
625941ceac7a0e7691ed41fe
def _get_grad_forces_alt(vects, alpha=2.0, **kwargs): <NEW_LINE> <INDENT> nb_points = vects.shape[0] // 3 <NEW_LINE> weights = kwargs.get('weights', np.ones((nb_points, nb_points))) <NEW_LINE> charges = vects.reshape((nb_points, 3)) <NEW_LINE> all_charges = np.concatenate((charges, -charges)) <NEW_LINE> all_charges = a...
1st-order derivative of electrostatic-like repulsion energy [1]_. The weights ensure equal importance of each shell to the objective function [2]_ [3]_. Parameters ---------- vects : array-like (N * 3,) Points on the sphere. alpha : float Controls the power of the repulsion. Default is 1.0. weights : array-lik...
625941ce925a0f43d2549fa9
def testStatCustomComplianceControl(self): <NEW_LINE> <INDENT> model = esp_sdk.models.stat_custom_compliance_control.StatCustomComplianceControl()
Test StatCustomComplianceControl
625941cefb3f5b602dac37c5
def update_bodies(self): <NEW_LINE> <INDENT> for start in range(len(self.all_index) - 1): <NEW_LINE> <INDENT> index_left = self.all_index[start+1:] <NEW_LINE> work_index = self.all_index[start] <NEW_LINE> work_body = self.bodies[work_index] <NEW_LINE> for second_index in index_left: <NEW_LINE> <INDENT> second_body = se...
calcule toutes les interaction entre tout les astres, en faisant attention de faire qu'une seul fois le calcul.
625941ce0c0af96317bb831a
def handle_closed(self): <NEW_LINE> <INDENT> print("Closed") <NEW_LINE> self.mainloop.quit() <NEW_LINE> self.closed = True
Handle Window Closed signal.
625941ce442bda511e8be54a
@deploy.command('config') <NEW_LINE> @click.argument('name') <NEW_LINE> @click.argument('version', type=Version()) <NEW_LINE> @click.argument('groups', nargs=-1, required=True) <NEW_LINE> @pass_config <NEW_LINE> def deploy_config(config, name, version, groups): <NEW_LINE> <INDENT> from cli.internal.commands.deploy impo...
Deploy config artifacts.  NAME of the configuration to be deployed. VERSION of the configuration to be deployed. GROUP(S) to deploy the configuration to.  For example, this registered configuration: os: name: mason-test version: latest  can be deployed to the "development" group with: $ mason de...
625941cedc8b845886cb5666
def to_md5(self): <NEW_LINE> <INDENT> return hashlib.md5(self.plain_text).hexdigest()
Convert a plain text password into MD5 format. :rtype: str
625941ce9b70327d1c4e0f07
def sync_signals(): <NEW_LINE> <INDENT> mappedObj = ObjectMapping.objects.all() <NEW_LINE> for objmapping in mappedObj: <NEW_LINE> <INDENT> _setup(objmapping) <NEW_LINE> <DEDENT> return "synced RDf publishing signals"
For each ObjectMapping force signal to be added or removed
625941ce5fc7496912cc3aaf
def submit_property_batch( self, name_id, timeout=60, operations=None, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> property_batch_description_list = models.PropertyBatchDescriptionList(operations=operations) <NEW_LINE> api_version = "6.0" <NEW_LINE> url = self.submit_property_batch.metadata...
Submits a property batch. Submits a batch of property operations. Either all or none of the operations will be committed. :param name_id: The Service Fabric name, without the 'fabric:' URI scheme. :type name_id: str :param timeout: The server timeout for performing the operation in seconds. This timeout specifies t...
625941ced164cc6175782e80
def user_cache_path( appname: Optional[str] = None, appauthor: Union[str, None, "Literal[False]"] = None, version: Optional[str] = None, opinion: bool = True, ) -> Path: <NEW_LINE> <INDENT> return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_cache_path
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`. :returns: cache pa...
625941ced486a94d0b98e278
def __init__(self, wsdl_parser, xsd_scope=None, _parsed=None): <NEW_LINE> <INDENT> self._init_attrs() <NEW_LINE> self.WsdlParser = wsdl_parser <NEW_LINE> self.parsed = self.WsdlParser.parse() if _parsed is None else _parsed <NEW_LINE> if xsd_scope is None: <NEW_LINE> <INDENT> onvif_xsd = xsd.Xsd(assets.XSD_ONVIF) <NEW_...
Initialises self. :param wsdl_parser - A <wsdl.WsdlParser> instance to be compiled. :xsd_scope - A list of <xsd.Xsd> instances which are ... imported/used by the wsdl ... Can leave None for auto-detection ... It's recommended to pass an xsd_scope of [onvif_xsd, common_xsd] ... This will save a lot of time if multiple ...
625941cea05bb46b383ec953
def triangle_spiral(side, angle, side2): <NEW_LINE> <INDENT> while is_run(): <NEW_LINE> <INDENT> a = math.pi - math.radians(angle) <NEW_LINE> d = math.sqrt(side * side + side2 * side2 - 2 * side * side2 * math.cos(a)) <NEW_LINE> a2 = math.degrees(math.acos((d * d + side2 * side2 - side * side) / (2 * d * side2))) <NEW_...
Draw a spiral formed by successive triangles. :param side: length of the first triangles's first side :param angle: the angle between the first side and second side :param side2: length of the first triangle's second side
625941ced53ae8145f87a3a2
def load_data(real_news_path: str, fake_news_path: str) -> tuple: <NEW_LINE> <INDENT> real_news = open(real_news_path, "r").readlines() <NEW_LINE> total_news = real_news + open(fake_news_path, "r").readlines() <NEW_LINE> vectorizer = CountVectorizer() <NEW_LINE> X = vectorizer.fit_transform(total_news) <NEW_LINE> y = [...
Loads files in <real_news_path> and <fake_news_path> into a single dataset. Splits the datatest randomly into 70% training, 15% validation, and 15% test examples Returns each example.
625941ce627d3e7fe0d68f82
def _cleanup_results(self, input_ts_list, obtained_match, obtained_no_match): <NEW_LINE> <INDENT> if input_ts_list is not None: <NEW_LINE> <INDENT> for item in input_ts_list: <NEW_LINE> <INDENT> self._delete_if_exist(ts=item) <NEW_LINE> <DEDENT> <DEDENT> if obtained_match is not None: <NEW_LINE> <INDENT> for timeseries...
Cleanup results of the current test after having checked them. :param input_ts_list: list of timeseries used as input of the algorithm build especially for this test :param obtained_match: list of matching timeseries obtained as result of algorithm :param obtained_no_match: list of non-matching timeseries obtained as ...
625941ce5fdd1c0f98dc0365
def location(self) -> Tuple[str, int]: <NEW_LINE> <INDENT> obj = self.object() <NEW_LINE> a = Addr2line() <NEW_LINE> a.add_addr(obj, self.simstate.addr) <NEW_LINE> return a.compute()[self.simstate.addr]
Binary of current state
625941ce3539df3088e2e47d
def u2ver(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> part = u2.__version__.split('.', 1) <NEW_LINE> n = float('.'.join(part)) <NEW_LINE> return n <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> log.exception(e) <NEW_LINE> return 0
Get the major/minor version of the urllib2 lib. @return: The urllib2 version. @rtype: float
625941ce2eb69b55b151c9e1
def initialise(self, global_conf, prefix='', **app_conf): <NEW_LINE> <INDENT> for name in SOAPQueryInterfaceMiddleware.CONFIG_FILE_OPTNAMES: <NEW_LINE> <INDENT> val = app_conf.get(prefix + name) <NEW_LINE> if val is not None: <NEW_LINE> <INDENT> setattr(self, name, val) <NEW_LINE> <DEDENT> <DEDENT> if self.serialise is...
:type global_conf: dict :param global_conf: PasteDeploy global configuration dictionary :type prefix: basestring :param prefix: prefix for configuration items :type app_conf: dict :param app_conf: PasteDeploy application specific configuration dictionary
625941ce45492302aab5e3f6
def _add_body_headers(self, headers, body): <NEW_LINE> <INDENT> if b'content-length' in headers: <NEW_LINE> <INDENT> return BODY_FLAT <NEW_LINE> <DEDENT> if b'chunked' in headers.get(b'transfer-encoding', []): <NEW_LINE> <INDENT> return BODY_CHUNKED <NEW_LINE> <DEDENT> if isinstance(body, bytes): <NEW_LINE> <INDENT> le...
Adds any headers needed for sending the request body. This will always defer to the user-supplied header content. :returns: One of (BODY_CHUNKED, BODY_FLAT), indicating what type of request body should be used.
625941ce8e7ae83300e4b0ff
def getKompass(): <NEW_LINE> <INDENT> Kurs=0 <NEW_LINE> KompassAdress=0x60 <NEW_LINE> daten1=bus.read_byte_data(KompassAdress,0x02) <NEW_LINE> daten2=bus.read_byte_data(KompassAdress,0x03) <NEW_LINE> Kurs=(daten1<<8)+daten2 <NEW_LINE> Kurs=Kurs/10 <NEW_LINE> return(Kurs)
Returns KompassKurs
625941ce3cc13d1c6d3c74ac
def saveWeightVectorResults(self, X, Y, learner, paramDict, fileName): <NEW_LINE> <INDENT> filelock = FileLock(fileName) <NEW_LINE> gc.collect() <NEW_LINE> if not filelock.isLocked() and not filelock.fileExists(): <NEW_LINE> <INDENT> filelock.lock() <NEW_LINE> try: <NEW_LINE> <INDENT> logging.debug("Computing weights f...
Save the results of the variable importance
625941ce8da39b475bd650a6
def send_msg_v1(self, msg, msg_format='text', color='yellow', notify=False): <NEW_LINE> <INDENT> params = {} <NEW_LINE> params['room_id'] = self.room <NEW_LINE> params['from'] = self.from_name[:15] <NEW_LINE> params['message'] = msg <NEW_LINE> params['message_format'] = msg_format <NEW_LINE> params['color'] = color <NE...
Method for sending a message to HipChat
625941ce5fcc89381b1e17f1
def azim_proj(pos): <NEW_LINE> <INDENT> [r, elev, az] = cart2sph(pos[0], pos[1], pos[2]) <NEW_LINE> return pol2cart(az, m.pi / 2 - elev)
azim_proj : Computes the Azimuthal Equidistant Projection of input point in 3D Cartesian Coordinates. Imagine a plane being placed against (tangent to) a globe. If a light source inside the globe projects the graticule onto the plane the result would be a planar, or azimuthal, map projection. Parameters: ----------- -...
625941ce8c0ade5d55d3eaed
@app.route('/admin') <NEW_LINE> def admin_page(): <NEW_LINE> <INDENT> n = fetch_entries() <NEW_LINE> chart = graph_data(n) <NEW_LINE> avg = sum(n)/len(n) <NEW_LINE> if session['logged_in'] == True: <NEW_LINE> <INDENT> return render_template('admin.html', entries=n, chart=chart, avg=avg) <NEW_LINE> <DEDENT> else: <NEW_L...
Renders admin interface page.
625941ce507cdc57c6306e0e
def write(self, nb, fp, **kwargs): <NEW_LINE> <INDENT> nbs = self.writes(nb,**kwargs) <NEW_LINE> if not py3compat.PY3 and not isinstance(nbs, unicode_type): <NEW_LINE> <INDENT> nbs = py3compat.str_to_unicode(nbs) <NEW_LINE> <DEDENT> return fp.write(nbs)
Write a notebook to a file like object
625941ce38b623060ff0af20
def coordAccess(self, c:tuple, r:int) -> list: <NEW_LINE> <INDENT> if self.coord2pos(c) is None: return [] <NEW_LINE> if r < 0: return [] <NEW_LINE> _rep = set([ c ]) <NEW_LINE> _todo = [c] <NEW_LINE> _seen = set([]) <NEW_LINE> for i in range(r): <NEW_LINE> <INDENT> _s = set([]) <NEW_LINE> while _todo != []: <NEW_LINE>...
parcours en largeur d'abord jusqu'à la profondeur r
625941cee64d504609d74972
def pop(self): <NEW_LINE> <INDENT> if self.a: <NEW_LINE> <INDENT> for i in range(len(self.a)-1): <NEW_LINE> <INDENT> self.b.append(self.a.pop()) <NEW_LINE> <DEDENT> k = self.a.pop() <NEW_LINE> for i in range(len(self.b)): <NEW_LINE> <INDENT> self.a.append(self.b.pop()) <NEW_LINE> <DEDENT> return k <NEW_LINE> <DEDENT> f...
Removes the element from in front of queue and returns that element. :rtype: int
625941ce8a43f66fc4b54197
def newCoin(self, signature, currency_description_document=None, mint_key=None): <NEW_LINE> <INDENT> coin = CurrencyCoin(standard_identifier = self.standard_identifier, currency_identifier = self.currency_identifier, denomination = self.denomination, key_identifier = self.key_identifier, serial = self.serial, signature...
Returns a coin using the unblinded signature. Performs tests if currency_description_document and mint_key are provided.
625941ceff9c53063f47c326
def getslc(self,_arg1_whichsol_,_arg2_slc): <NEW_LINE> <INDENT> if not isinstance(_arg1_whichsol_,soltype): raise TypeError("Argument _arg1_whichsol has wrong type") <NEW_LINE> _arg1_whichsol = _arg1_whichsol_ <NEW_LINE> if _arg2_slc is None: raise TypeError("Invalid type for argument _arg2_slc") <NEW_LINE> _copyback__...
Obtains the slc vector for a solution. getslc(self,_arg1_whichsol_,_arg2_slc) _arg1_whichsol: mosek.soltype. <no description> _arg2_slc: array of double. <no description>
625941cef8510a7c17cf982e
def average_surface_distance(mflo, mref): <NEW_LINE> <INDENT> pd = polydata_distance(mflo, mref, do_signed=False) <NEW_LINE> xv = pd.GetPointData().GetArray("Distance") <NEW_LINE> xn = nps.vtk_to_numpy(xv) <NEW_LINE> return xn.mean()
average on points so not reliable if the sampling is unhomogeneous
625941ce8da39b475bd650a7
def make(*args, **kwargs): <NEW_LINE> <INDENT> return _Interfaces_swig.length_framing_sink_b_make(*args, **kwargs)
make(char * preamble, bool log) -> length_framing_sink_b_sptr Return a shared_ptr to a new instance of Interfaces::length_framing_sink_b. To avoid accidental use of raw pointers, Interfaces::length_framing_sink_b's constructor is in a private implementation class. Interfaces::length_framing_sink_b::make is the public...
625941ce31939e2706e4cf9c
def validateMessage(magicNumber): <NEW_LINE> <INDENT> pass
used to validate remote commands @param magicNumber C{int} @return C{bool}
625941ce8c0ade5d55d3eaee
def test_correlation(a, b, method="kendall"): <NEW_LINE> <INDENT> a = FloatVector(a) <NEW_LINE> b = FloatVector(b) <NEW_LINE> t = stats.cor_test(a, b, method=method) <NEW_LINE> return float(t[2][0]) < .01
>>> test_correlation([44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1], [2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8]) Kendall's rank correlation tau data: c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1) and c(2.6, 3.1, 2.5, 5, 3.6, 4, 5.2, 2.8, 3.8) T = 26, p-value = 0.1194 alternative hypot...
625941ce3eb6a72ae02ec610
def do_pause(self, arg): <NEW_LINE> <INDENT> input(arg + '\n')
Displays the specified text then waits for the user to press RETURN.
625941ce0a366e3fb873e94d
def GetResultString(self): <NEW_LINE> <INDENT> return self.resultString;
Return result text.
625941cea79ad161976cc278
def load_image(path, file, mode = ''): <NEW_LINE> <INDENT> file = os.path.join(path, file) <NEW_LINE> try: <NEW_LINE> <INDENT> surface = pygame.image.load(file) <NEW_LINE> <DEDENT> except pygame.error: <NEW_LINE> <INDENT> raise SystemExit('Could not load image "%s" %s'%(file, pygame.get_error())) <NEW_LINE> <DEDENT> if...
loads an image, prepares it for play
625941cea8ecb033257d3200
def split_rec_bl(ts, inclusion_minimum_number=20): <NEW_LINE> <INDENT> recs = ts.sel(events=ts['events'].data['type'] == 'REC_WORD') <NEW_LINE> bl = ts.sel(events=ts['events'].data['type'] != 'REC_WORD') <NEW_LINE> included = False <NEW_LINE> if ((len(recs['events'].data) >= inclusion_minimum_number) & (len(bl['events'...
Returns out recalls, baselines, and a boolean on whether or not to included the data
625941cebde94217f3682f23
def test_no_options(tmpdir): <NEW_LINE> <INDENT> runner = click.testing.CliRunner() <NEW_LINE> with tmpdir.as_cwd(): <NEW_LINE> <INDENT> result = runner.invoke(main, []) <NEW_LINE> <DEDENT> assert result.exit_code == 1 <NEW_LINE> assert 'Error: can\'t find template "mailmerge_template.txt"' in result.output <NEW...
Verify help message when called with no options. Run mailmerge at the CLI with no options. Do this in an empty temporary directory to ensure that mailmerge doesn't find any default input files.
625941ce0383005118ecf715
def grid1(screen, space=64, color=(255,255,255), width=1): <NEW_LINE> <INDENT> info = pygame.display.Info() <NEW_LINE> res = (info.current_w, info.current_h) <NEW_LINE> array = [0,0] <NEW_LINE> if space <= 0: <NEW_LINE> <INDENT> space = 1 <NEW_LINE> <DEDENT> for lines in range(int(info.current_h/space+1)): <NEW_LINE> <...
Creates a grid with fixed mouse spacing between lines.
625941ce32920d7e50b28303
def test_confounding_braces(self): <NEW_LINE> <INDENT> confounding_braces_lines = ['{brace{bracebrace}{}', 'brace{{brace}', 'brace}', '}'] <NEW_LINE> start, start_line, end, end_line = find_open_and_close_braces( 0, 0, '{', confounding_braces_lines) <NEW_LINE> self.assertTrue(start == 0, 'didn\'t identify start index')...
plotextractor - find_open_and_close_braces confounding
625941ce3eb6a72ae02ec611
def getPlanetEaUrEnabledFlag(self): <NEW_LINE> <INDENT> return self.planetEaUrEnabledFlag
Returns the flag that indicates that the planet geocentric longitude movement measurements should be displayed for this planet. Arguments: flag - bool value for the enabled flag.
625941ce2eb69b55b151c9e2
def new_search(request): <NEW_LINE> <INDENT> search = request.POST.get('search') <NEW_LINE> models.Search.objects.create(search=search) <NEW_LINE> final_url = BASE_CRAIGSLIST_URL.format(quote_plus(search)) <NEW_LINE> response = requests.get(final_url) <NEW_LINE> data = response.text <NEW_LINE> soup = BeautifulSoup(data...
Handles request for new searches and renders a list of results
625941ce283ffb24f3c55a33
def estimatedStateCarte(state,carte,p): <NEW_LINE> <INDENT> angleToMatrix = {0: p.m0,1: p.m1, 2: p.m2, 3: p.m3} <NEW_LINE> vitesse = carte.vitesse <NEW_LINE> angle = state[3] <NEW_LINE> if vitesse == -1: <NEW_LINE> <INDENT> angle = state[3] + 2 <NEW_LINE> angle = angle % 4 <NEW_LINE> <DEDENT> matriceDirection = angleTo...
renvoie l'état obtenu en partant d'un état 'state' avec la carte 'carte' sur le plateau 'p'
625941ced99f1b3c44c676c0
@socketIO.on('pingServer') <NEW_LINE> def pingServer(data): <NEW_LINE> <INDENT> print(data)
Test websocket connection
625941ce16aa5153ce3625ab
def _connect(self): <NEW_LINE> <INDENT> headers = {'Accept': 'application/json', 'Authorization': 'Basic {0}'.format(base64.b64encode('{0}:{1}'.format(self.client_id, self.client_secret)).strip())} <NEW_LINE> raw_response = requests.post(url='{0}/oauth2/token/'.format(self._url), data={'grant_type': 'client_credentials...
Authenticates to the api
625941cecad5886f8bd2710c
def load_data(name, download=True): <NEW_LINE> <INDENT> path = datasets[name] <NEW_LINE> if not os.path.exists(path): <NEW_LINE> <INDENT> if download: <NEW_LINE> <INDENT> download_all() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError(( "'{}' dataset has not been downloaded, " "use the download.py module ...
Loads and wrangles the passed in text corpus by name. If download is specified, this method will download any missing files.
625941cee76e3b2f99f3a93d
def time_increment(self): <NEW_LINE> <INDENT> self.time_index += 1
To be invoked when a new audio chunk has been analyzed, before using any of the following methods.
625941ced58c6744b4257d93
def raw_data(self): <NEW_LINE> <INDENT> return self.reservoir.values
Return the raw underlying data
625941ced10714528d5ffe16
def get_args(): <NEW_LINE> <INDENT> parser = ArgumentParser( description='A quick and dirty simulation of a cosmic ray shower.' ) <NEW_LINE> parser.add_argument( 'ph_energy', metavar='ENERGY', type=float, help='initial energy of the cosmic ray photon initiating the shower (in MeV).' ) <NEW_LINE> parser.add_argument( 's...
Parses the command line parameters using argparse
625941ce60cbc95b062c6676