code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def GetHeight(cli): <NEW_LINE> <INDENT> if cli.config.completion_menu_lines and not cli.is_done: <NEW_LINE> <INDENT> buf = cli.current_buffer <NEW_LINE> if UserTypingFilter(cli) or buf.complete_state: <NEW_LINE> <INDENT> return dimension.LayoutDimension( min=cli.config.completion_menu_lines + 1) <NEW_LINE> <DEDENT> <DE...
Determine the height for the input buffer.
625941b9e1aae11d1e749b31
def get_db_query_4_columns(self, m2o_db, table_name, schema, database): <NEW_LINE> <INDENT> sgdb = m2o_db.m2o_dbtype.name <NEW_LINE> query = """ SELECT * FROM {t_from} WHERE """.format( t_from="information_schema.columns" ) <NEW_LINE> if sgdb != "SQLServer": <NEW_LINE> <INDENT> query += ( " table_schema =" f" '{schema ...
Function to obtain the SELECT query for a table columns :param m2o_db: :param table_name: :param schema: :param database: :return:
625941b9956e5f7376d70cf6
def __repr__(self): <NEW_LINE> <INDENT> context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) <NEW_LINE> return '<Twilio.Api.V2010.MediaContext {}>'.format(context)
Provide a friendly representation :returns: Machine friendly representation :rtype: str
625941b9a05bb46b383ec6aa
def _create_placeholders(self): <NEW_LINE> <INDENT> logger.info("Creating model placeholders.") <NEW_LINE> self.inputs_placeholder = tf.placeholder(dtype=tf.float32, shape=[None, self.data_features], name="inputs") <NEW_LINE> logger.info(self.inputs_placeholder) <NEW_LINE> self.labels_placeholder = tf.placeholder(dtype...
Create the placeholders of the model.
625941b9507cdc57c6306b51
def dis_resnet34(pretrained=False, **kwargs): <NEW_LINE> <INDENT> model = ResNet(BasicBlock, [3, 4, 6, 3], **kwargs) <NEW_LINE> return model
Constructs a ResNet-34 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
625941b90c0af96317bb8067
def __enter__(self) -> Event: <NEW_LINE> <INDENT> if self._cuda: <NEW_LINE> <INDENT> self._event_start = torch.cuda.Event(enable_timing=True) <NEW_LINE> self._event_start.record() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._event_start = datetime.now() <NEW_LINE> <DEDENT> return self
Mark a time. Mimics torch.cuda.Event.
625941b9097d151d1a222cd9
def SearchBarContext(request): <NEW_LINE> <INDENT> return {'searchbar':SearchBarForm()}
Produces a context variable for the searchbar that's available across all pages. :param request: :return:
625941b921bff66bcd6847d2
def test_changelog(self): <NEW_LINE> <INDENT> version_str = "v" + self.init_version <NEW_LINE> hruler = '-' * len(version_str) <NEW_LINE> expect_str = version_str + "\n" + hruler <NEW_LINE> filepath = os.path.join( self.repodir, "cmakelang/doc/changelog.rst") <NEW_LINE> with open(filepath) as infile: <NEW_LINE> <INDENT...
Ensure that the changelog includes an section for this version
625941b9004d5f362079a1b4
def test_double_add_mac_address(self): <NEW_LINE> <INDENT> self.network.host_add("test1", "00:11:22:33:44:55", "127.0.0.1") <NEW_LINE> self.assertRaises(cinv.netipv4.Error, self.network.host_add, "test2", "00:11:22:33:44:55", "127.0.0.2")
Add two hosts with same mac address
625941b9d6c5a10208143ec5
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 1 <NEW_LINE> (self.type,) = _struct_B.unpack(str[start:end]) <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> start = end <N...
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
625941b90383005118ecf462
def generate_proto(source, require = True): <NEW_LINE> <INDENT> protroot = os.environ.get("PROTROOT") <NEW_LINE> if protroot is not None: <NEW_LINE> <INDENT> source = source.replace("../src/", protroot) <NEW_LINE> <DEDENT> if not require and not os.path.exists(source): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> out...
Invokes the Protocol Compiler to generate a _pb2.py from the given .proto file. Does nothing if the output already exists and is newer than the input.
625941b98e7ae83300e4ae49
def getGoal(self): <NEW_LINE> <INDENT> return self.goal
Returns the curent Goal object.
625941b9a219f33f346287f2
def isPowerOfTwo(self,n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif n == 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif n % 2 == 0: <NEW_LINE> <INDENT> return self.isPowerOfTwo(n/2) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
:type n: int :rtype: bool
625941b9b545ff76a8913c9c
def db_psql_delete_database(dbname): <NEW_LINE> <INDENT> sudo('echo "DROP DATABASE {};" | sudo -u postgres psql'.format(dbname))
Delete (drop) a database - Ex: (cmd:<dbname>)
625941b924f1403a926009e7
def resolve_conflicts(self): <NEW_LINE> <INDENT> neighbours = self.nodes <NEW_LINE> new_chain = None <NEW_LINE> max_length = len(self.chain) <NEW_LINE> for node in neighbours: <NEW_LINE> <INDENT> response = requests.get('http://{node}/chain') <NEW_LINE> if response.status_code == 200: <NEW_LINE> <INDENT> length = respo...
This is our consensus algorithm, it resolves conflicts by replacing our chain with the longest one in the network. :return: True if our chain was replaced, False if not
625941b973bcbd0ca4b2befb
def add_observer_bot(self, new_bot): <NEW_LINE> <INDENT> if not any (isinstance(bot, new_bot.__class__) for bot in self._observer_bots): <NEW_LINE> <INDENT> print("Adding observer: {}".format(new_bot.__class__.__name__)) <NEW_LINE> self._observer_bots.append(new_bot)
We assume that since every specific bot type represents a certain responsibility, only one instance of each type will be allowed to observe the forum. Therefore, only one instance of any child of AbstractObserverBot will be added to the list of observers.
625941b9cc0a2c11143dcd16
def pack_to(self, writer): <NEW_LINE> <INDENT> writer.write(self._objectID, 'I') <NEW_LINE> writer.write(self._objectFamily, 'i') <NEW_LINE> writer.write(self._objectType, 'i')
Writes the current ConnectedObjectState to the given BinaryWriter.
625941b963d6d428bbe4436d
def _readheader(self, infile): <NEW_LINE> <INDENT> self.header = {} <NEW_LINE> hstr = infile.read(4096) <NEW_LINE> if (hstr.find('# ') == -1): <NEW_LINE> <INDENT> return self.header <NEW_LINE> <DEDENT> hstr = hstr[hstr.index('# '):] <NEW_LINE> hstr = hstr[:hstr.index('\x00')] <NEW_LINE> hstr = hstr.split('#') <NEW_LINE...
Parser based approach Gets all entries
625941b991af0d3eaac9b892
def chgat(self, x_pos, y_pos, length, color): <NEW_LINE> <INDENT> if self.lines > y_pos >= 0: <NEW_LINE> <INDENT> if x_pos >= 0 and (x_pos + length) <= self.columns: <NEW_LINE> <INDENT> self.window.chgat(y_pos, x_pos, length, color)
Wraps call around curses.window.chgat.
625941b95166f23b2e1a4fd7
def raw_request(self, url, method, params, data=None, headers=None): <NEW_LINE> <INDENT> if method == 'GET': <NEW_LINE> <INDENT> resp = requests.get(url, params=params, headers=headers) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resp = requests.post(url, params=params, data=data, headers=headers) <NEW_LINE> <DEDENT>...
Performs the actual http requests to OptimoRoute's service, by using the ``requests`` library. If for some reason someone would want to use a different library, this is the function they should override. The only requirement is to always return a dictionary of the form: { 'status_code': $INT_STATUS_CODE, 'hea...
625941b997e22403b379ce16
def add_to( v, to, G, color, sum_ins, sum_out, tot_mas, ver_wei): <NEW_LINE> <INDENT> com_col = color[to] <NEW_LINE> sum_tot = sum_ins[com_col] + sum_out[com_col] <NEW_LINE> k_v = ver_wei[v] <NEW_LINE> k_v_in = np.sum(G[v, np.where(color == com_col)]) <NEW_LINE> first = (k_v_in / (2 * tot_mas)) <NEW_LINE> second = (sum...
Add vertex to community v - vertex, that we want to add to - vertex, to which community we want to add v G - adjacency matrix color - labels color sum_ins - sum of edges inside community sum_out - sum of edges outside community tot_mas - sum of all edges ver_wei - sum of edges, that are connected to vertices
625941b9566aa707497f43f7
def range_alpha_light(alpha_range,time): <NEW_LINE> <INDENT> alpha_range_light=[] <NEW_LINE> for i in range(len(alpha_range)): <NEW_LINE> <INDENT> alpha_i=[] <NEW_LINE> min_i=alpha_range[i][0][0] <NEW_LINE> max_i=alpha_range[i][alpha_range[i].shape[0]-1][0] <NEW_LINE> alpha_i.append(min_i) <NEW_LINE> if min_i!=max_i: <...
Creates a time-range vector with only min and max values of all alpha Parameters ---------- alpha_range : time-range vector The time-range vector included between an alpha min and an alpha max time : vector Time vector Returns ------- alpha_range_light : vector Time-range vector with only min and max valu...
625941b9442bda511e8be2a3
def process_update_network_service_policy(self, session, data, result): <NEW_LINE> <INDENT> pass
Process extended attributes for network_service_policy update. :param session: database session :param data: dictionary of incoming network_service_policy data :param result: network_service_policy dictionary to extend Called inside transaction context on session to validate and update any extended network_service_po...
625941b955399d3f05588531
def login(self): <NEW_LINE> <INDENT> brw = self.browser <NEW_LINE> self.logger.debug('Requesting first login page.') <NEW_LINE> brw.open('https://onlinebanking.aib.ie/inet/roi/login.htm') <NEW_LINE> brw.select_form(selector='#loginCiamForm') <NEW_LINE> self.logger.debug('Clicking large CONTINUE button on the entry page...
Go through the login process.
625941b9f548e778e58cd3fa
def perform_authentication(self, request): <NEW_LINE> <INDENT> pass
默认视图在进行请求分发时就会进行认证 在视图中重写此方法,如果内部直接pass,表示在请求分发时,先不要认证,让请求可以正常访问 目的:延后它的认证,为了让未登录用户也能先访问我的视图 将来自己去写认证,
625941b9e64d504609d746be
def __init__(self, entry, valid_combinations): <NEW_LINE> <INDENT> Exception.__init__(self) <NEW_LINE> self._entry = entry <NEW_LINE> self._valid_combinations = valid_combinations
Initialize this exception with combinations.
625941b9a8370b771705271f
def stocGradAscent(features, labels, alpha=0.001): <NEW_LINE> <INDENT> featureMatrix = mat(features) <NEW_LINE> m, n = shape(featureMatrix) <NEW_LINE> weights = ones((n, 1)) <NEW_LINE> for i in range(m): <NEW_LINE> <INDENT> h = sigmoid(sum(featureMatrix[i]*weights)) <NEW_LINE> error = labels[i] - h <NEW_LINE> weights +...
随机梯度上升算法: - 在线学习算法:一次仅用一个样本点来更新回归系数,可以在新样本到来时对分类器进行增量式更新 - 与梯度上升算法相比,占用更少的计算资源
625941b930c21e258bdfa31b
def resnet_v2_50(inputs, num_classes=None, is_training=True, return_raw=True, global_pool=True, output_stride=None, spatial_squeeze=True, reuse=None, scope='resnet_v2_50'): <NEW_LINE> <INDENT> blocks = [ resnet_v2_block('block1', base_depth=64, num_units=3, stride=2), resnet_v2_block('block2', base_depth=128, num_units...
ResNet-50 model of [1]. See resnet_v2() for arg and return description.
625941b9656771135c3eb6f0
def run(self): <NEW_LINE> <INDENT> self.chessblack.doWait() <NEW_LINE> while True: <NEW_LINE> <INDENT> userinput = input("请用户输入下棋坐标:") <NEW_LINE> ret = self.engine.userGo(self.chessblack,userinput) <NEW_LINE> if ret: <NEW_LINE> <INDENT> print("我是客户端,我方已下完棋") <NEW_LINE> ret = self.chessblack.getPos() <NEW_LINE> msg = st...
子线程执行的代码
625941b966656f66f7cbc028
def _calc_deltas(self): <NEW_LINE> <INDENT> deltas = [self.alfa[i]*self.t0/(self.d[i]*self.d[i]) for i in range(3)] <NEW_LINE> return deltas
:return: dimensionless thermal diffusivity
625941b9187af65679ca4f9b
def getHeader( self ): <NEW_LINE> <INDENT> return "\t".join(self.mHeader)
return header
625941b963f4b57ef0000fa0
def clear_orphaned_result(self, item=None): <NEW_LINE> <INDENT> Result = apps.get_model('lab_clinic_api', 'result') <NEW_LINE> LisResultItem = apps.get_model('lab_result_item', 'resultitem') <NEW_LINE> if isinstance(item, Result): <NEW_LINE> <INDENT> result = item <NEW_LINE> <DEDENT> elif Result.objects.filter(order__o...
Verifies and, if required, deletes the result of a 'PENDING' order on the EDC that has no result items and the result is NEW. Args: item: can be either a Result instance or an order_identifier.
625941b915fb5d323cde0988
@blueprint.route('/note/view/<note_id>') <NEW_LINE> @role_required('operator') <NEW_LINE> def note_view_route(note_id): <NEW_LINE> <INDENT> note = Note.query.get(note_id) <NEW_LINE> return render_template('storage/note/view.html', note=note, button_form=ButtonForm())
view note
625941b9d8ef3951e32433bb
def CreateRecipe(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Create new recipe
625941b9d10714528d5ffb5e
def factory_basename(dir_ann, dir_gt): <NEW_LINE> <INDENT> names_gt = tuple(os.listdir(dir_gt)) <NEW_LINE> path_train = os.path.join('splits', 'kitti_train.txt') <NEW_LINE> path_val = os.path.join('splits', 'kitti_val.txt') <NEW_LINE> _, set_val_gt = split_training(names_gt, path_train, path_val) <NEW_LINE> set_val_gt ...
Return all the basenames in the annotations folder corresponding to validation images
625941b9cc40096d615957d1
def onExceptionRaiseExit(self, raisable_exceptions, collection=None): <NEW_LINE> <INDENT> if collection is None: <NEW_LINE> <INDENT> collection = self <NEW_LINE> <DEDENT> if self.exception_collections is not None: <NEW_LINE> <INDENT> self.exception_collections.append( TraceCollectionBranch(parent=collection, name="exce...
Indicate to the trace collection what exceptions may have occurred. Args: raisable_exception: Currently ignored, one or more exceptions that could occur, e.g. "BaseException". collection: To pass the collection that will be the parent Notes: Currently this is unused. Passing "collection" as an argument...
625941b9c432627299f04ac2
def get_download_url(file_name): <NEW_LINE> <INDENT> return f"{settings.EXPORT_MEDIA_ROOT.rstrip('/')}/{str(file_name)}"
A URL path to the run data :param run_uid: The unique identifier for the run data. :return: The url context. (e.g. /downloads/123e4567-e89b-12d3-a456-426655440000)
625941b98e71fb1e9831d62b
def dispatch_to_server(self, pub_msg): <NEW_LINE> <INDENT> assert isinstance(pub_msg, Publish) <NEW_LINE> if self.authorization.is_publish_allowed(pub_msg.topic): <NEW_LINE> <INDENT> self.server.handle_incoming_publish(pub_msg, self.uid) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.logger.warn("[uid: %s] is not a...
Dispatches a Publish message to the server for further processing, ie. delivering it to the appropriate subscribers. :param Publish pub_msg: A :class:`broker.messages.Publish` instance.
625941b9be383301e01b530b
def unsubscribe_user_to_calendar(user, course_key): <NEW_LINE> <INDENT> UserCalendarSyncConfig.objects.filter(user=user, course_key=course_key).update(enabled=False)
Disables the Calendar Sync config for a particular user and course. If the instance does not exist, this function will do nothing. Parameters: user (User): The user to subscribe course_key (CourseKey): The course key for the subscription
625941b9e64d504609d746bf
def get_features(path): <NEW_LINE> <INDENT> data_files = os.listdir(path) <NEW_LINE> N = len(data_files) <NEW_LINE> D = 299 * 13 <NEW_LINE> X = np.zeros((N, D)) <NEW_LINE> sample_num = 0 <NEW_LINE> for f in data_files: <NEW_LINE> <INDENT> ts, sample_rate = li.core.load(path + "/" + f, sr=16000) <NEW_LINE> clipped_ts = ...
This function extracts mfcc features from each of the wav files located at the specified path and returns a feature matrix containing the mfcc features for each sample :param path: str: path to directory containing the wav files for feature extraction N: int: number of data samples D: int: number of featu...
625941b93c8af77a43ae361b
def test_yaml_platform_overrive(self): <NEW_LINE> <INDENT> if platform.system() == 'Windows': <NEW_LINE> <INDENT> other = 'unix' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> other = 'windows' <NEW_LINE> <DEDENT> with self._task_config.using_platform(other): <NEW_LINE> <INDENT> res = self._task_config.properties['ptest...
Make sure we can swap platforms
625941b944b2445a33931f1e
def __init__(self, coordinates, hFig): <NEW_LINE> <INDENT> self.delay = 0 <NEW_LINE> self.hL = [0, 0, 0, 0] <NEW_LINE> self.xData_0_L = np.zeros(4) <NEW_LINE> self.yData_0_L = np.zeros(4) <NEW_LINE> self.R = 0.35 <NEW_LINE> self.L = 0.15 <NEW_LINE> self.hFig = hFig <NEW_LINE> self.position = np.array(coordinates) <NEW_...
Designer of the oriented robot and its graphical image SYNTAX: r = Body( coordinates ) - coordinates = [x, y] - Cartesian coordinates of the lower left corner of the cell - - hid = handle of the graphics window work :param coordinates: initial robot position on the field :param hFig: reference to plot Fig...
625941b9187af65679ca4f9c
def start(self, start=None): <NEW_LINE> <INDENT> return self.bounds(start)[0]
Return the start point of the Iteration if the lower limit is known, ``None`` otherwise.
625941b98a349b6b435e7ff3
def get_tuples(self): <NEW_LINE> <INDENT> self._read() <NEW_LINE> return zip(self.data["scores"], self.data["costs"], self.data["tw"])
Return zipped data about vertices
625941b967a9b606de4a7d3b
def _build_single_stream_model(self, data, embedding_fn, encoder_fn_1, encoder_fn_2, logits_fn): <NEW_LINE> <INDENT> if isinstance(embedding_fn, (modules.Embeddding, modules.CachedElmoModule)): <NEW_LINE> <INDENT> embedded_tokens_1 = embedding_fn(data.source_1) <NEW_LINE> <DEDENT> if isinstance(embedding_fn, modules.TF...
BiLSTM with max pooling, but ignore sequence_2
625941b938b623060ff0ac6d
def __init__(self): <NEW_LINE> <INDENT> object.__setattr__(self, "__conf", dict()) <NEW_LINE> object.__setattr__(self, "__frozen", False)
Constructor
625941b992d797404e304008
@public.add <NEW_LINE> def cp(source, target, force=True): <NEW_LINE> <INDENT> if (os.path.exists(target) and not force) or source == target: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> _copy(source, target)
Copy the directory/file src to the directory/file target
625941b97d847024c06be13f
def client_send_request_1(trf_from, trf_to, trf_amount): <NEW_LINE> <INDENT> print("-" * 60) <NEW_LINE> print("CLIENT1 : New Request:") <NEW_LINE> print("CLIENT1 : from = [{0}]".format(trf_from)) <NEW_LINE> print("CLIENT1 : to = [{0}]".format(trf_to)) <NEW_LINE> print("CLIENT1 : amount = ...
Simulates the client request message sending for the 1st scenario.
625941b9dd821e528d63b02a
def get_network_constitution(self): <NEW_LINE> <INDENT> with requests.get(f"{self.node_url}/constitution") as res: <NEW_LINE> <INDENT> return decode(res.text)
Get the constitution of the network
625941b9cad5886f8bd26e61
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> stripped_name = " ".join( w for w in self.name.split() if w not in STOPWORDS ) <NEW_LINE> if not self.slug: <NEW_LINE> <INDENT> self.slug = uuslug( stripped_name, instance=self, max_length=100, separator="-", start_no=2, ) <NEW_LINE> <DEDENT> super(Office, self).save...
**uid**: :code:`{body.uid | jurisdiction.uid}_office:{slug}`
625941b97b25080760e392d9
def json_payload(self): <NEW_LINE> <INDENT> return { 'point': list(self.point), 'value': self.value, 'value_var': self.noise_variance, }
Convert the sample_point into a dict to be consumed by json for a REST request.
625941b950485f2cf553cc17
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, V2beta1ExternalMetricSource): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941b91f037a2d8b94607d
def version_cmp(pkg1, pkg2, ignore_epoch=False): <NEW_LINE> <INDENT> normalize = lambda x: str(x).split(':', 1)[-1] if ignore_epoch else str(x) <NEW_LINE> pkg1 = normalize(pkg1) <NEW_LINE> pkg2 = normalize(pkg2) <NEW_LINE> output = __salt__['cmd.run_stdout'](['opkg', '--version'], output_loglevel='trace', python_shell=...
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` to ignore the epoch when comparing versions .. versionadded:: 2016.3.4 CLI Example: .. code-block:: bas...
625941b9851cf427c661a391
def connect(self): <NEW_LINE> <INDENT> self.logger.info('Connecting to %s', self._prefix) <NEW_LINE> account = 'opensuse' <NEW_LINE> server = 'rabbit.opensuse.org' <NEW_LINE> if self._prefix == 'suse': <NEW_LINE> <INDENT> account = 'suse' <NEW_LINE> server = 'rabbit.suse.de' <NEW_LINE> <DEDENT> credentials = pika.Plain...
This method connects to RabbitMQ, returning the connection handle. When the connection is established, the on_connection_open method will be invoked by pika. :rtype: pika.SelectConnection
625941b9adb09d7d5db6c611
def match_command(self, c, buttons): <NEW_LINE> <INDENT> for b in self.command_list[c]['buttons']: <NEW_LINE> <INDENT> if b < 0 or len(buttons) <= b or buttons[b] != 1: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return sum(buttons) == len(self.command_list[c]['buttons'])
Find a command matching a joystick configuration
625941b9d164cc6175782bcd
def items(self): <NEW_LINE> <INDENT> return self._dict.items()
Exposes the items of the internal dictionary
625941b90383005118ecf463
def traceConfluent(self, aDEVS): <NEW_LINE> <INDENT> pass
Called for each atomic DEVS model that does a confluent transition.
625941b9925a0f43d2549cf2
def __init__(self, num_buckets=1024, own_hash = None): <NEW_LINE> <INDENT> self.dict = [] <NEW_LINE> for i in range(num_buckets): <NEW_LINE> <INDENT> self.dict.append((None, None)) <NEW_LINE> <DEDENT> self.keys = dict() <NEW_LINE> self.hash = hash <NEW_LINE> if own_hash != None: <NEW_LINE> <INDENT> own_hash.modulo = le...
Initializes a dictionary with the given number of buckets.
625941b966656f66f7cbc029
def test_ks_2samp(self): <NEW_LINE> <INDENT> data1 = [ self.L, self.A ] <NEW_LINE> data2 = [ self.M, self.B ] <NEW_LINE> results = (-0.20000000000000007, 0.77095294467662123) <NEW_LINE> i = 0 <NEW_LINE> for d in data1: <NEW_LINE> <INDENT> self.assertEqual( stats.ks_2samp( d, data2[i] )[i], results[i] ) <NEW_LINE> i += ...
Testing ks_2samp
625941b9ec188e330fd5a625
def insert_tables(cur, conn): <NEW_LINE> <INDENT> for query in insert_table_queries: <NEW_LINE> <INDENT> cur.execute(query) <NEW_LINE> conn.commit()
This function is responsible for extracting data from the staged_tables stage_events and stage_songs into the fact and dimension tables. inputs: cur: pyscopg2 cursor object for query execution conn: a connection object return by psycopg2 output: Returns None
625941b9d6c5a10208143ec6
def _ReadRows(self): <NEW_LINE> <INDENT> raise NotImplementedError("_ReadRows must be overridden by subclasses.")
Generator that returns one row at a time. THIS METHOD MUST BE OVERRIDDEN BY SUBCLASSES. Returns: The next row, as a dict keyed by the column names.
625941b915fb5d323cde0989
def rules_from_wordform(word_form): <NEW_LINE> <INDENT> rules = [] <NEW_LINE> if word_form in form_to_ids: <NEW_LINE> <INDENT> for key in form_to_ids[word_form]: <NEW_LINE> <INDENT> rules.extend(rules_from_wordid(key)) <NEW_LINE> <DEDENT> <DEDENT> return list(set(rules))
Find all syntactic rules for the word_form
625941b924f1403a926009e8
def _obtain_args(): <NEW_LINE> <INDENT> if request.method == "GET": <NEW_LINE> <INDENT> args = _obtain_get_args() <NEW_LINE> <DEDENT> elif request.method in ("POST", "PUT"): <NEW_LINE> <INDENT> args = {} <NEW_LINE> args.update(_obtain_get_args()) <NEW_LINE> args.update(_obtain_form_args()) <NEW_LINE> args.update(_obtai...
获取请求参数,参数重复时只取一个。 GET请求:获取 URL 参数。 POST请求:参数优先级:JSON参数 > FORM参数 > URL参数。
625941b929b78933be1e5538
def finishElement(self): <NEW_LINE> <INDENT> if len(self.__scopeStack) == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> lastScope = self.__activeScope <NEW_LINE> nextScope = self.__scopeStack.pop() <NEW_LINE> tmpPElist = [] <NEW_LINE> for element in self.__elementDict[lastScope]: <NEW_LINE> <INDENT> if isinstance(s...
The first scope on the stack is closed. The element is still addressable with the scopes identifier.
625941b9925a0f43d2549cf3
def _config_to_list(self, config): <NEW_LINE> <INDENT> whitelisted = [] <NEW_LINE> sensitive = [] <NEW_LINE> for group in config: <NEW_LINE> <INDENT> for option in config[group]: <NEW_LINE> <INDENT> the_list = (sensitive if self._is_sensitive(group, option) else whitelisted) <NEW_LINE> the_list.append({ 'group': group,...
Build whitelisted and sensitive lists for use by backend drivers.
625941b9a05bb46b383ec6ac
def surfTen(self): <NEW_LINE> <INDENT> st = self.AS.surface_tension() <NEW_LINE> try: <NEW_LINE> <INDENT> st_eng = st * 0.00571014709755764 <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> st_eng = st <NEW_LINE> <DEDENT> return st_eng
calculate surface tension, lbf / inch
625941b9167d2b6e31218a1c
def normalize( arr: xr.DataArray, dim: Hashable = 'f', method: str = 'root_mean_square' ) -> xr.DataArray: <NEW_LINE> <INDENT> if method == 'root_mean_square': <NEW_LINE> <INDENT> ss = np.sqrt((arr*arr).mean(dim=dim)) <NEW_LINE> res = arr / ss <NEW_LINE> <DEDENT> elif method == 'snv': <NEW_LINE> <INDENT> std = arr.std(...
Normalize spectra Normalized every spectrum contained in the dataarray. Args: arr: input array dim: array dimension that contains spectra, defaults to 'f' method: {'root_mean_square', 'snv', 'unit_variance'} Returns: array of same shape as input array but with normalized spectra
625941b9dc8b845886cb53b4
def move_squad_out(self, squad_num, direction): <NEW_LINE> <INDENT> f = self.field.get_adjacent(direction) <NEW_LINE> if f is not None: <NEW_LINE> <INDENT> f.queue.add(f, self.squads[squad_num]) <NEW_LINE> return True <NEW_LINE> <DEDENT> return False
Moves a squad to an adjacent's field's queue. Returns True if there is an adjacent field.
625941b9097d151d1a222cdb
def which(command, path=None, verbose=0, exts=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> absName, fromWhere = next(whichgen(command, path, verbose, exts)) <NEW_LINE> <DEDENT> except StopIteration: <NEW_LINE> <INDENT> raise WhichError("Could not find '%s' on the path." % command) <NEW_LINE> <DEDENT> if verbose:...
Return the full path to the first match of the given command on the path. "command" is a the name of the executable to search for. "path" is an optional alternate path list to search. The default it to use the PATH environment variable. "verbose", if true, will cause a 2-tuple to be returned. The second elemen...
625941b93617ad0b5ed67d7f
def process_view(self, request, view_func, view_args, view_kwargs): <NEW_LINE> <INDENT> if not view_func.__module__.startswith('django.contrib.admin.'): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if not request.user.is_authenticated: <NEW_LINE> <INDENT> login_url = ( settings.LOGIN_URL + '?' + urlencode({auth....
Forward unauthenticated requests to the admin page to the CAS login.
625941b9d6c5a10208143ec7
def main(args=None): <NEW_LINE> <INDENT> parser = get_parser() <NEW_LINE> args = parser.parse_args(args) <NEW_LINE> if args.meta_specfile: <NEW_LINE> <INDENT> metapackage = Metapackage( meta_name=args.meta_specfile, variables=args.variables) <NEW_LINE> print(metapackage.create_specfile()) <NEW_LINE> return <NEW_LINE> <...
Main CLI entry point.
625941b931939e2706e4ccef
def check_array(self, value, name): <NEW_LINE> <INDENT> pass
Check an array's value.
625941b91f5feb6acb0c49d4
def _hooked(self, parent_task): <NEW_LINE> <INDENT> self._parent_tasks.append(parent_task) <NEW_LINE> def unhook(*args): <NEW_LINE> <INDENT> self._parent_tasks.remove(parent_task) <NEW_LINE> parent_task._unhook_task(self) <NEW_LINE> <DEDENT> self.observer.register(unhook)
A task has hooked us
625941b976e4537e8c3514f7
def fetch_path_data(self, current_path, list_type="directories"): <NEW_LINE> <INDENT> directories = [] <NEW_LINE> files = [] <NEW_LINE> if list_type == "directories" or list_type == "all": <NEW_LINE> <INDENT> directories = self.fetch_directories(current_path) <NEW_LINE> <DEDENT> if list_type == "files" or list_type == ...
Returns an object filled with data pertaining to a particular path :param current_path: :param list_type: :return:
625941b97b25080760e392da
def create_hive_warehouse(self): <NEW_LINE> <INDENT> return self._cmd('hiveCreateHiveWarehouse')
Creates the Hive warehouse directory in HDFS :return: Reference to the submitted command. :since: API v3
625941b99b70327d1c4e0c53
def start_val_range(self): <NEW_LINE> <INDENT> user_choice_min = input("Please enter a whole number for the minimum for the start value: ") <NEW_LINE> while not (user_choice_min.isnumeric): <NEW_LINE> <INDENT> print("You've entered an invalid entry") <NEW_LINE> user_choice_min = input("Please enter a whole number for ...
(GameView, Tuple) -> Tuple of str
625941b9b545ff76a8913c9e
def _update_container_metrics(self, instance, subcontainer, kube_labels): <NEW_LINE> <INDENT> tags = list(instance.get('tags', [])) <NEW_LINE> if len(subcontainer.get('aliases', [])) >= 1: <NEW_LINE> <INDENT> container_name = subcontainer['aliases'][0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> container_name = subc...
Publish metrics for a subcontainer and handle filtering on tags
625941b924f1403a926009e9
def zpstr(val): <NEW_LINE> <INDENT> return unicode(val) if val is not None else None
Transfer value to string return string if right value
625941b97cff6e4e81117805
def set(self, value): <NEW_LINE> <INDENT> assert self._port_type == PortType.Output, "You can't set value of parameter in Connection " "object via this port in this unit because it's not output port" <NEW_LINE> self.value = value <NEW_LINE> self._linked_connection.value...
Задает хранимое в соединении значении
625941b95166f23b2e1a4fd9
def shaderFromFile(shaderType, shaderFile): <NEW_LINE> <INDENT> shaderSrc = '' <NEW_LINE> with open(shaderFile) as sf: <NEW_LINE> <INDENT> shaderSrc = sf.read() <NEW_LINE> <DEDENT> return shaders.compileShader(shaderSrc, shaderType)
create shader from file
625941b94e4d5625662d425c
def _populate_exp(self): <NEW_LINE> <INDENT> old_s = self._current_ob <NEW_LINE> if self.rng.rand() <= self.exploration or (len(self.mem) <= self.history_len): <NEW_LINE> <INDENT> act = self.rng.choice(range(self.num_actions)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> history = self.mem.recent_state() <NEW_LINE> hi...
populate a transition by epsilon-greedy
625941b9498bea3a759b9930
def test_datetime_str(): <NEW_LINE> <INDENT> date = datetime.datetime.now() <NEW_LINE> date_str = str(date) <NEW_LINE> new_date = get_date(date_str) <NEW_LINE> assert new_date == date
Test get a datetime object the string is a datetime str
625941b9f548e778e58cd3fc
def findWords(self, words): <NEW_LINE> <INDENT> s1 = {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'} <NEW_LINE> s2 = {'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'} <NEW_LINE> s3 = {'z', 'x', 'c', 'v', 'b', 'n', 'm'} <NEW_LINE> res = [] <NEW_LINE> for w in words: <NEW_LINE> <INDENT> if set(w.lower())-s1 == set() or se...
:type words: List[str] :rtype: List[str]
625941b963f4b57ef0000fa1
def optimisation(silo,choix): <NEW_LINE> <INDENT> if choix=="Prix min": <NEW_LINE> <INDENT> compt=4 <NEW_LINE> minmax="min" <NEW_LINE> <DEDENT> if choix=="Prix max": <NEW_LINE> <INDENT> compt=4 <NEW_LINE> minmax="max" <NEW_LINE> <DEDENT> if choix=="Diamètre min": <NEW_LINE> <INDENT> compt=1 <NEW_LINE> minmax="min" <NEW...
Programme qui choisi le silo optimal selon un critère précis
625941b95fc7496912cc3806
def __init__(self, traindata, labels, transform=train_tfms): <NEW_LINE> <INDENT> self.transform = transform <NEW_LINE> self.data = traindata <NEW_LINE> self.labels = labels
datapath: dicom data path
625941b90a366e3fb873e697
def getPoseState(self, noBake=False): <NEW_LINE> <INDENT> poseState = self.__currentAnim.getAtTime(self.__playTime, noBake) <NEW_LINE> if self.__inPlace: <NEW_LINE> <INDENT> poseState = poseState.copy() <NEW_LINE> poseState[:,:3,3] = np.zeros((poseState.shape[0],3), dtype=np.float32) <NEW_LINE> <DEDENT> return poseStat...
Get the pose matrices of the active animation at the current play time. Returned matrices are baked (they are skin matrices, relative to bone rest pose in object space) if the active animation is baked, otherwise they are plain pose matrices in local bone space.
625941b901c39578d7e74cc3
def make(self): <NEW_LINE> <INDENT> logging.debug('Doing domain %s' % (self.dt['name'], )) <NEW_LINE> st='' <NEW_LINE> st+=self.make_soa() <NEW_LINE> st+=self.make_toplevel() <NEW_LINE> st+=self.make_subzones() <NEW_LINE> st+='\n' <NEW_LINE> st+=self.make_hosts() <NEW_LINE> return(st)
! @param incserial If True then increment the serial number
625941b9046cf37aa974cbca
def expectation(self, operator): <NEW_LINE> <INDENT> if isinstance(operator, QubitOperator): <NEW_LINE> <INDENT> expectation_value = 0. <NEW_LINE> for qubit_term in operator: <NEW_LINE> <INDENT> expectation += qubit_term_expectation(self, qubit_term) <NEW_LINE> <DEDENT> <DEDENT> elif isinstance(operator, InteractionOpe...
Return expectation value of an InteractionRDM with an operator. Args: operator: A QubitOperator or InteractionOperator. Returns: float: Expectation value Raises: InteractionRDMError: Invalid operator provided.
625941b994891a1f4081b928
def __init__(self): <NEW_LINE> <INDENT> self.LogExpireDay = None <NEW_LINE> self.LogType = None <NEW_LINE> self.RequestId = None
:param LogExpireDay: 审计日志保存时长。目前支持的值包括:[0,30,180,365,1095,1825]。 注意:此字段可能返回 null,表示取不到有效值。 :type LogExpireDay: int :param LogType: 审计日志存储类型。目前支持的值包括:"storage" - 存储型。 :type LogType: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str ...
625941b96fece00bbac2d5bb
def createAsyncIOService(allow_epoll = True, allow_kqueue = True, allow_poll = True, allow_select = True): <NEW_LINE> <INDENT> pollerClassesToTry = [] <NEW_LINE> if allow_epoll: <NEW_LINE> <INDENT> pollerClassesToTry.append(_EPollPoller) <NEW_LINE> <DEDENT> if allow_kqueue: <NEW_LINE> <INDENT> pollerClassesToTry.append...
Create an AsyncIOService supported by the platform and parameters.
625941b9c4546d3d9de728b1
def read_comments(self, df, data_f): <NEW_LINE> <INDENT> start = self.config_obj.start <NEW_LINE> end = self.config_obj.end <NEW_LINE> modified = self.config_obj.modified <NEW_LINE> if df is None: <NEW_LINE> <INDENT> name = self.util_obj.get_comments_filename(modified) <NEW_LINE> filename = data_f + name <NEW_LINE> if ...
Reads the comments if the dataframe is empty. df: comments dataframe. data_f: data folder. Returns the coments dataframe.
625941b930dc7b76659017ea
def SetFont(self, *args, **kwargs): <NEW_LINE> <INDENT> wx.TextCtrl.SetFont(self, *args, **kwargs) <NEW_LINE> if self._autofit: <NEW_LINE> <INDENT> self.SetClientSize(self._CalcSize()) <NEW_LINE> width = self.GetSize().width <NEW_LINE> height = self.GetBestSize().height <NEW_LINE> self.SetInitialSize((width, height))
Set the font, then recalculate control size, if appropriate. see :meth:`TextCtrl.SetFont` for valid arguements
625941b9dd821e528d63b02b
@ResponderRegistrar.responder('rebaser', MergeRequestActions.COMMENTED) <NEW_LINE> def apply_command_on_merge_request( pr: MergeRequest, comment: Comment, enable_rebase: bool=False, enable_merge: bool=False, enable_fastforward: bool=False, merge_admin_only: bool=True, fastforward_admin_only: bool=True, ): <NEW_LINE> <I...
Performs a merge, fastforward or rebase of a merge request when an authorized user posts a command mentioning the keywords ``merge``, ``fastforward``/``ff`` or ``rebase`` respectively. e.g. ``@gitmate-bot rebase`` rebases the pull request with master.
625941b96fb2d068a760ef21
def test_remove_existing_classifiers(tmpdir): <NEW_LINE> <INDENT> test_file = setup_local_copy("sample_files/sample_setup_file.py", tmpdir) <NEW_LINE> setup_file_modernizer = SetupFileModernizer() <NEW_LINE> file_data = open(test_file).read() <NEW_LINE> updated_file_data = setup_file_modernizer._remove_outdated_classif...
Test the case where old classifiers are removed
625941b9cc40096d615957d3
@task <NEW_LINE> def resync(): <NEW_LINE> <INDENT> sudo("service ntp stop") <NEW_LINE> sudo("ntpdate -B ntp.ubuntu.com") <NEW_LINE> sudo("service ntp start")
Forcibly resynchronise the VM's NTP clock. If a VM's clock manages to get sufficiently out of sync, ntp will give up, forcing a manual intervention.
625941b9b7558d58953c4d9b
def char_read(self, uuid): <NEW_LINE> <INDENT> raise NotImplementedError()
Reads a Characteristic by UUID. uuid -- UUID of Characteristic to read as a string. Returns a bytearray containing the characteristic value on success. Example: my_ble_device.char_read('a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b')
625941b93c8af77a43ae361d
def test_35_to_string(self): <NEW_LINE> <INDENT> ctx = CryptContext(**self.sample_1_dict) <NEW_LINE> dump = ctx.to_string() <NEW_LINE> import sys <NEW_LINE> if sys.version_info >= (2,7): <NEW_LINE> <INDENT> self.assertEqual(dump, self.sample_1_unicode) <NEW_LINE> <DEDENT> ctx2 = CryptContext.from_string(dump) <NEW_LINE...
test to_string() method
625941b97047854f462a128d
def yaml_dumps( data: YAMLInput, indent_mapping: int = 2, indent_sequence: int = 4, indent_offset: int = 2, sort_keys: bool = False, ) -> str: <NEW_LINE> <INDENT> yaml = CustomYaml() <NEW_LINE> yaml.sort_base_mapping_type_on_output = sort_keys <NEW_LINE> yaml.indent(mapping=indent_mapping, sequence=indent_sequence, off...
Serialize an object to a YAML string. See the ruamel.yaml docs on indentation for more details on the expected format. https://yaml.readthedocs.io/en/latest/detail.html?highlight=indentation#indentation-of-block-sequences data: The YAML-serializable data. indent_mapping (int): Mapping indentation. indent_sequence (int...
625941b9a79ad161976cbfc6
def forced_checkout_of_dir_with_file_obstructions(sbox): <NEW_LINE> <INDENT> make_local_tree(sbox, False, False) <NEW_LINE> url = sbox.repo_url <NEW_LINE> wc_dir_other = sbox.add_wc_path('other') <NEW_LINE> other_A = os.path.join(wc_dir_other, 'A') <NEW_LINE> os.makedirs(wc_dir_other) <NEW_LINE> svntest.main.file_write...
forced co flags conflict if a file obstructs a dir
625941b9498bea3a759b9931
def contain_each_other(self, names): <NEW_LINE> <INDENT> if not isinstance(names, list): names = list(names) <NEW_LINE> if len(names) <= 1: return <NEW_LINE> root = names.pop() <NEW_LINE> if root not in self.subvars: <NEW_LINE> <INDENT> self.subvars[root] = set() <NEW_LINE> <DEDENT> self.subvars[root].update(names) <NE...
Update the state, such that the specified variables all contain each other
625941b90a50d4780f666d0f