code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def group_exists(groupname): """Check if a group exists""" try: grp.getgrnam(groupname) group_exists = True except KeyError: group_exists = False return group_exists
Check if a group exists
Below is the the instruction that describes the task: ### Input: Check if a group exists ### Response: def group_exists(groupname): """Check if a group exists""" try: grp.getgrnam(groupname) group_exists = True except KeyError: group_exists = False return group_exists
def file_xext(filepath): """ Get the file extension wrt compression from the filename (is it tar or targz) :param str filepath: Path to the file :return str ext: Compression extension name """ ext = os.path.splitext(filepath)[1] if ext == '.gz': xext = os.path.splitext(os.path.splite...
Get the file extension wrt compression from the filename (is it tar or targz) :param str filepath: Path to the file :return str ext: Compression extension name
Below is the the instruction that describes the task: ### Input: Get the file extension wrt compression from the filename (is it tar or targz) :param str filepath: Path to the file :return str ext: Compression extension name ### Response: def file_xext(filepath): """ Get the file extension wrt comp...
def load(self, tableName='rasters', rasters=[]): ''' Accepts a list of paths to raster files to load into the database. Returns the ids of the rasters loaded successfully in the same order as the list passed in. ''' # Create table if necessary Base.metadata.create...
Accepts a list of paths to raster files to load into the database. Returns the ids of the rasters loaded successfully in the same order as the list passed in.
Below is the the instruction that describes the task: ### Input: Accepts a list of paths to raster files to load into the database. Returns the ids of the rasters loaded successfully in the same order as the list passed in. ### Response: def load(self, tableName='rasters', rasters=[]): ''' ...
def yml_load(stream, container, yml_fnc=yml_fnc, **options): """An wrapper of yaml.safe_load and yaml.load. :param stream: a file or file-like object to load YAML content :param container: callble to make a container object :return: Mapping object """ if options.get("ac_safe", False): ...
An wrapper of yaml.safe_load and yaml.load. :param stream: a file or file-like object to load YAML content :param container: callble to make a container object :return: Mapping object
Below is the the instruction that describes the task: ### Input: An wrapper of yaml.safe_load and yaml.load. :param stream: a file or file-like object to load YAML content :param container: callble to make a container object :return: Mapping object ### Response: def yml_load(stream, container, yml_fn...
def flatten_pages(self, pages, level=1): """Recursively flattens pages data structure into a one-dimensional data structure""" flattened = [] for page in pages: if type(page) is list: flattened.append( { 'f...
Recursively flattens pages data structure into a one-dimensional data structure
Below is the the instruction that describes the task: ### Input: Recursively flattens pages data structure into a one-dimensional data structure ### Response: def flatten_pages(self, pages, level=1): """Recursively flattens pages data structure into a one-dimensional data structure""" flattened = [...
def frame(self): """Convert the trades to transaction level details necessary for long/short accouting. :param trades: :param pricer: provides the interface to get premium for a specified quanity, price, and timestamp. :return: """ rows = [] pricer = self.pricer ...
Convert the trades to transaction level details necessary for long/short accouting. :param trades: :param pricer: provides the interface to get premium for a specified quanity, price, and timestamp. :return:
Below is the the instruction that describes the task: ### Input: Convert the trades to transaction level details necessary for long/short accouting. :param trades: :param pricer: provides the interface to get premium for a specified quanity, price, and timestamp. :return: ### Response: def...
def mset(self, *args): """Set multiple keys to multiple values or unpack dict to keys & values. :raises TypeError: if len of args is not event number :raises TypeError: if len of args equals 1 and it is not a dict """ data = args if len(args) == 1: if not isi...
Set multiple keys to multiple values or unpack dict to keys & values. :raises TypeError: if len of args is not event number :raises TypeError: if len of args equals 1 and it is not a dict
Below is the the instruction that describes the task: ### Input: Set multiple keys to multiple values or unpack dict to keys & values. :raises TypeError: if len of args is not event number :raises TypeError: if len of args equals 1 and it is not a dict ### Response: def mset(self, *args): ...
def play_uri(self, uri='', meta='', title='', start=True, force_radio=False): """Play a URI. Playing a URI will replace what was playing with the stream given by the URI. For some streams at least a title is required as metadata. This can be provided using the `meta` ar...
Play a URI. Playing a URI will replace what was playing with the stream given by the URI. For some streams at least a title is required as metadata. This can be provided using the `meta` argument or the `title` argument. If the `title` argument is provided minimal metadata will be gener...
Below is the the instruction that describes the task: ### Input: Play a URI. Playing a URI will replace what was playing with the stream given by the URI. For some streams at least a title is required as metadata. This can be provided using the `meta` argument or the `title` argument. ...
def retention_period(self): """Retrieve or set the retention period for items in the bucket. :rtype: int or ``NoneType`` :returns: number of seconds to retain items after upload or release from event-based lock, or ``None`` if the property is not set locally....
Retrieve or set the retention period for items in the bucket. :rtype: int or ``NoneType`` :returns: number of seconds to retain items after upload or release from event-based lock, or ``None`` if the property is not set locally.
Below is the the instruction that describes the task: ### Input: Retrieve or set the retention period for items in the bucket. :rtype: int or ``NoneType`` :returns: number of seconds to retain items after upload or release from event-based lock, or ``None`` if the property is not ...
def list_topics(self): """Get a client for all topic entities in the namespace. :rtype: list[~azure.servicebus.servicebus_client.TopicClient] :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. Example: .. literalinclude:: ../ex...
Get a client for all topic entities in the namespace. :rtype: list[~azure.servicebus.servicebus_client.TopicClient] :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. Example: .. literalinclude:: ../examples/test_examples.py ...
Below is the the instruction that describes the task: ### Input: Get a client for all topic entities in the namespace. :rtype: list[~azure.servicebus.servicebus_client.TopicClient] :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. Example: ...
def get_key_by_value(dictionary, search_value): """ searchs a value in a dicionary and returns the key of the first occurrence :param dictionary: dictionary to search in :param search_value: value to search for """ for key, value in dictionary.iteritems(): if value == search_value: ...
searchs a value in a dicionary and returns the key of the first occurrence :param dictionary: dictionary to search in :param search_value: value to search for
Below is the the instruction that describes the task: ### Input: searchs a value in a dicionary and returns the key of the first occurrence :param dictionary: dictionary to search in :param search_value: value to search for ### Response: def get_key_by_value(dictionary, search_value): """ searchs ...
def get_points(orig, dest, taillen): """Return a pair of lists of points for use making an arrow. The first list is the beginning and end point of the trunk of the arrow. The second list is the arrowhead. """ # Adjust the start and end points so they're on the first non-transparent pixel. # y...
Return a pair of lists of points for use making an arrow. The first list is the beginning and end point of the trunk of the arrow. The second list is the arrowhead.
Below is the the instruction that describes the task: ### Input: Return a pair of lists of points for use making an arrow. The first list is the beginning and end point of the trunk of the arrow. The second list is the arrowhead. ### Response: def get_points(orig, dest, taillen): """Return a pair of ...
def ck_portf_003(self): ''' 當日成交量,大於前三天的總成交量。(短線多空動能) ''' return self.a.stock_vol[-1] > sum(self.a.stock_vol[-4:-1]) and self.a.stock_vol[-1] > 1000*1000 and self.a.raw_data[-1] > 10
當日成交量,大於前三天的總成交量。(短線多空動能)
Below is the the instruction that describes the task: ### Input: 當日成交量,大於前三天的總成交量。(短線多空動能) ### Response: def ck_portf_003(self): ''' 當日成交量,大於前三天的總成交量。(短線多空動能) ''' return self.a.stock_vol[-1] > sum(self.a.stock_vol[-4:-1]) and self.a.stock_vol[-1] > 1000*1000 and self.a.raw_data[-1] > 10
def move(self, lr, fb, vv, va): """Makes the drone move (translate/rotate). Parameters: lr -- left-right tilt: float [-1..1] negative: left, positive: right fb -- front-back tilt: float [-1..1] negative: forwards, positive: backwards vv -- vertical speed: float [-1.....
Makes the drone move (translate/rotate). Parameters: lr -- left-right tilt: float [-1..1] negative: left, positive: right fb -- front-back tilt: float [-1..1] negative: forwards, positive: backwards vv -- vertical speed: float [-1..1] negative: go down, positive: rise ...
Below is the the instruction that describes the task: ### Input: Makes the drone move (translate/rotate). Parameters: lr -- left-right tilt: float [-1..1] negative: left, positive: right fb -- front-back tilt: float [-1..1] negative: forwards, positive: backwards vv -- v...
def filter_record(records): """ Filter records and remove items with missing or inconsistent fields Parameters ---------- records : list A list of Record objects Returns ------- records, ignored : (Record list, dict) A tuple of filtered records, and a dictionary counti...
Filter records and remove items with missing or inconsistent fields Parameters ---------- records : list A list of Record objects Returns ------- records, ignored : (Record list, dict) A tuple of filtered records, and a dictionary counting the missings fields
Below is the the instruction that describes the task: ### Input: Filter records and remove items with missing or inconsistent fields Parameters ---------- records : list A list of Record objects Returns ------- records, ignored : (Record list, dict) A tuple of filtered rec...
def _splitit(self, line, isheader): """Split each element of line to fit the column width Each element is turned into a list, result of the wrapping of the string to the desired width """ line_wrapped = [] for cell, width in zip(line, self._width): array = [...
Split each element of line to fit the column width Each element is turned into a list, result of the wrapping of the string to the desired width
Below is the the instruction that describes the task: ### Input: Split each element of line to fit the column width Each element is turned into a list, result of the wrapping of the string to the desired width ### Response: def _splitit(self, line, isheader): """Split each element of line ...
def mapper_from_prior_arguments(self, arguments): """ Creates a new model mapper from a dictionary mapping_matrix existing priors to new priors. Parameters ---------- arguments: {Prior: Prior} A dictionary mapping_matrix priors to priors Returns ----...
Creates a new model mapper from a dictionary mapping_matrix existing priors to new priors. Parameters ---------- arguments: {Prior: Prior} A dictionary mapping_matrix priors to priors Returns ------- model_mapper: ModelMapper A new model mapper w...
Below is the the instruction that describes the task: ### Input: Creates a new model mapper from a dictionary mapping_matrix existing priors to new priors. Parameters ---------- arguments: {Prior: Prior} A dictionary mapping_matrix priors to priors Returns -----...
def is_get_query_with_results(results): """ :param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise """ return results and EsConst.FOUND in results and results[EsConst.FOUND] and EsConst.FIELDS in results
:param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise
Below is the the instruction that describes the task: ### Input: :param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise ### Response: def is_get_query_with_results(results): """ :param results: the response from Elasticsearch ...
def corrgroups60(display=False): """ Correlated Groups 60 A simulated dataset with tight correlations among distinct groups of features. """ # set a constant seed old_seed = np.random.seed() np.random.seed(0) # generate dataset with known correlation N = 1000 M = 60 # set...
Correlated Groups 60 A simulated dataset with tight correlations among distinct groups of features.
Below is the the instruction that describes the task: ### Input: Correlated Groups 60 A simulated dataset with tight correlations among distinct groups of features. ### Response: def corrgroups60(display=False): """ Correlated Groups 60 A simulated dataset with tight correlations among distin...
def show(context, id, job_id): """show(context, id, job_id) Show an analytic. >>> dcictl analytic-show [OPTIONS] id :param string id: The id of the analytic :param string job-id: The job on which to show the analytic """ result = analytic.get(context, id, job_id=job_id) utils.format_...
show(context, id, job_id) Show an analytic. >>> dcictl analytic-show [OPTIONS] id :param string id: The id of the analytic :param string job-id: The job on which to show the analytic
Below is the the instruction that describes the task: ### Input: show(context, id, job_id) Show an analytic. >>> dcictl analytic-show [OPTIONS] id :param string id: The id of the analytic :param string job-id: The job on which to show the analytic ### Response: def show(context, id, job_id): ...
def get_scripts(self): """ Get the scripts at the path in sorted order as set in the module properties :return: a sorted list of scripts """ ret = list() for d in self.allpaths: scripts = filter(lambda x: x.startswith(self.prefix), os.listdir(d)) s...
Get the scripts at the path in sorted order as set in the module properties :return: a sorted list of scripts
Below is the the instruction that describes the task: ### Input: Get the scripts at the path in sorted order as set in the module properties :return: a sorted list of scripts ### Response: def get_scripts(self): """ Get the scripts at the path in sorted order as set in the module properties...
def _refresh(self): """Refreshes the cursor with more data from the server. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an error on the query. """ ...
Refreshes the cursor with more data from the server. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an error on the query.
Below is the the instruction that describes the task: ### Input: Refreshes the cursor with more data from the server. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an e...
def clean(self): """ Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either combining units to make compound words,...
Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either combining units to make compound words, combining units with the ...
Below is the the instruction that describes the task: ### Input: Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either...
def bic(self, X): """Bayesian information criterion for the current model fit and the proposed data Parameters ---------- X : array of shape(n_samples, n_dimensions) Returns ------- bic: float (the lower the better) """ return (-2 * self....
Bayesian information criterion for the current model fit and the proposed data Parameters ---------- X : array of shape(n_samples, n_dimensions) Returns ------- bic: float (the lower the better)
Below is the the instruction that describes the task: ### Input: Bayesian information criterion for the current model fit and the proposed data Parameters ---------- X : array of shape(n_samples, n_dimensions) Returns ------- bic: float (the lower the better...
def gid_to_group(gid): ''' Convert the group id to the group name on this system gid gid to convert to a group name CLI Example: .. code-block:: bash salt '*' file.gid_to_group 0 ''' try: gid = int(gid) except ValueError: # This is not an integer, mayb...
Convert the group id to the group name on this system gid gid to convert to a group name CLI Example: .. code-block:: bash salt '*' file.gid_to_group 0
Below is the the instruction that describes the task: ### Input: Convert the group id to the group name on this system gid gid to convert to a group name CLI Example: .. code-block:: bash salt '*' file.gid_to_group 0 ### Response: def gid_to_group(gid): ''' Convert the group...
def ks_distance(a, b): '''Get the Kolmogorov-Smirnov (KS) distance between two densities a and b.''' if len(a.shape) == 1: return np.max(np.abs(a.cumsum() - b.cumsum())) return np.max(np.abs(a.cumsum(axis=1) - b.cumsum(axis=1)), axis=1)
Get the Kolmogorov-Smirnov (KS) distance between two densities a and b.
Below is the the instruction that describes the task: ### Input: Get the Kolmogorov-Smirnov (KS) distance between two densities a and b. ### Response: def ks_distance(a, b): '''Get the Kolmogorov-Smirnov (KS) distance between two densities a and b.''' if len(a.shape) == 1: return np.max(np.abs(a.cu...
def update_dict(d, u=None, depth=-1, take_new=True, default_mapping_type=dict, prefer_update_type=False, copy=False): """ Recursively merge (union or update) dict-like objects (Mapping) to the specified depth. >>> update_dict({'k1': {'k2': 2}}, {'k1': {'k2': {'k3': 3}}, 'k4': 4}) == {'k1': {'k2': {'k3': 3}...
Recursively merge (union or update) dict-like objects (Mapping) to the specified depth. >>> update_dict({'k1': {'k2': 2}}, {'k1': {'k2': {'k3': 3}}, 'k4': 4}) == {'k1': {'k2': {'k3': 3}}, 'k4': 4} True >>> update_dict(OrderedDict([('k1', OrderedDict([('k2', 2)]))]), {'k1': {'k2': {'k3': 3}}, 'k4': 4}) ...
Below is the the instruction that describes the task: ### Input: Recursively merge (union or update) dict-like objects (Mapping) to the specified depth. >>> update_dict({'k1': {'k2': 2}}, {'k1': {'k2': {'k3': 3}}, 'k4': 4}) == {'k1': {'k2': {'k3': 3}}, 'k4': 4} True >>> update_dict(OrderedDict([('k1', ...
def find_playground_segments(segs): '''Finds playground time in a list of segments. Playground segments include the first 600s of every 6370s stride starting at GPS time 729273613. Parameters ---------- segs : segmentfilelist A segmentfilelist to find playground segments. ...
Finds playground time in a list of segments. Playground segments include the first 600s of every 6370s stride starting at GPS time 729273613. Parameters ---------- segs : segmentfilelist A segmentfilelist to find playground segments. Returns ------- outlist :...
Below is the the instruction that describes the task: ### Input: Finds playground time in a list of segments. Playground segments include the first 600s of every 6370s stride starting at GPS time 729273613. Parameters ---------- segs : segmentfilelist A segmentfilelist to f...
def get_bundle_list(self, href=None, limit=None, embed_items=None, embed_tracks=None, embed_metadata=None, embed_insights=None): """Get a list of available bundles. 'href' the relative href to the bundle list to retriev. If None, the first bundle ...
Get a list of available bundles. 'href' the relative href to the bundle list to retriev. If None, the first bundle list will be returned. 'limit' the maximum number of bundles to include in the result. 'embed_items' whether or not to expand the bundle data into the result. ...
Below is the the instruction that describes the task: ### Input: Get a list of available bundles. 'href' the relative href to the bundle list to retriev. If None, the first bundle list will be returned. 'limit' the maximum number of bundles to include in the result. 'embed_items' wh...
def copyto_file_object(self, query, file_object): """ Gets data from a table into a writable file object :param query: The "COPY { table_name [(column_name[, ...])] | (query) } TO STDOUT [WITH(option[,...])]" query to execute :type query: str :param f...
Gets data from a table into a writable file object :param query: The "COPY { table_name [(column_name[, ...])] | (query) } TO STDOUT [WITH(option[,...])]" query to execute :type query: str :param file_object: A file-like object. Normally t...
Below is the the instruction that describes the task: ### Input: Gets data from a table into a writable file object :param query: The "COPY { table_name [(column_name[, ...])] | (query) } TO STDOUT [WITH(option[,...])]" query to execute :type query: str :param fi...
def report(self, output_file=sys.stdout): """Report analysis outcome in human readable form.""" max_perf = self.results['max_perf'] if self._args and self._args.verbose >= 3: print('{}'.format(pformat(self.results)), file=output_file) if self._args and self._args.verbose >=...
Report analysis outcome in human readable form.
Below is the the instruction that describes the task: ### Input: Report analysis outcome in human readable form. ### Response: def report(self, output_file=sys.stdout): """Report analysis outcome in human readable form.""" max_perf = self.results['max_perf'] if self._args and self._args.ve...
def resource_group_present(name, location, managed_by=None, tags=None, connection_auth=None, **kwargs): ''' .. versionadded:: 2019.2.0 Ensure a resource group exists. :param name: Name of the resource group. :param location: The Azure location in which to create the resource group...
.. versionadded:: 2019.2.0 Ensure a resource group exists. :param name: Name of the resource group. :param location: The Azure location in which to create the resource group. This value cannot be updated once the resource group is created. :param managed_by: The ID of...
Below is the the instruction that describes the task: ### Input: .. versionadded:: 2019.2.0 Ensure a resource group exists. :param name: Name of the resource group. :param location: The Azure location in which to create the resource group. This value cannot be updated once the...
def total_items_purchased(context, category=None): ''' Returns the number of items purchased for this user (sum of quantities). The user will be either `context.user`, and `context.request.user` if the former is not defined. ''' return sum(i.quantity for i in items_purchased(context, category))
Returns the number of items purchased for this user (sum of quantities). The user will be either `context.user`, and `context.request.user` if the former is not defined.
Below is the the instruction that describes the task: ### Input: Returns the number of items purchased for this user (sum of quantities). The user will be either `context.user`, and `context.request.user` if the former is not defined. ### Response: def total_items_purchased(context, category=None): ''...
def delete(self, space_no, *args): """ delete tuple by primary key """ d = self.replyQueue.get() packet = RequestDelete(self.charset, self.errors, d._ipro_request_id, space_no, 0, *args) self.transport.write(bytes(packet)) return d.addCallback(self.handle_reply, s...
delete tuple by primary key
Below is the the instruction that describes the task: ### Input: delete tuple by primary key ### Response: def delete(self, space_no, *args): """ delete tuple by primary key """ d = self.replyQueue.get() packet = RequestDelete(self.charset, self.errors, d._ipro_request_id, s...
def __cluster_distance(self, cluster1, cluster2): """! @brief Calculate minimal distance between clusters using representative points. @param[in] cluster1 (cure_cluster): The first cluster. @param[in] cluster2 (cure_cluster): The second cluster. @return (...
! @brief Calculate minimal distance between clusters using representative points. @param[in] cluster1 (cure_cluster): The first cluster. @param[in] cluster2 (cure_cluster): The second cluster. @return (double) Euclidean distance between two clusters that is define...
Below is the the instruction that describes the task: ### Input: ! @brief Calculate minimal distance between clusters using representative points. @param[in] cluster1 (cure_cluster): The first cluster. @param[in] cluster2 (cure_cluster): The second cluster. @r...
def set_column_format(tree_column, model_column_index, format_str, cell_renderer=None): ''' Set the text of a cell according to a [format][1] string. [1]: https://docs.python.org/2/library/string.html#formatstrings Args: tree_column (gtk.TreeViewColumn) : Tree view to ap...
Set the text of a cell according to a [format][1] string. [1]: https://docs.python.org/2/library/string.html#formatstrings Args: tree_column (gtk.TreeViewColumn) : Tree view to append columns to. model_column_index (int) : Index in list store model corresponding to tree view colum...
Below is the the instruction that describes the task: ### Input: Set the text of a cell according to a [format][1] string. [1]: https://docs.python.org/2/library/string.html#formatstrings Args: tree_column (gtk.TreeViewColumn) : Tree view to append columns to. model_column_index (int) : I...
def encode(self): """Encode this record into binary, suitable for embedded into an update script. This function just adds the required record header and delegates all work to the subclass implementation of encode_contents(). Returns: bytearary: The binary version of the rec...
Encode this record into binary, suitable for embedded into an update script. This function just adds the required record header and delegates all work to the subclass implementation of encode_contents(). Returns: bytearary: The binary version of the record that could be parsed via ...
Below is the the instruction that describes the task: ### Input: Encode this record into binary, suitable for embedded into an update script. This function just adds the required record header and delegates all work to the subclass implementation of encode_contents(). Returns: ...
def get_asymmetric_double_well_data(nstep, x0=0., nskip=1, dt=0.01, kT=10.0, mass=1.0, damping=1.0): r"""wrapper for the asymmetric double well generator""" adw = AsymmetricDoubleWell(dt, kT, mass=mass, damping=damping) return adw.sample(x0, nstep, nskip=nskip)
r"""wrapper for the asymmetric double well generator
Below is the the instruction that describes the task: ### Input: r"""wrapper for the asymmetric double well generator ### Response: def get_asymmetric_double_well_data(nstep, x0=0., nskip=1, dt=0.01, kT=10.0, mass=1.0, damping=1.0): r"""wrapper for the asymmetric double well generator""" adw = AsymmetricDo...
def main(args): """Main function which runs worker.""" title = '## Starting evaluation of round {0} ##'.format(args.round_name) logging.info('\n' + '#' * len(title) + '\n' + '#' * len(title) + '\n' + '##' + ' ' * (len(title)-2) + '##' + '\n' + title + '\...
Main function which runs worker.
Below is the the instruction that describes the task: ### Input: Main function which runs worker. ### Response: def main(args): """Main function which runs worker.""" title = '## Starting evaluation of round {0} ##'.format(args.round_name) logging.info('\n' + '#' * len(title) + '\n' ...
def fetch(self): """ Fetch a ExportInstance :returns: Fetched ExportInstance :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=par...
Fetch a ExportInstance :returns: Fetched ExportInstance :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance
Below is the the instruction that describes the task: ### Input: Fetch a ExportInstance :returns: Fetched ExportInstance :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance ### Response: def fetch(self): """ Fetch a ExportInstance :returns: Fetched ExportInstanc...
def leaves_not_empty(self): """ Return the list of leaves not empty in the tree rooted at this node, in DFS order. :rtype: list of :class:`~aeneas.tree.Tree` """ return [n for n in self.dfs if ((n.is_leaf) and (not n.is_empty))]
Return the list of leaves not empty in the tree rooted at this node, in DFS order. :rtype: list of :class:`~aeneas.tree.Tree`
Below is the the instruction that describes the task: ### Input: Return the list of leaves not empty in the tree rooted at this node, in DFS order. :rtype: list of :class:`~aeneas.tree.Tree` ### Response: def leaves_not_empty(self): """ Return the list of leaves not empty ...
def HKY85(mu=1.0, pi=None, kappa=0.1, **kwargs): """ Hasegawa, Kishino and Yano 1985 model. Allows different concentrations of the nucleotides (as in F81) + distinguishes between transition/transversionsubstitutions (similar to K80). Link: Hasegawa, Kishino, Yano (1985), J. Mol. Evol. 22 (2): 160–17...
Hasegawa, Kishino and Yano 1985 model. Allows different concentrations of the nucleotides (as in F81) + distinguishes between transition/transversionsubstitutions (similar to K80). Link: Hasegawa, Kishino, Yano (1985), J. Mol. Evol. 22 (2): 160–174. doi:10.1007/BF02101694 Current implementation of the ...
Below is the the instruction that describes the task: ### Input: Hasegawa, Kishino and Yano 1985 model. Allows different concentrations of the nucleotides (as in F81) + distinguishes between transition/transversionsubstitutions (similar to K80). Link: Hasegawa, Kishino, Yano (1985), J. Mol. Evol. 22 (2)...
def values(self): """Will only return the current values """ self.expired() values = [] for key in self._dict.keys(): try: value = self._dict[key].get() values.append(value) except: continue return va...
Will only return the current values
Below is the the instruction that describes the task: ### Input: Will only return the current values ### Response: def values(self): """Will only return the current values """ self.expired() values = [] for key in self._dict.keys(): try: value = s...
def __configure_timeline(self, *args): """Function from ScrolledFrame, adapted for the _timeline""" # Resize the canvas scrollregion to fit the entire frame (size_x, size_y) = (self._timeline.winfo_reqwidth(), self._timeline.winfo_reqheight()) self._canvas_scroll.config(scrollregion="0 0...
Function from ScrolledFrame, adapted for the _timeline
Below is the the instruction that describes the task: ### Input: Function from ScrolledFrame, adapted for the _timeline ### Response: def __configure_timeline(self, *args): """Function from ScrolledFrame, adapted for the _timeline""" # Resize the canvas scrollregion to fit the entire frame ...
def is_descriptor_class(desc, include_abstract=False): r"""Check calculatable descriptor class or not. Returns: bool """ return ( isinstance(desc, type) and issubclass(desc, Descriptor) and (True if include_abstract else not inspect.isabstract(desc)) )
r"""Check calculatable descriptor class or not. Returns: bool
Below is the the instruction that describes the task: ### Input: r"""Check calculatable descriptor class or not. Returns: bool ### Response: def is_descriptor_class(desc, include_abstract=False): r"""Check calculatable descriptor class or not. Returns: bool """ return ( ...
def main(argv): """ Main program. @return: none """ global g_log_base_dir global g_airline_java global g_milsongs_java global g_airline_python global g_milsongs_python global g_jenkins_url global g_airline_py_tail global g_milsongs_py_tail global g_airline_java_tail ...
Main program. @return: none
Below is the the instruction that describes the task: ### Input: Main program. @return: none ### Response: def main(argv): """ Main program. @return: none """ global g_log_base_dir global g_airline_java global g_milsongs_java global g_airline_python global g_milsongs_pytho...
def canonify(self): """ Transform self to an equivalent canonical form: delete optdict keys with False value, move optdict keys with True value to optlist, stringify other values. """ for k, v in self.optdict.items(): if v == False: self.optdi...
Transform self to an equivalent canonical form: delete optdict keys with False value, move optdict keys with True value to optlist, stringify other values.
Below is the the instruction that describes the task: ### Input: Transform self to an equivalent canonical form: delete optdict keys with False value, move optdict keys with True value to optlist, stringify other values. ### Response: def canonify(self): """ Transform self to an equ...
def parse_paragraph(document, par): """Parse paragraph element. Some other elements could be found inside of paragraph element (math, links). """ paragraph = doc.Paragraph() paragraph.document = document for elem in par: if elem.tag == _name('{{{w}}}pPr'): parse_paragraph_...
Parse paragraph element. Some other elements could be found inside of paragraph element (math, links).
Below is the the instruction that describes the task: ### Input: Parse paragraph element. Some other elements could be found inside of paragraph element (math, links). ### Response: def parse_paragraph(document, par): """Parse paragraph element. Some other elements could be found inside of paragraph ...
def alias_function(function, class_name): """Create a RedditContentObject function mapped to a BaseReddit function. The BaseReddit classes define the majority of the API's functions. The first argument for many of these functions is the RedditContentObject that they operate on. This factory returns fun...
Create a RedditContentObject function mapped to a BaseReddit function. The BaseReddit classes define the majority of the API's functions. The first argument for many of these functions is the RedditContentObject that they operate on. This factory returns functions appropriate to be called on a RedditCo...
Below is the the instruction that describes the task: ### Input: Create a RedditContentObject function mapped to a BaseReddit function. The BaseReddit classes define the majority of the API's functions. The first argument for many of these functions is the RedditContentObject that they operate on. This...
def _raise_response_exceptions(response): """Raise specific errors on some status codes.""" if not response.ok and 'www-authenticate' in response.headers: msg = response.headers['www-authenticate'] if 'insufficient_scope' in msg: raise OAuthInsufficientScope('insufficient_scope', res...
Raise specific errors on some status codes.
Below is the the instruction that describes the task: ### Input: Raise specific errors on some status codes. ### Response: def _raise_response_exceptions(response): """Raise specific errors on some status codes.""" if not response.ok and 'www-authenticate' in response.headers: msg = response.header...
def add_hashed_value(self, hash_value, store_key): """Add hashed value to the index. :param hash_value: The hashed value to be added to the index :type hash_value: str :param store_key: The key for the document in the store :type store_key: object """ if self._u...
Add hashed value to the index. :param hash_value: The hashed value to be added to the index :type hash_value: str :param store_key: The key for the document in the store :type store_key: object
Below is the the instruction that describes the task: ### Input: Add hashed value to the index. :param hash_value: The hashed value to be added to the index :type hash_value: str :param store_key: The key for the document in the store :type store_key: object ### Response: def add_h...
def step_impl12(context, runs): """Check called apps / files. :param runs: expected number of records. :param context: test context. """ executor_ = context.fuzz_executor stats = executor_.stats count = stats.cumulated_counts() assert count == runs, "VERIFY: Number of recorded runs."
Check called apps / files. :param runs: expected number of records. :param context: test context.
Below is the the instruction that describes the task: ### Input: Check called apps / files. :param runs: expected number of records. :param context: test context. ### Response: def step_impl12(context, runs): """Check called apps / files. :param runs: expected number of records. :param contex...
def cosh(x): """ Hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.cosh(x._mcpts) return UncertainFunction(mcpts) else: return np.cosh(x)
Hyperbolic cosine
Below is the the instruction that describes the task: ### Input: Hyperbolic cosine ### Response: def cosh(x): """ Hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.cosh(x._mcpts) return UncertainFunction(mcpts) else: return np.cosh(x)
def majmin(reference_labels, estimated_labels): """Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_...
Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab')...
Below is the the instruction that describes the task: ### Input: Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals,...
def loci2migrate(name, locifile, popdict, mindict=1): """ A function to build an input file for the program migrate from an ipyrad .loci file, and a dictionary grouping Samples into populations. Parameters: ----------- name: (str) The name prefix for the migrate formatted output file...
A function to build an input file for the program migrate from an ipyrad .loci file, and a dictionary grouping Samples into populations. Parameters: ----------- name: (str) The name prefix for the migrate formatted output file. locifile: (str) The path to the .loci file produced by ...
Below is the the instruction that describes the task: ### Input: A function to build an input file for the program migrate from an ipyrad .loci file, and a dictionary grouping Samples into populations. Parameters: ----------- name: (str) The name prefix for the migrate formatted output fil...
def start_of_month(dt, d_years=0, d_months=0): """ Given a date, return a date first day of the month. @param dt: The date to base the return value upon. @param d_years: Specify a delta in years to apply to date. @param d_months: Specify a delta in months to apply to date. @see http://...
Given a date, return a date first day of the month. @param dt: The date to base the return value upon. @param d_years: Specify a delta in years to apply to date. @param d_months: Specify a delta in months to apply to date. @see http://code.activestate.com/recipes/476197-first-last-day-of-the-m...
Below is the the instruction that describes the task: ### Input: Given a date, return a date first day of the month. @param dt: The date to base the return value upon. @param d_years: Specify a delta in years to apply to date. @param d_months: Specify a delta in months to apply to date. @s...
def _format_output(account, data): """Format data to get a readable output""" data['account'] = account output = ("""Ebox data for account: {d[account]} Balance ======= Balance: {d[balance]:.2f} $ Usage ===== Usage: {d[usage]:.2f} % Before offpeak ============== Download: {d[before_offpeak_down...
Format data to get a readable output
Below is the the instruction that describes the task: ### Input: Format data to get a readable output ### Response: def _format_output(account, data): """Format data to get a readable output""" data['account'] = account output = ("""Ebox data for account: {d[account]} Balance ======= Balance: {d[...
def get_transcript_lengths(ensembl, transcript_ids): """ finds the protein length for ensembl transcript IDs for a gene Args: ensembl: EnsemblRequest object to request sequences and data from the ensembl REST API transcript_ids: list of transcript IDs for a single gene ...
finds the protein length for ensembl transcript IDs for a gene Args: ensembl: EnsemblRequest object to request sequences and data from the ensembl REST API transcript_ids: list of transcript IDs for a single gene Returns: dictionary of lengths (in amino acids), inde...
Below is the the instruction that describes the task: ### Input: finds the protein length for ensembl transcript IDs for a gene Args: ensembl: EnsemblRequest object to request sequences and data from the ensembl REST API transcript_ids: list of transcript IDs for a single gene ...
def generate(env): """Add Builders and construction variables for zip to an Environment.""" try: bld = env['BUILDERS']['Zip'] except KeyError: bld = ZipBuilder env['BUILDERS']['Zip'] = bld env['ZIP'] = 'zip' env['ZIPFLAGS'] = SCons.Util.CLVar('') env['ZIPCOM'] ...
Add Builders and construction variables for zip to an Environment.
Below is the the instruction that describes the task: ### Input: Add Builders and construction variables for zip to an Environment. ### Response: def generate(env): """Add Builders and construction variables for zip to an Environment.""" try: bld = env['BUILDERS']['Zip'] except KeyError: ...
def get_config_files(): """ Return the application configuration files. Return a list of configuration files describing the apps supported by Mackup. The files return are absolute full path to those files. e.g. /usr/lib/mackup/applications/bash.cfg Only one config file ...
Return the application configuration files. Return a list of configuration files describing the apps supported by Mackup. The files return are absolute full path to those files. e.g. /usr/lib/mackup/applications/bash.cfg Only one config file per application should be returned, custom c...
Below is the the instruction that describes the task: ### Input: Return the application configuration files. Return a list of configuration files describing the apps supported by Mackup. The files return are absolute full path to those files. e.g. /usr/lib/mackup/applications/bash.cfg ...
def load_calibration(self): """Load factory calibration data from device.""" registers = self.i2c_read_register(0xAA, 22) ( self.cal['AC1'], self.cal['AC2'], self.cal['AC3'], self.cal['AC4'], self.cal['AC5'], self.cal['AC6']...
Load factory calibration data from device.
Below is the the instruction that describes the task: ### Input: Load factory calibration data from device. ### Response: def load_calibration(self): """Load factory calibration data from device.""" registers = self.i2c_read_register(0xAA, 22) ( self.cal['AC1'], self...
def path(self): """Concatenation of ``origin`` and ``relpath``, as a string. Used in stack traces and other debugging places. """ if self.origin: return six.text_type(self.origin / self.relpath) else: return six.text_type(self.relpath)
Concatenation of ``origin`` and ``relpath``, as a string. Used in stack traces and other debugging places.
Below is the the instruction that describes the task: ### Input: Concatenation of ``origin`` and ``relpath``, as a string. Used in stack traces and other debugging places. ### Response: def path(self): """Concatenation of ``origin`` and ``relpath``, as a string. Used in stack traces and o...
async def prompt(self, dialog_id: str, options) -> DialogTurnResult: """ Helper function to simplify formatting the options for calling a prompt dialog. This helper will take a `PromptOptions` argument and then call. :param dialog_id: ID of the prompt to start. :param options: Co...
Helper function to simplify formatting the options for calling a prompt dialog. This helper will take a `PromptOptions` argument and then call. :param dialog_id: ID of the prompt to start. :param options: Contains a Prompt, potentially a RetryPrompt and if using ChoicePrompt, Choices. :r...
Below is the the instruction that describes the task: ### Input: Helper function to simplify formatting the options for calling a prompt dialog. This helper will take a `PromptOptions` argument and then call. :param dialog_id: ID of the prompt to start. :param options: Contains a Prompt, pot...
def get_artifact(suppress_status=False, nexus_url=sample_nexus_url, timeout_sec=600, overwrite=True, username=None, password=None, **kwargs): """Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of t...
Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of the Nexus Server :param timeout_sec: (int) Number of seconds to wait before timing out the artifact retrieval. :param overwrite: (bool) True overwrites...
Below is the the instruction that describes the task: ### Input: Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of the Nexus Server :param timeout_sec: (int) Number of seconds to wait before timing out...
def setup_prometheus(self, registry=None): """Setup Prometheus.""" kwargs = {} if registry: kwargs["registry"] = registry self.metrics = PrometheusMetrics(self.app, **kwargs) try: version = pkg_resources.require(self.app.name)[0].version except pkg...
Setup Prometheus.
Below is the the instruction that describes the task: ### Input: Setup Prometheus. ### Response: def setup_prometheus(self, registry=None): """Setup Prometheus.""" kwargs = {} if registry: kwargs["registry"] = registry self.metrics = PrometheusMetrics(self.app, **kwargs)...
def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, Me...
Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none.
Below is the the instruction that describes the task: ### Input: Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ### Response: def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: t...
def remove_if_present(self, *tagnames): """ Remove all child elements having tagname in *tagnames*. """ for tagname in tagnames: element = self.find(qn(tagname)) if element is not None: self.remove(element)
Remove all child elements having tagname in *tagnames*.
Below is the the instruction that describes the task: ### Input: Remove all child elements having tagname in *tagnames*. ### Response: def remove_if_present(self, *tagnames): """ Remove all child elements having tagname in *tagnames*. """ for tagname in tagnames: element...
def empty(self, duration): '''Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` obser...
Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` observation.
Below is the the instruction that describes the task: ### Input: Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisti...
def toggle_pac(self): """Enable and disable PAC options.""" if Pac is not None: pac_on = self.pac['pac_on'].get_value() self.pac['prep'].setEnabled(pac_on) self.pac['box_metric'].setEnabled(pac_on) self.pac['box_complex'].setEnabled(pac_on) sel...
Enable and disable PAC options.
Below is the the instruction that describes the task: ### Input: Enable and disable PAC options. ### Response: def toggle_pac(self): """Enable and disable PAC options.""" if Pac is not None: pac_on = self.pac['pac_on'].get_value() self.pac['prep'].setEnabled(pac_on) ...
def unprefix(self, path): """Remove the self.prefix_ (if present) from a path or list of paths""" path = self.strip(path) if isinstance(path, six.string_types): path = path[len(self.prefix_):] if path.startswith(self.prefix_) else path path = path[1:] if path.startswith(s...
Remove the self.prefix_ (if present) from a path or list of paths
Below is the the instruction that describes the task: ### Input: Remove the self.prefix_ (if present) from a path or list of paths ### Response: def unprefix(self, path): """Remove the self.prefix_ (if present) from a path or list of paths""" path = self.strip(path) if isinstance(path, six....
def instance(self): """Content instance of the wrapped object """ if self._instance is None: logger.debug("SuperModel::instance: *Wakup object*") self._instance = api.get_object(self.brain) return self._instance
Content instance of the wrapped object
Below is the the instruction that describes the task: ### Input: Content instance of the wrapped object ### Response: def instance(self): """Content instance of the wrapped object """ if self._instance is None: logger.debug("SuperModel::instance: *Wakup object*") sel...
def start_playing(self, on_exit, args): """ Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. """ # log.d...
Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen.
Below is the the instruction that describes the task: ### Input: Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. ### Response: def...
def deprecated(message=DEPRECATION_MESSAGE, logger=None): """ This decorator will simply print warning before running decoratee. So, presumably, you want to use it with console-based commands. :return: Decorator for the function. """ if logger is None: logger = default_logger def _d...
This decorator will simply print warning before running decoratee. So, presumably, you want to use it with console-based commands. :return: Decorator for the function.
Below is the the instruction that describes the task: ### Input: This decorator will simply print warning before running decoratee. So, presumably, you want to use it with console-based commands. :return: Decorator for the function. ### Response: def deprecated(message=DEPRECATION_MESSAGE, logger=None): ...
def buttons_pressed(self, channel=1): """ Returns list of currently pressed buttons. Note that the sensor can only identify up to two buttons pressed at once. """ self._ensure_mode(self.MODE_IR_REMOTE) channel = self._normalize_channel(channel) return self._BUTTO...
Returns list of currently pressed buttons. Note that the sensor can only identify up to two buttons pressed at once.
Below is the the instruction that describes the task: ### Input: Returns list of currently pressed buttons. Note that the sensor can only identify up to two buttons pressed at once. ### Response: def buttons_pressed(self, channel=1): """ Returns list of currently pressed buttons. ...
def _load_ngram(name): """Dynamically import the python module with the ngram defined as a dictionary. Since bigger ngrams are large files its wasteful to always statically import them if they're not used. """ module = importlib.import_module('lantern.analysis.english_ngrams.{}'.format(name)) return...
Dynamically import the python module with the ngram defined as a dictionary. Since bigger ngrams are large files its wasteful to always statically import them if they're not used.
Below is the the instruction that describes the task: ### Input: Dynamically import the python module with the ngram defined as a dictionary. Since bigger ngrams are large files its wasteful to always statically import them if they're not used. ### Response: def _load_ngram(name): """Dynamically import the...
def get_poll_options(tweet): """ Get the text in the options of a poll as a list - If there is no poll in the Tweet, return an empty list - If the Tweet is in activity-streams format, raise 'NotAvailableError' Args: tweet (Tweet or dict): A Tweet object or dictionary Returns: l...
Get the text in the options of a poll as a list - If there is no poll in the Tweet, return an empty list - If the Tweet is in activity-streams format, raise 'NotAvailableError' Args: tweet (Tweet or dict): A Tweet object or dictionary Returns: list: list of strings, or, in the case whe...
Below is the the instruction that describes the task: ### Input: Get the text in the options of a poll as a list - If there is no poll in the Tweet, return an empty list - If the Tweet is in activity-streams format, raise 'NotAvailableError' Args: tweet (Tweet or dict): A Tweet object or dictio...
def Evaluate(self, client_obj): """Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluation. Raises: ValueErr...
Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluation. Raises: ValueError: The match mode is of unknown value.
Below is the the instruction that describes the task: ### Input: Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluatio...
def get_notebook_names(self, path=''): """List all notebook names in the notebook dir and path.""" path = path.strip('/') spec = {'path': path, 'type': 'notebook'} fields = {'name': 1} notebooks = list(self._connect_collection(self.notebook_collection).find(spec,f...
List all notebook names in the notebook dir and path.
Below is the the instruction that describes the task: ### Input: List all notebook names in the notebook dir and path. ### Response: def get_notebook_names(self, path=''): """List all notebook names in the notebook dir and path.""" path = path.strip('/') spec = {'path': path, ...
def _determine_heterogen_chain_type(residue_types): '''We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH. ''' residue_type_id_le...
We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH.
Below is the the instruction that describes the task: ### Input: We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH. ### Response: def _determine_he...
def _adium_status(status, message): """ Updates status and message for Adium IM application. `status` Status type. `message` Status message. """ # map status code code = ADIUM_CODE_MAP[status] # get message if not message: default_messages =...
Updates status and message for Adium IM application. `status` Status type. `message` Status message.
Below is the the instruction that describes the task: ### Input: Updates status and message for Adium IM application. `status` Status type. `message` Status message. ### Response: def _adium_status(status, message): """ Updates status and message for Adium IM applicatio...
def get_withdrawal(self, withdrawal_id, **params): """https://developers.coinbase.com/api/v2#show-a-withdrawal""" return self.api_client.get_withdrawal(self.id, withdrawal_id, **params)
https://developers.coinbase.com/api/v2#show-a-withdrawal
Below is the the instruction that describes the task: ### Input: https://developers.coinbase.com/api/v2#show-a-withdrawal ### Response: def get_withdrawal(self, withdrawal_id, **params): """https://developers.coinbase.com/api/v2#show-a-withdrawal""" return self.api_client.get_withdrawal(self.id, wi...
def construct_rest_of_world(self, excluded, name=None, fp=None, geom=True): """Construct rest-of-world geometry and optionally write to filepath ``fp``. Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids).""" for location in excluded...
Construct rest-of-world geometry and optionally write to filepath ``fp``. Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids).
Below is the the instruction that describes the task: ### Input: Construct rest-of-world geometry and optionally write to filepath ``fp``. Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids). ### Response: def construct_rest_of_world(self, excl...
def _factorize_array(values, na_sentinel=-1, size_hint=None, na_value=None): """Factorize an array-like to labels and uniques. This doesn't do any coercion of types or unboxing before factorization. Parameters ---------- values : ndarray na_sentinel : int, default -1 s...
Factorize an array-like to labels and uniques. This doesn't do any coercion of types or unboxing before factorization. Parameters ---------- values : ndarray na_sentinel : int, default -1 size_hint : int, optional Passsed through to the hashtable's 'get_labels' method na_value : ob...
Below is the the instruction that describes the task: ### Input: Factorize an array-like to labels and uniques. This doesn't do any coercion of types or unboxing before factorization. Parameters ---------- values : ndarray na_sentinel : int, default -1 size_hint : int, optional Pas...
def moving_average_smooth(t, y, dy, span=None, cv=True, t_out=None, span_out=None, period=None): """Perform a moving-average smooth of the data Parameters ---------- t, y, dy : array_like time, value, and error in value of the input data span : array_like t...
Perform a moving-average smooth of the data Parameters ---------- t, y, dy : array_like time, value, and error in value of the input data span : array_like the integer spans of the data cv : boolean (default=True) if True, treat the problem as a cross-validation, i.e. don't ...
Below is the the instruction that describes the task: ### Input: Perform a moving-average smooth of the data Parameters ---------- t, y, dy : array_like time, value, and error in value of the input data span : array_like the integer spans of the data cv : boolean (default=True) ...
def hms(segundos): # TODO: mover para util.py """ Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> hms(3601) ...
Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> hms(3601) (1, 0, 1) >>> hms(3661) (1, 1, 1) ...
Below is the the instruction that describes the task: ### Input: Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> h...
def init_info_window_adapter(self): """ Initialize the info window adapter. Should only be done if one of the markers defines a custom view. """ adapter = self.adapter if adapter: return #: Already initialized adapter = GoogleMap.InfoWindowAdapter() ...
Initialize the info window adapter. Should only be done if one of the markers defines a custom view.
Below is the the instruction that describes the task: ### Input: Initialize the info window adapter. Should only be done if one of the markers defines a custom view. ### Response: def init_info_window_adapter(self): """ Initialize the info window adapter. Should only be done if one of the...
def _get_auth(self): """Return the authorization data for an SNMP request. :returns: A :class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData` object. """ if self.version == SNMP_V3: # Handling auth/encryption credentials is not (yet) supported. ...
Return the authorization data for an SNMP request. :returns: A :class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData` object.
Below is the the instruction that describes the task: ### Input: Return the authorization data for an SNMP request. :returns: A :class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData` object. ### Response: def _get_auth(self): """Return the authorization data for an SN...
def migrate_autoload_details(autoload_details, shell_name, shell_type): """ Migrate autoload details. Add namespace for attributes :param autoload_details: :param shell_name: :param shell_type: :return: """ mapping = {} for resource in autoload_details.resources: resource.model...
Migrate autoload details. Add namespace for attributes :param autoload_details: :param shell_name: :param shell_type: :return:
Below is the the instruction that describes the task: ### Input: Migrate autoload details. Add namespace for attributes :param autoload_details: :param shell_name: :param shell_type: :return: ### Response: def migrate_autoload_details(autoload_details, shell_name, shell_type): """ Migrate auto...
def add_properties(self, names, methods): """Returns a view of self with the given methods added as properties. From: <http://stackoverflow.com/a/2954373/1366472>. """ cls = type(self) cls = type(cls.__name__, (cls,), dict(cls.__dict__)) if isinstance(names, string_types...
Returns a view of self with the given methods added as properties. From: <http://stackoverflow.com/a/2954373/1366472>.
Below is the the instruction that describes the task: ### Input: Returns a view of self with the given methods added as properties. From: <http://stackoverflow.com/a/2954373/1366472>. ### Response: def add_properties(self, names, methods): """Returns a view of self with the given methods added as ...
def storage_soc_sorted(network, filename = None): """ Plots the soc (state-pf-charge) of extendable storages Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : path to folder """ sbatt = n...
Plots the soc (state-pf-charge) of extendable storages Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : path to folder
Below is the the instruction that describes the task: ### Input: Plots the soc (state-pf-charge) of extendable storages Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : path to folder ### Response: def ...
def get_session_identifiers(cls, folder=None, inputfile=None): """ Retrieve the list of session identifiers contained in the data on the folder or the inputfile. For this plugin, it returns the list of excel sheet available. :kwarg folder: the path to the folder containing the files to ...
Retrieve the list of session identifiers contained in the data on the folder or the inputfile. For this plugin, it returns the list of excel sheet available. :kwarg folder: the path to the folder containing the files to check. This folder may contain sub-folders. :kwarg inpu...
Below is the the instruction that describes the task: ### Input: Retrieve the list of session identifiers contained in the data on the folder or the inputfile. For this plugin, it returns the list of excel sheet available. :kwarg folder: the path to the folder containing the files to ...
def facet_by(self, column): """ Faceting creates new TableFu instances with rows matching each possible value. """ faceted_spreadsheets = {} for row in self.rows: if row[column]: col = row[column].value if faceted_spreadsheets.h...
Faceting creates new TableFu instances with rows matching each possible value.
Below is the the instruction that describes the task: ### Input: Faceting creates new TableFu instances with rows matching each possible value. ### Response: def facet_by(self, column): """ Faceting creates new TableFu instances with rows matching each possible value. """ ...
def parse_line(p_string): """ Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occurrences of contexts, projects o...
Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occurrences of contexts, projects or tags. Returns an dictionary...
Below is the the instruction that describes the task: ### Input: Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occu...
def getInputSourceHandle(self, pchInputSourcePath): """Returns a handle for any path in the input system. E.g. /user/hand/right""" fn = self.function_table.getInputSourceHandle pHandle = VRInputValueHandle_t() result = fn(pchInputSourcePath, byref(pHandle)) return result, pHandl...
Returns a handle for any path in the input system. E.g. /user/hand/right
Below is the the instruction that describes the task: ### Input: Returns a handle for any path in the input system. E.g. /user/hand/right ### Response: def getInputSourceHandle(self, pchInputSourcePath): """Returns a handle for any path in the input system. E.g. /user/hand/right""" fn = self.funct...
def get(self, key): """Return set of descendants of node named `key` in `target_graph`. Returns from cached dict if exists, otherwise compute over the graph and cache results in the dict. """ if key not in self: self[key] = set(get_descendants(self._target_graph, key...
Return set of descendants of node named `key` in `target_graph`. Returns from cached dict if exists, otherwise compute over the graph and cache results in the dict.
Below is the the instruction that describes the task: ### Input: Return set of descendants of node named `key` in `target_graph`. Returns from cached dict if exists, otherwise compute over the graph and cache results in the dict. ### Response: def get(self, key): """Return set of descendan...
def monitor(stop, offset=0, limit=10, city='Dresden', *, raw=False): """ VVO Online Monitor (GET http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do) :param stop: Name of Stop :param offset: Minimum time of arrival :param limit: Count of returned results :param city: Name of City ...
VVO Online Monitor (GET http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do) :param stop: Name of Stop :param offset: Minimum time of arrival :param limit: Count of returned results :param city: Name of City :param raw: Return raw response :return: Dict of stops
Below is the the instruction that describes the task: ### Input: VVO Online Monitor (GET http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do) :param stop: Name of Stop :param offset: Minimum time of arrival :param limit: Count of returned results :param city: Name of City :param raw: ...
def _handleDescriptionFromFileOption(filename, outDir, usageStr, hsVersion, claDescriptionTemplateFile): """ Parses and validates the --descriptionFromFile option and executes the request Parameters: ----------------------------------------------------------------------- filena...
Parses and validates the --descriptionFromFile option and executes the request Parameters: ----------------------------------------------------------------------- filename: File from which we'll extract description JSON outDir: where to place generated experiment files usageStr: program usage strin...
Below is the the instruction that describes the task: ### Input: Parses and validates the --descriptionFromFile option and executes the request Parameters: ----------------------------------------------------------------------- filename: File from which we'll extract description JSON outDir: where ...
def compact_hdf5_file(filename, name=None, index=None, keep_backup=True): """Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/u...
Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/usersguide/utilities.html#ptrepackdescr) Currently only supported under Linux...
Below is the the instruction that describes the task: ### Input: Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/usersguide/ut...
def is_pleasant(self): """ Return ``True`` if all the leaves in the subtree rooted at this node are at the same level. :rtype: bool """ levels = sorted([n.level for n in self.leaves]) return levels[0] == levels[-1]
Return ``True`` if all the leaves in the subtree rooted at this node are at the same level. :rtype: bool
Below is the the instruction that describes the task: ### Input: Return ``True`` if all the leaves in the subtree rooted at this node are at the same level. :rtype: bool ### Response: def is_pleasant(self): """ Return ``True`` if all the leaves in the subtree rooted...
def dump_openssl_private_key(private_key, passphrase): """ Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that ...
Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that does not support PKCS#8 private keys. The encryption provided by PK...
Below is the the instruction that describes the task: ### Input: Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that ...