code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def test204_login(self): <NEW_LINE> <INDENT> print('login') <NEW_LINE> try: <NEW_LINE> <INDENT> response = Service.Service().login(Common.LoginPwd, 66666, Common.teleNum) <NEW_LINE> Common.search_str(str(response), [self.SUCCESS_RESULT]) <NEW_LINE> authorization = response['data']['authorization'] <NEW_LINE> Utils.Util... | 用户登录 | 625941bf91af0d3eaac9b955 |
def __contains__(self, x): <NEW_LINE> <INDENT> if isinstance(x, str): <NEW_LINE> <INDENT> x = FeatureGroup(x) <NEW_LINE> <DEDENT> return x in self.__s | Return True if the feature set contains either given feature or given feature group
This function relies on the fact that FeatureGroup and Feature compare as equal
if their names match. This is to allow, for example, NUMBER.plural == NUMBER return True.
>>> NUMBER = FeatureGroup('NUMBER', 'singular', 'plural')
>>> fs... | 625941bfa934411ee37515d2 |
def is_valid_url(variable): <NEW_LINE> <INDENT> if re.match(r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)", variable): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False | Check if email is a valid mail. | 625941bf2ae34c7f2600d070 |
def destroy(vm_, call=None): <NEW_LINE> <INDENT> destroy_opt = __opts__.get('destroy', False) <NEW_LINE> profiles = __opts__.get('profiles', {}) <NEW_LINE> profile = __opts__.get('profile', __opts__.get('internal_lxc_profile', [])) <NEW_LINE> path = None <NEW_LINE> if profile and profile in profiles: <NEW_LINE> <INDENT... | Destroy a lxc container | 625941bf0a50d4780f666dcf |
def get_cbm_vbm(self, tol=0.001, abs_tol=False, spin=None): <NEW_LINE> <INDENT> tdos = self.get_densities(spin) <NEW_LINE> if not abs_tol: <NEW_LINE> <INDENT> tol = tol * tdos.sum() / tdos.shape[0] <NEW_LINE> <DEDENT> i_fermi = 0 <NEW_LINE> while self.energies[i_fermi] <= self.efermi: <NEW_LINE> <INDENT> i_fermi += 1 <... | Expects a DOS object and finds the cbm and vbm.
Args:
tol:
tolerance in occupations for determining the gap
abs_tol:
an absolute tolerance (True) and a relative one (False)
spin:
Possible values are:
None - finds the gap in the summed densities
Up - finds the... | 625941bf8a43f66fc4b53fa6 |
def add_match_to_profile(self, user_id, matched_interest, force=False): <NEW_LINE> <INDENT> if 'user_id' in g: <NEW_LINE> <INDENT> user = self.user_store.query.get(g.user_id) <NEW_LINE> g.user = user <NEW_LINE> <DEDENT> user = self.db.session.query(Profile).filter_by(user_id=g.user_id).first() <NEW_LINE> matched_user =... | Adds a match for the user in the current context with a specified user.
If a match has not previously been made then return True, else False.
:param user_id: user id of the match to the user in the current context
:type user_id: int
:param matched_interest: one interest that the matched user and user in the current c... | 625941bf656771135c3eb7ab |
def unmarshall_player(player_sparse): <NEW_LINE> <INDENT> template = get_player_template() <NEW_LINE> delta = {} <NEW_LINE> player = player_sparse.copy() <NEW_LINE> for k in player_sparse.keys(): <NEW_LINE> <INDENT> if player_sparse[k] == None or player_sparse[k] == []: <NEW_LINE> <INDENT> player.pop(k) <NEW_LINE> <DED... | Unmarshall a MSF player JSON to a proper flat dict
Paramters
---------
player_sparse: dict,
fetched player from MSF API.
Returns
-------
template: dict,
flat proper player dict. | 625941bf1f037a2d8b94613d |
def warning(*args, **kwargs): <NEW_LINE> <INDENT> pass | The warning command is provided so that the user can issue warning messages from his/her scripts. The string argument is
displayed in the command window (or stdout if running in batch mode) after being prefixed with a warning message heading
and surrounded by the appropriate language separators (# for Python, // for Me... | 625941bf8e7ae83300e4af0b |
def __init__(self, id=None, slug=None, username=None, password=None, email=None, admin=None, active=None, created_at=None, updated_at=None): <NEW_LINE> <INDENT> self._id = None <NEW_LINE> self._slug = None <NEW_LINE> self._username = None <NEW_LINE> self._password = None <NEW_LINE> self._email = None <NEW_LINE> self._a... | User - a model defined in OpenAPI | 625941bfe76e3b2f99f3a74f |
def remove(download): <NEW_LINE> <INDENT> pass | remove a Download object from the queue | 625941bf4f6381625f11497c |
def get_changed_files_in_commit(self, commit_hash): <NEW_LINE> <INDENT> output = self._execute_command(get_changed_files_in_commit.format(commit_id=commit_hash)) <NEW_LINE> return re.match(r"(?P<content>.*)\ncommit {}".format(commit_hash), output, re.DOTALL).group('content').splitlines() | Gets all changed files in specified by parameter commit
:param commit_hash: Commit hash
:type commit_hash: str | 625941bf7d847024c06be1f8 |
def p_VariableStatementError(p): <NEW_LINE> <INDENT> p[0] = "VariableStatement" <NEW_LINE> p[0] = list(p) | VariableStatement : VAR error ';'
| VAR error
| VAR Identifier EQUAL error ';'
| VAR Identifier EQUAL error | 625941bf187af65679ca505d |
def risposta3(): <NEW_LINE> <INDENT> tavolo() <NEW_LINE> glPushMatrix() <NEW_LINE> t(yArm/2,0,yArm/2) <NEW_LINE> t(lunghezzaTavolo/2, larghezzaTavolo*2.4, altezzaTavolo/2) <NEW_LINE> r(-alphaTavolo, 1, 0, 0) <NEW_LINE> t(-lunghezzaTavolo/2, 0, -altezzaTavolo/2) <NEW_LINE> t(0,zArm,0) <NEW_LINE> drawTecnigrafo(xArm, yAr... | Visualizza il tavolo ed il modello dei bracci con la squadretta alla fine | 625941bf7cff6e4e811178c5 |
def testWordLength(): <NEW_LINE> <INDENT> if avgWordLength() != [5.728459348746789, 5.881334691000235, 5.985706580366775, 5.686571428571429, 5.3567737870195336]: <NEW_LINE> <INDENT> return False | tests function avgWordLength, returns false if not working | 625941bf2ae34c7f2600d071 |
def subtract_cells(self, other): <NEW_LINE> <INDENT> column_names = self.column_names_list() <NEW_LINE> result = named_column_sheet(self.config, column_names) <NEW_LINE> result.rows = {date: qsutils.qsutils.subtracted_row(row, other.rows.get(date, {}), column_names) for date, row in self.rows.items()} <NEW_LINE> return... | Return the cell-by-cell subtraction of another sheet from this one. | 625941bf16aa5153ce3623b8 |
def SetDefault(self): <NEW_LINE> <INDENT> tlw = wx.GetTopLevelParent(self) <NEW_LINE> if hasattr(tlw, 'SetDefaultItem'): <NEW_LINE> <INDENT> tlw.SetDefaultItem(self) | This sets the :class:`AquaButton` to be the default item for the panel or dialog box.
:note: Under Windows, only dialog box buttons respond to this function. As normal
under Windows and Motif, pressing return causes the default button to be depressed
when the return key is pressed. See also :meth:`Window.SetFocus` w... | 625941bf92d797404e3040c8 |
def pass_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description='Generate a sine wave stimulus module using a Lookup Table.') <NEW_LINE> parser.add_argument('-e', '--etol', help='Error tolerance.', type=float) <NEW_LINE> parser.add_argument('-f', '--freq', help='Frequency.', type=float) <NEW_LINE> par... | args | 625941bf0a366e3fb873e757 |
def scanstring(string, end, strict=True): <NEW_LINE> <INDENT> pass | scanstring(string, end, strict=True) -> (string, end)
Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
Unescapes all valid JSON string escape sequences and raises ValueError
on attempt to decode an invalid string. If strict is False then literal
... | 625941bfac7a0e7691ed4010 |
def write_open_ended(self, background_column_indices=None, column_indices=None): <NEW_LINE> <INDENT> if not column_indices: <NEW_LINE> <INDENT> start, length = self.metadata['columns'] <NEW_LINE> column_indices = range(start, start + length) <NEW_LINE> if self.metadata['other'] == 'Y': <NEW_LINE> <INDENT> column_indice... | List the answers to an open-ended question
:param background_column_indices: indices of columns containing
background information to be included (Default value = None)
:param column_indices: indices of columns to be used
(Default value = None) | 625941bffff4ab517eb2f379 |
def get_vmin_vmax(self, frame, vmin=None, vmax=None, soft_vmin=False, soft_vmax=False): <NEW_LINE> <INDENT> has_vmin = vmin is not None <NEW_LINE> has_vmax = vmax is not None <NEW_LINE> if has_vmin and has_vmax and (not soft_vmin) and (not soft_vmax): return vmin, vmax <NEW_LINE> return get_vmin_vmax(frame.data, interv... | This function ...
:param frame:
:param vmin:
:param vmax:
:param soft_vmin:
:param soft_vmax:
:return: | 625941bf21bff66bcd684894 |
def intersection(self, other): <NEW_LINE> <INDENT> VERIFICATION.verify_type(other, Rect, "intersection target must be Rect") <NEW_LINE> funcs = (max, min, max, min) <NEW_LINE> intersection_tuple = self._apply_binary_funcs(other, funcs) <NEW_LINE> (inter_row_start, inter_row_end, inter_col_start, inter_col_end) = inters... | Returns the intersection between the current Rect and the input Rect
Computes and returns a Rect whose ROI covers the exact overlapping region between the
current object's ROI and the passed in Rect's ROI if such region consists of at least one
pixel or None if such region is empty.
Arguments:
other -- The Rect to co... | 625941bf6fb2d068a760efda |
def create_user(self, **extra_fields): <NEW_LINE> <INDENT> user = self.model(**extra_fields) <NEW_LINE> user.save() <NEW_LINE> return user | Create and save a User with the given email and password. | 625941bf31939e2706e4cdac |
def make_connection(config=None, default_model=None): <NEW_LINE> <INDENT> return datastore_rpc.Connection( adapter=ModelAdapter(default_model), config=config) | Create a new Connection object with the right adapter.
Optionally you can pass in a datastore_rpc.Configuration object. | 625941bfec188e330fd5a6e3 |
def isoformat(self): <NEW_LINE> <INDENT> return self.strftime(self.ISO8601Format) | Convert object to an ISO 8601 timestamp accepted by MediaWiki.
datetime.datetime.isoformat does not postfix the ISO formatted date
with a 'Z' unless a timezone is included, which causes MediaWiki
~1.19 and earlier to fail. | 625941bfd18da76e23532412 |
def stop_sequence(self): <NEW_LINE> <INDENT> return sorted( self.stop_times(), key=lambda x:int(x.get('stop_sequence')) ) | Return the sorted StopTimes for this trip. | 625941bfa05bb46b383ec763 |
def text_image(text_path, font_path=None): <NEW_LINE> <INDENT> grayscale = 'L' <NEW_LINE> with open(text_path) as text_file: <NEW_LINE> <INDENT> lines = tuple(l.rstrip() for l in text_file.readlines()) <NEW_LINE> <DEDENT> large_font = 20 <NEW_LINE> font_path = font_path or 'C:\WINDOWS\Fonts\\arial.ttf' <NEW_LINE> try: ... | Convert text file to a grayscale image with black characters on a white background.
arguments:
text_path - the content of this file will be converted to an image
font_path - path to a font file (for example impact.ttf) | 625941bfd99f1b3c44c674d4 |
def dedup_list(alist): <NEW_LINE> <INDENT> seen = set() <NEW_LINE> ret = [] <NEW_LINE> for item in alist: <NEW_LINE> <INDENT> if item not in seen: <NEW_LINE> <INDENT> ret.append(item) <NEW_LINE> <DEDENT> seen.add(item) <NEW_LINE> <DEDENT> return ret | Deduplicates the given list by removing duplicates while preserving the order | 625941bf097d151d1a222d9a |
def generate(self, src_text, src_text_rev, sentence_limit, word2id, id2word): <NEW_LINE> <INDENT> self.initialize(batch_size=1) <NEW_LINE> self.one_encode(src_text, src_text_rev, train=False) <NEW_LINE> sentence = "" <NEW_LINE> word_id = word2id["<start>"] <NEW_LINE> for _ in range(sentence_limit): <NEW_LINE> <INDENT> ... | :param src_text: input text embed id ex.) [ 1, 0 ,14 ,5 ]
:param src_text_rev:
:param sentence_limit:
:param word2id:
:param id2word:
:return: | 625941bf26238365f5f0edaa |
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 | 625941bf66673b3332b91fd0 |
def main(): <NEW_LINE> <INDENT> parser = get_argparser() <NEW_LINE> args = parser.parse_args() <NEW_LINE> conf = ConfigParser() <NEW_LINE> conf.read_file(args.config) <NEW_LINE> conf["alembic"]['sqlalchemy.url'] = SQLALCHEMY_URL <NEW_LINE> conf["alembic"]['sqlalchemy.echo'] = SQLALCHEMY_ECHO <NEW_LINE> if SQLALCHEMY_PO... | 設定ファイルをparseして、slackbotを起動します
1. configparserで設定ファイルを読み込む
2. 設定ファイルに `alembic` セクションが設定されているかチェック
3. 設定ファイルの情報でDB周りの設定を初期化
4. slackbotの処理を開始 | 625941bf96565a6dacc8f60c |
def main_menu(): <NEW_LINE> <INDENT> img = libtcod.image_load('menu_background.png') <NEW_LINE> title = 'Rumble in the Underdeep' <NEW_LINE> author = 'By @cr8ivecodesmith' <NEW_LINE> while not libtcod.console_is_window_closed(): <NEW_LINE> <INDENT> libtcod.image_blit_2x(img, 0, 0, 0) <NEW_LINE> libtcod.console_set_defa... | Game main menu
| 625941bf3346ee7daa2b2ca9 |
def is_square_mod_p(n, p): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return pow(n, int((p-1)/2), p) == 1 | Checks if n is a square (mod p) using Euler's criterion
>>> is_square_mod_p(0,5)
True
>>> is_square_mod_p(1,5)
True
>>> is_square_mod_p(2,5)
False | 625941bfd53ae8145f87a1b3 |
def fen(self): <NEW_LINE> <INDENT> hash = [] <NEW_LINE> for i, coord in enumerate(all_coords): <NEW_LINE> <INDENT> p_type = self.get_coord((coord[1], SIZE - coord[0] - 1)) <NEW_LINE> if i % 8 == 0 and i > 0: <NEW_LINE> <INDENT> hash.append("/") <NEW_LINE> <DEDENT> if p_type == EMPTY: <NEW_LINE> <INDENT> if len(hash) > ... | Return the FEN hash string for the current state of the game. | 625941bfa17c0f6771cbdf92 |
def vm_snapshot_revert(vm_name, kwargs=None, call=None): <NEW_LINE> <INDENT> if call != "action": <NEW_LINE> <INDENT> raise SaltCloudSystemExit( "The vm_snapshot_revert action must be called with -a or --action." ) <NEW_LINE> <DEDENT> if kwargs is None: <NEW_LINE> <INDENT> kwargs = {} <NEW_LINE> <DEDENT> snapshot_id = ... | Reverts a virtual machine to a snapshot
.. versionadded:: 2016.3.0
vm_name
The name of the VM to revert.
snapshot_id
The snapshot ID.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_snapshot_revert my-vm snapshot_id=42 | 625941bfbaa26c4b54cb1061 |
def _server_connect(dsn, user='', password='', host=''): <NEW_LINE> <INDENT> if dsn is None: <NEW_LINE> <INDENT> raise InterfaceError("dsn value should not be None") <NEW_LINE> <DEDENT> if (not isinstance(dsn, str)) | (not isinstance(user, str)) | (not isinstance(password, str)) | (not isinstance(host... | This method create connection with server
| 625941bfaad79263cf39097d |
def format_cmd(alias, cmd, params): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return cmd.format(*params) <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> helpers.exit(constants.WARN_FMT_NUM_PARAMS.format( alias, len(params))) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> helpers.exit(constants.W... | Formats a command with user provided parameters, similar to the Python
`format()` method.
Arguments:
cmd (str): The command.
params (tuple): Parameters to be formatted into the command.
Returns:
A `string` representing the newly formatted command. | 625941bf67a9b606de4a7dfa |
def edit_item(self, item): <NEW_LINE> <INDENT> conn = sqlite3.connect('plugins/rs_ac_singidunum_magacin/db/warehouse.db') <NEW_LINE> c = conn.cursor() <NEW_LINE> c.execute('UPDATE items SET item_count = ? WHERE name = ? and expiration_date = ? and temperature = ? ', (item.item_count, item.name,item.expiration_date, ite... | Menja broj proizvoda u sqlite bazi. | 625941bf167d2b6e31218ad5 |
def get_positions(self): <NEW_LINE> <INDENT> self.logger.debug('Fetching positions of BitFlyer') <NEW_LINE> try: <NEW_LINE> <INDENT> positions = self.call_json_api('GET', API_PATH_POSITIONS) <NEW_LINE> <DEDENT> except BitFlyerAPIError as e: <NEW_LINE> <INDENT> self.logger.warning(('Failed to fetch positions of BitFlyer... | Get positions.
Refer:
[建玉の一覧を取得](https://lightning.bitflyer.jp/docs?lang=ja#建玉の一覧を取得) | 625941bf23849d37ff7b2fd0 |
def find_vampire_in_4digit(num): <NEW_LINE> <INDENT> digit = 4 <NEW_LINE> nl = list(str(num)) <NEW_LINE> if len(nl) != digit: <NEW_LINE> <INDENT> print('only works for 4-digit number!') <NEW_LINE> return <NEW_LINE> <DEDENT> vampires = [] <NEW_LINE> jj = permutations(nl, digit) <NEW_LINE> for cc in jj: <NEW_LINE> <INDEN... | give number check if a vampire number | 625941bf9f2886367277a7cf |
def test_client_intermediate(self): <NEW_LINE> <INDENT> with HTTPSConnectionPool( self.host, self.port, key_file=os.path.join(self.certs_dir, CLIENT_INTERMEDIATE_KEY), cert_file=os.path.join(self.certs_dir, CLIENT_INTERMEDIATE_PEM), ca_certs=DEFAULT_CA, ) as https_pool: <NEW_LINE> <INDENT> r = https_pool.request("GET",... | Check that certificate chains work well with client certs
We generate an intermediate CA from the root CA, and issue a client certificate
from that intermediate CA. Since the server only knows about the root CA, we
need to send it the certificate *and* the intermediate CA, so that it can check
the whole chain. | 625941bf5510c4643540f32a |
def get_ros_package_path(config): <NEW_LINE> <INDENT> code_trees = [] <NEW_LINE> for tree_el in reversed(config.get_config_elements()): <NEW_LINE> <INDENT> if not os.path.isfile(tree_el.get_path()): <NEW_LINE> <INDENT> code_trees.append(tree_el.get_path()) <NEW_LINE> <DEDENT> <DEDENT> return code_trees | Return the simplifed ROS_PACKAGE_PATH | 625941bfe64d504609d7477f |
def logSearch( self, mode='all', searchTerm='', startLine='', logNum=1 ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert isinstance( searchTerm, str ) <NEW_LINE> logPath = '/opt/onos/log/karaf.log.' <NEW_LINE> logPaths = '/opt/onos/log/karaf.log' <NEW_LINE> for i in range( 1, logNum ): <NEW_LINE> <INDENT> logPaths... | Searches the latest ONOS log file for the given search term and
return a list that contains all the lines that have the search term.
Arguments:
searchTerm:
The string to grep from the ONOS log.
startLine:
The term that decides which line is the start to search the searchTerm in
the kara... | 625941bf9b70327d1c4e0d13 |
def tower_encoder(frames: tf.Tensor, poses: tf.Tensor, scope="TowerEncoder"): <NEW_LINE> <INDENT> with tf.variable_scope(scope): <NEW_LINE> <INDENT> endpoints = {} <NEW_LINE> net = tf.layers.conv2d(frames, filters=256, kernel_size=2, strides=2, padding="VALID", activation=tf.nn.relu) <NEW_LINE> skip1 = tf.layers.conv2d... | Feed-forward convolutional architecture. | 625941bf15baa723493c3eb3 |
def _precess_from_J2000_Capitaine(epoch): <NEW_LINE> <INDENT> from .angles import rotation_matrix <NEW_LINE> T = (epoch - 2000.0) / 100.0 <NEW_LINE> pzeta = (-0.0000003173, -0.000005971, 0.01801828, 0.2988499, 2306.083227, 2.650545) <NEW_LINE> pz = (-0.0000002904, -0.000028596, 0.01826837, 1.0927348, 2306.077181, -2.65... | Computes the precession matrix from J2000 to the given Julian Epoch.
Expression from from Capitaine et al. 2003 as expressed in the USNO
Circular 179. This should match the IAU 2006 standard from SOFA.
Parameters
----------
epoch : scalar
The epoch as a julian year number (e.g. J2000 is 2000.0) | 625941bf1f5feb6acb0c4a93 |
def containsNearbyDuplicate(self, nums, k): <NEW_LINE> <INDENT> num2index = {} <NEW_LINE> for index, num in enumerate(nums): <NEW_LINE> <INDENT> if num in num2index and abs(num2index[num] - index) <= k: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> num2index[num] = index <NEW_LINE> <DEDENT> return False | :type nums: List[int]
:type k: int
:rtype: bool | 625941bfff9c53063f47c134 |
def bernstein_pt_aprox(X): <NEW_LINE> <INDENT> n = X.shape[0] <NEW_LINE> xpoly = np.poly1d([0]) <NEW_LINE> ypoly = np.poly1d([0]) <NEW_LINE> for i in xrange(n): <NEW_LINE> <INDENT> npoly = bernstein(i, n-1) <NEW_LINE> xpoly += X[i,0] * npoly <NEW_LINE> ypoly += X[i,1] * npoly <NEW_LINE> <DEDENT> return xpoly, ypoly | Returns the 'x' and 'y' coordinate functions for a 2-dimensional
Bezier curve with control points 'X'. | 625941bfb5575c28eb68df3e |
def baroclinic_modes(self, nmodes, ztop=10, N2key="N2", depthkey="z"): <NEW_LINE> <INDENT> if N2key not in self.fields or depthkey not in self.fields: <NEW_LINE> <INDENT> raise FieldError("baroclinic_modes requires buoyancy frequency and depth") <NEW_LINE> <DEDENT> igood = ~self.nanmask((N2key, depthkey)) <NEW_LINE> N2... | Calculate the baroclinic normal modes based on linear
quasigeostrophy and the vertical stratification. Return the first
`nmodes::int` deformation radii and their associated eigenfunctions.
Additional arguments
--------------------
ztop the depth at which to cut off the profile,
... | 625941bf67a9b606de4a7dfb |
def findIndex(self, R, Z, tol=1e-10, show=False): <NEW_LINE> <INDENT> R = np.asfarray(R) <NEW_LINE> Z = np.asfarray(Z) <NEW_LINE> assert R.shape == Z.shape <NEW_LINE> input_shape = R.shape <NEW_LINE> n = R.size <NEW_LINE> position = np.concatenate( (R.reshape((n,1)), Z.reshape((n,1))), axis=1) <NEW_LINE> R = R.reshape(... | Finds the (x, z) index corresponding to the given (R, Z) coordinate
Parameters
----------
R, Z : array_like
Locations. Can be scalar or array, must be the same shape
tol : float, optional
Maximum tolerance on the square distance
Returns
-------
x, z : (ndarray, ndarray)
Index as a float, same shape as R, ... | 625941bf92d797404e3040c9 |
def _get_index_prefix(self, index=None): <NEW_LINE> <INDENT> if index and self.app.config['ELASTICSEARCH_INDEX_PREFIX']: <NEW_LINE> <INDENT> prefixed_index = self.app.config['ELASTICSEARCH_INDEX_PREFIX'] + index <NEW_LINE> return prefixed_index <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return index | Get prefix that should be added to each index.
This allows to save indexes with a seperate prefix in elasticsearch,
however entry point and request stay the same. So the name of index is
different in elasticsearch itself and the layer handles the querying for
the right index. | 625941bfbaa26c4b54cb1062 |
def hash_file(path, saltenv='base'): <NEW_LINE> <INDENT> path, senv = salt.utils.url.split_env(path) <NEW_LINE> if senv: <NEW_LINE> <INDENT> saltenv = senv <NEW_LINE> <DEDENT> return _client().hash_file(path, saltenv) | Return the hash of a file, to get the hash of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
salt '*' cp.hash_file salt://path/to/file | 625941bffb3f5b602dac35d0 |
@coroutine <NEW_LINE> def dvilike_machine(transitions, actions, start = 'start', **state_vars): <NEW_LINE> <INDENT> state = start <NEW_LINE> while True: <NEW_LINE> <INDENT> command = (yield) <NEW_LINE> try: <NEW_LINE> <INDENT> state = transitions[command][state] <NEW_LINE> <DEDENT> except KeyError as e: <NEW_LINE> <IND... | No.
transitions: Dictionary mapping commands (strings) to dictionaries
mapping states (strings) to a state (a string).
actions: Dictionary mapping commands (strings) to dictionaries
mapping states to an action (a function).
start: The start state (a string). | 625941bf50485f2cf553ccd8 |
def test_initialisation_attitude(self): <NEW_LINE> <INDENT> self.Solver.actualise_splines() <NEW_LINE> error = self.Solver.error_function() <NEW_LINE> self.assertAlmostEqual(error, 0, delta=1e-25) | [Attitude] Test if generated source comply with the copied (from satellite) attitude | 625941bf796e427e537b0503 |
def decrease(self,proxy): <NEW_LINE> <INDENT> score = self.db.zscore(self.redis_key,proxy) <NEW_LINE> if score and (score > self.min_score): <NEW_LINE> <INDENT> print('代理',proxy,'当前分数',score,'减1') <NEW_LINE> return self.db.zincrby(self.redis_key, -1, proxy) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('代理',proxy... | 为不能用的代理降分,把分数过低的代理清除
:param proxy: 随即代理
:return: 降分或删除 | 625941bf0c0af96317bb8128 |
def GetMax(dOuter, dOrder): <NEW_LINE> <INDENT> dBig = {} <NEW_LINE> iLittle = iBig = 0 <NEW_LINE> for sIP, dData in dOuter.iteritems(): <NEW_LINE> <INDENT> iLittle = dData['traffic'] <NEW_LINE> if iLittle >= iBig and not sIP in dOrder: <NEW_LINE> <INDENT> iBig = iLittle <NEW_LINE> dBig = {'ip': sIP, 'data': dData} <NE... | 每次得到一个不在dOrder中的dOuter的最大流量值,加入dOrder
@param dOuter:
@param dOrder:
@return: | 625941bfbe8e80087fb20b86 |
def test_volume_present_new(self): <NEW_LINE> <INDENT> ret = { "name": "myzpool/volume", "result": True, "comment": "volume myzpool/volume was created", "changes": {"myzpool/volume": "created"}, } <NEW_LINE> mock_exists = MagicMock(return_value=False) <NEW_LINE> mock_create = MagicMock(return_value=OrderedDict([("creat... | Test if volume is present (non existing volume) | 625941bf44b2445a33931fd7 |
def _drop_index(engine, table_name, index_name): <NEW_LINE> <INDENT> _LOGGER.debug("Dropping index %s from table %s", index_name, table_name) <NEW_LINE> success = False <NEW_LINE> try: <NEW_LINE> <INDENT> engine.execute(text(f"DROP INDEX {index_name}")) <NEW_LINE> <DEDENT> except SQLAlchemyError: <NEW_LINE> <INDENT> pa... | Drop an index from a specified table.
There is no universal way to do something like `DROP INDEX IF EXISTS`
so we will simply execute the DROP command and ignore any exceptions
WARNING: Due to some engines (MySQL at least) being unable to use bind
parameters in a DROP INDEX statement (at least via SQLAlchemy), the qu... | 625941bfd164cc6175782c8d |
def random_Marsaglia(k, seed): <NEW_LINE> <INDENT> subdivisions = [10, 20, 50, 100] <NEW_LINE> numbers = [] <NEW_LINE> random.seed(seed) <NEW_LINE> count = 0 <NEW_LINE> while count < k: <NEW_LINE> <INDENT> x1 = 2.0 * random.random() - 1.0 <NEW_LINE> x2 = 2.0 * random.random() - 1.0 <NEW_LINE> w = x1 ** 2 + x2 ** 2 <NEW... | Generate k Gaussian distributed random numbers.
:param k: number of random numbers.
:param seed: random seed.
:return: null. | 625941bf293b9510aa2c31d8 |
def _read_bitand_expr(self): <NEW_LINE> <INDENT> node = self._read_equlity_expr() <NEW_LINE> while self._next_t('&'): <NEW_LINE> <INDENT> node = self._binop(NodeKind.OP_BITAND, self._conv(node), self._conv(self._read_equlity_expr())) <NEW_LINE> <DEDENT> return node | bit and expression & operation | 625941bffbf16365ca6f60fe |
def error(code=404): <NEW_LINE> <INDENT> e = { 404: b'HTTP/1.1 404 NOT FOUND\r\n\r\n<h1>NOT FOUND</h1>', } <NEW_LINE> return e.get(code, b'') | 根据code返回不同的错误响应
:param code:
:return: | 625941bf167d2b6e31218ad6 |
def search(self, query: str) -> CommentQuery: <NEW_LINE> <INDENT> return self.filter( Comment.search_tsv.op("@@")(func.websearch_to_tsquery(query)) ) | Restrict the comments to ones that match a search query (generative). | 625941bf50812a4eaa59c264 |
def retreive_artifacts_link_from_last_run(self, workflow_id): <NEW_LINE> <INDENT> resp = self.call(self.workflows_url + "/" + str(workflow_id) + "/runs") <NEW_LINE> last_workflow_run = max(resp["workflow_runs"], key=lambda w: w["run_number"]) <NEW_LINE> self.logger.info("last run workflow_id: {}".format(last_workflow_r... | Retreive artifacts link from the last run | 625941bf0fa83653e4656efc |
def setEnabled(self, enable): <NEW_LINE> <INDENT> pass | void Plasma.QueryMatch.setEnabled(bool enable) | 625941bf8c0ade5d55d3e8f8 |
def to_be_ended(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> qs = super(ConditionClassManager, self) .get_query_set() .exclude(self.model.exists_when) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> raise NoExist... | Returns a query set of all the objects in self.model.objects
for which exists_when is false, but there is an open condition for it. | 625941bfd268445f265b4dae |
def index_information(self, collection_name): <NEW_LINE> <INDENT> dbcollection = self._db[collection_name] <NEW_LINE> return {index: specs.get('unique', False) or index == '_id_' for index, specs in dbcollection.index_information().items()} | Return dict of names and sorting order of indexes | 625941bf3cc13d1c6d3c72bb |
def get_wordlist(self, url, filename="shiritori_wordlist.txt"): <NEW_LINE> <INDENT> if not path.exists(filename): <NEW_LINE> <INDENT> self.logger.info("Wordlist not found; downloading new list. This can take a while.") <NEW_LINE> r = requests.get(url, stream=True) <NEW_LINE> filesize = len(r.content) <NEW_LINE> with op... | Retrieves and downloads the wordlist on initializaton for use in the game. | 625941bf66656f66f7cbc0ea |
def strStr(self, haystack, needle): <NEW_LINE> <INDENT> if not needle: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if not haystack or len(haystack) < len(needle): <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> length = len(needle) <NEW_LINE> for i in range(len(haystack)): <NEW_LINE> <INDENT> if haystack[i:i + l... | :type haystack: str
:type needle: str
:rtype: int | 625941bfd53ae8145f87a1b4 |
def print_queue(self): <NEW_LINE> <INDENT> for i in range(0, len(self.clients)): <NEW_LINE> <INDENT> print(self.clients[i]) | Imprime a fila.
| 625941bf60cbc95b062c6482 |
def get_context(fingerprint, verify_cb=None, remote_jid=None): <NEW_LINE> <INDENT> ctx = SSL.Context(SSL.SSLv23_METHOD) <NEW_LINE> flags = (SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3 | SSL.OP_SINGLE_DH_USE | SSL.OP_NO_TICKET) <NEW_LINE> ctx.set_options(flags) <NEW_LINE> ctx.set_cipher_list('HIGH:!aNULL:!3DES') <NEW_... | constructs and returns the context objects | 625941bf3346ee7daa2b2caa |
def verify_user_cfg_change(self, field, name, multivalued=False): <NEW_LINE> <INDENT> self.add_record(user_data.ENTITY, user_data.DATA2) <NEW_LINE> self.navigate_to_record(user_data.DATA2['pkey']) <NEW_LINE> if multivalued: <NEW_LINE> <INDENT> s = "div[name={0}] input[name={0}-0]".format(field) <NEW_LINE> <DEDENT> else... | Helper function to verify that user config changes were reflected on
newly created user | 625941bfc432627299f04b84 |
@pytest.fixture(name="mock_get_countries_by_region_with_filter") <NEW_LINE> def fixture_mock_get_countries_by_region_with_filter(requests_mock): <NEW_LINE> <INDENT> eu_url = BASE_URI + "/region/europe?fields=name" <NEW_LINE> requests_mock.get(eu_url, json=[]) <NEW_LINE> af_url = BASE_URI + "/region/africa?fields=name" ... | Mock requests for getting countries by region and filters the response. | 625941bfe5267d203edcdbdf |
def prediction_imputation(self, df, cfg): <NEW_LINE> <INDENT> df_ctu, ids = self.add_rows_no_event_ctu_predict(df, cfg) <NEW_LINE> df_ctu = self.remove_ctu_churn_customers(df_ctu, cfg) <NEW_LINE> df_ctu = self.fill_no_event_ctu(df_ctu, cfg) <NEW_LINE> df_ctu = df_ctu[df_ctu.index.isin(ids)] <NEW_LINE> df.set_index([cfg... | Imputes values for empty CTUs
Parameters:
df (dataframe): dataframe
cfg (dict): configuration dictionary
Returns:
df: dataframe | 625941bff9cc0f698b14053d |
def _get_bounds(self) -> constants.TYPING_LIST: <NEW_LINE> <INDENT> list_bounds = [] <NEW_LINE> for elem in self.range_X: <NEW_LINE> <INDENT> list_bounds.append(tuple(elem)) <NEW_LINE> <DEDENT> return list_bounds | It returns list of range tuples, obtained from `self.range_X`.
:returns: list of range tuples.
:rtype: list | 625941bf090684286d50ec23 |
def _get_max_prefixes(self): <NEW_LINE> <INDENT> return self.__max_prefixes | Getter method for max_prefixes, mapped from YANG variable /bgp/neighbors/neighbor/afi_safis/afi_safi/l3vpn_ipv6_unicast/prefix_limit/state/max_prefixes (uint32)
YANG Description: Maximum number of prefixes that will be accepted
from the neighbour
| 625941bf627d3e7fe0d68d8e |
@register_decorator(priority=5) <NEW_LINE> def namelambda(name): <NEW_LINE> <INDENT> def rename(f): <NEW_LINE> <INDENT> if not isinstance(f, (LambdaType, FunctionType)): <NEW_LINE> <INDENT> return f <NEW_LINE> <DEDENT> f = copy(f) <NEW_LINE> f.__name__ = name <NEW_LINE> idx = f.__qualname__.rfind('.') <NEW_LINE> f.__qu... | Rename a function. Decorator.
This can be used to give a lambda a meaningful name, which is especially
useful for debugging in cases where a lambda is returned as a closure,
and the actual call into it occurs much later (so that if the call crashes,
the stack trace will report a meaningful name, not just ``"<lambda>"`... | 625941bf71ff763f4b5495c7 |
def test_regulation_retrocession(self): <NEW_LINE> <INDENT> mandate_id = self.ref('%s.extm_jacques_membre_ag' % self._module_ns) <NEW_LINE> data = {'ext_mandate_id': mandate_id, 'month': '05', 'year': 2014 } <NEW_LINE> self.assertRaises( orm.except_orm, self.registry('retrocession').create, self.cr, self.uid, data) <NE... | Test regulation retrocession | 625941bf50485f2cf553ccd9 |
def shift_y(self, y_move): <NEW_LINE> <INDENT> [p.shift_y(y_move) for p in self.arr] | Move all items down by the given amount. | 625941bf8da39b475bd64eb1 |
def read_excel_data(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> xl = pd.ExcelFile(self.excel_file) <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> raise FileNotFoundError(f"file {self.excel_file} not found, or no data") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.xl_dict = {sheet_name: xl.parse(s... | read data from excel to pandas table
excel file has few sheets,
Each sheet is converted into dict
to store values with key = sheet_name | 625941bf442bda511e8be35c |
def CNN_simple(input_size=(71,71,3), output_size=5): <NEW_LINE> <INDENT> model = Sequential() <NEW_LINE> model.add(Lambda(lambda x : x, input_shape=input_size)) <NEW_LINE> model.add(Conv2D(32, kernel_size=(3, 3), padding='same', kernel_initializer='random_uniform')) <NEW_LINE> model.add(Activation('relu')) <NEW_LINE> m... | Implements a convolutional neural network | 625941bf566aa707497f44ad |
def test_bootstrap_length(): <NEW_LINE> <INDENT> out = algo.bootstrap(a_norm) <NEW_LINE> assert_equal(len(out), 10000) <NEW_LINE> n_boot = 100 <NEW_LINE> out = algo.bootstrap(a_norm, n_boot=n_boot) <NEW_LINE> assert_equal(len(out), n_boot) | Test that we get a bootstrap array of the right shape. | 625941bfa934411ee37515d3 |
def OnChatIncomingPM(self, userData, data): <NEW_LINE> <INDENT> raise NotImplementedError | Callback for incoming chat in a Private Message (PM).
Return value should be a tuple of two bools:
first denoting if the call was successfull and
the second if further processing shall be blocked for other plugins. | 625941bf07f4c71912b113c1 |
def enable_ports(self): <NEW_LINE> <INDENT> pass | Enable ports if Ports table is empty.
| 625941bfa17c0f6771cbdf93 |
def is_null(self) -> bool: <NEW_LINE> <INDENT> return self.ref == self.alt | Return if this variant has an alternate equivalent to its reference. | 625941bf498bea3a759b99f0 |
def post(self, request, *args, **kwargs): <NEW_LINE> <INDENT> data = request.POST.copy() <NEW_LINE> form = self.form_class(data) <NEW_LINE> context = {} <NEW_LINE> context['messages'] = [] <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> username = form.cleaned_data['email'] <NEW_LINE> password = form.cleaned_data['p... | Validates the username and password if credentials are valid
the user will be authenticated and will be returned to Dashboard
else appropriate message will be displayed to User on the same login page
:param request:
:param args:
:param kwargs:
:returns: HttpResponse,HttpResponseRedirect | 625941bfad47b63b2c509ec0 |
def mostCommon(self, text): <NEW_LINE> <INDENT> if isinstance(text,list): <NEW_LINE> <INDENT> text = ''.join(text) <NEW_LINE> <DEDENT> lst = Counter(text) <NEW_LINE> d = {} <NEW_LINE> for key, value in lst.items(): <NEW_LINE> <INDENT> d[key] = value <NEW_LINE> <DEDENT> sort_val = sorted(d.items(), key=lambda kv: kv[1],... | Znajdywanie najczęściej występujących znakow | 625941bf66673b3332b91fd1 |
def __init__(self): <NEW_LINE> <INDENT> self.PkgId = None <NEW_LINE> self.Bucket = None <NEW_LINE> self.Region = None <NEW_LINE> self.Path = None <NEW_LINE> self.Credentials = None | :param PkgId: 程序包ID
注意:此字段可能返回 null,表示取不到有效值。
:type PkgId: str
:param Bucket: 桶
注意:此字段可能返回 null,表示取不到有效值。
:type Bucket: str
:param Region: 目标地域
注意:此字段可能返回 null,表示取不到有效值。
:type Region: str
:param Path: 存储路径
注意:此字段可能返回 null,表示取不到有效值。
:type Path: str
... | 625941bfa219f33f346288ad |
def signUserInorOut(user_data, server_conf, clientSocket, count): <NEW_LINE> <INDENT> user_name, course = user_data.split('#') <NEW_LINE> db_name = server_conf["database_name"] <NEW_LINE> profile = getProfileWithName(user_name, db_name) <NEW_LINE> if profile != None: <NEW_LINE> <INDENT> if profile[8] == 0: <NEW_LINE> <... | Signs in user after client has filled out data
:param user_data: user data from client
:param server_conf: server config file | 625941bfd10714528d5ffc21 |
def queue_window(self, window: Window, event_type: WMEventType): <NEW_LINE> <INDENT> self.queue.put(WMEvent(window=window, event_type=event_type)) | Add a window to the queue. | 625941bf1f5feb6acb0c4a94 |
def __call__(cls, parameters, **kwargs): <NEW_LINE> <INDENT> obj = type.__call__(cls) <NEW_LINE> obj.init(parameters, **kwargs) <NEW_LINE> return obj | Called when you call Class() | 625941bf187af65679ca505e |
def p_init_next_state_1(p): <NEW_LINE> <INDENT> initValues[p[1]]=True | init_next_state : NAME NEXT EQUALS TRUE | 625941bf63f4b57ef0001060 |
def numOfWays(self, nums: List[int]) -> int: <NEW_LINE> <INDENT> def way(nums): <NEW_LINE> <INDENT> if len(nums) <= 2: return 1 <NEW_LINE> l = [x for x in nums if x < nums[0]] <NEW_LINE> r = [x for x in nums if x > nums[0]] <NEW_LINE> return comb(len(l)+len(r), len(r)) * way(l) * way(r) <NEW_LINE> <DEDENT> return (way(... | First, we cannot change root, otherwise different tree
Second, nodes in the left < root, nodes in the right > root
l = [x for x in nums if x < nums[0]]
r = [x for x in nums if x > nums[0]]
Interleaving l and r will lead to the same tree
There are C(|l|+|r|, |l|) ways
Do it recursively for l and r
Total ways = C(|l|... | 625941bffbf16365ca6f60ff |
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(CfgPRT, self).__init__(*args, **kwds) <NEW_LINE> if self.portID is None: <NEW_LINE> <INDENT> self.portID = 0 <NEW_LINE> <DEDENT> if self.reserved0 is None: <NEW_LINE> <INDENT> self.reserved0 = 0 <NEW_LINE> <DEDENT> if self... | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
portID,reserved0,txReady,mode,baud... | 625941bf99fddb7c1c9de2d3 |
def load_photo(self, last_chat_file_id): <NEW_LINE> <INDENT> method = 'getFile' <NEW_LINE> image_name = 'initial.jpg' <NEW_LINE> data = {"file_id": last_chat_file_id} <NEW_LINE> ret = requests.post(self.api_url + method, data=data) <NEW_LINE> data = {'file_path': ret.json()['result']['file_path']} <NEW_LINE> ret = requ... | Получение/загрузка фотографии, присланного пользователем бота
:param last_chat_file_id: id чата присланной фотографии
:return: - | 625941bf796e427e537b0504 |
def find_all(self, *criterion, raw=False, limit=None, offset=None): <NEW_LINE> <INDENT> self.session.expire_all() <NEW_LINE> if raw: <NEW_LINE> <INDENT> return session.query(self.__class__).filter(*criterion).limit(limit).offset(offset) <NEW_LINE> <DEDENT> res = session.query(self.__class__).filter(*criterion).limit(li... | Searches the DB (Parameters: limit, offset | 625941bf7047854f462a134d |
def _secret_data_too_large(req, resp): <NEW_LINE> <INDENT> api.abort(falcon.HTTP_413, _("Could not add secret data as it was too large"), req, resp) | Throw exception indicating plain-text was too big. | 625941bf45492302aab5e201 |
def get_representation(output): <NEW_LINE> <INDENT> hidden_states = output[1] <NEW_LINE> token_embeddings = torch.stack(hidden_states, dim=0) <NEW_LINE> token_embeddings = torch.squeeze(token_embeddings, dim=1) <NEW_LINE> token_embeddings = token_embeddings.permute(1, 0, 2) <NEW_LINE> hidden_states = [token[-1] for tok... | Get the hidden representations from bert layers. | 625941bfdd821e528d63b0eb |
def test_type_objects_and_constructors() -> None: <NEW_LINE> <INDENT> assert isfunction(dbapi.Date) <NEW_LINE> assert isfunction(dbapi.Time) <NEW_LINE> assert isfunction(dbapi.Timestamp) <NEW_LINE> assert isfunction(dbapi.DateFromTicks) <NEW_LINE> assert isfunction(dbapi.TimeFromTicks) <NEW_LINE> assert isfunction(dbap... | Test type objects and constructors. | 625941bf711fe17d825422b1 |
def noise(C0=0, Cx=0, x=0, Cu=0, u=0, NSim=1): <NEW_LINE> <INDENT> if is_scalar(C0): <NEW_LINE> <INDENT> independent_noise = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> assert len(C0.shape) == 2, "C0 must have 2 dimensions" <NEW_LINE> independent_noise = C0.dot(randn(C0.shape[1],NSim)) <NEW_LINE> <DEDENT> if is_sca... | Produce state and control dependent noise. | 625941bfbde94217f3682d34 |
def get_temp(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> dev = sorted([x for x in os.listdir( "/sys/class/thermal/") if "thermal_zone" in x])[-1] <NEW_LINE> with open("/sys/class/thermal/"+dev+"/temp") as f: <NEW_LINE> <INDENT> temp = f.read() <NEW_LINE> <DEDENT> return str(int(int(temp)/1000)) <NEW_LINE> <DEDENT> ... | Return temp in Celsius from /sys/class/thermal | 625941bf71ff763f4b5495c8 |
def _in_iterating_context(node): <NEW_LINE> <INDENT> parent = node.parent <NEW_LINE> if isinstance(parent, astroid.For): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if isinstance(parent, astroid.Comprehension): <NEW_LINE> <INDENT> if parent.iter == node: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDE... | Check if the node is being used as an iterator.
Definition is taken from lib2to3.fixer_util.in_special_context(). | 625941bf5e10d32532c5ee68 |
def docstring_to_rest(repo, docstring, current_type=None, current_func=None): <NEW_LINE> <INDENT> if current_type is not None: <NEW_LINE> <INDENT> assert current_type.count(".") == 1 <NEW_LINE> <DEDENT> if current_func is not None: <NEW_LINE> <INDENT> assert current_func.count(".") in (1, 2) <NEW_LINE> <DEDENT> def esc... | Converts `docstring` to reST.
Args:
repo (Repository): the repo that produced the docstring
docstring (str): the docstring
current_type (str or None): the Python identifier for the docstring.
In case the docstring comes from Gtk.Widget.some_func, the parser
can use "Gtk.Widget" in case a si... | 625941bfbe383301e01b53cc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.