code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def tail(self, irc, msg, args, optlist, optlog): <NEW_LINE> <INDENT> optlog = optlog.lower() <NEW_LINE> singleline, lines = False, 10 <NEW_LINE> if optlist: <NEW_LINE> <INDENT> for (k, v) in optlist: <NEW_LINE> <INDENT> if k == 'singleline': <NEW_LINE> <INDENT> singleline = True <NEW_LINE> <DEDENT> if k == 'n': <NEW_LI... | [--singleline --n=# of lines] <logfile>
Tail's the last 10 messages from a logfile. Execute listlogs command for a list of logs available.
Ex: main | 625941efd486a94d0b98e6b1 |
def get_comments_nums(self): <NEW_LINE> <INDENT> all_lessons = Comment.objects.filter(aid=self.id).all() <NEW_LINE> return all_lessons.count() | 获取评论数量 | 625941efe1aae11d1e74a227 |
def upload(client, file_name_local, file_name_cloud): <NEW_LINE> <INDENT> logger.info('uploading file {}'.format(file_name_local)) <NEW_LINE> client.item(drive='me', id='root').children[file_name_cloud].upload(file_name_local) | Upload given local file to cloud
:param client:
onedrive client
:param file_name_local: str
path to local file
:param file_name_cloud:
cloud path of uploaded file
:return: | 625941efadb09d7d5db6ccf7 |
def execute(self): <NEW_LINE> <INDENT> self.evaluated = None <NEW_LINE> self.recorders.append(ListCaseRecorder()) <NEW_LINE> try: <NEW_LINE> <INDENT> super(CaseIteratorDriver, self).execute() <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> self.evaluated = self.recorders.pop().get_iterator() | Evaluate cases from `iterator` and place in `evaluated`. | 625941ef7b25080760e399c0 |
def compute_loss(self, batch): <NEW_LINE> <INDENT> glob_feat = self._forward(batch) <NEW_LINE> cont = 1 - batch['is_base_frame'] <NEW_LINE> cont_loss = self.cont_cls.compute_loss(glob_feat, cont) <NEW_LINE> lang_loss = self.inst_selector.compute_loss(glob_feat, batch['inst_idx']) <NEW_LINE> assert_eq(cont_loss.size(), ... | used for pre-training the model with dataset
| 625941efe76e3b2f99f3ad6d |
def get_edge_cluster_state(self, edge_cluster_id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.get_edge_cluster_state_with_http_info(edge_cluster_id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.get... | Get the Realized State of a Edge Cluster # noqa: E501
Return realized state information of a edge cluster. Any configuration update that affects the edge cluster can use this API to get its realized state by passing a request_id returned by the configuration change operation. e.g. Update configuration of edge cluster... | 625941eff9cc0f698b140b61 |
def grad(x, rv) -> None: <NEW_LINE> <INDENT> rv[:] = 0 <NEW_LINE> for i, ((e1, e2), kind, val) in enumerate(constraints): <NEW_LINE> <INDENT> cost = costs[kind] <NEW_LINE> x1 = x[ixs[e1] : ixs[e1 + 1]] <NEW_LINE> args = [x1.copy(), geoms[e1], x0s[e1]] <NEW_LINE> if e2 is not None: <NEW_LINE> <INDENT> x2 = x[ixs[e2] : i... | Gradient of the cost function | 625941efad47b63b2c50a4ea |
def obtain_price_change(self, symbol): <NEW_LINE> <INDENT> asset = Asset(symbol, full=True) <NEW_LINE> price = self.price_result.get(symbol, None) <NEW_LINE> newPrice = price["price"] <NEW_LINE> current_feed = self.get_my_current_feed(asset) <NEW_LINE> if current_feed and "settlement_price" in current_feed: <NEW_LINE> ... | Store the price change to your previous feed
| 625941efbe383301e01b59e6 |
def disburse_cash(username, current_balance, amount_to_withdraw): <NEW_LINE> <INDENT> user_balance = current_balance - amount_to_withdraw <NEW_LINE> print("Disbursing ${}".format(amount_to_withdraw)) <NEW_LINE> print("Remaining Balance is ${}".format(user_balance)) <NEW_LINE> print("Ending transaction.") | Give requested amount of cash to user... This is called after all checks are done | 625941ef851cf427c661aa75 |
def get_user_id(self, details, response): <NEW_LINE> <INDENT> return details['email'] | Return user unique id provided by service. For google user email
is unique enought to flag a single user. Email comes from schema:
http://axschema.org/contact/email | 625941efd10714528d600255 |
def __init__(self): <NEW_LINE> <INDENT> with open('./.blkchnmsg/contract', 'r') as f: <NEW_LINE> <INDENT> self.addr = f.readline().strip() <NEW_LINE> self.addr_2 = f.readline() <NEW_LINE> <DEDENT> compiled = compile_files(['./../contract/contracts/BlckChnMsgStorage.sol']) <NEW_LINE> compiled_manager = compile_files([".... | Sets up Ethereum interaction variables and compiles the contract, allowing web3 to call functions directly. | 625941ef8c3a87329515892c |
def get_alert(self, current=0, minimum=0, maximum=100, highlight_zero=True, is_max=False, header="", action_key=None, log=False): <NEW_LINE> <INDENT> if not highlight_zero and current == 0: <NEW_LINE> <INDENT> return 'DEFAULT' <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> value = (current * 100) / maximum <NEW_LINE> <DE... | Return the alert status relative to a current value.
Use this function for minor stats.
If current < CAREFUL of max then alert = OK
If current > CAREFUL of max then alert = CAREFUL
If current > WARNING of max then alert = WARNING
If current > CRITICAL of max then alert = CRITICAL
If highlight=True than 0.0 is highli... | 625941ef63b5f9789fde7651 |
def report_state(self, jury_state): <NEW_LINE> <INDENT> copied_js = copy.deepcopy(jury_state) <NEW_LINE> self._game_controller.jury_states.append(copied_js) | Saves jury states to array | 625941eff7d966606f6aa576 |
def go(self): <NEW_LINE> <INDENT> cmdline = self._get_cmdline() <NEW_LINE> subp.run_with_timer( cmdline, self.timeout, self.program, stdout=os.devnull) <NEW_LINE> self._remove_temp_file() <NEW_LINE> if not os.path.exists(self.outfile): <NEW_LINE> <INDENT> open(self.outfile, 'w').close() <NEW_LINE> <DEDENT> return GDBfi... | Generates gdb output for <program> <cmd_args> into <outfile>.
If gdb fails to complete before <timeout>,
attempt to _kill gdb and program.
@return: a GDBfile object with the parsed results | 625941ef0a366e3fb873ed8b |
def printAtomFEP(atom, alchemical=False): <NEW_LINE> <INDENT> if alchemical: <NEW_LINE> <INDENT> lj_A = 2.0*(atom.sigma_B**6)*math.sqrt(atom.epsilon_B) <NEW_LINE> lj_B = 2.0*(atom.sigma_B**3)*math.sqrt(atom.epsilon_B) <NEW_LINE> type_q = atom.type_q_B <NEW_LINE> mass = atom.mass_B <NEW_LINE> <DEDENT> else: <NEW_LINE> <... | Generate atom line if FEP
Parameters
----------
atom : Atom class
Atom object
alchemical : bool, optional
If alchemical data, by default False
Returns
-------
atomLine : str
Atom line data | 625941ef8e71fb1e9831dd12 |
def isVisible(self, shape): <NEW_LINE> <INDENT> return self.visible.get(shape, True) | Returns True if the shape is visible.
:param shape: The shape object
:return: True if the shape object is visible. False otherwise. | 625941ef56b00c62f0f14bc8 |
def _get_order_lines(self, cr, uid, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> record_ids = context and context.get('active_ids', False) <NEW_LINE> if record_ids: <NEW_LINE> <INDENT> order_line_ids = [] <NEW_LINE> line_plan_obj = self.pool.get('analytic.b... | Returns the order lines associated to the analytic accounts selected. | 625941ef435de62698dfe1b8 |
def wait_for_element_clickable(self, locator, locator_type="id", timeout=10, poll_frequency=0.5): <NEW_LINE> <INDENT> element = None <NEW_LINE> try: <NEW_LINE> <INDENT> by_type = self.get_by_type(locator_type) <NEW_LINE> self.log.debug("Waiting max " + str(timeout) + " seconds for element to be clickable. Locator:" + ... | Wait for an element to become clickable
:param locator: Unique identifier for the element to be found
:param locator_type: Type of locator being passed (default "id")
:param timeout: Period to wait for the element
:param poll_frequency: Period to check if element visible
:returns: Located element | 625941efd99f1b3c44c67af0 |
def warn(self, _code_or_warning=None, message=None, code=None): <NEW_LINE> <INDENT> if message is None: <NEW_LINE> <INDENT> if _code_or_warning is None: <NEW_LINE> <INDENT> raise ValueError("code_or_warning must be given") <NEW_LINE> <DEDENT> self._std_warn(_code_or_warning) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT... | Issue a warning for this item.
Warnings will be displayed after the test session, unless explicitly suppressed.
This can be called in two forms:
**Warning instance**
This was introduced in pytest 3.8 and uses the standard warning mechanism to issue warnings.
.. code-block:: python
node.warn(PytestWarning("som... | 625941ef4e4d5625662d493b |
def ftp_download_directory(server, username, password, basepath, destination, port=None): <NEW_LINE> <INDENT> ftp = ftplib.FTP() <NEW_LINE> ftp.connect(server, port) <NEW_LINE> ftp.login(username, password) <NEW_LINE> def _recursive_ftp_download(sourcepath): <NEW_LINE> <INDENT> original_dir = ftp.pwd() <NEW_LINE> try: ... | Function to recursively download an entire directory structure over FTP. | 625941efa17c0f6771cbe5ba |
def _convertReturn(self, value): <NEW_LINE> <INDENT> return value | Return the same value.
This method is required to keep the code clean.
Args:
values (any): Value to return.
Returns:
any: Not modified value.
| 625941efaad79263cf390fb5 |
def unset_processor_affinity(self): <NEW_LINE> <INDENT> return _vocoder_swig.cvsd_encode_sb_sptr_unset_processor_affinity(self) | unset_processor_affinity(cvsd_encode_sb_sptr self) | 625941ef31939e2706e4d3cd |
def loginPage(request): <NEW_LINE> <INDENT> return render(request,'login.html') | 登录页面
:return: | 625941ef71ff763f4b549c01 |
def has_target(prefix, target): <NEW_LINE> <INDENT> query = {'nsmeta-id': prefix_map[prefix], 'norm': target.lower()} <NEW_LINE> if restapi_db.nsvalues.find_one(query): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False | Get whether the target of a synonym is in MongoDB. | 625941ef9b70327d1c4e1343 |
def upload_userdata(self, attachment_content, attachment_name=None, **ignore): <NEW_LINE> <INDENT> action = const.ACTION_UPLOAD_USERDATA_ATTACHMENT <NEW_LINE> valid_keys = ['attachment_content', 'attachment_name'] <NEW_LINE> body = filter_out_none(locals(), valid_keys) <NEW_LINE> if not self.req_checker.check_params(bo... | Action:UploadUserDataAttachment
@param attachment_content: base64 encoded string
@param attachment_name: file name | 625941ef3539df3088e2e8b7 |
@view_config(renderer='annotran:templates/annotran_help.html.jinja2', route_name='annotran_help') <NEW_LINE> @view_config(renderer='annotran:templates/annotran_help.html.jinja2', route_name='annotran_onboarding') <NEW_LINE> def help_page(request): <NEW_LINE> <INDENT> current_route = request.matched_route.name <NEW_LINE... | Render the help page for annotran
:param request: the current request
:return: a context for the template | 625941ef7c178a314d6ef9d4 |
def test_parse_response_series_1(): <NEW_LINE> <INDENT> import pandas as pd <NEW_LINE> from io import StringIO <NEW_LINE> s = (',,P,MV,VO\n@AAPL,1999-12-31,3.6719,16540.47,40952.8\n@AAPL,2000-01-03,3.9978,18008.5,133932.3\n' '@AAPL,2000-01-04,3.6607,16490.2,127909.5\n@AAPL,2000-01-05,3.7143,16760.53,194426.3\n' '@AAPL,... | Parse response as a series | 625941ef3617ad0b5ed68462 |
def get_test(self, urlname, urlkwargs=None, params=None, success_expected=True, **kwargs): <NEW_LINE> <INDENT> params = params or {} <NEW_LINE> response = self.client.get(reverse_lazy(urlname, kwargs=urlkwargs), params, **kwargs) <NEW_LINE> if success_expected: <NEW_LINE> <INDENT> self.assertTrue(status.is_success(resp... | Submit a GET request and assert the response status code is 200
Arguments:
urlname (str): The url name to pass to the 'reverse_lazy' function
urlkwargs (dict): The `kwargs` parameter to pass to the `reverse_lazy` function | 625941ef30bbd722463cc335 |
def send_demo_reply_now(request, itemTable, keyWordTable, eventTable): <NEW_LINE> <INDENT> if dsh_django_request.deny_it(request): <NEW_LINE> <INDENT> return views.please_log_in() <NEW_LINE> <DEDENT> response = views.page_header('send a demo reply now') <NEW_LINE> sessionID = dsh_common_db.make_dsh_uid() <NEW_LINE> suc... | 10/04/09: called by views.send_demo_reply_now() | 625941efd6c5a102081445bb |
def test_escolhe_casa_sem_peca_selecionada(self): <NEW_LINE> <INDENT> self.app.build_base(self.gui) <NEW_LINE> m = self.app.mao1 <NEW_LINE> t = self.app.tabuleiro <NEW_LINE> c = t.casas[0] <NEW_LINE> c.escolhida() <NEW_LINE> self.assertEquals(c.peca,None) | nada acontece, nenhuma peca pode ser movida para a casa. | 625941ef1b99ca400220b01f |
def Dispose(self): <NEW_LINE> <INDENT> pass | Dispose(self: FamilyPointLocation,A_0: bool) | 625941ef76e4537e8c351be3 |
def add_source(self, multi_cmd): <NEW_LINE> <INDENT> self.sources.append(multi_cmd) | Adds a new multi command to the chain dispatcher. | 625941ef0fa83653e4657523 |
def atualiza_estilos_cover(portal_setup): <NEW_LINE> <INDENT> record = '{0}.styles'.format(ICoverSettings.__identifier__) <NEW_LINE> old_styles = api.portal.get_registry_record(record) <NEW_LINE> new_styles = set([ 'Amarelo|amarelo', 'Azul Claro - borda|azul-claro-borda', 'Azul Claro Saude|azul-claro', 'Azul Escuro Tur... | Atualiza estilos da configuração do collective.cover caso os mesmos
tenham sido perdidos. Ver:
https://github.com/collective/collective.cover/issues/465 | 625941ef090684286d50f25a |
@app.route('/addstock/<name>/<int:amount>', methods=['GET']) <NEW_LINE> def addstock(name, amount=1): <NEW_LINE> <INDENT> if type(amount) is not int or amount <= 0: <NEW_LINE> <INDENT> return 'ERROR' <NEW_LINE> <DEDENT> sql = """SELECT amount FROM stock WHERE product_name = '{}';""".format(name) <NEW_LINE> try: <NEW_LI... | 在庫の追加
:param name:
:param amount:
:return: None | 625941ef046cf37aa974d2ad |
def empty(self, i3s_output_list, i3s_config): <NEW_LINE> <INDENT> response = { 'cached_until': time() + self.cache_timeout, 'full_text': '' } <NEW_LINE> return response | This method will return an empty text message
so it will NOT be displayed on your i3bar.
If you want something displayed you should write something
in the 'full_text' key of your response.
See the i3bar protocol spec for more information:
http://i3wm.org/docs/i3bar-protocol.html | 625941ef9c8ee82313fbbce3 |
def create_books(db, reader): <NEW_LINE> <INDENT> con = sqlite3.connect(db) <NEW_LINE> cur = con.cursor() <NEW_LINE> cur.execute('''CREATE TABLE Books(id TEXT, title TEXT, author TEXT)''') <NEW_LINE> for line in reader: <NEW_LINE> <INDENT> data = line.split(',') <NEW_LINE> if len(data) > 1: <NEW_LINE> <INDENT> cur.exec... | Create and populate the Books table with
the data from the open file data_file. | 625941ef656771135c3ebde1 |
def fast_lucas(n): <NEW_LINE> <INDENT> def fast_lucas_helper(n,memo): <NEW_LINE> <INDENT> if n in memo: <NEW_LINE> <INDENT> return memo[n] <NEW_LINE> <DEDENT> elif n == 0: <NEW_LINE> <INDENT> result = 2 <NEW_LINE> <DEDENT> elif n == 1: <NEW_LINE> <INDENT> result = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result ... | Returns the nth Lucas number using the memoization technique
shown in class and lab. The Lucas numbers are as follows:
[2, 1, 3, 4, 7, 11, ...] | 625941ef24f1403a926010cd |
def test_soil_bulk_density_01(self): <NEW_LINE> <INDENT> item = get_single_element_json('soil_bulk_density', 14, self) <NEW_LINE> self.assertTrue(item['sample_id']) | Is the /soil_bulk_density endpoint returning the expected number of fields? | 625941efcad5886f8bd27544 |
def test_get_valid_single_course(self): <NEW_LINE> <INDENT> url = "/courses/" + str(self.newCourse1.pk) <NEW_LINE> request = self.factory.get(url) <NEW_LINE> serializer = CourseSerializer(self.newCourse1) <NEW_LINE> course_detail = CourseViewSet.as_view({'get': 'retrieve'}) <NEW_LINE> response = course_detail(request, ... | Test the api get valid single course. | 625941ef96565a6dacc8fc35 |
def mse(referenceVideoData, distortedVideoData): <NEW_LINE> <INDENT> referenceVideoData = vshape(referenceVideoData) <NEW_LINE> distortedVideoData = vshape(distortedVideoData) <NEW_LINE> assert(referenceVideoData.shape == distortedVideoData.shape) <NEW_LINE> T, M, N, C = referenceVideoData.shape <NEW_LINE> assert C == ... | Computes mean-squared error (MSE).
Both video inputs are compared frame-by-frame to obtain T
MSE measurements.
Parameters
----------
referenceVideoData : ndarray
Reference video, ndarray of dimension (T, M, N, C), (T, M, N), (M, N, C), or (M, N),
where T is the number of frames, M is the height, N is width,
... | 625941ef435de62698dfe1b9 |
def bls_pulse(time, flux, fluxerr, n_bins, segment_size, min_duration, max_duration, detrend_order=3, direction=0, remove_nan_segs=False): <NEW_LINE> <INDENT> if segment_size <= 0.0: <NEW_LINE> <INDENT> raise ValueError("Segment size must be > 0.") <NEW_LINE> <DEDENT> if min_duration <= 0.0: <NEW_LINE> <INDENT> raise V... | Main function for this module; performs the BLS pulse algorithm on the input
lightcurve data, in a vectorized way. Lightcurve should be 0-based if no
detrending is used.
See Kovacs et al. (2002)
:param time: Array of times of observations; nominally in units of days
:type time: numpy.ndarray
:param flux: Array of flu... | 625941ef94891a1f4081c018 |
def __str__(self): <NEW_LINE> <INDENT> x="" <NEW_LINE> for i in range(self._capacity): <NEW_LINE> <INDENT> x+=str((self._array[i]))+" " <NEW_LINE> <DEDENT> return x | prints the array | 625941ef379a373c97cfb0b3 |
def interpreter(self, msg): <NEW_LINE> <INDENT> variables = self.evenement.espaces.variables <NEW_LINE> if "_" in variables: <NEW_LINE> <INDENT> del variables["_"] <NEW_LINE> <DEDENT> if msg.startswith("/"): <NEW_LINE> <INDENT> msg = msg[1:] <NEW_LINE> parties = msg.split(" ") <NEW_LINE> opt = parties[0].lower() <NEW_L... | Méthode d'interprétation du contexte | 625941ef004d5f362079a89b |
def apirequest(self, method='GET', **kwargs): <NEW_LINE> <INDENT> if method.upper() == "GET": <NEW_LINE> <INDENT> return self._get_method(**kwargs) <NEW_LINE> <DEDENT> elif method.upper() == "POST": <NEW_LINE> <INDENT> return self._post_method(**kwargs) <NEW_LINE> <DEDENT> elif method.upper() == "PUT": <NEW_LINE> <INDE... | Send request to class:'request' method object.
:param method: method for the new :class:'request' method object.
this method might be either of 'GET', 'POST', 'PUT', 'PATCH'
and 'DELETE'.
:param **kwargs: Optional arguments that 'request' method method takes. | 625941ef67a9b606de4a8422 |
def list_vlans(self, datacenter=None, vlan_number=None, name=None, **kwargs): <NEW_LINE> <INDENT> _filter = NestedDict(kwargs.get('filter') or {}) <NEW_LINE> if vlan_number: <NEW_LINE> <INDENT> _filter['networkVlans']['vlanNumber'] = query_filter(vlan_number) <NEW_LINE> <DEDENT> if name: <NEW_LINE> <INDENT> _filter['ne... | Display a list of all VLANs on the account.
This provides a quick overview of all VLANs including information about
data center residence and the number of devices attached.
:param string datacenter: If specified, the list will only contain
VLANs in the specified data center.
:param int vl... | 625941ef21a7993f00bc8266 |
def prepare_batch(self): <NEW_LINE> <INDENT> for _, metadata in self.certificates_to_issue.items(): <NEW_LINE> <INDENT> self.certificate_handler.validate_certificate(metadata) <NEW_LINE> <DEDENT> with FinalizableSigner(self.secret_manager) as signer: <NEW_LINE> <INDENT> for _, metadata in self.certificates_to_issue.ite... | Propagates exception on failure
:return: byte array to put on the blockchain | 625941efa934411ee3751c01 |
def add_files(self, type, for_mod, files): <NEW_LINE> <INDENT> if files: <NEW_LINE> <INDENT> table = type + "files" <NEW_LINE> if table in self._tablenames: <NEW_LINE> <INDENT> with self.conn: <NEW_LINE> <INDENT> self.conn.executemany( "INSERT INTO " + table + " VALUES (?, ?)", zip(repeat(for_mod), files)) <NEW_LINE> s... | Record the list of filepaths in the database keyed by the mod
with which they are associated. `type` indicates the context
for the file list.
:param type: a string that is either 'mod', 'missing', or 'hidden'
:param for_mod:
:param files: list of filepaths (as strings) | 625941ef656771135c3ebde2 |
def __register_handler(handler): <NEW_LINE> <INDENT> if issubclass(handler.__class__, Handler): <NEW_LINE> <INDENT> handler_key = handler.get_handler_key() <NEW_LINE> try: <NEW_LINE> <INDENT> handlers[handler_key].append(handler) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> handlers[handler_key] = [handler] | Register the handler (Actor) which is to process signals from [Node]Module or other Actor in chain.
:param handler: object of handler (Actor) to be registered | 625941ef82261d6c526aba14 |
def TrainModel(self, datapath, epoch=2, batch_size=32, load_model=False, filename='model_set/speech_model25'): <NEW_LINE> <INDENT> assert(batch_size%4 == 0) <NEW_LINE> data = DataSpeech(datapath, 'train') <NEW_LINE> num_data = sum(data.DataNum) <NEW_LINE> iterations_per_epoch = max(data.DataNum) // (batch_size//4) + 1 ... | 训练模型
参数:
datapath: 数据保存的路径
epoch: 迭代轮数
save_step: 每多少步保存一次模型
filename: 默认保存文件名,不含文件后缀名 | 625941ef6fece00bbac2dcb2 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ProtoSalesSite.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are y... | Run administrative tasks. | 625941ef7b180e01f3dc4d5d |
def tst_test_find_designation_type03(self) -> Any: <NEW_LINE> <INDENT> return self.execute_sp_row1("call tst_test_find_designation_type03()") | Test for designation type.
:rtype: dict[str,*] | 625941ef377c676e91272713 |
def hide_info(self, context): <NEW_LINE> <INDENT> if self.PostPixelHandle is not None: <NEW_LINE> <INDENT> self.handle_remove(context) | Hides information
:param context: | 625941efeab8aa0e5d26e0c6 |
def check_comp_spec(comp_spec, comp_spec_format): <NEW_LINE> <INDENT> for spec_k, spec_format_v in comp_spec_format.items(): <NEW_LINE> <INDENT> comp_spec_v = comp_spec[spec_k] <NEW_LINE> if ps.is_list(spec_format_v): <NEW_LINE> <INDENT> v_set = spec_format_v <NEW_LINE> assert comp_spec_v in v_set, f'Component spec val... | Base method to check component spec | 625941ef63f4b57ef0001675 |
def _applyTransforms(self, row): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for colname, regex in self.transforms.iteritems(): <NEW_LINE> <INDENT> row[colname] = regex.sub('', row[colname]) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> for colname, regex in self.transforms.items(): <NEW_LINE> <INDENT> row[... | Applies any column value transformations that were defined in the configuration file. | 625941ef23849d37ff7b35f7 |
def log_sending(self, message): <NEW_LINE> <INDENT> raise NotImplementedError() | Log a message that is being sent to device
:param message: The bytes being sent
:type message: bytes
:return: None | 625941efc432627299f051b6 |
def _add_state(self, username, block_key, scope, state): <NEW_LINE> <INDENT> history_list = self._history.setdefault((username, block_key, scope), []) <NEW_LINE> history_list.insert(0, XBlockUserState(username, block_key, state, datetime.now(pytz.utc), scope)) | Add the specified state to the state history of this block. | 625941ef55399d3f05588c24 |
def load(modelfile, probes=None): <NEW_LINE> <INDENT> M = experiment(modelfile, probes) <NEW_LINE> constraints = M[0]._get_penalty <NEW_LINE> if len(M) > 1: <NEW_LINE> <INDENT> return FitProblem(M, constraints=constraints) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return FitProblem(M[0], constraints=constraints) | Load a garefl model file as an experiment.
*modelfile* is a model.so file created from setup.c.
*probes* is a list of datasets to fit to the models in the model file, or
None if the model file provides its own data. | 625941ef4527f215b584c9be |
@pytest.mark.security <NEW_LINE> @pytest.mark.parametrize("cls", CacheLineSize) <NEW_LINE> @pytest.mark.parametrize('max_wb_queue_size', RandomGenerator(DefaultRanges.UINT32, 10)) <NEW_LINE> def test_fuzzy_start_max_queue_size(pyocf_ctx, max_wb_queue_size, c_uint32_randomize, cls): <NEW_LINE> <INDENT> with pytest.raise... | Test whether it is impossible to start cache with invalid dependence between max queue size
and queue unblock size.
:param pyocf_ctx: basic pyocf context fixture
:param max_wb_queue_size: max queue size value to start cache with
:param c_uint32_randomize: queue unblock size value to start cache with
:param cls: cache l... | 625941efd53ae8145f87a7d1 |
def createCombinationSel( self, OutputList, DecayDescriptor, DaughterLists, DaughterCuts = {} , PreVertexCuts = "ALL", PostVertexCuts = "ALL" ) : <NEW_LINE> <INDENT> combiner = CombineParticles( DecayDescriptor = DecayDescriptor, DaughtersCuts = DaughterCuts, MotherCut = PostVertexCuts, CombinationCut = PreVertexCuts, ... | create a selection using a ParticleCombiner with a single decay descriptor | 625941ef76d4e153a657f09e |
def normalize_text(html): <NEW_LINE> <INDENT> return unicodedata.normalize('NFKC', html) | 使用 NFKC 对网页源代码进行归一化,把特殊符号转换为普通符号
:param html:
:return: | 625941ef8a43f66fc4b545cb |
def build_on_start(self, runnable, regime, on_start): <NEW_LINE> <INDENT> on_start_code = [] <NEW_LINE> for action in on_start.actions: <NEW_LINE> <INDENT> code = self.build_action(runnable, regime, action) <NEW_LINE> for line in code: <NEW_LINE> <INDENT> on_start_code += [line] <NEW_LINE> <DEDENT> <DEDENT> return on_s... | Build OnStart start handler code.
:param on_start: OnStart start handler object
:type on_start: lems.model.dynamics.OnStart
:return: Generated OnStart code
:rtype: list(string) | 625941ef4d74a7450ccd4732 |
def unload(self): <NEW_LINE> <INDENT> for action in self.actions: <NEW_LINE> <INDENT> self.iface.removePluginWebMenu( self.tr('&GeoCoding for Korea'), action) <NEW_LINE> self.iface.removeToolBarIcon(action) <NEW_LINE> <DEDENT> del self.toolbar | Removes the plugin menu item and icon from QGIS GUI. | 625941efcb5e8a47e48b800d |
def build_text(shape_number): <NEW_LINE> <INDENT> text = vpython.text(text=get_random_word(), color=get_random_color(), pos=vpython.vector( -config.DISTANCE_BETWEEN_SHAPE + shape_number * config.DISTANCE_BETWEEN_SHAPE, 0, 0), billboard=True, align=ALIGN) <NEW_LINE> return text | creating a text's shape
:param shape_number: the index number of the shape that the text will be inside it
:return: a text's shape object | 625941efbf627c535bc1373c |
def test_hsobel_zeros(): <NEW_LINE> <INDENT> result = F.hsobel(np.zeros((10, 10)), np.ones((10, 10), bool)) <NEW_LINE> assert (np.all(result == 0)) | Horizontal sobel on an array of all zeros | 625941ef1f037a2d8b946769 |
def base_from_filename(filename, split_char=ELT_SPLIT, base_regex=REGEX_BASE): <NEW_LINE> <INDENT> return _base_from_felts( filename_elts_list(filename, split_char), base_regex) | Gets the base A-number (that normal-ordering was done WRT)
from the filename.
Assumes that the base number is the first element (from left to right) that
will be matched by the base_regex.
:param filename: the name of the file
:param split_char: the character that separates file elements
:param base_regex: the regular ... | 625941ef596a89723608a025 |
def sync_watch_status(watched, section, accountTo, userTo, same_server=False): <NEW_LINE> <INDENT> print('Marking watched...') <NEW_LINE> sectionTo = accountTo.library.section(section) <NEW_LINE> for item in watched: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if same_server: <NEW_LINE> <INDENT> fetch_check = sectionT... | Sync watched status between two users.
Parameters
----------
watched: list
List of watched items either from Tautulli or Plex
section: str
Section title of sync from server
accountTo: class
User's account that will be synced to
userTo: str
User's server class of sync to user
same_server: bool
Are s... | 625941ef0fa83653e4657524 |
def clear_banded_columns(self): <NEW_LINE> <INDENT> self.banded_columns.clear() <NEW_LINE> self.show_banded_columns = False | Удаляет все объединенные колонки из грида | 625941ef57b8e32f52483a0b |
def test_read_by_id(client): <NEW_LINE> <INDENT> request = client.get('/api/roles/1') <NEW_LINE> response = json.loads(request.data.decode()) <NEW_LINE> assert request.status_code == 200 <NEW_LINE> assert response['id'] == 1 | Ensure names can be read by their ID | 625941ef30dc7b7665901ecc |
@pytest.fixture <NEW_LINE> def db(request): <NEW_LINE> <INDENT> return request.config.getoption("--db") | Return API secret. | 625941ef462c4b4f79d1dc3c |
def __get_dependencies(root): <NEW_LINE> <INDENT> if root.find(_tag('dependencyManagement')) is None: <NEW_LINE> <INDENT> dependencies = root.find(_tag('dependencies')) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dependencies = root.find(_tag('dependencyManagement')).find(_tag('dependencies')) <NEW_LINE> <DEDENT> if ... | Find all artifact dependencies. | 625941efadb09d7d5db6ccf9 |
def flat_all(self): <NEW_LINE> <INDENT> for sym, pos in self._position_manager.positions.items(): <NEW_LINE> <INDENT> if pos.size != 0: <NEW_LINE> <INDENT> o = OrderEvent() <NEW_LINE> o.full_symbol = sym <NEW_LINE> o.order_size = -pos.size <NEW_LINE> o.source = 0 <NEW_LINE> o.create_time = datetime.now().strftime('%H:%... | flat all according to position_manager
TODO: should turn off all strategies?
:return: | 625941ef26238365f5f0f3e2 |
def archive(thread_url): <NEW_LINE> <INDENT> match = None <NEW_LINE> for cls in Extractor.__subclasses__(): <NEW_LINE> <INDENT> extractor = None <NEW_LINE> if re.match(cls.VALID_URL, thread_url): <NEW_LINE> <INDENT> match = re.match(cls.VALID_URL, thread_url) <NEW_LINE> extractor = cls() <NEW_LINE> <DEDENT> <DEDENT> if... | Get values from the url to create a Thread object.
Passes the thread to parse_html to be download. | 625941ef45492302aab5e836 |
def hand_out_card(self): <NEW_LINE> <INDENT> if self.cards: <NEW_LINE> <INDENT> return self.cards.pop() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Takes the top card, aka the last card in the list of cards and
removes it from the list and returns it.
Returns
-------
bool
Based on success of execution. | 625941ef442bda511e8be97d |
def humannumber2int(bytesize): <NEW_LINE> <INDENT> bytesize = bytesize.lstrip().rstrip() <NEW_LINE> bibytes_regex = re.compile(BIBYTES_PATTERN) <NEW_LINE> match = bibytes_regex.match(bytesize) <NEW_LINE> assert match, "invalid format" <NEW_LINE> number, unit = match.groups() <NEW_LINE> power = BIBYTES.index(unit) <NEW_... | Convert a number such as 8GB or 4MB to an integer (number of bytes) | 625941efd8ef3951e3243aaa |
def __init__(self, jsondict=None, strict=True): <NEW_LINE> <INDENT> self.imagingStudy = None <NEW_LINE> self.series = None <NEW_LINE> self.uid = None <NEW_LINE> self.url = None <NEW_LINE> super(ImagingObjectSelectionStudy, self).__init__(jsondict=jsondict, strict=strict) | Initialize all valid properties.
:raises: FHIRValidationError on validation errors, unless strict is False
:param dict jsondict: A JSON dictionary to use for initialization
:param bool strict: If True (the default), invalid variables will raise a TypeError | 625941ef5e10d32532c5f492 |
def encrypt(self, datagram): <NEW_LINE> <INDENT> assert len(datagram) < self.MAX_LEN <NEW_LINE> encrypted_body = self.box.encrypt(datagram, nonce=self.nonce()) <NEW_LINE> return encrypted_body.ciphertext | SecretBox-encrypt the datagram and return ciphertext | 625941efd7e4931a7ee9e48c |
def __init__(self, size=None, path=None): <NEW_LINE> <INDENT> self.dialogues = [] <NEW_LINE> self.current_dialogue = None <NEW_LINE> self.context = {} <NEW_LINE> self.reviews = {} <NEW_LINE> self.comments = '' <NEW_LINE> self.dialogue_rating = 0 <NEW_LINE> self.path = path <NEW_LINE> if path: <NEW_LINE> <INDENT> self.l... | Initializes the Dialogue Episode Recorder
:param size: size of the experience (how many dialogues to store)
:param path: path to save / load the experience | 625941efbe383301e01b59e7 |
@register.filter(name='alarm_condition_add_on') <NEW_LINE> def alarm_condition_add_on(value): <NEW_LINE> <INDENT> return get_status_value(value, ALERT_CONDITION_ADD_ON) | alarm condition add_on | 625941ef627d3e7fe0d693be |
def test_p1_contains_letter(self): <NEW_LINE> <INDENT> with self.assertRaises(AttributeError): <NEW_LINE> <INDENT> tournament.reportMatch(p1="A", p2=1) | reportMatch() throws if player 1 ID contains letter | 625941eff9cc0f698b140b63 |
def get_single_origin(self, possible_origins, parsed_data): <NEW_LINE> <INDENT> if self.turn%2: <NEW_LINE> <INDENT> friendly = 'White' <NEW_LINE> enemy = 'Black' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> friendly = 'Black' <NEW_LINE> enemy = 'White' <NEW_LINE> <DEDENT> moves = [] <NEW_LINE> parsed_origins = [] <NEW... | This takes a list of the possible origins of the active piece
and attempts to determine if any of them are valid moves. If
only one valid move is found, then a list all the pieces to
move is returned as [ [ [move1_ori_x, move1_ori_y],
[move1_tar_x, move1_tar_y] ],
[ [move2_... | 625941ef7b180e01f3dc4d5e |
def get_online_statuses_provider(test=False): <NEW_LINE> <INDENT> if test: <NEW_LINE> <INDENT> injector = Injector( [OnlineStatusesProvider(), OnlineStatusesProviderTest()]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> injector = Injector(OnlineStatusesProvider()) <NEW_LINE> <DEDENT> return injector.get(PynamoDBOnline... | Returns OnlineStatuses client based on enviroment | 625941efb545ff76a8914383 |
def copy(self): <NEW_LINE> <INDENT> self.id = list(self.id) <NEW_LINE> cpy = Slab(c = self.c, slab_oc = self.slab_oc,T_factor=self.T_factor) <NEW_LINE> for i in range(len(self.id)): <NEW_LINE> <INDENT> cpy.add_atom(str(self.id[i]), str(self.el[i]), self.x[i], self.y[i], self.z[i], self.u[i], self.oc[i], self.m[i]) <NEW... | Returns a copy of the object.
| 625941ef63b5f9789fde7653 |
def fileProperties(self, listVar): <NEW_LINE> <INDENT> MainFunctions.propertiesWindow = QtGui.QDialog() <NEW_LINE> uiColors = CustomUi.UiColors() <NEW_LINE> self.ui = PropertiesWindow.PropertiesPopUp(MainFunctions.propertiesWindow, listVar, uiColors.interfaceColor, MainFunctions.currentMode, MainFunctions.database, Mai... | Open file properties | 625941ef009cb60464c6391a |
def checkVersionAndClearConflict(self, logger: logging.Logger = None): <NEW_LINE> <INDENT> raise NotImplementedError("Function not implemented yet.") | Checks the version of the server and the version in the database and clears every compatibility issue.
No return value but raise exception if it fails.
:param logger: | 625941ef3eb6a72ae02eca5a |
def p_py_m_expression_2(p): <NEW_LINE> <INDENT> p[0] = p[1] + ' ' + p[2] + ' ' + p[3] | py_m_expression : py_m_expression py_binary_operator py_u_expression | 625941ef293b9510aa2c37fd |
def get_mysql_root_password(): <NEW_LINE> <INDENT> return _get_password("mysql", "root") | The root password for the mysql service. | 625941ef15fb5d323cde1085 |
def add_ace(self, ace): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._validate_ace(ace) <NEW_LINE> <DEDENT> except OnepIllegalArgumentException as e: <NEW_LINE> <INDENT> raise e <NEW_LINE> <DEDENT> if not ace._acl == None: <NEW_LINE> <INDENT> raise OnepIllegalArgumentException('Ace already added to an Acl') <NEW_L... | Add a L3 Access Control Element(ACE) to the L3 Access Control List(ACL).
Already added L3-ACE cannot be added in the same L3-ACL again.
@param ace: L3 ACE instance to be added in L3 ACL.
@type ace: L{L3Ace<onep.policy.L3Ace.L3Ace>}
@raise OnepIllegalArgumentException: If ace/ace parameter is invalid.
@raise ... | 625941ef3346ee7daa2b32de |
def get_hoststatus(self, host_name): <NEW_LINE> <INDENT> if self.data is None: <NEW_LINE> <INDENT> self.parse() <NEW_LINE> <DEDENT> for i in self.data['hoststatus']: <NEW_LINE> <INDENT> if i.get('host_name') == host_name: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> raise ValueError(host_name) | Returns a dictionary derived from status.dat for one particular contact
Returns:
dict
Raises:
ValueError if object is not found | 625941ef627d3e7fe0d693bf |
def add_image_set(self, match): <NEW_LINE> <INDENT> images = re.findall(self.guide.regex_list['image']['regex'], match.group('images'), flags=re.MULTILINE) <NEW_LINE> num_images = len(images) <NEW_LINE> small_count = min(num_images, 2) <NEW_LINE> medium_count = min(num_images, 3) <NEW_LINE> large_count = min(num_images... | Creates an image block grid for viewing a large number of images | 625941ef44b2445a339325ff |
def product_count(self): <NEW_LINE> <INDENT> product_items = InvoiceProducts.objects.filter(invoice=self).count() <NEW_LINE> return product_items | Devolver la quantity de productos adquiridos | 625941ef796e427e537b0b38 |
def __init__(self, sys=None): <NEW_LINE> <INDENT> super(Space, self).__init__(sys) <NEW_LINE> self.name = None | Space constructor.
:param sys: dict containing the resource's remote system attributes.
:return: Space instance. | 625941ef63d6d428bbe44a5e |
def test_view_can_get_all_services(self): <NEW_LINE> <INDENT> self.create_org() <NEW_LINE> self.create_program() <NEW_LINE> service_res = self.client().post( '/api/organizations/1/programs/1/services/', data=self.service_data) <NEW_LINE> res = self.client().get('/api/organizations/1/programs/1/services/') <NEW_LINE> se... | Test that the view can handle GET request for all existing
services. | 625941effff4ab517eb2f9ad |
def make_grayscale_map(image, drawable): <NEW_LINE> <INDENT> if pdb.gimp_image_base_type(image) == GRAY : <NEW_LINE> <INDENT> return image, drawable <NEW_LINE> <DEDENT> original_selection = pdb.gimp_selection_save(image) <NEW_LINE> pdb.gimp_selection_all(image) <NEW_LINE> pdb.gimp_edit_copy(drawable) <NEW_LINE> if orig... | Make a grayscale copy for a map.
Maps must be same size as their parent image.
If image is already grayscale, return it without copying.
Maps don't need a selection, since the resynthesizer looks at parent drawables for the selection. | 625941ef435de62698dfe1ba |
def get_model(self, app_label, model_name, seed_cache=True, only_installed=True): <NEW_LINE> <INDENT> if seed_cache: <NEW_LINE> <INDENT> self._populate() <NEW_LINE> <DEDENT> if only_installed and app_label not in self.app_labels: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if (self.available_apps is not None an... | Returns the model matching the given app_label and case-insensitive
model_name.
Returns None if no model is found.
Raises UnavailableApp when set_available_apps() in in effect and
doesn't include app_label. | 625941ef507cdc57c6307255 |
def check_latest_version(): <NEW_LINE> <INDENT> if not cfg.version_check(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> current, testver = convert_version(sabnzbd.__version__) <NEW_LINE> if not current: <NEW_LINE> <INDENT> logging.debug("Unsupported release number (%s), will not check", sabnzbd.__version__) <NEW_LIN... | Do an online check for the latest version
Perform an online version check
Syntax of online version file:
<current-final-release>
<url-of-current-final-release>
<latest-alpha/beta-or-rc>
<url-of-latest-alpha/beta/rc-release>
The latter two lines are only present when an alpha/beta/rc is available.
Formu... | 625941ef8a349b6b435e86e0 |
def testBasicInterfaceWithParamAndKeywordsInConstructor(self): <NEW_LINE> <INDENT> bifaceWPK = BasicInterfaceWithParamAndKeywordsInConstructor(None, keyword=None) <NEW_LINE> self.assertTrue(hasattr(bifaceWPK, DBUS_INJECTED_ATTRS.dbus_interface_info_at)) <NEW_LINE> dbus_interface_info = getattr(bifaceWPK, DBUS_INJECTED_... | test simple interface that receives a param and keyword param | 625941ef293b9510aa2c37fe |
def wait_for_key_response(): <NEW_LINE> <INDENT> timeout = 30.0 <NEW_LINE> while len(key_input) < 20 and timeout > 0: <NEW_LINE> <INDENT> logging.debug("Waiting for encryption key...") <NEW_LINE> sleep(0.25) <NEW_LINE> timeout -= 0.25 <NEW_LINE> <DEDENT> if timeout == 0: <NEW_LINE> <INDENT> logging.error( "Error: timeo... | Wait for full key from notifications with 30 second timeout | 625941efde87d2750b860306 |
@library.global_function <NEW_LINE> @jinja2.contextfunction <NEW_LINE> @takes_article_page <NEW_LINE> def get_article_url(context, article, page): <NEW_LINE> <INDENT> return escape(article._get_permalink_for_page(page)) | Renders the URL for an article. | 625941ef26238365f5f0f3e3 |
def getTestMethod(vb): <NEW_LINE> <INDENT> def testMethod(self): <NEW_LINE> <INDENT> buildParseTree(vb) <NEW_LINE> <DEDENT> return testMethod | Create a test method | 625941ef31939e2706e4d3cf |
@register.filter(name='getNextDept') <NEW_LINE> def all_dept_node(pid): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return Department.objects.filter(parent_id=pid).values('id', 'deptname', 'parent_id') <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return None | 部门节点
:param pk:
:return: | 625941ef23849d37ff7b35f8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.