code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def run_e2e_test(bucket_name, s3): <NEW_LINE> <INDENT> s3.delete_objects( Bucket=bucket_name, Delete={ 'Objects': [ { 'Key': 'app_runner/input/test.zip' }, { 'Key': 'app_runner/input/test_ec2.log' }, { 'Key': 'app_runner/input/test_app.log' } ] } ) <NEW_LINE> with open('test.csv', 'w') as file: <NEW_LINE> <INDENT> file...
Runs an end-to-end test.
625941e14a966d76dd5513bb
def req(self): <NEW_LINE> <INDENT> ADMIN = current.session.s3.system_roles.ADMIN <NEW_LINE> settings = current.deployment_settings <NEW_LINE> use_commit = lambda i: settings.get_req_use_commit() <NEW_LINE> req_items = lambda i: "Stock" in settings.get_req_req_type() <NEW_LINE> req_skills = lambda i: "People" in setting...
REQ / Request Management
625941e1796e427e537b0971
def GetDerivativeWeights(self): <NEW_LINE> <INDENT> return _itkDisplacementFieldJacobianDeterminantFilterPython.itkDisplacementFieldJacobianDeterminantFilterIVF33D_GetDerivativeWeights(self)
GetDerivativeWeights(self) -> double
625941e1d164cc61757830f8
def get_empd_master_repo(): <NEW_LINE> <INDENT> wait_for_empd_master() <NEW_LINE> if not osp.exists(DATADIR): <NEW_LINE> <INDENT> with lock_empd_master(): <NEW_LINE> <INDENT> url = "https://github.com/EMPD2/EMPD-data.git" <NEW_LINE> print("Cloning the EMPD-data repository from " + url) <NEW_LINE> git.Repo.clone_from(ur...
Get the repository to the data directory and download it if necessary This function returns a :class:`git.Repo` instance for the :attr:`DATADIR`. Returns ------- git.Repo The local repository of the EMPD-data. If necessary, it has been cloned from https://github.com/EMPD2/EMPD-data.git.
625941e1f7d966606f6aa3b2
def collate_fn(data): <NEW_LINE> <INDENT> def merge(sequences): <NEW_LINE> <INDENT> lengths = [len(seq) for seq in sequences] <NEW_LINE> padded_seqs = torch.ones(len(sequences), max(lengths)).long() <NEW_LINE> for i, seq in enumerate(sequences): <NEW_LINE> <INDENT> end = lengths[i] <NEW_LINE> padded_seqs[i, :end] = seq...
Creates mini-batch tensors from the list of tuples (src_seq, trg_seq). We should build a custom collate_fn rather than using default collate_fn, because merging sequences (including padding) is not supported in default. Seqeuences are padded to the maximum length of mini-batch sequences (dynamic padding). Args: dat...
625941e1bde94217f3683196
def reverse(self, x): <NEW_LINE> <INDENT> pos = True <NEW_LINE> if x < 0: <NEW_LINE> <INDENT> pos = False <NEW_LINE> x = -x <NEW_LINE> <DEDENT> t = 0 <NEW_LINE> while x != 0: <NEW_LINE> <INDENT> t = t * 10 + x % 10 <NEW_LINE> x /= 10 <NEW_LINE> <DEDENT> if not pos: <NEW_LINE> <INDENT> return -t <NEW_LINE> <DEDENT> retu...
:type x: int :rtype: int
625941e1d10714528d600090
def process_test_execution(content_metadata, custom_metadata, test_execution): <NEW_LINE> <INDENT> event = create_test_execution_event(content_metadata, custom_metadata, test_execution) <NEW_LINE> sys.stdout.write(json.dumps(event))
Processes single CircleCI test execution. Creates GAIA code_testrun event and writes it on STDOUT. Caller is responsible for sending the data to message gateway.
625941e17b25080760e39800
def __init__(self, max_atoms=-1, out_size=-1, add_Hs=False): <NEW_LINE> <INDENT> super(GINPreprocessor, self).__init__(add_Hs=add_Hs) <NEW_LINE> if max_atoms >= 0 and out_size >= 0 and max_atoms > out_size: <NEW_LINE> <INDENT> raise ValueError('max_atoms {} must be less or equal to ' 'out_size {}'.format(max_atoms, out...
initialize the GTN Preprocessor. :param max_atoms: integer, Max number of atoms for each molecule, if the number of atoms is more than this value, this data is simply ignored. Setting negative value indicates no limit for max atoms. :param out_size: integer, It specifies the size of array returned by `...
625941e1851cf427c661a8b5
def find_original(burst_i, ind_burst, clique_word, whole_tweets, dates_, accumulated_num, terms_stop): <NEW_LINE> <INDENT> max_count = 0 <NEW_LINE> max_ind = 0 <NEW_LINE> for i in range(accumulated_num[list(ind_burst.keys())[burst_i]], accumulated_num[list(ind_burst.values())[burst_i]+1]): <NEW_LINE> <INDENT> count_ap...
find the original tweets according to the clique words input: burst_i: the ith burst in the dictionnary ind_burst: a dictionnary indicating the burst burst and the burst end by funtion find_burst clique_word: the words in the clique ... output: max_count: how many words are matched in the clique and the original twee...
625941e1925a0f43d254a223
def IfExpr(ig): <NEW_LINE> <INDENT> pio.NextItem(ig) <NEW_LINE> condition = Expr(ig) <NEW_LINE> if not Expect(exp.THENWord,ig): return '' <NEW_LINE> alt1 = Expr(ig) <NEW_LINE> if not Expect(exp.ELSEWord,ig): return '' <NEW_LINE> alt2 = Expr(ig) <NEW_LINE> if not Expect(exp.FIWord,ig): return '' <NEW_LINE> return exp.Op...
parse if expression
625941e18e71fb1e9831db51
def _clean_pending_exits(self, pending_exits): <NEW_LINE> <INDENT> pending_exits_to_remove = [] <NEW_LINE> for simrun_key, pe in pending_exits.iteritems(): <NEW_LINE> <INDENT> if pe.returning_source is None: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> func = self.kb.functions.function(pe.returning_source) <NEW_LIN...
Remove those pending exits if: a) they are the return exits of non-returning SimProcedures b) they are the return exits of non-returning syscalls c) they are the return exits of non-returning functions :param pending_exits: A dict of all pending exits
625941e1f8510a7c17cf9aa8
def templatePath(self): <NEW_LINE> <INDENT> return 'modules/gci/conversations/_cell.html'
See soc.views.template.Template.templatePath for full specification.
625941e18da39b475bd65321
def get(self): <NEW_LINE> <INDENT> images = Image.all() <NEW_LINE> images.order("-date") <NEW_LINE> logout = users.create_logout_url("/") <NEW_LINE> context = { "images": images, "logout": logout, } <NEW_LINE> path = os.path.join(os.path.dirname(__file__), 'templates', 'index.html') <NEW_LINE> self.response.out.write(t...
Responds to GET requets with the admin interface
625941e11b99ca400220ae5c
def test_call_for_bid(self): <NEW_LINE> <INDENT> requisition = self._create_requisition() <NEW_LINE> for line in requisition.line_ids: <NEW_LINE> <INDENT> self.assertEqual( line.activity_id, line.purchase_request_lines.activity_id, 'Activity in requisition line not equal to its ' 'reference in purchase request line')
Create Call for Bid Activity should be passed correctly
625941e1be8e80087fb20fe6
def update(current, new): <NEW_LINE> <INDENT> for key, value in new.items(): <NEW_LINE> <INDENT> if isinstance(value, dict): <NEW_LINE> <INDENT> result = update(current.get(key, {}), value) <NEW_LINE> current[key] = result <NEW_LINE> <DEDENT> elif new[key] is not None: <NEW_LINE> <INDENT> current[key] = new[key] <NEW_L...
Recursively merge or update dictionaries. :rapam current: `dict` for update. :param new: `dict` updater. :returns: updated `dict`.
625941e14f6381625f114de5
def build_inlinepatterns(md_instance, **kwargs): <NEW_LINE> <INDENT> inlinePatterns = odict.OrderedDict() <NEW_LINE> inlinePatterns["backtick"] = BacktickPattern(BACKTICK_RE) <NEW_LINE> inlinePatterns["escape"] = EscapePattern(ESCAPE_RE, md_instance) <NEW_LINE> inlinePatterns["reference"] = ReferencePattern(REFERENCE_R...
Build the default set of inline patterns for Markdown.
625941e1ad47b63b2c50a328
def _process_rc_event(self, data, chan): <NEW_LINE> <INDENT> if data.msg_type == "edit": <NEW_LINE> <INDENT> if "N" in data.flags: <NEW_LINE> <INDENT> event = "page" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> event = "edit" <NEW_LINE> if "B" in data.flags: <NEW_LINE> <INDENT> event = "bot edit" <NEW_LINE> <DEDENT> i...
Processes an individual line from the recent changes server.
625941e10a366e3fb873ebc6
def _get_valid_targets(user, user_rank, allTargets, ladder): <NEW_LINE> <INDENT> challengables = [] <NEW_LINE> user_arrow = user_rank.arrow <NEW_LINE> user_nrank = user_rank.rank <NEW_LINE> up_distance = ladder.up_arrow <NEW_LINE> dn_distance = ladder.down_arrow <NEW_LINE> if user_arrow == Rank.ARROW_UP : <NEW_LINE> <I...
Takes a Rank QueryObject and returns a list of challengable ranks in the ladder. You are allowed to challenge if: - User is on the ladder. (checked beforehand) - User has no open challenges in this ladder. - User's (/w ▲) target is within current rank - UPARROW range. - User's (/w ▼) target is within c...
625941e12ae34c7f2600d4da
def _load_data(cached_file): <NEW_LINE> <INDENT> file_name, file_type = os.path.splitext(cached_file) <NEW_LINE> loader = None <NEW_LINE> if file_type == '.json': <NEW_LINE> <INDENT> loader = json <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> loader = yaml <NEW_LINE> <DEDENT> with salt.utils.fopen(cached_file) as fhr: ...
Given a pillar_name and the template cache location, attempt to load the defaults.json from the cache location. If it does not exist, try defaults.yaml.
625941e14d74a7450ccd456d
def pop(self): <NEW_LINE> <INDENT> record = self.db.crawling_queue.find_and_modify( query={'status': self.OUTSTANDING}, update={'$set': {'status': self.PROCESSING, 'timestamp': datetime.now()}} ) <NEW_LINE> if record: <NEW_LINE> <INDENT> return record['_id'], record['depth'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
Get an outstanding URL from the queue and set its status to processing. If the queue is empty a KeyError exception is raised.
625941e1d7e4931a7ee9e2c8
def islink(self, path): <NEW_LINE> <INDENT> return self.filesystem.islink(path)
Determine if path identifies a symbolic link. Args: path: Path to filesystem object. Returns: `True` if path points to a symbolic link. Raises: TypeError: if path is None.
625941e1287bf620b61d3e0b
def get_data(name='small_64D'): <NEW_LINE> <INDENT> if name == 'small_64D': <NEW_LINE> <INDENT> fbvals = pjoin(THIS_DIR, 'small_64D.bvals.npy') <NEW_LINE> fbvecs = pjoin(THIS_DIR, 'small_64D.gradients.npy') <NEW_LINE> fimg = pjoin(THIS_DIR, 'small_64D.nii') <NEW_LINE> return fimg, fbvals, fbvecs <NEW_LINE> <DEDENT> if ...
provides filenames of some test datasets or other useful parametrisations Parameters ---------- name : str the filename/s of which dataset to return, one of: 'small_64D' small region of interest nifti,bvecs,bvals 64 directions 'small_101D' small region of interest nifti,bvecs,bvals 101 directions 'anis...
625941e1507cdc57c630708c
def p_expression_group(p): <NEW_LINE> <INDENT> p[0] = (p[2], p[1], p[3])
expression : LPAREN expression RPAREN
625941e1f548e778e58cd929
def degree_on_basis(self, m): <NEW_LINE> <INDENT> if m[0] in self._central_elements: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return self._weights[self._index_to_pos[m[0]]] + m[1]
Return the degree of the basis element indexed by ``m`` in ``self``. EXAMPLES:: sage: V = lie_conformal_algebras.Virasoro(QQ) sage: V.degree_on_basis(('L',2)) 4
625941e1711fe17d8254270c
def __process_feature__(featureCluster, parameters, means): <NEW_LINE> <INDENT> if (len(featureCluster) == 1): <NEW_LINE> <INDENT> return featureCluster <NEW_LINE> <DEDENT> if (means): <NEW_LINE> <INDENT> tmpData = featureCluster.iloc[:, -parameters['numSamples'] : ].copy() <NEW_LINE> nonZeroIndices = numpy.where(tmpDa...
Correct retention time misalignment in the given feature cluster. Keyword Arguments: featureCluster -- frames with the same feature cluster ID parameters -- LipidFinder's PeakFilter parameters instance means -- perform the correction over mean columns instead of each samp...
625941e1a8370b7717052c47
def slidingwindow(m, n, xss): <NEW_LINE> <INDENT> return performmerge(xss, m, n, False, True)
Interleave n tracks from m playlists.
625941e101c39578d7e751e5
@click.command() <NEW_LINE> def main(args=None): <NEW_LINE> <INDENT> click.echo("Replace this message by putting your code into " "unitheme.cli.main") <NEW_LINE> click.echo("See click documentation at http://click.pocoo.org/") <NEW_LINE> return 0
Console script for unitheme.
625941e1a4f1c619b28b03da
def sw_selHalActiveClick(self): <NEW_LINE> <INDENT> if self.dlg_sw.cb_selHalActive.isChecked(): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> anz = self.dlg_sw.lw_hal_entw.count() <NEW_LINE> for i in range(anz): <NEW_LINE> <INDENT> item = self.dlg_sw.lw_hal_entw.item(i) <NEW_LINE> self.dlg_sw.l...
Reagiert auf Checkbox zur Aktivierung der Auswahl
625941e13617ad0b5ed682a0
def get_dialed_digits_grid_last_modified_date(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.logger.info('Start: get dialed digits grid last modified date') <NEW_LINE> return self._buy_page.get_dialed_digits_grid_last_modified_date() <NEW_LINE> <DEDENT> except WebDriverException as exp: <NEW_LINE> <INDENT> se...
Returning get dialed digits grid last modified date Implementing logging for get dialed digits grid last modified date functionality :return: last modified date
625941e1e76e3b2f99f3abb0
def makefolders(directory, docket_no, primary_on, supporting_on, comments_on): <NEW_LINE> <INDENT> comment_path = "" <NEW_LINE> primary_path = "" <NEW_LINE> supporting_path = "" <NEW_LINE> if sum([comments_on,primary_on,supporting_on]) == 3: <NEW_LINE> <INDENT> path = os.path.join(directory, docket_no) <NEW_LINE> <DEDE...
Makes folders for the docket number. Creates folders for the docket number based on type of documents requested. If only one type of document is requested, only one folder is created with the folder name being the docket number. If multiple types are requested, a head directory (name = docket number_'selected types')...
625941e130dc7b7665901d0c
def _shrink_right(self, state): <NEW_LINE> <INDENT> for l in range(-len(state), 1): <NEW_LINE> <INDENT> yield tuple(state[l:])
Shrink a state towards the right, until it is empty.
625941e144b2445a3393243d
def add_overtime_hours(my, main_div): <NEW_LINE> <INDENT> row_div = FloatDivWdg() <NEW_LINE> main_div.add(row_div) <NEW_LINE> process_div = _get_div(my.process_len) <NEW_LINE> process_div.add("overtime hours") <NEW_LINE> row_div.add(process_div) <NEW_LINE> for i in TimecardWdg.WEEK_CALENDAR: <NEW_LINE> <INDENT> div = ...
draw the unregistered hours
625941e14e4d5625662d477d
def add_wizard_programm_uninstall_page(Wizard, lProgramms, *args, **kwargs): <NEW_LINE> <INDENT> packages = Wizard.getInstallLogManager().load_packages() <NEW_LINE> programms = [] <NEW_LINE> if packages: <NEW_LINE> <INDENT> dProgramms = dict([(prg.get('programm', prg.get('name', '-')), prg) for prg in lProgramms]) if l...
Добавить страницу инсталляции программ в визард. @param Wizard: Объект главного визарда. @param lProgramms; Описание инсталлируемы/Деинсталлируемых программ. @return: Созданный объект страницы или None в случае ошибки.
625941e11f5feb6acb0c4ef3
def testScanVolumeSystemRootOnMBR(self): <NEW_LINE> <INDENT> test_path = self._GetTestFilePath(['mbr.raw']) <NEW_LINE> self._SkipIfPathNotExists(test_path) <NEW_LINE> test_mediator = TestVolumeScannerMediator() <NEW_LINE> test_scanner = volume_scanner.VolumeScanner(mediator=test_mediator) <NEW_LINE> test_options = volu...
Tests the _ScanVolumeSystemRoot function on MBR.
625941e1462c4b4f79d1da79
def write_fortran(self,f): <NEW_LINE> <INDENT> f.write('{} \n'.format(self.val))
Write data to fortran file, with file descriptor f
625941e1ac7a0e7691ed446f
def create_subdomain(self, pool_id, gateway_id, subdomain, addresses=None, **metadata): <NEW_LINE> <INDENT> if not addresses: <NEW_LINE> <INDENT> gateway = j.sal.zosv2._explorer.gateway.get(gateway_id) <NEW_LINE> addresses = [j.sal.nettools.getHostByName(ns) for ns in gateway.dns_nameserver] <NEW_LINE> <DEDENT> reserva...
creates an A record pointing to the specified addresses if no addresses are specified, the record will point the gateway IP address (used for exposing solutions)
625941e156ac1b37e6264573
def infix_to_postfix(expr): <NEW_LINE> <INDENT> prec = {'*': 2, '/': 2, '+': 1, '-': 1} <NEW_LINE> ops = Stack() <NEW_LINE> postfix = [] <NEW_LINE> toks = expr.split() <NEW_LINE> for t in toks: <NEW_LINE> <INDENT> flag = True <NEW_LINE> while flag: <NEW_LINE> <INDENT> if t.isdigit(): <NEW_LINE> <INDENT> postfix.append(...
Returns the postfix form of the infix expression found in `expr`
625941e14e696a04525c97f6
@reactive.when_not('storpool-inventory.configured') <NEW_LINE> @reactive.when('storpool-inventory.collected') <NEW_LINE> @reactive.when('storpool-inventory.submitting') <NEW_LINE> @reactive.when_not('storpool-inventory.submitted') <NEW_LINE> def nowhere_to_submit_to(): <NEW_LINE> <INDENT> rdebug('collected some data, b...
Note that we still need the `submit_url` parameter to be set.
625941e13317a56b86939ffa
def set_APIKey(self, value): <NEW_LINE> <INDENT> super(ListAllEventsInputSet, self)._set_input('APIKey', value)
Set the value of the APIKey input for this Choreo. ((required, string) The API Key provided by Stripe)
625941e129b78933be1e5a51
def p_class_body_declarations(p): <NEW_LINE> <INDENT> if(len(p)==2): <NEW_LINE> <INDENT> p[0] = Node('class_body_declarations', [p[1]], None, None, None, p[1].code) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = Node('class_body_declarations' , [p[1],p[2]], None, None, None, p[1].code + p[2].code)
class_body_declarations : class_body_declaration | class_body_declarations class_body_declaration
625941e1e8904600ed9f22dc
def remove_digit_from_int(self, number, digit): <NEW_LINE> <INDENT> number_char_list = list(str(number)) <NEW_LINE> number_char_list.remove(digit) <NEW_LINE> answer = int(''.join(number_char_list)) <NEW_LINE> return answer
returns integer representing number with digit removed :param number: int :param digit: char :return: answer - int that is number with digit removed
625941e17d43ff24873a304d
def on_open_or_save_file(self, event, printTo, inputType): <NEW_LINE> <INDENT> if inputType == "Terrain": <NEW_LINE> <INDENT> dlg = wx.DirDialog(self, style=wx.DD_DIR_MUST_EXIST, defaultPath=os.getcwd(), message="Select an ESRI Grid or TIN container " "(directory in which are saved raster/vector " "files representing ...
Description: Create and show the Open or Save File/Directory Dialog. Arguments: (TextCtrl) printTo: - TextCtrl where the selected file will be displayed (string) inputType: - string that is used to set appropriate wildcard - 'Config', 'Terrain', 'Layer_F', Layer_D, 'Output' Returns: (string) path to sele...
625941e1236d856c2ad44b89
def __init__(self): <NEW_LINE> <INDENT> self.Pid = None
:param Pid: SCTE-35 `Pid`. Note: this field may return null, indicating that no valid values can be obtained. :type Pid: int
625941e199fddb7c1c9de739
def add_vserver_group_backend_servers(self, **kwargs): <NEW_LINE> <INDENT> return self.get_status_new(self.build_request_params(self.format_slb_request_kwargs(**self.format_request_kwargs(**kwargs))))
add vserver group backend servers :type vserver_group_id: string :param vserver_group_id: Unique identifier for the virtual server group :type backend_servers: list :param backend_servers:Backend server list :return: return the vserver group object
625941e150812a4eaa59c6c8
def test_create_topic_no_post(db_conn, users_table, topics_table, posts_table, session): <NEW_LINE> <INDENT> request = { 'params': { 'topic': { 'name': 'An entity', 'entity': { 'kind': 'unit', 'id': 'dfgh4567' }, } }, 'cookies': { 'session_id': session, }, 'db_conn': db_conn } <NEW_LINE> code, response = routes.topic.c...
Expect create topic to fail without post.
625941e1cdde0d52a9e533e0
def get_directory(self, path): <NEW_LINE> <INDENT> self._assert_db_is_initialized() <NEW_LINE> if path[0] == os.sep: <NEW_LINE> <INDENT> if not path.startswith(self.get_path()): <NEW_LINE> <INDENT> raise NotmuchError(STATUS.FILE_ERROR, message="Database().get_directory() called " "with a wrong absolute path.") <NEW_LIN...
Returns a :class:`Directory` of path, (creating it if it does not exist(?)) .. warning:: This call needs a writeable database in :attr:`Database.MODE`.READ_WRITE mode. The underlying library will exit the program if this method is used on a read-only database! :param path: An unicode string containing the path ...
625941e1d58c6744b4258008
def _check_fit_params(X, fit_params, indices=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from sklearn.utils.validation import _check_fit_params as _sklearn_check_fit_params <NEW_LINE> return _sklearn_check_fit_params(X, fit_params, indices) <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> ...
Check and validate the parameters passed during `fit`. Parameters ---------- X : array-like of shape (n_samples, n_features) Data array. fit_params : dict Dictionary containing the parameters passed at fit. indices : array-like of shape (n_samples,), default=None Indices to be selected if the parameter h...
625941e1d18da76e23532884
def list_user_participants(self, appointment_group, **kwargs): <NEW_LINE> <INDENT> from canvasapi.appointment_group import AppointmentGroup <NEW_LINE> from canvasapi.user import User <NEW_LINE> appointment_group_id = obj_or_id( appointment_group, "appointment_group", (AppointmentGroup,) ) <NEW_LINE> return PaginatedLis...
List user participants in this appointment group. :calls: `GET /api/v1/appointment_groups/:id/users <https://canvas.instructure.com/doc/api/appointment_groups.html#method.appointment_groups.users>`_ :param appointment_group: The object or ID of the appointment group. :type appointment_group: :class:`canvasapi...
625941e18e71fb1e9831db52
def action(self, colony): <NEW_LINE> <INDENT> if self.realqueen == False: <NEW_LINE> <INDENT> Insect.reduce_armor(self, self.armor) <NEW_LINE> <DEDENT> elif self.realqueen == True: <NEW_LINE> <INDENT> ScubaThrower.action(self, colony) <NEW_LINE> current_place = self.place.exit <NEW_LINE> while current_place != None: <N...
A queen ant throws a leaf, but also doubles the damage of ants in her tunnel. Impostor queens do only one thing: reduce their own armor to 0.
625941e1b57a9660fec33c33
def tinyurl(self,url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tiny_url = "http://tinyurl.com/api-create.php?url={0}".format(url) <NEW_LINE> page = requests.get(tiny_url).text <NEW_LINE> return page <NEW_LINE> <DEDENT> except: raise UrlShortenError("Unable to shorten the following url - {0}".format(url))
Makes shortened url with tinyurl
625941e130bbd722463cc172
def fetch_parameter(self, name, with_decryption=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> response = self.client.get_parameter( Name=name, WithDecryption=with_decryption ) <NEW_LINE> return response['Parameter']['Value'] <NEW_LINE> <DEDENT> except self.client.exceptions.ParameterNotFound: <NEW_LINE> <INDENT>...
Gets a Parameter from Parameter Store (Returns the Value)
625941e155399d3f05588a60
def add_task_to_diagram(self, process_id, task_name=""): <NEW_LINE> <INDENT> return self.add_flow_node_to_diagram(process_id, consts.Consts.task, task_name)
Adds a Task element to BPMN diagram. User-defined attributes: - name Returns a tuple, where first value is task ID, second a reference to created object. :param process_id: string object. ID of parent process, :param task_name: string object. Name of task.
625941e13346ee7daa2b3118
def _describe_certs(parsed_certs, parse_failures): <NEW_LINE> <INDENT> out = [] <NEW_LINE> notify = out.append <NEW_LINE> if not parsed_certs and not parse_failures: <NEW_LINE> <INDENT> notify("No certs found.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if parsed_certs: <NEW_LINE> <INDENT> notify("Found the followi...
Print information about the certs we know about
625941e17c178a314d6ef810
def __init__(self, cfg, analysis): <NEW_LINE> <INDENT> self.analysis = analysis(cfg) <NEW_LINE> self.cfg = cfg
Fixed point analysis analysis must be a dataflow analysis containing a 'fixpointmethod' method that analyzes one CFG node
625941e1d53ae8145f87a614
def next(self): <NEW_LINE> <INDENT> self.list_player.next()
Skip to next track in playlist.
625941e1566aa707497f490e
def __init__(self, X_l, L_l, X_u, random_generator, ** kw): <NEW_LINE> <INDENT> self.__random_generator = random_generator <NEW_LINE> if X_l.shape[1] > X_u.shape[1]: <NEW_LINE> <INDENT> X_u = sparse.hstack([X_u, sparse.coo_matrix(X_u.shape[0], X_l.shape[1] - X_u.shape[1])]) <NEW_LINE> <DEDENT> elif X_l.shape[1] < X_u.s...
Intializes the S3VM optimizer.
625941e199fddb7c1c9de73a
def get_score(self): <NEW_LINE> <INDENT> score = 1 if self.is_complete() else 0 <NEW_LINE> return {'score': score, 'total': self.max_score()}
0 / 1 based on whether student has gotten far enough.
625941e173bcbd0ca4b2c420
def _import_module(self, plugin, suffix='plugin'): <NEW_LINE> <INDENT> linecache.clearcache() <NEW_LINE> if plugin in self._module_cache: <NEW_LINE> <INDENT> module = reload(self._module_cache[plugin]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> module = importlib.import_module( '%s.%s.%s' % (self._plugin_module_impo...
Given a plugin name, will import it from its directory or reload it. Returns: The module that was loaded.
625941e191af0d3eaac9bdc6
def get_or_create_index(self, type, name, config=None): <NEW_LINE> <INDENT> if name not in self._indexes[type]: <NEW_LINE> <INDENT> self.get_indexes(type) <NEW_LINE> <DEDENT> if name in self._indexes[type]: <NEW_LINE> <INDENT> return self._indexes[type][name] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if type == Nod...
Fetch a specific index from the current database, returning an :py:class:`Index` instance. If an index with the supplied `name` and content `type` does not exist, one is created with either the default configuration or that supplied in `config`:: # get or create a node index called "People" people = graph_db.g...
625941e1b5575c28eb68e3ae
def isOverlapping(self, otherline): <NEW_LINE> <INDENT> if self.dir != otherline.dir: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if otherline in self.overlaps or self in otherline.overlaps: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> intersect = set(self.points).intersection(set(otherline.points)) <NE...
Checks whether 2 lines ovelaps :param Line otherline: :return:boolean
625941e13539df3088e2e6f5
def as_matrix(self): <NEW_LINE> <INDENT> R = self.rot.as_matrix() <NEW_LINE> t = np.reshape(self.trans, (self.dim - 1, 1)) <NEW_LINE> bottom_row = np.append(np.zeros(self.dim - 1), 1.) <NEW_LINE> return np.vstack([np.hstack([R, t]), bottom_row])
Return the matrix representation of the rotation.
625941e15166f23b2e1a5503
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.header is None: <NEW_LINE> <INDENT> self.header = std_msgs.msg.Header() <NEW_LINE> <DEDENT> if self.status is None: <NEW_LINE> <INDENT> self.status = actionlib_msgs.msg.GoalStatus() <NEW_LINE> <DEDENT> if self.feedback is None...
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
625941e157b8e32f52483848
def __delete_price_notify(ids): <NEW_LINE> <INDENT> with Mysql.pool as db: <NEW_LINE> <INDENT> cursor = db.cursor <NEW_LINE> cursor.execute('delete from jb_price_notify where id in %s', (ids, )) <NEW_LINE> db.conn.commit()
通知成功后,删除价格提醒设置 :param ids: list :return:
625941e144b2445a3393243e
def get_listenpriority(self): <NEW_LINE> <INDENT> return self.options['listenpriority']
Use this parameter to specify the priority for listen policy of CS Vserver. Default value: 101 Minimum value = 0 Maximum value = 100
625941e13346ee7daa2b3119
def peek(self): <NEW_LINE> <INDENT> return self._queue[0]
Peek.
625941e18a349b6b435e851d
def csr_tocsc(*args): <NEW_LINE> <INDENT> return _csr.csr_tocsc(*args)
csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, int Bp, int Bi, signed char Bx) csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, int Bp, int Bi, unsigned char Bx) csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, int Bi, short Bx) csr_tocsc(int n_row, int ...
625941e18da39b475bd65322
def unmount_volume(target_path): <NEW_LINE> <INDENT> if os.path.ismount(target_path): <NEW_LINE> <INDENT> execute(UNMOUNT_CMD, target_path)
Unmount a Volume
625941e110dbd63aa1bd2f4d
def test_get_realtime_breakdown(self): <NEW_LINE> <INDENT> pass
Test case for get_realtime_breakdown Get Real-Time Breakdown # noqa: E501
625941e171ff763f4b549a3d
def calPEHistory(ID, startDate, endDate=None): <NEW_LINE> <INDENT> if startDate is None: <NEW_LINE> <INDENT> startDate = datetime.strptime('19900101', '%Y%m%d').date() <NEW_LINE> <DEDENT> assert len(ID) == 9, '指数代码错误, 正确格式:000010.SH' <NEW_LINE> ID = ID.upper() <NEW_LINE> if endDate is None: <NEW_LINE> <INDENT> endDate ...
计算某一指数的TTMPE :param ID: 长格式的指数代码,如: 000010.SH :param startDate: :param endDate: :return:
625941e1e64d504609d74bea
def set_management_snmp(enabled=True, deploy=False): <NEW_LINE> <INDENT> if enabled is True: <NEW_LINE> <INDENT> value = "no" <NEW_LINE> <DEDENT> elif enabled is False: <NEW_LINE> <INDENT> value = "yes" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> CommandExecutionError("Invalid option provided for service enabled opti...
Enables or disables the SNMP management service on the device. CLI Example: Args: enabled (bool): If true the service will be enabled. If false the service will be disabled. deploy (bool): If true then commit the full candidate configuration, if false only set pending change. .. code-block:: bash salt ...
625941e1fff4ab517eb2f7e9
def VAE(input_shape=[None, 784], n_filters=[64, 64, 64], filter_sizes=[4, 4, 4], n_hidden=32, n_code=2, activation=tf.nn.tanh, convolutional=False, variational=False): <NEW_LINE> <INDENT> x = tf.placeholder(tf.float32, input_shape, 'x') <NEW_LINE> with tf.variable_scope('encoder'): <NEW_LINE> <INDENT> encoding = encode...
Summary Parameters ---------- input_shape : list, optional Description n_filters : list, optional Description filter_sizes : list, optional Description n_hidden : int, optional Description n_code : int, optional Description activation : TYPE, optional Description convolutional : bool, optional ...
625941e14c3428357757c6d1
def setUpModule(): <NEW_LINE> <INDENT> global hass <NEW_LINE> hass = get_test_home_assistant() <NEW_LINE> assert setup.setup_component( hass, http.DOMAIN, {http.DOMAIN: {http.CONF_API_PASSWORD: API_PASSWORD, http.CONF_SERVER_PORT: SERVER_PORT}}) <NEW_LINE> assert setup.setup_component(hass, 'frontend') <NEW_LINE> hass....
Initialize a Home Assistant server.
625941e1cc40096d61595cfa
def death_screen(self): <NEW_LINE> <INDENT> self.end_time = 1 <NEW_LINE> self.sound.fadeout(4000) <NEW_LINE> self.loser_txt = "GAME OVER" <NEW_LINE> self.loser_text = self.font.render(self.loser_txt, True, white)
Fonction qui affiche l'écran de défaite
625941e1d164cc61757830fa
@run_if('GOOGLE_APPS') <NEW_LINE> def create_folder_with_permissions(parent_id, folder_name, permissions=None): <NEW_LINE> <INDENT> service = Service(settings.GOOGLE_P12_PATH, settings.GOOGLE_SERVICE_EMAIL) <NEW_LINE> folder = service.insert_folder(folder_name, parent_id) <NEW_LINE> if folder is None: <NEW_LINE> <INDEN...
Create drive folder in the specified location with given permissions.
625941e167a9b606de4a8262
def _reconstruct_tuple(self, node): <NEW_LINE> <INDENT> tuple_param = () <NEW_LINE> for child in node: <NEW_LINE> <INDENT> if self._is_parameter(child): <NEW_LINE> <INDENT> tuple_param += (child,) <NEW_LINE> <DEDENT> elif isinstance(child, Tuple): <NEW_LINE> <INDENT> tuple_param += self._reconstruct_tuple(child) <NEW_L...
Reconstructs the tuple structure but with dictionary as children.
625941e10a50d4780f667240
def model_fn(features, labels, mode, params): <NEW_LINE> <INDENT> is_training = mode == tf.estimator.ModeKeys.TRAIN <NEW_LINE> landmarks = network(features, is_training, num_landmarks=params['num_landmarks']) <NEW_LINE> if mode == tf.estimator.ModeKeys.PREDICT: <NEW_LINE> <INDENT> predictions = {'landmarks': landmarks}...
This is a function for creating a tensorflow computational graph. The function is in the format required by tf.estimator.
625941e13cc13d1c6d3c7723
def translate_gene(self, gene): <NEW_LINE> <INDENT> if self.signed: <NEW_LINE> <INDENT> sign = 1 if gene.dna[0] == '0' else -1 <NEW_LINE> base_start_idx = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sign = 1 <NEW_LINE> base_start_idx = 0 <NEW_LINE> <DEDENT> base = sign * int(gene.dna[base_start_idx:base_start_idx +...
Translate a gene with binary DNA into a base-10 floating point real number. Parses the DNA in this manner: 1. The first bit determines the sign of the integer portion of the result (0=positive, 1=negative) 2. The next ``significand_length`` bits of the DNA are converted into a base-10 integer, and given a pos...
625941e19b70327d1c4e1181
def edit(self, cred_uuid, cred_name=None, description=None, permissions=None, ad_hoc=None, **settings): <NEW_LINE> <INDENT> current = self.details(cred_uuid) <NEW_LINE> payload = { 'name': self._check('cred_name', cred_name, str, default=current['name']), 'description': self._check('description', description, str, defa...
Creates a new managed credential. :devportal:`credentials: create <credentials-create>` Args: ad_hoc (bool, optional): Determins whether the credential is managed (``False``) or an embedded credential in a scan or policy (``True``). cred_name (str, optional): The name of the credential...
625941e1ab23a570cc250530
def get(self): <NEW_LINE> <INDENT> config = {} <NEW_LINE> for name in self: <NEW_LINE> <INDENT> config[name] = self[name].get() <NEW_LINE> <DEDENT> return config
Get the configuration without performing the read operation.
625941e1f9cc0f698b1409a3
def forwards(self, orm): <NEW_LINE> <INDENT> for organisation in orm.Organisation.objects.all(): <NEW_LINE> <INDENT> name_metaphones = dm(organisation.name) <NEW_LINE> organisation.name_metaphone = name_metaphones[0] <NEW_LINE> organisation.save()
Write your forwards methods here.
625941e163d6d428bbe4489b
def detach_object(self, arm_name, object_id): <NEW_LINE> <INDENT> obj = AttachedCollisionObject() <NEW_LINE> obj.object.header.stamp = rospy.Time.now() <NEW_LINE> obj.object.header.frame_id = 'base_link' <NEW_LINE> obj.link_name = self.hands[arm_name].attach_link <NEW_LINE> obj.object.id = object_id <NEW_LINE> obj.obje...
Detaches a single object from the arm and removes it from the collision space entirely. **Args:** **arm_name (string):** The arm ('left_arm' or 'right_arm') from which to detach the object **object_id (string):** The ID of the object to detach
625941e192d797404e304536
def get_character_reputations_summary( self, region, namespace, realm_slug, character_name, **filters ): <NEW_LINE> <INDENT> filters['namespace'] = namespace <NEW_LINE> resource = 'profile/wow/character/{0}/{1}/reputations' <NEW_LINE> params = [realm_slug, character_name] <NEW_LINE> return self.get_resource(resource, r...
Character Reputations API - Returns a summary of a character's reputations
625941e16fece00bbac2daed
def test_message_partial_delete(self): <NEW_LINE> <INDENT> doc = helpers.get_message_body(messagecount=3) <NEW_LINE> result = http.post(self.message_url, self.header, doc) <NEW_LINE> self.assertEqual(result.status_code, 201) <NEW_LINE> location = result.headers['Location'] <NEW_LINE> url = self.cfg.base_server + locati...
Delete Messages will be partially successful.
625941e1004d5f362079a6dc
def diff_staged(self): <NEW_LINE> <INDENT> return execute(['git', 'diff', '--cached', '--no-color', '--no-ext-diff'])[0]
Returns the output of `git diff --cached`, which is the diff for staged changes. Raises a `GitDiffError` if `git diff` outputs anything to stderr.
625941e18a349b6b435e851e
def check_metadata_org_changes(change_list: ChangeList, old: Data, new: Data): <NEW_LINE> <INDENT> if old.get(u'title') != new.get(u'title'): <NEW_LINE> <INDENT> _title_change(change_list, old, new) <NEW_LINE> <DEDENT> if old.get(u'description') != new.get(u'description'): <NEW_LINE> <INDENT> _description_change(change...
Compares two versions of a organization and records the changes between them in change_list.
625941e1cc0a2c11143dd23c
def get_tables_from_model_url(url, base_url='https://www.epa.gov'): <NEW_LINE> <INDENT> url = (base_url if 'https://' not in url else '') + url <NEW_LINE> html_doc = requests.get(url).content.decode('utf-8', 'ignore') <NEW_LINE> soup = bs4.BeautifulSoup(html_doc, 'html.parser') <NEW_LINE> for s in soup.select('area'): ...
Takes in a url and recursively scrapes page for area html elements for subsequent pages and table API references to compile a list of tables and urls. yields output in a tuple of format: { table_name: html alt text (so far always the table name), table_url: link to the table api page, source_url: the page ...
625941e18e71fb1e9831db53
def main(argv): <NEW_LINE> <INDENT> path = ' '.join(argv[1:]) <NEW_LINE> if not check_if_folder_is_nuendo_project(path): <NEW_LINE> <INDENT> input("This is not an Nuendo project, please use one of those") <NEW_LINE> return 0 <NEW_LINE> <DEDENT> destination = assemble_destination(path) <NEW_LINE> if LETTER in str(subpro...
Main function
625941e1236d856c2ad44b8a
def reset(self): <NEW_LINE> <INDENT> self.indchar = None <NEW_LINE> self.refs = [] <NEW_LINE> self.skips = set() <NEW_LINE> self.docstring = "" <NEW_LINE> self.ichain_count = 0 <NEW_LINE> self.tre_store_count = 0 <NEW_LINE> self.stmt_lambdas = [] <NEW_LINE> self.bind()
Resets references.
625941e16fece00bbac2daee
def test_constructor(self, layout): <NEW_LINE> <INDENT> gauge_field = core.LatticeColourMatrix(layout, 4) <NEW_LINE> action = fermions.WilsonFermionAction(0.1, gauge_field, [0] * 4)
Test construction of WilsonFermionAction
625941e1f8510a7c17cf9aaa
def shuffle(self) -> List[int]: <NEW_LINE> <INDENT> return random.sample(self.nums, len(self.nums))
Returns a random shuffling of the array.
625941e131939e2706e4d210
def get_pandigital(multiplicand, multiplier, product): <NEW_LINE> <INDENT> check_set = set() <NEW_LINE> identity_string = str(multiplicand) + str(multiplier) + str(product) <NEW_LINE> identity_int = int(identity_string) <NEW_LINE> while identity_int > 0: <NEW_LINE> <INDENT> last = identity_int % 10 <NEW_LINE> check_set...
Return True is n is pandigital
625941e1099cdd3c635f1004
def parse(self, raw): <NEW_LINE> <INDENT> return Encoding.parse(self, raw)
Returns a Python object decoded from a pickle byte stream. .. code-block:: python >>> p = Pickle() >>> p.parse(b'(lp0\nI1\naI2\naI3\naI01\naF4.5\naNaF6000.0\na.') [1, 2, 3, True, 4.5, None, 6000.0] Raises ------ ~ipfsapi.exceptions.DecodingError Parameters ---------- raw : bytes Pickle data bytes R...
625941e1442bda511e8be7be
def count(self): <NEW_LINE> <INDENT> cmd = ("select COUNT(*) from {table} " "{join_clause}{where_clause}{order_clause}").format( table=self.table_name, where_clause=self.where_clause, join_clause=self.join_clause, order_clause=self.order_clause).rstrip() <NEW_LINE> return Repo.db.execute(cmd, self.where_values)
Count the number of records in the table, subject to the query.
625941e1de87d2750b860141
def _filter_search(self, filter_func, order, follow_attrs): <NEW_LINE> <INDENT> order_opts = { "preorder": _preorder_traverse, "postorder": _postorder_traverse, "level": _level_traverse, } <NEW_LINE> try: <NEW_LINE> <INDENT> order_func = order_opts[order] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise V...
Perform a BFS or DFS traversal through all elements in this tree (PRIVATE). :returns: generator of all elements for which ``filter_func`` is True.
625941e1dd821e528d63b551
def transform_source(source): <NEW_LINE> <INDENT> return translate(source, {'function': 'lambda'})
Replaces instances of function by lambda
625941e1187af65679ca54cb
def _param_bit_size(self, fx_group, par_num): <NEW_LINE> <INDENT> pcr = self._pcr[fx_group] <NEW_LINE> lengths = [i[2] for i in pcr if i[3] == par_num] <NEW_LINE> return sum([abs(i) for i in lengths]), any([sign for sign in map(lambda x: x < 0, lengths)])
returns the parameter bit size and sign (tuple(int, bool))
625941e1507cdc57c630708e
def args_kwargs_to_call(args, kwargs): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> for arg in args: <NEW_LINE> <INDENT> if ret: <NEW_LINE> <INDENT> ret.append(", ") <NEW_LINE> <DEDENT> ret.append(repr(arg)) <NEW_LINE> <DEDENT> for k, v in kwargs.iteritems(): <NEW_LINE> <INDENT> if ret: <NEW_LINE> <INDENT> ret.append(", ") ...
Turns args (a list) and kwargs (a dict) into a string that looks like it could be used to call a function with positional and keyword arguments. >>> args_kwargs_to_call([1], {}) '1' >>> args_kwargs_to_call([1,2], {}) '1, 2' >>> args_kwargs_to_call([1], {'foo':'bar'}) "1, foo='bar'"
625941e14d74a7450ccd456f
def verify_thd(conn): <NEW_LINE> <INDENT> metadata = sa.MetaData() <NEW_LINE> metadata.bind = conn <NEW_LINE> changes = sautils.Table('changes', metadata, autoload=True) <NEW_LINE> builds = sautils.Table('builds', metadata, autoload=True) <NEW_LINE> workers = sautils.Table('workers', metadata, autoload=True) <NEW_LINE>...
Can't verify much under SQLite Even with PRAGMA foreign_keys=ON, the cascading deletes are actually ignored with SQLite, so we can't really test the behaviour in that environment.
625941e1d7e4931a7ee9e2ca
def curry_r(f): <NEW_LINE> <INDENT> @func.wraps(f) <NEW_LINE> def curried(*args): <NEW_LINE> <INDENT> if len(args) == arg_n(f): <NEW_LINE> <INDENT> return f(*args) <NEW_LINE> <DEDENT> return lambda *args2: curried(*(args2 + args)) <NEW_LINE> <DEDENT> return curried
Works exactly like curry except this time it appends the arguments from the back i.e f :: (a -> b -> c) called with f(b, c) then f(a) will still be the same as f(a, b, c). This helps to support data first functions when currying. @sig curry_r :: * -> b -> * -> b
625941e1796e427e537b0974
def create_table(conn, sql_create_table): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> c = conn.cursor() <NEW_LINE> c.execute(sql_create_table) <NEW_LINE> <DEDENT> except Error as e: <NEW_LINE> <INDENT> print(e)
create table with given SQL statement conn - connection object sql_create_table - SQL statement
625941e1a219f33f34628d10