code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def getNextFreeMultiIndex(attr, start): <NEW_LINE> <INDENT> for i in range(start, 10000000): <NEW_LINE> <INDENT> con = cmds.connectionInfo('{}[{}]'.format(attr, i), sourceFromDestination=True) <NEW_LINE> if not con: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> return 0
Descriptions: This returns the next multi index that's available for the given destination attribute. This command is useful when connecting nodes where one wishes to connect to the first available multi on a node, i.e. the first element that is not already connected.
625941ed6fece00bbac2dc84
def reinit_model(self): <NEW_LINE> <INDENT> cls = self.model.__class__ <NEW_LINE> model_params = self.model.options <NEW_LINE> model_params['time'] = self.evolved_time <NEW_LINE> return cls(model_params)
Re-initialize a new model at current time. Returns ------- model : New instance of the model initialized at ``model_params['time'] = self.evolved_time``.
625941ed56ac1b37e6264703
def test_pip_wheel_fail(script, data): <NEW_LINE> <INDENT> result = script.pip( 'wheel', '--no-index', '-f', data.find_links, 'wheelbroken==0.1', expect_error=True, ) <NEW_LINE> wheel_file_name = 'wheelbroken-0.1-py{pyversion[0]}-none-any.whl' .format(**globals()) <NEW_LINE> wheel_file_path = script.scratch / wh...
Test 'pip wheel' failure.
625941edbe8e80087fb21179
def get_ports(self): <NEW_LINE> <INDENT> return self.port_map.values()
Returns the list of ports in the particular service :return: The list of Port object :rtype: list[Port]
625941ed091ae35668667494
def cleanup(self): <NEW_LINE> <INDENT> self.log.info("Cleaning up.") <NEW_LINE> self._sys.cleanup() <NEW_LINE> for rt in self._routes: <NEW_LINE> <INDENT> if rt.nexthop.exploded != "0.0.0.0": <NEW_LINE> <INDENT> self._sys.uninstall_route(rt.network.ip.exploded, rt.network.prefixlen)
Clean up any system changes made while running (uninstall routes etc.).
625941edd6c5a1020814458e
def exit_program(self): <NEW_LINE> <INDENT> print("Program exited.") <NEW_LINE> exit()
Exits the program.
625941edec188e330fd5acd3
def set_symbol(self, symbol): <NEW_LINE> <INDENT> raise "Deprecated" <NEW_LINE> self.symbol, self.bondtype, bondorder, self.equiv_class = BONDLOOKUP[symbol] <NEW_LINE> if self.bondtype == 4: <NEW_LINE> <INDENT> self.aromatic = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.aromatic = 0
(symbol, bondorder) -> set the bondsymbol of the molecule
625941ed26068e7796caf226
def test_run_thread(): <NEW_LINE> <INDENT> runner = Bladerunner() <NEW_LINE> callback = Mock() <NEW_LINE> with patch.object(runner, "run", return_value="fake") as patched_run: <NEW_LINE> <INDENT> runner._run_thread(["nothing"], ["nowhere"], {}, callback) <NEW_LINE> <DEDENT> patched_run.assert_called_once_with(["nothing...
If run thread is used the callback should be called with results.
625941ed56ac1b37e6264704
def delete_batch_search(self, batch_id, search_id): <NEW_LINE> <INDENT> return json.loads(self.http_delete(self.ENDPOINT_BATCHES + "/" + str(batch_id) + "/" + str(search_id)))
Returns: JSON with the formatted response content
625941ed004d5f362079a86e
def fit(self, n_output_node, input_shape, train_data, test_data, time_limit=24 * 60 * 60): <NEW_LINE> <INDENT> if not self.searcher: <NEW_LINE> <INDENT> input_shape = input_shape[1:] <NEW_LINE> self.searcher_args['n_output_node'] = n_output_node <NEW_LINE> self.searcher_args['input_shape'] = input_shape <NEW_LINE> self...
Search the best network. Args: n_output_node: A integer value represent the number of output node in the final layer. input_shape: A tuple to express the shape of every train entry. For example, MNIST dataset would be (28,28,1). train_data: A PyTorch DataLoader instance representing the training da...
625941ed3317a56b8693a18a
def learn(self, inputs: DataArray, targets: DataArray) -> None: <NEW_LINE> <INDENT> inputs = np.array(inputs, dtype=self.dtype) <NEW_LINE> targets = np.array(targets, dtype=self.dtype) <NEW_LINE> self._forward(inputs=inputs) <NEW_LINE> self._backprop(inputs=inputs, targets=targets)
Perform a forward and backward pass, updating weights. Args: inputs: Array of input values targets: Array of true outputs
625941ed21bff66bcd684e8d
def mk_generic(self): <NEW_LINE> <INDENT> alldata = b'' <NEW_LINE> for (n, s) in options["ednsopt"]: <NEW_LINE> <INDENT> optcode = struct.pack('!H', n) <NEW_LINE> optdata = h2bin(s) <NEW_LINE> optlen = struct.pack('!H', len(optdata)) <NEW_LINE> alldata += optcode + optlen + optdata <NEW_LINE> <DEDENT> return alldata
Construct generic EDNS options
625941eda219f33f34628ea1
def _get_node_info(self, which_info, which_node): <NEW_LINE> <INDENT> return _proc.getcallbacknodeinfo(self._cbstruct, which_node, which_info)
non-public
625941ed8a349b6b435e86b2
def _is_list_iter(self): <NEW_LINE> <INDENT> iter_var_type = ( self.context.vars.get(self.stmt.iter.id).typ if isinstance(self.stmt.iter, vy_ast.Name) else None ) <NEW_LINE> if isinstance(self.stmt.iter, vy_ast.List) or isinstance(iter_var_type, ListType): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if isinstan...
Test if the current statement is a type of list, used in for loops.
625941eda05bb46b383ecd5c
def __init__(self, total_respondants: int) -> None: <NEW_LINE> <INDENT> self._total_respondants = total_respondants <NEW_LINE> self.respondants = 0 <NEW_LINE> self.meta_judgment = 0 <NEW_LINE> self.weighted_respondants = 0
Aggregated Respondants answer. Args: total_respondants (int): Total amount of respondants in the study.
625941ed15fb5d323cde1057
def __init_asteroid(self, asteroids_amount): <NEW_LINE> <INDENT> self.__asteroids = [] <NEW_LINE> for i in range(asteroids_amount): <NEW_LINE> <INDENT> random_pos = self._random_position() <NEW_LINE> while ut.distance(random_pos, self.__ship.get_position()) <= 3: <NEW_LINE> <INDENT> random_pos = self._random_position()...
Adds the initial asteroids according to the starting asteroids_amount :param asteroids_amount: The amount to add :return:
625941ed63d6d428bbe44a30
def _extract_csv_reader_kwargs(self): <NEW_LINE> <INDENT> kwargs = {} <NEW_LINE> if self.args.tabs: <NEW_LINE> <INDENT> kwargs['delimiter'] = '\t' <NEW_LINE> <DEDENT> elif self.args.delimiter: <NEW_LINE> <INDENT> kwargs['delimiter'] = self.args.delimiter <NEW_LINE> <DEDENT> if self.args.quotechar: <NEW_LINE> <INDENT> k...
Extracts those from the command-line arguments those would should be passed through to the input CSV reader(s).
625941ed4f6381625f114f7a
def __init__(self): <NEW_LINE> <INDENT> self.last = {}
Initialize your data structure here.
625941edd8ef3951e3243a7d
def get_arg_text(ob): <NEW_LINE> <INDENT> argspec = "" <NEW_LINE> try: <NEW_LINE> <INDENT> ob_call = ob.__call__ <NEW_LINE> <DEDENT> except BaseException: <NEW_LINE> <INDENT> if type(ob) is types.ClassType: <NEW_LINE> <INDENT> ob_call = ob <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return argspec <NEW_LINE> <DEDENT>...
Return a string describing the signature of a callable object, or ''. For Python-coded functions and methods, the first line is introspected. Delete 'self' parameter for classes (.__init__) and bound methods. The next lines are the first lines of the doc string up to the first empty line or _MAX_LINES. For builtins...
625941ed4f6381625f114f7b
def __init__(self): <NEW_LINE> <INDENT> self._amps = range(1, 17)
Constructor.
625941ed3eb6a72ae02eca2b
def _sleep_between_retries(attempt, max_attempts, sleep_base): <NEW_LINE> <INDENT> if attempt < (max_attempts - 1): <NEW_LINE> <INDENT> time.sleep((2 ** attempt) * sleep_base)
Sleep between retry attempts. Do an exponential backoff between retry attempts on an operation. The general pattern for use is: for attempt in range(max_attempts): # Try operation, either return or break on success _sleep_between_retries(attempt, max_attempts, sleep_base) Args: attempt: Which attempt just...
625941ed8e05c05ec3eea8b8
def cut_at(self, cuttype): <NEW_LINE> <INDENT> data_x, data_y = self.fitsimage.get_last_data_xy() <NEW_LINE> image = self.fitsimage.get_image() <NEW_LINE> wd, ht = image.get_size() <NEW_LINE> coords = [] <NEW_LINE> if cuttype == 'horizontal': <NEW_LINE> <INDENT> coords.append((0, data_y, wd-1, data_y)) <NEW_LINE> <DEDE...
Perform a cut at the last mouse position in the image. $cuttype$ determines the type of cut made.
625941edb7558d58953c5448
def fixMins(series): <NEW_LINE> <INDENT> if series['mins1'] == '-': <NEW_LINE> <INDENT> series['mins1'] = series['mins2'] <NEW_LINE> <DEDENT> return series
Fixes the column holding minutes. Sometimes it has "-" and the minutes are in a different columns. Args :param series: Original series. Returns: :return: Fixed series.
625941ed099cdd3c635f1198
def clearAccidental(note1): <NEW_LINE> <INDENT> if note1.pitch.accidental is not None: <NEW_LINE> <INDENT> note1.editorial.misc["saved-accidental"] = note1.pitch.accidental <NEW_LINE> note1.pitch.accidental = None
moves the accidental to `Note.editorial.misc['saved-accidental']` and clears `Note.pitch.accidental`
625941ede1aae11d1e74a1fc
@prepare_before_test(num=23) <NEW_LINE> def test_23_gpload_error_count(): <NEW_LINE> <INDENT> file = mkpath('setup.sql') <NEW_LINE> runfile(file) <NEW_LINE> f = open(mkpath('query23.sql'),'a') <NEW_LINE> f.write("\\! psql -d reuse_gptest -c 'select count(*) from csvtable;'") <NEW_LINE> f.close() <NEW_LINE> f = open(mkp...
23 gpload error_table
625941ed29b78933be1e5be5
def test_user_repr(self): <NEW_LINE> <INDENT> self.assertEqual(self.user1.__repr__(), f"<User #{self.user1.id}: {self.user1.username}, {self.user1.email}>")
Does User Repr work?
625941edfbf16365ca6f670f
def __verbose_print(self, print_str): <NEW_LINE> <INDENT> if self.verbose: <NEW_LINE> <INDENT> print (print_str)
This private method prints the `print_str` string only in case self.verbose flag is turned on. :parameters: print_str : str a string to be printed :returns: None
625941ed9f2886367277adc8
def ent2txt(match, start="[[[", end="]]]"): <NEW_LINE> <INDENT> logmgr_flog() <NEW_LINE> if match: <NEW_LINE> <INDENT> return "{}{}{}".format(start, match.group(2), end)
Replace any &text; -> [[[text]]] :param _sre.SRE_Match match: match object from re :param str start: Start string of entity replacement :param str end: end string :return: replaced string :rtype: str
625941ed956e5f7376d713ab
def test_database_writes(new_cursor): <NEW_LINE> <INDENT> net_worth, account_details = get_account_details(mint) <NEW_LINE> write_accounts(account_details, included_invsetments=included_investments, cursor=new_cursor) <NEW_LINE> results = new_cursor.execute("""SELECT * FROM mint_accounts""").fetchall() <NEW_LINE> asser...
:param new_cursor: :return:
625941ed7047854f462a1943
def test_deserialize_an_order(self): <NEW_LINE> <INDENT> data = {"product_id": 1, "quantity": 1, "price": 5.0, "status": "PLACED"} <NEW_LINE> order_item = OrderItem() <NEW_LINE> order_item.deserialize(data) <NEW_LINE> self.assertNotEqual(order_item, None) <NEW_LINE> self.assertEqual(order_item.item_id, None) <NEW_LINE>...
Deserialization of an Order Item
625941ed07f4c71912b119c4
def parallel_beam_c(origin=(0.,0.,0.),direction=(0.,0.,0.),size=(1.,1.),num_rays=(10,10),wavelength=0.58929, label=""): <NEW_LINE> <INDENT> ret_val=[] <NEW_LINE> nx,ny=num_rays <NEW_LINE> dx,dy=size <NEW_LINE> dx=float(dx) <NEW_LINE> dy=float(dy) <NEW_LINE> for ix in range(nx): <NEW_LINE> <INDENT> for iy in range(ny): ...
Cartesian grid parallel beam This function creates a parallel beam, where the rays are organized in a cartesian grid. Parameters: *origin* Tuple with the coordinates of the central ray origin *direction* Tuple with the rotation of the beam arround the XYZ axes. *size* Tuple with the beam's width and the...
625941edd486a94d0b98e686
def Main(): <NEW_LINE> <INDENT> args_parser = argparse.ArgumentParser(description=( "Lists a file system in a storage media image or device.")) <NEW_LINE> args_parser.add_argument( "images", nargs="+", metavar="IMAGE", action="store", type=str, default=None, help=("Storage media images or devices.")) <NEW_LINE> args_pa...
The main program function. Returns: A boolean containing True if successful or False if not.
625941ed85dfad0860c3b39c
def findWords(self, words): <NEW_LINE> <INDENT> s = ["", "", ""] <NEW_LINE> s[0] = "qwertyuiopQWERTYUIOP" <NEW_LINE> s[1] = "asdfghjklASDFGHJKL" <NEW_LINE> s[2] = "zxcvbnmZXCVBNM" <NEW_LINE> n = len(words) <NEW_LINE> arr = [] <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> check = True <NEW_LINE> for k in range(3): <...
:type words: List[str] :rtype: List[str]
625941ed8c3a873295158901
def read_input(self): <NEW_LINE> <INDENT> options = [(1, "Add matrices"), (2, "Multiply matrix by a constant"), (3, "Multiply matrices"), (4, "Transpose Matrix"), (0, "Exit")] <NEW_LINE> self.print_options(options) <NEW_LINE> choice = int(input()) <NEW_LINE> return choice
Present menu to user and read input
625941ed7d847024c06be800
def short(self, price, volume, stop=False): <NEW_LINE> <INDENT> return self.sendOrder(STUBORDER_SHORT, price, volume, stop)
卖开
625941edd7e4931a7ee9e45f
def max(self): <NEW_LINE> <INDENT> return max(self.elem)
Return the largest item in the tuple.
625941ed99fddb7c1c9de8cd
def set_param(self, param, value, clb=None): <NEW_LINE> <INDENT> req = { "name": param, "value": value } <NEW_LINE> status, data = self._call(clb, req, "/rosapi/set_param", "rosapi/SetParam") <NEW_LINE> return status, data
Sets the value of given ROS Parameter. Args: param (str): The ROS Parameter name. value (str, optional): Parameter value. clb (function, optional): Callback function that is called upon response is received.
625941edadb09d7d5db6cccc
def load_checkpoint(checkpoint, model, optimizer=None): <NEW_LINE> <INDENT> if not os.path.exists(checkpoint): <NEW_LINE> <INDENT> raise("File doesn't exist {}".format(checkpoint)) <NEW_LINE> <DEDENT> checkpoint = torch.load(checkpoint,map_location={'cuda:6':'cuda:0'}) <NEW_LINE> model.load_state_dict(checkpoint['state...
Loads model parameters (state_dict) from file_path. If optimizer is provided, loads state_dict of optimizer assuming it is present in checkpoint. Args: checkpoint: (string) filename which needs to be loaded model: (torch.nn.Module) model for which the parameters are loaded optimizer: (torch.optim) optional...
625941ed23849d37ff7b35ca
def get_hardware_version(self): <NEW_LINE> <INDENT> return self.hardware_version & 0x1F
Returns the version sense lookup index
625941edb57a9660fec33dcb
def get_spike_indices(self, remove_overlaps=True): <NEW_LINE> <INDENT> if remove_overlaps: <NEW_LINE> <INDENT> return self._remove_overlapping_spike_windows() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.spike_indices
Returns the detected spike indices remove_overlaps: If we want to remove the overlapping spikes based on the set window
625941ed460517430c3946b6
def formatParameter(self, paramName): <NEW_LINE> <INDENT> if not (paramName.startswith('_') and paramName.endswith('_')): <NEW_LINE> <INDENT> if not paramName.startswith('_'): <NEW_LINE> <INDENT> paramName = '_' + paramName <NEW_LINE> <DEDENT> if not paramName.endswith('_'): <NEW_LINE> <INDENT> paramName = paramName + ...
Formats the parameter name to the JSON standard (_<>_). No changes are applied if the string is already formatted correctly. Parameters --------------- paramName : string Name of the parameter. Returns --------------- paramName : string Name of the parameter.
625941edf8510a7c17cf9c40
def find_all(self, *hashes): <NEW_LINE> <INDENT> return [self.find(h).find_all(h) for h in hashes]
Find all near-duplicates of the provided hashes
625941ed9f2886367277adc9
def boundary_of_center_object(pc, downsample=None, angle_threshold=0.1, search_radius=0.1, normal_search_radius=0.1): <NEW_LINE> <INDENT> if downsample is not None: <NEW_LINE> <INDENT> log(' - Random downsampling factor:', downsample) <NEW_LINE> pc = utils.downsample_random(pc, downsample) <NEW_LINE> <DEDENT> else: <NE...
Find the boundary of the main object. First applies dbscan to find the main object, then estimates its footprint by taking the pointcloud boundary. Resulting pointcloud has the same SRS and offset as the input. Arguments: pointcloud : pcl.PointCloud downsample : If given, reduce the pointcloud to given percen...
625941ed50485f2cf553d2db
def test_leaftemp_all(): <NEW_LINE> <INDENT> test_path = tempfile.mkdtemp() <NEW_LINE> x_train, metadata = leaftemp_all(test_path) <NEW_LINE> try: <NEW_LINE> <INDENT> assert x_train.shape == (62, 9) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> shutil.rmtree(test_path) <NEW_LINE> raise()
Test module leaftemp_all.py by downloading leaftemp_all.csv and testing shape of extracted data has 62 rows and 9 columns
625941eeb57a9660fec33dcc
def meilleur_apres(liste): <NEW_LINE> <INDENT> liste_apres=[] <NEW_LINE> for b in liste: <NEW_LINE> <INDENT> a = baground.baground_test1(n) <NEW_LINE> c = principal(it,a,b) <NEW_LINE> liste_apres.append((c[1],c[2],c[0],b)) <NEW_LINE> <DEDENT> liste_apres=sorted(liste_apres,reverse=True) <NEW_LINE> return(liste_apres)
renvoie la liste : [0]: score [1]: nbiteration max [2]: la table de fin [3]: la table de debut [4]: la table de strategie
625941ee2ae34c7f2600d670
def __init__(self, params=None): <NEW_LINE> <INDENT> logger.info('Overriding class: Optimizer -> CSA.') <NEW_LINE> super(CSA, self).__init__() <NEW_LINE> self.fl = 2.0 <NEW_LINE> self.AP = 0.1 <NEW_LINE> self.build(params) <NEW_LINE> logger.info('Class overrided.')
Initialization method. Args: params (dict): Contains key-value parameters to the meta-heuristics.
625941ee287bf620b61d3fa0
def loadNextBatch(self, start_idx): <NEW_LINE> <INDENT> if self.params.aug_modes is not None: <NEW_LINE> <INDENT> self.dataBatch = self.data_queue.get() <NEW_LINE> if self.pca is not None: <NEW_LINE> <INDENT> return self.dataBatch.imgs, self.pca.transform(np.reshape(self.dataBatch.gt3Dcrops, newshape=[self.dataBatch.gt...
从缓冲区中获取下一个Batch :param idxs: :return:
625941ee92d797404e3046cc
def priceDF(symbol): <NEW_LINE> <INDENT> df = pd.io.json.json_normalize({'price': price(symbol)}) <NEW_LINE> _toDatetime(df) <NEW_LINE> return df
https://iextrading.com/developer/docs/#price
625941ee3d592f4c4ed1d59f
@pytest.fixture <NEW_LINE> def connection(session): <NEW_LINE> <INDENT> return Connection(session=session, username="", password="", country="DE", interval=999, fulldebug=True)
Real connection for integration tests.
625941ee5fdd1c0f98dc0775
def _RunLog2Timeline( self, test_definition, temp_directory, storage_file, source_path): <NEW_LINE> <INDENT> extract_options = ['--status-view=none', '--unattended'] <NEW_LINE> extract_options.extend(test_definition.extract_options) <NEW_LINE> filter_file_path = getattr(test_definition, 'filter_file', None) <NEW_LINE> ...
Runs log2timeline with the parameters specified by the test definition. Args: test_definition (TestDefinition): test definition. temp_directory (str): name of a temporary directory. storage_file (str): path of the storage file. source_path (str): path of the source. Returns: bool: True if log2timeline ran s...
625941ee82261d6c526ab9e8
def format_bin_prefix(num_frmt, value, prefix=None): <NEW_LINE> <INDENT> if prefix: <NEW_LINE> <INDENT> check_type(value, int, 'value') <NEW_LINE> if not isinstance(prefix, Prefix): <NEW_LINE> <INDENT> prefix = find_bin_prefix(prefix) or NO_PREFIX <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> prefix = bin_pref...
Format a number with a binary prefix. >>> format_bin_prefix('.3f', 1024**2+1024) '1.001 Mi' >>> format_bin_prefix('.3f', 1024**2+1024, prefix='Gi') '0.001 Gi' :param str num_frmt: number format string as used with :func:`format` :param int value: the number :param prefix: can be a binary prefix object, name, or symbo...
625941ee8da39b475bd654bb
def do_intersect(p1, q1, p2, q2) -> bool: <NEW_LINE> <INDENT> o1 = orientation(p1, q1, p2) <NEW_LINE> o2 = orientation(p1, q1, q2) <NEW_LINE> o3 = orientation(p2, q2, p1) <NEW_LINE> o4 = orientation(p2, q2, q1) <NEW_LINE> if (o1 != o2) and (o3 != o4): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if (o1 == 0) and...
Function that returns true if the line segment 'p1q1' and 'p2q2' intersect.
625941ee462c4b4f79d1dc0f
def initiate(self, measurement): <NEW_LINE> <INDENT> mean_pos = measurement <NEW_LINE> mean_vel = np.zeros_like(mean_pos) <NEW_LINE> mean = np.r_[mean_pos, mean_vel] <NEW_LINE> std = [ 2 * self._std_weight_position * measurement[0], 2 * self._std_weight_position * measurement[1], 2 * self._std_weight_position * measure...
Create track from unassociated measurement. Parameters ---------- measurement : ndarray Bounding box coordinates (x, y, a, h) Returns ------- (ndarray, ndarray) Returns the mean vector (8 dimensional) and covariance matrix (8x8 dimensional) of the new track. Unobserved velocities are initialized to 0 ...
625941eea4f1c619b28b056c
def add_include(self, name, module_spec): <NEW_LINE> <INDENT> assert name, 'name is required' <NEW_LINE> assert self.can_include <NEW_LINE> if name in self.includes: <NEW_LINE> <INDENT> raise ThriftCompilerError( 'Cannot include module "%s" as "%s" in "%s". ' 'The name is already taken.' % (module_spec.name, name, self...
Adds a module as an included module. :param name: Name under which the included module should be exposed in the current module. :param module_spec: ModuleSpec of the included module.
625941eed53ae8145f87a7a5
def armor(self): <NEW_LINE> <INDENT> return self._random_item(M_Item.ARMOR)
Generates a new random piece of magic armor.
625941ee26068e7796caf227
def set_Weight(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Weight', value)
Set the value of the Weight input for this Choreo. ((required, decimal) A new value (in pounds) to log for weight. In the format of X.XX.)
625941ee4d74a7450ccd4705
@main.group() <NEW_LINE> def mirror(): <NEW_LINE> <INDENT> pass
Manage site mirrors
625941eed4950a0f3b08c888
def plot_fit(self,**kwargs): <NEW_LINE> <INDENT> figsize = kwargs.get('figsize',(10,7)) <NEW_LINE> if self.parameters.estimated is False: <NEW_LINE> <INDENT> raise Exception("No parameters estimated!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> plt.figure(figsize=figsize) <NEW_LINE> date_index = self.index[max(self....
Plots the fit of the model Returns ---------- None (plots data and the fit)
625941eea219f33f34628ea2
def search_isos(self, **user_input): <NEW_LINE> <INDENT> search_params = deepcopy(user_input) <NEW_LINE> repo_id = search_params.pop(OPTION_REPO_ID.keyword) <NEW_LINE> search_params['type_ids'] = [ids.TYPE_ID_ISO] <NEW_LINE> isos = self.context.server.repo_unit.search(repo_id, **search_params).response_body <NEW_LINE> ...
Perform the search against the Pulp server. :param user_input: The input given from the user :type user_input: dict
625941ee4d74a7450ccd4706
def relationship(self, other): <NEW_LINE> <INDENT> if isinstance(other, Cube): <NEW_LINE> <INDENT> geom1, geom2 = self.wkt, other.wkt() <NEW_LINE> relation = geom1.relate(geom2) <NEW_LINE> if not intersects.matches(relation): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif contains.matches(relation): <NEW_LINE> <...
Relationship between a 3D polygon and a cube. The relevant relationships for this application are: * disjoint (returns 0) * within (returns 1) * overlap (returns 2)
625941ee3c8af77a43ae3ce7
def pack(as_png: bool = False): <NEW_LINE> <INDENT> pass
Pack an image as embedded data into the .blend file :param as_png: Pack As PNG, Pack image as lossless PNG :type as_png: bool
625941eed10714528d60022a
def convert_to_lastfm(item): <NEW_LINE> <INDENT> track = item['track']['name'] <NEW_LINE> artists = [a['name'] for a in item['track']['artists']] <NEW_LINE> played_at = to_posix_timestamp(dateutil.parser.parse(item['played_at'])) <NEW_LINE> return {'name': track, 'artists': artists, 'played_at': played_at}
Converts Spotify items to Last.fm tracks.
625941ee66656f66f7cbc6ed
def _LaunchServerAndVerifyExamples(self, pepper_version, pepper_path): <NEW_LINE> <INDENT> if self._ChromeAndPepperVersionMatch(pepper_version): <NEW_LINE> <INDENT> if self._IsURLAlive('http://localhost:5103'): <NEW_LINE> <INDENT> self._CloseHTTPServer() <NEW_LINE> <DEDENT> examples_path = os.path.join(pepper_path, 'ex...
Start local HTTP server and verify examples.
625941ee009cb60464c638ee
def closeEvent(self, event): <NEW_LINE> <INDENT> self.write_window_settings() <NEW_LINE> event.accept()
Over-rides the default close event to enable the saving of the window position and size before it closes.
625941ee5166f23b2e1a5699
def paginate(objects, size, request, context, var_name='object_list'): <NEW_LINE> <INDENT> paginator = Paginator(objects, size) <NEW_LINE> page = request.GET.get('page', '1') <NEW_LINE> try: <NEW_LINE> <INDENT> object_list = paginator.page(page) <NEW_LINE> <DEDENT> except PageNotAnInteger: <NEW_LINE> <INDENT> object_li...
Paginate objects provided by view. This function takes: * list of elements; * number of objects per page; * request object to get url parameters from; * context to set new variables into; * var_name - variable name for list of objects. It returns updated context object.
625941eec4546d3d9de72f79
def _find_normaldata_for_age(age): <NEW_LINE> <INDENT> if not age: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> for age_range, filename in cfg.general.normaldata_age.items(): <NEW_LINE> <INDENT> if age_range[0] <= age <= age_range[1]: <NEW_LINE> <INDENT> logger.debug(f'found normal data file {filename} for age {...
Find age specific normaldata file
625941ee956e5f7376d713ac
def draw_state(self): <NEW_LINE> <INDENT> if master == None: <NEW_LINE> <INDENT> master = Tk() <NEW_LINE> <DEDENT> w, h = self.board.get_dimensions() <NEW_LINE> canvas = Canvas(master, width=w, height=h) <NEW_LINE> self.board.draw_board(canvas) <NEW_LINE> for penguin in self.get_all_penguins(): <NEW_LINE> <INDENT> play...
Draw the current game state with tiles, fish, holes in board, and penguins
625941ee38b623060ff0b32d
def merge(self, nums1, m, nums2, n): <NEW_LINE> <INDENT> index = len(nums1) - 1 <NEW_LINE> m -= 1 <NEW_LINE> n -= 1 <NEW_LINE> while n >= 0: <NEW_LINE> <INDENT> if m<0 or nums1[m]<nums2[n]: <NEW_LINE> <INDENT> nums1[index] = nums2[n] <NEW_LINE> n -= 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> nums1[index] = nums1[m...
:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.
625941eea79ad161976cc686
def name(self): <NEW_LINE> <INDENT> return _xapian.MatchSpy_name(self)
Return the name of this match spy. virtual std::string Xapian::MatchSpy::name() const This name is used by the remote backend. It is passed with the serialised parameters to the remote server so that it knows which class to create. Return the full namespace-qualified name of your class here - if your class is called...
625941ee24f1403a926010a2
def _fetch_med_inst_cd(self, branch_id: int, dl_dir: str, output_handler: Callable[[int, int, str, str, str], None], out_dir: str, output_file: str): <NEW_LINE> <INDENT> if branch_id == BRANCH_ALL: <NEW_LINE> <INDENT> for b_id in BRANCH_LIST: <NEW_LINE> <INDENT> self._logger.debug(f"..branch-{b_id} begin") <NEW_LINE> s...
Download files from each kouseikyoku.mhlw.go.jp sites and sum them up to csv.
625941ee3cc13d1c6d3c78b8
def insert(self, first, last, age): <NEW_LINE> <INDENT> return self.dbpool.runInteraction(self._insert, first, last, age)
Insert data into the database using Twisted. :return: Deferred
625941ee5fcc89381b1e1c04
def CreateBiddingStrategy(client): <NEW_LINE> <INDENT> bidding_strategy_service = client.GetService( 'BiddingStrategyService', version='v201603') <NEW_LINE> shared_bidding_strategy = { 'name': 'Maximize Clicks %s' % uuid.uuid4(), 'biddingScheme': { 'xsi_type': 'TargetSpendBiddingScheme', 'bidCeiling': { 'microAmount': ...
Creates a bidding strategy object. Args: client: AdWordsClient the client to run the example with. Returns: dict An object representing a bidding strategy.
625941eed8ef3951e3243a7e
def main(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> file = sys.argv[1] <NEW_LINE> if not same_ratio(get_image_ratio(file), get_monitor_ratio(), file): <NEW_LINE> <INDENT> prompt_edit(file) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> print("No image chosen.") <NEW_LINE> n = input("Press enter to exit."...
:return: NoneType
625941ee287bf620b61d3fa1
def col_values(cols, results) -> dict: <NEW_LINE> <INDENT> if results is None: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> values = {} <NEW_LINE> for c in cols: <NEW_LINE> <INDENT> values[c] = [getattr(r, c) for r in results if hasattr(r, c)] <NEW_LINE> <DEDENT> return values
:param cols: List containing column names whose values are to be retrieved from the results set. :type cols: list :param results: ResultProxy object containing values for row columns. :return: Returns values for the specified column names which exist in the results set. :rtype: dict
625941eed58c6744b425819e
def t450530_x6(): <NEW_LINE> <INDENT> if GetEventStatus(74500181) == 1: <NEW_LINE> <INDENT> assert t450530_x5(text1=63000300, flag1=0, mode1=1) <NEW_LINE> SetEventState(74500181, 0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not GetEventStatus(74500150): <NEW_LINE> <INDENT> assert t450530_x4(text2=63000000, z2=74...
State 0,1
625941eed7e4931a7ee9e460
def L2forTest(outputs, targets, obs_length, lossMask): <NEW_LINE> <INDENT> seq_length = outputs.shape[0] <NEW_LINE> error = torch.norm(outputs - targets, p=2, dim=2) <NEW_LINE> pedi_full = torch.sum(lossMask, dim=0) == seq_length <NEW_LINE> error_full = error[obs_length - 1:, pedi_full] <NEW_LINE> error = torch.sum(err...
Evaluation.
625941ee4428ac0f6e5bad38
def __init__(self): <NEW_LINE> <INDENT> GPIO.setmode(GPIO.BOARD) <NEW_LINE> GPIO.setup(SIGNAL_PIN, GPIO.OUT) <NEW_LINE> self.pin = GPIO.PWM(SIGNAL_PIN, 50) <NEW_LINE> self.pin.start(7.5) <NEW_LINE> self.center() <NEW_LINE> self.isOn = True
Constructor
625941eee5267d203edce1d7
def user_info(auth, username): <NEW_LINE> <INDENT> user_attrs = [ 'cn', 'mail', 'uid', 'maildrop', 'givenName', 'sn', 'mailuserquota' ] <NEW_LINE> if len(username.split('@')) is 2: <NEW_LINE> <INDENT> filter = 'mail=' + username <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> filter = 'uid=' + username <NEW_LINE> <DEDENT...
Get user informations Keyword argument: username -- Username or mail to get informations
625941ee3c8af77a43ae3ce8
def get_uuid(): <NEW_LINE> <INDENT> return re.sub( "-", "", str(uuid.uuid4()) )
Return a v4 UUID as string without dashes in the middle.
625941ee656771135c3ebdb6
def Character(intervals, alphabet): <NEW_LINE> <INDENT> return _Character(Intervals(intervals, alphabet))
Allow simple construction of Character instances.
625941ee0c0af96317bb8728
def get_page_langage(filename,default='en'): <NEW_LINE> <INDENT> lst=filename.split('.') <NEW_LINE> if len(lst)==2: <NEW_LINE> <INDENT> lang=default <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> lang=lst[-2] <NEW_LINE> <DEDENT> return lang,lst[0]
get page langage from filename and returns langage and filename without langage >>> get_page_langage('test.fr.page') ('fr', 'test') >>> get_page_langage('test.page') ('en', 'test') >>> get_page_langage('test.page','fr') ('fr', 'test')
625941ee71ff763f4b549bd6
def my_square(y): <NEW_LINE> <INDENT> return (y ** 2)
takes a value and returns the squared value. uses the * operator
625941eed6c5a10208144590
def test_fit_without_predict_proba(self) -> type(None): <NEW_LINE> <INDENT> X, y = get_dataset_for_classification() <NEW_LINE> clf = StackingClassifier( base_estimators_types=[SVC, KNeighborsClassifier], base_estimators_params=[dict(), {'n_neighbors': 1}] ) <NEW_LINE> clf.fit(X, y) <NEW_LINE> true_meta_X_ = np.array( [...
Test that `fit` method works when some of base estimators have only `predict` method, but have not `predict_proba` method. :return: None
625941eea4f1c619b28b056d
def inherits_from(obj, a_class): <NEW_LINE> <INDENT> return issubclass(type(obj), a_class) and type(obj) != a_class
checks if object is subclass
625941eeec188e330fd5acd5
def OnRtnCancel(self, f=OrderField): <NEW_LINE> <INDENT> pass
撤单响应
625941ee5510c4643540f917
def run(self, config): <NEW_LINE> <INDENT> data = os.popen('sudo mdjson').read() <NEW_LINE> results = {} <NEW_LINE> try: <NEW_LINE> <INDENT> data = json.loads(data) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return "Could not load mdstat data" <NEW_LINE> <DEDENT> for key, value in data['devices'].items()...
Monitor software raid status using mdadm pip install mdstat
625941ee56ac1b37e6264706
def __init__(self): <NEW_LINE> <INDENT> self._mapDoc(('system', 'managers'), ['system'])
Constructor
625941ee3317a56b8693a18c
def prep_arrays(self, nnode: int) -> List[np.ndarray]: <NEW_LINE> <INDENT> dtype = np.float32 <NEW_LINE> arrs: List[np.ndarray] = [] <NEW_LINE> for key in 'state input param drift diffs obsrv'.split(): <NEW_LINE> <INDENT> shape = nnode, len(getattr(self, key + '_sym')) <NEW_LINE> arrs.append(np.zeros(shape, dtype)) <NE...
Prepare arrays for use with this model.
625941ee10dbd63aa1bd30e3
def compile(content): <NEW_LINE> <INDENT> pass
Return the mix between this template and the content's HTML.
625941eefb3f5b602dac3bda
def main(self, sample): <NEW_LINE> <INDENT> self.logger.debug('Sample is: {0}'.format(sample)) <NEW_LINE> sample_annot_file = sample.list_none(sample.get_output_files(analysis_step = self.task_configs['input_dir'], pattern = self.task_configs['input_pattern'])) <NEW_LINE> self.logger.debug('sample_annot_file is: {0}\na...
Main function for running the analysis task
625941ee16aa5153ce3629ba
def set_height(self, value): <NEW_LINE> <INDENT> if not isinstance(value, type(cv.ConstValue.INT_FOR_TYPE)): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> if value < Basic.INT_ZERO or value > Case.__MAX_HEIGHT: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> self._height = value
set_height
625941ee21bff66bcd684e8e
def frompointer(t): <NEW_LINE> <INDENT> return _mraa.uint8Array_frompointer(t)
frompointer(uint8_t * t) -> uint8Array Parameters: t: uint8_t *
625941ee21bff66bcd684e8f
def change_owner(token: Token, new_owner): <NEW_LINE> <INDENT> storage = StorageAPI() <NEW_LINE> owner = storage.get(token.owner_key) <NEW_LINE> if not owner: <NEW_LINE> <INDENT> print("Must deploy before changing owner") <NEW_LINE> return False <NEW_LINE> <DEDENT> if not CheckWitness(owner): <NEW_LINE> <INDENT> print(...
Record a transfer request to a new owner. The new owner must accept the request via accept_owner :param token: Token The token to change the owner for :param new_owner: the new owner of the contract :return: bool: Whether the operation was successful
625941ee50812a4eaa59c85d
def sync_routers(self, context, **kwargs): <NEW_LINE> <INDENT> router_ids = kwargs.get('router_ids') <NEW_LINE> host = kwargs.get('host') <NEW_LINE> context = neutron_context.get_admin_context() <NEW_LINE> if not self.l3plugin: <NEW_LINE> <INDENT> routers = {} <NEW_LINE> LOG.error(_LE('No plugin for L3 routing register...
Sync routers according to filters to a specific agent. @param context: contain user information @param kwargs: host, router_ids @return: a list of routers with their interfaces and floating_ips
625941ee377c676e912726e8
@commands.select_measure <NEW_LINE> @commands.select_case <NEW_LINE> def command(options): <NEW_LINE> <INDENT> measure.decode(options.measure[1], options.case[0])
Decodes the results of an already collected and simplified measure by annotating the XML structure with the needed POP metadata, as extracted from the TCP payload.
625941eefbf16365ca6f6710
def flee(self): <NEW_LINE> <INDENT> panic_range_sq = 1000 <NEW_LINE> if self.pos.distance(self.world.hunter.pos) > panic_range_sq: <NEW_LINE> <INDENT> return Vector2D() <NEW_LINE> <DEDENT> desired_vel = (self.pos - self.world.hunter.pos).normalise() * self.max_speed <NEW_LINE> return (desired_vel - self.vel)
move away from hunter position
625941ee30c21e258bdfa9e5
def add_host(self, host_data: str): <NEW_LINE> <INDENT> if not validate_net_data(host_data): <NEW_LINE> <INDENT> if not is_addr(host_data): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> net = NetworkEntry(value=host_data, type=NETWORK) <NEW_LINE> net.save() <NEW_LINE> return True <NEW_L...
Add supplied host data as a NetworkEntry into storage. host_data can be a string with host address or specific dictionary with required fields. Only IPv4 for now. Example of a dictionary: { "fields":"192.168.13.2", "type":"host" } TODO: implement a method to add NetworkEnt...
625941eed8ef3951e3243a7f
@log_call(namespace=__xmlrpc_namespace__) <NEW_LINE> def get_runs(request, product): <NEW_LINE> <INDENT> from tcms.testruns.models import TestRun <NEW_LINE> p = pre_check_product(values=product) <NEW_LINE> query = {'build__product': p} <NEW_LINE> return TestRun.to_xmlrpc(query)
Description: Get the list of runs associated with this product. Params: $product - Integer/String Integer: product_id of the product in the Database String: Product name Returns: Array: Returns an array of Test Run objects. Example: # Get with product id >>> P...
625941eeaad79263cf390f8a
def visualize_scatter_with_images(X_2d_data, images, figsize=(45,45), image_zoom=1): <NEW_LINE> <INDENT> fig, ax = plt.subplots(figsize=figsize) <NEW_LINE> artists = [] <NEW_LINE> for xy, i in zip(X_2d_data, images): <NEW_LINE> <INDENT> x0, y0 = xy <NEW_LINE> img = OffsetImage(i, zoom=image_zoom) <NEW_LINE> ab = Annota...
from https://www.kaggle.com/gaborvecsei/plants-t-sne
625941eeb7558d58953c544a
def dupJntDct(dct, oldNamePart, newNamePart): <NEW_LINE> <INDENT> result = {} <NEW_LINE> parents = {} <NEW_LINE> for tok, jnt in dct.items(): <NEW_LINE> <INDENT> newName = re.sub(oldNamePart, newNamePart, jnt) <NEW_LINE> result[tok] = MC.duplicate(jnt, parentOnly=1, n=newName)[0] <NEW_LINE> parent = MC.listRelatives(jn...
Duplicate a joint dict. Rename the joints
625941eef7d966606f6aa54c