code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def load(self) -> None: <NEW_LINE> <INDENT> def on_key_press(symbol: int, _: int) -> None: <NEW_LINE> <INDENT> if symbol == key.ESCAPE: <NEW_LINE> <INDENT> pyglet_exit() <NEW_LINE> <DEDENT> for controller in self.controllers: <NEW_LINE> <INDENT> if symbol == controller.player_up_key: <NEW_LINE> <INDENT> controller.play... | Run once on startup to initialize assets and event handlers.
| 625941cf91af0d3eaac9bb72 |
def sat_line(h,p,gz): <NEW_LINE> <INDENT> def findDiffR(rtGuess,htarget,p,gz): <NEW_LINE> <INDENT> rv=rtGuess <NEW_LINE> Tguess=tmr(rtGuess,p) <NEW_LINE> CPn=tc.CPD + tc.CPV*rv <NEW_LINE> gzp=gz*(1 + rv) <NEW_LINE> hguess=CPn*Tguess + gzp <NEW_LINE> theDiff=htarget - hguess <NEW_LINE> return theDiff <NEW_LINE> <DEDENT>... | find rtList that is exactly saturated at static energy
values given by hlist | 625941cff7d966606f6aa15d |
def plot(self, ax, cax, kws): <NEW_LINE> <INDENT> despine(ax=ax, left=True, bottom=True) <NEW_LINE> mesh = ax.pcolormesh(self.plot_data, vmin=self.vmin, vmax=self.vmax, cmap=self.cmap, **kws) <NEW_LINE> ax.set(xlim=(0, self.data.shape[1]), ylim=(0, self.data.shape[0])) <NEW_LINE> ax.invert_yaxis() <NEW_LINE> if self.cb... | Draw the heatmap on the provided Axes. | 625941cf3346ee7daa2b2ec5 |
def add_user(self, first_name: str, second_name: str, is_internal: bool, position: int, email: str, phone_number: str) -> int: <NEW_LINE> <INDENT> add_user_url = urllib.parse.urljoin(self.root_uri, self.__ADD_USER_REL_PATH) <NEW_LINE> params = { 'first_name': first_name, 'second_name': second_name, 'is_internal': is_in... | Adds user to database threw backend API
:param first_name: name of new user
:param second_name: second name of new user
:param is_internal: is user is internal True, else False
:param position: position of user
:param email: email of user
:param phone_number: phone number of user
:return: status code | 625941cf56b00c62f0f147b2 |
def process(self, img): <NEW_LINE> <INDENT> img[img<self.thresholds[0]] = 0 <NEW_LINE> img[img>self.thresholds[1]] = 0 <NEW_LINE> if self.mask is not None: <NEW_LINE> <INDENT> if self.mask.ndim==3: <NEW_LINE> <INDENT> autocorr = [corr.spatial_correlation_fourier(img, mask=mask) for mask in self.mask] <NEW_LINE> autocor... | Perform autocorrelation on masked detector images | 625941cf60cbc95b062c669c |
def _get_serializer_fields(self, serializer): <NEW_LINE> <INDENT> if serializer is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if hasattr(serializer, '__call__'): <NEW_LINE> <INDENT> fields = serializer().get_fields() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fields = serializer.get_fields() <NEW_LINE> <DE... | Returns serializer fields in the Swagger MODEL format | 625941cf4428ac0f6e5ba94b |
def _verify_notification(self, sample_file_name, replacements=None, actual=None): <NEW_LINE> <INDENT> if not actual: <NEW_LINE> <INDENT> self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS), fake_notifier.VERSIONED_NOTIFICATIONS) <NEW_LINE> notification = fake_notifier.VERSIONED_NOTIFICATIONS[0] <NEW_LINE> <D... | Assert if the generated notification matches with the stored sample
:param sample_file_name: The name of the sample file to match relative
to doc/notification_samples
:param replacements: A dict of key value pairs that is used to update
the payload field of the sample data... | 625941cfbe383301e01b55de |
def on_service_arrival(self, svc_ref): <NEW_LINE> <INDENT> with self._lock: <NEW_LINE> <INDENT> if svc_ref not in self.services: <NEW_LINE> <INDENT> prop_value = svc_ref.get_property(self._key) <NEW_LINE> if prop_value is not None or self._allow_none: <NEW_LINE> <INDENT> service = self._context.get_service(svc_ref) <NE... | Called when a service has been registered in the framework
:param svc_ref: A service reference
:return: True if the service is consumed | 625941cf26068e7796caee39 |
def get_high_prob_stat(self, previous_prob, observation): <NEW_LINE> <INDENT> stat_prob_now = {} <NEW_LINE> high_hidden_now_stat = '' <NEW_LINE> high_hidden_now_prob = 0.0 <NEW_LINE> for stat0 in self.hidden: <NEW_LINE> <INDENT> temp_prob = 0.0 <NEW_LINE> for stat1 in self.hidden: <NEW_LINE> <INDENT> trans_prob = previ... | 根据前一次记录结果,求解当前观察状态对应隐含值
:param previous_prob:
:param observation:
:return: | 625941cf656771135c3eb9c8 |
def clear_external_paths(self): <NEW_LINE> <INDENT> while self.count() > EXTERNAL_PATHS: <NEW_LINE> <INDENT> self.removeItem(EXTERNAL_PATHS) | Remove all the external paths listed in the combobox. | 625941cf099cdd3c635f0db4 |
def commit_allow_empty(proj_dir, msg): <NEW_LINE> <INDENT> check_exists_with_error() <NEW_LINE> try: <NEW_LINE> <INDENT> subprocess.check_call('git commit --allow-empty -m "{}"'.format(msg), cwd=proj_dir, shell=True) <NEW_LINE> <DEDENT> except subprocess.CalledProcessError as e: <NEW_LINE> <INDENT> log.error("'git comm... | same as commit(), but uses the --allow-empty arg so that the
commit doesn't fail if there's nothing to commit.
:param proj_dir: path to a git repo | 625941cf63d6d428bbe44648 |
def test_reflect(): <NEW_LINE> <INDENT> pt = Point3D(2, 2, 2) <NEW_LINE> vec = Vector3D(0, 2, 0) <NEW_LINE> seg = LineSegment3D(pt, vec) <NEW_LINE> origin_1 = Point3D(0, 1, 2) <NEW_LINE> origin_2 = Point3D(1, 1, 2) <NEW_LINE> normal_1 = Vector3D(0, 1, 0) <NEW_LINE> normal_2 = Vector3D(-1, 1, 0).normalize() <NEW_LINE> a... | Test the LineSegment3D reflect method. | 625941cf10dbd63aa1bd2cfd |
@AlchemyDumpsCommand.command <NEW_LINE> def history(): <NEW_LINE> <INDENT> backup = Backup() <NEW_LINE> if not backup.files: <NEW_LINE> <INDENT> print('==> No backups found at {}.'.format(backup.path)) <NEW_LINE> return None <NEW_LINE> <DEDENT> file_ids = backup.get_ids() <NEW_LINE> groups = [{'id': i, 'files': backup.... | List existing backups | 625941cf82261d6c526ab5f9 |
def setup_ops(self): <NEW_LINE> <INDENT> self.setup_loss() <NEW_LINE> self.setup_train_op() <NEW_LINE> self.setup_update_op() <NEW_LINE> ops = tf.group(*tf.get_collection(self.keys)) <NEW_LINE> self.ops = ops | Sets up all train_ops. | 625941cf50485f2cf553cef3 |
def forward_propagation(X, parameters): <NEW_LINE> <INDENT> W1 = parameters["W1"] <NEW_LINE> b1 = parameters["b1"] <NEW_LINE> W2 = parameters["W2"] <NEW_LINE> b2 = parameters["b2"] <NEW_LINE> Z1 = np.dot(W1, X) + b1 <NEW_LINE> A1 = np.tanh(Z1) <NEW_LINE> Z2 = np.dot(W2, A1) + b2 <NEW_LINE> A2 = sigmoid(Z2) <NEW_LINE> a... | Argument:
X -- input data of size (n_x, m)
Returns:
A2 -- The sigmoid output | 625941cf31939e2706e4cfc3 |
def searchInsert(self, nums, target): <NEW_LINE> <INDENT> for i in range(0, len(nums)): <NEW_LINE> <INDENT> if nums[i] >= target: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> return len(nums) | :type nums: List[int]
:type target: int
:rtype: int | 625941cfd4950a0f3b08c4a8 |
@user_passes_test(lambda u: u.is_superuser) <NEW_LINE> def projects_internal_summary(request: HttpRequest) -> HttpResponse: <NEW_LINE> <INDENT> view_dict = {} <NEW_LINE> q = Q() <NEW_LINE> from_date = Project.min_start_date() <NEW_LINE> until_date = Project.max_end_date() <NEW_LINE> if request.method == 'GET': <NEW_LIN... | View reports on allocated project income and staff expenditure.
Internal projects are not considered. | 625941cf15baa723493c40cf |
def add_session_success(request, message): <NEW_LINE> <INDENT> add_session_msg(request, message, 'success') | Adds a success message to our session var which will get shown
on the next page view. | 625941cf29b78933be1e5804 |
def unsubscribe(self, shareholder): <NEW_LINE> <INDENT> self.shareholders.remove(shareholder) | will remove `shareholder` to `self.shareholders` | 625941cf796e427e537b0720 |
def getModuleLogger(name): <NEW_LINE> <INDENT> logger = logging.getLogger(name) <NEW_LINE> return logger | Get the default module logger
Parameters
-------------
name : str
the name of the logger. can be __name__
Returns
-------------
logging.logger
the requested logger | 625941cf1f037a2d8b946357 |
def tblout_to_full_region(tblout_file, dest_dir=None): <NEW_LINE> <INDENT> tblout_fp = open(tblout_file, 'r') <NEW_LINE> filename = os.path.split(tblout_file)[1].partition('.')[0] <NEW_LINE> if dest_dir is None: <NEW_LINE> <INDENT> dest_dir = os.path.split(tblout_file)[0] <NEW_LINE> <DEDENT> full_region_fp = open(os.pa... | Parses Infernal's tblout file and generates a .txt file that is compatible with full_region
table.
tblout_file: A valid Infernal's output file in .tblout format
dest_dir: The path to the output directory
return: True if successful, False otherwise | 625941cf091ae356686670b7 |
def create(self, email): <NEW_LINE> <INDENT> endpoint = "/accounts/%s/emails/%s" % (self.username, email) <NEW_LINE> response = self.gerrit.requester.put(self.gerrit.get_endpoint_url(endpoint)) <NEW_LINE> result = self.gerrit.decode_response(response) <NEW_LINE> return result | Registers a new email address for the user.
:return: | 625941cf71ff763f4b5497e5 |
def test_function_unarchive_project(self): <NEW_LINE> <INDENT> path_to_mock = 'projects/4/unarchive.json' <NEW_LINE> request_url = api_url + path_to_mock <NEW_LINE> with requests_mock.Mocker() as m: <NEW_LINE> <INDENT> m.put(request_url, status_code=204) <NEW_LINE> response = self.client.unarchive_project('4') <NEW_LIN... | Test function unarchive_project. | 625941cffb3f5b602dac37ed |
def update_image_target(target_id, name=None, width=None, image=None, active_flag=None, application_metadata=None): <NEW_LINE> <INDENT> http_method = 'PUT' <NEW_LINE> content_type = 'application/json' <NEW_LINE> date = formatdate(None, localtime=False, usegmt=True) <NEW_LINE> path = "/targets/" + target_id <NEW_LINE> c... | 修改图像目标信息
:param target_id: 目标id
:param name: 目标id
:param width: 目标id
:param image: 目标id
:param active_flag: 目标id
:param application_metadata: 目标id
:return: 返回修改结果 | 625941cf5166f23b2e1a52b3 |
def tst(self, cond: Condition, rn: Reg) -> None: <NEW_LINE> <INDENT> struct.pack_into("<I", self.buf, self.pos, ((17825792 | cond) | (rn << 16))) <NEW_LINE> self.pos += 4 | Emits a 'tst' instruction. | 625941cfad47b63b2c50a0d9 |
def _convert_magnitude(self, mag): <NEW_LINE> <INDENT> return mblg_to_mw_atkinson_boore_87(mag) | Convert Mblg to Mw using Atkinson and Boore 1987 conversion equation | 625941cf0a366e3fb873e974 |
def search(self, running_hyps: BatchHypothesis, x: torch.Tensor) -> BatchHypothesis: <NEW_LINE> <INDENT> n_batch = len(running_hyps) <NEW_LINE> scores, states = self.score_full(running_hyps, x.expand(n_batch, *x.shape)) <NEW_LINE> if self.do_pre_beam: <NEW_LINE> <INDENT> part_ids = torch.topk( scores[self.pre_beam_scor... | Search new tokens for running hypotheses and encoded speech x.
Args:
running_hyps (BatchHypothesis): Running hypotheses on beam
x (torch.Tensor): Encoded speech feature (T, D)
Returns:
BatchHypothesis: Best sorted hypotheses | 625941cf5fdd1c0f98dc038d |
def getNumLeafs(myTree): <NEW_LINE> <INDENT> numLeafs = 0 <NEW_LINE> firstStr = list(myTree.keys())[0] <NEW_LINE> secondDict = myTree[firstStr] <NEW_LINE> for key in secondDict.keys(): <NEW_LINE> <INDENT> if isinstance(secondDict[key], dict): <NEW_LINE> <INDENT> numLeafs += getNumLeafs(secondDict[key]) <NEW_LINE> <DEDE... | :type myTree dict
:return: | 625941cfbe8e80087fb20d9c |
def transform(self, tree, program_config): <NEW_LINE> <INDENT> argument_configuration, tuning_configuration = program_config <NEW_LINE> output = self.generate_output(program_config) <NEW_LINE> param_types = [ np.ctypeslib.ndpointer(arg.dtype, arg.ndim, arg.shape) for arg in argument_configuration + (output,) ] <NEW_LIN... | Transforms the python AST representing our un-specialized stencil
kernel into a c_ast which can be JIT compiled.
:param tree: python AST of the kernel method.
:param program_config: The configuration generated by args_to_subconfig
:return: A ctree Project node, and our entry point type signature. | 625941cf5e10d32532c5f080 |
def SetOutsideValue(self, *args): <NEW_LINE> <INDENT> return _itkDoubleThresholdImageFilterPython.itkDoubleThresholdImageFilterIUL3IUL3_SetOutsideValue(self, *args) | SetOutsideValue(self, unsigned long _arg) | 625941cfd268445f265b4fc7 |
@login_required(login_url=LOGIN_URL) <NEW_LINE> def search(request): <NEW_LINE> <INDENT> query = request.POST.get('q', '') <NEW_LINE> results = [] <NEW_LINE> if query: <NEW_LINE> <INDENT> results.extend(Joblist.objects.filter(Q(owner__exact=request.user),Q(name__icontains=query) | Q(description__icontains=query)).disti... | Affichage du formulaire de recherche du site
:param request: Paramètres de la requête HTTP
:type request: HttpRequest
:returns: HttpResponse | 625941cf7b180e01f3dc4956 |
def mouse_click(self, button: (Button, str), action: (bool, str) = False, *args, **kwargs) -> None: <NEW_LINE> <INDENT> key_button, press_or_release = self._evaluate(button, action) <NEW_LINE> button_event = self.mouse_controller.release <NEW_LINE> if bool(press_or_release): <NEW_LINE> <INDENT> button_event = self.mous... | makes the mouse press or release the mousebutton on the position where it is located
:param button: represents the mouse.Button in string or mouse.Button object
:param action: represents a True or False value. True is button press, False is button release
:param args: catch for other arguments
:param kwargs: catch for... | 625941cf5f7d997b87174bf2 |
@register.assignment_tag <NEW_LINE> def flow_start_actions(flow_class, user=None): <NEW_LINE> <INDENT> actions = [ node for node in flow_class._meta.nodes() if isinstance(node, flow.Start) if user is None or node.can_execute(user) ] <NEW_LINE> return sorted(actions, key=lambda node: node.name) | List of actions to start flow available for the user.
Example::
{% flow_start_actions view.flow_class request.user as flow_start_actions %} | 625941cf2c8b7c6e89b3591a |
def zed_rgba_to_color_array(rgba_values): <NEW_LINE> <INDENT> rgba_values = list(rgba_values) <NEW_LINE> binary_values = [bin(unpack('I', pack('f', rgba))[0])[2:] for rgba in rgba_values] <NEW_LINE> color_array = np.empty((len(rgba_values), 3), dtype=np.uint8) <NEW_LINE> for (i,b) in enumerate(binary_values): <NEW_LINE... | Convert RGBA float32 values to an N by 3 array of RGB color values
:param rgba_values: ndarray
:return: ndarray | 625941cf66673b3332b921eb |
def is_probably_builtin(node): <NEW_LINE> <INDENT> prev = node.prev_sibling <NEW_LINE> if prev is not None and prev.type == token.DOT: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> parent = node.parent <NEW_LINE> if parent.type in (syms.funcdef, syms.classdef): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT... | Check that something isn't an attribute or function name etc. | 625941cfdd821e528d63b302 |
def get_active_plugins(): <NEW_LINE> <INDENT> installed_plugins = get_installed_plugins() <NEW_LINE> for plugin in installed_plugins: <NEW_LINE> <INDENT> if plugin.app_label == 'plugins': <NEW_LINE> <INDENT> spaceless_plugin_name = plugin.name.replace(' ', '') <NEW_LINE> if spaceless_plugin_name in settings.BULLETIN_CO... | Yield a list of ContentTypes representing plugins that
are installed and listed in settings.BULLETIN_CONTENT_TYPE_PLUGINS. | 625941cfc432627299f04da0 |
def test_topic_fields(self): <NEW_LINE> <INDENT> self.assertEqual(self.record,self.topic) | topic = TopicModel(topicname="animals",author_created = "anjana")
topic.save()
record = TopicModel.objects.get(pk=self.topic.id) | 625941cf30dc7b7665901ac0 |
def post_transaction_output(self): <NEW_LINE> <INDENT> def _fits_in_cols(msgs, num): <NEW_LINE> <INDENT> if len(msgs) < num: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> left = self.term.columns - ((num - 1) + 2) <NEW_LINE> if left <= 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> col_lens = [0] * num <NEW_L... | Returns a human-readable summary of the results of the
transaction.
:return: a string containing a human-readable summary of the
results of the transaction | 625941cf07f4c71912b115dc |
def leaveChat(self, chat_id: Union[int, str, ]): <NEW_LINE> <INDENT> data = { "chat_id": chat_id, } <NEW_LINE> return self.response(self.sendRequest("leaveChat", data), bool) | Use this method for your bot to leave a group, supergroup or channel. Returns True on success. [See Telegram API](https://core.telegram.org/bots/api#leavechat)
- - - - -
**Args**:
- `chat_id` :`Union[int,str,]` Unique identifier for the target chat or username of the target supergroup or channel (in the format @chann... | 625941cf57b8e32f524835f5 |
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 12 <NEW_LINE> (_x.x, _x.y, _x.phi,) = _get_struct_3f().unpack(str[start:end]) <NEW_LINE> return self <NEW_LINE> <DEDENT> except struct.error as e: <NEW_LINE> <INDEN... | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | 625941cf07f4c71912b115dd |
def test_usuario_superusuario_quiere_ver_detalles_usuario_normal(self): <NEW_LINE> <INDENT> self.client.post(self.login, data={"username": "danielrs", "password": "jaja123"}, format='json') <NEW_LINE> response = self.client.get(self.url_vendedor) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_200_OK, msg... | Metodo que prueba que un superusuario puede
ver los detalles de un usuario normal | 625941cfcdde0d52a9e5318e |
def args(f): <NEW_LINE> <INDENT> @functools.wraps(f) <NEW_LINE> def wrapper(environ, start_response, *args, **kwargs): <NEW_LINE> <INDENT> return f(environ, start_response, *(environ['dxhttp.args'] + args), **kwargs) <NEW_LINE> <DEDENT> return wrapper | Expands dxhttp.args into actual function arguments | 625941cf73bcbd0ca4b2c1d0 |
def all_config_files(): <NEW_LINE> <INDENT> user = user_config_files() <NEW_LINE> if os.path.exists('setup.cfg'): <NEW_LINE> <INDENT> return user, ['setup.cfg'] <NEW_LINE> <DEDENT> return user | Return path to any existing user config files, plus any setup.cfg
in the current working directory. | 625941cfe1aae11d1e749e11 |
def fetchone(self, stmt, params=(), formatting=None, cur=None): <NEW_LINE> <INDENT> if cur == None: <NEW_LINE> <INDENT> c = self.cursor() <NEW_LINE> self.execute(stmt, params, formatting=formatting, cur=c) <NEW_LINE> result = c.fetchone() <NEW_LINE> c.close() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.execute(s... | Execute given statement and fetch one row from result
This method can be used in case you only want to fetch one row from
the result. It accepts the same arguments as mentioned in the
'execute()' method. | 625941cfd8ef3951e3243697 |
def apply_activation_cap_modulation(idx: ItemIdx, activation: ActivationValue) -> ActivationValue: <NEW_LINE> <INDENT> return activation if activation <= activation_cap else activation_cap | If accumulated activation is over the cap, apply the cap. | 625941cf1f5feb6acb0c4caa |
def fit(self, X, y=None): <NEW_LINE> <INDENT> self._fit_transform(X) <NEW_LINE> return self | Compute the embedding vectors for data X
Parameters
----------
X : {array-like, sparse matrix, BallTree, KDTree, NearestNeighbors}
Sample data, shape = (n_samples, n_features), in the form of a
numpy array, precomputed tree, or NearestNeighbors
object.
Returns
-------
self : returns an instance of self. | 625941cf63b5f9789fde723f |
def strlist_union(a,b): <NEW_LINE> <INDENT> warnings.warn( "strlist functions are deprecated and will be removed in 3.5", category=DeprecationWarning, stacklevel=2, ) <NEW_LINE> temp = cidict() <NEW_LINE> for elt in a: <NEW_LINE> <INDENT> temp[elt] = elt <NEW_LINE> <DEDENT> for elt in b: <NEW_LINE> <INDENT> temp[elt] =... | Return union of two lists of case-insensitive strings a,b. | 625941cf91af0d3eaac9bb73 |
def log_uniform(low, high, size:Optional[List[int]]=None)->FloatOrTensor: <NEW_LINE> <INDENT> res = uniform(log(low), log(high), size) <NEW_LINE> return exp(res) if size is None else res.exp_() | Draw 1 or shape=`size` random floats from uniform dist: min=log(`low`), max=log(`high`) | 625941cf2ae34c7f2600d28b |
def train(train): <NEW_LINE> <INDENT> train_X=[] <NEW_LINE> train_y=[] <NEW_LINE> for line in train: <NEW_LINE> <INDENT> if line[3]=="NONE": <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> train_X.append(line[1]) <NEW_LINE> train_y.append(line[3].strip()) <NEW_LINE> <DEDENT> <DEDENT> datasentence... | This function trains the data on a logistic regression model and the model
is pickled afterwards.
Starting point for task 1 training. | 625941cffff4ab517eb2f596 |
def get_D(m, Fs, Ys, Upsilon, i, j): <NEW_LINE> <INDENT> (A, B, C, D) = m.get_ABCD(j) <NEW_LINE> C_, D_ = C.conj().T, D.conj().T <NEW_LINE> F = Fs[j] <NEW_LINE> F_ = F.conj().T <NEW_LINE> Y1, Y2 = Ys[i], Ys[j] <NEW_LINE> U = Upsilon <NEW_LINE> U_ = U.conj().T <NEW_LINE> B_cal = C_.dot(C) + F_.dot(D_).dot(D).dot(F) <NEW... | Calculates each individual D for the sum.
Args:
m (:obj:`MJLS`): the corresponding Markov Jump Linear System.
Fs: current approximation of the control gains.
Ys: current approximation of the CARE solution.
Upsilon: current value of `Upsilon'.
i: current mode.
j: next mode. | 625941cf187af65679ca5279 |
def get_date(): <NEW_LINE> <INDENT> time = datetime.datetime.now() <NEW_LINE> time_str = "{}y{}m{}d{}h{}m{}s".format(time.year,time.month,time.day,time.hour,time.minute,time.second) <NEW_LINE> return(time_str) | This creates a string of the day, hour, minute and second
I use this to make folder names unique | 625941cfcb5e8a47e48b7c04 |
def debug(self, msg, *args, **kwargs): <NEW_LINE> <INDENT> self._log(logging.DEBUG, msg, args, **kwargs) | Log a message with severity 'DEBUG'. | 625941cfd7e4931a7ee9e078 |
def run(self, cmd, opts = '') -> Union[RET, str]: <NEW_LINE> <INDENT> if not opts: opts = self.opts <NEW_LINE> return SendMsg(self.internal_wb, cmd, opts = opts) | SendMsg to server a string command, a RET object will be returned | 625941cfd58c6744b4257dba |
def __init__(self, series, raise_errors=True): <NEW_LINE> <INDENT> self._raw = series <NEW_LINE> self._error = self._raw.get('error', None) <NEW_LINE> if self.error is not None and raise_errors is True: <NEW_LINE> <INDENT> raise InfluxDBClientError(self.error) | Initialize the ResultSet. | 625941cfb830903b967e9a65 |
def populate(self, requirements): <NEW_LINE> <INDENT> pass | populate the required fields of the stratergies and ft_unit using the requirements | 625941cf82261d6c526ab5fa |
def open(self, vendor_id=0x16c0, product_id=0x5dc, bus=None, address=None): <NEW_LINE> <INDENT> return self._dev.open() | Open the DMX emulator client
:param vendor_id: ignored
:param product_id: ignored
:param bus: ignored
:param address: ignored
:return: Returns true if a device was opened. Otherwise, returns false. | 625941cf5fc7496912cc3ad8 |
def __init__(self, temboo_session): <NEW_LINE> <INDENT> super(DeleteDatapoint, self).__init__(temboo_session, '/Library/Xively/ReadWriteData/DeleteDatapoint') | Create a new instance of the DeleteDatapoint Choreo. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 625941cf23849d37ff7b31ea |
def test_get_module_no_default(self): <NEW_LINE> <INDENT> self.dispatcher._module_name_to_module = {'other': self.module1} <NEW_LINE> self.assertEqual(self.dispatcher._get_module('other', None), self.module1) <NEW_LINE> self.assertRaises(request_info.ModuleDoesNotExistError, self.dispatcher._get_module, None, None) <NE... | Tests the _get_module method with no default module. | 625941cf26238365f5f0efc9 |
def run(self): <NEW_LINE> <INDENT> theta = self.chooseTheta() <NEW_LINE> policy = _human_policies[np.random.randint(len(_human_policies))] <NEW_LINE> env = Game(theta, _num_objects, _human_prod_cap, _robot_prod_cap, _delta) <NEW_LINE> human = Human(theta, _num_objects, _human_prod_cap, policy) <NEW_LINE> robot = Robot(... | Runs the game for self._max_T time steps by initializing instances of
the game, human player and robot player.
Returns the total reward accumulated by the robot. | 625941cfaad79263cf390b9c |
def contain_ant(self, ant): <NEW_LINE> <INDENT> if self.ant == None: <NEW_LINE> <INDENT> self.ant = ant | *** REPLACE THIS LINE *** | 625941cf009cb60464c6350b |
def check_safe_delete(request): <NEW_LINE> <INDENT> pass | Investigate if it's safe to delete this question. Returns True/False + will append
to request flash message if it isn't safe. | 625941cf3317a56b86939db2 |
def usage(): <NEW_LINE> <INDENT> global g_script_name <NEW_LINE> print("") <NEW_LINE> print("Usage: " + g_script_name + " [...options...]") <NEW_LINE> print("") <NEW_LINE> print(" --help print out this help menu and show all the valid flags and inputs.") <NEW_LINE> print("") <NEW_LINE> print(" --inputfileadd fi... | Illustrate what the various input flags are and the options should be.
:return: none | 625941cffbf16365ca6f6320 |
def sort_matrix(mat): <NEW_LINE> <INDENT> freqs = (mat > 0).sum(axis=1) <NEW_LINE> order = list(freqs.sort_values(ascending=False).index) <NEW_LINE> mat_sorted = mat.ix[order] <NEW_LINE> mat_sorted = mat_sorted.T.sort_values(by=order, ascending=False).T <NEW_LINE> return mat_sorted | Sorts a 2D matrix, first by its rows and then by its columns.
Parameters
----------
mat : pd.DataFrame
Matrix to sort.
Returns
-------
pd.DataFrame
Sorted matrix. | 625941cf23e79379d52ee6be |
def test_nonIntegerUIDNEXT(self): <NEW_LINE> <INDENT> d = self._examine() <NEW_LINE> self._response('* OK [UIDNEXT foo] Predicted next UID') <NEW_LINE> self.assertRaises( imap4.IllegalServerResponse, self._extractDeferredResult, d) | If the server returns a non-integer UIDNEXT value in its response to an
I{EXAMINE} command, the L{Deferred} returned by L{IMAP4Client.examine}
fails with L{IllegalServerResponse}. | 625941cf99fddb7c1c9de4eb |
def intermediate_point(p1, p2, fraction=0.5): <NEW_LINE> <INDENT> lon1, lat1 = _point_to_radians(_error_check_point(p1)) <NEW_LINE> lon2, lat2 = _point_to_radians(_error_check_point(p2)) <NEW_LINE> delta = distance_between_points(p1, p2) / radius_earth.meters <NEW_LINE> a = sin((1 - fraction) * delta) / sin(delta) <NEW... | This function calculates the intermediate point along the course laid out by p1 to p2. fraction is the fraction
of the distance between p1 and p2, where 0 is p1, 0.5 is equivalent to midpoint(*), and 1 is p2.
:param p1: tuple point of (lon, lat)
:param p2: tuple point of (lon, lat)
:param fraction: the fraction of the... | 625941cf507cdc57c6306e36 |
def dummy_verify(self, elapsed=0): <NEW_LINE> <INDENT> self.verify(self._dummy_secret, self._dummy_hash) <NEW_LINE> return False | Helper that applications can call when user wasn't found,
in order to simulate time it would take to hash a password.
Runs verify() against a dummy hash, to simulate verification
of a real account password.
:param elapsed:
.. deprecated:: 1.7.1
this option is ignored, and will be removed in passlib 1.8.... | 625941cf293b9510aa2c33f0 |
def find_peaks_max(z, alpha=3., distance=10): <NEW_LINE> <INDENT> k_arr = [] <NEW_LINE> image_temp = copy.deepcopy(z) <NEW_LINE> peak_ct = 0 <NEW_LINE> sigma = np.std(z) <NEW_LINE> while True: <NEW_LINE> <INDENT> k = np.argmax(image_temp) <NEW_LINE> j, i = np.unravel_index(k, image_temp.shape) <NEW_LINE> if image_temp[... | Method to locate positive peaks in an image by local maximum searching.
Parameters
----------
alpha : float
Only maxima above `alpha * sigma` are found, where `sigma` is the
standard deviation of the image.
distance : int
When a peak is found, all pixels in a square region of side
`2 * distance` are se... | 625941cf3d592f4c4ed1d1c7 |
def request_project_summary(request, project_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> project = Project.objects.get(pk=project_id) <NEW_LINE> <DEDENT> except Project.DoesNotExist: <NEW_LINE> <INDENT> return JsonResponse({'status': 'error', 'message': 'report not found'}) <NEW_LINE> <DEDENT> summary = project.s... | Return a JSON with the summary of the project | 625941cfbd1bec0571d9078a |
def add_edge(self, source, target, **kwds): <NEW_LINE> <INDENT> if not kwds: <NEW_LINE> <INDENT> return self.add_edges([(source, target)]) <NEW_LINE> <DEDENT> eid = self.ecount() <NEW_LINE> result = self.add_edges([(source, target)]) <NEW_LINE> edge = self.es[eid] <NEW_LINE> for key, value in kwds.iteritems(): <NEW_LIN... | add_edge(source, target, **kwds)
Adds a single edge to the graph.
Keyword arguments (except the source and target arguments) will be
assigned to the edge as attributes.
@param source: the source vertex of the edge or its name.
@param target: the target vertex of the edge or its name. | 625941cf76d4e153a657ec8c |
def verify_files(self): <NEW_LINE> <INDENT> file_list = self.getfiles() <NEW_LINE> disallowed = list(filter(partial(self._file_nomatch, addon_whitelist), file_list)) <NEW_LINE> return not disallowed, disallowed | Check if all files in the path are allowed in a GMA file.
>>> addon_info_from_path("test").verify_files()
(True, []) | 625941cfab23a570cc2502dd |
def knx_read(self, json_obj, connection): <NEW_LINE> <INDENT> daemons = self.sql.get_daemons(); <NEW_LINE> slave_name = self.get_slave_name(json_obj, daemons); <NEW_LINE> if slave_name is None: <NEW_LINE> <INDENT> return None; <NEW_LINE> <DEDENT> for host in self.hostlist: <NEW_LINE> <INDENT> if slave_name in host._Hos... | Callback called each time a knx_read packet is received. | 625941cfd4950a0f3b08c4a9 |
def forward(self, x, avepool=False): <NEW_LINE> <INDENT> if self.dist == 'implicit': <NEW_LINE> <INDENT> noise = x.new(x.size(0), self.noise_dim, 1, 1).normal_(0, 1) <NEW_LINE> noise = noise.expand(x.size(0), self.noise_dim, x.size(2), x.size(3)) <NEW_LINE> x = torch.cat([x, noise], dim=1) <NEW_LINE> <DEDENT> z, ap = s... | :param x: input image
:param avepool: whether to return the average pooling feature (used for downstream tasks)
:return: | 625941cf4d74a7450ccd431e |
def _encode(self, sources: mx.nd.NDArray, source_length: int) -> List[ModelState]: <NEW_LINE> <INDENT> return [model.run_encoder(sources, source_length) for model in self.models] | Returns a ModelState for each model representing the state of the model after encoding the source.
:param sources: Source ids. Shape: (batch_size, bucket_key, num_factors).
:param source_length: Bucket key.
:return: List of ModelStates. | 625941cf283ffb24f3c55a5b |
def get_radiation_building(self, building): <NEW_LINE> <INDENT> return os.path.join(self.get_solar_radiation_folder(), '%s_radiation.csv' % building) | scenario/outputs/data/solar-radiation/${building}_insolation.json | 625941cf9b70327d1c4e0f30 |
def test_lookupInvalidTag(self) -> None: <NEW_LINE> <INDENT> self.assertRaises(AttributeError, getattr, tags, "invalid") | Invalid tags which are not part of HTML cause AttributeErrors when
accessed through C{tags}. | 625941cf16aa5153ce3625d3 |
def add_sold_items(): <NEW_LINE> <INDENT> item_id = input('Enter item_id ') <NEW_LINE> item_name = input('Enter name of item: ') <NEW_LINE> item_price = input('Enter price ') <NEW_LINE> sold_qty = input('Enter quantity sold ') <NEW_LINE> make_sold_items_table() <NEW_LINE> with sqlite3.connect(db_name) as db: <NEW_LINE>... | add sold item to the table | 625941cfd7e4931a7ee9e079 |
@app.route('/') <NEW_LINE> def index(): <NEW_LINE> <INDENT> return 'Hello!' | Render the home screen
:status 200: Successfully render
:status 404: Not found | 625941cf435de62698dfdda8 |
def __init__(self): <NEW_LINE> <INDENT> self.SpecId = None <NEW_LINE> self.MachineType = None <NEW_LINE> self.MachineTypeName = None <NEW_LINE> self.Version = None <NEW_LINE> self.VersionName = None <NEW_LINE> self.Memory = None <NEW_LINE> self.CPU = None <NEW_LINE> self.MinStorage = None <NEW_LINE> self.MaxStorage = N... | :param SpecId: 实例规格ID,利用DescribeZones返回的SpecId,结合DescribeProductConfig返回的可售卖规格信息,可获悉某个可用区下可购买什么规格的实例
:type SpecId: int
:param MachineType: 机型ID
:type MachineType: str
:param MachineTypeName: 机型中文名称
:type MachineTypeName: str
:param Version: 数据库版本信息。取值为2008R2(表示SQL... | 625941cf8e05c05ec3eea4d0 |
def zip_and_export(self, dataset: MetaDataSet, target: str): <NEW_LINE> <INDENT> if not dataset: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not target: <NEW_LINE> <INDENT> target = dataset.path <NEW_LINE> <DEDENT> target_file = os.path.join(target, dataset.name) <NEW_LINE> try: <NEW_LINE> <INDENT> graph = datase... | Zips all data of a project and saves it to a file.
The ZIP archive will contain a pickle of the data, all associated files and RDF serializations of the data.
Args:
dataset (MetaDataSet): The dataset to export.
target (str): The path where to store the export. | 625941cf4428ac0f6e5ba94e |
def delete(self): <NEW_LINE> <INDENT> ret = self.zclient.delete(self.module, self.dict["id"]) <NEW_LINE> self._loaddata(mydict=ret) <NEW_LINE> if self.code == "SUCCESS": <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Delete the record.
:returns: True or False depending on the server reply.
:rtype:bool
:raises: Zoho Exceptions: For all invalid requests see http status codes for Zoho CRM APIs for more details. | 625941cf090684286d50ee41 |
def parse_data(data, date): <NEW_LINE> <INDENT> parts = data.split('<table') <NEW_LINE> parts2 = parts[1].split('</table') <NEW_LINE> dummy = parts2[0].replace(' class="odd"','') <NEW_LINE> dummy = dummy.replace(' class="even"','') <NEW_LINE> parts3 = dummy.split('<tr><td><b>Total</b>') <NEW_LINE> table = parts3[0] <NE... | Parses the HTML table and transforms it into a CSV compatible
format. The result can be directly imported into a pandas DataFrame.
Parameters
==========
data: string
document containing the Web content
date: datetime object
date for which the data is parsed
Returns
=======
dataset: pandas DataFrame object
... | 625941cf44b2445a339321f0 |
def repeatSong(self, value): <NEW_LINE> <INDENT> self.repeatingSong = value <NEW_LINE> if self.repeatingSong: <NEW_LINE> <INDENT> self.playlist.setPlaybackMode(QMediaPlaylist.CurrentItemInLoop) <NEW_LINE> <DEDENT> elif self.shuffling: <NEW_LINE> <INDENT> self.playlist.setPlaybackMode(QMediaPlaylist.Random) <NEW_LINE> <... | Repeat current song if value = True. | 625941cfeab8aa0e5d26dcb3 |
def parse_method(name): <NEW_LINE> <INDENT> string = r"" <NEW_LINE> if name.split('es_')[1][0] == '1': <NEW_LINE> <INDENT> string += r'ES' <NEW_LINE> <DEDENT> if name.split('vm_')[1][0] == '1': <NEW_LINE> <INDENT> if len(string) > 0: <NEW_LINE> <INDENT> string += r', VM' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> st... | Parse hyperparameters from string name to make legend label.
Parameters
----------
name : str
Name of method
Returns
-------
string : str
Formatted string | 625941cf187af65679ca527a |
def journey(initial_state_vector, log, case='0'): <NEW_LINE> <INDENT> state_vector = initial_state_vector <NEW_LINE> np.set_printoptions(precision=3) <NEW_LINE> print('{}case: {}{}'.format(color.BOLD+color.PURPLE, case, color.END)) <NEW_LINE> print('Starting POMDP with') <NEW_LINE> print_state(initial_state_vector) <NE... | Performs multiple iterations
Args:
initial_state_vector (np.array(NUM_STATES)): initial state vector
log (list): [(action_taken, observed_environment), ...] list. Example [('U', 'X'), ('R', 'T')]
case (str, optional): Defaults to '0'. Case description, to print before the results | 625941cfdc8b845886cb5690 |
def call(self, inputs, updates, mask=None, training=None): <NEW_LINE> <INDENT> shape = shape_list(inputs) <NEW_LINE> rank = len(shape) <NEW_LINE> if rank > 2: <NEW_LINE> <INDENT> inputs = tf.reshape(inputs, [-1, shape[-1]]) <NEW_LINE> updates = tf.reshape(updates, [-1, shape[-1]]) <NEW_LINE> <DEDENT> outputs = tf.matmu... | Runs the layer. | 625941cff548e778e58cd6d9 |
@onsetup <NEW_LINE> def setup_product(): <NEW_LINE> <INDENT> fiveconfigure.debug_mode = True <NEW_LINE> import plone.MIRC_Legislative_Alert <NEW_LINE> zcml.load_config('configure.zcml', plone.MIRC_Legislative_Alert) <NEW_LINE> fiveconfigure.debug_mode = False <NEW_LINE> ztc.installPackage('plone.MIRC_Legislative_Alert'... | Set up the package and its dependencies.
The @onsetup decorator causes the execution of this body to be
deferred until the setup of the Plone site testing layer. We could
have created our own layer, but this is the easiest way for Plone
integration tests. | 625941cf97e22403b379d0f5 |
def sortPopulation(self, population): <NEW_LINE> <INDENT> k = len(population) <NEW_LINE> while k > 1: <NEW_LINE> <INDENT> i = 0 <NEW_LINE> for j in range(k - 1): <NEW_LINE> <INDENT> if population[j][1] > population[j + 1][1]: <NEW_LINE> <INDENT> aux = population[j] <NEW_LINE> population[j] = population[j + 1] <NEW_LINE... | Sort the current population attribute according to its fitness values using the bubble sort algorithm. | 625941cf7d43ff24873a2dfb |
def iter_article_sentences(self, max_n_pages=None): <NEW_LINE> <INDENT> for text in self.iter_stripped_article_texts(max_n_pages=max_n_pages): <NEW_LINE> <INDENT> paragraphs = self.paragraph_split_pattern.split(text) <NEW_LINE> for paragraph in paragraphs: <NEW_LINE> <INDENT> sentences = self.sentence_tokenizer.tokeniz... | Iterate over article sentences.
Parameters
----------
max_n_pages : int or None, optional
Maximum number of pages to return.
Yields
------
sentences : str
Sentences as strings. | 625941cf50812a4eaa59c47c |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, EmlToPngResult): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941cf63d6d428bbe4464a |
def call(self, buffers, transitions, training=False): <NEW_LINE> <INDENT> max_sequence_len, batch_size, d_proj = (int(x) for x in buffers.shape) <NEW_LINE> splitted = tf.split( tf.reshape(tf.transpose(buffers, [1, 0, 2]), [-1, d_proj]), max_sequence_len * batch_size, axis=0) <NEW_LINE> buffers = [splitted[k:k + max_seq... | Invoke the forward pass of the SPINN model.
Args:
buffers: Dense `Tensor` of shape
(max_sequence_len, batch_size, config.d_proj).
transitions: Dense `Tensor` with integer values that represent the parse
trees of the sentences. A value of 2 indicates "reduce"; a value of 3
indicates "shift". Shape: (max... | 625941cf24f1403a92600cc0 |
def archive(self, format, path='', ref='master'): <NEW_LINE> <INDENT> resp = None <NEW_LINE> if format in ('tarball', 'zipball'): <NEW_LINE> <INDENT> url = self._build_url(format, ref, base_url=self._api) <NEW_LINE> resp = self._get(url, allow_redirects=True, stream=True) <NEW_LINE> <DEDENT> if resp and self._boolean(r... | Get the tarball or zipball archive for this repo at ref.
See: http://developer.github.com/v3/repos/contents/#get-archive-link
:param str format: (required), accepted values: ('tarball',
'zipball')
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers ... | 625941cf4527f215b584c5b1 |
@app.route('/tvshow', methods=['GET', 'POST']) <NEW_LINE> def tvshow(): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> return trendTv() <NEW_LINE> <DEDENT> show = [] <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> tv_show = request.form['tv_show'] <NEW_LINE> if len(tv_show) != 0: <NEW_L... | obtiene lista de series de tv basadas en el criterio de busqueda | 625941cf3539df3088e2e4a6 |
def preprocess_companies(companies: pd.DataFrame) -> pd.DataFrame: <NEW_LINE> <INDENT> companies["iata_approved"] = _is_true(companies["iata_approved"]) <NEW_LINE> companies["company_rating"] = _parse_percentage(companies["company_rating"]) <NEW_LINE> return companies | Preprocesses the data for companies.
Args:
companies: Raw data.
Returns:
Preprocessed data, with `company_rating` converted to a float and
`iata_approved` converted to boolean. | 625941cfbe8e80087fb20d9d |
def calpulseprofile(ts, bpm): <NEW_LINE> <INDENT> Tp = calpulseperiod(ts, 60/bpm) <NEW_LINE> fs = foldtimeseries(ts, Tp) <NEW_LINE> tf = fs[:,0] <NEW_LINE> yf = fs[:,1] <NEW_LINE> Nf = len(yf) <NEW_LINE> profile = np.zeros([Nf,2]) <NEW_LINE> Nby2 = np.int(np.floor(Nf/2))-1 <NEW_LINE> ndx = np.argmax(yf) <NEW_LINE> if n... | calculate pulse profile by folding pulse time series | 625941cf442bda511e8be573 |
def get_idle_nodes(self): <NEW_LINE> <INDENT> if self.is_slurm_enabled: <NEW_LINE> <INDENT> return subprocess.check_output('sinfo -t idle -hNo %N | uniq', shell=True).decode().splitlines() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NotImplementedError('<geopm> geopmpy.launcher: Idle nodes feature requires use ... | Returns a list of the names of compute nodes that are currently
available to run jobs using the sinfo command. | 625941cfa219f33f34628ac5 |
def get_unique_periods(filelist, frequency): <NEW_LINE> <INDENT> if frequency == 'monthly': <NEW_LINE> <INDENT> months = set(get_month_label(filelist)) <NEW_LINE> return list(months) <NEW_LINE> <DEDENT> elif frequency == 'daily': <NEW_LINE> <INDENT> days = set(get_day_label(filelist)) <NEW_LINE> return list(days) <NEW_... | Extract all unique values in the filelist (do this using set ) | 625941cf30bbd722463cbf21 |
def getrunsInResult(schema,minrun=132440,maxrun=500000): <NEW_LINE> <INDENT> result=[] <NEW_LINE> qHandle=schema.newQuery() <NEW_LINE> try: <NEW_LINE> <INDENT> qHandle.addToTableList( 'HFLUMIRESULT' ) <NEW_LINE> qHandle.addToOutputList('distinct RUNNUM') <NEW_LINE> qCondition=coral.AttributeList() <NEW_LINE> qCondition... | get runs in result tables in specified range
output:
[runnum]
select distinct runnum from hflumiresult where runnum>=:minrun and runnum<=:maxrun; | 625941cf7d43ff24873a2dfc |
def get_from_cache(url, cache_dir=None): <NEW_LINE> <INDENT> response = requests.head(url, allow_redirects=True) <NEW_LINE> if response.status_code != 200: <NEW_LINE> <INDENT> raise IOError("HEAD request failed for url {} with status code {}" .format(url, response.status_code)) <NEW_LINE> <DEDENT> etag = response.heade... | Given a URL, look for the corresponding dataset in the local cache.
If it's not there, download it. Then return the path to the cached file. | 625941cfb545ff76a8913f71 |
def __init__(self, focus_tags, scope_tags=None, ignore_tags=None): <NEW_LINE> <INDENT> self.focus_tags = focus_tags <NEW_LINE> self.scope_tags = scope_tags <NEW_LINE> self.ignore_tags = ignore_tags or Pair([],[]) | Create a new TextAligner instance
@param focus_tags: a pair of soure and target focus tags
@keyword scope_tags: a pair of source and target scope tag lists;
defaults to the labels of the roots of the source and target document
trees.
@keyword ignore_tags: a pair of source and target ignore tag lists | 625941cf15baa723493c40d1 |
def _format_results(name, ppl, scores, metrics): <NEW_LINE> <INDENT> result_str = "" <NEW_LINE> if ppl: <NEW_LINE> <INDENT> result_str = "%s ppl %.3f" % (name, ppl) <NEW_LINE> <DEDENT> if scores: <NEW_LINE> <INDENT> for metric in metrics: <NEW_LINE> <INDENT> if result_str: <NEW_LINE> <INDENT> result_str += ", %s %s %.3... | Format results. | 625941cfbe7bc26dc91cd75a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.