code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def addData(self, data): <NEW_LINE> <INDENT> for x in data: <NEW_LINE> <INDENT> self.data[x]=data[x]
add more data to the call. Note that this does not delete the existing data (in case you define things separately
625941efaad79263cf390fc6
def split_into_sevens(binary): <NEW_LINE> <INDENT> final=[] <NEW_LINE> count=0 <NEW_LINE> pre="" <NEW_LINE> for i in binary: <NEW_LINE> <INDENT> pre=pre+i <NEW_LINE> count=count+1 <NEW_LINE> if count%7==0: <NEW_LINE> <INDENT> final=final+[pre] <NEW_LINE> count=0 <NEW_LINE> pre="" <NEW_LINE> <DEDENT> <DEDENT> return fin...
slits the user input that has been checked into groups of 7 :param binary: User input that has been checked from the previous functions :return: final, the group of chunks
625941efd486a94d0b98e6c3
def determine_run_play(game): <NEW_LINE> <INDENT> return game
Determines the chance for the offense to execute a run play
625941ef55399d3f05588c35
def leastBorders(x,y,r,x1,y1,x2,y2): <NEW_LINE> <INDENT> pass
return integer that's the fewest number of borders to cross as described below starting at (x1,y1) integer coordinates traveling to (x2,y2) integer coordinates with circles described by integer lists x,y,r, where x[i] and y[i] contain integer coordinates of i-th circle center and r[i] is i-th circle's radius
625941ef7b25080760e399d2
def delete_item(self, location, user_id, revision=None, **kwargs): <NEW_LINE> <INDENT> self._verify_branch_setting(ModuleStoreEnum.Branch.draft_preferred) <NEW_LINE> _verify_revision_is_published(location) <NEW_LINE> is_item_direct_only = location.category in DIRECT_ONLY_CATEGORIES <NEW_LINE> if is_item_direct_only or ...
Delete an item from this modulestore. The method determines which revisions to delete. It disconnects and deletes the subtree. In general, it assumes deletes only occur on drafts except for direct_only. The only exceptions are internal calls like deleting orphans (during publishing as well as from delete_orphan view). ...
625941ef293b9510aa2c380d
def resolveLinks(self, *pa, **kwa): <NEW_LINE> <INDENT> parms = self.actor.resolveLinks(**self.parms) <NEW_LINE> for key, value in parms.items(): <NEW_LINE> <INDENT> self.parms[key] = value
Resolve any links in associated parms for actors Should be overridden if use arguments
625941ef66673b3332b9260e
def get_complementary_sequence(dna): <NEW_LINE> <INDENT> new_list = '' <NEW_LINE> for char in dna: <NEW_LINE> <INDENT> new_list += get_complement(char) <NEW_LINE> <DEDENT> return new_list
(str) -> str Return the DNA sequence that is complementary to the given DNA sequence. >>> get_complementary_sequence('AT') 'TA' >>> get_complementary_sequence('GC') 'CG' >>> get_complementary_sequence('CC') False
625941ef24f1403a926010de
def update_state_ids(states: [State]): <NEW_LINE> <INDENT> states.sort(key = lambda st: st.x) <NEW_LINE> for i in range(0, len(states)): <NEW_LINE> <INDENT> if states[i].new_id[0] == '1': <NEW_LINE> <INDENT> states[i].new_id.append("1") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if states[i].new_id[0] == '2': <NEW_L...
:param states: :return:
625941ef7b180e01f3dc4d6e
def test_simple_add_id(): <NEW_LINE> <INDENT> results = simple_add_id() <NEW_LINE> assert results['meta']['id'] == 'aaa'
Test adding a simple id
625941efbe383301e01b59f8
def xml(self): <NEW_LINE> <INDENT> layout = current.deployment_settings.get_ui_icon_layout() <NEW_LINE> if layout: <NEW_LINE> <INDENT> return layout(self) <NEW_LINE> <DEDENT> css_class = self.css_class(self.name) <NEW_LINE> if css_class: <NEW_LINE> <INDENT> self.add_class(css_class) <NEW_LINE> <DEDENT> return super(ICO...
Render this instance as XML
625941efbe7bc26dc91cdb72
def _set_code_size(self): <NEW_LINE> <INDENT> if self._by == 'amino_acid': <NEW_LINE> <INDENT> self._code = MOLECULES.amino_acids <NEW_LINE> <DEDENT> elif self._by == 'codon': <NEW_LINE> <INDENT> self._code = MOLECULES.codons <NEW_LINE> <DEDENT> elif self._by == 'nucleotide': <NEW_LINE> <INDENT> self._code = MOLECULES....
Set up the code (alphabet) and dimensionality for computing self._byFreqs
625941efcad5886f8bd27555
def scale(self, scale, center=None): <NEW_LINE> <INDENT> scale_matrix = np.zeros(self.dims[::-1]) <NEW_LINE> for i in range(min(self.dims)): <NEW_LINE> <INDENT> scale_matrix[i,i] = scale[i] <NEW_LINE> <DEDENT> if center is not None: <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> self.matrix = np.do...
Scale the matrix about a given origin. The scaling is applied *after* the transformations already present in the matrix. Parameters ---------- scale : array-like Scale factors along x, y and z axes. center : array-like or None The x, y and z coordinates to scale around. If None, (0, 0, 0) will be used.
625941ef63d6d428bbe44a6e
def rm_lrm(str_to_modify): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if str_to_modify[0] == "\u200e": <NEW_LINE> <INDENT> str_to_modify = str_to_modify[1:] <NEW_LINE> <DEDENT> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> printts("{}".format(str(e))) <NEW_LINE> <DEDENT> return str_to_modify
Remove Left to Right Mark (LRM) from provided string start
625941ef099cdd3c635f11d5
def list_of_items(items): <NEW_LINE> <INDENT> item_list = [x["name"] for x in items ] <NEW_LINE> item_list = ', '.join(item_list) <NEW_LINE> return item_list
This function takes a list of items (see items.py for the definition) and returns a comma-separated list of item names (as a string). For example: >>> list_of_items([item_pen, item_handbook]) 'a pen, a student handbook' >>> list_of_items([item_id]) 'id card' >>> list_of_items([]) '' >>> list_of_items([item_money, i...
625941efe8904600ed9f24b4
def test_itemsReceivedNotify(self): <NEW_LINE> <INDENT> self.client.addObserver(self.observer) <NEW_LINE> self.clock.advance(5) <NEW_LINE> self.client.itemsReceived(self.event) <NEW_LINE> self.assertEquals(1, len(self.observer.events))
Received items result in notifications being generated and notified.
625941efe5267d203edce213
def capitalize_line(instr): <NEW_LINE> <INDENT> return " ".join( word.capitalize() for word in instr.split() )
capitalizes the input string :param instr: the string to capitalize it should be a single line. :type instr: string :returns: a capitalized version of instr
625941ef2eb69b55b151ce35
def inverse_log_fq(token, sent): <NEW_LINE> <INDENT> fdist = nltk.FreqDist(sent) <NEW_LINE> if log1p(fdist[token]): <NEW_LINE> <INDENT> return 1/log1p(fdist[token]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0
calculate the penalty for the token's inverse log frequency :param token: :param sent: :return:
625941efe64d504609d74dbd
def _createPileupConfigFile(self, helper): <NEW_LINE> <INDENT> encoder = JSONEncoder() <NEW_LINE> url = helper.data.dbsUrl <NEW_LINE> dbsReader = DBSReader(url) <NEW_LINE> configDict = self._queryDbsAndGetPileupConfig(helper, dbsReader) <NEW_LINE> json = encoder.encode(configDict) <NEW_LINE> stepPath = "%s/%s" % (self....
Stores pileup JSON configuration file in the working directory / sandbox.
625941ef3317a56b8693a1c7
def transform(self, X, Y=None, copy=True): <NEW_LINE> <INDENT> check_is_fitted(self) <NEW_LINE> X = check_array(X, copy=copy, dtype=FLOAT_DTYPES) <NEW_LINE> X -= self.x_mean_ <NEW_LINE> X /= self.x_std_ <NEW_LINE> x_scores = torch.mm(X, self.x_rotations_) <NEW_LINE> if Y is not None: <NEW_LINE> <INDENT> Y = check_array...
Apply the dimension reduction learned on the train data. Parameters ---------- X : array-like of shape (n_samples, n_features) Training vectors, where n_samples is the number of samples and n_features is the number of predictors. Y : array-like of shape (n_samples, n_targets) Target vectors, where n_samples...
625941ef3317a56b8693a1c8
def title(value): <NEW_LINE> <INDENT> value = value.lower() <NEW_LINE> t = re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title()) <NEW_LINE> return re.sub("\d([A-Z])", lambda m: m.group(0).lower(), t)
Converts a string into titlecase. Lifted from Django.
625941ef091ae356686674d2
def check_origin_4321(swh_scheduler: SchedulerInterface, lister: Lister) -> None: <NEW_LINE> <INDENT> origin_4321_req = swh_scheduler.get_listed_origins( url="https://github.com/origin/4321" ) <NEW_LINE> assert len(origin_4321_req.results) == 1 <NEW_LINE> origin_4321 = origin_4321_req.results[0] <NEW_LINE> assert origi...
Check that origin 4321 exists and has the proper last_update timestamp
625941efde87d2750b860316
def __call__(self, function): <NEW_LINE> <INDENT> @functools.wraps(function) <NEW_LINE> def wrapper(request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> query = request.query.to_dict(flat=False) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> query = dict(request.query.items()) <NEW_LINE> <DEDENT> try:...
:type function: types.FunctionType :rtype: types.FunctionType
625941ef711fe17d825428dc
def add_stderr_logger(level: int = logging.DEBUG) -> "logging.StreamHandler[TextIO]": <NEW_LINE> <INDENT> logger = logging.getLogger(__name__) <NEW_LINE> handler = logging.StreamHandler() <NEW_LINE> handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) <NEW_LINE> logger.addHandler(handler) <N...
Helper for quickly adding a StreamHandler to the logger. Useful for debugging. Returns the handler after adding it.
625941ef8e71fb1e9831dd24
def get_title(article): <NEW_LINE> <INDENT> return truncate_title(article.title)
Utility function to format the title of an article...
625941ef6aa9bd52df037325
def has_edges_between(self, u, v): <NEW_LINE> <INDENT> u_array = u.todgltensor() <NEW_LINE> v_array = v.todgltensor() <NEW_LINE> return utils.toindex(_CAPI_DGLGraphHasEdgesBetween(self, u_array, v_array))
Return true if the edge exists. Parameters ---------- u : utils.Index The src nodes. v : utils.Index The dst nodes. Returns ------- utils.Index 0-1 array indicating existence
625941ef925a0f43d254a3fa
def validate_no_duplicate_end_event_type_per_transporation_trip(self): <NEW_LINE> <INDENT> events = self.events <NEW_LINE> trans_trips = {e.transportation_trip for e in self.events if e.transportation_trip} <NEW_LINE> for t in trans_trips: <NEW_LINE> <INDENT> end_events = list(filter(lambda e: e.is_end_event and e.tran...
Check for no duplicate end events type per transportation Trip
625941efa79ad161976cc6c3
def manageTrace(self, trace): <NEW_LINE> <INDENT> self.trace = trace <NEW_LINE> if vtrace.remote: <NEW_LINE> <INDENT> trace.registerNotifier(vtrace.NOTIFY_ALL, v_rmi.getCallbackProxy(trace, self.dnotif)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> trace.registerNotifier(vtrace.NOTIFY_ALL, self.dnotif) <NEW_LINE> <DED...
Set all the modes/meta/notifiers in this trace for management by this TraceManager.
625941ef92d797404e30470a
def validate_email(self, email): <NEW_LINE> <INDENT> user = User.query.filter_by(email=email.data).first() <NEW_LINE> if user: <NEW_LINE> <INDENT> raise ValidationError( 'That email already registered! try a different one.')
to check if email already exists in db while registering!
625941ef5fc7496912cc3efb
def validate_cms_signature(signed_data: cms.SignedData, status_cls: Type[StatusType] = SignatureStatus, raw_digest: bytes = None, validation_context: ValidationContext = None, status_kwargs: dict = None, key_usage_settings: KeyUsageConstraints = None, externally_invalid=False): <NEW_LINE> <INDENT> status_kwargs = _vali...
Validate a detached CMS signature (i.e. a ``SignedData`` object). :param signed_data: The :class:`.asn1crypto.cms.SignedData` object to validate. :param status_cls: Status class to use for the validation result. :param raw_digest: Raw digest, computed from context. :param validation_context: Validation...
625941efcc40096d61595ecb
def test_020_role_exact(self): <NEW_LINE> <INDENT> q = IoportconQuery(self.p, role="role20_r", role_regex=False) <NEW_LINE> ports = sorted(p.ports for p in q.results()) <NEW_LINE> self.assertListEqual([(20, 20)], ports)
Portcon query with context role exact match
625941ef0c0af96317bb8765
def print_error(self, text: str, end: str ='\n', start: str='') -> None: <NEW_LINE> <INDENT> self.poutput(start + self.t.bold_red('[-]') + ' ' + self.t.red(text), end=end)
Prints a formatted error message
625941efdc8b845886cb5ab4
def remove_observer(self, func): <NEW_LINE> <INDENT> with self.observerLock: <NEW_LINE> <INDENT> i = 0 <NEW_LINE> while i < len(self.observers): <NEW_LINE> <INDENT> ofunc = self.observers[i][0] <NEW_LINE> if ofunc == func: <NEW_LINE> <INDENT> del self.observers[i] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> i += 1
Remove all observers with function func
625941ef24f1403a926010df
def build_config(update_path): <NEW_LINE> <INDENT> return Config(config(update_path))
Builds config :param str update_path: path to upgrade :returns: :class:`Config` object
625941ef30bbd722463cc347
def get_media_detail_output_interface_interface_identifier_xfpe_xfpe_vendor_name(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> get_media_detail = ET.Element("get_media_detail") <NEW_LINE> config = get_media_detail <NEW_LINE> output = ET.SubElement(get_media_detail, "output") <NEW_LINE> i...
Auto Generated Code
625941efb830903b967e9e82
def get_ExtentRule(self): <NEW_LINE> <INDENT> return super(IGPRasterSchema, self).get_ExtentRule()
Method IGPRasterSchema.get_ExtentRule OUTPUT Type : esriGPSchemaExtentType*
625941ef5510c4643540f953
def get_B_matrix(n, period): <NEW_LINE> <INDENT> num_full_cycles = int(np.ceil(n/float(period))) <NEW_LINE> identity_p = identity_spmatrix(period) <NEW_LINE> num = num_full_cycles * period <NEW_LINE> B = zero_spmatrix(num, period) <NEW_LINE> for i in xrange(num_full_cycles): <NEW_LINE> <INDENT> B[i*period:(i+1)*period,...
:param n: number of target variables :param period: length of period :return: B matrix which maps p -> S cyclically S_i = p_j (where j = i mod period)
625941efcc0a2c11143dd40f
def __TimeVal__isoformat(self, sep='T'): <NEW_LINE> <INDENT> return self.todatetime().isoformat(sep)
isoformat(self, sep='T') -> str Returns a string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM] Parameters : sep : (str) sep is used to separate the year from the time, and defaults to 'T' Return : (str) a string representing the time according to a format specification. .. versiona...
625941ef15fb5d323cde1096
def get_model_probabilities(self) -> pd.DataFrame: <NEW_LINE> <INDENT> vars = [(key, val) for key, val in self._model_probabilities.items()] <NEW_LINE> ms = [var[0] for var in vars] <NEW_LINE> ps = [var[1] for var in vars] <NEW_LINE> return pd.DataFrame({'m': ms, 'p': ps}).set_index('m')
Get probabilities of the individual models. Returns ------- model_probabilities: List The model probabilities.
625941ef9f2886367277ae06
def __init__(self, error_messages=[], status=400): <NEW_LINE> <INDENT> if isinstance(error_messages, six.string_types): <NEW_LINE> <INDENT> error_messages = [error_messages] <NEW_LINE> <DEDENT> content = json.dumps({'errors': error_messages}, indent=2, ensure_ascii=False) <NEW_LINE> super(JsonError, self).__init__(cont...
Object constructor, returns an error response containing the provided exception messages
625941efff9c53063f47c76e
def max_state_and_prob_at(self, j): <NEW_LINE> <INDENT> return max(self.sequence.iloc[j].items(), key=lambda kv: kv[1])
Return state,prob pair with highest prob among states at position j :param j: position, 0 <= j <= T-1 :return: pair (state,prob)
625941ef377c676e91272724
def update_task(self, task_id, token, data): <NEW_LINE> <INDENT> return self.tester.put('/todo/api/tasks/{}'.format(task_id), data=json.dumps(data), headers=self._do_headers(token), content_type='application/json')
Update a task
625941efbde94217f368336a
def metrics_scatterplot(metrics_df, x_offset=None, scatterplot_kwargs=None): <NEW_LINE> <INDENT> if scatterplot_kwargs is None: <NEW_LINE> <INDENT> scatterplot_kwargs = dict() <NEW_LINE> <DEDENT> fig, ax = plt.subplots(figsize=(4, 4)) <NEW_LINE> x_name = metrics_df.columns[0] <NEW_LINE> y_name = metrics_df.columns[1] <...
makes a scatterplot of the first column in `metrics_df` by the second column in `metrics_df` Parameters ---------- metrics_df : pd.DataFrame DataFrame containing numerical measurments in the first two columns x_offset : float amount to offset scatterplot point labels by scatterplot_kwargs : dict kwargs to ...
625941ef82261d6c526aba26
def setckheaders2dl(setckheaders): <NEW_LINE> <INDENT> setckdl = elel.array_map(setckheaders,setckheader2dict) <NEW_LINE> return(setckdl)
setckhs = ['Set-Cookie: BIGipServe=rd0; path=/','Set-Cookie: TS=0105; Path=/; Secure; HTTPOnly'] setckdl = setckheaders2dl(setckhs) pobj(setckdl)
625941ef9b70327d1c4e1356
@lst.command('buckets') <NEW_LINE> @click.option( '--profile', 'profile_name', default=None, help='Specify the AWS profile to use as credentials.') <NEW_LINE> def list_buckets(**kwargs): <NEW_LINE> <INDENT> client = S3Client(**kwargs) <NEW_LINE> return client.print_buckets()
Lists all S3 buckets [options]
625941efc4546d3d9de72fb7
def rob(self, nums): <NEW_LINE> <INDENT> if len(nums) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if len(nums) == 1: <NEW_LINE> <INDENT> return nums[0] <NEW_LINE> <DEDENT> curMax = nums[0] <NEW_LINE> preMax = 0 <NEW_LINE> for i in range(1, len(nums)): <NEW_LINE> <INDENT> temp = curMax <NEW_LINE> curMax = max...
:type nums: List[int] :rtype: int
625941ef5166f23b2e1a56d7
def dthetady(x, y, r=None): <NEW_LINE> <INDENT> r2 = x**2 + y**2 if r is None else r**2 <NEW_LINE> indx = r2 == 0. <NEW_LINE> if not np.any(indx): <NEW_LINE> <INDENT> return x / r2 <NEW_LINE> <DEDENT> dtheta = np.zeros(x.shape, dtype=float) <NEW_LINE> _indx = indx & (x == 0.) <NEW_LINE> dtheta[_indx] = 1e20 <NEW_LINE> ...
Compute the derivative of :math:`\theta=\tan^{-1}(y/x)` w.r.t. :math:`y`. When both :math:`x` and :math:`y` are non-zero, the result is: .. math:: \frac{\partial \theta}{\partial y} = \frac{x}{r^2} In the limit where both :math:`x` and :math:`y` approach 0, this reduces to :math:`\pm \infinity`, where the sign ...
625941ef1f5feb6acb0c50c7
def reload_index(self, progress_cb=dummy_progress_cb): <NEW_LINE> <INDENT> docs_by_id = self._docs_by_id <NEW_LINE> self._docs_by_id = {} <NEW_LINE> for doc in docs_by_id.values(): <NEW_LINE> <INDENT> doc.drop_cache() <NEW_LINE> <DEDENT> del docs_by_id <NEW_LINE> query = whoosh.query.Every() <NEW_LINE> results = self._...
Read the index, and load the document list from it
625941ef091ae356686674d3
def get_gf_by_key(pk, headers, request): <NEW_LINE> <INDENT> url = docker_container_ip + '/gfs/%d' % pk <NEW_LINE> gf_json = requests.get(url, headers=headers).json() <NEW_LINE> if 'results' in gf_json: <NEW_LINE> <INDENT> gf_json = gf_json['results'] <NEW_LINE> <DEDENT> elif 'detail' in gf_json: <NEW_LINE> <INDENT> pr...
Get-Method for API-Requests gets specific GF by key :param headers: :param request: :return:
625941ef66673b3332b9260f
def remove(self, item: Eventory): <NEW_LINE> <INDENT> title = sanitise_string(item.title) <NEW_LINE> self.eventories.pop(title) <NEW_LINE> os.remove(path.join(self.directory, item.filename))
Remove an Eventory from the Eventorial. Args: item: Eventory to removes Raises: KeyError: If the Eventory isn't part of the Eventorial
625941efa8370b7717052e1c
def ensure_active_group(self): <NEW_LINE> <INDENT> with self._lock: <NEW_LINE> <INDENT> if self._heartbeat_thread is None: <NEW_LINE> <INDENT> self._start_heartbeat_thread() <NEW_LINE> <DEDENT> while self.need_rejoin(): <NEW_LINE> <INDENT> self.ensure_coordinator_ready() <NEW_LINE> if not self.rejoining: <NEW_LINE> <IN...
Ensure that the group is active (i.e. joined and synced)
625941ef55399d3f05588c36
def chapeaux(self): <NEW_LINE> <INDENT> chapeaux = [] <NEW_LINE> if self.statut != cst.P_ATTEND_TIRAGE: <NEW_LINE> <INDENT> for equipe in self.equipes(): <NEW_LINE> <INDENT> if equipe.resultat(self.numero).etat == cst.CHAPEAU: <NEW_LINE> <INDENT> chapeaux.append(equipe) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return sort...
Retourne la liste des chapeaux de cette partie.
625941efeab8aa0e5d26e0d8
def dummy_code(groups, n_cond=1): <NEW_LINE> <INDENT> labels = dummy_label(groups, n_cond) <NEW_LINE> dummy = np.column_stack([labels == g for g in np.unique(labels)]) <NEW_LINE> return dummy.astype(int)
Dummy codes `groups` and `n_cond` Parameters ---------- groups : (G,) list List with number of subjects in each of `G` groups n_cond : int, optional Number of conditions, for each subject. Default: 1 Returns ------- Y : (S, F) `numpy.ndarray` Dummy-coded group array
625941ef3d592f4c4ed1d5dc
def _is(val): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> val = float(val.replace(',','.')) <NEW_LINE> if int(val) == val: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return val >= 6037008 and val <= 7230728 <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return False
Renvoie True si val peut etre une latitude en Lambert 93
625941ef29b78933be1e5c23
def read_file(file_path): <NEW_LINE> <INDENT> with open(file_path, 'r') as f: <NEW_LINE> <INDENT> data = f.read() <NEW_LINE> <DEDENT> return data
Reads file at `file_path` in read-only mode. Parameters ----------------- file_path : str Path of file to read. data : str Data read from file.
625941ef4e4d5625662d494e
def insert(self, val: int) -> bool: <NEW_LINE> <INDENT> ret = val not in self.s <NEW_LINE> self.s.add(val) <NEW_LINE> return ret
Inserts a value to the set. Returns true if the set did not already contain the specified element.
625941ef0383005118ecfb5f
def run(self): <NEW_LINE> <INDENT> while self.running: <NEW_LINE> <INDENT> for proc in self.proccesses: <NEW_LINE> <INDENT> duration = proc.duration() <NEW_LINE> maxDuration = self.cfg.get('max_run_time',proc.module.name) <NEW_LINE> try: <NEW_LINE> <INDENT> maxDuration = int(maxDuration) <NEW_LINE> <DEDENT> except: <NE...
run() Starting the process manager, invoked by self.start().
625941efe64d504609d74dbe
def get_info_of_connected_devices(): <NEW_LINE> <INDENT> return
Returns information about associated devices - 802.11 AP: info about the associated client devices of that AP. - Other??
625941ef6aa9bd52df037326
def get_total_height(self, height): <NEW_LINE> <INDENT> height = re.sub(r"\(.*?\)", "", height) <NEW_LINE> height = re.sub(r"\[.*?\]", "", height) <NEW_LINE> height = re.sub(r"<.*?>", "", height) <NEW_LINE> height = re.sub(r"{{.*?}}", "", height).replace("{", "").replace("}", "") <NEW_LINE> height = re.sub(r"(?<=\d)\s(...
Převádí celkovou výšku vodopádu do jednotného formátu. Parametry: height - ceková výška vodopádu (str)
625941ef63f4b57ef0001687
def _show_parameters(self): <NEW_LINE> <INDENT> import sys <NEW_LINE> self.config.write(sys.stdout) <NEW_LINE> return
Write parameters to stdout.
625941efbf627c535bc1374e
def CheckConfirmationProof(pi, y_hat, secparams): <NEW_LINE> <INDENT> AssertClass(secparams, SecurityParams) <NEW_LINE> (t, s) = pi <NEW_LINE> c = GetNIZKPChallenge(y_hat, t, secparams.tau, secparams) <NEW_LINE> t_prime = (gmpy2.powmod(y_hat,-c,secparams.p_hat) * gmpy2.powmod(secparams.g_hat,s, secparams.p_hat)) % secp...
Algorithm 7.36: Checks the correctness of a NIZKP pi generated by Alg. 7.33. The public value of this proof is the public confirmation credential y_hat. Args: pi: The NIZKP to check y_hat: The public confirmation credential secparams (SecurityP...
625941ef23849d37ff7b3609
def _target( *, command: typing.Sequence[typing.Union[bytes, str, os.PathLike]], stdout_function: typing.Optional[typing.Callable] = None, stderr_function: typing.Optional[typing.Callable] = None, exception_function: typing.Optional[typing.Callable] = None, exit_code_on_killed: int = 0, ): <NEW_LINE> <INDENT> if not st...
Manage the actual command we're running.
625941efeab8aa0e5d26e0d9
def check_if_user_exists(self, email): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.users[email] <NEW_LINE> return 'user with ' + email + ' already exists' <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return False
[summary]
625941ef66656f66f7cbc72b
def offline(ctx: commands.Context, ignore_dm: bool = False): <NEW_LINE> <INDENT> if not ctx.guild: <NEW_LINE> <INDENT> return ignore_dm <NEW_LINE> <DEDENT> return False
A function that checks if DM is ignored. This is only used when Ignore Cog is offline. Parameters ---------- ctx : commands.Context pass in context for analysis ignore_dm : bool whether or not the command is being ignored in direct messages Returns ------- bool Whether or not that channel is ignored
625941efe1aae11d1e74a23b
def has_build(self, build): <NEW_LINE> <INDENT> return build in self.builds.all()
Checks if instance is in builds field of the instance :param build: instance to check :return: True if instance in instance field, False otherwise
625941ef7d847024c06be83f
def _idpaths_sorted(self, bucketpath): <NEW_LINE> <INDENT> entry_names = os.listdir(bucketpath) <NEW_LINE> entry_ids = [] <NEW_LINE> for name in entry_names: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> entry_ids.append(int(name)) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDE...
Generator of paths to files in a bucketpath. Filters for entry files with names coercable to int(). Ordered.
625941ef21a7993f00bc8279
def set_LoanID(self, value): <NEW_LINE> <INDENT> super(GetLendersInputSet, self)._set_input('LoanID', value)
Set the value of the LoanID input for this Choreo. ((required, string) The ID of the loan for which to get details.)
625941efb5575c28eb68e584
def plot(self, r, draw, rgba, highlightPoints=False): <NEW_LINE> <INDENT> rotated_face = np.transpose(np.dot(r, np.transpose(self.face_matrix))) <NEW_LINE> [v1, v2, v3, v4] = shift + scale * rotated_face <NEW_LINE> draw.polygon([(v1[0], v1[1]), (v2[0], v2[1]), (v4[0], v4[1]), (v3[0], v3[1])], rgba) <NEW_LINE> if highli...
Plots the current face on the image whose draw object is passed.
625941efe1aae11d1e74a23c
def make_station_header(json_object, destination_filter, context): <NEW_LINE> <INDENT> name = json_object["stationinfo"]["standardname"] <NEW_LINE> station_time = timestamp_to_human_readable_time(json_object["timestamp"]) <NEW_LINE> direction = destination_filter or "all" <NEW_LINE> title = name + " (direction: " + dir...
Make a header much like an actual liveboard in a train station.
625941ef29b78933be1e5c24
def p_addQPP(t): <NEW_LINE> <INDENT> addPOper('print') <NEW_LINE> addQuadruple(['print'])
addQPP : COMMA
625941ef2ae34c7f2600d6af
def get_matrix(self, mtyp, bodyid=1, bodyid2=1): <NEW_LINE> <INDENT> w1matrix = self._get_record('w1matrix') <NEW_LINE> ibconi = self._get_ibcond(bodyid) <NEW_LINE> ibconj = self._get_ibcond(bodyid2) <NEW_LINE> cond = '(ibconi=={}) & (ibconj=={}) & (imtyp=={})'.format(ibconi, ibconj, mtyp) <NEW_LINE> if mtyp in (11, 22...
Get matrix. Parameters ---------- mtyp : int Used to specify matrix type: - 11 = First order body mass matrix - 12 = First order added mass matrix (freq. dependant) - 21 = First order potential damping matrix (freq. dependant) - 22 = Viscous damping matrix - 31 = Hydrostatic...
625941ef167d2b6e31219113
def append_ad_link(ad, on_done): <NEW_LINE> <INDENT> if ad.shortened_url is not None: <NEW_LINE> <INDENT> on_done(ad) <NEW_LINE> <DEDENT> ad.shortened_url = '' <NEW_LINE> def success(url): <NEW_LINE> <INDENT> ad.shortened_url = url <NEW_LINE> on_done(ad) <NEW_LINE> <DEDENT> def error(e=None): <NEW_LINE> <INDENT> if e i...
calls on_done with a NewsItem object that has a bit.ly link to its redirect_url appended
625941ef711fe17d825428dd
def queen_diagonal_attack_3(x1, y1): <NEW_LINE> <INDENT> return []
This goes right and up
625941ef796e427e537b0b49
def update(self): <NEW_LINE> <INDENT> for i in range(1, len(self.players) + 1): <NEW_LINE> <INDENT> self.points[i].append( eval("self.players[{} - 1]".format(i) + self.graph_type[3]) ) <NEW_LINE> <DEDENT> self.points[0].append(self.points[0][-1] + 1)
Update the values to be plotted.
625941efbe383301e01b59f9
def get_measures(self, metric, aggregations, from_timestamp=None, to_timestamp=None, resample=None): <NEW_LINE> <INDENT> timeseries = self.get_aggregated_measures( metric, aggregations, from_timestamp, to_timestamp) <NEW_LINE> if resample: <NEW_LINE> <INDENT> for agg, ts in six.iteritems(timeseries): <NEW_LINE> <INDENT...
Get aggregated measures from a metric. Deprecated. Use `get_aggregated_measures` instead. :param metric: The metric measured. :param aggregations: The aggregations to retrieve. :param from timestamp: The timestamp to get the measure from. :param to timestamp: The timestamp to get the measure to. :param resample: The ...
625941efd7e4931a7ee9e49e
def getVertexByLabel(self, element): <NEW_LINE> <INDENT> return self._v[element]
get the first vertex that matches element.
625941ef07f4c71912b11a04
def request(self, expand=None, select=None, options=None): <NEW_LINE> <INDENT> req = DriveRequest(self._request_url, self._client, options) <NEW_LINE> req._set_query_options(expand=expand, select=select) <NEW_LINE> return req
Builds the DriveRequest Args: expand (str): Default None, comma-separated list of relationships to expand in the response. select (str): Default None, comma-separated list of properties to include in the response. options (list of :class:`Option<microsoft.msgraph.options.Option>`): ...
625941ef3d592f4c4ed1d5dd
def test_get_state_comparison_stats_identified_as_colored(self): <NEW_LINE> <INDENT> key = '% Employees identified as "colored"' <NEW_LINE> for i in range(1): <NEW_LINE> <INDENT> employee = EmployeeFactory(colored=True) <NEW_LINE> employee.bureau_states.add(self.texas) <NEW_LINE> <DEDENT> for i in range(3): <NEW_LINE> ...
'% Employees identified as "colored"' should contain states with the top x percentage of employees identified as "colored"
625941ef30dc7b7665901edf
def add_cleanup(self, exit_block: BasicBlock) -> None: <NEW_LINE> <INDENT> if self.need_cleanup(): <NEW_LINE> <INDENT> self.builder.activate_block(self.loop_exit) <NEW_LINE> self.gen_cleanup() <NEW_LINE> self.builder.goto(exit_block)
Add post-loop cleanup, if needed.
625941ef627d3e7fe0d693d0
def reload(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(self.__file_path, "r") as f: <NEW_LINE> <INDENT> self.__objects = json.loads(f.read()) <NEW_LINE> for obj_id, obj in self.__objects.items(): <NEW_LINE> <INDENT> self.__objects[obj_id] = eval(obj['__class__'])(**obj) <NEW_LINE> <DEDENT> <DEDENT> <D...
Load JSON content of <file.json>, in multi dict format on __objects
625941ef50812a4eaa59c89a
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, SilenceStatus): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941ef3cc13d1c6d3c78f6
def get_gene_changes(psms): <NEW_LINE> <INDENT> LOGGER.info('Getting gene correlations ({} IDs)'.format(psms.shape[0])) <NEW_LINE> gene_changes = psms[['ID', 'Correlation']].copy() <NEW_LINE> if gene_changes.shape[0] > 0: <NEW_LINE> <INDENT> gene_changes = gene_changes.groupby( 'ID', as_index=False, ).agg({ 'Correlatio...
Extract the gene IDs and correlation values for each gene / phosphosite in a data set. Merge together duplicate IDs by calculating their mean correlation. Parameters ---------- psms : :class:`pandas.DataFrame`
625941ef99fddb7c1c9de90d
def _create_carrier(self, carrier_id: str, name: str) -> 'Carrier': <NEW_LINE> <INDENT> carrier = Carrier(carrier_id=carrier_id, name=name) <NEW_LINE> self._carriers[carrier_id] = carrier <NEW_LINE> return carrier
Создает экземпляр Carrier.
625941efbe383301e01b59fa
def find_root_bounds(x, power): <NEW_LINE> <INDENT> low = min(-1, x) <NEW_LINE> high = max(1, x) <NEW_LINE> return low, high
x a float, power a positive int return low, high such that low**power <= x and high ** power >= x
625941ef44b2445a33932611
def main() -> None: <NEW_LINE> <INDENT> start_time = timeit.default_timer() <NEW_LINE> puzzle_input = import_list() <NEW_LINE> logger.debug(puzzle_input) <NEW_LINE> logger.info(f"Part 1: 80 days gives a total of " f"{new_lanternfish(puzzle_input, 80)} fish.") <NEW_LINE> logger.info(f"Part 2: 256 days gives a total of "...
Import the puzzle input, process and display the results.
625941ef7b25080760e399d5
def read_state(self): <NEW_LINE> <INDENT> result = self.i2c_bus.read_i2c_block_data(self.i2c_bus_address, 2, 11) <NEW_LINE> max_int_32 = 2 ** 31 <NEW_LINE> encoder1 = (result[0] << 24) + (result[1] << 16) + (result[2] << 8) + result[3] <NEW_LINE> if encoder1 > max_int_32: <NEW_LINE> <INDENT> encoder1 ...
Private method to read the state of the MD25 board @rtype : tuple @return : both motors' encoders count (2 int), battery's voltage (float), both motors' current (2 float)
625941ef507cdc57c6307268
def indicators_edit(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.indicators_edit_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.indicators_edit_with_http_info(**kwargs) <NEW_LINE>...
Edit Indicator # noqa: E501 Edit an indicator entity To update indicator custom fields you should lowercase them and remove all spaces. For example: Scan IP -> scanip # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = ap...
625941efd7e4931a7ee9e49f
def set_attenuation(self, value=RFFEATT_MAX, timeout=TIMEOUT): <NEW_LINE> <INDENT> for bpm in self: <NEW_LINE> <INDENT> bpm.rffe_att = value <NEW_LINE> <DEDENT> mstr = '' <NEW_LINE> okall = True <NEW_LINE> t0 = _time.time() <NEW_LINE> for bpm in self: <NEW_LINE> <INDENT> tout = timeout - (_time.time() - t0) <NEW_LINE> ...
.
625941ef7c178a314d6ef9e8
@require_http_methods(['GET']) <NEW_LINE> @login_required <NEW_LINE> def phenotype(request, display_id, phenotype_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.filter(id=request.user.id) <NEW_LINE> owner_genomes = Genome.objects.filter(owner=user) <NEW_LINE> reader_genomes = Genome.objects.filte...
Detailed view for each phenotype of risk reports.
625941ef56b00c62f0f14bdc
def gradcheck_naive(f, x): <NEW_LINE> <INDENT> rndstate = random.getstate() <NEW_LINE> random.setstate(rndstate) <NEW_LINE> fx, grad = f(x) <NEW_LINE> h = 1e-4 <NEW_LINE> it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite']) <NEW_LINE> while not it.finished: <NEW_LINE> <INDENT> ix = it.multi_index <NEW_LINE>...
Gradient check for a function f. Arguments: f -- a function that takes a single argument and outputs the cost and its gradients x -- the point (numpy array) to check the gradient at AKA, checkpoint
625941efe64d504609d74dbf
def make_sine_waves(global_conditioning): <NEW_LINE> <INDENT> sample_period = 1.0/SAMPLE_RATE_HZ <NEW_LINE> times = np.arange(0.0, SAMPLE_DURATION, sample_period) <NEW_LINE> if global_conditioning: <NEW_LINE> <INDENT> LEADING_SILENCE = random.randint(10, 128) <NEW_LINE> amplitudes = np.zeros(shape=(NUM_SPEAKERS, len(ti...
Creates a time-series of sinusoidal audio amplitudes.
625941ef3539df3088e2e8cb
@ops.RegisterShape("TopK") <NEW_LINE> @ops.RegisterShape("TopKV2") <NEW_LINE> def _TopKShape(op): <NEW_LINE> <INDENT> input_shape = op.inputs[0].get_shape().with_rank_at_least(1) <NEW_LINE> if len(op.inputs) >= 2: <NEW_LINE> <INDENT> k = tensor_util.constant_value(op.inputs[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND...
Shape function for TopK and TopKV2 ops.
625941ef10dbd63aa1bd3121
def downvoted(self, **generator_kwargs): <NEW_LINE> <INDENT> return ListingGenerator(self._reddit, urljoin(self._path, 'downvoted'), **generator_kwargs)
Return a ListingGenerator for items the user has downvoted. May raise ``prawcore.Forbidden`` after issuing the request if the user is not authorized to access the list. Note that because this function returns a :class:`.ListingGenerator` the exception may not occur until sometime after this function has returned. Add...
625941ef0c0af96317bb8766
def load(): <NEW_LINE> <INDENT> return load_pandas()
Load the statecrime data and return a Dataset class instance. Returns ------- Dataset See DATASET_PROPOSAL.txt for more information.
625941efbe8e80087fb211b9
def GetName (self): <NEW_LINE> <INDENT> return Obit.ODataGetName(self.cast(myClass).me)
Tells OData object name (label) returns name as character string * self = Python OData object
625941ef4e4d5625662d494f
def opt_weights( X, metric="return", max_leverage=1, rf_rate=0.0, alpha=0.0, freq=252, no_cash=False, sd_factor=1.0, **kwargs, ): <NEW_LINE> <INDENT> assert metric in ("return", "sharpe", "drawdown", "ulcer") <NEW_LINE> assert X.notnull().all().all() <NEW_LINE> x_0 = max_leverage * np.ones(X.shape[1]) / float(X.shape[1...
Find best constant rebalanced portfolio with regards to some metric. :param X: Prices in ratios. :param metric: what performance metric to optimize, can be either `return` or `sharpe` :max_leverage: maximum leverage :rf_rate: risk-free rate for `sharpe`, can be used to make it more aggressive :alpha: regularization par...
625941ef090684286d50f26e
def list_targets(self): <NEW_LINE> <INDENT> targets_tmp = os.listdir(self.pathRoot) <NEW_LINE> targets = [] <NEW_LINE> for target in targets_tmp: <NEW_LINE> <INDENT> if not target.startswith('.f') and os.path.isdir(os.path.join(self.pathRoot,target)) and not target.startswith('DISK') and not target.startswit...
Returns a list of all targets in the library Output: - list of strings
625941ef4f6381625f114fba
def get_favorite(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Get my favorite bands. :rtype: iter[:class:`Favorites`]
625941ef1b99ca400220b033
def collatz_solve (r, w) : <NEW_LINE> <INDENT> while True : <NEW_LINE> <INDENT> a = collatz_read(r) <NEW_LINE> if not a : <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> i, j = a <NEW_LINE> v = collatz_eval(i, j) <NEW_LINE> collatz_print(w, i, j, v)
r a reader w a writer
625941ef85dfad0860c3b3dc
def setUp(self): <NEW_LINE> <INDENT> smm = SoftwareManager() <NEW_LINE> if not smm.check_installed("bridge-utils") and not smm.install("bridge-utils"): <NEW_LINE> <INDENT> self.cancel("bridge-utils package is need to test") <NEW_LINE> <DEDENT> self.host_interface = self.params.get("interface", default=None) <NEW_LINE> ...
To check and install dependencies for the test
625941ef7c178a314d6ef9e9
def binaryTreePaths(self, root): <NEW_LINE> <INDENT> if root is None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> return self.binaryTreePathsHelper(root, str(root.val))
:type root: TreeNode :rtype: List[str]
625941ef379a373c97cfb0c6