code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def RunMessage(self, message, iscomment = False): <NEW_LINE> <INDENT> if iscomment: <NEW_LINE> <INDENT> self.addline("' " + message) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.addline('Print "%s"' % message)
Display a message in the robot controller screen (teach pendant)
625941cb5fcc89381b1e1790
def positive_reciprocal(X): <NEW_LINE> <INDENT> X = np.asarray(X) <NEW_LINE> return np.where(X <= 0, 0, 1. / X)
Return element-wise reciprocal of array, setting `X`>=0 to 0 Return the reciprocal of an array, setting all entries less than or equal to 0 to 0. Therefore, it presumes that X should be positive in general. Parameters ---------- X : array-like Returns ------- rX : array array of same shape as `X`, dtype np.float,...
625941cb3617ad0b5ed67fc9
def step(self, inp): <NEW_LINE> <INDENT> return self.feedforward(inp=inp)
Method to step through a unit in time. Useful only for recurrent layers.
625941cbc432627299f04d17
def connect(self, receiver, signal, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('sender', self.sender) <NEW_LINE> dispatcher.connect(receiver, signal, **kwargs)
Connect a receiver to specified signal. Receiver can be either coroutine function or a regular function. :param kwargs: Passed to `pydispatch.dispatcher.connect`
625941cb15baa723493c4047
def make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return PresidentialByStatePage( pagination = openfec_sdk.models.offset_info.OffsetInfo( count = 56, page = 56, pages = 56, per_page = 56, ), results = [ openfec_sdk.models.presidential_by_state.PresidentialByState( ...
Test PresidentialByStatePage include_option is a boolean, when False only required params are included, when True both required and optional params are included
625941cb44b2445a33932168
def test_overall(eng, config_test): <NEW_LINE> <INDENT> assert config_test <NEW_LINE> eng.exe("let g:nvimgdb_config_override = {'key_next': '<f5>'}") <NEW_LINE> eng.exe("let g:nvimgdb_key_step = '<f5>'") <NEW_LINE> eng.feed(":GdbStart ./dummy-gdb.sh\n") <NEW_LINE> res = eng.exec_lua('return NvimGdb.i().config:get_or("k...
Smoke test.
625941cb090684286d50edb7
def clip_path(filepath): <NEW_LINE> <INDENT> fileslist = filepath.split('/') <NEW_LINE> return fileslist[-1]
Clip path to get file name
625941cbd268445f265b4f40
def is_ramping(self): <NEW_LINE> <INDENT> if self._worker_thread is not None and self._worker_thread.is_alive(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Check is the program is done executing.
625941cb435de62698dfdd1e
def smmarize_sales(): <NEW_LINE> <INDENT> wb = xw.Book.caller() <NEW_LINE> db_file = os.path.join(os.path.dirname(wb.fullname), 'pbp_proj.db') <NEW_LINE> engine = create_engine(r"sqlite:///{}".format(db_file)) <NEW_LINE> account = xw.Range('B2').options(numbers=int).value <NEW_LINE> start_date = xw.Range('D2').value <N...
Retrieve the account number and date ranges fro Excel sheet
625941cbf8510a7c17cf97ce
def add_to_emails(self, *emails): <NEW_LINE> <INDENT> assert all(isinstance(element, str) for element in emails), emails <NEW_LINE> post_parameters = {"emails": emails} <NEW_LINE> headers, data = self._requester.requestJsonAndCheck( "POST", "/user/emails", input=post_parameters )
:calls: `POST /user/emails <http://docs.github.com/en/rest/reference/users#emails>`_ :param email: string :rtype: None
625941cb07d97122c417895d
def get_str(self, data: bytes) -> str: <NEW_LINE> <INDENT> return data.decode('utf-8')
Convert to str
625941cb26238365f5f0ef40
def test_clone_version(self): <NEW_LINE> <INDENT> for version in start_version_test(): <NEW_LINE> <INDENT> sys.argv = ['virtualenv-clone', venv_path, clone_path] <NEW_LINE> clonevirtualenv.main() <NEW_LINE> clone_version = clonevirtualenv._virtualenv_sys(clone_path)[0] <NEW_LINE> assert version == clone_version, 'Expec...
Verify version for cloned virtualenvs
625941cb187af65679ca51f1
def __init__(self, embeddings, embeddings_dropout=0.0, proj_mlp_layers=1, proj_mlp_activation=torch.tanh, proj_mlp_dropout=0.5, proj_size=50, is_gru=True, cell_hidden_size=128, stacked_layers=1, bidirectional=False, top_mlp_layers=1, top_mlp_activation=relu, top_mlp_outer_activation=None, top_mlp_dropout=0.0): <NEW_LIN...
:param embeddings: the matrix of the embeddings :param embeddings_dropout: dropout of the embeddings layer :param proj_mlp_layers: number of layers of the projection mlp :param proj_mlp_activation: activation function of the projection mlp (usually tanh) :param proj_mlp_dropout: dropout of the projection :param proj_si...
625941cbbf627c535bc132a1
@asyncio.coroutine <NEW_LINE> def test_install_suite(hass, hass_client): <NEW_LINE> <INDENT> with patch.dict(os.environ, {'FORCE_HASSBIAN': '1'}), patch.object(config, 'SECTIONS', ['hassbian']): <NEW_LINE> <INDENT> yield from async_setup_component(hass, 'config', {}) <NEW_LINE> <DEDENT> client = yield from h...
Test getting suites.
625941cba4f1c619b28b010c
def sleep_receiver_function(signal, sender, data, params): <NEW_LINE> <INDENT> sleep(1)
Sleeps for one second. This is used as receiver of a signal (eg. when resource is created).
625941cb8c3a87329515848c
def read_len_with_integrity(n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> elif n == 1: <NEW_LINE> <INDENT> return 2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return n+2
Return the number of bytes needed to read a buffer of length `n` where the buffer that is read will have integrity bytes added.
625941cbac7a0e7691ed419f
def find(self, name): <NEW_LINE> <INDENT> return Search(self.request).find(name)
Find an existing domain registration. Parameters ---------- name: str The domain name to check Returns ------- Status The status of the domain registration
625941cb5fcc89381b1e1791
def _acl_admin(self, func): <NEW_LINE> <INDENT> allowed_gid = {1,} <NEW_LINE> return self._acl_groups(func, allowed_gid)
Restrict access to callbacks to administators only
625941cbb545ff76a8913ee9
def get_reservation_attachment(self, sandbox_id, filename, save_path): <NEW_LINE> <INDENT> get_result = requests.post(self._api_base_url + "/Package/GetReservationAttachment", {"ReservationId":sandbox_id, "FileName": filename}, headers={"Authorization": self._auth_code}) <NEW_LINE> if 200 <= get_result.status_code < 30...
Download an attached file from a Sandbox. The downloaded file will be saved at {save_path} ilename :param sandbox_id: ID of the reservation containing the file :param filename: File to get from the reservation :param target_filename: target file name to save the file as
625941cbaad79263cf390b13
def test_institute_settings(app, user_obj, institute_obj): <NEW_LINE> <INDENT> test_panel = store.panel_collection.find_one() <NEW_LINE> assert test_panel <NEW_LINE> mock_disease_terms = [ {"_id": "HP:0001298", "description": "Encephalopathy", "hpo_id": "HP:0001298"}, {"_id": "HP:0001250", "description": "Seizures", "h...
Test function that creates institute update form and updates an institute
625941cba8ecb033257d319f
def __init__(self, engine , gui_parent, parent=None): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.setWindowTitle ("Enregistrement d'une formation") <NEW_LINE> self.engine = engine <NEW_LINE> self.dateEdit.setDate(pendulum.now('Europe/Paris')) <NEW_LINE> self.cmr_bdd = Bdd_...
Constructor @param parent reference to the parent widget (QWidget)
625941cb30dc7b7665901a39
def psdTextureFile(*args, **kwargs): <NEW_LINE> <INDENT> pass
Creates a Photoshop file with UVSnap shot image and the layer set names as the input. Dynamic library stub function Flags: - channelRGB : chc (unicode, int, int, int, int) [create] (M) Layer set names, index, red, green and blue values are given as input. Using this flag, the layers created can ...
625941cb5166f23b2e1a522b
def SNSpatialRate2D(spikeTimes, rat_pos_x, rat_pos_y, dt, arenaDiam, h): <NEW_LINE> <INDENT> precision = arenaDiam/h <NEW_LINE> xedges = np.linspace(-arenaDiam/2, arenaDiam/2, precision+1) <NEW_LINE> yedges = np.linspace(-arenaDiam/2, arenaDiam/2, precision+1) <NEW_LINE> rateMap = np.zeros((len(xedges), len(yedges))) <...
Preprocess neuron spike times into a spatial rate map, given arena parameters. Both spike times and rat tracking data must be aligned in time!
625941cb26068e7796caedb1
def scalambdable_func(fn, *funcs): <NEW_LINE> <INDENT> def wrapped(*args, **kwargs): <NEW_LINE> <INDENT> for f in reversed((fn,) + funcs): <NEW_LINE> <INDENT> if any(map(is_scalambda_object, args)) or any(map(is_scalambda_object, kwargs.values())): <NEW_LINE> <INDENT> args = [FunctionCall(f, list(map(convert_operand, a...
Wrap function to scalambdable. :type fn: (T)->U :type funcs: ((Any)->Any, ...) :rtype: (T)->U
625941cb1d351010ab855bee
def tiny_decrypt(ctxt: list, kx: list, spice: list, blocksize: int, backup: int = 0) -> list: <NEW_LINE> <INDENT> s0 = ctxt[0] <NEW_LINE> for cycle_num in reversed(range(1 + backup)): <NEW_LINE> <INDENT> s0 = mask_lower(m_sub(s0, kx[blocksize + 8]), blocksize) <NEW_LINE> if 1 <= blocksize < 7: <NEW_LINE> <INDENT> s0 = ...
Encryption of Tiny Subciphers (0 <= blocksize < 36)
625941cb956e5f7376d70f40
def get_choice(): <NEW_LINE> <INDENT> valid_response = False <NEW_LINE> choice = "" <NEW_LINE> while not valid_response: <NEW_LINE> <INDENT> choice = input(">>> ") <NEW_LINE> if choice == CHOICE_FILE or choice == CHOICE_DIRECT: <NEW_LINE> <INDENT> valid_response = True <NEW_LINE> <DEDENT> else: print(INVALID_CHOICE_MES...
Get the choice of the user from input and ensure the choice is valid. Returns: a String indicating the preference of the user
625941cb71ff763f4b54975d
def set_test_config(ns, cfg_name=None, cfg_section=None): <NEW_LINE> <INDENT> global _test_config <NEW_LINE> _test_config = TestConfig(ns, cfg_name, cfg_section)
Set a test config. All subsequent calls to `get_test_config()` will retrieve the same configuration, until a new config is explicitly set with this method again.
625941cb5510c4643540f4b7
@click.command() <NEW_LINE> @click.option('--seed', type=int, help='Generate goals using this SEED for numpy.random') <NEW_LINE> @click.option('--n_2d_goals', type=int, default=25, help='# of 2D goals (default 25)') <NEW_LINE> @click.option('--n_25d_goals', type=int, default=15, help='# of 2.5D goals (default 15)') <NE...
Generates the specified number of goals and saves them in a file. The file is called goals-REAL2020-s{}-{}-{}-{}-{}.npy.npz where enclosed brackets are replaced with the supplied options (seed, n_2d_goals, n_25d_goals, n_3d_goals, n_obj) or the default value.
625941cb23e79379d52ee637
def toBitList(st): <NEW_LINE> <INDENT> return list(map(lambda x: ord(x)-ord('0'), st))
Convert bit string to bit list of integers
625941cb3617ad0b5ed67fca
def on_data(self, data): <NEW_LINE> <INDENT> for item in data: <NEW_LINE> <INDENT> thread_status = self.e.isSet() <NEW_LINE> if thread_status: <NEW_LINE> <INDENT> self.c.log('Collection thread set to shut down. Shutting down.', thread=self.thread) <NEW_LINE> self.running = False <NEW_LINE> break <NEW_LINE> <DEDENT> try...
Parses raw data and calls Collector's write() method to send to a file
625941cb1f5feb6acb0c4c24
def run(url): <NEW_LINE> <INDENT> os.system('open "{0}"'.format(url))
Open current comic in defualt webbrowser
625941cbadb09d7d5db6c862
def get_new_count_from_user(field_type, limit=0): <NEW_LINE> <INDENT> if limit < 0: <NEW_LINE> <INDENT> raise ValueError("Limit must be greater than or equal to 0") <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> count = click.prompt("Enter the new {} count (leave blank to skip)".format(field_type), default=-1, sho...
Prompt the user for a new episode/chapter/volume count and return it :param field_type: A string, :param limit: An integer, the number of episodes/chapters/volumes in a series :return: An integer, the new episode count or None if the user cancelled
625941cb498bea3a759b9b81
def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> print(self.prompt[:-2] + Colors.MAGENTA + self.prompt[-2:] + Colors.WHITE, end="") <NEW_LINE> command = input() <NEW_LINE> if command == "exit": <NEW_LINE> <INDENT> if self.supershell is None: <NEW_LINE> <INDENT> sys.exit() <NEW...
the main method of the shell running the infinite loop, continuesly prompting for a command, then attempting to execute the issued command :return: (void)
625941cb0a50d4780f666f65
def default_random_generator(n): <NEW_LINE> <INDENT> return np.random.uniform(size=n) ** 2
X_i^2 where X_i comes from a U[0,1] :param n: n is length of random numbers needed :return: vector of random numbers
625941cb55399d3f05588786
def price(self, ticker=None) -> float: <NEW_LINE> <INDENT> url = f'{self.BASE}/api/v3/ticker/price' <NEW_LINE> err_msg = "Error on latest_price()" <NEW_LINE> kwargs = dict(additional_params={'symbol': ticker}) if ticker is not None else dict() <NEW_LINE> return float(self.__unsigned_request(url, err_msg=err_msg, **kwar...
Current market price. Gets the current market price for a given ticker, or for all tickers if no ticker is specified. Args: ticker (`str`, optional) -- the currency pair. Defaults to None. Returns: `float`: The price of the ticker. Raises: BinanceException: If the request is malformed or incorrect.
625941cb30bbd722463cbe98
def __init__(self, app, nworkers, **kwargs): <NEW_LINE> <INDENT> assert chronos, CHRONOS_IMPORT_MSG <NEW_LINE> if self.RUNNER_PARAM_SPEC_KEY not in kwargs: <NEW_LINE> <INDENT> kwargs[self.RUNNER_PARAM_SPEC_KEY] = {} <NEW_LINE> <DEDENT> kwargs[self.RUNNER_PARAM_SPEC_KEY].update(self.RUNNER_PARAM_SPEC) <NEW_LINE> super(C...
Initialize this job runner and start the monitor thread
625941cb55399d3f05588787
def parse_data(self, data, raw_data): <NEW_LINE> <INDENT> self._should_poll = False <NEW_LINE> value = data.get(self._data_key) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if value == "leak": <NEW_LINE> <INDENT> self._should_poll = True <NEW_LINE> if self._state: <NEW_LINE> <INDENT...
Parse data sent by gateway.
625941cb92d797404e30425c
def initialize(context): <NEW_LINE> <INDENT> import criteria <NEW_LINE> content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) <NEW_LINE> for atype, constructor in zip(content_types, constructors): <NEW_LINE> <INDENT> utils.ContentInit('%s: %s' % (config.PROJEC...
Initializer called when used as a Zope 2 product.
625941cb76d4e153a657ec03
def test_addtokenprop(self): <NEW_LINE> <INDENT> fname = self.repo.path + '/__root__/__meta__' <NEW_LINE> with open(fname, 'r') as f: <NEW_LINE> <INDENT> content = f.read() <NEW_LINE> <DEDENT> data = dict(helpers.literal_eval(content)) <NEW_LINE> prop = { 'id': 'testprop', 'type': 'tokens', 'value': ('123', '518'), } <...
Validate tokens are correctly written
625941cb63d6d428bbe445c2
def scan(self, time): <NEW_LINE> <INDENT> conn = sqlite3.connect(self.data_file) <NEW_LINE> conn.row_factory = sqlite3.Row <NEW_LINE> c = conn.cursor() <NEW_LINE> if isinstance(time, float): <NEW_LINE> <INDENT> scan_num = self.scanForTime(time) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> scan_num = time <NEW_LINE> <D...
Gets scan based on the specified scan time The scan is a list of (mz, intensity) pairs. Example: >>> scan = myPeakFile.scan(20.035)
625941cb66673b3332b92164
def get(url): <NEW_LINE> <INDENT> protocol, host, port, path = parsed_url(url) <NEW_LINE> s = socket_by_protocol(protocol) <NEW_LINE> s.connect((host, port)) <NEW_LINE> request = 'GET {} HTTP/1.1\r\nhost: {}\r\nConnection: close\r\n\r\n'.format(path, host) <NEW_LINE> encoding = 'utf-8' <NEW_LINE> s.send(request.encode(...
用 GET 请求 url 并返回响应
625941cb4e696a04525c951e
def get_import(self, import_id: str): <NEW_LINE> <INDENT> url = str('/imports/' + import_id) <NEW_LINE> r = self._getresponse_client.get(url) <NEW_LINE> return r
Get import by id :param import_id: import id :return:
625941cbd486a94d0b98e218
def cleandata(self, data, threshold=3.0, dumbmask=True): <NEW_LINE> <INDENT> if dumbmask: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> dumb_rfimask = np.loadtxt('/home/arts/ARTS-obs/amber_conf/zapped_channels.conf') <NEW_LINE> dumb_rfimask = list(dumb_rfimask.astype(int)) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT>...
Take filterbank object and mask RFI time samples with average spectrum. Parameters: ---------- data : np.ndarray (nfreq, ntime) array threshold : float units of sigma Returns: ------- cleaned filterbank object
625941cb30c21e258bdfa570
def validate_dataset(self, dataset, indices=None, tag_pattern=None): <NEW_LINE> <INDENT> status = True <NEW_LINE> if self.saved_indices is None: <NEW_LINE> <INDENT> self.saved_indices = hxl.model.get_column_indices([self.tag_pattern], dataset.columns) <NEW_LINE> <DEDENT> for error in self.external_errors: <NEW_LINE> <I...
Test whether the columns are present to satisfy this rule.
625941cb99cbb53fe6792cb9
def log_bug(self, filename, board, depth, exc_tuple): <NEW_LINE> <INDENT> exc_type, exc_value, exc_traceback = exc_tuple <NEW_LINE> fbug = open("bug.log", "a") <NEW_LINE> exception_str = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) <NEW_LINE> fbug.write("bug in fen = [{!s}] with \"{!s}\", PV=...
Log an exception which occured in a given board to a file.
625941cb60cbc95b062c6616
def normalize(self): <NEW_LINE> <INDENT> if self.w < 0: <NEW_LINE> <INDENT> self.x += self.w <NEW_LINE> self.w = -self.w <NEW_LINE> <DEDENT> if self.h < 0: <NEW_LINE> <INDENT> self.y += self.h <NEW_LINE> self.h = -self.h <NEW_LINE> <DEDENT> return self
Correct negative sizes of the rectangle. This will flip the width or height of a rectangle if it has a negative size. The rectangle will remain in the same place, with only the sides swapped. Usage: rect.normalize() Returns: None
625941cb7b180e01f3dc48d0
def _PickFinalStateFromHistory(acc_state, sequence_length): <NEW_LINE> <INDENT> last_value = [] <NEW_LINE> for state_var in nest.flatten(acc_state): <NEW_LINE> <INDENT> shape = array_ops.shape(state_var) <NEW_LINE> max_time, batch_size = shape[0], shape[1] <NEW_LINE> output_time = array_ops.tile(math_ops.range(0, max_t...
Implements acc_state[sequence_length - 1].
625941cbf7d966606f6aa0d7
def generate_auth_content(self, signature_product_id: str, signature_timestamp: int, signature_result: str ) -> str: <NEW_LINE> <INDENT> if not signature_product_id or not isinstance(signature_product_id, str): <NEW_LINE> <INDENT> raise ValueError('<signature_product_id> value invalid') <NEW_LINE> <DEDENT> if not signa...
Generates a signed authentication context string that can be verified by Cloud API. Args: signature_product_id: Cloud API's product unique identifier. signature_timestamp: Signature UNIX timestamp. signature_result: Signature calculation result string. Returns: Returns the authentication context s...
625941cbc4546d3d9de72b07
def test_untrash_score(self): <NEW_LINE> <INDENT> pass
Test case for untrash_score Untrash a score # noqa: E501
625941cbf9cc0f698b1406cf
def tracker_from_state_info(state): <NEW_LINE> <INDENT> sun_az = state.get_sun_angle_AZ() <NEW_LINE> sun_alt = state.get_sun_angle_ALT() <NEW_LINE> return sun_az, sun_alt
Args: state (SolarOOMDP state): contains the panel and sun az/alt. panel_shift (int): how much to move the panel by each timestep. Returns: (tuple): <sun_az, sun_alt>
625941cb66656f66f7cbc27e
@main_blueprint.route('/guide') <NEW_LINE> def guide(): <NEW_LINE> <INDENT> return render_template('guide.html')
帮助页面
625941cb627d3e7fe0d68f22
def __init__(self, objeto = None, usuario = None): <NEW_LINE> <INDENT> Ventana.__init__(self, 'busca_lote.glade', objeto, usuario = usuario) <NEW_LINE> connections = {'b_salir/clicked': self.salir, 'b_buscar/clicked': self.buscar, 'b_ayuda/clicked': self.ayuda} <NEW_LINE> self.add_connections(connections) <NEW_LINE> co...
Constructor. objeto puede ser un objeto de pclases con el que comenzar la ventana (en lugar del primero de la tabla, que es el que se muestra por defecto).
625941cb8a43f66fc4b54138
def rgb2hash(red, green, blue): <NEW_LINE> <INDENT> rgb = (red, green, blue) <NEW_LINE> return '#%02x%02x%02x' % rgb
Convert rgb to hexadecimal Parameters ---------- red : int red component green : int green component blue : int blue component Returns ------- hash : str hexadecimal colour
625941cb57b8e32f5248356d
def set_status_for_bulk_edit(self, status): <NEW_LINE> <INDENT> self.switch_to_frame(self.app_container_frame_locator) <NEW_LINE> try: <NEW_LINE> <INDENT> self.single_selection_from_static_kendo_dropdown(self.bulk_edit_status_kendo_dropdown_locator, status) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise <NEW_LIN...
Implementing set status for bulk edit functionality :param status: :return:
625941cb0c0af96317bb82bb
def set(self, key, value, timeout=None, overwrite=True): <NEW_LINE> <INDENT> if timeout is None: <NEW_LINE> <INDENT> timeout = self.default_timeout <NEW_LINE> <DEDENT> if len(self) >= self.max_entries: <NEW_LINE> <INDENT> self._cull() <NEW_LINE> <DEDENT> expires = datetime.fromtimestamp( time.time() + timeout ).replace...
Set a cached value. :param key: The key to identify the cached value. :param value: The value to cache. :param timeout: The timeout in seconds till the key decays. :param overwrite: Overwrite existing values or not.
625941cb236d856c2ad448ad
def dropdb(*args, **kwargs): <NEW_LINE> <INDENT> subprocess.run(['dropdb', kwargs['DATABASE_NAME']]) <NEW_LINE> print("Dropping database {}".format(kwargs['DATABASE_NAME']))
Drop specific database.
625941cb442bda511e8be4ec
def _normalize(self, result): <NEW_LINE> <INDENT> if (isinstance(result, Sequence) and len(result) == 2 and not isinstance(result[1], BaseDifference)): <NEW_LINE> <INDENT> differences, description = result <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> differences = result <NEW_LINE> description = '' <NEW_LINE> <DEDENT>...
Return a normalized *result* as a 2-tuple (containing an iterable of differences and a string description) or None.
625941cb23849d37ff7b3162
def follow_subrequest(request, subrequest, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return request.invoke_subrequest(subrequest, **kwargs), subrequest <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> resp = render_view_to_response(e, subrequest) <NEW_LINE> if not re...
Run a subrequest (e.g. batch), and follow the redirection if any. :rtype: tuple :returns: the reponse and the redirection request (or `subrequest` if no redirection happened.)
625941cb73bcbd0ca4b2c149
def get_correctness_test_inputs(use_numpy, use_validation_data, with_distribution, x_train, y_train, x_predict): <NEW_LINE> <INDENT> training_epochs = 2 <NEW_LINE> global_batch_size = _GLOBAL_BATCH_SIZE <NEW_LINE> batch_size = get_batch_size(global_batch_size, with_distribution) <NEW_LINE> if use_numpy: <NEW_LINE> <IND...
Generates the inputs for correctness check when enable Keras with DS.
625941cb7d847024c06be38e
def test_predict(self): <NEW_LINE> <INDENT> im_dim = Shape(3, 64, 64) <NEW_LINE> num_cls, num_layers = 10, 7 <NEW_LINE> net = orpac_net.Orpac(self.sess, im_dim, num_layers, num_cls, None, False) <NEW_LINE> self.sess.run(tf.global_variables_initializer()) <NEW_LINE> assert net.trainable() is not True <NEW_LINE> img = np...
Ensure the 'predict' method succeeds. This test does not assess the numerical output but merely ensures the method works when the provided parameters have the correct shape and type.
625941cb8da39b475bd65046
def test_get_dog_0(self): <NEW_LINE> <INDENT> pass
Test trying to get a dog when there are only cats in the shelter
625941cb8da39b475bd65047
def loop(): <NEW_LINE> <INDENT> l_boiler.loop()
The body of the node code
625941cb96565a6dacc8f79e
def image_proxy(self, image_url): <NEW_LINE> <INDENT> if image_url: <NEW_LINE> <INDENT> return '{0}?source={1}'.format(self.config['links']['imageProxy'], image_url) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
Request the image from C More's image proxy. Can be extended to resize/add image effects automatically. See https://imageproxy.b17g.services/docs for more information.
625941cbd6c5a1020814411e
def fibonacci(n): <NEW_LINE> <INDENT> if n in known: <NEW_LINE> <INDENT> return known[n] <NEW_LINE> <DEDENT> res = fibonacci(n-1) + fibonacci(n-2) <NEW_LINE> known[n] = res <NEW_LINE> return res
“memoized” version of fibonacci
625941cb925a0f43d2549f4a
def test_retrieve_ingredients_list(self): <NEW_LINE> <INDENT> Ingredient.objects.create(user=self.user, name='Cucumber') <NEW_LINE> Ingredient.objects.create(user=self.user, name='Pepper') <NEW_LINE> res = self.client.get(INGREDIENTS_URL) <NEW_LINE> ingredients = Ingredient.objects.all().order_by('-name') <NEW_LINE> se...
Test retrieving a list of ingredients
625941cb21a7993f00bc7dc2
def __setitem__(self, key, value): <NEW_LINE> <INDENT> self._config[key] = value
Inserts value into internal dict :type key: str :type value: object :param key: key :param value: data :return: None
625941cb2c8b7c6e89b35894
def load_frame_data(series, episode): <NEW_LINE> <INDENT> series_frame_data = load_json(OFFSETS_JSON)[series] <NEW_LINE> try: <NEW_LINE> <INDENT> op_offset = get_op_offset(series, int(episode), series_frame_data) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> op_offset = None <NEW_LINE> <DEDENT> return seri...
Load the JSON data of frame offsets for one series
625941cb7b180e01f3dc48d1
def setup(self): <NEW_LINE> <INDENT> pass
Initialize process context and events loop and initialize stream
625941cb9b70327d1c4e0ea8
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 16 <NEW_LINE> self.orientation = _struct_4f.unpack(str[start:end]) <NEW_LINE> return self <NEW_LINE> <DEDENT> except struct.error as e: <NEW_LINE> <INDENT> raise genpy.DeserializationError(e)
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941cb7d43ff24873a2d74
def __on_do_selection(self, row): <NEW_LINE> <INDENT> children = self._box.get_children() <NEW_LINE> selected = None <NEW_LINE> end = children.index(row) + 1 <NEW_LINE> for child in children: <NEW_LINE> <INDENT> if child == row: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if child.get_state_flags() & Gtk.StateFlags.S...
Select rows from start (or any selected row) to track @param row as AlbumRow
625941cba17c0f6771cbe124
def mask_data(self, mask): <NEW_LINE> <INDENT> indices = self._iter_indices(*self.__spatial) <NEW_LINE> for indextuple in indices: <NEW_LINE> <INDENT> self.__setitem__( indextuple, np.ma.masked_where(mask, self.__getitem__(indextuple), copy=True)) <NEW_LINE> <DEDENT> return self
Method to mask the data array from a given boolean array. The array must match to the shape of the longitude and latitude axis
625941cb50485f2cf553ce6d
def create_sphinx_docs(package_dir, package_name, package_description, author_name, **kwargs): <NEW_LINE> <INDENT> docs_dir = folder_creator(package_dir, 'docs') <NEW_LINE> cmd = ['sphinx-quickstart', '--sep', f'--project={package_name}', f'--author="{author_name}"', '--ext-autodoc', '--ext-viewcode', '--extensions=sph...
Creates ``docs`` folder for documentation via sphinx. Args: package_dir (str): Full path to package directory. package_name (str): Package name that's being created. package_description (str): The created package descriptions. author_name (str): The package author's name. Returns: None
625941cb71ff763f4b54975e
def __matmul__(self, position: Point = Point()) -> None: <NEW_LINE> <INDENT> x = position.x <NEW_LINE> y = position.y <NEW_LINE> if x > Config.BORDER_X_MAX: <NEW_LINE> <INDENT> x = Config.BORDER_X_MAX <NEW_LINE> <DEDENT> if x < Config.BORDER_X_MIN: <NEW_LINE> <INDENT> x = Config.BORDER_X_MIN <NEW_LINE> <DEDENT> if y > ...
>>> dragon = Character(name='Red', position_x=0, position_y=0) >>> dragon >> Direction(right=1) >>> dragon.position Point(x=1, y=0) >>> dragon >> Direction(down=1) >>> dragon.position Point(x=1, y=1) >>> dragon >> Direction(left=2) >>> dragon.position Point(x=0, y=1) >>> dragon >> Direction(up=2) >>> dragon.position Po...
625941cb462c4b4f79d1d7a4
def MemWrite(self, address, count, data): <NEW_LINE> <INDENT> if (count > 4): <NEW_LINE> <INDENT> print('MemWrite: max count is 4') <NEW_LINE> return <NEW_LINE> <DEDENT> self.h.write([self.MEM_WRITE, address, count, data[0:count]] + [0]*(5-count))
This command writes data to the non-volatile EEPROM memory on the device. The non-volatile memory is used to store calibration coefficients, system information and user data. address: the start address to write. |-----------------------------------------| | Range | Usage | |---...
625941cb4527f215b584c52a
def count_one_collection( collection, collection_name, query_args_func, valid_keys): <NEW_LINE> <INDENT> result = [] <NEW_LINE> spec = handlers.common.query.get_query_spec( query_args_func, valid_keys) <NEW_LINE> handlers.common.query.get_and_add_date_range(spec, query_args_func) <NEW_LINE> handlers.common.query.get_an...
Count all the available documents in the provide collection. :param collection: The collection whose elements should be counted. :param collection_name: The name of the collection to count. :type collection_name: str :param query_args_func: A function used to return a list of the query arguments. :type query_args_func...
625941cbdd821e528d63b27c
def ContextualiseActivity(inputs, params, reg=True): <NEW_LINE> <INDENT> kernel_reg, activity_reg = get_regularization(reg) <NEW_LINE> layers = [] <NEW_LINE> for col_index in params['cols']['activity']: <NEW_LINE> <INDENT> cols = K.constant([col_index] + params['cols']['ctx'], dtype='int32') <NEW_LINE> layer_name = 'in...
Each no-context feature combined with a list of context features.
625941cb44b2445a33932169
def t400240_x7(gesture1=6, z1=9015, flag1=6056): <NEW_LINE> <INDENT> if GetEventStatus(flag1) == 1: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> AcquireGesture(gesture1) <NEW_LINE> OpenItemAcquisitionMenu(3, z1, 1) <NEW_LINE> SetEventState(flag1, 1) <NEW_LINE> assert not IsMenuOpen(63) and Get...
State 0,1
625941cbd8ef3951e3243611
def get_reduced_data(self): <NEW_LINE> <INDENT> raise NotImplementedError
Approximate the data with a reduced set and return it.
625941cb004d5f362079a406
def prob(n,probsBuilderDict): <NEW_LINE> <INDENT> prob = 0 <NEW_LINE> for i in range(n-6,n): <NEW_LINE> <INDENT> prob += probsBuilderDict[i] * 1/6 <NEW_LINE> <DEDENT> return prob
This function determines the probability that you will land on space n in the course of the game. In order to land on n, then you had to have landed on one of the preceeding six spaces in the turn immediately before. Basically there are six possibilities: Land on space n-6 and roll a 6, land on space n-5 and ...
625941cbe1aae11d1e749d8a
def update_topics(mongo_collection, name, topics): <NEW_LINE> <INDENT> mongo_collection.update_many( {"name": name}, {"$set": {"topics": topics}} )
Update documents in given collection
625941cb6e29344779a626e5
def rem_showwidget(self,stream): <NEW_LINE> <INDENT> funcname = self.__class__.__name__ + '.rem_showwidget()' <NEW_LINE> logger.debug(funcname + ':' + str(stream)) <NEW_LINE> for i,showwidget in enumerate(self.showwidgets): <NEW_LINE> <INDENT> if(showwidget.stream.socket.uuid == stream.socket.uuid): <NEW_LINE> <INDENT>...
Removes a showwidget containing the stream object from the layout
625941cb711fe17d8254243f
def get_languages(self): <NEW_LINE> <INDENT> headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/languages", None, None ) <NEW_LINE> return data
:calls: `GET /repos/:user/:repo/languages <http://developer.github.com/v3/todo>`_ :rtype: dict of string to integer
625941cb91af0d3eaac9baec
def test_secc_with_manager(self): <NEW_LINE> <INDENT> environ = {'REMOTE_USER': 'manager'} <NEW_LINE> resp = self.app.get('/secc', extra_environ=environ, status=200) <NEW_LINE> ok_('Secure Controller here' in resp.text, resp.text)
The manager can access the secure controller
625941cbcb5e8a47e48b7b7e
def load_system(doc, name, ins, outs): <NEW_LINE> <INDENT> system = system_class.System(name, None, ins, outs) <NEW_LINE> for line in doc: <NEW_LINE> <INDENT> command, rest = line.split(None, 1) <NEW_LINE> if command == "import": <NEW_LINE> <INDENT> path, name = parse_import(rest) <NEW_LINE> system.add_import((path, na...
Build a system object from the commands in the file.
625941cb8a43f66fc4b54139
def make_test_train_splits(df,target_col,target_class_col,target_class_colLAGGED,test_size,valid_size=0): <NEW_LINE> <INDENT> X_test = df[-test_size:] <NEW_LINE> X_valid = df[-(test_size + valid_size):-test_size] <NEW_LINE> X_train = df[:-(test_size + valid_size)] <NEW_LINE> X_train_valid = df[:-test_size] <NEW_LINE> y...
takes sizes of test,train,valid splits. creates new dfs for each removes target column from dfs. prints sizes of each split plots timeseries of data.
625941cb23849d37ff7b3163
@passport_blue.route('/image_code') <NEW_LINE> def image_code(): <NEW_LINE> <INDENT> cur_id = request.args.get("cur_id") <NEW_LINE> pre_id = request.args.get("pre_id") <NEW_LINE> if not all([cur_id]): <NEW_LINE> <INDENT> return jsonify(errno=RET.PARAMERR,errmsg="参数不全") <NEW_LINE> <DEDENT> name, text, image_data = captc...
思路分析: 1.获取参数 2.校验参数(为空校验) 3.生成图片验证码 4.保存图片验证码到redis 5.判断是否有上个图片验证码编号,有则删除 6.返回图片验证码即可 :return:
625941cb711fe17d82542440
def getAstropyTable(self, order): <NEW_LINE> <INDENT> if not self.dataIds: <NEW_LINE> <INDENT> raise RuntimeError("No DataIds were provided.") <NEW_LINE> <DEDENT> dataId = next(iter(self.dataIds)) <NEW_LINE> dimensions = list(dataId.full.keys()) <NEW_LINE> columnNames = [str(item) for item in dimensions] <NEW_LINE> typ...
Get the table as an astropy table. Returns ------- table : `astropy.table.Table` The dataIds, sorted by spatial and temporal columns first, and then the rest of the columns, with duplicate dataIds removed. order : `bool` If True then order rows based on DataIds.
625941cb1b99ca400220ab85
def egg_threshold(total_floor, egg_break_floor): <NEW_LINE> <INDENT> steps = 0 <NEW_LINE> ground_floor = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> steps += 1 <NEW_LINE> drop_floor = (ground_floor+total_floor)//2 <NEW_LINE> print(f"Step {steps} at floor {drop_floor}") <NEW_LINE> if egg_break_floor == drop_floor: <NEW...
Algorithm in action: Binary traversal and Linear tranversal Time Complexity:
625941cbcc40096d61595a24
def make_call_dict(filename, include_dirs=None, defines=None, *, nostdinc=False): <NEW_LINE> <INDENT> cpp_args = [] <NEW_LINE> dname = find_fake_libc_include() <NEW_LINE> if dname: <NEW_LINE> <INDENT> cpp_args += ['-nostdinc', "-I{}".format(dname)] <NEW_LINE> <DEDENT> elif nostdinc: <NEW_LINE> <INDENT> cpp_args += ['-n...
This parses the given file into an AST, then traverses the AST to create the function definition list. The return value is a tuple of (function_def_dict, set_of_nested_funcs), where the latter is the set of functions that aren't defined at top level in the module. This C version of this function passes the given inclu...
625941cb507cdc57c6306dae
def Yesno(self, *args, **kwargs): <NEW_LINE> <INDENT> return self._Yesno(*args, **kwargs) == self.dlg.OK
Convenience wrapper around dialog.Dialog.yesno(). Return True if "Yes" was chosen, False if "No" was chosen, and handle ESC as in the rest of the demo, i.e. make it spawn the "confirm quit" dialog.
625941cbbe383301e01b5559
def get_beta(self, genes): <NEW_LINE> <INDENT> with h5py.File(self.config.get_beta, mode='r', swmr=True) as store: <NEW_LINE> <INDENT> ids = np.array(list(map(lambda x: x.decode('utf-8'), store['IDs'][...]))) <NEW_LINE> gene_annotation = np.array(list(map(lambda x: x.decode('utf-8'), store['RefSeq'][...]))) <NEW_LINE> ...
get beta score for all TF ChIP-seq data get foreground and background gene TF RP
625941cbdc8b845886cb5608
def __init__(self): <NEW_LINE> <INDENT> self.machine_type = enum_machine_type.pc <NEW_LINE> self.protocol_type = enum_protocol_type.register_response <NEW_LINE> self.client_type = enum_client_type.device_client <NEW_LINE> self.protocol_reverse = 'hello client'
Constructor
625941cb97e22403b379d06d
def run(self): <NEW_LINE> <INDENT> data = dict([(x, 0) for x in range(self.number_of_pufs)]) <NEW_LINE> for i in range(self.number_of_pufs): <NEW_LINE> <INDENT> p = self.puf_generator.generate_puf() <NEW_LINE> c = pl.generate_random_challenges(self.n, self.puf_generator.stages) <NEW_LINE> current = 0 <NEW_LINE> for j i...
Build pufs, process them while updating progress, return data.
625941cb099cdd3c635f0d2e
def is_legal_move(location, direction): <NEW_LINE> <INDENT> cur_piece = at(location) <NEW_LINE> if is_within_board(location, direction): <NEW_LINE> <INDENT> if cur_piece == 'M': <NEW_LINE> <INDENT> is_legal = is_legal_move_by_musketeer(location, direction) <NEW_LINE> <DEDENT> elif cur_piece == 'R': <NEW_LINE> <INDENT> ...
Tests whether it is legal to move the piece at the location in the given direction.
625941cbb7558d58953c4fe9
@utils.arg('server', metavar='<server>', help='Name or ID of server.') <NEW_LINE> @utils.arg('--port', dest='port', action='store', type=int, default=22, help='Optional flag to indicate which port to use for ssh. ' '(Default=22)') <NEW_LINE> @utils.arg('--private', dest='private', action='store_true', default=False, he...
SSH into a server.
625941cbd53ae8145f87a344
def pre_investigate(TransitionActionList): <NEW_LINE> <INDENT> empties = [] <NEW_LINE> non_sharing = [] <NEW_LINE> remainder = set() <NEW_LINE> done_set = set() <NEW_LINE> L = len(TransitionActionList) <NEW_LINE> for i, x in enumerate(TransitionActionList): <NEW_LINE> <INDENT> if x.command_list.is_em...
Categorize the TransitionActions into one of three kinds: -- 'empties' where there is no action whatsoever. -- 'non_sharing' which are CommandList-s that do not share any command with any other. -- 'remainder' which do not fall into 'empties' or 'non_sharing'.
625941cbd164cc6175782e21
def dtcwt3d(mat_input, level=6): <NEW_LINE> <INDENT> depth, _, _ = np.shape(mat_input) <NEW_LINE> trans = dtcwt.Transform2d() <NEW_LINE> output = list() <NEW_LINE> for cross in range(depth): <NEW_LINE> <INDENT> output.append(trans.forward(mat_input[cross], nlevels=level)) <NEW_LINE> <DEDENT> return output
Input: Output:
625941cb63b5f9789fde71b9
def strip_influence(context, strip, frame=None): <NEW_LINE> <INDENT> if frame is None: <NEW_LINE> <INDENT> frame = context.scene.frame_current_final <NEW_LINE> <DEDENT> (start, end) = (strip.frame_start, strip.frame_end) <NEW_LINE> start_in = (start + strip.blend_in) <NEW_LINE> end_out = (end - strip.blend_out) <NEW_LI...
Return influence of NLA Strip at a given frame (or current frame)
625941cb9c8ee82313fbb849
def test_create_user(self): <NEW_LINE> <INDENT> self.res = User.objects.create_user( username='kalyango', email='john@gmail.com', password=None) <NEW_LINE> self.assertEqual(self.res.username, 'kalyango') <NEW_LINE> self.assertEqual(self.res.email, 'john@gmail.com')
Test for create user
625941cbfbf16365ca6f6298
def test_dtf2r_vector(self): <NEW_LINE> <INDENT> np.random.seed(131) <NEW_LINE> n_samples = 100 <NEW_LINE> i_hour = np.random.randint(0, 24, n_samples) <NEW_LINE> i_min = np.random.randint(0, 60, n_samples) <NEW_LINE> sec = np.random.random_sample(n_samples)*60.0 <NEW_LINE> test_rad = pal.dtf2rVector(i_hour, i_min, sec...
Test that dtf2rVector gives results consistent with dtf2r
625941cb0fa83653e465708f