code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def get_info(): <NEW_LINE> <INDENT> return r.info() | Return stats on Redis server. | 625941be01c39578d7e74d67 |
def SetLambda(self, *args): <NEW_LINE> <INDENT> return _itkAreaOpeningImageFilterPython.itkAreaOpeningImageFilterIF3IF3_Superclass_SetLambda(self, *args) | SetLambda(self, double _arg) | 625941be2c8b7c6e89b356ef |
def test_linking(self): <NEW_LINE> <INDENT> for suffix in IMP.rmf.suffixes: <NEW_LINE> <INDENT> m = IMP.kernel.Model() <NEW_LINE> print("reading pdb") <NEW_LINE> h = IMP.atom.read_pdb(self.get_input_file_name("simple.pdb"), m, IMP.atom.NonAlternativePDBSelector()) <NEW_LINE> IMP.base.set_log_level(IMP.base.SILENT) <NEW... | Test that linking hierarchies works | 625941bed99f1b3c44c674c1 |
def reset_position_for_friends_image_details_from_voter(voter, twitter_profile_image_url_https, facebook_profile_image_url_https): <NEW_LINE> <INDENT> position_list_manager = PositionListManager() <NEW_LINE> position_manager = PositionManager() <NEW_LINE> stance_we_are_looking_for = ANY_STANCE <NEW_LINE> friends_vs_pub... | Reset all position image urls in PositionForFriends from we vote image details
:param voter:
:param twitter_profile_image_url_https:
:param facebook_profile_image_url_https:
:return: | 625941bef7d966606f6a9f2e |
def best_attribute(self,X,Y): <NEW_LINE> <INDENT> th, i, g = float('-inf'), 0, -1 <NEW_LINE> for j in range(X.shape[0]): <NEW_LINE> <INDENT> cur_th, cur_g = DT.best_threshold(X[j,:],Y) <NEW_LINE> if cur_g > g: <NEW_LINE> <INDENT> g = cur_g <NEW_LINE> th = cur_th <NEW_LINE> i = j <NEW_LINE> <DEDENT> <DEDENT> '''i, th = ... | Find the best attribute to split the node. The attributes have continous values (int/float).
Here we use information gain to evaluate the attributes.
If there is a tie in the best attributes, select the one with the smallest index.
Input:
X: the feature matrix, a numpy matrix of shape p by n.
Each element ... | 625941be23e79379d52ee493 |
def test_has_optimizer(self): <NEW_LINE> <INDENT> from django_static.templatetags.django_static import has_optimizer <NEW_LINE> settings.DJANGO_STATIC_YUI_COMPRESSOR = 'sure' <NEW_LINE> self.assertTrue(has_optimizer('css')) <NEW_LINE> del settings.DJANGO_STATIC_YUI_COMPRESSOR <NEW_LINE> self.assertEqual(has_optimizer('... | test the utility function has_optimizer(type) | 625941bed6c5a10208143f75 |
def get_config_paths(self): <NEW_LINE> <INDENT> paths = [] <NEW_LINE> conf_path = os.path.realpath( os.path.join(work_path, '..', '..', 'conf')) <NEW_LINE> if self.location is not None: <NEW_LINE> <INDENT> paths.append(self.location) <NEW_LINE> <DEDENT> if os.path.exists(conf_path): <NEW_LINE> <INDENT> paths.append(os.... | Get a list of config file paths.
The list is built taking into account of the OS, priority and location.
* running from source: /path/to/glances/conf
* per-user install: ~/.local/etc/glances (Unix-like only)
* Linux: ~/.config/glances, /etc/glances
* BSD: ~/.config/glances, /usr/local/etc/glances
* Mac: ~/Library/App... | 625941beff9c53063f47c121 |
def get_absolute_url(self): <NEW_LINE> <INDENT> return reverse('probecard-detail', args=[str(self.id)]) | Returns the url to access a detail record for this probecard. | 625941be435de62698dfdb78 |
def _get_value(self, key, func=None, split_val=None, as_boolean=False, exception_default=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if as_boolean: <NEW_LINE> <INDENT> return self.config.getboolean(key[0], key[1]) <NEW_LINE> <DEDENT> value = self.config.get(key[0], key[1]) <NEW_LINE> if split_val is not None: <... | Helper method to get a value from the config | 625941be283ffb24f3c55831 |
def runcommand(cmd): <NEW_LINE> <INDENT> p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) <NEW_LINE> errors = p.stderr.read() <NEW_LINE> result = p.stdout.read() <NEW_LINE> ret = p.wait() <NEW_LINE> if ret != 0: <NEW_LINE> <INDENT> raise Exception(errors) <NEW_LINE> <DEDENT> return ... | Returns the output of a command | 625941bed7e4931a7ee9de49 |
def test_return_array_pointer(self): <NEW_LINE> <INDENT> input = Program([FuncDecl(Id("foo"), [], ArrayPointerType(IntType()), Block([Return(CallExpr(Id("foo"), []))])), FuncDecl(Id("main"), [], VoidType(), Block([Return(ArrayCell(CallExpr(Id("foo"), []), IntLiteral(2)))]))]) <NEW_LINE> expect = "Type Mismatch In State... | int[] foo(){
return foo()[];
};
void main(){
return foo()[2]; // Error
} | 625941bef548e778e58cd4a9 |
def test_get_name(self): <NEW_LINE> <INDENT> expected_name = "CTE Tech Loan" <NEW_LINE> self.assertEquals(expected_name, cte_techloan.get_name()) | Tests that the name of the endpoint is correct (logging purposes) | 625941be91af0d3eaac9b943 |
def blame_in_xml(sbox): <NEW_LINE> <INDENT> sbox.build() <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> file_name = "iota" <NEW_LINE> file_path = os.path.join(wc_dir, file_name) <NEW_LINE> svntest.main.file_append(file_path, "Testing svn blame --xml\n") <NEW_LINE> expected_output = svntest.wc.State(wc_dir, { 'iota' : Item(... | blame output in XML format | 625941beeab8aa0e5d26da84 |
def tcumsum(self, dtype=None, out=None): <NEW_LINE> <INDENT> dtype = self.dtype if dtype is None else dtype <NEW_LINE> return process(t=self.t, x=self.cumsum(axis=0, dtype=dtype, out=out)) | Process exposing for each path and time point
the cumulative sum of process values along time. | 625941bebe7bc26dc91cd531 |
def log_request(self, r): <NEW_LINE> <INDENT> token = r.headers.get(self.header, None) <NEW_LINE> r.token = token <NEW_LINE> self.requests.append(r) <NEW_LINE> if r.token: <NEW_LINE> <INDENT> self.log.debug('[%s] %s', token or '/', r.url) | Log a request/response to the target Symfony.
Extract the token from the response (from the X-Debug-Token header).
Save it in the response and add the latter to self.requests for later reuse.
Log it with DEBUG level if a token is found.
:param r: request to log | 625941be6e29344779a62541 |
def process_cluster(self,message): <NEW_LINE> <INDENT> COMs = [] <NEW_LINE> cluster_array = ast.literal_eval(message.data) <NEW_LINE> for cluster in cluster_array[1:]: <NEW_LINE> <INDENT> xs = [c[0] for c in cluster] <NEW_LINE> ys = [c[1] for c in cluster] <NEW_LINE> com_x, com_y = sum(xs)/len(xs), sum(ys)/len(ys) <NEW... | receives an list of lists from the clustering node and processes
to determine where in the map to look for the target. The first list is
always a noise element and is not a clustered set of points. | 625941be1b99ca400220a9dd |
def trick_for_cartpole(done, reward): <NEW_LINE> <INDENT> if done: <NEW_LINE> <INDENT> return -100 <NEW_LINE> <DEDENT> return reward | trick for speed up cartpole training
if done, which means agent died, set negtive reward,
which help agent learn control method faster. | 625941be67a9b606de4a7de8 |
def fix_origin(self, a, b=None): <NEW_LINE> <INDENT> if b is not None: <NEW_LINE> <INDENT> P = Point(a, b) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> P = a <NEW_LINE> <DEDENT> I = P <NEW_LINE> F = P.translate(self.Dx, self.Dy) <NEW_LINE> s = Segment(I, F) <NEW_LINE> return s | Return the segment fixed at `P`. This is the translation
of `self` by `P-self`. In other words, it returns the
segment which is parallel to self trough the given point.
Typically it is used in the framework of affine vector..
INPUT:
- ``P`` - The point on which we want to "attach" the new segment.
or
- two numb... | 625941be236d856c2ad44703 |
def get_table(self): <NEW_LINE> <INDENT> return self.table | Return string self.table. | 625941be7b180e01f3dc472f |
def test_find_items(self): <NEW_LINE> <INDENT> search_attrs = GnomeKeyring.Attribute.list_new() <NEW_LINE> (result, items) = GnomeKeyring.find_items_sync( GnomeKeyring.ItemType.GENERIC_SECRET, search_attrs) <NEW_LINE> self.assertEqual(result, GnomeKeyring.Result.OK) <NEW_LINE> print('(no attributes: %i matches) ' % len... | find_items_sync() | 625941bea4f1c619b28aff6c |
def test_surrogate_escape(self): <NEW_LINE> <INDENT> result = uuid('scm', name="Mishal\udcc5 Pytasz") <NEW_LINE> self.assertEqual(result, '625166bdc2c4f1a207d39eb8d25315010babd73b') | Check if no errors are raised for invalid UTF-8 chars | 625941be293b9510aa2c31c5 |
def execute_query(self): <NEW_LINE> <INDENT> self.output = requests.get( url = self.request_url, params = self.request_params ) | This method should be the same for every interface. Run a pre-defined
query with appropriate error handling. | 625941be5fc7496912cc38ab |
def test_map_aggregate_sortop(self): <NEW_LINE> <INDENT> stmts = [CREATE_STMT2, "CREATE AGGREGATE a1 (integer) (" "SFUNC = f1, STYPE = integer, SORTOP = >)"] <NEW_LINE> dbmap = self.to_map(stmts) <NEW_LINE> expmap = {'sfunc': 'f1', 'stype': 'integer', 'sortop': 'pg_catalog.>'} <NEW_LINE> assert dbmap['schema public']['... | Map an aggregate with a SORTOP | 625941bef8510a7c17cf9628 |
@APP.route(api_v0_1('hello'), methods=['GET', 'POST']) <NEW_LINE> def hello(): <NEW_LINE> <INDENT> return jsonify(with_metadata("Hello, world!")) | Hello world endpoint | 625941bed8ef3951e324346a |
def find_volume_id_2(onclick): <NEW_LINE> <INDENT> m = ONCLICK_PATTERN.search(onclick) <NEW_LINE> if not m: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> if m.group("_id"): <NEW_LINE> <INDENT> return m.group("_id") <NEW_LINE> <DEDENT> return "" | Find book id from the given string. The string actually is javascript
function.
Regular expression version is slower than string find. | 625941be5510c4643540f318 |
def update(self, timestamp, msg, *args): <NEW_LINE> <INDENT> self.last_msg = msg <NEW_LINE> self.last_seen = timestamp <NEW_LINE> if msg == 'HELLO': <NEW_LINE> <INDENT> self.status = 'Initializing' <NEW_LINE> self.first_seen = timestamp <NEW_LINE> self.py_version = args[0] <NEW_LINE> self.abi = args[1] <NEW_LINE> self.... | Update the slave's state from an incoming reply message.
:param datetime.datetime timestamp:
The time at which the message was originally sent.
:param str msg:
The message itself.
:param *args:
Any arguments sent with the message. | 625941be507cdc57c6306c02 |
def set_path(self, config): <NEW_LINE> <INDENT> self.content_path = os.path.join(config.provenance_path, GIT_DATABASE_DIR) <NEW_LINE> self.base_path = os.path.abspath(config.base_path) | Set content path | 625941be96565a6dacc8f5fa |
def make_text_object(text, font, color): <NEW_LINE> <INDENT> surf = font.render(text, True, color) <NEW_LINE> return surf, surf.get_rect() | Creates a surf and rect from a text. | 625941be046cf37aa974cc77 |
def test_get_data_bad_download_on_unsupported_dataset_address_scheme_error(self): <NEW_LINE> <INDENT> product = EOProduct( self.provider, self.eoproduct_props, productType=self.product_type ) <NEW_LINE> product.driver = mock.MagicMock(spec_set=NoDriver()) <NEW_LINE> product.driver.get_data_address.side_effect = Unsuppo... | If downloader doesn't return the downloaded file path, get_data must return an empty array | 625941be099cdd3c635f0b8a |
def kronecker_graphs(i_matrix, n): <NEW_LINE> <INDENT> m = len(i_matrix) <NEW_LINE> k = int(math.log(n, m)) <NEW_LINE> for i in range(1, k): <NEW_LINE> <INDENT> size = m ** (i + 1) <NEW_LINE> if i == 1: <NEW_LINE> <INDENT> it_matrix = i_matrix <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> it_matrix = iter_matrix <NEW_L... | :param i_matrix: init matrix of begin.
:param n: iter num of the net work | 625941be0a366e3fb873e745 |
def _generateSpecial_ColourMapOpts_negativeCmap( overlayList, displayCtx, source, longArg): <NEW_LINE> <INDENT> return _generateColourMap(longArg, source.negativeCmap) | Generates arguments for the :attr:`.ColourMapOpts.negativeCmap`
argument. | 625941be3617ad0b5ed67e26 |
def get_ds_state(self) -> Tuple[List, List]: <NEW_LINE> <INDENT> processors_prefix_X = 0 <NEW_LINE> processors_in_def_state = 0 <NEW_LINE> X = self.find_cons_state(self.com_pref_states( self.number_of_nodes - 3 * self.number_of_byzantine)) <NEW_LINE> if X[0] == -1: <NEW_LINE> <INDENT> return X <NEW_LINE> <DEDENT> is_de... | Method description.
Returns a prefix if suggested by at least 2f+1 and at most 3f+1
processors, and if there exists another set with the default
replica state and these two sets adds up to at least 4f+1 processors.
State machine specific method. | 625941be91f36d47f21ac41d |
def get_failed(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Returns a list of failed jobs.
May return ``None`` if this is not supported by the backend. | 625941be596a8972360899f1 |
def hasMeasures(self): <NEW_LINE> <INDENT> sel = FreeCADGui.Selection.getSelection() <NEW_LINE> if not sel: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for o in sel: <NEW_LINE> <INDENT> if not o.isDerivedFrom("App::MeasureDistance"): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True | checks if only measurements objects are selected | 625941bedd821e528d63b0d8 |
def apply(self, expr, replacements, evaluation): <NEW_LINE> <INDENT> new_expr = expr.copy() <NEW_LINE> replacements = replacements.get_sequence() <NEW_LINE> for replacement in replacements: <NEW_LINE> <INDENT> if not replacement.has_form('Rule', 2) and not replacement.has_form('RuleDelayed', 2): <NEW_LINE> <INDENT> eva... | ReplacePart[expr_, {replacements___}] | 625941be92d797404e3040b7 |
def mean_iou(pred, target, num_classes, batch=None): <NEW_LINE> <INDENT> i, u = intersection_and_union(pred, target, num_classes, batch) <NEW_LINE> iou = i.to(torch.float) / u.to(torch.float) <NEW_LINE> iou[torch.isnan(iou)] = 1 <NEW_LINE> iou = iou.mean(dim=-1) <NEW_LINE> return iou | Computes the mean intersection over union score of predictions.
Args:
pred (LongTensor): The predictions.
target (LongTensor): The targets.
num_classes (int): The number of classes.
batch (LongTensor): The assignment vector which maps each pred-target
pair to an example.
:rtype: :class:`Tensor... | 625941bed8ef3951e324346b |
def getPerceptionSize(self): <NEW_LINE> <INDENT> return self.size | Assumes perception is square. This is the length of one edge | 625941bed164cc6175782c7b |
def to_dict(self): <NEW_LINE> <INDENT> ordered_groups = list(self.group_order) <NEW_LINE> groups_in_stack = list(self.parameter_groups.keys()) <NEW_LINE> ordered_groups += [g for g in groups_in_stack if g not in ordered_groups] <NEW_LINE> ordered_groups = [g for g in ordered_groups if g in groups_in_stack] <NEW_LINE> s... | Overwrite 'AWS::CloudFormation::Interface' key in self.metadata (if any)
with the groups and labels defined via add_parameter(), and then call
super().to_dict(). | 625941be44b2445a33931fc5 |
def nll2hdf5(nll_name, h5_name): <NEW_LINE> <INDENT> h5 = H5NllSingleGrid(h5_name, nll_name) <NEW_LINE> del h5 | Translates NLL files to hdf5 format.
:param nll_name: NLL filename without extension
:param h5_name: hdf5 filename | 625941be26068e7796caec08 |
def strip_output(nb): <NEW_LINE> <INDENT> nb.metadata.pop('signature', None) <NEW_LINE> for cell in _cells(nb): <NEW_LINE> <INDENT> if 'outputs' in cell: <NEW_LINE> <INDENT> cell['outputs'] = [] <NEW_LINE> <DEDENT> if 'prompt_number' in cell: <NEW_LINE> <INDENT> cell['prompt_number'] = None <NEW_LINE> <DEDENT> if 'exec... | strip the outputs from a notebook object | 625941be50485f2cf553ccc6 |
def create_snapshot(self, wtd_name, snapshot_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> wt_disk = self._get_wt_disk(wtd_name) <NEW_LINE> snap_id = self._conn_wmi.WT_Snapshot.Create(WTD=wt_disk.WTD)[0] <NEW_LINE> wt_snap = self._conn_wmi.WT_Snapshot(Id=snap_id)[0] <NEW_LINE> wt_snap.Description = snapshot_name ... | Driver entry point for creating a snapshot. | 625941be293b9510aa2c31c6 |
def movesToChessboard(self, board): <NEW_LINE> <INDENT> row_direction = self.process_one_direction(board) <NEW_LINE> if row_direction == -1: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> col_direction = self.process_one_direction(zip(*board)) <NEW_LINE> if col_direction == -1: <NEW_LINE> <INDENT> return -1 <NEW_LIN... | :type board: List[List[int]]
:rtype: int | 625941bee5267d203edcdbcd |
def follow_inputs(self, node, num, space=""): <NEW_LINE> <INDENT> val = [] <NEW_LINE> top = space == "" <NEW_LINE> if num == 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> val.append("{}{} {} {}".format(space, node.type, node.name, self.get_shape(node.name + ":0"))) <NEW_LINE> space += " " <NEW_LINE> for j in ... | Follow inputs for (helpful for debugging). | 625941beeab8aa0e5d26da85 |
def _call_GET(self, chunk, headers): <NEW_LINE> <INDENT> resp = None <NEW_LINE> parsed = urlparse(chunk.get('real_url', chunk['url'])) <NEW_LINE> try: <NEW_LINE> <INDENT> with WatchdogTimeout(self.watchdog, self.connection_timeout, ConnectionTimeout): <NEW_LINE> <INDENT> conn = io.http_connect( parsed.netloc, 'GET', pa... | Call GET on the chunk's real URL.
:returns: the response object (ready to read data) | 625941bebde94217f3682d21 |
def get_experiment_dataset_dir(self): <NEW_LINE> <INDENT> dataset_dir = self._get_experiment_dir() / 'datasets' <NEW_LINE> if not dataset_dir.exists(): <NEW_LINE> <INDENT> dataset_dir.mkdir(parents=True, exist_ok=True) <NEW_LINE> <DEDENT> return dataset_dir | :return: A directory for storing experiment-specific dataset configs. | 625941befff4ab517eb2f368 |
def getattr(self, obj, attribute): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = getattr(obj, attribute) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return obj[attribute] <NEW_LINE> <DEDENT> except (TypeError, LookupError): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> ... | Subscribe an object from sandboxed code and prefer the
attribute. The attribute passed *must* be a bytestring. | 625941becad5886f8bd26f08 |
def GetStatAttribute(self): <NEW_LINE> <INDENT> return self._GetStatAttribute() | Retrieves a stat attribute.
Returns:
StatAttribute: a stat attribute or None if not available. | 625941bed58c6744b4257b8e |
def complement(seq): <NEW_LINE> <INDENT> COMPLEMENT_TRANS = str.maketrans('TAGCtagc', 'ATCGATCG') <NEW_LINE> return seq.translate(COMPLEMENT_TRANS) | complement seq | 625941bef9cc0f698b14052b |
def delete_type(self, namespace_id, type_id): <NEW_LINE> <INDENT> if namespace_id is None: <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> if type_id is None: <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> response = requests.delete( self.url + self.__typesPath.format(tenant_id=self.tenantId, namespace... | Tells SDS Service to delete the type specified by 'type_id' | 625941be97e22403b379cec7 |
def getVIMFrameRate(self): <NEW_LINE> <INDENT> if not self.proxy: <NEW_LINE> <INDENT> self.proxy = ALProxy("ALVideoDevice") <NEW_LINE> <DEDENT> return self.proxy.getVIMFrameRate() | :returns int: | 625941be3cc13d1c6d3c72a9 |
def _is_writable(path): <NEW_LINE> <INDENT> return os.access(str(path), os.W_OK) | Tests whether path exists and is writable.
>>> Path('/usr/bin/python').is_writable()
False | 625941bf91f36d47f21ac41e |
def set_ConsumerKey(self, value): <NEW_LINE> <INDENT> super(FriendshipsLookupInputSet, self)._set_input('ConsumerKey', value) | Set the value of the ConsumerKey input for this Choreo. ((required, string) The API Key (or Consumer Key) provided by Twitter.) | 625941bf4428ac0f6e5ba71f |
def graficar_intensidad(self, x1=0, y1=0, x2=0, y2=0): <NEW_LINE> <INDENT> print ('La animación requiere la configuración: %matplolib qt') <NEW_LINE> print ('Puede volver al modo inline tipeando %matplolib inline') <NEW_LINE> if x1==0 & x2==0 & y1==0 & y2==0: <NEW_LINE> <INDENT> x0 = self._x0 <NEW_LINE> y0 = self._y0 <... | Método para analizar una linea de la imagen levantando el perfil
de intensidades de la misma en forma dinámica (ANIMACIÓN)
Parámetros
----------
<coords> :
coordenadas del análisis (por defecto las calibradas)
*algunas pueden ser ignoradas en función de respetar
la dirección de analisis configurada*
... | 625941bfd268445f265b4d9c |
def alarm_arm_away(self, code=None): <NEW_LINE> <INDENT> self._client.arm_away(self._location_id) | Send arm away command. | 625941bf627d3e7fe0d68d7c |
@reroute <NEW_LINE> def new(name): <NEW_LINE> <INDENT> return None | Creates a new visual layer
:param name: Name of hte layer to create
:type name: str
:return: Host Specific | 625941bfadb09d7d5db6c6bf |
def parse_project_type(headers, gef_type): <NEW_LINE> <INDENT> if isinstance(headers, dict): <NEW_LINE> <INDENT> if gef_type == "cpt": <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return first_header_value(headers, "PROJECTID", index=1) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return first_header_value... | Function that returns the project type as an int.
:param headers:(Union[Dict,str]) Dictionary or string of headers.
:param gef_type: (str) String from which the gef type is given.
:return: Project type number. | 625941bf956e5f7376d70d9d |
def peekMax(self): <NEW_LINE> <INDENT> while self.maxHeap and self.toPop_heap.get(self.maxHeap[0], 0): <NEW_LINE> <INDENT> x = heapq.heappop(self.maxHeap) <NEW_LINE> self.toPop_heap[x] -= 1 <NEW_LINE> <DEDENT> return -self.maxHeap[0][0] | :rtype: int | 625941bf63f4b57ef000104e |
def phi(self, x, y, z): <NEW_LINE> <INDENT> res = swdlib.swd_api_phi(self.obj, x, y, z) <NEW_LINE> return res | Calculates the velocity potential at the actual location. It is
assumed that the current time has been set using the method
:meth:`update_time`.
Parameters
----------
x, y, z : float
Position as defined in the application program [m]
Returns
-------
float
Velocity potential at (x,y,z) [m^2/s]
Raises
------
N... | 625941bf507cdc57c6306c03 |
def kind(self): <NEW_LINE> <INDENT> return self._bytes2str(self.__pairs[-1][0]) | Return the kind of the entity referenced.
This is the kind from the last (kind, id) pair. | 625941bf711fe17d8254229e |
def FindItem(self, name, index=None): <NEW_LINE> <INDENT> pass | FindItem(self: GH_IReader, name: str, index: int) -> GH_Item
Finds the first item that matches the given name and index.
Only items with index
qualifiers are considered.
Name comparisons are not case-sensitive.
name: Name of item to search for.
index: Index of ite... | 625941bf56ac1b37e6264102 |
def plot_marginal_latlon(filename, ds, origins, **kwargs): <NEW_LINE> <INDENT> _check(ds) <NEW_LINE> ds = ds.copy() <NEW_LINE> if issubclass(type(ds), DataArray): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> elif issubclass(type(ds), DataFrame): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LI... | Plots likelihood versus hypocenter location
.. rubric :: Input arguments
``filename`` (`str`):
Name of output image file
``ds`` (`DataArray` or `DataFrame`):
Data structure containing moment tensors and corresponding misfit values
``origins`` (`list` of `Origin` objects)
Origin objects corresponding to different hy... | 625941bf8e71fb1e9831d6d9 |
def new_rev_tum_aux(self, dni, tipo, v_so, v_new): <NEW_LINE> <INDENT> if not all([dni.get(),tipo.get()]): <NEW_LINE> <INDENT> messagebox.showerror(title='Error', message='Alguno de los campos está vacío') <NEW_LINE> <DEDENT> elif self.h.comprueba_nomalta(dni.get(),'P') == False: <NEW_LINE> <INDENT> messagebox.showinfo... | Auxiliar function to be able to send messageboxes | 625941bfec188e330fd5a6d2 |
def get(self, **kwargs): <NEW_LINE> <INDENT> if self.closed: <NEW_LINE> <INDENT> raise exceptions.TranslatorMorseError( "get operation on closed translator" ) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> result = self._output_queue.get(**kwargs) <NEW_LINE> <DEDENT> except Queue.Empty: <NEW_LINE> <INDENT> raise exceptio... | Retrieve and return from the processed items a new item. | 625941bf009cb60464c632e2 |
@prettytensor.Register <NEW_LINE> def l1_regression( input_layer, target, name=PROVIDED, loss_weight=None, per_example_weights=None): <NEW_LINE> <INDENT> target = _convert_and_assert_tensors_compatible(input_layer, target) <NEW_LINE> return apply_regression(input_layer, functions.l1_regression_loss, target, [], name='%... | Applies an L1 Regression (Sum of Absolute Error) to the target. | 625941bf6fece00bbac2d66b |
def go_to(self, dir_name): <NEW_LINE> <INDENT> if self.is_dir(dir_name): <NEW_LINE> <INDENT> return self.__class__(self.path_to(dir_name), permissions=self.__permissions) <NEW_LINE> <DEDENT> raise OSError( 'Directory "{}" does not exist at path "{}"'.format( dir_name, self.__path, ), ) | Go to directory.
Will be created new instance of self class on base path of dir_name.
:param dir_name: name of directory
:raises: OSError
:return: WorkSpace | 625941bfa934411ee37515c1 |
def __deserialize(self, data, klass): <NEW_LINE> <INDENT> if data is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if type(klass) == str: <NEW_LINE> <INDENT> if klass.startswith('list['): <NEW_LINE> <INDENT> sub_kls = re.match('list\[(.*)\]', klass).group(1) <NEW_LINE> return [self.__deserialize(sub_data, s... | Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object. | 625941bf26068e7796caec09 |
def test_checkPreconditions_deferred(self): <NEW_LINE> <INDENT> resource = TestResource() <NEW_LINE> request = SimpleRequest(Site(resource), "HOOKUPS", "/") <NEW_LINE> def checkResponse(response): <NEW_LINE> <INDENT> self.assertEquals(response, responsecode.NO_CONTENT) <NEW_LINE> <DEDENT> d = resource.renderHTTP(reques... | RenderMixin.checkPreconditions()
checkPreconditions() returns a deferred | 625941bf01c39578d7e74d69 |
@pytest.mark.parametrize("destination", control_explorer_accordions) <NEW_LINE> def test_control_explorer_tree(control_explorer_view, destination, appliance): <NEW_LINE> <INDENT> navigate_to(appliance.server, 'ControlExplorer') <NEW_LINE> accordion_name = destination.lower().replace(" ", "_") <NEW_LINE> accordion = get... | This test checks the accordion of Control/Explorer.
Steps:
* Open each accordion tab and click on top node of the tree. | 625941bf8a43f66fc4b53f96 |
def dtype_from_ctypes_type(t): <NEW_LINE> <INDENT> if issubclass(t, _ctypes.Array): <NEW_LINE> <INDENT> return _from_ctypes_array(t) <NEW_LINE> <DEDENT> elif issubclass(t, _ctypes._Pointer): <NEW_LINE> <INDENT> raise TypeError("ctypes pointers have no dtype equivalent") <NEW_LINE> <DEDENT> elif issubclass(t, _ctypes.St... | Construct a dtype object from a ctypes type | 625941bf0a50d4780f666dbe |
def ABphot(fileTableList,**kwargs): <NEW_LINE> <INDENT> photA = get_phot_table(fileTableList[0],apPos=[1406,1039],**kwargs) <NEW_LINE> photB = get_phot_table(fileTableList[1],apPos=[827,822],**kwargs) <NEW_LINE> comb = comb_phot([photA,photB],table_names=['A','B']) <NEW_LINE> return comb | Does the A side photometry and B side photometry, then combines the results | 625941bf7c178a314d6ef389 |
def update(self, changes): <NEW_LINE> <INDENT> for (a, b), change in changes.iteritems(): <NEW_LINE> <INDENT> if change != 0: <NEW_LINE> <INDENT> self.upsert_node(a, change) <NEW_LINE> self.upsert_node(b, change) <NEW_LINE> <DEDENT> <DEDENT> return self.median() | Update the node-cache. | 625941bf29b78933be1e55df |
def send_restore_password_link(self): <NEW_LINE> <INDENT> if not self.restore_code: <NEW_LINE> <INDENT> self.generate_restore_code() <NEW_LINE> <DEDENT> context = { "speaker": self, } <NEW_LINE> send_template_email( subject=_("[PyConES 2016] Establece tu contraseña"), from_email="PyConES 2016 <[email protected]... | Sends email with link to restore password. | 625941bf2ae34c7f2600d060 |
def solve_problem(instance, relax=True, _round=False, decompose=False, _epsilon=0.01, _alpha0=5000.0, _rho=0.92, _nar=10): <NEW_LINE> <INDENT> print("Solving problem...") <NEW_LINE> start = time.time() <NEW_LINE> if not decompose: <NEW_LINE> <INDENT> problem, (u, v, p, theta, w, z, e) = create_formulation(instance, rel... | Solve a SUC problem instance given instance constants.
Returns the value of the objective function, the total execution
time, the number of violated constraints (if there are any),
and the value of the lagrangian dual (if lagrangian decomposition
is used).
Args:
instance (SUPInstance):
Constants of the pr... | 625941bfd6c5a10208143f77 |
def press_printscreen(): <NEW_LINE> <INDENT> press_key(win32con.VK_SNAPSHOT) | Presses the print screen key. | 625941bf435de62698dfdb7a |
def add_product_to_cart(self, product_id): <NEW_LINE> <INDENT> self.customer_cart.append(product_id) | Function adds product to cart with product id | 625941bffbf16365ca6f60ed |
def copy(self): <NEW_LINE> <INDENT> result = Message( time = self.time, interval = self.interval, aspect = self.aspect, location = self._location._location, state = self.state, severity = self.severity, comment = self.comment ) <NEW_LINE> for val in self: <NEW_LINE> <INDENT> result[val] = self[val].copy() <NEW_LINE> <D... | Return a deep copy of the message instance. | 625941bfe76e3b2f99f3a73f |
def fetch_content(self, what_if_fail, ca_certs_path=""): <NEW_LINE> <INDENT> self.content_uri = self._addon_data.content_url <NEW_LINE> shutil.rmtree(self.CONTENT_DOWNLOAD_LOCATION, ignore_errors=True) <NEW_LINE> self.CONTENT_DOWNLOAD_LOCATION.mkdir(parents=True, exist_ok=True) <NEW_LINE> fetching_thread_name = self._f... | Initiate fetch of the content into an appropriate directory
Args:
what_if_fail: Callback accepting exception as an argument that
should handle them in the calling layer.
ca_certs_path: Path to the HTTPS certificate file | 625941bfe8904600ed9f1e59 |
def test_get_loosers_tie(self): <NEW_LINE> <INDENT> loosers = elections.getLoosers(['abc', 'acb'], CANDIDATES) <NEW_LINE> self.assertItemsEqual(['b', 'c'], loosers) | Should correctly identified tied loosing candidates. | 625941bf0fa83653e4656eeb |
def _set_up_fields(self, user): <NEW_LINE> <INDENT> pass | Set up the form fields. | 625941bf1b99ca400220a9df |
def licenseKeyFormatting(self, S, K): <NEW_LINE> <INDENT> outoutstr = [] <NEW_LINE> index = 0 <NEW_LINE> for c in S[::-1]: <NEW_LINE> <INDENT> if c != '-': <NEW_LINE> <INDENT> index += 1 <NEW_LINE> outoutstr.append(c.upper()) <NEW_LINE> if index % (K) == 0: <NEW_LINE> <INDENT> outoutstr.append('-') <NEW_LINE> <DEDENT> ... | :type S: str
:type K: int
:rtype: str | 625941bf379a373c97cfaa72 |
def _get_percents(self): <NEW_LINE> <INDENT> if self._percents is not None: <NEW_LINE> <INDENT> return self._percents <NEW_LINE> <DEDENT> from weblate.trans.models.translation import Translation <NEW_LINE> result = Translation.objects.get_percents(language=self) <NEW_LINE> self._percents = result <NEW_LINE> return resu... | Returns percentages of translation status. | 625941bfd486a94d0b98e074 |
def set_subscription(self, subscribed, ignored): <NEW_LINE> <INDENT> url = self._build_url('subscription', base_url=self._api) <NEW_LINE> sub = {'subscribed': subscribed, 'ignored': ignored} <NEW_LINE> json = self._json(self._put(url, data=dumps(sub)), 200) <NEW_LINE> return Subscription(json, self) if json else None | Set the user's subscription for this thread
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
:returns: :class;`Subscription <Subscription>` | 625941bf442bda511e8be34b |
def width(self): <NEW_LINE> <INDENT> return sm.max_width(self.bStations) | Calculates the bankfull width given a certain elevation. | 625941bffff4ab517eb2f369 |
def orc( self, path: PathOrPaths, mergeSchema: Optional[bool] = None, pathGlobFilter: Optional[Union[bool, str]] = None, recursiveFileLookup: Optional[Union[bool, str]] = None, modifiedBefore: Optional[Union[bool, str]] = None, modifiedAfter: Optional[Union[bool, str]] = None, ) -> "DataFrame": <NEW_LINE> <INDENT> self... | Loads ORC files, returning the result as a :class:`DataFrame`.
.. versionadded:: 1.5.0
Parameters
----------
path : str or list
Other Parameters
----------------
Extra options
For the extra options, refer to
`Data Source Option <https://spark.apache.org/docs/latest/sql-data-sources-orc.html#data-source-optio... | 625941bfd18da76e23532402 |
def test_all_muscles_have_wormbaseID(self): <NEW_LINE> <INDENT> muscles = self.qctx(Worm)().muscles() <NEW_LINE> for muscle_object in muscles: <NEW_LINE> <INDENT> self.assertNotEqual(muscle_object.wormbaseID(), '') | This test verifies that every muscle has a Wormbase ID. | 625941bfab23a570cc2500af |
def test_without_test_cookie(self): <NEW_LINE> <INDENT> validate_test_cookie(self.form, self.request) <NEW_LINE> self.assertIn('submit', self.form.errors) <NEW_LINE> self.assertEqual(self.form.errors['submit'], ['Cookies must be enabled.']) | Testing validate_test_cookie without test cookie set | 625941bf6aa9bd52df036cd2 |
def intersect_line(self,line): <NEW_LINE> <INDENT> if self==line: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> elif self.is_parallel(line): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._intersect_line_skew(line) | Returns the intersection of this line with the supplied line.
:param line: A line.
:type line: Line2D or Line3D
:return: Returns a line (this line) if lines are collinear.
Returns None (i.e. no intersection) if lines are parallel.
For 2D, returns a point if lines are skew.
For 3D, returns either None... | 625941bf498bea3a759b99df |
def __enter__(self) -> list[State]: <NEW_LINE> <INDENT> self.now = dt_util.utcnow() <NEW_LINE> return self.states | Record time from which to track changes. | 625941bfbe7bc26dc91cd534 |
def __bool__(self): <NEW_LINE> <INDENT> return self._x != 0 or self._y != 0 | bool operator for Python 3. | 625941bf63b5f9789fde7014 |
def find_torrent(self, info_hash): <NEW_LINE> <INDENT> return(common.find_torrent(info_hash, self.get_torrents())) | Frontend for rtorrent.common.find_torrent | 625941bf67a9b606de4a7deb |
def sign_message(data, api_key): <NEW_LINE> <INDENT> dataJson = json.dumps(data) <NEW_LINE> message = base64.b64encode(dataJson) <NEW_LINE> timestamp = int(time.time()) <NEW_LINE> shared_secret = get_private_key(api_key) <NEW_LINE> sig = hmac.new(shared_secret, '{m} {ts}'.format(m=message, ts=timestamp), hashlib.sha1).... | Create a signed message
This is only required for testing. | 625941bf566aa707497f449c |
def io_axis_indices(coordmap, axis_id, fix0=True): <NEW_LINE> <INDENT> in_dims = list(coordmap.function_domain.coord_names) <NEW_LINE> out_dims = list(coordmap.function_range.coord_names) <NEW_LINE> in_dim, out_dim, is_str = None, None, False <NEW_LINE> if isinstance(axis_id, int): <NEW_LINE> <INDENT> in_dim = axis_id ... | Return input and output axis index for id `axis_id` in `coordmap`
Parameters
----------
cm : class:`AffineTransform`
Affine coordinate map instance
axis_id : int or str
If int, gives index of *input* axis. Can be negative, so that -2 refers
to the second from last input axis. If str, gives name of input *... | 625941bf4a966d76dd550f3c |
def eiFilt(autom, state, replacement): <NEW_LINE> <INDENT> autom.addFilter('eiFilt state:{} replacement:{}'.format( state, replacement)) <NEW_LINE> assert state >= 0 and state < autom.stateCount <NEW_LINE> assert replacement >= 0 and replacement <= autom.stateCount <NEW_LINE> if replacement == autom.stateCount: <NEW_LI... | Edge island filter. Replaces all islands of "state" that wrap around the
left and right edges of autom. | 625941bfbd1bec0571d9055d |
def get_provided(self, id_): <NEW_LINE> <INDENT> for provider in self.root.providers: <NEW_LINE> <INDENT> if hasattr(provider, 'ns_provide'): <NEW_LINE> <INDENT> provided = provider.ns_provide(id_) <NEW_LINE> if provided: <NEW_LINE> <INDENT> if provided == 'USE_EXISTING': <NEW_LINE> <INDENT> w = self.top().find_by_id(i... | IMPORTANT: nested_splitter should set the _ns_id attribute *only*
if the provider doesn't do it itself. That allows the provider to
encode state information in the id.
Also IMPORTANT: nested_splitter should call all providers for each id_, not
just providers which previously advertised the id_. E.g. a provider which... | 625941bf4527f215b584c389 |
def __init__(self, type=None): <NEW_LINE> <INDENT> self.type = type <NEW_LINE> self.displayName = _u("") <NEW_LINE> self.pattern = _u("") | Initialize the object. | 625941bfec188e330fd5a6d3 |
def sur_setp(bigB,varb): <NEW_LINE> <INDENT> vvb = varb.diagonal() <NEW_LINE> n_eq = len(bigB.keys()) <NEW_LINE> bigK = np.zeros((n_eq,1),dtype=np.int_) <NEW_LINE> for r in range(n_eq): <NEW_LINE> <INDENT> bigK[r] = bigB[r].shape[0] <NEW_LINE> <DEDENT> b = sur_dict2mat(bigB) <NEW_LINE> se = np.sqrt(vvb) <NEW_LINE> se.r... | Utility to compute standard error, t and p-value
Parameters
----------
bigB : dictionary of regression coefficient estimates,
one vector by equation
varb : variance-covariance matrix of coefficients
Returns
-------
surinfdict : dictionary with standard error, t-value, and
p-value array, o... | 625941bf097d151d1a222d8b |
def enhancedSort(liste, comparateur, ordre): <NEW_LINE> <INDENT> return sorted(liste, key=operator.attrgetter(comparateur), reverse=ordre) | Trie une liste d'objets selon le comparateur.
Entree : La liste
Le/les attributs de l'objet servant de comparateur(s) (str)
Ordre de tri (True: décroissant / False: croissant)
Sortie : La liste de dictionnaires triée. | 625941bfac7a0e7691ed4000 |
def test_POST_bulk_feature(self): <NEW_LINE> <INDENT> c = Client() <NEW_LINE> c.login(username='admin', password='admin') <NEW_LINE> response = c.get(self.url) <NEW_LINE> formset = response.context['formset'] <NEW_LINE> POST_data = self._POST_data_from_formset(formset) <NEW_LINE> POST_data['form-0-BULK'] = 'yes' <NEW_L... | A POST request to the bulk_edit view with a valid formset and a
POST['bulk_action'] of 'feature' should feature the videos with the
bulk option checked. | 625941bf379a373c97cfaa73 |
def main(): <NEW_LINE> <INDENT> algs = ALGORITHMS.keys() <NEW_LINE> results_table = [] <NEW_LINE> if not os.path.exists("results.txt"): <NEW_LINE> <INDENT> results_table.append(results_header(results_table, algs)) <NEW_LINE> <DEDENT> args = get_args() <NEW_LINE> train_data = get_data(args, 1) <NEW_LINE> train_col = [ro... | test all algs | 625941bfd8ef3951e324346c |
@misc.raise_privileges <NEW_LINE> def split_partition(device_path, partition_path, new_size_in_mb): <NEW_LINE> <INDENT> disk_dic = get_devices() <NEW_LINE> disk = disk_dic[device_path] <NEW_LINE> part_dic = get_partitions(disk) <NEW_LINE> part = part_dic[partition_path] <NEW_LINE> if not check_mounted(part): <NEW_LINE>... | Shrinks partition and splits it in two.
ALERT: The filesystem must be resized before trying this! | 625941bf85dfad0860c3ad89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.