code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def worker_disable(worker, lbn, profile="default"): <NEW_LINE> <INDENT> return _worker_ctl(worker, lbn, "d", profile)
Set the worker to disable state in the lbn load balancer CLI Examples: .. code-block:: bash salt '*' modjk.worker_disable node1 loadbalancer1 salt '*' modjk.worker_disable node1 loadbalancer1 other-profile
625941ca090684286d50ed83
def reset(self): <NEW_LINE> <INDENT> for flt in const.ACTIONS_FILTER.values(): <NEW_LINE> <INDENT> setattr(self, flt, set()) <NEW_LINE> <DEDENT> self._populated = [] <NEW_LINE> self._index = {}
reset the cache
625941cacc40096d615959ef
def agregar(heap, dato): <NEW_LINE> <INDENT> heap.vector[heap.tamanio] = dato <NEW_LINE> flotar(heap, heap.tamanio) <NEW_LINE> heap.tamanio += 1
Agrega un dato en el montículo.
625941ca31939e2706e4cf09
def test_none_string_tuples(self): <NEW_LINE> <INDENT> wrapper = QueryStringWrapper(None) <NEW_LINE> self.assertEqual(len(wrapper.argument_tuples), 0)
Tests that a query string wrapper that is given a None value has an empty argument_tuples property. :return: None
625941ca8c3a873295158458
def _create_device_tree(self): <NEW_LINE> <INDENT> return DeviceTreeModule()
Create the device tree module. :return: a device tree module
625941ca377c676e91272247
def localize(self,x): <NEW_LINE> <INDENT> print('Localize input x: %s'%(x.get_shape())) <NEW_LINE> with tf.variable_scope('localize',reuse=self.reuse): <NEW_LINE> <INDENT> W_fc_loc1 = tf.get_variable(name='W_fc_loc1', initializer=tf.zeros([ x.get_shape()[1],self.fc_loc1_units])) <NEW_LINE> b_fc_loc1 = tf.get_variable(n...
Creates a localization network (2 FC layers) to estimate the 6DOF localization parameters Args: x: A tensor of shape (batch_size, n_features) Returns: h_fc_loc2: A tensor of shape (batch_size, 6xnum_keys)
625941ca283ffb24f3c559a0
def test_rosenbrock_line_cubic_test(): <NEW_LINE> <INDENT> def g(x): <NEW_LINE> <INDENT> conval = 0 <NEW_LINE> cons = [ (x[0] - 1)**3 - x[1] + 1, x[0] + x[1] - 2 ] <NEW_LINE> for con in cons: <NEW_LINE> <INDENT> if con > 0: <NEW_LINE> <INDENT> conval += con <NEW_LINE> <DEDENT> <DEDENT> return conval * 200 <NEW_...
Rosenbrock function constrained with a cubic and a line benchmark
625941cabf627c535bc1326d
def next_datafile(filename, steps): <NEW_LINE> <INDENT> return re.sub( r'\d+', fcompose( lambda obj: obj.group(0), juxt(int, len), lambda data: (str(data[0] + steps), data[1]), lambda data: data[0].zfill(data[1]), ), os.path.basename(filename), 1 )
Rename a file when using numbers to denote time steps. Adds steps to a filename of format abc010.abc. Args: filename: the filename, e.g. data0000100.nc steps: the number of steps Returns: an updated filename >>> next_datafile('file000.abc', 1) 'file001.abc' >>> next_datafile('file_001.abc', 2) 'file_003.abc'
625941ca92d797404e304228
def save_pbpack(fname, rsrcs): <NEW_LINE> <INDENT> def mk_ent(data): <NEW_LINE> <INDENT> ent = {"idx": mk_ent.idx, "offset": mk_ent.offset, "size": len(data), "crc": crc32(data), "data": data} <NEW_LINE> mk_ent.offset += len(data) <NEW_LINE> mk_ent.idx += 1 <NEW_LINE> return ent <NEW_LINE> <DEDENT> mk_ent.offset = 0 <N...
Outputs a handful of resources to a file. |rsrcs| is a list of resources, with the first mapping to resource index "1". Although the PebbleOS resource structure permits a sparse mapping -- i.e., one in which one must read the whole resource table to find the index that one desires -- the RebbleOS resource loader simp...
625941ca8c3a873295158459
def _local_split(raster=None, n=None): <NEW_LINE> <INDENT> if raster is None: <NEW_LINE> <INDENT> raise IndexError("invalid raster= argument specified") <NEW_LINE> <DEDENT> if n is None: <NEW_LINE> <INDENT> raise IndexError("invalid n= argument specified") <NEW_LINE> <DEDENT> return np.array_split( np.array(raster.arra...
Stump for np._array_split. splits an input array into n (mostly) equal segments, possibly for a future parallel operation.
625941ca26068e7796caed7c
def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { } <NEW_LINE> self.attribute_map = { }
DocCode - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941ca63d6d428bbe4458e
@numba.njit(parallel=True,fastmath=True) <NEW_LINE> def lap3ddipolemat_numba(y,d,x,e,A,An): <NEW_LINE> <INDENT> y = np.atleast_2d(y) <NEW_LINE> d = np.atleast_2d(d) <NEW_LINE> x = np.atleast_2d(x) <NEW_LINE> e = np.atleast_2d(e) <NEW_LINE> ns = y.shape[0] <NEW_LINE> nt = x.shape[0] <NEW_LINE> assert(A.shape==(nt,ns)) <...
Fill dense matrix for pot & direc-grad of 3D Laplace dipoles, non-self. numba jit. Inputs: y - ns*3 source locs d - ns*3 src dipole directions (ought to be unit) x - nt*3 target locs e - nt*3 target normals (ought to be unit) Outputs: (must be preallocated) A - nt*ns matrix mapping source dipole strengths to target pot...
625941ca7cff6e4e81117a24
def minSubsequence(self, nums: List[int]) -> List[int]: <NEW_LINE> <INDENT> sum_all = sum(nums) <NEW_LINE> nums.sort() <NEW_LINE> ret = [] <NEW_LINE> while sum(ret) <= sum_all / 2: <NEW_LINE> <INDENT> t = nums.pop() <NEW_LINE> ret.append(t) <NEW_LINE> <DEDENT> return ret
思路:所谓子序列就是在数组中随机选几个数出来,这便是子序列。 要求和最大,个数最小,那肯定是从数组中按大到小的顺序选出数来。 且一旦选出的数组成的子序列和大于原序列和的一半,则停止,返回选出的子序列。 :param nums: :return:
625941cac4546d3d9de72ad2
def BorrarApp(): <NEW_LINE> <INDENT> run('sudo rm -rf ./Infraestructura-Virtual_IV')
Función para borrar el repositorio.
625941ca046cf37aa974cde7
def reset(self, widget): <NEW_LINE> <INDENT> self.dispatch_counter = 0 <NEW_LINE> for animation in self.animations: <NEW_LINE> <INDENT> animation.reset(widget)
Resets the parallel animation
625941ca442bda511e8be4b8
def process(raw): <NEW_LINE> <INDENT> field = None <NEW_LINE> entry = {} <NEW_LINE> cooked = [] <NEW_LINE> for line in raw: <NEW_LINE> <INDENT> log.debug("Line: {}".format(line)) <NEW_LINE> line = line.strip() <NEW_LINE> if len(line) == 0 or line[0] == "#": <NEW_LINE> <INDENT> log.debug("Skipping") <NEW_LINE> continue ...
Line by line processing of syllabus file. Each line that needs processing is preceded by 'head: ' for some string 'head'. Lines may be continued if they don't contain ':'. If # is the first non-blank character on a line, it is a comment ad skipped.
625941ca0c0af96317bb8287
def assert_collection_equal( self: _TestCaseProtocol, first: Collection[Any], second: Collection[Any] ) -> None: <NEW_LINE> <INDENT> self.assertSequenceEqual(cast(Sequence[Any], first), cast(Sequence[Any], second))
Use this method when comparing a QuerySet with another Collection. Since QuerySets have their own implementation of count() that does something different than Sequence.count(), assertSequenceEqual() cannot be used with QuerySets.
625941ca3eb6a72ae02ec57a
def parseGuardsFromList(lines: List[str]) -> Dict: <NEW_LINE> <INDENT> tmpGuard = {} <NEW_LINE> guards = {} <NEW_LINE> currentGuard = -1 <NEW_LINE> sleepTime = 0 <NEW_LINE> sleepStart = 0 <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> split = line.split(" ") <NEW_LINE> if split[2] == "Guard": <NEW_LINE> <INDENT> gua...
Returns dict containing guard infos parsed from lines. Arguments: lines -- Contains list of strings containing guard data.
625941ca76d4e153a657ebcf
def get_template(self, context, **kwargs): <NEW_LINE> <INDENT> return self.template
Returns the template to be used for the current context and arguments.
625941ca97e22403b379d038
def send_slack_message(message): <NEW_LINE> <INDENT> if 'SLACK_WEB_HOOK' not in os.environ: <NEW_LINE> <INDENT> raise EnvironmentError("Could not find SLACK_WEB_HOOK environment variable") <NEW_LINE> <DEDENT> webhook = os.environ['SLACK_WEB_HOOK'] <NEW_LINE> r = requests.post(webhook, json={'text':message, 'username': ...
Send a message to the slack channel #coretools
625941ca73bcbd0ca4b2c115
def __str__(self): <NEW_LINE> <INDENT> return "\"{}<{}>\"".format(str(type(self).__name__), str(self.type))
Возвращающет строку вида Stack<тип данных>
625941caa17c0f6771cbe0f0
def on_drag_data_get(self, _widget, _drag_context, selection_data, info, _time, data): <NEW_LINE> <INDENT> selection_data.set(Gdk.atom_intern('vte', False), info, str(data.terminator.terminals.index(self)))
I have no idea what this does, drag and drop is a mystery. sorry.
625941ca711fe17d8254240c
def _composite_clips(self): <NEW_LINE> <INDENT> for clips in self._clip_layers: <NEW_LINE> <INDENT> layer_level = 0 <NEW_LINE> self._xor_composite_clip_layer(clips, layer_level=layer_level) <NEW_LINE> layer_level = layer_level + 1 <NEW_LINE> <DEDENT> if len(self._clip_layers) == 1: <NEW_LINE> <INDENT> for clip_id in se...
for each rasterized clip subtract the alpha from the previous.
625941caac7a0e7691ed416c
@app.cli.command() <NEW_LINE> def drop_all(): <NEW_LINE> <INDENT> dsn = app.config.get('SQLALCHEMY_DATABASE_URI') <NEW_LINE> if dsn and input('Do you want to DROP DATABASE:%s ?!' % dsn): <NEW_LINE> <INDENT> drop_db(dsn)
Drop and recreates all tables
625941cae1aae11d1e749d55
def _lattice_type(self): <NEW_LINE> <INDENT> structure_ = self.lattice_only_structure if self.cell_type != "primitive" else self.structure <NEW_LINE> try: <NEW_LINE> <INDENT> return self._lattice_type_from_structure(structure_) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._lattic...
Returns lattice type according to AFLOW (http://aflowlib.org/) classification. Returns: str
625941ca656771135c3eb90d
def to_abstime(messages): <NEW_LINE> <INDENT> now = 0 <NEW_LINE> for msg in messages: <NEW_LINE> <INDENT> now += msg.time <NEW_LINE> yield msg.copy(time=now)
Convert messages to absolute time.
625941ca9f2886367277a92c
def get_value(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> val = self.options.get(value) <NEW_LINE> return val <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> print('Value missing') <NEW_LINE> sys.exit()
Get config value, or if missing/incorrect, recreate
625941cad268445f265b4f0d
def main(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pretty = pprint.PrettyPrinter(indent=2) <NEW_LINE> iam = boto3.client('iam') <NEW_LINE> page = iam.get_paginator('list_users') <NEW_LINE> for response in page.paginate(): <NEW_LINE> <INDENT> pretty.pprint(response['Users']) <NEW_LINE> <DEDENT> <DEDENT> except Exc...
list AWS IAM users
625941cab545ff76a8913eb6
def discard(self, member): <NEW_LINE> <INDENT> self._client.zrem(self.key, member)
Remove ``member`` form this set; Do nothing when element is not a member
625941cabe8e80087fb20ce2
def grayCode(self, n): <NEW_LINE> <INDENT> l = [0] <NEW_LINE> for i in range(1, n+1): <NEW_LINE> <INDENT> l1 = l <NEW_LINE> l2 = l[::-1] <NEW_LINE> k = 2**(i-1) <NEW_LINE> for j in range(len(l2)): <NEW_LINE> <INDENT> l2[j] += k <NEW_LINE> <DEDENT> l = l1 + l2 <NEW_LINE> <DEDENT> return l
:type n: int :rtype: List[int]
625941ca796e427e537b0664
def tearDown(self): <NEW_LINE> <INDENT> db.session.remove() <NEW_LINE> db.drop_all()
Delete our testing database
625941ca4428ac0f6e5ba891
def recon_loss(self, fwd_return, target=None, mask=None): <NEW_LINE> <INDENT> X = fwd_return['x'] if target is None else target <NEW_LINE> pxz = fwd_return['pxz'] <NEW_LINE> zp = fwd_return['zp'] <NEW_LINE> if mask is None: <NEW_LINE> <INDENT> mask = [torch.ones(x.shape, dtype=torch.bool).to(self.device) for x in X] <N...
Reconstruction loss. Done to obtain mae and reconstruction, and also from a target This function is not supposed to be used in the interior
625941ca460517430c394225
def check_full_house(dices): <NEW_LINE> <INDENT> if len(set(dices)) == 2: <NEW_LINE> <INDENT> for value in Counter(dices).values(): <NEW_LINE> <INDENT> if value == 2: <NEW_LINE> <INDENT> return [tuple(sorted(dices))] <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return False
Takes a set of dices as a list and checks if it contains a full house. If found, returns the full house as a tuple in a list.
625941ca7d847024c06be35a
def indicesPercentageOfMax(x, percentage): <NEW_LINE> <INDENT> x = np.asarray(x) <NEW_LINE> maxElement = x.argmax() <NEW_LINE> if np.abs(maxElement) < 1e-7: <NEW_LINE> <INDENT> raise ValueError("Maximum element is {}. This won't work.".format(np.abs(maxElement))) <NEW_LINE> <DEDENT> threshold = percentage / 100. * x[ma...
Find last index greater than maxElement*percentage% from the left and right of maxElement - the maximum element in x :param x: list of numbers :param percentage: percentage out of 100 :return: lowIdx, highIdx
625941caeab8aa0e5d26dbf7
def search_by_date_and_company(stats_param: List[List[Union[int, str]]], date_param: str, company_param: str): <NEW_LINE> <INDENT> date_company = {stat[0] + '_' + stat[1]: stat[2] for stat in stats_param} <NEW_LINE> return date_company[date_param + '_' + company_param]
Search stats for given company and date :param stats_param: Stats list :param date_param: Date to search :param company_param: Company name :rtype: int :return: Amount from stats for given company and date
625941ca8e71fb1e9831d848
def error(self, msg): <NEW_LINE> <INDENT> self.errors += 1 <NEW_LINE> self._log(msg, self.logger.error, prefix="ERROR: ")
Log an error condition. :param msg: The freeform message to display to the end user. :type msg: string
625941ca796e427e537b0665
def evaluate(self, matrix_shape, eigenvalues, eigenvectors, funcs): <NEW_LINE> <INDENT> batch_shape = torch.Size(eigenvalues.shape[1:-1]) <NEW_LINE> results = [torch.zeros(batch_shape, dtype=eigenvalues.dtype, device=eigenvalues.device) for _ in funcs] <NEW_LINE> num_random_probes = eigenvalues.size(0) <NEW_LINE> for j...
Computes tr(f(A)) for an arbitrary list of functions, where f(A) is equivalent to applying the function elementwise to the eigenvalues of A, i.e., if A = V\LambdaV^{T}, then f(A) = Vf(\Lambda)V^{T}, where f(\Lambda) is applied elementwise. Note that calling this function with a list of functions to apply is significant...
625941cabf627c535bc1326e
def convert_to_d_h_m_s(seconds): <NEW_LINE> <INDENT> minutes, seconds = divmod(seconds, 60) <NEW_LINE> hours, minutes = divmod(minutes, 60) <NEW_LINE> days, hours = divmod(hours, 24) <NEW_LINE> return days, hours, minutes, seconds
Return the tuple of days, hours, minutes and seconds.
625941ca462c4b4f79d1d770
def has_left_descent(self, i, mult=None): <NEW_LINE> <INDENT> if mult is None: <NEW_LINE> <INDENT> mult = self.parent().options.mult <NEW_LINE> <DEDENT> if mult != 'l2r': <NEW_LINE> <INDENT> self = self.inverse() <NEW_LINE> <DEDENT> return self[i-1] > self[i]
Check if ``i`` is a left descent of ``self``. A *left descent* of a permutation `\pi \in S_n` means an index `i \in \{ 1, 2, \ldots, n-1 \}` such that `s_i \circ \pi` has smaller length than `\pi`. Here, `\circ` denotes the multiplication of `S_n`. How it is defined depends on the ``mult`` variable in :meth:`Permutati...
625941cad18da76e23532575
def make_graph_comments(autor, date): <NEW_LINE> <INDENT> session = make_connection() <NEW_LINE> graph = "" <NEW_LINE> result = session.query(Submissions.flair, func.count(Submissions.id).label("count")) .join(Comments, Submissions.postid == Comments.postid) .filter(and_(Comments.autor == autor,Comments.d...
Takes a dictoinary of data and creates graphs
625941cad6c5a102081440ea
def p_tableColumn_attribute_default_float(p): <NEW_LINE> <INDENT> p[0] = {**p[1], **{'default': float(p[3])}}
tableColumn : tableColumn DEFAULT iFLOAT
625941ca30c21e258bdfa53c
def wait(self): <NEW_LINE> <INDENT> self._logger.debug("--- WAIT ---") <NEW_LINE> self.join()
Wait for the current parallel kernel to finish :return: no return value
625941caec188e330fd5a83f
def yaml_presets(ctx: click.Context, param: click.core.Option, value: str) -> None: <NEW_LINE> <INDENT> ctx.default_map = ctx.default_map or {} <NEW_LINE> cmd_name = ctx.info_name <NEW_LINE> if not cmd_name: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> _log.debug("Applying command line overrides for subcommand %s fro...
Update a click context with defaults from a yaml file. Parameters ---------- ctx : `click.Context` The click context to update. param : `click.core.Option` The name of the parameter. value : `str` The value of the parameter.
625941ca50812a4eaa59c3c2
def matches(self, request): <NEW_LINE> <INDENT> for key, value in self.keys.items(): <NEW_LINE> <INDENT> if ( key not in request.POST or value != request.POST[key]): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True
Return True if POST data contains all expected keys/values.
625941ca293b9510aa2c3336
def morpheme_freqs(self, morphemes=None, language=None): <NEW_LINE> <INDENT> language = self.verify_language(language) <NEW_LINE> if morphemes is None: <NEW_LINE> <INDENT> morphemes = self.all_morphemes(language) <NEW_LINE> <DEDENT> morphemes = [morpheme.lower() for morpheme in morphemes] <NEW_LINE> keys = set(morpheme...
Returns a frequency dictionary of morphemes in this MorphemeParser's language. :param morphemes: List[str], list of morphemes :param language: str, language of morphemes :return: dict, where... key (str) - morpheme in this MP's language val (int) - given morpheme's frequency
625941ca377c676e91272248
def dirname(self): <NEW_LINE> <INDENT> return self.constants.dir
Like os.path.dirname(self.path).
625941cac4546d3d9de72ad3
def plot(self, overplot=False, clearwindow=True, **kwargs): <NEW_LINE> <INDENT> Plot.plot(self, self.x, self.y, title=self.title, xlabel=self.xlabel, ylabel=self.ylabel, overplot=overplot, clearwindow=clearwindow, **kwargs) <NEW_LINE> Plot.vline(self.median, overplot=True, clearwindow=False, **self.median_defaults) <NE...
Plot the data. This will plot the data sent to the prepare method. Parameters ---------- overplot : bool, optional If `True` then add the data to an existing plot, otherwise create a new plot. clearwindow : bool, optional Should the existing plot area be cleared before creating this new plot (e.g. for mul...
625941ca44b2445a33932135
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 2 <NEW_LINE> (_x.power_ok, _x.overload,) = _struct_2B.unpack(str[start:end]) <NEW_LINE> self.power_ok = bool(self.power_ok) <NEW_LINE> self.overload = bool(self.overload) <NEW_L...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941ca60cbc95b062c65e3
def eucledian(one, two): <NEW_LINE> <INDENT> return sum([ (x - y)**2 for x,y in zip( one, two) ])**0.5
Compute Eucledian Distance between 2 vectors. We assume the input vectors are normalized. :param one: Vector 1 :param two: Vector 2 :return:
625941caac7a0e7691ed416d
def do_copyright(self, line): <NEW_LINE> <INDENT> print("Tuxemon\nCopyright (C) 2014, William Edwards <shadowapex@gmail.com>, Benjamin Bean <superman2k5@gmail.com>")
Print the copyright information if "copyright" was entered. :param None: :rtype: None :returns: None
625941caff9c53063f47c293
def getStatusTable(self, tableName): <NEW_LINE> <INDENT> tableBunch = self.getInternalStatusInfo(tableName) <NEW_LINE> return tableBunch.table
Return a local status table object that was created with addStatusTable()
625941ca009cb60464c63451
def event(self, doc): <NEW_LINE> <INDENT> self.raw_cache.append(doc) <NEW_LINE> if len(self.raw_cache) == self.num: <NEW_LINE> <INDENT> average_evt = dict() <NEW_LINE> desc_id = self.raw_cache[0]['descriptor'] <NEW_LINE> if not all([desc_id == evt['descriptor'] for evt in self.raw_cache]): <NEW_LINE> <INDENT> raise Exc...
Send an Event through the stream
625941ca5510c4643540f485
def __remove_adapter(self, adapter): <NEW_LINE> <INDENT> pass
Remove adapter sequence from Sequence under the development Args adapter (str): an adapter sequence
625941ca57b8e32f5248353a
def i2c(i, alphabet): <NEW_LINE> <INDENT> return alphabet[i % len(alphabet)]
Usage: i2c(i, alphabet). Returns the character at index i in alphabet
625941ca8a43f66fc4b54105
def clear_principal(self): <NEW_LINE> <INDENT> _PRINCIPAL_STORAGE.principal = SystemUser()
Clear the current user of the system.
625941ca097d151d1a222efa
def ownsFindBuffer(self): <NEW_LINE> <INDENT> return False
QClipboard.ownsFindBuffer() -> bool
625941caa934411ee3751733
def make_minus_or_arrow(self): <NEW_LINE> <INDENT> tok_type = TT_MINUS <NEW_LINE> pos_start = self.pos.copy() <NEW_LINE> self.advance() <NEW_LINE> if self.current_char == '>': <NEW_LINE> <INDENT> self.advance() <NEW_LINE> tok_type = TT_ARROW <NEW_LINE> <DEDENT> return Token(tok_type, pos_start=pos_start, pos_end=self.p...
Returns TT_MINUS if '-' and TT_ARROW if '->'
625941ca9b70327d1c4e0e74
def stop(self): <NEW_LINE> <INDENT> self._channel.stop_consuming() <NEW_LINE> self._connection.close() <NEW_LINE> self._connection = None
Stop.
625941ca1b99ca400220ab51
def define_import_directory(self, act_dir, filename=''): <NEW_LINE> <INDENT> if self.act_import_dir is not False: <NEW_LINE> <INDENT> full_dir = self.act_import_dir + '/' + act_dir <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> full_dir = self.root_import_dir + '/' + act_dir <NEW_LINE> <DEDENT> if len(filename) > 0: <NE...
defines the import directory to be the default or somewhere else on the file system
625941cad58c6744b4257d00
def remove_all_service_listeners(self): <NEW_LINE> <INDENT> for listener in [k for k in self.browsers]: <NEW_LINE> <INDENT> self.remove_service_listener(listener)
Removes a listener from the set that is currently listening.
625941ca38b623060ff0ae8d
def _suspend(self, error_dict, loop=True, do_step_change=True): <NEW_LINE> <INDENT> self._log.debug("Suspending") <NEW_LINE> yield from self._do_suspend(error_dict, do_step_change) <NEW_LINE> self._log.debug("Finishing Suspending") <NEW_LINE> if loop and self.step != self._print_steps.unsuspending: <NEW_LINE> <INDENT> ...
Suspending implementation
625941cafb3f5b602dac3732
def fields(self): <NEW_LINE> <INDENT> fields = super(BaseObject, self).fields() <NEW_LINE> if self.configurator is None: <NEW_LINE> <INDENT> return fields <NEW_LINE> <DEDENT> return self.configurator.overrideFields(self.getType(), fields)
Override Fields Definition if Configurator Defined
625941ca26238365f5f0ef0d
def name2Label(name): <NEW_LINE> <INDENT> return ' KQRBNPkqrbnp'.find(name)
Convert label vector into name of piece
625941ca30dc7b7665901a07
def __enter__(self): <NEW_LINE> <INDENT> if not self.check(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.deny() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> raise e <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise PermissionDeniedException()
Enter the runtime context checking whether there is enough permission for this. This is a suplimentary method for with-statement.
625941ca435de62698dfdcec
def submitUpdate(self, id): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addIntIfDefined("id", id); <NEW_LINE> self.client.queueServiceActionCall("contentdistribution_entrydistribution", "submitUpdate", "KalturaEntryDistribution", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDE...
Submits Entry Distribution changes to the remote destination
625941ca63b5f9789fde7185
def scale_by_level(self, level=None): <NEW_LINE> <INDENT> if level is None: <NEW_LINE> <INDENT> level = self.level <NEW_LINE> <DEDENT> return round(0.0 * level, self.num_of_decimals)
Update Survivalist's attributes and tooltip variable.
625941caf8510a7c17cf979c
def extract_report_nums(self,res): <NEW_LINE> <INDENT> selector = etree.HTML(res.text) <NEW_LINE> content = selector.xpath('//*[@id="container"]/div[2]/div/div[2]/text()')[0] <NEW_LINE> report_nums = re.findall('约(.*?)个', content) <NEW_LINE> return report_nums[0]
抽取报道数量
625941ca76e4537e8c351712
def _DischargeDevice(self, percent, wait_period=120): <NEW_LINE> <INDENT> battery_level = int(self.GetBatteryInfo().get('level')) <NEW_LINE> if not 0 < percent < 100: <NEW_LINE> <INDENT> raise ValueError( 'Discharge amount(%s) must be between 1 and 99' % percent) <NEW_LINE> <DEDENT> if battery_level is None: <NEW_LINE>...
Disables charging and waits for device to discharge given amount Args: percent: level of charge to discharge. Raises: ValueError: If percent is not between 1 and 99.
625941ca16aa5153ce362518
def update_seeds(session: nox.Session) -> None: <NEW_LINE> <INDENT> session.install("--upgrade", *SEEDS)
Helper function to update the core installation seed packages to their latest versions in each session. Args: session (nox.Session): The nox session currently running.
625941ca45492302aab5e362
def _terrain_products(self, dem): <NEW_LINE> <INDENT> flow_direction_clip, flow_accumulation_clip, slope_clip = compute_products(dem, self.data['outdir']) <NEW_LINE> slope_clip_desc = arcpy.Describe(slope_clip) <NEW_LINE> self.data['NoDataValue'] = slope_clip_desc.nodatavalue <NEW_LINE> return flow_direct...
Computes terrains products. :param str elev: DTM raster map name :return: (filled elevation, flow direction, flow accumulation, slope)
625941ca851cf427c661a5af
def parameter_changed(self, *args): <NEW_LINE> <INDENT> self.update_energies(self.solutes)
update the energy profile graph if a value has been changed :param args: needed so that the method can be bound to an event trace :return:
625941ca0fa83653e465705b
def prime(): <NEW_LINE> <INDENT> b = 1 <NEW_LINE> yield 2 <NEW_LINE> while True: <NEW_LINE> <INDENT> b += 2 <NEW_LINE> for a in range(2, b): <NEW_LINE> <INDENT> if b % a == 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> yield b
Check for prime numbers
625941ca56ac1b37e6264270
def setPreAndPostOrder(self): <NEW_LINE> <INDENT> self.getPreAndPostOrderAboveRoot() <NEW_LINE> self.preAndPostOrderAreValid = 1
Sets or re-sets self.preOrder and self.postOrder lists of node numbers. PreOrder starts from the root and goes to the tips; postOrder starts from the tips and goes to the root.
625941ca10dbd63aa1bd2c44
def __init__( self, full_name=None, group_identifier=None, identifier=None, path_separator='/', user_directory=None, username=None): <NEW_LINE> <INDENT> super(UserAccountArtifact, self).__init__() <NEW_LINE> self._path_separator = path_separator <NEW_LINE> self.full_name = full_name <NEW_LINE> self.group_identifier = g...
Initializes a user account artifact. Args: full_name (Optional[str]): name describing the user. group_identifier (Optional[str]): identifier of the primary group the user is part of. identifier (Optional[str]): user identifier. path_separator (Optional[str]): path segment separator. user_directory (Opt...
625941ca0a366e3fb873e8ba
def set_move(x, y, player): <NEW_LINE> <INDENT> if valid_move(x, y): <NEW_LINE> <INDENT> board[x][y] = player <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Set the move on board, if the coordinates are valid param x: X coordinate param y: Y coordinate param player: the current player
625941ca82261d6c526ab53e
def test_exec(): <NEW_LINE> <INDENT> assert check(["env", "echo"]).stdout == "\n" <NEW_LINE> assert check(["env", "echo", "hi"]).stdout == "hi\n" <NEW_LINE> assert check(["env", "echo", "hello,", "world!"]).stdout == "hello, world!\n"
Test that specifying a utility will run it.
625941ca596a897236089b61
def recommend_food_groups(ndata,imagebase,does_have=[],does_not_have=[],strictness_good=10,strictness_bad=10): <NEW_LINE> <INDENT> good_ones = [] <NEW_LINE> bad_ones = [] <NEW_LINE> for nutr in does_have: <NEW_LINE> <INDENT> print(nutr) <NEW_LINE> good = food_group_nutrient_contents(ndata,nutr,imagebase) <NEW_LINE> goo...
Recommend food groups based on which nutrients it should or should not have. Parameters: ndata: [DataFrame object] nutrient database imagebase: base name for images does_have: list of nutrients which should be included does_not_have: list of nutrients which should not be included strictness_good: take into account thi...
625941cabd1bec0571d906cf
def run_sim(filename = None) : <NEW_LINE> <INDENT> oracle = OracleSpace() <NEW_LINE> context = Context(oracle = oracle) <NEW_LINE> schedule = Schedule() <NEW_LINE> obt = Obstacle(name ="0", a = (50.0, -50.0), b = (50.0, 50.0), radius = 2.0) <NEW_LINE> context.add_obt(obt) <NEW_LINE> obj = ShowLabelObject(name = "0") <N...
run_sim(filename = None) ------------------------ filename : the name of the file to save the data; None by default.
625941ca07f4c71912b11522
def __init__(self, dim, nnet, swap=False): <NEW_LINE> <INDENT> super(CouplingBlock, self).__init__() <NEW_LINE> assert (dim % 2 == 0) <NEW_LINE> self.d = dim // 2 <NEW_LINE> self.nnet = nnet <NEW_LINE> self.swap = swap
Args: s (nn.Module) t (nn.Module)
625941ca63b5f9789fde7186
def replace_filters(**kwarg_mapping): <NEW_LINE> <INDENT> def decorator(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> replaced_kwargs = {} <NEW_LINE> for key, value in kwargs.items(): <NEW_LINE> <INDENT> if key in kwarg_mapping: <NEW_LINE> <INDENT> replac...
Decorator to replace kwargs. Examples: kwargs: {'a': 'b'}, kwarg_mapping: {'a': 'c'} replaced kwargs to decorated func: {'c': 'b'} replace_filters is used to replace caller's input to make it understandable by models.py.
625941ca3617ad0b5ed67f98
def __init__(self): <NEW_LINE> <INDENT> self.NetDetectId = None <NEW_LINE> self.NetDetectIpStateSet = None
:param NetDetectId: 网络探测实例ID。形如:netd-12345678。 :type NetDetectId: str :param NetDetectIpStateSet: 网络探测目的IP验证结果对象数组。 :type NetDetectIpStateSet: list of NetDetectIpState
625941cab57a9660fec33924
def maxmin(*args, key=identityfunc, default=None): <NEW_LINE> <INDENT> if not args: <NEW_LINE> <INDENT> raise TypeError("maxmin expected at least 1 argument, got 0") <NEW_LINE> <DEDENT> seq = args[0] if len(args) == 1 else args <NEW_LINE> curr_max = default <NEW_LINE> curr_min = default <NEW_LINE> for elem in seq: <NEW...
Mimic the builtin divmod() function
625941ca07d97122c417892a
def zoomOut(self): <NEW_LINE> <INDENT> self.fontsize = self.fontsize-1 <NEW_LINE> self.rowheight -= 2 <NEW_LINE> self.tablecolheader.height -=1 <NEW_LINE> self.setFont() <NEW_LINE> self.adjustColumnWidths() <NEW_LINE> self.redraw() <NEW_LINE> return
Zoom out, decreases font and row heights.
625941ca377c676e91272249
def encode(self, strs): <NEW_LINE> <INDENT> if not strs: <NEW_LINE> <INDENT> return ' /*/ ' <NEW_LINE> <DEDENT> modified = [s.replace('*', '**') for s in strs] <NEW_LINE> return ' /*/ '.join(modified)
Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
625941ca26068e7796caed7e
def convert_aaencoding(document): <NEW_LINE> <INDENT> if document.textclass != "aa": <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> i = find_token(document.header, "\\use_default_options true") <NEW_LINE> if i == -1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> val = get_value(document.header, "\\inputencoding") <NEW...
Convert default document option due to encoding change in aa class.
625941ca8c3a87329515845b
def check_withdraw(self, session): <NEW_LINE> <INDENT> withdraw_record = session.query(self.coin_withdraw_col ).filter_by( coin_type=self.coin_category, informed=InformEnum.NO).first() <NEW_LINE> if not withdraw_record: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> backend = self.driver <NEW_LINE> coin_config = sessio...
提币交易确认检查
625941ca63d6d428bbe44590
def get_evtcode_frequency(self, evtcode): <NEW_LINE> <INDENT> Id = self._get_evtcode_Id(evtcode) <NEW_LINE> return self._get_Id_freq(Id)
in Hz
625941ca091ae35668667000
def create_app(*args, **kwargs): <NEW_LINE> <INDENT> app = flask.Flask(__name__) <NEW_LINE> cfg = configparser.ConfigParser() <NEW_LINE> if 'FILABEL_CONFIG' not in os.environ: <NEW_LINE> <INDENT> app.logger.critical('Config not supplied by envvar FILABEL_CONFIG') <NEW_LINE> exit(1) <NEW_LINE> <DEDENT> configs = os.envi...
Prepare Filabel Flask application listening to GitHub webhooks
625941ca15fb5d323cde0baf
@dispatch.expectation.register(Gaussian, kernels.Sum, InducingPoints, NoneType, NoneType) <NEW_LINE> def _expectation_gaussian_sum_inducingpoints( p: Gaussian, kernel: kernels.Sum, inducing_variable: InducingPoints, _: None, __: None, nghp: None = None, ) -> tf.Tensor: <NEW_LINE> <INDENT> exps = [expectation(p, (k, ind...
Compute the expectation: <\Sum_i Ki_{X, Z}>_p(X) - \Sum_i Ki_{.,.} :: Sum kernel :return: NxM
625941ca7b180e01f3dc489f
def to_sub_query(self): <NEW_LINE> <INDENT> return self.expression.to_sub_query()
Return TableSubQuery object.
625941ca7cff6e4e81117a26
def toolbox_to_dictlist(typefile): <NEW_LINE> <INDENT> result=[] <NEW_LINE> with codecs.open(typefile,"r", "utf-8") as fd: <NEW_LINE> <INDENT> typetext = fd.read() <NEW_LINE> <DEDENT> fd.close() <NEW_LINE> results=split_entries(typetext) <NEW_LINE> return results
Convert a typesetting file to list of dictionaries, one per headword
625941ca2ae34c7f2600d1d2
def debug_async(self, conn_id, cmd_name, cmd_args, progress_callback, callback): <NEW_LINE> <INDENT> if cmd_name == 'heartbeat': <NEW_LINE> <INDENT> callback(conn_id, self.id, True, {'alive': not self.stopped}, None) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> callback(conn_id, self.id, False, None, "Debug commands a...
Asynchronously complete a named debug command. The command name and arguments are passed to the underlying device adapter and interpreted there. If the command is long running, progress_callback may be used to provide status updates. Callback is called when the command has finished. Args: conn_id (int): A uniqu...
625941ca23e79379d52ee605
def has(obj, segments): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> get(obj, segments) <NEW_LINE> return True <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return False
Return True if the path exists in the obj. Otherwise return False. has(obj, segments) -> bool
625941ca0a50d4780f666f32
@pytest.mark.meta(blockers=[1097150, 1273032, 1320244]) <NEW_LINE> def test_delete_button_should_appear_after_save(request): <NEW_LINE> <INDENT> pytest.sel.force_navigate("infra_vms") <NEW_LINE> filter_name = fauxfactory.gen_alphanumeric() <NEW_LINE> search.save_filter("fill_count(Virtual Machine.Files, >, 0)", filter_...
Delete button appears only after load, not after save
625941ca26068e7796caed7f
def get_selected_list(estimator, vs_analysis=True): <NEW_LINE> <INDENT> if isinstance(estimator, BaseSearchCV): <NEW_LINE> <INDENT> estimator = estimator.best_estimator_ <NEW_LINE> <DEDENT> if type(vs_analysis) == str: <NEW_LINE> <INDENT> selected_features = retrieve_features( estimator.named_steps[vs_analysis]) <NEW_L...
Retrieve the list of selected features. Retrieves the list of selected features automatically identifying the type of object Returns ------- index : nunmpy.array The indices of the selected features
625941ca7047854f462a14ab
def pipeline_cleanup(self): <NEW_LINE> <INDENT> for child in self.actions: <NEW_LINE> <INDENT> child.cleanup() <NEW_LINE> if child.internal_pipeline: <NEW_LINE> <INDENT> child.internal_pipeline.pipeline_cleanup()
Recurse through internal pipelines running action.cleanup(), in order of the pipeline levels.
625941caa05bb46b383ec8c2
def testIncrementANegativeInteger(self): <NEW_LINE> <INDENT> self.assertTrue(memcache.set(self.key1, -5)) <NEW_LINE> self.assertEqual(None, memcache.incr(self.key1)) <NEW_LINE> self.assertEqual(-5, memcache.get(self.key1))
Tests that incrementing a negative value fails.
625941ca4e696a04525c94ec
def filter_pycons(pycons: List[PyCon], year: int = 2019, continent: str = "Europe") -> List[PyCon]: <NEW_LINE> <INDENT> return [ pycon for pycon in pycons if ( get_continent(pycon.country) == continent and pycon.start_date.year == year ) ]
Given a list of PyCons a year and a continent return a list of PyCons that take place in that year and on that continent.
625941caeab8aa0e5d26dbf8
def optimize(self, loss, num_async_replicas=1): <NEW_LINE> <INDENT> tf.logging.info("Base learning rate: %f", self.hparams.learning_rate) <NEW_LINE> lr = self.hparams.learning_rate <NEW_LINE> decay_rate = optimize.learning_rate_decay_with_warmup(self.hparams) <NEW_LINE> lr *= decay_rate <NEW_LINE> if self.hparams.learn...
Return a training op minimizing loss.
625941cabe7bc26dc91cd6a2
def reinit(self, set_val_list, get_val_list): <NEW_LINE> <INDENT> self.set_val_list = set_val_list <NEW_LINE> self.get_val_list = get_val_list <NEW_LINE> self.update()
The interface is attached to another object, so the methods need to be reset.
625941ca0c0af96317bb8289