code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
def fit_linear(xdata, ydata): """ 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). """ x = _n.array(xdata) y = _n.arra...
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).
def renew(gandi, domain, duration, background): """Renew a domain.""" result = gandi.domain.renew(domain, duration, background) if background: gandi.pretty_echo(result) return result
Renew a domain.
def bloquear_sat(self): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.bloquear_sat`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT """ resp = self._http_post('bloquearsat') conteudo = resp.json() return RespostaSAT.bloquear_sat(conteud...
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.bloquear_sat`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT
def calibrate(self, calib_ps, analytes=None): """ 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 ap...
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
def libvlc_audio_equalizer_get_band_frequency(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...
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...
def foldx_dir(self): """str: FoldX folder""" if self.root_dir: return op.join(self.root_dir, self._foldx_dirname) else: log.warning('Root directory not set') return None
str: FoldX folder
def read_connections(file_name, point_names): """Read a file detailing which markers should be connected to which for motion capture data.""" connections = [] fid = open(file_name, 'r') line=fid.readline() while(line): connections.append(np.array(line.split(','))) connections[-1][0]...
Read a file detailing which markers should be connected to which for motion capture data.
def proc_chain(self, chain_info, parent): """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_par...
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...
def add_slice_db(self, fid, slice_end, md5): '''在数据库中加入上传任务分片信息''' sql = 'INSERT INTO slice VALUES(?, ?, ?)' self.cursor.execute(sql, (fid, slice_end, md5)) self.check_commit()
在数据库中加入上传任务分片信息
def broker_url(self): """ Returns a "broker URL" for use with Celery. """ return 'amqp://{}:{}@{}/{}'.format( self.user, self.password, self.name, self.vhost)
Returns a "broker URL" for use with Celery.
async def merge_imports_tree(cache, imports, target_trees, base_tree=None): '''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 ...
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 ...
def create_table(name=str('_Table'), base=Table, options=None): """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. """ try: base = tuple(base) except TypeEr...
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.
def index_modules(root) -> Dict: """ Counts the number of modules in the Fortran file including the program file. Each module is written out into a separate Python file. """ module_index_dict = { node["name"]: (node.get("tag"), index) for index, node in enumerate(root) if node.get(...
Counts the number of modules in the Fortran file including the program file. Each module is written out into a separate Python file.
def open_outside_spyder(self, fnames): """Open file outside Spyder with the appropriate application If this does not work, opening unknown file in Spyder, as text file""" for path in sorted(fnames): path = file_uri(path) ok = programs.start_file(path) if...
Open file outside Spyder with the appropriate application If this does not work, opening unknown file in Spyder, as text file
def _build_mappings( self, classes: Sequence[type] ) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]: """ Collect all bases and organize into parent/child mappings. """ parents_to_children: MutableMapping[type, Set[type]] = {} children_to_parent...
Collect all bases and organize into parent/child mappings.
def verify_response(response, status_code, content_type=None): """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 w...
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 ...
def follower_ids(self, user): """ Returns Twitter user id lists for the specified user's followers. A user can be a specific using their screen_name or user_id """ user = str(user) user = user.lstrip('@') url = 'https://api.twitter.com/1.1/followers/ids.json' ...
Returns Twitter user id lists for the specified user's followers. A user can be a specific using their screen_name or user_id
def internal_get_frame(dbg, seq, thread_id, frame_id): ''' Converts request into python variable ''' 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...
Converts request into python variable
def process_parsed_args(opts: Namespace, error_fun: Optional[Callable], connect: bool=True) -> Namespace: """ 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: nam...
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
def start_standby(cls, webdriver=None, max_time=WTF_TIMEOUT_MANAGER.EPIC, sleep=5): """ Create an instance of BrowserStandBy() and immediately return a running instance. This is best used in a 'with' block. Example:: with BrowserStandBy.start_standby(): # N...
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. # ... ...
def compare(self, buf, offset=0, length=1, ignore=""): """Compare buffer""" 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 s...
Compare buffer
def quast_contigs_barplot(self): """ Make a bar plot showing the number and length of contigs for each assembly """ # Prep the data data = dict() categories = [] for s_name, d in self.quast_data.items(): nums_by_t = dict() for k, v in d.items(): ...
Make a bar plot showing the number and length of contigs for each assembly
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() #end if return \ result
the bus name that the message is to be sent to.
def main(): """Return 0 on success.""" 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( ...
Return 0 on success.
def process_model_scores(self, model_names, root_cache, include_features=False): """ 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: ...
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` ) ...
def get_sqltext(self, format_=1): """retourne les requêtes actuellement lancées sur le serveur""" if format_ == 1: _sql = """SELECT u.sid, substr(u.username,1,12) user_name, s.sql_text FROM v$sql s,v$session u WHERE s.hash_value = u.sql_hash_value AND sql...
retourne les requêtes actuellement lancées sur le serveur
def json_file_response(obj=None, pid=None, record=None, status=None): """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) :...
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...
def find_exact(self, prefix): ''' Find the exact child with the given 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
def count_repetitions(self, ctx, maxcount): """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).""" count = 0 real_maxcount = ctx.state.end - ...
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).
def load_token(cls, token, force=False): """Validate a secret link token (non-expiring + expiring).""" for algorithm in SUPPORTED_DIGEST_ALGORITHMS: s = SecretLinkSerializer(algorithm_name=algorithm) st = TimedSecretLinkSerializer(algorithm_name=algorithm) for seriali...
Validate a secret link token (non-expiring + expiring).
def parse_multi_lrvalue_string(search_string, split_string, delimiter=":"): ''' 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 ...
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...
def draw(self, surface): """ Draw all sprites and map onto the surface :param surface: pygame surface to draw to :type surface: pygame.surface.Surface """ ox, oy = self._map_layer.get_center_offset() new_surfaces = list() spritedict = self.spritedict gl ...
Draw all sprites and map onto the surface :param surface: pygame surface to draw to :type surface: pygame.surface.Surface
def exit_config_mode(self, exit_config="exit", pattern=""): """Exit config_mode.""" if not pattern: pattern = re.escape(self.base_prompt) return super(CiscoWlcSSH, self).exit_config_mode(exit_config, pattern)
Exit config_mode.
def error(self, relative_to='AME2003'): """ Calculate error difference Parameters ---------- relative_to : string, a valid mass table name. Example: ---------- >>> Table('DUZU').error(relative_to='AME2003') """ df = self.df - ...
Calculate error difference Parameters ---------- relative_to : string, a valid mass table name. Example: ---------- >>> Table('DUZU').error(relative_to='AME2003')
def _find_valid_block(self, table, worksheet, flags, units, used_cells, start_pos, end_pos): ''' Searches for the next location where a valid block could reside and constructs the block object representing that location. ''' for row_index in range(len(table)): if row_...
Searches for the next location where a valid block could reside and constructs the block object representing that location.
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
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...
def _get_formatter(self, json): ''' Return the proper log formatter @param json: Boolean value ''' if json: return jsonlogger.JsonFormatter() else: return logging.Formatter(self.format_string)
Return the proper log formatter @param json: Boolean value
def is_cellular_component(self, go_term): """ Returns True is go_term has is_a, part_of ancestor of cellular component GO:0005575 """ cc_root = "GO:0005575" if go_term == cc_root: return True ancestors = self.get_isa_closure(go_term) if cc_root in ance...
Returns True is go_term has is_a, part_of ancestor of cellular component GO:0005575
def delete(self, *args, **kwargs): """Delete the data model.""" # Store ids in memory as relations are also deleted with the Data object. storage_ids = list(self.storages.values_list('pk', flat=True)) # pylint: disable=no-member super().delete(*args, **kwargs) Storage.objects....
Delete the data model.
def _handle_ctrl_c(self, *args): """Handle the keyboard interrupts.""" if self.anybar: self.anybar.change("exclamation") if self._stop: print("\nForced shutdown...") raise SystemExit if not self._stop: hline = 42 * '=' print( ...
Handle the keyboard interrupts.
def eval(self, expression, identify_erros=True): """ 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...
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.
def post(self, request, bot_id, format=None): """ Add a new hook --- serializer: HookSerializer responseMessages: - code: 401 message: Not authenticated - code: 400 message: Not valid request """ return super(Hoo...
Add a new hook --- serializer: HookSerializer responseMessages: - code: 401 message: Not authenticated - code: 400 message: Not valid request
def get_summary(self): """ Get a summary of this ResultLists contents as dictionary. :return: dictionary """ return { "count": self.count(), "pass": self.success_count(), "fail": self.failure_count(), "skip": self.skip_count(), ...
Get a summary of this ResultLists contents as dictionary. :return: dictionary
def loadEL(dbpath=None, recpath=None, remove_subs=None, wordpool=None, groupby=None, experiments=None, filters=None): ''' Function that loads sql files generated by autoFR Experiment ''' assert (dbpath is not None), "You must specify a db file or files." assert (recpath is not None), "You must ...
Function that loads sql files generated by autoFR Experiment
def chunk(self, lenient=False): """ 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 opt...
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`, ...
def inquire(self, name=True, lifetime=True, usage=True, mechs=True): """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 ...
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...
def save(self, path, format, binary=False, use_load_condition=False): """ 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 ...
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` ...
def __print(self, msg): """Shortcut for printing with the distutils logger.""" self.announce(msg, level=distutils.log.INFO)
Shortcut for printing with the distutils logger.
def _set_version(self, version): ''' Set up this object based on the capabilities of the known versions of Redmine ''' # Store the version we are evaluating self.version = version or None # To evaluate the version capabilities, # assume the best-case if no...
Set up this object based on the capabilities of the known versions of Redmine
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='expand', default_col_width='expand'): """ Return rectangles for each cell in the specified grid. The rectangles are returned in a ...
Return rectangles for each cell in the specified grid. The rectangles are returned in a dictionary where the keys are (row, col) tuples.
def build_filter(predicate: Callable[[Any], bool] = None, *, unpack: bool = False): """ 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) """ def _build_filter(predicate: Call...
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)
def key(self): """Embedded supports curies.""" if self.curie is None: return self.name return ":".join((self.curie.name, self.name))
Embedded supports curies.
def find_stop(self, query, direction=""): """ 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. ""...
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.
def defer(self, func, *args, **kwargs): """ Arrange for `func(*args, **kwargs)` to be invoked in the context of a service pool thread. """ self._ipc_latch.put(lambda: func(*args, **kwargs))
Arrange for `func(*args, **kwargs)` to be invoked in the context of a service pool thread.
def _parse_alt_url(html_chunk): """ 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. """ url_list = html_chunk.find("a", fn=has_param("href")) url_li...
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.
def getResponse(self, context=""): """ Poll for finished block or first byte ACK. Args: context (str): internal serial call context. Returns: string: Response, implict cast from byte array. """ waits = 0 # allowed interval counter response_str = ...
Poll for finished block or first byte ACK. Args: context (str): internal serial call context. Returns: string: Response, implict cast from byte array.
def _compute_faulting_style_term(self, C, rake): """ Compute faulting style term as a function of rake angle value as given in equation 5 page 465. """ if rake > -120.0 and rake <= -60.0: return C['aN'] elif rake > 30.0 and rake <= 150.0: return C[...
Compute faulting style term as a function of rake angle value as given in equation 5 page 465.
def step_impl07(context, len_list): """Check assertions. :param len_list: expected number of variants. :param context: test context. """ assert len(context.fuzzed_string_list) == len_list for fuzzed_string in context.fuzzed_string_list: assert len(context.seed) == len(fuzzed_string) ...
Check assertions. :param len_list: expected number of variants. :param context: test context.
def _fromData(cls, header, tflags, data): """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. """ ...
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.
def on_created(self, event, dry_run=False, remove_uploaded=True): 'Called when a file (or directory) is created. ' super(ArchiveEventHandler, self).on_created(event) log.info("created: %s", event)
Called when a file (or directory) is created.
def help_center_section_subscriptions(self, section_id, locale=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#list-section-subscriptions" api_path = "/api/v2/help_center/sections/{section_id}/subscriptions.json" api_path = api_path.format(section_id=secti...
https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#list-section-subscriptions
def select_grid_model_residential(lvgd): """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 :pa...
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...
def _writeLinks(self, links, fileObject, replaceParamFile): """ Write Link Lines to File Method """ for link in links: linkType = link.type fileObject.write('LINK %s\n' % link.linkNumber) # Cases if 'TRAP' in linkType or 'TRAPEZO...
Write Link Lines to File Method
def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, socket_options=None): """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 o...
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...
def show(module): ''' Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy ''' ret = {} ret['name'] = module # This section parses out details from CPAN, if possible cmd = 'cpan -D {0}'.format(module) out =...
Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy
def _generate_anchor_for(self, element, data_attribute, anchor_class): """ 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 ...
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...
def _map_segmentation_mask_to_stft_domain(mask, times, frequencies, stft_times, stft_frequencies): """ Maps the given `mask`, which is in domain (`frequencies`, `times`) to the new domain (`stft_frequencies`, `stft_times`) and returns the result. """ assert mask.shape == (frequencies.shape[0], times...
Maps the given `mask`, which is in domain (`frequencies`, `times`) to the new domain (`stft_frequencies`, `stft_times`) and returns the result.
def bbox_rotate(bbox, angle, rows, cols, interpolation): """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): in...
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...
def getOntoCategory(curie, alwaysFetch=False): """ 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. """ fileName = os.path.join(os.path.dirname(__file__), "ontoCategories....
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.
def generate_ecdsa_key(scheme='ecdsa-sha2-nistp256'): """ <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.ECD...
<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...
def readline(self): """ Read until a new-line character is encountered """ line = "" n_pos = -1 try: while n_pos < 0: line += self.next_chunk() n_pos = line.find('\n') except StopIteration: pass if n...
Read until a new-line character is encountered
def gather(self, analysis, node): "High-level function to call an `analysis' on a `node'" assert issubclass(analysis, Analysis) a = analysis() a.attach(self) return a.run(node)
High-level function to call an `analysis' on a `node
def walk(self, *types): ''' Iterator which visits all suites and suite files, yielding test cases and keywords ''' requested = types if len(types) > 0 else [SuiteFile, ResourceFile, SuiteFolder, Testcase, Keyword] for thing in self.robot_files: if thing.__cla...
Iterator which visits all suites and suite files, yielding test cases and keywords
def export_tour(tour_steps, name=None, filename="my_tour.js", url=None): """ 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. "...
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.
def __get_stack_trace(self, depth = 16, bUseLabels = True, bMakePretty = True): """ Tries to get a stack trace for the current function using the debug helper API (dbghelp.dll). @type depth: int @param depth: Maximum de...
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: ...
def retinotopy_data(m, source='any'): ''' 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...
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 ...
def _parse_annotations(sbase): """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...
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...
def get_relationship(self, attribute): """ Returns the domain relationship object for the given resource attribute. """ rel = self.__relationships.get(attribute.entity_attr) if rel is None: rel = LazyDomainRelationship(self, attribute, ...
Returns the domain relationship object for the given resource attribute.
def _do_code_blocks(self, text): """Process Markdown `<pre><code>` blocks.""" code_block_re = re.compile(r''' (?:\n\n|\A\n?) ( # $1 = the code block -- one or more lines, starting with a space/tab (?: (?:[ ]{%d} | \t) # Lines must star...
Process Markdown `<pre><code>` blocks.
def get_genomes(cfg): """ Installs genomes :param cfg: configuration dict """ if cfg['host']=='homo_sapiens': contigs=['1', '2', '3', '4', '5', '6', '7', '8', ...
Installs genomes :param cfg: configuration dict
def logical_volume(cls, file_path, sudo=False): """ 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) """ mp = WMountPoint.mo...
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)
def src2obj(srcpath, CompilerRunner_=None, objpath=None, only_update=False, cwd=None, out_ext=None, inc_py=False, **kwargs): """ Compiles a source code file to an object file. Files ending with '.pyx' assumed to be cython files and are dispatched to pyx2obj. Parameters -...
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...
def get_area(self): """Calculate area of bounding box.""" return (self.p2.x-self.p1.x)*(self.p2.y-self.p1.y)
Calculate area of bounding box.
def start_event_loop(self, timeout=0): """ 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 runni...
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...
def ReadHuntObjects(self, offset, count, with_creator=None, created_after=None, with_description_match=None, cursor=None): """Reads multiple hunt objects from the database.""" quer...
Reads multiple hunt objects from the database.
def convert_dense(builder, layer, input_names, output_names, keras_layer): """Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output...
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
def audio_set_format(self, 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...
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...
def _from_binary_obj_ace(cls, binary_stream): """See base class.""" ''' Access rights flags - 4 Flags - 4 Object type class identifier (GUID) - 16 Inherited object type class identifier (GUID) - 16 SID - n ''' #content = cls._REPR.unpack(binary_stream[:cls._REPR.size]) ...
See base class.
def dropEvent( self, event ): """ Handles a drop event. """ url = event.mimeData().urls()[0] url_path = nativestring(url.toString()) # download an icon from the web if ( not url_path.startswith('file:') ): filename = os.path.basename...
Handles a drop event.
def run_check_kind(_): ''' Running the script. ''' 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): post...
Running the script.
def add_style_opts(cls, component, new_options, backend=None): """ 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 kno...
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...
def errors(self): """ Returns the list of recent errors. Returns: list: of :obj:`.ErrorEvent` tuples. """ ret_errs = list() errors = self.get('error').get('errors', None) or list() assert isinstance(errors, list) for err in errors: ...
Returns the list of recent errors. Returns: list: of :obj:`.ErrorEvent` tuples.
def search_process(process, pattern, minAddr = None, maxAddr = None, bufferPages = None, overlapping = False): """ Search for the given pattern within the process memory. @...
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} ...
def find_by_id(self, project_membership, params={}, **options): """Returns the project membership record. Parameters ---------- project_membership : {Id} Globally unique identifier for the project membership. [params] : {Object} Parameters for the request """ pa...
Returns the project membership record. Parameters ---------- project_membership : {Id} Globally unique identifier for the project membership. [params] : {Object} Parameters for the request
def get_operator(self, op): """Assigns function to the operators property of the instance. """ if op in self.OPERATORS: return self.OPERATORS.get(op) try: n_args = len(inspect.getargspec(op)[0]) if n_args != 2: raise TypeError e...
Assigns function to the operators property of the instance.
def select(self): """ Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon) """ if self.GUI==None: return self.GUI.current_fit = self if self.tmax != None and self.tmin != None: self.GUI.update_bounds_boxes()...
Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon)
def path_url(self): """Build the path URL to use.""" 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...
Build the path URL to use.
def search_tags(self,series_search_text=None,response_type=None,params=None): """ 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 serie...
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'...
def get_tunnel_info_input_filter_type_filter_by_adm_state_admin_state(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_tunnel_info = ET.Element("get_tunnel_info") config = get_tunnel_info input = ET.SubElement(get_tunnel_info, "input") ...
Auto Generated Code