Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
363,600
def fit_linear(xdata, ydata): x = _n.array(xdata) y = _n.array(ydata) ax = _n.average(x) ay = _n.average(y) axx = _n.average(x*x) ayx = _n.average(y*x) slope = (ayx - ay*ax) / (axx - ax*ax) intercept = ay - slope*ax return slope, intercept
Returns slope and intercept of line of best fit: y = a*x + b through the supplied data. Parameters ---------- xdata, ydata: Arrays of x data and y data (having matching lengths).
363,601
def renew(gandi, domain, duration, background): result = gandi.domain.renew(domain, duration, background) if background: gandi.pretty_echo(result) return result
Renew a domain.
363,602
def bloquear_sat(self): resp = self._http_post() conteudo = resp.json() return RespostaSAT.bloquear_sat(conteudo.get())
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.bloquear_sat`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT
363,603
def calibrate(self, calib_ps, analytes=None): if analytes is None: analytes = self.analytes if not in self.data.keys(): self.data[] = Bunch() for a in analytes: m = calib_ps[a][].new(self.uTime) if in calib_ps[a]: ...
Apply calibration to data. The `calib_dict` must be calculated at the `analyse` level, and passed to this calibrate function. Parameters ---------- calib_dict : dict A dict of calibration values to apply to each analyte. Returns ------- None
363,604
def libvlc_audio_equalizer_get_band_frequency(u_index): f = _Cfunctions.get(, None) or \ _Cfunction(, ((1,),), None, ctypes.c_float, ctypes.c_uint) return f(u_index)
Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control in a user interface. @param u_index: index of the band, counting from zero. @return: equalizer band frequency (Hz), or -1 if there is no such band. @version: LibVLC 2.2.0 o...
363,605
def foldx_dir(self): if self.root_dir: return op.join(self.root_dir, self._foldx_dirname) else: log.warning() return None
str: FoldX folder
363,606
def read_connections(file_name, point_names): connections = [] fid = open(file_name, ) line=fid.readline() while(line): connections.append(np.array(line.split())) connections[-1][0] = connections[-1][0].strip() connections[-1][1] = connections[-1][1].strip() line = ...
Read a file detailing which markers should be connected to which for motion capture data.
363,607
def proc_chain(self, chain_info, parent): hetatom_filters = { : self.check_for_non_canonical } polymer = False chain_labels, chain_data = chain_info chain_label = list(chain_labels)[0] monomer_types = {x[2] for x in chain_labels if x[2]} if (...
Converts a chain into a `Polymer` type object. Parameters ---------- chain_info : (set, OrderedDict) Contains a set of chain labels and atom records. parent : ampal.Assembly `Assembly` used to assign `ampal_parent` on created `Polymer`. Raise...
363,608
def add_slice_db(self, fid, slice_end, md5): sql = self.cursor.execute(sql, (fid, slice_end, md5)) self.check_commit()
在数据库中加入上传任务分片信息
363,609
def broker_url(self): return .format( self.user, self.password, self.name, self.vhost)
Returns a "broker URL" for use with Celery.
363,610
async def merge_imports_tree(cache, imports, target_trees, base_tree=None): t have to do expensive git operations just to check whether a module is in cache. - We want tree merging to know about target names, so that it can write good error messages when there are conflicts. - We...
Take an Imports struct and a dictionary of resolved trees and merge the unified imports tree. If base_tree is supplied, merge that too. There are a couple reasons for structuring this function the way it is: - We want to cache merged trees, so that we don't have to do expensive git operations ...
363,611
def create_table(name=str(), base=Table, options=None): try: base = tuple(base) except TypeError: base = (base,) return TableMeta(name, base, options or {})
Creates and returns a new table class. You can specify a name for you class if you wish. You can also set the base class (or classes) that should be used when creating the class.
363,612
def index_modules(root) -> Dict: module_index_dict = { node["name"]: (node.get("tag"), index) for index, node in enumerate(root) if node.get("tag") in ("module", "program", "subroutine") } return module_index_dict
Counts the number of modules in the Fortran file including the program file. Each module is written out into a separate Python file.
363,613
def open_outside_spyder(self, fnames): for path in sorted(fnames): path = file_uri(path) ok = programs.start_file(path) if not ok: self.sig_edit.emit(path)
Open file outside Spyder with the appropriate application If this does not work, opening unknown file in Spyder, as text file
363,614
def _build_mappings( self, classes: Sequence[type] ) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]: parents_to_children: MutableMapping[type, Set[type]] = {} children_to_parents: MutableMapping[type, Set[type]] = {} visited_classes: Set[type] = set()...
Collect all bases and organize into parent/child mappings.
363,615
def verify_response(response, status_code, content_type=None): status = int(response.status.split(, 1)[0]) if status != status_code: return False if content_type is None: return True for header, value in response.headers: if header.lower() == : return value == content_ty...
Verifies that a response has the expected status and content type. Args: response: The ResponseTuple to be checked. status_code: An int, the HTTP status code to be compared with response status. content_type: A string with the acceptable Content-Type header value. None allows any ...
363,616
def follower_ids(self, user): user = str(user) user = user.lstrip() url = if re.match(r, user): params = {: user, : -1} else: params = {: user, : -1} while params[] != 0: try: resp = self.get(url, params=para...
Returns Twitter user id lists for the specified user's followers. A user can be a specific using their screen_name or user_id
363,617
def internal_get_frame(dbg, seq, thread_id, frame_id): try: frame = dbg.find_frame(thread_id, frame_id) if frame is not None: hidden_ns = pydevconsole.get_ipython_hidden_vars() xml = "<xml>" xml += pydevd_xml.frame_vars_to_xml(frame.f_locals, hidden_ns) ...
Converts request into python variable
363,618
def process_parsed_args(opts: Namespace, error_fun: Optional[Callable], connect: bool=True) -> Namespace: def setdefault(vn: str, default: object) -> None: assert vn in opts, "Unknown option" if not getattr(opts, vn): setattr(opts, vn, default) if error_fun and \ (g...
Set the defaults for the crc and ontology schemas :param opts: parsed arguments :param error_fun: Function to call if error :param connect: actually connect. (For debugging) :return: namespace with additional elements added
363,619
def start_standby(cls, webdriver=None, max_time=WTF_TIMEOUT_MANAGER.EPIC, sleep=5): return cls(webdriver=webdriver, max_time=max_time, sleep=sleep, _autostart=True)
Create an instance of BrowserStandBy() and immediately return a running instance. This is best used in a 'with' block. Example:: with BrowserStandBy.start_standby(): # Now browser is in standby, you can do a bunch of stuff with in this block. # ... ...
363,620
def compare(self, buf, offset=0, length=1, ignore=""): for i in range(offset, offset + length): if isinstance(self.m_types, (type(Union), type(Structure))): if compare(self.m_buf[i], buf[i], ignore=ignore): return 1 elif self.m_buf[i] != buf[...
Compare buffer
363,621
def quast_contigs_barplot(self): data = dict() categories = [] for s_name, d in self.quast_data.items(): nums_by_t = dict() for k, v in d.items(): m = re.match(, k) if m and v != : nums_by_t[int(m.grou...
Make a bar plot showing the number and length of contigs for each assembly
363,622
def destination(self) : "the bus name that the message is to be sent to." result = dbus.dbus_message_get_destination(self._dbobj) if result != None : result = result.decode() return \ result
the bus name that the message is to be sent to.
363,623
def main(): args = parse_args() if not args.files: return 0 with enable_sphinx_if_possible(): status = 0 pool = multiprocessing.Pool(multiprocessing.cpu_count()) try: if len(args.files) > 1: results = pool.map( _check_fil...
Return 0 on success.
363,624
def process_model_scores(self, model_names, root_cache, include_features=False): model_scores = {} for model_name in model_names: model_scores[model_name] = {} model_scores[model_name][] = \ self._process_score(...
Generates a score map for a set of models based on a `root_cache`. This method performs no substantial IO, but may incur substantial CPU usage. :Parameters: model_names : `set` ( `str` ) A set of models to score root_cache : `dict` ( `str` --> `mixed` ) ...
363,625
def get_sqltext(self, format_=1): if format_ == 1: _sql = if format_ == 2: _sql = return psql.read_sql(_sql, self.conn)
retourne les requêtes actuellement lancées sur le serveur
363,626
def json_file_response(obj=None, pid=None, record=None, status=None): from invenio_records_files.api import FilesIterator if isinstance(obj, FilesIterator): return json_files_serializer(obj, status=status) else: return json_file_serializer(obj, status=status)
JSON Files/File serializer. :param obj: A :class:`invenio_files_rest.models.ObjectVersion` instance or a :class:`invenio_records_files.api.FilesIterator` if it's a list of files. :param pid: PID value. (not used) :param record: The record metadata. (not used) :param status: The HTTP sta...
363,627
def find_exact(self, prefix): matches = self.find_all(prefix) if len(matches) == 1: match = matches.pop() if match.prefix == prefix: return match return None
Find the exact child with the given prefix
363,628
def count_repetitions(self, ctx, maxcount): count = 0 real_maxcount = ctx.state.end - ctx.string_position if maxcount < real_maxcount and maxcount != MAXREPEAT: real_maxcount = maxcount code_position = ctx.code_position string_posit...
Returns the number of repetitions of a single item, starting from the current string position. The code pointer is expected to point to a REPEAT_ONE operation (with the repeated 4 ahead).
363,629
def load_token(cls, token, force=False): for algorithm in SUPPORTED_DIGEST_ALGORITHMS: s = SecretLinkSerializer(algorithm_name=algorithm) st = TimedSecretLinkSerializer(algorithm_name=algorithm) for serializer in (s, st): try: data...
Validate a secret link token (non-expiring + expiring).
363,630
def parse_multi_lrvalue_string(search_string, split_string, delimiter=":"): dictlist = [] for out in search_string.split(split_string): tdict = parse_lrvalue_string(split_string + out, delimiter=delimiter) dictlist.append(t...
The function is an extension of the parse_lrvalue_string() API. The function takes a multi-line output/string of the format "Category: xyz name: foo id: bar Category: abc name: foox id: barx : " It splits the output based on the splitstring passed as argument (eg...
363,631
def draw(self, surface): ox, oy = self._map_layer.get_center_offset() new_surfaces = list() spritedict = self.spritedict gl = self.get_layer_of_sprite new_surfaces_append = new_surfaces.append for spr in self.sprites(): new_rect = spr.rect.move(ox, ...
Draw all sprites and map onto the surface :param surface: pygame surface to draw to :type surface: pygame.surface.Surface
363,632
def exit_config_mode(self, exit_config="exit", pattern=""): if not pattern: pattern = re.escape(self.base_prompt) return super(CiscoWlcSSH, self).exit_config_mode(exit_config, pattern)
Exit config_mode.
363,633
def error(self, relative_to=): df = self.df - Table(relative_to).df return Table(df=df)
Calculate error difference Parameters ---------- relative_to : string, a valid mass table name. Example: ---------- >>> Table('DUZU').error(relative_to='AME2003')
363,634
def _find_valid_block(self, table, worksheet, flags, units, used_cells, start_pos, end_pos): for row_index in range(len(table)): if row_index < start_pos[0] or row_index > end_pos[0]: continue convRow = table[row_index] used_row = used_cells[row_index...
Searches for the next location where a valid block could reside and constructs the block object representing that location.
363,635
def add_link(self): "Create a new internal link" n=len(self.links)+1 self.links[n]=(0,0) return n
Create a new internal link
363,636
def fourier_fit_magseries(times, mags, errs, period, fourierorder=None, fourierparams=None, sigclip=3.0, magsarefluxes=False, plotfit=False, ignoreinitfail=True, ...
This fits a Fourier series to a mag/flux time series. Parameters ---------- times,mags,errs : np.array The input mag/flux time-series to fit a Fourier cosine series to. period : float The period to use for the Fourier fit. fourierorder : None or int If this is an int, wil...
363,637
def _get_formatter(self, json): if json: return jsonlogger.JsonFormatter() else: return logging.Formatter(self.format_string)
Return the proper log formatter @param json: Boolean value
363,638
def is_cellular_component(self, go_term): cc_root = "GO:0005575" if go_term == cc_root: return True ancestors = self.get_isa_closure(go_term) if cc_root in ancestors: return True else: return False
Returns True is go_term has is_a, part_of ancestor of cellular component GO:0005575
363,639
def delete(self, *args, **kwargs): storage_ids = list(self.storages.values_list(, flat=True)) super().delete(*args, **kwargs) Storage.objects.filter(pk__in=storage_ids, data=None).delete()
Delete the data model.
363,640
def _handle_ctrl_c(self, *args): if self.anybar: self.anybar.change("exclamation") if self._stop: print("\nForced shutdown...") raise SystemExit if not self._stop: hline = 42 * print( + hline + "\nGot CTRL+C, waiting for...
Handle the keyboard interrupts.
363,641
def eval(self, expression, identify_erros=True): self._check_open() ret = self.client.Execute(expression) if identify_erros and ret.rfind() != -1: begin = ret.rfind() + 4 raise MatlabError(ret[begin:]) return ret
Evaluates a matlab expression synchronously. If identify_erros is true, and the last output line after evaluating the expressions begins with '???' an excpetion is thrown with the matlab error following the '???'. The return value of the function is the matlab output following the call.
363,642
def post(self, request, bot_id, format=None): return super(HookList, self).post(request, bot_id, format)
Add a new hook --- serializer: HookSerializer responseMessages: - code: 401 message: Not authenticated - code: 400 message: Not valid request
363,643
def get_summary(self): return { "count": self.count(), "pass": self.success_count(), "fail": self.failure_count(), "skip": self.skip_count(), "inconclusive": self.inconclusive_count(), "retries": self.retry_count(), "du...
Get a summary of this ResultLists contents as dictionary. :return: dictionary
363,644
def loadEL(dbpath=None, recpath=None, remove_subs=None, wordpool=None, groupby=None, experiments=None, filters=None): assert (dbpath is not None), "You must specify a db file or files." assert (recpath is not None), "You must specify a recall folder." assert (wordpool is not None), "You must speci...
Function that loads sql files generated by autoFR Experiment
363,645
def chunk(self, lenient=False): self.validate_signature() if not self.atchunk: self.atchunk = self._chunk_len_type() if not self.atchunk: raise ChunkError("No more chunks.") length, type = self.atchunk self.atchunk = None data ...
Read the next PNG chunk from the input file; returns a (*type*, *data*) tuple. *type* is the chunk's type as a byte string (all PNG chunk types are 4 bytes long). *data* is the chunk's data content, as a byte string. If the optional `lenient` argument evaluates to `True`, ...
363,646
def inquire(self, name=True, lifetime=True, usage=True, mechs=True): res = rcreds.inquire_cred(self, name, lifetime, usage, mechs) if res.name is not None: res_name = names.Name(res.name) else: res_name = None return tuples.InquireCredResult(res_name, ...
Inspect these credentials for information This method inspects these credentials for information about them. Args: name (bool): get the name associated with the credentials lifetime (bool): get the remaining lifetime for the credentials usage (bool): get the usage f...
363,647
def save(self, path, format, binary=False, use_load_condition=False): if use_load_condition: if self._load_cond is None: raise ValueError( b"use_load_condition was specified but the object is not " b"loaded from a file") ...
Save object as word embedding file. For most arguments, you should refer to :func:`~word_embedding_loader.word_embedding.WordEmbedding.load`. Args: use_load_condition (bool): If `True`, options from :func:`~word_embedding_loader.word_embedding.WordEmbedding.load` ...
363,648
def __print(self, msg): self.announce(msg, level=distutils.log.INFO)
Shortcut for printing with the distutils logger.
363,649
def _set_version(self, version): self.version = version or None version_check = version or 9999.0 if version_check < 1.0: raise RedmineError( ) ...
Set up this object based on the capabilities of the known versions of Redmine
363,650
def make_grid(rect, cells={}, num_rows=0, num_cols=0, padding=None, inner_padding=None, outer_padding=None, row_heights={}, col_widths={}, default_row_height=, default_col_width=): grid = Grid( bounding_rect=rect, min_cell_rects=cells, num_rows=num_rows, ...
Return rectangles for each cell in the specified grid. The rectangles are returned in a dictionary where the keys are (row, col) tuples.
363,651
def build_filter(predicate: Callable[[Any], bool] = None, *, unpack: bool = False): def _build_filter(predicate: Callable[[Any], bool]): @wraps(predicate) def _wrapper(*args, **kwargs) -> Filter: if in kwargs: raise TypeError() return Fi...
Decorator to wrap a function to return a Filter operator. :param predicate: function to be wrapped :param unpack: value from emits will be unpacked (*value)
363,652
def key(self): if self.curie is None: return self.name return ":".join((self.curie.name, self.name))
Embedded supports curies.
363,653
def find_stop(self, query, direction=""): _directions = ["inbound", "outbound", ""] direction = direction.lower() if direction == "inbound": stops = self.inbound_stops elif direction == "outbound": stops = self.outbound_stops else: sto...
Search the list of stops, optionally in a direction (inbound or outbound), for the term passed to the function. Case insensitive, searches both the stop name and ID. Yields a generator. Defaults to both directions.
363,654
def defer(self, func, *args, **kwargs): self._ipc_latch.put(lambda: func(*args, **kwargs))
Arrange for `func(*args, **kwargs)` to be invoked in the context of a service pool thread.
363,655
def _parse_alt_url(html_chunk): url_list = html_chunk.find("a", fn=has_param("href")) url_list = map(lambda x: x.params["href"], url_list) url_list = filter(lambda x: not x.startswith("autori/"), url_list) if not url_list: return None return normalize_url(BASE_URL, url_list[0])
Parse URL from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's URL.
363,656
def getResponse(self, context=""): waits = 0 response_str = "" try: waits = 0 while (waits < self.m_max_waits): bytes_to_read = self.m_ser.inWaiting() if bytes_to_read > 0: next_chunk = str(self.m_ser.read...
Poll for finished block or first byte ACK. Args: context (str): internal serial call context. Returns: string: Response, implict cast from byte array.
363,657
def _compute_faulting_style_term(self, C, rake): if rake > -120.0 and rake <= -60.0: return C[] elif rake > 30.0 and rake <= 150.0: return C[] else: return C[]
Compute faulting style term as a function of rake angle value as given in equation 5 page 465.
363,658
def step_impl07(context, len_list): assert len(context.fuzzed_string_list) == len_list for fuzzed_string in context.fuzzed_string_list: assert len(context.seed) == len(fuzzed_string) count = number_of_modified_bytes(context.seed, fuzzed_string) assert count >= 0
Check assertions. :param len_list: expected number of variants. :param context: test context.
363,659
def _fromData(cls, header, tflags, data): if header.version >= header._V24: if tflags & (Frame.FLAG24_COMPRESS | Frame.FLAG24_DATALEN): frame = cls() frame._readData(header, data) return frame
Construct this ID3 frame from raw string data. Raises: ID3JunkFrameError in case parsing failed NotImplementedError in case parsing isn't implemented ID3EncryptionUnsupportedError in case the frame is encrypted.
363,660
def on_created(self, event, dry_run=False, remove_uploaded=True): super(ArchiveEventHandler, self).on_created(event) log.info("created: %s", event)
Called when a file (or directory) is created.
363,661
def help_center_section_subscriptions(self, section_id, locale=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/subscriptions api_path = "/api/v2/help_center/sections/{section_id}/subscriptions.json" api_path = api_path.format(section_id=section_id) if locale: ...
https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#list-section-subscriptions
363,662
def select_grid_model_residential(lvgd): string_properties = lvgd.lv_grid.network.static_data[] apartment_string = lvgd.lv_grid.network.static_data[ ] apartment_house_branch_ratio = cfg_ding0.get("assumptions", "apartment_house_b...
Selects typified model grid based on population Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :pandas:`pandas.DataFrame<dataframe>` Selected string of typified model grid :pandas:`pandas.DataFrame<dataframe>` Param...
363,663
def _writeLinks(self, links, fileObject, replaceParamFile): for link in links: linkType = link.type fileObject.write( % link.linkNumber) if in linkType or in linkType or in linkType: self._writeCrossSectionLink(link, fileObject, repla...
Write Link Lines to File Method
363,664
def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, socket_options=None): host, port = address if host.startswith(): host = host.strip() err = None family = allowed_gai_family() for res in socket.getaddrinfo...
Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the...
363,665
def show(module): * ret = {} ret[] = module cmd = .format(module) out = __salt__[](cmd).splitlines() mode = info = [] for line in out: if line.startswith(): mode = continue if mode == : continue info.append(line) if...
Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy
363,666
def _generate_anchor_for(self, element, data_attribute, anchor_class): self.id_generator.generate_id(element) if self.parser.find( + data_attribute + + element.get_attribute() + ).first_result() is None: if element.get_tag_name() == : anchor =...
Generate an anchor for the element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_attribute: The name of attribute that links the element with the anchor. :type data_attribute: str :param a...
363,667
def _map_segmentation_mask_to_stft_domain(mask, times, frequencies, stft_times, stft_frequencies): assert mask.shape == (frequencies.shape[0], times.shape[0]), "Times is shape {} and frequencies is shape {}, but mask is shaped {}".format( times.shape, frequencies.shape, mask.shape ) result = np...
Maps the given `mask`, which is in domain (`frequencies`, `times`) to the new domain (`stft_frequencies`, `stft_times`) and returns the result.
363,668
def bbox_rotate(bbox, angle, rows, cols, interpolation): scale = cols / float(rows) x = np.array([bbox[0], bbox[2], bbox[2], bbox[0]]) y = np.array([bbox[1], bbox[1], bbox[3], bbox[3]]) x = x - 0.5 y = y - 0.5 angle = np.deg2rad(angle) x_t = (np.cos(angle) * x * scale + np.sin(angle) * ...
Rotates a bounding box by angle degrees Args: bbox (tuple): A tuple (x_min, y_min, x_max, y_max). angle (int): Angle of rotation in degrees rows (int): Image rows. cols (int): Image cols. interpolation (int): interpolation method. return a tuple (x_min, y_min, x_max...
363,669
def getOntoCategory(curie, alwaysFetch=False): fileName = os.path.join(os.path.dirname(__file__), "ontoCategories.bin") if not alwaysFetch: try: with open(fileName, "rb") as catFile: ontoCat = pickle.load(catFile) if curie in ontoCat: ...
Accessing web-based ontology service is too long, so we cache the information in a pickle file and query the services only if the info has not already been cached.
363,670
def generate_ecdsa_key(scheme=): securesystemslib.formats.ECDSA_SCHEME_SCHEMA.check_match(scheme) ecdsa_key = {} keytype = public = None private = None public, private = \ securesystemslib.ecdsa_keys.generate_public_and_private(scheme) key_value = {: public....
<Purpose> Generate public and private ECDSA keys, with NIST P-256 + SHA256 (for hashing) being the default scheme. In addition, a keyid identifier for the ECDSA key is generated. The object returned conforms to 'securesystemslib.formats.ECDSAKEY_SCHEMA' and has the form: {'keytype': 'ecdsa-sha2-n...
363,671
def readline(self): line = "" n_pos = -1 try: while n_pos < 0: line += self.next_chunk() n_pos = line.find() except StopIteration: pass if n_pos >= 0: line, extra = line[:n_pos+1], line[n_pos+1:] ...
Read until a new-line character is encountered
363,672
def gather(self, analysis, node): "High-level function to call an `analysis" assert issubclass(analysis, Analysis) a = analysis() a.attach(self) return a.run(node)
High-level function to call an `analysis' on a `node
363,673
def walk(self, *types): requested = types if len(types) > 0 else [SuiteFile, ResourceFile, SuiteFolder, Testcase, Keyword] for thing in self.robot_files: if thing.__class__ in requested: yield thing if isinstance(thing, SuiteFolder): for ...
Iterator which visits all suites and suite files, yielding test cases and keywords
363,674
def export_tour(tour_steps, name=None, filename="my_tour.js", url=None): if not name: name = "default" if name not in tour_steps: raise Exception("Tour {%s} does not exist!" % name) if not filename.endswith(): raise Exception() if not url: url = "data:," tour_ty...
Exports a tour as a JS file. It will include necessary resources as well, such as jQuery. You'll be able to copy the tour directly into the Console of any web browser to play the tour outside of SeleniumBase runs.
363,675
def __get_stack_trace(self, depth = 16, bUseLabels = True, bMakePretty = True): aProcess = self.get_process() arch = aProcess.get_arch() bits = aProcess.get_bits() if arch == win32.ARCH_I386: MachineType = ...
Tries to get a stack trace for the current function using the debug helper API (dbghelp.dll). @type depth: int @param depth: Maximum depth of stack trace. @type bUseLabels: bool @param bUseLabels: C{True} to use labels, C{False} to use addresses. @type bMakePretty: ...
363,676
def retinotopy_data(m, source=): polar_angleeccentricitypRF_sizevariance_explainedvisual_areavisualempiricalmodelany if pimms.is_map(source): if all(k in source for k in [, ]): return source if geo.is_vset(m): return retinotopy_data(m.properties, source=source) source = source.lower() model_...
retinotopy_data(m) yields a dict containing a retinotopy dataset with the keys 'polar_angle', 'eccentricity', and any other related fields for the given retinotopy type; for example, 'pRF_size' and 'variance_explained' may be included for measured retinotopy datasets and 'visual_area' may be included ...
363,677
def _parse_annotations(sbase): annotation = {} if sbase.isSetSBOTerm(): annotation["sbo"] = sbase.getSBOTermID() cvterms = sbase.getCVTerms() if cvterms is None: return annotation for cvterm in cvterms: for k in range(cvterm.getNumResources()): ...
Parses cobra annotations from a given SBase object. Annotations are dictionaries with the providers as keys. Parameters ---------- sbase : libsbml.SBase SBase from which the SBML annotations are read Returns ------- dict (annotation dictionary) FIXME: annotation format must b...
363,678
def get_relationship(self, attribute): rel = self.__relationships.get(attribute.entity_attr) if rel is None: rel = LazyDomainRelationship(self, attribute, direction= self.relationship_direction) ...
Returns the domain relationship object for the given resource attribute.
363,679
def _do_code_blocks(self, text): code_block_re = re.compile(r % (self.tab_width, self.tab_width), re.M | re.X) return code_block_re.sub(self._code_block_sub, text)
Process Markdown `<pre><code>` blocks.
363,680
def get_genomes(cfg): if cfg[]==: contigs=[, , , , , , , , , , , , , , ...
Installs genomes :param cfg: configuration dict
363,681
def logical_volume(cls, file_path, sudo=False): mp = WMountPoint.mount_point(file_path) if mp is not None: name_file = % mp.device_name() if os.path.exists(name_file): lv_path = % open(name_file).read().strip() return WLogicalVolume(lv_path, sudo=sudo)
Return logical volume that stores the given path :param file_path: target path to search :param sudo: same as 'sudo' in :meth:`.WLogicalVolume.__init__` :return: WLogicalVolume or None (if file path is outside current mount points)
363,682
def src2obj(srcpath, CompilerRunner_=None, objpath=None, only_update=False, cwd=None, out_ext=None, inc_py=False, **kwargs): name, ext = os.path.splitext(os.path.basename(srcpath)) if objpath is None: if os.path.isabs(srcpath): objpath = else: ...
Compiles a source code file to an object file. Files ending with '.pyx' assumed to be cython files and are dispatched to pyx2obj. Parameters ---------- srcpath: path string path to source file CompilerRunner_: pycompilation.CompilerRunner subclass (optional) Default: deduced fro...
363,683
def get_area(self): return (self.p2.x-self.p1.x)*(self.p2.y-self.p1.y)
Calculate area of bounding box.
363,684
def start_event_loop(self, timeout=0): if hasattr(self, ): raise RuntimeError("Event loop already running") id = wx.NewId() timer = wx.Timer(self, id=id) if timeout > 0: timer.Start(timeout*1000, oneShot=True) bind(self, wx.EVT_TIMER, self.sto...
Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always running and has nothing to do with this. Call s...
363,685
def ReadHuntObjects(self, offset, count, with_creator=None, created_after=None, with_description_match=None, cursor=None): query = "SELECT {columns} FROM hunts ".format(columns=_H...
Reads multiple hunt objects from the database.
363,686
def convert_dense(builder, layer, input_names, output_names, keras_layer): input_name, output_name = (input_names[0], output_names[0]) has_bias = keras_layer.bias W = keras_layer.get_weights ()[0].T Wb = keras_layer.get_weights ()[1].T if has_bias else None builder.add_inner_product...
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
363,687
def audio_set_format(self, format, rate, channels): return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels)
Set decoded audio format. This only works in combination with L{audio_set_callbacks}(), and is mutually exclusive with L{audio_set_format_callbacks}(). @param format: a four-characters string identifying the sample format (e.g. "S16N" or "FL32"). @param rate: sample rate (expressed in Hz...
363,688
def _from_binary_obj_ace(cls, binary_stream): access_flags, flags, object_guid, inher_guid = cls._REPR.unpack(binary_stream[:cls._REPR.size]) sid = SID.create_from_binary(binary_stream[cls._REPR.size:]) nw_obj = cls((ACEAccessFlags(access_flags),flags, UUID(bytes_le=object_guid), UUID(bytes_...
See base class.
363,689
def dropEvent( self, event ): url = event.mimeData().urls()[0] url_path = nativestring(url.toString()) if ( not url_path.startswith() ): filename = os.path.basename(url_path) temp_path = os.path.join(nativestring(QDir.tempPath()), filena...
Handles a drop event.
363,690
def run_check_kind(_): for kindv in router_post: for rec_cat in MCategory.query_all(kind=kindv): catid = rec_cat.uid catinfo = MCategory.get_by_uid(catid) for rec_post2tag in MPost2Catalog.query_by_catid(catid): postinfo = MPost.get_by_uid(rec_post2ta...
Running the script.
363,691
def add_style_opts(cls, component, new_options, backend=None): backend = cls.current_backend if backend is None else backend if component not in cls.registry[backend]: raise ValueError("Component %r not registered to a plotting class" % component) if not isinstance(new_opti...
Given a component such as an Element (e.g. Image, Curve) or a container (e.g Layout) specify new style options to be accepted by the corresponding plotting class. Note: This is supplied for advanced users who know which additional style keywords are appropriate for the correspon...
363,692
def errors(self): ret_errs = list() errors = self.get().get(, None) or list() assert isinstance(errors, list) for err in errors: when = parse_datetime(err.get(, None)) msg = err.get(, ) e = ErrorEvent(when, msg) ret_errs.append(e) ...
Returns the list of recent errors. Returns: list: of :obj:`.ErrorEvent` tuples.
363,693
def search_process(process, pattern, minAddr = None, maxAddr = None, bufferPages = None, overlapping = False): if address < end: ...
Search for the given pattern within the process memory. @type process: L{Process} @param process: Process to search. @type pattern: L{Pattern} @param pattern: Pattern to search for. It must be an instance of a subclass of L{Pattern}. The following L{Pattern} ...
363,694
def find_by_id(self, project_membership, params={}, **options): path = "/project_memberships/%s" % (project_membership) return self.client.get(path, params, **options)
Returns the project membership record. Parameters ---------- project_membership : {Id} Globally unique identifier for the project membership. [params] : {Object} Parameters for the request
363,695
def get_operator(self, op): if op in self.OPERATORS: return self.OPERATORS.get(op) try: n_args = len(inspect.getargspec(op)[0]) if n_args != 2: raise TypeError except: eprint() raise else: re...
Assigns function to the operators property of the instance.
363,696
def select(self): if self.GUI==None: return self.GUI.current_fit = self if self.tmax != None and self.tmin != None: self.GUI.update_bounds_boxes() if self.PCA_type != None: self.GUI.update_PCA_box() try: self.GUI.zijplot except AttributeEr...
Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon)
363,697
def path_url(self): url = [] p = urlsplit(self.url) path = p.path if not path: path = url.append(path) query = p.query if query: url.append() url.append(query) return .join(url)
Build the path URL to use.
363,698
def search_tags(self,series_search_text=None,response_type=None,params=None): path = params[] = series_search_text response_type = response_type if response_type else self.response_type if response_type != : params[] = response = _get_request(self.url_root,self.api_key...
Function to request the FRED tags for a series search. `<https://research.stlouisfed.org/docs/api/fred/series_search_tags.html>`_ :arg str series_search_text: The words to match against economic data series. Required. :arg str response_type: File extension of response. Options are 'xml', 'json'...
363,699
def get_tunnel_info_input_filter_type_filter_by_adm_state_admin_state(self, **kwargs): config = ET.Element("config") get_tunnel_info = ET.Element("get_tunnel_info") config = get_tunnel_info input = ET.SubElement(get_tunnel_info, "input") filter_type = ET.SubElement(input...
Auto Generated Code