code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def execute( stackCode): <NEW_LINE> <INDENT> TheStack = list() <NEW_LINE> for func in stackCode: <NEW_LINE> <INDENT> func( TheStack) <NEW_LINE> <DEDENT> return TheStack[-1]
execute : list( StackOp) -> int Each StackOp is a function of the form Function : Stack -> NoneType and its action occurs as a side effect changing the stack argument to the function. The Stack implementation is a python list.
625941cdbde94217f3682f06
def get_state(self,angles): <NEW_LINE> <INDENT> for i in range(24): <NEW_LINE> <INDENT> self.angles[i] = self.ang2rad(angles[i]) <NEW_LINE> <DEDENT> class Pos(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [ ("x", ctypes.c_float), ("y", ctypes.c_float), ("z", ctypes.c_float), ("elbowx", ctypes.c_float), ("elbowy", c...
Get current state by current angles Return: The state wrapped by torch.FloatTensor with dim (3, )
625941cdaad79263cf390b56
def fuel_ferc1(self, update=False): <NEW_LINE> <INDENT> if update or self._dfs["fuel_ferc1"] is None: <NEW_LINE> <INDENT> self._dfs["fuel_ferc1"] = pudl.output.ferc1.fuel_ferc1(self.pudl_engine) <NEW_LINE> <DEDENT> return self._dfs["fuel_ferc1"]
Pull the FERC Form 1 steam plants fuel consumption data. Args: update (bool): If true, re-calculate the output dataframe, even if a cached version exists. Returns: pandas.DataFrame: a denormalized table for interactive use.
625941cd99fddb7c1c9de4a6
def trainable_variables_on_device(self, rel_device_num, abs_device_num, writable=False): <NEW_LINE> <INDENT> del rel_device_num, writable <NEW_LINE> if self.each_tower_has_variables(): <NEW_LINE> <INDENT> params = [ v for v in tf.trainable_variables() if v.name.startswith('v%s/' % abs_device_num) ] <NEW_LINE> <DEDENT> ...
Return the set of trainable variables on device. Args: rel_device_num: local worker device index. abs_device_num: global graph device index. writable: whether to get a reference to the underlying variable. Returns: The set of trainable variables on the specified device.
625941cd4f6381625f114b50
def handle_field_get_desc(self, idx = None): <NEW_LINE> <INDENT> if not self.field_desc: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if idx is None: <NEW_LINE> <INDENT> idx = self.field_desc_idx <NEW_LINE> <DEDENT> if idx >= 0 and idx >= len(self.field_desc): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> ...
Lookup description of a PJON frame field.
625941cd3317a56b86939d6d
def rare_variant(self, threshold, populations_to_consider=Ancestry.all()): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if Ancestry.Overall in populations_to_consider: <NEW_LINE> <INDENT> if not self.rare_variant_population(threshold, 'AF'): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> if Ancestry.Afri...
This function returns whether or not this mutation is rare; if it has an incidence of MAF or greater in the populations However, mutation.rare_variant takes an optional argument which can specify which populations should be checked :populations_to_consider: A list of objects of type Ancestry :return: Boolean, if this m...
625941cd091ae35668667073
def plot_variance_accumulation(self, thresh=6, verbose=False): <NEW_LINE> <INDENT> sns.set_palette(palette=self.color_palette, n_colors=None, desat=None, color_codes=True) <NEW_LINE> if self.pcs is None: <NEW_LINE> <INDENT> self.get_pcs() <NEW_LINE> <DEDENT> var_accum = self.var_ratios.cumsum() <NEW_LINE> ax = var_accu...
Plot variance accumulation over PCs.
625941cdd58c6744b4257d75
def render(self, request): <NEW_LINE> <INDENT> data = self.content(request) <NEW_LINE> request.setHeader('content-type', self.content_type) <NEW_LINE> request.setHeader('cache-control', 'no-cache') <NEW_LINE> request.setHeader( 'content-disposition', 'inline; filename="%s"' % (data['filename']) ) <NEW_LINE> return data...
Renders a given build status as PNG file We don't care about pre or post paths here so we skip them, we only care about parameters passed in the URL, those are: :param builder: the builder name :param size: the size of the PNG than can be 'small', 'normal', 'large' :returns: a binary PNG
625941cd23849d37ff7b31a4
def registerPlayer(name): <NEW_LINE> <INDENT> db, cursor = connect() <NEW_LINE> query = "INSERT INTO players (name) VALUES (%s);" <NEW_LINE> parameter = (name.replace("'", '"'),) <NEW_LINE> cursor.execute(query, parameter) <NEW_LINE> db.commit() <NEW_LINE> db.close()
Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.) Args: name: the player's full name (need not be unique).
625941cd9c8ee82313fbb88a
def change_en_mort(self,i,j): <NEW_LINE> <INDENT> self.li[i][j].configure(bg = 'black', command=lambda:self.change_en_vivant(i,j)) <NEW_LINE> self.modele.plateau[i][j].val = 0
Vue, int, int -> None Change la valeur de la case de coordonnées (i,j) à 0 (morte).
625941cdcdde0d52a9e53148
def reconnect(self): <NEW_LINE> <INDENT> if self._remote_host is None: <NEW_LINE> <INDENT> raise ValueError('Cannot reconnect before first connection.') <NEW_LINE> <DEDENT> self.close() <NEW_LINE> self.connect(self._remote_host, self._remote_port, self._peername, self._ssh_user, self._ssh, self._ssh_rpython, self._ssh_...
Reconnect to the remote host. This will reset the remote environment, and any currently held proxied objects will become invalid.
625941cd4c3428357757c43d
def time(self, non_speech_char="."): <NEW_LINE> <INDENT> total = 0.0 <NEW_LINE> if self.classid != TEXTTIER: <NEW_LINE> <INDENT> for (time1, time2, utt) in self.simple_transcript: <NEW_LINE> <INDENT> utt = utt.strip() <NEW_LINE> if utt and not utt[0] == "." and len(utt) > 0: <NEW_LINE> <INDENT> total += (float(time2) -...
@return: Utterance time of a given tier. Screens out entries that begin with a non-speech marker.
625941cdd7e4931a7ee9e033
def output(self): <NEW_LINE> <INDENT> bar = "" <NEW_LINE> if self.bar_mode: <NEW_LINE> <INDENT> bar = "{}" <NEW_LINE> self.bar(self.val) <NEW_LINE> <DEDENT> out = self.prefix + bar + self.postfix <NEW_LINE> update = "\r" + out.format(*[e() for e in self.elements]) <NEW_LINE> string_len = len(update) <NEW_LINE> if strin...
Render the updated progress
625941cd01c39578d7e74f50
def sum(self, prefix): <NEW_LINE> <INDENT> ptr, s = self.root, 0 <NEW_LINE> for p in prefix: <NEW_LINE> <INDENT> if p in ptr.child: <NEW_LINE> <INDENT> ptr = ptr.child[p] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> <DEDENT> return self.dfs(ptr)
:type prefix: str :rtype: int
625941cd21bff66bcd684a68
def getTeamProgressList(user): <NEW_LINE> <INDENT> logger.info('getTeamProgressList: ' + user.username) <NEW_LINE> team_progress_lists = [] <NEW_LINE> my_membership = MODELS.Membership.objects.filter(user=user) <NEW_LINE> if len(my_membership) == 1: <NEW_LINE> <INDENT> my_membership = my_membership[0] <NEW_LINE> team_m...
ユーザからチームの別メンバの進捗を取得する return progress_management[]
625941cde5267d203edcddb2
def version(): <NEW_LINE> <INDENT> return str(__version__)
Provide the version as a string.
625941cd7047854f462a151f
def collect_stations(): <NEW_LINE> <INDENT> first_station = "武蔵境" <NEW_LINE> second_station = "三鷹" <NEW_LINE> third_station = "吉祥寺" <NEW_LINE> s = Station(first_station, "2 Chome-1-12 Kyonancho, Musashino-shi, 〒180-0023, Japan") <NEW_LINE> s1 = Station(second_station, "3 Chome-46 Shimorenjaku, Mitaka-shi, 〒181-0013, Ja...
Create a simple chain of train stations
625941cdbe7bc26dc91cd715
def correct_shape_shrink(b, size): <NEW_LINE> <INDENT> n, m = size <NEW_LINE> diff = np.abs(n - m) <NEW_LINE> if n == m: <NEW_LINE> <INDENT> return b <NEW_LINE> <DEDENT> elif n < m: <NEW_LINE> <INDENT> b2 = b[:n,:] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> b2 = b[:,:m] <NEW_LINE> <DEDENT> return b2
b is 2d
625941cdd4950a0f3b08c464
def test_dimmableLightingControl_manual_changes(): <NEW_LINE> <INDENT> async def run_test(loop): <NEW_LINE> <INDENT> plm = MockPLM(loop) <NEW_LINE> address = '1a2b3c' <NEW_LINE> cat = 0x01 <NEW_LINE> subcat = 0x04 <NEW_LINE> product_key = None <NEW_LINE> description = 'SwitchLinc Dimmer (1000W)' <NEW_LINE> model = '247...
Test manual changes to Dimmable Lighting Controls.
625941cd7d43ff24873a2db5
def test_str_with_other_cards(self): <NEW_LINE> <INDENT> deck = self.a2.Deck([ self.a2.Card(), self.a2.NumberCard(1), self.a2.CoderCard("steven"), self.a2.TutorCard("steven"), self.a2.KeyboardKidnapperCard(), self.a2.AllNighterCard() ]) <NEW_LINE> self.assertEqual(str(deck), 'Deck(Card(), NumberCard(1), CoderCard(steve...
test Deck with other cards
625941cd45492302aab5e3d8
def repo_urls(self, name): <NEW_LINE> <INDENT> http_url = '%s%s' % (self.mercurial_url, name) <NEW_LINE> ssh_url = 'ssh://%s:%d/%s' % (self.ssh_hostname, self.ssh_port, name) <NEW_LINE> return http_url, ssh_url
Obtain the http:// and ssh:// URLs for a review repo.
625941cd4527f215b584c56c
def area(self): <NEW_LINE> <INDENT> return (self.__width * self.__height)
area
625941cd8c3a8732951584d0
def _train(self): <NEW_LINE> <INDENT> with db_conn.cursor(cursor_factory=Cursor) as cursor: <NEW_LINE> <INDENT> cursor.execute("SELECT digit, pixels FROM numbers;") <NEW_LINE> data = cursor.fetchall() <NEW_LINE> labels, images = zip( *map(lambda r: (r['digit'], flatten(r['pixels'])), data) ) <NEW_LINE> self.classifier....
load training data and feed classification engine
625941cdbf627c535bc132e4
def session_preparation(self): <NEW_LINE> <INDENT> self.disable_paging(command="terminal more disable\n") <NEW_LINE> self.set_base_prompt()
Prepare the session after the connection has been established
625941cd50812a4eaa59c437
def getJSON(self): <NEW_LINE> <INDENT> return json.dumps(self, default=lambda o: o.__dict__)
Returns the JSON object of this object
625941cd090684286d50edfb
def test_long_long_type(self): <NEW_LINE> <INDENT> d = {'CXX_SOURCES': 'long_long.cpp'} <NEW_LINE> self.build(dictionary=d) <NEW_LINE> self.setTearDownCleanup(dictionary=d) <NEW_LINE> self.generic_type_tester(set(['long long']))
Test that 'long long'-type variables are displayed correctly.
625941cd796e427e537b06db
def parseName(n): <NEW_LINE> <INDENT> names = n.split(',',1) <NEW_LINE> last_name = names[0] <NEW_LINE> first_middle = names[1] <NEW_LINE> first_middle = first_middle.split(maxsplit=1) <NEW_LINE> full_name = first_middle + [last_name] <NEW_LINE> return(full_name)
Given a comma-separated name, converts it to a 3-element list of names. Last element is last name, which possibly contains spaces and suffices. Args: n: Comma separated string of "last name, first [middle]". Middle name is optional. Middle name is optional. Returns: List of two or more elements. "First name...
625941cd07d97122c41789a1
def remove(path: Union[str, Path], entity_key: str): <NEW_LINE> <INDENT> path = _get_valid_hdf_path(path) <NEW_LINE> entity_key = EntityKey(entity_key) <NEW_LINE> with tables.open_file(str(path), mode="a") as file: <NEW_LINE> <INDENT> file.remove_node(entity_key.path, recursive=True)
Removes a piece of data from an HDF file. Parameters ---------- path : The path to the HDF file to remove the data from. entity_key : A representation of the internal HDF path where the data is located. Raises ------ ValueError If the path or entity_key are improperly formatted.
625941cd91f36d47f21ac608
def __init__(self, ai, color, bling): <NEW_LINE> <INDENT> Base.__init__(self,ai, color, bling) <NEW_LINE> self.name = "Sammi" <NEW_LINE> self.desc = "Ground pounders for the win." <NEW_LINE> self.level1 = 50 <NEW_LINE> self.level2 = 100 <NEW_LINE> self.CaptureBonus = 1.5
generated source for method __init__
625941cdb57a9660fec33999
def append(self, key, data=None): <NEW_LINE> <INDENT> self.insert_at(self.size, key, data)
Appends a new node at the end of the list. Parameters ========== key Any valid identifier to uniquely identify the node in the linked list. data Any valid data to be stored in the node.
625941cd1b99ca400220abc7
def ClearEventAttributes(self): <NEW_LINE> <INDENT> self._extra_event_attributes = {}
Clear out attributes that should be added to all events.
625941cd4e4d5625662d44ed
def process_results(source_list): <NEW_LINE> <INDENT> source_results = [] <NEW_LINE> for source_item in source_list: <NEW_LINE> <INDENT> id = source_item.get('id') <NEW_LINE> name = source_item.get('name') <NEW_LINE> description = source_item.get('description') <NEW_LINE> url = source_item.get('url') <NEW_LINE> categor...
Function that processes the source result and transform them to a list of Objects Args: source_list: A list of dictionaries that contain source details Returns : source_results: A list of source objects
625941cd82261d6c526ab5b5
def writeOctetstring(value): <NEW_LINE> <INDENT> return (writeUniversalTag(Tag.BER_TAG_OCTET_STRING, False), writeLength(len(value)), String(value))
Write string in BER representation @param value: string @return: BER octet string block
625941cd5f7d997b87174bae
def old_boolean_func_from_coop_binding(world, channels, bindings): <NEW_LINE> <INDENT> unique = list(set(channels)) <NEW_LINE> indexes = {unique[i]: i for i in range(len(unique))} <NEW_LINE> all_states = [_ for _ in itertools.product([0, 1], repeat=len(bindings))] <NEW_LINE> is_true = [] <NEW_LINE> for state in all_sta...
Convert a coop binding into a boolean function
625941cd0fa83653e46570d1
def orthorhombic(self, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert len(kwargs) == 9 <NEW_LINE> c11 = kwargs['C11'] <NEW_LINE> c22 = kwargs['C22'] <NEW_LINE> c33 = kwargs['C33'] <NEW_LINE> c12 = kwargs['C12'] <NEW_LINE> c13 = kwargs['C13'] <NEW_LINE> c23 = kwargs['C23'] <NEW_LINE> c44 = kwargs['C44'] ...
Set values with nine independent orthorhombic moduli. Parameters ---------- C11 : float C11 component of Cij. C12 : float C12 component of Cij. C13 : float C13 component of Cij. C22 : float C22 component of Cij. C23 : float C23 component of Cij. C33 : float C33 component of Cij. C44 : float ...
625941cd7b180e01f3dc4912
def setEncoding(self, encoding): <NEW_LINE> <INDENT> self.uiEditTXT.setEncoding(encoding)
Sets the encoding type for this editor to the inputed encoding. :param encoding | <str>
625941cd099cdd3c635f0d70
def parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser() <NEW_LINE> parser.add_argument('--gwas', metavar="<file>", help=('GWAS Catalog input'), type=str, required=True) <NEW_LINE> parser.add_argument('--invar', metavar="<file>", help=("Variant index input"), type=str, required=True) <NEW_LINE> parser.a...
Load command line args
625941cdf7d966606f6aa11a
def max_q_batch(self, state_batch): <NEW_LINE> <INDENT> raise NotImplementedError
An array of maximum qs for the states in state_batch. :param state_batch: :return:
625941cd21a7993f00bc7e05
def __init__(self, thread_number=None, network_try_limit=None, task_try_limit=None, request_pause=NULL, priority_mode='random', meta=None, only_cache=False, config=None, slave=False, max_task_generator_chunk=None, args=None, taskq=None, ): <NEW_LINE> <INDENT> self.stat = Stat() <NEW_LINE> self.taskq = taskq <NEW_LINE> ...
Arguments: * thread-number - Number of concurrent network streams * network_try_limit - How many times try to send request again if network error was occurred, use 0 to disable * network_try_limit - Limit of tries to execute some task this is not the same as network_try_limit network try limit limits the nu...
625941cd60cbc95b062c6659
def output_file(*path): <NEW_LINE> <INDENT> path = [str(p) for p in path if p is not None] <NEW_LINE> output_mkdir(*path[:-1]) <NEW_LINE> return PurePath(*path).as_posix()
Creates POSIX path from input list and creates directory for the parent directory :param path: List of path elements :return: POSIX path
625941cd4f88993c3716c17d
def form_valid(self, form): <NEW_LINE> <INDENT> serie = form.save(commit=False) <NEW_LINE> from uuslug import slugify <NEW_LINE> serie.slug = slugify(serie.name) <NEW_LINE> serie.save() <NEW_LINE> super(SerieUpdateView, self).form_valid(form)
Sobrescreve o metodo form_valid para buscar o palestrante/user através do request
625941cd8e71fb1e9831d8bf
def test_get_volume(self): <NEW_LINE> <INDENT> a = [5.43 * 0.5, 0., 5.43 * 0.5] <NEW_LINE> b = [5.43 * 0.5, 5.43 * 0.5, 0.] <NEW_LINE> c = [0., 5.43 * 0.5, 5.43 * 0.5] <NEW_LINE> self.assertAlmostEqual(md.get_volume(a, b, c), 40.03, places=2)
Test the get_volume function
625941cd167d2b6e31218cac
def nip(self): <NEW_LINE> <INDENT> nip = [int(i) for i in self.random_element(self.tax_office_codes)] <NEW_LINE> for _ in range(6): <NEW_LINE> <INDENT> nip.append(self.random_digit()) <NEW_LINE> <DEDENT> weights = (6, 5, 7, 2, 3, 4, 5, 6, 7) <NEW_LINE> check_sum = sum(d * w for d, w in zip(nip, weights)) % 11 <NEW_LINE...
Returns 10 digit of Number of tax identification. Polish: Numer identyfikacji podatkowej (NIP). https://pl.wikipedia.org/wiki/NIP list of codes http://www.algorytm.org/numery-identyfikacyjne/nip.html
625941cd4428ac0f6e5ba908
def input_signature(self): <NEW_LINE> <INDENT> return _analog_swig.fastnoise_source_f_sptr_input_signature(self)
input_signature(fastnoise_source_f_sptr self) -> io_signature_sptr
625941cdd164cc6175782e63
def check_task_credential(): <NEW_LINE> <INDENT> folder = get_full_path('~/.cloud_pipe') <NEW_LINE> path = get_full_path('~/.cloud_pipe/task') <NEW_LINE> config = ConfigParser() <NEW_LINE> config.read(path) <NEW_LINE> if 'default' not in config: <NEW_LINE> <INDENT> aws_access_key_id = input('run task AWS ACCESS KEY ID:...
get the credential and configures stored in ~/.cloud_pipe/task, if there is not any, collect those inforamtions and saved in ~/.cloud_pipe
625941cdd164cc6175782e64
def calcTaxes(costOfCoffees, costOfDonuts): <NEW_LINE> <INDENT> preTaxAmt = calcPreTaxAmt(costOfCoffees, costOfDonuts) <NEW_LINE> taxes = preTaxAmt * TAX_RATE <NEW_LINE> return taxes
calculates the taxes
625941cd099cdd3c635f0d71
def predictForRanking(self,u): <NEW_LINE> <INDENT> if self.dao.containsUser(u): <NEW_LINE> <INDENT> u = self.dao.user[u] <NEW_LINE> return (self.Y-self.X[u]).dot(self.X[u])+self.Bi+self.Bu[u]+self.dao.globalMean <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.array([self.dao.globalMean]*len(self.dao.item))
invoked to rank all the items for the user
625941cd30c21e258bdfa5b4
def start_time(self): <NEW_LINE> <INDENT> return self.time_range()[0]
Returns the global start time in seconds.
625941cd21a7993f00bc7e06
def create_tree(self, words): <NEW_LINE> <INDENT> for word in words: <NEW_LINE> <INDENT> self.tree = self.tree.add_node(word) <NEW_LINE> <DEDENT> return self.tree
Method creates a frequency tree from lost of words.
625941cdaad79263cf390b57
def __str__(self): <NEW_LINE> <INDENT> result = '' <NEW_LINE> for k, v in self.nodes.items(): <NEW_LINE> <INDENT> result += str(k) + ': \n' <NEW_LINE> for attr in vars(v): <NEW_LINE> <INDENT> result += '\t' + str(attr) + ' = ' + str(getattr(v, attr)) + '\n' <NEW_LINE> <DEDENT> <DEDENT> return result
Helper printing function for debugging the index
625941cd283ffb24f3c55a17
def __init__(self, structure): <NEW_LINE> <INDENT> self.structure = structure.copy() <NEW_LINE> self.structure.relocate_to_cm() <NEW_LINE> self.max_distance = np.max(self.distance_matrix())
Cluster Analysis provides routines to compute Structure Analysis for finite systems such as molecules and clusters. :param structure: (pychemia.Structure) A PyChemia Structure object
625941cd091ae35668667074
def drop_changed_udt(self): <NEW_LINE> <INDENT> for udt in self._udt: <NEW_LINE> <INDENT> cascade_str = 'CASCADE' if udt in ('svec', 'bytea8') else '' <NEW_LINE> _write_to_file(self.output_filehandle, "DROP TYPE IF EXISTS {0}.{1} {2};". format(self._schema, udt, cascade_str))
@brief Drop all types that were updated/removed in the new version @note It is dangerous to drop a UDT becuase there might be many dependencies
625941cd21bff66bcd684a69
def add_lex_ent(ent, lex): <NEW_LINE> <INDENT> return [ent] + lex
lexicon x lexicon entry -> lexicon
625941cd2ae34c7f2600d247
def build_n_shot_task(self, k, n=1): <NEW_LINE> <INDENT> if k >= self.unique_speakers: <NEW_LINE> <INDENT> raise(ValueError, 'k must be smaller than the number of unique speakers in this dataset!') <NEW_LINE> <DEDENT> if k <= 1: <NEW_LINE> <INDENT> raise(ValueError, 'k must be greater than or equal to one!') <NEW_LINE>...
This method builds a k-way n-shot classification task. It returns a support set of n audio samples each from k unique speakers. In addition it will return a query sample. Downstream models will attempt to match the query sample to the correct samples in the support set. :param k: Number of unique speakers to include in...
625941cd4d74a7450ccd42da
def render_GET(self, request): <NEW_LINE> <INDENT> rtl = False <NEW_LINE> try: <NEW_LINE> <INDENT> rtl = usingRTLLang(request) <NEW_LINE> <DEDENT> except Exception as err: <NEW_LINE> <INDENT> logging.exception(err) <NEW_LINE> logging.error("The gettext files were not properly installed.") <NEW_LINE> logging.info("To in...
Handles requests for the webserver root document. For example, this function handles requests for https://bridges.torproject.org/. :type request: :api:`twisted.web.server.Request` :param request: An incoming request.
625941cdff9c53063f47c30a
def create_model(bert_config, is_training, input_ids, input_mask, segment_ids, num_intent_labels, num_slot_labels, use_one_hot_embeddings, intent_label_ids=None, slot_label_ids=None): <NEW_LINE> <INDENT> model = modeling.BertModel( config=bert_config, is_training=is_training, input_ids=input_ids, input_mask=input_mask,...
Creates a classification model.
625941cd91af0d3eaac9bb2f
def __init__( self, fs_type: str = None, storage_policy_id: str = None, storage_policy_name: str = None, volume_path: str = None, ): <NEW_LINE> <INDENT> super(VsphereVirtualDiskVolumeSource, self).__init__( api_version="core/v1", kind="VsphereVirtualDiskVolumeSource" ) <NEW_LINE> self._properties = { "fsType": fs_type ...
Create VsphereVirtualDiskVolumeSource instance.
625941cdcc0a2c11143dcfa7
def is_resource_method_allowed(self, resources_policy, method, resource_id): <NEW_LINE> <INDENT> resource_policy = resources_policy.get(self.policy_id) <NEW_LINE> if resource_policy: <NEW_LINE> <INDENT> permission = self._check_resource_policy( resource_policy, method, [resource_id, '*']) <NEW_LINE> if permission is no...
Returns whether a method can be performed on a resource. A method can be performed if a specific per-resource policy allows it, and the global policy also allows it. The per-resource policy takes precedence over the global policy. If, for instance, the global policy blocks and the resource policies allows, the method...
625941cdd6c5a10208144161
def __get_terminal(self, index): <NEW_LINE> <INDENT> return self.terminals[index] if index < len(self.terminals) else self.constants[index % len(self.constants)]
Returns a terminal from the terminals list, extracted at the given index. Arguments: index {int} -- index for the terminals list. Returns: [string] -- terminal.
625941cdbe383301e01b559c
def adversary_reward(self, agent, world, shaped_adv): <NEW_LINE> <INDENT> reward = 0 <NEW_LINE> agents = self.good_agents(world) <NEW_LINE> adversaries = self.adversaries(world) <NEW_LINE> if shaped_adv: <NEW_LINE> <INDENT> reward -= 0.1 * min([np.sqrt(np.sum(np.square(a.state.p_pos - agent.state.p_pos))) for a in agen...
Adversaries are rewarded for collisions with good agents. Args: agent (multiagent_particle_env.core.Agent): Agent object world (multiagent_particle_env.core.World): World object with agents and landmarks shaped_adv (boolean): Specifies whether to use shaped reward, decreased for i...
625941cda8ecb033257d31e3
def _gdp_vol_estimate(self, variables): <NEW_LINE> <INDENT> raw_vol = tsa.ARMA(variables['gdp'], order=(1, 0)).fit(disp=False).resid <NEW_LINE> abs_vol = np.abs(raw_vol) <NEW_LINE> cycle, trend = sm_filters.tsa.filters.hpfilter(abs_vol) <NEW_LINE> return trend
This function estimates long-run volatilities of GDP growht. To esimate such long-run volatility, I use a 2-sided rolling window to filter raw volatility. Returns: -------- rolling_vol: pd.Series(float) The rolling estimate of volatility
625941cdd99f1b3c44c676a4
def GetCellWidths(self): <NEW_LINE> <INDENT> numNonEmptyTexts = sum(1 for x in self.GetTexts() if x) <NEW_LINE> if not numNonEmptyTexts: <NEW_LINE> <INDENT> return (0, 0, 0) <NEW_LINE> <DEDENT> widths = list() <NEW_LINE> width = round(RectUtils.Width(self.GetWorkBounds()) / numNonEmptyTexts) <NEW_LINE> for x in self.Ge...
Return a list of the widths of the cells in this block
625941cd283ffb24f3c55a18
def to_dict(self): <NEW_LINE> <INDENT> return { "text": self.text, "bounding_box": [f.to_dict() for f in self.bounding_box] if self.bounding_box else [], "confidence": self.confidence, "page_number": self.page_number, "kind": self.kind, }
Returns a dict representation of FormWord. :return: dict :rtype: dict
625941cd96565a6dacc8f7e2
def writeFile(self, destination, data, block_size=65536): <NEW_LINE> <INDENT> ByteStreamWriter = self.loadClass("common/ByteStreamWriter.apk", "ByteStreamWriter") <NEW_LINE> file_io = self.new("java.io.File", destination) <NEW_LINE> if file_io.exists() != True: <NEW_LINE> <INDENT> file_stream = self.new("java.io.FileOu...
Write data into a file on the Agent's file system.
625941cd596a897236089bd7
def headerData(self, section, orientation, role): <NEW_LINE> <INDENT> if self._rootNode.columnCount() == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if orientation == Qt.Horizontal and role == Qt.DisplayRole: <NEW_LINE> <INDENT> return self._rootNode.data(section) <NEW_LINE> <DEDENT> elif orientation == Qt.Vertic...
Set the column headers to be displayed by the tree view.
625941cd10dbd63aa1bd2cba
def up(self): <NEW_LINE> <INDENT> with self.schema.table('schedules') as table: <NEW_LINE> <INDENT> table.drop_foreign('schedules_league_id_foreign') <NEW_LINE> table.foreign('league_id').references('id').on('leagues') .on_delete('cascade')
Run the migrations.
625941cd090684286d50edfc
def __init__(self, tx): <NEW_LINE> <INDENT> self.tx = tx <NEW_LINE> self.children = [] <NEW_LINE> self.depth = 0 <NEW_LINE> self.reachable = set()
Arguments: tx {Tx} -- The transaction that the node represents.
625941cd76d4e153a657ec48
def convert_fused_activation_function(self, in_expr, fused_activation_fn): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from tflite.ActivationFunctionType import ActivationFunctionType <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> raise ImportError("The tflite package must be installed") <NEW_LINE> <DEDEN...
Convert TFLite fused activation function
625941cd925a0f43d2549f8e
def test_x_projection(self): <NEW_LINE> <INDENT> x_proj = ip.x_projection(self.MI.image) <NEW_LINE> self.assertEqual(x_proj.sum(), 9792279) <NEW_LINE> self.assertEqual(int(x_proj.mean()), 7034) <NEW_LINE> self.assertEqual(int(x_proj.std()), 10005)
Test we get expected value for x projection
625941cd6fece00bbac2d855
def rollback(self): <NEW_LINE> <INDENT> if hasattr(self.local, 'tx') and self.local.tx: <NEW_LINE> <INDENT> self.local.tx[-1].rollback() <NEW_LINE> self._dispose_transaction()
Roll back the current transaction, discarding all statements executed since the transaction was begun.
625941cd66656f66f7cbc2c1
def initializer_method(method, attrname=None): <NEW_LINE> <INDENT> meth = InitializerMethod(method, attrname) <NEW_LINE> @functools.wraps(method) <NEW_LINE> def wrapped_method(*args, **kwargs): <NEW_LINE> <INDENT> return meth(*args, **kwargs) <NEW_LINE> <DEDENT> return wrapped_method
Properly set the docstring for the wrapped method.
625941cd55399d3f055887cb
def libvlc_media_list_lock(p_ml): <NEW_LINE> <INDENT> f = _Cfunctions.get('libvlc_media_list_lock', None) or _Cfunction('libvlc_media_list_lock', ((1,),), None, MediaList) <NEW_LINE> if not __debug__: <NEW_LINE> <INDENT> global libvlc_media_list_lock <NEW_LINE> libvlc_media_list_lock = f <NEW_LINE> <DEDENT> retu...
Get lock on media list items. @param p_ml: a media list instance.
625941cd92d797404e3042a1
def get_remote_address(self): <NEW_LINE> <INDENT> addr = self.ip.split("\n")[1].split(" = ")[1].split(":"); <NEW_LINE> return (addr[0], int(addr[1]));
Get the remote address of the client as a tuple. @return Tuple as: (host, port).
625941cdcc40096d61595a67
def _dict_to_tensor(self, x, k1, k2, k3): <NEW_LINE> <INDENT> return array_ops.stack([array_ops.stack( [array_ops.stack([x[i, j, k] for k in range(k3)]) for j in range(k2)]) for i in range(k1)])
Convert a dictionary to a tensor. Args: x: A k1 * k2 dictionary. k1: First dimension of x. k2: Second dimension of x. k3: Third dimension of x. Returns: A k1 * k2 * k3 tensor.
625941cd66656f66f7cbc2c2
def _set_torch_model(self, model, input_shape=None, input_sample=None, inputs=None, name='main'): <NEW_LINE> <INDENT> from torch import from_numpy <NEW_LINE> from deepkit.pytorch import get_pytorch_graph <NEW_LINE> if not inputs and not input_shape and input_sample is None: <NEW_LINE> <INDENT> raise Exception('No input...
Extracts the computation graph using either the given input_shape with random data or the given (real) input_sample. If you have multiple models per training, use the name argument to differentiate. :param model: your pytorch model instance :param input_shape: shape like (1, 32, 32) or a list of input shapes for multi ...
625941cd30dc7b7665901a7d
def _load_shapenet_scene_annotation(self, index): <NEW_LINE> <INDENT> image_path = self.image_path_from_index(index) <NEW_LINE> depth_path = self.depth_path_from_index(index) <NEW_LINE> label_path = self.label_path_from_index(index) <NEW_LINE> metadata_path = self.metadata_path_from_index(index) <NEW_LINE> pos = index....
Load class name and meta data
625941cd7c178a314d6ef577
def serialize(self, request): <NEW_LINE> <INDENT> app_list = self.app_list(request) <NEW_LINE> for app in app_list: <NEW_LINE> <INDENT> for dicmodel in app['models']: <NEW_LINE> <INDENT> dicmodel.pop('bwp') <NEW_LINE> <DEDENT> <DEDENT> return app_list
Сериализует все объекты сайта в Python
625941cd63b5f9789fde71fc
def getint(self, option): <NEW_LINE> <INDENT> value = self._get(option) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> exit() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = int(value) <NEW_LINE> <DEDENT> except ValueError as msg: <NEW_LINE> <INDENT> print("参数无效 '{0}'--{1}".format(optio...
获取指定配置参数的值,返回整数 :param option: name of option :type option: string :return: value of option :rtype: int
625941cd32920d7e50b282e7
def get_nodes_names(self): <NEW_LINE> <INDENT> return self.nodes.keys()
Returns a list of the names of all nodes.
625941cde64d504609d74957
def __init__(self, id=None, timestamp=None, results=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._id = None <NEW_L...
GeolookupResults - a model defined in OpenAPI
625941cd3d592f4c4ed1d184
def close_browser(): <NEW_LINE> <INDENT> if not get_instance(): <NEW_LINE> <INDENT> raise Exception("You need to start a browser first with open_browser()") <NEW_LINE> <DEDENT> get_instance().quit() <NEW_LINE> set_instance(None)
Close the currently running browser.
625941cd63d6d428bbe44606
def freqEigvalRatio(self,isotropic=False): <NEW_LINE> <INDENT> if isotropic: <NEW_LINE> <INDENT> sortedEig= sorted(numpy.fabs(self._dOdJpEig[0])) <NEW_LINE> return sortedEig[2]/sortedEig[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return numpy.sqrt(self._sortedSigOEig)[2] /numpy.sqrt(self._sortedSig...
NAME: freqEigvalRatio PURPOSE: calculate the ratio between the largest and 2nd-to-largest (in abs) eigenvalue of sqrt(dO/dJ^T V_J dO/dJ) (if this is big, a 1D stream will form) INPUT: isotropic= (False), if True, return the ratio assuming an isotropic action distribution (i.e., just of dO/dJ) OUTP...
625941cdde87d2750b85feaa
@pipeable() <NEW_LINE> def main() -> None: <NEW_LINE> <INDENT> description, epilog = __doc__.strip().split("\n\n", 1) <NEW_LINE> parser = argparse.ArgumentParser( description=description, epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter, ) <NEW_LINE> parser.add_argument( "takeout_path", help="File pa...
Process command line arguments, parse the Takeout, and write a CSV.
625941cd23849d37ff7b31a6
def redraw_ax(self, *axes): <NEW_LINE> <INDENT> self.restore_region(self._background) <NEW_LINE> for ax in axes: <NEW_LINE> <INDENT> ax.draw_artist(ax) <NEW_LINE> extent = ax.get_window_extent() <NEW_LINE> self.blit(extent)
redraw one or several axes
625941cd0c0af96317bb82ff
def _create_check(self, circuit, polygon, ticks, check_type, datas, ancilla, mapping): <NEW_LINE> <INDENT> if polygon == 'square': <NEW_LINE> <INDENT> sides = 4 <NEW_LINE> if len(datas) != sides: <NEW_LINE> <INDENT> raise Exception('Squares must have 4 datas!') <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> sid...
Args: circuit: polygon: ticks: check_type: datas: ancilla: mapping: Returns:
625941cd460517430c39429c
def add_expr(self, expr): <NEW_LINE> <INDENT> if expr is not None: <NEW_LINE> <INDENT> if isinstance(expr, Expression): <NEW_LINE> <INDENT> expr = [expr] <NEW_LINE> <DEDENT> if not isinstance(expr, list): <NEW_LINE> <INDENT> raise AttributeError( "expr must be of type {} or list of {}".format(Expression.__name__) ) <NE...
Add expression to Subject instance.
625941cd3346ee7daa2b2e83
def stop(self, services): <NEW_LINE> <INDENT> self.manager.stop_services(services) <NEW_LINE> self.manager.stop_machine() <NEW_LINE> self.manager.delete_machine() <NEW_LINE> self.manager.stop_networking()
Sequence the stop of 21 sell services.
625941cdd7e4931a7ee9e035
def test04a_int(self): <NEW_LINE> <INDENT> root = self.rootgroup <NEW_LINE> if common.verbose: <NEW_LINE> <INDENT> print('\n', '-=' * 30) <NEW_LINE> print("Running %s.test04a_int..." % self.__class__.__name__) <NEW_LINE> <DEDENT> byteorder = {'little': 'big', 'big': 'little'}[sys.byteorder] <NEW_LINE> earray = self.h5f...
Checking earray with byteswapped appends (2, ints)
625941cde1aae11d1e749dce
def get_id_num(self): <NEW_LINE> <INDENT> return self.id_num
TODO: This method takes no parameters. Your task is to return the customer's identification number.
625941cdec188e330fd5a8b6
def __type_hinting__(self, user: User, dbsession: Session, session: ISession, admin: Admin, registry: Registry, on_demand_resource_renderer: OnDemandResourceRenderer, transaction_manager: TransactionManager): <NEW_LINE> <INDENT> self.user = user <NEW_LINE> self.dbsession = dbsession <NEW_LINE> self.session = session <N...
A dummy helper function to tell IDEs about reify'ed variables. :param user: The logged in user. None if the visitor is anonymous. :param dbsession: Current active SQLAlchemy session :param session: Session data for anonymous and logged in users. :param admin: The default admin interface of the site. Note that the site...
625941cdf9cc0f698b140713
def create_adjacency_matrix(self, data=None, sprsfmt='coo', dropzeros=True, sym=True): <NEW_LINE> <INDENT> logger.debug('create_adjacency_matrix: Start of method') <NEW_LINE> Np = self.num_pores() <NEW_LINE> Nt = self.num_throats() <NEW_LINE> if data is None: <NEW_LINE> <INDENT> data = sp.ones((self.num_throats(),)) <N...
Generates a weighted adjacency matrix in the desired sparse format Parameters ---------- data : array_like, optional An array containing the throat values to enter into the matrix (in graph theory these are known as the 'weights'). If omitted, ones are used to create a standard adjacency matrix representi...
625941cdeab8aa0e5d26dc6f
def extra_attributes (self,node): <NEW_LINE> <INDENT> d = { 'e': self.do_repr, 'cache':self.do_cache_list, 'reach':self.do_reaching_list, 'typ': self.do_types_list, } <NEW_LINE> aList = [] <NEW_LINE> for attr in sorted(d.keys()): <NEW_LINE> <INDENT> if hasattr(node,attr): <NEW_LINE> <INDENT> val = getattr(node,at...
Return the tuple (field,repr(field)) for all extra fields.
625941cd4527f215b584c56e
def assignPrimer(self, prTable, dedup_float, max_diff, endmatch, flip=False): <NEW_LINE> <INDENT> vflip = False <NEW_LINE> pr1, pr1Mismatch, pr1StartPosition, pr1EndPosition = primerDist(prTable.getP5sequences(), self.read_1, dedup_float, max_diff, endmatch) <NEW_LINE> if flip: <NEW_LINE> <INDENT> pr1f, pr1fMismatch, p...
Given a primerTable object, the maximum number of allowed difference (mismatch, insertion, deletions) and the required number of end match bases (final endmatch bases must match) assign a primer pair ID from the read sequences.
625941cd5f7d997b87174baf
def set_bounds(self, *args): <NEW_LINE> <INDENT> if len(args) == 1: <NEW_LINE> <INDENT> vars, lb, ub = list(zip(*args)) <NEW_LINE> <DEDENT> elif len(args) == 3: <NEW_LINE> <INDENT> vars = [args[0]] <NEW_LINE> lb = [args[1]] <NEW_LINE> ub = [args[2]] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise exceptions.Cpl...
Sets the bounds for a set of variables. Can be called by two forms. self.set_bounds(i, lb, ub) i must be a variable name or index and lb and ub must be real numbers. Sets the lower bound and upper bound of the variable whose index or name is i to lb and ub, respectively. self.set_lower_bounds(seq_of_triples...
625941cd090684286d50edfd
def load_features_and_labels(df, include_dummy_variable=False): <NEW_LINE> <INDENT> X = df.loc[:,'Blood_Test ALBUMIN':] <NEW_LINE> X['CCI']=df.loc[:,'CCI'] <NEW_LINE> X.drop(['Vital_Sign AVPU Scale', 'Vital_Sign Best Verbal Response', 'Vital_Sign Delivery device used', 'Vital_Sign Eye Opening Response', 'Vital_Sign GCS...
Input Features
625941cd287bf620b61d3b7b
def join_fore_link(self, fore_link): <NEW_LINE> <INDENT> with self._condition: <NEW_LINE> <INDENT> self._fore_link = null.NULL_FORE_LINK if fore_link is None else fore_link
See ticket_interfaces.RearLink.join_fore_link for specification.
625941cd956e5f7376d70f85
def test_same_state_from_state(self): <NEW_LINE> <INDENT> result = new_state( vertice=self.vertice, event={}, state=Check.OK ) <NEW_LINE> self.assertFalse(result)
Test if state is the same than the input state.
625941cde1aae11d1e749dcf
def predict(self,csv_file): <NEW_LINE> <INDENT> predictions = [] <NEW_LINE> tf.reset_default_graph() <NEW_LINE> (X,_),_,_,_,pred_y,lr,saver = self._build_graph(training=False) <NEW_LINE> with tf.Session() as sess: <NEW_LINE> <INDENT> sess.run(tf.initialize_all_variables()) <NEW_LINE> saver.restore(sess,self._save_path)...
Predicts the type of error between the two strings in each row of a CSV file. Returns: 0 for minor, 1 for major, 'No error' for identical strings, and 'Unknown' if a prediction cannot be made (could change to 0).
625941cdb57a9660fec3399b
def set_max_gain(self, *args, **kwargs): <NEW_LINE> <INDENT> return _gnuradio_core_general.gr_agc2_ff_sptr_set_max_gain(self, *args, **kwargs)
set_max_gain(self, float max_gain)
625941cdd268445f265b4f86
def read_text(filename): <NEW_LINE> <INDENT> with open(filename, 'r') as f: <NEW_LINE> <INDENT> text = f.read() <NEW_LINE> <DEDENT> return text
reads in a text from a file, returns text as string
625941cd1b99ca400220abc9