code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _parse_response(self, response): <NEW_LINE> <INDENT> if self.status == 200: <NEW_LINE> <INDENT> return [result for result in self._parse_response_generator(response)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return []
Returns list of Result objects from API response :param response: response object :return: [] or list of Result objects
625941ebaad79263cf390f2c
def update_board(self): <NEW_LINE> <INDENT> self.board_array = np.full((self.rows, self.columns), 0) <NEW_LINE> for part in range(0, len(self.E_snake)): <NEW_LINE> <INDENT> self.board_array[self.E_snake.get_pos_part(part)] = self.E_snake.get_part_identity(part) <NEW_LINE> self.NN_array[self.E_snake.get_pos_part(part)] ...
Handle the snake
625941eb566aa707497f4a45
def test_correlation_test_pearson(self): <NEW_LINE> <INDENT> obs = correlation_t(self.data1, self.data2, method='pearson', confidence_level=0.90, permutations=990) <NEW_LINE> assert_allclose(obs[:2], (-0.03760147, 0.91786297277172868), atol=10e-7) <NEW_LINE> self.assertEqual(len(obs[2]), 990) <NEW_LINE> for r in obs[2]...
Test correlation_t using pearson on valid input.
625941eba17c0f6771cbe533
def collectElemConnectivity(exodusHandle, connectivity): <NEW_LINE> <INDENT> if not isinstance(connectivity, list): <NEW_LINE> <INDENT> raise Exception( "ERROR: connectivity is not a list in call to collectElemConnectivity().") <NEW_LINE> <DEDENT> if connectivity: <NEW_LINE> <INDENT> raise Exception( "ERROR: connectivi...
This function generates a list of lists that represent the element connectivity. Usage: exodusHandle = exodus("file.g", "r") connectivity = [] collectElemConnectivity(exodusHandle, connectivity) exodusHandle.close()
625941eb8c0ade5d55d3eea2
def predict(self, X): <NEW_LINE> <INDENT> if len(X.shape)==1: <NEW_LINE> <INDENT> X=X.reshape(1,-1) <NEW_LINE> <DEDENT> if self.add_bias: <NEW_LINE> <INDENT> X=np.c_[np.ones(X.shape[0]),X] <NEW_LINE> <DEDENT> pred = (X.dot(self.coef_)).reshape(-1) <NEW_LINE> if X.shape[0]==1: <NEW_LINE> <INDENT> return pred[0] <NEW_LIN...
Make predictions on new observations Note ---- As this is a least-squares model rather than logistic, the predictions are unbounded. Parameters ---------- X : array or data frame, shape (n_samples, n_features) Data on which to make predictions. Returns ------- yhat : array, shape (n_samples,) Model predictio...
625941eb63d6d428bbe449d4
def test_waypoint_import_existing(self): <NEW_LINE> <INDENT> waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy() <NEW_LINE> self.send_message(WAYPOINTS_TOPIC, waypoints_message) <NEW_LINE> wayp = self.hass.states.get(WAYPOINT_ENTITY_NAMES[0]) <NEW_LINE> waypoints_message = WAYPOINTS_UPDATED_MESSAGE.copy() <NEW_LINE> ...
Test importing a zone that exists.
625941eb498bea3a759b9f91
@gof.optimizer <NEW_LINE> def crossentropy_to_crossentropy_with_softmax(fgraph): <NEW_LINE> <INDENT> def search_make_one_sub(): <NEW_LINE> <INDENT> for node in fgraph.toposort(): <NEW_LINE> <INDENT> if node.op == crossentropy_categorical_1hot: <NEW_LINE> <INDENT> nll, = node.outputs <NEW_LINE> sm, one_of_n = node.input...
This is a stabilization optimization that is more general than crossentropy_to_crossentropy_with_softmax_with_bias. It must be executed after local_softmax_with_bias optimization in specialize. TODO : This is a stabilization optimization! How to make this more cleanly? Notes ----- Not a local optimization because we...
625941eb851cf427c661a9ee
def setUp(self): <NEW_LINE> <INDENT> super(ContextMiddlewareTestCase, self).setUp() <NEW_LINE> self.item = ContextMiddleware()
Create a ContextMiddleware instance
625941eb460517430c39465b
def leave ( self, event ): <NEW_LINE> <INDENT> if self._mouse_over: <NEW_LINE> <INDENT> self._mouse_over = False <NEW_LINE> self.refresh()
Handles the mouse leaving the control.
625941eb21bff66bcd684e31
def __or__(self, f): <NEW_LINE> <INDENT> return QTextCodec.ConversionFlags()
QTextCodec.ConversionFlags QTextCodec.ConversionFlags.__or__(QTextCodec.ConversionFlags f)
625941ebbe8e80087fb2111e
def src_rec(v, tau, model, geometry): <NEW_LINE> <INDENT> ts = model.grid.time_dim.spacing <NEW_LINE> src = PointSource(name='src', grid=model.grid, time_range=geometry.time_axis, npoint=geometry.nsrc) <NEW_LINE> rec1 = Receiver(name='rec1', grid=model.grid, time_range=geometry.time_axis, npoint=geometry.nrec) <NEW_LIN...
Source injection and receiver interpolation
625941eb5fcc89381b1e1ba6
def build(self): <NEW_LINE> <INDENT> with tf.compat.v1.variable_scope(self.name): <NEW_LINE> <INDENT> self._build() <NEW_LINE> <DEDENT> variables = tf.compat.v1.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=self.name) <NEW_LINE> self.vars = {var.name: var for var in variables}
Wrapper for _build()
625941eb26068e7796caf1ca
def destroySelf(): <NEW_LINE> <INDENT> pass
Delete this JabberID from the database.
625941eb26238365f5f0f359
def custom_split(log): <NEW_LINE> <INDENT> running_substring = False <NEW_LINE> log = log.strip() <NEW_LINE> i = -1 <NEW_LINE> splitted_string = [] <NEW_LINE> token = [] <NEW_LINE> while i < len(log) - 1: <NEW_LINE> <INDENT> i += 1 <NEW_LINE> if log[i] in ('"', "'"): <NEW_LINE> <INDENT> if running_substring: <NEW_LINE>...
Splits string with space considering subsrtings enclosed between quotes as single string.
625941ebde87d2750b86027c
def _extract_raw_music_data(self): <NEW_LINE> <INDENT> encoded_music_data = self._raw_json["data"]["mdat"]["data"] <NEW_LINE> self._music_data = base64.b64decode(encoded_music_data)
Extracts base 64 music data and decodes it into the raw bytes. :return: None
625941ebcc0a2c11143dd375
def get_asset_name(self, index): <NEW_LINE> <INDENT> return self.q(css='.chapter-asset-path').text[index]
Gets the name of chapter asset by taking an ordinal.
625941ebc432627299f0512d
def rgb_to_yuv(rgb): <NEW_LINE> <INDENT> if rgb in rgb_yuv_cache: <NEW_LINE> <INDENT> return rgb_yuv_cache[rgb] <NEW_LINE> <DEDENT> r, g, b = rgb <NEW_LINE> y = (r + g + b) >> 2 <NEW_LINE> u = 128 + ((r - b) >> 2) <NEW_LINE> v = 128 + ((-r + g * 2 - b) >> 3) <NEW_LINE> rgb_yuv_cache[rgb] = y, u, v <NEW_LINE> return y, ...
Takes a tuple of (r, g, b) and returns a tuple (y, u, v). Both must be 24-bit color! This is the algorithm from the original hq2x source; it doesn't seem to match any other algorithm I can find, but whatever.
625941eba934411ee3751b79
def _getSparkDlOpName(self, tensor_name): <NEW_LINE> <INDENT> op_name = tfx.op_name(tensor_name) <NEW_LINE> return tfx.add_scope_to_name(scope=self.SPARKDL_OP_SCOPE, name=op_name)
Given a tensor name, returns the name of the op generating the tensor, prefixed with a special scope indicating that the op has been added by Sparkdl.
625941ebd53ae8145f87a74a
def main(): <NEW_LINE> <INDENT> logging.basicConfig() <NEW_LINE> parser = argparse.ArgumentParser( prog="tldextract", description="Parse hostname from a url or fqdn" ) <NEW_LINE> parser.add_argument( "--version", action="version", version="%(prog)s " + __version__ ) <NEW_LINE> parser.add_argument( "input", metavar="fqd...
tldextract CLI main command.
625941ebf9cc0f698b140adb
def __init__(self, item_path, max_height, max_width, start_level, maze_generation): <NEW_LINE> <INDENT> self.num_games = -1 <NEW_LINE> self.grid_types = ["goal", "block", "agent"] <NEW_LINE> self.item_path = item_path <NEW_LINE> self.current_level = start_level <NEW_LINE> self.max_height = max_height <NEW_LINE> self.ma...
item_path: path to the item images max_height/max_width: maximum height of the world; if a smaller world size is specified using set_dims, the extra space will be padded with wall blocks maze_generattion: True: use maze generator for placing the blocks False: randomly assign available locations to blo...
625941ebff9c53063f47c6d5
def gv_device_status(status, tag=None): <NEW_LINE> <INDENT> if len(status) == 2 and tag == 'ignition': <NEW_LINE> <INDENT> return 't' if int(status, 2) > 0 else 'f' <NEW_LINE> <DEDENT> s = int(status[:2],16) <NEW_LINE> if tag is not None: <NEW_LINE> <INDENT> if tag == 'ignition': <NEW_LINE> <INDENT> if s == int('21',16...
return status the of device
625941eb3cc13d1c6d3c785c
def _create_postgres_db(project_settings): <NEW_LINE> <INDENT> username = project_settings['user'] <NEW_LINE> password = project_settings['db password'] <NEW_LINE> db_name = project_settings['db name'] <NEW_LINE> databases = env.run(r'psql -l | grep --color=never -o "^ \w\+"').split() <NEW_LINE> if db_name not in datab...
Create postgres database and user for the django deployment. Will also change that user's postgres password.
625941eb656771135c3ebd59
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> pattern = '<%sQ'%length <NEW_LINE> start = end <NEW_LINE> end += struct.calcsize(pattern) <NEW_LINE> self.detection_...
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
625941ebe8904600ed9f2419
def w5_cites_matrix(w5): <NEW_LINE> <INDENT> rows = sort(w5.all_dois()) <NEW_LINE> cols = sort(w5.all_cited_dois()) <NEW_LINE> result = zeros((rows.shape[0], cols.shape[0]), dtype=int8) <NEW_LINE> for paper in w5.h5.root.papers: <NEW_LINE> <INDENT> rindex = sindex(rows, paper['doi']) <NEW_LINE> if rindex is not None: <...
Creates a citation matrix from the corpus, where columns represent cited papers and rows represent papers doing the citing
625941eb796e427e537b0aae
def genvec(data): <NEW_LINE> <INDENT> ndata = data.size <NEW_LINE> b = np.empty((ndata)) <NEW_LINE> noff = 0 <NEW_LINE> for nd, spectra in enumerate(data.data): <NEW_LINE> <INDENT> b[noff:noff+spectra.flux.size] = (spectra.flux / spectra.ferr).flat <NEW_LINE> noff += spectra.flux.size <NEW_LINE> <DEDENT> b = np.resha...
Computes the vector b when representing the Doppler image problem by A x = b Arguments:: data : the Data defining the data Returns:: b : column vector dimensions Nx1 matrix where N is number of data
625941eb55399d3f05588b9b
def toh5(data, path, datapath='data'): <NEW_LINE> <INDENT> with h5.File(path, 'w') as f: <NEW_LINE> <INDENT> f.create_dataset(datapath, data=data)
Write `data` to a HDF5 volume. :type data: numpy.ndarray :param data: Data to write. :type path: str :param path: Path to the volume. :type datapath: str :param datapath: Path to the volume in the HDF5 volume.
625941eb442bda511e8be8f5
def getParam_saveFile(dbConfig,logicName,primid,filename,nullParam=''): <NEW_LINE> <INDENT> params = {} <NEW_LINE> params['LOGICNAME']=logicName <NEW_LINE> params['TOKEN']='' <NEW_LINE> params['MESSAGEID']='' <NEW_LINE> datas={} <NEW_LINE> consdata=test_data.getAttechment(dbConfig,primid,filename) <NEW_LINE> oradata=co...
获取附件,构建参数
625941eb097d151d1a22333b
def get_permission_object(self): <NEW_LINE> <INDENT> return self.get_object()
Retrieves the apporpriate user object to use during edx-rbac's permission checks. This object is passed to the rule predicate(s).
625941eb1d351010ab855fff
def flsh(routine, var1, var2, x, kph=1, prop=None, mRP=None): <NEW_LINE> <INDENT> def _rpfunc(): <NEW_LINE> <INDENT> return refprop.flsh(routine, var1, var2, x, kph) <NEW_LINE> <DEDENT> return _rpfunc_handler(prop, mRP, _rpfunc)
Flash calculation given two independent variables and bulk composition.
625941eb7d847024c06be7a4
def __button_clicked(self, button): <NEW_LINE> <INDENT> self.menu = Gtk.Menu() <NEW_LINE> menu = self.menu <NEW_LINE> ag_menu = Gtk.MenuItem(label=_('Add a gramplet')) <NEW_LINE> nav_type = self.pageview.navigation_type() <NEW_LINE> skip = self.all_gramplets() <NEW_LINE> gramplet_list = GET_GRAMPLET_LIST(nav_type, skip...
Called when the drop-down button is clicked.
625941ebc432627299f0512e
def divide(a, b): <NEW_LINE> <INDENT> print("=" * 20) <NEW_LINE> print("a: ", a, "/ b: ", b) <NEW_LINE> try: <NEW_LINE> <INDENT> result = a / b <NEW_LINE> <DEDENT> except (ZeroDivisionError, TypeError): <NEW_LINE> <INDENT> print("Something went wrong!") <NEW_LINE> raise
Return result of dividing a by b
625941eb6fece00bbac2dc29
def preorder_search(self, start, find_val): <NEW_LINE> <INDENT> if (start.value == find_val): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if (start.left): <NEW_LINE> <INDENT> flag = self.preorder_search(start.left, find_val) <NEW_LINE> if (flag): return flag <NEW_LINE> <DEDENT> if (start.right): <NEW_LINE> <IND...
Helper method - use this to create a recursive search solution.
625941eb4e696a04525c9932
def scale_variable(shape): <NEW_LINE> <INDENT> initial = tf.random_uniform(shape, 0.8, 1.2) <NEW_LINE> return tf.Variable(initial)
scale_variable generates a bias variable of a given shape. 产生一个[0.8,1.2]范围内的随机分
625941ebfb3f5b602dac3b7c
def add(self, x): <NEW_LINE> <INDENT> res = self.hashFunc.getHashList(x) <NEW_LINE> for i in res: <NEW_LINE> <INDENT> self.hashTable[i] = 1 <NEW_LINE> <DEDENT> pass
Adds x to the data structure, using self.hashFunc Args: x (int): The integer to add to the bloom filter
625941eb0fa83653e465749c
def setUp(self): <NEW_LINE> <INDENT> super(FormulaProblemTest, self).setUp() <NEW_LINE> self.courseware_page.visit() <NEW_LINE> time.sleep(6)
Setup the test suite to verify various behaviors involving formula problem type. Given a course, setup a formula problem type and view it in courseware Given the MathJax requirement for generating preview, wait for MathJax files to load
625941ebd6c5a10208144533
def groups2Emails(groups, **kwd): <NEW_LINE> <INDENT> subjects = groups2subjects(groups, **kwd) <NEW_LINE> emails = [] <NEW_LINE> for i, grp in enumerate(groups): <NEW_LINE> <INDENT> eml = group2Email(grp, subject=subjects[i], **kwd) <NEW_LINE> emails.append(eml) <NEW_LINE> <DEDENT> return emails
return a list of Email instances from a list of groups eg: emails = groups2Emails(groups, title='hahaha', from_='xxx@abc.com', to=['yyy@ddd.com'], smtp='mail.abc.com') passwd = input('your password') for eml in emails: eml.password = passwd # setting up eml ...... eml.send()
625941eb7cff6e4e81117e6a
def test_entries_cannot_have_leading_whitespace(): <NEW_LINE> <INDENT> cfg = " key = cannot be indented" <NEW_LINE> error = ( "test.cfg: 1: expected \"key = value\" entry\n" "on this line: " + cfg) <NEW_LINE> with pytest.raises(SyntaxError, match=error): <NEW_LINE> <INDENT> list(run_cfg_test(cfg))
Leading whitespace is forbidden in case that will be used for multi-line values, similar to MIME headers.
625941ebdc8b845886cb5a1b
def getUlx(self): <NEW_LINE> <INDENT> return self._jim_list._jipjimlist.getUlx()
Get the upper left corner x coordinate of this dataset. :return: The upper left corner x (georeferenced) coordinate of this dataset
625941ebd4950a0f3b08c82c
def decision_system(a1, a2, b1, b2, e1, e2): <NEW_LINE> <INDENT> determinant = a1 * b2 - a2 * b1 <NEW_LINE> if determinant != 0: <NEW_LINE> <INDENT> determinant_x = e1 * b2 - e2 * b1 <NEW_LINE> determinant_y = a1 * e2 - a2 * e1 <NEW_LINE> x = determinant_x / determinant <NEW_LINE> y = determinant_y / determinant <NEW_L...
Решение системы линейных уравнений из 2 штук с 2 неизвестными.
625941eb0383005118ecfac5
def html_encode(text): <NEW_LINE> <INDENT> return (text.replace('&', '&amp;').replace('<', '&lt;'). replace('>', '&gt;'))
Encode ``&``, ``<`` and ``>`` entities in ``text`` that will be used in or as HTML.
625941eb31939e2706e4d347
def fire(self): <NEW_LINE> <INDENT> for i in range(3): <NEW_LINE> <INDENT> bullet = Bullet() <NEW_LINE> bullet.rect.bottom = self.rect.y - i*20 <NEW_LINE> bullet.rect.centerx = self.rect.centerx <NEW_LINE> self.bullets.add(bullet)
#创建子弹精灵(一颗子弹) bullet = Bullet() #设置子弹精灵位置 bullet.rect.bottom = self.rect.y - 20 bullet.rect.centerx = self.rect.centerx #将精灵添加到子弹精灵组 self.bullets.add(bullet)
625941eb8da39b475bd6545e
def exists(self, value): <NEW_LINE> <INDENT> if not self.head: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> curr = self.head <NEW_LINE> if curr.value == value: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> while curr.next: <NEW_LINE> <INDENT> if curr.value == value: <NEW_LINE> <INDENT> return True <NEW_LI...
Whether a node with a particular value exists Args: value: The value to check Returns: True/False depending on the whether the value exists
625941eb1f5feb6acb0c502e
def FlushEntireSystemCache(self): <NEW_LINE> <INDENT> return self._platform_backend.FlushEntireSystemCache()
Flushes the OS's file cache completely. This function may require root or administrator access.
625941ebb7558d58953c53ee
def save_to_wav(self, event): <NEW_LINE> <INDENT> with wx.FileDialog(self, "Save wav file", wildcard="wav files (*.wav)|*.wav", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog: <NEW_LINE> <INDENT> if fileDialog.ShowModal() == wx.ID_CANCEL: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> pathname = fileDialog.Ge...
transforms soundboard data to playable wav file
625941eb5f7d997b87174f81
@utils.timeit_formated(utils.format_time) <NEW_LINE> def invalid_to_jpg(_path:str): <NEW_LINE> <INDENT> files = glob(os.path.join(_path, '**', '*.invalid')) <NEW_LINE> for file in files: <NEW_LINE> <INDENT> os.rename(file, file.replace('.invalid', '.jpg'))
Renames all '.invalid' files back to '*.jpg'.
625941eb0a366e3fb873ed03
def save_to_db(self): <NEW_LINE> <INDENT> db.session.add(self) <NEW_LINE> db.session.commit()
Save the user to the db.
625941eb2c8b7c6e89b35ca1
def _format_boolean(self, value, yes='X', no=' '): <NEW_LINE> <INDENT> res = value and yes or no <NEW_LINE> return str(res)
Format a boolean value into a fixed length ASCII (iso-8859-1) record.
625941eb283ffb24f3c55de0
def add(self, name, obj): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> raise RuntimeError("name is required") <NEW_LINE> <DEDENT> elif type(name) is not str: <NEW_LINE> <INDENT> name = s3_str(name) <NEW_LINE> <DEDENT> archive = self.archive <NEW_LINE> if not archive: <NEW_LINE> <INDENT> raise RuntimeError("cann...
Add an object to the archive @param name: the file name for the object inside the archive @param obj: the object to add (string or file-like object) @raises UserWarning: when adding a duplicate name (overwrites the existing object in the archive) @raises RuntimeError: if the archive is not writab...
625941eb0c0af96317bb86cc
def fix_scipy_svds(scipy_svds): <NEW_LINE> <INDENT> U, D, V = scipy_svds <NEW_LINE> sv_reordering = np.argsort(-D) <NEW_LINE> U = U[:, sv_reordering] <NEW_LINE> D = D[sv_reordering] <NEW_LINE> V = V.T[:, sv_reordering] <NEW_LINE> return U, D, V
scipy.sparse.linalg.svds orders the singular values backwards, this function fixes this insanity and returns the singular values in decreasing order Parameters ---------- scipy_svds: the out put from scipy.sparse.linalg.svds Output ------ U, D, V ordered in decreasing singular values
625941eb99fddb7c1c9de873
def __init__(self, arg_types: Sequence[type], var_arg_type: Optional[type] = None, return_type: Optional[type] = None) -> None: <NEW_LINE> <INDENT> self._arg_types = tuple(arg_types) <NEW_LINE> self._var_arg_type = var_arg_type <NEW_LINE> self._return_type = return_type
Initialize Signature object.
625941ebb57a9660fec33d6f
def _resolve_tag(self): <NEW_LINE> <INDENT> repositories = json.loads(self._content('repositories', memoize=False)) <NEW_LINE> if len(repositories) != 1: <NEW_LINE> <INDENT> raise ValueError('Tarball must contain a single repository, ' 'or a name must be specified to FromTarball.') <NEW_LINE> <DEDENT> for (repo, tags) ...
Resolve the singleton tag this tarball contains using legacy methods.
625941ebadb09d7d5db6cc71
def get_unique_fields(results, field): <NEW_LINE> <INDENT> out = set() <NEW_LINE> for res in results: <NEW_LINE> <INDENT> out.add( res[field] ) <NEW_LINE> <DEDENT> return list(out)
Given a list of TestResult, return a list of all unique values of 'field'
625941ebcdde0d52a9e5351b
def vel_callback(self, twist): <NEW_LINE> <INDENT> msg = SubThrusts() <NEW_LINE> msg.header.stamp = self.get_clock().now().to_msg() <NEW_LINE> msg.thrusts[0] = twist.linear.x + twist.linear.y - twist.angular.z <NEW_LINE> msg.thrusts[1] = -twist.linear.x + twist.linear.y + twist.angular.z <NEW_LINE> msg.thrusts[2] = -tw...
Assuming that forward is +y lateral right is +x depth up is +z Assuming that thrusts order is Horizontal drive 1. top left 2. top right 3. bottom left 4. bottom right Vertical drive 5. top left 6. top right 7. bottom left 8. bottom right Only for Robosub AUV for now
625941ebcdde0d52a9e5351c
def replace_webhook(self, scaling_group, policy, webhook, name, metadata=None): <NEW_LINE> <INDENT> return self._manager.replace_webhook(scaling_group, policy, webhook, name, metadata=metadata)
Replace an existing webhook. All of the attributes must be specified. If you wish to delete any of the optional attributes, pass them in as None.
625941ebac7a0e7691ed45a7
def genPythTriples(perimcap): <NEW_LINE> <INDENT> prim_triples = genPrimPythTriples(perimcap) <NEW_LINE> all_triples = prim_triples[:] <NEW_LINE> for trip in prim_triples: <NEW_LINE> <INDENT> mul = 2 <NEW_LINE> newperim = 0 <NEW_LINE> while newperim <= perimcap: <NEW_LINE> <INDENT> newtrip = [] <NEW_LINE> newperim = 0 ...
Generates all pythagorean triples less than or equal to a perimeter bound.
625941eb8a43f66fc4b54544
def is_displayed(self): <NEW_LINE> <INDENT> return 'openstax' in self.driver.page_source
Return True if the main content is loaded.
625941eb4527f215b584c936
def _ecl_pop_err(self): <NEW_LINE> <INDENT> s = self._ecl_state() <NEW_LINE> s += -1 <NEW_LINE> return self.DOLLARerrno
Method call emitted in compiled CL code to close an iferr block and start the handler. Returns $errno which is 0 iff no error occurred. Decrements local iferr state counter to track block nesting.
625941eb4527f215b584c937
def update_remote(self): <NEW_LINE> <INDENT> click.secho("UPDATE: Running update ...", bg="green", fg="white") <NEW_LINE> self.run(["fetch", "--all", "--prune"]) <NEW_LINE> for branch in self.branches: <NEW_LINE> <INDENT> click.secho( "UPDATE: %s - Updating local base-branch ..." % branch, fg="green" ) <NEW_LINE> self....
Updates odoo-dev remote from tracked remote branches
625941ebb545ff76a89142fa
def build_shift_dict(self, shift): <NEW_LINE> <INDENT> lower_case = string.ascii_lowercase <NEW_LINE> upper_case = string.ascii_uppercase <NEW_LINE> new_dic = {} <NEW_LINE> try: <NEW_LINE> <INDENT> for i in lower_case: <NEW_LINE> <INDENT> new_dic[i] = chr(((ord(i) + shift) - 97)% 26 + 97) <NEW_LINE> <DEDENT> <DEDENT> e...
Creates a dictionary that can be used to apply a cipher to a letter. The dictionary maps every uppercase and lowercase letter to a character shifted down the alphabet by the input shift. The dictionary should have 52 keys of all the uppercase letters and all the lowercase letters only. shift (integer): the amo...
625941eb4d74a7450ccd46a9
def __init__(self, dice, roll_now=True, *args, **kwargs): <NEW_LINE> <INDENT> self.dice = dice <NEW_LINE> if roll_now: <NEW_LINE> <INDENT> self.throw()
Simulates throwing one or more Die objects and exposes a list of the results.
625941eb956e5f7376d71350
def isValid(self): <NEW_LINE> <INDENT> return bool()
bool QRectF.isValid()
625941ebb57a9660fec33d70
def lookForAtlinks(self): <NEW_LINE> <INDENT> if self.is_a2t_candidate(): <NEW_LINE> <INDENT> logger.debug("A2T Alink candidate " + self.attrs['lid'] + " " + self.attrs['relType']) <NEW_LINE> apply_patterns(self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logger.debug("A2T Alink not a candidate " + self.attrs['lid']...
Examine whether the Alink can generate a Tlink.
625941eb3346ee7daa2b3255
def __str__(self): <NEW_LINE> <INDENT> return self.abbreviation
String representation of accidental. Returns string.
625941eba8370b7717052d82
def test_other_money_order_no_bank_account(self): <NEW_LINE> <INDENT> other_get = self.env.ref('money.other_get_60') <NEW_LINE> other_get.bank_id.account_id = False <NEW_LINE> with self.assertRaises(UserError): <NEW_LINE> <INDENT> other_get.other_money_done()
其他收支单审核,bank 的 account 不存在
625941eb10dbd63aa1bd3087
def process(self): <NEW_LINE> <INDENT> arg1, arg2 = self.operation.get_arguments() <NEW_LINE> try: <NEW_LINE> <INDENT> pair_values = arg1.instance.survey_id == arg2.instance.survey_id <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pair_values = False <NEW_LINE> <DEDENT> pair_values = pair_values and sel...
First test if the arguments come from the same survey, if they do, pair responses together, and filter out if it is missing numerator/denominator
625941eba05bb46b383ecd02
def refresh(self): <NEW_LINE> <INDENT> self.factorlist = copy.deepcopy(self.originalfactorlist)
Refresh the *factorlist* attribute to equate with *originalfactorlist*. This is in effect a reset of the system, erasing any changes to *factorlist* that the program has executed.
625941eb8e05c05ec3eea85e
def testNonexistentDataSource(self): <NEW_LINE> <INDENT> provider = getid1( '/Cell:%(cellName)s/Node:%(nodeName)s/Server:%(serverName)s' '/JDBCProvider:Derby JDBC Provider/' % topology ) <NEW_LINE> dataSource = getid1( '/Cell:%(cellName)s/Node:%(nodeName)s/Server:%(serverName)s' '/JDBCProvider:Derby JDBC Provider' '/Da...
Customize missing DataSource
625941ebfbf16365ca6f66b4
def test_000_mls_disabled(self): <NEW_LINE> <INDENT> mock_p = Mock(qpol.qpol_policy_t) <NEW_LINE> mock_p.capability.return_value = False <NEW_LINE> self.assertRaises(MLSDisabled, level_decl_factory, mock_p, None)
Level declaration factory on MLS-disabled policy.
625941eb9b70327d1c4e12bc
def org_group_update_affiliations(record): <NEW_LINE> <INDENT> if record.deleted and record.deleted_fk: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fk = json.loads(record.deleted_fk) <NEW_LINE> organisation_id = fk["organisation_id"] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> e...
Update affiliations for organisation group memberships @param record: the org_group_membership record
625941eb1f037a2d8b9466e2
def GetTrueMotorTorques(self): <NEW_LINE> <INDENT> if self._accurate_motor_model_enabled or self._pd_control_enabled: <NEW_LINE> <INDENT> return self._observed_motor_torques <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> motor_torques = [ self._pybullet_client.getJointState(self.quadruped, motor_id)[3] for motor_id in s...
Get the amount of torque the motors are exerting. Returns: Motor torques of all eight motors.
625941eb9f2886367277ad6e
def odm_entity_delete(entity: odm.model.Entity): <NEW_LINE> <INDENT> _api.delete_all(entity)
'odm.entity.delete' event handler.
625941eb2c8b7c6e89b35ca2
def _create_update_paths(subparsers): <NEW_LINE> <INDENT> paths = subparsers.add_parser('update_paths', help="Command to extend PYTHONPATH needed by RobotWS") <NEW_LINE> paths.set_defaults(func=exe_update_paths, paths=PATHS)
Specify options needed by update_paths command line command
625941ebe64d504609d74d25
def get_queryset(self): <NEW_LINE> <INDENT> user = self.request.user <NEW_LINE> return Picture.objects.filter(user=user)
This view should return a list of all the picture tourist spots for the currently authenticated user.
625941eb7047854f462a18e9
def get_plugin_description(self): <NEW_LINE> <INDENT> return "L3 SDN Controller For Neutron"
Returns string description of the plugin.
625941eb50812a4eaa59c802
def calculate_energy_fluence(traces,times, signal_window=100., remove_noise=True): <NEW_LINE> <INDENT> energy_fluence_vector = calculate_energy_fluence_vector(traces, times, signal_window, remove_noise) <NEW_LINE> return energy_fluence_vector
get energy fluence Parameters ---------- traces: array time series in V / m array is expected to have 2 (time, channel) or 3 (antenna, time, channel) dimensions -----times: array (removed) corresponding time vector in seconds array is expected to have 1 (time) or 2 (antenna, time) dimensions signal_window (op...
625941ebdc8b845886cb5a1c
def __init__(self, opcode, xfer, elements, rng=0, fast=0): <NEW_LINE> <INDENT> SCSICommand.__init__(self, opcode, 0, 0) <NEW_LINE> self.cdb = self.build_cdb(opcode=self.opcode.value, starting_element_address=xfer, number_of_elements=elements, range=rng, fast=fast)
initialize a new instance :param opcode: a OpCode instance :param xfer: starting element address :param elements: number of elements :param rng: range indicates if all elements should be checked, if set to 1 xfer and elements are ignored :param fast: fast , if set to 1 scan for media presence only. If set...
625941eb23e79379d52eea42
def template_CustomisedFormLayoutWithSequence(request): <NEW_LINE> <INDENT> pass
${form.header()|n} ${form.metadata()|n} ${form['firstName']()|n} <div id="${form['surname'].cssname}--field" class="${form['surname'].classes}"> <strong>${form['surname'].description}</strong> <em>${form['surname'].error}</em> ${form['surname'].widget()|n} <br /> <table> %for field in form['emails'].field...
625941eb4428ac0f6e5bacdc
def test_02_02_line_in_square(self): <NEW_LINE> <INDENT> l1 = np.zeros((10, 10), int) <NEW_LINE> l1[1:5, 1:5] = 1 <NEW_LINE> l1[5:9, 5:9] = 2 <NEW_LINE> l2 = np.zeros((10, 10), int) <NEW_LINE> l2[2, 2:5] = 3 <NEW_LINE> l2[2, 6:9] = 4 <NEW_LINE> result = morph.associate_by_distance(l1, l2, 0) <NEW_LINE> self.assertEqual...
Test a line in a square
625941eb7d43ff24873a3189
def delete_work_test(table_name): <NEW_LINE> <INDENT> if table_name == 'trabalhos': <NEW_LINE> <INDENT> name = 'work' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> name = 'test' <NEW_LINE> <DEDENT> ID = int(input(f"Enter the ID of the {name} you wanna delete or digit a >=0 number to cancel: \n" )) <NEW_LINE> return DB....
Calls the method of the class DataBase that deletes data and then remove the row from the selected ID
625941eb099cdd3c635f113e
def __init__(self, icon, text, parent): <NEW_LINE> <INDENT> pass
void KActionMenu.__init__(KIcon icon, QString text, QObject parent)
625941eb3eb6a72ae02ec9d0
def test_decode_new_reference(self): <NEW_LINE> <INDENT> expected = erl_codec.NewReference( erl_codec.Atom('nonode@nohost'), 0, [0, 0, 94]) <NEW_LINE> input_value = [ 131, 114, 0, 3, 100, 0, 13, 110, 111, 110, 111, 100, 101, 64, 110, 111, 104, 111, 115, 116, 0, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 0] <NEW_LINE> stream = s...
Test decoding a new reference.
625941ebbe7bc26dc91cdadc
def addwoeid(self,woeidint): <NEW_LINE> <INDENT> if len(self.city) == 0: <NEW_LINE> <INDENT> self.woeid = woeidint <NEW_LINE> self.weather_obj = self.weather.lookup(woeidint)
Adds city to the current object using woeid which is where on earth ID this object can only be used for this woeid, or a new woeid but can not be reinitialized with city names @param woeid int @return void @post creats a current city related object
625941eb711fe17d82542845
def relative_rate(self): <NEW_LINE> <INDENT> return _gnuradio_core_io.gr_file_descriptor_source_sptr_relative_rate(self)
relative_rate(self) -> double
625941eb07d97122c4178d7c
def extract_names(filename): <NEW_LINE> <INDENT> html = open(filename, 'rU').read() <NEW_LINE> match = re.search(r'Popularity\sin\s(\d\d\d\d)', html) <NEW_LINE> list_names = [] <NEW_LINE> list_names.append(match.group(1)) <NEW_LINE> match_name = re.findall(r'<td>(\d+)</td><td>([A-Za-z]+)',html) <NEW_LINE> for names in ...
Given a file name for baby.html, returns a list starting with the year string followed by the name-rank strings in alphabetical order. ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]
625941eb07f4c71912b1196a
def __init__(self, main_controller, text=None, selector_textbox=None, role=None): <NEW_LINE> <INDENT> super(TextBox, self).__init__() <NEW_LINE> self.buffer = self.get_buffer() <NEW_LINE> self.elem = None <NEW_LINE> self.main_controller = main_controller <NEW_LINE> self.placeables_controller = main_controller.placeable...
Constructor. @type main_controller: L{virtaal.controllers.main_controller} @param main_controller: The main controller instance. @type text: String @param text: The initial text to set in the new text box. Optional. @type selector_textbox: C{TextBox} @param selector_textbox: The text box in which placeable selection...
625941eb3d592f4c4ed1d545
def set_thread_priority(self, priority): <NEW_LINE> <INDENT> return _iio_swig.device_source_sptr_set_thread_priority(self, priority)
set_thread_priority(device_source_sptr self, int priority) -> int
625941eb76e4537e8c351b5c
def c_expression(self, var_name, word_num=0): <NEW_LINE> <INDENT> assert word_num == 0 <NEW_LINE> return "%s" % var_name
Return code for a C expression that gets word 'word_num' of this type.
625941eb73bcbd0ca4b2c55b
def init(self): <NEW_LINE> <INDENT> for i, bc in enumerate(self.barcode_list): <NEW_LINE> <INDENT> if bc != "": <NEW_LINE> <INDENT> dut = PGEMBase(device=self.adk, slot=i, barcode=bc) <NEW_LINE> dut.status = DUT_STATUS.Idle <NEW_LINE> dut.cable_barcode = self.cable_barcodes_list[i] <NEW_LINE> dut.testdate = datetime.da...
hardware initialize in when work loop starts. :return: None.
625941eb498bea3a759b9f93
def Clone(self): <NEW_LINE> <INDENT> state = GameState(0) <NEW_LINE> state.lastplayer = self.lastplayer <NEW_LINE> state.cities = self.cities <NEW_LINE> state.operators = self.operators <NEW_LINE> state.reward= self.reward <NEW_LINE> state.score =self.score <NEW_LINE> state.rollout_layer = self.rollout_layer <NEW_LINE>...
Create a deep clone of this game state.
625941eb8c0ade5d55d3eea5
def thirdMax2(self, nums): <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> nums = list(set(nums)) <NEW_LINE> if len(nums) < 3: <NEW_LINE> <INDENT> return max(nums) <NEW_LINE> <DEDENT> t = nums[:3] <NEW_LINE> t.sort() <NEW_LINE> first = t[2] <NEW_LINE> second = t[1] <NEW_LINE> third = t...
:type nums: List[int] :rtype: int 92ms
625941ebd8ef3951e3243a23
def search_index(self, table, term, limit=25, offset=0): <NEW_LINE> <INDENT> results = [] <NEW_LINE> with self.index[table].searcher() as searcher: <NEW_LINE> <INDENT> search_hit = searcher.search_page(term, offset+1, limit) <NEW_LINE> for result in search_hit: <NEW_LINE> <INDENT> results.append(result.fields()) <NEW_L...
Search the index returning the hit results with references to data in storage. @param table: The table name to search. @type table: C{string} @param term: Parsed query term used by the index searcher. @type term: C{string} @param limit: Limit the number of results returned by the search. @type limit: C{int} @param ...
625941eb30c21e258bdfa988
def default(self, o): <NEW_LINE> <INDENT> if isinstance(o, Language): <NEW_LINE> <INDENT> return getattr(o, 'name') <NEW_LINE> <DEDENT> return text_type(o)
Convert properties to string.
625941eb460517430c39465d
def get_credit_providers(self): <NEW_LINE> <INDENT> key = 'credit_providers' <NEW_LINE> credit_providers = cache.get(key, []) <NEW_LINE> if not credit_providers: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> credit_api = EdxRestApiClient( get_lms_url('/api/credit/v1/'), oauth_access_token=self.request.user.access_token ...
Retrieve all credit providers from LMS. Results will be sorted alphabetically by display name.
625941eb21bff66bcd684e33
def conflict_exclusivity(self, _level, _candidate): <NEW_LINE> <INDENT> conflict = False <NEW_LINE> memberships = _candidate.get_memberships(_level) <NEW_LINE> for mk in memberships.keys(): <NEW_LINE> <INDENT> if memberships[mk].group_type == "EX" and mk.split(":")[0] == _level: <NEW_LINE> <INDENT> c...
Check for an exculsivity conflict.
625941eb5fcc89381b1e1ba8
def to_pascal_case(target, separator=_DEFAULT_SEPARATOR): <NEW_LINE> <INDENT> result = '' <NEW_LINE> if target is not None and len(target): <NEW_LINE> <INDENT> if target[0:len(separator)] == separator: <NEW_LINE> <INDENT> result = separator <NEW_LINE> <DEDENT> for text in target.split(separator): <NEW_LINE> <INDENT> if...
Converts a string to pascal case. :param str target: A string to be converted. :param str separator: A separator used to split target string into parts. :returns: The target string converted to pascal case. :rtype: str
625941ebdd821e528d63b68b
def selectedItems(self): <NEW_LINE> <INDENT> context = self.context <NEW_LINE> try: <NEW_LINE> <INDENT> return self.field.get(context) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return []
Retorna la llista/valor guardat del camp
625941eb5510c4643540f8bd
def test_email_exists(self): <NEW_LINE> <INDENT> response = self.client.post( '/api/v2/auth/signup', data=json.dumps(email_exists), content_type='application/json', headers=self.get_token()) <NEW_LINE> result = json.loads(response.data.decode()) <NEW_LINE> self.assertEqual(result['message'], 'Email already exists!') <N...
Test create a new account.
625941eb6fece00bbac2dc2a
def setup_reader(self): <NEW_LINE> <INDENT> r = PolyDataReader() <NEW_LINE> r.initialize(get_example_data('caffeine.pdb')) <NEW_LINE> self.e.add_source(r) <NEW_LINE> self.bounds = (3.10, 10.78, -2.39, 4.03, -10.60, -6.31)
"Setup the reader in here. This is called after the engine has been created and started. The engine is available as self.e. This method is called by setUp().
625941eb60cbc95b062c6a29
def CombLayer(self): <NEW_LINE> <INDENT> if not self.context.mcnp_string: <NEW_LINE> <INDENT> return "Not defined yet." <NEW_LINE> <DEDENT> clID = re.sub('^0+', '', self.context.ID) <NEW_LINE> out = self.comments("CombLayer") <NEW_LINE> out += "MObj.setMaterial(%s, \"M%s\",\n" % (clID, self.context.ID) <NEW_LINE> for l...
prints CombLayer material definition
625941eb187af65679ca5605
def set_clipboard(self, text, label=None): <NEW_LINE> <INDENT> self.jsonrpc.setClipboard(label, text)
Args: text: The actual text in the clip. label: User-visible label for the clip data.
625941ebe5267d203edce17c