code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _preprocess_candidate_answers(features, max_num_candidates, max_seq_length): <NEW_LINE> <INDENT> ragged_indices = tf.RaggedTensor.from_row_lengths( features["can_indexes"].values, features["can_sizes"]) <NEW_LINE> candidate_id = tf.ragged.row_splits_to_segment_ids(ragged_indices.row_splits) <NEW_LINE> indices = tf....
Prepares dense labels for each candidate.
625941e673bcbd0ca4b2c4cc
def clean(self): <NEW_LINE> <INDENT> df = self.df <NEW_LINE> for i in df.columns: <NEW_LINE> <INDENT> if i in ['ticker','dt','process_time','company','index','earnings','company_name', 'sector', 'industry', 'country','setup']: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> df[i] = df[i].appl...
Iterates all columns to clean except those in the list
625941e64e4d5625662d4828
def get_authorized_forums(user): <NEW_LINE> <INDENT> forums_pub = Forum.objects.filter(groups__isnull=True).all() <NEW_LINE> if user and user.is_authenticated(): <NEW_LINE> <INDENT> forums_private = Forum .objects .filter(groups__isnull=False, groups__in=user.groups.all()) .all() <NEW_L...
Find forums the user is allowed to visit. :param user: concerned user. :return: authorized_forums
625941e6ff9c53063f47c648
def plot(foo, x, y): <NEW_LINE> <INDENT> np_foo = np.vectorize(foo) <NEW_LINE> x_space = np.linspace(*x) <NEW_LINE> y_space = np.linspace(*y) <NEW_LINE> xx, yy = np.meshgrid(x_space, y_space) <NEW_LINE> xx = xx.flatten() <NEW_LINE> yy = yy.flatten() <NEW_LINE> zz = np_foo(xx, yy) <NEW_LINE> num_x = x[-1] <NEW_LINE> num...
x, y are tuples of 3 values: xmin, xmax, xnum
625941e6dc8b845886cb598d
def receive(self, packet): <NEW_LINE> <INDENT> super(Joinent, self).receive(packet) <NEW_LINE> if packet.data['tk'] == TrnsKind.join: <NEW_LINE> <INDENT> if packet.data['pk'] == PcktKind.request: <NEW_LINE> <INDENT> self.stack.incStat('joinent_rx_request') <NEW_LINE> self.join() <NEW_LINE> <DEDENT> elif packet.data['pk...
Process received packet belonging to this transaction
625941e616aa5153ce3628cf
def __init__(self, filename): <NEW_LINE> <INDENT> if isinstance(filename, bytes): <NEW_LINE> <INDENT> self._read(bs=filename) <NEW_LINE> self.output_file = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.input_file = filename <NEW_LINE> if self.input_file.endswith('.gz'): <NEW_LINE> <INDENT> self.output_file = ...
read in a .csp or .csp.gz file and create a CellSpace instance to represent the file contents. filename can also be a bytearray object that contains the contents of a .csp file. arguments: filename -- the path to the input file the following attributes will be created: header_size: the number of bytes in the hea...
625941e6eab8aa0e5d26dfb0
def cb_add_clicked(self, args): <NEW_LINE> <INDENT> key = self.key_input.getText() <NEW_LINE> value = self.value_input.getText() <NEW_LINE> item = self.edit_dict.findColumnItemWithText(key, 0, None) <NEW_LINE> if item is not None: <NEW_LINE> <INDENT> row = self.edit_dict.getItemRowIndex(item) <NEW_LINE> pos = PyCEGUI.M...
Called when the add button was clicked Args: args: PyCEGUI.WindowEventArgs
625941e6d53ae8145f87a6be
def Notify(self, Notification): <NEW_LINE> <INDENT> pass
This event is triggered whenever Skype client sends a notification. :Parameters: Notification : unicode Notification string. :note: Use this event only if there is no dedicated one.
625941e650485f2cf553d1f2
def time_since(time): <NEW_LINE> <INDENT> delta = time - datetime.utcnow() <NEW_LINE> locale = "en" <NEW_LINE> if current_user.is_authenticated() and current_user.language is not None: <NEW_LINE> <INDENT> locale = current_user.language <NEW_LINE> <DEDENT> return format_timedelta(delta, add_direction=True, locale=locale...
Returns a string representing time since e.g. 3 days ago, 5 hours ago. :param time: A datetime object
625941e6cc40096d61595da6
def delete_entry(entry): <NEW_LINE> <INDENT> if input('Are you sure? [y/N] ').lower() == 'y': <NEW_LINE> <INDENT> entry.delete_instance() <NEW_LINE> print('Entry deleted')
Delete an entry
625941e626068e7796caf13d
def totient(n): <NEW_LINE> <INDENT> n = as_int(n) <NEW_LINE> if n < 1: <NEW_LINE> <INDENT> raise ValueError("n must be a positive integer") <NEW_LINE> <DEDENT> factors = factorint(n) <NEW_LINE> t = 1 <NEW_LINE> for p, k in factors.items(): <NEW_LINE> <INDENT> t *= (p-1) * p**(k-1) <NEW_LINE> <DEDENT> return t
Calculate the Euler totient function phi(n) >>> from sympy.ntheory import totient >>> totient(1) 1 >>> totient(25) 20 See Also ======== divisor_count
625941e6c4546d3d9de72e8f
@edit.command('extruded-border') <NEW_LINE> @click.argument('model-json', type=click.Path( exists=True, file_okay=True, dir_okay=False, resolve_path=True)) <NEW_LINE> @click.option('--depth', '-d', help='A number for the extrusion depth. This can include ' 'the units of the distance (eg. 3ft) or, if no units are provid...
Add extruded borders to all windows in walls.  Args: model_json: Full path to a Honeybee Model JSON file.
625941e6a219f33f34628dbb
def test_open_public_timer_other_user(self): <NEW_LINE> <INDENT> resp_timer_detail = self.user_test_t_2.timer_detail(self.timer_lpub_2_id) <NEW_LINE> view_timer = resp_timer_detail.context.get('timer') <NEW_LINE> edit_enabled = resp_timer_detail.context.get('edit_enabled') <NEW_LINE> self.assertNotEqual(view_timer.crea...
A signed-in user should succeed in accessing the details of another user's public timer.
625941e6bf627c535bc13626
def update_or_create_assignment(self, name: str, **kwargs: dict) -> Assignment: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assignment = self.find_assignment(name) <NEW_LINE> <DEDENT> except MissingEntry: <NEW_LINE> <INDENT> assignment = self.add_assignment(name, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
Update an existing assignment, or create it if it doesn't exist. Parameters ---------- name: the name of the assignment `**kwargs` additional keyword arguments for the :class:`~nbgrader.api.Assignment` object Returns ------- assignment
625941e6baa26c4b54cb1572
def populate_model(self, delta_ifc_key, delta_ifc_cfg_value): <NEW_LINE> <INDENT> super(TemplateAndCollectors, self).populate_model(delta_ifc_key, delta_ifc_cfg_value) <NEW_LINE> values = delta_ifc_cfg_value['value'] <NEW_LINE> for (ifc_type, ifc_key, ifc_name), value in values.iteritems(): <NEW_LINE> <INDENT> if ifc_k...
Populate model
625941e6d6c5a102081444a5
def server(self): <NEW_LINE> <INDENT> return _ldap.Server(WrappedAdmin(self._ldap_conn))
Create Server object.
625941e6099cdd3c635f10b0
@require_http_methods(["GET"]) <NEW_LINE> @login_required <NEW_LINE> def solve_topic(request, topic_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> topic = Topic.objects.get(id=topic_id) <NEW_LINE> if request.user == topic.author: <NEW_LINE> <INDENT> topic.is_solved = 1 <NEW_LINE> topic.save() <NEW_LINE> <DEDENT> <DE...
View to update a question as solved in DB Afficher pour mettre à jour une question telle que résolue dans DB
625941e623849d37ff7b34e3
def oddTuples(aTup): <NEW_LINE> <INDENT> tup_store = () <NEW_LINE> for i in range(0,len(aTup),2): <NEW_LINE> <INDENT> tup_store = tup_store + (aTup[i],) <NEW_LINE> <DEDENT> return tup_store
aTup: a tuple returns: tuple, every other element of aTup.
625941e6b57a9660fec33ce1
def wncomd(left, right, window): <NEW_LINE> <INDENT> assert isinstance(window, stypes.SpiceCell) <NEW_LINE> assert window.dtype == 1 <NEW_LINE> left = ctypes.c_double(left) <NEW_LINE> right = ctypes.c_double(right) <NEW_LINE> result = stypes.SpiceCell.double(window.size) <NEW_LINE> libspice.wncomd_c(left, right, ctypes...
Determine the complement of a double precision window with respect to a specified interval. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/wncomd_c.html :param left: left endpoints of complement interval. :type left: float :param right: right endpoints of complement interval. :type right: float :param wind...
625941e650485f2cf553d1f3
def newRoute(self, name=None): <NEW_LINE> <INDENT> @receiver(inputType=Routed(self._outputType), outputType=self._outputType, name=name) <NEW_LINE> def received(item): <NEW_LINE> <INDENT> if not isinstance(item, _To): <NEW_LINE> <INDENT> raise TypeError("{0} is not routed".format(item)) <NEW_LINE> <DEDENT> if item._whe...
Create a new route. A route has two uses; first, it is an L{IFount} that you can flow to a drain. Second, it is the "where" parameter passed to L{to}. Each value sent to L{Router.drain} should be a L{to} constructed with a value returned from this method as the "where" parameter. @param name: Give the route a name ...
625941e65510c4643540f830
def check_file_access(m, PMS): <NEW_LINE> <INDENT> LOG.debug('Checking if we can reach %s directly' % m._prettyfilename()) <NEW_LINE> files = list(m.iterParts()) <NEW_LINE> for file in files: <NEW_LINE> <INDENT> if os.path.exists(file.file): <NEW_LINE> <INDENT> LOG.debug('Found %s', file.file) <NEW_LINE> return file.fi...
Check if we can reach the file directly or if we have to download it via PMS. Args: m (plexapi.video.Episode) Return: filepath or http to the file.
625941e6c432627299f050a0
def molid_lab(): <NEW_LINE> <INDENT> cachefile = op.join(MALARIA_INDICES_ROOT, 'lab_molids_label.txt') <NEW_LINE> if not op.isfile(cachefile): <NEW_LINE> <INDENT> with open(cachefile, 'wt') as writer: <NEW_LINE> <INDENT> writer.write('\n'.join(['%s %s' % (molid, label[0].lower()) for molid, _, _, label, _, _ in read_la...
Returns a map {molid->label} for the labelled molecules.
625941e663b5f9789fde753d
def __init__(self): <NEW_LINE> <INDENT> pygame.sprite.Sprite.__init__(self) <NEW_LINE> self.image = pygame.Surface((540, 50)) <NEW_LINE> self.image = self.image.convert() <NEW_LINE> self.image.fill((144, 144, 144)) <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect.centerx = 320 <NEW_LINE> self.rect.cent...
This initalizer will determine the location of the ceiling as well as the colour
625941e67cff6e4e81117ddd
def headerlist(self): <NEW_LINE> <INDENT> self.headers = self.lines[4].split() <NEW_LINE> self.headercnt = len(self.headers)
creates headers from first line read in from file self.lines
625941e6bd1bec0571d90a86
def get_undefined_symbols(file): <NEW_LINE> <INDENT> symbols = [] <NEW_LINE> cmdline = 'nm -u -A %s' % file <NEW_LINE> result = exec_cmd(cmdline, os.path.join(cef_dir, 'tools')) <NEW_LINE> if len(result['err']) > 0: <NEW_LINE> <INDENT> raise Exception('ERROR: nm failed: %s' % result['err']) <NEW_LINE> <DEDENT> for line...
Returns the undefined symbols imported by |file|.
625941e6d486a94d0b98e59e
def init (self,owner,runtime): <NEW_LINE> <INDENT> _TDLOptionItem.init(self,owner,runtime); <NEW_LINE> if self.config_name: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = config.get(config_section,self.config_name); <NEW_LINE> if self._validator(value): <NEW_LINE> <INDENT> _dprint(2,"read",self.config_name,"=",va...
initializes the option. This is called when the option is placed into a run-time or compile-time menu.
625941e632920d7e50b2862b
def disk_mass_within_radius(star, t, R, gamma): <NEW_LINE> <INDENT> R /= star.initial_characteristic_disk_radius <NEW_LINE> R **= 2-gamma <NEW_LINE> R /= 1+(t-star.last_encounter)/star.viscous_timescale <NEW_LINE> return -disk_mass(star, t, gamma)*np.expm1(-R)
Return the mass of a circumstellar disk on a given moment inside a given radius. :param star: star with the disk :param t: moment of time at which the disk mass is to be evaluated :param R: radius inside which the mass is to be evaluated :return: disk mass at moment t inside radius R
625941e629b78933be1e5afe
def build_shift_dict(self, shift): <NEW_LINE> <INDENT> shift_dict = {} <NEW_LINE> for letter in string.ascii_lowercase: <NEW_LINE> <INDENT> enctryped_letter = '' <NEW_LINE> new_shift = string.ascii_lowercase.index(letter) + shift <NEW_LINE> if (new_shift > 25): <NEW_LINE> <INDENT> new_shift = abs(26 - new_shift) <NEW_L...
Creates a dictionary that can be used to apply a cipher to a letter. The dictionary maps every uppercase and lowercase letter to a character shifted down the alphabet by the input shift. The dictionary should have 52 keys of all the uppercase letters and all the lowercase letters only. shift (integer): the amo...
625941e671ff763f4b549aeb
def test_No1030307_get_ETH_buy_list(self): <NEW_LINE> <INDENT> logger.logger.debug("doing test " + str(self.id()) + " started") <NEW_LINE> conf_input_data = data_c2c_listed.ucex_inputdata[6] <NEW_LINE> conf_output_data = data_c2c_listed.ucex_outputdata[6] <NEW_LINE> logger.logger.info("token value "+str(self.token_valu...
UCEX QA:get ETH buy list
625941e6711fe17d825427b9
def set_pair_info(r1: AlignedSegment, r2: AlignedSegment, proper_pair: bool = True) -> None: <NEW_LINE> <INDENT> assert not r1.is_unmapped, f"Cannot process unmapped mate {r1.query_name}/1" <NEW_LINE> assert not r2.is_unmapped, f"Cannot process unmapped mate {r2.query_name}/2" <NEW_LINE> assert r1.query_name == r2.quer...
Resets mate pair information between reads in a pair. Requires that both r1 and r2 are mapped. Can be handed reads that already have pairing flags setup or independent R1 and R2 records that are currently flagged as SE reads. Args: r1: read 1 r2: read 2 with the same queryname as r1
625941e6b830903b967e9d5e
def __init__(self, name=None, brief='', **field_args): <NEW_LINE> <INDENT> Widget.__init__(self, name=name, brief=brief, **field_args) <NEW_LINE> self.tag_name = "textarea" <NEW_LINE> self[0] = ''
input_text: The default text in the text input field, field name used as name attribute rows: The number of rows of the text area cols: The number of columns of the text area
625941e696565a6dacc8fb21
@jax.jit <NEW_LINE> def symmetrize( data: jnp.ndarray, row: jnp.ndarray, col: jnp.ndarray, ncols: Optional[int] = None, ): <NEW_LINE> <INDENT> perm = reorder_perm(row=col, col=row, ncols=ncols) <NEW_LINE> return (data + data.take(perm)) / 2
Get data of `(A + A.T) / 2` assuming `A` has symmetric sparsity. Args: data: values of `A` row: row indices of `A` col: col indices of `A` ncols: number of columns of `A` Returns: `sym_data`, same shape and dtype as `data`.
625941e7de87d2750b8601ef
def get_status(self): <NEW_LINE> <INDENT> ret = None <NEW_LINE> if not self.canceled: <NEW_LINE> <INDENT> ret = self.user_interface.comboBoxStatus.itemText( self.user_interface.comboBoxStatus.currentIndex()) <NEW_LINE> <DEDENT> return ret
Returns the selected status value
625941e6d4950a0f3b08c7a0
def serialize_input_str(tx, prevout_n, sequence, script_sig): <NEW_LINE> <INDENT> s = ['CTxIn('] <NEW_LINE> s.append('COutPoint(%s, %s)' % (tx, prevout_n)) <NEW_LINE> s.append(', ') <NEW_LINE> if tx == '00' * 32 and prevout_n == 0xffffffff: <NEW_LINE> <INDENT> s.append('coinbase %s' % script_sig) <NEW_LINE> <DEDENT> el...
Based on project: https://github.com/chaeplin/dashmnb.
625941e7442bda511e8be86a
def save_album(release, label_id, artist_id): <NEW_LINE> <INDENT> image_id = save_cover_art(release) <NEW_LINE> album_id = db.save('album', { 'name': release['title'], 'mbid': release['id'], 'type': release['release-group']['primary-type'].upper(), 'release_date': parse_release_date(release), 'image_id': image_id, 'art...
Save album `release` released on label `label_id` by artist `artist_id`.
625941e707f4c71912b118dc
def SGD(self, training_data, epochs, mini_batch_size, eta, lmbda = 0.0, evaluation_data=None, patience = 10, monitor_evaluation_cost=False, monitor_training_cost=False): <NEW_LINE> <INDENT> if evaluation_data: n_data = len(evaluation_data) <NEW_LINE> n = len(training_data) <NEW_LINE> evaluation_cost = [] <NEW_LINE> tra...
Train the neural network using mini-batch stochastic gradient descent. The ``training_data`` is a list of tuples ``(x, y)`` representing the training inputs and the desired outputs. The other non-optional parameters are self-explanatory, as is the regularization parameter ``lmbda``. The method also accepts ``evaluat...
625941e723e79379d52ee9b6
def latex_str(self): <NEW_LINE> <INDENT> return r"$V_s={:.1f}$, $a_s={:.1f}$, $d_s={:.1f}$".format(self.v, self.a, self.d).replace(".", ",")
str: Generates cell info in latex code
625941e77d847024c06be717
def send(self, data): <NEW_LINE> <INDENT> self._handler.send(data)
Proxy for handler send method.
625941e757b8e32f524838f5
def split_page_num(bookmark): <NEW_LINE> <INDENT> bookmark = bookmark.strip() <NEW_LINE> bookmark_list = re.split(r'([-]?\d*$)', bookmark) <NEW_LINE> if len(bookmark_list) > 1: <NEW_LINE> <INDENT> return bookmark_list[0].rstrip(' .-'), int(bookmark_list[1] or 0) <NEW_LINE> <DEDENT> return bookmark_list[0], 0
split between title and page number
625941e7d4950a0f3b08c7a1
def add_player(self, player): <NEW_LINE> <INDENT> self._player_list[player.get_position()].append(player)
add a player to the player list
625941e7a934411ee3751aec
def prior_GP_var_inv_gamma(y_invK_y, n_y, tau_range): <NEW_LINE> <INDENT> alpha = 2 <NEW_LINE> tau2 = (y_invK_y + 2 * tau_range**2) / (alpha * 2 + 2 + n_y) <NEW_LINE> log_ptau = scipy.stats.invgamma.logpdf( tau2, scale=tau_range**2, a=2) <NEW_LINE> return tau2, log_ptau
Imposing an inverse-Gamma prior onto the variance (tau^2) parameter of a Gaussian Process, which is in turn a prior imposed over an unknown function y = f(x). The inverse-Gamma prior of tau^2, tau^2 ~ invgamma(shape, scale) is described by a shape parameter alpha=2 and a scale parameter beta=tau_ran...
625941e73617ad0b5ed6834e
def __init__(self, logoperator=None): <NEW_LINE> <INDENT> self.logoperator = logoperator <NEW_LINE> condition = ( self.logoperator is not None and not isinstance(self.logoperator, logs.log_operator.LogOperator) ) <NEW_LINE> if condition: <NEW_LINE> <INDENT> raise TypeError("Param 'logoperator' must be a 'LogOperator'")
Constructor.
625941e7d7e4931a7ee9e377
def split_extension(path): <NEW_LINE> <INDENT> result = os.path.splitext(path) <NEW_LINE> if result[1] == '.in': <NEW_LINE> <INDENT> result = os.path.splitext(result[0]) <NEW_LINE> <DEDENT> return result
A wrapped around splitext() which will delete a '.in' extension. This convention is used for files being fed as the template file to cmake's configure_file() command; the resulting file has the same name but without the .in part.
625941e75166f23b2e1a55b1
def solve(self, board): <NEW_LINE> <INDENT> for i in xrange(len(board)): <NEW_LINE> <INDENT> for j in xrange(len(board[0])): <NEW_LINE> <INDENT> if board[i][j] == '.': <NEW_LINE> <INDENT> for c in "123456789": <NEW_LINE> <INDENT> if self.isValid(board, i, j, c): <NEW_LINE> <INDENT> board[i][j] = c <NEW_LINE> if self.so...
rtype: boolean
625941e7bf627c535bc13627
def add_gridlines(code, plot_method, gridlines, can_draw_map): <NEW_LINE> <INDENT> if gridlines: <NEW_LINE> <INDENT> if can_draw_map and plot_method == "using quickplot": <NEW_LINE> <INDENT> code += "try:\n" <NEW_LINE> code += " grid = plt.gca().gridlines(draw_labels=True)\n" <NEW_LINE> code += " grid.xlabels_top...
This function add the code required to add gridlines to the plot, and then returns the updated string. Args: * code String containing the current code. * gridlines Boolean holding whether or not gridlines are desired. * can_draw_map See iris.plot._can_draw_map(). This Boolean represents whether or not ...
625941e730dc7b7665901db9
def createmergerequest(self, project_id, sourcebranch, targetbranch, title, assignee_id=None, sudo=""): <NEW_LINE> <INDENT> url_str = '{0}/{1}/merge_requests'.format(self.projects_url, project_id) <NEW_LINE> data = {'source_branch': sourcebranch, 'target_branch': targetbranch, 'title': title, 'assignee_id': assignee_id...
Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to merge from :param targetbranch: name of the branch to merge to :param title: Title of the merge request :param assignee_id: Assignee user ID
625941e70c0af96317bb8640
def _make_path(target_path, theme): <NEW_LINE> <INDENT> ip = os.path.join(target_path, theme) if len(theme) else target_path <NEW_LINE> if not os.path.exists(ip): <NEW_LINE> <INDENT> os.makedirs(ip) <NEW_LINE> <DEDENT> return ip
Create output folder pre: os.path.exists(target_path) post: os.path.exists(__return__)
625941e70383005118ecfa39
def boundBox(self): <NEW_LINE> <INDENT> box = [[0.,0.],[0.,0.],[0.,0.]] <NEW_LINE> for item in self: <NEW_LINE> <INDENT> for i,ax in enumerate(item): <NEW_LINE> <INDENT> if item[ax] < box[i][0]: box[i][0] = item[ax] <NEW_LINE> if item[ax] > box[i][1]: box[i][1] = item[ax] <NEW_LINE> <DEDENT> <DEDENT> return box
Returns the bounding box [[xmin,xmax],[ymin,ymax],[zmin,zmax]] for the toolpath
625941e791f36d47f21ac94f
def markdown_func(site): <NEW_LINE> <INDENT> def markdown(text): <NEW_LINE> <INDENT> jinja_env = jinja2.Environment() <NEW_LINE> jinja_env.filters['media_url'] = media_url_func(site) <NEW_LINE> jinja_env.filters['absolute_url'] = absolute_url_func(site) <NEW_LINE> jinja_rendered = jinja_env.from_string(text).render() <...
Returns a filter function which will return the rendered version of the given Markdown text. This is done in two passes. First the content is rendered as Jinja, which allows the use of the other filters found here, like ``media_url`` and ``absolute_url``. Then, the result of that is rendered as markdown.
625941e77d847024c06be718
def _set_export_policy(self, v, load=False): <NEW_LINE> <INDENT> if hasattr(v, "_utype"): <NEW_LINE> <INDENT> v = v._utype(v) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> t = YANGDynClass( v, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="export-policy", parent=self, path_helper=self._path_he...
Setter method for export_policy, mapped from YANG variable /network_instances/network_instance/inter_instance_policies/apply_policy/config/export_policy (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_export_policy is considered as a private method. Backends lo...
625941e7bd1bec0571d90a87
def user_data(self, access_token): <NEW_LINE> <INDENT> request = self.oauth_request(access_token, SKYROCK_CHECK_AUTH) <NEW_LINE> json = self.fetch_response(request) <NEW_LINE> try: <NEW_LINE> <INDENT> return simplejson.loads(json) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None
Return user data provided
625941e730bbd722463cc220
def load_embedding_dictionary(self, file_path): <NEW_LINE> <INDENT> self.embedding_dictionary = {} <NEW_LINE> embeddings = [] <NEW_LINE> if ".zip/" in file_path: <NEW_LINE> <INDENT> archive_path = abspath(file_path) <NEW_LINE> split = archive_path.split(".zip/") <NEW_LINE> archive_path = split[0] + ".zip" <NEW_LINE> pa...
Loading a dictionary from GloVe Embeddings Values are the index of the embedding
625941e799cbb53fe679303d
def test_8_TradeMegagame_follow_standard_lots(self): <NEW_LINE> <INDENT> self.assertAlmostEqual(self.quotaDict["follow_standard_lots"], self.mysqlMegagameDay["follow_standard_lots"],delta=0.002)
交易大赛天统计数据:跟随总手数
625941e7283ffb24f3c55d55
def configure(args): <NEW_LINE> <INDENT> config = Configuration() <NEW_LINE> try: <NEW_LINE> <INDENT> if args.get('config'): <NEW_LINE> <INDENT> config.load_config(args.get('config'), 'api') <NEW_LINE> <DEDENT> if args.get('env'): <NEW_LINE> <INDENT> config.set("key", os.environ.get('DEVO_API_KEY', None)) <NEW_LINE> co...
Load CLI configuration :param args: args from files, launch vars, etc :return: Clien t API Object and Config values in array
625941e782261d6c526ab8fe
def get(self, *args, **kwargs): <NEW_LINE> <INDENT> return self._request.get(*args, **kwargs)
Queries the API resource :param args: - :param query: Dictionary, string or :class:`QueryBuilder` object defaults to empty dict (all) :param kwargs: - :param limit: Limits the number of records returned - :param fields: List of fields to include in the response cre...
625941e7d268445f265b52c7
def get_custom_logger(logger_name='default_logger'): <NEW_LINE> <INDENT> LOG_TO_FILE = False <NEW_LINE> DELIMITTER = '/' <NEW_LINE> LOG_PATH = dirname(abspath(__file__)) + DELIMITTER + 'logs' <NEW_LINE> LOG_FILE = LOG_PATH + DELIMITTER + 'blackbox.log' <NEW_LINE> LOG_FORMATTER = '%(asctime)s - %(name)s in function %(fu...
Creates logger instance. :param logger_name: Name for logger :return: Logger object
625941e78a43f66fc4b544b9
@admin.route('/role/list/<int:page>',methods=["GET"]) <NEW_LINE> @admin_login_req <NEW_LINE> def role_list(page=None): <NEW_LINE> <INDENT> if page is None: <NEW_LINE> <INDENT> page = 1 <NEW_LINE> <DEDENT> page_data = Role.query.paginate(page=page, per_page=10) <NEW_LINE> return render_template('admin/role_list.html',pa...
角色列表
625941e7fbf16365ca6f6625
def create_directory(resources_dir): <NEW_LINE> <INDENT> for f in os.listdir(os.path.join(resources_dir, "docs_for_ner")): <NEW_LINE> <INDENT> fpath = os.path.join(resources_dir, "docs_for_ner", f) <NEW_LINE> if os.path.isfile(fpath): <NEW_LINE> <INDENT> os.unlink(fpath)
Creates a directory for the result files
625941e7e5267d203edce0f0
def get(service_type): <NEW_LINE> <INDENT> return ServiceCatalog.get_instance()._services.get(service_type)
Retrieve a service from the service catalog. :Example: nurse.serve(SSHClient()) ssh_client = nurse.get(SSHClient)
625941e7e8904600ed9f238c
def fetch_from_google(self, keyword, api_key, engine_id, number_links=50): <NEW_LINE> <INDENT> items_per_page = 10 <NEW_LINE> if number_links < 10: <NEW_LINE> <INDENT> items_per_page = number_links <NEW_LINE> <DEDENT> pages_nbr = int(ceil(number_links / items_per_page)) <NEW_LINE> from googleapiclient.discovery import ...
Fetch images from google using API Key
625941e760cbc95b062c699c
def _write_lines(self, text_lines): <NEW_LINE> <INDENT> text_lines = text_lines[:self.max_lines] <NEW_LINE> for i in range(self.max_lines): <NEW_LINE> <INDENT> if i >= len(text_lines): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> self.draw.text((2, 1+(i*8)), self._truncate_text(text_lines[i]), font=self.font, fill=255...
Write text to the relevant line in a particular style (highlighted, plain, inverted, etc)
625941e7ac7a0e7691ed451c
def getTrackStartingPoints(data): <NEW_LINE> <INDENT> def _to_segment(group): <NEW_LINE> <INDENT> return Segment(np.min(group.time), np.max(group.time)) <NEW_LINE> <DEDENT> starting_point = Annotation(modality='face') <NEW_LINE> for track, segment in data.groupby('track').apply(_to_segment).iteritems(): <NEW_LINE> <IND...
Get track start points from pandas data frame
625941e707f4c71912b118dd
def getHeight(self, node): <NEW_LINE> <INDENT> if node is None: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> heightLeftTree = self.getHeight(node._left) <NEW_LINE> heightRightTree = self.getHeight(node._right) <NEW_LINE> return max(heightLeftTree, heightRightTree) + 1
Returns the height of a node, defined as the number of edges on the longest path from the specified node to a leaf node. Single node height is 1.
625941e7956e5f7376d712c4
def test_get_userinfo(self, authenticated_client): <NEW_LINE> <INDENT> for user_data in conftest.TEST_DATA: <NEW_LINE> <INDENT> if user_data['email'] == authenticated_client.user.email: <NEW_LINE> <INDENT> expected_response = user_data.copy() <NEW_LINE> del expected_response['password'] <NEW_LINE> del expected_response...
Test GETing UserInfo.
625941e7090684286d50f144
def query_zip_progress(self, token): <NEW_LINE> <INDENT> return seafserv_threaded_rpc.query_zip_progress(token)
Query zip progress for download-dir, download-multi token: obtained by get_fileserver_access_token Return: json formated string `{"zipped":, "total":}`, otherwise None.
625941e7377c676e912725ff
def load(self): <NEW_LINE> <INDENT> etree = ElementTree.parse(self.filename).getroot() <NEW_LINE> self.set_properties(etree) <NEW_LINE> self.imagemap[(0,0)] = 0 <NEW_LINE> for node in etree.findall('layer'): <NEW_LINE> <INDENT> self.addTileLayer(TiledLayer(self, node)) <NEW_LINE> <DEDENT> for node in etree.findall('obj...
parse a map node from a tiled tmx file
625941e799cbb53fe679303e
@pytest.fixture(scope="module") <NEW_LINE> def farm(): <NEW_LINE> <INDENT> return endpoint_farm.Farm(N_HOSTS, CALLBACKS)
Create a coco runner.
625941e75fdd1c0f98dc068e
def jisuan_jia_and_jian(l): <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> while l: <NEW_LINE> <INDENT> if l[0] == '-': <NEW_LINE> <INDENT> l[0] = l[0] + l[1] <NEW_LINE> del l[1] <NEW_LINE> <DEDENT> sum += float(l[0]) <NEW_LINE> for i in range(1, len(l), 2): <NEW_LINE> <INDENT> if l[i] == '+' and l[i + 1] != '-': <NEW_LINE> <I...
计算加减 :param l: 是一个只含有加减号的表达式 :return: sum最终的计算结果
625941e799fddb7c1c9de7e7
def search(self, release_name, lang): <NEW_LINE> <INDENT> subtitles = [] <NEW_LINE> language = babelfish.Language.fromalpha2(lang).name <NEW_LINE> payload = {'q': release_name, 'r': 'true'} <NEW_LINE> url = 'http://subscene.com/subtitles/release' <NEW_LINE> response = requests.get(url, params=payload, headers=self.head...
search subtitles from subscene.com
625941e7cc0a2c11143dd2ea
def powerset(s): <NEW_LINE> <INDENT> return set( frozenset(x) for x in powersequence(list(s)) )
Generate the powerset of s Example: >>> powerset(set([6,7,8])) set([frozenset([7]), frozenset([8, 6, 7]), frozenset([6]), frozenset([6, 7]), frozenset([]), frozenset([8]), frozenset([8, 7]), frozenset([8, 6])])
625941e716aa5153ce3628d0
def abandonner(self): <NEW_LINE> <INDENT> rep = askyesno(message="Êtes-vous certain de vouloir abandonner la partie?") <NEW_LINE> if rep: <NEW_LINE> <INDENT> if self.verifier_jetons_sur_le_plateau(): <NEW_LINE> <INDENT> self.reprendre_tous_les_jetons() <NEW_LINE> <DEDENT> log = "Tour {}: {} a abandonné la partie.\n Le...
Retire un joueur de la liste des joueurs :return: Aucun return
625941e763f4b57ef0001565
def get_arguments(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=__doc__, usage= "{0} -h".format(sys.argv[0])) <NEW_LINE> parser.set_defaults(results=".{0}".format(os.sep)) <NEW_LINE> parser.add_argument('-d', dest='data_dir', type=isdir, action=FullPaths, required=True, help='Result directory of M...
Retrieves the arguments of the program. Returns: An object that contains the arguments
625941e745492302aab5e720
@click.command() <NEW_LINE> def normalize_json_files(): <NEW_LINE> <INDENT> n = 0 <NEW_LINE> for f in glob.glob('index/*/*.json') + ["data/rss_feeds.json"]: <NEW_LINE> <INDENT> n += normalize_file(f) <NEW_LINE> <DEDENT> print(n, 'records changed')
Make sure all JSON is identically formatted.
625941e729b78933be1e5aff
def print_daily_report(day, the_file): <NEW_LINE> <INDENT> log = open(the_file) <NEW_LINE> print(f"Day {day}") <NEW_LINE> for line in log: <NEW_LINE> <INDENT> line = line.rstrip() <NEW_LINE> words = line.split('|') <NEW_LINE> melon = words[0] <NEW_LINE> count = words[1] <NEW_LINE> amount = words[2] <NEW_LINE> print(f"D...
Given a day number and a path to a file generate a report Generate a report for the number of melons and the total cost delivered for a particular day
625941e76aa9bd52df037200
def get_wannier_integrals(self, s, k, k1, G_c, nbands=None): <NEW_LINE> <INDENT> assert s <= self.wfs.nspins <NEW_LINE> kpt_rank, u = divmod(k + len(self.wfs.kd.ibzk_kc) * s, len(self.wfs.kpt_u)) <NEW_LINE> kpt_rank1, u1 = divmod(k1 + len(self.wfs.kd.ibzk_kc) * s, len(self.wfs.kpt_u)) <NEW_LINE> kpt_u = self.wfs.kpt_u ...
Calculate integrals for maximally localized Wannier functions.
625941e7be7bc26dc91cda51
def api_call(self, method, timeout=None, **kwargs): <NEW_LINE> <INDENT> print('method: {method}. channel: {channel}. Text: {text}'.format( method=method, channel=kwargs.get('channel'), text=kwargs.get('text') ))
Just print out slack call instead of making a real slack request
625941e726238365f5f0f2cd
def forward(self, x, pos): <NEW_LINE> <INDENT> knn_idx = get_knn_idx(pos, pos, k=self.knn, offset=1) <NEW_LINE> edge_feat = self.get_edge_feature(x, knn_idx) <NEW_LINE> y = torch.cat([ self.layer_first(edge_feat), x.unsqueeze(-2).repeat(1, 1, self.knn, 1) ], dim=-1) <NEW_LINE> for layer in self.layers: <NEW_LINE> <INDE...
:param x: (B, N, d) :return (B, N, d+L*c)
625941e78c0ade5d55d3ee17
def pythonpath_sync(): <NEW_LINE> <INDENT> pypath = os.pathsep.join(sys.path) <NEW_LINE> os.environ['PYTHONPATH'] = pypath
@brief apply the current sys.path to the environment variable PYTHONPATH, so that child processes have the same paths as the caller does.
625941e723e79379d52ee9b7
def put(self, pv, value): <NEW_LINE> <INDENT> caput(pv, value)
Set the value for a given. Args: pv(string): The pv to set the value of. It must be a setpoint pv. value(Number): The value to set the pv to.
625941e70a50d4780f6672ee
def t100005_x1(): <NEW_LINE> <INDENT> if not CheckSpecificPersonTalkHasEnded(0): <NEW_LINE> <INDENT> ClearTalkProgressData() <NEW_LINE> StopEventAnimWithoutForcingConversationEnd(0) <NEW_LINE> ReportConversationEndToHavokBehavior() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> """State 2""" <NE...
State 0,1
625941e7851cf427c661a964
def SRLS_fixed_z(anchors, w, r2, z): <NEW_LINE> <INDENT> n, d = anchors.shape <NEW_LINE> Sigma = np.diagflat(np.power(w, 0.5)) <NEW_LINE> A = np.c_[-2 * anchors[:, :2], np.ones((n, 1))] <NEW_LINE> b = r2 - np.power(np.linalg.norm(anchors, axis=1), 2).reshape(r2.shape) <NEW_LINE> b = b + 2 * anchors[:, 2].reshape((-1, 1...
Helper routine for SRLS.
625941e726068e7796caf13e
def __getattr__(self, name): <NEW_LINE> <INDENT> if name.startswith('using'): <NEW_LINE> <INDENT> return self.getUsing(name) <NEW_LINE> <DEDENT> raise AttributeError('No attribute '+name)
Handle requests for nonexistent using<lang> objects
625941e7498bea3a759b9f07
def _read_info(self): <NEW_LINE> <INDENT> info_file = os.path.join(self._path[INFO], '%s.csv' % INFO) <NEW_LINE> if os.path.exists(info_file): <NEW_LINE> <INDENT> t = pd.read_csv(info_file, header=0, dtype={'code': str}, encoding=self._encoding) <NEW_LINE> t.rename({'code': SYMBOLS}, axis=1, ...
read info into Dataframe
625941e7eab8aa0e5d26dfb2
def printf( text, verbose = False): <NEW_LINE> <INDENT> if verbose: <NEW_LINE> <INDENT> print(f"{text}")
printf - print just if verbose
625941e7e76e3b2f99f3ac5d
def __init__(self, iface): <NEW_LINE> <INDENT> self.iface = iface <NEW_LINE> self.plugin_dir = os.path.dirname(__file__) <NEW_LINE> locale = QSettings().value('locale/userLocale')[0:2] <NEW_LINE> locale_path = os.path.join( self.plugin_dir, 'i18n', 'rcmrdNatBreaks_{}.qm'.format(locale)) <NEW_LINE> if os.path.exists(loc...
Constructor. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface
625941e74e4d5625662d482b
def buildMenus(menuBar): <NEW_LINE> <INDENT> menus = [ FileMenu(menuBar, translate("menu", "File")), EditMenu(menuBar, translate("menu", "Edit")), ViewMenu(menuBar, translate("menu", "View")), SettingsMenu(menuBar, translate("menu", "Settings")), ShellMenu(menuBar, translate("menu", "Shell")), RunMenu(menuBar, transl...
Build all the menus
625941e7956e5f7376d712c5
def pc_input_buffers_full_var(self, *args): <NEW_LINE> <INDENT> return _blocks_swig3.float_to_char_sptr_pc_input_buffers_full_var(self, *args)
pc_input_buffers_full_var(float_to_char_sptr self, int which) -> float pc_input_buffers_full_var(float_to_char_sptr self) -> pmt_vector_float
625941e726068e7796caf13f
def MapOnPDB(pdb,residues_list,segidPROT,depth_avg,outname): <NEW_LINE> <INDENT> depth_dico = {} <NEW_LINE> for i in range(len(residues_list)): <NEW_LINE> <INDENT> depth_dico[residues_list[i]] = depth_avg[i] <NEW_LINE> <DEDENT> common.Mapped(pdb,depth_dico,segidPROT,outname,"depth_of_anchoring")
Map dist on PDB :param pdb: pdb file :param residues_list: list of residues :param segidPROT: segid of the protein :param depth_avg: list with the avg depth :param outname: name of the output :return: none
625941e766656f66f7cbc606
def close_toc_ul(doc_parts, level, prev_level): <NEW_LINE> <INDENT> close_count = prev_level - max(1, level) <NEW_LINE> for i in range(close_count): <NEW_LINE> <INDENT> doc_parts['toc'][-1] += '</li>' <NEW_LINE> doc_parts['toc'].append('</ul>')
Output </li> and </ul> tags needed to decrease table of contents indent from prev_level to level, if level > 1 (e.g. using <ul>).
625941e7bde94217f3683246
def minDepth(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if not root.left or not root.right: <NEW_LINE> <INDENT> return max(self.minDepth(root.right),self.minDepth(root.left)) + 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return min(self.minDepth(root.right), self....
:type root: TreeNode :rtype: int
625941e7435de62698dfe0a6
def patch(self, hero_id): <NEW_LINE> <INDENT> hero = Hero.query.get_or_404(hero_id) <NEW_LINE> if 'name' in request.json: <NEW_LINE> <INDENT> hero.name = request.json['name'] <NEW_LINE> <DEDENT> if 'content' in request.json: <NEW_LINE> <INDENT> hero.alter_ego = request.json['alter_ego'] <NEW_LINE> <DEDENT> db.session.c...
Update a Hero.
625941e744b2445a339324ec
def __init__(self, wall_type=0): <NEW_LINE> <INDENT> self.wall_type = wall_type
Creates the default wall object
625941e7adb09d7d5db6cbe6
@pytest.yield_fixture(scope='session') <NEW_LINE> def app(): <NEW_LINE> <INDENT> _app = create_app(config[config_name]) <NEW_LINE> ctx = _app.app_context() <NEW_LINE> ctx.push() <NEW_LINE> yield _app <NEW_LINE> ctx.pop()
Setup our flask test app, this only gets executed once. Returns: Flask app
625941e7d6c5a102081444a7
def evaluate(self, system_id=1, rouge_args=None, show_all=True): <NEW_LINE> <INDENT> self.write_config(system_id=system_id) <NEW_LINE> options = self.__get_options(rouge_args, show_all=show_all) <NEW_LINE> command = [self._bin_path] + options <NEW_LINE> command.insert(0, 'perl') <NEW_LINE> rouge_output = check_output(c...
Run ROUGE to evaluate the system summaries in system_dir against the model summaries in model_dir. The summaries are assumed to be in the one-sentence-per-line HTML format ROUGE understands. system_id: Optional system ID which will be printed in ROUGE's output. Returns: Rouge output as string.
625941e7293b9510aa2c36ea
def EventArgument(vim, *args, **kwargs): <NEW_LINE> <INDENT> obj = vim.client.factory.create('{urn:vim25}EventArgument') <NEW_LINE> if (len(args) + len(kwargs)) < 0: <NEW_LINE> <INDENT> raise IndexError('Expected at least 1 arguments got: %d' % len(args)) <NEW_LINE> <DEDENT> required = [ ] <NEW_LINE> optional = [ 'dyn...
This is the base type for event argument types.Event argument objects, which inherit from a common subtype, are used to manage supplementary properties of different kinds of event objects.
625941e7baa26c4b54cb1574
def __init__(self, ncomp, amp, freq, omega): <NEW_LINE> <INDENT> super(SpinSystem, self).__init__() <NEW_LINE> self.ncomp = ncomp <NEW_LINE> self.amp = amp <NEW_LINE> self.freq = freq <NEW_LINE> self.omega = omega <NEW_LINE> self.nz = 3 <NEW_LINE> self.dhf = dhf(ncomp)
Initialise a SpinSystem.
625941e7a17c0f6771cbe4a8
def test_size_empty(empty_queue): <NEW_LINE> <INDENT> assert empty_queue.size() == 0
Test size method.
625941e7b57a9660fec33ce3
def cancelDialog(self): <NEW_LINE> <INDENT> self.close()
Closes the dialog.
625941e731939e2706e4d2bd
def getConfig(): <NEW_LINE> <INDENT> pass
Return a zeneventd.conf
625941e7c432627299f050a2
def references(env, value=None): <NEW_LINE> <INDENT> if not hasattr(env, 'websnap_references'): <NEW_LINE> <INDENT> env.websnap_references = {} <NEW_LINE> <DEDENT> if value is not None: <NEW_LINE> <INDENT> env.websnap_references = value <NEW_LINE> <DEDENT> return env.websnap_references
Get the list of nodes that have been created for this environment
625941e76fb2d068a760f4fd