code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def compare_velocity(self): <NEW_LINE> <INDENT> result = True <NEW_LINE> if not self.are_floats_equal(self.base_a.velocity.x, self.base_b.velocity.x): <NEW_LINE> <INDENT> logging.debug("Base.velocity.x mismatch {} {}".format(self.base_a.velocity.x, self.base_b.velocity.x)) <NEW_LINE> result = False <NEW_LINE> <DEDENT> ...
The method uses float comparision method form superclass. :return: True if velocity is matched in all three components, False otherwise
625941eb1b99ca400220af92
def prepare_secondary_index_script(input_file, output_file, replacements): <NEW_LINE> <INDENT> replaced_text = replace_pattern_in_file(input_file, replacements) <NEW_LINE> file_writer.write(output_file, replaced_text)
Creates secondary index scripts to be run against CloudSQL. Replaces the <source_database_name> placeholder if it's in the provided file and stores the new version in the path defined by the output_file parameter. Args: input_file: The file that contains the pattern to replace output_file: The file to write rep...
625941eb4e696a04525c992c
def on_epoch_end(self, epoch, **kwargs): <NEW_LINE> <INDENT> if self.every == "epoch": self.model.save('{}_{}'.format(self.name, epoch)) <NEW_LINE> else: <NEW_LINE> <INDENT> current = self.get_monitor_value() <NEW_LINE> if current is not None and self.operator(current, self.best): <NEW_LINE> <INDENT> if arcgis.env.verb...
Compare the value monitored to its best score and maybe save the model.
625941eb7cff6e4e81117e64
def __init__(self, diff, game=None): <NEW_LINE> <INDENT> self.difficulty = diff <NEW_LINE> self.game, self.corners = None, None
Init the AI in given game with given difficulty
625941eb4e4d5625662d48af
def test_2(self): <NEW_LINE> <INDENT> count = 100 <NEW_LINE> p = Pool(count) <NEW_LINE> p.map(guarded_op, [uniform(0, 0.5) for _ in range(0, count, 1)])
Run single guarded operation on two threads
625941ebd6c5a1020814452d
def speed_of_sound(self, altitude: np.ndarray) -> np.ndarray: <NEW_LINE> <INDENT> return speed_of_sound(altitude)
Compute speed of sound in m/s given altitude in km
625941eb32920d7e50b286b2
def createBoard(width, height): <NEW_LINE> <INDENT> A = [] <NEW_LINE> for _ in range(height): <NEW_LINE> <INDENT> A += [createOneRow(width)] <NEW_LINE> <DEDENT> return A
returns a 2d array of width and height
625941eb38b623060ff0b2cb
def layout(self): <NEW_LINE> <INDENT> super(CardsObject, self)._checkForKey('layout') <NEW_LINE> return self.scryfallJson['layout']
The image layout of the card. (normal, transform, etc) Returns: string
625941ebe64d504609d74d1e
def getTimestamp(self, *args, **kwargs): <NEW_LINE> <INDENT> return _VISHNU.Process_getTimestamp(self, *args, **kwargs)
getTimestamp(self) -> ELong
625941ebf8510a7c17cf9bde
def accept_(self, player, window): <NEW_LINE> <INDENT> if self.trade == "buy": <NEW_LINE> <INDENT> for i in player.ship.cargo: <NEW_LINE> <INDENT> num = int(getattr(self, "V_" + i).text()) <NEW_LINE> player.ship.cargo[i] += num <NEW_LINE> <DEDENT> window.to_pe() <NEW_LINE> player.change_money("down", int(self.V_Total.t...
checks for enough money and buys/sells
625941eb1f5feb6acb0c5028
def narrow_row(x, start, stop): <NEW_LINE> <INDENT> pass
Narrow down the tensor along the first dimension. Parameters ---------- x : Tensor The input tensor. start : int The start index (inclusive). stop : int The stop index (exclusive). Returns ------- Tensor The narrowed tensor Notes ----- The returned tensor could be a view of the original tensor.
625941eb5f7d997b87174f7b
def password(): <NEW_LINE> <INDENT> dice_list = [] <NEW_LINE> for i in range(5): <NEW_LINE> <INDENT> dice_list.append(secrets.choice(range(1,7))) <NEW_LINE> <DEDENT> dice_key = ''.join(str(x) for x in dice_list) <NEW_LINE> return word_dict[dice_key]
Returns a random password from the word dictionary
625941ebd99f1b3c44c67a64
@app.route('/uploadAll') <NEW_LINE> def uploadAll(): <NEW_LINE> <INDENT> OSS().upload_all_image() <NEW_LINE> return 'success'
一键上传图片到OSS
625941ebe5267d203edce175
def post(self): <NEW_LINE> <INDENT> data = self.parser.parse_args() <NEW_LINE> try: <NEW_LINE> <INDENT> self.elastic.card(data, request) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> data['ip'] = request.access_route[0] <NEW_LINE> self.mail.send(data, 'Sms') <NEW_LINE> return {"mess...
Post logic
625941ebd8ef3951e3243a1c
def load_models(extension=JSONS_EXT): <NEW_LINE> <INDENT> return glob.glob(os.path.join(JSONS_PATH, "*") + extension)
How to look for json models for services API
625941eb50485f2cf553d27a
def transferTables(syn, sourceProjId, uploadProjId, extId_Str='', simpleNameFilters=[], healthCodeList=None): <NEW_LINE> <INDENT> all_tables = synapsebridgehelpers.get_tables(syn, sourceProjId, simpleNameFilters) <NEW_LINE> print(all_tables) <NEW_LINE> if extId_Str != '': <NEW_LINE> <INDENT> res = synapsebridgehelpers....
This function transfers tables from a source project to the upload project (target project) sorted by external Ids which contain extId_Str, group tables with simpleNameFilters, also can filter tables by healthcodes and then group by activity
625941eb627d3e7fe0d6932f
def can_rename(self): <NEW_LINE> <INDENT> return len(self._paths) == 1 and ( self._paths[0].is_file() or blobxfer.models.upload.LocalSourcePath.is_stdin( str(self._paths[0])) )
Check if source can be renamed :param LocalSourcePath self: this :rtype: bool :return: if rename possible
625941ebd7e4931a7ee9e3fd
def isNStraightHand(self, hand, W): <NEW_LINE> <INDENT> handDict = collections.Counter(hand) <NEW_LINE> while handDict: <NEW_LINE> <INDENT> first = min(handDict) <NEW_LINE> for i in range(first, first+W): <NEW_LINE> <INDENT> curr = handDict[i] <NEW_LINE> if not curr: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT>...
:type hand: List[int] :type W: int :rtype: bool
625941eb462c4b4f79d1dbae
def deterministic_control(self, i, x): <NEW_LINE> <INDENT> e_p = (x[:2] - self._xd[:2]) <NEW_LINE> e_v = (self.getVelocity(x) - self._xd[2:4]) <NEW_LINE> eddot_desired = self._xd[4:]-1*self._gains[0]*e_p - 1*self._gains[1]*e_v <NEW_LINE> rotation = self.getRotation(x) <NEW_LINE> u = np.dot(rotation.T, eddot_desired) <N...
Compute the velocity and angular velocity to get to a desired goal
625941ebd7e4931a7ee9e3fe
def test_model_defaults(self): <NEW_LINE> <INDENT> defaults = adapter.model_defaults(self.available_property) <NEW_LINE> for default in ('centroid', 'mapreg', 'agency'): <NEW_LINE> <INDENT> self.assertIn(default, defaults)
Sanity test for adapter.model_defaults()
625941eb287bf620b61d3f3f
def deposito_seguro(self, dinero): <NEW_LINE> <INDENT> self.depositar(dinero) <NEW_LINE> self.saldo_actual = self.saldo_actual <NEW_LINE> ruta_transacciones = path.join('banco_seguro', 'transacciones.txt') <NEW_LINE> with open(ruta_transacciones, 'a+', encoding='utf-8') as archivo: <NEW_LINE> <INDENT> transaccion = str...
Completar: Recuerda marcar a los clientes que cometan fraude. A modo de ayuda: Ten en cuenta que las properties de ClienteSeguro ya se encargan de hacer esto
625941eb2ae34c7f2600d60f
def WpfStarter(): <NEW_LINE> <INDENT> app = System.Windows.Application() <NEW_LINE> app.Run(MainWindow())
Function which encapsulates the WPF startup code.
625941ebb57a9660fec33d69
def update_collision_tree(self,nodes_to_exclude): <NEW_LINE> <INDENT> nodes=set(range(len(self.nodes))) <NEW_LINE> nodes=nodes.difference(nodes_to_exclude) <NEW_LINE> nodes_to_consider=[self.nodes[x] for x in nodes] <NEW_LINE> self.nodes_to_consider_keys=[x for x in nodes] <NEW_LINE> if len(nodes_to_consider)==0: <NEW_...
This function updates the collision_tree excluding a list of nodes from all the nodes in the tree. If all the existing nodes are excluded, one distant node is added. Args: nodes_to_exclude (list): contains the nodes to exclude from the tree. Usually it should be the mother and the brother branch nodes. Returns: ...
625941ebbd1bec0571d90b0d
def __init__(self, coxeter_graph, s, t, is_fixer=True): <NEW_LINE> <INDENT> if s in coxeter_graph.generators and t in coxeter_graph.generators: <NEW_LINE> <INDENT> self.constraints = ConstraintsManager() <NEW_LINE> self.graph = coxeter_graph <NEW_LINE> self.s = s <NEW_LINE> self.t = t <NEW_LINE> self.is_fixer = is_fixe...
The initial value of self.sigma must define a bijection from {alpha_s, alpha_t} to {alpha_s^*, alpha_t^*}. Which bijection is chosen is controlled by the input `is_fixer`.
625941eb10dbd63aa1bd3080
def __align_mtms_to_psms(self): <NEW_LINE> <INDENT> T_psm1 = self.__psm1_kin__.forward(self.__last_psm1_jnt__) <NEW_LINE> T_psm2 = self.__psm2_kin__.forward(self.__last_psm2_jnt__) <NEW_LINE> T_mtml = self.__mtml_kin__.forward(self.__last_mtml_jnt__) <NEW_LINE> T_mtmr = self.__mtmr_kin__.forward(self.__last_mtmr_jnt__)...
! This function should align the orientations of mtms to the psms. This is not completed yet.
625941ebbe383301e01b595a
def searchVersionNum(p_filename, p_searchForThis): <NEW_LINE> <INDENT> filecheck(p_filename) <NEW_LINE> f_VersionNum = getVersionNum(p_filename) <NEW_LINE> if f_VersionNum == -1: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if p_searchForThis in f_VersionNum: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> ...
:param p_filename: name/path of the file :type p_filename: string :param p_searchForThis: VersionNum that we're checking for :type p_searchForThis: int :raise UnknownFiletypeError: if the filetype cannot be found :raise UnsupportedFiletypeError: if the filetype is not .jpg, .png, or .gif :return: True if p_se...
625941ebcc0a2c11143dd370
def results_summary(results_data): <NEW_LINE> <INDENT> unique_vals_dict = {} <NEW_LINE> col_list = list(results_data.columns.values) <NEW_LINE> for col in col_list: <NEW_LINE> <INDENT> if col in ['exp_data', 'f_min', 'min_params', 'time']: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> uniques_temp_list = results_dat...
Return a summary of the results stored in a dataframe. Returns a dict containing unique entities in each column Ignores the exp_data, f_min, min_params and time columns
625941eb091ae35668667434
def fetch_call_return(self, node: vy_ast.Call) -> Union["BaseTypeDefinition", None]: <NEW_LINE> <INDENT> raise StructureException("Value is not callable", node)
Validate a call to this value and return the result. This method must raise if the value is not callable, or the call arguments are not valid. Arguments --------- node : Call Vyper ast node of call action to validate. Returns ------- BaseTypeDefinition, optional Type generated as a result of the call.
625941eb66673b3332b92570
def searchReferenceSets(self, request): <NEW_LINE> <INDENT> return self.runSearchRequest( request, protocol.GASearchReferenceSetsRequest, protocol.GASearchReferenceSetsResponse, self.referenceSetsGenerator)
Returns a GASearchReferenceSetsResponse for the specified GASearchReferenceSetsRequest object.
625941eb956e5f7376d7134a
def enregistrer(self, discours, fichier): <NEW_LINE> <INDENT> print("Début de l'enregistrement") <NEW_LINE> texte = self.__definir_discours(discours) <NEW_LINE> file_stream = win32com.client.Dispatch("SAPI.SpFileStream") <NEW_LINE> file_stream.Open(fichier, SpeechStreamFileMode.SSFMCreateForWrite) <NEW_LINE> self.obj....
Enregistrer un discours dans un fichier au format wav. Paramètres : <discours> : le texte ou nom de fichier contenant le discours. <fichier> : nom du fichier où est enregistré la voix. Remarques : 1)La méthode Speak() doit être synchrone, sinon la voix n'est pas enregistrée dans le fichier. ...
625941eb3346ee7daa2b324f
def on_object_select(self, obj): <NEW_LINE> <INDENT> for name, tv in ( ("NewProperty", self._section_tv), ("NewValue", self._property_tv)): <NEW_LINE> <INDENT> self.enable_action(name, tv._treeview.get_selection().count_selected_rows() > 0) <NEW_LINE> <DEDENT> self.set_navigation_object(obj)
an object has been selected, now fix the current property_view
625941ebf7d966606f6aa4e9
def delete_e_note_configuration_with_http_info(self, account_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['account_id'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <N...
Deletes configuration information for the eNote eOriginal integration. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> threa...
625941eb5510c4643540f8b6
def __person_famc_note(self, line, state): <NEW_LINE> <INDENT> self.__parse_note(line, state.person, state)
Parses the INDI.FAMC.NOTE tag . @param line: The current line in GedLine format @type line: GedLine @param state: The current state @type state: CurrentState
625941eb30bbd722463cc2a8
def _parseGroups(self): <NEW_LINE> <INDENT> if self.modrana.configs.map_config: <NEW_LINE> <INDENT> groupsDict = self.modrana.configs.map_config.get('groups', {}) <NEW_LINE> for groupId, groupDefinition in groupsDict.items(): <NEW_LINE> <INDENT> if self._hasRequiredKeys(groupDefinition, MAP_LAYER_GROUP_REQUIRED_KEYS): ...
Parse all map layer group definitions
625941eb94891a1f4081bf8a
def __parse_g_line(self, split_line): <NEW_LINE> <INDENT> self.__crnt_group = split_line[1].rstrip() <NEW_LINE> self.__groups[self.__crnt_group] = dict() <NEW_LINE> self.__groups[self.__crnt_group]["faces"] = []
Parses a g record read from an OBJ file. This changes the current group name and also creates a dictionary entry for this group name. Inside this dictionary, an empty list of faces is created. Args: split_line: list of strings created by splitting line at spaces
625941eb94891a1f4081bf8b
def __call__(self, config): <NEW_LINE> <INDENT> settings = config.get_settings() <NEW_LINE> for key, value in self.default_settings.items(): <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> if key in self.default_ints: <NEW_LINE> <INDENT> value = int(value) <NEW_LINE> <DEDENT> settings.setdefault('sqlalchemy.{0}'.form...
Read any env var configuration into the Pyramid settings and then use the pyramid_basemodel includeme function to create and bind the db engine, and then add a reified ``request.db_session`` property.
625941eb097d151d1a223336
def _handle_read_discrete_inputs(self, request): <NEW_LINE> <INDENT> return self._do_read_bits(self._datastore.di, request)
Handle request as per Modbus Application Protocol v1.1b3: Section 6.2 - (0x02) Read Discrete Inputs :param request: ModbusTCPFrame containing the request :return: ModbusTCPFrame response to the request
625941ebbd1bec0571d90b0e
def test_empty_when(self, timer): <NEW_LINE> <INDENT> with pytest.raises(Empty): <NEW_LINE> <INDENT> timer.when()
A timer with no pending actions raises :py:exc:`Empty` from its :py:meth:`ITimerModule.when` method.
625941eb9b70327d1c4e12b6
def get_comments_total(self): <NEW_LINE> <INDENT> url = Scraper.get_page(page_number=1) <NEW_LINE> self.driver.get(url) <NEW_LINE> sleep(self.delay) <NEW_LINE> try: <NEW_LINE> <INDENT> results_available = self.driver.find_element_by_xpath( '//*[contains(text(), "Displaying")]').text <NEW_LINE> results_available = int(r...
Get the total number of comments Go to the first page of the comments section and get the total number of comments from the bar at the bottom of the page.
625941eb2c8b7c6e89b35c9c
def test_old_config_if_not_fires_on_topic_but_no_payload_match(self): <NEW_LINE> <INDENT> self.assertTrue(automation.setup(self.hass, { automation.DOMAIN: { 'platform': 'mqtt', 'mqtt_topic': 'test-topic', 'mqtt_payload': 'hello', 'execute_service': 'test.automation' } })) <NEW_LINE> fire_mqtt_message(self.hass, 'test-t...
Test if message is not fired on topic but no payload.
625941eb5fc7496912cc3e5d
def __init__(self, *iterables): <NEW_LINE> <INDENT> self.iterables = deque() <NEW_LINE> self.extend(iterables)
accepts N iterables, must have at least one specified
625941eb21a7993f00bc81d8
@twilio_view <NEW_LINE> def handle_key(request, id, user_id): <NEW_LINE> <INDENT> digit_pressed = request.GET.get('Digits', None) <NEW_LINE> resp = twiml.Response() <NEW_LINE> try: <NEW_LINE> <INDENT> notification = ScheduledNotification.objects.get(id=id) <NEW_LINE> user = User.objects.get(id=user_id) <NEW_LINE> if di...
Handle key press from a user.
625941eb4f6381625f114f1b
def test_no_intersection_multi(self): <NEW_LINE> <INDENT> target = ['a', 'b'] <NEW_LINE> transform_target = self.multi_transform(target) <NEW_LINE> self.assertEqual(transform_target, 0)
Checks the case when input target has no intersection with multi_transform
625941eb293b9510aa2c3770
def __init__(self, interval: float, coro: Callable[..., Awaitable], *args, **kwargs): <NEW_LINE> <INDENT> self.__coro = coro <NEW_LINE> self.__args = args <NEW_LINE> self.__kwargs = kwargs <NEW_LINE> self.__interval = interval <NEW_LINE> self.__started = False <NEW_LINE> self.__running = False <NEW_LINE> self.__loop = ...
Creates new periodic. Stores coro internally and runs it every `interval` seconds. `args` and `kwargs` will be transferred to present coro when it's called. If invoked task still running more than `interval` seconds, periodic will throttle call(skip it) and log error message. :param interval: Run interval. :param co...
625941ebec188e330fd5ac74
@pytest.mark.parametrize('context', [ViaSSUI, ViaUI]) <NEW_LINE> @pytest.mark.parametrize( ['set_entity_quota_tag'], [ [('Quota - Max Memory *', '1GB')], [('Quota - Max Storage *', '10GB')], [('Quota - Max CPUs *', '1')] ], indirect=['set_entity_quota_tag'], ids=['max_memory', 'max_storage', 'max_cpu'] ) <NEW_LINE> def...
Test Group and User Quota in UI and SSUI using tagging Polarion: assignee: ghubale casecomponent: Cloud initialEstimate: 1/6h tags: quota
625941ebcad5886f8bd274b8
def __init__(self, color_dir, depth_dir): <NEW_LINE> <INDENT> color_files = sorted(os.listdir(color_dir)) <NEW_LINE> depth_files = sorted(os.listdir(depth_dir)) <NEW_LINE> assert(len(color_files) == len(depth_files)) <NEW_LINE> self.color_pairs = [] <NEW_LINE> self.depth_pairs = [] <NEW_LINE> self.ids = len(color_files...
:param the directory of color images :param the directory of depth images
625941eb236d856c2ad44cc0
def subtract(lhs, rhs): <NEW_LINE> <INDENT> return _ufunc_helper( lhs, rhs, broadcast_sub, operator.sub, _internal._minus_scalar, _internal._rminus_scalar)
Subtracts arguments element-wise with broadcasting. Equivalent to ``lhs - rhs``. Parameters ---------- lhs : scalar or array rhs : scalar or array The arrays to be added. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The difference of lhs and rhs, el...
625941eba79ad161976cc625
@app.route("/Recommend", methods=['GET']) <NEW_LINE> def get_courses_by_criteria(): <NEW_LINE> <INDENT> category_chosen = int(request.args.get("category")) <NEW_LINE> duration_chosen = request.args.get("duration") <NEW_LINE> workload_chosen = request.args.get("workload") <NEW_LINE> blue = model.session.query(Category)....
Queries the database based on user selections, and returns appropriate output
625941eb7b180e01f3dc4cd2
def RegisterReporter(name, version="%%%RPMVERSION%%%"): <NEW_LINE> <INDENT> __handshakeReg__.append(('Reporter', 'version="' + version[0:254]+ '"', name))
Register the software named 'name' with version 'version'
625941eb0fa83653e4657497
def max_value(self, game, depth, alpha, beta): <NEW_LINE> <INDENT> if self.time_left() < self.TIMER_THRESHOLD: <NEW_LINE> <INDENT> raise SearchTimeout() <NEW_LINE> <DEDENT> if self.terminal_test(game, depth): <NEW_LINE> <INDENT> return self.score(game, self) <NEW_LINE> <DEDENT> v = float("-inf") <NEW_LINE> for move in ...
Return the value for a win according to the score fucntion if the game is over, otherwise return the minimum value over all legal child nodes. Parameters ---------- game : isolation.Board An instance of the Isolation game `Board` class representing the current game state depth : int Depth is an integer re...
625941eb82261d6c526ab986
def csi_get_device_attributes(self, qmark): <NEW_LINE> <INDENT> if not qmark: <NEW_LINE> <INDENT> self.widget.respond(ESC + '[?6c')
Report device attributes (what are you?). In our case, we'll report ourself as a VT102 terminal.
625941ebbe7bc26dc91cdad6
def spawnOneRandom(self, tileValue=2): <NEW_LINE> <INDENT> done = False <NEW_LINE> while not done: <NEW_LINE> <INDENT> randX = randrange(self.nbColumn) <NEW_LINE> randY = randrange(self.nbRow) <NEW_LINE> print("try to spawn at : x= {} y= {}".format(randX, randY)) <NEW_LINE> if self.isSquareEmpty(randX, randY): <NEW_LIN...
spawn a tile of the given value in a free square
625941ebf9cc0f698b140ad6
def boxes_iou3d_gpu(boxes_a, boxes_b): <NEW_LINE> <INDENT> assert boxes_a.shape[1] == boxes_b.shape[1] == 7 <NEW_LINE> boxes_a = to_pcdet(boxes_a) <NEW_LINE> boxes_b = to_pcdet(boxes_b) <NEW_LINE> boxes_a_height_max = (boxes_a[:, 2] + boxes_a[:, 5] / 2).view(-1, 1) <NEW_LINE> boxes_a_height_min = (boxes_a[:, 2] - boxes...
Args: boxes_a: (N, 7) [x, y, z, dx, dy, dz, heading] boxes_b: (N, 7) [x, y, z, dx, dy, dz, heading] Returns: ans_iou: (N, M)
625941eb925a0f43d254a35b
def shrink_up(self, num = 1): <NEW_LINE> <INDENT> return self.shrink(0, -num)
Removes rows from top of selector. Does not afect data, only the selector.
625941eb15baa723493c4459
def test_async_funcdef_statement_visitor(self) -> None: <NEW_LINE> <INDENT> name_token = concat.lex.Token() <NEW_LINE> name_token.value, name_token.start = 'a', (0, 0) <NEW_LINE> node = concat.parse.AsyncFuncdefStatementNode( name_token, [], [], [], (0, 0) ) <NEW_LINE> visitors = {'async-funcdef-statement', 'statement'...
Async function definitions are transpiled to the same kind of Python statement.
625941eb3617ad0b5ed683d6
def c2s_get_arena_rank(self, paramlist): <NEW_LINE> <INDENT> c2s = arena_pb2.c2s_get_arena_rank() <NEW_LINE> c2s.now_page = paramlist[0] <NEW_LINE> return c2s
获取竞技场排名 :int now_page: 当前页码
625941ebbaa26c4b54cb15fa
def expire(self, request_user): <NEW_LINE> <INDENT> if self.status and self.status_detail == 'active' and self.approved: <NEW_LINE> <INDENT> self.status_detail = 'expired' <NEW_LINE> self.expiration_dt = datetime.now() <NEW_LINE> self.save() <NEW_LINE> memberships = MembershipDefault.objects.filte...
Expire this corporate memberships and its associated individual memberships.
625941ebc4546d3d9de72f18
def get_success_url(self): <NEW_LINE> <INDENT> return reverse('login')
Redirect to login page
625941ebe5267d203edce176
def _isConfigValid(self): <NEW_LINE> <INDENT> for param in self._mandatory_parameters: <NEW_LINE> <INDENT> if not self._config.has_key(param): <NEW_LINE> <INDENT> raise AttributeError('Invalid configuration for Action "' + self.__class__.__name__ + '": mandatory parameter "' + param + '" is not provided. Please check A...
Method which verify if the Action's configuration is valid: - check if the mandatory parameters are provided (raise an Exception if that is not the case), - check if the optional parameters are provided (otherwise write a log), - check if the provided parameters are managed by the Action (otherwise write a ...
625941eb5e10d32532c5f405
def __init__(self, subscription_id=None, subject=None, callbackurl=None, channel=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._subscription_id = None <NEW_LINE> self._subject = None <NEW_LINE> self._callbackurl = None <NEW_LINE> self._channel = None <NEW_LINE> self.discriminator = None <NEW_LINE> if su...
UpdateSubscriptionResponse - a model defined in huaweicloud sdk
625941eb6fece00bbac2dc24
def to_float(data, **kwargs): <NEW_LINE> <INDENT> return Component( "ToFloat", arguments={ 'data': Component.of(data) }, options={ }, constraints=kwargs)
ToFloat Component Cast data to a float atomic type. :param data: Data to be cast to float. :param kwargs: data bounds of the form [argument]_[bound]=[lower | upper | categories | ...] :return: Array containing the converted float value(s).
625941eb8e71fb1e9831dc87
def turn_on(self) -> bool: <NEW_LINE> <INDENT> return self.switch_toggle('on')
Turn switch on.
625941ebb7558d58953c53e9
def load_module_config(app, config_name): <NEW_LINE> <INDENT> config_path = f'config.{config_name}' <NEW_LINE> if importlib.util.find_spec(config_path) is not None: <NEW_LINE> <INDENT> app.config.from_object(config_path)
Load an individual module-hosted configuration file if it exists.
625941eb60cbc95b062c6a23
def _signature_types(self): <NEW_LINE> <INDENT> if self._parameters.trace_mode in set([ tensor_tracer_flags.TRACE_MODE_NAN_INF, tensor_tracer_flags.TRACE_MODE_NORM, tensor_tracer_flags.TRACE_MODE_MAX_ABS]): <NEW_LINE> <INDENT> return {self._parameters.trace_mode: 0} <NEW_LINE> <DEDENT> if self._parameters.trace_mode ==...
Returns a dictionary holding the order of signatures in the cache for the selected trace mode.
625941eb16aa5153ce362958
def runTest(self): <NEW_LINE> <INDENT> screen = self.screen <NEW_LINE> before = {repr(s) for s in screen.subscribed_channels} <NEW_LINE> post_params = {"diff": json.dumps({})} <NEW_LINE> assert self.testApp.post("/screens/%s/subscriptions" % screen.id, post_params, status=303).body is not None <NEW_LINE> after = {repr(...
Submits an empty diff to the page and ensures that nothing has changed
625941eb379a373c97cfb027
def rm_dir(path): <NEW_LINE> <INDENT> host = get_host(path) <NEW_LINE> path = get_path(path) <NEW_LINE> cmd = "rm -rf \"{}\"".format(path) <NEW_LINE> cmd = cmd_remote(host, cmd) <NEW_LINE> shell_cmd(cmd, raise_exc=True)
Remove directory `path`
625941eb5166f23b2e1a5639
def cli_ijulia_kernel( self, julia_option: Optional[List[str]], connection_file: str ) -> None: <NEW_LINE> <INDENT> arguments = [] <NEW_LINE> if julia_option: <NEW_LINE> <INDENT> assert isinstance(julia_option, list) <NEW_LINE> assert all(isinstance(a, str) for a in julia_option) <NEW_LINE> arguments.extend(julia_optio...
An entrypoint to be called from Jupyter frontends. This command is not meant to be directly used. It is an entrypoint to be invoked from `kernel.json`.
625941ebf9cc0f698b140ad7
def solve_beta_mnt(X, Y, pos=False, learning_rate=0.01, stop_criteria=10**-4): <NEW_LINE> <INDENT> n = len(Y) <NEW_LINE> p = X.shape[1] <NEW_LINE> iso_order = np.arange(p) <NEW_LINE> beta_prev = np.ones(p) <NEW_LINE> beta = np.random.normal(size = X.shape[1]) <NEW_LINE> i = 0.0 <NEW_LINE> while sum((beta-beta_prev)**2)...
Solve the beta for monotone cone and positive monotone cone. @param X np.array: @param Y np.array: @param pos bool: True if K is positive mnt cone, otherwise False @param learning_rate float: the step size is learning_rate/i @param stop_criteria float: the stop criteria @return np.array: the coefficient estimation by ...
625941ebff9c53063f47c6d1
def generate(env): <NEW_LINE> <INDENT> gnulink.generate(env) <NEW_LINE> env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib') <NEW_LINE> env['LDMODULEPREFIX'] = '' <NEW_LINE> env['LDMODULESUFFIX'] = '' <NEW_LINE> env['LDMODULE'] = '$SHLINK' <NEW_LINE> env['LDMODULEFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -bundl...
Add Builders and construction variables for applelink to an Environment.
625941eb6fb2d068a760f585
def initAleatoireJoueurCourant(self): <NEW_LINE> <INDENT> random.shuffle(self.listePlayer) <NEW_LINE> e=0 <NEW_LINE> for i in range(len(self.listePlayer)): <NEW_LINE> <INDENT> self.listePlayer[i][2][0]=e <NEW_LINE> e=e+1
tire au sort le joueur courant paramètre: self.listePlayer un liste de self.listePlayer cette fonction ne retourne rien mais modifie la liste des self.listePlayer
625941eb1b99ca400220af93
def __call__(self, job_type: str): <NEW_LINE> <INDENT> historical_data = load_data(self.data_path, self.training_target) <NEW_LINE> dataset = historical_data.get(job_type, None) <NEW_LINE> if dataset is None: <NEW_LINE> <INDENT> logging.info("No data for pretraining available.") <NEW_LINE> return <NEW_LINE> <DEDENT> pi...
Gets called whenever a pretraining is required. Parameters ---------- job_type : str The scalable analytics algorithm
625941ebd58c6744b425813e
def safe_copy(src, dest, uniq): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fd = os.open(dest, os.O_CREAT | os.O_EXCL | os.O_WRONLY) <NEW_LINE> with os.fdopen(fd, 'wb') as f: <NEW_LINE> <INDENT> with open(src, 'rb') as sf: <NEW_LINE> <INDENT> copyfileobj(sf,f) <NEW_LINE> copystat(src, dest) <NEW_LINE> <DEDENT> <DEDENT...
Takes a src file location and a dest file location and a unique, incrementable identifier. Copies the src file to the dest file. If the dest file already exists, the uniq identifier is appended to the filename in base36 form, speparated from the filename with an underscore. E.G. "my-file-name.txt" will turn into "m...
625941eb99fddb7c1c9de86e
def max_length(self): <NEW_LINE> <INDENT> return self._max_len
Return the maximum length of the partitions of ``self``. EXAMPLES:: sage: P = Partitions(regular=4, max_length=3) sage: P.max_length() 3
625941eb91f36d47f21ac9d8
def delete_certificates_server_by_id(self, certificates_server_id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.delete_certificates_server_by_id_with_http_info(certificates_server_id, **kwargs) <NEW_LINE> <DEDENT> else: <NE...
delete_certificates_server_by_id # noqa: E501 Delete a SyncIQ TLS server certificate. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_certificates_server_by_id(certificates_server_id, async_req=True) >>> re...
625941eb0383005118ecfac1
def cast(self, to_type): <NEW_LINE> <INDENT> return functions.Cast(self._name, to_type)
Coerce an expression to a new value type.
625941ebd4950a0f3b08c828
def __init__(self, game_set): <NEW_LINE> <INDENT> self.game_set = game_set <NEW_LINE> self.score = 0
Initialize statistics.
625941eb1f5feb6acb0c502a
def test_game_add(): <NEW_LINE> <INDENT> game = games.add("Flingler", "LD26 physics game", "http://hostagamejam.com/flingler.png") <NEW_LINE> game2 = games.add("Flingler II", "LD27 physics game", "hostagamejam.com/flingler.png") <NEW_LINE> assert type(game) == models.Game <NEW_LINE> assert type(game2) == models.Game
Test game adding.
625941eb50485f2cf553d27c
def _update_model(self, t): <NEW_LINE> <INDENT> for i in range(self.num_gradient_steps): <NEW_LINE> <INDENT> batch_ind = rd.randint(t + 1, size=self.batch_size) <NEW_LINE> action_batch = self.action_hist[batch_ind] <NEW_LINE> reward_batch = self.reward_hist[batch_ind] <NEW_LINE> out, cache = self._model_forward(action_...
Update the model by taking a few gradient steps.
625941eb462c4b4f79d1dbb0
def set_Version(self, value): <NEW_LINE> <INDENT> super(JSONToDBInputSet, self)._set_input('Version', value)
Set the value of the Version input for this Choreo. ((optional, decimal) The version of the Postgres database. Allowed values are 8 and 9 (the default).)
625941ebadb09d7d5db6cc6d
def vgg16(inputs, n_classes=1000, use_batch_norm=False, is_training=True, dropout=0.5, weight_decay=0.0005, spatial_squeeze=True): <NEW_LINE> <INDENT> with tf.variable_scope("vgg16", "vgg16"): <NEW_LINE> <INDENT> with tf.contrib.framework.arg_scope(get_vgg_argscope( weight_decay=weight_decay, use_batch_norm=use_batch_n...
Simonyan and Zisserman 2014 PARAMETERS: 138,357,544 (with input image [224,224,3] and 1000 classes) PARAMETERS IN CONV LAYERS: 14,714,688 Notes: Originally designed for 224x224x3 images. References: Karen Simonyan, Andrew Zisserman, 2014: Very Deep Convolutional Networks for Large-Scale Image Recognition...
625941eb2ae34c7f2600d611
def test_bugzilla_subscribed(): <NEW_LINE> <INDENT> did.base.Config(CONFIG) <NEW_LINE> stats = did.cli.main([ "--bz-subscribed", "--email", "Evgeni Golov <egolov@redhat.com>", "--since", "2016-06-06", "--until", "2016-06-12"])[0][0].stats[0].stats[7].stats <NEW_LINE> assert any([bug.id == 1343546 for bug in stats])
Check subscribed bugs
625941eb287bf620b61d3f41
def index_queryset(self): <NEW_LINE> <INDENT> return Article.objects.published().select_related()
Used when the entire index for model is updated.
625941eb71ff763f4b549b75
def __init__(self, train_step: tf.Variable, interval: int, log_to_terminal: bool = True): <NEW_LINE> <INDENT> self._train_step = train_step <NEW_LINE> self._log_to_terminal = log_to_terminal <NEW_LINE> self._step_timer = step_per_second_tracker.StepPerSecondTracker(train_step) <NEW_LINE> super(StepPerSecondLogTrigger, ...
Initializes a StepPerSecondLogTrigger. Args: train_step: `tf.Variable` which keeps track of the number of train steps. interval: How often, in train_steps, the trigger will save. Note that as long as the >= `interval` number of steps have passed since the last trigger, the event gets triggered. The current...
625941ebbd1bec0571d90b0f
def print_on_success(message: str, verbose: bool=True) -> None: <NEW_LINE> <INDENT> if verbose: <NEW_LINE> <INDENT> print(f"{BRIGHT}{GREEN}{'[ OK ]'.ljust(12, ' ')}{RESET_ALL}{message}")
Print a formatted success message if verbose is enabled.
625941ebcb5e8a47e48b7f83
def iter_windows(corpus,bigrams,fsm_copy,fsm_no_copy,n,w,runs,presmooth=True,sc=SC,end_mark=False,start='S',end='F'): <NEW_LINE> <INDENT> results=[] <NEW_LINE> i=0 <NEW_LINE> while i<=runs: <NEW_LINE> <INDENT> print ("\nRun %i of %i"%(i,runs)) <NEW_LINE> results.append(windows(corpus,bigrams,fsm_copy,fsm_no_copy,n,w,pr...
Runs windows multiple times, re-initialising the grammar probabilities each time Arguments corpus : string list bigrams : bigram markhov chain fsm_copy : FSM with copy rules fsm_no_copy: FSM without copy rules n : number of EM iterations windows : number of windows to divide into (int) runs ...
625941ebac7a0e7691ed45a3
def new_object ( self, **facets ): <NEW_LINE> <INDENT> return DefaultObject()
Returns a new object to be viewed (must be overridden).
625941eb8a43f66fc4b54540
def repr(self, *args, **kwargs): <NEW_LINE> <INDENT> if not self.is_numpy: <NEW_LINE> <INDENT> text = "'" + self.str(*args, **kwargs) + "'" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> text = "{} numpy array, {} uncertainties".format(self.shape, len(self.uncertainties)) <NEW_LINE> <DEDENT> return "<{} at {}, {}>".form...
Returns the unique string representation of the number.
625941eb4c3428357757c805
def save_credentials(self): <NEW_LINE> <INDENT> Credentials.credentials_list.append(self)
Adding to credentials list
625941ebd18da76e235329bd
def get_entry(title): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = default_storage.open(f"entries/{title}.md") <NEW_LINE> return f.read().decode("utf-8") <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> return None
Retrieves an encyclopedia entry by its title. If no such entry exists, the function returns None.
625941ebcc0a2c11143dd372
def xml(self): <NEW_LINE> <INDENT> return base64.b64decode(self.resposta.arquivoCFeBase64)
Retorna o XML do CF-e-SAT de cancelamento decodificado.
625941eb23849d37ff7b356c
def get_parallels(bezier2, width): <NEW_LINE> <INDENT> c1x, c1y = bezier2[0] <NEW_LINE> cmx, cmy = bezier2[1] <NEW_LINE> c2x, c2y = bezier2[2] <NEW_LINE> parallel_test = check_if_parallel(c1x - cmx, c1y - cmy, cmx - c2x, cmy - c2y) <NEW_LINE> if parallel_test == -1: <NEW_LINE> <INDENT> _api.warn_external( "Lines do not...
Given the quadratic Bezier control points *bezier2*, returns control points of quadratic Bezier lines roughly parallel to given one separated by *width*.
625941eb45492302aab5e7a9
def test_update_webhook_nonexistent_policy_fails(self): <NEW_LINE> <INDENT> deferred = self.group.update_webhook("puppies", "1", {'name': 'fake'}) <NEW_LINE> self.assert_deferred_failed(deferred, NoSuchPolicyError)
Updating a webhook of a nonexistant policy fails with a :class:`NoSuchPolicyError`.
625941ebad47b63b2c50a460
def compute_lower_bound(self): <NEW_LINE> <INDENT> pass
Compute the variational lower bound NOTE: Currently not implemented. Returns ------- lower_bound : float The variational lower bound
625941eb7d847024c06be7a1
def get_is_type_of(type_, sync=True): <NEW_LINE> <INDENT> if sync: <NEW_LINE> <INDENT> def is_type_of(obj, _info): <NEW_LINE> <INDENT> return isinstance(obj, type_) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> async def is_type_of(obj, _info): <NEW_LINE> <INDENT> return isinstance(obj, type_) <NEW_LINE> <DEDE...
Get a sync or async is_type_of function for the given type.
625941eb66673b3332b92572
def copy(self): <NEW_LINE> <INDENT> evidence = self.variables[1:] if len(self.variables) > 1 else None <NEW_LINE> evidence_card = self.cardinality[1:] if len(self.variables) > 1 else None <NEW_LINE> return TabularCPD(self.variable, self.variable_card, self.get_cpd(), evidence, evidence_card)
Returns a copy of the TabularCPD object. Examples -------- >>> from pgmpy.factors.discrete import TabularCPD >>> cpd = TabularCPD('grade', 2, ... [[0.7, 0.6, 0.6, 0.2],[0.3, 0.4, 0.4, 0.8]], ... ['intel', 'diff'], [2, 2]) >>> copy = cpd.copy() >>> copy.variable 'grade' >>> copy.variab...
625941eb596a897236089f9a
def __init__(self, brickname): <NEW_LINE> <INDENT> self.name = brickname <NEW_LINE> self.ops = [] <NEW_LINE> self.trainable_weights = []
Arguments: - brickname: a string to create the namescope of the brick.
625941eb2eb69b55b151cd97
def syllable_textgrid_extraction(textgrid_path, recording, tier0, tier1): <NEW_LINE> <INDENT> print(textgrid_path, recording) <NEW_LINE> textgrid_file = os.path.join(textgrid_path,recording+'.TextGrid') <NEW_LINE> syllableList, _ = textgrid_2_word_list(textgrid_file, whichTier=tier0) <NEW_LINE> phonemeList, _ = textgri...
Extract syllable boundary and phoneme boundary from textgrid :param textgrid_path: :param recording: :param tier0: parent tier :param tier1: child tier which should be covered by parent tier :return: nestedPhonemeList, element[0] - syllable, element[1] - a list containing the phoneme of the syllable
625941eb1f037a2d8b9466de
def custom_dumps(string): <NEW_LINE> <INDENT> return simplejson.dumps(string, for_json=True)
Serialize **s** to JSON accepting **for_json** serializer method
625941eb30dc7b7665901e42
def BroadcasterMatchesRef(self, broadcaster): <NEW_LINE> <INDENT> return _lldb.SBEvent_BroadcasterMatchesRef(self, broadcaster)
BroadcasterMatchesRef(SBEvent self, SBBroadcaster broadcaster) -> bool
625941ebfbf16365ca6f66b0
@safe_failure <NEW_LINE> def get_section_spans(text: str, use_ml=True, return_text=True, skip_empty_headers=False, sections_hierarchy: Optional[List[Any]] = None) -> Generator[DocumentSection, None, None]: <NEW_LINE> <INDENT> _start_index_counter = 0 <NEW_LINE> level_parser = SectionLevelParser(sections_hierarch...
Get sections from text. Use NLP-based detection OR regex-bases detection of sections - see use_ml param. :param text: str - source full text :param use_ml: bool - use sklearn classifier otherwise use regex-based detection :param return_text: bool - return section text :param skip_empty_headers: bool - return results co...
625941eb956e5f7376d7134d