code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _get_luncopy_info(self, luncopyid): <NEW_LINE> <INDENT> url = self.url + "/LUNCOPY?range=[0-100000]" <NEW_LINE> data = json.dumps({"TYPE": "219", }) <NEW_LINE> result = self.call(url, data, "GET") <NEW_LINE> self._assert_rest_result(result, 'Get lun copy information error.') <NEW_LINE> luncopyinfo = {} <NEW_LINE> i...
Get LUNcopy information.
625941e6be8e80087fb2108e
@app.route('/user', methods=['POST']) <NEW_LINE> def generate_user(): <NEW_LINE> <INDENT> form = request.json <NEW_LINE> phone_num = form['phone'] <NEW_LINE> first_name = form['account_info']['first'] <NEW_LINE> last_name = form['account_info']['last'] <NEW_LINE> zip_code = form['account_info']['zip'] <NEW_LINE> custom...
Generate a new user and return the
625941e69f2886367277acdb
def add_element(self,element): <NEW_LINE> <INDENT> nr_elements = len(self.elements) <NEW_LINE> if self.layout is None: <NEW_LINE> <INDENT> self.logger.warn("Cannot add element: no layout specified") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (x,y) = self.layout.positions[nr_elements] <NEW_LINE> element.pos = (x+self...
Adds a visual element to the list of elements and set it on the position specified by the layout
625941e6dd821e528d63b5f7
def fieldtech_device_sync (server, form): <NEW_LINE> <INDENT> _with_valid_device (form, lambda: _send_response (server, ALLISWELL, rc=response_code_number(ALLISWELL)), lambda: _send_response (server, FORBIDDEN))
Handle the /fieldtech/device/sync request from the Android tablet app. This request occurs from within the 'TechHome' portion of the app. The actual server will update a database with the required info but we'll just respond ok for now, if the request is otherwise valid.
625941e6566aa707497f49b4
def _load_playlists(self): <NEW_LINE> <INDENT> self.smart = self.model.append(None, [self.folder, _("Smart Playlists"), None]) <NEW_LINE> self.custom = self.model.append(None, [self.folder, _("Custom Playlists"), None]) <NEW_LINE> names = self.smart_manager.playlists[:] <NEW_LINE> names.sort() <NEW_LINE> for name in na...
Loads the currently saved playlists
625941e696565a6dacc8fb1c
def test_bike_has_attributes(self): <NEW_LINE> <INDENT> new_bike = Bike() <NEW_LINE> self.assertTrue('city_id' in new_bike.__dir__()) <NEW_LINE> self.assertTrue('user_id' in new_bike.__dir__()) <NEW_LINE> self.assertTrue('latitude' in new_bike.__dir__()) <NEW_LINE> self.assertTrue('longitude' in new_bike.__dir__()) <NE...
Checks the bike attributes exist
625941e6ad47b63b2c50a3d0
def test_logic_operations(self): <NEW_LINE> <INDENT> pass
DESCR: Test FixNum logic operations.
625941e657b8e32f524838ef
def create_or_update_linked_service( self, linked_service_name, properties, if_match=None, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> _linked_service = mod...
Creates or updates a linked service. :param linked_service_name: The linked service name. :type linked_service_name: str :param properties: Properties of linked service. :type properties: ~azure.synapse.artifacts.models.LinkedService :param if_match: ETag of the linkedService entity. Should only be specified for upda...
625941e68e05c05ec3eea7ca
def redo(self, widget): <NEW_LINE> <INDENT> if len(self.nodes) == 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if len(self.nodes[0].redo) == 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> op = self.undo_action_history.pop() <NEW_LINE> self.action_history.append(op) <NEW_LINE> for node in self.nodes: <...
Redo the modifications of the previous operation. Restore previous undo attributes.
625941e656ac1b37e6264619
def get_maze_bqm(n_rows, n_cols, start, end, walls, penalty_per_tile=0.5): <NEW_LINE> <INDENT> maze = Maze(n_rows, n_cols, start, end, walls) <NEW_LINE> return maze.get_bqm(penalty_per_tile)
Returns a BQM that corresponds to a valid path through a maze. This maze is described by the parameters. Specifically, it uses the parameters to build a maze constraint satisfaction problem (CSP). This maze CSP is then converted into the returned BQM. Note: If penalty_per_tile is too large, the path will be too heavi...
625941e62ae34c7f2600d582
def vec_random_limits( dim , limits ): <NEW_LINE> <INDENT> rtnVec = [] <NEW_LINE> randVec = vec_random( dim ) <NEW_LINE> for i , elem in enumerate( randVec ): <NEW_LINE> <INDENT> span = abs( limits[i][1] - limits[i][0] ) <NEW_LINE> rtnVec.append( elem * span + limits[i][0] ) <NEW_LINE> <DEDENT> return rtnVec
Return a vector in which each element takes on a random value between 'limits[i][0]' and 'limits[i][1]' with a uniform distribution
625941e65166f23b2e1a55ab
@task <NEW_LINE> def dropbox(): <NEW_LINE> <INDENT> r1 = env.run(SUDO_INSTALL + "nautilus-dropbox") <NEW_LINE> return r1
Install dropbox.
625941e630dc7b7665901db4
def ungap(self, gap="-"): <NEW_LINE> <INDENT> if len(gap) != 1 or not isinstance(gap, str): <NEW_LINE> <INDENT> raise ValueError("Unexpected gap character, %s" % repr(gap)) <NEW_LINE> <DEDENT> return CodonSeq(str(self._data).replace(gap, ""), rf_table=self.rf_table)
Return a copy of the sequence without the gap character(s).
625941e6fb3f5b602dac3aea
def perl5_output(target, source, env): <NEW_LINE> <INDENT> args = create_args_perl5_output(env, source) <NEW_LINE> with open(str(target[0]), "w") as target_file: <NEW_LINE> <INDENT> rv = subprocess.call(args, stdout=target_file) <NEW_LINE> <DEDENT> return rv
The actual PerlOutput Builder action.
625941e6d58c6744b42580b0
def send_message(frm=None, to=None, text=None): <NEW_LINE> <INDENT> assert to is not None <NEW_LINE> assert text is not None <NEW_LINE> if frm is None: <NEW_LINE> <INDENT> frm = settings.NEXMO_DEFAULT_FROM <NEW_LINE> <DEDENT> nexmo = Nexmo(settings.NEXMO_API_KEY, settings.NEXMO_API_SECRET) <NEW_LINE> response = nexmo.s...
Shortcut to send a sms using libnexmo api. :param frm: The originator of the message :param to: The message's recipient :param text: The text message body Example usage: >>> send_message(to='+33123456789', text='My sms message body')
625941e6a4f1c619b28b0481
def checkout_new_branch( self, branch_name: str, remote_branch: tp.Optional[str] = None ) -> None: <NEW_LINE> <INDENT> checkout_new_branch( self.__parent_code_base.base_dir / self.path, branch_name, remote_branch )
Create and checkout out a new branch in the sub project. Args: branch_name: name of the new branch, should not exists in the repo
625941e676d4e153a657ef84
def low_pass(img, sigma, size): <NEW_LINE> <INDENT> pass
Filter the image as if its filtered with a low pass filter of the given sigma and a square kernel of the given size. A low pass filter supresses the higher frequency components (finer details) of the image. Output: Return an image of the same dimensions as the input image (same width, height and the number of ...
625941e67047854f462a1857
def get_netflix_english_title(self): <NEW_LINE> <INDENT> title = self.title <NEW_LINE> query = '{} site:netflix.com'.format(title) <NEW_LINE> result = search(query, lang="en") <NEW_LINE> if result: <NEW_LINE> <INDENT> url = result[0] <NEW_LINE> r = re.findall("https://www.netflix.com/(.*)/title/(.*)", url) <NEW_LINE> t...
Try to scrape the title from Netflix and get the english translation. First a Google search is made on Netflix' site and then the Netflix id is obtained and the English translated site is accessed and scraped. Returns: The English title found on Netflix
625941e63617ad0b5ed68349
def changePassword(self, oldPassword, newPassword): <NEW_LINE> <INDENT> if(self.getPassword() == oldPassword): <NEW_LINE> <INDENT> if(oldPassword != newPassword): <NEW_LINE> <INDENT> self.setPassword(newPassword) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NewPasswordEqualOldPasswordException() <NEW_LINE> <DEDE...
Cambia la contrasenha de un usuario. Si la contrasenha anterior es incorrecta, salta una excepcion. Si la contrasenha a la que se quiere cambiar, es igual a la que se tenia, levanta una excepcion
625941e632920d7e50b28626
def softmax_loss_naive(W, X, y, reg): <NEW_LINE> <INDENT> loss = 0.0 <NEW_LINE> dW = np.zeros_like(W) <NEW_LINE> num_train = X.shape[0] <NEW_LINE> num_class = W.shape[1] <NEW_LINE> scores = X.dot(W) <NEW_LINE> for i in range(num_train): <NEW_LINE> <INDENT> score_i = scores[i] <NEW_LINE> normalized_score_i = score_i - n...
Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples. Inputs: - W: A numpy array of shape (D, C) containing weights. - X: A numpy array of shape (N, D) containing a minibatch of data. - y: A numpy array of shape (N,) contain...
625941e6d486a94d0b98e599
def getLambda(self): <NEW_LINE> <INDENT> return get_c0()/numpy.array(self.frequency_vector)
Get the wavelength list. .. todo:: Rename to getWavelength()?
625941e6b545ff76a8914267
def interface_vlan_interface_vlan_ip_arp_inspection_trust(**kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> interface_vlan = ET.SubElement(config, "interface-vlan", xmlns="urn:brocade.com:mgmt:brocade-interface") <NEW_LINE> if kwargs.pop('delete_interface_vlan', False) is True: <NEW_LINE> <INDENT>...
Auto Generated Code
625941e6a8ecb033257d351e
def rotate(text, shift): <NEW_LINE> <INDENT> def rotate_char(char, shift): <NEW_LINE> <INDENT> if char.isalpha(): <NEW_LINE> <INDENT> shifted_char = chr((ord(char.lower()) - 97 + shift) % 26 + 97) <NEW_LINE> if char.isupper(): <NEW_LINE> <INDENT> shifted_char = shifted_char.upper() <NEW_LINE> <DEDENT> <DEDENT> else: <N...
Encrypt text using rotational cipher
625941e67d847024c06be712
def nodeInitializer(): <NEW_LINE> <INDENT> pass
Add attrs
625941e61f5feb6acb0c4f9c
def buildBlocks(prefixlen, data): <NEW_LINE> <INDENT> ml = (prefixlen + len(data)) * 8 <NEW_LINE> blocks = tools.split(data, BLOCK_LEN) <NEW_LINE> if len(blocks[-1]) == BLOCK_LEN: <NEW_LINE> <INDENT> blocks.append(b'') <NEW_LINE> <DEDENT> blocks[-1] = blocks[-1] + b'\x80' <NEW_LINE> remSpace = BLOCK_LEN - len(blocks[-1...
Builds blocks for hashing from given data.
625941e65f7d997b87174eee
def main(_): <NEW_LINE> <INDENT> if FLAGS.load_model is None: <NEW_LINE> <INDENT> print('Please specify checkpoint file to load model from') <NEW_LINE> return -1 <NEW_LINE> <DEDENT> if not os.path.exists(FLAGS.load_model + ".index"): <NEW_LINE> <INDENT> print('Checkpoint file not found', FLAGS.load_model) <NEW_LINE> re...
Loads trained model and evaluates it on test split
625941e6e5267d203edce0ea
def __init__(self, tier, text_type, t_time): <NEW_LINE> <INDENT> self.tier = tier <NEW_LINE> self.text_type = text_type <NEW_LINE> self.t_time = t_time <NEW_LINE> self.classid = "" <NEW_LINE> self.nameid = "" <NEW_LINE> self.xmin = 0 <NEW_LINE> self.xmax = 0 <NEW_LINE> self.size = 0 <NEW_LINE> self.transcript = "" <NEW...
Initializes attributes of the tier: class, name, xmin, xmax size, transcript, total time. Utilizes text_type to guide how to parse the file. @type tier: a tier object; single item in the TextGrid list. @param text_type: TextGrid format @param t_time: Total time of TextGrid file. @param classid: Type of tier (point...
625941e682261d6c526ab8f8
def IsRuc(val): <NEW_LINE> <INDENT> if not len(val) == 13: <NEW_LINE> <INDENT> raise ValidationError("RUC no tiene 13 digitos") <NEW_LINE> <DEDENT> if val == '9999999999999': <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not val.endswith("001"): <NEW_LINE> <INDENT> raise ValidationError("RUC no termina en 001") <NE...
Ensures the value is a valid RUC
625941e6b545ff76a8914268
def test_300_issue111(self): <NEW_LINE> <INDENT> q = TERuleQuery(self.p, source="test300b", source_indirect=True) <NEW_LINE> r = sorted(q.results()) <NEW_LINE> self.assertEqual(len(r), 4) <NEW_LINE> self.validate_rule(r[0], "allow", "test300a", "test300target", "infoflow7", set(["hi_w"])) <NEW_LINE> self.validate_rule(...
TE rule query with attribute source criteria, indirect match.
625941e6fbf16365ca6f661f
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkBinaryDilateImageFilterIUS2IUS2SE2.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj
New() -> itkBinaryDilateImageFilterIUS2IUS2SE2 Create a new object of the class itkBinaryDilateImageFilterIUS2IUS2SE2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non ...
625941e6ac7a0e7691ed4516
def filter(self, fes): <NEW_LINE> <INDENT> request = self.request <NEW_LINE> filters = request.GET.get("filter", False) <NEW_LINE> if not filters: <NEW_LINE> <INDENT> return fes <NEW_LINE> <DEDENT> filters = filters.replace("stability=0", "stability<=0") <NEW_LINE> filters = filters.replace("&", " AND ") <NEW_LINE> fil...
Valid attributes: element, generic, prototype, spacegroup, volume, natoms, ntypes, stability, delta_e, band_gap Requirments: 1. Space padding is required between expression. 2. For each epression, space is not allowed. 3. Operators include: 'AND', 'OR' 4. '(' and ')' can be used to change p...
625941e6b7558d58953c535d
def __stride4DImage(self, source, bEncs, bVecs, bVals, layout="1,2,3"): <NEW_LINE> <INDENT> dwiStride = self.buildName(source, "stride") <NEW_LINE> bEncsStride = self.buildName(bEncs, "stride") <NEW_LINE> bVecsStride= self.buildName(bVecs, "stride") <NEW_LINE> bValsStride= self.buildName(bVals, "stride") <NEW_LINE> sub...
perform a reorientation of the axes and flip the image into a different layout. stride gredient encoding files as well if provided Args: source: the input image bEncs: a mrtrix gradient encoding files to stride bVecs: a vector gradient encoding files to stride bVals:...
625941e6ac7a0e7691ed4517
def split(self, ratio, pre_batch_size=None, pos_batch_size=None): <NEW_LINE> <INDENT> mid = int(ratio * self.size) <NEW_LINE> pos_batch_size = pos_batch_size if pos_batch_size else self.batch_size <NEW_LINE> pre_batch_size = pre_batch_size if pre_batch_size else self.batch_size <NEW_LINE> if pos_batch_size > mid: <NEW_...
Split the dataset to tow dataset by ratio Args: ratio: the ratio for split, for example: dataset --> shape of (100,) previous, posterior = dataset.split(0.1) previous --> shape of (90,) posterior --> shape of (10,) pre_batch_size: Optional, the batch size for pr...
625941e6aad79263cf390e9a
def get_alpha(self): <NEW_LINE> <INDENT> return _analog_swig.pll_carriertracking_cc_get_alpha(self)
get_alpha(pll_carriertracking_cc self) -> float
625941e676e4537e8c351ac8
def render_statement(statement, bind=None): <NEW_LINE> <INDENT> if isinstance(statement, Query): <NEW_LINE> <INDENT> if bind is None: <NEW_LINE> <INDENT> bind = statement.session.get_bind(statement._mapper_zero_or_none()) <NEW_LINE> <DEDENT> statement = statement.statement <NEW_LINE> <DEDENT> elif bind is None: <NEW_LI...
Generate an SQL expression string with bound parameters rendered inline for the given SQLAlchemy statement.
625941e6498bea3a759b9f00
def print_schema(dframe): <NEW_LINE> <INDENT> print(_java_api().explain(dframe._jdf))
Prints the schema of the dataframe, including all the metadata that describes tensor information. TODO: explain the data :param dframe: a Spark DataFrame :return: nothing
625941e6046cf37aa974d196
def __init__(self, prop_type=None, cc_path=None, cc_type=CC_TYPE_GOLANG, cc_name=None, cc_version=None, fcn=None, args=None, cc_endorsement_policy=None, transient_map=None, packaged_cc=None, collections_config=None, package_id=None, is_init=False): <NEW_LINE> <INDENT> self._cc_type = cc_type <NEW_LINE> self._prop_type ...
Construct transaction proposal request :param cc_type: chaincode type :param prop_type: proposal type :param packaged_cc: chaincode gz.tar bytes :param transient_map: transient data map :param cc_endorsement_policy: chaincode endorsement policy :param args: function arguments :param fcn: function name :param cc_versio...
625941e62c8b7c6e89b35c10
def fillbox(self, alts, word=None): <NEW_LINE> <INDENT> ui = self.c.frame.top.leo_ui <NEW_LINE> self.suggestions = alts <NEW_LINE> if not word: <NEW_LINE> <INDENT> word = "" <NEW_LINE> <DEDENT> self.wordLabel.setText("Suggestions for: " + word) <NEW_LINE> self.listBox.clear() <NEW_LINE> if len(self.suggestions): <NEW_L...
Update the suggestions listBox in the Check Spelling dialog.
625941e61f037a2d8b94664f
def test_save_user(self): <NEW_LINE> <INDENT> self.new_user.save_user() <NEW_LINE> self.assertEqual(len(User.user_list),1)
test_save_user test case to test if the user object is saved into user list.
625941e6bde94217f368323f
def order_by(self, key, reverse=False) -> List['Proposal']: <NEW_LINE> <INDENT> return sorted(self.proposals, key=key, reverse=reverse)
Возвращает отсортированный по ключу список предложений.
625941e67cff6e4e81117dd8
def score(line): <NEW_LINE> <INDENT> fields = line[8].split("/") <NEW_LINE> return fields[2] + "/" + fields[0] + "/" + fields[1]
Return the line's datestamp, but with the format changed from "12/31/2017" to "2017/12/31". That makes alphabetical order the same as chronological order.
625941e64c3428357757c778
def reorder_jmultis_det_terms(jmulti_output, constant, seasons): <NEW_LINE> <INDENT> if seasons == 0: <NEW_LINE> <INDENT> return jmulti_output <NEW_LINE> <DEDENT> constant = int(constant) <NEW_LINE> const_column = jmulti_output[:, :constant] <NEW_LINE> season_columns = jmulti_output[:, constant:constant+seasons-1].copy...
In case of seasonal terms and a trend term we have to reorder them to make the outputs from JMulTi and statsmodels comparable. JMulTi's ordering is: [constant], [seasonal terms], [trend term] while in statsmodels it is: [constant], [trend term], [seasonal terms] Parameters ---------- jmulti_output : ndarray (neqs x nu...
625941e6e76e3b2f99f3ac57
def exitPropTestIsSuperset(self, ctx): <NEW_LINE> <INDENT> ip_or_subnet_str = _literal_terminal_to_python_val(ctx.StringLiteral()) <NEW_LINE> debug_label = u"exitPropTestIsSuperset ({}{})".format( u"not " if ctx.NOT() else u"", ip_or_subnet_str ) <NEW_LINE> obs_values = self.__pop(debug_label) <NEW_LINE> def contains_p...
Consumes an observation data map, {obs_id: {...}, ...}, representing selected values from Cyber Observable objects in each observation (grouped by observation index and root Cyber Observable object ID). See exitObjectPath(). Produces a map representing those observations with Cyber Observable object values whic...
625941e6956e5f7376d712bf
@app.route('/entries') <NEW_LINE> @login_required <NEW_LINE> def list(): <NEW_LINE> <INDENT> list = current_user.get_entries().limit(100) <NEW_LINE> user = current_user <NEW_LINE> return render_template('entries.html', list=list)
Lists all entries created by current user
625941e64e4d5625662d4825
def hmw(phases,weights,m=20,c=4): <NEW_LINE> <INDENT> phases = np.asarray(phases)*(2*np.pi) <NEW_LINE> s = (np.asarray([(weights*np.cos(k*phases)).sum() for k in xrange(1,m+1)]))**2 + (np.asarray([(weights*np.sin(k*phases)).sum() for k in xrange(1,m+1)]))**2 <NEW_LINE> return ( (2./(weights**2).sum()) * np.cumsu...
Calculate the H statistic (de Jager et al. 1989) and weight each sine/cosine with the weights in the argument. The distribution is corrected such that the CLT still applies, i.e., it maintains the same calibration as the unweighted version.
625941e6dd821e528d63b5f8
def create_command_buttons(self): <NEW_LINE> <INDENT> f = self.buttonframe = ttk.Frame(self.inner) <NEW_LINE> f.grid(row=99, column=0, columnspan=2, sticky='e', pady=[20,0])
Place buttons in vertical command frame gridded on right.
625941e626238365f5f0f2c7
def parse_line(text): <NEW_LINE> <INDENT> action, value = text[0], int(text[1:]) <NEW_LINE> if action not in CHARS: <NEW_LINE> <INDENT> raise ValueError('invalid action %r' % action) <NEW_LINE> <DEDENT> if value < 0: <NEW_LINE> <INDENT> raise ValueError('invalid value %r' % (value,)) <NEW_LINE> <DEDENT> if action in 'L...
parse line into (operator, argument) tuple.
625941e616aa5153ce3628cb
def setMimeTypeFilter(self, mimeTypes): <NEW_LINE> <INDENT> pass
void Akonadi.AgentActionManager.setMimeTypeFilter(QStringList mimeTypes)
625941e64d74a7450ccd4617
def __generate_resources_ontology_definitions() -> str: <NEW_LINE> <INDENT> definitions = '' <NEW_LINE> definitions += f':- {RES_SYMBOL}({RES_VARIABLE}), #sum {{ {M_VARIABLE},{CMP_VARIABLE} : ' f'{PRD_SYMBOL}({CMP_VARIABLE}, {RES_VARIABLE}, {M_VARIABLE}), {IN_SYMBOL}({CMP_VARIABLE}) }} < 0.\n' <NEW_LI...
Generates ontology definitions regarding taxonomy of components. (Ontology definitions are the same for every instance of configuration problem.) :return: Ontology definitions of taxonomy.
625941e68c0ade5d55d3ee11
def GetCommentNums(self, movie_id): <NEW_LINE> <INDENT> headers = { 'User-Agent': random.choice(self.user_agent) } <NEW_LINE> response = requests.get(self.comment_url.format(movieid=movie_id, date=self.now_date), headers=headers) <NEW_LINE> if response.status_code == 200: <NEW_LINE> <INDENT> comments_list = json.loads(...
根据电影id进入电影详情页返回电影评论总数 :return: commentNUM
625941e626068e7796caf138
def verify_lists_expected_cohorts(self, response_dict, expected_cohorts): <NEW_LINE> <INDENT> self.assertTrue(response_dict.get("success")) <NEW_LINE> self.assertItemsEqual( response_dict.get("cohorts"), [ {"name": cohort.name, "id": cohort.id, "user_count": cohort.user_count} for cohort in expected_cohorts ] )
Verify that the server response contains the expected_cohorts.
625941e68e7ae83300e4b421
def pet_animal(self) -> str: <NEW_LINE> <INDENT> return "Woof"
Returns response to petting.
625941e64f88993c3716c4b6
def mock_return_values(mocked_properties): <NEW_LINE> <INDENT> for mock in mocked_properties: <NEW_LINE> <INDENT> mock.return_value = mocked_properties[mock]
Set return values of given mocks to given value.
625941e626068e7796caf139
def _is_zero(self, *args, **kwargs): <NEW_LINE> <INDENT> pass
returns whether semaphore has value zero
625941e6377c676e912725fa
def clone(self, *args): <NEW_LINE> <INDENT> return _MEDCoupling.MEDCouplingFieldDouble_clone(self, *args)
clone(self, bool recDeepCpy) -> MEDCouplingFieldDouble 1
625941e63539df3088e2e79e
def map_zone(raw_zone) -> Optional[Zone]: <NEW_LINE> <INDENT> raw_zone_body = raw_zone.get("body") <NEW_LINE> if raw_zone_body: <NEW_LINE> <INDENT> raw_zone = raw_zone_body <NEW_LINE> <DEDENT> if raw_zone: <NEW_LINE> <INDENT> zone_id = raw_zone.get("_id") <NEW_LINE> configuration = raw_zone.get("configuration", {}) <NE...
Map *zones*.
625941e6bde94217f3683240
def get_status(self, torrent_id, fields): <NEW_LINE> <INDENT> status = {} <NEW_LINE> if len(fields) == 0: <NEW_LINE> <INDENT> fields = list(self.status_fields) <NEW_LINE> <DEDENT> for field in fields: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> status[field] = self.status_fields[field](torrent_id) <NEW_LINE> <DEDENT> ...
Return the value of status fields for the selected torrent_id.
625941e623849d37ff7b34de
def main(*argv, **kwargs): <NEW_LINE> <INDENT> args = parser.parse_args() <NEW_LINE> print(args.start_color) <NEW_LINE> for color in get_color_steps(args.start_color, args.end_color, args.steps): <NEW_LINE> <INDENT> print(color) <NEW_LINE> <DEDENT> print(args.end_color)
Entry-point for command-line invocation of the `color_steps` module.
625941e6a79ad161976cc599
def _input_fn(filenames, tf_transform_output, batch_size=200): <NEW_LINE> <INDENT> transformed_feature_spec = ( tf_transform_output.transformed_feature_spec().copy()) <NEW_LINE> dataset = tf.data.experimental.make_batched_features_dataset( filenames, batch_size, transformed_feature_spec, reader=_gzip_reader_fn) <NEW_LI...
Generates features and labels for training or evaluation. Args: filenames: [str] list of CSV files to read data from. tf_transform_output: A TFTransformOutput. batch_size: int First dimension size of the Tensors returned by input_fn Returns: A (features, indices) tuple where features is a dictionary of Te...
625941e60a366e3fb873ec71
def get_seq_from_URL(url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from StringIO import StringIO <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> from io import StringIO <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> from urllib.request import urlopen <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <IN...
takes a URL and gets the sequence
625941e6adb09d7d5db6cbe0
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(PassengersCounters, self).__init__( ('flags', Flags()), ('dpr', presence_flags.PresenceFlags(field_name='dpr')), ('drl', Byte()), ('maddr', UShort()), ('pcd', ArrayOfType(of_type=Pcd, maxlen=8)), *args, **kwargs )
Overriding constructor with fields :param args: additional args :param kwargs: parent class kwargs
625941e6a17c0f6771cbe4a2
def setFiniteBounds(self, lbDict={}, ubDict={}, strict=True, messages=[]): <NEW_LINE> <INDENT> for reaname in ubDict: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> index = self.reactionDict[reaname] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> msg = "Warning: UB set for non-existing reaction %s" % reaname <N...
set lower and upper bounds of fluxes through specific reactions Keyword arguments: lbDict -- dict {reaction name : value} for lower bounds ubDict -- dict {reaction name : value} for upper bounds strict -- if True, raise ValueError if both bounds are outside the range allowed by the reaction's direct...
625941e65fc7496912cc3dd1
def deleteDuplicates(self, head): <NEW_LINE> <INDENT> nh = ListNode(0) <NEW_LINE> nh.next = head <NEW_LINE> pre = nh <NEW_LINE> t = head <NEW_LINE> while t is not None: <NEW_LINE> <INDENT> val = t.val <NEW_LINE> if t.next is not None and t.next.val == val: <NEW_LINE> <INDENT> while t is not None and t.val == val: <NEW_...
:type head: ListNode :rtype: ListNode
625941e62eb69b55b151cd08
def _simPathWalkExpand(self): <NEW_LINE> <INDENT> for _, sd in self._stepsDiffs.items(): <NEW_LINE> <INDENT> yield sd
Return an iterable of the elements that should be part of ResultSelector paths.
625941e6cb5e8a47e48b7ef7
def test_nonlinear_ac(): <NEW_LINE> <INDENT> pycircuit.circuit.circuit.default_toolkit = numeric <NEW_LINE> cir=SubCircuit() <NEW_LINE> vvec=np.linspace(-2,2,100) <NEW_LINE> ivec=np.exp(vvec/10.) <NEW_LINE> nvec=ivec <NEW_LINE> cir['VB']=VS(1, gnd, v=1, vac=1) <NEW_LINE> cir['RL']=R(2, gnd, r=1e2) <NEW_LINE> cir['NVCCS...
Test that elements are linearised around DC operating point.
625941e663b5f9789fde7539
def parse_list(array_string): <NEW_LINE> <INDENT> if array_string is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return array_string.strip().lstrip('{').rstrip('}').split(',')
Turn "{Item1,Item2}" string into list
625941e6be8e80087fb2108f
def list_by_resource_group( self, resource_group_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "2020-05-...
Gets all service endpoint Policies in a resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceEndpointPolicyListResult or the...
625941e6c432627299f0509c
@_define_event <NEW_LINE> def shell_initialized(ip): <NEW_LINE> <INDENT> pass
Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`. This is before extensions and startup scripts are loaded, so it can only be set by subclassing. Parameters ---------- ip : :class:`~IPython.core.interactiveshell.InteractiveShell` The newly initialised shell.
625941e68c3a873295158813
def solve(A, B, solver_tag, precond_tag=tags.NoPreconditioner(), inplace=False): <NEW_LINE> <INDENT> if not isinstance(A, MagicMethods): <NEW_LINE> <INDENT> raise TypeError("A must be dense or sparse matrix type") <NEW_LINE> <DEDENT> elif not (issubclass(A.result_container_type, Matrix) or issubclass(A.result_container...
Solve the linear system expressed by ``A x = B`` for *x*. :param: A : (M, M) dense or sparse Matrix A square matrix :param: B : {Vector, Matrix} Right-hand side in ``A x = B`` :param: solver_tag : :class:`SolverTag` instance Describes the system matrix and solver algorithm. See the help for each tag cl...
625941e60a50d4780f6672e9
def _get_all_document_tag(self) -> list: <NEW_LINE> <INDENT> conn = sqlite3.connect(self.index_db) <NEW_LINE> cur = conn.cursor() <NEW_LINE> cur.execute('SELECT DOCUMENT_GUID, TAG_GUID FROM WIZ_DOCUMENT_TAG') <NEW_LINE> rows = cur.fetchall() <NEW_LINE> conn.close() <NEW_LINE> return rows
获取 WIZ_DOCUMENT_TAG 的所有记录
625941e6293b9510aa2c36e5
def add_child(self, child): <NEW_LINE> <INDENT> self.children.append(child)
Adds `child` to this IrNode's list of children.
625941e6e8904600ed9f2387
def del_ip(self, record): <NEW_LINE> <INDENT> sql = "delete from ips where ip='%s' and port='%s'" % (record['ip'], record['port']) <NEW_LINE> print(sql) <NEW_LINE> exec_sql(sql, **kwargs) <NEW_LINE> print(record, " was deleted.")
delete ip that can not use
625941e6462c4b4f79d1db23
def sum_values_above_threshold(value_string, threshold): <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> for i in value_string: <NEW_LINE> <INDENT> if int(i) > threshold: <NEW_LINE> <INDENT> sum += int(i) <NEW_LINE> <DEDENT> <DEDENT> return sum
(str, int) -> int Precondition: value_string.isdigit() returns True Return the sum of the individual digits in value_string that are greaterthan threshold. >>> sum_values_above_threshold('153382', 4) 13 >>> sum_values_above_threshold('12345', 5) 0
625941e64527f215b584c8a6
def __init__(self, name, url, info, gis, portaladmin, **kwargs): <NEW_LINE> <INDENT> self._info = info <NEW_LINE> super(Machine, self).__init__(url=url, gis=gis, name=name, info=info, portaladmin=portaladmin) <NEW_LINE> self._info = info <NEW_LINE> initialize = kwargs.pop('initialize', False) <NEW_LINE> self._name = na...
Constructor
625941e66fb2d068a760f4f8
def handle_endtag(self, tag): <NEW_LINE> <INDENT> if tag == 'a': <NEW_LINE> <INDENT> if self.linktarget: <NEW_LINE> <INDENT> if self.result[self.linkstart:] == self.linktarget: <NEW_LINE> <INDENT> self.result += ']' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.result += ']({})'.format(self.linktarget) <NEW_LINE> ...
Called when an end tag is encountered
625941e63539df3088e2e79f
def _reset_fields(self, template, profile_data): <NEW_LINE> <INDENT> fields_to_keep = ['profile', 'type', 'flags', 'format', 'pubstatus', 'language', 'usageterms', 'company_codes', 'keywords', 'target_regions', 'target_types', 'target_subscribers'] <NEW_LINE> data = deepcopy(template.get('data', {})) <NEW_LINE> schema ...
Removes fields from template which is disabled or doesn't exist in profile
625941e69c8ee82313fbbbca
def test_respons(client): <NEW_LINE> <INDENT> res = client.get('/') <NEW_LINE> assert res.status_code == 200
Test that the app is responding
625941e6287bf620b61d3eb4
def test_b_GLMB012(self): <NEW_LINE> <INDENT> self.driver.get('http://10.1.63.125:8080/gmp/admin#/smstemplate') <NEW_LINE> self.js = "window.scrollTo(0,200)" <NEW_LINE> self.driver.execute_script(self.js) <NEW_LINE> time.sleep(3) <NEW_LINE> self.searpage.click_time(self.searpage.next_page,1) <NEW_LINE> self.number = (B...
下一页可点击
625941e6d164cc61757831a3
def mocus(sg: SystemGraph, ignore_suppliers=False) -> FrozenSet[FrozenSet[str]]: <NEW_LINE> <INDENT> graph, logic = prep_for_mocus(sg, ignore_suppliers) <NEW_LINE> working_result = iterative_mocus("indicator", graph, logic) <NEW_LINE> working_result = minimize_cutsets([frozenset(cutset) for cutset in working_result]) <...
Inefficient implementation of MOCUS. Gates are added to connect suppliers and components and their dependencies. Minimal cutsets including these gates can safely be deleted since the probability of gate failure is zero. This function and the use of cutsets in general is deprecated in favor of BDD based functions.
625941e6dd821e528d63b5f9
def move(self, a_Move, logger=None): <NEW_LINE> <INDENT> frmCrd = a_Move.crd <NEW_LINE> frmSts = self.crdOD[frmCrd] <NEW_LINE> assert frmSts.fce , " Move ERROR: face is DOWN in Status{}".format(frmSts) <NEW_LINE> frmStk_nme = frmSts.stkNme <NEW_LINE> frmStk = self.stkOD[frmStk_nme] <NEW_LINE> frmSlice = frmStk[frmSt...
Move(Crd, stkNme). has a lot of logging for my debugging and monitoring.
625941e626238365f5f0f2c8
def save_and_update_user(self, user): <NEW_LINE> <INDENT> self.save() <NEW_LINE> user.last_game_on = tzware_datetime() <NEW_LINE> return user.save()
Commit the game and update the user's information. :return: SQLAlchemy save result
625941e630c21e258bdfa8f5
def test_admin_11(self): <NEW_LINE> <INDENT> r=self.obj.post(category(name='test-005',parentId=5,sort=1,row=11),row=11) <NEW_LINE> print(r.text)
类目保存
625941e6656771135c3ebcc7
def e_noroeste(arg): <NEW_LINE> <INDENT> return arg == 'NW'
e_noroeste: direcao --> logico e_noroeste(arg) tem o valor verdadeiro se arg for o elemento 'NW' e falso caso contrario.
625941e607f4c71912b118d8
def list_all_users_results_data(): <NEW_LINE> <INDENT> response = {} <NEW_LINE> user_results = UserTaskResults.query.order_by(UserTaskResults.user_id).all() <NEW_LINE> for user in user_results: <NEW_LINE> <INDENT> response[user.user_id] = {'user_id': user.user_id, 'task_id': user.task_id, 'results': user.results} <NEW...
returns a dict of all the user-results-data
625941e623e79379d52ee9b2
def fit(self, X, y=None): <NEW_LINE> <INDENT> self._fit(check_array(X)) <NEW_LINE> return self
Fit the model with X by extracting the first principal components. Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples in the number of samples and n_features is the number of features. Returns ------- self : object Returns the instance itself.
625941e6ad47b63b2c50a3d2
@pytest.fixture(autouse=True) <NEW_LINE> def home_directory(tmp_path, mocker): <NEW_LINE> <INDENT> directory = tmp_path / ".home" <NEW_LINE> directory.mkdir() <NEW_LINE> new_home = str(directory) <NEW_LINE> def expand_user(path): <NEW_LINE> <INDENT> return path.replace("~", new_home) <NEW_LINE> <DEDENT> mocker.patch("o...
Fixture to mock os.path.expanduser to return a different home directory.
625941e65510c4643540f82d
def _get_paginated_data(self, query_set, serializer): <NEW_LINE> <INDENT> page = self.paginate_queryset(query_set) <NEW_LINE> if page is not None: <NEW_LINE> <INDENT> serializer = serializer(page, many=True) <NEW_LINE> return self.get_paginated_response(serializer.data).data <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
进行分页操作
625941e6379a373c97cfaf9a
def get_connection(conf): <NEW_LINE> <INDENT> config = configparser.ConfigParser() <NEW_LINE> with open(conf, 'r') as configfile: <NEW_LINE> <INDENT> config.read_file(configfile) <NEW_LINE> connection = config['Database']['Connection_String'] <NEW_LINE> <DEDENT> return connection
Get connection string from .cfg file. :param conf: ODM2 Config File. Ex. 'odm2_config_timeseries.cfg' :return: Connection String
625941e67047854f462a1858
@task <NEW_LINE> def restartapache(): <NEW_LINE> <INDENT> sudo("/etc/init.d/apache2 reload", pty=True)
Restarts apache on both app servers.
625941e6d8ef3951e3243991
def buffer_to_string(self): <NEW_LINE> <INDENT> length = self.buffer_to_string_length() <NEW_LINE> return self.bytes_.read(2 * length).decode('utf-16-le')
Reads bytes with a string of the appropriate length and returns the string. Returns: str: a string
625941e66e29344779a62a64
def __init__(self, count=None, text=None, low=None, high=None, extension_elements=None, extension_attributes=None): <NEW_LINE> <INDENT> self.count = count <NEW_LINE> self.text = text <NEW_LINE> self.low = low <NEW_LINE> self.high = high <NEW_LINE> self.extension_elements = extension_elements or [] <NEW_LINE> self.exten...
Constructor for Bucket metadata element Args: count: str (optional) The number of times the value in text is given for the parent attribute. text: str (optional) The bucket's string representation. low: str (optional) The low end of the bucket. high: str (optional) The high end of the bucket. extension...
625941e6ad47b63b2c50a3d3
def test_putNotPaused(self): <NEW_LINE> <INDENT> self.producer.resumeProducing() <NEW_LINE> self.producer.put(None) <NEW_LINE> self.assertEqual(1, len(self.output))
When not paused has been called, all items are just queued.
625941e6d6c5a102081444a2
def TGUtil_GetPdf(*args): <NEW_LINE> <INDENT> return _snap.TGUtil_GetPdf(*args)
GetPdf(TIntPrV const & CdfV, TIntPrV & PdfV) Parameters: CdfV: TIntPrV const & PdfV: TIntPrV & GetPdf(TFltPrV const & CdfV, TFltPrV & PdfV) Parameters: CdfV: TFltPrV const & PdfV: TFltPrV & TGUtil_GetPdf(TIntFltKdV const & CdfV, TIntFltKdV & PdfV) Parameters: CdfV: TIntFltKdV const & PdfV: ...
625941e65166f23b2e1a55ad
def exec_(argv): <NEW_LINE> <INDENT> import atexit <NEW_LINE> atexit._run_exitfuncs() <NEW_LINE> from os import execv <NEW_LINE> execv(argv[0], argv)
Wrapper to os.execv which shows the command and runs any atexit handlers (for coverage's sake). Like os.execv, this function never returns.
625941e663b5f9789fde753a
def test_idw_rel_hum_from_set_to_grid(self): <NEW_LINE> <INDENT> idw_p = api.IDWParameter() <NEW_LINE> self.assertEqual(idw_p.max_distance, 200000) <NEW_LINE> self.assertEqual(idw_p.max_members, 10) <NEW_LINE> fx = lambda z: [15 for x in range(self.n)] <NEW_LINE> arome_grid = self._create_geo_rel_hum_grid(self.nx, self...
Test IDW interpolation transforms wind_speed time-series according to time-axis and range.
625941e630c21e258bdfa8f6
def H_a(self, a): <NEW_LINE> <INDENT> return self.H0 * np.sqrt(self.oml + self.omm * a**(-3) + self.omr * a**(-4))
returns the hubble factor at scale factor a=1/(1+z).
625941e61b99ca400220af07
def test_coin_apis_view(self): <NEW_LINE> <INDENT> target_url = url_for('admin.list_coin_apis') <NEW_LINE> redirect_url = url_for('auth.login', next=target_url) <NEW_LINE> response = self.client.get(target_url) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE> self.assertRedirects(response, redirect_url...
Test that coin_apis page is inaccessible without login and redirects to login page then to coin_apis page
625941e6d8ef3951e3243992
def process(pfn, lang): <NEW_LINE> <INDENT> train_rec = [] <NEW_LINE> with open(pfn) as cfile: <NEW_LINE> <INDENT> lines = cfile.readlines() <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> flag = classify(line.strip(), lang) <NEW_LINE> if flag.count(False) != len(flag) and flag.count(True) != len(flag): <NEW_LINE> <I...
Get training file from the text documents based on select features :param pfn: filename to read txt :param lang: txt language :return: records
625941e6851cf427c661a95f
def _record_daily_balance(self, balance, liability, receivable, datetime=None, bucket=None): <NEW_LINE> <INDENT> if self.is_null(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if datetime is None: <NEW_LINE> <INDENT> datetime = _datetime.datetime.now() <NEW_LINE> <DEDENT> balance = _create_decimal(balance) <NEW_LINE...
Record the starting balance for the day containing 'datetime' as 'balance' with the starting outstanding liabilities at 'liability' and starting outstanding accounts receivable at 'receivable' If 'datetime' is none, then the balance for today is set.
625941e64f88993c3716c4b7
def load_bert_embedding(file, embeddings, tags, tokens, mode='sum'): <NEW_LINE> <INDENT> index = 0 <NEW_LINE> with open(file, 'rb') as f: <NEW_LINE> <INDENT> out = pickle.load(f) <NEW_LINE> for tmp in out: <NEW_LINE> <INDENT> if (index + 1) % 1000 == 0: <NEW_LINE> <INDENT> print(f'load index: {index}') <NEW_LINE> <DEDE...
Load bert embedding form json file. :param file: bert embedding json file :param mode: 'average', 'sum, 'concat'... :return: dict of {linex: embedding}, shape=seqence_length*[768]
625941e62ae34c7f2600d585