code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def ExecuteActionShowInputField(self,oAction:cAction) -> eReturnCode: <NEW_LINE> <INDENT> self.oEventDispatcher.bDoNext = False <NEW_LINE> self.oEventDispatcher.LogAction(uTxt=u'ShowInputField: DestVar:',oAction=oAction) <NEW_LINE> uVarName:str = oAction.dActionPars.get("varname","") <NEW_LINE> self.oInputKeyboard = Sh... | WikiDoc:Doc
WikiDoc:Context:ActionsDetails
WikiDoc:Page:Actions-ShowInputField
WikiDoc:TOCTitle:showinputfield
= showinputfield =
This action opens a seperate page where the user can input text using the default keyboard. This could be the system software keyboard, an Orca software keyboard or a hardware keyboard. You ... | 625941cbd268445f265b4f42 |
def cross_from_below(x, threshold): <NEW_LINE> <INDENT> x = np.asarray(x) <NEW_LINE> threshold = threshold <NEW_LINE> ind = np.nonzero((x[:-1] < threshold) & (x[1:] >= threshold))[0] <NEW_LINE> if len(ind): <NEW_LINE> <INDENT> return ind+1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return ind | return the indices into *x* where *x* crosses some threshold from
below, e.g., the i's where::
x[i-1]<threshold and x[i]>=threshold
Example code::
import matplotlib.pyplot as plt
t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2*np.pi*t)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(t, s, ... | 625941cbad47b63b2c50a053 |
def test_bfs_root_node_search_returns_entire_tree(self): <NEW_LINE> <INDENT> self.assertEqual(bfs(self.tree, 1), self.tree[0]) | Test search for first key returns the root node. | 625941cb82261d6c526ab573 |
def compute_inverse_hessian(self, x_k, x_k_1, grad_k, grad_k_1, H_k): <NEW_LINE> <INDENT> y_k = grad_k_1 - grad_k <NEW_LINE> s_k = x_k_1 - x_k <NEW_LINE> rho_k = 1.0/(torch.t(y_k).matmul(s_k)) <NEW_LINE> I = torch.eye(s_k.size()[0]) <NEW_LINE> H_k_1 = (I - rho_k*s_k.matmul(torch.t(y_k))).matmul(H_k).matmul((I - rho_k*s... | This function computes the H matrix (inverse of hessian) (6.17 Nocedal)
Input:
x_k : current x
x_k_1 : x at after update
grad_k : gradient at x
grad_k_1 : gradient at x_k_1
H_k : current inverse hessian approximation | 625941cb7b25080760e3952d |
def p_pattern_list(self, p): <NEW_LINE> <INDENT> p[0] = cross_product(p[1], p[2]) | pattern_list : pattern_list pattern_element | 625941cb26238365f5f0ef42 |
def endpoint(self) -> Response : <NEW_LINE> <INDENT> req = request.get_json() <NEW_LINE> text = "" <NEW_LINE> try: <NEW_LINE> <INDENT> text = req["text"] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> abort(400) <NEW_LINE> <DEDENT> return jsonify({ "prediction": self.predict(text), }) | The endpoint implementation | 625941cbbf627c535bc132a3 |
def send_facts(self, host, data): <NEW_LINE> <INDENT> data["_type"] = "ansible" <NEW_LINE> data["_timestamp"] = datetime.now().strftime(self.TIME_FORMAT) <NEW_LINE> facts = {"name": host, "facts": data, } <NEW_LINE> try: <NEW_LINE> <INDENT> r = requests.post(url=self.FOREMAN_URL + '/api/v2/hosts/facts', data=json.dumps... | Sends facts to Foreman, to be parsed by foreman_ansible fact
parser. The default fact importer should import these facts
properly. | 625941cb26068e7796caedb2 |
def test_bind_julian(self): <NEW_LINE> <INDENT> output = hbcal("hbcal -id -od --dafbind julian -fphonetics") <NEW_LINE> self.assertEqual(1, len(output)) <NEW_LINE> self.assertEqual('Bava Basra 133', output[0]) | Test --dafbind parameter with Julian calendar. | 625941cb30c21e258bdfa571 |
def remove_callbacks(self): <NEW_LINE> <INDENT> r <NEW_LINE> self.group_dropdown.unobserve(self._group_fun, names="value", type="change") <NEW_LINE> self.shape_options_wid.remove_render_function() <NEW_LINE> self.render_landmarks_switch.remove_render_function() | Function that removes all the internal handler callback functions. | 625941cbcb5e8a47e48b7b7f |
def format_oids(oids_parameters): <NEW_LINE> <INDENT> oids = list() <NEW_LINE> for oid in oids_parameters: <NEW_LINE> <INDENT> if oid in OIDS: <NEW_LINE> <INDENT> current_oid = oids_parameters[oid] <NEW_LINE> if not current_oid: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if type(current_oid) is not str: <NEW_LINE... | Format dictionary OIDs to ``cryptography.x509.oid.NameOID`` object list
:param oids_parameters: CA Object Identifiers (OIDs).
The are typically seen in X.509 names.
Allowed keys/values:
``'country_name': str (two letters)``,
``'locality_name': str``,
``'state_or_province': str``,
``'street_addr... | 625941cb4e4d5625662d44ac |
def execute(self, in_filepath, out_filepath): <NEW_LINE> <INDENT> logger.info("Transcoding from %s to %s", in_filepath, out_filepath) <NEW_LINE> filter_arguments = [] <NEW_LINE> if self._mode.startswith("replaygain"): <NEW_LINE> <INDENT> rp_info = ReplayGain.from_tags( in_filepath, album_gain=self._mode == "replaygain-... | Transcode audio file. | 625941cbf8510a7c17cf97d1 |
def __init__(self, ts_set, **kwargs): <NEW_LINE> <INDENT> if hasattr(ts_set, 'data'): <NEW_LINE> <INDENT> ts_set.data = ts_set.data.mean(axis=0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ts_set = ts_set.mean(axis=0) <NEW_LINE> <DEDENT> self.selected_ts = ts_set | Returns the average timeseries from an array.
:param ts_set: nitime.Timeseries
n_samps x time_size. Time series matrix.
:param kwargs:
:return: average timeseries: 1 x time_size
Will return the same type as ts_set. | 625941cbe1aae11d1e749d8b |
def squared_norm(self): <NEW_LINE> <INDENT> return self.dot_product(self) | Computes the squared norm of the vector. | 625941cb6fb2d068a760f171 |
@nox.session() <NEW_LINE> def tests(session): <NEW_LINE> <INDENT> session.install("pipenv") <NEW_LINE> session.run("pipenv", "install", "--dev") <NEW_LINE> session.run( "pipenv", "run", "pytest", "--quiet", ) | Running tests. | 625941cb16aa5153ce36254c |
def fetch_try_jobs(auth_config, changelist, options): <NEW_LINE> <INDENT> rietveld_url = settings.GetDefaultServerUrl() <NEW_LINE> rietveld_host = urlparse.urlparse(rietveld_url).hostname <NEW_LINE> authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) <NEW_LINE> if authenticator.has_cached_creden... | Fetches tryjobs from buildbucket.
Returns a map from build id to build info as json dictionary. | 625941cb67a9b606de4a7f8e |
def initialize_connection(self, volume, connector): <NEW_LINE> <INDENT> LOG.debug('vCloud Driver: initialize_connection') <NEW_LINE> driver_volume_type = 'hwclouds_volume' <NEW_LINE> data = {} <NEW_LINE> data['backend'] = 'hwclouds' <NEW_LINE> data['volume_id'] = volume['id'] <NEW_LINE> data['display_name'] = volume['d... | Allow connection to connector and return connection info. | 625941cbcad5886f8bd270ad |
def on_private_message(self, by, message): <NEW_LINE> <INDENT> super().on_private_message(by, message) <NEW_LINE> was_command = self.parse_private_message(by, message) <NEW_LINE> if not was_command: <NEW_LINE> <INDENT> answer, technique = self.generator.compose_message(self.last_channel_message) <NEW_LINE> self.message... | this is called when a private message was received.
1. checks if the message was a commando
2. if not, answer to the message directly
:param by: who sent the message
:param message: the content of the message
:return: nothing | 625941cbe8904600ed9f2001 |
def display_calib(dirname, right, verbose): <NEW_LINE> <INDENT> fig = plt.figure(figsize = (10, 10)) <NEW_LINE> ax = plt.axes([0, 0, 1, 1]) <NEW_LINE> plt.axis([0, 1765, 1765, 0]) <NEW_LINE> colours = [] <NEW_LINE> patches = [] <NEW_LINE> sections = calib2sections(dirname) <NEW_LINE> for q in range(len(secti... | XXX Docstring, in fact revise all the documentation
@param dirname Directory with calibration information
@param right @c True to restrict rotations to right angles
@param verbose @c True to print ASIC coordinates | 625941cbbd1bec0571d90703 |
def parse_cols_arg( cols ): <NEW_LINE> <INDENT> if cols: <NEW_LINE> <INDENT> if cols.endswith( ',' ): <NEW_LINE> <INDENT> cols += '0' <NEW_LINE> <DEDENT> col_list = map( lambda x: int( x ) - 1, cols.split(",") ) <NEW_LINE> return col_list <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return BED_DEFAULT_COLS | Parse a columns command line argument into a four-tuple | 625941cbec188e330fd5a874 |
def test_multi_match_qvalue(self): <NEW_LINE> <INDENT> headers = {'X-Roles': 'role-1; q=0.9, role-2; q=0.1'} <NEW_LINE> mc = deproxy_object.make_request(url=self.url, headers=headers) <NEW_LINE> self.assertEqual(mc.received_response.code, '404') <NEW_LINE> self.assertEqual(len(mc.handlings), 0) | mf4p\1q0.9,2q0.1 -> f4 | 625941cb5f7d997b87174b6c |
def getEstVivante(self): <NEW_LINE> <INDENT> return self.__estVivante | Getter estVivante. | 625941cbd164cc6175782e22 |
def __init__(self, test, *, split=None, cache=None, id_prefix=None, proc_num=None, max_utilization=None, subset_first=True, subset_iterator=None, complement_iterator=None): <NEW_LINE> <INDENT> super().__init__(test=test, split=split, cache=cache, id_prefix=id_prefix, proc_num=proc_num, max_utilization=max_utilization) ... | Initialize a ParallelDD object.
:param test: A callable tester object.
:param split: Splitter method to break a configuration up to n part.
:param cache: Cache object to use.
:param id_prefix: Tuple to prepend to config IDs during tests.
:param proc_num: The level of parallelization.
:param max_utilization: The maximu... | 625941cba8ecb033257d31a1 |
@api.route('/users/<int:userid>/shoppinglists/<int:lstid>/items/<itemname>', methods=['GET']) <NEW_LINE> @json <NEW_LINE> def get_item_by_name(userid, lstid, itemname): <NEW_LINE> <INDENT> shoppinglst = User.query.get_or_404(userid).get_shoppinglists_by_id(lstid) <NEW_LINE> item = shoppinglst.get_item_by_name(itemname)... | return the Item if found in database for itemname else return error code 404 | 625941cb21a7993f00bc7dc3 |
def unsubscribe(self, topic): <NEW_LINE> <INDENT> self.mqtt_client.unsubscribe(topic) | subscribe to a new topic | 625941cb435de62698dfdd21 |
def construct__stack(self, nodes): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> base = set(nodes) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> base = set([nodes]) <NEW_LINE> <DEDENT> i = 0 <NEW_LINE> visit_time = -1 * numpy.ones((self.delta.size - 1)) <NEW_LINE> num_visits = numpy.zeros((self.delta.size - ... | Function to construct the drainage stack.
Function to add all nodes upstream of a set of base level nodes given
by list *nodes* in an order
such that downstream nodes always occur before upstream nodes.
This function contains the major algorithmic difference between the
route to 1 method of Braun and Willet (2013) an... | 625941cb8e05c05ec3eea449 |
def skinInsideFaces(insideFaceList): <NEW_LINE> <INDENT> objFaceList = glTools.utils.selection.componentListByObject(insideFaceList) <NEW_LINE> for objFaces in objFaceList: <NEW_LINE> <INDENT> mesh = cmds.ls(objFaces[0], o=True)[0] <NEW_LINE> faceIds = glTools.utils.component.getSingleIndexComponentList(objFaces) <NEW_... | Copy skinCluster weights to inside faces from the outside faces of the same mesh.
insideFaceList
@param insideFaceList: List of inside faces to copy skinWeights to.
@type insideFaceList: list | 625941cb63b5f9789fde71ba |
def test_permutation_columns_pad(): <NEW_LINE> <INDENT> array_a = np.array([[1, 5, 8, 4], [1, 5, 7, 2], [1, 6, 9, 3], [2, 7, 9, 4]]) <NEW_LINE> perm = np.array([[0, 0, 0, 1], [0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0]]) <NEW_LINE> array_b = np.dot(array_a, perm) <NEW_LINE> array_a = np.concatenate((array_a, np.array([[0]... | Test permutation by permuted columns along with padded zeros. | 625941cbd7e4931a7ee9dff2 |
def initStyleOption(self, option, index): <NEW_LINE> <INDENT> if self.parent.name == "CoinIndex": <NEW_LINE> <INDENT> self.style_coin_index(option, index) <NEW_LINE> self.filter_highlight(option, index) | Initialize `option` with the values using the `index` index. When the
item (0,1) is processed, it is styled especially. All other items are
passed to the original `initStyleOption()` which then calls `displayText()`. | 625941cb2ae34c7f2600d205 |
def __init__(self, min: int, max: int, alpha:float=2, beta:float=5): <NEW_LINE> <INDENT> super().__init__(min, max) <NEW_LINE> self.alpha = alpha <NEW_LINE> self.beta = beta | Recommended parameters:
ID,a,B
1, a=.5, B=.5
2, a=5, B=1
3, a=1, B=3
4, a=2, B=2
5, a=2, B=5
:param min: system minimum
:param max: system maximum
:param alpha: alpha parameter in Betavariate distribution
:param beta: beta parameter in Betavariate distribution | 625941cb9b70327d1c4e0ea9 |
def _reprText(self, **keywords): <NEW_LINE> <INDENT> return self.__repr__() | Return a text representation possible with line
breaks. This methods can be overridden by subclasses
to provide alternative text representations. | 625941cb4d74a7450ccd4298 |
def open(self): <NEW_LINE> <INDENT> if self._serial is None: <NEW_LINE> <INDENT> self._serial = serial.Serial(self.port, self.baudrate, timeout=self.timeout, bytesize=self.bytesize, parity=self.parity, stopbits=self.stopbits) <NEW_LINE> self._serial.reset_output_buffer() <NEW_LINE> LOGGER.info('new %s was initialized' ... | Open the serial connection. | 625941cb3d592f4c4ed1d143 |
def hierarchy_dist(synset_1, synset_2): <NEW_LINE> <INDENT> h_dist = sys.maxsize <NEW_LINE> if synset_1 is None or synset_2 is None: <NEW_LINE> <INDENT> return h_dist <NEW_LINE> <DEDENT> if synset_1 == synset_2: <NEW_LINE> <INDENT> h_dist = max([x[1] for x in synset_1.hypernym_distances()]) <NEW_LINE> <DEDENT> else: <N... | Return a measure of depth in the ontology to model the fact that
nodes closer to the root are broader and have less semantic similarity
than nodes further away from the root. | 625941cb31939e2706e4cf3f |
def harvest_doxygen_groups(file_list, group_list): <NEW_LINE> <INDENT> for file_i in file_list: <NEW_LINE> <INDENT> with open(file_i, 'r') as infile: <NEW_LINE> <INDENT> for line in infile: <NEW_LINE> <INDENT> comment_start = line.find("//!") <NEW_LINE> if comment_start >= 0: <NEW_LINE> <INDENT> group_start = line.find... | Scan a list of C/C++ header files, appending found Doxygen API groups to the given list.
:param file_list: The list of files to search
:param group_list: A list to append found groups to
:return: None | 625941cbfff4ab517eb2f511 |
def load_words(): <NEW_LINE> <INDENT> with open('./../dictionary.txt') as f: <NEW_LINE> <INDENT> words = f.read().splitlines() <NEW_LINE> return words | Load dictionary into a list and return list | 625941cb3cc13d1c6d3c744f |
def testOffset(self): <NEW_LINE> <INDENT> request_count = 10 <NEW_LINE> expected = self.createLogs(request_count) <NEW_LINE> fetched_logs = [] <NEW_LINE> for log in logservice.fetch(version_ids=[self.major_version_id]): <NEW_LINE> <INDENT> fetched_logs.append(log) <NEW_LINE> reader = input_readers.LogInputReader(versio... | Test that the user can provide an offset parameter. | 625941cbd18da76e235325ab |
def main(args=[], qapp=None): <NEW_LINE> <INDENT> if qapp is None: <NEW_LINE> <INDENT> app = QtWidgets.QApplication(args) <NEW_LINE> app.setAttribute(Qt.AA_DontUseNativeMenuBar) <NEW_LINE> app.setStyle("Plastique") <NEW_LINE> with closing(QtCore.QFile(":/css/DefaultUIStyle.css")) as f: <NEW_LINE> <INDENT> if f.open(QtC... | Default main program which starts Qt based on the command line arguments `args', sets the stylesheet if present,
then creates the window object and shows it. The `args' command line arguments list is passed to the window object
to pick up on specified directories. The `qapp' object would be the QApplication object if i... | 625941cbc4546d3d9de72b08 |
def main_stacks(): <NEW_LINE> <INDENT> paths = sys.argv[1:] <NEW_LINE> stackslist = [] <NEW_LINE> for path in paths: <NEW_LINE> <INDENT> stacks = Stacks() <NEW_LINE> with open(path) as f: <NEW_LINE> <INDENT> stacks.load(f) <NEW_LINE> <DEDENT> stackslist.append(stacks) <NEW_LINE> <DEDENT> compare(stackslist) | Compare stack traces across build logs. | 625941cb462c4b4f79d1d7a5 |
def testNoForce(self): <NEW_LINE> <INDENT> self.assertRaises(InvalidDicomError, read_file, rtstruct_name) | Raises exception if missing DICOM header and force==False. | 625941cb76d4e153a657ec05 |
def sparseVectorDotProduct(v1, v2): <NEW_LINE> <INDENT> product_list = [v1[i] * v2[i] for i in v1.keys() if i in v2.keys()] <NEW_LINE> return sum(product_list) | Given two sparse vectors |v1| and |v2|, each represented as collections.defaultdict(float), return
their dot product.
You might find it useful to use sum() and a list comprehension.
This function will be useful later for linear classifiers. | 625941cba05bb46b383ec8f6 |
def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): <NEW_LINE> <INDENT> super(AttentionMulitHead, self).__init__() <NEW_LINE> if hidden_dim is None: <NEW_LINE> <INDENT> hidden_dim = embed_dim // n_head <NEW_LINE> <DEDENT> if out_dim is None: <NEW_LINE> <INDEN... | Attention Mechanism
:param embed_dim:
:param hidden_dim:
:param out_dim:
:param n_head: num of head (Multi-Head Attention)
:param score_function: scaled_dot_product / mlp (concat) / bi_linear (general dot)
:return (?, q_len, out_dim,) | 625941cb63d6d428bbe445c4 |
def get_symbol_by_name(self, name): <NEW_LINE> <INDENT> if self._symbol_name_map is None: <NEW_LINE> <INDENT> self._symbol_name_map = defaultdict(list) <NEW_LINE> for i, sym in enumerate(self.iter_symbols()): <NEW_LINE> <INDENT> self._symbol_name_map[sym.name].append(i) <NEW_LINE> <DEDENT> <DEDENT> symnums = self._symb... | Get a symbol(s) by name. Return None if no symbol by the given name
exists. | 625941cbd486a94d0b98e21a |
@login_required <NEW_LINE> def payment_confirmation(request): <NEW_LINE> <INDENT> return redirect('{0}#/account/payment'.format(request.build_absolute_uri(reverse('main')))) | It is return page from PayPal service. It just redirects to correct page of one-page app, because PayPal
can't redirect back to urls with hash (#). | 625941cb596a897236089b96 |
def initialize_chain(test_dir): <NEW_LINE> <INDENT> if not os.path.isdir(os.path.join("cache", "node0")): <NEW_LINE> <INDENT> devnull = open("/dev/null", "w+") <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> datadir=initialize_datadir("cache", i) <NEW_LINE> args = [ os.getenv("BITCOIND", "cgencored"), "-keypool=1", "... | Create (or copy from cache) a 200-block-long chain and
4 wallets.
cgencored and cgencore-cli must be in search path. | 625941cb60cbc95b062c6618 |
def write(self): <NEW_LINE> <INDENT> self.config['cogs']['blacklist'] = self.blacklist <NEW_LINE> self.config['prefixes'] = self.prefixes <NEW_LINE> self._write() | Write guild-specific configuration file. | 625941cb99cbb53fe6792cbb |
def fc_layer(self, input, size_in, size_out, name="fc"): <NEW_LINE> <INDENT> with tf.name_scope(name): <NEW_LINE> <INDENT> w = tf.Variable(tf.truncated_normal([size_in, size_out], stddev=0.1), name="W") <NEW_LINE> b = tf.Variable(tf.constant(0.1, shape=[size_out]), name="B") <NEW_LINE> act = tf.nn.relu(tf.matmul(input,... | Define the fully connected layer
:param input:
:param size_in:
:param size_out:
:param name:
:return: | 625941cb97e22403b379d06e |
def iter_authorization(objecttoauthorize, permission, principal, cache, breadth_first=True): <NEW_LINE> <INDENT> if cache is not None and objecttoauthorize in cache: <NEW_LINE> <INDENT> if permission in cache[objecttoauthorize]: <NEW_LINE> <INDENT> yield cache[objecttoauthorize][permission] <NEW_LINE> return <NEW_LINE>... | Work through `IAuthorization` adapters for `objecttoauthorize`.
Adapters are permitted to delegate checks to other adapters, and this
manages that delegation such that the minimum number of checks are made,
subject to a breadth-first check of delegations.
This also updates `cache` as it goes along, though `cache` can... | 625941cb377c676e9127227d |
def create_from_file(file_path=None): <NEW_LINE> <INDENT> if file_path is None: <NEW_LINE> <INDENT> raise ValueError("Require JSON file path") <NEW_LINE> <DEDENT> status = False <NEW_LINE> with open(file_path) as json_file: <NEW_LINE> <INDENT> data = json.load(json_file) <NEW_LINE> app.logger.debug('== JSON data: %s', ... | Import song data from JSON file.
:param file_path: full file path to JSON file
:return: status: True if creation is done successfully | 625941cb627d3e7fe0d68f24 |
def base(self, path1, *paths): <NEW_LINE> <INDENT> root_dir = self.configuration.root_dir <NEW_LINE> return root_dir.relpathto(path1.joinpath(*paths)) | Return a relative path from config.BASE_DIR to path1 / paths[0] / ... | 625941cb3346ee7daa2b2e40 |
def _add(self, fieldDataList): <NEW_LINE> <INDENT> recDict = {} <NEW_LINE> fieldIndex = 0 <NEW_LINE> for field in self._fieldsList: <NEW_LINE> <INDENT> pStr = pickle.dumps(fieldDataList[fieldIndex], 1) <NEW_LINE> recDict[field] = pStr <NEW_LINE> fieldIndex += 1 <NEW_LINE> <DEDENT> self._dbHandle.Insert(self._name, recD... | Add the fieldData list as a record. | 625941cb67a9b606de4a7f8f |
def main(name, test_gen, cover_branches=False, cover_omit=None, args=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> opts = _parse_args(args, test_gen) <NEW_LINE> cover_ctx = CoverageContext(name, cover_branches, opts.html_report, not opts.handler.SKIP_RUNLOOP) <NEW_LINE> error, killed = result_loop( test_gen, cove... | Entry point for tests using expect_tests.
Example:
import expect_tests
def happy_fn(val):
# Usually you would return data which is the result of some deterministic
# computation.
return expect_tests.Result({'neet': '%s string value' % val})
def Gen():
yield expect_tests.Test('happy', happy_fn, ... | 625941cb090684286d50edba |
@registry.register_hparams <NEW_LINE> def next_frame_l1(): <NEW_LINE> <INDENT> hparams = next_frame() <NEW_LINE> hparams.target_modality = "video:l1" <NEW_LINE> hparams.video_modality_loss_cutoff = 2.4 <NEW_LINE> return hparams | Basic conv model with L1 modality. | 625941cb236d856c2ad448af |
def match_equality(matcher): <NEW_LINE> <INDENT> return EqualityWrapper(wrap_matcher(matcher)) | Wraps a matcher to define equality in terms of satisfying the matcher.
``match_equality`` allows Hamcrest matchers to be used in libraries that
are not Hamcrest-aware. They might use the equality operator::
assert match_equality(matcher) == object
Or they might provide a method that uses equality for its test::
... | 625941cb32920d7e50b282a5 |
def get_file_by_url(url, params=None, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> req = requests.get(url=url, params=params, **kwargs) <NEW_LINE> <DEDENT> except requests.exceptions.RequestException: <NEW_LINE> <INDENT> print("Error retrieving data from {}".format(url)) <NEW_LINE> return None <NEW_LINE> <DE... | Retrieve the contents of the hosts file at the URL, then pass it through domain_to_idna().
Parameters are passed to the requests.get() function.
Parameters
----------
url : str or bytes
URL for the new Request object.
params :
Dictionary, list of tuples or bytes to send in the query string for the Request.
kw... | 625941cb287bf620b61d3b39 |
def _get_attributes_from_config(self): <NEW_LINE> <INDENT> if hasattr(self.configuration, 'cinder_dell_emc_config_file'): <NEW_LINE> <INDENT> self.pool_info['config_file'] = ( self.configuration.cinder_dell_emc_config_file) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.pool_info['config_file'] = ( self.configurati... | Get relevent details from configuration file. | 625941cb656771135c3eb943 |
def find_min_loc(L): <NEW_LINE> <INDENT> minval = L[0] <NEW_LINE> minloc = 0 <NEW_LINE> for i in list(range(len(L))): <NEW_LINE> <INDENT> if L[i] < minval: <NEW_LINE> <INDENT> minval = L[i] <NEW_LINE> minloc = i <NEW_LINE> <DEDENT> <DEDENT> return minval, minloc | find min loc uses a loop to return the minimum of L
and the location (index or day) of that minimum.
Argument L: a nonempty list of numbers.
Results: the smallest value in L, its location (index) | 625941cb8da39b475bd65049 |
def gen_genre_string(genres: list): <NEW_LINE> <INDENT> genre_string = '' <NEW_LINE> for g in genres: <NEW_LINE> <INDENT> genre_string += g + ', ' <NEW_LINE> <DEDENT> genre_string = genre_string.rstrip(', ') <NEW_LINE> return genre_string | Return a pretty genre string to look at given a list of genres (strings). | 625941cb9b70327d1c4e0eaa |
def all_quartets(dist_matrix, names=None): <NEW_LINE> <INDENT> if names is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> names = dist_matrix.names <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> n = len(dist_matrix) <NEW_LINE> quartets = itr.combinations(range(n), 4... | Get all inferred quartet subtrees. | 625941cb56ac1b37e62642a5 |
def test_get_all(self): <NEW_LINE> <INDENT> logger.debug('***** GET ALL *****') <NEW_LINE> user, _, auth, session = self.create_auth_and_check('GET', '/phrasebook') <NEW_LINE> logger.debug('> no data') <NEW_LINE> res = self.test_client.get('/phrasebook', headers={'access_token': auth.access_token}) <NEW_LINE> data = js... | GET /phrasebook | 625941cb2c8b7c6e89b35896 |
def iterfeatures(self, na="null", show_bbox=False): <NEW_LINE> <INDENT> if na not in ["null", "drop", "keep"]: <NEW_LINE> <INDENT> raise ValueError("Unknown na method {0}".format(na)) <NEW_LINE> <DEDENT> ids = np.array(self.index, copy=False) <NEW_LINE> geometries = np.array(self[self._geometry_column_name], copy=False... | Returns an iterator that yields feature dictionaries that comply with
__geo_interface__
Parameters
----------
na : {'null', 'drop', 'keep'}, default 'null'
Indicates how to output missing (NaN) values in the GeoDataFrame
* null: ouput the missing entries as JSON null
* drop: remove the property from the fe... | 625941cb63f4b57ef00011ef |
def processingSteps(self): <NEW_LINE> <INDENT> self._f.seek(0) <NEW_LINE> return processingStepsFromStallMonitorOutput(self._f,self._moduleNames) | Create a generator which can step through the file and return each processing step.
Using a generator reduces the memory overhead when parsing a large file.
| 625941cb507cdc57c6306daf |
def _configIsValid(self): <NEW_LINE> <INDENT> if self.schema: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.config = self.schema(self.config) <NEW_LINE> <DEDENT> except MultipleInvalid as e: <NEW_LINE> <INDENT> self._displayConfigErrors(e.errors) <NEW_LINE> raise <NEW_LINE> <DEDENT> <DEDENT> return 1 | Validate config file content
If :attr:`schema` has been set the `yaml` configuration file is checked
for the correct structure and content. | 625941cbb5575c28eb68e0d5 |
def spy(self, fdct_aircraft_table=None, flst_icao24_fake=None): <NEW_LINE> <INDENT> M_LOG.info(">> EvilTwinCallsign.spy") <NEW_LINE> if self.can_attack() is False: <NEW_LINE> <INDENT> M_LOG.info("!! Waiting to start the attack") <NEW_LINE> return <NEW_LINE> <DEDENT> if self.__s_spoof_icao24 is None: <NEW_LINE> <INDENT>... | Escuta da mensagens ADS-B.
:param fo_adsbOut: o transmissor da mensagem ADS-B
:param fdct_aircraft_table: dicionário com as informações das aeronaves espionadas.
:param flst_icao24_fake: lista com o endereços ICAO24 fake.
:return: None. | 625941cb627d3e7fe0d68f25 |
def test(self, prediction, test_batch_files): <NEW_LINE> <INDENT> if not self._config.config.get_model_train() and self._config.get_model_load(): <NEW_LINE> <INDENT> tf.train.Saver().restore(self._sess, self._config.get_model_path()) <NEW_LINE> print("Model restored.") <NEW_LINE> <DEDENT> print("Starting prediction") <... | This function detects and classifies objects in the given images
:param prediction: tensorflow operator to detect objects (will be run using the session)
:param test_batch_files: list of files to use to test the net | 625941cba79ad161976cc21b |
def __init__(self): <NEW_LINE> <INDENT> self.ParamName = None <NEW_LINE> self.ValueType = None <NEW_LINE> self.NeedRestart = None <NEW_LINE> self.DefaultValue = None <NEW_LINE> self.CurrentValue = None <NEW_LINE> self.Tips = None <NEW_LINE> self.EnumValue = None <NEW_LINE> self.Status = None | :param ParamName: Parameter name
:type ParamName: str
:param ValueType: Parameter type: Multi
:type ValueType: str
:param NeedRestart: Whether restart is required after a modification is made. Value range: true, false
:type NeedRestart: str
:param DefaultValue: Default value of the parameter
:type DefaultValue: str
:pa... | 625941cbd8ef3951e3243613 |
def platonic_dodecahedron(): <NEW_LINE> <INDENT> vertices=[] <NEW_LINE> phi=AA(1+sqrt(5))/2 <NEW_LINE> F=NumberField(phi.minpoly(),"phi",embedding=phi) <NEW_LINE> phi=F.gen() <NEW_LINE> for x in range(-1,3,2): <NEW_LINE> <INDENT> for y in range(-1,3,2): <NEW_LINE> <INDENT> for z in range(-1,3,2): <NEW_LINE> <INDENT> ve... | Produce a triple consisting of a polyhedral version of the platonic dodecahedron,
the associated cone surface, and a ConeSurfaceToPolyhedronMap from the surface
to the polyhedron.
EXAMPLES::
sage: from flatsurf.geometry.polyhedra import platonic_dodecahedron
sage: polyhedron,surface,surface_to_polyhedron = platonic_d... | 625941cb76e4537e8c351748 |
def _decode_rdata_mx(self, data, offset, rr_length): <NEW_LINE> <INDENT> pref = struct.unpack('!H',data[offset:offset+2])[0] <NEW_LINE> offset += 2 <NEW_LINE> if self._check_dns_rr_pointer(data[offset:offset+1]): <NEW_LINE> <INDENT> offset += 1 <NEW_LINE> mail_exch, offset = self._decode_rr_pointer(data, offset) <NEW_L... | decode rdata MX record. | 625941cb99fddb7c1c9de466 |
def parse_pr(files=None, string=None): <NEW_LINE> <INDENT> warnings = [] <NEW_LINE> errors = [] <NEW_LINE> files = files or [] <NEW_LINE> common_tree = antlr3.tree.CommonTree(None) <NEW_LINE> for filename in files: <NEW_LINE> <INDENT> sys.path.insert(0, os.path.dirname(filename)) <NEW_LINE> <DEDENT> try: <NEW_LINE> <IN... | Parse SDL files (.pr) and/or string | 625941cb99cbb53fe6792cbc |
def run(self, args): <NEW_LINE> <INDENT> self.confFile = Defaults.confFile <NEW_LINE> try: <NEW_LINE> <INDENT> self.confFile = args.confFile <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.preflight(args) <NEW_LINE> self.execute(args) | Run this operation. This is the external entry point for users of
VDOOperation.
Arguments:
args (dict): The command line arguments | 625941cb5fc7496912cc3a53 |
def estimate(y, lik, K, M=None, verbose=True): <NEW_LINE> <INDENT> from numpy_sugar.linalg import economic_qs <NEW_LINE> from numpy import pi, var, diag <NEW_LINE> from glimix_core.glmm import GLMMExpFam <NEW_LINE> from glimix_core.lmm import LMM <NEW_LINE> lik = normalize_likelihood(lik) <NEW_LINE> lik_name = lik[0] <... | Estimate the so-called narrow-sense heritability.
It supports Normal, Bernoulli, Probit, Binomial, and Poisson phenotypes.
Parameters
----------
y : array_like
Array of trait values of n individuals.
lik : tuple, "normal", "bernoulli", "probit", "binomial", "poisson"
Sample likelihood describing the residual ... | 625941cb4a966d76dd5510e5 |
def create_order_overriding_cfg(self, name=None, payload_content_type=None, expiration=None, algorithm=None, bit_length=None, mode=None, payload_content_encoding=None): <NEW_LINE> <INDENT> resp = self.create_order( name=name or self.config.name, payload_content_type= payload_content_type or self.config.payload_content_... | Creates order using provided parameters or default configurations.
Allows for testing individual parameters on creation. | 625941cb379a373c97cfac1a |
def std(tr, params): <NEW_LINE> <INDENT> from math import sqrt <NEW_LINE> d = tr.data() <NEW_LINE> time, endtime, samprate, nsamp = tr.getv("time", "endtime", "samprate", "nsamp") <NEW_LINE> dt = 1.0 / samprate <NEW_LINE> nsmps = int(params["twin"] * samprate) <NEW_LINE> inds = [] <NEW_LINE> for i in range(int(nsamp / ... | Test for large spread in data.
Arguments:
tr - Trace4.1 schema trace object <class 'Dbptr'>
params - User-defined parameters <dict>
params['filter'] - Antelope filter string <str>
Return Values:
<list> of <dict>s containing field:value pairs. Field values
correspond to a CSS3.0 schema wfmeas table fields. | 625941cb24f1403a92600c3c |
def fit(self, X, y, preload_features=None): <NEW_LINE> <INDENT> return self._fit(X, y, features_names=self.features_names, preload_features=preload_features) | Fit the IFS model and then the underlying estimator on the selected
features.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
The training input samples.
y : array-like, shape = [n_samples]
The target values.
preload_features: {array-like}, shape = from 0 to n_featur... | 625941cb167d2b6e31218c6b |
def longestCommonPrefix_1(self, strs): <NEW_LINE> <INDENT> res = '' <NEW_LINE> for i in zip(*strs): <NEW_LINE> <INDENT> if len(set(i)) != 1: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> res += i[0] <NEW_LINE> <DEDENT> return res | :type strs: List[str]
:rtype: str | 625941cb097d151d1a222f2f |
def classify_contributors(self, owner, repo=None): <NEW_LINE> <INDENT> repoid = self.repoid(owner, repo) <NEW_LINE> contributors = self.contributors(repoid, repo=None) <NEW_LINE> sums = contributors.sum() <NEW_LINE> def classify(row): <NEW_LINE> <INDENT> role = 'user' <NEW_LINE> ratio = row / sums <NEW_LINE> if (ratio[... | Classify everyone who has interacted with a repo into
- user
- tester
- rejected_contributor
- contributor
- major_contributor
- maintainer
:param owner: The name of the project owner or the id of the project in the projects table of the project in the projects table.
:param repo: The name of the repo. Unn... | 625941cb4c3428357757c3fd |
def plot_corpus(corpus): <NEW_LINE> <INDENT> f = [] <NEW_LINE> for root, dirs, files in os.walk(corpus): <NEW_LINE> <INDENT> for file in files: <NEW_LINE> <INDENT> if file.endswith(".cha"): <NEW_LINE> <INDENT> f.append(str((os.path.join(root, file)))) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> pandizes = [] <NEW_LINE> viz =... | Strives to make a plot for every file in corpus. | 625941cb8a349b6b435e8249 |
def custom_score(game, player): <NEW_LINE> <INDENT> if game.is_loser(player): <NEW_LINE> <INDENT> return float("-inf") <NEW_LINE> <DEDENT> if game.is_winner(player): <NEW_LINE> <INDENT> return float("inf") <NEW_LINE> <DEDENT> own_moves = len(game.get_legal_moves(player)) <NEW_LINE> opp_moves = len(game.get_legal_moves(... | Calculate the heuristic value of a game state from the point of view
of the given player.
This should be the best heuristic function for your project submission.
Note: this function should be called from within a Player instance as
`self.score()` -- you should not need to call this function directly.
Parameters
----... | 625941cb07d97122c4178960 |
def load_macros(module): <NEW_LINE> <INDENT> builtin_macros = EXTRA_MACROS <NEW_LINE> module.__macros__ = {} <NEW_LINE> for builtin_mod_name in builtin_macros: <NEW_LINE> <INDENT> builtin_mod = importlib.import_module(builtin_mod_name) <NEW_LINE> if hasattr(builtin_mod, '__macros__'): <NEW_LINE> <INDENT> module.__macro... | Load the hy builtin macros into module `module_name`,
removing any prior macros set.
It is an error to call this on any module in `hy.core`. | 625941cb283ffb24f3c559d7 |
def conf_ssl_term_preferred_cipher(device=None, *args, **kwargs): <NEW_LINE> <INDENT> return SslServices(device).conf_ssl_preferred_cipher(sslplugin="termination", *args, **kwargs) | SSL preferred cipher suite configurations
Example :-
conf_ssl_term_preferred_cipher( device=device, sslprofile="sslprofile",
ciphersuite="strong")
conf_ssl_term_preferred_cipher(device=device, mode="delete",
sslprofile="sslprofile")
Robot example :-
config ssl term preferred cipher device=$(dev... | 625941cbe5267d203edcdd73 |
def _set_from_db_object(self, context, db_object, fields=None): <NEW_LINE> <INDENT> fields = fields or self.fields <NEW_LINE> for field in fields: <NEW_LINE> <INDENT> setattr(self, field, db_object[field]) | Sets object fields.
:param context: security context
:param db_object: A DB entity of the object
:param fields: list of fields to set on obj from values from db_object. | 625941cb1b99ca400220ab87 |
def create(self, language, value, synonym_of=values.unset): <NEW_LINE> <INDENT> data = values.of({'Language': language, 'Value': value, 'SynonymOf': synonym_of, }) <NEW_LINE> payload = self._version.create( 'POST', self._uri, data=data, ) <NEW_LINE> return FieldValueInstance( self._version, payload, assistant_sid=self.... | Create a new FieldValueInstance
:param unicode language: An ISO language-country string of the value.
:param unicode value: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
:param unicode synonym_of: A value that indicates this field value is ... | 625941cbf548e778e58cd653 |
def test_unused_string(): <NEW_LINE> <INDENT> double_string = proto_op() + string_op * 2 + STOP <NEW_LINE> e = critique_raises(a.SuperfluousStackItemsException, double_string) <NEW_LINE> assert e.issues[0].count == 1 | Critiques a pickle consisting of a start, a string literal, a new string
literal, and a stop. Should fail because the stack isn't empty at the end
of parsing. | 625941cb63f4b57ef00011f0 |
def group_tweets_by_hour(tweets): <NEW_LINE> <INDENT> tweets_by_hour = {} <NEW_LINE> range_hours = range(24) <NEW_LINE> for hour in range_hours: <NEW_LINE> <INDENT> tweets_by_hour[hour] = [] <NEW_LINE> <DEDENT> for tweet in tweets: <NEW_LINE> <INDENT> time = tweet_time(tweet) <NEW_LINE> hour = time.hour <NEW_LINE> twee... | Return a dictionary that groups tweets by the hour they were posted.
The keys of the returned dictionary are the integers 0 through 23.
The values are lists of tweets, where tweets_by_hour[i] is the list of all
tweets that were posted between hour i and hour i + 1. Hour 0 refers to
midnight, while hour 23 refers to 1... | 625941cbbaa26c4b54cb11f6 |
def findContentChildren(self, g, s): <NEW_LINE> <INDENT> g.sort() <NEW_LINE> s.sort() <NEW_LINE> g_index, s_index = 0, 0 <NEW_LINE> while g_index < len(g) and s_index < len(s): <NEW_LINE> <INDENT> if s[s_index] >= g[g_index]: <NEW_LINE> <INDENT> g_index += 1 <NEW_LINE> <DEDENT> s_index += 1 <NEW_LINE> <DEDENT> return g... | Improved solution. I just made some easy optimizations to my previous code without re-examining the approach. Made a lot of easy mistakes the first time around -- this is a good example of the importance of sleep and revisiting your own code!
:type g: List[int]
:type s: List[int]
:rtype: int | 625941cb090684286d50edbb |
def irc_RPL_ENDOFWHO(self, prefix, args): <NEW_LINE> <INDENT> channel = args[1].lower() <NEW_LINE> self.chanmodes[channel] = self.whoreplies[channel] | All WHO data are received, and the newly-populated data
structure replaces a portion of the existing per-channel user
flags data. | 625941cbd268445f265b4f44 |
def test_log_process_sql_log_none(self): <NEW_LINE> <INDENT> columns = self.ok_log.split(' ') <NEW_LINE> self.assertEqual(False, self.ld_iis.log_process_sql_log(columns[5])) | test of: log_process_sql, check if sql injection probe | 625941cbad47b63b2c50a055 |
def SetAutoIdPolicy(self, auto_id_policy): <NEW_LINE> <INDENT> datastore_stub_util.UpdateEmulatorConfig( port=self._emulator_port, auto_id_policy=auto_id_policy) | Set the auto id policy of cloud datastore emulator.
Args:
auto_id_policy: A string indicating how the emulator assigns auto IDs,
should be either datastore_stub_util.SCATTERED or
datastore_stub_util.SEQUENTIAL. | 625941cbe1aae11d1e749d8d |
def sign(self, secret, data): <NEW_LINE> <INDENT> s = 0 <NEW_LINE> e = self._hash(data, self.q - 1) <NEW_LINE> while s == 0 or r == 0: <NEW_LINE> <INDENT> k = self.random_secret() <NEW_LINE> kG_x, _ = self.multiply(self.generator(), k) <NEW_LINE> r = kG_x <NEW_LINE> s = (inverse(k, self.q) * (e + (secret * r)) % self.q... | Executes ECDSA for data to be signed. | 625941cb5fcc89381b1e1795 |
def as_bundle(self): <NEW_LINE> <INDENT> self._unsupported("as_bundle()") | Transform this charm into a charm bundle, if possible.
Some subclasses may not be able to do this. | 625941cba4f1c619b28b0110 |
def _get_raw_data_with_status(self, url=None, manager=None, retries=1, redirect=True, **kwargs): <NEW_LINE> <INDENT> url = url or self.url <NEW_LINE> manager = manager or self._manager <NEW_LINE> retry = urllib3.Retry(retries) <NEW_LINE> if hasattr(retry, 'respect_retry_after_header'): <NEW_LINE> <INDENT> retry.respect... | Get status and response body content from http request. Does not catch exceptions
:return: int, str | 625941cb67a9b606de4a7f90 |
def encode(self, song_object): <NEW_LINE> <INDENT> song_config_file = open("song_config.json") <NEW_LINE> song_config = json.load(song_config_file) <NEW_LINE> song_config_file.close() <NEW_LINE> song_string = "" <NEW_LINE> for song_info_type in song_config['song_single_info_types']: <NEW_LINE> <INDENT> if song_object.g... | Converts the song into chordpro | 625941cbac7a0e7691ed41a3 |
def test_open_file_with_end_padding(self): <NEW_LINE> <INDENT> hdul = fits.open(self.data('test0.fits'), do_not_scale_image_data=True) <NEW_LINE> info = hdul.info(output=False) <NEW_LINE> hdul.writeto(self.temp('temp.fits')) <NEW_LINE> with open(self.temp('temp.fits'), 'ab') as f: <NEW_LINE> <INDENT> f.seek(0, os.SEEK_... | Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/106
Open files with end padding bytes. | 625941cbfff4ab517eb2f512 |
def test_bgscan_simple_same_scan_int(dev, apdev): <NEW_LINE> <INDENT> hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"}) <NEW_LINE> dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412", bgscan="simple:1:-20:1") <NEW_LINE> for i in range(2): <NEW_LINE> <INDENT> ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], ... | bgscan_simple and same short/long scan interval | 625941cb10dbd63aa1bd2c7a |
def execute(self, processor): <NEW_LINE> <INDENT> self.start_time = monotonic() <NEW_LINE> try: <NEW_LINE> <INDENT> self.method, self.response = processor(self.message_buffer) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> successful = self.successful = False <NEW_LINE> exception = self.exception = sys.exc_info() <NEW... | Process our request. | 625941cbd164cc6175782e24 |
def __init__(self, key=None, values=None): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> self.values = values | :param key: (Optional)
:param values: (Optional) | 625941cbec188e330fd5a876 |
def domainString(domain): <NEW_LINE> <INDENT> if isinstance(domain, str): <NEW_LINE> <INDENT> domain = domain.encode('idna') <NEW_LINE> <DEDENT> if not isinstance(domain, bytes): <NEW_LINE> <INDENT> raise TypeError('Expected {} or {} but found {!r} of type {}'.format( type(b'').__name__, type(u'').__name__, domain, typ... | Coerce a domain name string to bytes.
L{twisted.names} represents domain names as L{bytes}, but many interfaces
accept L{bytes} or a text string (L{unicode} on Python 2, L{str} on Python
3). This function coerces text strings using IDNA encoding --- see
L{encodings.idna}.
Note that DNS is I{case insensitive} but I{ca... | 625941cb5fc7496912cc3a54 |
@fill_doc <NEW_LINE> def smooth_img(imgs, fwhm): <NEW_LINE> <INDENT> if hasattr(imgs, "__iter__") and not isinstance(imgs, str): <NEW_LINE> <INDENT> single_img = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> single_img = True <NEW_LINE> imgs = [imgs] <NEW_LINE> <DEDENT> ret = [] <NEW_LINE> for img in imgs: ... | Smooth images by applying a Gaussian filter.
Apply a Gaussian filter along the three first dimensions of `arr`.
In all cases, non-finite values in input image are replaced by zeros.
Parameters
----------
imgs : Niimg-like object or iterable of Niimg-like objects
Image(s) to smooth (see
http://nilearn.github.i... | 625941cb71ff763f4b549761 |
def append_to_slug(slug): <NEW_LINE> <INDENT> return "{slug}_{randchar}".format( slug=slug, randchar=random_string_generator(size=1, chars=string.digits)) | append to the back of the slug with a underscore between
:param slug: is a string
:return: modified slug | 625941cb796e427e537b069c |
def with_polymorphic(base, classes, selectable=False, flat=False, polymorphic_on=None, aliased=False, innerjoin=False, _use_mapper_path=False): <NEW_LINE> <INDENT> primary_mapper = _class_to_mapper(base) <NEW_LINE> mappers, selectable = primary_mapper. _with_polymorphic_args(classes, selectable, inne... | Produce an :class:`.AliasedClass` construct which specifies
columns for descendant mappers of the given base.
.. versionadded:: 0.8
:func:`.orm.with_polymorphic` is in addition to the existing
:class:`.Query` method :meth:`.Query.with_polymorphic`,
which has the same purpose but is not as flexible in its u... | 625941cbdc8b845886cb560b |
def __init__(self, axes): <NEW_LINE> <INDENT> self.axes = axes <NEW_LINE> self.channels = [] <NEW_LINE> self.lines = {} | Create a new C{StripCharter} associated with a matplotlib C{axes}. | 625941cb56b00c62f0f1472f |
def get_queryset(self): <NEW_LINE> <INDENT> return Strategy.objects.order_by('code') | 返回 | 625941cbbd1bec0571d90706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.