code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def predictive_gradients(self, Xnew, X=None): <NEW_LINE> <INDENT> raise NotImplementedError() | Calculates the predictive gradients (gradient of the prediction)
:param Xnew: The points to predict the gradient for
:param X: TODO: Not implemented yet
:return: Gradients(?) | 625941e3fff4ab517eb2f82a |
def isValidSerialization(self, preorder): <NEW_LINE> <INDENT> stack, count = [], [] <NEW_LINE> s = preorder.split(',') <NEW_LINE> if s[0] == '#' and len(s) > 1: return False <NEW_LINE> if s[0] == '#' and len(s) == 1: return True <NEW_LINE> stack.append(s[0]) <NEW_LINE> count.append(0) <NEW_LINE> for i in s[1:]: <NEW_LI... | :type preorder: str
:rtype: bool | 625941e36fb2d068a760f490 |
def htmlentitydecode(s): <NEW_LINE> <INDENT> def entity2char(m): <NEW_LINE> <INDENT> entity = m.group(1) <NEW_LINE> if entity in htmlentitydefs.name2codepoint: <NEW_LINE> <INDENT> return unichr(htmlentitydefs.name2codepoint[entity]) <NEW_LINE> <DEDENT> return u" " <NEW_LINE> <DEDENT> expression = u'&(%s);' % u'|'.join(... | Decode les caractére 'html' | 625941e34c3428357757c712 |
def connectToYamlGraph(self): <NEW_LINE> <INDENT> yaml_path_file = self.yaml_path_file <NEW_LINE> protocol = self.getKeyValueFromYAML(yaml_path_file, 'protocol') <NEW_LINE> url = self.getKeyValueFromYAML(yaml_path_file, 'url') <NEW_LINE> password = self.getKeyValueFromYAML(yaml_path_file, 'password') <NEW_LINE> new_ser... | Connect to the relevant version of the Neo4j client graph database | 625941e35e10d32532c5f312 |
def where(*args, **kwargs): <NEW_LINE> <INDENT> return tensorflow.where(*args, **kwargs) | See https://www.tensorflow.org/api_docs/python/tf/where .
| 625941e31d351010ab855f07 |
def __init__(self, interface, logger, base_configs=None): <NEW_LINE> <INDENT> self._base_configs = None <NEW_LINE> self._capture_file_path = "" <NEW_LINE> self._interface = "" <NEW_LINE> self._logger = logger <NEW_LINE> self._process = None <NEW_LINE> self._temp_capture_file_path = "" <NEW_LINE> if interface == "": <NE... | See base class documentation
| 625941e3851cf427c661a8f8 |
@pytest.mark.repeat(3) <NEW_LINE> @pytest.mark.parametrize('seed', [None]) <NEW_LINE> def test_estim_v_scaled_hrf(seed): <NEW_LINE> <INDENT> rng = check_random_state(seed) <NEW_LINE> eps = 1.0e-3 <NEW_LINE> t_r = 1.0 <NEW_LINE> n_atoms = 2 <NEW_LINE> n_times_valid = 500 <NEW_LINE> n_times_atom = 60 <NEW_LINE> n_voxels_... | Test the estimation of the HRF with the scaled HRF model without noise
in the observed data. | 625941e366673b3332b9247e |
def test_show_message_after_logout(self): <NEW_LINE> <INDENT> passwordchange_page = self.home_pg.go_to_settings_changepasswordpage() <NEW_LINE> try: <NEW_LINE> <INDENT> passwordchange_page.change_password(self.TEST_PASSWORD, self.NEW_PASSWORD) <NEW_LINE> self.assertTrue( self.login_pg.is_logout_reason_displayed(), "The... | Ensure an informational message is shown on the login page after the
user is logged out. | 625941e3c432627299f05035 |
def draw_info(self, additional_messages=[], icon=StringConstants.info): <NEW_LINE> <INDENT> messages = self.messages + additional_messages <NEW_LINE> if messages: <NEW_LINE> <INDENT> column = self.layout.column(align=True) <NEW_LINE> for text in set(messages): <NEW_LINE> <INDENT> column.label(text=text, icon=icon) | Draws the info box onto the layout.
:param additional_messages: Additional messages can be appended. | 625941e363f4b57ef00014fa |
def get_bn(n0): <NEW_LINE> <INDENT> def errfunc(bn, n): <NEW_LINE> <INDENT> return abs(scipy.special.gamma(2*n0) - 2*scipy.special.gammainc(2*n0, bn) * scipy.special.gamma(2*n0)) <NEW_LINE> <DEDENT> bn = scipy.optimize.fmin(errfunc, 1., args=(n0,), disp=False)[0] <NEW_LINE> return bn | Calculates the parameter bn from the Sersic profile.
Args:
n0 (int) = Sersic index.
Returns:
bn (float) = Value of bn. | 625941e3379a373c97cfaf33 |
def _consider_act(self, state, action): <NEW_LINE> <INDENT> prev_layer = None if not state else state[-1] <NEW_LINE> if not prev_layer: <NEW_LINE> <INDENT> return action.name == 'c' <NEW_LINE> <DEDENT> if prev_layer.name == 'o': <NEW_LINE> <INDENT> return action.name == 'lr' <NEW_LINE> <DEDENT> if action.name == 'lr': ... | Prunes valid actions based on prior knowledge
(Like why on earth would you do two batchnorms in a row?) | 625941e396565a6dacc8fab6 |
def list_children(handle, path, watcher=None): <NEW_LINE> <INDENT> result = sorted(zookeeper.get_children(handle, path, watcher)) <NEW_LINE> logging.getLogger().debug('Listing children of %s: %s ', path, ', '.join(result)) <NEW_LINE> return result | Return a sorted list of child nodes from ZooKeeper | 625941e32c8b7c6e89b35baa |
def write(self): <NEW_LINE> <INDENT> self.nxlink.write() <NEW_LINE> if not self.infile: <NEW_LINE> <INDENT> with self.nxlink as path: <NEW_LINE> <INDENT> target = path.getdataID() <NEW_LINE> <DEDENT> with self.nxgroup as path: <NEW_LINE> <INDENT> path.makelink(target) <NEW_LINE> <DEDENT> self._infile = self._saved = Tr... | Write the linked NXfield. | 625941e3d164cc617578313c |
def list(self, pat): <NEW_LINE> <INDENT> elm = [] <NEW_LINE> for thisg in self._nodes: <NEW_LINE> <INDENT> if fnmatch.fnmatch(thisg.name, pat): <NEW_LINE> <INDENT> if isinstance(thisg, NLHLeaf): <NEW_LINE> <INDENT> elm.append(' ' + thisg.name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> elm.append('* ' + thisg.name)... | Return a sorted list of node names. If the node is a tree,
its name is preceded by '* ', a an asterisk followed by a
space. Otherwise the node's name is preceded by two spaces. | 625941e301c39578d7e75228 |
def text(self, borders=False): <NEW_LINE> <INDENT> result = [] <NEW_LINE> data = self.data(header=True) <NEW_LINE> colsizes = [max(len(d[i]) for d in data) for i in range(len(data[0]))] <NEW_LINE> for d in data: <NEW_LINE> <INDENT> line = [] <NEW_LINE> for size, c in zip(colsizes, d): <NEW_LINE> <INDENT> line.append(c.... | Return textual table representation. | 625941e37b25080760e39843 |
def disable_fullquicklook(self): <NEW_LINE> <INDENT> for p in ['quicklook', 'cpu', 'gpu', 'mem', 'memswap']: <NEW_LINE> <INDENT> setattr(self.args, 'disable_' + p, False) | Disable the full quicklook mode | 625941e321bff66bcd684d3b |
def tout_droit(self): <NEW_LINE> <INDENT> self.controle_moteur(self.vitesse, self.vitesse) | change les vitesses des roues pour que le robot aille tout droit a la vitesse self.vitesse | 625941e371ff763f4b549a7f |
def plot_eigenvectors(emp_mats, gen_mats, n_hist=100): <NEW_LINE> <INDENT> mean_emp_pf = np.mean(_compute_pf_vec(emp_mats), axis=0) <NEW_LINE> mean_gen_pf = np.mean(_compute_pf_vec(gen_mats), axis=0) <NEW_LINE> _, axes = plt.subplots(1, 1, figsize=(8, 4)) <NEW_LINE> axes.hist(mean_gen_pf, bins=n_hist, density=True, col... | Plots the following stylized facts for comparison between empirical and generated
correlation matrices:
- Perron-Frobenius property (first eigenvector has positive entries).
It is reproduced with modifications from the following blog post:
`Marti, G. (2020) TF 2.0 DCGAN for 100x100 financial correlation matrices [Onl... | 625941e31b99ca400220ae9f |
def _normalize_path(filename, canonicalise=False): <NEW_LINE> <INDENT> if canonicalise: <NEW_LINE> <INDENT> filename = os.path.realpath(filename) <NEW_LINE> <DEDENT> filename = os.path.normpath(filename) <NEW_LINE> return os.path.normcase(filename) | Normalize a path on Windows / Linux
If `canonicalise` is True, dereference symlinks etc
by calling `os.path.realpath` | 625941e3e5267d203edce085 |
def __init__(self, url, base): <NEW_LINE> <INDENT> assert isinstance(url, unicode_type) and isinstance(base, unicode_type) <NEW_LINE> self.url = url <NEW_LINE> self.parsed_url = urlparse(self.url) <NEW_LINE> self.is_local = self.parsed_url.scheme in ('', 'file') <NEW_LINE> self.is_internal = self.is_local a... | :param url: The url this link points to. Must be an unquoted unicode string.
:param base: The base directory that relative URLs are with respect to.
Must be a unicode string. | 625941e366656f66f7cbc599 |
def save(self,stream): <NEW_LINE> <INDENT> cPickle.dump(self.n,stream) <NEW_LINE> cPickle.dump(self.d,stream) <NEW_LINE> cPickle.dump(self.k,stream) | Save the quantizer to disk. | 625941e367a9b606de4a82a4 |
def workaround_argparse_bug(subparsers): <NEW_LINE> <INDENT> if sys.version_info >= (3, 3): <NEW_LINE> <INDENT> subparsers.required = True | Work around argparse bug on Python 3.3 and above.
Subcommands should be mandatory, and they are treated as optional.
Impact is that argparse will not give an error if the user runs us
without any arguments, therefore we break with an exception when trying
to call args.func().
See http://bugs.python.org/issue9253 | 625941e34527f215b584c83f |
def post(self, *args, **kw): <NEW_LINE> <INDENT> val_params, kw = self._get_validation_params(kw) <NEW_LINE> resp = super().post(*args, **kw) <NEW_LINE> if not self.validate_skip and not val_params['validate_skip']: <NEW_LINE> <INDENT> self._validate(resp, 'post', val_params) <NEW_LINE> <DEDENT> return resp | :rtype: webtest.app.TestResponse | 625941e396565a6dacc8fab7 |
def _on_user_select_match(self, match:str) -> None: <NEW_LINE> <INDENT> if match == MORE_TEXT: <NEW_LINE> <INDENT> self._expanded_search() <NEW_LINE> <DEDENT> elif match in self._matches: <NEW_LINE> <INDENT> mappings = self._matches[match] <NEW_LINE> self._set_mappings(mappings) <NEW_LINE> if mappings: <NEW_LINE> <INDE... | If the user clicked "more", search again with another page.
Otherwise, update the mappings list with the items corresponding to <match> and pick the best one. | 625941e34527f215b584c840 |
def processFile(filename): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> match = re.match(r'.*\.java', filename, re.I) <NEW_LINE> if match: <NEW_LINE> <INDENT> pyFilename = re.compile(r'java$', re.I).sub('py', filename) <NEW_LINE> transform(filename, pyFilename) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(os.pat... | Processes a single file | 625941e307d97122c4178c81 |
def create_cfg_drv_vopt(self, instance, injected_files, network_info, lpar_uuid, admin_pass=None): <NEW_LINE> <INDENT> iso_path, file_name = self._create_cfg_dr_iso(instance, injected_files, network_info, admin_pass) <NEW_LINE> file_size = os.path.getsize(iso_path) <NEW_LINE> vopt, f_uuid = self._upload_vopt(iso_path, ... | Creates the config drive virtual optical and attach to VM.
:param instance: The VM instance from OpenStack.
:param injected_files: A list of file paths that will be injected into
the ISO.
:param network_info: The network_info from the nova spawn method.
:param lpar_uuid: The UUID of the client L... | 625941e3fb3f5b602dac3a84 |
def plot_decomp(row,Mean,EigVec,fig=None,ax=None,Title=None,interactive=False): <NEW_LINE> <INDENT> target=np.array(unpackArray(row.Values,np.float16),dtype=np.float64) <NEW_LINE> if Title is None: <NEW_LINE> <INDENT> Title='%s / %d %s'%(row['station'],row['year'],row['measurement']) <NEW_LINE> <DEDENT> eigen_decomp... | Plot a single reconstruction with an informative title
:param row: SparkSQL Row that contains the measurements for a particular station, year and measurement.
:param Mean: The mean vector of all measurements of a given type
:param v: eigen-vectors for the distribution of measurements.
:param fig: a matplotlib figure ... | 625941e33eb6a72ae02ec8d4 |
def reduce_mean(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None): <NEW_LINE> <INDENT> return gen_math_ops._mean( input_tensor, _ReductionDims(input_tensor, axis, reduction_indices), keep_dims, name=name) | Computes the mean of elements across dimensions of a tensor.
Reduces `input_tensor` along the dimensions given in `axis`.
Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each
entry in `axis`. If `keep_dims` is true, the reduced dimensions
are retained with length 1.
If `axis` has no entries, al... | 625941e363f4b57ef00014fb |
def get_parser_by_url(url): <NEW_LINE> <INDENT> parser = None <NEW_LINE> if re.search(r'^http[s]?://www\.google', url): <NEW_LINE> <INDENT> parser = GoogleParser <NEW_LINE> <DEDENT> elif re.search(r'^http://yandex\.ru', url): <NEW_LINE> <INDENT> parser = YandexParser <NEW_LINE> <DEDENT> elif re.search(r'^http://www\.bi... | Get the appropriate parser by an search engine url.
Args:
url: The url that was used to issue the search
Returns:
The correct parser that can parse results for this url.
Raises:
UnknowUrlException if no parser could be found for the url. | 625941e3d99f1b3c44c67975 |
def serialize(self, value, jsonapi_format=False): <NEW_LINE> <INDENT> return serialize_datetime(value) | Serialize a value to a json-serializable type.
See :meth:`Attribute.serialize`. | 625941e3de87d2750b860183 |
def texCoordXform(self, origShape): <NEW_LINE> <INDENT> scales = [1, 1, 1] <NEW_LINE> offsets = [0, 0, 0] <NEW_LINE> rots = [0, 0, 0] <NEW_LINE> if origShape is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if origShape[0] == 1: <NEW_LINE> <INDENT> rots = [0, -np.pi / 2, -np.pi / 2] <NEW_LINE> <DED... | Overrides :meth:`.Texture.texCoordXform`.
Returns an affine matrix which encodes a rotation that maps the two
major axes of the image voxel coordinate system to the first two axes
of the texture coordinate system.
This method is used by sub-classes which are being used to store 3D
image data, e.g. the :class:`.ImageT... | 625941e30c0af96317bb85d5 |
def create_or_load_model(session, model, model_dir, name, loaded_vector=None): <NEW_LINE> <INDENT> latest_ckpt = tf.train.latest_checkpoint(model_dir) <NEW_LINE> if latest_ckpt: <NEW_LINE> <INDENT> model = load_model(model, latest_ckpt, session, name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> start_time = time.time... | Create translation model and initialize or load parameters in session. | 625941e38a349b6b435e8560 |
def _validate_auth_flow( self, auth_flow: str, valid_flows: typing.List[AuthFlow] ) -> AuthFlow: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> auth_flow = AuthFlow[auth_flow] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise InvalidParameterException( f"1 validation error detected: Value '{auth_flow}' at 'a... | validate auth_flow value and convert auth_flow to enum | 625941e3656771135c3ebc60 |
def ModifyLogFileRetentionPeriod(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("ModifyLogFileRetentionPeriod", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Mod... | 本接口(ModifyLogFileRetentionPeriod)用于修改数据库备份日志保存天数。
:param request: Request instance for ModifyLogFileRetentionPeriod.
:type request: :class:`tencentcloud.mariadb.v20170312.models.ModifyLogFileRetentionPeriodRequest`
:rtype: :class:`tencentcloud.mariadb.v20170312.models.ModifyLogFileRetentionPeriodResponse` | 625941e3379a373c97cfaf34 |
def addRelated(self, uri1, uri2): <NEW_LINE> <INDENT> self.reporting['related'] += 1 <NEW_LINE> if self.isConceptScheme(uri1) or self.isConceptScheme(uri2): <NEW_LINE> <INDENT> self.logger.debug('Adding equal Concept - ConcepScheme relation') <NEW_LINE> self.addToResult(uri1, Merger.EXA.distantMatch, uri2) <NEW_LINE> <... | addEquals takes two URIs and adds them to the resultgraph.
if one of the URIs is a SKOS:ConceptScheme, the predicate will
be EXA:distantMatch instead of SKOS:CloseMatch. | 625941e3cb5e8a47e48b7e91 |
@click.command(short_help='Get current value of a PowerPlay parameter(s).') <NEW_LINE> @click.argument('variable-path-set', nargs=-1, required=True) <NEW_LINE> @click.pass_context <NEW_LINE> def get(ctx, variable_path_set): <NEW_LINE> <INDENT> debug = ctx.obj['DEBUG'] <NEW_LINE> pp_file = ctx.obj['PPBINARY'] <NEW_LINE>... | Retrieves current value of one or multiple PP parameters
The parameter variable path must be specified in
"/<param> notation", for example:
upp get /FanTable/TargetTemperature /VddgfxLookupTable/7/Vdd
The raw value of the parameter will be retrieved,
decoded and displayed on console.
Multiple PP parameters can... | 625941e3f9cc0f698b1409e5 |
@auth <NEW_LINE> def bind_qcode(request): <NEW_LINE> <INDENT> ret = {'code': 1000} <NEW_LINE> try: <NEW_LINE> <INDENT> access_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={redirect_uri}&response_type=code&scope=snsapi_userinfo&state={state}#wechat_redirect" <NEW_LINE> access_url... | 生成二维码,让用户扫码(向微信发送请求,获取用户信息。然后微信回调 url:http://47.93.4.198/callback/, 在callback中获取用户唯一标识)
:param request:
:return: | 625941e3498bea3a759b9e9b |
def play(self): <NEW_LINE> <INDENT> play_message = {'PYTHON': ['/usr/bin/python3', 'python3', self.file_path, '<', self.input_path], 'C': [self.excute_path, self.excute_path, '<', self.input_path], 'C++': [self.excute_path, self.excute_path, '<', self.input_path]} <NEW_LINE> return play_message[self.language] | Return execute command
:return: execute command
:rtype: str | 625941e399fddb7c1c9de77c |
def split_parts(self): <NEW_LINE> <INDENT> if not self.has_multi(): <NEW_LINE> <INDENT> debug('Single part: {}'.format(self)) <NEW_LINE> return [self] <NEW_LINE> <DEDENT> roomparts = self.split_rooms() <NEW_LINE> return self.split_room_cabs(roomparts) | If this MozaikPart has multiple rooms/cabs, split it into
multiple MozaikParts.
Otherwise returns a list with [self]. | 625941e363d6d428bbe448de |
def exists(self): <NEW_LINE> <INDENT> return FilePath(self.zipfile.filename).exists() | Returns C{True} if the underlying archive exists. | 625941e36e29344779a629fd |
@app.route('/edit_recipe/<title>/<category>/<description>', methods=['GET', 'POST']) <NEW_LINE> def edit_recipe(title='', category='', description=''): <NEW_LINE> <INDENT> recipe.delete(title) <NEW_LINE> context = {"title" : title, "category" : category, "description" : description} <NEW_LINE> return render_template('a... | edit an already saved recipe | 625941e3442bda511e8be800 |
def calculate_vn_diff_SP(vn_diff_real, vn_diff_imag, vn_diff_denorm1, vn_diff_denorm2): <NEW_LINE> <INDENT> vn_diff_real = array(vn_diff_real) <NEW_LINE> vn_diff_imag = array(vn_diff_imag) <NEW_LINE> vn_diff_denorm1 = array(vn_diff_denorm1) + 1e-30 <NEW_LINE> vn_diff_denorm2 = array(vn_diff_denorm2) <NEW_LINE> nev = le... | this funciton calculates the scalar-product vn
assumption: no overlap between particles of interest
and reference flow Qn vectors | 625941e3009cb60464c6379c |
def get_group_ranking_list(self): <NEW_LINE> <INDENT> if self.group_rankings is None: <NEW_LINE> <INDENT> sorted_group_scores = sorted(list(self.scores_dict.items()), key=lambda x: x[1]['average_daily_points'], reverse=True) <NEW_LINE> group_dict = self.group_dict <NEW_LINE> self.group_rankings = [group_dict[g[0]] for ... | Returns a sorted list of groups, ordered by their rank where the first item in the list is in first place,
the second item in the list is in second place, and so on. | 625941e3d53ae8145f87a656 |
def setConfig(self, config): <NEW_LINE> <INDENT> self._previousIdentifier = config['identifier'] <NEW_LINE> self._ui.lineEdit0.setText(config['identifier']) <NEW_LINE> self._ui.lineEdit1.setText(config['subject_height']) <NEW_LINE> self._ui.lineEdit2.setText(config['subject_mass']) <NEW_LINE> self._previousOsimOutputDi... | Set the current value of the configuration for the dialog. Also
set the _previousIdentifier value so that we can check uniqueness of the
identifier over the whole of the workflow. | 625941e3097d151d1a223245 |
def test_user_update(self): <NEW_LINE> <INDENT> pass | Test when a user updates their profile information | 625941e3de87d2750b860184 |
def readfiles(self): <NEW_LINE> <INDENT> self.io.seek(0) <NEW_LINE> with zipfile.ZipFile(self.io) as archive: <NEW_LINE> <INDENT> for filename in archive.namelist(): <NEW_LINE> <INDENT> if filename.endswith(".class"): <NEW_LINE> <INDENT> iostr = StringIO(archive.read(filename)) <NEW_LINE> javaclass.read_magic(iostr) <N... | Read files within the archive and return their content | 625941e35fcc89381b1e1aaf |
def make(parser): <NEW_LINE> <INDENT> parser.add_argument( '--env', required=True, dest='ENV', help='The fuel environment to be deployment.' ) <NEW_LINE> parser.add_argument( '--influxdb', dest='INFLUXDB', action='store_true', default=False, help='Deployment influxdb node.', ) <NEW_LINE> parser.add_argument( '--lma_col... | Deploy fuel monitor plugins. | 625941e3b5575c28eb68e3f1 |
@calc_time <NEW_LINE> def main(): <NEW_LINE> <INDENT> if BUCKET is None or PREFIX is None or TIMESTAMP is None: <NEW_LINE> <INDENT> logger.error("BUCKET or PREFIX or TIMESTAMP is None") <NEW_LINE> return 1 <NEW_LINE> <DEDENT> logger.info("BUCKET: {}".format(BUCKET)) <NEW_LINE> logger.info("PREFIX: {}".format(PREFIX)) <... | Main logic | 625941e3cad5886f8bd273c7 |
def test_warn_on_missing_amend_threshold(self): <NEW_LINE> <INDENT> deed = Deed() <NEW_LINE> deed.set_signee(self.board[0], 1) <NEW_LINE> deed.set_operation(Operation.transfer, 1) <NEW_LINE> with self.assertRaises(InvalidDeedError): <NEW_LINE> <INDENT> deed.validate() <NEW_LINE> <DEDENT> with self.assertRaises(InvalidD... | Checks a warning is printed when creating a deed when amend threshold is specified | 625941e35510c4643540f7c8 |
def update_virtual_machine(self, virtual_machine_name, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> virtual_machine_id = self.get_virtual_machines(name=virtual_machine_name)[0]['id'] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> raise exceptions.NotFoundException('virtual-machine: {}' .format(vi... | Update virtual-machine
:param virtual_machine_name: name of the virtual-machine to update
:param kwargs: update data
:return: bool True if successful otherwise raise UpdateException | 625941e33c8af77a43ae3b92 |
def test_delete(): <NEW_LINE> <INDENT> with patch("controlpanel.api.helm._execute") as mock_execute: <NEW_LINE> <INDENT> helm.delete("foo", "bar", "baz") <NEW_LINE> mock_execute.assert_called_once_with( "delete", "--purge", "foo", "bar", "baz", ) | The delete function (helm 2) results in the expected helm command to be
executed. | 625941e3d7e4931a7ee9e30d |
def service_related_triggers_switch_to(request, user_service_id, switch): <NEW_LINE> <INDENT> status = True <NEW_LINE> if switch == 'off': <NEW_LINE> <INDENT> status = False <NEW_LINE> <DEDENT> TriggerService.objects.filter(provider__id=user_service_id).update(status=status) <NEW_LINE> TriggerService.objects.filter(con... | switch the status of all the triggers related to the service,
then go back home
:param request: request object
:param user_service_id: the service ID to switch the status to
True or False of all the related trigger
:param switch: the switch value
:type request: HttpRequest object
:type user_service_id: int
:type switch... | 625941e3fbf16365ca6f65b9 |
def GetByteCount(self, *__args): <NEW_LINE> <INDENT> pass | GetByteCount(self: UnicodeEncoding, chars: Char*, count: int) -> int
Calculates the number of bytes produced by encoding a set of characters starting at the
specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns... | 625941e38da39b475bd65366 |
def __init__(self, config_path=None): <NEW_LINE> <INDENT> config_path = config_path if config_path is not None else './slack_zabbix.cfg' <NEW_LINE> config = parse_configs(config_path) <NEW_LINE> self.url = config['url'] <NEW_LINE> self.emoji = {} <NEW_LINE> self.emoji['recovery'] = config['emoji']['recovery'... | Construct class.
Constructor Arguments in kwargs and configuration
file 'slack_zabbix.cfg'.
'slack_zabbix.cfg' must live in the same directory as the
'slack_zabbix.py' script
Sample configuration:
url: https://hooks.slack.com/the/rest/of/url
emoji:
recovery: ':smiling:'
problem: ':frowning:'
... | 625941e3eab8aa0e5d26df47 |
def test_shrink_v5(): <NEW_LINE> <INDENT> pass | >>> import audio.shrink
>>> import audio.wave
>>> import numpy as np
>>> dt = 1.0 / 44100.0
>>> f = 440.0
>>> T = 1.0
>>> t = np.r_[0.0:T:dt]
>>> data = np.cos(2.0 * np.pi * f * t)
>>> data = audio.wave.read(audio.wave.write(data), scale=False)
>>> stream = audio.shrink.shrink_v5(data) | 625941e3a934411ee3751a82 |
def _get_actions(self, option, index, return_all=False, positions=None): <NEW_LINE> <INDENT> result = {} <NEW_LINE> positions = positions or [] <NEW_LINE> selected = self.is_selected(option) <NEW_LINE> hover = self.is_hover(option) <NEW_LINE> for pos, _ in enumerate(self.POSITIONS): <NEW_LINE> <INDENT> if positions and... | Retun all of the actions that are valid for this item.
:param option: The option used for rendering the item.
:type option: :class:`sgtk.platform.qt.QtGui.QStyleOptionViewItem`
:param index: The item model index.
:type index: :class:`sgtk.platform.qt.QtCore.QModelIndex`
:param return_all: Return all actions no matter ... | 625941e3566aa707497f4951 |
def normpath(path): <NEW_LINE> <INDENT> return os.path.normpath(path) | Returns Normalize path, eliminating double slashes, etc.
.. versionadded:: 2015.5.0
This can be useful at the CLI but is frequently useful when scripting.
.. code-block:: jinja
{%- from salt['file.normpath'](tpldir ~ '/../vars.jinja') import parent_vars %}
CLI Example:
.. code-block:: bash
salt '*' file.... | 625941e307f4c71912b11873 |
def _get_dav_props_hlpr(self, cr, par_class, prop_model, prop_ref_field, res_id): <NEW_LINE> <INDENT> ret = par_class.get_dav_props(self, cr) <NEW_LINE> if prop_model: <NEW_LINE> <INDENT> propobj = self.context._dirobj.pool.get(prop_model) <NEW_LINE> uid = self.context.uid <NEW_LINE> ctx = self.context.context.copy() <... | Helper for dav properties, usable in subclasses
@param par_class The parent class
@param prop_model The name of the orm model holding the properties
@param prop_ref_field The name of the field at prop_model pointing to us
@param res_id the id of self in the corresponing orm table, that should
match pro... | 625941e39b70327d1c4e11c5 |
def set_servo(self, servo: int, position: float, **kwargs): <NEW_LINE> <INDENT> if position is None: <NEW_LINE> <INDENT> raise ValueError(f'position for s{servo} must not be None') <NEW_LINE> <DEDENT> if not isinstance(position, (float, int)): <NEW_LINE> <INDENT> raise ValueError(f's{servo} value must be float, was {po... | Set a servo value
:param servo:
The servo to set, this must be a value in the array of servos
:param position:
Position from -1.0 (minimum PWM duty cycle) to 1.0 (max PWM). Values outside this range will be clamped to
it
:param kwargs:
Any additional arguments to provide to the underlying _set_servo_pu... | 625941e3f8510a7c17cf9aed |
def get_news(): <NEW_LINE> <INDENT> r = requests.get(NEW_ROOT, headers=HEADERS) <NEW_LINE> if r.status_code == 200: <NEW_LINE> <INDENT> news = r.json() <NEW_LINE> db['raw'].insert_one({ "bests": news, "time": time.time(), "type": "new", }) <NEW_LINE> return news | Get the newest
:return: | 625941e3627d3e7fe0d6923f |
def list_donors(self, **kwargs): <NEW_LINE> <INDENT> for name in self.donors: <NEW_LINE> <INDENT> print(name) <NEW_LINE> <DEDENT> return [name for name in self.donors] | If the user types ‘list’, show them a list of the donor names and re-prompt | 625941e37c178a314d6ef854 |
def __init__( self, config: KubeConfig, timeout: float = DEFAULT_HTTP_TIMEOUT, dry_run: bool = False, verify: bool = True, http_adapter: Optional[requests.adapters.HTTPAdapter] = None, ): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.timeout = timeout <NEW_LINE> self.url = self.config.cluster["server"] <NEW_... | Creates a new instance of the HTTPClient.
:Parameters:
- `config`: The configuration instance | 625941e31f5feb6acb0c4f37 |
def pre_prune(itemSet,length): <NEW_LINE> <INDENT> items=set([item for itemset in itemSet for item in itemset]) <NEW_LINE> freq=[len([itemset for itemset in itemSet if i in itemset]) for i in items] <NEW_LINE> item=[i for i in items] <NEW_LINE> item_freq=dict(zip(item,freq)) <NEW_LINE> filter_item=[item for item,freq i... | Preprune frequent itemsets which cannot generate higher dimensional frequent itemsets.
The condition is that the frequent itemset should not contain any item whose frequency
of appearing in the itemsets is lower than the length of the itemset. | 625941e391f36d47f21ac8e5 |
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ApiResponseOfListOfATMOpenDataResponse): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | 625941e356ac1b37e62645b6 |
def register_producer(self, producer, id): <NEW_LINE> <INDENT> self.producers[id] = producer <NEW_LINE> if id not in self.producer_rankings.keys(): <NEW_LINE> <INDENT> self.producer_rankings[id] = 10 <NEW_LINE> <DEDENT> self.broadcast_new_producer(producer) | Register a new producer. Every consumer should be notified about this producer | 625941e356ac1b37e62645b7 |
def __str__(self): <NEW_LINE> <INDENT> return self.name | String representation of the Weapon class. | 625941e363b5f9789fde74d4 |
def aqi_get(city_name): <NEW_LINE> <INDENT> url = _AQI_URL.replace('<CITY>', city_name) <NEW_LINE> html_content = _fetch_html(url) <NEW_LINE> parser = _MyHTMLParser() <NEW_LINE> parser.feed(html_content) <NEW_LINE> return int(parser.aqi) | Return integer for AQI of given city and raise error if failure.
Data is from parsed from twitter US account. | 625941e366673b3332b9247f |
def isMatch(self, s, p): <NEW_LINE> <INDENT> m = len(s) <NEW_LINE> n = len(p) <NEW_LINE> arr = [[False] * (n + 1) for x in range(m + 1)] <NEW_LINE> arr[0][0] = True <NEW_LINE> for i in range(m + 1): <NEW_LINE> <INDENT> for j in range(n + 1): <NEW_LINE> <INDENT> if i == j == 0: <NEW_LINE> <INDENT> continue <NEW_LINE> <D... | :type s: str
:type p: str
:rtype: bool | 625941e37b180e01f3dc4be4 |
def train_weights(dataset, learning_rate, n_epoch): <NEW_LINE> <INDENT> weights = [0.0 for i in range(len(dataset[0]))] <NEW_LINE> MSE_list = [] <NEW_LINE> for epoch in range(n_epoch): <NEW_LINE> <INDENT> MSE = 0.0 <NEW_LINE> for row in dataset: <NEW_LINE> <INDENT> prediction = predict(row, weights) <NEW_LINE> error = ... | :param dataset: the dataset we use to train perceptron
:param learning_rate: The learning rate of the neural network
:param n_epoch: number of epochs
:return: mean square error list and weights of the neural network | 625941e332920d7e50b285c2 |
@app.route('/phrases/<phrase_id>') <NEW_LINE> def show_metadata(phrase_id): <NEW_LINE> <INDENT> phrase = crud.get_phrase_by_phrase_id(phrase_id) <NEW_LINE> phrase_state = phrase.phrase_state <NEW_LINE> phrase_date = str(phrase.phrase_date) <NEW_LINE> phrase_date_str = phrase_date[:10] <NEW_LINE> response = requests.get... | Show metadata for a particular phrase.
Query the CDC API for COVID data. | 625941e399cbb53fe6792fd4 |
def run_test_step(self, sess, text, text_len, keywords): <NEW_LINE> <INDENT> pred = sess.run([self._prediction], { self._text: text, self._text_len: text_len, self._dropout: 1. }) <NEW_LINE> pred = pred[0] <NEW_LINE> for i, p in enumerate(pred): <NEW_LINE> <INDENT> _, topk_pred = tf.nn.top_k(p, self._num_kw) <NEW_LINE>... | 625941e38e05c05ec3eea766 | |
def style_color(df, colors): <NEW_LINE> <INDENT> return df.style.apply(style_apply, colors=colors) | :param df: pd.DataFrame
:param colors: 字典 内容是 {标题:颜色}
:return: | 625941e3a05bb46b383ecc0c |
def test_binary_crossentropy(): <NEW_LINE> <INDENT> pred = np.array([0.0, 0.5, 1.0]).reshape((1, 3)) <NEW_LINE> actual = np.array([1.0, 1.0, 1.0]).reshape((1, 3)) <NEW_LINE> pred_adj = np.array([1e-15, 0.5, (1 - 1e-15)]).reshape((1, 3)) <NEW_LINE> expected_results = -1 / 3 * np.sum(actual * np.log(pred_adj)) <NEW_LINE>... | Test the binary cross entropy loss function. We pass a number of prediction, actual pairs and check the results.
:return: | 625941e35e10d32532c5f314 |
@clickwatch <NEW_LINE> def porcess_geos(): <NEW_LINE> <INDENT> global Geocdfs <NEW_LINE> Geocdfs = dict() <NEW_LINE> for idx, df in vmaidf.groupby(level=0): <NEW_LINE> <INDENT> df = df.loc[idx] <NEW_LINE> rurals = [] <NEW_LINE> if len(idx) == 2: <NEW_LINE> <INDENT> if idx != '01': rurals.append( (idx, 1) ) <NEW_LINE> <... | porcessing aggregate geographies | 625941e3460517430c394569 |
def createFolder(server, port, adminUser, adminPass, folderName, folderDescription, token=None): <NEW_LINE> <INDENT> if token is None: <NEW_LINE> <INDENT> token = gentoken(server, port, adminUser, adminPass) <NEW_LINE> <DEDENT> folderProp_dict = { "folderName": folderName, "description": folderDescription } <NEW_LINE> ... | Function to create a folder
Requires Admin user/password, as well as server and port (necessary to construct token if one does not exist).
folderName = String with a folder name
folderDescription = String with a description for the folder
If a token exists, you can pass one in for use. | 625941e35166f23b2e1a5547 |
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self <NEW_LINE> buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) <NEW_LINE> _x = self.header.frame_id <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <INDENT> _x = _x.... | serialize message into buffer
:param buff: buffer, ``StringIO`` | 625941e36fb2d068a760f492 |
def get_filter(self) -> "uint32_t": <NEW_LINE> <INDENT> return _moduleconnectorwrapper.PyDataReader_get_filter(self) | get_filter(PyDataReader self) -> uint32_t
Returns
-------
the filter used by read_record and peek_record. By default this value is all
data types.
See also: set_filter | 625941e35f7d997b87174e89 |
def mark_notifications_as_read(self, license_key: str): <NEW_LINE> <INDENT> return self.post_request('mark_notifications_as_read', data={'license_key': license_key}) | Отметить непрочитанные уведомления как прочитанные.
:param license_key: ключ-лицензия из личного кабинета игрока.
:return: возвращает ответ в виде json (словаря) | 625941e33317a56b8693a03d |
def __init__(self, api_version=None, groups=None, kind=None): <NEW_LINE> <INDENT> self._api_version = None <NEW_LINE> self._groups = None <NEW_LINE> self._kind = None <NEW_LINE> self.discriminator = None <NEW_LINE> if api_version is not None: <NEW_LINE> <INDENT> self.api_version = api_version <NEW_LINE> <DEDENT> self.g... | V1APIGroupList - a model defined in Swagger | 625941e3c432627299f05037 |
def step(self, action: Action) -> Tuple[float, bool]: <NEW_LINE> <INDENT> self._state, reward, done = self.functional_step(self.state, action) <NEW_LINE> self._observation = None <NEW_LINE> return reward, done | Runs the dynamics for one timestep, and returns reward and done flag
Internally calls :py:meth:`functional_step` to update the state; also
resets the observation, so that an updated observation will be
generated upon request.
Args:
action (Action): the chosen action to apply
Returns:
Tuple[float, bool]: rew... | 625941e301c39578d7e7522a |
def restart(): <NEW_LINE> <INDENT> teardown() <NEW_LINE> setup() <NEW_LINE> run() | Reinstantiates everything and re-enters the main loop. | 625941e3b7558d58953c52fa |
def delete_material_all(arg_object:bpy.types.Object) -> bool: <NEW_LINE> <INDENT> if arg_object.type != 'MESH': <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> meshdata = arg_object.data <NEW_LINE> while len(meshdata.materials) > 0: <NEW_LINE> <INDENT> meshdata.materials.pop(index=-1) <NEW_LINE> <DEDENT> return Tr... | 指定オブジェクトのマテリアルを全て削除する
Args:
arg_object (bpy.types.Object): 指定オブジェクト
arg_materialname (str, optional): 作成マテリアル名. Defaults to "DefaultMaterial".
Returns:
bool: 実行正否 | 625941e3a8ecb033257d34ba |
def get_prediction(country_code, event_category_id): <NEW_LINE> <INDENT> with open(CSV_FILE, 'rt') as csvprices: <NEW_LINE> <INDENT> prices = list(csv.reader(csvprices, delimiter=",")) <NEW_LINE> values=[] <NEW_LINE> i=0 <NEW_LINE> for i in range(0,len(prices)): <NEW_LINE> <INDENT> if prices[i][2]==country_code and pri... | Returns the mean and standard deviation for purchases for the provided country and event category.
:Parameters:
- `country_code` (str)
- `event_category` (str): Human-friendly alias for a Category ID.
:Returns:
Dictionary with 'mean' and 'standard_deviation' as keys and floats as values. | 625941e37b25080760e39845 |
def face_degeneracies(m, I): <NEW_LINE> <INDENT> if not I: <NEW_LINE> <INDENT> return ([], m) <NEW_LINE> <DEDENT> J = [] <NEW_LINE> t = m <NEW_LINE> for i in I: <NEW_LINE> <INDENT> if t is None: <NEW_LINE> <INDENT> J.append(i) <NEW_LINE> <DEDENT> elif t<i: <NEW_LINE> <INDENT> J.append(i-1) <NEW_LINE> <DEDENT> elif t ==... | Return the result of applying the face map `d_m` to the iterated
degeneracy `s_I = s_{i_1} s_{i_2} ... s_{i_n}`.
INPUT:
- ``m`` -- integer
- ``I`` -- tuple ``(i_1, i_2, ..., i_n)`` of integers. We assume
that this sequence is strictly decreasing.
Using the simplicial identities (see :mod:`.simplicial_set`), we
can... | 625941e3d6c5a1020814443d |
def myhasattr(obj, name, _marker=object()): <NEW_LINE> <INDENT> return getattr(obj, name, _marker) is not _marker | Make sure we don't mask exceptions like hasattr().
We don't want exceptions other than AttributeError to be masked,
since that too often masks other programming errors.
Three-argument getattr() doesn't mask those, so we use that to
implement our own hasattr() replacement. | 625941e385dfad0860c3b24a |
@click.group(context_settings=dict(obj={})) <NEW_LINE> @click.pass_context <NEW_LINE> @_option("-i", "--input", type=click.File("r", lazy=True), default="-", help="Path to vertical to process (- for STDIN).") <NEW_LINE> @_option("--inenc", type=str, default="utf-8", help="Input encoding.") <NEW_LINE> @_option("--outenc... | Slice and dice a corpus in vertical format.
Available COMMANDs are listed below and are documented with ``vrt COMMAND
--help``.
NOTE: In order to speed up processing to a degree, you can provide a list
of strings to be considered valid structure names in the ``PYVERT_STRUCTS``
environment variable. If provided, the l... | 625941e3d99f1b3c44c67976 |
def y_from_x(y,x,y_to_find): <NEW_LINE> <INDENT> yreduced = np.array(y) - y_to_find <NEW_LINE> freduced = interpolate.UnivariateSpline(x, yreduced, s=None) <NEW_LINE> return freduced.roots() | Returns list of x values corresponding to a y after a doing a
univariate spline interpolation
:param x: x-axis numerical data
:param y: corresponding y-axis numerical data
:param y_to_find: x value for desired y-value,
interpolated from nearest two measured x/y value pairs
:return: interpolated y value | 625941e324f1403a92600f51 |
def init_optimizer(self, kvstore='local', optimizer='sgd', optimizer_params=(('learning_rate', 0.01),), force_init=False): <NEW_LINE> <INDENT> assert self.binded and self.params_initialized <NEW_LINE> if self.optimizer_initialized and not force_init: <NEW_LINE> <INDENT> self.logger.warning('optimizer already initialize... | Installs and initializes optimizers.
Parameters
----------
kvstore : str or KVStore
Default `'local'`.
optimizer : str or Optimizer
Default `'sgd'`
optimizer_params : dict
Default `(('learning_rate', 0.01),)`. The default value is not a dictionary,
just to avoid pylint warning of dangerous default valu... | 625941e33cc13d1c6d3c7767 |
@PETSc.Log.EventDecorator("thetis.get_facet_areas") <NEW_LINE> def get_facet_areas(mesh): <NEW_LINE> <INDENT> HDivTrace = FunctionSpace(mesh, "HDiv Trace", 0) <NEW_LINE> v, u = TestFunction(HDivTrace), TrialFunction(HDivTrace) <NEW_LINE> facet_areas = Function(HDivTrace, name="Facet areas") <NEW_LINE> mass_term = v('+'... | Compute area of each facet of `mesh`. The facet areas are stored as a HDiv trace field.
NOTES:
* In the 2D case, this gives edge lengths.
* The plus sign is arbitrary and could equally well be chosen as minus. | 625941e3379a373c97cfaf35 |
def model(self, X_train, Y_train, X_test, Y_test, num_iterations=2000, learning_rate=0.1, print_cost=True): <NEW_LINE> <INDENT> w, b = self.initialize_with_zeros(X_train.shape[0]) <NEW_LINE> parameters, grads, costs = self.optimize(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost=False) <NEW_LINE> w = ... | Builds the logistic regression model by calling the function you've implemented previously
Arguments:
X_train -- training set represented by a numpy array of shape (training example size, m_train)
Y_train -- training labels represented by a numpy array (vector) of shape (1, m_train)
X_test -- test set represented by a... | 625941e321bff66bcd684d3d |
def try_recover_premature_end( self, state ): <NEW_LINE> <INDENT> if state == 'before tests': <NEW_LINE> <INDENT> test_begin = gts_tparser._test_begin.search('TEST_BEGIN 0') <NEW_LINE> self.test_begin( state, test_begin) <NEW_LINE> msg = "No \"TEST_BEGIN\" Directive found" <NEW_LINE> self.broken( msg, 'parse error') <N... | Sometimes tests just don't end where you wnat them.
And ya gotta go back and figure out why. | 625941e350812a4eaa59c70c |
def __parse_entities(self, txt, entities): <NEW_LINE> <INDENT> if not entities: <NEW_LINE> <INDENT> return txt.split() <NEW_LINE> <DEDENT> entity = entities[0] <NEW_LINE> if txt.find(entity) == -1: <NEW_LINE> <INDENT> return self.__parse_entities(txt, entities[1:]) <NEW_LINE> <DEDENT> beg_index = txt.find(entity) <NEW_... | produces a list representation of the given text with each entity
as its' own list element. Example:
'i hate northesatern university, but i like john adams'
->
['i', 'hate', 'northeastern university', 'but', 'i', 'like', 'john adams']
this will apply this transformation to multiple references to the same
entity, as we... | 625941e34f6381625f114e2b |
def testCase003(self): <NEW_LINE> <INDENT> arg = 'd:/:d:/' <NEW_LINE> if RTE is RTE_WIN32: <NEW_LINE> <INDENT> resX = 'd:\\:d:' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resX = 'd:/:d:' <NEW_LINE> <DEDENT> res = normpathx(arg, tpf='local') <NEW_LINE> self.assertEqual(res, resX) | .. code-block:: python
:linenos:
path = 'd:/:d:/' | 625941e3b830903b967e9cf6 |
def _get_appdesc_embeddings(self, features, training): <NEW_LINE> <INDENT> appdesc_embeddings = self._word_embedding_layer( features['appdesc_token_id']) <NEW_LINE> appdesc_embeddings = self._aggregate_text_embedding( features['appdesc_token_id'], appdesc_embeddings) <NEW_LINE> if training: <NEW_LINE> <INDENT> appdesc_... | Get app description embeedings. | 625941e37d847024c06be6ae |
def wishart_i(self, T, n, N=1, num=1, x=None, method="exact", **kwargs): <NEW_LINE> <INDENT> assert T >= 0 and N > 0 <NEW_LINE> if x is None: <NEW_LINE> <INDENT> x = self.x <NEW_LINE> <DEDENT> assert x.shape == (num, self.d, self.d) or x.shape == (self.d, self.d) <NEW_LINE> h = T/N <NEW_LINE> X_proc = np.zeros((num, N+... | :param T: Non-negative real number.
:param n: Positive integer. The n of I_d^n.
:param N: Positive integer. The number of discrete time points.
:param x: Pos-def matrix. The initial value. If x is None, self.x is used.
:return: an np.array of shape (num, self.d, self.d). | 625941e3cc40096d61595d3e |
def fixnodenames(self, aframe): <NEW_LINE> <INDENT> for anode in aframe.nodes: <NEW_LINE> <INDENT> for refframe in self.frames: <NEW_LINE> <INDENT> for refnode in refframe.nodes: <NEW_LINE> <INDENT> if np.all(anode.clrtrmshape == refnode.clrtrmshape): <NEW_LINE> <INDENT> anode.ndname = refnode.ndname <NEW_LINE> <DEDENT... | This module comapres the new symbols with existing nodes with the objective of finding nodees
with similar properties by imposing certain "similarity constraints". The colour-neutral trimmed
shape of the symbols is an example of a similarity constraint. Symbols fulfiling similarity
constraints are given a common name | 625941e324f1403a92600f52 |
def addToList(self): <NEW_LINE> <INDENT> self.setRowColor() <NEW_LINE> self.model.appendRow(self.modelItems) <NEW_LINE> self.model.parent().setCurrentIndex( self.modelItems.index() ) | Add this ingredient's list items to the QStandardModel (model) associated with its QTreeView
then highlight it when it's added. | 625941e329b78933be1e5a96 |
def test_password_change_failure(self): <NEW_LINE> <INDENT> data = { 'old_password': 'password', 'new_password1': 'Chah+pher9k', 'new_password2': 'Chah+pher9k', } <NEW_LINE> msg = "Your old password was entered incorrectly. Please enter it again." <NEW_LINE> self.client.login(username='alice', password=passwords[-1]) <... | A ``POST`` to the ``password_change`` view with invalid data properly
fails and issues the according error. | 625941e3796e427e537b09b8 |
def get_parent_var(name, global_ok=False, default=None, skip_frames=0): <NEW_LINE> <INDENT> scope = get_parent_scope_from_var(name, global_ok, skip_frames + 1) <NEW_LINE> if not scope: <NEW_LINE> <INDENT> return default <NEW_LINE> <DEDENT> if name in scope.locals: <NEW_LINE> <INDENT> return scope.locals.get(name, defau... | Directly gets a variable from a parent frame-scope. | 625941e3fb3f5b602dac3a87 |
def hasChildren(self, parent ): <NEW_LINE> <INDENT> if parent.isValid(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (len(self._workspace.sortedDocuments) > 0) | See QAbstractItemModel documentation | 625941e3ff9c53063f47c5e1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.