positive
stringlengths
100
30.3k
anchor
stringlengths
1
15k
def _compute_error(comp_cov, covariance_, precision_, score_metric="frobenius"): """Computes the covariance error vs. comp_cov. Parameters ---------- comp_cov : array-like, shape = (n_features, n_features) The precision to compare with. This should normally be the test sample covariance...
Computes the covariance error vs. comp_cov. Parameters ---------- comp_cov : array-like, shape = (n_features, n_features) The precision to compare with. This should normally be the test sample covariance/precision. scaling : bool If True, the squared error norm is divided by n_...
def add_info(self, data): """add info to a build""" for key in data: # verboten if key in ('status','state','name','id','application','services','release'): raise ValueError("Sorry, cannot set build info with key of {}".format(key)) self.obj[key] = dat...
add info to a build
def __ungrabHotkey(self, key, modifiers, window): """ Ungrab a specific hotkey in the given window """ logger.debug("Ungrabbing hotkey: %r %r", modifiers, key) try: keycode = self.__lookupKeyCode(key) mask = 0 for mod in modifiers: ...
Ungrab a specific hotkey in the given window
def _namedtupleload(l: Loader, value: Dict[str, Any], type_) -> Tuple: """ This loads a Dict[str, Any] into a NamedTuple. """ if not hasattr(type_, '__dataclass_fields__'): fields = set(type_._fields) optional_fields = set(getattr(type_, '_field_defaults', {}).keys()) type_hints ...
This loads a Dict[str, Any] into a NamedTuple.
def _set_fast_flood(self, v, load=False): """ Setter method for fast_flood, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/fast_flood (container) If this variable is read-only (config: false) in the source YANG file, then _set_fast_flood is considere...
Setter method for fast_flood, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/fast_flood (container) If this variable is read-only (config: false) in the source YANG file, then _set_fast_flood is considered as a private method. Backends looking to populat...
def _next_lexem(self, lexem_type, source_code, source_code_size): """Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used""" # define reader as a lexem extractor def reader(seq, block_size): identificator = '' ...
Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used
def _stream(self): """ Returns a generator of lines instead of a list of lines. """ if self._exception: raise self._exception try: if self._content: yield self._content else: args = self.create_args() ...
Returns a generator of lines instead of a list of lines.
def mangle_scope_tree(root, toplevel): """Walk over a scope tree and mangle symbol names. Args: toplevel: Defines if global scope should be mangled or not. """ def mangle(scope): # don't mangle global scope if not specified otherwise if scope.get_enclosing_scope() is None and no...
Walk over a scope tree and mangle symbol names. Args: toplevel: Defines if global scope should be mangled or not.
def want_service_notification(self, timeperiods, timestamp, state, n_type, business_impact, cmd=None): # pylint: disable=too-many-return-statements """Check if notification options match the state of the service Notification is NOT wanted in ONE of the following...
Check if notification options match the state of the service Notification is NOT wanted in ONE of the following case:: * service notifications are disabled * cmd is not in service_notification_commands * business_impact < self.min_business_impact * service_notification_period is...
def parse_grasp_gwas(fn): """ Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of ...
Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of the form chrom:pos where pos is the on...
def stop_transmit(self, fd): """ Stop yielding writeability events for `fd`. Redundant calls to :meth:`stop_transmit` are silently ignored, this may change in future. """ self._wfds.pop(fd, None) self._update(fd)
Stop yielding writeability events for `fd`. Redundant calls to :meth:`stop_transmit` are silently ignored, this may change in future.
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Content-Type for the object @param metadata: C{dict} containing additional metadata @param amz_headers: A C{dict} used to build C{x-amz-*} ...
def BROADCAST_FILTER_OR(*funcs): """ Composes the passed filters into an and-joined filter. """ return lambda u, command, *args, **kwargs: any(f(u, command, *args, **kwargs) for f in funcs)
Composes the passed filters into an and-joined filter.
def _GetDecodedStreamSize(self): """Retrieves the decoded stream size. Returns: int: decoded stream size. """ self._file_object.seek(0, os.SEEK_SET) self._decoder = self._GetDecoder() self._decoded_data = b'' encoded_data_offset = 0 encoded_data_size = self._file_object.get_size...
Retrieves the decoded stream size. Returns: int: decoded stream size.
def get(self, req, driver): """Get info of a network Get info of a specific netowrk with id on special cloud with: :Param req :Type object Request """ response = driver.get_network(req.params, id) data = { 'action': "get", 'contr...
Get info of a network Get info of a specific netowrk with id on special cloud with: :Param req :Type object Request
def create_launch_configuration(self, launch_config): """ Creates a new Launch Configuration. :type launch_config: :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` :param launch_config: LaunchConfiguration object. """ params = {'ImageId': launch_config.image_...
Creates a new Launch Configuration. :type launch_config: :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` :param launch_config: LaunchConfiguration object.
def actDerivASIG(self, x): """ Only works on scalars. """ def act(v): if v < -15.0: return 0.0 elif v > 15.0: return 1.0 else: return 1.0 / (1.0 + Numeric.exp(-v)) return (act(x) * (1.0 - act(x))) + self.sigmoid_prime_offset
Only works on scalars.
def islive(self, state): '''A state is "live" if a final state can be reached from it.''' reachable = [state] i = 0 while i < len(reachable): current = reachable[i] if current in self.finals: return True if current in self.map: for symbol in self.map[current]: next = self.map[current][symb...
A state is "live" if a final state can be reached from it.
def fit(self, env, nb_steps, action_repetition=1, callbacks=None, verbose=1, visualize=False, nb_max_start_steps=0, start_step_policy=None, log_interval=10000, nb_max_episode_steps=None): """Trains the agent on the given environment. # Arguments env: (`Env` instance)...
Trains the agent on the given environment. # Arguments env: (`Env` instance): Environment that the agent interacts with. See [Env](#env) for details. nb_steps (integer): Number of training steps to be performed. action_repetition (integer): Number of times the agent repeats ...
def _next_channel_id(self): '''Return the next possible channel id. Is a circular enumeration.''' self._channel_counter += 1 if self._channel_counter >= self._channel_max: self._channel_counter = 1 return self._channel_counter
Return the next possible channel id. Is a circular enumeration.
def check_online(stream): """ Used to check user's online opponents and show their online/offline status on page on init """ while True: packet = yield from stream.get() session_id = packet.get('session_key') opponent_username = packet.get('username') if session_i...
Used to check user's online opponents and show their online/offline status on page on init
def Axn(mt, x, n): """ (A^1)x:n : Returns the EPV (net single premium) of a term insurance. """ return (mt.Mx[x] - mt.Mx[x + n]) / mt.Dx[x]
(A^1)x:n : Returns the EPV (net single premium) of a term insurance.
def generate_overcloud_passwords(output_file="tripleo-overcloud-passwords"): """Create the passwords needed for the overcloud This will create the set of passwords required by the overcloud, store them in the output file path and return a dictionary of passwords. If the file already exists the existing...
Create the passwords needed for the overcloud This will create the set of passwords required by the overcloud, store them in the output file path and return a dictionary of passwords. If the file already exists the existing passwords will be returned instead,
def subscribe(config, accounts, region, merge, debug): """subscribe accounts log groups to target account log group destination""" config = validate.callback(config) subscription = config.get('subscription') if subscription is None: log.error("config file: logs subscription missing") sy...
subscribe accounts log groups to target account log group destination
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
Writes the contents of the Extension to the logging system.
def query(self, query): """Q.query(query string) -> category string -- return the matched category for any user query """ self.query = query self.process_query() matching_corpus_index = self.match_query_to_corpus() return self.category_list[matching_corpus_index].strip()
Q.query(query string) -> category string -- return the matched category for any user query
def convert(self,label,units=None,conversion_function=convert_time): """ converts a dimension in place """ label_no = self.get_label_no(label) new_label, new_column = self.get_converted(label_no,units,conversion_function) labels = [LabelDimension(l) for l in self.labels] labels[l...
converts a dimension in place
async def join(self, channel, password=None): """ Join channel, optionally with password. """ if self.in_channel(channel): raise AlreadyInChannel(channel) if password: await self.rawmsg('JOIN', channel, password) else: await self.rawmsg('JOIN', channe...
Join channel, optionally with password.
def getReffs(self, textId, level=1, subreference=None): """ Retrieve the siblings of a textual node :param textId: CtsTextMetadata Identifier :type textId: str :param level: Depth for retrieval :type level: int :param subreference: CapitainsCtsPassage Reference :...
Retrieve the siblings of a textual node :param textId: CtsTextMetadata Identifier :type textId: str :param level: Depth for retrieval :type level: int :param subreference: CapitainsCtsPassage Reference :type subreference: str :return: List of references :...
def sparkline_display_value_type(self, sparkline_display_value_type): """Sets the sparkline_display_value_type of this ChartSettings. For the single stat view, whether to display the name of the query or the value of query # noqa: E501 :param sparkline_display_value_type: The sparkline_displa...
Sets the sparkline_display_value_type of this ChartSettings. For the single stat view, whether to display the name of the query or the value of query # noqa: E501 :param sparkline_display_value_type: The sparkline_display_value_type of this ChartSettings. # noqa: E501 :type: str
def _generate_create_dict(record, record_type, data, ttl, **kwargs): """Returns a dict appropriate to pass into Dns_Domain_ResourceRecord::createObject""" # Basic dns record structure resource_record = { 'host': record, 'data': data, 'ttl': ttl, '...
Returns a dict appropriate to pass into Dns_Domain_ResourceRecord::createObject
def dump(self, fh, value, context=None): """Attempt to transform and write a string-based foreign value to the given file-like object. Returns the length written. """ value = self.dumps(value) fh.write(value) return len(value)
Attempt to transform and write a string-based foreign value to the given file-like object. Returns the length written.
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with ...
Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with RowIterator. progress_bar_type (Any): Ignored. Added for compatibil...
def get_select_fields(self, select_fields=None): """ :return: string specifying the attributes to return """ return self.heading.as_sql if select_fields is None else self.heading.project(select_fields).as_sql
:return: string specifying the attributes to return
def determine_json_encoding(json_bytes): ''' Given the fact that the first 2 characters in json are guaranteed to be ASCII, we can use these to determine the encoding. See: http://tools.ietf.org/html/rfc4627#section-3 Copied here: Since the first two characters of a JSON text will always be ASCII characte...
Given the fact that the first 2 characters in json are guaranteed to be ASCII, we can use these to determine the encoding. See: http://tools.ietf.org/html/rfc4627#section-3 Copied here: Since the first two characters of a JSON text will always be ASCII characters [RFC0020], it is possible to determine wheth...
def reads(paths, filename='data.h5', options=None, **keywords): """ Reads data from an HDF5 file (high level). High level function to read one or more pieces of data from an HDF5 file located at the paths specified in `paths` into Python types. Each path is specified as a POSIX style path where the dat...
Reads data from an HDF5 file (high level). High level function to read one or more pieces of data from an HDF5 file located at the paths specified in `paths` into Python types. Each path is specified as a POSIX style path where the data to read is located. There are various options that can be use...
def load_ncVar(varName, nc=None, **kwargs): ''' Loads a variable from the NetCDF file and saves it as a data structure. :parameter varName: variable name :keywords kwargs: additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensi...
Loads a variable from the NetCDF file and saves it as a data structure. :parameter varName: variable name :keywords kwargs: additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensions to subsample along and associated value should be a length 2 o...
def make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs): """make_predictor(regressor=LassoLarsIC(fit_intercep...
make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs) Makes a predictor object for use in :func:`get_lightcurve`. **Parameters** regressor : object with "fit" and "transform" m...
def property_list(self, property_list): """Setter method; for a description see the getter method.""" if property_list is not None: msg = "The 'property_list' init parameter and attribute of " \ "CIMInstance is deprecated; Set only the desired properties " \ "...
Setter method; for a description see the getter method.
def enforce_time_limit(self, site): ''' Raises `brozzler.ReachedTimeLimit` if appropriate. ''' if (site.time_limit and site.time_limit > 0 and site.elapsed() > site.time_limit): self.logger.debug( "site FINISHED_TIME_LIMIT! time_limit=%s " ...
Raises `brozzler.ReachedTimeLimit` if appropriate.
def offer_answer(pool, answer, rationale, student_id, algo, options): """ submit a student answer to the answer pool The answer maybe selected to stay in the pool depending on the selection algorithm Args: pool (dict): answer pool Answer pool format: { o...
submit a student answer to the answer pool The answer maybe selected to stay in the pool depending on the selection algorithm Args: pool (dict): answer pool Answer pool format: { option1_index: { 'student_id': { can store algorithm specific i...
def jacobian_augmentation(sess, x, X_sub_prev, Y_sub, grads, lmbda, aug_batch_size=512, feed=None): """ Augment an adversary's substit...
Augment an adversary's substitute training set using the Jacobian of a substitute model to generate new synthetic inputs. See https://arxiv.org/abs/1602.02697 for more details. See cleverhans_tutorials/mnist_blackbox.py for example use case :param sess: TF session in which the substitute model is defined :par...
def update_context(self): """ Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.a...
Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.author` was set by the caller). ...
def galactic_xyz(self): """Compute galactic coordinates (x, y, z)""" vector = _GALACTIC.dot(self.position.au) return Distance(vector)
Compute galactic coordinates (x, y, z)
def load_py_config(conf_file): # type: (str) -> None """ Import configuration from a python file. This will just import the file into python. Sky is the limit. The file has to deal with the configuration all by itself (i.e. call conf.init()). You will also need to add your src directory to sys.path...
Import configuration from a python file. This will just import the file into python. Sky is the limit. The file has to deal with the configuration all by itself (i.e. call conf.init()). You will also need to add your src directory to sys.paths if it's not the current working directory. This is done aut...
def items(cls): """ All values for this enum :return: list of str """ return [ cls.GREEN, cls.BLACK_AND_WHITE, cls.CONTRAST_SHIFTED, cls.CONTRAST_CONTINUOUS ]
All values for this enum :return: list of str
def html_parts(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1): """ Given an input string, returns a dictionary of HTML document parts. Dictionary keys are the names of parts, and values are Unicode strings; encoding is...
Given an input string, returns a dictionary of HTML document parts. Dictionary keys are the names of parts, and values are Unicode strings; encoding is up to the client. Parameters: - `input_string`: A multi-line text string; required. - `source_path`: Path to the source file or object. Optional...
def branches(remotes=False): """Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch ...
Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch
def create_class(self, data, options=None, **kwargs): """Return instance of class based on Javascript data Data keys handled here: type Set the object class consts, types, vars, funcs Recurse into :py:meth:`create_class` to create child object ...
Return instance of class based on Javascript data Data keys handled here: type Set the object class consts, types, vars, funcs Recurse into :py:meth:`create_class` to create child object instances :param data: dictionary data fr...
def find_functions(code): """ Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...]. """ regex = "^\s*" + re_func_decl + "\s*{" funcs = [] while True: m = re.search(regex, code, re.M) ...
Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...].
def _create_training_directories(): """Creates the directory structure and files necessary for training under the base path """ logger.info('Creating a new training folder under %s .' % base_dir) os.makedirs(model_dir) os.makedirs(input_config_dir) os.makedirs(output_data_dir) _write_json(...
Creates the directory structure and files necessary for training under the base path
def reorder(self, dst_order, arr, src_order=None): """Reorder the output array to match that needed by the viewer.""" if dst_order is None: dst_order = self.viewer.rgb_order if src_order is None: src_order = self.rgb_order if src_order != dst_order: ar...
Reorder the output array to match that needed by the viewer.
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" # the double prefixes are to avoid double keyword argument # errors when proxying the call. if not __self.is_safe_callable(__obj): raise SecurityError('%r is not safely callable' % ...
Call an object from sandboxed code.
def to_json(val, allow_pickle=False, pretty=False): r""" Converts a python object to a JSON string using the utool convention Args: val (object): Returns: str: json_str References: http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp CommandLine: ...
r""" Converts a python object to a JSON string using the utool convention Args: val (object): Returns: str: json_str References: http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp CommandLine: python -m utool.util_cache --test-to_json py...
def _schmidt_count(cos_dist, sigma=None): """Schmidt (a.k.a. 1%) counting kernel function.""" radius = 0.01 count = ((1 - cos_dist) <= radius).astype(float) # To offset the count.sum() - 0.5 required for the kamb methods... count = 0.5 / count.size + count return count, (cos_dist.size * radius)
Schmidt (a.k.a. 1%) counting kernel function.
def _set_in_exp(self, v, load=False): """ Setter method for in_exp, mapped from YANG variable /qos_mpls/map/inexp_outexp/in_exp (list) If this variable is read-only (config: false) in the source YANG file, then _set_in_exp is considered as a private method. Backends looking to populate this variable...
Setter method for in_exp, mapped from YANG variable /qos_mpls/map/inexp_outexp/in_exp (list) If this variable is read-only (config: false) in the source YANG file, then _set_in_exp is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_in_exp(...
def get_bounding_box_list(input_doc_fname, input_doc, full_page_box_list, set_of_page_nums_to_crop, argparse_args, chosen_PdfFileWriter): """Calculate a bounding box for each page in the document. The first argument is the filename of the document's original PDF file, the second is t...
Calculate a bounding box for each page in the document. The first argument is the filename of the document's original PDF file, the second is the PdfFileReader for the document. The argument full_page_box_list is a list of the full-page-size boxes (which is used to correct for any nonzero origins in t...
def init(vcs): """Initialize the locking module for a repository """ path = os.path.join(vcs.private_dir(), 'locks') if not os.path.exists(path): os.mkdir(path)
Initialize the locking module for a repository
def _iso8601_to_localized_time(date_string): """ Convert iso8601 date string into UTC time. :param date_string: iso8601 formatted date string. :return: :class:`datetime.datetime` """ parsed_date = datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ') localized_time = pytz.utc.localize(par...
Convert iso8601 date string into UTC time. :param date_string: iso8601 formatted date string. :return: :class:`datetime.datetime`
def update_dimension(dimension,**kwargs): """ Update a dimension in the DB. Raises and exception if the dimension does not exist. The key is ALWAYS the name and the name itself is not modificable """ db_dimension = None dimension = JSONObject(dimension) try: db_dimens...
Update a dimension in the DB. Raises and exception if the dimension does not exist. The key is ALWAYS the name and the name itself is not modificable
def load_lists(keys=[], values=[], name='NT'): """ Map namedtuples given a pair of key, value lists. """ mapping = dict(zip(keys, values)) return mapper(mapping, _nt_name=name)
Map namedtuples given a pair of key, value lists.
def updateAARLocations(self): '''Update the locations of airspeed, altitude and Climb rate.''' # Locations self.airspeedText.set_position((self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0))) self.altitudeText.set_position((self.rightPos-(self.vertSize/10.0),...
Update the locations of airspeed, altitude and Climb rate.
def sample_random(self): """ Sample a point in a random leaf. """ if self.sampling_mode['volume']: # Choose a leaf weighted by volume, randomly if self.leafnode: return self.sample_bounds() else: split_ratio =...
Sample a point in a random leaf.
def RowWith(self, column, value): """Retrieves the first non header row with the column of the given value. Args: column: str, the name of the column to check. value: str, The value of the column to check. Returns: A Row() of the first row found, None otherwise. Raises: In...
Retrieves the first non header row with the column of the given value. Args: column: str, the name of the column to check. value: str, The value of the column to check. Returns: A Row() of the first row found, None otherwise. Raises: IndexError: The specified column does not exist...
def on(self, eventName, cb): """ Subscribe to an igv.js event. :param Name of the event. Currently only "locuschange" is supported. :type str :param cb - callback function taking a single argument. For the locuschange event this argument will contain a dictiona...
Subscribe to an igv.js event. :param Name of the event. Currently only "locuschange" is supported. :type str :param cb - callback function taking a single argument. For the locuschange event this argument will contain a dictionary of the form {chr, start, end} :type f...
def _split_addr(addr): """ Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP addres...
Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP address and port. :return: IP address...
def jsonify(obj, pretty=False): """ Turn a nested object into a (compressed) JSON string. Parameters ---------- obj : dict Any kind of dictionary structure. pretty : bool, optional Whether to format the resulting JSON in a more legible way ( default False). """ ...
Turn a nested object into a (compressed) JSON string. Parameters ---------- obj : dict Any kind of dictionary structure. pretty : bool, optional Whether to format the resulting JSON in a more legible way ( default False).
def avail_images(conn=None, call=None): ''' List available images for Azure ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) if not conn: conn =...
List available images for Azure
def __split_info(self, info_part, patternsname, patterns): """ Splits info from SAR parts into logical stuff :-) :param info_part: Part of SAR output we want to split into usable data :param patternsname: ??? :param patterns: ??? :return: ``List``-style info from SAR file...
Splits info from SAR parts into logical stuff :-) :param info_part: Part of SAR output we want to split into usable data :param patternsname: ??? :param patterns: ??? :return: ``List``-style info from SAR files, now finally \ completely parsed into meaningful data for further...
def resizeToContents(self): """ Resizes this toolbar based on the contents of its text. """ if self._toolbar.isVisible(): doc = self.document() h = doc.documentLayout().documentSize().height() offset = 34 ...
Resizes this toolbar based on the contents of its text.
def get_as_boolean_with_default(self, key, default_value): """ Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or d...
Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or default value if conversion is not supported.
def set_link(self, link,y=0,page=-1): "Set destination of internal link" if(y==-1): y=self.y if(page==-1): page=self.page self.links[link]=[page,y]
Set destination of internal link
def color(self, key): """ Returns the color value for the given key for this console. :param key | <unicode> :return <QtGui.QColor> """ if type(key) == int: key = self.LoggingMap.get(key, ('NotSet', ''))[0] name = n...
Returns the color value for the given key for this console. :param key | <unicode> :return <QtGui.QColor>
def get_times(): """ Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons). Returns: Times: gtimer timing data structure object. """ if f.root.stopped: return copy.deepcopy(f.root.times) else: t = timer() ...
Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons). Returns: Times: gtimer timing data structure object.
def frames(self): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage o...
Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage of the current frame.
def answer(self): """ Answer the phone call. :return: self (for chaining method calls) """ if self.ringing: self._gsmModem.write('ATA') self.ringing = False self.answered = True return self
Answer the phone call. :return: self (for chaining method calls)
def encode(self, payload): """ Encode payload """ try: return self.encoder.encode(payload) except Exception as exception: raise EncodeError(str(exception))
Encode payload
def get_farthest_node(self, topology_only=False): """ Returns the node's farthest descendant or ancestor node, and the distance to it. :argument False topology_only: If set to True, distance between nodes will be referred to the number of nodes between them. In other...
Returns the node's farthest descendant or ancestor node, and the distance to it. :argument False topology_only: If set to True, distance between nodes will be referred to the number of nodes between them. In other words, topological distance will be used instead of branch ...
def get_locations_list(self, lower_bound=0, upper_bound=None): """ Return the internal location list. Args: lower_bound: upper_bound: Returns: """ real_upper_bound = upper_bound if upper_bound is None: real_upper_bound = self....
Return the internal location list. Args: lower_bound: upper_bound: Returns:
def wait_on_hosts(hosts, max_attempts=3, sleep_time=1): ''' Wait for a container to have a State.Running value = true. :param hosts: list of service names taken from container.yml :param max_attempts: Max number of times to inspect the container and check State.Running :param sleep_time: Number of s...
Wait for a container to have a State.Running value = true. :param hosts: list of service names taken from container.yml :param max_attempts: Max number of times to inspect the container and check State.Running :param sleep_time: Number of seconds to wait between attempts. :return: dict of host:running p...
def _algo_fill_zi_if_missing(self, ro_rw_zi): """! @brief Create an empty zi section if it is missing""" s_ro, s_rw, s_zi = ro_rw_zi if s_rw is None: return ro_rw_zi if s_zi is not None: return ro_rw_zi s_zi = MemoryRange(start=(s_rw.start + s_rw.length), ...
! @brief Create an empty zi section if it is missing
def assert_independent(package, *packages): """ :param package: Python name of a module/package :param packages: Python names of modules/packages Make sure the `package` does not depend from the `packages`. """ assert packages, 'At least one package must be specified' import_package = 'from...
:param package: Python name of a module/package :param packages: Python names of modules/packages Make sure the `package` does not depend from the `packages`.
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): '''Set the media list associated with the player. @param p_mlp: media list player instance. @param p_mlist: list of media. ''' f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \ _Cfunction('libvlc_media_list_...
Set the media list associated with the player. @param p_mlp: media list player instance. @param p_mlist: list of media.
def solve(a, b): """ Find ``x`` such that ``a @ x = b`` for matrix ``a``. Args: a: Two-dimensional, square matrix/array of numbers and/or :class:`gvar.GVar`\s. b: One-dimensional vector/array of numbers and/or :class:`gvar.GVar`\s, or an array of such vectors. ...
Find ``x`` such that ``a @ x = b`` for matrix ``a``. Args: a: Two-dimensional, square matrix/array of numbers and/or :class:`gvar.GVar`\s. b: One-dimensional vector/array of numbers and/or :class:`gvar.GVar`\s, or an array of such vectors. Requires ``b.shape[0] =...
def get_translator (domain, directory, languages=None, translatorklass=Translator, fallback=False, fallbackklass=NullTranslator): """Search the appropriate GNUTranslations class.""" translator = gettext.translation(domain, localedir=directory, languages=langua...
Search the appropriate GNUTranslations class.
def copy(self): """ Returns a deep copy of this chart. """ chart = Chart.__new__(Chart) chart.date = self.date chart.pos = self.pos chart.hsys = self.hsys chart.objects = self.objects.copy() chart.houses = self.houses.copy() chart.angles = self.angles.copy...
Returns a deep copy of this chart.
def _set_offset_cpu(self, v, load=False): """ Setter method for offset_cpu, mapped from YANG variable /resource_monitor/cpu/offset_cpu (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_offset_cpu is considered as a private method. Backends looking to populate ...
Setter method for offset_cpu, mapped from YANG variable /resource_monitor/cpu/offset_cpu (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_offset_cpu is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._se...
def save(self, instance): """Save (create or update) the instance to the database :param instance: an instance of modeled data object """ cond = tinydb.where('original') == instance.original eid = self.update(instance, cond) if eid is None: return self.create...
Save (create or update) the instance to the database :param instance: an instance of modeled data object
def export_fem(self, arms=None, format='json', df_kwargs=None): """ Export the project's form to event mapping Parameters ---------- arms : list Limit exported form event mappings to these arm numbers format : (``'json'``), ``'csv'``, ``'xml'`` Re...
Export the project's form to event mapping Parameters ---------- arms : list Limit exported form event mappings to these arm numbers format : (``'json'``), ``'csv'``, ``'xml'`` Return the form event mappings in native objects, csv or xml, ``'df''`` wi...
def red(cls): "Make the text foreground color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_RED cls._set_text_attributes(wAttributes)
Make the text foreground color red.
def handle_command_exit_code(self, code): """ here we determine if we had an exception, or an error code that we weren't expecting to see. if we did, we create and raise an exception """ ca = self.call_args exc_class = get_exc_exit_code_would_raise(code, ca["ok_code"], ...
here we determine if we had an exception, or an error code that we weren't expecting to see. if we did, we create and raise an exception
def write_configuration(self, out, secret_attrs=False): """Generic configuration, may be overridden by type-specific version""" key_order = ['name', 'path', 'git_dir', 'doc_dir', 'assumed_doc_version', 'git_ssh', 'pkey', 'has_aliases', 'number of collections'] cd = self.get_...
Generic configuration, may be overridden by type-specific version
def zrlist(self, name_start, name_end, limit=10): """ Return a list of the top ``limit`` zset's name between ``name_start`` and ``name_end`` in descending order .. note:: The range is (``name_start``, ``name_end``]. The ``name_start`` isn't in the range, but ``name_end`` is. ...
Return a list of the top ``limit`` zset's name between ``name_start`` and ``name_end`` in descending order .. note:: The range is (``name_start``, ``name_end``]. The ``name_start`` isn't in the range, but ``name_end`` is. :param string name_start: The lower bound(not included) of zs...
def flush(self, auth, resource, options=None, defer=False): """ Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits. """ args = [resource] if options is not None...
Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits.
def load_repo_info_from_cache(i): """ Input: { repo_uoa - repo_uoa } Output: { return - return code = 0, if successful 16, if repo not found (may be warning) > 0, if error ...
Input: { repo_uoa - repo_uoa } Output: { return - return code = 0, if successful 16, if repo not found (may be warning) > 0, if error (error) - error text if retur...
def get_snmp_configuration(self): """ Gets the SNMP configuration for a logical interconnect. Returns: dict: SNMP configuration. """ uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH) return self._helper.do_get(uri)
Gets the SNMP configuration for a logical interconnect. Returns: dict: SNMP configuration.
def variant_filtration(call_file, ref_file, vrn_files, data, items): """Filter variant calls using Variant Quality Score Recalibration. Newer GATK with Haplotype calling has combined SNP/indel filtering. """ caller = data["config"]["algorithm"].get("variantcaller") if "gvcf" not in dd.get_tools_on(...
Filter variant calls using Variant Quality Score Recalibration. Newer GATK with Haplotype calling has combined SNP/indel filtering.
def _su_scripts_regex(self): """ :return: [compiled regex, function] """ sups = re.escape(''.join([k for k in self.superscripts.keys()])) subs = re.escape(''.join([k for k in self.subscripts.keys()])) # language=PythonRegExp su_regex = (r'\\([{su_}])|([{sub}]...
:return: [compiled regex, function]
def load(self, arguments): "Load the values from the a ServerConnection arguments" features = arguments[1:-1] list(map(self.load_feature, features))
Load the values from the a ServerConnection arguments