code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def has_terminated(self): <NEW_LINE> <INDENT> gen = self.generator <NEW_LINE> return gen is None or gen.gi_frame is None | Check if the wrapped generator has terminated. | 625941dfa4f1c619b28b039a |
def index(request): <NEW_LINE> <INDENT> anos = [x for x in reversed(range(2000, (datetime.datetime.now().year)+20))] <NEW_LINE> choices = Oferta.OFERTA_TRIMESTRE_CHOICES <NEW_LINE> context = { 'anos': anos, 'choices': choices, 'pagename': 'Ofertas' } <NEW_LINE> return render(request, 'oferta/index.html', context) | Esta es la unica peticion que hace el navegador directamente.
El resto es puro AJAX. | 625941df3cc13d1c6d3c76e2 |
def RequestAssociation(self, remoteAE): <NEW_LINE> <INDENT> assoc = Association(self, RemoteAE=remoteAE, AssociateRequestTimeout=self.AssociateRequestTimeout) <NEW_LINE> while not assoc.AssociationEstablished and not assoc.AssociationRefused and not assoc.DUL.kill: <NEW_LINE> <INDENT> time.sleep(0.1) <NE... | Requests association to a remote application entity | 625941df29b78933be1e5a10 |
def has_table(self, connection, table_name, schema=None): <NEW_LINE> <INDENT> if schema is None: <NEW_LINE> <INDENT> schema = self.get_default_schema_name(connection) <NEW_LINE> <DEDENT> table = connection.connection.connection.tables(schema, table_name) <NEW_LINE> has_it = table is not None and len(table) ... | Inputs: - sqlalchemy.engine.base.Connection object has a <connection> reference
to sqlalchemy.pool._ConnectionFairy which has a <connection> reference
to sqlalchemy.databases.ibm_db_dbi.Connection, the actual DBAPI
driver connection handler
- table_name string
- schema stri... | 625941dfd4950a0f3b08c6b3 |
def _make_filter_class(expected_strings): <NEW_LINE> <INDENT> class nooplogfilter(object): <NEW_LINE> <INDENT> records_silenced = 0 <NEW_LINE> @classmethod <NEW_LINE> def filter(cls, record): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> class logfilter(object): <NEW_LINE> <INDENT> records_silenced = 0 <... | Builds an anon-ish filtering class and returns it.
Returns a logfilter if filtering should take place, otherwise a nooplogfilter.
We're just using a class here as a one-off object with a filter method, for
use as a filter object on the desired log. | 625941df3539df3088e2e6b3 |
def redraw_statusside(self, lock=True): <NEW_LINE> <INDENT> if lock: <NEW_LINE> <INDENT> self.lock.acquire() <NEW_LINE> <DEDENT> self.win_statusside.clear() <NEW_LINE> if self.status: <NEW_LINE> <INDENT> for i, text in enumerate(self.status.split('\n')): <NEW_LINE> <INDENT> self.win_statusside.addstr(i, 0, text) <NEW_L... | Redraw the statusside | 625941df07d97122c4178bfb |
def to_dict(self): <NEW_LINE> <INDENT> return {k: getattr(self, k) for k in dir(self) if is_config_attr(self, k)} | Get the configuration values of this config object as a dict.
Returns:
dict[str, any]: The configuration values of this config object. | 625941df377c676e91272510 |
def getHarvestData(self): <NEW_LINE> <INDENT> if self.stopped: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> query = self.getParamString() <NEW_LINE> getRequest = Request(self.harvestInfo['uri'] + query) <NEW_LINE> try: <NEW_LINE> <INDENT> self.firstCall = False <NEW_LINE> self.setStatus("HARVESTING", "getting data ur... | requests a set of "maxRecords" (100) until there are no more records to be retrieved
:return:
:rtype: | 625941df8a43f66fc4b543ca |
def create_dummy_variables(self): <NEW_LINE> <INDENT> def update_feature_list(dummy_name, dummy_values, all_features): <NEW_LINE> <INDENT> complete_features = all_features[:] <NEW_LINE> for f in all_features: <NEW_LINE> <INDENT> if f == dummy_name: <NEW_LINE> <INDENT> complete_features = complete_features + dummy_value... | dummy categorical columns need to be listed before their interaction with other columns
:return: | 625941dfa79ad161976cc4af |
def download_started(self, command): <NEW_LINE> <INDENT> self.files_downloading.append(command) <NEW_LINE> self.queued_commands.add(command) | A download just started. | 625941dfd7e4931a7ee9e288 |
def test_get_security_price_technicals_dc(self): <NEW_LINE> <INDENT> pass | Test case for get_security_price_technicals_dc
Donchian Channel # noqa: E501 | 625941dfb830903b967e9c71 |
def __init__(self, catalog, tpwcs, name=None, group_id=None, meta={}): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.group_id = group_id <NEW_LINE> self._catalog = None <NEW_LINE> self._bb_radec = None <NEW_LINE> self.img_bounding_ra = None <NEW_LINE> self.img_bounding_dec = None <NEW_LINE> self.meta = dict(meta... | Parameters
----------
catalog: astropy.table.Table
Source catalog associated with an image. Must contain ``'x'`` and
``'y'`` columns which indicate source coordinates (in pixels) in
the associated image.
tpwcs: TPWCS
``TPWCS``-derived tangent-plane WCS corrector object associated
with the image fro... | 625941dfc432627299f04fb1 |
def output_signature(self): <NEW_LINE> <INDENT> return _gnuradio_core_io.gr_udp_source_sptr_output_signature(self) | output_signature(self) -> gr_io_signature_sptr | 625941df92d797404e3044f4 |
def t_newline(self, t): <NEW_LINE> <INDENT> t.lexer.lineno += len(t.value) <NEW_LINE> t.type = "NEWLINE" <NEW_LINE> if self.is_outside_brackets(): <NEW_LINE> <INDENT> return t | \n+ | 625941df3617ad0b5ed6825f |
def changes(self, **opts:{str:object}) -> dict: <NEW_LINE> <INDENT> if opts.get('feed') == 'continuous': <NEW_LINE> <INDENT> return self._streamingChanges(**opts) <NEW_LINE> <DEDENT> response = self.resource.getJson('_changes', **opts) <NEW_LINE> return response.data['last_seq'], response.data['results'] | Retrieve a changes feed from the database.
The options available are documented at `CouchDB HTTP API - Changes
<http://wiki.apache.org/couchdb/HTTP_database_API#Changes>`_
A **changes dictionary** has the following fields:
* ``seq`` -- The sequence number of the particular change.
* ``id`` -- The ID of the changed... | 625941df711fe17d825426cd |
def FBColor(self): <NEW_LINE> <INDENT> pass | Constructor. | 625941df6fb2d068a760f40b |
def test_find_negative(self): <NEW_LINE> <INDENT> depth_first = DepthFirstAlgorithm(self.graph) <NEW_LINE> self.assertIsNone( depth_first.find('Z') ) | Es sollte None zurück geben, wenn der Eintrag nicht
gefunden werden kann. | 625941df2ae34c7f2600d49a |
@pytest.fixture(scope='session') <NEW_LINE> def session_master_of_masters_prod_env_state_tree_root_dir(session_master_of_masters_state_tree_root_dir): <NEW_LINE> <INDENT> dirname = session_master_of_masters_state_tree_root_dir.join('prod') <NEW_LINE> dirname.ensure(dir=True) <NEW_LINE> return dirname | Fixture which returns the salt prod environment state tree directory path.
Creates the directory if it does not yet exist. | 625941df5fc7496912cc3ce7 |
def get_new_image_composed(intensities_im, probas_original): <NEW_LINE> <INDENT> n_components = probas_original.shape[1] <NEW_LINE> new_image_composed = np.zeros(intensities_im[0].shape) <NEW_LINE> for k in range(n_components): <NEW_LINE> <INDENT> new_image_composed = new_image_composed + probas_original[:, k] * intens... | Compose the new image (brain)
:param intensities_im: image intensities for the new components
:param probas_original: initial probabilities for each component (as predicted by the GMM model)
:return new_image_composed: new image after augmentation (skull stripped) | 625941df091ae356686672c2 |
def getAccountNumbers(self, customerId): <NEW_LINE> <INDENT> self.send_getAccountNumbers(customerId) <NEW_LINE> return self.recv_getAccountNumbers() | Parameters:
- customerId | 625941df15baa723493c42e1 |
def access(self, obj): <NEW_LINE> <INDENT> pass | Returns description of the accessibility of the article.
If the article is accessible to Google News readers without a registration or subscription,
this function should return None
Options are::
* Subscription (visible): an article which prompts users to pay to view content.
* Registration (visible): an arti... | 625941dfa17c0f6771cbe3b9 |
def difference( list1: List[PhonemeFeature], list2: List[PhonemeFeature] ) -> List[Tuple[Optional[PhonemeFeature], Optional[PhonemeFeature]]]: <NEW_LINE> <INDENT> return [ binary_difference(SyllabicFeature, list1, list2), binary_difference(ConsonantalFeature, list1, list2), binary_difference(SonorantFeature, list1, lis... | This function takes two lists of phoneme features
and returns how they differ. Any phonemic
feature present in one list, and absent in the other
will be represented; and any phonemic
feature that is positive in one list but absent
in the other will be represented. | 625941df851cf427c661a875 |
def sortIndividuals(self, infoFields: 'stringList', reverse: 'bool'=False) -> "void": <NEW_LINE> <INDENT> return _simuPOP_baop.Population_sortIndividuals(self, infoFields, reverse) | Usage:
x.sortIndividuals(infoFields, reverse=False)
Details:
Sort individuals according to values at specified information
fields (infoFields). Individuals will be sorted at an increasing
order unless reverse is set to true. | 625941df0a366e3fb873eb86 |
def GetFullyConnected(self): <NEW_LINE> <INDENT> return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetFullyConnected(self) | GetFullyConnected(self) -> bool | 625941df56b00c62f0f149c5 |
def __create_dummy_pic_response__(): <NEW_LINE> <INDENT> red = Image.new('RGBA', (128, 128), (255, 0, 0, 0)) <NEW_LINE> response = HttpResponse(content_type="image/jpeg") <NEW_LINE> red.save(response, "JPEG") <NEW_LINE> return response | Creates a red dummy image, if read from disk fails, but image should be available.
:return: | 625941df596a897236089e26 |
def get_backbone(list_of_lines): <NEW_LINE> <INDENT> list_of_lines=list(list_of_lines) <NEW_LINE> backbone = [] <NEW_LINE> for line in list_of_lines: <NEW_LINE> <INDENT> if line['ATOM'] == "ATOM ": <NEW_LINE> <INDENT> if line['name'] in (' N ', ' CA ', ' C '): <NEW_LINE> <INDENT> backbone.append([line['x'], line['y'... | Gets the N, CA, C backbone of the pdb file | 625941df009cb60464c63719 |
def test_scatter(self): <NEW_LINE> <INDENT> scatter = Tree(EXAMPLES + "scatter").find("/object") <NEW_LINE> assert(len(list(scatter.climb())) == 1) <NEW_LINE> assert(scatter.data['one'] == 1) <NEW_LINE> assert(scatter.data['two'] == 2) <NEW_LINE> assert(scatter.data['three'] == 3) | Scattered files | 625941df21a7993f00bc805f |
def _get_cache_stats(server_name=None): <NEW_LINE> <INDENT> server_info = {} <NEW_LINE> for svr in mc_client.get_stats(): <NEW_LINE> <INDENT> svr_info = svr[0].split(' ') <NEW_LINE> svr_name = svr_info[0] <NEW_LINE> svr_stats = svr[1] <NEW_LINE> svr_stats['bytes_percent'] = _percent(svr_stats, 'bytes', 'limit_maxbytes'... | Get stats info. | 625941df3617ad0b5ed68260 |
def createType(): <NEW_LINE> <INDENT> creator.create("FitnessMax", base.Fitness, weights=(1.0,)) <NEW_LINE> creator.create("Individual", list, fitness=creator.FitnessMax) | # Creating appropriate type
:return: | 625941df4c3428357757c690 |
def is_valid(bd: List[int]) -> bool: <NEW_LINE> <INDENT> return is_row_valid(bd) and is_column_valid(bd) and is_square_valid(bd) | Checks if board is valid(no duplicates in row, column, or square)
Args:
bd: list of values in a sudoku board organized by rows
Returns:
True if the board is valid, False if it violates a rule | 625941dfac7a0e7691ed4430 |
def __repr__(self): <NEW_LINE> <INDENT> return 'DateRange({start} to {end})'.format(start=self.start, end=self.end) | Representation for DateRange objects. | 625941df99fddb7c1c9de6f9 |
def means_cluster(vectors, noofclusters): <NEW_LINE> <INDENT> noofclusters = int(noofclusters) <NEW_LINE> assert noofclusters < len(vectors) <NEW_LINE> dim = len(vectors[0]) <NEW_LINE> vector_indices = list(range(len(vectors))) <NEW_LINE> shuffle(vector_indices) <NEW_LINE> graph = tf.Graph() <NEW_LINE> with graph.as_de... | K-Means Clustering using TensorFlow.
'vectors' should be a n*k 2-D NumPy array, where n is the number
of vectors of dimensionality k.
'noofclusters' should be an integer. | 625941df004d5f362079a69b |
def __init__(self, handler, sctp_client, keynodes): <NEW_LINE> <INDENT> self.handler = handler <NEW_LINE> self.user = handler.current_user <NEW_LINE> self.session_key = handler.get_secure_cookie("session_key") <NEW_LINE> self.sctp_client = sctp_client <NEW_LINE> self.keynodes = keynodes <NEW_LINE> self.sc_addr = None <... | Initialize session class with requets.user object
| 625941df38b623060ff0b157 |
def metalMass(self): <NEW_LINE> <INDENT> mM = 0 <NEW_LINE> for v, b in zip(self.elements.values(), self.elements.keys()): <NEW_LINE> <INDENT> if b.isMetal(): <NEW_LINE> <INDENT> mM += v <NEW_LINE> <DEDENT> <DEDENT> return mM | Return the total metal mass in the composition | 625941dff7d966606f6aa372 |
def DoPhotometryofNight(PC,night): <NEW_LINE> <INDENT> with open(os.path.join(PC.OUTDIR,night,PC.OUTFITSFILELIST),'r') as outfitsfilelist: <NEW_LINE> <INDENT> imgfilterlist = [tuple(imageLINE.rstrip().split()) for imageLINE in outfitsfilelist if ((imageLINE.strip() is not '') and (imageLINE[0] !='#'))] <NEW_LINE> <DEDE... | Does photometry of all images in the night as well as create the final magnitude catlog table | 625941dffbf16365ca6f6533 |
def delButton(self, name:str): <NEW_LINE> <INDENT> self.undrawButtons() <NEW_LINE> for i in range(len(self.buttons)): <NEW_LINE> <INDENT> if self.buttons[i].name == name: <NEW_LINE> <INDENT> self.buttons.pop(i) <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> self.drawButtons() | Deletes a button by name | 625941dfbf627c535bc13539 |
def add_tuplet_type(self, ttype): <NEW_LINE> <INDENT> etree.SubElement(self.current_notation, "tuplet", type=ttype) | Create tuplet with type attribute | 625941df8da39b475bd652e1 |
def _parse_interval_query(self, query): <NEW_LINE> <INDENT> pattern = r'chr(?P<chr>\w+):(?P<gstart>[0-9,]+)-(?P<gend>[0-9,]+)' <NEW_LINE> if query: <NEW_LINE> <INDENT> mat = re.search(pattern, query) <NEW_LINE> if mat: <NEW_LINE> <INDENT> d = mat.groupdict() <NEW_LINE> if query.startswith('hg19.'): <NEW_LINE> <INDENT> ... | Check if the input query string matches interval search regex,
if yes, return a dictionary with three key-value pairs:
chr
gstart
gend
, otherwise, return None. | 625941df3c8af77a43ae3b0d |
def suppr_bad_chars(ligne): <NEW_LINE> <INDENT> accents = { 'a': ['à', 'ã', 'á', 'â'], 'e': ['é', 'è', 'ê', 'ë'], 'i': ['î', 'ï'], 'u': ['ù', 'ü', 'û'], 'o': ['ô', 'ö'] } <NEW_LINE> """ Iteration pour supprimer les accents """ <NEW_LINE> for (char, accented_chars) in accents.iteritems(): <NEW_LINE> <INDENT> for accente... | Tableau des accents | 625941df26068e7796caf04d |
def RestoreCtrlValue(self, obj, keyName): <NEW_LINE> <INDENT> if self._style & PM_PERSIST_CONTROL_VALUE: <NEW_LINE> <INDENT> return self.DoRestoreValue(obj, keyName) | Check if we persist the widget value, if so pass it to :meth:`~PersistenceManager.DoRestoreValue`.
:param `obj`: an instance of :class:`PersistentObject`;
:param `keyName`: a string specifying the key name. | 625941df55399d3f05588a1f |
def for_all_parents(path, func): <NEW_LINE> <INDENT> d = os.path.dirname(path) <NEW_LINE> while d != "": <NEW_LINE> <INDENT> func(d) <NEW_LINE> d = os.path.dirname(d) | Invoke func for each parent path. | 625941dfe8904600ed9f229b |
def __init__(self, py_dict=None): <NEW_LINE> <INDENT> super(ArpEntrySchema, self).__init__() <NEW_LINE> self.protocol = None <NEW_LINE> self.address = None <NEW_LINE> self.hardwareaddr = None <NEW_LINE> self.type = None <NEW_LINE> self.interface = None <NEW_LINE> if py_dict is not None: <NEW_LINE> <INDENT> self.get_obj... | Constructor to create ArpEntrySchema object
| 625941df6fece00bbac2daac |
def to_field(self, value): <NEW_LINE> <INDENT> value = value.strip() <NEW_LINE> if value.startswith('$'): <NEW_LINE> <INDENT> value = value[1:].strip() <NEW_LINE> <DEDENT> if not value: <NEW_LINE> <INDENT> return pform.null <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return decimal.Decimal(value) <NEW_LINE> <DEDENT> e... | This method convert html form value into internal format.
`value` is the result of `Field.extract()` method. For this
field we checks if input value contains '$' prefix and removes it. | 625941df4f88993c3716c3ce |
def argsFetch(): <NEW_LINE> <INDENT> import argparse <NEW_LINE> parser = argparse.ArgumentParser(description='These scripts will initialize the Database for the district and populate relevant details') <NEW_LINE> parser.add_argument('-v', '--visible', help='Make the browser visible', required=False, action='store_const... | Paser for the argument list that returns the args list | 625941dfaad79263cf390db0 |
def __init__(self, hidden_dims, input_dim=3*32*32, num_classes=10, dropout=0, use_batchnorm=False, reg=0.0, weight_scale=1e-2, dtype=np.float32, seed=None): <NEW_LINE> <INDENT> self.use_batchnorm = use_batchnorm <NEW_LINE> self.use_dropout = dropout > 0 <NEW_LINE> self.reg = reg <NEW_LINE> self.num_layers = 1 + len(hid... | Initialize a new FullyConnectedNet.
Inputs:
- hidden_dims: A list of integers giving the size of each hidden layer.
- input_dim: An integer giving the size of the input.
- num_classes: An integer giving the number of classes to classify.
- dropout: Scalar between 0 and 1 giving dropout strength. If dropout=0 then
th... | 625941df63b5f9789fde7450 |
def __get_all_fields_selection_list(self, depth, trail, typename): <NEW_LINE> <INDENT> selections = SelectionList(self.__field__.type) <NEW_LINE> selections.__select_all__(depth, trail, typename, typename) <NEW_LINE> return selections | Create a new SelectionList, select all fields and return it | 625941dfab23a570cc2504ef |
def _check_down(self, position): <NEW_LINE> <INDENT> idx, idx2 = position <NEW_LINE> try: <NEW_LINE> <INDENT> down = self.table[idx+1][idx2] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return down < self.table[idx][idx2] | Check if the item is larger than the down one. | 625941df4e696a04525c97b6 |
def main(): <NEW_LINE> <INDENT> print(compare(1, 1)) <NEW_LINE> print(compare(1, 2)) <NEW_LINE> print(compare(2, 1)) <NEW_LINE> print(hypotenuse(1, 1)) <NEW_LINE> print(hypotenuse(3, 4)) <NEW_LINE> print(hypotenuse(1.2, 12)) <NEW_LINE> print(is_between(1, 2, 3)) <NEW_LINE> print(is_between(2, 1, 3)) <NEW_LINE> print(is... | Your functions will be called within this function. | 625941dfa8370b7717052c08 |
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(robot_ApproachResponse, self).__init__(*args, **kwds) <NEW_LINE> if self.ret is None: <NEW_LINE> <INDENT> self.ret = 0 <NEW_LINE> <DEDENT> if self.msg is None: <NEW_LINE> <INDENT> self.msg = '' <NEW_LINE> <DEDENT> <DEDENT>... | 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:
ret,msg
:param args: complete set... | 625941df8e05c05ec3eea6e2 |
def standardize_scores_permutations_old( genes_scores_permutations=None ): <NEW_LINE> <INDENT> dip = calculate_mean_deviation_scores_permutations( measure="dip", genes_scores_permutations=genes_scores_permutations, ) <NEW_LINE> mixture = calculate_mean_deviation_scores_permutations( measure="mixture", genes_scores_perm... | Calculates standard values of scores and permutations of the primary
bimodality measures.
There are two reasonable ways to standard bimodality measures.
1. standardize relative to each gene
- use mean and standard deviation from that gene
2. standardize relative to each measure across all genes
- use mean and standard... | 625941df7c178a314d6ef7cf |
def show_window_button_pressed(self, window): <NEW_LINE> <INDENT> window.show() <NEW_LINE> window.raise_() | show and close window when show button is pressed | 625941df8a349b6b435e84dd |
def convolve(unit, nb_plan): <NEW_LINE> <INDENT> weight = flip(nb_plan) <NEW_LINE> padding = weight.shape[-1] - 1 <NEW_LINE> length = unit.shape[-1] <NEW_LINE> return conv1d(unit.unsqueeze(0), weight.unsqueeze(0), padding=padding) .squeeze().narrow(-1, 0, length) | convolution of nb_plan over unit, used in calcultion of new buisiness
| 625941df44b2445a339323fe |
def plot_hill(grid, filename=None, array=None): <NEW_LINE> <INDENT> rock = '#5F594D' <NEW_LINE> sed = '#A4874B' <NEW_LINE> sky = '#D0E4F2' <NEW_LINE> mob = '#D98859' <NEW_LINE> clist = [sky, mob, mob, mob, mob, mob, mob, sed, rock] <NEW_LINE> my_cmap = mpl.colors.ListedColormap(clist) <NEW_LINE> if array is None: <NEW_... | Generate a plot of the modeled hillslope. | 625941df7b180e01f3dc4b61 |
def read_security_groups(self, element): <NEW_LINE> <INDENT> groups = [] <NEW_LINE> for e in element.iterfind('groups/group'): <NEW_LINE> <INDENT> groups.append(self.read_security_group(e)) <NEW_LINE> <DEDENT> return groups | Reads workflow security groups data out of the given xml element.
:param element: The xml element which holds information
about project workflow transitions.
:return: Returns the workflow transitions. | 625941df1f037a2d8b946568 |
def get_last_count(self, event_id: str, interval: str) -> Union[int, None]: <NEW_LINE> <INDENT> key = create_redis_key(self.group_name, interval, False, event_id) <NEW_LINE> return self._get_redis_value(key) | Return *last* counter state in given reset interval of given event_id.
:param event_id: Name of the event
:param interval: Interval specification
:return: int (None if given event_id or interval is not present in Redis) | 625941df31939e2706e4d1d0 |
def plot_uncertainty_decomposition(self, m: int = 0, n: int = 0): <NEW_LINE> <INDENT> if self.name is not None: <NEW_LINE> <INDENT> plt.title(r'Uncertainty Decomposition: %s $S_{%i%i}$'%(self.name,m,n)) <NEW_LINE> <DEDENT> self.std_s.plot_s_mag(label='Distance', m=m,n=n) <NEW_LINE> self.std_s_re.plot_s_mag(label='Real'... | Plot the total and component-wise uncertainty.
Parameters
----------
m : int
first s-parameters index
n :
second s-parameter index | 625941df6e29344779a6297a |
def index_of(self, _x): <NEW_LINE> <INDENT> if self._l.contains(_x): <NEW_LINE> <INDENT> return self._l.index(_x) <NEW_LINE> <DEDENT> return -1 | Return index of item x if item x is in collection | 625941df9f2886367277abf6 |
def get_insertion_point_list(self): <NEW_LINE> <INDENT> result = [] <NEW_LINE> sizer_items = self.sizer.Children <NEW_LINE> for i, item in enumerate(sizer_items): <NEW_LINE> <INDENT> item = item.GetWindow() <NEW_LINE> if item.IsShown(): <NEW_LINE> <INDENT> result.append((i, item, item.GetPosition()[1])) <NEW_LINE> <DED... | get a list of items and their position in the sizer | 625941df2eb69b55b151cc1e |
def gradF(self, T): <NEW_LINE> <INDENT> gradient = PVector(1) <NEW_LINE> gradient.array[0] = self.n * exp(T.array[0]) / (1 + exp(T.array[0])) <NEW_LINE> gradient.type_ = TYPE.EXPECTATION_PARAMETER <NEW_LINE> return gradient | generated source for method gradF | 625941df4428ac0f6e5bab5f |
def _windows_iqn(): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> wmic = salt.utils.path.which('wmic') <NEW_LINE> if not wmic: <NEW_LINE> <INDENT> return ret <NEW_LINE> <DEDENT> namespace = r'\\root\WMI' <NEW_LINE> mspath = 'MSiSCSIInitiator_MethodClass' <NEW_LINE> get = 'iSCSINodeName' <NEW_LINE> cmdret = __salt__['cmd.run_... | Return iSCSI IQN from a Windows host. | 625941df6aa9bd52df037110 |
def setup_parser(self, parser: argparse.ArgumentParser) -> None: <NEW_LINE> <INDENT> parser.description = ( "view or modify DF variables as JSON documents. Strings are " "encoded/decoded from their internal byte representation using " "latin1 encoding." ) <NEW_LINE> parser.add_argument("object") <NEW_LINE> parser.add_a... | Read CLI arguments | 625941dfd8ef3951e32438a8 |
def integrate_plugins(): <NEW_LINE> <INDENT> from airflow.plugins_manager import ( admin_views, flask_blueprints, menu_links) <NEW_LINE> for v in admin_views: <NEW_LINE> <INDENT> admin.add_view(v) <NEW_LINE> <DEDENT> for bp in flask_blueprints: <NEW_LINE> <INDENT> print(bp) <NEW_LINE> app.register_blueprint(bp) <NEW_LI... | Integrate plugins to the context | 625941df3d592f4c4ed1d3cf |
def clean_image(self, img): <NEW_LINE> <INDENT> raise NotImplementedError | :param numpy.array img: frame of video
:return numpy.array cleaned: cleaned image, ready to run through OCR | 625941df24f1403a92600ece |
def Oblique(self, axis, angle1, angle2): <NEW_LINE> <INDENT> None | axis = 'X' or 'Y' or 'Z'
angle1, angle2 : degree (right-handed system)
transfer pulse_GX, pulse_GY, pulse_GZ, to oblique plane | 625941df0a50d4780f6671ff |
def load_and_validate(path, constraints=set()): <NEW_LINE> <INDENT> pairs = [] <NEW_LINE> ids_found = set() <NEW_LINE> with open(path) as f: <NEW_LINE> <INDENT> for i, line in enumerate(f): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> idx, label = line.strip().split('\t') <NEW_LINE> if label not in LABELS: <NEW_LINE> <... | Validate list of triage classifications from filename.
Load into a list of pairs. | 625941df8e7ae83300e4b338 |
def drawPixel(x, y, color): <NEW_LINE> <INDENT> assert isinstance(x, int) and isinstance(y, int) and isinstance(color, str) <NEW_LINE> canvas.create_rectangle(x, y, x + 1, y + 1, width = 0, fill = color) | Color the pixel at coordinates (x, y). | 625941df656771135c3ebbdd |
def to_number(value): <NEW_LINE> <INDENT> if isinstance(value, timedelta): <NEW_LINE> <INDENT> return value.total_seconds() <NEW_LINE> <DEDENT> return value | Convert a timedelta to seconds, leaving other values untouched. | 625941df8a349b6b435e84de |
def put_parameters(self, parameters): <NEW_LINE> <INDENT> key_id = 'alias/{}'.format(self.confetti_key) <NEW_LINE> description = self.confetti_key <NEW_LINE> message = '{}: {}: {}' <NEW_LINE> logger = self.get_logger() <NEW_LINE> kms = self.session.client('kms') <NEW_LINE> ssm = self.session.client('ssm') <NEW_LINE> km... | Put parameters to AWS Systems Manager parameter store.
Ensures the following:
- the encryption key exists
- parameter names are prefixed with the path
- secure parameters use the correct key
:param parameters: the list of parameters
:type parameters: list | 625941dff8510a7c17cf9a69 |
def test_extended_bodyclass_template_change_form(self): <NEW_LINE> <INDENT> response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit) <NEW_LINE> self.assertContains(response, 'bodyclass_consistency_check ') | Ensure that the admin/change_form.html template uses block.super in the
bodyclass block. | 625941dfbd1bec0571d90999 |
def _expand(self): <NEW_LINE> <INDENT> row, col = u_grid.to_row_col(self.grid, self.best.idd) <NEW_LINE> idds = u_grid.get_neighbors(self.grid, row, col) <NEW_LINE> children = {Node(x) for x in idds} - self.closed <NEW_LINE> for child in sorted(children): <NEW_LINE> <INDENT> if self.opened.contains(child): <NEW_LINE> <... | =======================================================================
Description: Expand the Best Node's Children.
======================================================================= | 625941df5f7d997b87174e06 |
@app.route('/database/stories/csv', methods=['GET']) <NEW_LINE> @login_required <NEW_LINE> def db_stories_csv(): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> rows = (str(s) for s in models.Story.query.order_by( models.Story.language_id).all()) <NEW_LINE> return '<br>'.join(rows) | Dump stories database as csv | 625941df7047854f462a1771 |
def __init__(self): <NEW_LINE> <INDENT> self._model = importutils.import_object(conf.MODEL_CLASS) <NEW_LINE> if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE: <NEW_LINE> <INDENT> self._master = False <NEW_LINE> LOG.debug(_("Model %s manages state"), conf.MODEL_CLASS) <NEW_LINE> native_bulk_attr_name... | Loads the model class. | 625941dfaad79263cf390db1 |
def get_kls(agent, env, sess): <NEW_LINE> <INDENT> kls = np.ones((env.nS, env.nG)) <NEW_LINE> for g in range(env.nG): <NEW_LINE> <INDENT> for s in range(env.nS): <NEW_LINE> <INDENT> if s == env.goal_locs[g]: kl = -.5 <NEW_LINE> elif s in env.goal_locs: kl = -1 <NEW_LINE> else: kl = agent.get_kl(s, g, sess) <NEW_LINE> k... | Extracts action info array from agent. | 625941df07d97122c4178bfe |
def test_str(self): <NEW_LINE> <INDENT> output = "[{}] ({}) {}".format( self.p1.__class__.__name__, self.p1.id, self.p1.__dict__) <NEW_LINE> self.assertEqual(str(self.p1), output) | Testing string of obj | 625941dfc432627299f04fb3 |
def set_vol_for_all_audio_items(self, a_uid, a_vol, a_reverse=None, a_same_vol=False, a_old_vol=0): <NEW_LINE> <INDENT> f_uid = int(a_uid) <NEW_LINE> f_changed_any = False <NEW_LINE> assert False, "this needs to be reworked" <NEW_LINE> f_pysong = self.get_song() <NEW_LINE> for f_region_uid in f_pysong.regions.values():... | a_uid: wav_pool uid
a_vol: dB
a_reverse: None=All, True=reversed-only,
False=only-if-not-reversed | 625941dffff4ab517eb2f7a9 |
def select(parent_1: Tuple[str, float]) -> List[str]: <NEW_LINE> <INDENT> pop = [] <NEW_LINE> child_n = int(parent_1[1] * 100) + 1 <NEW_LINE> child_n = 10 if child_n >= 10 else child_n <NEW_LINE> for _ in range(child_n): <NEW_LINE> <INDENT> parent_2 = population_score[random.randint(0, N_SELECTED)][0] <NEW_LINE> child_... | Select the second parent and generate new population | 625941dfad47b63b2c50a2e9 |
def generate_group_lists(course_list): <NEW_LINE> <INDENT> group_lists = [] <NEW_LINE> generate_group_lists_helper(0, course_list, [], group_lists) <NEW_LINE> return group_lists | Picks a group from each class from which to pick sections. | 625941df099cdd3c635f0fc4 |
def StyleText(self, evt): <NEW_LINE> <INDENT> stc = evt.GetEventObject() <NEW_LINE> last_styled_pos = stc.GetEndStyled() <NEW_LINE> line = stc.LineFromPosition(last_styled_pos) <NEW_LINE> start_pos = stc.PositionFromLine(line) <NEW_LINE> end_pos = evt.GetPosition() <NEW_LINE> userXYZ = voiceToken = False <NEW_LINE> whi... | Handle the EVT_STC_STYLENEEDED event. | 625941df38b623060ff0b158 |
def test_one_limit(self): <NEW_LINE> <INDENT> fibs = fib(1) <NEW_LINE> next(fibs) <NEW_LINE> self.assertRaises(StopIteration, next, fibs) | Request a sequence with a limit of one element.
Ensure the generator is exhausted after reading that element. | 625941df099cdd3c635f0fc5 |
def _test_precision_recall_curve(): <NEW_LINE> <INDENT> y_true, _, probas_pred = make_prediction(binary=True) <NEW_LINE> p, r, thresholds = precision_recall_curve(y_true, probas_pred) <NEW_LINE> precision_recall_auc = auc(r, p) <NEW_LINE> assert_array_almost_equal(precision_recall_auc, 0.82, 2) | Test Precision-Recall and aread under PR curve | 625941df0383005118ecf94d |
def test_split_and_join(self): <NEW_LINE> <INDENT> tmp_dir = join( self.tmp_dir, 'NNTPSegmentedPost_Test.test_split_and_join', ) <NEW_LINE> assert(isdir(tmp_dir) is False) <NEW_LINE> assert(mkdir(tmp_dir) is True) <NEW_LINE> assert(isdir(tmp_dir) is True) <NEW_LINE> segobj = NNTPSegmentedPost( 'mytestfile', subject='wo... | Test the split() and join() functionality of a NNTPSegmentedPost | 625941df796e427e537b0933 |
def parse_shop_csv(): <NEW_LINE> <INDENT> logger.info("Parsing shops.csv") <NEW_LINE> df = utils.read_csv('shops.csv').copy() <NEW_LINE> df.loc[df.shop_name == 'Сергиев Посад ТЦ "7Я"', "shop_name"] = 'СергиевПосад ТЦ "7Я"' <NEW_LINE> df["shop_city"] = df.shop_name.str.split(" ").map(lambda x: x[0]) <NEW_LINE> df["shop_... | Calculates features from shop description [shop_city, shop_category]
Taken 99% from https://www.kaggle.com/gordotron85/future-sales-xgboost-top-3
:param train:
:return: | 625941df21bff66bcd684cba |
def _update_menu(self, *args): <NEW_LINE> <INDENT> self.remove_children() <NEW_LINE> designer = App.get_running_app().root <NEW_LINE> loader = None <NEW_LINE> if designer: <NEW_LINE> <INDENT> loader = designer.project_watcher._project_dir <NEW_LINE> <DEDENT> if loader: <NEW_LINE> <INDENT> self.disabled = False <NEW_LIN... | Update the Git ActionSubMenu content.
If a valid repo is open, git tools will be available.
Is not a git repo, git init is available. | 625941df3cc13d1c6d3c76e4 |
def test_username_change_maxlen_error(self): <NEW_LINE> <INDENT> username_data = {'new_username': 'kuhhahheriqwemniackolaxcivjkleqwerty'} <NEW_LINE> response = self.client.post( '/accounts/username/change/', username_data, follow=True ) <NEW_LINE> html_string = 'Ensure this value has at most 30 characters (it has 36).'... | New Username is longer than 30 characters | 625941dfd268445f265b51da |
def in_list(verifield, checklist): <NEW_LINE> <INDENT> return verifield in checklist | Checks whether an item is in a list of other items
:param verifield: Value of the field that is being validated
:param checklist: Acceptable values for the field
:type checklist: list
:returns: bool -- True if the verifield value exists in the checklist; otherwise, False | 625941dfd6c5a102081443b8 |
def test_validate_invalid_transition_result_symbol(self): <NEW_LINE> <INDENT> with nose.assert_raises(exceptions.InvalidSymbolError): <NEW_LINE> <INDENT> self.mntm1.transitions['q0'][("1", "#")] = [ ('q1', (('.', 'U'), ('#', 'R')))] <NEW_LINE> self.mntm1.validate() | Should raise error if a transition result symbol is invalid. | 625941df32920d7e50b2853e |
def p_unified_wstring_literal(self, p): <NEW_LINE> <INDENT> if len(p) == 2: <NEW_LINE> <INDENT> p[0] = vc_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] <NEW_LINE> p[0] = p[1] | unified_wstring_literal : WSTRING_LITERAL
| unified_wstring_literal WSTRING_LITERAL | 625941df283ffb24f3c55c69 |
def configure_app(app, args, oauth): <NEW_LINE> <INDENT> app.debug = args.debug <NEW_LINE> app.testing = args.testing <NEW_LINE> app.secret_key = urandom(64) <NEW_LINE> app.config["HOST"] = get_host(args) <NEW_LINE> app.config["APPLICATION_ROOT"] = get_app_url(args) <NEW_LINE> create_routes(app, oauth) | Configure the application's behavior | 625941df23e79379d52ee8cb |
def tree(self, rdir=None, init=True): <NEW_LINE> <INDENT> if init and rdir in ('.', None): <NEW_LINE> <INDENT> rdir = self.conn.pwd() <NEW_LINE> <DEDENT> tree = [] <NEW_LINE> tree.append((rdir, self.PATH_TYPE_DIR)) <NEW_LINE> dir_info = self.dir(rdir) <NEW_LINE> for info in dir_info: <NEW_LINE> <INDENT> attr = info[0] ... | recursively get the tree structure of a directory on FTP Server.
args:
rdir - remote direcotry path of the FTP Server.
init - flag showing whether in a recursion. | 625941df236d856c2ad44b4a |
def main(rootpath, outpath): <NEW_LINE> <INDENT> opt.check_dir(outpath) <NEW_LINE> today = opt.get_today_date() <NEW_LINE> try: <NEW_LINE> <INDENT> os.remove(PRESET_PATH + 'files.pk') <NEW_LINE> os.remove(PRESET_PATH + 'times.pk') <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT... | 主要用于自动化处理ROBS文件
输入参数
-------
rootpath : `str`
数据源的根路径,其末尾不带日期文件夹路径
outpath : `str`
数据保存路径,其末尾不带日期文件夹路径 | 625941dfac7a0e7691ed4431 |
@treeio_login_required <NEW_LINE> @handle_response_format <NEW_LINE> def tax_add(request, response_format='html'): <NEW_LINE> <INDENT> if not request.user.get_profile().is_admin('treeio.finance'): <NEW_LINE> <INDENT> return user_denied(request, message="You don't have administrator access to the Finance module") <NEW_L... | Tax add | 625941dfdd821e528d63b511 |
def Cortex_Exit(): <NEW_LINE> <INDENT> _Cortex_Exit = lib.Cortex_Exit <NEW_LINE> return _Cortex_Exit() | This function stops all activity of the SDK.
This function should be called once before exiting. | 625941dff548e778e58cd8ea |
def get_nodes(self): <NEW_LINE> <INDENT> nodes = [] <NEW_LINE> for node in self['substanzas']: <NEW_LINE> <INDENT> if isinstance(node, FieldsNode): <NEW_LINE> <INDENT> nodes.append(node) <NEW_LINE> <DEDENT> <DEDENT> return nodes | Return all nodes. | 625941df5e10d32532c5f290 |
def update(self, data) -> None: <NEW_LINE> <INDENT> X = np.zeros(shape=(self.state_vector_length, self.ensemble_size)) <NEW_LINE> if data.ndim == 1: <NEW_LINE> <INDENT> self.update_data_ensemble(data) <NEW_LINE> <DEDENT> elif data.ndim == 2: <NEW_LINE> <INDENT> self.data_ensemble = data <NEW_LINE> <DEDENT> else: <NEW_L... | Update filter with data provided.
Params:
data
Returns:
None | 625941df442bda511e8be77f |
def getResults(): <NEW_LINE> <INDENT> pass | Return a tuple describing the results of the step: (result,
strings). 'result' is one of the constants in
buildbot.status.builder: SUCCESS, WARNINGS, FAILURE, or SKIPPED.
'strings' is an optional list of strings that the step wants to
append to the overall build's results. These strings are usually
more terse than the ... | 625941dfe76e3b2f99f3ab72 |
def get_env(self): <NEW_LINE> <INDENT> env = super().get_env() <NEW_LINE> username = self.user.name <NEW_LINE> if self.local_home: <NEW_LINE> <INDENT> homepath = "/scratch/%s" %(username) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> homepath = self.eos_path_format.format(username = username) <NEW_LINE> <DEDENT> if not... | Set base environmental variables for swan jupyter docker image | 625941df4c3428357757c691 |
def _sample_nd_mixed_data(self, n, m, float_dtype): <NEW_LINE> <INDENT> samples0 = self._sample_cauchy_ppf(n) <NEW_LINE> samples2 = self._sample_normal_ppf(n) <NEW_LINE> mu = np.random.normal(size=m) <NEW_LINE> alpha = (np.random.uniform(size=m) > 0.5) * 2 <NEW_LINE> scale = np.exp(np.clip(np.random.normal(size=m), -3.... | `n` Samples from `m` scaled+shifted Cauchy and Normal distributions. | 625941dfcc0a2c11143dd1fc |
def centerOfMass(projections, data, comelem): <NEW_LINE> <INDENT> center_of_mass = np.zeros(projections) <NEW_LINE> temp = np.zeros(data.shape[3]) <NEW_LINE> temp2 = np.zeros(data.shape[3]) <NEW_LINE> for i in np.arange(projections): <NEW_LINE> <INDENT> temp = sum(data[comelem, i, :, :] - data[comelem, i, :10, :10].mea... | self.center_of_mass: center of mass vector
self.comelem: the element chosen for center of mass | 625941df3346ee7daa2b30d9 |
def acquire(self, blocking=True, timeout=-1): <NEW_LINE> <INDENT> blocking = bool(blocking) <NEW_LINE> self.check_args(blocking, timeout) <NEW_LINE> ask_time = time.time() <NEW_LINE> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._lock_socket.bind(self.socket_name) <NEW_LINE> self._locked = True <NEW_LIN... | Attempt to acquire the lock, returning True on success, False on failure. | 625941df5fdd1c0f98dc05a0 |
def swap(event, pfield_index_a, pfield_index_b): <NEW_LINE> <INDENT> a, b = get(event, pfield_index_a), get(event, pfield_index_b) <NEW_LINE> event = set(event, pfield_index_a, b) <NEW_LINE> event = set(event, pfield_index_b, a) <NEW_LINE> return event | Returns a new event string after swapping two pfield elements.
Example::
>>> event.swap('i 1 0 4 1.0 440 ; A440', 4, 5)
'i 1 0 4 440 1.0 ; A440'
.. note:: This currently will not swap pfield 0. Not sure if it
should, though throwing an error might be in order.
See :term:`event`, :term:`pfield_ind... | 625941df596a897236089e28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.