code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def DeleteLiveSnapshotRule(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("DeleteLiveSnapshotRule", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.DeleteLiveSnaps... | 删除截图规则
:param request: 调用DeleteLiveSnapshotRule所需参数的结构体。
:type request: :class:`tencentcloud.live.v20180801.models.DeleteLiveSnapshotRuleRequest`
:rtype: :class:`tencentcloud.live.v20180801.models.DeleteLiveSnapshotRuleResponse` | 625941c6a8370b77170528ce |
def combineSolids(self,otherCQToCombine=None): <NEW_LINE> <INDENT> toCombine = self.solids().vals() <NEW_LINE> if otherCQToCombine: <NEW_LINE> <INDENT> for obj in otherCQToCombine.solids().vals(): <NEW_LINE> <INDENT> toCombine.append(obj) <NEW_LINE> <DEDENT> <DEDENT> if len(toCombine) < 1: <NEW_LINE> <INDENT> raise Val... | !!!DEPRECATED!!! use union()
Combines all solids on the current stack, and any context object, together
into a single object.
After the operation, the returned solid is also the context solid.
:param otherCQToCombine: another cadquery to combine.
:return: a cQ object with the resulting combined solid on the stack.
M... | 625941c6a8370b77170528cd |
def get_archive_format(self, archive_path): <NEW_LINE> <INDENT> for format_str, extns in list(EXTNS.items()): <NEW_LINE> <INDENT> for extn in extns: <NEW_LINE> <INDENT> if archive_path.endswith(extn): <NEW_LINE> <INDENT> return format_str <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return None | Guess archive format based on filename extension | 625941c6de87d2750b85fdbf |
def _calc_total_throughput(self, o: np.ndarray) -> float: <NEW_LINE> <INDENT> if 'clients' in self.opt: <NEW_LINE> <INDENT> num_ma = len(self.opt['clients']) <NEW_LINE> <DEDENT> elif 'num_ma' in self.opt: <NEW_LINE> <INDENT> num_ma = self.opt['num_ma'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> num_ma = len(self.opt... | Calculate total throughput of an observation
Only the throughput of last tick in the observation are included in the reward.
:param o: observation
:return: total throughput | 625941c6462c4b4f79d1d6fe |
def get_temperature(self): <NEW_LINE> <INDENT> return self.temperature | Get the device temperature in celsius. | 625941c644b2445a339320c4 |
def raise_if_shared_machines(unit_machines): <NEW_LINE> <INDENT> if not unit_machines: <NEW_LINE> <INDENT> raise ValueError('Cannot share 0 machines. Empty list provided.') <NEW_LINE> <DEDENT> if len(unit_machines) != len(set(unit_machines)): <NEW_LINE> <INDENT> raise JujuAssertionError('Appliction units reside on the ... | Raise an exception if `unit_machines` contain double ups of machine ids.
A unique list of machine ids will be equal in length to the set of those
machine ids.
:raises ValueError: if an empty list is passed in.
:raises JujuAssertionError: if any double-ups of machine ids are detected. | 625941c6be8e80087fb20c72 |
def grid(side, n): <NEW_LINE> <INDENT> if n < 2: <NEW_LINE> <INDENT> raise TypeError('n must be >= 2') <NEW_LINE> <DEDENT> coords = [] <NEW_LINE> for yi in range(0,n): <NEW_LINE> <INDENT> y = float(yi) / (n-1) * side - (side/2.0) <NEW_LINE> for xi in range(0,n): <NEW_LINE> <INDENT> x = float(xi) / (n-1) * side - (side/... | Returns a grid with specified side length and number of points,
centred at the origin and with z=0. | 625941c6d6c5a10208144077 |
def get(self, filename): <NEW_LINE> <INDENT> basefilename = os.path.basename(filename) <NEW_LINE> try: <NEW_LINE> <INDENT> return next(clump for clump in self.txlist if clump['file'] == basefilename and not clump['obsolete']) <NEW_LINE> <DEDENT> except StopIteration: <NEW_LINE> <INDENT> return None | Return the tx.json structure for the specified *.run file.
Returns None if this file is not in tx.json. | 625941c60383005118ecf611 |
def lclxtrem(vec, in_width, maxima=False): <NEW_LINE> <INDENT> width = abs(in_width) <NEW_LINE> vecp = np.diff(vec) <NEW_LINE> vecps = np.zeros(vecp.shape, dtype='i') <NEW_LINE> vecps[vecp > 0.] = 1 <NEW_LINE> vecps[vecp < 0.] = -1 <NEW_LINE> vecpps = np.diff(vecps) <NEW_LINE> if maxima: <NEW_LINE> <INDENT> z = np.wher... | Finds peaks in data. Converted from lclxtrem. | 625941c699fddb7c1c9de3bf |
def get_storno_account_id(self, cr, uid, payment_line_id, amount, currency, context=None): <NEW_LINE> <INDENT> line = self.browse(cr, uid, payment_line_id) <NEW_LINE> account_id = False <NEW_LINE> if (line.transit_move_line_id and not line.storno and self.pool.get('res.currency').is_zero( cr, uid, currency, ( (line.tra... | Check the match of the arguments, and return the account associated
with the storno.
Used in account_banking interactive mode
:param payment_line_id: the single payment line id
:param amount: the (signed) amount debited from the bank account
:param currency: the bank account's currency *browse object*
:return: an acco... | 625941c6e64d504609d7486d |
def default_repl_keys(): <NEW_LINE> <INDENT> import tempfile <NEW_LINE> calc_root = tempfile.mkdtemp() <NEW_LINE> jobfn_templ = pj(calc_root, 'foo.job') <NEW_LINE> common.file_write(jobfn_templ, 'dummy job template, go away!') <NEW_LINE> m = Machine(hostname='foo', template=FileTemplate(basename='foo.job', templ_dir=ca... | Return a dict of default keys for replacement in a
:class:`ParameterStudy`. Each key will in practice be processed by
:class:`FileTemplate`, such that e.g. the key 'foo' becomes the placeholder
'XXXFOO'.
Each of these placeholders can be used in any parameter study in any file
template, indenpendent from `params_lst` ... | 625941c63d592f4c4ed1d09e |
def global_get_bundle_version_extensions(self, bundle_id, version, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.global_get_bundle_version_extensions_with_http_info(bundle_id, version, **kwargs) <NEW_LINE> <DEDENT> else: <NEW... | Get bundle version extensions
Gets the metadata about the extensions in the given extension bundle version. NOTE: This endpoint is subject to change as NiFi Registry and its REST API evolve.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` funct... | 625941c6287bf620b61d3a92 |
def is_not_zero(self): <NEW_LINE> <INDENT> if isinstance(self.val, numbers.Number) is False: <NEW_LINE> <INDENT> raise AXOtherError('val is not numeric') <NEW_LINE> <DEDENT> return self.is_not_equal_to(0) | Asserts that val is numeric and not equal to zero. | 625941c6167d2b6e31218bc3 |
def __reverse_last_actions(self): <NEW_LINE> <INDENT> actions = list() <NEW_LINE> for action in self.last_goals_moves: <NEW_LINE> <INDENT> if action[0] == "load": <NEW_LINE> <INDENT> actions.append(("unload", action[1], action[2])) <NEW_LINE> <DEDENT> elif action[0] == "unload": <NEW_LINE> <INDENT> actions.append(("loa... | Return the last actions reversed except for the move actions.
Move actions are not useful on heuristic. | 625941c64e696a04525c9479 |
def add_related_indicator(self, indicator): <NEW_LINE> <INDENT> if not indicator: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif isinstance(indicator, RelatedIndicator): <NEW_LINE> <INDENT> self.related_indicators.append(indicator) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.related_indicators.append(Relate... | Adds an Related Indicator to the ``related_indicators`` list
property of this :class:`Indicator`.
The `indicator` parameter must be an instance of
:class:`stix.common.related.RelatedIndicator` or
:class:`Indicator`.
If the `indicator` parameter is ``None``, no item wil be added to the
``related_indicators`` list prop... | 625941c6566aa707497f4598 |
def test_merge_not_fail_draftpath_intersection(self): <NEW_LINE> <INDENT> path_a = PathFactory.create(name="A", geom=LineString((0, 0), (10, 0))) <NEW_LINE> path_b = PathFactory.create(name="B", geom=LineString((10, 0), (20, 0))) <NEW_LINE> PathFactory.create(name="C", geom=LineString((10, 0), (10, 10)), draft=True) <N... | Merge should not fail
.
C (draft)
.
|--------A--------|-----------B-----------| | 625941c67b180e01f3dc482e |
def close(self, code=1000, reason=''): <NEW_LINE> <INDENT> return CloseControlMessage(code=code, reason=reason) | Returns a close control message built from
a :class:`miniws4py.messaging.CloseControlMessage` instance,
using the given status ``code`` and ``reason`` message. | 625941c61f5feb6acb0c4b80 |
def testValueP(self): <NEW_LINE> <INDENT> for i in range(100): <NEW_LINE> <INDENT> no = uniform(0.1, 100) <NEW_LINE> self.sigma.set_scale(no) <NEW_LINE> self.assertAlmostEqual(self.J.get_probability(), 1.0 / no, delta=0.001) | Test if JeffreysRestraint probability is 1/scale | 625941c6ff9c53063f47c222 |
def revert(self, history, *args, **kwargs): <NEW_LINE> <INDENT> pass | Reverts this retry.
On revert call all results that had been provided by previous tries
and all errors caused during reversion are provided. This method
will be called *only* if a subflow must be reverted without the
retry (that is to say that the controller has ran out of resolution
options and has either given up re... | 625941c6009cb60464c633e0 |
def patch_dashboard(self, owner, dashboard_uuid, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.patch_dashboard_with_http_info(owner, dashboard_uuid, body, **kwargs) | Patch dashboard # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_dashboard(owner, dashboard_uuid, body, async_req=True)
>>> result = thread.get()
:param owner: Owner of the namespace (required)
:type owner: ... | 625941c6b830903b967e993a |
def variational_sgpr_sample(n_sample, qf_mean, qf_cov, mfvi_mixture=False, mixture_par_list=None, **kwargs): <NEW_LINE> <INDENT> q_f = tfd.MultivariateNormalFullCovariance(loc=qf_mean, covariance_matrix=qf_cov, ) <NEW_LINE> q_f_sample = q_f.sample(n_sample) <NEW_LINE> if mfvi_mixture: <NEW_LINE> <INDENT> (mixture_logit... | Generates f samples from GPR mean-field variational family.
Args:
n_sample: (int) number of samples to draw
qf_mean: (tf.Tensor of float32) mean parameters for
variational family
qf_cov: (tf.Tensor of float32) covariance for parameters for
variational family
mfvi_mixture: (bool) Whether... | 625941c6cc40096d6159597e |
def dataWriterStatus(self): <NEW_LINE> <INDENT> status = self.dataStatusPv.get() <NEW_LINE> if status: <NEW_LINE> <INDENT> printMsg('DataWriter status is: ON') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> printMsg('DataWriter status is: OFF') <NEW_LINE> <DEDENT> return status | Return status of dataWriter. | 625941c6d53ae8145f87a2a0 |
def intify_etc(sals): <NEW_LINE> <INDENT> regex = '[0-9]*? ?[0-9]{3}' <NEW_LINE> for i in range(len(sals)): <NEW_LINE> <INDENT> if type(sals[i]) != float: <NEW_LINE> <INDENT> if 'par an' in sals[i]: <NEW_LINE> <INDENT> if '-' in sals[i]: <NEW_LINE> <INDENT> frm = re.findall(regex,sals[i])[0] <NEW_LINE> to = re.findall(... | sals : liste de salaires en forme de string
cette fonction convertie toutes les phrases en int's:
remplace les salaires avec une moyenne si c'est une fourchette
et avec une moyenne transformé en annuel s'il sagit d'une salaire par mois
retourne une liste nettoyée, prête à être ajoutée au dataframe :)) | 625941c6a05bb46b383ec850 |
def test_transpose(self): <NEW_LINE> <INDENT> mat1 = np.eye(2) <NEW_LINE> mat2 = np.eye(3) <NEW_LINE> op = atmos_flux_inversion.linalg.SchmidtKroneckerProduct( mat1, mat2 ) <NEW_LINE> op_transpose = op.T <NEW_LINE> np_tst.assert_allclose( op_transpose.dot(np.eye(6)), np.eye(6)) | Test that SchmidtKroneckerProduct can be transposed. | 625941c6dd821e528d63b1d8 |
def make_symlink_if_not_exists(real_path, link_path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(real_path) <NEW_LINE> <DEDENT> except OSError as e: <NEW_LINE> <INDENT> if e.errno != errno.EEXIST: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> <DEDENT> cmd = 'ln -s {0} {1}'.format(real_path, link_path) <NE... | param real_path: str the path linked
param link_path: str the path with only the symbol | 625941c60a366e3fb873e847 |
def clean( self, units=config.DEFAULTcurrency ): <NEW_LINE> <INDENT> currencies = self.dough.keys() <NEW_LINE> if len(currencies) > 1: <NEW_LINE> <INDENT> for currency in currencies: <NEW_LINE> <INDENT> if self.dough[currency] == 0: <NEW_LINE> <INDENT> del self.dough[currency] <NEW_LINE> <DEDENT> <DEDENT> if len( self.... | cut out any entries that are zero, unless they all are; then keep 0 in the units currency. | 625941c6d486a94d0b98e173 |
def check_block_size(steps, block_size, prune=False): <NEW_LINE> <INDENT> if block_size == 1: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> steps_local = copy.copy(steps) <NEW_LINE> block = steps_local[0: block_size] <NEW_LINE> ibl, jbl = 0, 0 <NEW_LINE> prune_me = [] <NEW_LINE> for i, step in enumerate(steps_loc... | Perform some consistency checks on periodicity of non linear sampling.
`block_size` is the number of frames composing a periodic block.
If `prune` is True, the steps that do not match the first periodic
block will be removed.
Return a new list of steps that match the periodicity.
Example:
-------
steps = [0, 1, 2, 4... | 625941c616aa5153ce3624a6 |
@SkipUnless(shelf2_enabled) <NEW_LINE> def shelve_replace_dir(sbox): <NEW_LINE> <INDENT> sbox.build() <NEW_LINE> sbox.simple_propset('p', 'v', 'A/C') <NEW_LINE> sbox.simple_commit() <NEW_LINE> def modifier(sbox): <NEW_LINE> <INDENT> sbox.simple_rm('A/C', 'A/D/G') <NEW_LINE> sbox.simple_mkdir('A/C', 'A/C/D2') <NEW_LINE>... | shelve replace dir | 625941c638b623060ff0ae1c |
def gf_multiply(self, b): <NEW_LINE> <INDENT> a = self.deep_copy() <NEW_LINE> b_copy = b.deep_copy() <NEW_LINE> a_highest_power = a.length() - a.next_set_bit(0) - 1 <NEW_LINE> b_highest_power = b.length() - b_copy.next_set_bit(0) - 1 <NEW_LINE> result = BitVector(size=a.length() + b_copy.length()) <NEW_LINE> a.pad_from... | If you want to multiply two bit patterns in GF(2):
a = BitVector(bitstring='0110001')
b = BitVector(bitstring='0110')
c = a.gf_multiply(b)
print(c) # 00010100110
As you would expect, in general, the bitvector returned by this
method is longer than the two operand bitv... | 625941c692d797404e3041b7 |
def n(self): <NEW_LINE> <INDENT> return self._n | Return the integer that is being factored. | 625941c6d6c5a10208144078 |
def Index(self,name='',dictionary = {}): <NEW_LINE> <INDENT> id = self.getId() <NEW_LINE> if id: <NEW_LINE> <INDENT> dictionary.update({id:self}) <NEW_LINE> <DEDENT> for element in self.children: <NEW_LINE> <INDENT> element.Index(name,dictionary) <NEW_LINE> <DEDENT> return dictionary | Builds a dictionary over self and all child elements | 625941c6a05bb46b383ec851 |
def Rx(ra): <NEW_LINE> <INDENT> R = zeros( (3,3) ) <NEW_LINE> R[1,1] = math.cos(ra) <NEW_LINE> R[1,2] =-math.sin(ra) <NEW_LINE> R[2,1] = math.sin(ra) <NEW_LINE> R[2,2] = math.cos(ra) <NEW_LINE> R[0,0] = 1. <NEW_LINE> return R | Rotation matrix around x axis. | 625941c6925a0f43d2549ea4 |
def _clip_raster(self, no_data_val): <NEW_LINE> <INDENT> root_dir = get_directory(self.src, self.dir_startswith) <NEW_LINE> try: <NEW_LINE> <INDENT> if self.clip_poly and self.clip_poly.endswith('.shp') and arcpy.Exists(self.clip_poly): <NEW_LINE> <INDENT> for source_dir, file_path, file_name in get_file_location(root_... | Clip raster to area of interest | 625941c6a934411ee37516c1 |
def nextGreaterElement(self, nums1, nums2): <NEW_LINE> <INDENT> stack = [] <NEW_LINE> hash_map = {} <NEW_LINE> for i in range(len(nums2)): <NEW_LINE> <INDENT> while len(stack) and stack[-1] < nums2[i]: <NEW_LINE> <INDENT> hash_map[stack.pop()] = nums2[i] <NEW_LINE> <DEDENT> stack.append(nums2[i]) <NEW_LINE> <DEDENT> an... | :type nums1: List[int]
:type nums2: List[int]
:rtype: List[int] | 625941c623849d37ff7b30be |
def form_wrapper(self): <NEW_LINE> <INDENT> form = Form(self.request, self.__schema__, self.request.context) <NEW_LINE> if self.request.method == 'GET': <NEW_LINE> <INDENT> return { 'form_view': self.form_view(form), 'form_url': self.form_url, 'macros': self.form_macros if self.use_form_macros else '', } <NEW_LINE> <DE... | Handles form create/update methods | 625941c6e1aae11d1e749ce4 |
def is_observer(self): <NEW_LINE> <INDENT> return self.playerinfo.is_observer() | Return whether the player is an observer.
:rtype: bool | 625941c61b99ca400220aadf |
def __init__(self, name, builders): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.builders = builders | Contructor. | 625941c67cff6e4e811179b4 |
def par_deriv_input_setter(self, inds, imeta, mode): <NEW_LINE> <INDENT> all_rel_systems = set() <NEW_LINE> vec_names = set() <NEW_LINE> dist = self.comm.size > 1 <NEW_LINE> for i in inds: <NEW_LINE> <INDENT> if not dist or self.in_loc_idxs[mode][i] >= 0: <NEW_LINE> <INDENT> rel_systems, vnames, _ = self.single_input_s... | Set -1's into the input vector in the parallel derivative case.
Parameters
----------
inds : tuple of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Returns
-------
set
Set of relevant system names.
list of str or N... | 625941c6cb5e8a47e48b7ada |
def _allt(self, shift): <NEW_LINE> <INDENT> for hdr in ['b', 'o', 'a', 'f'] + ['t'+str(i) for i in range(10)]: <NEW_LINE> <INDENT> val = getattr(self, hdr) <NEW_LINE> if val is not None: <NEW_LINE> <INDENT> setattr(self, hdr, val + shift) | Shift all relative time headers by some value (addition).
Similar to SAC's "chnhdr allt".
Note
----
This method is triggered by setting an instance's iztype or changing
its reference time, which is the most likely use case for this
functionality. If what you're trying to do is set an origin time and
make a file orig... | 625941c6b5575c28eb68e02d |
def end_trial(self): <NEW_LINE> <INDENT> self.parent()._rt = int(self.time_elapsed) <NEW_LINE> self.parent().set_central_widget_to_record() | Temporarily store response time and end the trial. | 625941c64f6381625f114a69 |
def single_byte_xor(byte_array, key_byte): <NEW_LINE> <INDENT> result = bytearray() <NEW_LINE> for i in range(0, len(byte_array)): <NEW_LINE> <INDENT> result.append(byte_array[i] ^ key_byte) <NEW_LINE> <DEDENT> return result | XOR every byte in 'byte_array' with the 'key_byte' | 625941c64428ac0f6e5ba820 |
def test_update_series(update_series_echo_server): <NEW_LINE> <INDENT> client = replace(CLIENT, port=update_series_echo_server.server_port) <NEW_LINE> series = models.Series( tvdbId=110381, title="Archer (2009)", cleanTitle="archer2009", monitored=True, seasonFolder=True, titleSlug="archer-2009", profileId=1, seasons=(... | Test API call for SonarrClient.update_series()
| 625941c68da39b475bd64fa0 |
def getChartScrollBar(self): <NEW_LINE> <INDENT> return self._csb | チャート部用のスクロールバーを取得する | 625941c67d43ff24873a2cce |
@extract.add('gridded_sources') <NEW_LINE> def extract_gridded_sources(dstore, what): <NEW_LINE> <INDENT> qdict = parse(what) <NEW_LINE> task_no = int(qdict.get('task_no', ['0'])[0]) <NEW_LINE> dic = {} <NEW_LINE> for i, lonlats in enumerate(dstore['ps_grid/%02d' % task_no][()]): <NEW_LINE> <INDENT> dic[i] = numpy.roun... | Extract information about the gridded sources (requires ps_grid_spacing)
Use it as /extract/gridded_sources?task_no=0.
Returns a json string id -> lonlats | 625941c6baa26c4b54cb114f |
@csrf_exempt <NEW_LINE> def update_cart(request): <NEW_LINE> <INDENT> if request.method == "POST": <NEW_LINE> <INDENT> cart = get_session_cart(request.session) <NEW_LINE> try: <NEW_LINE> <INDENT> items_to_update = [(Item.objects.get(id__exact=item[0]), int(item[1])) for item in request.POST.items() if it... | Updates the cart associated with the session based on items in the POST
object. | 625941c6377c676e912721d7 |
def test_with_settings(self): <NEW_LINE> <INDENT> config = ConfigBuilder(None, None) <NEW_LINE> self.assertEqual(config._config, {}) <NEW_LINE> self.assertFalse(config._wait_for_completion) <NEW_LINE> result = config.with_settings({'test': 'OK!'}) <NEW_LINE> self.assertEqual(config._config, {'settings': {'test': 'OK!'}... | Test the `with_settings` method. | 625941c63eb6a72ae02ec508 |
def plot_all_hess(self, plotdir, **plot_args): <NEW_LINE> <INDENT> if not os.path.exists(plotdir): <NEW_LINE> <INDENT> os.makedirs(plotdir) <NEW_LINE> <DEDENT> group_names = self.lockfile.active_groups <NEW_LINE> for name in group_names: <NEW_LINE> <INDENT> for cmd in self._cmds: <NEW_LINE> <INDENT> synth_path = os.pat... | Plot Hess (binned CMD) diagrams of all synthetic CMD planes.
Parameters
----------
plotdir : str
Directory where plots will be saved.
format : str
Format of the plot (typically ``png``, ``pdf`` or ``eps).
dpi : int
Resolution of the output.
figsize : tuple
Size of matplotlib axes. | 625941c63617ad0b5ed67f26 |
def run(self, config): <NEW_LINE> <INDENT> pass | The YamlToMux varianter plugin handles these | 625941c67b25080760e39488 |
def forward(self, src, lengths=None): <NEW_LINE> <INDENT> self._check_args(src, lengths) <NEW_LINE> emb = self.embeddings(src) <NEW_LINE> _, batch, emb_dim = emb.size() <NEW_LINE> mean = emb.mean(0).expand(self.num_layers, batch, emb_dim) <NEW_LINE> memory_bank = emb <NEW_LINE> encoder_final = (mean, mean) <NEW_LINE> r... | See :obj:`EncoderBase.forward()` | 625941c6851cf427c661a53e |
def test_nested_flow(self, mock_class): <NEW_LINE> <INDENT> flow_config = FlowConfig({ 'description': 'Run a task and a flow', 'steps': { 1: {'task': 'pass_name'}, 2: {'flow': 'nested_flow'}, }, }) <NEW_LINE> flow = BaseFlow(self.project_config, flow_config, self.org_config) <NEW_LINE> flow() <NEW_LINE> self.assertEqua... | Flows can run inside other flows | 625941c6796e427e537b05f3 |
def remove_clusters(A, cluster_indeces): <NEW_LINE> <INDENT> return np.delete(A, cluster_indeces, axis=1) | Removes the clusters (i.e. columns given by the indices) from a matrix A. | 625941c6a8ecb033257d30fc |
def set_flush(self, val): <NEW_LINE> <INDENT> self.flushing.value = val | Set flushing to file on or off
Parameters
----------
val : bool
set flushing on (True) or off (False) | 625941c65fdd1c0f98dc0261 |
def test_extra_change_view_via_decorator(self): <NEW_LINE> <INDENT> obj = Foo.objects.create(bar='test') <NEW_LINE> self._register_model_in_admin(Foo) <NEW_LINE> @register_extra_view(Foo) <NEW_LINE> class TestView(RalphDetailView, View): <NEW_LINE> <INDENT> label = 'Test view' <NEW_LINE> url_name = 'extra_detail_view' ... | Register extra view by decorator. | 625941c6956e5f7376d70e9c |
def conv1d( img, conv_weights, padding = "same" ): <NEW_LINE> <INDENT> filter_out = [] <NEW_LINE> for fno in range( conv_weights.shape[-1] ): <NEW_LINE> <INDENT> ch_sum = 0 <NEW_LINE> for chno in range( conv_weights.shape[-2] ): <NEW_LINE> <INDENT> conv_window = np.flip( conv_weights[:,chno,fno], 0 ) <NEW_LINE> ch_sum ... | img => img to convolve
conv_weights => the weights for the convolution
padding => "same" or "valid" | 625941c6cad5886f8bd27008 |
def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, total_loss, classification_loss, input_image, correct_label, keep_prob, learning_rate): <NEW_LINE> <INDENT> total_loss_plot = [] <NEW_LINE> classification_loss_plot = [] <NEW_LINE> samples_plot = [] <NEW_LINE> sample = 0 <NEW_LINE> for epoch in tqdm(range... | Train neural network and print out the loss during training.
:param sess: TF Session
:param epochs: Number of epochs
:param batch_size: Batch size
:param get_batches_fn: Function to get batches of training data. Call using get_batches_fn(batch_size)
:param train_op: TF Operation to train the neural network
:param tota... | 625941c6ab23a570cc2501b0 |
def coproduct(self, S): <NEW_LINE> <INDENT> return sum([c * self.coproduct_on_basis(i) for i,c in S.monomial_coefficients().items()]) | Return the coproduct of the series ``S``.
EXAMPLES::
sage: F = ShuffleAlgebra(QQ,'ab')
sage: S = F.an_element(); S
B[word: ] + 2*B[word: a] + 3*B[word: b] + B[word: bab]
sage: F.coproduct(S)
B[word: ] # B[word: ] + 2*B[word: ] # B[word: a]
+ 3*B[word: ] # B[word: b] + B[word: ] # B[word: bab]
... | 625941c6aad79263cf390a6e |
def get_sa_value(self, state, action): <NEW_LINE> <INDENT> if state in self.V.keys(): <NEW_LINE> <INDENT> if action in self.V[state].keys(): <NEW_LINE> <INDENT> return self.V[state][action] <NEW_LINE> <DEDENT> <DEDENT> return 0 | Look up state-action value.
If never seen state-action combo, then assume neutral (value = 0). | 625941c644b2445a339320c5 |
def random_init(popul_size, size, mu=None, sigma=None): <NEW_LINE> <INDENT> if mu is None: <NEW_LINE> <INDENT> mu = 0.5 * np.ones(size) <NEW_LINE> <DEDENT> if sigma is None: <NEW_LINE> <INDENT> sigma = np.identity(size) <NEW_LINE> <DEDENT> population = [] <NEW_LINE> for i in range(popul_size): <NEW_LINE> <INDENT> elem ... | generate the population with random gaussian distribution centerd on 0.5 | 625941c6d18da76e23532504 |
def request_token(self, email, REQUEST=None): <NEW_LINE> <INDENT> auth_tool = self.getSite().getAuthenticationTool() <NEW_LINE> users = list(auth_tool.lookup_user_by_email(email)) <NEW_LINE> if not users: <NEW_LINE> <INDENT> err = i18n_exception(ValueError, 'E-mail address not found: "${email}"', email=email) <NEW_LINE... | User submits an email address. If address found, an email is sent with
a password reset token. | 625941c6de87d2750b85fdc0 |
def all(self, query=None): <NEW_LINE> <INDENT> return self.proxy.all(query) | Gets all resources related to the current entry. | 625941c6d99f1b3c44c675bf |
def process(self): <NEW_LINE> <INDENT> if self.targetPath.is_dir(): <NEW_LINE> <INDENT> for eachFile in self.targetPath.iterdir(): <NEW_LINE> <INDENT> if eachFile.suffix == '.jack': <NEW_LINE> <INDENT> self.__processFile__(eachFile) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> raise RuntimeError("Err... | iterates over a directory causing each .jack file to be processed.
returns the pathname of the directory upon successful completion. | 625941c6cdde0d52a9e53061 |
def _generate_template(self, url): <NEW_LINE> <INDENT> fn = url.split("/")[-1] <NEW_LINE> str_to_replaced = re.findall(r"\d+", fn) <NEW_LINE> self.num_vars = len(str_to_replaced) <NEW_LINE> self.n_digits = [len(s) for s in str_to_replaced] <NEW_LINE> rep = {} <NEW_LINE> for index, item in enumerate(str_to_replaced): <N... | Generate the template string from url. | 625941c64c3428357757c357 |
def update_normalisation(self, event=None): <NEW_LINE> <INDENT> fmt = self.normalisation_format.get() <NEW_LINE> self.config.beamline_config['normalisation_format'] = fmt <NEW_LINE> try: <NEW_LINE> <INDENT> norm_value = self.config.normalise_value(1.0, self.nexus) <NEW_LINE> <DEDENT> except NameError: <NEW_LINE> <INDEN... | Test normalisation | 625941c6046cf37aa974cd78 |
def read_file(self, path): <NEW_LINE> <INDENT> if isinstance(path, str): <NEW_LINE> <INDENT> path = Path(path) <NEW_LINE> <DEDENT> with chdir(self.path): <NEW_LINE> <INDENT> with path.open('r') as stream: <NEW_LINE> <INDENT> return stream.read() | IMPORTANT: it's danger method. It's allow you to read any file,
even not in repository. Don't allow external calls for it. | 625941c6adb09d7d5db6c7bf |
@cli.group() <NEW_LINE> def markdown(): <NEW_LINE> <INDENT> pass | Markdown file manipulation | 625941c6d7e4931a7ee9df4c |
def test_notify_contributor(self): <NEW_LINE> <INDENT> video = VideoUrlFactory().video <NEW_LINE> self.video_pg.open_video_page(video.video_id) <NEW_LINE> self.video_pg.log_in(self.user.username, 'password') <NEW_LINE> rev1 = os.path.join(self.subs_path, 'rev1.dfxp') <NEW_LINE> self.video_pg.open_video_page(video.video... | Subtitle contributor gets an email when new revision added.
| 625941c685dfad0860c3ae89 |
def get_speakers_ip(self, refresh=False): <NEW_LINE> <INDENT> if self.speakers_ip and not refresh: <NEW_LINE> <INDENT> return self.speakers_ip <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> response = requests.get('http://' + self.speaker_ip + ':1400/status/topology') <NEW_LINE> text = response.text <NEW_LINE> grp = re.... | Get the IP addresses of all the Sonos speakers in the network.
Code contributed by Thomas Bartvig (thomas.bartvig@gmail.com)
Arguments:
refresh -- Refresh the speakers IP cache.
Returns:
IP addresses of the Sonos speakers. | 625941c6d164cc6175782d7c |
def is_available(self, quantity=1, request=None): <NEW_LINE> <INDENT> if request: <NEW_LINE> <INDENT> cart = Cart.objects.get_or_create_from_request(request) <NEW_LINE> cart_item = self.is_in_cart(cart) <NEW_LINE> quantity += cart_item.quantity if cart_item else 0 <NEW_LINE> <DEDENT> now = timezone.now().replace(tzinfo... | Returns if product is available for the given quantity. If request
is passed in, count items already in cart. | 625941c65fdd1c0f98dc0262 |
@subscriber.route( "/account/subscriptions/update-choices/<subscription_id>", methods=["GET", "POST"] ) <NEW_LINE> @subscriber_login_required <NEW_LINE> def update_subscription_choices(subscription_id): <NEW_LINE> <INDENT> subscription = Subscription.query.get(subscription_id) <NEW_LINE> plan = subscription.plan <NEW_L... | Subscriber can update their subscription choices | 625941c645492302aab5e2f1 |
def epsilonFactor(): <NEW_LINE> <INDENT> return _CsoundAC.Conversions_epsilonFactor() | epsilonFactor() -> double & | 625941c699cbb53fe6792c16 |
def rotate_pixel_coords_p_to_q(p, q, x_size = 1000): <NEW_LINE> <INDENT> p = sphere_from_pixel_coords(p, x_size = x_size) <NEW_LINE> q = sphere_from_pixel_coords(q, x_size = x_size) <NEW_LINE> return rotate_sphere_points_p_to_q(p,q) | p and q are pixel coordinate points, return SL(2,C) matrix rotating image of p to image of q on CP^1 | 625941c660cbc95b062c6572 |
def reverseList(self, head): <NEW_LINE> <INDENT> def helper(head): <NEW_LINE> <INDENT> if head.next is None: <NEW_LINE> <INDENT> return (head, head) <NEW_LINE> <DEDENT> newH, newT = helper(head.next) <NEW_LINE> head.next = None <NEW_LINE> newT.next = head <NEW_LINE> return (newH, head) <NEW_LINE> <DEDENT> if head is No... | :type head: ListNode
:rtype: ListNode | 625941c6e1aae11d1e749ce5 |
def _check_backup_source_state(self): <NEW_LINE> <INDENT> state = self.backup_source.state <NEW_LINE> if state not in self.backup_source.States.STABLE_STATES: <NEW_LINE> <INDENT> logger.warning('Cannot execute backup schedule for %s in state %s.' % (self.backup_source, state)) <NEW_LINE> return False <NEW_LINE> <DEDENT... | Backup source should be stable state. | 625941c6be7bc26dc91cd631 |
@pytest.mark.parametrize('dimension', list(range(2, 100))) <NEW_LINE> def test_diag_liou_mult(dimension): <NEW_LINE> <INDENT> H = qutip.rand_dm(dimension, 0.5) <NEW_LINE> evals, evecs = H.eigenstates() <NEW_LINE> L = qutip.liouvillian(H.transform(evecs)) <NEW_LINE> coefficients = np.ones((dimension*dimension,), dtype=n... | BR Tools : Diagonal Liouvillian mult | 625941c676e4537e8c3516a0 |
def transform(self, raw_documents): <NEW_LINE> <INDENT> for tokens in self._tokenizer(raw_documents): <NEW_LINE> <INDENT> word_ids = np.ones(self.max_document_length, np.int64) <NEW_LINE> len_tokens = len(tokens) <NEW_LINE> start_index = int((self.max_document_length - len_tokens + 1)/2) <NEW_LINE> temp = [] <NEW_LINE>... | Transform documents to word-id matrix.
Convert words to ids with vocabulary fitted with fit or the one
provided in the constructor.
Args:
raw_documents: An iterable which yield either str or unicode.
Yields:
x: iterable, [n_samples, max_document_length]. Word-id matrix. | 625941c62eb69b55b151c8dd |
def push_empty_patch(self, name): <NEW_LINE> <INDENT> unapplied = self.get_unapplied() <NEW_LINE> assert(name in unapplied) <NEW_LINE> head = git.get_head() <NEW_LINE> append_string(self.__applied_file, name) <NEW_LINE> unapplied.remove(name) <NEW_LINE> write_strings(self.__unapplied_file, unapplied) <NEW_LINE> self.re... | Pushes an empty patch on the stack
| 625941c62c8b7c6e89b357f0 |
def metric_fn(masked_lm_example_loss, masked_lm_log_probs, masked_lm_ids, masked_lm_weights, next_sentence_example_loss, next_sentence_log_probs, next_sentence_labels): <NEW_LINE> <INDENT> masked_lm_log_probs = tf.reshape(masked_lm_log_probs, [-1, masked_lm_log_probs.shape[-1]]) <NEW_LINE> masked_lm_predictions = tf.ar... | Computes the loss and accuracy of the model. | 625941c68c0ade5d55d3e9e9 |
def _get_state(pkg): <NEW_LINE> <INDENT> cmd = ['opkg', 'status'] <NEW_LINE> cmd.append(pkg) <NEW_LINE> out = __salt__['cmd.run'](cmd) <NEW_LINE> state_flag = '' <NEW_LINE> for line in out.splitlines(): <NEW_LINE> <INDENT> if line.startswith('Status'): <NEW_LINE> <INDENT> _status, _state_want, state_flag, _state_status... | View package state from the opkg database
Return the state of pkg | 625941c6e8904600ed9f1f5a |
def get(self, default=None): <NEW_LINE> <INDENT> return list(self) or default | Return a list containing all element data.
See SimpleElement.get(). | 625941c65fcc89381b1e16ed |
def diskstats(): <NEW_LINE> <INDENT> stats = open('/proc/diskstats', 'r').read().split('\n') <NEW_LINE> ret = {} <NEW_LINE> for line in stats: <NEW_LINE> <INDENT> if not line.count(' '): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> comps = line.split() <NEW_LINE> ret[comps[2]] = { 'major': _number... | Return the disk stats for this minion
CLI Example:
salt '*' status.diskstats | 625941c64d74a7450ccd41f3 |
def addLociFrom(self, pop: 'Population', byName: 'bool'=False) -> "void": <NEW_LINE> <INDENT> return _simuPOP_op.Population_addLociFrom(self, pop, byName) | Usage:
x.addLociFrom(pop, byName=False)
Details:
Add loci from population pop. By default, chromosomes are merged
by index and names of merged chromosomes of population pop will be
ignored (merge of two chromosomes with different names will yield
a warning). If byName is set to True, chromosomes ... | 625941c623e79379d52ee594 |
def transform_xdmf_xml(root): <NEW_LINE> <INDENT> for grid_node in root.getElementsByTagName("Grid"): <NEW_LINE> <INDENT> if grid_node.getAttribute("GridType") == "Uniform": <NEW_LINE> <INDENT> if grid_node.getAttribute("Name").startswith("Grid_"): <NEW_LINE> <INDENT> merge_grid_attributes(grid_node) <NEW_LINE> <DEDENT... | Transform XDMF XML tree starting at node root
Parameters:
----------------
root: Element
XML root element | 625941c61f037a2d8b94622d |
def setup(self): <NEW_LINE> <INDENT> self.pymol_handle.delete('all') <NEW_LINE> self.pymol_handle.load(self.protein_path.as_posix()) <NEW_LINE> self.pymol_handle.show_as('cartoon') <NEW_LINE> self.pymol_handle.color('green') <NEW_LINE> selection_string = ['(chain %s and resi %d)' % (chain, id_) for chain,id_ in self.si... | Setup a new pymol scene. First, delete any previous setup.
Load the protein in pymol in cartoon style,
and highlight the active site. | 625941c676e4537e8c3516a1 |
def test_6rd_ip4_to_ip6_sec_check(self): <NEW_LINE> <INDENT> rv = self.vapi.ipip_6rd_add_tunnel(0, 0, inet_pton(AF_INET6, '2002::'), inet_pton(AF_INET, '0.0.0.0'), self.pg0.local_ip4n, 16, 0, True) <NEW_LINE> self.tunnel_index = rv.sw_if_index <NEW_LINE> self.vapi.cli("show ip6 fib") <NEW_LINE> p_ip6 = (IPv6(src="2002:... | ip4 -> ip6 (decap) security check 6rd test | 625941c621a7993f00bc7d1d |
def deleteAtIndex(self, index: int) -> None: <NEW_LINE> <INDENT> if index >= self.length: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if index == 0: <NEW_LINE> <INDENT> self.head = self.head.next <NEW_LINE> self.length-=1 <NEW_LINE> return <NEW_LINE> <DEDENT> prev = ListNode(None) <NEW_LINE> prev.next = self.head <N... | Delete the index-th node in the linked list, if the index is valid. | 625941c6de87d2750b85fdc1 |
def environ_path_variable_exists(variable_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return os.path.exists(os.environ[variable_name]) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return False | Determines if the os.environ variable exists and is a valid path.
:rtype: bool | 625941c6a8370b77170528d0 |
def read_parsivel(filename): <NEW_LINE> <INDENT> reader = ParsivelReader(filename) <NEW_LINE> dsd = DropSizeDistribution(reader) <NEW_LINE> return dsd | Takes a filename pointing to a parsivel raw file and returns
a drop size distribution object.
Usage:
dsd = read_parsivel(filename)
Returns:
DropSizeDistrometer object | 625941c6a8370b77170528cf |
@__decorate_docstring <NEW_LINE> def concatenated_software_path_fragment( software_name, vendor_name = None, version = None, error_on_none = False ): <NEW_LINE> <INDENT> path_fragment = None <NEW_LINE> error_reason_format = _TD_( "Empty software-specific path fragment." ) <NEW_LINE> fsl = which_fs_layout( ) <NEW_... | Returns a concatenation of the name of a software product with an
optional name of the software product's vendor and an optional version
string for the software product as a filesystem path fragment typical
for the operating system architecture. | 625941c6be8e80087fb20c74 |
def runSelinuxFileTest(self, test_object): <NEW_LINE> <INDENT> logging.info("Testing existence of %s" % (test_object.get_path())) <NEW_LINE> asserts.assertTrue( file_utils.Exists(test_object.get_path(), self.shell), "%s: File does not exist." % test_object.get_path()) <NEW_LINE> logging.info("Testing permissions of %s"... | Reads the file and checks that its content and permissions are valid.
Args:
test_object: inherits KernelSelinuxFileTestBase, contains the test functions | 625941c6e64d504609d7486f |
def primesfrom2to(n): <NEW_LINE> <INDENT> sieve = np.ones(n/3 + (n%6==2), dtype=np.bool) <NEW_LINE> if n%2 == 0: <NEW_LINE> <INDENT> return "x2" <NEW_LINE> <DEDENT> for i in range(1,int((n**0.5)/3+1)): <NEW_LINE> <INDENT> if sieve[i]: <NEW_LINE> <INDENT> k=3*i+1|1 <NEW_LINE> sieve[ k*k/3 ::2*k] = False <NEW_L... | Input n>=6, Returns a array of primes, 2 <= p < n | 625941c6460517430c3941b7 |
def navigate_calc(self, target, game_map, speed, avoid_obstacles=True, max_corrections=90, angular_step=1, ignore_ships=False, ignore_planets=False): <NEW_LINE> <INDENT> if max_corrections <= 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> distance = self.dist_to(target) <NEW_LINE> angle = self.angle_to(target) ... | Move a ship to a specific target position (Entity). It is recommended to place the position
itself here, else navigate will crash into the target. If avoid_obstacles is set to True (default)
will avoid obstacles on the way, with up to max_corrections corrections. Note that each correction accounts
for angular_step degr... | 625941c607f4c71912b114b1 |
def do_GET(self): <NEW_LINE> <INDENT> if not self.is_rpc_path_valid(): <NEW_LINE> <INDENT> self.report_404() <NEW_LINE> return <NEW_LINE> <DEDENT> response = self.server.generate_html_documentation().encode('utf-8') <NEW_LINE> self.send_response(200) <NEW_LINE> self.send_header("Content-type", "text/html") <NEW_LINE> s... | Handles the HTTP GET request.
Interpret all HTTP GET requests as requests for server
documentation. | 625941c66fece00bbac2d76d |
def run_shell_command(command): <NEW_LINE> <INDENT> process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) <NEW_LINE> p_out, p_err = process.communicate() <NEW_LINE> return p_out, p_err, process.returncode | Run shell command
:param command: the command that will be executed
:return: process return code | 625941c626068e7796caed0c |
def group_elements(drawing, anchors=None): <NEW_LINE> <INDENT> new_elm = {'paths': [], 'shapes': [], 'labels': [], 'anchors': {}} <NEW_LINE> for elm in drawing._elm_list: <NEW_LINE> <INDENT> new_elm['paths'].extend(elm.paths) <NEW_LINE> for s in elm.shapes: <NEW_LINE> <INDENT> s = s.copy() <NEW_LINE> if s['shape'] == '... | Combine all elements in a drawing into a single element that can be added to
another drawing. Returns an element definition.
drawing: The drawing object. All elements in the drawing will be combined.
anchors: New anchor dictionary to use for the new element. | 625941c61f5feb6acb0c4b82 |
def get_user_id(): <NEW_LINE> <INDENT> response = requests.get( "https://api.spotify.com/v1/me", headers={"Authorization": "Bearer " + flask.session.get("access_token")}, ) <NEW_LINE> assert response.status_code == requests.codes.ok <NEW_LINE> return response.json()["id"] | Return the user's Spotify ID.
Returns (string):
The user's Spotify ID (*not their URI).
Raises:
AssertionError: The HTTP request to lookup the user failed. | 625941c63317a56b86939c8b |
def __init__(self, path, transform=None): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.imgs_ids = [i[:i.find('_')] for i in os.listdir(self.path)][::4] <NEW_LINE> self.channels = ['_red.png', '_green.png', '_blue.png', '_yellow.png'] <NEW_LINE> self.transform = transform | Args:
path(str): root path from which read in images
transform(object, optional): tranforms applied on input | 625941c626068e7796caed0d |
def incsearch(func, xmin, xmax, ns=50): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> x = np.linspace(xmin, xmax, ns) <NEW_LINE> f = func(x) <NEW_LINE> nb = 0 <NEW_LINE> xb = [] <NEW_LINE> for k in range(len(x)): <NEW_LINE> <INDENT> if f(x[k]) * f(x[k+1]) <= 0: <NEW_LINE> <INDENT> nb += 1 <NEW_LINE> xb[nb-1][0] = x... | incsearch: incremental search root locator
xb = incsearch(func, xmin, xmax, ns):
finds brackets of x that contain sign changes
of a function on an interval
input:
func = name of function
xmin, xmax = endpoints of interval
ns = number of subintervals
output:
xb[k-1][0] is the lowe... | 625941c6bf627c535bc131fe |
def connector(name=None): <NEW_LINE> <INDENT> informant = None <NEW_LINE> constraints = [] <NEW_LINE> def set_value(source, value): <NEW_LINE> <INDENT> nonlocal informant <NEW_LINE> val = connector['val'] <NEW_LINE> if val is None: <NEW_LINE> <INDENT> informant, connector['val'] = source, value <NEW_LINE> if name is no... | A connector between constraints | 625941c6566aa707497f459b |
def hash(self, state): <NEW_LINE> <INDENT> hash = 0 <NEW_LINE> hash += self.bucket[1] * self.bucket[2] * self.bucket[3] * state[0] <NEW_LINE> hash += self.bucket[2] * self.bucket[3] * state[1] <NEW_LINE> hash += self.bucket[3] * state[2] <NEW_LINE> hash += state[3] <NEW_LINE> return hash | Hash a discrete state to a unique integer value.
:param state: list of integer values.
:return: unique integer hash. | 625941c623e79379d52ee595 |
def target_mc_bc(_cls, n_cls): <NEW_LINE> <INDENT> assert int(_cls) in range(n_cls) <NEW_LINE> out = np.zeros(n_cls) <NEW_LINE> out[_cls] = 1. <NEW_LINE> return out | cls from 0. to n_cls-1. | 625941c650485f2cf553cdc9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.