code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def upload_file(self, file, folder_id=None, caption=None): <NEW_LINE> <INDENT> data = {} <NEW_LINE> if folder_id is not None: <NEW_LINE> <INDENT> numeric_folder_id = self._get_numeric_record_id(folder_id) <NEW_LINE> data["folderId"] = numeric_folder_id <NEW_LINE> <DEDENT> if caption is not None: <NEW_LINE> <INDENT> dat... | Upload a file to the gallery. More information on
https://community.researchspace.com/public/apiDocs (or your own instance's /public/apiDocs).
:param file: open file object
:param folder_id: folder id of the destination folder
:param caption: optional caption
:return: parsed response as a dictionary | 625941f57b180e01f3dc4e1c |
@use_cache(namespace="backup") <NEW_LINE> def get_backup_list(system_id='local', backup_type='configuration', no_cache=False): <NEW_LINE> <INDENT> success, system_ip = get_system_ip_from_system_id(system_id) <NEW_LINE> if not success: <NEW_LINE> <INDENT> api_log.error(str(system_ip)) <NEW_LINE> error_msg = "Error retri... | Get the list of backups in the system | 625941f5d8ef3951e3243b6a |
def series_to_supervised(df, configs, n_in=1, n_out=1, dropnan=True): <NEW_LINE> <INDENT> predictors = df.get(configs['data']['predictors']) <NEW_LINE> responses = df.get(configs['data']['responses']) <NEW_LINE> cols, predictor_names = list(), list() <NEW_LINE> for i in range(n_in, 0, -1): <NEW_LINE> <INDENT> cols.appe... | Frame a time series as a supervised learning dataset.
Arguments:
df: Sequence of observations a pandas dataframe.
configs: dictionary of data configuration.
n_in: Number of lag observations as input (X).
n_out: Number of observations as output (y).
dropnan: Boolean whether or not to drop rows with N... | 625941f5851cf427c661ab35 |
def DeleteUserDefinedFunction(self, udf_link, options={}): <NEW_LINE> <INDENT> path = '/' + udf_link <NEW_LINE> udf_id = base.GetIdFromLink(udf_link) <NEW_LINE> return self.DeleteResource(path, 'udfs', udf_id, None, options) | Deletes a user defined function.
:Parameters:
- `udf_link`: str, the link to the user defined function.
- `options`: dict, the request options for the request.
:Returns:
dict | 625941f521a7993f00bc8329 |
def select_resource_type(self, resource): <NEW_LINE> <INDENT> resource = resource.lower() <NEW_LINE> self.select('resource_type', resource) | Select the reource type. | 625941f5e64d504609d74e6c |
def _parse_one_vc(vc): <NEW_LINE> <INDENT> if len(vc) < 4: <NEW_LINE> <INDENT> raise Exception('Invalid or empty: ' + str(vc)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if 'BEGIN:VCARD' != vc[0] or 'END:VCARD' != vc[-1]: <NEW_LINE> <INDENT> raise Exception('Bad begin or end: ' + str(vc)) <NEW_LINE> <DEDENT> if 'VER... | Takes in a list that represents a single card, returns a hash, or
throws an exception. | 625941f530c21e258bdfaad1 |
def ListTransferLogs(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | Returns user facing log messages for the data transfer run.
| 625941f55fcc89381b1e1cf1 |
def open_stream(self): <NEW_LINE> <INDENT> if self._stream_handler is None: <NEW_LINE> <INDENT> self._stream_handler = logging.StreamHandler() <NEW_LINE> self._stream_handler.setFormatter(self._formatter) <NEW_LINE> self._logger.addHandler(self._stream_handler) | Opens the stream handler to write log messages to stdout.
| 625941f51f037a2d8b946828 |
def __init__(self, heatgrid=None, pal='RdYlGn10', p=None): <NEW_LINE> <INDENT> self.heatgrid = heatgrid <NEW_LINE> self.pal = pal | This initializes the class | 625941f550812a4eaa59c947 |
@app.route('/students/enroll', methods=['POST']) <NEW_LINE> def enroll_student(): <NEW_LINE> <INDENT> result = "" <NEW_LINE> json_data = request.get_json(force=True) <NEW_LINE> if json_data is None: <NEW_LINE> <INDENT> return "Please add JSON data as payload! \n <usage> : {""}" <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND... | Enrolls a given student based on a given Course_id
Also, capable of enrolling multiple students at a time
:return: String with status of the result on the student's enrollment | 625941f58e7ae83300e4b5fc |
def update(self, value): <NEW_LINE> <INDENT> self.l.set_data(self.revcorr_center[:, :, np.searchsorted(self.tau_range, -value)]) <NEW_LINE> self.slider.valtext.set_text('{:03.3f}'.format(value)) <NEW_LINE> self.fig.canvas.draw() | :param value: Float. Value from slider on image.
:return: New image presented containing shifted time window. | 625941f5656771135c3ebea3 |
def getindexbykeyword(index_ts, **kwargs): <NEW_LINE> <INDENT> lst = [] <NEW_LINE> name = kwargs.get('name') <NEW_LINE> if name: <NEW_LINE> <INDENT> index_mi = index_ts.dbMatch(rpm.RPMTAG_NAME, name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> index_mi = index_ts.dbMatch() <NEW_LINE> <DEDENT> if 'epoch' in kwargs: <N... | Return list of indexs from the rpmdb matching keywords
ex: getHeadersByKeyword(name='foo', version='1', release='1')
Can be passed any structure that can be indexed by the pkgspec
keyswords as other keys are filtered out. | 625941f5cad5886f8bd27604 |
def test_lesser(self): <NEW_LINE> <INDENT> f1 = Fraction(3, 4) <NEW_LINE> f2 = Fraction(1, 2) <NEW_LINE> f3 = Fraction(2, 4) <NEW_LINE> self.assertTrue(f2 < f1) <NEW_LINE> self.assertFalse(f2 < f3) <NEW_LINE> self.assertTrue(f3 < f1) <NEW_LINE> self.assertTrue(Fraction(-1, 2) < Fraction(1, -3)) | test fraction lesser than | 625941f5cc40096d61595f7a |
@t16000m.axis(2) <NEW_LINE> def y_axis(event, vjoy): <NEW_LINE> <INDENT> vjoy[1].axis(2).value = event.value + g_trim_offset[1] | Remaps the physical Y axis onto the virtual Y axis, applying trim.
:param event event containing the physical axis value
:param vjoy vjoy proxy | 625941f523849d37ff7b36b7 |
@_append_from_pretrained_docstring(bert_docstring) <NEW_LINE> def bertForMultipleChoice(*args, **kwargs): <NEW_LINE> <INDENT> model = BertForMultipleChoice.from_pretrained(*args, **kwargs) <NEW_LINE> return model | BertForMultipleChoice is a fine-tuning model that includes BertModel and a
linear layer on top of the BertModel. Note that the multiple choice head is
only initialized and has to be trained.
Args:
num_choices: the number (>=2) of classes for the classifier.
Example:
# Load the tokenizer
>>> import torch
>... | 625941f563f4b57ef0001733 |
def add_message(self, msg_id, location, msg): <NEW_LINE> <INDENT> module, obj, line, col_offset = location[1:] <NEW_LINE> if self.include_ids: <NEW_LINE> <INDENT> sigle = msg_id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sigle = msg_id[0] <NEW_LINE> <DEDENT> full_msg = [sigle, module, obj, str(line), msg] <NEW_LINE>... | manage message of different type and in the context of path | 625941f5507cdc57c6307317 |
def get_buckets(self): <NEW_LINE> <INDENT> with self._get_connection_from_pool() as connection: <NEW_LINE> <INDENT> return connection.get_buckets() | Serialize bucket listing request and deserialize response | 625941f550485f2cf553d3c9 |
def restore_states(self): <NEW_LINE> <INDENT> for file in self.app.get_files(): <NEW_LINE> <INDENT> path = file.get_path() <NEW_LINE> if path in self.storage.get_data().keys(): <NEW_LINE> <INDENT> state = self.storage[path] <NEW_LINE> if "hash" not in state: <NEW_LINE> <INDENT> self.set_file_state(file, state) <NEW_LIN... | Restore the states of files that are currently open. | 625941f5d4950a0f3b08c973 |
def get_br_assistance_themes(self): <NEW_LINE> <INDENT> return self.br.get("assistance_themes", False) | Use assistance theme categories | 625941f53539df3088e2e978 |
def test_get_default(self): <NEW_LINE> <INDENT> p1 = self.constructor(Name='a',Prefix='-',Value=42,Quote='\'', Delimiter='=') <NEW_LINE> self.assertEqual(p1._get_default(),42) <NEW_LINE> p1.Value = 43 <NEW_LINE> self.assertEqual(p1._get_default(),42) | Parameter: default behaves as expected | 625941f5dc8b845886cb5b64 |
def invitation_type(self): <NEW_LINE> <INDENT> if self.with_guest: <NEW_LINE> <INDENT> return "Guest" <NEW_LINE> <DEDENT> elif self.family_size > 0: <NEW_LINE> <INDENT> return "Family" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "People" | Returns the invitation type.
-- Guest means that there is an extra person to the invitation who is a guest.
-- Family means that we are just inputting the family name and size and the invite
has one person just for the info.
-- People type means the invitation includes a list of people | 625941f55510c4643540fa00 |
def apphot(self, output_fn='output-apphot.txt', coords=None): <NEW_LINE> <INDENT> if coords is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> coords = self._path_cache['daofind_output'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise DaophotError('You need to run Daophot.daofind ' 'before Daophot.app... | Run the DAOPHOT aperture photometry task.
Parameters
----------
output_fn : str (optional)
Where to write the output text file? (defaults to a temporary file)
coords : str
Path to an output file of DAOFIND. By default, it will use the
output from the most recent call to daofind() on this object. | 625941f5d58c6744b425828a |
def strStr(self, s, p): <NEW_LINE> <INDENT> sn = 0 if s == None else len(s) <NEW_LINE> pn = 0 if p == None else len(p) <NEW_LINE> if pn == 0: return 0 <NEW_LINE> if sn == 0: return -1 <NEW_LINE> si, pi, ne = 0, 0, self.getNext(p, pn) <NEW_LINE> while si < sn: <NEW_LINE> <INDENT> if s[si] == p[pi]: <NEW_LINE> <INDENT> s... | :type s: str origin string
:type p: str pattern string
:rtype: int | 625941f57d847024c06be8ee |
@tox_hookimpl <NEW_LINE> def tox_addoption(parser): <NEW_LINE> <INDENT> _setup_no_fallback(parser) | Add command line option to the argparse-style parser object. | 625941f526238365f5f0f4a3 |
def _generate(self): <NEW_LINE> <INDENT> self._write_headers() <NEW_LINE> self._write_data() | Creates a markdown table
Note:
Args:
Returns: | 625941f55f7d997b871750cb |
def keyPressEvent(self, event): <NEW_LINE> <INDENT> if not self.isStarted: <NEW_LINE> <INDENT> super(Board, self).keyPressEvent(event) <NEW_LINE> return <NEW_LINE> <DEDENT> key = event.key() <NEW_LINE> if key == Qt.Key_P: <NEW_LINE> <INDENT> self.pause() <NEW_LINE> return <NEW_LINE> <DEDENT> if self.isPaused: <NEW_LINE... | processes key press events | 625941f55510c4643540fa01 |
def stop(self): <NEW_LINE> <INDENT> self.event.set() | Stops the peer | 625941f5ab23a570cc2507b5 |
def str(self): <NEW_LINE> <INDENT> bigstring = '' <NEW_LINE> if not self._delimiter: <NEW_LINE> <INDENT> delim = ' ' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> delim = self._delimiter <NEW_LINE> <DEDENT> bigstring = bigstring + str(self.header) <NEW_LINE> for ii in range(self.nrows): <NEW_LINE> <INDENT> strlist = se... | Defines a string method for the object.
Gives a simple string method such that str(AsciiData)
does work. The formatting is close to the formatting
for the output to files.
@return: the string representation of the object
@rtype: string | 625941f5379a373c97cfb174 |
def mooseReadNML2( modelpath, verbose = False ): <NEW_LINE> <INDENT> global nml2Import_ <NEW_LINE> if not nml2Import_: <NEW_LINE> <INDENT> mu.warn( nml2ImportError_ ) <NEW_LINE> raise RuntimeError( "Could not load NML2 support." ) <NEW_LINE> <DEDENT> reader = _neuroml2.NML2Reader( verbose = verbose ) <NEW_LINE> reader.... | Read NeuroML model (version 2) and return reader object.
| 625941f556ac1b37e62647ef |
def __call__(paths=None, limit=0, b_start=0, b_size=10, b_orphan=1): <NEW_LINE> <INDENT> pass | Returns search event results. | 625941f5ac7a0e7691ed46ec |
def BoolVectorProperty(name="", description="", default=(False, False, False), options={'ANIMATABLE'}, subtype='NONE', size=3, update=None, get=None, set=None): <NEW_LINE> <INDENT> pass | Returns a new vector boolean property definition.
Arguments:
@name (string): Name used in the user interface.
@description (string): Text used for the tooltip and api documentation.
@default (sequence): sequence of booleans the length of *size*.
@options (set): Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBR... | 625941f57047854f462a1a2f |
def test_non_initial_bytes_in_two_reverse(rgb_file_bytes): <NEW_LINE> <INDENT> with MemoryFile() as memfile: <NEW_LINE> <INDENT> memfile.seek(600000) <NEW_LINE> assert memfile.write(rgb_file_bytes[600000:]) == len(rgb_file_bytes) - 600000 <NEW_LINE> memfile.seek(0) <NEW_LINE> assert memfile.write(rgb_file_bytes[:600000... | MemoryFile contents can be read from bytes in two steps, tail first, and opened.
Demonstrates fix of #1926. | 625941f57c178a314d6efa98 |
def new_control(self, type, name, value, **kwargs): <NEW_LINE> <INDENT> for tag in ('input', 'textarea', 'select'): <NEW_LINE> <INDENT> for old in self.form.find_all(tag, {'name': name}): <NEW_LINE> <INDENT> old.decompose() <NEW_LINE> <DEDENT> <DEDENT> control = BeautifulSoup("", "html.parser").new_tag('input') <NEW_LI... | Add a new input element to the form.
The arguments set the attributes of the new element. | 625941f5b545ff76a8914442 |
def iso_timestr(dt: datetime) -> str: <NEW_LINE> <INDENT> return str(dt.isoformat()).split('.')[0] | Convert datetime object into ISO friendly ``2010-03-03Z21:16:45`` | 625941f591af0d3eaac9c04b |
def __init__(self, x, z): <NEW_LINE> <INDENT> self.x = int(x) <NEW_LINE> self.z = int(z) <NEW_LINE> self.blocks = zeros((16, 16, 128), dtype=uint8) <NEW_LINE> self.heightmap = zeros((16, 16), dtype=uint8) <NEW_LINE> self.blocklight = zeros((16, 16, 128), dtype=uint8) <NEW_LINE> self.metadata = zeros((16, 16, 128), dtyp... | Set up the internal data structures for tracking and representing a
chunk.
Chunks are large pieces of block data, always measured 16x128x16 and
aligned on 16x16 boundaries in the xz-plane.
:param int x: X coordinate in chunk coords
:param int z: Z coordinate in chunk coords | 625941f5d268445f265b549c |
def get_file_path(self, index): <NEW_LINE> <INDENT> if index == self.current_song_index: <NEW_LINE> <INDENT> return self.get_downloading_video_path() <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return self.downloaded_songs_paths[index] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> return "" | Given an index, tries to find the filepath associated with it.
@param index: the index of the song
@return: the path of the file associated with the index | 625941f5e1aae11d1e74a2eb |
def list_normalization(l, range_size=1): <NEW_LINE> <INDENT> _max = max(abs(val) if val is not None else None for val in l) <NEW_LINE> return [float(val)/_max * range_size if val is not None else 0 for val in l] | Normalization of a list on the 0:r range. | 625941f5ff9c53063f47c81d |
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, SellerRebateOfferCriterionOffers): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | 625941f58c3a8732951589f0 |
def permission_bits(str_value, typeflag): <NEW_LINE> <INDENT> value = int(str_value, 8) <NEW_LINE> res = TYPE_FLAGS.get(chr(ord(typeflag)), '?') <NEW_LINE> res += 'r' if (value >> 6) & 0b100 else '-' <NEW_LINE> res += 'w' if (value >> 6) & 0b010 else '-' <NEW_LINE> res += 'x' if (value >> 6) & 0b001 else '-' <NEW_LINE>... | Format type flag and permission bits | 625941f545492302aab5e8f7 |
def update_note(self): <NEW_LINE> <INDENT> print('CALLED: Update the underlying note object') <NEW_LINE> self.note.update(self.bbody.get_text(self.bbody.get_start_iter(), self.bbody.get_end_iter(), True)) | Update the underlying note object | 625941f550812a4eaa59c948 |
def getMiniStep(self): <NEW_LINE> <INDENT> return self._get_ministep( ) | @rtype: int | 625941f5a934411ee3751cc3 |
def __init__(self): <NEW_LINE> <INDENT> self.__module = AnsibleModule( argument_spec={ "plugin": {"type": "str", "required": True}, "versions": {"type": "list", "required": True}, "global": {"type": "str", "required": False, "default": None}, }, supports_check_mode=True, ) | Initialize. | 625941f5091ae35668667581 |
def pulpDoctest(): <NEW_LINE> <INDENT> import doctest <NEW_LINE> if __name__ != '__main__': <NEW_LINE> <INDENT> from . import pulp <NEW_LINE> doctest.testmod(pulp) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> doctest.testmod() | runs all doctests | 625941f563d6d428bbe44b1f |
def get_model_by_name(self, model_name: str ) -> typing.Tuple[typing.Type[NodeDataModel], dict]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._item_creators[model_name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise ValueError(f'Unknown model: {model_name}') from None | Get information on how to create a specific :class:`NodeDataModel`
node given its user-friendly name.
Parameters
----------
model_name : str
Returns
-------
data_model : NodeDataModel
The data model class.
init_kwargs : dict
Default init keyword arguments.
Raises
------
ValueError
If the model name is n... | 625941f5d18da76e23532b0c |
def _parse_bundle(elem, parent_bundle=None): <NEW_LINE> <INDENT> if elem.tag != "bundle": <NEW_LINE> <INDENT> raise SyntaxError("Bundling only works with bundle tags.") <NEW_LINE> <DEDENT> contents = [] <NEW_LINE> asset_type = None <NEW_LINE> asset_types = [] <NEW_LINE> for t in elem: <NEW_LINE> <INDENT> if t.tag == 'b... | Recursively generate webassets bundles by walking the xml/html tree | 625941f5bde94217f3683418 |
@register.inclusion_tag('horizon/_nav_list.html', takes_context=True) <NEW_LINE> def horizon_main_nav(context): <NEW_LINE> <INDENT> if 'request' not in context: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> current_dashboard = context['request'].horizon.get('dashboard', None) <NEW_LINE> dashboards = [] <NEW_LINE> f... | Generates top-level dashboard navigation entries. | 625941f597e22403b379d5ca |
def wrapper(self, *params, **kwargs): <NEW_LINE> <INDENT> return self._execute(attr, self.id, *params, **kwargs) | Wrapper for client.execute(%r, %r, [...], *params, **kwargs). | 625941f530dc7b7665901f8c |
def check_credentials(self, username, password): <NEW_LINE> <INDENT> sql = "SELECT * FROM users WHERE username='{}'".format(username) <NEW_LINE> self.cursor.execute(sql) <NEW_LINE> data = self.cursor.fetchone() <NEW_LINE> if data is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if check_password_hash(data[... | Method for checking users username and password | 625941f5cc0a2c11143dd4bf |
def check_payload(payload): <NEW_LINE> <INDENT> if check_mobile(payload["mobile"]) and "msg" in payload.keys(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False | 短信 载荷是否 有效 | 625941f56fb2d068a760f6d5 |
def get_authority_info(request, slug, **kwargs): <NEW_LINE> <INDENT> template = kwargs.get('template', 'authority.html') <NEW_LINE> user_message = request.session.pop('user_message', {}) <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> authority = get_authority(slug) <NEW_LI... | Display the details on the selected authority:
* Authority info (contacts, description, etc.)
* Authority requests
* Fill the Breadcrumb by category. | 625941f5596a89723608a0e5 |
def getOutList(self): <NEW_LINE> <INDENT> return self.hypergraph.getOutList(self.name) | Returns a list of FEdges leaving this Vertex. | 625941f556ac1b37e62647f0 |
def test_listen_add_while_getall_running(self): <NEW_LINE> <INDENT> listen_1 = {'!re': '', '.tag': 'LISTEN', '.id': '*1', 'address': '1.2.3.4', 'list': 'list_name_1_test'} <NEW_LINE> fetch_1 = {'!re': '', '.tag': 'FETCH', '.id': '*2', 'address': '1.2.3.4', 'list': 'list_name_old_test'} <NEW_LINE> fetch_done = {'!done':... | The /listen sentences will always have the latest data.
Only use /getall data when it hasn't been provided by /listen yet. | 625941f5dd821e528d63b7d1 |
def help(command = ''): <NEW_LINE> <INDENT> return help.__doc__ | /sala
/notas @ ra senha semestre
| 625941f563f4b57ef0001734 |
@keras_export('keras.metrics.poisson', 'keras.losses.poisson') <NEW_LINE> def poisson(y_true, y_pred): <NEW_LINE> <INDENT> y_pred = ops.convert_to_tensor_v2(y_pred) <NEW_LINE> y_true = math_ops.cast(y_true, y_pred.dtype) <NEW_LINE> return K.mean(y_pred - y_true * math_ops.log(y_pred + K.epsilon()), axis=-1) | Computes the Poisson loss between y_true and y_pred.
The Poisson loss is the mean of the elements of the `Tensor`
`y_pred - y_true * log(y_pred)`.
Args:
y_true: Ground truth values. shape = `[batch_size, d0, .. dN]`.
y_pred: The predicted values. shape = `[batch_size, d0, .. dN]`.
Returns:
Poisson loss value.... | 625941f515baa723493c45a8 |
def create_superuser(self,email,password): <NEW_LINE> <INDENT> user = self.create_user( email, password=password, is_employee=False, ) <NEW_LINE> user.is_admin = True <NEW_LINE> user.save(using=self._db) <NEW_LINE> return user | Creates and saves a superuser with the given email, date of
birth and password. | 625941f5460517430c3947a1 |
def get_stats(self): <NEW_LINE> <INDENT> stats = {stats_key: self.stats[stats_key] for stats_key in self.stats if stats_key.split('_', 1)[0] in self.STATS_PREFIXES} <NEW_LINE> stats.update(self._manager.backend.get_stats() or {}) <NEW_LINE> if not stats: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> stats['_timestamp'... | Return default stats with a timestamp.
It's useful to have a default implementation of the method because both
strategy and db worker store stats this way, though this logic could be
modified in a child class to redefine/transform stats data. | 625941f5283ffb24f3c55f28 |
def __del__(self): <NEW_LINE> <INDENT> self.parent._unregister_child(self) | Unregister itself. | 625941f54e696a04525c9a7c |
def test_userphoneclaim_unicode(self): <NEW_LINE> <INDENT> haymitch = models.User(username='haymitch', fullname='Haymitch Abernathy') <NEW_LINE> phone = '9191919191' <NEW_LINE> phone_claim = models.UserPhoneClaim(phone=phone, user=haymitch) <NEW_LINE> db.session.add(phone_claim) <NEW_LINE> db.session.commit() <NEW_LINE... | Test for verifying whether UserPhoneClaim instance
returns phone in unicode format | 625941f5379a373c97cfb175 |
def __str__(self): <NEW_LINE> <INDENT> r <NEW_LINE> return self() | New in 1.2.8. Equal to :met:`__call__` without passing parameters. | 625941f5a4f1c619b28b0657 |
def set_db(self): <NEW_LINE> <INDENT> api_geneset = self.api.ref_rna_geneset <NEW_LINE> self.logger.info("wooooooooorkflowinfoooooooo") <NEW_LINE> output_file = self.output_dir + '/kegg_stat.xls' <NEW_LINE> pathway_file = self.output_dir + '/pathways' <NEW_LINE> api_geneset.add_kegg_regulate_detail(self.option("main_ta... | 保存结果指数表到mongo数据库中 | 625941f54f88993c3716c68e |
def legeNachHinten(self): <NEW_LINE> <INDENT> self.__nichtGelernt.enqueue(self.__nichtGelernt.dequeue()) | Vorderes Objekt wird nach hinten gelegt | 625941f5046cf37aa974d36f |
def addDomain(self, domain): <NEW_LINE> <INDENT> if domain: <NEW_LINE> <INDENT> self.__domains.append(domain) | @types: tibco.Domain | 625941f50fa83653e46575e5 |
def get_short_name(self): <NEW_LINE> <INDENT> return self.name | retrieve shot name of the user | 625941f53cc13d1c6d3c79a5 |
def __init__(self, t, location): <NEW_LINE> <INDENT> self.location = location <NEW_LINE> self.t = t | Input: location - tuple of ints (x, y), the position
of the bar in the terminal | 625941f56fece00bbac2dd74 |
def d_expression(t): <NEW_LINE> <INDENT> if len(t) == 1: <NEW_LINE> <INDENT> return t[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> assert len(t) == 3 <NEW_LINE> return nodes.ExpressionContainer([t[1]]) | expression: literal
| variable
| assignment
| call
| function_header
| condition
| math_expression
| atomic_increment
| atomic_decrement
| '(' expression ')' | 625941f5f9cc0f698b140c24 |
def function_application_infer( env: Env, ctx: TypingContext, ty: Ty, function_call_expr: FunctionCallExpr ) -> Tuple[Env, TypingContext, Ty]: <NEW_LINE> <INDENT> n_callee = function_call_expr.n_callee <NEW_LINE> assert n_callee is not None, "should have been checked by parser" <NEW_LINE> n_argument_list = function_cal... | The function-application relation ⇒⇒, discussed in Dunfield 2013. | 625941f5baa26c4b54cb1746 |
def _import_exists(module_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import_module(module_name) <NEW_LINE> return True <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> return False | Validates if import module exists
:param module_name: module name to import
:return: Bool | 625941f521bff66bcd684f7b |
def _createSpeakerObject(self, request): <NEW_LINE> <INDENT> user = endpoints.get_current_user() <NEW_LINE> if not user: <NEW_LINE> <INDENT> raise endpoints.UnauthorizedException('Authorization required') <NEW_LINE> <DEDENT> user_id = user.email() <NEW_LINE> if not request.name: <NEW_LINE> <INDENT> raise endpoints.BadR... | Create a speaker, returning SpeakerForm/request. | 625941f56fece00bbac2dd75 |
def inputList(typefn, delim=","): <NEW_LINE> <INDENT> def _make_list(values): <NEW_LINE> <INDENT> print("making list from {}".format(values)) <NEW_LINE> return [ typefn(v) for v in values.split(',') ] <NEW_LINE> <DEDENT> return _make_list | parses a deliminated string into a list of items
:param typefn: type function that will be applied to each string item
:param delim: delimiter character, defaults to ','
:return: a list of parsed values
:rtype: A list [n1,n2,...] | 625941f5a8370b7717052ecb |
def rep01(s): <NEW_LINE> <INDENT> return s + '?' | REGEX: build repeat 0 or 1. | 625941f5377c676e912727d5 |
def figure_out_parameters(self): <NEW_LINE> <INDENT> valid_parameters = [] <NEW_LINE> valid_parameters += self.try_list_of_parameters() <NEW_LINE> print("Trying to infer parameters from help") <NEW_LINE> valid_parameters += self.try_inferring_parameters_from_help() <NEW_LINE> print("Inferred", valid_parameters, "from h... | Figure out the argument which is needed to force the binary to take a file. | 625941f5be8e80087fb21265 |
def fix_yaml_loader() -> None: <NEW_LINE> <INDENT> def construct_yaml_str(self, node): <NEW_LINE> <INDENT> return self.construct_scalar(node) <NEW_LINE> <DEDENT> yaml.Loader.add_constructor("tag:yaml.org,2002:str", construct_yaml_str) <NEW_LINE> yaml.SafeLoader.add_constructor("tag:yaml.org,2002:str", construct_yaml_st... | Ensure that any string read by yaml is represented as unicode.
| 625941f5fb3f5b602dac3cc9 |
def __init__(self, name=None, device_type=None): <NEW_LINE> <INDENT> self._name = None <NEW_LINE> self._device_type = None <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> if device_type is not None: <NEW_LINE> <INDENT> self.device_type = device_type | Data59 - a model defined in Swagger | 625941f5cc0a2c11143dd4c0 |
def prep_images(self): <NEW_LINE> <INDENT> y_offset = self.y_start <NEW_LINE> for a, es in zip(self.aliens, self.example_scores): <NEW_LINE> <INDENT> a[1].centery = y_offset <NEW_LINE> a[1].centerx = (self.settings.screen_width // 2) - a[1].width <NEW_LINE> es.prep_image() <NEW_LINE> es.image_rect.centery = y_offset <N... | Prepare all images and render all text for later display | 625941f57d43ff24873a32d4 |
def to_html(self): <NEW_LINE> <INDENT> raise NotImplementedError('Please Implement this method') | Render a MessageElement queue as html
Args:
None
Returns:
Str message the html representation of the message queue
Raises:
Errors are propagated | 625941f515baa723493c45a9 |
def _make_discrete_source_space(pos, coord_frame='mri'): <NEW_LINE> <INDENT> if coord_frame not in _str_to_frame: <NEW_LINE> <INDENT> raise KeyError('coord_frame must be one of %s, not "%s"' % (list(_str_to_frame.keys()), coord_frame)) <NEW_LINE> <DEDENT> coord_frame = _str_to_frame[coord_frame] <NEW_LINE> rr = np.arra... | Use a discrete set of source locs/oris to make src space.
Parameters
----------
pos : dict
Must have entries "rr" and "nn". Data should be in meters.
coord_frame : str
The coordinate frame in which the positions are given; default: 'mri'.
The frame must be one defined in transforms.py:_str_to_frame
Return... | 625941f58e7ae83300e4b5fd |
def __init__(self, spi_bus=1, led_count=1, intensity=1): <NEW_LINE> <INDENT> self.led_count = led_count <NEW_LINE> self.intensity = intensity <NEW_LINE> self.buf_length = self.led_count * 3 * 4 <NEW_LINE> self.buf = bytearray(self.buf_length) <NEW_LINE> self.spi = pyb.SPI(spi_bus, pyb.SPI.MASTER, baudrate=3200000, pola... | Params:
* spi_bus = SPI bus ID (1 or 2)
* led_count = count of LEDs
* intensity = light intensity (float up to 1) | 625941f58a349b6b435e87a1 |
def _showaxes(self): <NEW_LINE> <INDENT> if self._joyaxis == self._lastaxis: return <NEW_LINE> self._lastaxis = self._joyaxis <NEW_LINE> for axis_num in range(2): <NEW_LINE> <INDENT> if axis_num == 0: <NEW_LINE> <INDENT> xorg_rel = a1xorg <NEW_LINE> yorg_rel = a1yorg <NEW_LINE> xdir = self._xdir1 <NEW_LINE> ydir = self... | draws the position of the joystick on the diagram | 625941f531939e2706e4d48f |
def __array__(self, result=None): <NEW_LINE> <INDENT> return self.values | the array interface, return my values | 625941f5ff9c53063f47c81e |
def _write_boxline(self, char, char_x0, char_y0, char_x1, char_y1, page_nb): <NEW_LINE> <INDENT> tess_char_x0, tess_char_y0 = pil_coord_to_tesseract(char_x0, char_y0, self.H) <NEW_LINE> tess_char_x1, tess_char_y1 = pil_coord_to_tesseract(char_x1, char_y1, self.H) <NEW_LINE> boxline = '%s %d %d %d %d %d' % (char, tess_c... | Generate a boxfile line given a character coordinates, and append it to the
self.boxlines list. | 625941f5d10714528d600319 |
def run(self): <NEW_LINE> <INDENT> print('Ahenk running...') <NEW_LINE> global_scope = Scope() <NEW_LINE> global_scope.set_instance(global_scope) <NEW_LINE> config_file_folder_path = '/etc/ahenk/config.d/' <NEW_LINE> self.init_config_manager(System.Ahenk.config_path(), config_file_folder_path) <NEW_LINE> self.logger = ... | docstring | 625941f57b25080760e39a83 |
def get_inventory_values(self) -> list: <NEW_LINE> <INDENT> column: list = [] <NEW_LINE> for variation in self.variations: <NEW_LINE> <INDENT> if 'stock' not in variation.keys(): <NEW_LINE> <INDENT> logger.error("ERROR: variations without stock data.") <NEW_LINE> return [] <NEW_LINE> <DEDENT> value = 0 <NEW_LINE> for s... | Get the stock for each variation from the configured warehouse.
Return:
[list] - value for every variation | 625941f530c21e258bdfaad3 |
def get_all_notifications(self): <NEW_LINE> <INDENT> path = self._urls['notifications'] <NEW_LINE> data = {'all': True} <NEW_LINE> req = self._session.get(url=path, params=data) <NEW_LINE> if req.status_code == 200: <NEW_LINE> <INDENT> return req.json() <NEW_LINE> <DEDENT> elif req.status_code == 400: <NEW_LINE> <INDEN... | Path: /notifications
Can only be used by admins or managers to fetch all entities
Args:
Returns:
json: list of Notifications | 625941f55fcc89381b1e1cf3 |
def compute_statistics(self, sample: np.ndarray) -> Tuple: <NEW_LINE> <INDENT> return sample.mean(), sample.var() | Computes mean and variance of a sample
:param sample: A sample to compute statistics for.
:return: A tuple (mean, variance). | 625941f5b830903b967e9f32 |
def search_activities_using_get(self, query, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.search_activities_using_get_with_http_info(query, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.search_activit... | searchActivities
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.search_activities_using_get(query, callback=... | 625941f5a8ecb033257d36f9 |
def unset_max_noutput_items(self): <NEW_LINE> <INDENT> return _fec_swig.tagged_decoder_sptr_unset_max_noutput_items(self) | unset_max_noutput_items(tagged_decoder_sptr self) | 625941f51f5feb6acb0c5178 |
def forward(self, hm_targets, hm_preds1, hm_preds2, vismap): <NEW_LINE> <INDENT> loss1 = 0 <NEW_LINE> for p in hm_preds1: <NEW_LINE> <INDENT> loss1 += self.compute_l1_weighted_loss(hm_targets, p, vismap) <NEW_LINE> <DEDENT> loss1 /= 4.0 <NEW_LINE> loss2 = self.compute_l1_weighted_loss(hm_targets, hm_preds2, vismap, ohe... | :param hm_targets: list of 4 elements, each is [batch size, keypoint number, h, w]
:param hm_preds1: list of 4 elements, each is [batch size, keypoint number, h, w]
:param vismap: [batch size, keypoint number]
:return: | 625941f53346ee7daa2b33a1 |
def test_collections(root_parser): <NEW_LINE> <INDENT> l = parse_item(get_path(), Tuple[Dict[str, int], List[int], Set[int], Tuple[str, int, str]]) <NEW_LINE> print(l) | Tests all the supported ways to parse collections_data
:return: | 625941f571ff763f4b549cc6 |
def _interpret_emr_step_logs(fs, matches): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> result = {} <NEW_LINE> for match in matches: <NEW_LINE> <INDENT> path = match['path'] <NEW_LINE> interpretation = _parse_step_log(_cat_log(fs, path)) <NEW_LINE> result.update(interpretation) <NEW_LINE> for error in result.get('errors'... | Extract information from step log (see :py:func:`_parse_step_log()`),
which may be split into several chunks by timestamp | 625941f550812a4eaa59c949 |
def predict(first_url=None, second_url=None, third_url=None, tvrain_data=None, recommends_num=3): <NEW_LINE> <INDENT> global model_init <NEW_LINE> input_ids = [first_url, second_url, third_url] <NEW_LINE> input_articles = [] <NEW_LINE> for url in input_ids: <NEW_LINE> <INDENT> if url != '': <NEW_LINE> <INDENT> input_ar... | Get news predictions. If one of ids isn't specified,
so replace it to most popular articles. If none of ids
is specified, get most popular news.
:param first_url: MongoDB url of first article
:param second_url:
:param third_url:
:param tvrain_data: data.data_utils.TvrainData object
:param recommends_num: num of article... | 625941f5656771135c3ebea5 |
def test_show_message_constraints(self): <NEW_LINE> <INDENT> from plone.api.exc import MissingParameterError <NEW_LINE> with self.assertRaises(MissingParameterError): <NEW_LINE> <INDENT> portal.show_message() <NEW_LINE> <DEDENT> with self.assertRaises(MissingParameterError): <NEW_LINE> <INDENT> portal.show_message(requ... | Test the constraints for show_message. | 625941f5d18da76e23532b0d |
def adjust_bbox(fig, format, bbox_inches): <NEW_LINE> <INDENT> origBbox = fig.bbox <NEW_LINE> origBboxInches = fig.bbox_inches <NEW_LINE> _boxout = fig.transFigure._boxout <NEW_LINE> asp_list = [] <NEW_LINE> locator_list = [] <NEW_LINE> for ax in fig.axes: <NEW_LINE> <INDENT> pos = ax.get_position(original=False).froze... | Temporarily adjust the figure so that only the specified area
(bbox_inches) is saved.
It modifies fig.bbox, fig.bbox_inches,
fig.transFigure._boxout, and fig.patch. While the figure size
changes, the scale of the original figure is conserved. A
function whitch restores the original values are returned. | 625941f5507cdc57c6307319 |
def is_empty_list(o): <NEW_LINE> <INDENT> return is_empty(o) | :return: Returns `True` if the given list is empty. | 625941f563f4b57ef0001735 |
def Delete(self, request, global_params=None): <NEW_LINE> <INDENT> config = self.GetMethodConfig('Delete') <NEW_LINE> return self._RunMethod( config, request, global_params=global_params) | Deletes a workspace. Uncommitted changes are lost. If the workspace does.
not exist, NOT_FOUND is returned.
Args:
request: (SourceProjectsReposWorkspacesDeleteRequest) input message
global_params: (StandardQueryParameters, default: None) global arguments
Returns:
(Empty) The respons... | 625941f5cc40096d61595f7c |
def getDirs(path, excludeDirs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> names = os.listdir(path) <NEW_LINE> <DEDENT> except EnvironmentError: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> dirs = [] <NEW_LINE> for name in names: <NEW_LINE> <INDENT> if os.path.isdir(os.path.join(path, name)) and not os.path.islink(... | Function returning a list of all directories below path.
@param path root of the tree to check
@param excludeDirs basename of directories to ignore
@return list of all directories found | 625941f5925a0f43d254a4ac |
def test_format_subject_custom_template_with_double_hash(self): <NEW_LINE> <INDENT> ticket = self._insert_ticket() <NEW_LINE> self.env.config.set('notification', 'ticket_subject_template', '##${prefix}## #${ticket.id}: ${summary}') <NEW_LINE> notify_ticket_created(self.env, ticket) <NEW_LINE> message = smtpd.get_messag... | Format subject with a custom template with leading ##. | 625941f510dbd63aa1bd31d0 |
def test_DetermineElementComposition_All_Oth(self): <NEW_LINE> <INDENT> np.testing.assert_array_almost_equal(msf.DetermineElementComposition_All_Oth(ELCTest1),ELCTest1res,16) | Test the DetermineElementComposition_All_Oth function. | 625941f50c0af96317bb8816 |
def find_by_id(self, other_id): <NEW_LINE> <INDENT> for element in self.elements: <NEW_LINE> <INDENT> if other_id in element: <NEW_LINE> <INDENT> return element <NEW_LINE> <DEDENT> <DEDENT> return None | Looks up a script id by id name | 625941f5b7558d58953c5535 |
def load_from_1c(arg, status): <NEW_LINE> <INDENT> session = Session() <NEW_LINE> dep = session.query(Department1c.id).filter(Department1c.name == arg['department']).first() <NEW_LINE> if not dep: <NEW_LINE> <INDENT> id_dep = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> id_dep = dep[0] <NEW_LINE> <DEDENT> id_positio... | Заповнення базу mysql з 1с працівниками
:param arg: обєкт працівника з 1с
:param status: active/dissmised | 625941f524f1403a9260118f |
def __init__(self, apikey=None, summary=True, max_cache_size=1000, max_cache_time=60, throttle=True): <NEW_LINE> <INDENT> if apikey is None: <NEW_LINE> <INDENT> print('Using public VT API Key: Please set apikey=<your key> when creating this class') <NEW_LINE> <DEDENT> pub_vt_apikey = 'ab0933e5b4d8032031bbce54b4170453e6... | VTQuery Init | 625941f55510c4643540fa02 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.