code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def tab_factory ( abscissas , values ) : <NEW_LINE> <INDENT> return Ostap.Math.Interpolation.Table ( abscissas , doubles ( values ) )
The factory for serialisation of the interpolation table
625941f2627d3e7fe0d69422
def getWholeGenomById(id_whole_genome): <NEW_LINE> <INDENT> wholeDNAObj = WholeDNA.get_whole_dna_by_id(id_whole_genome) <NEW_LINE> return wholeDNAObj
get a whole genome according to it id :param id_whole_genome: Id of the whole genome :type id_whole_genome: int :return: whole genome Object :rtype WholeDNA
625941f2fb3f5b602dac3c6a
def doNothing_(self, sender): <NEW_LINE> <INDENT> pass
Hack to enable menuItems by passing them this method as action setEnabled_ isn't working, so this should do for now (achieves the same thing) :param sender: :return:
625941f25fcc89381b1e1c94
def test_create_vote(self): <NEW_LINE> <INDENT> u1, u2 = self.test_create_users() <NEW_LINE> p = self.test_create_post() <NEW_LINE> choices = Choice.get_choices_by_post_id(p.post_id) <NEW_LINE> c1, c2 = [choice.choice_id for choice in choices][0], [choice.choice_id for choice in choices][1] <NEW_LINE> v1 = Vote.create(...
test the creation of votes and check if it's correctly linked to post
625941f2cb5e8a47e48b8070
def _log_error_signal_wrapper(self, config, msg): <NEW_LINE> <INDENT> self._log_error_signal.emit(config, msg)
Wrapper for signal
625941f2596a89723608a089
def fh1(flows, datetimes, hydro_years, drainage_area): <NEW_LINE> <INDENT> perc75 = np.percentile(flows, 75, axis=0) <NEW_LINE> info = np.zeros((hydro_years.shape[0], flows.shape[1]), dtype=np.float64) <NEW_LINE> for hy, mask in enumerate(hydro_years): <NEW_LINE> <INDENT> info[hy, :] = count_events(flows[mask, :], thre...
Mean annual high-flow pulse count (above 75th percentile). *Note:* this streamflow characteristic is equivalent to `fh8`. :Calculation Details: Identify for each hydrological year the flow events above the 75th percentile of the whole daily flow record. Count the number of these flow events for each hydro...
625941f2e76e3b2f99f3add2
def _verify_no_dead_ends(self): <NEW_LINE> <INDENT> processed_queue = [] <NEW_LINE> curr_queue = [feconf.END_DEST] <NEW_LINE> while curr_queue: <NEW_LINE> <INDENT> curr_state_name = curr_queue[0] <NEW_LINE> curr_queue = curr_queue[1:] <NEW_LINE> if curr_state_name in processed_queue: <NEW_LINE> <INDENT> continue <NEW_L...
Verifies that the END state is reachable from all states.
625941f263f4b57ef00016d8
def update_password(self, new_password): <NEW_LINE> <INDENT> self.password = bcrypt.encrypt(new_password)
Hash a new password to bcrypt. :param new_password: The new password :type new_password: str
625941f273bcbd0ca4b2c646
def handler(self, req): <NEW_LINE> <INDENT> raise NotImplementedError(self.__class__.__name__ + '.handler')
Default handler, which just raises an exception. Unless a handler is passed at initialization time, this must be implemented by a subclass.
625941f221bff66bcd684f1d
def check_transition(self: "Area", area_dict: dict): <NEW_LINE> <INDENT> new_area = old_area = self <NEW_LINE> if self.player_obj != None: <NEW_LINE> <INDENT> if (self.player_obj.rect.topright[0] >= self.width and self.player_obj.rect.centery >= self.height*0.35 and self.player_obj.rect.centery <= self.height*0.65 and ...
Determines if a transition to a new Area has been made. If no transition is made, then the player will simply be blocked by a 'wall'.
625941f285dfad0860c3b42e
def get_changelist(self, request, **kwargs): <NEW_LINE> <INDENT> from django.contrib.admin.views.main import ChangeList <NEW_LINE> class ObjectChangeList(ChangeList): <NEW_LINE> <INDENT> def get_queryset(self, *args, **kwargs): <NEW_LINE> <INDENT> qs = super(ObjectChangeList, self).get_queryset(*args, **kwargs) <NEW_LI...
Filter changelist by object
625941f27d847024c06be892
def create_DES_subkeys(key): <NEW_LINE> <INDENT> fullKey = bit_permutation(key, PC1) <NEW_LINE> lprev, rprev = fullKey[:28], fullKey[28:] <NEW_LINE> nFinalBlock = [] <NEW_LINE> for n in range (16): <NEW_LINE> <INDENT> lPart, rPart = left_shift_rot(lprev, key_shifts[n]), left_shift_rot(rprev, key_shifts[n]) <NEW_LINE> l...
>>> create_DES_subkeys('0001001100110100010101110111100110011011101111001101111111110001') ['000110110000001011101111111111000111000001110010', '011110011010111011011001110110111100100111100101', '010101011111110010001010010000101100111110011001', '011100101010110111010110110110110011010100011101', '0111110011101100000...
625941f2377c676e91272777
def google_translate( sentence, src_lang='auto', to_lang='en', mode = False, proxy=None ): <NEW_LINE> <INDENT> out = '' <NEW_LINE> fast_lang = None <NEW_LINE> if len(sentence) > 5000: <NEW_LINE> <INDENT> _input = StringIO(sentence) <NEW_LINE> sentence = '' <NEW_LINE> flag = False <NEW_LINE> fast_lang = src_lang <NEW_LI...
Translate by google translation @param sentence: source text @param mode: (optional) True:Use API for iphone/False:Use API for iphone WebApp @param src_lang: (optional) source langage 'auto': auto detect 'en': english 'jp': japanease @param to_lang: (optional) to langage (default 'en') 'en': english ...
625941f230c21e258bdfaa75
def main(argv=None): <NEW_LINE> <INDENT> if argv is None: <NEW_LINE> <INDENT> argv = sys.argv <NEW_LINE> <DEDENT> logging.basicConfig(level=logging.INFO) <NEW_LINE> desc = DESCRIPTION <NEW_LINE> parser = argparse.ArgumentParser(description=desc) <NEW_LINE> help_str = "Path to JSON credentials file (default: '%(default)...
:param argv: A list of String input arguments :returns: Integer return code for use with sys.exit
625941f27b25080760e39a26
def migration_complete(self, context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None): <NEW_LINE> <INDENT> return
Completes by removing the source local volume.
625941f2f548e778e58cdb51
def __contains__(self, i): <NEW_LINE> <INDENT> if not isinstance(i, Permutation): <NEW_LINE> <INDENT> raise TypeError("A PermutationGroup contains only Permutations as " "elements, not elements of type %s" % type(i)) <NEW_LINE> <DEDENT> return self.contains(i)
Return ``True`` if `i` is contained in PermutationGroup. Examples ======== >>> from sympy.combinatorics import Permutation, PermutationGroup >>> p = Permutation(1, 2, 3) >>> Permutation(3) in PermutationGroup(p) True
625941f201c39578d7e7540c
def get_experiment_container_metrics(self, experiment_container_metric_ids=None): <NEW_LINE> <INDENT> data = self.template_query('brain_observatory_queries', 'experiment_container_metric', experiment_container_metric_ids=experiment_container_metric_ids) <NEW_LINE> return data
Get experiment container metrics by id Parameters ---------- isi_experiment_ids : integer or list of integers, optional only select specific experiments. Returns ------- dict : isi experiment metadata
625941f2b57a9660fec33e5e
def keywords(self, lemmatized_legend_text, legend_rare_words): <NEW_LINE> <INDENT> frequency_dist = nltk.FreqDist(lemmatized_legend_text) <NEW_LINE> return {w for (w, freq) in frequency_dist.items() if freq > 2 and w in legend_rare_words}
Generuje zbiór słów kluczowych danej legendy. lemmatized_legend_text - lista zlematyzowanych, odśmiecionych (po przebiegu metody strip_garbage) "lemów. legend_rare_words - lista rzadkich słów występujących w legendzie (stworzona metodą find_rare_words).
625941f2bd1bec0571d90c00
def urlopen(url, **kwargs): <NEW_LINE> <INDENT> return BytesIO(create_http_session().get(url, **kwargs).content)
GET a file-like object for a URL using HTTP. This is a thin wrapper around :meth:`requests.Session.get` that returns a file-like object wrapped around the resulting content. Parameters ---------- url : str The URL to request kwargs : arbitrary keyword arguments Additional keyword arguments to pass to :meth:`...
625941f257b8e32f52483a70
def MoveItems(self, folder_id, itemids): <NEW_LINE> <INDENT> logging.info('pimdb_ex:MoveItems() - moveing items....') <NEW_LINE> req = MoveItemsRequest(self, folder_id=folder_id, itemids=itemids) <NEW_LINE> logging.info('pimdb_ex:MoveItems() - moveing items....done') <NEW_LINE> return req.execute()
Move items in the exchange store.
625941f25e10d32532c5f4f6
def identify(self, auth_header): <NEW_LINE> <INDENT> if auth_header: <NEW_LINE> <INDENT> payload = self.decode_auth_token(auth_header) <NEW_LINE> if not payload: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if "user_id" in payload and "flag" in payload: <NEW_LINE> <INDENT> if payload["flag"] == 1: <NEW_LINE> <I...
用户鉴权 :return: list
625941f23539df3088e2e91d
def create_img_placeholder(img_node): <NEW_LINE> <INDENT> image_d = 'm {0},{1} h {2} v {3} h -{2} z'.format(img_node.get('x'), img_node.get('y'), img_node.get('width'), img_node.get('height')) <NEW_LINE> path = inkex.etree.Element(inkex.addNS('path', 'svg')) <NEW_LINE> path.set('d', image_d) <NEW_LINE> path.set('style'...
Insert new path based on geometry of <image> node.
625941f2d6c5a10208144620
def begin(self) -> NoReturn: <NEW_LINE> <INDENT> self._db.begin()
begin a transaction. if not in autocommit mode, it will open a new transaction.
625941f2293b9510aa2c3861
def count(self, obj) -> int: <NEW_LINE> <INDENT> count = 0 <NEW_LINE> item = self.head <NEW_LINE> while item is not None: <NEW_LINE> <INDENT> if item.value == obj: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> <DEDENT> item = item.next <NEW_LINE> <DEDENT> return count
:returns: the number of times the object appears in the list
625941f28da39b475bd6554d
@login_required <NEW_LINE> def operation_working_other(request): <NEW_LINE> <INDENT> device_entry = get_object_or_none(DeviceEntry,id=0) <NEW_LINE> ogrs = OperationGroupRecord.objects.filter(Q(device_items__isnull=True)|Q(device_items=device_entry)) <NEW_LINE> productionline_id_list = list(set([ogr.productionline.id fo...
单独的工作台: 其它 说明: 如果一个 ProductionLine ,不需要设备/设备id为0,且没有在 `检验`,`去毛刺`,`热处理`,`装箱`,`时效` 中显示, 那么就在这里显示
625941f2ff9c53063f47c7c1
def get_landmarks(self): <NEW_LINE> <INDENT> return ([(self.state[3+2*j], self.state[3+2*j+1]) for j in range(self.number_of_landmarks)])
Returns a list of (x, y) tuples of all landmark positions.
625941f2925a0f43d254a44e
def coverage_det(arr): <NEW_LINE> <INDENT> ma = numpy.max(arr) <NEW_LINE> mn = numpy.min(arr) <NEW_LINE> maxcover = len(arr) + 1 <NEW_LINE> if ma == 0: <NEW_LINE> <INDENT> return slice(0, 0) <NEW_LINE> <DEDENT> if mn == 1: <NEW_LINE> <INDENT> return slice(0, maxcover) <NEW_LINE> <DEDENT> diffa = numpy.diff(arr) <NEW_LI...
Compute coverage
625941f263d6d428bbe44ac2
def map_idx_to_text(self, samples): <NEW_LINE> <INDENT> all_words = [] <NEW_LINE> all_word_idx = [] <NEW_LINE> for i in xrange(len(samples)): <NEW_LINE> <INDENT> cur_sample = samples[i] <NEW_LINE> cur_words = [] <NEW_LINE> cur_word_idx = [] <NEW_LINE> for idx in cur_sample: <NEW_LINE> <INDENT> cur_word = self.action_vo...
sample: [batch_size, length] of idx
625941f2377c676e91272778
def getlvl2termnumstake2(energies): <NEW_LINE> <INDENT> energies = energies.split('\n')[1:] <NEW_LINE> terms = {} <NEW_LINE> termnums = [0] <NEW_LINE> for energy in energies: <NEW_LINE> <INDENT> term = energy.split()[-3].strip('(') <NEW_LINE> term = energy.split()[-4] + term <NEW_LINE> if term not in terms.keys(): <NEW...
generates a list whose elements correspond to the term number of a level in the adf04 file. So, the 0th index would correspond to the term number (starting at 1) of the first level.
625941f2bf627c535bc137a1
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, GenericThrottlePolicy): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941f29c8ee82313fbbd49
def test_item_updateddate_no_modification(self): <NEW_LINE> <INDENT> now = timezone.now() <NEW_LINE> author = get_user_model().objects.create_user(username='jonhdoe', password='jonhdoe', email='jonh.doe@example.com') <NEW_LINE> announcement = Announcement.objects.create(title='Test 1', slug='test-1', author=author, con...
Test the ``item_updateddate`` method of the feed with an announcement never modified.
625941f230dc7b7665901f30
def decode(s): <NEW_LINE> <INDENT> return ''.join(decode_dict[c] for c in s)[:-3-int(s[-1])]
:param s: base64 string :return: decoded nucleotide sequence
625941f23c8af77a43ae3d79
def install_dependencies(options): <NEW_LINE> <INDENT> print('Bootstrapping: Installing the Review Board package and ' 'dependencies..') <NEW_LINE> cmdline = [sys.executable, 'setup.py', '-q', 'develop'] <NEW_LINE> if options.all_pyvers: <NEW_LINE> <INDENT> cmdline.append('--all-pyvers') <NEW_LINE> <DEDENT> os.system(s...
Install dependencies via setup.py and pip (and therefore npm). Args: options (argparse.Namespace): The parsed command line arguments.
625941f2796e427e537b0b9c
def get_cmd_params(): <NEW_LINE> <INDENT> args = sys.argv[1:] <NEW_LINE> assert len(args) % 2 ==0 <NEW_LINE> cmd_params = {} <NEW_LINE> for i in range(1,len(args), 2): <NEW_LINE> <INDENT> key_name = args[i-1][2:] <NEW_LINE> value = args[i] <NEW_LINE> cmd_params[key_name] = value <NEW_LINE> <DEDENT> return cmd_params
Retrieves list of parameters from command line and returns them as a dict.
625941f2379a373c97cfb118
def print_text_on_surface(font, str_list, surface, center, offset_line): <NEW_LINE> <INDENT> for idx, str_display in enumerate(str_list): <NEW_LINE> <INDENT> text = font.render(str_display, True, WHITE) <NEW_LINE> center_x = center[0] - (text.get_width() // 2) <NEW_LINE> center_y = center[1] - (text.get_height() // 2) ...
Show multi line text on surface
625941f27b180e01f3dc4dc1
@app.route('/predict_file',methods=["POST"]) <NEW_LINE> def pred_note_authentication_file(): <NEW_LINE> <INDENT> df_test=pd.read_csv(request.files.get("file")) <NEW_LINE> prediction=classifier.predict(df_test) <NEW_LINE> return "The predicted value is"+ str(list(prediction))
This method is used to authenticate notes This is used for docstring --- parameters: - name: file in: formData type: file required: true responses: 200: description : The output values
625941f297e22403b379d56d
def connect_JSON(config): <NEW_LINE> <INDENT> testnet = config.get('testnet', '0') <NEW_LINE> testnet = (int(testnet) > 0) <NEW_LINE> if not 'rpcport' in config: <NEW_LINE> <INDENT> config['rpcport'] = 19113 if testnet else 39796 <NEW_LINE> <DEDENT> connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcp...
Connect to a xavander JSON-RPC server
625941f24e696a04525c9a1f
def rescuetime_result(self, week, ind=0): <NEW_LINE> <INDENT> if ind == 0: <NEW_LINE> <INDENT> nstart = datetime.date(2018, 1, 1) + datetime.timedelta(days=7 * (week - 1)) <NEW_LINE> result = get_all_from_rescuetime( [nstart + datetime.timedelta(days=i) for i in range(0 - nstart.weekday(), 7 - nstart.wee...
print data
625941f230bbd722463cc39b
def teardown_interfaces(self): <NEW_LINE> <INDENT> self.logger.debug("Tearing down interfaces") <NEW_LINE> for i in self.pg_interfaces: <NEW_LINE> <INDENT> self.logger.debug("Tear down interface %s" % (i.name)) <NEW_LINE> i.admin_down() <NEW_LINE> i.unconfig() <NEW_LINE> i.set_table_ip4(0) <NEW_LINE> i.set_table_ip6(0)
Unconfigure and bring down interface.
625941f2d486a94d0b98e718
def num_tokens_in_file(vocabulary_path): <NEW_LINE> <INDENT> num_tokens = 0 <NEW_LINE> with tf.io.gfile.GFile(vocabulary_path, "r") as reader: <NEW_LINE> <INDENT> text = reader.readline() <NEW_LINE> while text: <NEW_LINE> <INDENT> num_tokens += 1 <NEW_LINE> text = reader.readline() <NEW_LINE> <DEDENT> <DEDENT> return n...
Count the number of lines in a vocab file to get the number of tokens.
625941f23cc13d1c6d3c7948
def main(): <NEW_LINE> <INDENT> inp = input("1.管理员登录;2.管理员注册:\n>>>") <NEW_LINE> user = input("请输入账户:") <NEW_LINE> pwd = input("请输入密码:") <NEW_LINE> if inp == "1": <NEW_LINE> <INDENT> result = login(user, pwd) <NEW_LINE> if result == 0: <NEW_LINE> <INDENT> print("登录失败:密码错误!") <NEW_LINE> <DEDENT> elif result == 1: <NEW_LI...
主函数 :return: None
625941f2566aa707497f4b31
def create(channel): <NEW_LINE> <INDENT> _send('create_channel', { 'channel_name': channel, })
Create a channel.
625941f2498bea3a759ba07f
def isValidSudoku(self, board): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> l = len(board) <NEW_LINE> for i in range(l): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> for j in range(l): <NEW_LINE> <INDENT> if board[i][j] in dic: return False <NEW_LINE> elif board[i][j]!=".": dic[board[i][j]] = 1 <NEW_LINE> <DEDENT> <DEDENT> for ...
:type board: List[List[str]] :rtype: bool
625941f21d351010ab8560ec
def get_base_queryset(self): <NEW_LINE> <INDENT> qs = super(AlphabeticalPaginationMixin, self).get_queryset().exclude( **{self.get_alphabetical_pagination_field(): ''} ) <NEW_LINE> return qs
Queryset before applying pagination filters.
625941f23eb6a72ae02ecabf
@main.command() <NEW_LINE> @click.argument('user') <NEW_LINE> @click.argument('password') <NEW_LINE> @click.argument('provider') <NEW_LINE> @click.argument('consumer') <NEW_LINE> def modify_permissions(user, password, provider, consumer, perm='active'): <NEW_LINE> <INDENT> schemas_map = get_schemas(provider) <NEW_LINE>...
Modify permissions  :param user: The EOS user account name. :param password: Wallet password for user. :param provider: Provider EOS account name. :param consumer: Consumer EOS account name. :param perm: EOS Permission level to use for acquiring keys.
625941f2a934411ee3751c67
def set_attributes_from_weights(self, weights=None, do_asserts=True): <NEW_LINE> <INDENT> if weights is not None: <NEW_LINE> <INDENT> if not weights[0] > 0: <NEW_LINE> <INDENT> raise ValueError( "the first weight must be >0 but was %f" % weights[0]) <NEW_LINE> <DEDENT> if weights[-1] > 0: <NEW_LINE> <INDENT> raise Valu...
make the class attribute values consistent with weights, in case after (re-)setting the weights from input parameter ``weights``, post condition is also ``sum(self.postive_weights) == 1``. This method allows to set or change the weight list manually, e.g. like ``weights[:] = new_list`` or using the `pop`, `insert` etc...
625941f25166f23b2e1a572b
def query(graph, observable_nodes, model_mapper, sleep=100): <NEW_LINE> <INDENT> LAST_DATE = '01/01/1900' <NEW_LINE> while True: <NEW_LINE> <INDENT> state = get_state() <NEW_LINE> with graph.session_scope() as session: <NEW_LINE> <INDENT> for k in observable_nodes: <NEW_LINE> <INDENT> for label in observable_nodes[k]: ...
Transform and write expired records to elastic q.
625941f2b5575c28eb68e5d7
def computePublicKey(g, p, s): <NEW_LINE> <INDENT> return (g**s)%p
Computes a node's public key
625941f2e1aae11d1e74a28f
def multi_drag(self, curve: DigitizeCurve, mp: Point): <NEW_LINE> <INDENT> raise NotImplementedError
Drag last point (usually control-point move)
625941f2460517430c394746
def get_activity_by_id(id, user_id): <NEW_LINE> <INDENT> activity = Activity.query.filter(Activity.id == id).first() <NEW_LINE> if activity: <NEW_LINE> <INDENT> get_activity_address_by_id(activity) <NEW_LINE> activity_is_collect(activity, user_id) <NEW_LINE> activity = flatten(activity) <NEW_LINE> return activity <NEW_...
通过id得到activity
625941f23346ee7daa2b3343
def get_recent_state(self, current_observation): <NEW_LINE> <INDENT> state_list = [] <NEW_LINE> n_workers = len(current_observation) <NEW_LINE> for worker_idx in range(n_workers): <NEW_LINE> <INDENT> state = self._get_recent_state(current_observation, worker_idx) <NEW_LINE> state_list.append(state) <NEW_LINE> <DEDENT> ...
Return list of last observations Parameters ---------- current_observation: tuple(array-like) Each element corresponds to observation for each agent Returns ------- Array of the last observations of agents
625941f2f7d966606f6aa5dd
def __init__(self, space, exponent): <NEW_LINE> <INDENT> super(LpNorm, self).__init__( space=space, linear=False, grad_lipschitz=np.nan) <NEW_LINE> self.exponent = float(exponent)
Initialize a new instance. Parameters ---------- space : `DiscreteLp` or `TensorSpace` Domain of the functional. exponent : float Exponent for the norm (``p``).
625941f2fbf16365ca6f67a2
def __createSimpleNamedPipeConnection(self, *args): <NEW_LINE> <INDENT> logging.debug("Thread for RPCSS & Network Service starting") <NEW_LINE> logging.debug("Sleeping 2 secods for server, ugly -:(") <NEW_LINE> sleep(2) <NEW_LINE> namePipe = self.pipeName.replace("\\\\.\\","\\\\127.0.0.1\\") <NEW_LINE> try: <NEW_LINE> ...
Connect to 127.0.0.1 named pipe defined in pipeName, send a random string and close connection. :param args: :return: True or False (if an error)
625941f273bcbd0ca4b2c647
def call(self, inputs, state): <NEW_LINE> <INDENT> inputs = tf.concat([inputs, state.attention], axis=-1) <NEW_LINE> output, res_state = self._cell(inputs, state) <NEW_LINE> self._concats = inputs <NEW_LINE> if self._linear is None: <NEW_LINE> <INDENT> self._linear = _Linear(output, self._output_size, True) <NEW_LINE> ...
Run the cell and output projection on inputs, starting from state.
625941f25fc7496912cc3f4f
def schur_to_hl(mu, t=None): <NEW_LINE> <INDENT> if mu == []: <NEW_LINE> <INDENT> return {mu: 1} <NEW_LINE> <DEDENT> if t is None: <NEW_LINE> <INDENT> t = polygen(ZZ, 't') <NEW_LINE> <DEDENT> res = {} <NEW_LINE> for rg in riggings(mu): <NEW_LINE> <INDENT> res[ rg[0] ] = res.get(rg[0], 0) + weight(rg, t) <NEW_LINE> <DED...
Returns a dictionary corresponding to `s_\mu` in Hall-Littlewood `P` basis. INPUT: - ``mu`` -- a partition - ``t`` -- an optional parameter (default : the generator from `\mathbb{Z}['t']` ) OUTPUT: - a dictionary with the coefficients `K_{\mu\nu}(t)` for `\nu` smaller in dominance order than `\mu` EXAMPLES:: ...
625941f2ac7a0e7691ed4692
def test_authornames_doe_john(self): <NEW_LINE> <INDENT> tokenizer = _TOKENIZERS["BibIndexAuthorTokenizer"]() <NEW_LINE> self.assertEqual(['doe',], tokenizer.get_author_family_name_words_from_phrase('Doe, John'))
bibindex engine - get author family name words for Doe, John
625941f21b99ca400220b086
@publisher(['animation', 'shot previs']) <NEW_LINE> def check_multiple_shot_nodes(): <NEW_LINE> <INDENT> shot_nodes = pm.ls(type='shot') <NEW_LINE> local_shot_nodes = [] <NEW_LINE> for shot in shot_nodes: <NEW_LINE> <INDENT> if shot.referenceFile() is None: <NEW_LINE> <INDENT> local_shot_nodes.append(shot) <NEW_LINE> <...
Single shot node in the scene checks if there are multiple shot nodes
625941f224f1403a92601133
def get_isbn_by_asins(self, asins): <NEW_LINE> <INDENT> isbns = [] <NEW_LINE> query = "select isbn from %s where asin = ?" % self.table_name <NEW_LINE> for asin in asins: <NEW_LINE> <INDENT> isbn = self.conn.execute(query, asin).fetchone() <NEW_LINE> if len(isbn) == 1: <NEW_LINE> <INDENT> isbns.append(isbn) <NEW_LINE> ...
get isbns from asin_isbn table
625941f2be7bc26dc91cdbc6
def time_columns(df): <NEW_LINE> <INDENT> fill_nan = np.nan <NEW_LINE> year_lst = list(np.full(len(df),fill_nan)) <NEW_LINE> month_lst = list(np.full(len(df),fill_nan)) <NEW_LINE> day_lst = list(np.full(len(df),fill_nan)) <NEW_LINE> hour_lst = list(np.full(len(df),fill_nan)) <NEW_LINE> min_lst = list(np.full(len(...
This function takes a df with a "TIMESTAMP" index/column and separates the date and time atributes into different columns and creates a new df with just the time columns separated input: df - pandas dataframe with "TIMESTAMP" index output: df_time - pandas dataframe with just the timestamp columns
625941f2097d151d1a223428
def endBy1(p, sep): <NEW_LINE> <INDENT> return separated(p, sep, 1, maxt=float('inf'), end=True)
`endBy1(p, sep) parses one or more occurrences of `p`, seperated and ended by `sep`. Returns a list of values returned by `p`.
625941f25fdd1c0f98dc0808
def callback_value(self, widget_ref, index, ch_index, trigger, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> w_map = self.widget_map[widget_ref] <NEW_LINE> w_map[index]['values'][ch_index] = value <NEW_LINE> if trigger: <NEW_LINE> <INDENT> if not all(w_map[index]['conn']): <NEW_LINE> <INDENT> self.warn_unconnect...
Callback executed when a channel receives a new value. Parameters ---------- widget_ref : weakref A weakref to the widget owner of the rule. index : int The index of the rule being processed. ch_index : int The channel index on the list for this rule. trigger : bool Whether or not this channel should t...
625941f24527f215b584ca23
def reset_statevector_nondeterministic(): <NEW_LINE> <INDENT> targets = [] <NEW_LINE> targets.append(array([1, 0, 1, 0]) / sqrt(2)) <NEW_LINE> targets.append(array([1, 1, 0, 0]) / sqrt(2)) <NEW_LINE> return targets
Reset test circuits reference counts.
625941f24d74a7450ccd4797
def naked_twins(values): <NEW_LINE> <INDENT> for unit in unitlist: <NEW_LINE> <INDENT> digit = '' <NEW_LINE> unit_pos = [box for box in unit if len(values[box]) == 2] <NEW_LINE> unit_list = unit.copy() <NEW_LINE> unit_values = [] <NEW_LINE> for p in unit_pos: <NEW_LINE> <INDENT> unit_values.append(values[p]) <NEW_LINE>...
Eliminate values using the naked twins strategy. Args: values(dict): a dictionary of the form {'box_name': '123456789', ...} Returns: the values dictionary with the naked twins eliminated from peers.
625941f232920d7e50b287a7
def nearest_neighbour_classification(reference, data): <NEW_LINE> <INDENT> reference = np.array(reference) <NEW_LINE> data = np.array(data) <NEW_LINE> reference_features = np.array(reference[0, 1:], dtype=str) <NEW_LINE> data_features = np.array(data[0], dtype=str) <NEW_LINE> data_names = reference[1:, 0] <NEW_LINE> fe...
Assigns a value from the reference to each data points.correlation The name of the features must be identical. Args: reference (numpy.array): A matrix to which the data will be mapped. The first row should contain the names/indices of the features. The first column contains the labels. ...
625941f229b78933be1e5c77
def push_wx(_sckey, desp=""): <NEW_LINE> <INDENT> if _sckey == '': <NEW_LINE> <INDENT> print("[注意] 未提供sckey,不进行推送!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> server_url = f"https://sc.ftqq.com/{_sckey}.send" <NEW_LINE> params = { "text": '小米运动 步数修改', "desp": desp } <NEW_LINE> response = requests.get(server_url, pa...
推送server酱
625941f210dbd63aa1bd3174
def safePlot(self, data, stats_list, imageName): <NEW_LINE> <INDENT> if not self.parent.parent.parent.imageOpen: <NEW_LINE> <INDENT> self.parent.parent.parent.openImage("manual open") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.parent.parent.parent.window.panel.clear() <NEW_LINE> <DEDENT> plotInstance = self.par...
Used in conjunction with wx.CallAfter to update the embedded Matplotlib in the image window. If the image window is closed it will open it and then plot, otherwise it is simply plotted.
625941f28c3a873295158994
def _maybe_expand_labels(labels, predictions): <NEW_LINE> <INDENT> with ops.name_scope(None, 'expand_labels', (labels, predictions)) as scope: <NEW_LINE> <INDENT> labels = sparse_tensor.convert_to_tensor_or_sparse_tensor(labels) <NEW_LINE> if isinstance(labels, sparse_tensor.SparseTensor): <NEW_LINE> <INDENT> return co...
If necessary, expand `labels` along last dimension to match `predictions`. Args: labels: `Tensor` or `SparseTensor` with shape [D1, ... DN, num_labels] or [D1, ... DN]. The latter implies num_labels=1, in which case the result is an expanded `labels` with shape [D1, ... DN, 1]. predictions: `Tensor` wi...
625941f2656771135c3ebe48
def set(self, attribute, value): <NEW_LINE> <INDENT> if not isinstance(attribute, str): <NEW_LINE> <INDENT> raise TypeError("attributes must be designated by string label, recieved %s" % attribute) <NEW_LINE> <DEDENT> self._defined[attribute] = value
set a domain-specific aspect of the task, such as duration, due, progress...
625941f256ac1b37e6264795
def addLayerToGroup(self, layer, group): <NEW_LINE> <INDENT> addedLayer = QgsProject.instance().addMapLayer(layer, False) <NEW_LINE> group.addLayer(addedLayer)
Add a layer to its corresponding group
625941f292d797404e30475f
def leastConstraintOrder(var, assignment, graph): <NEW_LINE> <INDENT> pass
FunctionUndefined: This will require some change in the structure of few other functions The idea behind implementing this function was to get a list of values for the passed var sorted in increasing order of their effect on domains of other variables of CSP.
625941f2cad5886f8bd275aa
@login_required <NEW_LINE> def events_view(request): <NEW_LINE> <INDENT> if len(Event.objects.all()) > 0: <NEW_LINE> <INDENT> all_events = Event.objects.all().order_by('-event_date') <NEW_LINE> events_group = [] <NEW_LINE> for year in range(all_events[0].event_date.year, all_events[len(all_events) - 1].event_date.year ...
This provides the site's events view
625941f22eb69b55b151ce8a
def serialized_name(self) -> str: <NEW_LINE> <INDENT> return "insert"
Get the name of the iterator, as used in the plan serialization protocol
625941f2d486a94d0b98e719
def __add_tree(self,new_tree): <NEW_LINE> <INDENT> self.elements = self.elements + 2**new_tree.rank <NEW_LINE> self.__resize() <NEW_LINE> while self.trees[new_tree.rank] is not None: <NEW_LINE> <INDENT> if self.trees[new_tree.rank].value < new_tree.value: <NEW_LINE> <INDENT> new_tree, self.trees[new_tree.rank] = ...
Insert new_tree into self
625941f2e64d504609d74e12
def formarNumero(num,aum=0): <NEW_LINE> <INDENT> if num == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if (num%10)%2 == 0: <NEW_LINE> <INDENT> return (num%10)*10**aum +(formarNumero(num//10,aum+1)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return formarNumero(num//10,aum)
Entrada: num(int),aum(int) Funcionalidad: Formar un número con los digitos pares de num Salida: Numero con los digitos pares de num
625941f25fcc89381b1e1c96
def test_fragment_loss( self, sim_engine, fragmentation, fragmentation_ff_discard_vrb_entry_policy, target_datagram_offset, ): <NEW_LINE> <INDENT> sim_engine = sim_engine( { 'exec_numMotes' : 3, 'exec_numSlotframesPerRun' : 10, 'sf_class' : 'SFN...
Test fragmentation with fragment loss - objective : test if a packet is lost there is a missing fragment - precondition: form a 3-mote linear topology - precondition: app scheduled is done by hand (app_pkPeriod=0) - precondition: a packet is divided into three fragments - action : send a packet from the leaf - a...
625941f2596a89723608a08a
def update_dbs(): <NEW_LINE> <INDENT> pass
Check for updates to the XML Dumps and download the updates if they have been updated since current version.
625941f29f2886367277ae5b
def getBannerName(self, dir): <NEW_LINE> <INDENT> res = self.banner <NEW_LINE> if dir == 'rtl': res = '%srtl%s' % os.path.splitext(res) <NEW_LINE> return res
If your site uses at least one RTL (right-to-left) language, you must propose a banner whose name is self.banner, suffixed with "rtl".
625941f2cdde0d52a9e5360b
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, BitRateMode): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941f271ff763f4b549c69
def command_for_sub_path(self, path): <NEW_LINE> <INDENT> name = fs.relative_to(path, self.maps_path).split("/")[0] <NEW_LINE> return self.command_for_sub_name(name)
This function ... :param path: :return:
625941f23d592f4c4ed1d62f
def getExtremeExp(idx): <NEW_LINE> <INDENT> switcher = { 20:['Median', 'quartile', 'Extreme'], 21:['Median', 'Extreme', 'quartile'], 22:['quartile', 'Extreme', 'Median'], 23:['quartile', 'Median', 'Extreme'], 24:['Extreme', 'Median', 'quartile'], 25:['Extreme', 'quartile', 'Median'] } <NEW_LINE> error_msg = 'Please ent...
Get Group 7 experiment details
625941f2fff4ab517eb2fa13
def get_csv(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> csv_file = Eg003BulkExportUserDataController.get_csv_user_list() <NEW_LINE> <DEDENT> except ApiException as err: <NEW_LINE> <INDENT> return process_error(err) <NEW_LINE> <DEDENT> results_file = open("app/admin/examples/exported_user_data.csv", "w") <NEW_LINE> ...
1. Getting an existing CSV file 2. Returns the finished csv file to the user
625941f28a43f66fc4b54631
def __len__(self): <NEW_LINE> <INDENT> return self.id_range
Get the number of distinct ids = the entire dictionary size.
625941f2d164cc6175783321
def get_summary_for_group(self, datatype_group_id): <NEW_LINE> <INDENT> result = 0, "" <NEW_LINE> try: <NEW_LINE> <INDENT> result = self.session.query(func.sum(DataType.disk_size), func.max(DataType.subject) ).filter(DataType.fk_datatype_group == datatype_group_id).all()[0] or result <NEW_LINE> <DEDENT> except SQLAlche...
:return (disk_size SUM, subject)
625941f273bcbd0ca4b2c648
def absent(name, persist=False, comment=True, mods=None): <NEW_LINE> <INDENT> if not isinstance(mods, (list, tuple)): <NEW_LINE> <INDENT> mods = [name] <NEW_LINE> <DEDENT> ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} <NEW_LINE> loaded_mods = __salt__['kmod.mod_list']() <NEW_LINE> if persist: <NEW_...
Verify that the named kernel module is not loaded name The name of the kernel module to verify is not loaded persist Remove module from ``/etc/modules`` comment Comment out module in ``/etc/modules`` rather than remove it mods A list of modules to verify are unloaded. If this argument is used, ...
625941f24428ac0f6e5badca
def parse_arguments(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser() <NEW_LINE> parser.add_argument( 'cmdb_file', type=str, help='Path to cmdb settings file', ) <NEW_LINE> parser.add_argument( '-a', '--app', dest='app', type=str, help='Application name', ) <NEW_LINE> parser.add_argument( '-k', '--key', dest='k...
Argument parsing :return: args namespace :rtype: namespace
625941f2460517430c394747
def userAddGroupInfoAction(bot, user, groupId, dbAction): <NEW_LINE> <INDENT> return
user add group and bot connect info, bot or user could do something about it, default: do nothing if you only have bot app, it is not needed
625941f238b623060ff0b3bf
def test_008(self): <NEW_LINE> <INDENT> for rgn in regions.All: <NEW_LINE> <INDENT> self.context.regions = [rgn] <NEW_LINE> gen = SuperGenerator(None) <NEW_LINE> self.context.generators = [gen] <NEW_LINE> nemo.run(self.context) <NEW_LINE> if rgn == regions.nsw: <NEW_LINE> <INDENT> self.assertEqual(gen.runhours, self.co...
A NSW generator runs in NSW only.
625941f285dfad0860c3b430
def isProbablyPrime(n, k): <NEW_LINE> <INDENT> print("n is", n, ", k is", k) <NEW_LINE> d = n-1 <NEW_LINE> r = 0 <NEW_LINE> while(d%2 == 0): <NEW_LINE> <INDENT> r += 1 <NEW_LINE> d = int(d/2) <NEW_LINE> <DEDENT> for i in range(k): <NEW_LINE> <INDENT> cont_flag = False <NEW_LINE> a = random.randrange(2,n-1) <NEW_LINE> x...
input 1: n > 3, odd integer input 2: determines accuracy of test, P(isprime) = 1 - (1/2)^k output: 0 if n is composite, otherwise 1 runtime: O(k lg^3 n)
625941f2be8e80087fb2120a
def open_existing(self, cr, uid, ids, context=None): <NEW_LINE> <INDENT> if not context: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> return { 'domain': "[('res_id','in', ["+','.join(map(str, context.get('active_ids',[])))+ "]),('res_model', '=', '%s')]" %context.ge...
function will open existing report
625941f24c3428357757c8f6
def connect(self, num_retries): <NEW_LINE> <INDENT> zeroconf = Zeroconf() <NEW_LINE> listener = mDNSListener(self) <NEW_LINE> browser = ServiceBrowser(zeroconf, self.mdns_address , listener) <NEW_LINE> num_tries = 0 <NEW_LINE> while (num_tries < num_retries and not self.is_connected): <NEW_LINE> <INDENT> time.sleep(1) ...
Connects to the drone :param num_retries: maximum number of retries :return: True if the connection succeeded and False otherwise
625941f2bde94217f36833be
def generatePossibleNextMoves(self, s): <NEW_LINE> <INDENT> result =[] <NEW_LINE> for i in range(len(s)-1): <NEW_LINE> <INDENT> flip = list(s) <NEW_LINE> if s[i:i+2] == "++": <NEW_LINE> <INDENT> flip[i:i+2] = "--" <NEW_LINE> result.append(''.join(flip)) <NEW_LINE> <DEDENT> <DEDENT> return result
:type s: str :rtype: List[str]
625941f25fcc89381b1e1c97
def __init__(self, window, min_hits=4, n_last_fit=2): <NEW_LINE> <INDENT> self.window = window <NEW_LINE> self.min_hits = min_hits <NEW_LINE> self.n_last_fit = n_last_fit <NEW_LINE> self.labels_ = None <NEW_LINE> self.predictions_ = None
This calss is simple realization of the Naive Track Following algorithm the straight track in 2D. :param window: float, if the difference between a hit and the extrapolation function is larger than thi value, the hit is rejected. :param min_hits: int, min number of hits in a track. :param n_last_fit: int, number of las...
625941f266656f66f7cbc780
def get_total_torque(self): <NEW_LINE> <INDENT> return sum([abs(hang.weight() * dist) for hang, dist in zip(self.hanger[:], self.dist[:])])
Returns the total torque on the beam :return: torque value
625941f22c8b7c6e89b35d8e
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941f24c3428357757c8f7
def field(self, coordinates): <NEW_LINE> <INDENT> obstime = coordinates.obstime <NEW_LINE> if obstime is None: <NEW_LINE> <INDENT> raise ValueError( "No observation time was specified for the coordinates") <NEW_LINE> <DEDENT> date = obstime.datetime.date() <NEW_LINE> if date != self._date: <NEW_LINE> <INDENT> self._sna...
Get the geo-magnetic field components This method accepts vectorized input. The frame of the returned value depends on the input size. If a single point is provided the magnetic field is returned in local ENU coordinates, centered on the point. Otherwise the components are given in ECEF. Parameters ---------- coordin...
625941f24e4d5625662d49a2
def leafs(bt, values_only=False): <NEW_LINE> <INDENT> bt = _prepare_tree(bt) <NEW_LINE> current_nodes = [bt] <NEW_LINE> leaf_nodes = [] <NEW_LINE> while current_nodes: <NEW_LINE> <INDENT> next_nodes = [] <NEW_LINE> for node in current_nodes: <NEW_LINE> <INDENT> left_child = _left_of(node) <NEW_LINE> right_child = _righ...
Return the leaf nodes of the binary tree. If the binary tree is given as a list, it is automatically converted into a tree form first. :param bt: The binary tree. :type bt: list | binarytree.Node :param values_only: Return the node values only rather than the nodes. :type values_only: bool :return: The list of leaf n...
625941f2cb5e8a47e48b8073
def divide(self, dividend, divisor): <NEW_LINE> <INDENT> k = dividend / divisor <NEW_LINE> if k < -2147483648 or k > 2147483647: <NEW_LINE> <INDENT> return 2147483647 <NEW_LINE> <DEDENT> if k >= 0: <NEW_LINE> <INDENT> return int(k) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return -int(-dividend / divisor)
:type dividend: int :type divisor: int :rtype: int
625941f29c8ee82313fbbd4a
def test_element_list(self): <NEW_LINE> <INDENT> category = self.F.CategoryFactory.create(name="OS") <NEW_LINE> element = self.factory.create(name="OS X", category=category) <NEW_LINE> res = self.get_list() <NEW_LINE> act_meta = res.json["meta"] <NEW_LINE> exp_meta = { "limit" : 20, "next" : None, "offset" : 0, "previo...
Get a list of existing elements
625941f230c21e258bdfaa77
def QA_SU_save_stock_alpha101half_day(code = None, start_date = None, end_date = None, client=DATABASE, ui_log = None, ui_progress = None): <NEW_LINE> <INDENT> if end_date is None: <NEW_LINE> <INDENT> end_date = QA_util_today_str() <NEW_LINE> <DEDENT> if start_date is None: <NEW_LINE> <INDENT> start_date = '2017-04-10'...
save stock_day 保存财报日历 历史全部数据 :return:
625941f2cad5886f8bd275ab
def create_special_styles(self): <NEW_LINE> <INDENT> self.base_names = { 'character': self.args.base_character_style, 'paragraph': self.args.base_paragraph_style, } <NEW_LINE> self.base_styles = { realm: self.found_style_definition( realm=realm, internal_name=name, wpid=name, used=True, automatic=True, ) for realm, nam...
Add any internal styles (i.e., not imported from the doc).
625941f2f548e778e58cdb53