code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def use_with(self, obj_or_driver): <NEW_LINE> <INDENT> if isinstance(obj_or_driver, BaseInterfaceObjectOfPage): <NEW_LINE> <INDENT> self.__driver = obj_or_driver.driver <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__driver = obj_or_driver | Reset driver from object with implemented
BaseInterfaceObjectOfPage.
Can be similarly WebDriver or WebElement instance. | 625941e732920d7e50b28646 |
def onMessageReceived(self, messageview): <NEW_LINE> <INDENT> raise NotImplementedError | Called for incoming and outgoing messages
message: a MessageView of the message | 625941e73eb6a72ae02ec95b |
def get_min_freq(self): <NEW_LINE> <INDENT> return _analog_swig.pll_freqdet_cf_get_min_freq(self) | get_min_freq(pll_freqdet_cf self) -> float | 625941e7d10714528d60015a |
def __init__(self, cqc, notify=True, block=True, createNew=True, q_id=None, entInfo=None): <NEW_LINE> <INDENT> self._cqc = cqc <NEW_LINE> self.notify = cqc.notify <NEW_LINE> if not self._cqc._opened_with_with: <NEW_LINE> <INDENT> logging.info( "You should open CQCConnection in a context, i.e. using 'with CQCConnection(... | Initializes the qubit. The cqc connection must be given.
If notify, the return message is received before the method finishes.
createNew is set to False when we receive a qubit.
- **Arguments**
:cqc: The CQCconnection used
:nofify: Do we wish to be notified when done.
:block: Do we wan... | 625941e7bf627c535bc13641 |
def translate_point_list(self): <NEW_LINE> <INDENT> translated = [ Point(p.x + self.draw_offset[0], p.y + self.draw_offset[1]) for p in self.point_list ] <NEW_LINE> return translated | Translate the point_list by the given draw_offset. | 625941e73c8af77a43ae3c18 |
def Add(self,newItem): <NEW_LINE> <INDENT> pass | Add(self: CompositeCollection,newItem: object) -> int
Adds the specified item to this collection.
newItem: New item to add to the collection.
Returns: Zero-based index where the new item is added. | 625941e7fbf16365ca6f6640 |
def __init__(self, id: str=None, secret: str=None, redirect_uri: str=None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': str, 'secret': str, 'redirect_uri': str } <NEW_LINE> self.attribute_map = { 'id': 'id', 'secret': 'secret', 'redirect_uri': 'redirect_uri' } <NEW_LINE> self._id = id <NEW_LINE> self._secret = sec... | DashboardClient - a model defined in Swagger
:param id: The id of this DashboardClient.
:type id: str
:param secret: The secret of this DashboardClient.
:type secret: str
:param redirect_uri: The redirect_uri of this DashboardClient.
:type redirect_uri: str | 625941e79b70327d1c4e1249 |
@app.route('/logout') <NEW_LINE> def logout(): <NEW_LINE> <INDENT> session.pop('logged_in', None) <NEW_LINE> session.pop('account', None) <NEW_LINE> session.pop('investment_account', None) <NEW_LINE> session.pop('permission_manager', None) <NEW_LINE> session.pop('permission_browse_commission_yn', None) <NEW_LINE> sessi... | 退出时删除会话中的相关全局变量 | 625941e75fdd1c0f98dc06a7 |
def at_jabies(self): <NEW_LINE> <INDENT> jaby_list = getenv("JABY_LIST").split(", ") <NEW_LINE> mention_list = [member for member in self.get_member_list() if member["name"] in jaby_list] <NEW_LINE> for mention in self.create_multi_mention(mention_list, bold_location=(12, 9)): <NEW_LINE> <INDENT> self.send_message(msg=... | Mention every upcoming JA. | 625941e701c39578d7e752ae |
def create_Toplevel1(root, *args, **kwargs): <NEW_LINE> <INDENT> global w, w_win, rt <NEW_LINE> rt = root <NEW_LINE> w = tk.Toplevel (root) <NEW_LINE> top = Toplevel1 (w) <NEW_LINE> transaction_support.init(w, top, *args, **kwargs) <NEW_LINE> return (w, top) | Starting point when module is imported by another program. | 625941e7283ffb24f3c55d6f |
def rates(barrier=None, nres=None, temp=298.): <NEW_LINE> <INDENT> beta = 1/(8.314e-3 * temp) <NEW_LINE> return 3.6e6/nres*np.exp(-beta*barrier) | Estimation of (un)folding rates in s^-1 from the free energy barrier
Parameters
----------
barrier : float
Free energy barrier in kJ/mol
nres : int
The number of amino acids
temp : float
The temperature of interest
| 625941e7507cdc57c6307157 |
def reverse(arr): <NEW_LINE> <INDENT> new_arr = arr.copy() <NEW_LINE> return new_arr[::-1] | this fuction takes an array copies it and reverse it | 625941e7e64d504609d74cb2 |
def py_ang(v1, v2): <NEW_LINE> <INDENT> cosang = np.dot(v1, v2) <NEW_LINE> sinang = lg.norm(np.cross(v1, v2)) <NEW_LINE> return np.arctan2(sinang, cosang) | Returns the angle in radians between vectors 'v1' and 'v2' | 625941e70fa83653e465742b |
def _query_db_for_one_record(self, query, args=()): <NEW_LINE> <INDENT> rv = self._query_db(query, args) <NEW_LINE> if len(rv) != 1: <NEW_LINE> <INDENT> raise IndexError("Expected exactly one row; %s rows returned" % len(rv)) <NEW_LINE> <DEDENT> return rv[0] | Call _query_db and return exactly one record as a dict.
If there isn't exactly one record, raise an IndexError. | 625941e7be383301e01b58ef |
def encode(self): <NEW_LINE> <INDENT> if self.mode == tables.modes['alphanumeric']: <NEW_LINE> <INDENT> encoded = self.encode_alphanumeric() <NEW_LINE> <DEDENT> elif self.mode == tables.modes['numeric']: <NEW_LINE> <INDENT> encoded = self.encode_numeric() <NEW_LINE> <DEDENT> elif self.mode == tables.modes['binary']: <N... | This method encodes the data into a binary string using
the appropriate algorithm specified by the mode. | 625941e7c4546d3d9de72eaa |
def run_analysis(): <NEW_LINE> <INDENT> o64 = max_outcomes_for_face(dice=6, rolls=4, sims=10000000) <NEW_LINE> p64 = summarise_percentages(o64) <NEW_LINE> l64 = percentage_labels(p64) <NEW_LINE> save_heatmap( p64, l64, 'tokyo-heatmap-64', '6 dice, 4 rolls', cmap='YlGnBu', vmin=0.0, vmax=0.4,width=12, height=16.2) <NEW_... | Do the analysis.
By default this is set up to run ten million simulations for each of two
scenarios and it takes around ten minutes to run. Reduce the number of
simulations to generate output more quickly, but with less precision. | 625941e7596a897236089f2d |
def _join_act_thread(self): <NEW_LINE> <INDENT> if self.act_threading: <NEW_LINE> <INDENT> self._at_thread.join() | This is called at the beginning of every user-side API functions (step(), reset()...) for thread safety
In the RTRL setting with action threading, this ensures that the previous time-step is completed when starting a new one | 625941e7099cdd3c635f10cb |
def get_stripe_patch(jitter=False): <NEW_LINE> <INDENT> _, O = .1, .8 <NEW_LINE> patch = np.array([ [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _], [O, O, O, _, _, _, _]]) <NEW_LINE> i... | test data patch | 625941e75fdd1c0f98dc06a8 |
def testInconsistentLabelSizeRaisesException(self): <NEW_LINE> <INDENT> with self.test_session(): <NEW_LINE> <INDENT> logits = constant_op.constant([[100.0, -100.0, -100.0], [-100.0, 100.0, -100.0], [-100.0, -100.0, 100.0]]) <NEW_LINE> labels = constant_op.constant([[0], [1], [2], [3]]) <NEW_LINE> weights = constant_op... | The label tensor has incorrect number of elements. | 625941e744b2445a33932505 |
def test_cache_explicit_expiration(self): <NEW_LINE> <INDENT> self._init( datetime(2019, 5, 21, 21, 8, 11), timedelta(minutes=1), 'before explicit expiration') <NEW_LINE> result = self.cached_function(1, 'a,', None, True) <NEW_LINE> self.assertEqual(len(self.function_mock.mock_calls), 1) <NEW_LINE> self.assertEqual(res... | Test the cache method for explicit expiration
1. Call 1
2. Call 1 again not expired after explicit expiration | 625941e78c0ade5d55d3ee31 |
def get_startTime(self): <NEW_LINE> <INDENT> values = self._attributes[VOPROV_ATTR_STARTTIME] <NEW_LINE> return first(values) if values else None | Returns the time the activity started.
:return: :py:class:`datetime.datetime` | 625941e7cc0a2c11143dd304 |
def get_headers(self, key): <NEW_LINE> <INDENT> return self.headers.get(key) | Get a specific header line | 625941e7bd1bec0571d90aa1 |
def hamming_circle( sequence: str, n: int, alphabet: Optional[str] = None ) -> Generator[str, None, None]: <NEW_LINE> <INDENT> if not isinstance(sequence, str): <NEW_LINE> <INDENT> raise TypeError('`sequence` must be of type `str`.') <NEW_LINE> <DEDENT> if alphabet is None: <NEW_LINE> <INDENT> alphabet = ''.join(sorted... | Find strings, of a given character alphabet, with a distance of `n` away from a sequence.
Args:
sequence: A sequence of characters.
n: The Hamming distance all returned items should be to *sequence*.
alphabet: The alphabet to use when mutating *sequence*, optional.
Yields:
The next sequence found with... | 625941e7566aa707497f49d5 |
@numba.jit(nopython=True, nogil=True, cache=True) <NEW_LINE> def _find_minimum_times(time_1, time_2, out_min_times, out_best_indices): <NEW_LINE> <INDENT> n, m = time_1.shape <NEW_LINE> m, p = time_2.shape <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> for j in range(p): <NEW_LINE> <INDENT> for k in range(m): <NEW_L... | Parameters
----------
time_1
time_2
out_min_time
out_best_indices
Returns
------- | 625941e7cad5886f8bd2744b |
def _create_more_application(): <NEW_LINE> <INDENT> from prompt_toolkit.shortcuts import create_prompt_application <NEW_LINE> registry = Registry() <NEW_LINE> @registry.add_binding(' ') <NEW_LINE> @registry.add_binding('y') <NEW_LINE> @registry.add_binding('Y') <NEW_LINE> @registry.add_binding(Keys.ControlJ) <NEW_LINE>... | Create an `Application` instance that displays the "--MORE--". | 625941e7498bea3a759b9f20 |
def test_01_Tags(self): <NEW_LINE> <INDENT> pass | Be sure that the XML contains the right stuff.
| 625941e797e22403b379d40e |
def prepare_data(tags=False, gridsearch=False): <NEW_LINE> <INDENT> if not tags: <NEW_LINE> <INDENT> neg_reviews = load_data_from_file('neg') <NEW_LINE> pos_reviews = load_data_from_file('pos') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> neg_reviews = load_data_tag_from_file('neg') <NEW_LINE> pos_reviews = load_data_... | prepare the data without partition
(read all neg and pos reviews) | 625941e7e5267d203edce10a |
@pytest.mark.parametrize('attr, args, expected', [('days', [], 7), ('nanoseconds', [], 0), ('seconds', [], 0), ('total_seconds', [], 604800.), ]) <NEW_LINE> def test_td_namespace(attr, args, expected): <NEW_LINE> <INDENT> df = DataFrame({'span': [timedelta(7)]}) <NEW_LINE> t = symbol('t', 'var * {span: timedelta}') <NE... | timedelta functions | 625941e7b5575c28eb68e477 |
def _send_immediate_response(self, success, message=""): <NEW_LINE> <INDENT> response_str = json.dumps( {'return_code': 0 if success else 1, 'content': message} ) <NEW_LINE> if self._is_grade_request(): <NEW_LINE> <INDENT> self.send_response( 200, content=response_str, headers={'Content-type': 'text/plain'} ) <NEW_LINE... | Send an immediate success/failure message
back to the client | 625941e715baa723493c43eb |
def finalize_response(self, request, response, *args, **kwargs): <NEW_LINE> <INDENT> response = super(CondomDistributionViewSet, self).finalize_response( request, response, *args, **kwargs) <NEW_LINE> if response.accepted_renderer.format == 'csv': <NEW_LINE> <INDENT> filename = request.query_params.get('filename') ... | Setup filename for CSV response. | 625941e71f037a2d8b946670 |
def SetRefitWeight(self, *args): <NEW_LINE> <INDENT> return _itkSparseFieldFourthOrderLevelSetImageFilterPython.itkLevelSetFunctionWithRefitTermID3SINBNID33_SetRefitWeight(self, *args) | SetRefitWeight(self, double w) | 625941e731939e2706e4d2d6 |
def type_names_for_params(params): <NEW_LINE> <INDENT> param_count = java.GetArrayLength(params) <NEW_LINE> sig = [] <NEW_LINE> for p in range(0, param_count): <NEW_LINE> <INDENT> java_type = java.GetObjectArrayElement(params, p) <NEW_LINE> if java_type.value is None: <NEW_LINE> <INDENT> raise RuntimeError('Unable to r... | Return the Java type descriptors list matching an array of Java parameters.
This is used when registering interfaces. The params list is converted into a
tuple, where each element is the JNI type of the parameter. | 625941e7bf627c535bc13642 |
def __init__(self, hosts, tmp): <NEW_LINE> <INDENT> super().__init__("/run/dcp/*", "dcp", hosts, tmp) <NEW_LINE> self.blocksize = FormattedParameter("--blocksize {}") <NEW_LINE> self.bufsize = FormattedParameter("--bufsize {}") <NEW_LINE> self.chunksize = FormattedParameter("--chunksize {}") <NEW_LINE> self.daos_prefix... | Create a dcp Command object. | 625941e78e71fb1e9831dc1a |
def edit_task(self, args): <NEW_LINE> <INDENT> task_id = args["object_id"] <NEW_LINE> options = args["options"] <NEW_LINE> changed_repeats_type, new_repeats = self.task_log.edit_task(task_id, options) <NEW_LINE> if changed_repeats_type: <NEW_LINE> <INDENT> self.recurrence_manager.update_edited_task(task_id, new_repeats... | Modify a task's information. | 625941e7cb5e8a47e48b7f16 |
def _get_latest_geckodriver_version() -> str: <NEW_LINE> <INDENT> url = urllib.request.urlopen("https://github.com/mozilla/geckodriver/releases/latest").geturl() <NEW_LINE> if "/tag/" not in url: <NEW_LINE> <INDENT> raise GeckodriverVersionNotFoundError <NEW_LINE> <DEDENT> return url.split('/')[-1] | :return: the latest version of geckodriver | 625941e72eb69b55b151cd28 |
@cli.command() <NEW_LINE> @click.option('--pretty', is_flag=True, help="DEPRECATED") <NEW_LINE> @click.option('--config', metavar="CONFIG", required=False, help="The config to run the module with") <NEW_LINE> @click.option('--secrets', required=False, help="The secrets to run the module with") <NEW_LINE> @click.option(... | Run an nFlex module locally.
The command will try to find a "main.py" file in the current working
directory and execute the HANDLER, passing EVENT as a parameter and
attaching the CONFIG to the context parameter of the HANDLER.
EVENT and CONFIG must be valid JSON dictionaries
HANDLER must be the handler name, i.e. "g... | 625941e7091ae356686673c9 |
def measure_of_dispersion(type_, df, col): <NEW_LINE> <INDENT> disp=df[col].apply(type_) <NEW_LINE> print(disp) | Calculate the measure of dispersion.
This function accepts the measure of dispersion to be calculated, the data frame and the required column(s).
It returns the calculated measure.
Keyword arguments:
type_ -- type of central tendency to be calculated
df -- the dataframe
col -- the column(s) in the dataframe to do the... | 625941e7462c4b4f79d1db42 |
def mouseDoubleClickEvent(self, event): <NEW_LINE> <INDENT> if self.callback is not None: <NEW_LINE> <INDENT> self.callback().addRelation(self) | Override Qt
Add a relation or save start relation point when double clicking | 625941e7adb09d7d5db6cc00 |
def test_string(self): <NEW_LINE> <INDENT> self.assertEquals(chrono.calendar.Calendar.monthdays("2009", "1"), 31) | Calendar.monthdays() accepts string input | 625941e7ff9c53063f47c664 |
def execute(self, oTstDrv, oVmSession, oTxsSession, oTestVm, sMsgPrefix): <NEW_LINE> <INDENT> assert self.enmUser is None; <NEW_LINE> self.oCreds = tdCtxCreds(oTestVm = oTestVm); <NEW_LINE> self.setEnvironment(oVmSession, oTxsSession, oTestVm); <NEW_LINE> reporter.log2('%s: %s steps' % (sMsgPrefix, len(self.aoSteps),))... | Executes the test. | 625941e74f6381625f114eae |
def many_to_many_relationship(current_class, other_class, table_prefix=None, primary_key_tuple=False, ondelete=None, unique=False, **relationship_kwargs): <NEW_LINE> <INDENT> current_table_name = current_class.__tablename__ <NEW_LINE> current_column_name = '{0}_id'.format(current_table_name[:-1]) <NEW_LINE> current_for... | Return a many-to-many SQL relationship object
Notes:
1. The backreference name is the current table's table name
2. This method creates a new helper table in the DB
:param current_class: The class of the table we're connecting from
:param other_class: The class of the table we're connecting to
:param table_prefix: Cu... | 625941e74f6381625f114eaf |
def matrixToFacesMesh(self,name,matrices,vector=[0.,1.,0.],transpose=True,**kw): <NEW_LINE> <INDENT> pass | convert liste of matrix (rotation/position) to quad mesh in order to use cloner / dupliFace | 625941e7925a0f43d254a2ee |
def tojson(self, csvFile): <NEW_LINE> <INDENT> if not self.file_exists(csvFile): <NEW_LINE> <INDENT> raise FileNotFoundError(csvFile) <NEW_LINE> <DEDENT> jsonFile = csvFile.replace('.csv', '.json') <NEW_LINE> d = {} <NEW_LINE> jsonDict = {} <NEW_LINE> splitUrlsArray = [] <NEW_LINE> with open(csvFile, 'r') as csv: <NEW_... | Just going to produce a nested dict of 'domain', 'sites' and 'leafs'
'domain' is the main website: http://abc.agency.gov
'sites' are the first path after the domain
'leafs' are objects that contain the full url (minus protocol) and last modified timestamp
example:
"www.epa.gov": {
"aboutepa": [
{
... | 625941e773bcbd0ca4b2c4e8 |
def test_get_records(app, db): <NEW_LINE> <INDENT> test_records = [ Record.create({'title': 'test1'}), Record.create({'title': 'to_be_deleted'}), Record.create({'title': 'test3'}), ] <NEW_LINE> db.session.commit() <NEW_LINE> test_ids = [record.id for record in test_records] <NEW_LINE> assert len(Record.get_records(test... | Test bulk record fetching. | 625941e716aa5153ce3628eb |
def get_next_fire_time(self, previous_fire_time, now): <NEW_LINE> <INDENT> if not previous_fire_time: <NEW_LINE> <INDENT> previous_fire_time = now <NEW_LINE> <DEDENT> delta = datetime.timedelta(seconds=self._timelapse_config.frequency) <NEW_LINE> next_time = previous_fire_time + delta <NEW_LINE> if not self._timelapse_... | Returns the next datetime to fire on, If no such datetime can be calculated, returns None. | 625941e7d164cc61757831c2 |
def update(self, sample_sid=values.unset, status=values.unset): <NEW_LINE> <INDENT> return self._proxy.update(sample_sid=sample_sid, status=status, ) | Update the QueryInstance
:param unicode sample_sid: The SID of an optional reference to the Sample created from the query
:param unicode status: The new status of the resource
:returns: The updated QueryInstance
:rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance | 625941e750485f2cf553d20e |
def parseXHRClientRequest(requestMETA): <NEW_LINE> <INDENT> encoded_json_s = requestMETA.get("HTTP_X_CLIENT_REQUEST") <NEW_LINE> json_s = unquote(encoded_json_s) <NEW_LINE> d = json.loads(json_s) <NEW_LINE> browTabName = d.get('browTabName') <NEW_LINE> model = d.get('model') <NEW_LINE> if not browTabName: <NEW_LI... | Розбираємо xhr запит від клієнта
:param requestMETA: request.META
:return: d - словник з даними про материнську теку і інш.
Формат запиту від клієнта:
encoded_json_string знаходиться у заголовку "X-client-request"
Кожна ф-ція xhr ajax...view витягне з словника d необхідні дані | 625941e755399d3f05588b2a |
def get_first_and_last_symbols(self, string): <NEW_LINE> <INDENT> array = list(string) <NEW_LINE> first_and_last_symbols = 'Первый символ: ' + array[0] + '\n' + 'Последний символ: ' + array[len(array) - 1] <NEW_LINE> return first_and_last_symbols | Создать массив символов из строки. Размер массива должен автоматически рассчитываться.
Вывести первый и последний элементы массива. | 625941e7e76e3b2f99f3ac77 |
def investigate_md5(md5): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> response = vt.get_file_report(md5) <NEW_LINE> if response['response_code']==200: <NEW_LINE> <INDENT> timestamp_desc = "VT_md5info" <NEW_LINE> datetime_new = convert_date_to_datetime(response['results']['scan_date']) <NEW_LINE> timestamp = convert_da... | :param md5: | 625941e7460517430c3945ec |
def max_overlaps(classes): <NEW_LINE> <INDENT> number_classes = len(classes) <NEW_LINE> number_vetors_per_class = len(classes[0]) <NEW_LINE> number_elements_per_vector = len(classes[0][0]) <NEW_LINE> return number_classes * (number_classes - 1) * number_vetors_per_class * number_elements_per_vector | Encontra o número máximo de sobreposições (F) que uma classe pode ter. F = N * (N - 1) * X * T
:param classes: Classes de dados normalizadas.
:return: Quantidade máxima de sobreposições possíveis de todas as classes. | 625941e7f9cc0f698b140a6a |
def delete(self, **details): <NEW_LINE> <INDENT> model_choice = details['Model'] <NEW_LINE> model = self.tables[model_choice] <NEW_LINE> col = details['column'] <NEW_LINE> val = details['value'] <NEW_LINE> print('Details: ' + str(col) + ' = ' + str(val)) <NEW_LINE> q = model.query.filter( getattr(model, col) == val).de... | Deletes can only be performed using unique entries in the DB
- Files can only be filtered on its 'path' & 'title' attributes
- Users can only be filtered on its 'mac_id' attribute
- Returns Boolean Value
The program has access to the path & title variables which can
uniquely identify rows in the Files Table. It... | 625941e760cbc95b062c69b7 |
def test_that_themes_loads_themes_landing_page(self, testsetup): <NEW_LINE> <INDENT> amo_home_page = AddonsHomePage(testsetup) <NEW_LINE> amo_themes_page = amo_home_page.click_themes() <NEW_LINE> url_current_page = amo_themes_page.get_url_current_page() <NEW_LINE> Assert.true(url_current_page.endswith("/themes/")) | test for litmus 15339 | 625941e7cb5e8a47e48b7f17 |
def get_section(file_name, section): <NEW_LINE> <INDENT> inifile = _Ini.get_ini_file(file_name) <NEW_LINE> if inifile: <NEW_LINE> <INDENT> sect = inifile.get_section(section) <NEW_LINE> if sect: <NEW_LINE> <INDENT> return sect.contents() <NEW_LINE> <DEDENT> <DEDENT> return {} | Retrieve a section from an ini file. Returns the section as dictionary. If
the section is not found, an empty dictionary is returned.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
sc.cmd('target', 'ini.get_section',
[path_to_ini_file, section_name])
CLI E... | 625941e7293b9510aa2c3704 |
def _run(self): <NEW_LINE> <INDENT> self._login() <NEW_LINE> self.sleep_time(self.load_time) <NEW_LINE> self._delete_inbox() <NEW_LINE> self._delete_sent() <NEW_LINE> self._delete_deleted() | 执行删除的业务逻辑
1. 登录
2. 删除收件箱中的邮件
3. 删除已发送中的邮件
4. 删除已删除中的邮件 | 625941e76fb2d068a760f518 |
def get(self, group_name, use_cache=True): <NEW_LINE> <INDENT> if not self.async_request: <NEW_LINE> <INDENT> if use_cache: <NEW_LINE> <INDENT> group = self._cache.get(group_name) <NEW_LINE> if group: <NEW_LINE> <INDENT> return group <NEW_LINE> <DEDENT> <DEDENT> tags = self.tag_factory.get_tags_by_group(group_name) <NE... | Args:
group_name (str): The name of the group to pull
Returns:
TagGroup: an instance of TagGroup for the given TagGroup name
Raises:
SampleAbsent: Raises a key error when the tag does not exist
ClientError: In the case that the client did something unexpected
ServerError: In the case that the clie... | 625941e792d797404e3045ff |
def create_sitemap(app, exception): <NEW_LINE> <INDENT> root = ET.Element('urlset') <NEW_LINE> root.set('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9') <NEW_LINE> for link in sorted(app.sitemap_links): <NEW_LINE> <INDENT> url = ET.SubElement(root, "url") <NEW_LINE> ET.SubElement(url, "loc").text = '/' + link <N... | Generates the sitemap.xml from the collected HTML page links | 625941e729b78933be1e5b1a |
def center(data, desired): <NEW_LINE> <INDENT> return (data - data.mean()) + desired | Return a new array containing the original data centered around the desired value. | 625941e7b7558d58953c537e |
def test___repr__(self): <NEW_LINE> <INDENT> svs = services.Service(None, FAKE_SERVICE) <NEW_LINE> self.assertEqual( "<Service: binary=%s host=%s>" % (FAKE_SERVICE['binary'], FAKE_SERVICE['host']), repr(svs)) | Unit test for Service.__repr__
Verify that one Service object can be printed. | 625941e791af0d3eaac9be90 |
def process_message(self, msg): <NEW_LINE> <INDENT> emote_dict = self.__count_emotes(msg) <NEW_LINE> if len(emote_dict) >= 1: <NEW_LINE> <INDENT> self.__update_total_count(emote_dict) <NEW_LINE> self.add_entry(emote_dict) | Process an incoming chatmessage. | 625941e7956e5f7376d712df |
def test_trigonal_angle(self): <NEW_LINE> <INDENT> atoms = TrackedList() <NEW_LINE> atoms.extend([Atom(list=atoms) for x in range(8)]) <NEW_LINE> bonds = [] <NEW_LINE> bonds.append(Bond(atoms[0], atoms[1])) <NEW_LINE> bonds.append(Bond(atoms[2], atoms[1])) <NEW_LINE> bonds.append(Bond(atoms[3], atoms[1])) <NEW_LINE> bo... | Tests the trigonal angle term used in the AMOEBA force field | 625941e7d164cc61757831c3 |
def __init__(self): <NEW_LINE> <INDENT> self.TotalCount = None <NEW_LINE> self.Items = None <NEW_LINE> self.RequestId = None | :param TotalCount: 实例切换记录的总数。
:type TotalCount: int
:param Items: 实例切换记录详情。
:type Items: list of DBSwitchInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | 625941e7f9cc0f698b140a6b |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, CheckboxFieldConfigJson): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941e756b00c62f0f14acf |
def adjust_par(): <NEW_LINE> <INDENT> par = [ { 'weights': ['uniform'], 'n_neighbors': [i for i in range(1, 10)] }, { 'weights': ['distance'], 'n_neighbors': [i for i in range(1, 10)], 'p': [i for i in range(1, 6)] } ] <NEW_LINE> iris = datasets.load_iris() <NEW_LINE> X = iris.data <NEW_LINE> y = iris.target <NEW_LINE>... | 这里我先构建自己的网格搜索:
1.不考虑weights,即uniform,这时我需要考虑参数n_neighbors(1,10);
2.考虑weights,即distance,这时我们不仅要考虑n_neighbors(1,10),
加上了距离权重,就要考虑使用什么距离,即闵可夫斯基距离中p等于多少时分类器最优(1,10) | 625941e723849d37ff7b34ff |
def continuous_mountain_car_arg_parser(): <NEW_LINE> <INDENT> parser = arg_parser() <NEW_LINE> parser.add_argument('--env', help='environment ID', type=str, default='MountainCarContinuous-v0') <NEW_LINE> parser.add_argument('--seed', help='RNG seed', type=int, default=0) <NEW_LINE> parser.add_argument('--num-timesteps'... | Create an argparse.ArgumentParser for run_mujoco.py. | 625941e730c21e258bdfa915 |
def rand10(self): <NEW_LINE> <INDENT> res = 40 <NEW_LINE> while res >= 40: <NEW_LINE> <INDENT> res = 7 * (rand7() - 1) + (rand7() - 1) <NEW_LINE> <DEDENT> return res % 10 + 1 | :rtype: int | 625941e707f4c71912b118f8 |
def create_voting_dict(): <NEW_LINE> <INDENT> dictt = dict() <NEW_LINE> for i in voting_data: <NEW_LINE> <INDENT> key = i.split()[0] <NEW_LINE> dictt.update({key:[int(x) for x in i.split()[3:]]}) <NEW_LINE> <DEDENT> return dictt | Input: None (use voting_data above)
Output: A dictionary that maps the last name of a senator
to a list of numbers representing the senator's voting
record.
Example:
>>> create_voting_dict()['Clinton']
[-1, 1, 1, 1, 0, 0, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, ... | 625941e7462c4b4f79d1db43 |
def e_eq_water_mk(T): <NEW_LINE> <INDENT> if np.any(T <= 0): <NEW_LINE> <INDENT> raise Exception('Temperatures must be larger than 0 Kelvin.') <NEW_LINE> <DEDENT> e = (54.842763 - 6763.22 / T - 4.21 * np.log(T) + 0.000367 * T + np.tanh(0.0415 * (T - 218.8)) * (53.878 - 1331.22 / T - 9.44523 * np.log(T) + 0.014025 * T))... | Calculate the equilibrium water vapor pressure over water.
Equilibrium water vapor pressure over water using Murphy and
Koop 2005 parameterization formula.
.. math::
\ln(e_w) &= 54.842763 - \frac{6763.22}{T} - 4.21 \cdot \ln(T) \\
&+ 0.000367 \cdot T
+ \tanh \left(0.0415 \cdot (T -... | 625941e7baa26c4b54cb158f |
def iSarAddPerpEdge(edg_name): <NEW_LINE> <INDENT> pln = bpy.data.objects[edg_name] <NEW_LINE> mat_pln = pln.matrix_world <NEW_LINE> axis_dst = (mat_src[0][2], mat_src[1][2], mat_src[2][2]) <NEW_LINE> val_dst = math.radians(90) <NEW_LINE> bpy.data.objects[edg_name].select = True <NEW_LINE> mesh = bpy.data.meshes.new('R... | Get perpendicular edge | 625941e78e05c05ec3eea7ec |
def getInputStream(self): <NEW_LINE> <INDENT> return self | Returns this instance, which has a send method.
| 625941e73539df3088e2e7bf |
def pop(self): <NEW_LINE> <INDENT> return self.stack.pop() if self.stack else -1 | :rtype: int | 625941e7b57a9660fec33cfe |
def test_product_installed(self): <NEW_LINE> <INDENT> self.assertTrue(self.installer.isProductInstalled("collective.iamisearch")) | Test if collective.iamisearch is installed. | 625941e796565a6dacc8fb3d |
def daily_proc(self, timestamp, base): <NEW_LINE> <INDENT> return False | :type timestamp: datetime
:type base: dict
:return: True if user data updated | 625941e710dbd63aa1bd3015 |
def get_tightbbox(self, renderer): <NEW_LINE> <INDENT> if not self.get_visible(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> ticks_to_draw = self._update_ticks(renderer) <NEW_LINE> self._update_label_position(renderer) <NEW_LINE> ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes( ticks_to_draw, renderer) <NEW... | Return a bounding box that encloses the axis. It only accounts
tick labels, axis label, and offsetText. | 625941e74527f215b584c8c6 |
def send_control(self, *args, **kwargs): <NEW_LINE> <INDENT> if isinstance(args[0] if args else None, carla_protocol.Control): <NEW_LINE> <INDENT> pb_message = args[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pb_message = carla_protocol.Control() <NEW_LINE> pb_message.steer = kwargs.get('steer', 0.0) <NEW_LINE> pb... | Send vehicle control for the current frame. | 625941e77047854f462a1878 |
def _validate_subset(self, subset): <NEW_LINE> <INDENT> subset = self._validate_set(subset) <NEW_LINE> assert subset.issubset(self.states), 'Marked and forbidden states must be subsets of all states!' <NEW_LINE> return subset | Validates the set and checks whether the states in the subset are part of the state set. | 625941e7ff9c53063f47c665 |
def ffc_resnext50_32x4d(pretrained=False, **kwargs): <NEW_LINE> <INDENT> kwargs['groups'] = 32 <NEW_LINE> kwargs['width_per_group'] = 4 <NEW_LINE> model = FFCResNet(Bottleneck, [3, 4, 6, 3], **kwargs) <NEW_LINE> return model | ResNeXt-50 32x4d model from
`"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr | 625941e76e29344779a62a84 |
def eligible_for_update(self,record, rr): <NEW_LINE> <INDENT> log.info(record) <NEW_LINE> if str(record.ttl) == str(rr.ttl) and str(record.data["rrdatas"][0]) == str(rr.ip): <NEW_LINE> <INDENT> log.info("Not Eligible For Update") <NEW_LINE> return False <NEW_LINE> <DEDENT> log.info("Eligible For Update") <NEW_LINE> ret... | Checks if record matches the Request Record
(Args):
GoogleDNSDriver:Record()
RequestRecord() | 625941e7d53ae8145f87a6db |
def agent_can_global(self, ability): <NEW_LINE> <INDENT> return ability in self.global_abilities() | Return True if agent has the global ability. | 625941e7c432627299f050bd |
def ZerosLikeOutsideLoop(op, index): <NEW_LINE> <INDENT> val = op.outputs[index] <NEW_LINE> if not IsSwitch(op): <NEW_LINE> <INDENT> return array_ops.zeros_like(val, optimize=False) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> op_ctxt = op._get_control_flow_context() <NEW_LINE> if op_ctxt: <NEW_LINE> <INDENT> pred = o... | Create zeros_like for the specified output of an op. | 625941e710dbd63aa1bd3016 |
def test_delete_process_type_protected(self): <NEW_LINE> <INDENT> result = self.runner.invoke(main, 'delete -t "process type" -n "extract"') <NEW_LINE> expected_result = ( "The item could not be deleted because it is a protected record." ) <NEW_LINE> self.assertIn(expected_result, result.output) <NEW_LINE> self.assertE... | Testing that when deleting a protected process type record it is not deleted.
:return: | 625941e7566aa707497f49d6 |
def process_iterator(self, pid, node_name=None): <NEW_LINE> <INDENT> process = self.get_process(pid, node_name) <NEW_LINE> yield from self._iterate_childs(process, slurm_step_id=process.get('slurm_step_id')) | Generator which iterates on process and it's childs.
Args:
pid (str,int) - process identifier from which start iteration
node_name (str) - optional node name where to look for process
Returns:
dict, int: a pair with process data and level of nesting in tree | 625941e785dfad0860c3b2cf |
def test_arg0_in_operator(self): <NEW_LINE> <INDENT> block = self._compile('read: arg0 in 0x3') <NEW_LINE> self.assertEqual( block.simulate(self.arch.arch_nr, self.arch.syscalls['read'], 0)[1], 'ALLOW') <NEW_LINE> self.assertEqual( block.simulate(self.arch.arch_nr, self.arch.syscalls['read'], 1)[1], 'ALLOW') <NEW_LINE>... | Accept lines with an argument filter with in. | 625941e7e1aae11d1e74a12f |
def remove_colinear_vertices(self, tolerance=0.01): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._geometry = self.geometry.remove_colinear_vertices(tolerance) <NEW_LINE> <DEDENT> except AssertionError as e: <NEW_LINE> <INDENT> raise ValueError( 'Shade "{}" is invalid with dimensions less than the ' 'tolerance.\n{}... | Remove all colinear and duplicate vertices from this object's geometry.
Args:
tolerance: The minimum distance between a vertex and the boundary segments
at which point the vertex is considered colinear. Default: 0.01,
suitable for objects in meters. | 625941e73c8af77a43ae3c19 |
def serialize(self): <NEW_LINE> <INDENT> result = { 'entry_type': self.entry_type, } <NEW_LINE> if self.new_commit: <NEW_LINE> <INDENT> result['new_commit_id'] = self.new_commit.pk <NEW_LINE> <DEDENT> if self.old_commit: <NEW_LINE> <INDENT> result['old_commit_id'] = self.old_commit.pk <NEW_LINE> <DEDENT> return result | Serialize the entry to a dictionary.
Returns:
dict:
A dictionary of the serialized information. | 625941e756ac1b37e626463a |
def find_strategy(initial_sigmas, k): <NEW_LINE> <INDENT> m = len(initial_sigmas) <NEW_LINE> target = np.max(initial_sigmas) <NEW_LINE> if target == 0: <NEW_LINE> <INDENT> target = 1 <NEW_LINE> <DEDENT> x_i_C2val = lp_solve(m, k, initial_sigmas, target) <NEW_LINE> last_target = target <NEW_LINE> while x_i_C2val == 'dua... | Args:
initial_sigmas:
k:
Returns: | 625941e785dfad0860c3b2d0 |
def greedy_cow_transport(cows, limit=10): <NEW_LINE> <INDENT> herdl = sorted(cows.items(), key=lambda x: x[1], reverse=True) <NEW_LINE> all_trips = [] <NEW_LINE> trip = [] <NEW_LINE> used = [] <NEW_LINE> trip_wt = 0 <NEW_LINE> while len(used) < len(herdl): <NEW_LINE> <INDENT> for cow in herdl: <NEW_LINE> <INDENT> if co... | Uses a greedy heuristic to determine an allocation of cows that attempts to
minimize the number of spaceship trips needed to transport all the cows.
The returned allocation of cows may or may not be optimal.
The greedy heuristic should follow the following method:
1. As long as the current trip can fit another cow, ad... | 625941e77d847024c06be733 |
def unpack_raw_datum(raw_datum, dtype=None): <NEW_LINE> <INDENT> dat = caffe.proto.caffe_pb2.Datum() <NEW_LINE> dat.ParseFromString(raw_datum) <NEW_LINE> channels = dat.channels <NEW_LINE> height = dat.height <NEW_LINE> width = dat.width <NEW_LINE> d = dat.data <NEW_LINE> df = dat.float_data <NEW_LINE> if dtype is not ... | Wraps de-serialization instructions
returns datum object and array values | 625941e78c3a873295158834 |
def setTimer(self, player_id): <NEW_LINE> <INDENT> player = self.getPlayer(player_id) <NEW_LINE> if self.timerOn: <NEW_LINE> <INDENT> if not player.timerOn: <NEW_LINE> <INDENT> player.timerOn = True <NEW_LINE> self.timer_value = self.timer_value - SET_TIMER_VALUE <NEW_LINE> if self.timer_value <= 0: <NEW_LINE> <INDENT>... | Start an N * 5 minute timer where N is number of players, or reduce timer by 5 minutes | 625941e7925a0f43d254a2ef |
def swish(x, inplace: bool = False): <NEW_LINE> <INDENT> if inplace: <NEW_LINE> <INDENT> return x.mul_(x.sigmoid()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return x.mul(x.sigmoid()) | Swish activation function as described in https://arxiv.org/pdf/1710.05941.pdf
| 625941e763f4b57ef0001580 |
def testOtherUserAccessDenied(self): <NEW_LINE> <INDENT> self.data.kwargs['user'] = 'other' <NEW_LINE> access_checker = access.IsUrlUserAccessChecker() <NEW_LINE> with self.assertRaises(exception.UserError) as context: <NEW_LINE> <INDENT> access_checker.checkAccess(self.data, None) <NEW_LINE> <DEDENT> self.assertEqual(... | Tests that access is denied for a user who is not defined in URL. | 625941e757b8e32f52483912 |
def initialize_model( self, config, weights, classes, confidence=0.2, NMS_threshold=0.2, network_resolution=416 ): <NEW_LINE> <INDENT> self.confidence = confidence <NEW_LINE> self.NMS_threshold = NMS_threshold <NEW_LINE> self.network_resolution = network_resolution <NEW_LINE> self.batch_size = 1 <NEW_LINE> self.classes... | Initializes network with config and weights provided.
:param config: path to config
:param weights: path to weights
:param classes: path to .txt file with classes listed
:param confidence:
:param NMS_threshold:
:param network_resolution:
:return: | 625941e77b25080760e398ca |
def pre_match_odds( self, fi: str, raw: Optional[str] = None ) -> Bet365Response: <NEW_LINE> <INDENT> querystring = {"FI": fi, "raw": raw} <NEW_LINE> return self._get( url_extras="prematch", params=querystring, version="v2" ) | Caller for `PreMatch Odds` endpoint of Bet365 API.
Args:
fi (str): FI from Bet365 InPlay
raw (Optional[str]): option for raw Bet365 body response
Returns:
Bet365Response: Response Object for `pre_match_odds` endpoint | 625941e70c0af96317bb865c |
def test_sort_file(): <NEW_LINE> <INDENT> data_file = create_file(['Ben,US,24', 'Alex,US,25', 'Alex,PT,25']) <NEW_LINE> out_file = sort_file(data_file) <NEW_LINE> obs_out = file_2list(out_file) <NEW_LINE> os.remove(out_file) <NEW_LINE> assert obs_out == ['Alex,PT,25', 'Alex,US,25', 'Ben,US,24'] | Test md5 sum calculation. | 625941e72ae34c7f2600d5a4 |
def import_by_path(dotted_path, error_prefix=''): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> module_path, class_name = dotted_path.rsplit('.', 1) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> raise ImproperlyConfigured("%s%s doesn't look like a module path" % ( error_prefix, dotted_path)) <NEW_LINE> <DED... | Import a dotted module path and return the attribute/class designated by
the last name in the path. Raise ImproperlyConfigured if something goes
wrong. This has come straight from Django 1.6 | 625941e7ad47b63b2c50a3f3 |
def add_none_keys_cate_conti_list(self,conti_list, cate_list ): <NEW_LINE> <INDENT> CALCULATED_CONTINUOUS_COLUMNS = list() <NEW_LINE> CALCULATED_CATEGORICAL_COLUMNS = list() <NEW_LINE> _extend_cell_feature = self.extend_cell_feature <NEW_LINE> _extend_cell_feature_list = list() <NEW_LINE> _label = self.label <NEW_LINE>... | Example 을 위한 Continuous 랑 Categorical을 구분하기 위한 list | 625941e72ae34c7f2600d5a5 |
def create_xtstitched_ifg_job(project, stitched, auto_bbox, ifg_id, master_zip_url, master_orbit_url, slave_zip_url, slave_orbit_url, bbox, wuid=None, job_num=None): <NEW_LINE> <INDENT> if wuid is None or job_num is None: <NEW_LINE> <INDENT> raise RuntimeError("Need to specify workunit id and job num.") <NEW_LINE> <DED... | Map function for create cross-track stitched interferogram job json creation. | 625941e7046cf37aa974d1b7 |
def runTest(self): <NEW_LINE> <INDENT> self.assertEqual({'eof'}, self.reader.current_class()) <NEW_LINE> self.assert_reader_at_end() | reading at eof should produce the proper classification | 625941e7442bda511e8be886 |
def test__iterate_and_delete_empty_asgs_empties(self, req_mock): <NEW_LINE> <INDENT> asgs = [ { 'desiredCapacity': 8, 'minSize': 2, 'maxSize': 20, 'autoScalingGroupName': 'loadtest-edx-edxapp-v1337' }, { 'desiredCapacity': 0, 'minSize': 0, 'maxSize': 0, 'autoScalingGroupName': 'loadtest-edx-edxapp-v1338' }, { 'desiredC... | Function should only delete if latest ASG is empty | 625941e7d18da76e23532950 |
def aggr_fsinfo(fs_name: str): <NEW_LINE> <INDENT> fsinfo_results_dic = {} <NEW_LINE> fsinfo_cmd = subprocess.run( ["zfsadm", "fsinfo", "-aggregate", fs_name], capture_output=True ) <NEW_LINE> if fsinfo_cmd.returncode != 0: <NEW_LINE> <INDENT> logging.error(f"RC={fsinfo_cmd.returncode}") <NEW_LINE> logging.error("The z... | Display detailed information about a zFS file system.
Parameters:
fs_name (str): FS aggregate name
Returns:
Python dictionary corresponds to zfsadm fsinfo -aggregate omvs command
Doc:
https://www.ibm.com/docs/en/zos/2.4.0?topic=commands-zfsadm-fsinfo | 625941e755399d3f05588b2b |
@lru_cache(maxsize=1024) <NEW_LINE> def unimplemented_abstract_methods( node: nodes.ClassDef, is_abstract_cb: nodes.FunctionDef = None ) -> Dict[str, nodes.NodeNG]: <NEW_LINE> <INDENT> if is_abstract_cb is None: <NEW_LINE> <INDENT> is_abstract_cb = partial(decorated_with, qnames=ABC_METHODS) <NEW_LINE> <DEDENT> visited... | Get the unimplemented abstract methods for the given *node*.
A method can be considered abstract if the callback *is_abstract_cb*
returns a ``True`` value. The check defaults to verifying that
a method is decorated with abstract methods.
The function will work only for new-style classes. For old-style
classes, it will... | 625941e776d4e153a657efa7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.