code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def insert(self, index: int, value: ParsablePolicyQualifier) -> None: <NEW_LINE> <INDENT> if self.policy_qualifiers is None: <NEW_LINE> <INDENT> self.policy_qualifiers = [] <NEW_LINE> <DEDENT> self.policy_qualifiers.insert(index, self._parse_policy_qualifier(value))
Insert qualifier at given index.
625941ee8e05c05ec3eea8ba
def update_tool1(): <NEW_LINE> <INDENT> (pwd, name,ip) = get_env() <NEW_LINE> t = datetime.datetime.now() <NEW_LINE> d = time.mktime(t.timetuple()) <NEW_LINE> rev = dbhash.open('%s/cg/rev.db'%ui.__BASE__,'w') <NEW_LINE> allow,delta = False,0 <NEW_LINE> if rev.has_key('_update_'): <NEW_LINE> <INDENT> delta = d - float(r...
update the tool from github
625941ee7b25080760e39997
@cancellable <NEW_LINE> def fb_select_license(win, db, name): <NEW_LINE> <INDENT> select_item(win, db, 'license', name)
Selects license
625941ee9f2886367277adca
def GetG(self, UP=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.struct.G <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return self.struct.GetG()
Récupère la valeur de G
625941ee4f6381625f114f7c
def __init__(self, jsondict=None, strict=True, **kwargs): <NEW_LINE> <INDENT> self.contact = None <NEW_LINE> self.endpoint = None <NEW_LINE> self.name = None <NEW_LINE> self.software = None <NEW_LINE> self.version = None <NEW_LINE> super(MessageHeaderSource, self).__init__(jsondict=jsondict, strict=strict, **kwargs)
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
625941ee63b5f9789fde7628
def split_data(x, y, ratio): <NEW_LINE> <INDENT> n = len(x) <NEW_LINE> if len(y) != n: <NEW_LINE> <INDENT> raise ValueError("Vector x and y have a different size") <NEW_LINE> <DEDENT> n_train = int(ratio*n) <NEW_LINE> train_ind = np.random.choice(n, n_train, replace=False) <NEW_LINE> index = np.arange(n) <NEW_LINE> mas...
split the dataset based on the split ratio.
625941ee57b8e32f524839e0
def main(): <NEW_LINE> <INDENT> dictionary = load_dictionary() <NEW_LINE> letters = [l.upper() for l in input('Enter hive letters: ') if l.isalpha()] <NEW_LINE> if not len(letters) == 7: <NEW_LINE> <INDENT> raise IndexError('Must enter 7 letters') <NEW_LINE> <DEDENT> primary = input(f'Which is the primary letter: {lett...
Get user input; look up matching words
625941eecdde0d52a9e53579
def addInfo(self, instanceLocation=None, sources=None, copySourceName=None): <NEW_LINE> <INDENT> if instanceLocation is None: <NEW_LINE> <INDENT> instanceLocation = self.locationObject <NEW_LINE> <DEDENT> infoObject = self.font.info <NEW_LINE> infoMasters = [] <NEW_LINE> if sources is None: <NEW_LINE> <INDENT> sources ...
Add font info data.
625941ee7047854f462a1945
def apk(actual, predicted, k=5): <NEW_LINE> <INDENT> if len(predicted)>k: <NEW_LINE> <INDENT> predicted = predicted[:k] <NEW_LINE> <DEDENT> score = 0.0 <NEW_LINE> num_hits = 0.0 <NEW_LINE> for i,p in enumerate(predicted): <NEW_LINE> <INDENT> if p in actual and p not in predicted[:i]: <NEW_LINE> <INDENT> num_hits += 1.0...
Function to get Average Precision at K
625941eed7e4931a7ee9e461
def get_locations(self, locations_url): <NEW_LINE> <INDENT> locations_page = self.get_page_source(locations_url) <NEW_LINE> soup = BeautifulSoup(locations_page, 'html.parser') <NEW_LINE> locations = [] <NEW_LINE> for location in soup.find_all('li', attrs={'class': 'drilldown cl'}): <NEW_LINE> <INDENT> url = location.fi...
Get list of available locations.
625941ee99fddb7c1c9de8d0
def sentence_loss(self, sent_embeds, im_embeds, im_labels): <NEW_LINE> <INDENT> sent_im_ratio = self.args.sample_size <NEW_LINE> num_img = self.args.batch_size <NEW_LINE> num_sent = num_img * sent_im_ratio <NEW_LINE> sent_im_dist = pdist(sent_embeds, im_embeds) <NEW_LINE> sent_sent_mask = tf.reshape(tf.tile(tf.transpos...
im_embeds: (b, 512) image embedding tensors sent_embeds: (sample_size * b, 512) sentence embedding tensors where the order of sentence corresponds to the order of images and setnteces for the same image are next to each other im_labels: (sample_size * b, b) boolean tensor, where (i, j) entry is True if and ...
625941ee7cff6e4e81117ec7
def intstrtuple(s): <NEW_LINE> <INDENT> parts = [p.strip() for p in s.split(":", 1)] <NEW_LINE> if len(parts) == 2: <NEW_LINE> <INDENT> return int(parts[0]), parts[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None, parts[0]
Get (int, string) tuple from int:str strings.
625941eee64d504609d74d81
def calculate_iou(pred_labels, ref_labels): <NEW_LINE> <INDENT> if ref_labels.any(): <NEW_LINE> <INDENT> i = np.logical_and(pred_labels, ref_labels).sum() <NEW_LINE> u = np.logical_or(pred_labels, ref_labels).sum() <NEW_LINE> return i.astype('float') / u <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if pred_labels.any(...
Calculates the intersection over union for binary segmentation. Args: pred_labels: predicted segmentation labels. ref_labels: reference segmentation labels. Returns: The IoU between pred_labels and ref_labels
625941ee236d856c2ad44d23
def lteq(left, right): <NEW_LINE> <INDENT> left = Normalizer.run(left) <NEW_LINE> right = Normalizer.run(right) <NEW_LINE> return all_sums_of_products_dominate(right.terms, left.terms)
Return True if the left cost is equal to or dominated by the right cost. This is a partial order over costs.
625941ee8a43f66fc4b545a1
def __init__(self, **kwargs): <NEW_LINE> <INDENT> if 'can_id' in kwargs: <NEW_LINE> <INDENT> self.can_id = kwargs.get('can_id') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.priority = kwargs.get('priority', 0) & 7 <NEW_LINE> self.parameter_group_number = kwargs.get('parameter_group_number', 0) & 0x3FFFF <NEW_LINE...
:param priority: 3-bit Priority :param parameter_group_number: 18-bit Parameter Group Number :param source_address: 8-bit Source Address There is a total of 253 addresses available and every address must be unique within the network. :param can_id: A 29-bit CAN-Id the MessageId should be parsed...
625941ee3539df3088e2e88d
def print_common_facts(comment_symbol="", file=None): <NEW_LINE> <INDENT> print(comment_symbol, "Common facts:", file=file) <NEW_LINE> for fact, value in facter.FACTS.items(): <NEW_LINE> <INDENT> print(f"{comment_symbol} {fact}: {value}", file=file) <NEW_LINE> <DEDENT> print(file=file)
Print the facts about the used system common to all benchmarks
625941ee32920d7e50b28716
def random_hex_generator(num): <NEW_LINE> <INDENT> return binascii.hexlify(os.urandom(num)).decode('utf-8')
Returns randomly generated n bytes of encoded hex data for the given `num`
625941eebaa26c4b54cb165c
def delete(self, *args, **kwargs): <NEW_LINE> <INDENT> pl_list = self.pl.all() <NEW_LINE> logger.info("PLTP '"+self.sha1+" ("+self.name+")' has been deleted") <NEW_LINE> for pl in pl_list: <NEW_LINE> <INDENT> if len(pl.pltp_set.all()) == 1: <NEW_LINE> <INDENT> logger.info("PL '"+pl.sha1+" ("+pl.name+")' has been delete...
Overriding delete() to also delete his PL if they're not with any other PLTP
625941ee24f1403a926010a3
def compute_julia(c, N, bound=2, lim=1000., kernel=kernel, num_sections=8): <NEW_LINE> <INDENT> while N % num_sections: <NEW_LINE> <INDENT> num_sections += 1 <NEW_LINE> <DEDENT> grid = np.linspace(-bound, bound, N) <NEW_LINE> chunk = N / num_sections <NEW_LINE> grid_x_sections = [grid[i*chunk:(i+1)*chunk] for i in rang...
Computes the julia set for an NxN complex domain using Python's multiprocessing module for parallelization. Note: this version breaks up the domain over the first dimension; improvements to the computation would be to break up the computation over both the first and second dimensions. Arguments --------- c: The comp...
625941ee3cc13d1c6d3c78b9
def __init__(self, dict = {}, secure = False): <NEW_LINE> <INDENT> if not dict.has_key('endpoint'): <NEW_LINE> <INDENT> dict['endpoint'] = "%scmssrv49.fnal.gov:8585/reqMgr/" % ((secure and "https://" or "http://")) <NEW_LINE> <DEDENT> if dict.has_key('cachepath'): <NEW_LINE> <INDENT> pass...
responseType will be either xml or json
625941eebd1bec0571d90b71
def _run_pimple_log_stats(path): <NEW_LINE> <INDENT> from subprocess import call <NEW_LINE> import os <NEW_LINE> from sys import stdout <NEW_LINE> devnull = open(os.devnull, 'wb') <NEW_LINE> log_file = os.path.join(path, 'log') <NEW_LINE> if os.path.exists(log_file): <NEW_LINE> <INDENT> print(' pimple-log-stats ... ',...
Collect running stats.
625941ee01c39578d7e7537d
def multiply_card_by_count(card, card_counter, alias_mapping=None): <NEW_LINE> <INDENT> alias_mapping = alias_mapping or {} <NEW_LINE> card_name = card.name <NEW_LINE> aliases_to_this_name = [ k for k, v in alias_mapping.iteritems() if v == card_name ] <NEW_LINE> return [card] * sum( card_counter.get(name, 0) for name ...
It's useful to return the same number of serialized card objects as there were card names requested, this method takes in a card, and information that helps answer how many instances of the card should be returned :param card: the card to be multiplied :param card_counter: the collections.Counter object mapping str re...
625941ee287bf620b61d3fa2
def _generate_report_html(self, pdb_name, pdb_path): <NEW_LINE> <INDENT> html_report = list() <NEW_LINE> output_directory = os.path.join(self.scratch, str(uuid.uuid4())) <NEW_LINE> os.mkdir(output_directory) <NEW_LINE> result_file_path = os.path.join(output_directory, 'viewer.html') <NEW_LINE> new_pdb_path = os.path.jo...
_generate_report_html: generates the HTML for the upload report
625941eea17c0f6771cbe591
def showMatchesForm(self, prepared_entries, bin_suggested_names, rename_fn): <NEW_LINE> <INDENT> pass
Pop open Karta's form presenting the matched library functions. Note: This function contains some of Karta's UI logic Args: prepared_entries (list): list of UI rows, including the length for the different columns suggested_names (dict): suggested names for the renaming: bin ea => name rename_fn (func)...
625941ee442bda511e8be952
def get_refresh_ids(self): <NEW_LINE> <INDENT> ids = [] <NEW_LINE> for bucket in self.router.lonely_buckets(): <NEW_LINE> <INDENT> rid = random.randint(*bucket.range).to_bytes(20, byteorder='big') <NEW_LINE> ids.append(rid) <NEW_LINE> <DEDENT> return ids
Get ids to search for to keep old buckets up to date.
625941ee31939e2706e4d3a4
def _findScopeWithName(self, name, scopeStack, type="variables"): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> log.info("_findScopeWithName: %r with name:%r in scopeStack:%r", type, name, scopeStack[-1].name) <NEW_LINE> for scopePos in range(len(scopeStack) - 1, -1, -1): <NEW_LIN...
Find a object somewhere on the given scope stack with the given name @param name {unicode} The name to look for @param scopeStack {list of JSObject} The scope stack, with the outermost (and therefore last searched) scope at the lowest index @param type {str} The type of property to look for, e.g. "variables", ...
625941ee4428ac0f6e5bad39
def __init__ (self): <NEW_LINE> <INDENT> super(QtGui.QWidget, self).__init__() <NEW_LINE> self.path = False <NEW_LINE> self.curves = [] <NEW_LINE> self.initUI()
Initializes fancy GUI class
625941ee91af0d3eaac9bf60
def test_auto_delay_force_sync(self): <NEW_LINE> <INDENT> result = ( self.env["test.queue.job"] .with_context(_job_force_sync=True) .delay_me(1, kwarg=2) ) <NEW_LINE> self.assertTrue(result, (1, 2))
method forced to run synchronously
625941ee07f4c71912b119c7
def length_dist(synset_1, synset_2): <NEW_LINE> <INDENT> l_dist = sys.maxint <NEW_LINE> if synset_1 is None or synset_2 is None: <NEW_LINE> <INDENT> return 0.0 <NEW_LINE> <DEDENT> if synset_1 == synset_2: <NEW_LINE> <INDENT> l_dist = 0.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> wset_1 = set([str(x.name()) for x in...
Return a measure of the length of the shortest path in the semantic ontology (Wordnet in our case as well as the paper's) between two synsets.
625941ee4e4d5625662d4912
def graft_cdrs_onto_human_germline(self, v_gene=None, j_gene=None, backmutate_vernier=False, backmutations: List[Union['Position',str]] = []): <NEW_LINE> <INDENT> germline_chain = self.find_merged_human_germline(v_gene=v_gene, j_gene=j_gene) <NEW_LINE> if self.scheme != 'imgt' or self.cdr_definition != 'imgt': <NEW_LIN...
Graft CDRs from this Chain onto the nearest human germline sequence :param v_gene: Use defined V germline allele (e.g. IGHV1-18*01), gene (e.g. IGHV1-18) or family (e.g. IGHV1) :param j_gene: Use defined J germline allele (e.g. IGHJ1*01) or gene (e.g. IGHJ1) :param backmutate_vernier: Also graft all Kabat Vernier posi...
625941ee462c4b4f79d1dc11
def __init__(self, path=None, script_home=None): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> path = ['.'] <NEW_LINE> <DEDENT> if type(path) in (str, str): <NEW_LINE> <INDENT> path = [path] <NEW_LINE> <DEDENT> self.path = list(path) <NEW_LINE> if script_home is None: <NEW_LINE> <INDENT> script_home = get_sc...
Create a loader for the given path. If no path is specified it defaults to ``['.']``; that is, just the program directory. See the module documentation for details on the path format. :Parameters: `path` : list of str List of locations to search for resources. `script_home` : str Base locatio...
625941eeeab8aa0e5d26e09c
def setImage(self, image, xscale=(0, 1.), yscale=(0, 1.)): <NEW_LINE> <INDENT> self.addImage(image, legend=self._activeImageLegend, origin=(xscale[0], yscale[0]), scale=(xscale[1], yscale[1]), z=1, replace=False) <NEW_LINE> self.setActiveImage(self._activeImageLegend)
Set the main (*active*) image, by providing its data as a 2D array or as a pixmap. :param image: 2D image, array of shape (nrows, ncolumns) or (nrows, ncolumns, 3) or (nrows, ncolumns, 4) RGB(A) pixmap :param xscale: Factors for polynomial scaling for x-axis, *(a, b)* such as :math:`x \mapsto a + bx` :param y...
625941eebe8e80087fb2117c
def __init__(self, ltol=0.2, stol=0.3, angle_tol=5, primitive_cell=True, scale=True, comparator=SpeciesComparator()): <NEW_LINE> <INDENT> self.ltol = ltol <NEW_LINE> self.stol = stol <NEW_LINE> self.angle_tol = angle_tol <NEW_LINE> self._comparator = comparator <NEW_LINE> self._primitive_cell = primitive_cell <NEW_LINE...
Args: ltol: Fractional length tolerance. Default is 0.2. stol: Site tolerance. Defined as the fraction of the average free length per atom := ( V / Nsites ) ** (1/3) Default is 0.3 angle_tol: Angle tolerance in degrees. Default is 5 degrees. primitive_cell: ...
625941eee76e3b2f99f3ad44
def built( name, runas, dest_dir, spec, sources, template, tgt, results=None, always=False, saltenv='base'): <NEW_LINE> <INDENT> ret = {'name': name, 'changes': {}, 'comment': '', 'result': True} <NEW_LINE> if not always: <NEW_LINE> <INDENT> if isinstance(results, str): <NEW_LINE> <INDENT> results = results.split(',') ...
Ensure that the named package is built and exists in the named directory name The name to track the build, the name value is otherwise unused runas The user to run the build process as dest_dir The directory on the minion to place the built package(s) spec The location of the spec file (used for rpm...
625941eebf627c535bc13711
def test_non_existing_template(self): <NEW_LINE> <INDENT> with self.assertRaises(StopIteration): <NEW_LINE> <INDENT> _report = Report(self.my_container, self.system) <NEW_LINE> _report.html_template = 'this_file_does_not_exist' <NEW_LINE> _report.render()
Test with a non existing template file, should yield nothing
625941ee0383005118ecfb23
@py2only <NEW_LINE> def test_social_login_link(social_app): <NEW_LINE> <INDENT> res = social_app.get('/login') <NEW_LINE> assert ('Connect with facebook</a>' in res.body.decode('unicode_escape'))
Login:Form displayed social form.
625941ee9c8ee82313fbbcb9
def updateIndividualEndpoint(self, sid, endpointType=None, uri=None, description=None, default=None): <NEW_LINE> <INDENT> self.check_sid(sid) <NEW_LINE> data = {} <NEW_LINE> if (default) and (default != 0): <NEW_LINE> <INDENT> data['default'] = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> data['default'] = 0 <NEW_LI...
Update field or fields for an endpoint defined by sid. Args: sid - ID of endpoint you are updating endpointType - Type of endpoint your want to update your endpoint to. uri - URI you want to update your endpoint to. description - Updated description for endpointType. default - Up...
625941ee50812a4eaa59c85e
def __init__(self, n_arms): <NEW_LINE> <INDENT> self.n_impressions = np.ones(n_arms).astype(float) <NEW_LINE> self.n_rewards = np.ones(n_arms).astype(float)
Thompsom Sampling constructor. :param n_arms: Number of arms which this instance need to perform.
625941ee1f5feb6acb0c508c
def get_status(self): <NEW_LINE> <INDENT> return self.raw
Return JSON encoded captured data
625941ee090684286d50f231
def hasCycle(self, head): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> first, second = head, head.next <NEW_LINE> while fist is not second: <NEW_LINE> <INDENT> first = first.next <NEW_LINE> second = second.next.next <NEW_LINE> <DEDENT> return True <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return False
:type head: ListNode :rtype: bool
625941eeab23a570cc2506c9
def equation_of_time(day): <NEW_LINE> <INDENT> day_of_year = day.toordinal() - date(day.year, 1, 1).toordinal() <NEW_LINE> A = EARTH_ORIBITAL_VELOCITY * (day_of_year + 10) <NEW_LINE> B = A + 1.914 * sin(radians(EARTH_ORIBITAL_VELOCITY * (day_of_year - 2))) <NEW_LINE> movement_on_equatorial_plane = degrees( atan2( tan(r...
Compute the equation of time for the given date. Uses formula described at https://en.wikipedia.org/wiki/Equation_of_time#Alternative_calculation :param day: The datetime.date to compute the equation of time for :returns: The angle, in radians, of the Equation of Time
625941eecb5e8a47e48b7fe4
def _service_url(request, redirect_to=None): <NEW_LINE> <INDENT> protocol = get_protocol(request) <NEW_LINE> host = request.get_host() <NEW_LINE> ticketless_full_path = request.get_full_path() <NEW_LINE> match = re.search(r'(&ticket=[\w\-\.]+)(?:[&].+|$)(?:$|)', ticketless_full_path) <NEW_LINE> if match: <NEW_LINE> <IN...
Generates application service URL for CAS
625941eed53ae8145f87a7a7
def handle_field_add_desc(self, fmt, hdl, cls = None): <NEW_LINE> <INDENT> item = { 'format': fmt, 'width': struct.calcsize(fmt), 'handler': hdl, 'anncls': cls, } <NEW_LINE> self.field_desc.append(item)
Register description for a PJON frame field.
625941ee7d43ff24873a31e7
def replot(self): <NEW_LINE> <INDENT> logger = logging.getLogger(__name__) <NEW_LINE> if self.plotEnabled: <NEW_LINE> <INDENT> points = self.waveform.evaluate() <NEW_LINE> points = points.tolist() <NEW_LINE> self.plot.getItem(0,0).clear() <NEW_LINE> if self.settings.channelSettingsList[self.channel]['plotStyle'] == sel...
Plot the waveform
625941eef8510a7c17cf9c43
def __init__(self, catalog_url): <NEW_LINE> <INDENT> session = session_manager.create_session() <NEW_LINE> resp = session.get(catalog_url) <NEW_LINE> resp.raise_for_status() <NEW_LINE> self.catalog_url = resp.url <NEW_LINE> self.base_tds_url = _find_base_tds_url(self.catalog_url) <NEW_LINE> if 'html' in resp.headers['c...
Initialize the TDSCatalog object. Parameters ---------- catalog_url : str The URL of a THREDDS client catalog
625941ee167d2b6e312190d7
def __init__(self,program,prompts,args=None,out=sys.stdout,echo=True): <NEW_LINE> <INDENT> self.program = program <NEW_LINE> self.prompts = prompts <NEW_LINE> if args is None: args = [] <NEW_LINE> self.args = args <NEW_LINE> self.out = out <NEW_LINE> self.echo = echo <NEW_LINE> self.delaybeforesend = 0 <NEW_LINE> c = s...
Construct a runner. Inputs: - program: command to execute the given program. - prompts: a list of patterns to match as valid prompts, in the format used by pexpect. This basically means that it can be either a string (to be compiled as a regular expression) or a list of such (it must be a true list,...
625941ee0fa83653e46574fa
def pycodestylpe_check(filename): <NEW_LINE> <INDENT> pycodestyle_res = io.StringIO() <NEW_LINE> sys.stdout = pycodestyle_res <NEW_LINE> pycodestyle_errors = pycodestyle.Checker(filename).check_all() <NEW_LINE> sys.stdout = sys.__stdout__ <NEW_LINE> res = pycodestyle_res.getvalue() <NEW_LINE> return pycodestyle_errors,...
run pycodestyle, return #errors and error string
625941ee66656f66f7cbc6ef
@app.errorhandler(405) <NEW_LINE> def method_not_allowed(error): <NEW_LINE> <INDENT> return render_template('405.html', error=error), 405
Renders a custom 405 error page with a link to take the user back to homework.html
625941eee5267d203edce1d8
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, SubscriberSummary): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941ee9c8ee82313fbbcba
def printCalibParsDefault (self, partype=None) : <NEW_LINE> <INDENT> if partype==None : <NEW_LINE> <INDENT> for type in self.list_of_clib_types : <NEW_LINE> <INDENT> print('\nprintCalibParsDefault(): Calibration constants type "' + type + '"') <NEW_LINE> print(self.defpars[type]) <NEW_LINE> <DEDENT> <DEDENT> else : <NE...
Print the calibration prarameters of specified partype or all for dafault.
625941ee73bcbd0ca4b2c5b8
def list_users_in_group(self, group_id, per_page=500, offset=0, max_records=None): <NEW_LINE> <INDENT> self.log.info(f"Listing groups.") <NEW_LINE> return self.handle_pagination( endpoint=f"v1/groups/{group_id}/users", per_page=per_page, offset=offset, max_records=max_records, )
List the users in a group in your Domo instance. https://developer.domo.com/docs/groups-api-reference/groups-2#List%20users%20in%20a%20group :param max_records: The total number of records you would like to retrieve. If this value is less than the per_page value, then the limit will be used inste...
625941ee56b00c62f0f14b9f
def LinTransform(dest, M, x): <NEW_LINE> <INDENT> I = len(A) <NEW_LINE> J = len(x) <NEW_LINE> for i in range(0,I): <NEW_LINE> <INDENT> dest[i] = 0.0 <NEW_LINE> for j in range(0,J): <NEW_LINE> <INDENT> dest[i] += M[i][j] * x[j]
Multiply matrix M by 1-dimensioal array (vector) "x" (from the right). Store result in 1-dimensional array "dest". In this function, wetreat "x" and "dest" as a column vectors. (Not row vectors.)
625941ee4d74a7450ccd4708
def isExternalType(self): <NEW_LINE> <INDENT> return (self.typ in self.EXTERNAL_TYPES or self.typ in ['file', 'directory'])
Return True iff values of this type are file paths
625941eee1aae11d1e74a1ff
def write_html(cal_dir, results, run): <NEW_LINE> <INDENT> if not os.path.exists(cal_dir): <NEW_LINE> <INDENT> logger.debug('calibration directory does not exist, creating') <NEW_LINE> os.makedirs(cal_dir) <NEW_LINE> <DEDENT> logger.debug(f'Writing results to {cal_dir}') <NEW_LINE> with open(''.join([cal_dir, CAL_FILE,...
Write the data to the calib directory
625941ee57b8e32f524839e1
def hasCycle(self, head): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> walker = head <NEW_LINE> runner = head.next <NEW_LINE> while walker and runner and runner.next: <NEW_LINE> <INDENT> walker = walker.next <NEW_LINE> runner = runner.next.next <NEW_LINE> if walker == runner: <N...
:type head: ListNode :rtype: bool
625941ee5f7d997b87174fdf
def model_batch_norm(x_crop, y_, reuse, is_train): <NEW_LINE> <INDENT> W_init = tf.truncated_normal_initializer(stddev=5e-2) <NEW_LINE> W_init2 = tf.truncated_normal_initializer(stddev=0.04) <NEW_LINE> b_init2 = tf.constant_initializer(value=0.1) <NEW_LINE> with tf.variable_scope("model", reuse=reuse): <NEW_LINE> <INDE...
Batch normalization should be placed before rectifier.
625941eeb545ff76a8914358
def __init__(self): <NEW_LINE> <INDENT> super(UpdateChooser, self).__init__() <NEW_LINE> self.initUI() <NEW_LINE> self.retranslateUI() <NEW_LINE> self.task = WorkThread() <NEW_LINE> self.task.signal_done.connect(self.recreateChooser) <NEW_LINE> self.startTask()
Initialize progress bar and workthread
625941ee3cc13d1c6d3c78ba
def verify_minconf(self, _minconf = None): <NEW_LINE> <INDENT> if not _minconf or not type(_minconf) == int or not _minconf >= 0: <NEW_LINE> <INDENT> raise Exception("CtbCoin::verify_minconf(): _minconf wrong type (%s), empty, or negative (%s)", type(_minconf), _minconf) <NEW_LINE> <DEDENT> return _minconf
Verify and return minimum number of confirmations
625941ee23e79379d52eea9f
def __init__(self): <NEW_LINE> <INDENT> this = _MontePython_cxx.new_Reatto2VortexPotentialEnergy() <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this
__init__(Reatto2VortexPotentialEnergy self) -> Reatto2VortexPotentialEnergy
625941ee8a43f66fc4b545a2
def test(): <NEW_LINE> <INDENT> assert len(squares) == 81 <NEW_LINE> assert len(unitlist) == 27 <NEW_LINE> assert all(len(units[s]) == 3 for s in squares) <NEW_LINE> assert all(len(peers[s]) == 20 for s in squares) <NEW_LINE> assert units['C2'] == [ ['A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'I2'], ['C1', 'C2', '...
A set of tests for def cross(A,B) set up that must pass.
625941ee627d3e7fe0d69394
def create_context(self): <NEW_LINE> <INDENT> return DirContext()
Creates the context that we are testing.
625941ee287bf620b61d3fa3
def _get_bulk(self, queue, max_if_unlimited=10): <NEW_LINE> <INDENT> maxcount = self.qos.can_consume_max_estimate() <NEW_LINE> maxcount = max_if_unlimited if maxcount is None else min(max(maxcount, 1), max_if_unlimited) <NEW_LINE> messages = self._get_from_sqs(queue, count=maxcount) <NEW_LINE> if not messages: <NEW_LIN...
Try to retrieve multiple messages off ``queue``. Where _get() returns a single Payload object, this method returns a list of Payload objects. The number of objects returned is determined by the total number of messages available in the queue and the number of messages that the QoS object allows (based on the prefetch_...
625941eebf627c535bc13712
def __init__(self, next_page_token=None, page_count=None, page_size=None, participants=None, total_records=None): <NEW_LINE> <INDENT> self._next_page_token = None <NEW_LINE> self._page_count = None <NEW_LINE> self._page_size = None <NEW_LINE> self._participants = None <NEW_LINE> self._total_records = None <NEW_LINE> se...
InlineResponse20028 - a model defined in Swagger
625941ee5166f23b2e1a569c
def test_set_bold(self): <NEW_LINE> <INDENT> expected_rPr_xml = ( '<a:rPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006' '/main" b="1"/>') <NEW_LINE> self.font.bold = True <NEW_LINE> rPr_xml = oxml_tostring(self.font._Font__rPr) <NEW_LINE> assert_that(rPr_xml, is_(equal_to(expected_rPr_xml)))
Setting _Font.bold to True selects bold font weight
625941ee460517430c3946b9
def _smoothing(precision_fractions, c=1): <NEW_LINE> <INDENT> ratios = [0] * len(precision_fractions) <NEW_LINE> for i, precision_fraction in enumerate(precision_fractions): <NEW_LINE> <INDENT> if precision_fraction[1] > 0: <NEW_LINE> <INDENT> ratios[i] = float(precision_fraction[0] + c) / (precision_fraction[1] + c) <...
Compute the smoothed precision for all the orders. Parameters ---------- precision_fractions: list(tuple) Contain a list of (precision_numerator, precision_denominator) pairs c: int, default 1 Smoothing constant to use Returns ------- ratios: list of floats Contain the smoothed precision_fractions.
625941ee15fb5d323cde105a
def grad_loss_wrt_w(self, x, y): <NEW_LINE> <INDENT> val = list() <NEW_LINE> for i in range(0, x.shape[0]): <NEW_LINE> <INDENT> if (1 - y[i]*(np.matmul(self.w, x[i].T) + self.b) > 0): <NEW_LINE> <INDENT> val.append((1/float(x.shape[0]))*-y[i]*x[i]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> val.append(np.zeros(x.sha...
Compute the gradient of the loss with respect to w Parameters ---------- x : np.array The input data of size number of training samples x number of features y : np.array The vector of corresponding class labels Returns ------- np.array The gradient (should be the same size as self.w)
625941ee596a897236089ffc
def make_inline(a, frmt): <NEW_LINE> <INDENT> if frmt in LATEX_LIKE: <NEW_LINE> <INDENT> return make_latex_inline(a) <NEW_LINE> <DEDENT> if frmt in HTML_LIKE: <NEW_LINE> <INDENT> return make_html_inline(a)
Wähle die passende make(LaTeX/HTML)Inline gemäß dem Format aus. :param a: :param frmt: format
625941eef9cc0f698b140b39
def test_encrypted_save(self): <NEW_LINE> <INDENT> key = self.get_random_string() <NEW_LINE> secret = self.get_random_string() <NEW_LINE> self.provider.key = key <NEW_LINE> self.provider.secret = secret <NEW_LINE> self.provider.save() <NEW_LINE> found_key = Provider.objects.filter(key=key).exists() <NEW_LINE> self.asse...
Encrypt key/secret on save.
625941ee3c8af77a43ae3cea
def _wrap_bitmap_bits_in_array(bitmap, shape, dtype): <NEW_LINE> <INDENT> pitch = _FI.FreeImage_GetPitch(bitmap) <NEW_LINE> height = shape[1] <NEW_LINE> byte_size = height * pitch <NEW_LINE> itemsize = dtype.itemsize <NEW_LINE> if len(shape) == 3: <NEW_LINE> <INDENT> nchannels = shape[2] <NEW_LINE> strides = (nchannels...
Return an ndarray view on the data in a FreeImage bitmap. Only valid for as long as the bitmap is loaded (if single page) / locked in memory (if multipage). Shape is interpreted as (width, height) or (width, height, nchannels).
625941eee5267d203edce1d9
def _get_fields(self): <NEW_LINE> <INDENT> fields = [ IntIdField(name='id'), self._update_time, self._update_type, self._trade[self.TRADE_PX_INDEX], self._trade[self.TRADE_QTY_INDEX] ] <NEW_LINE> for i in range(0, self._depth): <NEW_LINE> <INDENT> fields += self._bids[i] <NEW_LINE> fields += self._asks[i] <NEW_LINE> <D...
Get fields.
625941eea05bb46b383ecd5f
def makeAttributes(self, line, extension): <NEW_LINE> <INDENT> creationDate = time.ctime(os.path.getctime(line)) <NEW_LINE> size = os.path.getsize(line)/1000. <NEW_LINE> return [str(line), creationDate, size, extension]
Make the attributes array line: csv line extension: file extension
625941eed99f1b3c44c67ac7
def upscale_ETOPO2v2_to_10minute_grid(self): <NEW_LINE> <INDENT> file_label = self._generate_file_label() <NEW_LINE> etopo2v2_file=path.join(self.orography_path,"ETOPO2v2c_f4.nc") <NEW_LINE> intermediary_file=self.generated_orography_filepath + "intermediary_" +file_label + ".nc" <NEW_LINE> output_file=self.generated_o...
Upscale ETOPO2v2 data to a 10 minutes grid by averaging
625941ee16aa5153ce3629bb
def array2arrays(self, frame, ballx, bally): <NEW_LINE> <INDENT> r = [] <NEW_LINE> for i in range(len(frame)): <NEW_LINE> <INDENT> temp = [] <NEW_LINE> temp.append(frame[i]) <NEW_LINE> temp.append(ballx[i]) <NEW_LINE> temp.append(bally[i]) <NEW_LINE> r.append(temp) <NEW_LINE> <DEDENT> return r
convert array to arrays by point num example # point=[1,2,3,3,4,4,4,4] hit=["A","B","A","B","A","B","A","B"] array_hit=[[], ['A'], ['B'], ['A', 'B'], ['A', 'B', 'A', 'B']]
625941eed53ae8145f87a7a8
def dispersion(t: np.ndarray, params: np.ndarray): <NEW_LINE> <INDENT> t_t, p_d = params <NEW_LINE> return ((4 * np.pi * p_d * t / t_t) ** -0.5) * (1 / t) * np.exp(-((1 - (t / t_t)) ** 2) / (4 * p_d * t / t_t))
Calculate response function for DM :param t: time range :param params: transit time and dispersion parameter (Pd) :return: calculated response function g(t)
625941eed6c5a10208144592
def populate(self, chunk, seed): <NEW_LINE> <INDENT> reseed(seed) <NEW_LINE> factor = 1 / 256 <NEW_LINE> for x, z in product(xrange(16), repeat=2): <NEW_LINE> <INDENT> magx = (chunk.x * 16 + x) * factor <NEW_LINE> magz = (chunk.z * 16 + z) * factor <NEW_LINE> height = octaves2(magx, magz, 6) <NEW_LINE> height *= 15 <NE...
Make smooth waves of stone.
625941eead47b63b2c50a4c2
def __init__(self, region: Tuple[int, int]): <NEW_LINE> <INDENT> if region[0] < 0 or region[1] < 0: <NEW_LINE> <INDENT> raise exc.RegionException( "A coordinate of the Region1D was specified as negative." ) <NEW_LINE> <DEDENT> if region[0] >= region[1]: <NEW_LINE> <INDENT> raise exc.RegionException( "The first pixel in...
A region of a 1D array defined as a tuple (x0, x1) = (left-pixel, right-pixel). For example, the overscan of 1D data may be defined by the region (40, 50), indicating it spans 10 pixels after 40 rows of data. Parameters ----------- region The coordinates on the 1D data of the region defined following the conventi...
625941eeec188e330fd5acd7
def itkHessianRecursiveGaussianImageFilterIF3_cast(*args): <NEW_LINE> <INDENT> return _itkHessianRecursiveGaussianImageFilterPython.itkHessianRecursiveGaussianImageFilterIF3_cast(*args)
itkHessianRecursiveGaussianImageFilterIF3_cast(itkLightObject obj) -> itkHessianRecursiveGaussianImageFilterIF3
625941ee8a349b6b435e86b5
def _split_url(self, memes_urls, character): <NEW_LINE> <INDENT> splited_urls = [] <NEW_LINE> for i in range(len(memes_urls)): <NEW_LINE> <INDENT> splited_urls.append(memes_urls[i].split(character)) <NEW_LINE> <DEDENT> return splited_urls
Split url by "/" character. Example: "http://kwejk.pl" -> ["http", "", "kwejk.pl"] :param memes_urls: 1D array of urls. :return: Splitted array of urls. Returns 2D array.
625941ee004d5f362079a872
def assemble_end_sequence(self, recipe): <NEW_LINE> <INDENT> order = self.end_order <NEW_LINE> template_name = 'print_end_sequence' <NEW_LINE> gcodes = self.assemble_sequence_from_recipe( recipe, template_name, order) <NEW_LINE> return gcodes
Given an end recipe, assembles the correct sequence @param recipe: The recipe used to create the sequence @return list gcodes: Sequence of gcodes derived from the recipe
625941ee29b78933be1e5be8
def save(self, to_save, callback=None,manipulate=True, safe=False, **kwargs): <NEW_LINE> <INDENT> if not isinstance(to_save, dict): <NEW_LINE> <INDENT> raise TypeError("cannot save object of type %s" % type(to_save)) <NEW_LINE> <DEDENT> if "_id" not in to_save: <NEW_LINE> <INDENT> self.insert(to_save, manipulate, safe,...
Save a document in this collection. If `to_save` already has an ``"_id"`` then an :meth:`update` (upsert) operation is performed and any existing document with that ``"_id"`` is overwritten. Otherwise an ``"_id"`` will be added to `to_save` and an :meth:`insert` operation is performed. If the save succeeds, it pas...
625941ee21bff66bcd684e91
def GetTypeName(self): <NEW_LINE> <INDENT> return _lldb.SBTypeFormat_GetTypeName(self)
GetTypeName(self) -> str
625941ee15baa723493c44bd
def geocode(self, query, **kwargs): <NEW_LINE> <INDENT> if self.session and isinstance(self.session, aiohttp.client.ClientSession): <NEW_LINE> <INDENT> raise AioHttpError("Cannot use `geocode` in an async context, use `gecode_async`.") <NEW_LINE> <DEDENT> request = self._parse_request(query, kwargs) <NEW_LINE> response...
Given a string to search for, return the results from OpenCage's Geocoder. :param string query: String to search for :returns: Dict results :raises InvalidInputError: if the query string is not a unicode string :raises RateLimitExceededError: if you have exceeded the number of queries you can make. Exception says whe...
625941ee94891a1f4081bfef
def prefix_suffix_prep(string1: str, string2: str) -> Tuple[int, int, int]: <NEW_LINE> <INDENT> len1 = len(string1) <NEW_LINE> len2 = len(string2) <NEW_LINE> while len1 != 0 and string1[len1 - 1] == string2[len2 - 1]: <NEW_LINE> <INDENT> len1 -= 1 <NEW_LINE> len2 -= 1 <NEW_LINE> <DEDENT> start = 0 <NEW_LINE> while star...
Calculates starting position and lengths of two strings such that common prefix and suffix substrings are excluded. Expects len(string1) <= len(string2). Args: string_1: Base string. string_2: The string to compare. Returns: A tuple of lengths of the part excluding common prefix and suffix, and th...
625941ee30c21e258bdfa9e6
def run(args): <NEW_LINE> <INDENT> torch.manual_seed(args.seed) <NEW_LINE> train_loader, test_loader, eval_loader = inputs.load_data(args) <NEW_LINE> sequential_model, criterion, optimizer = model.create(args) <NEW_LINE> for epoch in range(1, args.num_epochs + 1): <NEW_LINE> <INDENT> train(sequential_model, train_loade...
Load the data, train, evaluate, and export the model for serving and evaluating. Args: args: experiment parameters.
625941eeff9c53063f47c734
def closeQuestion(self): <NEW_LINE> <INDENT> if self.isSaved is False: <NEW_LINE> <INDENT> answer = QMessageBox.question( self, self.tr('Question'), self.tr('Do you want to save your data before exit?'), QMessageBox.Yes | QMessageBox.No) <NEW_LINE> if answer == QMessageBox.Yes: <NEW_LINE> <INDENT> self.saveFileAs() <NE...
Asks about to close.
625941eeaad79263cf390f8c
def get_vnc_console(self, context, instance): <NEW_LINE> <INDENT> output = self._call_compute_message('get_vnc_console', context, instance) <NEW_LINE> rpc.call(context, '%s' % FLAGS.vncproxy_topic, {'method': 'authorize_vnc_console', 'args': {'token': output['token'], 'host': output['host'], 'port': output['port']}}) <...
Get a url to a VNC Console.
625941eea934411ee3751bd8
def test_07_checksecure_notallowed_command(self): <NEW_LINE> <INDENT> args = self.args + ["--allowed=['ls']"] <NEW_LINE> userconf = CheckConfig(args).returnconf() <NEW_LINE> INPUT = "ll" <NEW_LINE> return self.assertEqual(sec.check_secure(INPUT, userconf)[0], 1)
U07 | forbidden command, should return 1
625941ee21a7993f00bc823d
def _objects_triplets(dict_class_subj_prop_obj): <NEW_LINE> <INDENT> for entity_graphic_class in sorted(dict_class_subj_prop_obj): <NEW_LINE> <INDENT> url_class = lib_util.EntityClassUrl(entity_graphic_class) <NEW_LINE> url_class_with_mode = _url_in_html_mode(url_class) <NEW_LINE> dict_subj_prop_obj = dict_class_subj_p...
Group objects by class. Display list of classes with an index and a link to the class.
625941ee63b5f9789fde7629
def set_descriptormodel(self, descriptormodel, out_features=[], out_type=None): <NEW_LINE> <INDENT> self._format_outtypes(out_type) <NEW_LINE> descriptormodel.set_functions(type(self.features).__name__, self._out) <NEW_LINE> self.descriptormodel = descriptormodel <NEW_LINE> self._format_out_features(out_features) <NEW_...
Link the descriptormodel and the feature retriever. Parameters ---------- descriptormodel: pst.BaseDescriptormodel the descriptormodel information. out_features: list (default=[]) the output features names. out_type: str, optional ['array', 'ndarray', 'dict'] (default=None) the output type we want to retri...
625941ee8e05c05ec3eea8bd
def on_exit(self, callback: Callable[[], Awaitable[Any]]) -> None: <NEW_LINE> <INDENT> self.manager.get_plugin(callback.__module__).set_on_exit_callback(callback)
set a callback to calls when the userge is exiting
625941eeb545ff76a8914359
def testZeroPeriod(self): <NEW_LINE> <INDENT> self.assertRaises( dos.ConfigError, dos.limit, count=1, period=0)
Tests when the count is less than zero.
625941eea17c0f6771cbe592
def _downloadStandingsTable(self): <NEW_LINE> <INDENT> standingsUrl = ('http://games.espn.com/flb/standings?view=official&' + urlencode((self.leagueId, self.seasonId))) <NEW_LINE> html = self._getHTML(standingsUrl, login=self.login) <NEW_LINE> tables = html.xpath('//table[@class="tableBody"]') <NEW_LINE> dfs = [] <NEW_...
Download league official "Standings" table. There are two tables within the page, roto and season stats. Input: roto bool Output: league standings dataframe
625941ee8c3a873295158905
def __init__(self, levelKey, matchKey, matchValue): <NEW_LINE> <INDENT> Level.__init__(self, levelKey) <NEW_LINE> self.matchKey = matchKey <NEW_LINE> self.matchValue = matchValue
__init__ - Create a Level_ListMap object @param levelKey <str> - The key with which to find this list-of-maps @param matchKey <str> - The key we will check against in each map @param matchValue<str> - The value we are looking for in #matchKey to select that map
625941eecad5886f8bd2751c
def bool_value_renderer(value, **options): <NEW_LINE> <INDENT> if options.get('no_html', False): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> return '<i class="fa {} {}"></i>'.format( 'fa-check-square-o' if value else 'fa-square-o', 'text-success' if value else 'text-danger' )
Render boolean value
625941ee7d847024c06be804
def replace_greek_spelled_out(s): <NEW_LINE> <INDENT> for greek_uni, greek_spelled_out in greek_alphabet.items(): <NEW_LINE> <INDENT> s = s.replace(greek_uni, greek_spelled_out) <NEW_LINE> <DEDENT> return s
Replace Greek unicode character with latin spelled out.
625941eed58c6744b42581a1
def get_board_by_index(devices, index): <NEW_LINE> <INDENT> board = {} <NEW_LINE> if 1 <= index <= len(devices): <NEW_LINE> <INDENT> device = devices[index - 1] <NEW_LINE> board["hostname"] = device.get("hostname") <NEW_LINE> board["board"] = device.get("target_board", "") <NEW_LINE> board["ip"] = device.get("ip", "") ...
Returns the required data to flash a given board
625941ee91af0d3eaac9bf61
def changeThreadColor(self, color, thread_id=None): <NEW_LINE> <INDENT> thread_id, thread_type = self._getThread(thread_id, None) <NEW_LINE> data = { 'color_choice': color.value if color != ThreadColor.MESSENGER_BLUE else '', 'thread_or_other_fbid': thread_id } <NEW_LINE> j = self._post(self.req_url.THREAD_COLOR, data,...
Changes thread color :param color: New thread color :param thread_id: User/Group ID to change color of. See :ref:`intro_threads` :type color: models.ThreadColor :raises: FBchatException if request failed
625941eee64d504609d74d83
def _build_parsed_values(self): <NEW_LINE> <INDENT> result = [] <NEW_LINE> if self._data_match: <NEW_LINE> <INDENT> result = [self._encode_value(DostadMetadataDataParticleKey.PRODUCT_NUMBER, self._data_match.group(1), int), self._encode_value(DostadMetadataDataParticleKey.SERIAL_NUMBER, self._data_match.group(2), int)]...
Take something in the binary data values and turn it into a particle with the appropriate tag.
625941ee498bea3a759b9ff1
def bitter_rivals(voting_dict): <NEW_LINE> <INDENT> return min_key({ (k,l):policy_compare(k,l,voting_dict) for k in voting_dict.keys() for l in voting_dict.keys() if l != k })
Input: a dictionary mapping senator names to lists representing their voting records Output: a tuple containing the two senators who most strongly disagree with one another. Example: >>> voting_dict = {'Klein':[-1,0,1], 'Fox-Epstein':[-1,-1,-1], 'Ravella':[0,0,1], 'Oyakawa':[1,1,1], 'Loery':[1,1,0]}...
625941ee0fa83653e46574fb
def __initialise_parser(self): <NEW_LINE> <INDENT> utf8_parser = etree.XMLParser( remove_blank_text=True, encoding='utf-8', recover=True) <NEW_LINE> self._ATTR_CMPT = 0 <NEW_LINE> try: <NEW_LINE> <INDENT> self.etree_xml = etree.parse(self.filePath, parser=utf8_parser) <NEW_LINE> self.namespace = '{' + self.etree_xml.xp...
Initialization of the XML/TEI parser for current document
625941ee24f1403a926010a5