code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def fetch(data): <NEW_LINE> <INDENT> backend_domain_name = "backend %s" % data <NEW_LINE> return file_handle("haproxy.conf", backend_domain_name)
根据用户输入的backend,查询backend下的server信息
625941d0e5267d203edcde12
def encrypt(second_dial, word_to_encrypt): <NEW_LINE> <INDENT> encrypted_word = '' <NEW_LINE> for letter in word_to_encrypt: <NEW_LINE> <INDENT> encrypt_dict = {letters[i]:second_dial[i] for i in range(26)} <NEW_LINE> encrypted_word += encrypt_dict[letter] <NEW_LINE> second_dial = second_dial[1:] + second_dial[0] <NEW_...
expects two strings, a second_dial and a word_to_encrypt with each iteration through the letters of the word_to_encrypt adds a letter to the encrypted_word and adjusts the dial position 1 place
625941d0462c4b4f79d1d847
def read_party(fname=None, read_detection_catalog=True, *args, **kwargs): <NEW_LINE> <INDENT> party = Party() <NEW_LINE> party.read(filename=fname, read_detection_catalog=read_detection_catalog, *args, **kwargs) <NEW_LINE> return party
Read detections and metadata from a tar archive. :type fname: str :param fname: Filename to read from, if this contains a single Family, then will return a party of length = 1 :type read_detection_catalog: bool :param read_detection_catalog: Whether to read the detection catalog or not, if False, catalog ...
625941d0d53ae8145f87a3e5
def add_enumerable_item_to_dict(dict_, key, item): <NEW_LINE> <INDENT> dict_.setdefault(key, []) <NEW_LINE> if isinstance(item, (list, tuple)): <NEW_LINE> <INDENT> dict_[key].extend(item) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dict_[key].append(item)
Add an item to a list contained in a dict. For example: If the dict is ``{'some_key': ['an_item']}``, then calling this function will alter the dict to ``{'some_key': ['an_item', 'another_item']}``. If the key doesn't exist yet, the function initializes it with a list containing the item. List-like items are allowed...
625941d0a17c0f6771cbe1c6
def _transform(self, m): <NEW_LINE> <INDENT> repNum = self.mesh.vnC[:self.mesh.dim-1].prod() <NEW_LINE> return Utils.mkvc(m).repeat(repNum)
:param numpy.ndarray m: model :rtype: numpy.ndarray :return: transformed model
625941d0566aa707497f46dd
def getReleaseDate(text): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = open(text, "r") <NEW_LINE> for lines in f.readlines(): <NEW_LINE> <INDENT> if "Release Date: " in lines: <NEW_LINE> <INDENT> for i in lines.split(): <NEW_LINE> <INDENT> if len(i) == 4: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> n = int(i) <NEW...
Helper Function :param: *.txt File provided by the main function :return: Returns the year of the release date :rtype: Integer :except: Certain files aren't in UTF-8 format: Will return File Invalid The function will look for the year by looking for a len == 4 string It'll convert the string into an integer, if succes...
625941d0d6c5a102081441c1
def lock_layers_until(model, first_trainable_layer, verbose=False): <NEW_LINE> <INDENT> found_first_layer = False <NEW_LINE> for layer in model.layers: <NEW_LINE> <INDENT> if layer.name == first_trainable_layer: <NEW_LINE> <INDENT> found_first_layer = True <NEW_LINE> <DEDENT> if verbose and found_first_layer and not la...
Locks layers until a given layer name. # Arguments model: Model to set trainable layers on. first_trainable_layer: Name of first trainable layer. verbose: True to print trainable status of each layer.
625941d0ac7a0e7691ed4241
def get_version_by_id(version_id): <NEW_LINE> <INDENT> version_sql = "SELECT * FROM Version WHERE id=?" <NEW_LINE> return dbutils.execute_query(version_sql, (version_id,), DATABASE_FILE)
Return version information by version id. :param version_id: JIRA version identifier. :return: Tuple with version information.
625941d00c0af96317bb835e
@login_required <NEW_LINE> def inbox(request): <NEW_LINE> <INDENT> conversations = Message.get_conversations(user=request.user) <NEW_LINE> users_list = request.user.profile.contact_list.all().filter(is_active=True) <NEW_LINE> never_send_msg = True <NEW_LINE> return render(request, 'messenger/inbox.html', { 'conversatio...
Displays an inbox page of user.
625941d073bcbd0ca4b2c1ec
def render_DELETE(self, request): <NEW_LINE> <INDENT> channel_info = self.get_channel_from_db(self.cid) <NEW_LINE> if channel_info is None: <NEW_LINE> <INDENT> return ChannelsPlaylistsEndpoint.return_404(request) <NEW_LINE> <DEDENT> playlist = self.channel_db_handler.getPlaylist(self.playlist_id, ['Playlists.dispersy_i...
.. http:delete:: /channels/discovered/(string: channelid)/playlists/(int: playlistid) Remove a playlist with a specified playlist id. **Example request**: .. sourcecode:: none curl -X DELETE http://localhost:8085/channels/discovered/abcd/playlists/3 **Example response**: .. sourcecode:: ja...
625941d0d58c6744b4257dd6
def _get_state(self): <NEW_LINE> <INDENT> return self.__state
Getter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/afi_safi/af/state (container) YANG Description: This container defines AFI-SAFI State information
625941d09f2886367277aa03
def fstr(value, default=''): <NEW_LINE> <INDENT> return default if value is None else str(value)
强制转换为 str
625941d08a349b6b435e82ea
def get_question_score(self, question, forms): <NEW_LINE> <INDENT> form1, form2, form3, form4 = forms <NEW_LINE> if question.alternatives.all()[0].is_correct: <NEW_LINE> <INDENT> score = int(form1['score'].value()) <NEW_LINE> <DEDENT> elif question.alternatives.all()[1].is_correct: <NEW_LINE> <INDENT> score = int(form2...
Get the score from correct alternative.
625941d0d268445f265b4fe4
def DistributedGradientTape(gradtape, device_dense='', device_sparse='', compression=Compression.none, sparse_as_dense=False, op=Average, gradient_predivide_factor=1.0, num_groups=0, groups=None, process_set=global_process_set): <NEW_LINE> <INDENT> if gradient_predivide_factor != 1.0: <NEW_LINE> <INDENT> if rocm_built(...
A tape that wraps another tf.GradientTape, using an allreduce to combine gradient values before applying gradients to model weights. Args: gradtape: GradientTape to use for computing gradients and applying updates. device_dense: Device to be used for dense tensors. Uses GPU by default if Horovod was bu...
625941d0925a0f43d2549fee
def instance_activate(request): <NEW_LINE> <INDENT> if request.GET.get('site_api_key', '') != settings.SITE_API_KEY: <NEW_LINE> <INDENT> return HttpResponse(serialize({ "status": "failure", "reason": 'wrong key' }), mimetype="application/json") <NEW_LINE> <DEDENT> i = get_object_or_404(Instance, pk=request.GET['instanc...
Called when an instance is done provisioning. Requires two GET Parameters: - site_api_key: for security reasons - instance: ID of the instance to activate
625941d0d6c5a102081441c2
def run_test(self, input_code): <NEW_LINE> <INDENT> tmp_expected = self.run_command(self.cli_cmd+[input_code]).split("\n") <NEW_LINE> tmp_expected = map(lambda x: x.strip(" \n"), tmp_expected) <NEW_LINE> tmp_expected = filter(lambda x: len(x) > 0, tmp_expected) <NEW_LINE> expected = [] <NEW_LINE> for item in tmp_expect...
Run the actual test This compares the output of the libcangjie2_cli tool with the output from pycangjie. The idea is that if pycangjie produces the same results as a C++ tool compiled against libcangjie, then pycangjie properly wraps libcangjie. We do not try to verify that pycangjie produces valid results here, val...
625941d010dbd63aa1bd2d1a
def forward(self, x): <NEW_LINE> <INDENT> Batch, C, H, W = x.size() <NEW_LINE> x_project = x.view(x.size(0),x.size(1),-1) <NEW_LINE> x_project = torch.mean(x_project,dim=2) <NEW_LINE> predict_att = F.sigmoid(self.fc1(x_project)) <NEW_LINE> _,argsort_pred = torch.sort(-predict_att,dim=1) <NEW_LINE> n_att ...
:param x: input feature maps Batch * C * H * W weight: attribute classfier weights N*C :return: out: attention value + input value
625941d0566aa707497f46de
def _underscore_to_camelcase(self, context): <NEW_LINE> <INDENT> return { self._to_camelcase(key): val for key, val in context.items() }
Convert underscore to CamelCase. For example: >>> {'language_code': 'TR'} ==> {'languageCode': 'TR'}
625941d0b7558d58953c5089
def assertFalse(expr, message=None): <NEW_LINE> <INDENT> if expr: <NEW_LINE> <INDENT> raise TestStepFail( format_message(message) if message is not None else 'Assert: %r != False' % expr)
Assert that expr evaluates to False. :param expr: expression to evaluate. :param message: Message set to raised Exception :raises: TestStepFail if expr.
625941d07d847024c06be433
def get_contact(self, contact_id): <NEW_LINE> <INDENT> logging.debug('method: GET') <NEW_LINE> url = self.prepare_url(resource_url='contacts/{contact_id}'.format( contact_id=contact_id)) <NEW_LINE> r = requests.get(url, headers=self._get_headers()) <NEW_LINE> json_response = self.process_response(r) <NEW_LINE> return j...
Gets a contact with the provided contactId, if it doesn't find a match it raises an IcontactException
625941d0dd821e528d63b31f
def next_node_rule(self, curr_node): <NEW_LINE> <INDENT> graph = self.colony.graph <NEW_LINE> q = random.random() <NEW_LINE> max_node = -1 <NEW_LINE> if q < self.Q0: <NEW_LINE> <INDENT> self.output.write("Exploitation\n") <NEW_LINE> max_val = -1 <NEW_LINE> val = None <NEW_LINE> for node in self.nodes_to_visit.values():...
Return which node to move to. curr_node -- the node the ant is currently at.
625941d03317a56b86939dcd
def hyperbolic_tangent(self, sigma_add): <NEW_LINE> <INDENT> return (m.exp(sigma_add)-m.exp(-sigma_add)) / (m.exp(sigma_add)+m.exp(-sigma_add))
Returns hyperbolic tangent activation function value
625941d0046cf37aa974cebe
def assemble(self, assembly): <NEW_LINE> <INDENT> assert isinstance(assembly, Assembly), 'Invalid assembly %s' % assembly <NEW_LINE> prefix = self.group + '.' <NEW_LINE> for name, call in assembly.calls.items(): <NEW_LINE> <INDENT> if name.startswith(prefix) and isinstance(call, CallEntity): <NEW_LINE> <INDENT> assert ...
@see: Setup.assemble
625941d0a8ecb033257d3243
def search_missing_revision_ids(self, other, find_ghosts=True, revision_ids=None, if_present_ids=None, limit=None): <NEW_LINE> <INDENT> with self.lock_read(): <NEW_LINE> <INDENT> inter_repo = _mod_repository.InterRepository.get(other, self) <NEW_LINE> return inter_repo.search_missing_revision_ids( find_ghosts=find_ghos...
Return the revision ids that other has that this does not. These are returned in topological order. revision_id: only return revision ids included by revision_id.
625941d0fff4ab517eb2f5b3
def bootstrap(command, conf, vars): <NEW_LINE> <INDENT> g = model.Group() <NEW_LINE> g.group_name = 'managers' <NEW_LINE> g.display_name = 'Managers Group' <NEW_LINE> p = model.Permission() <NEW_LINE> p.permission_name = 'manage' <NEW_LINE> p.description = 'This permission give an administrative right to the bearer' <N...
Place any commands to setup sample_ecommerce here
625941d091f36d47f21ac669
def getMin(self): <NEW_LINE> <INDENT> if self.size == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return self.min_stack[self.size - 1]
:rtype: int
625941d06fece00bbac2d8b5
def _addRelToKnowledge(rel, sortWithSiblings = True): <NEW_LINE> <INDENT> relOid = rel.getOid() <NEW_LINE> childOid = rel.getChildOid() <NEW_LINE> parentOid = rel.getParentOid() <NEW_LINE> relType = rel.getRelationshipType() <NEW_LINE> parentTuple = (parentOid, relType) <NEW_LINE> childTuple = (childOid, relType) <NEW_...
Add the relationship to our store of knowledge about relationships. sortWithSiblings: If True then resort this relationship's parent's list of children. If False, then the new relationship is added to the end.
625941d032920d7e50b28347
def get_auth_response(token: str, secret: str) -> AuthResponse: <NEW_LINE> <INDENT> with http_session() as session: <NEW_LINE> <INDENT> log.debug(f"Fetching OAuth token response for client {token!r}") <NEW_LINE> response = session.post( API_URL_AUTH, json.dumps( { "grant_type": "client_credentials", "client_id": token,...
Request an OAuth bearer token. Args: token (str): The "client_id" for the registered Gfycat application. secret (str): The "client_secret" for the registered Gfycat application. Raises: ValueError: If the request for the OAuth bearer token fails. Returns: AuthResponse: ...
625941d0596a897236089c36
@register.filter <NEW_LINE> def endasher(value): <NEW_LINE> <INDENT> return unicode(value).replace(u'-', u'–')
Nahradi - za en dash;
625941d0cc40096d61595ac7
def fsdecode(path): <NEW_LINE> <INDENT> encoding = sys.getfilesystemencoding() <NEW_LINE> if isinstance(path, bytes): <NEW_LINE> <INDENT> path = path.decode(encoding) <NEW_LINE> <DEDENT> elif not isinstance(path, unicode): <NEW_LINE> <INDENT> raise TypeError('%s is not a byte type' % type(path).__name__) <NEW_LINE> <DE...
Path must be unicode or in file system encoding already
625941d04e696a04525c95c2
def block_diagonal(matrices, dtype=tf.float32): <NEW_LINE> <INDENT> matrices = [tf.convert_to_tensor(matrix, dtype=dtype) for matrix in matrices] <NEW_LINE> blocked_rows = tf.Dimension(0) <NEW_LINE> blocked_cols = tf.Dimension(0) <NEW_LINE> batch_shape = tf.TensorShape(None) <NEW_LINE> for matrix in matrices: <NEW_LINE...
Constructs block-diagonal matrices from a list of batched 2D tensors. Taken from: https://stackoverflow.com/questions/42157781/block-diagonal-matrices-in-tensorflow Args: matrices: A list of Tensors with shape [..., N_i, M_i] (i.e. a list of matrices with the same batch dimension). dtype: Data type to use. The Tenso...
625941d04d74a7450ccd433a
def fitness(decode_pop): <NEW_LINE> <INDENT> fitness_list = [] <NEW_LINE> for index, item in enumerate(decode_pop): <NEW_LINE> <INDENT> fitness_list.append(10*math.sin(5*item[0])+7*math.cos(4*item[0])+item[0]) <NEW_LINE> pass <NEW_LINE> <DEDENT> return fitness_list <NEW_LINE> pass
适应度计算函数 :param decode_pop: 输入参数为解码后的十进制种群 :return: 返回每条染色体对应的适应度值,存在负适应度值
625941d03317a56b86939dce
def regression_line(super_bowls_df, tv_df): <NEW_LINE> <INDENT> games_tv = pd.merge(tv_df[tv_df['super_bowl'] > 1], super_bowls_df, on='super_bowl') <NEW_LINE> """We plot a regression line""" <NEW_LINE> sns.regplot(x="difference_pts", y="share_household", data=games_tv) <NEW_LINE> plt.show()
We combine the tv dataframe with the super bowl dataframe
625941d055399d3f0558882b
def test_filter(self): <NEW_LINE> <INDENT> dataimport = DataImportFactory.create() <NEW_LINE> DataFeatureFactory.create(imported=True, dataimport=dataimport) <NEW_LINE> DataFeatureFactory.create(imported=True, dataimport=dataimport) <NEW_LINE> DataFeatureFactory.create(imported=False, dataimport=dataimport) <NEW_LINE> ...
Test filter.
625941d0a4f1c619b28b01ae
def test_get_plugin(self): <NEW_LINE> <INDENT> official_account_1 = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_1, name='Ace Kwok', email='doraemonext@gmail.com', original='original', wechat='wechat') <NEW_LINE> official_account_2 = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_2, name='doraemonex...
测试获取插件
625941d04f6381625f114bb2
def mk_string(board): <NEW_LINE> <INDENT> s = '' <NEW_LINE> for n in np.nditer(board): <NEW_LINE> <INDENT> s += str(int(n)) <NEW_LINE> <DEDENT> return s
This takes a numpy array and returns a string representation ex. 1. 2. 3. 4. 5. 6. = '123456780' 7. 8. 0. Params ====== board(np.array) : The board to be converted into a string
625941d0956e5f7376d70fe4
def crown(self, piece): <NEW_LINE> <INDENT> piece_x, piece_y = piece <NEW_LINE> piece_i = piece_y * self.ncols + piece_x <NEW_LINE> if piece_y == self.nrows - 1 and self.squares[piece_i].is_black(): <NEW_LINE> <INDENT> self.squares[piece_i].crown() <NEW_LINE> <DEDENT> elif piece_y == 0 and self.squares[piece_i].is_red(...
Enhance the piece to be able to move in reverse as well.
625941d026068e7796caee56
def setup_plugin(self, path): <NEW_LINE> <INDENT> if path in self.plugins: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> mod = __import__( path, globals=None, locals=None, fromlist=('setup',) ) <NEW_LINE> <DEDENT> except ImportError as err: <NEW_LINE> <INDENT> raise PluginError( 'Could not imp...
Import and setup a plugin. No-op if called twice for the same plugin. :param str path: Import path to the plugin. :raise: PluginError if the given plugin is invalid.
625941d0cad5886f8bd27150
def dataset_at_path(self, nims_path, filepath): <NEW_LINE> <INDENT> for dataset_class in self.dataset_classes: <NEW_LINE> <INDENT> dataset = dataset_class.at_path(nims_path, filepath) <NEW_LINE> if dataset: break <NEW_LINE> <DEDENT> return dataset
Return instance of appropriate MRIDataset subclass for provided file.
625941d03c8af77a43ae3918
def intermediate_convolve_path_for_image(self, instr_name, filter_name): <NEW_LINE> <INDENT> return fs.join(self.intermediate_convolve_path, instr_name + "__" + filter_name + ".fits")
This function ... :param instr_name: :param filter_name: :return:
625941d055399d3f0558882c
def execute(self): <NEW_LINE> <INDENT> if not self.tests: <NEW_LINE> <INDENT> return 0.0 <NEW_LINE> <DEDENT> self.failure_count = 0 <NEW_LINE> self.hit_max_failures = False <NEW_LINE> one_week = 7 * 24 * 60 * 60 <NEW_LINE> timeout = self.timeout or one_week <NEW_LINE> start = time.time() <NEW_LINE> deadline = start + t...
Execute the tests in the run using up to the specified number of parallel tasks, and inform the caller of each individual result. The provided tests should be a subset of the tests available in this run object. The progress_callback will be invoked for each completed test. If timeout is non-None, it should be a time ...
625941d0fb3f5b602dac380b
def isAggregate(): <NEW_LINE> <INDENT> pass
Return true if DV represents an aggregate function
625941d0e8904600ed9f20a5
def _initialize_episode(self, index=0): <NEW_LINE> <INDENT> _ = self._environment.reset() <NEW_LINE> self._environment.environment.restore_state(self.starting_states[index]) <NEW_LINE> initial_observation = self._environment._pool_and_resize() <NEW_LINE> return self._agent.begin_episode(initial_observation)
Initialization for a new episode. Args: index: int, chooses the state to which the environment is reset from the available states. Default to 0 for the first state. Returns: action: int, the initial action chosen by the agent.
625941d050485f2cf553cf11
def rotate_img(self, im): <NEW_LINE> <INDENT> min_count = 1000 <NEW_LINE> final_angle = 0 <NEW_LINE> for angle in range(-45, 45): <NEW_LINE> <INDENT> x_count = 0 <NEW_LINE> ti = im.rotate(angle, expand=True) <NEW_LINE> for x in range(ti.width): <NEW_LINE> <INDENT> for y in range(ti.height): <NEW_LINE> <INDENT> if ti.ge...
根据图像在x轴方向投影大小确定字符的摆放方向 :param im: PIL.Image object :return: rotated Image object
625941d06aa9bd52df036f1c
@pytest.fixture <NEW_LINE> def db_session(db_engine): <NEW_LINE> <INDENT> conn = db_engine.connect() <NEW_LINE> trans = conn.begin() <NEW_LINE> session = Session(bind=conn) <NEW_LINE> session.begin_nested() <NEW_LINE> @sqlalchemy.event.listens_for(session, "after_transaction_end") <NEW_LINE> def restart_savepoint(sessi...
Prepare the SQLAlchemy session object. We enable fast repeatable database tests by setting up the database only once per session (see :func:`db_engine`) and then wrapping each test function in a transaction that is rolled back. Additionally, we set a SAVEPOINT before entering the test, and if we detect that the test ...
625941d032920d7e50b28348
def minion_config(opts, vm_): <NEW_LINE> <INDENT> minion = salt.config.DEFAULT_MINION_OPTS.copy() <NEW_LINE> minion.update( log_level='info', log_level_logfile='info' ) <NEW_LINE> minion['id'] = vm_['name'] <NEW_LINE> master_finger = config.get_config_value('master_finger', vm_, opts) <NEW_LINE> if master_finger is not...
Return a minion's configuration for the provided options and VM
625941d0b57a9660fec339fc
def formatah(horas, segundos=False, sinal=True): <NEW_LINE> <INDENT> if sinal and horas: <NEW_LINE> <INDENT> sinal = '-' if (horas < 0) else '+' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sinal = '' <NEW_LINE> <DEDENT> s = abs(horas) * 3600.0 <NEW_LINE> m, s = divmod(s, 60.0) <NEW_LINE> h, m = divmod(m, 60.0) <NEW_L...
formatah(horas, segundos=False, sinal=True) -> '[+-]HH:MM[:SS]' Recebe uma quantidade de horas como float e retorna uma string HH:MM.
625941d071ff763f4b549803
def testDestroyCIDTwice(t, env): <NEW_LINE> <INDENT> c = env.c1.new_client(env.testname(t)) <NEW_LINE> res = env.c1.compound([op.destroy_clientid(c.clientid)]) <NEW_LINE> check(res) <NEW_LINE> res = env.c1.compound([op.destroy_clientid(c.clientid)]) <NEW_LINE> check(res, NFS4ERR_STALE_CLIENTID)
destroy a clientid twice without session FLAGS: destroy_clientid all CODE: DESCID8
625941d0e76e3b2f99f3a981
def save_tree(input_imagetree): <NEW_LINE> <INDENT> filename_tsvencoded_string_map = convert_imagetree_to_tsv_string_dictionary(input_imagetree) <NEW_LINE> for filename, serialized_sring in filename_tsvencoded_string_map.iteritems(): <NEW_LINE> <INDENT> graphmap.utilities.put_contents(serialized_sring, filename)
Saves all the files in the given tree as tsv encoded format. :type input_imagetree: graphmap.imagetree.ImageTree
625941d08c3a873295158532
def add_file(self, module, data=None, lines=None): <NEW_LINE> <INDENT> file = open(os.path.join(self.__path, module + '.py'), 'a+') <NEW_LINE> self.__file[module] = file <NEW_LINE> self.__data[module] = '' if data or lines else file.read() <NEW_LINE> if data: <NEW_LINE> <INDENT> self.set_data(module, data) <NEW_LINE> <...
Adds a Python file (identified by its module name) in the module. If the related .py file doesn't exist an empty file is created.
625941d001c39578d7e74fb2
def bokeh_shot_chart(source, x="LOC_X", y="LOC_Y", fill_color="#1f77b4", fill_alpha=0.3, line_alpha=0.3, court_lw=1, court_line_color='gray'): <NEW_LINE> <INDENT> fig = figure(width=700, height=658, x_range=[-250,250], y_range=[422.5, -47.5], min_border=0, x_axis_type=None, y_axis_type=None, outline_line_color="black")...
Returns a figure with both FGA and basketball court lines drawn onto it. This function expects data to be a ColumnDataSource with the x and y values named "LOC_X" and "LOC_Y". Otherwise specify x and y.
625941d067a9b606de4a8031
def auto_norm(data_set): <NEW_LINE> <INDENT> min_val = data_set.min(0) <NEW_LINE> max_val = data_set.max(0) <NEW_LINE> ranges = max_val - min_val <NEW_LINE> m = data_set.shape[0] <NEW_LINE> norm_data_set = data_set - tile(min_val, (m, 1)) <NEW_LINE> norm_data_set = norm_data_set / tile(ranges, (m, 1)) <NEW_LINE> return...
tile(A,reps),数据A沿各个维度重复的次数 A=[1,2] tile(A,(2,3)) 结果:[[1,2,1,2,1,2], [1,2,1,2,1,2]] reps的数字从后往前分别对应A的第N个维度的重复次数。 如tile(A,2)表示A的第一个维度重复2遍; tile(A,(2,3))表示A的第一个维度重复3遍,然后第二个维度重复2遍; tile(A,(2,2,3))表示A的第一个维度重复2遍,第二个维度重复2遍,第三个维度重复2遍。 :param data_set: :return:
625941d00c0af96317bb835f
def t150300_x17(): <NEW_LINE> <INDENT> assert t150300_x19(z5=1101, mode7=0, mode8=0, mode9=0, mode10=0) <NEW_LINE> return 0
State 0,1
625941d08c3a873295158533
def hasNext(self): <NEW_LINE> <INDENT> if self.peeknum: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.iterator.hasNext()
:rtype: bool
625941d023e79379d52ee6db
def main_window_auto_toggled(self, switch, state): <NEW_LINE> <INDENT> self.state['auto'] = state <NEW_LINE> candidate_window = self.builder.get_object("candidate_window") <NEW_LINE> candidate_window.set_default_size(500, 500) <NEW_LINE> if self.state['auto']: <NEW_LINE> <INDENT> candidate_window.show() <NEW_LINE> <DED...
Callback to activate/deactivate the boat detection
625941d03eb6a72ae02ec657
def typeAlter(hD): <NEW_LINE> <INDENT> pitchFound = False <NEW_LINE> degrees = self._degreesList <NEW_LINE> for p, degree in zip(pitches, degrees): <NEW_LINE> <INDENT> degree = degree.replace('-', '') <NEW_LINE> degree = degree.replace('#', '') <NEW_LINE> degree = degree.replace('A', '') <NEW_LINE> if hD.degree == int(...
alter
625941d0b5575c28eb68e178
def get_login_profile( self, name, project_id=None, system_id=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): <NEW_LINE> <INDENT> if "get_login_profile" not in self._inner_api_calls: <NEW_LINE> <INDENT> self._inner_api_calls[ "get_login_profile" ] ...
Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine. Example: >>> from google.cloud import oslogin_v1 >>> >>> client = oslogin_v1.OsLoginServiceClient() >>> >>> name = client.user_path('[USER]') >>> >>> response = client.get_login_profile(name...
625941d09c8ee82313fbb8ed
def strStr(self, haystack, needle): <NEW_LINE> <INDENT> return haystack.find(needle, 0)
:type haystack: str :type needle: str :rtype: int
625941d0796e427e537b073e
def nonlocal_mean_denoising(image, patch_size=5, number_of_similar_patches=3): <NEW_LINE> <INDENT> height, width = image.shape <NEW_LINE> denoised_image = np.copy(image) <NEW_LINE> patch_edge_offset = math.floor(patch_size / 2) <NEW_LINE> for y_index in range(patch_edge_offset+1, height-patch_edge_offset): <NEW_LINE> <...
Denoises an image using the nonlocal mean approach. :param image: The image to search for patches in. :type image: np.ndarray :param patch_size: The size of a side of the patch (always square). :type patch_size: int :param number_of_similar_patches: The number of similar patches to return. :type number_of_similar_patc...
625941d0d99f1b3c44c67705
def preprocess(): <NEW_LINE> <INDENT> cards = preprocess_cards(ALL_SETS_FILENAME, CARDS_FILENAME) <NEW_LINE> preprocess_regex(cards, REGEX_FILENAME) <NEW_LINE> validate_secrets()
Precompute stuff so loading in appengine is fast.
625941d0293b9510aa2c340d
def reset(self, destination=None, testing=False): <NEW_LINE> <INDENT> self.planner.route_to(destination) <NEW_LINE> if testing is True: <NEW_LINE> <INDENT> self.epsilon = 0 <NEW_LINE> self.alpha = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.epsilon *= math.exp(-self.alpha / 10) <NEW_LINE> <DEDENT> return None
The reset function is called at the beginning of each trial. 'testing' is set to True if testing trials are being used once training trials have completed.
625941d0283ffb24f3c55a78
def modjobinfo(self, op_userid, userid, employee_type=None, employee_status=None, confirm_join_time=None, probation_period_type=None, regular_time=None, join_working_time=None, birth_time=None): <NEW_LINE> <INDENT> if confirm_join_time is not None and isinstance(confirm_join_time, (datetime.date, datetime.datetime)): <...
更新员工工作信息 :param op_userid: 操作人userid,必须是拥有被操作人操作权限的管理员userid :param userid: 被操作人userid :param employee_type: 员工类型(1:全职,2:兼职,3:实习,4:劳务派遣,5:退休返聘,6:劳务外包) :param employee_status: 员工状态(2:试用,3:正式) :param confirm_join_time: 入职日期 :param probation_period_type: 试用期(1:无试用期,2:1个月,3:2个月,4:3个月,5:4个月,6:5个月,7:6个月,8:其他) :param regular...
625941d007f4c71912b115fa
def unannotated_data2word_list(word_line, delimiter=u"\t"): <NEW_LINE> <INDENT> return word_line.split(delimiter)
split unannotated line to word list. Args: word_line: unicode line, seperated by delimiter. delimietr: delimeiter Returns: word_list
625941d060cbc95b062c66bb
def format_wiki_data(wiki_data): <NEW_LINE> <INDENT> formatted = [] <NEW_LINE> for entry in wiki_data: <NEW_LINE> <INDENT> city = get_wiki_city(entry) <NEW_LINE> city = remove_umlaut(city) <NEW_LINE> state = get_wiki_state(entry, city) <NEW_LINE> area = get_wiki_area(entry) <NEW_LINE> density, population = get_wiki_pop...
Takes the list of JSON formatted wiki data and removes units of measure, also extracts data from the nested population dictionary to make it easier to access.
625941d0656771135c3eb9e7
@admin.route('/categorys',methods=['GET']) <NEW_LINE> @login_required <NEW_LINE> @admin_required <NEW_LINE> def categorys(): <NEW_LINE> <INDENT> page = request.args.get('page', 1, type=int) <NEW_LINE> categorys = Category.query.order_by(Category.id.asc()).paginate(page, per_page=current_app.config['H3BLOG_POST_PER_PAGE...
分类
625941d04e696a04525c95c3
def PointIn(self,Punto2D,tolerance=0): <NEW_LINE> <INDENT> v1=self.getAX() <NEW_LINE> v2=self.getAY() <NEW_LINE> if v1==0: <NEW_LINE> <INDENT> vals=[self.__pini.getY(),self.__pfin.getY()] <NEW_LINE> vals.sort() <NEW_LINE> vals[0]=vals[0]-tolerance <NEW_LINE> vals[1]=vals[1]+tolerance <NEW_LINE> if Punto2D.getY()>=vals[...
! @brief: El método comprueba si un punto se encuentra sobre la línea. The method check if point is in line.
625941d08e05c05ec3eea4ed
def receiveGroupMessage(self, sender, group, message): <NEW_LINE> <INDENT> pass
Receive a message from 'sender' directed to a group.
625941d0c4546d3d9de72bac
def ssd_random_crop(image, boxes, labels, masks=None, keypoints=None, min_object_covered=(0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0), aspect_ratio_range=((0.5, 2.0),) * 7, area_range=((0.1, 1.0),) * 7, overlap_thresh=(0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0), random_coef=(0.15,) * 7, seed=None): <NEW_LINE> <INDENT> def random_crop_s...
Random crop preprocessing with default parameters as in SSD paper. Liu et al., SSD: Single shot multibox detector. For further information on random crop preprocessing refer to RandomCrop function above. Args: image: rank 3 float32 tensor contains 1 image -> [height, width, channels] with pixel values vary...
625941d04d74a7450ccd433b
def __ne__(self, other: 'Expansion') -> bool: <NEW_LINE> <INDENT> return not self == other
Return `true` when self and other are not equal, false otherwise.
625941d0dc8b845886cb56ad
def __radd__(self, other) -> 'Tensor': <NEW_LINE> <INDENT> return _add(ensure_tensor(other),self)
gets called if I do other + t
625941d0be8e80087fb20db9
def on_barcode(self, barcode, message, image): <NEW_LINE> <INDENT> return barcode
This is called when a barcode is available with barcode being the decoded barcode. Message is the GStreamer message containing the barcode.
625941d07b25080760e395d1
def __init__(self, parent): <NEW_LINE> <INDENT> self.serial = parent.serial <NEW_LINE> self.parent = parent <NEW_LINE> self._pan_speed = 0x05 <NEW_LINE> self._tilt_speed = 0x05 <NEW_LINE> if debug: <NEW_LINE> <INDENT> print("new visca camera")
the constructor
625941d0004d5f362079a4aa
def restore_wallet(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.remove(os.path.join(sqlite_path, 'bitshares.sqlite')) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> backup_path = os.path.join(os.getcwd(), '.backup') <NEW_LINE> if os.path.exists(os.path.join(backup_path, 'bitshares.sqlite...
Restore wallet sqlite file from tmp directory
625941d0a219f33f34628ae1
def benchmark(conf, error_on_timeout): <NEW_LINE> <INDENT> success = True <NEW_LINE> tool_combinations_run = [] <NEW_LINE> header = os.path.join(BASE_DIRECTORY, "output", "header.csv") <NEW_LINE> shutil.copy(header, OUTPUT_FILE) <NEW_LINE> os.environ['Sequences'] = str(conf.Sequences) <NEW_LINE> os.environ['Runs'] = st...
Runs measurements
625941d091af0d3eaac9bb91
def _broadcast_gradient_args(s0, s1, name=None): <NEW_LINE> <INDENT> result = _op_def_lib.apply_op("BroadcastGradientArgs", s0=s0, s1=s1, name=name) <NEW_LINE> return _BroadcastGradientArgsOutput._make(result)
Return the reduction indices for computing gradients of s0 op s1 with broadcast. This is typically used by gradient computations for a broadcasting operation. Args: s0: A `Tensor` of type `int32`. s1: A `Tensor` of type `int32`. name: A name for the operation (optional). Returns: A tuple of `Tensor` objects ...
625941d04a966d76dd551187
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, UpdateUser): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d0d7e4931a7ee9e096
def get_envs_prefixed(self, prefix: str) -> dict: <NEW_LINE> <INDENT> return dict(d for d in os.environ.items() if str(d[0]).startswith(prefix))
:param prefix: keys start with prefix :return: dict
625941d0aad79263cf390bba
def _repr_png_(self, width=None, height=None): <NEW_LINE> <INDENT> if width is None: <NEW_LINE> <INDENT> width = self.ipython_plot_width <NEW_LINE> height = self.ipython_plot_height <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> handle, name = tempfile.mkstemp( suffix=".png" ) <NEW_LINE> os.close(handle) <NEW_LINE> self....
Show the plot in the ipython notebook (ie. return png formated image data)
625941d0cc0a2c11143dd008
def test_links_get_all_duplicate_relation(self): <NEW_LINE> <INDENT> ts = TaskStatus() <NEW_LINE> relation = 'test' <NEW_LINE> uri = 'http://foo.com/test' <NEW_LINE> uri2 = 'http://baz.com/test' <NEW_LINE> ts.add_link(relation, uri) <NEW_LINE> ts.add_link(relation, uri2) <NEW_LINE> links = ts.get_links() <NEW_LINE> ass...
Get all links where a relation has multiple uris.
625941d0d6c5a102081441c3
def unit_convert(value, base, font, dpi, body_font_size=12): <NEW_LINE> <INDENT> if isinstance(value, (int, long, float)): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return float(value) * 72.0 / dpi <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> result = valu...
Return value in pts
625941d00c0af96317bb8360
def get_logger(name): <NEW_LINE> <INDENT> logger = logging.getLogger(name) <NEW_LINE> logger.setLevel(logging.INFO) <NEW_LINE> handler = logging.FileHandler("hypertrophy.log", mode='a') <NEW_LINE> formatter = logging.Formatter('%(levelname)s - %(asctime)s - %(name)s -- %(msg)s') <NEW_LINE> handler.setFormatter(formatte...
Returns an already configured logger for a specific module. (This should be used instead of stdout.) :param name: the name of the modeule where the logger is created :return: a custom configured logger object
625941d02ae34c7f2600d2a9
@pytest.mark.parametrize("dividend, divisor, expected", [ (1, 2, 0), (2, 2, 1), (3, 2, 1), (4, 2, 2), (5, 2, 2), (6, 2, 3), (8, 2, 4), (15, 3, 5), (1, -1, -1), (-1, -1, 1), (2147483648, 1, 2147483647), (-2147483648, -1, 2147483647), (2147483648, -1, -2147483648), (-2147483648, 1, -2147483648), ]) <NEW_LINE> def test_di...
NOTE: This is an unoptimized implementation, so it is not doing 2147483647 / 2
625941d03539df3088e2e4c3
def remove(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0] <NEW_LINE> <DEDENT> except MinionError as exc: <NEW_LINE> <INDENT> raise CommandExecutionError(exc) <NEW_LINE> <DEDENT> old = list_pkgs() ...
Remove packages via emerge --unmerge. name The name of the package to be deleted. slot Restrict the remove to a specific slot. Ignored if ``name`` is None. fromrepo Restrict the remove to a specific slot. Ignored if ``name`` is None. Multiple Package Options: pkgs Uninstall multiple packages. ``slo...
625941d09f2886367277aa05
def minDiffInBST(self, root): <NEW_LINE> <INDENT> global li <NEW_LINE> li = [] <NEW_LINE> self.new(root) <NEW_LINE> li = sorted(li) <NEW_LINE> mi = li[len(li)-1] <NEW_LINE> for i in range(len(li)-1,0,-1): <NEW_LINE> <INDENT> mi = min(li[i]-li[i-1],mi) <NEW_LINE> <DEDENT> return mi
:type root: TreeNode :rtype: int
625941d099fddb7c1c9de509
def test_SimpleParser_Read_Localizations(): <NEW_LINE> <INDENT> f = 'HeLaL_Control_1.csv' <NEW_LINE> inputFile = testDataRoot / Path('parsers_test_files') / Path('SimpleParser/') / Path(f) <NEW_LINE> parser = parsers.SimpleParser() <NEW_LINE> parser.parseFilename(inputFile, datasetType = 'Lo...
SimpleParser correctly reads localization results.
625941d01d351010ab855c94
def exportData(self, filename): <NEW_LINE> <INDENT> self.rec_m.exportRecord(filename)
Export textual data records that is implemented by CSV format into the specified file.
625941d076e4537e8c3517eb
def put_Element(self, index, pElement): <NEW_LINE> <INDENT> return super(ILongArray, self).put_Element(index, pElement)
Method ILongArray.put_Element INPUTS index : long pElement : long
625941d023849d37ff7b3207
def print(self): <NEW_LINE> <INDENT> for i in range(self.elementCount): <NEW_LINE> <INDENT> print(self.set[i], end=" ") <NEW_LINE> <DEDENT> print()
The print method prints elements of set list.
625941d0e76e3b2f99f3a982
def diameterOfBinaryTree(self, root): <NEW_LINE> <INDENT> if root is None: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.distance = 0 <NEW_LINE> depth = self.get_depth(root) <NEW_LINE> return self.distance-1
:type root: TreeNode :rtype: int
625941d0be7bc26dc91cd777
def run(self, draw=None, setup=None, update=None, stop=None): <NEW_LINE> <INDENT> if isinstance(setup, FunctionType): <NEW_LINE> <INDENT> self.set_method(setup, name="setup") <NEW_LINE> <DEDENT> if isinstance(draw, FunctionType): <NEW_LINE> <INDENT> self.set_method(draw, name="draw") <NEW_LINE> <DEDENT> if isinstance(u...
Open the application windows and start drawing the canvas. - Canvas.setup() will be called once during initialization. - Canvas.draw() and Canvas.update() will be called each frame. - Canvas.clear() needs to be called explicitly to clear the previous frame drawing. - Canvas.stop() closes the application window. If ...
625941d056ac1b37e6264346
def about_template(self): <NEW_LINE> <INDENT> return 'group/about.html'
Returns a string representing the location of the template to be rendered for the about page
625941d096565a6dacc8f843
def restoreIpAddresses2(self, s): <NEW_LINE> <INDENT> def dfs(u, k, s, res, path): <NEW_LINE> <INDENT> if k == 4 and u == len(s): <NEW_LINE> <INDENT> res.append('.'.join(path)) <NEW_LINE> <DEDENT> if k > 4: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> t = 0 <NEW_LINE> for i in range(u, len(s)): <NEW_LINE> <INDENT> t ...
回溯 :type s: str :rtype: List[str]
625941d023849d37ff7b3208
def _showFullScreen(self): <NEW_LINE> <INDENT> self.showFullScreen()
全屏
625941d0a79ad161976cc2be
def temporal_average(File, datasetName='coherence', updateMode=False, outFile=None): <NEW_LINE> <INDENT> atr = readfile.read_attribute(File, datasetName=datasetName) <NEW_LINE> k = atr['FILE_TYPE'] <NEW_LINE> if k not in ['ifgramStack', 'timeseries']: <NEW_LINE> <INDENT> print('WARNING: input file is not multi-temporal...
Calculate temporal average of multi-temporal dataset, equivalent to stacking For ifgramStakc/unwrapPhase, return average phase velocity Parameters: File : string, file to be averaged in time datasetName : string, dataset to be read from input file, for multiple datasets file - ifgramStack -...
625941d0379a373c97cfacbd
def parse_ffmpeg_output(text): <NEW_LINE> <INDENT> state = None <NEW_LINE> result = {'input': '', 'output': ''} <NEW_LINE> for line in text.split('\n'): <NEW_LINE> <INDENT> if line.startswith("Input"): <NEW_LINE> <INDENT> state = "INPUT" <NEW_LINE> <DEDENT> elif line.startswith("Output"): <NEW_LINE> <INDENT> state = "O...
Get relevant info from the ffmpeg output
625941d091f36d47f21ac66c
def quit(self): <NEW_LINE> <INDENT> if self.playing_flag and self.player: <NEW_LINE> <INDENT> self.playing_flag = False <NEW_LINE> try: <NEW_LINE> <INDENT> self.player.close() <NEW_LINE> <DEDENT> except IOError as e: <NEW_LINE> <INDENT> log.error(e)
退出播放
625941d032920d7e50b28349
def decode(self, du, bitPos): <NEW_LINE> <INDENT> paramType = self.getParamType() <NEW_LINE> bitWidth = self.getBitWidth() <NEW_LINE> value = self.value <NEW_LINE> nextBitPos = bitPos + bitWidth <NEW_LINE> if paramType == UTIL.DU.BITS: <NEW_LINE> <INDENT> self.value = du.getBits(bitPos, bitWidth) <NEW_LINE> return next...
decodes the contens from a data unit, returns the new position overloaded from Entity
625941d085dfad0860c3afd4
def listen(self): <NEW_LINE> <INDENT> ssl_factory = Factory() <NEW_LINE> ServerInterfaceSSLProtocol.agent_listener = self <NEW_LINE> ssl_factory.protocol = ServerInterfaceSSLProtocol <NEW_LINE> ssl_context_factory = twisted.internet.ssl.DefaultOpenSSLContextFactory( self.key_file_name, self.cert_file_name) <...
Called when we should start listening to requests
625941d0ab23a570cc2502fb
def get_match_status_bgrole(ibs, aid_pair): <NEW_LINE> <INDENT> aid1, aid2 = aid_pair <NEW_LINE> truth = ibs.get_match_truth(aid1, aid2) <NEW_LINE> truth_color = vh.get_truth_color(truth, base255=True, lighten_amount=0.35) <NEW_LINE> return truth_color
Background role for status column
625941d0851cf427c661a687
def execute(self, queuecmd=False): <NEW_LINE> <INDENT> es.mexec('..' + self.cfgpath.replace(self.gamedir, '', 1))
Executes the config
625941d0b830903b967e9a83