code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def set_locs(self, locs): <NEW_LINE> <INDENT> self.locs = locs <NEW_LINE> if len(self.locs) > 0: <NEW_LINE> <INDENT> vmin, vmax = self.axis.get_view_interval() <NEW_LINE> d = abs(vmax - vmin) <NEW_LINE> if self._useOffset: <NEW_LINE> <INDENT> self._compute_offset() <NEW_LINE> <DEDENT> self._set_orderOfMagnitude(d) <NEW...
Set the locations of the ticks.
625941c27cff6e4e8111792e
def load_data_for_datacenter(self, datacenter): <NEW_LINE> <INDENT> if self.config.bulk_load == 'true': <NEW_LINE> <INDENT> nodes = self.inmemory_nodes <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> index, nodes = self.consul_api.catalog.nodes(dc=datacenter) <NEW_LINE> <DEDENT> for node in nodes: <NEW_LINE> <INDENT> sel...
processes all the nodes in a particular datacenter
625941c27b25080760e39402
def add_vertex(self, vertex): <NEW_LINE> <INDENT> if isinstance(vertex, str) or isinstance(vertex, unicode): <NEW_LINE> <INDENT> return self.execute("ADDV", code=vertex) <NEW_LINE> <DEDENT> raise TypeError( 'Vertices should be a code or a list of codes. Got {}'.format( type(vertex) ) )
Add a vertex to solver
625941c273bcbd0ca4b2c01e
def cech(S, R): <NEW_LINE> <INDENT> vr = dionysus.fill_rips(np.array(S), 2, R * 2) <NEW_LINE> vr_complex = [list(s) for s in vr if len(s) <= 3] <NEW_LINE> ch_complex = [] <NEW_LINE> for simplex in vr_complex: <NEW_LINE> <INDENT> s_points = [tuple(S[x]) for x in simplex] <NEW_LINE> mb = miniball.Miniball(s_points) <NEW_...
Computes the cech complex for the given point cloud S with radius parameter R :param S: list of points :param R: radius parameter for the complex :return: dictionary: dimension -> list of simplices (dionysus objects)
625941c231939e2706e4ce15
def test_set_tuple(): <NEW_LINE> <INDENT> context = Context({'ctx1': 'ctxvalue1', 'ctx2': 'ctxvalue2', 'ctx3': 'ctxvalue3', 'set': { 'output': ('k1', 'k2', '{ctx3}', True, False, 44) }}) <NEW_LINE> pypyr.steps.set.run_step(context) <NEW_LINE> output = context['output'] <NEW_LINE> assert output[0] == 'k1' <NEW_LINE> ass...
Simple tuple.
625941c230bbd722463cbd6c
def rreplace(s: str, old: str, new: str, occurrence: int) -> str: <NEW_LINE> <INDENT> li = s.rsplit(old, occurrence) <NEW_LINE> return new.join(li)
Replace first ocurrence from back of string. :param s: :param old: :param new: :param occurrence: :return:
625941c24527f215b584c401
def answer(self, answer): <NEW_LINE> <INDENT> self.__out__(str(answer))
Anwer client Answer something to the user Input: answer: str
625941c2187af65679ca50c6
def import_voc_list(self, fname='HSK_Level_5.txt'): <NEW_LINE> <INDENT> hsk_data = pd.read_csv(fname) <NEW_LINE> for opt in [SCORE_ID, FAV_HDR_ID]: <NEW_LINE> <INDENT> if opt not in hsk_data.columns: <NEW_LINE> <INDENT> print('Create {} column as it didn\'t exist'.format(opt)) <NEW_LINE> hsk_data[opt] = 0 <NEW_LINE> <D...
this function loads the vocabulary list from a given csv file it expects the following format from the file : 'Order','HSK Level-Order','Word','Pronunciation','Definition','score' It will return an array of array ignoring the first 2 columns
625941c215fb5d323cde0ab5
def __init__(self, trans_model, ctx_dep, lex_fst, disambig_syms, opts): <NEW_LINE> <INDENT> super(TrainingGraphCompiler, self).__init__( trans_model, ctx_dep, lex_fst, disambig_syms, opts) <NEW_LINE> self._trans_model = trans_model <NEW_LINE> self._ctx_dep = ctx_dep <NEW_LINE> self._lex_fst = lex_fst
Args: trans_model (TransitionModel): Transition model `H`. ctx_dep (ContextDependency): Context dependency model `C`. lex_fst (StdVectorFst): Lexicon `L`. disambig_syms (List[int]): Disambiguation symbols. opts (TrainingGraphCompilerOptions): Compiler options.
625941c273bcbd0ca4b2c01f
def histogram(self, axis, values, xmin, xmax, step, xlabel, ylabel): <NEW_LINE> <INDENT> gc_min, gc_max = 20, 80 <NEW_LINE> gc_step = 2 <NEW_LINE> axis.hist(values, bins=range(gc_min, gc_max, gc_step), color=(0.5, 0.5, 0.5)) <NEW_LINE> axis.set_xlabel('% GC') <NEW_LINE> axis.set_ylabel('# scaffolds (out of %d)' % len(v...
Create histogram. Parameters ---------- axis : matplotlib.axis Axis on which to render histogram. values : iterable Values from which to create histogram. xmin : float Minimum bin value. xmax : float Maximum bin value. step : float Size of bin. xlabel : str Label for x-axis. ylabel : str Label for y-...
625941c28c0ade5d55d3e961
def test_message(self): <NEW_LINE> <INDENT> self.client.part('#framewirc', message='Leeroy Jenkins!') <NEW_LINE> expected = b'PART #framewirc :Leeroy Jenkins!\r\n' <NEW_LINE> self.client.connection.send.assert_called_with(expected)
If provided with a parting message, pass it on.
625941c24a966d76dd550fb6
def test_cursor_dictionary_buf(self): <NEW_LINE> <INDENT> cur_pure = self.cnx_pure.cursor(dictionary=True, buffered=True) <NEW_LINE> cur_cext = self.cnx_cext.cursor(dictionary=True, buffered=True) <NEW_LINE> self._test_fetchone(cur_pure, cur_cext) <NEW_LINE> self._test_fetchmany(cur_pure, cur_cext) <NEW_LINE> self._tes...
Test results from cursor buffered are the same in pure or c-ext
625941c296565a6dacc8f674
def set_recharge(self, recharge): <NEW_LINE> <INDENT> self.__recharge = recharge
It set the value of the attribute 'recharge'. Represents the number of ms required to recharge the unit for an attack. Args: recharge: the value of the recharge.
625941c20fa83653e4656f64
def delete_group(self, context, group, volumes): <NEW_LINE> <INDENT> if not volume_utils.is_group_a_cg_snapshot_type(group): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> LOG.info("Deleting Group") <NEW_LINE> model_update = {'status': fields.GroupStatus.DELETED} <NEW_LINE> error_statuses = [fields...
Deletes a group. :param context: the context of the caller. :param group: the group object. :param volumes: a list of volume objects in the group. :returns: model_update, volumes_model_update ScaleIO will delete the volumes of the CG.
625941c2de87d2750b85fd39
def ocs_unlock (lock): <NEW_LINE> <INDENT> lock_bin = get_lock_library () <NEW_LINE> lock_id = c_int (int (lock)) <NEW_LINE> status = lock_bin.ocs_unlock (lock_id) <NEW_LINE> if (status != 0): <NEW_LINE> <INDENT> ocslog.log_error (status, "Failed to release {0} lock.".format (lock))
Release an OCS system lock. :param lock: The enumeration for the lock to release.
625941c2e64d504609d747e8
def test_provision_gt_compensable(self): <NEW_LINE> <INDENT> p = Provision(self.vendor.id, provision_function="""(* 2 (.count sold_and_compensated))""") <NEW_LINE> self.assertTrue(p.has_provision, p) <NEW_LINE> self.assertEqual(Decimal("0.00"), p.provision_fix, p) <NEW_LINE> self.assertEqual(Decimal("-20.00"), p.provis...
Provision is higher than average item price -> compensation causes actually vendor to pay.
625941c28c0ade5d55d3e962
def test_nodes(graph): <NEW_LINE> <INDENT> graph.add_node('blah') <NEW_LINE> graph.add_node('whamo') <NEW_LINE> graph.add_node('zeno') <NEW_LINE> assert sorted(graph.nodes()) == ['blah', 'whamo', 'zeno']
Test nodes returns list of all nodes in graph.
625941c28a349b6b435e811c
def test_void_invoice(self): <NEW_LINE> <INDENT> pass
Test case for void_invoice Voids the invoice specified by the invoice identifier parameter.
625941c224f1403a92600b11
def GetDigestFromName(image_name): <NEW_LINE> <INDENT> tag_or_digest = GetDockerImageFromTagOrDigest(image_name) <NEW_LINE> if isinstance(tag_or_digest, docker_name.Digest): <NEW_LINE> <INDENT> return tag_or_digest <NEW_LINE> <DEDENT> def ResolveV2Tag(tag): <NEW_LINE> <INDENT> with v2_image.FromRegistry( basic_creds=Cr...
Gets a digest object given a repository, tag or digest. Args: image_name: A docker image reference, possibly underqualified. Returns: a docker_name.Digest object. Raises: InvalidImageNameError: If no digest can be resolved.
625941c2656771135c3eb815
def get_url(self): <NEW_LINE> <INDENT> return self._url
Get URL for this report
625941c2dd821e528d63b153
def full_like( a: DNDarray, fill_value: Union[int, float], dtype: Type[datatype] = types.float32, split: Optional[int] = None, device: Optional[Device] = None, comm: Optional[Communication] = None, order: str = "C", ) -> DNDarray: <NEW_LINE> <INDENT> return __factory_like(a, dtype, split, full, device, comm, fill_value...
Return a full :class:`~heat.core.dndarray.DNDarray` with the same shape and type as a given array. Parameters ---------- a : DNDarray The shape and data-type of ``a`` define these same attributes of the returned array. fill_value : scalar Fill value. dtype : datatype, optional Overrides the data type of th...
625941c21d351010ab855ac5
def getCacheID(self, pycontext=None): <NEW_LINE> <INDENT> pass
getCacheID([, pycontext]) This will produce a hash of the all colorspace definitions, etc. All external references, such as files used in FileTransforms, etc., will be incorporated into the cacheID. While the contents of the files are not read, the file system is queried for relavent information (mtime, inode) so tha...
625941c201c39578d7e74de4
def __call__(self, obj): <NEW_LINE> <INDENT> if not self.pprint: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return repr(obj) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> stream = StringIO() <NEW_LINE> printer = pretty.RepresentationPrinter(...
Compute the pretty representation of the object.
625941c2d268445f265b4e17
def build(self,category): <NEW_LINE> <INDENT> sub_tree = '<li>'+str(category[0])+':'+category[1]+':'+str(category[2])+':'+str(1 == category[3]) <NEW_LINE> child_categories = self.get_direct_children(category[0]) <NEW_LINE> sub_sub_tree = '' <NEW_LINE> if child_categories: <NEW_LINE> <INDENT> for category in child_categ...
Build the tree recursively.
625941c20383005118ecf58d
def splot(x, y, name='outplot', fmt='-k', xtitle=r'$r$', ytitle=r'$S(R)$'): <NEW_LINE> <INDENT> clf() <NEW_LINE> plot(x, y, fmt) <NEW_LINE> xscale('log') ; yscale('log') <NEW_LINE> xlabel(xtitle) ; ylabel(ytitle) <NEW_LINE> savefig(name+'.png') <NEW_LINE> close('all')
so far plots some quantity S(R)
625941c260cbc95b062c64eb
def isPowerOfTwo(self, n: int) -> bool: <NEW_LINE> <INDENT> if n <= 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return n & (n - 1) == 0
Bit Manipulation time O(1), space O(1)
625941c215baa723493c3f1d
def on_update_toggled(self, renderer, path): <NEW_LINE> <INDENT> iter = self.store.get_iter(path) <NEW_LINE> data = self.store.get_value(iter, LIST_UPDATE_DATA) <NEW_LINE> if data.groups: <NEW_LINE> <INDENT> self.toggle_from_items([item for group in data.groups for item in group.items]) <NEW_LINE> <DEDENT> elif data.gr...
a toggle button in the listview was toggled
625941c27d43ff24873a2c48
@register.function <NEW_LINE> @jinja2.contextfunction <NEW_LINE> def favorites_widget(context, addon, condensed=False): <NEW_LINE> <INDENT> c = dict(context.items()) <NEW_LINE> request = c['request'] <NEW_LINE> if request.user.is_authenticated(): <NEW_LINE> <INDENT> is_favorite = addon.id in request.amo_user.favorite_a...
Displays 'Add to Favorites' widget.
625941c2851cf427c661a4ba
def __init__(self, root_node): <NEW_LINE> <INDENT> self.root_node = root_node
:param root_node: The root node of the parse tree. :type root_node: :class:`booleano.operations.core.OperationNode`
625941c24428ac0f6e5ba79a
def abort(self): <NEW_LINE> <INDENT> with self._lock: <NEW_LINE> <INDENT> if self._state == CREATED: <NEW_LINE> <INDENT> log.debug("%s not started yet", self) <NEW_LINE> self._state = ABORTED <NEW_LINE> <DEDENT> elif self._state == RUNNING: <NEW_LINE> <INDENT> self._state = ABORTING <NEW_LINE> log.info("Aborting %s", s...
Attempt to terminate the child process from another thread. Does not wait for the child process; the thread running this process will wait for the process. The caller must not assume that the operation was aborted when this returns. May be invoked multiple times. Raises: OSError if killing the underlying process...
625941c2566aa707497f4515
def getHelpAndVersionStatus(self): <NEW_LINE> <INDENT> helpflag = False <NEW_LINE> versionflag = False <NEW_LINE> for parameter in sys.argv[1:]: <NEW_LINE> <INDENT> if (parameter == "-?" or parameter == "--help"): <NEW_LINE> <INDENT> helpflag = True <NEW_LINE> <DEDENT> if (parameter == "-V" or parameter == "--version")...
function: get help and version information status input : NA output: helpflag, versionflag
625941c299cbb53fe6792b90
def get_lookup_a_phone_number(self, phone_number, options=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.logger.info('get_lookup_a_phone_number called.') <NEW_LINE> self.logger.info('Preparing query URL for get_lookup_a_phone_number.') <NEW_LINE> _query_builder = Configuration.base_uri <NEW_LINE> _query_build...
Does a GET request to /v1/lookups/phone/{phone_number}. Use the Lookups API to find information about a phone number. A request to the lookups API has the following format: ```/v1/lookups/phone/{phone_number}?options={carrier,type}``` The `{phone_number}` parameter is a required field and should be set to the phone nu...
625941c24e4d5625662d4383
def create_classes(self): <NEW_LINE> <INDENT> classes_name = input('输入要创建的班级名称:').strip() <NEW_LINE> lesson_name = input('输入要关联的课程名称:').strip() <NEW_LINE> if classes_name in self.school_object.school_classes: <NEW_LINE> <INDENT> print('班级已经存在,将自动更新覆盖') <NEW_LINE> self.school_object.add_classes(classes_name,lesson_name...
创建班级,调用school类的add_classes来创建 :return:
625941c2bf627c535bc13177
def main_loop(self): <NEW_LINE> <INDENT> while not self.done: <NEW_LINE> <INDENT> self.event_loop() <NEW_LINE> self.player.update(self.obstacles) <NEW_LINE> self.screen.fill(BACKGROUND_COLOR) <NEW_LINE> self.obstacles.draw(self.screen) <NEW_LINE> self.player.draw(self.screen) <NEW_LINE> pg.display.update() <NEW_LINE> s...
Our main game loop; I bet you'd never have guessed.
625941c23c8af77a43ae3747
def get_stipple_brush(color): <NEW_LINE> <INDENT> color = wx.Colour( (color.Red() + 1) * 1 // 4, (color.Green() + 1) * 1 // 4, (color.Blue() + 1) * 1 // 4, ) <NEW_LINE> rgb = color.GetRGB() <NEW_LINE> if rgb in stipple_brushes: <NEW_LINE> <INDENT> return stipple_brushes[rgb] <NEW_LINE> <DEDENT> image = wx.Image(16, 16,...
Return the stipple bitmap for the given color.
625941c21f037a2d8b9461a7
def update_xray_structure(self, x=None): <NEW_LINE> <INDENT> if not x: x = self.x <NEW_LINE> if self.refine_transformations: <NEW_LINE> <INDENT> self.ncs_restraints_group_list = nu.update_rot_tran( x=x, ncs_restraints_group_list=self.ncs_restraints_group_list) <NEW_LINE> x_ncs = nu.get_ncs_sites_cart(self).as_double() ...
Update xray_structure with refined parameters, then update fmodel object with updated xray_structure.
625941c266656f66f7cbc153
def test_decode_inputs_batch_sync(self): <NEW_LINE> <INDENT> response = inputs._decode_inputs_batch_sync({ "0x1": (TEST_CONTRACT_ABI, TEST_CONTRACT_PARAMETERS), "0x2": (TEST_CONTRACT_ABI, TEST_CONTRACT_EVENT_PARAMETERS) }) <NEW_LINE> print(response['0x2']) <NEW_LINE> self.assertSequenceEqual(response, { "0x1": TEST_CON...
Test decode inputs batch
625941c229b78933be1e5658
def get_prefix(bot, message): <NEW_LINE> <INDENT> prefixes = ['?'] <NEW_LINE> if not message.guild: <NEW_LINE> <INDENT> return '?' <NEW_LINE> <DEDENT> return commands.when_mentioned_or(*prefixes)(bot, message)
A callable Prefix for our bot. This could be edited to allow per server prefixes.
625941c263b5f9789fde708e
def PlotError(pf, xx, tacc, vacc, command): <NEW_LINE> <INDENT> if command == 0: <NEW_LINE> <INDENT> xlabel = r"$N_{\rm features}$" <NEW_LINE> <DEDENT> elif command == 1: <NEW_LINE> <INDENT> xlabel = r"${\rm log}_{10}(C)$" <NEW_LINE> <DEDENT> ylabel = r"${\rm Error}$" <NEW_LINE> tlabel = r"${\rm Training}$" <NEW_LINE> ...
Make a plot comparing the training and validation error as a function of the feature set size.
625941c2377c676e91272152
def process_course_and_provider(html, step_detail): <NEW_LINE> <INDENT> body = html.find("div", {"class": "BodyPanel642"}) <NEW_LINE> if body: <NEW_LINE> <INDENT> contents = str(body) <NEW_LINE> if 'No Records Found' in contents: <NEW_LINE> <INDENT> print('No courses found') <NEW_LINE> return <NEW_LINE> <DEDENT> conten...
Processing course and provider. :param html: html that found :type html: str :param step_detail: step_detail to be used :type step_detail: StepDetail
625941c296565a6dacc8f675
def download_check_sum(self, checksum_type, origin_file_name): <NEW_LINE> <INDENT> checksum_url = origin_file_name + "." + checksum_type <NEW_LINE> try: <NEW_LINE> <INDENT> return download_string(checksum_url) <NEW_LINE> <DEDENT> except DownloadException: <NEW_LINE> <INDENT> return None
return pre calculated checksum value, only avaiable for remote repos
625941c27c178a314d6ef405
@check_aware_dt('when') <NEW_LINE> def get_sunset_time(latitude_deg, longitude_deg, when): <NEW_LINE> <INDENT> return get_sunrise_sunset_transit(latitude_deg, longitude_deg, when)[1]
Wrapper for get_sunrise_sunset_transit that returns just the sunset time.
625941c28da39b475bd64f1b
def test_open_ru_ballance(self, ): <NEW_LINE> <INDENT> if self.report_type == 'open.ru': <NEW_LINE> <INDENT> (mid, aid) = self.make_money_and_account() <NEW_LINE> self.load_data_into_account(aid) <NEW_LINE> deals = self.get_deals() <NEW_LINE> repo_deals = self.get_repo_deals() <NEW_LINE> if self.open_ru_report_type == ...
rief check if ballance for deals matches for report and database
625941c2d268445f265b4e18
def SCNW(self, A1, k, coreset_size, is_scaled): <NEW_LINE> <INDENT> A, A3 = self.initializing_data(A1, k) <NEW_LINE> At = np.transpose(A) <NEW_LINE> AtA = np.dot(At, A) <NEW_LINE> num_of_samples = A.shape[0] <NEW_LINE> num_of_channels = A.shape[1] <NEW_LINE> i = np.int(np.floor(min(A.shape[0], coreset_size))) <NEW_LINE...
This function operates the CNW algorithm, exactly as elaborated in Feldman & Ras inputs: A: data matrix, n points, each of dimension d. k: an algorithm parameter which determines the normalization neededand the error given the coreset size. coreset_size: the maximal coreset size (number of lines inequal to zero) deman...
625941c2cc40096d615958fa
def download(url, target_directory, chunk_size=1024): <NEW_LINE> <INDENT> head_response = requests.head(url) <NEW_LINE> file_name = _derive_file_name(head_response, url) <NEW_LINE> file_path = os.path.join(target_directory, file_name) <NEW_LINE> response = requests.get(url, stream=True) <NEW_LINE> with open(file_path, ...
Download data source from a remote host. :param url: URL to the data source. :param target_directory: import session's directory path to download the data source. :param chunk_size: data stream's chunk size :type url: string :type target_directory: string :type chunk_size: int :return: path to the downloaded file :rty...
625941c25fdd1c0f98dc01dc
def get(self, request, pk, format=None): <NEW_LINE> <INDENT> data = {} <NEW_LINE> tag = self.get_object(pk=pk) <NEW_LINE> serializer = BookmarkSerializer(tag.bookmark.all(), many=True) <NEW_LINE> data['bookmarks'] = serializer.data <NEW_LINE> data['tag'] = tag.tag <NEW_LINE> return Response(data, status=status.HTTP_200...
Get all URL related to The Tag
625941c2eab8aa0e5d26db01
def load_config(self): <NEW_LINE> <INDENT> dialog = QFileDialog(self) <NEW_LINE> filename = dialog.getOpenFileName( self, "Load settings", QDir.homePath(), "Enigma config (*.json)" )[0] <NEW_LINE> if filename: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.__enigma_api.load_from(filename) <NEW_LINE> logging.info('Su...
Loads EnigmaAPI settings from a config file and refershes GUI
625941c2ff9c53063f47c19e
def getLineStyles(self, row): <NEW_LINE> <INDENT> return {'color':wxToMatplotlibColor (self.GetCellBackgroundColour(row, 1)), 'linestyle': styleStrings[styleNames.index(self.GetCellValue(row, 2))], 'linewidth':int(self.GetCellValue(row, 3)), 'label':self.GetCellValue(row, 7) or ' '}
Get the line styles. If no legend label is specified, use a single space.
625941c2460517430c394133
def __init__(self, channel): <NEW_LINE> <INDENT> self.call = channel.unary_unary( '/comunicacion.Comunicando/call', request_serializer=comunicacion__pb2.llamada.SerializeToString, response_deserializer=comunicacion__pb2.llamada.FromString, )
Constructor. Args: channel: A grpc.Channel.
625941c2851cf427c661a4bb
def scores_for_assignment(self, assignment): <NEW_LINE> <INDENT> content = [] <NEW_LINE> member = self.member[0].get() <NEW_LINE> for m in self.member: <NEW_LINE> <INDENT> member = m.get() <NEW_LINE> if member: <NEW_LINE> <INDENT> data, success = member.scores_for_assignment(assignment) <NEW_LINE> content.extend(data) ...
Returns a list of lists containing score data for the groups's final submission for ASSIGNMENT. There is one element for each combination of group member and score. Ensures that each student only appears once in the list. Format: [['STUDENT', 'SCORE', 'MESSAGE', 'GRADER', 'TAG']]
625941c2a8370b771705284a
def parse_row(column_names, row): <NEW_LINE> <INDENT> cell_values = [] <NEW_LINE> for cell in row.iter('%spara' %br): <NEW_LINE> <INDENT> emph_value = cell.find('%semphasis' %br) <NEW_LINE> if emph_value is not None: <NEW_LINE> <INDENT> if emph_value.text is not None: <NEW_LINE> <INDENT> cell_values.append(emph_value.t...
Parses the table's tbody tr row, row, for the DICOM Element data Returns a list of dicts {header1 : val1, header2 : val2, ...} with each list an Element
625941c22c8b7c6e89b3576b
def get_inequality_constraint(self): <NEW_LINE> <INDENT> return casadi.SX()
Get the inequality constraint g(x) <= 0.0
625941c2711fe17d82542319
def get_date_hierarchy_drilldown(self, year_lookup, month_lookup): <NEW_LINE> <INDENT> today = timezone.now().date() <NEW_LINE> if year_lookup is None and month_lookup is None: <NEW_LINE> <INDENT> return ( datetime.date(y, 1, 1) for y in range(today.year - 2, today.year + 1) ) <NEW_LINE> <DEDENT> elif year_lookup is no...
Drill-down only on past dates.
625941c2b5575c28eb68dfa8
def blank(self, blank_wells=None, n_skip=3, n_av=5): <NEW_LINE> <INDENT> if not blank_wells: <NEW_LINE> <INDENT> return self._blank_by_early_timepoints( n_skip=n_skip, n_av=n_av) <NEW_LINE> <DEDENT> return self._blank_by_blank_wells( blank_wells, n_skip=n_skip, n_av=n_av)
Return a new timecourse that has been blanked. If blank_wells is defined, all wells will be blanked according to the mean measurements of n_av early timepoints from the defined blanks. Otherwise, each well will be blanked separately by subtracting off the mean of n_av early timepoints (skipping the first n_skip). Ar...
625941c27c178a314d6ef406
def updateScript(dbconnection): <NEW_LINE> <INDENT> cursor = dbconnection.cursor() <NEW_LINE> cursor.execute("select rss, name, source from podcasts;") <NEW_LINE> rssArray = cursor.fetchall() <NEW_LINE> for rss in rssArray: <NEW_LINE> <INDENT> print("chekcing name " + str(rss[1])) <NEW_LINE> url = str(rss[0]) <NEW_LINE...
scans all rss feeds for new
625941c23cc13d1c6d3c7325
def satellite_repos_cdn(rhel_ver, sat_ver): <NEW_LINE> <INDENT> repos_sat = (f'rhel-{rhel_ver}-server-satellite-maintenance-6-rpms,' f'rhel-{rhel_ver}-server-satellite-capsule-{sat_ver}-rpms,' f'rhel-{rhel_ver}-server-satellite-{sat_ver}-rpms,' f'rhel-{rhel_ver}-server-satellite-tools-{sat_ver}-rpms,' f'rhel-{rhel_ver}...
Gather all required repos for installing released satellite from cdn. :param rhel_ver: rhel version, such as 6, 7, 8. :param sat_ver: satellite version, such as 6.8, 6.9 :return: A string with comma to separate repos.
625941c2507cdc57c6306c80
def mktar(path, dest): <NEW_LINE> <INDENT> with tarfile.open(dest, "w:gz") as tar: <NEW_LINE> <INDENT> tar.add(path, arcname='./')
Creates a tar.gz from path and saves it to dest.
625941c2009cb60464c6335d
def get_activation_token_using_get_with_http_info(self, user_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['user_id'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW...
getActivationLink # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api_pe.get_activation_link_using_get_with_http_info(user_id, async_req=True) >>> result = thread.get() :param async_req bool :param str user_id: userId...
625941c291af0d3eaac9b9c0
def __init__(self, id, title, dest_server, username, password): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.title = title <NEW_LINE> self.dest_server = dest_server <NEW_LINE> self.username = username <NEW_LINE> self.password = password <NEW_LINE> ZSyncer.__dict__['__init__'](self, id, title)
Initialize variables.
625941c25f7d997b87174a3f
def on_done(self, picked): <NEW_LINE> <INDENT> if picked == -1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> name = self.package_list[picked][0] <NEW_LINE> if self.disable_package(name): <NEW_LINE> <INDENT> on_complete = lambda: self.reenable_package(name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> on_complete = N...
Quick panel user selection handler - disables a package, upgrades it, then re-enables the package :param picked: An integer of the 0-based package name index from the presented list. -1 means the user cancelled.
625941c2a79ad161976cc0ef
def CreateRouteTable(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("CreateRouteTable", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.CreateRouteTableResponse() ...
本接口(CreateRouteTable)用于创建路由表。 * 创建了VPC后,系统会创建一个默认路由表,所有新建的子网都会关联到默认路由表。默认情况下您可以直接使用默认路由表来管理您的路由策略。当您的路由策略较多时,您可以调用创建路由表接口创建更多路由表管理您的路由策略。 :param request: 调用CreateRouteTable所需参数的结构体。 :type request: :class:`tencentcloud.vpc.v20170312.models.CreateRouteTableRequest` :rtype: :class:`tencentcloud.vpc.v20170312.models.Creat...
625941c23346ee7daa2b2d14
def cursor_insert(self, value): <NEW_LINE> <INDENT> toMove = self.cursor.next <NEW_LINE> self.cursor.next = LinkedList.Node(value,self.cursor,self.cursor.next) <NEW_LINE> toMove.prior = self.cursor.next <NEW_LINE> self.cursor = self.cursor.next <NEW_LINE> self.length += 1
inserts a new value after the cursor and sets the cursor to the new node
625941c2d10714528d5ffc8b
def locales(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return contentful().locales(api_id) <NEW_LINE> <DEDENT> except HTTPError: <NEW_LINE> <INDENT> return [DEFAULT_LOCALE]
Returns the list of available locales.
625941c2b5575c28eb68dfa9
def __call__(self, stdin=None, stdout=True, stderr=True): <NEW_LINE> <INDENT> if stdout: <NEW_LINE> <INDENT> stdout_arg = subprocess.PIPE <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> stdout_arg = open(os.devnull) <NEW_LINE> <DEDENT> if stderr: <NEW_LINE> <INDENT> stderr_arg = subprocess.PIPE <NEW_LINE> <DEDENT> else: ...
Execute the command and waits for it to finish, returns output. Runs the command line tool and waits for it to finish. If it returns a non-zero error level, an exception is raised. Otherwise two strings are returned containing stdout and stderr. The optional stdin argum...
625941c299fddb7c1c9de33c
def _update(self, *items: Tuple[str, Union[int, str]]) -> Tuple[Union[int, str], ...]: <NEW_LINE> <INDENT> comments = dict(items) <NEW_LINE> comments.update(bootlegdisc="N") <NEW_LINE> comments.update(date=int(comments.get("date", 0))) <NEW_LINE> comments.update(deluxe="N") <NEW_LINE> comments.update(livedisc="N") <NEW...
:param items: :return:
625941c27d43ff24873a2c49
def run(argv=None): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser() <NEW_LINE> parser.add_argument( '--input', dest='input', required=False, help='Input file to read. This can be a local file or ' 'a file in a Google Storage Bucket.', default=input_file) <NEW_LINE> parser.add_argument('--output', dest='output', ...
The main function which creates the pipeline and runs it.
625941c263d6d428bbe44499
@salt.utils.decorators.path.which('sync') <NEW_LINE> @salt.utils.decorators.path.which('mkfs') <NEW_LINE> def format_(device, fs_type='ext4', inode_size=None, lazy_itable_init=None, force=False): <NEW_LINE> <INDENT> cmd = ['mkfs', '-t', str(fs_type)] <NEW_LINE> if inode_size is not None: <NEW_LINE> <INDENT> if fs_type[...
Format a filesystem onto a device .. versionadded:: 2016.11.0 device The device in which to create the new filesystem fs_type The type of filesystem to create inode_size Size of the inodes This option is only enabled for ext and xfs filesystems lazy_itable_init If enabled and the uninit_bg fea...
625941c2097d151d1a222e05
def ui_setup(self): <NEW_LINE> <INDENT> self.setWindowTitle("Run Occam 1D") <NEW_LINE> self.resize(1920, 1080) <NEW_LINE> self.occam_widget = OccamWidget() <NEW_LINE> self.central_widget = self.setCentralWidget(self.occam_widget) <NEW_LINE> self.menu_bar = self.menuBar() <NEW_LINE> self.menu_help = self.menu_bar.addMen...
setup the window layout
625941c223e79379d52ee50f
def batchnorm_backward(dout, cache): <NEW_LINE> <INDENT> dx, dgamma, dbeta = None, None, None <NEW_LINE> (x, x_norm, sample_mean, sample_var, gamma, beta, eps) = cache <NEW_LINE> n = x.shape[0] <NEW_LINE> dbeta = np.sum(dout, axis=0) <NEW_LINE> dgamma = np.sum(dout * x_norm, axis=0) <NEW_LINE> dxnorm = dout * gamma <NE...
Backward pass for batch normalization. For this implementation, you should write out a computation graph for batch normalization on paper and propagate gradients backward through intermediate nodes. Inputs: - dout: Upstream derivatives, of shape (N, D) - cache: Variable of intermediates from batchnorm_forward. Retur...
625941c2435de62698dfdbf6
def reverse_color(im): <NEW_LINE> <INDENT> assert im.mode=='L','必须为灰度图' <NEW_LINE> for i in range(im.height): <NEW_LINE> <INDENT> for j in range(im.width): <NEW_LINE> <INDENT> im[i, j] = 255 - im[i, j] <NEW_LINE> <DEDENT> <DEDENT> pass
反色 :param im: 灰度图 :return: 灰度图
625941c291f36d47f21ac49a
def project_export_limits(pulse_limit, ei_ratio,delta_inflow): <NEW_LINE> <INDENT> if ei_ratio.getStartTime() != pulse_limit.getStartTime(): <NEW_LINE> <INDENT> raise ValueError("EI limit and total export limit must have same start time") <NEW_LINE> <DEDENT> eilimit=ei_ratio*delta_inflow <NEW_LINE> tsmonth=month_number...
Refine export limits to include EI ratio and allocate limits to CVP and SWP. Arguments: pulse_limit: the raw combined export limit from CALSIM ei_ratio: the maximum E/I ratio calculated by CALSIM delta_inflow: total inflow to the delta calculated by CALSIM Output: swp_limit,cvp_limit: Maximum pumpin...
625941c2ec188e330fd5a74c
def getPeriodicSpikes(firing_rate,time_step_sim,t_max): <NEW_LINE> <INDENT> isi_ms = 1000/firing_rate <NEW_LINE> nsteps = int(np.ceil(isi_ms/time_step_sim)) <NEW_LINE> spikes = np.arange(nsteps,t_max+nsteps,nsteps) <NEW_LINE> spiketrue = np.ones([len(spikes)]) <NEW_LINE> return spikes, spiketrue
Integer-based method for getting periodic spikes. returns desired spike times in step numbers. the reason for this method is that a clock with floats will lead to skipped spikes due to rounding issues with floats in python.
625941c256ac1b37e626417d
def _process(self, packet, **kwargs): <NEW_LINE> <INDENT> if not packet.is_private(): <NEW_LINE> <INDENT> self._receive_callback(packet) <NEW_LINE> return False <NEW_LINE> <DEDENT> specification = packet.get("specification") <NEW_LINE> error_message = "Received packet is of unexpected type '{}', expected '{}'" <NEW_LIN...
Process a `Packet` object `packet`. Returns whether or not `packet` is an RSSI broadcast packet for further processing. Classes that inherit this base class must extend this method.
625941c2462c4b4f79d1d67a
def _on_board(self, position): <NEW_LINE> <INDENT> (x, y) = position <NEW_LINE> return x >= 0 and y >= 0 and x < self.height and y < self.width
Args: position: a tuple of (x, y) Returns: bool: returns True iff position is within the bounds of [0, self.size)
625941c2e76e3b2f99f3a7b9
def test__get_tunable_no_conditionals(self): <NEW_LINE> <INDENT> init_params = { 'an_init_param': 'a_value' } <NEW_LINE> hyperparameters = { 'tunable': { 'this_is_not_conditional': { 'type': 'int', 'default': 1, 'range': [1, 10] } } } <NEW_LINE> tunable = MLBlock._get_tunable(hyperparameters, init_params) <NEW_LINE> ex...
If there are no conditionals, tunables are returned unmodified.
625941c257b8e32f52483444
def sharpen_saturation(image: str or PillowImage, **kwargs) -> PillowImage: <NEW_LINE> <INDENT> if isinstance(image, str): <NEW_LINE> <INDENT> print('sharpen saturation isinstance') <NEW_LINE> image = Image.open(image).convert('RGB') <NEW_LINE> <DEDENT> print('sharpen saturation rest ofcode') <NEW_LINE> sharp_factor = ...
:param image: image to process on :param kwargs: should contain sharp_factor: int, color_factor: int :return:
625941c26aa9bd52df036d4d
def rotate_matrix_inplace(matrix: list, n: int) -> list: <NEW_LINE> <INDENT> last_index = n - 1 <NEW_LINE> for layer in range(n // 2): <NEW_LINE> <INDENT> layer_len = last_index - layer <NEW_LINE> for pos in range(layer, layer_len): <NEW_LINE> <INDENT> temp = matrix[layer][pos] <NEW_LINE> matrix[layer][pos] = matrix[po...
Rotate an NxN matrix 90 degrees counterclockwise in place. Runtime: O(n^2) Memory: O(1)
625941c23eb6a72ae02ec482
def inet_ntop(family, address): <NEW_LINE> <INDENT> if family == AF_INET: <NEW_LINE> <INDENT> return thirdparty.dns.ipv4.inet_ntoa(address) <NEW_LINE> <DEDENT> elif family == AF_INET6: <NEW_LINE> <INDENT> return thirdparty.dns.ipv6.inet_ntoa(address) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NotImplementedErr...
Convert the binary form of a network address into its textual form. *family* is an ``int``, the address family. *address* is a ``bytes``, the network address in binary form. Raises ``NotImplementedError`` if the address family specified is not implemented. Returns a ``str``.
625941c2796e427e537b056e
def show(self, request, response, pathmatch): <NEW_LINE> <INDENT> tool_list = os.listdir("data/tools") <NEW_LINE> tools_html = "<ul>" <NEW_LINE> for tool_title in tool_list: <NEW_LINE> <INDENT> if tool_title != '.DS_Store': <NEW_LINE> <INDENT> with open("data/tools/" + tool_title, "r") as g: <NEW_LINE> <INDENT> tools_h...
Show the editor. Provide list of saved icons.
625941c2566aa707497f4516
@app.route("/get") <NEW_LINE> def get_bot_response(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> userText = request.args.get('msg') <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> print(e) <NEW_LINE> <DEDENT> return str(bot.get_response(userText))
try: es por si ocurre algun error. :except Nos muestra el error de una forma mas detallada :var userText: variable que trae lo que le introduscamos. :return: retorna la respuesta del bot.
625941c2be8e80087fb20bf0
def test_add_person_add_staff_to_living_space(self): <NEW_LINE> <INDENT> self.amity.create_room(["Maathai"], "LivingSpace") <NEW_LINE> person = self.amity.add_person("Robley", "Gori", "staff", "Y") <NEW_LINE> self.assertIn("Staff cannot be allocated a living space!", person)
Test that staff cannot be added to living space
625941c2d8ef3951e32434e7
def cached(func): <NEW_LINE> <INDENT> def write_to_cache(fpath, data): <NEW_LINE> <INDENT> with open(fpath, 'wb') as fout: <NEW_LINE> <INDENT> pickle.dump(data, fout) <NEW_LINE> <DEDENT> return data <NEW_LINE> <DEDENT> def wrapper(*func_args): <NEW_LINE> <INDENT> fname = '{}-{}-cache.pkl'.format(func.__name__, hash(rep...
Decorator to cache function's return values to a file on disk. Although it will cache functions that take arguments (e.g. cache f(2) and f(3) separately), this is an experimental feature. It will cache the function under the function name and the hash of the repr() of the arguments tuple. We hash the repr() and not th...
625941c2091ae35668666f0c
def define(key, value): <NEW_LINE> <INDENT> DEFINES[key] = value
Add a definition that can be used in the C struct
625941c2ab23a570cc25012b
def check_ib_vf_under_ipmp(name, password, vf): <NEW_LINE> <INDENT> port = get_domain_port(name) <NEW_LINE> domain = Ldom.Ldom(name, password, port) <NEW_LINE> link = get_ib_vf_link_in_domain(name, password, vf) <NEW_LINE> part = get_ib_part_over_link_in_domain(name, password, link)[0] <NEW_LINE> hotplug_dev = get_ib_v...
Purpose: Check the part over the corresponding link of ib vf is under ipmp group in io domain Arguments: name - IO domain name password - IO domain password vf - IB vf Return: True - Under IPMP group False - Not under IPMP group
625941c230bbd722463cbd6f
def fit_predict(self, X, ml=[], hyperparameters=None): <NEW_LINE> <INDENT> assert isinstance(X, pd.DataFrame), 'X must be a pandas.DataFrame' <NEW_LINE> ml_flat = [idx for link in ml for idx in link] <NEW_LINE> assert not(is_duplicate(ml_flat)), 'Integers in ml are not unique' <NEW_LINE> assert (0 <= np.array(ml_flat))...
Fit the model to X & predict clusters for each observation (row) in X given must-link constraints ml :param pd.DataFrame X: data :param list ml: each element is a list of indices of points that must be in the same cluster :param hyperparameters: hyperparameters of distributions for the variates :type hyperparameters: ...
625941c223849d37ff7b303b
def card_input_validate(card_names, previous_cards, num_cards_required=None): <NEW_LINE> <INDENT> if num_cards_required is not None and len(card_names) != num_cards_required: <NEW_LINE> <INDENT> print("Wrong number of cards.") <NEW_LINE> return False <NEW_LINE> <DEDENT> for card_name in card_names: <NEW_LINE> <INDENT> ...
To validate user input of cards, preventing wrong number of cards, cards not recognized in our notation, and duplicated cards. Called by prompt_user() :param card_names: an array of strings, for the card names. :param previous_cards: a set of strings, for the card names previously entered, to check for duplicates. :par...
625941c2656771135c3eb817
def module_func(*args, **kwargs): <NEW_LINE> <INDENT> return 'blah'
Used by dispatch tests
625941c2a17c0f6771cbdffd
def common_command_formatting(self, page_or_embed, command): <NEW_LINE> <INDENT> page_or_embed.title = self.get_command_signature(command) <NEW_LINE> if command.description: <NEW_LINE> <INDENT> page_or_embed.description = f'{command.description}\n\n{command.help}' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> page_or_e...
Command help formatting.
625941c2cad5886f8bd26f84
def sort_text_column(self, tv, col, reverse=False): <NEW_LINE> <INDENT> l = [(tv.set(k, col), k) for k in tv.get_children('')] <NEW_LINE> l.sort(key=lambda x: x[0].lower(), reverse=reverse) <NEW_LINE> for index, (val, k) in enumerate(l): <NEW_LINE> <INDENT> tv.move(k, '', index) <NEW_LINE> <DEDENT> tv.heading(col, comm...
Sorts entries in treeview tables alphabetically.
625941c24a966d76dd550fb9
def interval(a, b): <NEW_LINE> <INDENT> if a <= b: <NEW_LINE> <INDENT> return [a, b] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [b, a]
Construct an interval from a to b.
625941c21d351010ab855ac7
def get_song(self, song_id): <NEW_LINE> <INDENT> url = get_song_url(song_id) <NEW_LINE> result = self.get_request(url) <NEW_LINE> return result['songs'][0]
Get song info by song id :param song_id: :return:
625941c2d10714528d5ffc8c
def _remove_in_process_courses(courses, in_process_course_actions): <NEW_LINE> <INDENT> def format_course_for_view(course): <NEW_LINE> <INDENT> return { 'display_name': course.display_name, 'course_key': unicode(course.location.course_key), 'url': reverse_course_url('course_handler', course.id), 'lms_link': get_lms_lin...
removes any in-process courses in courses list. in-process actually refers to courses that are in the process of being generated for re-run
625941c2097d151d1a222e06
def get(self, *args): <NEW_LINE> <INDENT> return _vnl_vectorPython.vnl_vectorUL_get(self, *args)
get(self, unsigned int index) -> unsigned long
625941c216aa5153ce362423
def add_meta_options(parser): <NEW_LINE> <INDENT> parser.add_argument('--force-handlers', default=C.DEFAULT_FORCE_HANDLERS, dest='force_handlers', action='store_true', help="run handlers even if a task fails") <NEW_LINE> parser.add_argument('--flush-cache', dest='flush_cache', action='store_true', help="clear the fact ...
Add options for commands which can launch meta tasks from the command line
625941c226068e7796caec86
def __init__(self): <NEW_LINE> <INDENT> self.RouteTableName = None <NEW_LINE> self.RouteTableCidrBlock = None <NEW_LINE> self.VpcId = None
:param RouteTableName: 路由表名称。 :type RouteTableName: str :param RouteTableCidrBlock: 路由表CIDR。 :type RouteTableCidrBlock: str :param VpcId: VPC实例ID。 :type VpcId: str
625941c2f8510a7c17cf96a6
def divMax(fData, realData): <NEW_LINE> <INDENT> maxData = max(fData) <NEW_LINE> for data in fData: <NEW_LINE> <INDENT> cuck = data / maxData <NEW_LINE> realData.append(cuck) <NEW_LINE> <DEDENT> pass
Calculate in relative, to the max data
625941c282261d6c526ab447
def add_callback(self, callback): <NEW_LINE> <INDENT> self.callbacks.append(callback)
Adds a callback that inherits from HttpCallback.
625941c27d43ff24873a2c4a
def newspeed(self): <NEW_LINE> <INDENT> self.dirscan_speed = cfg.dirscan_speed() <NEW_LINE> self.trigger = True
We're notified of a scan speed change
625941c27d847024c06be265
def test_validate2(self): <NEW_LINE> <INDENT> board = AtomicBoard(setup=FEN1) <NEW_LINE> board = board.move(parseSAN(board, 'Nc7+')) <NEW_LINE> print(board) <NEW_LINE> self.assertTrue(validate(board, parseSAN(board, 'Qxd2'))) <NEW_LINE> self.assertTrue(validate(board, parseSAN(board, 'Qxf2'))) <NEW_LINE> self.assertTru...
Testing explode king vs mate in Atomic variant
625941c2cad5886f8bd26f85
def execute_step( self, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder, install_environment, work_dir, current_dir=None, initial_download=False, ): <NEW_LINE> <INDENT> with settings(warn_only=True): <NEW_LINE> <INDENT> configure_opts = action_dict.get("configure_opts", "") <NEW_...
Handle configure, make and make install in a shell, allowing for configuration options. Since this class is not used in the initial download stage, no recipe step filtering is performed here, and None values are always returned for filtered_actions and dir.
625941c2046cf37aa974ccf4